").addClass("tpd-spin-line"))), f.css({
"background-color": this.options.color
, width: this.options.width
, height: this.options.length
, "margin-left": -.5 * this.options.width
, "border-radius": Math.round(.5 * this.options.width)
}), e.css({
opacity: (1 / c * (d + 1)).toFixed(2)
});
var g = {};
g[Support.css.prefixed("transform")] = "rotate(" + 360 / c * (d + 1) + "deg)", e.css(g)
}
}
, start: function () {
var a = {};
a[Support.css.prefixed("animation")] = "tpd-spin 1s infinite steps(" + this.options.lines + ")", this._rotate.css(a)
}
, stop: function () {
var a = {};
a[Support.css.prefixed("animation")] = "none", this._rotate.css(a), this.element.detach()
}
}), $.extend(Visible.prototype, {
initialize: function (a) {
return a = "array" == $.type(a) ? a : [a], this.elements = a, this._restore = [], $.each(a, $.proxy(function (a, b) {
var c = $(b).is(":visible");
c || $(b).show(), this._restore.push({
element: b
, visible: c
})
}, this)), this
}
, restore: function () {
$.each(this._restore, function (a, b) {
b.visible || $(b.element).show()
}), this._restore = null
}
});
var Z = function () {
var a = [];
return {
get: function (b) {
for (var c = null, d = 0; d < a.length; d++) a[d] && a[d].url == b.url && (a[d].type || "GET").toUpperCase() == (b.type || "GET").toUpperCase() && $.param(a[d].data || {}) == $.param(b.data || {}) && (c = a[d]);
return c
}
, set: function (b, c, d) {
var e = this.get(b);
e || (e = $.extend({
callbacks: {}
}, b), a.push(e)), e.callbacks[c] = d
}
, remove: function (b) {
for (var c = 0; c < a.length; c++) a[c] && a[c].url == b && delete a[c]
}
, clear: function () {
a = []
}
}
}()
, Voila = function (a) {
function b(c, d, e) {
if (!(this instanceof b)) return new b(c, d, e);
var f = a.type(arguments[1])
, g = "object" === f ? arguments[1] : {}
, h = "function" === f ? arguments[1] : "function" === a.type(arguments[2]) ? arguments[2] : !1;
return this.options = a.extend({
method: "onload"
}, g), this.deferred = new jQuery.Deferred, h && this.always(h), this._processed = 0, this.images = [], this._add(c), this
}
a.extend(b.prototype, {
_add: function (b) {
var d = "string" == a.type(b) ? a(b) : b instanceof jQuery || b.length > 0 ? b : [b];
a.each(d, a.proxy(function (b, d) {
var e = a()
, f = a(d);
e = f.is("img") ? e.add(f) : e.add(f.find("img")), e.each(a.proxy(function (b, d) {
this.images.push(new c(d, a.proxy(function (a) {
this._progress(a)
}, this), a.proxy(function (a) {
this._progress(a)
}, this), this.options))
}, this))
}, this)), this.images.length < 1 && setTimeout(a.proxy(function () {
this._resolve()
}, this))
}
, abort: function () {
this._progress = this._notify = this._reject = this._resolve = function () { }, a.each(this.images, function (a, b) {
b.abort()
}), this.images = []
}
, _progress: function (a) {
this._processed++, a.isLoaded || (this._broken = !0), this._notify(a), this._processed == this.images.length && this[this._broken ? "_reject" : "_resolve"]()
}
, _notify: function (a) {
this.deferred.notify(this, a)
}
, _reject: function () {
this.deferred.reject(this)
}
, _resolve: function () {
this.deferred.resolve(this)
}
, always: function (a) {
return this.deferred.always(a), this
}
, done: function (a) {
return this.deferred.done(a), this
}
, fail: function (a) {
return this.deferred.fail(a), this
}
, progress: function (a) {
return this.deferred.progress(a), this
}
});
var c = function (a) {
var b = function () {
return this.initialize.apply(this, Array.prototype.slice.call(arguments))
};
a.extend(b.prototype, {
initialize: function () {
this.options = a.extend({
test: function () { }
, success: function () { }
, timeout: function () { }
, callAt: !1
, intervals: [[0, 0], [1e3, 10], [2e3, 50], [4e3, 100], [2e4, 500]]
}, arguments[0] || {}), this._test = this.options.test, this._success = this.options.success, this._timeout = this.options.timeout, this._ipos = 0, this._time = 0, this._delay = this.options.intervals[this._ipos][1], this._callTimeouts = [], this.poll(), this._createCallsAt()
}
, poll: function () {
this._polling = setTimeout(a.proxy(function () {
if (this._test()) return this.success(), void 0;
if (this._time += this._delay, this._time >= this.options.intervals[this._ipos][0]) {
if (!this.options.intervals[this._ipos + 1]) return "function" == a.type(this._timeout) && this._timeout(), void 0;
this._ipos++, this._delay = this.options.intervals[this._ipos][1]
}
this.poll()
}, this), this._delay)
}
, success: function () {
this.abort(), this._success()
}
, _createCallsAt: function () {
this.options.callAt && a.each(this.options.callAt, a.proxy(function (b, c) {
var d = c[0]
, e = c[1]
, f = setTimeout(a.proxy(function () {
e()
}, this), d);
this._callTimeouts.push(f)
}, this))
}
, _stopCallTimeouts: function () {
a.each(this._callTimeouts, function (a, b) {
clearTimeout(b)
}), this._callTimeouts = []
}
, abort: function () {
this._stopCallTimeouts(), this._polling && (clearTimeout(this._polling), this._polling = null)
}
});
var c = function () {
return this.initialize.apply(this, Array.prototype.slice.call(arguments))
};
return a.extend(c.prototype, {
supports: {
naturalWidth: function () {
return "naturalWidth" in new Image
}()
}
, initialize: function (b, c, d) {
return this.img = a(b)[0], this.successCallback = c, this.errorCallback = d, this.isLoaded = !1, this.options = a.extend({
method: "onload"
, pollFallbackAfter: 1e3
}, arguments[3] || {}), "onload" != this.options.method && this.supports.naturalWidth ? (this.poll(), void 0) : (this.load(), void 0)
}
, poll: function () {
this._poll = new b({
test: a.proxy(function () {
return this.img.naturalWidth > 0
}, this)
, success: a.proxy(function () {
this.success()
}, this)
, timeout: a.proxy(function () {
this.error()
}, this)
, callAt: [[this.options.pollFallbackAfter, a.proxy(function () {
this.load()
}, this)]]
})
}
, load: function () {
this._loading = setTimeout(a.proxy(function () {
var b = new Image;
this._onloadImage = b, b.onload = a.proxy(function () {
b.onload = function () { }, this.supports.naturalWidth || (this.img.naturalWidth = b.width, this.img.naturalHeight = b.height, b.naturalWidth = b.width, b.naturalHeight = b.height), this.success()
}, this), b.onerror = a.proxy(this.error, this), b.src = this.img.src
}, this))
}
, success: function () {
this._calledSuccess || (this._calledSuccess = !0, this.abort(), this.waitForRender(a.proxy(function () {
this.isLoaded = !0, this.successCallback(this)
}, this)))
}
, error: function () {
this._calledError || (this._calledError = !0, this.abort(), this._errorRenderTimeout = setTimeout(a.proxy(function () {
this.errorCallback && this.errorCallback(this)
}, this)))
}
, abort: function () {
this.stopLoading(), this.stopPolling(), this.stopWaitingForRender()
}
, stopPolling: function () {
this._poll && (this._poll.abort(), this._poll = null)
}
, stopLoading: function () {
this._loading && (clearTimeout(this._loading), this._loading = null), this._onloadImage && (this._onloadImage.onload = function () { }, this._onloadImage.onerror = function () { })
}
, waitForRender: function (a) {
this._renderTimeout = setTimeout(a)
}
, stopWaitingForRender: function () {
this._renderTimeout && (clearTimeout(this._renderTimeout), this._renderTimeout = null), this._errorRenderTimeout && (clearTimeout(this._errorRenderTimeout), this._errorRenderTimeout = null)
}
}), c
}(jQuery);
return b
}(jQuery);
X.Behaviors = {
hide: {
showOn: {
element: "mouseenter"
, tooltip: !1
}
, hideOn: {
element: "mouseleave"
, tooltip: "mouseenter"
}
}
, mouse: {
showOn: {
element: "mouseenter"
, tooltip: !1
}
, hideOn: {
element: "mouseleave"
, tooltip: "mouseenter"
}
, target: "mouse"
, showDelay: 100
, fadeIn: 0
, hideDelay: 0
, fadeOut: 0
}
, sticky: {
showOn: {
element: "mouseenter"
, tooltip: "mouseenter"
}
, hideOn: {
element: "mouseleave"
, tooltip: "mouseleave"
}
, showDelay: 150
, target: "mouse"
, fixed: !0
}
};
var ba = {
create: function () {
function a(b) {
return e = X.Skins.base, f = deepExtend($.extend({}, e), X.Skins.reset), a = d, d(b)
}
function b(a) {
return a.match(/^(top|left|bottom|right)$/) && (a += "middle"), a.replace("center", "middle").replace(" ", ""), a
}
function c(a) {
var b, c;
return b = a.behavior && (c = X.Behaviors[a.behavior]) ? deepExtend($.extend({}, c), a) : a
}
function d(a) {
var d = a.skin ? a.skin : bb.options.defaultSkin
, g = $.extend({}, X.Skins[d] || {});
g.skin || (g.skin = bb.options.defaultSkin || "dark");
var h = deepExtend($.extend({}, f), c(g))
, i = deepExtend($.extend({}, h), c(a));
if (i.ajax) {
var j = (f.ajax || {}, e.ajax);
"boolean" == $.type(i.ajax) && (i.ajax = {}), i.ajax = deepExtend($.extend({}, j), i.ajax)
}
var k, l = l = i.position && i.position.target || "string" == $.type(i.position) && i.position || f.position && f.position.target || "string" == $.type(f.position) && f.position || e.position && e.position.target || e.position;
l = b(l);
var m = i.position && i.position.tooltip || f.position && f.position.tooltip || e.position && e.position.tooltip || bb.Position.getInversedPosition(l);
if (m = b(m), i.position ? "string" == $.type(i.position) ? (i.position = b(i.position), k = {
target: i.position
, tooltip: bb.Position.getTooltipPositionFromTarget(i.position)
}) : (k = {
tooltip: m
, target: l
}, i.position.tooltip && (k.tooltip = b(i.position.tooltip)), i.position.target && (k.target = b(i.position.target))) : k = {
tooltip: m
, target: l
}, Position.isCorner(k.target) && Position.getOrientation(k.target) != Position.getOrientation(k.tooltip) && (k.target = Position.inverseCornerPlane(k.target)), "mouse" == i.target) {
var n = Position.getOrientation(k.target);
k.target = "horizontal" == n ? k.target.replace(/(left|right)/, "middle") : k.target.replace(/(top|bottom)/, "middle")
}
i.position = k;
var o;
if ("mouse" == i.target ? (o = $.extend({}, e.offset), $.extend(o, X.Skins.reset.offset || {}), a.skin && $.extend(o, (X.Skins[a.skin] || X.Skins[bb.options.defaultSkin] || {}).offset || {}), o = Position.adjustOffsetBasedOnPosition(e.offset, e.position, k.target, !0), a.offset && (o = $.extend(o, a.offset || {}))) : o = {
x: i.offset.x
, y: i.offset.y
}, i.offset = o, i.hideOn && "click-outside" == i.hideOn && (i.hideOnClickOutside = !0, i.hideOn = !1, i.fadeOut = 0), i.showOn) {
var p = i.showOn;
"string" == $.type(p) && (p = {
element: p
}), i.showOn = p
}
if (i.hideOn) {
var q = i.hideOn;
"string" == $.type(q) && (q = {
element: q
}), i.hideOn = q
}
return i.inline && "string" != $.type(i.inline) && (i.inline = !1), Y.IE && Y.IE < 9 && $.extend(i, {
fadeIn: 0
, fadeOut: 0
, hideDelay: 0
}), i.spinner && (Spin.supported ? "boolean" == $.type(i.spinner) && (i.spinner = f.spinner || e.spinner || {}) : i.spinner = !1), i.container || (i.container = document.body), i.containment && "string" == $.type(i.containment) && (i.containment = {
selector: i.containment
, padding: f.containment && f.containment.padding || e.padding && e.containment.padding
}), i.shadow && (i.shadow = Support.shadow), i
}
var e, f;
return a
}()
};
$.extend(Skin.prototype, {
initialize: function (a) {
this.tooltip = a, this.element = a._skin;
var b = this.tooltip.options;
this.tooltip._tooltip[(b.shadow ? "remove" : "add") + "Class"]("tpd-no-shadow")[(b.radius ? "remove" : "add") + "Class"]("tpd-no-radius")[(b.stem ? "remove" : "add") + "Class"]("tpd-no-stem");
var c, d, e, f, g = Support.css.prefixed("borderTopLeftRadius");
this.element.append(c = $("
").addClass("tpd-frames").append($("
").addClass("tpd-frame").append($("
").addClass("tpd-backgrounds").append(d = $("
").addClass("tpd-background").append(e = $("
").addClass("tpd-background-content")))))).append(f = $("
").addClass("tpd-spinner")), d.css({
width: 999
, height: 999
, zoom: 1
}), this._css = {
border: parseFloat(d.css("border-top-width"))
, radius: parseFloat(g ? d.css(g) : 0)
, padding: parseFloat(a._content.css("padding-top"))
, borderColor: d.css("border-top-color")
, backgroundColor: e.css("background-color")
, backgroundOpacity: e.css("opacity")
, spinner: {
dimensions: {
width: f.innerWidth()
, height: f.innerHeight()
}
}
}, f.remove(), c.remove(), this._side = Position.getSide(a.options.position.tooltip) || "top", this._vars = {}
}
, destroy: function () {
this.frames && ($.each("top right bottom left".split(" "), $.proxy(function (a, b) {
this["stem_" + b] && this["stem_" + b].destroy()
}, this)), this.frames.remove(), this.frames = null)
}
, build: function () {
this.frames || (this.element.append(this.frames = $("
").addClass("tpd-frames")), $.each("top right bottom left".split(" "), $.proxy(function (a, b) {
this.insertFrame(b)
}, this)), this._spinner || this.tooltip._tooltip.append(this._spinner = $("
").addClass("tpd-spinner").hide().append($("
").addClass("tpd-spinner-spin"))))
}
, _frame: function () {
var a, b = $("
").addClass("tpd-frame").append(a = $("
").addClass("tpd-backgrounds").append($("
").addClass("tpd-background-shadow"))).append($("
").addClass("tpd-shift-stem").append($("
").addClass("tpd-shift-stem-side tpd-shift-stem-side-before")).append($("
").addClass("tpd-stem")).append($("
").addClass("tpd-shift-stem-side tpd-shift-stem-side-after")));
return $.each("top right bottom left".split(" "), $.proxy(function (b, c) {
a.append($("
").addClass("tpd-background-box tpd-background-box-" + c).append($("
").addClass("tpd-background-box-shift").append($("
").addClass("tpd-background-box-shift-further").append($("
").addClass("tpd-background").append($("
").addClass("tpd-background-title")).append($("
").addClass("tpd-background-content"))).append($("
").addClass("tpd-background tpd-background-loading")).append($("
").addClass("tpd-background-border-hack").hide()))))
}, this)), b
}()
, _getFrame: function (a) {
var b = this._frame.clone();
b.addClass("tpd-frame-" + a), b.find(".tpd-background-shadow").css({
"border-radius": this._css.radius
}), this.tooltip.options.stem && b.find(".tpd-stem").attr("data-stem-position", a);
var c = Math.max(this._css.radius - this._css.border, 0);
b.find(".tpd-background-title").css({
"border-top-left-radius": c
, "border-top-right-radius": c
}), b.find(".tpd-background-content").css({
"border-bottom-left-radius": c
, "border-bottom-right-radius": c
}), b.find(".tpd-background-loading").css({
"border-radius": c
});
var d = {
backgroundColor: this._css.borderColor
}
, e = Position.getOrientation(a)
, f = "horizontal" == e;
d[f ? "height" : "width"] = this._css.border + "px";
var g = {
top: "bottom"
, bottom: "top"
, left: "right"
, right: "left"
};
return d[g[a]] = 0, b.find(".tpd-shift-stem-side").css(d), b
}
, insertFrame: function (a) {
var b = this["frame_" + a] = this._getFrame(a);
if (this.frames.append(b), this.tooltip.options.stem) {
var c = b.find(".tpd-stem");
this["stem_" + a] = new Stem(c, this, {})
}
}
, startLoading: function () {
this.tooltip.supportsLoading && (this.build(), this._spinner || this.tooltip.is("resize-to-content") || this.setDimensions(this._css.spinner.dimensions), this._spinner && this._spinner.show())
}
, stopLoading: function () {
this.tooltip.supportsLoading && this._spinner && (this.build(), this._spinner.hide())
}
, updateBackground: function () {
var a = this._vars.frames[this._side]
, b = $.extend({}, a.background.dimensions);
if (this.tooltip.title && !this.tooltip.is("loading")) {
this.element.find(".tpd-background-title, .tpd-background-content").show(), this.element.find(".tpd-background").css({
"background-color": "transparent"
});
var c = $.extend({}, b)
, d = Math.max(this._css.radius - this._css.border, 0)
, e = {
"border-top-left-radius": d
, "border-top-right-radius": d
, "border-bottom-left-radius": d
, "border-bottom-right-radius": d
}
, f = new Visible(this.tooltip._tooltip)
, g = this.tooltip._titleWrapper.innerHeight();
c.height -= g, this.element.find(".tpd-background-title").css({
height: g
, width: b.width
}), e["border-top-left-radius"] = 0, e["border-top-right-radius"] = 0, f.restore(), this.element.find(".tpd-background-content").css(c).css(e), this.element.find(".tpd-background-loading").css({
"background-color": this._css.backgroundColor
})
} else this.element.find(".tpd-background-title, .tpd-background-content").hide(), this.element.find(".tpd-background").css({
"background-color": this._css.backgroundColor
});
this._css.border && (this.element.find(".tpd-background").css({
"border-color": "transparent"
}), this.element.find(".tpd-background-border-hack").css({
width: b.width
, height: b.height
, "border-radius": this._css.radius
, "border-width": this._css.border
, "border-color": this._css.borderColor
}).show())
}
, paint: function () {
if (!this._paintedDimensions || this._paintedDimensions.width != this._dimensions.width || this._paintedDimensions.height != this._dimensions.height || this._paintedStemPosition != this._stemPosition) {
this._paintedDimensions = this._dimensions, this._paintedStemPosition = this._stemPosition, this.element.removeClass("tpd-visible-frame-top tpd-visible-frame-bottom tpd-visible-frame-left tpd-visible-frame-right").addClass("tpd-visible-frame-" + this._side);
var a = this._vars.frames[this._side]
, b = $.extend({}, a.background.dimensions);
this.element.find(".tpd-background").css(b), this.element.find(".tpd-background-shadow").css({
width: b.width + 2 * this._css.border
, height: b.height + 2 * this._css.border
}), this.updateBackground(), this.element.find(".tpd-background-box-shift, .tpd-background-box-shift-further").removeAttr("style"), this.element.add(this.frames).add(this.tooltip._tooltip).css(a.dimensions);
var c = this._side
, d = this._vars.frames[c]
, e = this.element.find(".tpd-frame-" + this._side)
, f = this._vars.frames[c].dimensions;
e.css(f), e.find(".tpd-backgrounds").css($.extend({}, d.background.position, {
width: f.width - d.background.position.left
, height: f.height - d.background.position.top
}));
var g = Position.getOrientation(c);
if (this.tooltip.options.stem)
if (e.find(".tpd-shift-stem").css($.extend({}, d.shift.dimensions, d.shift.position)), "vertical" == g) {
var h = e.find(".tpd-background-box-top, .tpd-background-box-bottom");
h.css({
height: this._vars.cut
, width: this._css.border
}), e.find(".tpd-background-box-bottom").css({
top: d.dimensions.height - this._vars.cut
}).find(".tpd-background-box-shift").css({
"margin-top": -1 * d.dimensions.height + this._vars.cut
});
var i = "right" == c ? d.dimensions.width - d.stemPx - this._css.border : 0;
h.css({
left: i
}).find(".tpd-background-box-shift").css({
"margin-left": -1 * i
}), e.find(".tpd-background-box-" + ("left" == c ? "left" : "right")).hide(), "right" == c ? e.find(".tpd-background-box-left").css({
width: d.dimensions.width - d.stemPx - this._css.border
}) : e.find(".tpd-background-box-right").css({
"margin-left": this._css.border
}).find(".tpd-background-box-shift").css({
"margin-left": -1 * this._css.border
});
var j = e.find(".tpd-background-box-" + this._side);
j.css({
height: d.dimensions.height - 2 * this._vars.cut
, "margin-top": this._vars.cut
}), j.find(".tpd-background-box-shift").css({
"margin-top": -1 * this._vars.cut
})
} else {
var h = e.find(".tpd-background-box-left, .tpd-background-box-right");
h.css({
width: this._vars.cut
, height: this._css.border
}), e.find(".tpd-background-box-right").css({
left: d.dimensions.width - this._vars.cut
}).find(".tpd-background-box-shift").css({
"margin-left": -1 * d.dimensions.width + this._vars.cut
});
var i = "bottom" == c ? d.dimensions.height - d.stemPx - this._css.border : 0;
h.css({
top: i
}).find(".tpd-background-box-shift").css({
"margin-top": -1 * i
}), e.find(".tpd-background-box-" + ("top" == c ? "top" : "bottom")).hide(), "bottom" == c ? e.find(".tpd-background-box-top").css({
height: d.dimensions.height - d.stemPx - this._css.border
}) : e.find(".tpd-background-box-bottom").css({
"margin-top": this._css.border
}).find(".tpd-background-box-shift").css({
"margin-top": -1 * this._css.border
});
var j = e.find(".tpd-background-box-" + this._side);
j.css({
width: d.dimensions.width - 2 * this._vars.cut
, "margin-left": this._vars.cut
}), j.find(".tpd-background-box-shift").css({
"margin-left": -1 * this._vars.cut
})
}
var k = a.background
, l = k.position
, m = k.dimensions;
this._spinner.css({
top: l.top + this._css.border + (.5 * m.height - .5 * this._css.spinner.dimensions.height)
, left: l.left + this._css.border + (.5 * m.width - .5 * this._css.spinner.dimensions.width)
})
}
}
, getVars: function () {
var a = (this._css.padding, this._css.radius, this._css.border)
, b = this._vars.maxStemHeight || 0
, c = $.extend({}, this._dimensions || {})
, d = {
frames: {}
, dimensions: c
, maxStemHeight: b
};
d.cut = Math.max(this._css.border, this._css.radius) || 0;
var e = {
width: 0
, height: 0
}
, f = 0
, g = 0;
return this.tooltip.options.stem && (e = this.stem_top.getMath().dimensions.outside, f = this.stem_top._css.offset, g = Math.max(e.height - this._css.border, 0)), d.stemDimensions = e, d.stemOffset = f, Position.getOrientation(this._side), $.each("top right bottom left".split(" "), $.proxy(function (b, f) {
var h = Position.getOrientation(f)
, i = "vertical" == h
, j = {
width: c.width + 2 * a
, height: c.height + 2 * a
}
, k = j[i ? "height" : "width"] - 2 * d.cut
, l = {
dimensions: j
, stemPx: g
, position: {
top: 0
, left: 0
}
, background: {
dimensions: $.extend({}, c)
, position: {
top: 0
, left: 0
}
}
};
if (d.frames[f] = l, l.dimensions[i ? "width" : "height"] += g, ("top" == f || "left" == f) && (l.background.position[f] += g), $.extend(l, {
shift: {
position: {
top: 0
, left: 0
}
, dimensions: {
width: i ? e.height : k
, height: i ? k : e.height
}
}
}), Y.IE && Y.IE < 9) {
var m = l.shift.dimensions;
m.width = Math.round(m.width), m.height = Math.round(m.height)
}
switch (f) {
case "top":
case "bottom":
l.shift.position.left += d.cut, "bottom" == f && (l.shift.position.top += j.height - a - g);
break;
case "left":
case "right":
l.shift.position.top += d.cut, "right" == f && (l.shift.position.left += j.width - a - g)
}
}, this)), d.connections = {}, $.each(Position.positions, $.proxy(function (a, b) {
d.connections[b] = this.getConnectionLayout(b, d)
}, this)), d
}
, setDimensions: function (a) {
this.build();
var b = this._dimensions;
b && b.width == a.width && b.height == a.height || (this._dimensions = a, this._vars = this.getVars())
}
, setSide: function (a) {
this._side = a, this._vars = this.getVars()
}
, getConnectionLayout: function (a, b) {
var c = Position.getSide(a)
, d = Position.getOrientation(a)
, e = (b.dimensions, b.cut)
, f = this["stem_" + c]
, g = b.stemOffset
, h = this.tooltip.options.stem ? f.getMath().dimensions.outside.width : 0
, i = e + g + .5 * h
, j = {
stem: {}
}
, k = {
left: 0
, right: 0
, up: 0
, down: 0
}
, l = {
top: 0
, left: 0
}
, m = {
top: 0
, left: 0
}
, n = b.frames[c]
, i = 0;
if ("horizontal" == d) {
var o = n.dimensions.width;
this.tooltip.options.stem && (o = n.shift.dimensions.width, 2 * g > o - h && (g = Math.floor(.5 * (o - h)) || 0), i = e + g + .5 * h);
var p = o - 2 * g
, q = Position.split(a)
, r = g;
switch (q[2]) {
case "left":
k.right = p - h, l.left = i;
break;
case "middle":
r += Math.round(.5 * p - .5 * h), k.left = r - g, k.right = r - g, l.left = m.left = Math.round(.5 * n.dimensions.width);
break;
case "right":
r += p - h, k.left = p - h, l.left = n.dimensions.width - i, m.left = n.dimensions.width
}
"bottom" == q[1] && (l.top += n.dimensions.height, m.top += n.dimensions.height), $.extend(j.stem, {
position: {
left: r
}
, before: {
width: r
}
, after: {
left: r + h
, width: o - r - h + 1
}
})
} else {
var s = n.dimensions.height;
this.tooltip.options.stem && (s = n.shift.dimensions.height, 2 * g > s - h && (g = Math.floor(.5 * (s - h)) || 0), i = e + g + .5 * h);
var t = s - 2 * g
, q = Position.split(a)
, u = g;
switch (q[2]) {
case "top":
k.down = t - h, l.top = i;
break;
case "middle":
u += Math.round(.5 * t - .5 * h), k.up = u - g, k.down = u - g, l.top = m.top = Math.round(.5 * n.dimensions.height);
break;
case "bottom":
u += t - h, k.up = t - h, l.top = n.dimensions.height - i, m.top = n.dimensions.height
}
"right" == q[1] && (l.left += n.dimensions.width, m.left += n.dimensions.width), $.extend(j.stem, {
position: {
top: u
}
, before: {
height: u
}
, after: {
top: u + h
, height: s - u - h + 1
}
})
}
return j.move = k, j.stem.connection = l, j.connection = m, j
}
, setStemPosition: function (a, b) {
if (this._stemPosition != a) {
this._stemPosition = a;
var c = Position.getSide(a);
this.setSide(c)
}
this.tooltip.options.stem && this.setStemShift(a, b)
}
, setStemShift: function (a, b) {
var c = this._shift
, d = this._dimensions;
if (!c || c.stemPosition != a || c.shift.x != b.x || c.shift.y != b.y || !d || c.dimensions.width != d.width || c.dimensions.height != d.height) {
this._shift = {
stemPosition: a
, shift: b
, dimensions: d
};
var e = Position.getSide(a)
, f = {
horizontal: "x"
, vertical: "y"
}[Position.getOrientation(a)]
, g = {
x: {
left: "left"
, width: "width"
}
, y: {
left: "top"
, width: "height"
}
}[f]
, h = this["stem_" + e]
, i = deepExtend({}, this._vars.connections[a].stem);
b && 0 !== b[f] && (i.before[g.width] += b[f], i.position[g.left] += b[f], i.after[g.left] += b[f], i.after[g.width] -= b[f]), h.element.css(i.position), h.element.siblings(".tpd-shift-stem-side-before").css(i.before), h.element.siblings(".tpd-shift-stem-side-after").css(i.after)
}
}
}), $.extend(Stem.prototype, {
initialize: function (a, b) {
this.element = $(a), this.element[0] && (this.skin = b, this.element.removeClass("tpd-stem-reset"), this._css = $.extend({}, b._css, {
width: this.element.innerWidth()
, height: this.element.innerHeight()
, offset: parseFloat(this.element.css("margin-left"))
, spacing: parseFloat(this.element.css("margin-top"))
}), this.element.addClass("tpd-stem-reset"), this.options = $.extend({}, arguments[2] || {}), this._position = this.element.attr("data-stem-position") || "top", this._m = 100, this.build())
}
, destroy: function () {
this.element.html("")
}
, build: function () {
this.destroy();
var a = this._css.backgroundColor
, b = a.indexOf("rgba") > -1 && parseFloat(a.replace(/^.*,(.+)\)/, "$1"))
, c = b && 1 > b;
this._useTransform = c && Support.css.transform, this._css.border || (this._useTransform = !1), this[(this._useTransform ? "build" : "buildNo") + "Transform"]()
}
, buildTransform: function () {
this.element.append(this.spacer = $("
").addClass("tpd-stem-spacer").append(this.downscale = $("
").addClass("tpd-stem-downscale").append(this.transform = $("
").addClass("tpd-stem-transform").append(this.first = $("
").addClass("tpd-stem-side").append(this.border = $("
").addClass("tpd-stem-border")).append($("
").addClass("tpd-stem-border-corner")).append($("
").addClass("tpd-stem-triangle")))))), this.transform.append(this.last = this.first.clone().addClass("tpd-stem-side-inversed")), this.sides = this.first.add(this.last);
var a = this.getMath()
, b = a.dimensions
, c = this._m
, d = Position.getSide(this._position);
if (this.element.find(".tpd-stem-spacer").css({
width: l ? b.inside.height : b.inside.width
, height: l ? b.inside.width : b.inside.height
}), "top" == d || "left" == d) {
var e = {};
"top" == d ? (e.bottom = 0, e.top = "auto") : "left" == d && (e.right = 0, e.left = "auto"), this.element.find(".tpd-stem-spacer").css(e)
}
this.transform.css({
width: b.inside.width * c
, height: b.inside.height * c
});
var f = Support.css.prefixed("transform")
, g = {
"background-color": "transparent"
, "border-bottom-color": this._css.backgroundColor
, "border-left-width": .5 * b.inside.width * c
, "border-bottom-width": b.inside.height * c
};
g[f] = "translate(" + a.border * c + "px, 0)", this.element.find(".tpd-stem-triangle").css(g);
var h = this._css.borderColor;
alpha = h.indexOf("rgba") > -1 && parseFloat(h.replace(/^.*,(.+)\)/, "$1")), alpha && 1 > alpha ? h = (h.substring(0, h.lastIndexOf(",")) + ")").replace("rgba", "rgb") : alpha = 1;
var i = {
"background-color": "transparent"
, "border-right-width": a.border * c
, width: a.border * c
, "margin-left": -2 * a.border * c
, "border-color": h
, opacity: alpha
};
i[f] = "skew(" + a.skew + "deg) translate(" + a.border * c + "px, " + -1 * this._css.border * c + "px)", this.element.find(".tpd-stem-border").css(i);
var h = this._css.borderColor;
alpha = h.indexOf("rgba") > -1 && parseFloat(h.replace(/^.*,(.+)\)/, "$1")), alpha && 1 > alpha ? h = (h.substring(0, h.lastIndexOf(",")) + ")").replace("rgba", "rgb") : alpha = 1;
var j = {
width: a.border * c
, "border-right-width": a.border * c
, "border-right-color": h
, background: h
, opacity: alpha
, "margin-left": -2 * a.border * c
};
if (j[f] = "skew(" + a.skew + "deg) translate(" + a.border * c + "px, " + (b.inside.height - this._css.border) * c + "px)", this.element.find(".tpd-stem-border-corner").css(j), this.setPosition(this._position), c > 1) {
var k = {};
k[f] = "scale(" + 1 / c + "," + 1 / c + ")", this.downscale.css(k)
}
var l = /^(left|right)$/.test(this._position);
this._css.border || this.element.find(".tpd-stem-border, .tpd-stem-border-corner").hide(), this.element.css({
width: l ? b.outside.height : b.outside.width
, height: l ? b.outside.width : b.outside.height
})
}
, buildNoTransform: function () {
this.element.append(this.spacer = $("
").addClass("tpd-stem-spacer").append($("
").addClass("tpd-stem-notransform").append($("
").addClass("tpd-stem-border").append($("
").addClass("tpd-stem-border-corner")).append($("
").addClass("tpd-stem-border-center-offset").append($("
").addClass("tpd-stem-border-center-offset-inverse").append($("
").addClass("tpd-stem-border-center"))))).append($("
").addClass("tpd-stem-triangle"))));
var a = this.getMath()
, b = a.dimensions
, c = /^(left|right)$/.test(this._position)
, d = /^(bottom)$/.test(this._position)
, e = /^(right)$/.test(this._position)
, f = Position.getSide(this._position);
if (this.element.css({
width: c ? b.outside.height : b.outside.width
, height: c ? b.outside.width : b.outside.height
}), this.element.find(".tpd-stem-notransform").add(this.element.find(".tpd-stem-spacer")).css({
width: c ? b.inside.height : b.inside.width
, height: c ? b.inside.width : b.inside.height
}), "top" == f || "left" == f) {
var g = {};
"top" == f ? (g.bottom = 0, g.top = "auto") : "left" == f && (g.right = 0, g.left = "auto"), this.element.find(".tpd-stem-spacer").css(g)
}
this.element.find(".tpd-stem-border").css({
width: "100%"
, background: "transparent"
});
var h = {
opacity: Y.IE && Y.IE < 9 ? this._css.borderOpacity : 1
};
h[c ? "height" : "width"] = "100%", h[c ? "width" : "height"] = this._css.border, h[d ? "top" : "bottom"] = 0, $.extend(h, e ? {
left: 0
} : {
right: 0
}), this.element.find(".tpd-stem-border-corner").css(h);
var i = {
width: 0
, "background-color": "transparent"
, opacity: Y.IE && Y.IE < 9 ? this._css.borderOpacity : 1
}
, j = .5 * b.inside.width + "px solid transparent"
, k = {
"background-color": "transparent"
};
if (.5 * b.inside.width - a.border + "px solid transparent", c) {
var l = {
left: "auto"
, top: "50%"
, "margin-top": -.5 * b.inside.width
, "border-top": j
, "border-bottom": j
};
if ($.extend(i, l), i[e ? "right" : "left"] = 0, i[e ? "border-left" : "border-right"] = b.inside.height + "px solid " + this._css.borderColor, $.extend(k, l), k[e ? "border-left" : "border-right"] = b.inside.height + "px solid " + this._css.backgroundColor, k[e ? "right" : "left"] = a.top, k[e ? "left" : "right"] = "auto", Y.IE && Y.IE < 8) {
var m = .5 * this._css.width + "px solid transparent";
$.extend(k, {
"margin-top": -.5 * this._css.width
, "border-top": m
, "border-bottom": m
}), k[e ? "border-left" : "border-right"] = this._css.height + "px solid " + this._css.backgroundColor
}
this.element.find(".tpd-stem-border-center-offset").css({
"margin-left": -1 * this._css.border * (e ? -1 : 1)
}).find(".tpd-stem-border-center-offset-inverse").css({
"margin-left": this._css.border * (e ? -1 : 1)
})
} else {
var l = {
"margin-left": -.5 * b.inside.width
, "border-left": j
, "border-right": j
};
if ($.extend(i, l), i[d ? "border-top" : "border-bottom"] = b.inside.height + "px solid " + this._css.borderColor, $.extend(k, l), k[d ? "border-top" : "border-bottom"] = b.inside.height + "px solid " + this._css.backgroundColor, k[d ? "bottom" : "top"] = a.top, k[d ? "top" : "bottom"] = "auto", Y.IE && Y.IE < 8) {
var m = .5 * this._css.width + "px solid transparent";
$.extend(k, {
"margin-left": -.5 * this._css.width
, "border-left": m
, "border-right": m
}), k[d ? "border-top" : "border-bottom"] = this._css.height + "px solid " + this._css.backgroundColor
}
this.element.find(".tpd-stem-border-center-offset").css({
"margin-top": -1 * this._css.border * (d ? -1 : 1)
}).find(".tpd-stem-border-center-offset-inverse").css({
"margin-top": this._css.border * (d ? -1 : 1)
})
}
this.element.find(".tpd-stem-border-center").css(i), this.element.find(".tpd-stem-border-corner").css({
"background-color": this._css.borderColor
}), this.element.find(".tpd-stem-triangle").css(k), this._css.border || this.element.find(".tpd-stem-border").hide()
}
, setPosition: function (a) {
this._position = a, this.transform.attr("class", "tpd-stem-transform tpd-stem-transform-" + a)
}
, getMath: function () {
var a = this._css.height
, b = this._css.width
, c = this._css.border;
this._useTransform && Math.floor(b) % 2 && (b = Math.max(Math.floor(b) - 1, 0));
var d = degrees(Math.atan(.5 * b / a))
, e = 90 - d
, f = c / Math.cos((90 - e) * Math.PI / 180)
, g = c / Math.cos((90 - d) * Math.PI / 180)
, h = {
width: b + 2 * f
, height: a + g
};
Math.max(c, this._css.radius), a = h.height, b = .5 * h.width;
var i = degrees(Math.atan(a / b))
, j = 90 - i
, k = c / Math.cos(j * Math.PI / 180)
, l = 180 * Math.atan(a / b) / Math.PI
, m = -1 * (90 - l)
, n = 90 - l
, o = c * Math.tan(n * Math.PI / 180)
, g = c / Math.cos((90 - n) * Math.PI / 180)
, p = $.extend({}, h)
, q = $.extend({}, h);
q.height += this._css.spacing, q.height = Math.ceil(q.height);
var r = !0;
return 2 * c >= h.width && (r = !1), {
enabled: r
, outside: q
, dimensions: {
inside: p
, outside: q
}
, top: g
, border: k
, skew: m
, corner: o
}
}
});
var bb = {
tooltips: {}
, options: {
defaultSkin: "dark"
, startingZIndex: 999999
}
, _emptyClickHandler: function () { }
, init: function () {
this.reset(), this._resizeHandler = $.proxy(this.onWindowResize, this), $(window).bind("resize orientationchange", this._resizeHandler), Y.MobileSafari && $("body").bind("click", this._emptyClickHandler)
}
, reset: function () {
bb.removeAll(), bd.removeAll(), this._resizeHandler && $(window).unbind("resize orientationchange", this._resizeHandler), Y.MobileSafari && $("body").unbind("click", this._emptyClickHandler)
}
, onWindowResize: function () {
this._resizeTimer && (window.clearTimeout(this._resizeTimer), this._resizeTimer = null), this._resizeTimer = _.delay($.proxy(function () {
var a = this.getVisible();
$.each(a, function (a, b) {
b.clearUpdatedTo(), b.position()
})
}, this), 15)
}
, _getTooltips: function (a, b) {
var c, d = []
, e = [];
if (_.isElement(a) ? (c = $(a).data("tipped-uids")) && (d = d.concat(c)) : $(a).each(function (a, b) {
(c = $(b).data("tipped-uids")) && (d = d.concat(c))
}), !d[0] && !b) {
var f = this.getTooltipByTooltipElement($(a).closest(".tpd-tooltip")[0]);
f && f.element && (c = $(f.element).data("tipped-uids") || [], c && (d = d.concat(c)))
}
return d.length > 0 && $.each(d, $.proxy(function (a, b) {
var c;
(c = this.tooltips[b]) && e.push(c)
}, this)), e
}
, findElement: function (a) {
var b = [];
return _.isElement(a) && (b = this._getTooltips(a)), b[0] && b[0].element
}
, get: function (a) {
var b = $.extend({
api: !1
}, arguments[1] || {})
, c = [];
return _.isElement(a) ? c = this._getTooltips(a) : a instanceof $ ? a.each($.proxy(function (a, b) {
var d = this._getTooltips(b, !0);
d.length > 0 && (c = c.concat(d))
}, this)) : "string" == $.type(a) && $.each(this.tooltips, function (b, d) {
d.element && $(d.element).is(a) && c.push(d)
}), b.api && $.each(c, function (a, b) {
b.is("api", !0)
}), c
}
, getTooltipByTooltipElement: function (a) {
if (!a) return null;
var b = null;
return $.each(this.tooltips, function (c, d) {
d.is("build") && d._tooltip[0] === a && (b = d)
}), b
}
, getBySelector: function (a) {
var b = [];
return $.each(this.tooltips, function (c, d) {
d.element && $(d.element).is(a) && b.push(d)
}), b
}
, getNests: function () {
var a = [];
return $.each(this.tooltips, function (b, c) {
c.is("nest") && a.push(c)
}), a
}
, show: function (a) {
$(this.get(a)).each(function (a, b) {
b.show(!1, !0)
})
}
, hide: function (a) {
$(this.get(a)).each(function (a, b) {
b.hide()
})
}
, toggle: function (a) {
$(this.get(a)).each(function (a, b) {
b.toggle()
})
}
, hideAll: function (a) {
$.each(this.getVisible(), function (b, c) {
a && a == c || c.hide()
})
}
, refresh: function (a) {
var b;
b = a ? $.grep(this.get(a), function (a) {
return a.is("visible")
}) : this.getVisible(), $.each(b, function (a, b) {
b.refresh()
})
}
, getVisible: function () {
var a = [];
return $.each(this.tooltips, function (b, c) {
c.visible() && a.push(c)
}), a
}
, isVisibleByElement: function (a) {
var b = !1;
return _.isElement(a) && $.each(this.getVisible() || [], function (c, d) {
return d.element == a ? (b = !0, !1) : void 0
}), b
}
, getHighestTooltip: function () {
var a, b = 0;
return $.each(this.tooltips, function (c, d) {
d.zIndex > b && (b = d.zIndex, a = d)
}), a
}
, resetZ: function () {
this.getVisible().length <= 1 && $.each(this.tooltips, function (a, b) {
b.is("build") && !b.options.zIndex && b._tooltip.css({
zIndex: b.zIndex = +bb.options.startingZIndex
})
})
}
, clearAjaxCache: function () {
$.each(this.tooltips, $.proxy(function (a, b) {
b.options.ajax && (b._cache && b._cache.xhr && (b._cache.xhr.abort(), b._cache.xhr = null), b.is("updated", !1), b.is("updating", !1), b.is("sanitized", !1))
}, this)), Z.clear()
}
, add: function (a) {
this.tooltips[a.uid] = a
}
, remove: function (a) {
var b = this._getTooltips(a);
this.removeTooltips(b)
}
, removeTooltips: function (a) {
a && $.each(a, $.proxy(function (a, b) {
var c = b.uid;
delete this.tooltips[c], Y.IE && Y.IE < 9 ? _.defer(function () {
b.remove()
}) : b.remove()
}, this))
}
, removeDetached: function () {
var a = this.getNests()
, b = [];
a.length > 0 && $.each(a, function (a, c) {
c.is("detached") && (b.push(c), c.attach())
}), $.each(this.tooltips, $.proxy(function (a, b) {
b.element && !_.element.isAttached(b.element) && this.remove(b.element)
}, this)), $.each(b, function (a, b) {
b.detach()
})
}
, removeAll: function () {
$.each(this.tooltips, $.proxy(function (a, b) {
b.element && this.remove(b.element)
}, this)), this.tooltips = {}
}
, setDefaultSkin: function (a) {
this.options.defaultSkin = a || "dark"
}
, setStartingZIndex: function (a) {
this.options.startingZIndex = a || 0
}
};
bb.Position = {
inversedPosition: {
left: "right"
, right: "left"
, top: "bottom"
, bottom: "top"
, middle: "middle"
, center: "center"
}
, getInversedPosition: function (a) {
var b = Position.split(a)
, c = b[1]
, d = b[2]
, e = Position.getOrientation(a)
, f = $.extend({
horizontal: !0
, vertical: !0
}, arguments[1] || {});
return "horizontal" == e ? (f.vertical && (c = this.inversedPosition[c]), f.horizontal && (d = this.inversedPosition[d])) : (f.vertical && (d = this.inversedPosition[d]), f.horizontal && (c = this.inversedPosition[c])), c + d
}
, getTooltipPositionFromTarget: function (a) {
var b = Position.split(a);
return this.getInversedPosition(b[1] + this.inversedPosition[b[2]])
}
}, $.extend(Tooltip.prototype, {
supportsLoading: Support.css.transform && Support.css.animation
, initialize: function (a, b) {
if (this.element = a, this.element) {
var c;
"object" != $.type(b) || _.isElement(b) || _.isText(b) || _.isDocumentFragment(b) || b instanceof $ ? c = arguments[2] || {} : (c = b, b = null);
var d = $(a).data("tipped-options");
d && (c = deepExtend($.extend({}, c), eval("({" + d + "})"))), this.options = ba.create(c), this._cache = {
dimensions: {
width: 0
, height: 0
}
, events: []
, timers: {}
, layouts: {}
, is: {}
, fnCallFn: ""
, updatedTo: {}
}, this.queues = {
showhide: $({})
};
var e = $(a).attr("title") || $(a).data("tipped-restore-title");
if (!b) {
var f = $(a).attr("data-tipped");
if (f ? b = f : e && (b = e), b) {
var g = /