/* jQuery UI - v1.12.1 - 2017-05-08 http://jqueryui.com Includes: position.js Copyright jQuery Foundation and other contributors; Licensed MIT */ (function (c) { "function" == typeof define && define.amd ? define(["jquery"], c) : c(jQuery) })(function (c) { c.ui = c.ui || {}; c.ui.version = "1.12.1"; (function () { function D(a, b, c) { return [parseFloat(a[0]) * (x.test(a[0]) ? b / 100 : 1), parseFloat(a[1]) * (x.test(a[1]) ? c / 100 : 1)] } function F(a) { var b = a[0]; return 9 === b.nodeType ? { width: a.width(), height: a.height(), offset: { top: 0, left: 0 } } : c.isWindow(b) ? { width: a.width(), height: a.height(), offset: { top: a.scrollTop(), left: a.scrollLeft() } } : b.preventDefault ? { width: 0, height: 0, offset: { top: b.pageY, left: b.pageX } } : { width: a.outerWidth(), height: a.outerHeight(), offset: a.offset() } } var w, y = Math.max, q = Math.abs, z = /left|center|right/, A = /top|center|bottom/, B = /[\+\-]\d+(\.[\d]+)?%?/, E = /^\w+/, x = /%$/, G = c.fn.position; c.position = { scrollbarWidth: function () { if (void 0 !== w) return w; var a, b, k = c("
"), d = k.children()[0]; return c("body").append(k), a = d.offsetWidth, k.css("overflow", "scroll"), b = d.offsetWidth, a === b && (b = k[0].clientWidth), k.remove(), w = a - b }, getScrollInfo: function (a) { var b = a.isWindow || a.isDocument ? "" : a.element.css("overflow-x"), k = a.isWindow || a.isDocument ? "" : a.element.css("overflow-y"), b = "scroll" === b || "auto" === b && a.width < a.element[0].scrollWidth; return { width: "scroll" === k || "auto" === k && a.height < a.element[0].scrollHeight ? c.position.scrollbarWidth() : 0, height: b ? c.position.scrollbarWidth() : 0 } }, getWithinInfo: function (a) { var b = c(a || window), k = c.isWindow(b[0]), d = !!b[0] && 9 === b[0].nodeType; return { element: b, isWindow: k, isDocument: d, offset: k || d ? { left: 0, top: 0 } : c(a).offset(), scrollLeft: b.scrollLeft(), scrollTop: b.scrollTop(), width: b.outerWidth(), height: b.outerHeight() } } }; c.fn.position = function (a) { if (!a || !a.of) return G.apply(this, arguments); a = c.extend({}, a); var b, k, d, e, g, f, h = c(a.of), r = c.position.getWithinInfo(a.within), p = c.position.getScrollInfo(r), l = (a.collision || "flip").split(" "), m = {}; return f = F(h), h[0].preventDefault && (a.at = "left top"), k = f.width, d = f.height, e = f.offset, g = c.extend({}, e), c.each(["my", "at"], function () { var b = (a[this] || "").split(" "); 1 === b.length && (b = z.test(b[0]) ? b.concat(["center"]) : A.test(b[0]) ? ["center"].concat(b) : ["center", "center"]); b[0] = z.test(b[0]) ? b[0] : "center"; b[1] = A.test(b[1]) ? b[1] : "center"; var d = B.exec(b[0]); var c = B.exec(b[1]); m[this] = [d ? d[0] : 0, c ? c[0] : 0]; a[this] = [E.exec(b[0])[0], E.exec(b[1])[0]] }), 1 === l.length && (l[1] = l[0]), "right" === a.at[0] ? g.left += k : "center" === a.at[0] && (g.left += k / 2), "bottom" === a.at[1] ? g.top += d : "center" === a.at[1] && (g.top += d / 2), b = D(m.at, k, d), g.left += b[0], g.top += b[1], this.each(function () { var f, t = c(this), u = t.outerWidth(), v = t.outerHeight(), w = parseInt(c.css(this, "marginLeft"), 10) || 0, x = parseInt(c.css(this, "marginTop"), 10) || 0, z = u + w + (parseInt(c.css(this, "marginRight"), 10) || 0) + p.width, A = v + x + (parseInt(c.css(this, "marginBottom"), 10) || 0) + p.height, n = c.extend({}, g), C = D(m.my, t.outerWidth(), t.outerHeight()); "right" === a.my[0] ? n.left -= u : "center" === a.my[0] && (n.left -= u / 2); "bottom" === a.my[1] ? n.top -= v : "center" === a.my[1] && (n.top -= v / 2); n.left += C[0]; n.top += C[1]; var B = { marginLeft: w, marginTop: x }; c.each(["left", "top"], function (e, f) { c.ui.position[l[e]] && c.ui.position[l[e]][f](n, { targetWidth: k, targetHeight: d, elemWidth: u, elemHeight: v, collisionPosition: B, collisionWidth: z, collisionHeight: A, offset: [b[0] + C[0], b[1] + C[1]], my: a.my, at: a.at, within: r, elem: t }) }); a.using && (f = function (b) { var c = e.left - n.left, f = c + k - u, g = e.top - n.top, l = g + d - v, m = { target: { element: h, left: e.left, top: e.top, width: k, height: d }, element: { element: t, left: n.left, top: n.top, width: u, height: v }, horizontal: 0 > f ? "left" : 0 < c ? "right" : "center", vertical: 0 > l ? "top" : 0 < g ? "bottom" : "middle" }; u > k && k > q(c + f) && (m.horizontal = "center"); v > d && d > q(g + l) && (m.vertical = "middle"); m.important = y(q(c), q(f)) > y(q(g), q(l)) ? "horizontal" : "vertical"; a.using.call(this, b, m) }); t.offset(c.extend(n, { using: f })) }) }; c.ui.position = { fit: { left: function (a, b) { var c, d = b.within, e = d.isWindow ? d.scrollLeft : d.offset.left, d = d.width, g = a.left - b.collisionPosition.marginLeft, f = e - g, h = g + b.collisionWidth - d - e; b.collisionWidth > d ? 0 < f && 0 >= h ? (c = a.left + f + b.collisionWidth - d - e, a.left += f - c) : a.left = 0 < h && 0 >= f ? e : f > h ? e + d - b.collisionWidth : e : 0 < f ? a.left += f : 0 < h ? a.left -= h : a.left = y(a.left - g, a.left) }, top: function (a, b) { var c, d = b.within, d = d.isWindow ? d.scrollTop : d.offset.top, e = b.within.height, g = a.top - b.collisionPosition.marginTop, f = d - g, h = g + b.collisionHeight - e - d; b.collisionHeight > e ? 0 < f && 0 >= h ? (c = a.top + f + b.collisionHeight - e - d, a.top += f - c) : a.top = 0 < h && 0 >= f ? d : f > h ? d + e - b.collisionHeight : d : 0 < f ? a.top += f : 0 < h ? a.top -= h : a.top = y(a.top - g, a.top) } }, flip: { left: function (a, b) { var c, d, e = b.within, g = e.offset.left + e.scrollLeft, f = e.width, e = e.isWindow ? e.scrollLeft : e.offset.left, h = a.left - b.collisionPosition.marginLeft, r = h - e, h = h + b.collisionWidth - f - e, p = "left" === b.my[0] ? -b.elemWidth : "right" === b.my[0] ? b.elemWidth : 0, l = "left" === b.at[0] ? b.targetWidth : "right" === b.at[0] ? -b.targetWidth : 0, m = -2 * b.offset[0]; 0 > r ? (c = a.left + p + l + m + b.collisionWidth - f - g, (0 > c || q(r) > c) && (a.left += p + l + m)) : 0 < h && (d = a.left - b.collisionPosition.marginLeft + p + l + m - e, (0 < d || h > q(d)) && (a.left += p + l + m)) }, top: function (a, b) { var c, d, e = b.within, g = e.offset.top + e.scrollTop, f = e.height, e = e.isWindow ? e.scrollTop : e.offset.top, h = a.top - b.collisionPosition.marginTop, r = h - e, h = h + b.collisionHeight - f - e, p = "top" === b.my[1] ? -b.elemHeight : "bottom" === b.my[1] ? b.elemHeight : 0, l = "top" === b.at[1] ? b.targetHeight : "bottom" === b.at[1] ? -b.targetHeight : 0, m = -2 * b.offset[1]; 0 > r ? (d = a.top + p + l + m + b.collisionHeight - f - g, (0 > d || q(r) > d) && (a.top += p + l + m)) : 0 < h && (c = a.top - b.collisionPosition.marginTop + p + l + m - e, (0 < c || h > q(c)) && (a.top += p + l + m)) } }, flipfit: { left: function () { c.ui.position.flip.left.apply(this, arguments); c.ui.position.fit.left.apply(this, arguments) }, top: function () { c.ui.position.flip.top.apply(this, arguments); c.ui.position.fit.top.apply(this, arguments) } } } })(); c.ui.position });