/* == jquery mousewheel plugin == version: 3.1.12, license: mit license (mit) */ ! function(a) {
"function" == typeof define && define.amd ? define(["jquery"], a) : "object" == typeof exports ? module.exports = a : a(jquery)
}(function(a) {
function b(b) {
var g = b || window.event,
h = i.call(arguments, 1),
j = 0,
l = 0,
m = 0,
n = 0,
o = 0,
p = 0;
if(b = a.event.fix(g), b.type = "mousewheel", "detail" in g && (m = -1 * g.detail), "wheeldelta" in g && (m = g.wheeldelta), "wheeldeltay" in g && (m = g.wheeldeltay), "wheeldeltax" in g && (l = -1 * g.wheeldeltax), "axis" in g && g.axis === g.horizontal_axis && (l = -1 * m, m = 0), j = 0 === m ? l : m, "deltay" in g && (m = -1 * g.deltay, j = m), "deltax" in g && (l = g.deltax, 0 === m && (j = -1 * l)), 0 !== m || 0 !== l) {
if(1 === g.deltamode) {
var q = a.data(this, "mousewheel-line-height");
j *= q, m *= q, l *= q
} else if(2 === g.deltamode) {
var r = a.data(this, "mousewheel-page-height");
j *= r, m *= r, l *= r
}
if(n = math.max(math.abs(m), math.abs(l)), (!f || f > n) && (f = n, d(g, n) && (f /= 40)), d(g, n) && (j /= 40, l /= 40, m /= 40), j = math[j >= 1 ? "floor" : "ceil"](j / f), l = math[l >= 1 ? "floor" : "ceil"](l / f), m = math[m >= 1 ? "floor" : "ceil"](m / f), k.settings.normalizeoffset && this.getboundingclientrect) {
var s = this.getboundingclientrect();
o = b.clientx - s.left, p = b.clienty - s.top
}
return b.deltax = l, b.deltay = m, b.deltafactor = f, b.offsetx = o, b.offsety = p, b.deltamode = 0, h.unshift(b, j, l, m), e && cleartimeout(e), e = settimeout(c, 200), (a.event.dispatch || a.event.handle).apply(this, h)
}
}
function c() {
f = null
}
function d(a, b) {
return k.settings.adjustolddeltas && "mousewheel" === a.type && b % 120 === 0
}
var e, f, g = ["wheel", "mousewheel", "dommousescroll", "mozmousepixelscroll"],
h = "onwheel" in document || document.documentmode >= 9 ? ["wheel"] : ["mousewheel", "dommousescroll", "mozmousepixelscroll"],
i = array.prototype.slice;
if(a.event.fixhooks)
for(var j = g.length; j;) a.event.fixhooks[g[--j]] = a.event.mousehooks;
var k = a.event.special.mousewheel = {
version: "3.1.12",
setup: function() {
if(this.addeventlistener)
for(var c = h.length; c;) this.addeventlistener(h[--c], b, !1);
else this.onmousewheel = b;
a.data(this, "mousewheel-line-height", k.getlineheight(this)), a.data(this, "mousewheel-page-height", k.getpageheight(this))
},
teardown: function() {
if(this.removeeventlistener)
for(var c = h.length; c;) this.removeeventlistener(h[--c], b, !1);
else this.onmousewheel = null;
a.removedata(this, "mousewheel-line-height"), a.removedata(this, "mousewheel-page-height")
},
getlineheight: function(b) {
var c = a(b),
d = c["offsetparent" in a.fn ? "offsetparent" : "parent"]();
return d.length || (d = a("body")), parseint(d.css("fontsize"), 10) || parseint(c.css("fontsize"), 10) || 16
},
getpageheight: function(b) {
return a(b).height()
},
settings: {
adjustolddeltas: !0,
normalizeoffset: !0
}
};
a.fn.extend({
mousewheel: function(a) {
return a ? this.bind("mousewheel", a) : this.trigger("mousewheel")
},
unmousewheel: function(a) {
return this.unbind("mousewheel", a)
}
})
});
/* == malihu jquery custom scrollbar plugin == version: 3.0.7, license: mit license (mit) */
! function(e, t, a) {
! function(t) {
var o = "function" == typeof define && define.amd,
n = "https:" == a.location.protocol ? "https:" : "http:",
i = "cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";
o || e.event.special.mousewheel || e("head").append(decodeuri("%3cscript src=" + n + "//" + i + "%3e%3c/script%3e")), t()
}(function() {
var o, n = "mcustomscrollbar",
i = "mcs",
r = ".mcustomscrollbar",
l = {
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,
advanced: {
autoscrollonfocus: "input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",
updateoncontentresize: !0,
updateonimageload: !0
},
theme: "light",
callbacks: {
ontotalscrolloffset: 0,
ontotalscrollbackoffset: 0,
alwaystriggeroffsets: !0
}
},
s = 0,
c = {},
d = t.attachevent && !t.addeventlistener ? 1 : 0,
u = !1,
f = ["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"],
h = {
init: function(t) {
var t = e.extend(!0, {}, l, t),
a = m.call(this);
if(t.live) {
var o = t.liveselector || this.selector || r,
n = e(o);
if("off" === t.live) return void g(o);
c[o] = settimeout(function() {
n.mcustomscrollbar(t), "once" === t.live && n.length && g(o)
}, 500)
} else g(o);
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" : v(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 = x(t.scrollbuttons.scrolltype), p(t), e(a).each(function() {
var a = e(this);
if(!a.data(i)) {
a.data(i, {
idx: ++s,
opt: t,
scrollratio: {
y: null,
x: null
},
overflowed: null,
contentreset: {
y: null,
x: null
},
bindevents: !1,
tweenrunning: !1,
sequential: {},
langdir: a.css("direction"),
cboffsets: null,
trigger: null
});
var o = a.data(i),
n = o.opt,
r = a.data("mcs-axis"),
l = a.data("mcs-scrollbar-position"),
c = a.data("mcs-theme");
r && (n.axis = r), l && (n.scrollbarposition = l), c && (n.theme = c, p(n)), _.call(this), e("#mcsb_" + o.idx + "_container img:not(." + f[2] + ")").addclass(f[2]), h.update.call(null, a)
}
})
},
update: function(t, a) {
var o = t || m.call(this);
return e(o).each(function() {
var t = e(this);
if(t.data(i)) {
var o = t.data(i),
n = o.opt,
r = e("#mcsb_" + o.idx + "_container"),
l = [e("#mcsb_" + o.idx + "_dragger_vertical"), e("#mcsb_" + o.idx + "_dragger_horizontal")];
if(!r.length) return;
o.tweenrunning && q(t), t.hasclass(f[3]) && t.removeclass(f[3]), t.hasclass(f[4]) && t.removeclass(f[4]), c.call(this), w.call(this), "y" === n.axis || n.advanced.autoexpandhorizontalscroll || r.css("width", s(r.children())), o.overflowed = k.call(this), r.call(this), n.autodraggerlength && y.call(this), b.call(this), o.call(this);
var s = [math.abs(r[0].offsettop), math.abs(r[0].offsetleft)];
"x" !== n.axis && (o.overflowed[0] ? l[0].height() > l[0].parent().height() ? m.call(this) : (g(t, s[0].tostring(), {
dir: "y",
dur: 0,
overwrite: "none"
}), o.contentreset.y = null) : (m.call(this), "y" === n.axis ? i.call(this) : "yx" === n.axis && o.overflowed[1] && g(t, s[1].tostring(), {
dir: "x",
dur: 0,
overwrite: "none"
}))), "y" !== n.axis && (o.overflowed[1] ? l[1].width() > l[1].parent().width() ? m.call(this) : (g(t, s[1].tostring(), {
dir: "x",
dur: 0,
overwrite: "none"
}), o.contentreset.x = null) : (m.call(this), "x" === n.axis ? i.call(this) : "yx" === n.axis && o.overflowed[0] && g(t, s[0].tostring(), {
dir: "y",
dur: 0,
overwrite: "none"
}))), a && o && (2 === a && n.callbacks.onimageload && "function" == typeof n.callbacks.onimageload ? n.callbacks.onimageload.call(this) : 3 === a && n.callbacks.onselectorchange && "function" == typeof n.callbacks.onselectorchange ? n.callbacks.onselectorchange.call(this) : n.callbacks.onupdate && "function" == typeof n.callbacks.onupdate && n.callbacks.onupdate.call(this)), n.call(this)
}
})
},
scrollto: function(t, a) {
if("undefined" != typeof t && null != t) {
var o = m.call(this);
return e(o).each(function() {
var o = e(this);
if(o.data(i)) {
var n = o.data(i),
r = n.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, a),
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] *= n.scrollratio.y, c[1] *= n.scrollratio.x), s.dur = d, settimeout(function() {
null !== c[0] && "undefined" != typeof c[0] && "x" !== r.axis && n.overflowed[0] && (s.dir = "y", s.overwrite = "all", g(o, c[0].tostring(), s)), null !== c[1] && "undefined" != typeof c[1] && "y" !== r.axis && n.overflowed[1] && (s.dir = "x", s.overwrite = "none", g(o, c[1].tostring(), s))
}, s.timeout)
}
})
}
},
stop: function() {
var t = m.call(this);
return e(t).each(function() {
var t = e(this);
t.data(i) && q(t)
})
},
disable: function(t) {
var a = m.call(this);
return e(a).each(function() {
var a = e(this);
if(a.data(i)) {
{
a.data(i)
}
n.call(this, "remove"), i.call(this), t && m.call(this), r.call(this, !0), a.addclass(f[3])
}
})
},
destroy: function() {
var t = m.call(this);
return e(t).each(function() {
var a = e(this);
if(a.data(i)) {
var o = a.data(i),
r = o.opt,
l = e("#mcsb_" + o.idx),
s = e("#mcsb_" + o.idx + "_container"),
c = e(".mcsb_" + o.idx + "_scrollbar");
r.live && g(r.liveselector || e(t).selector), n.call(this, "remove"), i.call(this), m.call(this), a.removedata(i), $(this, "mcs"), c.remove(), s.find("img." + f[2]).removeclass(f[2]), l.replacewith(s.contents()), a.removeclass(n + " _" + i + "_" + o.idx + " " + f[6] + " " + f[7] + " " + f[5] + " " + f[3]).addclass(f[4])
}
})
}
},
m = function() {
return "object" != typeof e(this) || e(this).length < 1 ? r : this
},
p = function(t) {
var a = ["rounded", "rounded-dark", "rounded-dots", "rounded-dots-dark"],
o = ["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, a) > -1 ? !1 : t.autodraggerlength, t.autoexpandscrollbar = e.inarray(t.theme, o) > -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
},
g = function(e) {
c[e] && (cleartimeout(c[e]), $(c, e))
},
v = function(e) {
return "yx" === e || "xy" === e || "auto" === e ? "yx" : "x" === e || "horizontal" === e ? "x" : "y"
},
x = function(e) {
return "stepped" === e || "pixels" === e || "step" === e || "click" === e ? "stepped" : "stepless"
},
_ = function() {
var t = e(this),
a = t.data(i),
o = a.opt,
r = o.autoexpandscrollbar ? " " + f[1] + "_expand" : "",
l = ["
", ""],
s = "yx" === o.axis ? "mcsb_vertical_horizontal" : "x" === o.axis ? "mcsb_horizontal" : "mcsb_vertical",
c = "yx" === o.axis ? l[0] + l[1] : "x" === o.axis ? l[1] : l[0],
d = "yx" === o.axis ? "" : "",
u = o.autohidescrollbar ? " " + f[6] : "",
h = "x" !== o.axis && "rtl" === a.langdir ? " " + f[7] : "";
o.setwidth && t.css("width", o.setwidth), o.setheight && t.css("height", o.setheight), o.setleft = "y" !== o.axis && "rtl" === a.langdir ? "989999px" : o.setleft, t.addclass(n + " _" + i + "_" + a.idx + u + h).wrapinner("");
var m = e("#mcsb_" + a.idx),
p = e("#mcsb_" + a.idx + "_container");
"y" === o.axis || o.advanced.autoexpandhorizontalscroll || p.css("width", s(p.children())), "outside" === o.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(d)), b.call(this);
var g = [e("#mcsb_" + a.idx + "_dragger_vertical"), e("#mcsb_" + a.idx + "_dragger_horizontal")];
g[0].css("min-height", g[0].height()), g[1].css("min-width", g[1].width())
},
s = function(t) {
return math.max.apply(math, t.map(function() {
return e(this).outerwidth(!0)
}).get())
},
w = function() {
var t = e(this),
a = t.data(i),
o = a.opt,
n = e("#mcsb_" + a.idx + "_container");
o.advanced.autoexpandhorizontalscroll && "y" !== o.axis && n.css({
position: "absolute",
width: "auto"
}).wrap("").css({
width: math.ceil(n[0].getboundingclientrect().right + .4) - math.floor(n[0].getboundingclientrect().left),
position: "relative"
}).unwrap()
},
b = function() {
var t = e(this),
a = t.data(i),
o = a.opt,
n = e(".mcsb_" + a.idx + "_scrollbar:first"),
r = at(o.scrollbuttons.tabindex) ? "tabindex='" + o.scrollbuttons.tabindex + "'" : "",
l = ["", "", "", ""],
s = ["x" === o.axis ? l[2] : l[0], "x" === o.axis ? l[3] : l[1], l[2], l[3]];
o.scrollbuttons.enable && n.prepend(s[0]).append(s[1]).next(".mcsb_scrolltools").prepend(s[2]).append(s[3])
},
c = function() {
var t = e(this),
a = t.data(i),
o = e("#mcsb_" + a.idx),
n = t.css("max-height") || "none",
r = -1 !== n.indexof("%"),
l = t.css("box-sizing");
if("none" !== n) {
var s = r ? t.parent().height() * parseint(n) / 100 : parseint(n);
"border-box" === l && (s -= t.innerheight() - t.height() + (t.outerheight() - t.innerheight())), o.css("max-height", math.round(s))
}
},
y = function() {
var t = e(this),
a = t.data(i),
o = e("#mcsb_" + a.idx),
n = e("#mcsb_" + a.idx + "_container"),
r = [e("#mcsb_" + a.idx + "_dragger_vertical"), e("#mcsb_" + a.idx + "_dragger_horizontal")],
l = [o.height() / n.outerheight(!1), o.width() / n.outerwidth(!1)],
s = [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())],
c = d && s[1] < s[0] ? s[0] : s[1],
u = d && s[3] < s[2] ? s[2] : s[3];
r[0].css({
height: c,
"max-height": r[0].parent().height() - 10
}).find(".mcsb_dragger_bar").css({
"line-height": s[0] + "px"
}), r[1].css({
width: u,
"max-width": r[1].parent().width() - 10
})
},
b = function() {
var t = e(this),
a = t.data(i),
o = e("#mcsb_" + a.idx),
n = e("#mcsb_" + a.idx + "_container"),
r = [e("#mcsb_" + a.idx + "_dragger_vertical"), e("#mcsb_" + a.idx + "_dragger_horizontal")],
l = [n.outerheight(!1) - o.height(), n.outerwidth(!1) - o.width()],
s = [l[0] / (r[0].parent().height() - r[0].height()), l[1] / (r[1].parent().width() - r[1].width())];
a.scrollratio = {
y: s[0],
x: s[1]
}
},
t = function(e, t, a) {
var o = a ? f[0] + "_expanded" : "",
n = e.closest(".mcsb_scrolltools");
"active" === t ? (e.toggleclass(f[0] + " " + o), n.toggleclass(f[1]), e[0]._draggable = e[0]._draggable ? 0 : 1) : e[0]._draggable || ("hide" === t ? (e.removeclass(f[0]), n.removeclass(f[1])) : (e.addclass(f[0]), n.addclass(f[1])))
},
k = function() {
var t = e(this),
a = t.data(i),
o = e("#mcsb_" + a.idx),
n = e("#mcsb_" + a.idx + "_container"),
r = null == a.overflowed ? n.height() : n.outerheight(!1),
l = null == a.overflowed ? n.width() : n.outerwidth(!1);
return [r > o.height(), l > o.width()]
},
m = function() {
var t = e(this),
a = t.data(i),
o = a.opt,
n = e("#mcsb_" + a.idx),
r = e("#mcsb_" + a.idx + "_container"),
l = [e("#mcsb_" + a.idx + "_dragger_vertical"), e("#mcsb_" + a.idx + "_dragger_horizontal")];
if(q(t), ("x" !== o.axis && !a.overflowed[0] || "y" === o.axis && a.overflowed[0]) && (l[0].add(r).css("top", 0), g(t, "_resety")), "y" !== o.axis && !a.overflowed[1] || "x" === o.axis && a.overflowed[1]) {
var s = dx = 0;
"rtl" === a.langdir && (s = n.width() - r.outerwidth(!1), dx = math.abs(s / a.scrollratio.x)), r.css("left", s), l[1].css("left", dx), g(t, "_resetx")
}
},
o = function() {
function t() {
r = settimeout(function() {
e.event.special.mousewheel ? (cleartimeout(r), a.call(a[0])) : t()
}, 100)
}
var a = e(this),
o = a.data(i),
n = o.opt;
if(!o.bindevents) {
if(d.call(this), n.contenttouchscroll && l.call(this), w.call(this), n.mousewheel.enable) {
var r;
t()
}
z.call(this), u.call(this), n.advanced.autoscrollonfocus && h.call(this), n.scrollbuttons.enable && f.call(this), n.keyboard.enable && q.call(this), o.bindevents = !0
}
},
i = function() {
var t = e(this),
o = t.data(i),
n = o.opt,
r = i + "_" + o.idx,
l = ".mcsb_" + o.idx + "_scrollbar",
s = e("#mcsb_" + o.idx + ",#mcsb_" + o.idx + "_container,#mcsb_" + o.idx + "_container_wrapper," + l + " ." + f[12] + ",#mcsb_" + o.idx + "_dragger_vertical,#mcsb_" + o.idx + "_dragger_horizontal," + l + ">a"),
c = e("#mcsb_" + o.idx + "_container");
n.advanced.releasedraggableselectors && s.add(e(n.advanced.releasedraggableselectors)), o.bindevents && (e(a).unbind("." + r), s.each(function() {
e(this).unbind("." + r)
}), cleartimeout(t[0]._focustimeout), $(t[0], "_focustimeout"), cleartimeout(o.sequential.step), $(o.sequential, "step"), cleartimeout(c[0].oncompletetimeout), $(c[0], "oncompletetimeout"), o.bindevents = !1)
},
r = function(t) {
var a = e(this),
o = a.data(i),
n = o.opt,
r = e("#mcsb_" + o.idx + "_container_wrapper"),
l = r.length ? r : e("#mcsb_" + o.idx + "_container"),
s = [e("#mcsb_" + o.idx + "_scrollbar_vertical"), e("#mcsb_" + o.idx + "_scrollbar_horizontal")],
c = [s[0].find(".mcsb_dragger"), s[1].find(".mcsb_dragger")];
"x" !== n.axis && (o.overflowed[0] && !t ? (s[0].add(c[0]).add(s[0].children("a")).css("display", "block"), l.removeclass(f[8] + " " + f[10])) : (n.alwaysshowscrollbar ? (2 !== n.alwaysshowscrollbar && c[0].css("display", "none"), l.removeclass(f[10])) : (s[0].css("display", "none"), l.addclass(f[10])), l.addclass(f[8]))), "y" !== n.axis && (o.overflowed[1] && !t ? (s[1].add(c[1]).add(s[1].children("a")).css("display", "block"), l.removeclass(f[9] + " " + f[11])) : (n.alwaysshowscrollbar ? (2 !== n.alwaysshowscrollbar && c[1].css("display", "none"), l.removeclass(f[11])) : (s[1].css("display", "none"), l.addclass(f[11])), l.addclass(f[9]))), o.overflowed[0] || o.overflowed[1] ? a.removeclass(f[5]) : a.addclass(f[5])
},
e = function(e) {
var t = e.type;
switch(t) {
case "pointerdown":
case "mspointerdown":
case "pointermove":
case "mspointermove":
case "pointerup":
case "mspointerup":
return [e.originalevent.pagey, e.originalevent.pagex, !1];
case "touchstart":
case "touchmove":
case "touchend":
var a = e.originalevent.touches[0] || e.originalevent.changedtouches[0],
o = e.originalevent.touches.length || e.originalevent.changedtouches.length;
return [a.pagey, a.pagex, o > 1];
default:
return [e.pagey, e.pagex, !1]
}
},
d = function() {
function t(e) {
var t = p.find("iframe");
if(t.length) {
var a = e ? "auto" : "none";
t.css("pointer-events", a)
}
}
function o(e, t, a, o) {
if(p[0].idletimer = f.scrollinertia < 233 ? 250 : 0, n.attr("id") === m[1]) var i = "x",
r = (n[0].offsetleft - t + o) * c.scrollratio.x;
else var i = "y",
r = (n[0].offsettop - e + a) * c.scrollratio.y;
g(s, r.tostring(), {
dir: i,
drag: !0
})
}
var n, r, l, s = e(this),
c = s.data(i),
f = c.opt,
h = i + "_" + c.idx,
m = ["mcsb_" + c.idx + "_dragger_vertical", "mcsb_" + c.idx + "_dragger_horizontal"],
p = e("#mcsb_" + c.idx + "_container"),
g = e("#" + m[0] + ",#" + m[1]),
v = f.advanced.releasedraggableselectors ? g.add(e(f.advanced.releasedraggableselectors)) : g;
g.bind("mousedown." + h + " touchstart." + h + " pointerdown." + h + " mspointerdown." + h, function(o) {
if(o.stopimmediatepropagation(), o.preventdefault(), et(o)) {
u = !0, d && (a.onselectstart = function() {
return !1
}), t(!1), q(s), n = e(this);
var i = n.offset(),
c = e(o)[0] - i.top,
h = e(o)[1] - i.left,
m = n.height() + i.top,
p = n.width() + i.left;
m > c && c > 0 && p > h && h > 0 && (r = c, l = h), t(n, "active", f.autoexpandscrollbar)
}
}).bind("touchmove." + h, function(e) {
e.stopimmediatepropagation(), e.preventdefault();
var t = n.offset(),
a = e(e)[0] - t.top,
i = e(e)[1] - t.left;
o(r, l, a, i)
}), e(a).bind("mousemove." + h + " pointermove." + h + " mspointermove." + h, function(e) {
if(n) {
var t = n.offset(),
a = e(e)[0] - t.top,
i = e(e)[1] - t.left;
if(r === a) return;
o(r, l, a, i)
}
}).add(v).bind("mouseup." + h + " touchend." + h + " pointerup." + h + " mspointerup." + h, function() {
n && (t(n, "active", f.autoexpandscrollbar), n = null), u = !1, d && (a.onselectstart = null), t(!0)
})
},
l = function() {
function t(e, t) {
var a = [1.5 * t, 2 * t, t / 1.5, t / 2];
return e > 90 ? t > 4 ? a[0] : a[3] : e > 60 ? t > 3 ? a[3] : a[2] : e > 30 ? t > 8 ? a[1] : t > 6 ? a[0] : t > 4 ? t : a[2] : t > 8 ? t : a[3]
}
function a(e, t, a, o, n, i) {
e && g(_, e.tostring(), {
dur: t,
scrolleasing: a,
dir: o,
overwrite: n,
drag: i
})
}
var n, r, l, s, c, d, f, h, m, p, g, v, x, _ = e(this),
s = _.data(i),
w = s.opt,
b = i + "_" + s.idx,
c = e("#mcsb_" + s.idx),
y = e("#mcsb_" + s.idx + "_container"),
b = [e("#mcsb_" + s.idx + "_dragger_vertical"), e("#mcsb_" + s.idx + "_dragger_horizontal")],
t = [],
k = [],
m = 0,
o = "yx" === w.axis ? "none" : "all",
i = [];
y.bind("touchstart." + b + " pointerdown." + b + " mspointerdown." + b, function(e) {
if(!tt(e) || u || e(e)[2]) return void(o = 0);
o = 1, v = 0, x = 0;
var t = y.offset();
n = e(e)[0] - t.top, r = e(e)[1] - t.left, i = [e(e)[0], e(e)[1]]
}).bind("touchmove." + b + " pointermove." + b + " mspointermove." + b, function(e) {
if(tt(e) && !u && !e(e)[2] && (e.stopimmediatepropagation(), !x || v)) {
d = k();
var t = c.offset(),
o = e(e)[0] - t.top,
i = e(e)[1] - t.left,
l = "mcslinearout";
if(t.push(o), k.push(i), i[2] = math.abs(e(e)[0] - i[0]), i[3] = math.abs(e(e)[1] - i[1]), s.overflowed[0]) var s = b[0].parent().height() - b[0].height(),
c = n - o > 0 && o - n > -(s * s.scrollratio.y) && (2 * i[3] < i[2] || "yx" === w.axis);
if(s.overflowed[1]) var f = b[1].parent().width() - b[1].width(),
h = r - i > 0 && i - r > -(f * s.scrollratio.x) && (2 * i[2] < i[3] || "yx" === w.axis);
c || h ? (e.preventdefault(), v = 1) : x = 1, p = "yx" === w.axis ? [n - o, r - i] : "x" === w.axis ? [null, r - i] : [n - o, null], y[0].idletimer = 250, s.overflowed[0] && a(p[0], m, l, "y", "all", !0), s.overflowed[1] && a(p[1], m, l, "x", o, !0)
}
}), c.bind("touchstart." + b + " pointerdown." + b + " mspointerdown." + b, function(e) {
if(!tt(e) || u || e(e)[2]) return void(o = 0);
o = 1, e.stopimmediatepropagation(), q(_), c = k();
var t = c.offset();
l = e(e)[0] - t.top, s = e(e)[1] - t.left, t = [], k = []
}).bind("touchend." + b + " pointerup." + b + " mspointerup." + b, function(e) {
if(tt(e) && !u && !e(e)[2]) {
e.stopimmediatepropagation(), v = 0, x = 0, f = k();
var o = c.offset(),
n = e(e)[0] - o.top,
i = e(e)[1] - o.left;
if(!(f - d > 30)) {
m = 1e3 / (f - c);
var r = "mcseaseout",
_ = 2.5 > m,
b = _ ? [t[t.length - 2], k[k.length - 2]] : [0, 0];
h = _ ? [n - b[0], i - b[1]] : [n - l, i - s];
var b = [math.abs(h[0]), math.abs(h[1])];
m = _ ? [math.abs(h[0] / 4), math.abs(h[1] / 4)] : [m, m];
var m = [math.abs(y[0].offsettop) - h[0] * t(b[0] / m[0], m[0]), math.abs(y[0].offsetleft) - h[1] * t(b[1] / m[1], m[1])];
p = "yx" === w.axis ? [m[0], m[1]] : "x" === w.axis ? [null, m[1]] : [m[0], null], g = [4 * b[0] + w.scrollinertia, 4 * b[1] + w.scrollinertia];
var i = parseint(w.contenttouchscroll) || 0;
p[0] = b[0] > i ? p[0] : 0, p[1] = b[1] > i ? p[1] : 0, s.overflowed[0] && a(p[0], g[0], r, "y", o, !1), s.overflowed[1] && a(p[1], g[1], r, "x", o, !1)
}
}
})
},
w = function() {
function n() {
return t.getselection ? t.getselection().tostring() : a.selection && "control" != a.selection.type ? a.selection.createrange().text : 0
}
function r(e, t, a) {
f.type = a && l ? "stepped" : "stepless", f.scrollamount = 10, j(s, e, t, "mcslinearout", a ? 60 : null)
}
var l, s = e(this),
c = s.data(i),
d = c.opt,
f = c.sequential,
h = i + "_" + c.idx,
m = e("#mcsb_" + c.idx + "_container"),
p = m.parent();
m.bind("mousedown." + h, function() {
o || l || (l = 1, u = !0)
}).add(a).bind("mousemove." + h, function(e) {
if(!o && l && n()) {
var t = m.offset(),
a = e(e)[0] - t.top + m[0].offsettop,
i = e(e)[1] - t.left + m[0].offsetleft;
a > 0 && a < p.height() && i > 0 && i < p.width() ? f.step && r("off", null, "stepped") : ("x" !== d.axis && c.overflowed[0] && (0 > a ? r("on", 38) : a > p.height() && r("on", 40)), "y" !== d.axis && c.overflowed[1] && (0 > i ? r("on", 37) : i > p.width() && r("on", 39)))
}
}).bind("mouseup." + h, function() {
o || (l && (l = 0, r("off", null)), u = !1)
})
},
a = function() {
function t(e) {
var t = null;
try {
var a = e.contentdocument || e.contentwindow.document;
t = a.body.innerhtml
} catch(o) {}
return null !== t
}
var a = e(this),
o = a.data(i);
if(o) {
var n = o.opt,
r = i + "_" + o.idx,
l = e("#mcsb_" + o.idx),
s = [e("#mcsb_" + o.idx + "_dragger_vertical"), e("#mcsb_" + o.idx + "_dragger_horizontal")],
c = e("#mcsb_" + o.idx + "_container").find("iframe"),
u = l;
c.length && c.each(function() {
var a = this;
t(a) && (u = u.add(e(a).contents().find("body")))
}), u.bind("mousewheel." + r, function(t, i) {
if(q(a), !p(a, t.target)) {
var r = "auto" !== n.mousewheel.deltafactor ? parseint(n.mousewheel.deltafactor) : d && t.deltafactor < 100 ? 100 : t.deltafactor || 100;
if("x" === n.axis || "x" === n.mousewheel.axis) var c = "x",
u = [math.round(r * o.scrollratio.x), parseint(n.mousewheel.scrollamount)],
f = "auto" !== n.mousewheel.scrollamount ? u[1] : u[0] >= l.width() ? .9 * l.width() : u[0],
h = math.abs(e("#mcsb_" + o.idx + "_container")[0].offsetleft),
m = s[1][0].offsetleft,
p = s[1].parent().width() - s[1].width(),
g = t.deltax || t.deltay || i;
else var c = "y",
u = [math.round(r * o.scrollratio.y), parseint(n.mousewheel.scrollamount)],
f = "auto" !== n.mousewheel.scrollamount ? u[1] : u[0] >= l.height() ? .9 * l.height() : u[0],
h = math.abs(e("#mcsb_" + o.idx + "_container")[0].offsettop),
m = s[0][0].offsettop,
p = s[0].parent().height() - s[0].height(),
g = t.deltay || i;
"y" === c && !o.overflowed[0] || "x" === c && !o.overflowed[1] || (n.mousewheel.invert && (g = -g), n.mousewheel.normalizedelta && (g = 0 > g ? -1 : 1), (g > 0 && 0 !== m || 0 > g && m !== p || n.mousewheel.preventdefault) && (t.stopimmediatepropagation(), t.preventdefault()), g(a, (h - g * f).tostring(), {
dir: c
}))
}
})
}
},
p = function(t, a) {
var o = a.nodename.tolowercase(),
n = t.data(i).opt.mousewheel.disableover,
r = ["select", "textarea"];
return e.inarray(o, n) > -1 && !(e.inarray(o, r) > -1 && !e(a).is(":focus"))
},
z = function() {
var t = e(this),
a = t.data(i),
o = i + "_" + a.idx,
n = e("#mcsb_" + a.idx + "_container"),
r = n.parent(),
l = e(".mcsb_" + a.idx + "_scrollbar ." + f[12]);
l.bind("touchstart." + o + " pointerdown." + o + " mspointerdown." + o, function() {
u = !0
}).bind("touchend." + o + " pointerup." + o + " mspointerup." + o, function() {
u = !1
}).bind("click." + o, function(o) {
if(e(o.target).hasclass(f[12]) || e(o.target).hasclass("mcsb_draggerrail")) {
q(t);
var i = e(this),
l = i.find(".mcsb_dragger");
if(i.parent(".mcsb_scrolltools_horizontal").length > 0) {
if(!a.overflowed[1]) return;
var s = "x",
c = o.pagex > l.offset().left ? -1 : 1,
d = math.abs(n[0].offsetleft) - .9 * c * r.width()
} else {
if(!a.overflowed[0]) return;
var s = "y",
c = o.pagey > l.offset().top ? -1 : 1,
d = math.abs(n[0].offsettop) - .9 * c * r.height()
}
g(t, d.tostring(), {
dir: s,
scrolleasing: "mcseaseinout"
})
}
})
},
h = function() {
var t = e(this),
o = t.data(i),
n = o.opt,
r = i + "_" + o.idx,
l = e("#mcsb_" + o.idx + "_container"),
s = l.parent();
l.bind("focusin." + r, function() {
var o = e(a.activeelement),
i = l.find(".mcustomscrollbox").length,
r = 0;
o.is(n.advanced.autoscrollonfocus) && (q(t), cleartimeout(t[0]._focustimeout), t[0]._focustimer = i ? (r + 17) * i : 0, t[0]._focustimeout = settimeout(function() {
var e = [ot(o)[0], ot(o)[1]],
a = [l[0].offsettop, l[0].offsetleft],
i = [a[0] + e[0] >= 0 && a[0] + e[0] < s.height() - o.outerheight(!1), a[1] + e[1] >= 0 && a[0] + e[1] < s.width() - o.outerwidth(!1)],
c = "yx" !== n.axis || i[0] || i[1] ? "all" : "none";
"x" === n.axis || i[0] || g(t, e[0].tostring(), {
dir: "y",
scrolleasing: "mcseaseinout",
overwrite: c,
dur: r
}), "y" === n.axis || i[1] || g(t, e[1].tostring(), {
dir: "x",
scrolleasing: "mcseaseinout",
overwrite: c,
dur: r
})
}, t[0]._focustimer))
})
},
u = function() {
var t = e(this),
a = t.data(i),
o = i + "_" + a.idx,
n = e("#mcsb_" + a.idx + "_container").parent();
n.bind("scroll." + o, function() {
(0 !== n.scrolltop() || 0 !== n.scrollleft()) && e(".mcsb_" + a.idx + "_scrollbar").css("visibility", "hidden")
})
},
f = function() {
var t = e(this),
a = t.data(i),
o = a.opt,
n = a.sequential,
r = i + "_" + a.idx,
l = ".mcsb_" + a.idx + "_scrollbar",
s = e(l + ">a");
s.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(i) {
function r(e, a) {
n.scrollamount = o.snapamount || o.scrollbuttons.scrollamount, j(t, e, a)
}
if(i.preventdefault(), et(i)) {
var l = e(this).attr("class");
switch(n.type = o.scrollbuttons.scrolltype, i.type) {
case "mousedown":
case "touchstart":
case "pointerdown":
case "mspointerdown":
if("stepped" === n.type) return;
u = !0, a.tweenrunning = !1, r("on", l);
break;
case "mouseup":
case "touchend":
case "pointerup":
case "mspointerup":
case "mouseout":
case "pointerout":
case "mspointerout":
if("stepped" === n.type) return;
u = !1, n.dir && r("off", l);
break;
case "click":
if("stepped" !== n.type || a.tweenrunning) return;
r("on", l)
}
}
})
},
q = function() {
var t = e(this),
o = t.data(i),
n = o.opt,
r = o.sequential,
l = i + "_" + o.idx,
s = e("#mcsb_" + o.idx),
c = e("#mcsb_" + o.idx + "_container"),
d = c.parent(),
u = "input,textarea,select,datalist,keygen,[contenteditable='true']";
s.attr("tabindex", "0").bind("blur." + l + " keydown." + l + " keyup." + l, function(i) {
function l(e, a) {
r.type = n.keyboard.scrolltype, r.scrollamount = n.snapamount || n.keyboard.scrollamount, "stepped" === r.type && o.tweenrunning || j(t, e, a)
}
switch(i.type) {
case "blur":
o.tweenrunning && r.dir && l("off", null);
break;
case "keydown":
case "keyup":
var s = i.keycode ? i.keycode : i.which,
f = "on";
if("x" !== n.axis && (38 === s || 40 === s) || "y" !== n.axis && (37 === s || 39 === s)) {
if((38 === s || 40 === s) && !o.overflowed[0] || (37 === s || 39 === s) && !o.overflowed[1]) return;
"keyup" === i.type && (f = "off"), e(a.activeelement).is(u) || (i.preventdefault(), i.stopimmediatepropagation(), l(f, s))
} else if(33 === s || 34 === s) {
if((o.overflowed[0] || o.overflowed[1]) && (i.preventdefault(), i.stopimmediatepropagation()), "keyup" === i.type) {
q(t);
var h = 34 === s ? -1 : 1;
if("x" === n.axis || "yx" === n.axis && o.overflowed[1] && !o.overflowed[0]) var m = "x",
p = math.abs(c[0].offsetleft) - .9 * h * d.width();
else var m = "y",
p = math.abs(c[0].offsettop) - .9 * h * d.height();
g(t, p.tostring(), {
dir: m,
scrolleasing: "mcseaseinout"
})
}
} else if((35 === s || 36 === s) && !e(a.activeelement).is(u) && ((o.overflowed[0] || o.overflowed[1]) && (i.preventdefault(), i.stopimmediatepropagation()), "keyup" === i.type)) {
if("x" === n.axis || "yx" === n.axis && o.overflowed[1] && !o.overflowed[0]) var m = "x",
p = 35 === s ? math.abs(d.width() - c.outerwidth(!1)) : 0;
else var m = "y",
p = 35 === s ? math.abs(d.height() - c.outerheight(!1)) : 0;
g(t, p.tostring(), {
dir: m,
scrolleasing: "mcseaseinout"
})
}
}
})
},
j = function(t, a, o, n, r) {
function l(e) {
var a = "stepped" !== u.type,
o = r ? r : e ? a ? p / 1.5 : g : 1e3 / 60,
i = e ? a ? 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],
f = "x" === u.dir[0] ? s[1] + u.dir[1] * d[1] * i : s[0] + u.dir[1] * d[0] * i,
m = "x" === u.dir[0] ? s[1] + u.dir[1] * parseint(u.scrollamount) : s[0] + u.dir[1] * parseint(u.scrollamount),
v = "auto" !== u.scrollamount ? m : f,
x = n ? n : e ? a ? "mcslinearout" : "mcseaseinout" : "mcslinear",
_ = e ? !0 : !1;
return e && 17 > o && (v = "x" === u.dir[0] ? s[1] : s[0]), g(t, v.tostring(), {
dir: u.dir[0],
scrolleasing: x,
dur: o,
oncomplete: _
}), e ? void(u.dir = !1) : (cleartimeout(u.step), void(u.step = settimeout(function() {
l()
}, o)))
}
function s() {
cleartimeout(u.step), $(u, "step"), q(t)
}
var c = t.data(i),
d = c.opt,
u = c.sequential,
h = e("#mcsb_" + c.idx + "_container"),
m = "stepped" === u.type ? !0 : !1,
p = d.scrollinertia < 26 ? 26 : d.scrollinertia,
g = d.scrollinertia < 1 ? 17 : d.scrollinertia;
switch(a) {
case "on":
if(u.dir = [o === f[16] || o === f[15] || 39 === o || 37 === o ? "x" : "y", o === f[13] || o === f[15] || 38 === o || 37 === o ? -1 : 1], q(t), at(o) && "stepped" === u.type) return;
l(m);
break;
case "off":
s(), (m || c.tweenrunning && u.dir) && l(!0)
}
},
y = function(t) {
var a = e(this).data(i).opt,
o = [];
return "function" == typeof t && (t = t()), t instanceof array ? o = t.length > 1 ? [t[0], t[1]] : "x" === a.axis ? [null, t[0]] : [t[0], null] : (o[0] = t.y ? t.y : t.x || "x" === a.axis ? null : t, o[1] = t.x ? t.x : t.y || "y" === a.axis ? null : t), "function" == typeof o[0] && (o[0] = o[0]()), "function" == typeof o[1] && (o[1] = o[1]()), o
},
x = function(t, a) {
if(null != t && "undefined" != typeof t) {
var o = e(this),
n = o.data(i),
r = n.opt,
l = e("#mcsb_" + n.idx + "_container"),
s = l.parent(),
c = typeof t;
a || (a = "x" === r.axis ? "x" : "y");
var d = "x" === a ? l.outerwidth(!1) : l.outerheight(!1),
u = "x" === a ? l[0].offsetleft : l[0].offsettop,
f = "x" === a ? "left" : "top";
switch(c) {
case "function":
return t();
case "object":
var m = t.jquery ? t : e(t);
if(!m.length) return;
return "x" === a ? ot(m)[1] : ot(m)[0];
case "string":
case "number":
if(at(t)) return math.abs(t);
if(-1 !== t.indexof("%")) return math.abs(d * parseint(t) / 100);
if(-1 !== t.indexof("-=")) return math.abs(u - parseint(t.split("-=")[1]));
if(-1 !== t.indexof("+=")) {
var p = u + parseint(t.split("+=")[1]);
return p >= 0 ? 0 : math.abs(p)
}
if(-1 !== t.indexof("px") && at(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" === a ? ot(m)[1] : ot(m)[0]
}
return e(t).length ? "x" === a ? ot(e(t))[1] : ot(e(t))[0] : (l.css(f, t), void h.update.call(null, o[0]))
}
}
},
n = function(t) {
function a() {
cleartimeout(u[0].autoupdate), u[0].autoupdate = settimeout(function() {
return d.advanced.updateonselectorchange && (m = r(), m !== s) ? (l(3), void(s = m)) : (d.advanced.updateoncontentresize && (p = [u.outerheight(!1), u.outerwidth(!1), v.height(), v.width(), _()[0], _()[1]], (p[0] !== w[0] || p[1] !== w[1] || p[2] !== w[2] || p[3] !== w[3] || p[4] !== w[4] || p[5] !== w[5]) && (l(p[0] !== w[0] || p[1] !== w[1]), w = p)), d.advanced.updateonimageload && (g = o(), g !== b && (u.find("img").each(function() {
n(this)
}), b = g)), void((d.advanced.updateonselectorchange || d.advanced.updateoncontentresize || d.advanced.updateonimageload) && a()))
}, 60)
}
function o() {
var e = 0;
return d.advanced.updateonimageload && (e = u.find("img").length), e
}
function n(t) {
function a(e, t) {
return function() {
return t.apply(e, arguments)
}
}
function o() {
this.onload = null, e(t).addclass(f[2]), l(2)
}
if(e(t).hasclass(f[2])) return void l();
var n = new image;
n.onload = a(n, o), n.src = t.src
}
function r() {
d.advanced.updateonselectorchange === !0 && (d.advanced.updateonselectorchange = "*");
var t = 0,
a = u.find(d.advanced.updateonselectorchange);
return d.advanced.updateonselectorchange && a.length > 0 && a.each(function() {
t += e(this).height() + e(this).width()
}), t
}
function l(e) {
cleartimeout(u[0].autoupdate), h.update.call(null, s[0], e)
}
var s = e(this),
c = s.data(i),
d = c.opt,
u = e("#mcsb_" + c.idx + "_container");
if(t) return cleartimeout(u[0].autoupdate), void $(u[0], "autoupdate");
var m, p, g, v = u.parent(),
x = [e("#mcsb_" + c.idx + "_scrollbar_vertical"), e("#mcsb_" + c.idx + "_scrollbar_horizontal")],
_ = function() {
return [x[0].is(":visible") ? x[0].outerheight(!0) : 0, x[1].is(":visible") ? x[1].outerwidth(!0) : 0]
},
s = r(),
w = [u.outerheight(!1), u.outerwidth(!1), v.height(), v.width(), _()[0], _()[1]],
b = o();
a()
},
v = function(e, t, a) {
return math.round(e / t) * t - a
},
q = function(t) {
var a = t.data(i),
o = e("#mcsb_" + a.idx + "_container,#mcsb_" + a.idx + "_container_wrapper,#mcsb_" + a.idx + "_dragger_vertical,#mcsb_" + a.idx + "_dragger_horizontal");
o.each(function() {
z.call(this)
})
},
g = function(t, a, o) {
function n(e) {
return s && c.callbacks[e] && "function" == typeof c.callbacks[e]
}
function r() {
return [c.callbacks.alwaystriggeroffsets || _ >= s[0] + b, c.callbacks.alwaystriggeroffsets || -c >= _]
}
function l() {
var e = [h[0].offsettop, h[0].offsetleft],
a = [v[0].offsettop, v[0].offsetleft],
n = [h.outerheight(!1), h.outerwidth(!1)],
i = [f.height(), f.width()];
t[0].mcs = {
content: h,
top: e[0],
left: e[1],
draggertop: a[0],
draggerleft: a[1],
toppct: math.round(100 * math.abs(e[0]) / (math.abs(n[0]) - i[0])),
leftpct: math.round(100 * math.abs(e[1]) / (math.abs(n[1]) - i[1])),
direction: o.dir
}
}
var s = t.data(i),
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
},
o = e.extend(d, o),
u = [o.dur, o.drag ? 0 : o.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 = o.trigger, (0 !== m.scrolltop() || 0 !== m.scrollleft()) && (e(".mcsb_" + s.idx + "_scrollbar").css("visibility", "visible"), m.scrolltop(0).scrollleft(0)), "_resety" !== a || s.contentreset.y || (n("onoverflowynone") && c.callbacks.onoverflowynone.call(t[0]), s.contentreset.y = 1), "_resetx" !== a || s.contentreset.x || (n("onoverflowxnone") && c.callbacks.onoverflowxnone.call(t[0]), s.contentreset.x = 1), "_resety" !== a && "_resetx" !== a) {
switch(!s.contentreset.y && t[0].mcs || !s.overflowed[0] || (n("onoverflowy") && c.callbacks.onoverflowy.call(t[0]), s.contentreset.x = null), !s.contentreset.x && t[0].mcs || !s.overflowed[1] || (n("onoverflowx") && c.callbacks.onoverflowx.call(t[0]), s.contentreset.x = null), c.snapamount && (a = v(a, c.snapamount, c.snapoffset)), o.dir) {
case "x":
var v = e("#mcsb_" + s.idx + "_dragger_horizontal"),
x = "left",
_ = h[0].offsetleft,
s = [f.width() - h.outerwidth(!1), v.parent().width() - v.width()],
w = [a, 0 === a ? 0 : a / s.scrollratio.x],
b = p[1],
c = g[1],
y = b > 0 ? b / s.scrollratio.x : 0,
b = c > 0 ? c / s.scrollratio.x : 0;
break;
case "y":
var v = e("#mcsb_" + s.idx + "_dragger_vertical"),
x = "top",
_ = h[0].offsettop,
s = [f.height() - h.outerheight(!1), v.parent().height() - v.height()],
w = [a, 0 === a ? 0 : a / s.scrollratio.y],
b = p[0],
c = g[0],
y = b > 0 ? b / s.scrollratio.y : 0,
b = c > 0 ? c / s.scrollratio.y : 0
}
w[1] < 0 || 0 === w[0] && 0 === w[1] ? w = [0, 0] : w[1] >= s[1] ? w = [s[0], s[1]] : w[0] = -w[0], t[0].mcs || (l(), n("oninit") && c.callbacks.oninit.call(t[0])), cleartimeout(h[0].oncompletetimeout), (s.tweenrunning || !(0 === _ && w[0] >= 0 || _ === s[0] && w[0] <= s[0])) && (j(v[0], x, math.round(w[1]), u[1], o.scrolleasing), j(h[0], x, math.round(w[0]), u[0], o.scrolleasing, o.overwrite, {
onstart: function() {
o.callbacks && o.onstart && !s.tweenrunning && (n("onscrollstart") && (l(), c.callbacks.onscrollstart.call(t[0])), s.tweenrunning = !0, t(v), s.cboffsets = r())
},
onupdate: function() {
o.callbacks && o.onupdate && n("whilescrolling") && (l(), c.callbacks.whilescrolling.call(t[0]))
},
oncomplete: function() {
if(o.callbacks && o.oncomplete) {
"yx" === c.axis && cleartimeout(h[0].oncompletetimeout);
var e = h[0].idletimer || 0;
h[0].oncompletetimeout = settimeout(function() {
n("onscroll") && (l(), c.callbacks.onscroll.call(t[0])), n("ontotalscroll") && w[1] >= s[1] - y && s.cboffsets[0] && (l(), c.callbacks.ontotalscroll.call(t[0])), n("ontotalscrollback") && w[1] <= b && s.cboffsets[1] && (l(), c.callbacks.ontotalscrollback.call(t[0])), s.tweenrunning = !1, h[0].idletimer = 0, t(v, "hide")
}, e)
}
}
}))
}
},
j = function(e, a, o, n, i, r, l) {
function s() {
b.stop || (_ || p.call(), _ = k() - x, c(), _ >= b.time && (b.time = _ > b.time ? _ + h - (_ - b.time) : _ + h - 1, b.time < _ + 1 && (b.time = _ + 1)), b.time < n ? b.id = m(s) : v.call())
}
function c() {
n > 0 ? (b.currval = f(b.time, s, c, n, i), w[a] = math.round(b.currval) + "px") : w[a] = o + "px", g.call()
}
function d() {
h = 1e3 / 60, b.time = _ + h, m = t.requestanimationframe ? t.requestanimationframe : function(e) {
return c(), settimeout(e, .01)
}, b.id = m(s)
}
function u() {
null != b.id && (t.requestanimationframe ? t.cancelanimationframe(b.id) : cleartimeout(b.id), b.id = null)
}
function f(e, t, a, o, n) {
switch(n) {
case "linear":
case "mcslinear":
return a * e / o + t;
case "mcslinearout":
return e /= o, e--, a * math.sqrt(1 - e * e) + t;
case "easeinoutsmooth":
return e /= o / 2, 1 > e ? a / 2 * e * e + t : (e--, -a / 2 * (e * (e - 2) - 1) + t);
case "easeinoutstrong":
return e /= o / 2, 1 > e ? a / 2 * math.pow(2, 10 * (e - 1)) + t : (e--, a / 2 * (-math.pow(2, -10 * e) + 2) + t);
case "easeinout":
case "mcseaseinout":
return e /= o / 2, 1 > e ? a / 2 * e * e * e + t : (e -= 2, a / 2 * (e * e * e + 2) + t);
case "easeoutsmooth":
return e /= o, e--, -a * (e * e * e * e - 1) + t;
case "easeoutstrong":
return a * (-math.pow(2, -10 * e / o) + 1) + t;
case "easeout":
case "mcseaseout":
default:
var i = (e /= o) * e,
r = i * e;
return t + a * (.499999999999997 * r * i + -2.5 * i * i + 5.5 * r + -6.5 * i + 4 * e)
}
}
e._mtween || (e._mtween = {
top: {},
left: {}
});
var h, m, l = l || {},
p = l.onstart || function() {},
g = l.onupdate || function() {},
v = l.oncomplete || function() {},
x = k(),
_ = 0,
s = e.offsettop,
w = e.style,
b = e._mtween[a];
"left" === a && (s = e.offsetleft);
var c = o - s;
b.stop = 0, "none" !== r && u(), d()
},
k = function() {
return t.performance && t.performance.now ? t.performance.now() : t.performance && t.performance.webkitnow ? t.performance.webkitnow() : date.now ? date.now() : (new date).gettime()
},
z = function() {
var e = this;
e._mtween || (e._mtween = {
top: {},
left: {}
});
for(var a = ["top", "left"], o = 0; o < a.length; o++) {
var n = a[o];
e._mtween[n].id && (t.requestanimationframe ? t.cancelanimationframe(e._mtween[n].id) : cleartimeout(e._mtween[n].id), e._mtween[n].id = null, e._mtween[n].stop = 1)
}
},
$ = function(e, t) {
try {
delete e[t]
} catch(a) {
e[t] = null
}
},
et = function(e) {
return !(e.which && 1 !== e.which)
},
tt = function(e) {
var t = e.originalevent.pointertype;
return !(t && "touch" !== t && 2 !== t)
},
at = function(e) {
return !isnan(parsefloat(e)) && isfinite(e)
},
ot = function(e) {
var t = e.parents(".mcsb_container");
return [e.offset().top - t.offset().top, e.offset().left - t.offset().left]
};
e.fn[n] = function(t) {
return h[t] ? h[t].apply(this, array.prototype.slice.call(arguments, 1)) : "object" != typeof t && t ? void e.error("method " + t + " does not exist") : h.init.apply(this, arguments)
}, e[n] = function(t) {
return h[t] ? h[t].apply(this, array.prototype.slice.call(arguments, 1)) : "object" != typeof t && t ? void e.error("method " + t + " does not exist") : h.init.apply(this, arguments)
}, e[n].defaults = l, t[n] = !0, e(t).load(function() {
e(r)[n](), e.extend(e.expr[":"], {
mcsinview: e.expr[":"].mcsinview || function(t) {
var a, o, n = e(t),
i = n.parents(".mcsb_container");
if(i.length) return a = i.parent(), o = [i[0].offsettop, i[0].offsetleft], o[0] + ot(n)[0] >= 0 && o[0] + ot(n)[0] < a.height() - n.outerheight(!1) && o[1] + ot(n)[1] >= 0 && o[1] + ot(n)[1] < a.width() - n.outerwidth(!1)
},
mcsoverflow: e.expr[":"].mcsoverflow || function(t) {
var a = e(t).data(i);
if(a) return a.overflowed[0] || a.overflowed[1]
}
})
})
})
}(jquery, window, document);