Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Created September 9, 2013 15:21
Show Gist options
  • Select an option

  • Save wboykinm/6497098 to your computer and use it in GitHub Desktop.

Select an option

Save wboykinm/6497098 to your computer and use it in GitHub Desktop.
Javascript Map Libraries - A Comparison of Uncompressed Versions
// cartodb.js version: 3.1.11
// uncompressed version: cartodb.uncompressed.js
// sha: 2207f28d2403a31a4a30832974db31ca10a70695
(function () {
var root = this,
__prev = {
jQuery: root.jQuery,
$: root.$,
L: root.L,
Mustache: root.Mustache,
Backbone: root.Backbone,
_: root._
};
(function (e, t) {
function n(e) {
return H.isWindow(e) ? e : e.nodeType === 9 ? e.defaultView || e.parentWindow : !1
}
function r(e) {
if (!vn[e]) {
var t = _.body,
n = H("<" + e + ">").appendTo(t),
r = n.css("display");
n.remove();
if (r === "none" || r === "") {
mn || (mn = _.createElement("iframe"), mn.frameBorder = mn.width = mn.height = 0), t.appendChild(mn);
if (!gn || !mn.createElement) gn = (mn.contentWindow || mn.contentDocument).document, gn.write((H.support.boxModel ? "<!doctype html>" : "") + "<html><body>"), gn.close();
n = gn.createElement(e), gn.body.appendChild(n), r = H.css(n, "display"), t.removeChild(mn)
}
vn[e] = r
}
return vn[e]
}
function i(e, t) {
var n = {};
return H.each(En.concat.apply([], En.slice(0, t)), function () {
n[this] = e
}), n
}
function s() {
Sn = t
}
function o() {
return setTimeout(s, 0), Sn = H.now()
}
function u() {
try {
return new e.ActiveXObject("Microsoft.XMLHTTP")
} catch (t) {}
}
function a() {
try {
return new e.XMLHttpRequest
} catch (t) {}
}
function f(e, n) {
e.dataFilter && (n = e.dataFilter(n, e.dataType));
var r = e.dataTypes,
i = {},
s, o, u = r.length,
a, f = r[0],
l, c, h, p, d;
for (s = 1; s < u; s++) {
if (s === 1) for (o in e.converters) typeof o == "string" && (i[o.toLowerCase()] = e.converters[o]);
l = f, f = r[s];
if (f === "*") f = l;
else if (l !== "*" && l !== f) {
c = l + " " + f, h = i[c] || i["* " + f];
if (!h) {
d = t;
for (p in i) {
a = p.split(" ");
if (a[0] === l || a[0] === "*") {
d = i[a[1] + " " + f];
if (d) {
p = i[p], p === !0 ? h = d : d === !0 && (h = p);
break
}
}
}
}!h && !d && H.error("No conversion from " + c.replace(" ", " to ")), h !== !0 && (n = h ? h(n) : d(p(n)))
}
}
return n
}
function l(e, n, r) {
var i = e.contents,
s = e.dataTypes,
o = e.responseFields,
u, a, f, l;
for (a in o) a in r && (n[o[a]] = r[a]);
while (s[0] === "*") s.shift(), u === t && (u = e.mimeType || n.getResponseHeader("content-type"));
if (u) for (a in i) if (i[a] && i[a].test(u)) {
s.unshift(a);
break
}
if (s[0] in r) f = s[0];
else {
for (a in r) {
if (!s[0] || e.converters[a + " " + s[0]]) {
f = a;
break
}
l || (l = a)
}
f = f || l
}
if (f) return f !== s[0] && s.unshift(f), r[f]
}
function c(e, t, n, r) {
if (H.isArray(t)) H.each(t, function (t, i) {
n || Ut.test(e) ? r(e, i) : c(e + "[" + (typeof i == "object" ? t : "") + "]", i, n, r)
});
else if (!n && H.type(t) === "object") for (var i in t) c(e + "[" + i + "]", t[i], n, r);
else r(e, t)
}
function h(e, n) {
var r, i, s = H.ajaxSettings.flatOptions || {};
for (r in n) n[r] !== t && ((s[r] ? e : i || (i = {}))[r] = n[r]);
i && H.extend(!0, e, i)
}
function p(e, n, r, i, s, o) {
s = s || n.dataTypes[0], o = o || {}, o[s] = !0;
var u = e[s],
a = 0,
f = u ? u.length : 0,
l = e === rn,
c;
for (; a < f && (l || !c); a++) c = u[a](n, r, i), typeof c == "string" && (!l || o[c] ? c = t : (n.dataTypes.unshift(c), c = p(e, n, r, i, c, o)));
return (l || !c) && !o["*"] && (c = p(e, n, r, i, "*", o)), c
}
function d(e) {
return function (t, n) {
typeof t != "string" && (n = t, t = "*");
if (H.isFunction(n)) {
var r = t.toLowerCase().split(Zt),
i = 0,
s = r.length,
o, u, a;
for (; i < s; i++) o = r[i], a = /^\+/.test(o), a && (o = o.substr(1) || "*"), u = e[o] = e[o] || [], u[a ? "unshift" : "push"](n)
}
}
}
function v(e, t, n) {
var r = t === "width" ? e.offsetWidth : e.offsetHeight,
i = t === "width" ? 1 : 0,
s = 4;
if (r > 0) {
if (n !== "border") for (; i < s; i += 2) n || (r -= parseFloat(H.css(e, "padding" + jt[i])) || 0), n === "margin" ? r += parseFloat(H.css(e, n + jt[i])) || 0 : r -= parseFloat(H.css(e, "border" + jt[i] + "Width")) || 0;
return r + "px"
}
r = Ft(e, t);
if (r < 0 || r == null) r = e.style[t];
if (Dt.test(r)) return r;
r = parseFloat(r) || 0;
if (n) for (; i < s; i += 2) r += parseFloat(H.css(e, "padding" + jt[i])) || 0, n !== "padding" && (r += parseFloat(H.css(e, "border" + jt[i] + "Width")) || 0), n === "margin" && (r += parseFloat(H.css(e, n + jt[i])) || 0);
return r + "px"
}
function m(e) {
var t = _.createElement("div");
return Lt.appendChild(t), t.innerHTML = e.outerHTML, t.firstChild
}
function g(e) {
var t = (e.nodeName || "").toLowerCase();
t === "input" ? y(e) : t !== "script" && typeof e.getElementsByTagName != "undefined" && H.grep(e.getElementsByTagName("input"), y)
}
function y(e) {
if (e.type === "checkbox" || e.type === "radio") e.defaultChecked = e.checked
}
function b(e) {
return typeof e.getElementsByTagName != "undefined" ? e.getElementsByTagName("*") : typeof e.querySelectorAll != "undefined" ? e.querySelectorAll("*") : []
}
function w(e, t) {
var n;
t.nodeType === 1 && (t.clearAttributes && t.clearAttributes(), t.mergeAttributes && t.mergeAttributes(e), n = t.nodeName.toLowerCase(), n === "object" ? t.outerHTML = e.outerHTML : n !== "input" || e.type !== "checkbox" && e.type !== "radio" ? n === "option" ? t.selected = e.defaultSelected : n === "input" || n === "textarea" ? t.defaultValue = e.defaultValue : n === "script" && t.text !== e.text && (t.text = e.text) : (e.checked && (t.defaultChecked = t.checked = e.checked), t.value !== e.value && (t.value = e.value)), t.removeAttribute(H.expando), t.removeAttribute("_submit_attached"), t.removeAttribute("_change_attached"))
}
function E(e, t) {
if (t.nodeType === 1 && !! H.hasData(e)) {
var n, r, i, s = H._data(e),
o = H._data(t, s),
u = s.events;
if (u) {
delete o.handle, o.events = {};
for (n in u) for (r = 0, i = u[n].length; r < i; r++) H.event.add(t, n, u[n][r])
}
o.data && (o.data = H.extend({}, o.data))
}
}
function S(e, t) {
return H.nodeName(e, "table") ? e.getElementsByTagName("tbody")[0] || e.appendChild(e.ownerDocument.createElement("tbody")) : e
}
function x(e) {
var t = dt.split("|"),
n = e.createDocumentFragment();
if (n.createElement) while (t.length) n.createElement(t.pop());
return n
}
function T(e, t, n) {
t = t || 0;
if (H.isFunction(t)) return H.grep(e, function (e, r) {
var i = !! t.call(e, r, e);
return i === n
});
if (t.nodeType) return H.grep(e, function (e, r) {
return e === t === n
});
if (typeof t == "string") {
var r = H.grep(e, function (e) {
return e.nodeType === 1
});
if (lt.test(t)) return H.filter(t, r, !n);
t = H.filter(t, r)
}
return H.grep(e, function (e, r) {
return H.inArray(e, t) >= 0 === n
})
}
function N(e) {
return !e || !e.parentNode || e.parentNode.nodeType === 11
}
function C() {
return !0
}
function k() {
return !1
}
function L(e, t, n) {
var r = t + "defer",
i = t + "queue",
s = t + "mark",
o = H._data(e, r);
o && (n === "queue" || !H._data(e, i)) && (n === "mark" || !H._data(e, s)) && setTimeout(function () {
!H._data(e, i) && !H._data(e, s) && (H.removeData(e, r, !0), o.fire())
}, 0)
}
function A(e) {
for (var t in e) {
if (t === "data" && H.isEmptyObject(e[t])) continue;
if (t !== "toJSON") return !1
}
return !0
}
function O(e, n, r) {
if (r === t && e.nodeType === 1) {
var i = "data-" + n.replace(I, "-$1").toLowerCase();
r = e.getAttribute(i);
if (typeof r == "string") {
try {
r = r === "true" ? !0 : r === "false" ? !1 : r === "null" ? null : H.isNumeric(r) ? +r : F.test(r) ? H.parseJSON(r) : r
} catch (s) {}
H.data(e, n, r)
} else r = t
}
return r
}
function M(e) {
var t = B[e] = {},
n, r;
e = e.split(/\s+/);
for (n = 0, r = e.length; n < r; n++) t[e[n]] = !0;
return t
}
var _ = e.document,
D = e.navigator,
P = e.location,
H = function () {
function n() {
if (!r.isReady) {
try {
_.documentElement.doScroll("left")
} catch (e) {
setTimeout(n, 1);
return
}
r.ready()
}
}
var r = function (e, t) {
return new r.fn.init(e, t, o)
},
i = e.jQuery,
s = e.$,
o, u = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
a = /\S/,
f = /^\s+/,
l = /\s+$/,
c = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
h = /^[\],:{}\s]*$/,
p = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
d = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
v = /(?:^|:|,)(?:\s*\[)+/g,
m = /(webkit)[ \/]([\w.]+)/,
g = /(opera)(?:.*version)?[ \/]([\w.]+)/,
y = /(msie) ([\w.]+)/,
b = /(mozilla)(?:.*? rv:([\w.]+))?/,
w = /-([a-z]|[0-9])/ig,
E = /^-ms-/,
S = function (e, t) {
return (t + "").toUpperCase()
},
x = D.userAgent,
T, N, C, k = Object.prototype.toString,
L = Object.prototype.hasOwnProperty,
A = Array.prototype.push,
O = Array.prototype.slice,
M = String.prototype.trim,
P = Array.prototype.indexOf,
H = {};
return r.fn = r.prototype = {
constructor: r,
init: function (e, n, i) {
var s, o, a, f;
if (!e) return this;
if (e.nodeType) return this.context = this[0] = e, this.length = 1, this;
if (e === "body" && !n && _.body) return this.context = _, this[0] = _.body, this.selector = e, this.length = 1, this;
if (typeof e == "string") {
e.charAt(0) !== "<" || e.charAt(e.length - 1) !== ">" || e.length < 3 ? s = u.exec(e) : s = [null, e, null];
if (s && (s[1] || !n)) {
if (s[1]) return n = n instanceof r ? n[0] : n, f = n ? n.ownerDocument || n : _, a = c.exec(e), a ? r.isPlainObject(n) ? (e = [_.createElement(a[1])], r.fn.attr.call(e, n, !0)) : e = [f.createElement(a[1])] : (a = r.buildFragment([s[1]], [f]), e = (a.cacheable ? r.clone(a.fragment) : a.fragment).childNodes), r.merge(this, e);
o = _.getElementById(s[2]);
if (o && o.parentNode) {
if (o.id !== s[2]) return i.find(e);
this.length = 1, this[0] = o
}
return this.context = _, this.selector = e, this
}
return !n || n.jquery ? (n || i).find(e) : this.constructor(n).find(e)
}
return r.isFunction(e) ? i.ready(e) : (e.selector !== t && (this.selector = e.selector, this.context = e.context), r.makeArray(e, this))
},
selector: "",
jquery: "1.7.2",
length: 0,
size: function () {
return this.length
},
toArray: function () {
return O.call(this, 0)
},
get: function (e) {
return e == null ? this.toArray() : e < 0 ? this[this.length + e] : this[e]
},
pushStack: function (e, t, n) {
var i = this.constructor();
return r.isArray(e) ? A.apply(i, e) : r.merge(i, e), i.prevObject = this, i.context = this.context, t === "find" ? i.selector = this.selector + (this.selector ? " " : "") + n : t && (i.selector = this.selector + "." + t + "(" + n + ")"), i
},
each: function (e, t) {
return r.each(this, e, t)
},
ready: function (e) {
return r.bindReady(), N.add(e), this
},
eq: function (e) {
return e = +e, e === -1 ? this.slice(e) : this.slice(e, e + 1)
},
first: function () {
return this.eq(0)
},
last: function () {
return this.eq(-1)
},
slice: function () {
return this.pushStack(O.apply(this, arguments), "slice", O.call(arguments).join(","))
},
map: function (e) {
return this.pushStack(r.map(this, function (t, n) {
return e.call(t, n, t)
}))
},
end: function () {
return this.prevObject || this.constructor(null)
},
push: A,
sort: [].sort,
splice: [].splice
}, r.fn.init.prototype = r.fn, r.extend = r.fn.extend = function () {
var e, n, i, s, o, u, a = arguments[0] || {},
f = 1,
l = arguments.length,
c = !1;
typeof a == "boolean" && (c = a, a = arguments[1] || {}, f = 2), typeof a != "object" && !r.isFunction(a) && (a = {}), l === f && (a = this, --f);
for (; f < l; f++) if ((e = arguments[f]) != null) for (n in e) {
i = a[n], s = e[n];
if (a === s) continue;
c && s && (r.isPlainObject(s) || (o = r.isArray(s))) ? (o ? (o = !1, u = i && r.isArray(i) ? i : []) : u = i && r.isPlainObject(i) ? i : {}, a[n] = r.extend(c, u, s)) : s !== t && (a[n] = s)
}
return a
}, r.extend({
noConflict: function (t) {
return e.$ === r && (e.$ = s), t && e.jQuery === r && (e.jQuery = i), r
},
isReady: !1,
readyWait: 1,
holdReady: function (e) {
e ? r.readyWait++ : r.ready(!0)
},
ready: function (e) {
if (e === !0 && !--r.readyWait || e !== !0 && !r.isReady) {
if (!_.body) return setTimeout(r.ready, 1);
r.isReady = !0;
if (e !== !0 && --r.readyWait > 0) return;
N.fireWith(_, [r]), r.fn.trigger && r(_).trigger("ready").off("ready")
}
},
bindReady: function () {
if (!N) {
N = r.Callbacks("once memory");
if (_.readyState === "complete") return setTimeout(r.ready, 1);
if (_.addEventListener) _.addEventListener("DOMContentLoaded", C, !1), e.addEventListener("load", r.ready, !1);
else if (_.attachEvent) {
_.attachEvent("onreadystatechange", C), e.attachEvent("onload", r.ready);
var t = !1;
try {
t = e.frameElement == null
} catch (i) {}
_.documentElement.doScroll && t && n()
}
}
},
isFunction: function (e) {
return r.type(e) === "function"
},
isArray: Array.isArray ||
function (e) {
return r.type(e) === "array"
},
isWindow: function (e) {
return e != null && e == e.window
},
isNumeric: function (e) {
return !isNaN(parseFloat(e)) && isFinite(e)
},
type: function (e) {
return e == null ? String(e) : H[k.call(e)] || "object"
},
isPlainObject: function (e) {
if (!e || r.type(e) !== "object" || e.nodeType || r.isWindow(e)) return !1;
try {
if (e.constructor && !L.call(e, "constructor") && !L.call(e.constructor.prototype, "isPrototypeOf")) return !1
} catch (n) {
return !1
}
var i;
for (i in e);
return i === t || L.call(e, i)
},
isEmptyObject: function (e) {
for (var t in e) return !1;
return !0
},
error: function (e) {
throw new Error(e)
},
parseJSON: function (t) {
if (typeof t != "string" || !t) return null;
t = r.trim(t);
if (e.JSON && e.JSON.parse) return e.JSON.parse(t);
if (h.test(t.replace(p, "@").replace(d, "]").replace(v, ""))) return (new Function("return " + t))();
r.error("Invalid JSON: " + t)
},
parseXML: function (n) {
if (typeof n != "string" || !n) return null;
var i, s;
try {
e.DOMParser ? (s = new DOMParser, i = s.parseFromString(n, "text/xml")) : (i = new ActiveXObject("Microsoft.XMLDOM"), i.async = "false", i.loadXML(n))
} catch (o) {
i = t
}
return (!i || !i.documentElement || i.getElementsByTagName("parsererror").length) && r.error("Invalid XML: " + n), i
},
noop: function () {},
globalEval: function (t) {
t && a.test(t) && (e.execScript ||
function (t) {
e.eval.call(e, t)
})(t)
},
camelCase: function (e) {
return e.replace(E, "ms-").replace(w, S)
},
nodeName: function (e, t) {
return e.nodeName && e.nodeName.toUpperCase() === t.toUpperCase()
},
each: function (e, n, i) {
var s, o = 0,
u = e.length,
a = u === t || r.isFunction(e);
if (i) {
if (a) {
for (s in e) if (n.apply(e[s], i) === !1) break
} else for (; o < u;) if (n.apply(e[o++], i) === !1) break
} else if (a) {
for (s in e) if (n.call(e[s], s, e[s]) === !1) break
} else for (; o < u;) if (n.call(e[o], o, e[o++]) === !1) break;
return e
},
trim: M ?
function (e) {
return e == null ? "" : M.call(e)
} : function (e) {
return e == null ? "" : (e + "").replace(f, "").replace(l, "")
},
makeArray: function (e, t) {
var n = t || [];
if (e != null) {
var i = r.type(e);
e.length == null || i === "string" || i === "function" || i === "regexp" || r.isWindow(e) ? A.call(n, e) : r.merge(n, e)
}
return n
},
inArray: function (e, t, n) {
var r;
if (t) {
if (P) return P.call(t, e, n);
r = t.length, n = n ? n < 0 ? Math.max(0, r + n) : n : 0;
for (; n < r; n++) if (n in t && t[n] === e) return n
}
return -1
},
merge: function (e, n) {
var r = e.length,
i = 0;
if (typeof n.length == "number") for (var s = n.length; i < s; i++) e[r++] = n[i];
else while (n[i] !== t) e[r++] = n[i++];
return e.length = r, e
},
grep: function (e, t, n) {
var r = [],
i;
n = !! n;
for (var s = 0, o = e.length; s < o; s++) i = !! t(e[s], s), n !== i && r.push(e[s]);
return r
},
map: function (e, n, i) {
var s, o, u = [],
a = 0,
f = e.length,
l = e instanceof r || f !== t && typeof f == "number" && (f > 0 && e[0] && e[f - 1] || f === 0 || r.isArray(e));
if (l) for (; a < f; a++) s = n(e[a], a, i), s != null && (u[u.length] = s);
else for (o in e) s = n(e[o], o, i), s != null && (u[u.length] = s);
return u.concat.apply([], u)
},
guid: 1,
proxy: function (e, n) {
if (typeof n == "string") {
var i = e[n];
n = e, e = i
}
if (!r.isFunction(e)) return t;
var s = O.call(arguments, 2),
o = function () {
return e.apply(n, s.concat(O.call(arguments)))
};
return o.guid = e.guid = e.guid || o.guid || r.guid++, o
},
access: function (e, n, i, s, o, u, a) {
var f, l = i == null,
c = 0,
h = e.length;
if (i && typeof i == "object") {
for (c in i) r.access(e, n, c, i[c], 1, u, s);
o = 1
} else if (s !== t) {
f = a === t && r.isFunction(s), l && (f ? (f = n, n = function (e, t, n) {
return f.call(r(e), n)
}) : (n.call(e, s), n = null));
if (n) for (; c < h; c++) n(e[c], i, f ? s.call(e[c], c, n(e[c], i)) : s, a);
o = 1
}
return o ? e : l ? n.call(e) : h ? n(e[0], i) : u
},
now: function () {
return (new Date).getTime()
},
uaMatch: function (e) {
e = e.toLowerCase();
var t = m.exec(e) || g.exec(e) || y.exec(e) || e.indexOf("compatible") < 0 && b.exec(e) || [];
return {
browser: t[1] || "",
version: t[2] || "0"
}
},
sub: function () {
function e(t, n) {
return new e.fn.init(t, n)
}
r.extend(!0, e, this), e.superclass = this, e.fn = e.prototype = this(), e.fn.constructor = e, e.sub = this.sub, e.fn.init = function (n, i) {
return i && i instanceof r && !(i instanceof e) && (i = e(i)), r.fn.init.call(this, n, i, t)
}, e.fn.init.prototype = e.fn;
var t = e(_);
return e
},
browser: {}
}), r.each("Boolean Number String Function Array Date RegExp Object".split(" "), function (e, t) {
H["[object " + t + "]"] = t.toLowerCase()
}), T = r.uaMatch(x), T.browser && (r.browser[T.browser] = !0, r.browser.version = T.version), r.browser.webkit && (r.browser.safari = !0), a.test("Â ") && (f = /^[\s\xA0]+/, l = /[\s\xA0]+$/), o = r(_), _.addEventListener ? C = function () {
_.removeEventListener("DOMContentLoaded", C, !1), r.ready()
} : _.attachEvent && (C = function () {
_.readyState === "complete" && (_.detachEvent("onreadystatechange", C), r.ready())
}), r
}(),
B = {};
H.Callbacks = function (e) {
e = e ? B[e] || M(e) : {};
var n = [],
r = [],
i, s, o, u, a, f, l = function (t) {
var r, i, s, o, u;
for (r = 0, i = t.length; r < i; r++) s = t[r], o = H.type(s), o === "array" ? l(s) : o === "function" && (!e.unique || !h.has(s)) && n.push(s)
},
c = function (t, l) {
l = l || [], i = !e.memory || [t, l], s = !0, o = !0, f = u || 0, u = 0, a = n.length;
for (; n && f < a; f++) if (n[f].apply(t, l) === !1 && e.stopOnFalse) {
i = !0;
break
}
o = !1, n && (e.once ? i === !0 ? h.disable() : n = [] : r && r.length && (i = r.shift(), h.fireWith(i[0], i[1])))
},
h = {
add: function () {
if (n) {
var e = n.length;
l(arguments), o ? a = n.length : i && i !== !0 && (u = e, c(i[0], i[1]))
}
return this
},
remove: function () {
if (n) {
var t = arguments,
r = 0,
i = t.length;
for (; r < i; r++) for (var s = 0; s < n.length; s++) if (t[r] === n[s]) {
o && s <= a && (a--, s <= f && f--), n.splice(s--, 1);
if (e.unique) break
}
}
return this
},
has: function (e) {
if (n) {
var t = 0,
r = n.length;
for (; t < r; t++) if (e === n[t]) return !0
}
return !1
},
empty: function () {
return n = [], this
},
disable: function () {
return n = r = i = t, this
},
disabled: function () {
return !n
},
lock: function () {
return r = t, (!i || i === !0) && h.disable(), this
},
locked: function () {
return !r
},
fireWith: function (t, n) {
return r && (o ? e.once || r.push([t, n]) : (!e.once || !i) && c(t, n)), this
},
fire: function () {
return h.fireWith(this, arguments), this
},
fired: function () {
return !!s
}
};
return h
};
var j = [].slice;
H.extend({
Deferred: function (e) {
var t = H.Callbacks("once memory"),
n = H.Callbacks("once memory"),
r = H.Callbacks("memory"),
i = "pending",
s = {
resolve: t,
reject: n,
notify: r
},
o = {
done: t.add,
fail: n.add,
progress: r.add,
state: function () {
return i
},
isResolved: t.fired,
isRejected: n.fired,
then: function (e, t, n) {
return u.done(e).fail(t).progress(n), this
},
always: function () {
return u.done.apply(u, arguments).fail.apply(u, arguments), this
},
pipe: function (e, t, n) {
return H.Deferred(function (r) {
H.each({
done: [e, "resolve"],
fail: [t, "reject"],
progress: [n, "notify"]
}, function (e, t) {
var n = t[0],
i = t[1],
s;
H.isFunction(n) ? u[e](function () {
s = n.apply(this, arguments), s && H.isFunction(s.promise) ? s.promise().then(r.resolve, r.reject, r.notify) : r[i + "With"](this === u ? r : this, [s])
}) : u[e](r[i])
})
}).promise()
},
promise: function (e) {
if (e == null) e = o;
else for (var t in o) e[t] = o[t];
return e
}
},
u = o.promise({}),
a;
for (a in s) u[a] = s[a].fire, u[a + "With"] = s[a].fireWith;
return u.done(function () {
i = "resolved"
}, n.disable, r.lock).fail(function () {
i = "rejected"
}, t.disable, r.lock), e && e.call(u, u), u
},
when: function (e) {
function t(e) {
return function (t) {
o[e] = arguments.length > 1 ? j.call(arguments, 0) : t, f.notifyWith(l, o)
}
}
function n(e) {
return function (t) {
r[e] = arguments.length > 1 ? j.call(arguments, 0) : t, --u || f.resolveWith(f, r)
}
}
var r = j.call(arguments, 0),
i = 0,
s = r.length,
o = Array(s),
u = s,
a = s,
f = s <= 1 && e && H.isFunction(e.promise) ? e : H.Deferred(),
l = f.promise();
if (s > 1) {
for (; i < s; i++) r[i] && r[i].promise && H.isFunction(r[i].promise) ? r[i].promise().then(n(i), f.reject, t(i)) : --u;
u || f.resolveWith(f, r)
} else f !== e && f.resolveWith(f, s ? [e] : []);
return l
}
}), H.support = function () {
var t, n, r, i, s, o, u, a, f, l, c, h, p = _.createElement("div"),
d = _.documentElement;
p.setAttribute("className", "t"), p.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>", n = p.getElementsByTagName("*"), r = p.getElementsByTagName("a")[0];
if (!n || !n.length || !r) return {};
i = _.createElement("select"), s = i.appendChild(_.createElement("option")), o = p.getElementsByTagName("input")[0], t = {
leadingWhitespace: p.firstChild.nodeType === 3,
tbody: !p.getElementsByTagName("tbody").length,
htmlSerialize: !! p.getElementsByTagName("link").length,
style: /top/.test(r.getAttribute("style")),
hrefNormalized: r.getAttribute("href") === "/a",
opacity: /^0.55/.test(r.style.opacity),
cssFloat: !! r.style.cssFloat,
checkOn: o.value === "on",
optSelected: s.selected,
getSetAttribute: p.className !== "t",
enctype: !! _.createElement("form").enctype,
html5Clone: _.createElement("nav").cloneNode(!0).outerHTML !== "<:nav></:nav>",
submitBubbles: !0,
changeBubbles: !0,
focusinBubbles: !1,
deleteExpando: !0,
noCloneEvent: !0,
inlineBlockNeedsLayout: !1,
shrinkWrapBlocks: !1,
reliableMarginRight: !0,
pixelMargin: !0
}, H.boxModel = t.boxModel = _.compatMode === "CSS1Compat", o.checked = !0, t.noCloneChecked = o.cloneNode(!0).checked, i.disabled = !0, t.optDisabled = !s.disabled;
try {
delete p.test
} catch (v) {
t.deleteExpando = !1
}!p.addEventListener && p.attachEvent && p.fireEvent && (p.attachEvent("onclick", function () {
t.noCloneEvent = !1
}), p.cloneNode(!0).fireEvent("onclick")), o = _.createElement("input"), o.value = "t", o.setAttribute("type", "radio"), t.radioValue = o.value === "t", o.setAttribute("checked", "checked"), o.setAttribute("name", "t"), p.appendChild(o), u = _.createDocumentFragment(), u.appendChild(p.lastChild), t.checkClone = u.cloneNode(!0).cloneNode(!0).lastChild.checked, t.appendChecked = o.checked, u.removeChild(o), u.appendChild(p);
if (p.attachEvent) for (c in {
submit: 1,
change: 1,
focusin: 1
}) l = "on" + c, h = l in p, h || (p.setAttribute(l, "return;"), h = typeof p[l] == "function"), t[c + "Bubbles"] = h;
return u.removeChild(p), u = i = s = p = o = null, H(function () {
var n, r, i, s, o, u, f, l, c, d, v, m, g, y = _.getElementsByTagName("body")[0];
!y || (l = 1, g = "padding:0;margin:0;border:", v = "position:absolute;top:0;left:0;width:1px;height:1px;", m = g + "0;visibility:hidden;", c = "style='" + v + g + "5px solid #000;", d = "<div " + c + "display:block;'><div style='" + g + "0;display:block;overflow:hidden;'></div></div>" + "<table " + c + "' cellpadding='0' cellspacing='0'>" + "<tr><td></td></tr></table>", n = _.createElement("div"), n.style.cssText = m + "width:0;height:0;position:static;top:0;margin-top:" + l + "px", y.insertBefore(n, y.firstChild), p = _.createElement("div"), n.appendChild(p), p.innerHTML = "<table><tr><td style='" + g + "0;display:none'></td><td>t</td></tr></table>", a = p.getElementsByTagName("td"), h = a[0].offsetHeight === 0, a[0].style.display = "", a[1].style.display = "none", t.reliableHiddenOffsets = h && a[0].offsetHeight === 0, e.getComputedStyle && (p.innerHTML = "", f = _.createElement("div"), f.style.width = "0", f.style.marginRight = "0", p.style.width = "2px", p.appendChild(f), t.reliableMarginRight = (parseInt((e.getComputedStyle(f, null) || {
marginRight: 0
}).marginRight, 10) || 0) === 0), typeof p.style.zoom != "undefined" && (p.innerHTML = "", p.style.width = p.style.padding = "1px", p.style.border = 0, p.style.overflow = "hidden", p.style.display = "inline", p.style.zoom = 1, t.inlineBlockNeedsLayout = p.offsetWidth === 3, p.style.display = "block", p.style.overflow = "visible", p.innerHTML = "<div style='width:5px;'></div>", t.shrinkWrapBlocks = p.offsetWidth !== 3), p.style.cssText = v + m, p.innerHTML = d, r = p.firstChild, i = r.firstChild, o = r.nextSibling.firstChild.firstChild, u = {
doesNotAddBorder: i.offsetTop !== 5,
doesAddBorderForTableAndCells: o.offsetTop === 5
}, i.style.position = "fixed", i.style.top = "20px", u.fixedPosition = i.offsetTop === 20 || i.offsetTop === 15, i.style.position = i.style.top = "", r.style.overflow = "hidden", r.style.position = "relative", u.subtractsBorderForOverflowNotVisible = i.offsetTop === -5, u.doesNotIncludeMarginInBodyOffset = y.offsetTop !== l, e.getComputedStyle && (p.style.marginTop = "1%", t.pixelMargin = (e.getComputedStyle(p, null) || {
marginTop: 0
}).marginTop !== "1%"), typeof n.style.zoom != "undefined" && (n.style.zoom = 1), y.removeChild(n), f = p = n = null, H.extend(t, u))
}), t
}();
var F = /^(?:\{.*\}|\[.*\])$/,
I = /([A-Z])/g;
H.extend({
cache: {},
uuid: 0,
expando: "jQuery" + (H.fn.jquery + Math.random()).replace(/\D/g, ""),
noData: {
embed: !0,
object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
applet: !0
},
hasData: function (e) {
return e = e.nodeType ? H.cache[e[H.expando]] : e[H.expando], !! e && !A(e)
},
data: function (e, n, r, i) {
if ( !! H.acceptData(e)) {
var s, o, u, a = H.expando,
f = typeof n == "string",
l = e.nodeType,
c = l ? H.cache : e,
h = l ? e[a] : e[a] && a,
p = n === "events";
if ((!h || !c[h] || !p && !i && !c[h].data) && f && r === t) return;
h || (l ? e[a] = h = ++H.uuid : h = a), c[h] || (c[h] = {}, l || (c[h].toJSON = H.noop));
if (typeof n == "object" || typeof n == "function") i ? c[h] = H.extend(c[h], n) : c[h].data = H.extend(c[h].data, n);
return s = o = c[h], i || (o.data || (o.data = {}), o = o.data), r !== t && (o[H.camelCase(n)] = r), p && !o[n] ? s.events : (f ? (u = o[n], u == null && (u = o[H.camelCase(n)])) : u = o, u)
}
},
removeData: function (e, t, n) {
if ( !! H.acceptData(e)) {
var r, i, s, o = H.expando,
u = e.nodeType,
a = u ? H.cache : e,
f = u ? e[o] : o;
if (!a[f]) return;
if (t) {
r = n ? a[f] : a[f].data;
if (r) {
H.isArray(t) || (t in r ? t = [t] : (t = H.camelCase(t), t in r ? t = [t] : t = t.split(" ")));
for (i = 0, s = t.length; i < s; i++) delete r[t[i]];
if (!(n ? A : H.isEmptyObject)(r)) return
}
}
if (!n) {
delete a[f].data;
if (!A(a[f])) return
}
H.support.deleteExpando || !a.setInterval ? delete a[f] : a[f] = null, u && (H.support.deleteExpando ? delete e[o] : e.removeAttribute ? e.removeAttribute(o) : e[o] = null)
}
},
_data: function (e, t, n) {
return H.data(e, t, n, !0)
},
acceptData: function (e) {
if (e.nodeName) {
var t = H.noData[e.nodeName.toLowerCase()];
if (t) return t !== !0 && e.getAttribute("classid") === t
}
return !0
}
}), H.fn.extend({
data: function (e, n) {
var r, i, s, o, u, a = this[0],
f = 0,
l = null;
if (e === t) {
if (this.length) {
l = H.data(a);
if (a.nodeType === 1 && !H._data(a, "parsedAttrs")) {
s = a.attributes;
for (u = s.length; f < u; f++) o = s[f].name, o.indexOf("data-") === 0 && (o = H.camelCase(o.substring(5)), O(a, o, l[o]));
H._data(a, "parsedAttrs", !0)
}
}
return l
}
return typeof e == "object" ? this.each(function () {
H.data(this, e)
}) : (r = e.split(".", 2), r[1] = r[1] ? "." + r[1] : "", i = r[1] + "!", H.access(this, function (n) {
if (n === t) return l = this.triggerHandler("getData" + i, [r[0]]), l === t && a && (l = H.data(a, e), l = O(a, e, l)), l === t && r[1] ? this.data(r[0]) : l;
r[1] = n, this.each(function () {
var t = H(this);
t.triggerHandler("setData" + i, r), H.data(this, e, n), t.triggerHandler("changeData" + i, r)
})
}, null, n, arguments.length > 1, null, !1))
},
removeData: function (e) {
return this.each(function () {
H.removeData(this, e)
})
}
}), H.extend({
_mark: function (e, t) {
e && (t = (t || "fx") + "mark", H._data(e, t, (H._data(e, t) || 0) + 1))
},
_unmark: function (e, t, n) {
e !== !0 && (n = t, t = e, e = !1);
if (t) {
n = n || "fx";
var r = n + "mark",
i = e ? 0 : (H._data(t, r) || 1) - 1;
i ? H._data(t, r, i) : (H.removeData(t, r, !0), L(t, n, "mark"))
}
},
queue: function (e, t, n) {
var r;
if (e) return t = (t || "fx") + "queue", r = H._data(e, t), n && (!r || H.isArray(n) ? r = H._data(e, t, H.makeArray(n)) : r.push(n)), r || []
},
dequeue: function (e, t) {
t = t || "fx";
var n = H.queue(e, t),
r = n.shift(),
i = {};
r === "inprogress" && (r = n.shift()), r && (t === "fx" && n.unshift("inprogress"), H._data(e, t + ".run", i), r.call(e, function () {
H.dequeue(e, t)
}, i)), n.length || (H.removeData(e, t + "queue " + t + ".run", !0), L(e, t, "queue"))
}
}), H.fn.extend({
queue: function (e, n) {
var r = 2;
return typeof e != "string" && (n = e, e = "fx", r--), arguments.length < r ? H.queue(this[0], e) : n === t ? this : this.each(function () {
var t = H.queue(this, e, n);
e === "fx" && t[0] !== "inprogress" && H.dequeue(this, e)
})
},
dequeue: function (e) {
return this.each(function () {
H.dequeue(this, e)
})
},
delay: function (e, t) {
return e = H.fx ? H.fx.speeds[e] || e : e, t = t || "fx", this.queue(t, function (t, n) {
var r = setTimeout(t, e);
n.stop = function () {
clearTimeout(r)
}
})
},
clearQueue: function (e) {
return this.queue(e || "fx", [])
},
promise: function (e, n) {
function r() {
--u || i.resolveWith(s, [s])
}
typeof e != "string" && (n = e, e = t), e = e || "fx";
var i = H.Deferred(),
s = this,
o = s.length,
u = 1,
a = e + "defer",
f = e + "queue",
l = e + "mark",
c;
while (o--) if (c = H.data(s[o], a, t, !0) || (H.data(s[o], f, t, !0) || H.data(s[o], l, t, !0)) && H.data(s[o], a, H.Callbacks("once memory"), !0)) u++, c.add(r);
return r(), i.promise(n)
}
});
var q = /[\n\t\r]/g,
R = /\s+/,
U = /\r/g,
z = /^(?:button|input)$/i,
W = /^(?:button|input|object|select|textarea)$/i,
X = /^a(?:rea)?$/i,
V = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
$ = H.support.getSetAttribute,
J, K, Q;
H.fn.extend({
attr: function (e, t) {
return H.access(this, H.attr, e, t, arguments.length > 1)
},
removeAttr: function (e) {
return this.each(function () {
H.removeAttr(this, e)
})
},
prop: function (e, t) {
return H.access(this, H.prop, e, t, arguments.length > 1)
},
removeProp: function (e) {
return e = H.propFix[e] || e, this.each(function () {
try {
this[e] = t, delete this[e]
} catch (n) {}
})
},
addClass: function (e) {
var t, n, r, i, s, o, u;
if (H.isFunction(e)) return this.each(function (t) {
H(this).addClass(e.call(this, t, this.className))
});
if (e && typeof e == "string") {
t = e.split(R);
for (n = 0, r = this.length; n < r; n++) {
i = this[n];
if (i.nodeType === 1) if (!i.className && t.length === 1) i.className = e;
else {
s = " " + i.className + " ";
for (o = 0, u = t.length; o < u; o++)~s.indexOf(" " + t[o] + " ") || (s += t[o] + " ");
i.className = H.trim(s)
}
}
}
return this
},
removeClass: function (e) {
var n, r, i, s, o, u, a;
if (H.isFunction(e)) return this.each(function (t) {
H(this).removeClass(e.call(this, t, this.className))
});
if (e && typeof e == "string" || e === t) {
n = (e || "").split(R);
for (r = 0, i = this.length; r < i; r++) {
s = this[r];
if (s.nodeType === 1 && s.className) if (e) {
o = (" " + s.className + " ").replace(q, " ");
for (u = 0, a = n.length; u < a; u++) o = o.replace(" " + n[u] + " ", " ");
s.className = H.trim(o)
} else s.className = ""
}
}
return this
},
toggleClass: function (e, t) {
var n = typeof e,
r = typeof t == "boolean";
return H.isFunction(e) ? this.each(function (n) {
H(this).toggleClass(e.call(this, n, this.className, t), t)
}) : this.each(function () {
if (n === "string") {
var i, s = 0,
o = H(this),
u = t,
a = e.split(R);
while (i = a[s++]) u = r ? u : !o.hasClass(i), o[u ? "addClass" : "removeClass"](i)
} else if (n === "undefined" || n === "boolean") this.className && H._data(this, "__className__", this.className), this.className = this.className || e === !1 ? "" : H._data(this, "__className__") || ""
})
},
hasClass: function (e) {
var t = " " + e + " ",
n = 0,
r = this.length;
for (; n < r; n++) if (this[n].nodeType === 1 && (" " + this[n].className + " ").replace(q, " ").indexOf(t) > -1) return !0;
return !1
},
val: function (e) {
var n, r, i, s = this[0];
if ( !! arguments.length) return i = H.isFunction(e), this.each(function (r) {
var s = H(this),
o;
if (this.nodeType === 1) {
i ? o = e.call(this, r, s.val()) : o = e, o == null ? o = "" : typeof o == "number" ? o += "" : H.isArray(o) && (o = H.map(o, function (e) {
return e == null ? "" : e + ""
})), n = H.valHooks[this.type] || H.valHooks[this.nodeName.toLowerCase()];
if (!n || !("set" in n) || n.set(this, o, "value") === t) this.value = o
}
});
if (s) return n = H.valHooks[s.type] || H.valHooks[s.nodeName.toLowerCase()], n && "get" in n && (r = n.get(s, "value")) !== t ? r : (r = s.value, typeof r == "string" ? r.replace(U, "") : r == null ? "" : r)
}
}), H.extend({
valHooks: {
option: {
get: function (e) {
var t = e.attributes.value;
return !t || t.specified ? e.value : e.text
}
},
select: {
get: function (e) {
var t, n, r, i, s = e.selectedIndex,
o = [],
u = e.options,
a = e.type === "select-one";
if (s < 0) return null;
n = a ? s : 0, r = a ? s + 1 : u.length;
for (; n < r; n++) {
i = u[n];
if (i.selected && (H.support.optDisabled ? !i.disabled : i.getAttribute("disabled") === null) && (!i.parentNode.disabled || !H.nodeName(i.parentNode, "optgroup"))) {
t = H(i).val();
if (a) return t;
o.push(t)
}
}
return a && !o.length && u.length ? H(u[s]).val() : o
},
set: function (e, t) {
var n = H.makeArray(t);
return H(e).find("option").each(function () {
this.selected = H.inArray(H(this).val(), n) >= 0
}), n.length || (e.selectedIndex = -1), n
}
}
},
attrFn: {
val: !0,
css: !0,
html: !0,
text: !0,
data: !0,
width: !0,
height: !0,
offset: !0
},
attr: function (e, n, r, i) {
var s, o, u, a = e.nodeType;
if ( !! e && a !== 3 && a !== 8 && a !== 2) {
if (i && n in H.attrFn) return H(e)[n](r);
if (typeof e.getAttribute == "undefined") return H.prop(e, n, r);
u = a !== 1 || !H.isXMLDoc(e), u && (n = n.toLowerCase(), o = H.attrHooks[n] || (V.test(n) ? K : J));
if (r !== t) {
if (r === null) {
H.removeAttr(e, n);
return
}
return o && "set" in o && u && (s = o.set(e, r, n)) !== t ? s : (e.setAttribute(n, "" + r), r)
}
return o && "get" in o && u && (s = o.get(e, n)) !== null ? s : (s = e.getAttribute(n), s === null ? t : s)
}
},
removeAttr: function (e, t) {
var n, r, i, s, o, u = 0;
if (t && e.nodeType === 1) {
r = t.toLowerCase().split(R), s = r.length;
for (; u < s; u++) i = r[u], i && (n = H.propFix[i] || i, o = V.test(i), o || H.attr(e, i, ""), e.removeAttribute($ ? i : n), o && n in e && (e[n] = !1))
}
},
attrHooks: {
type: {
set: function (e, t) {
if (z.test(e.nodeName) && e.parentNode) H.error("type property can't be changed");
else if (!H.support.radioValue && t === "radio" && H.nodeName(e, "input")) {
var n = e.value;
return e.setAttribute("type", t), n && (e.value = n), t
}
}
},
value: {
get: function (e, t) {
return J && H.nodeName(e, "button") ? J.get(e, t) : t in e ? e.value : null
},
set: function (e, t, n) {
if (J && H.nodeName(e, "button")) return J.set(e, t, n);
e.value = t
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function (e, n, r) {
var i, s, o, u = e.nodeType;
if ( !! e && u !== 3 && u !== 8 && u !== 2) return o = u !== 1 || !H.isXMLDoc(e), o && (n = H.propFix[n] || n, s = H.propHooks[n]), r !== t ? s && "set" in s && (i = s.set(e, r, n)) !== t ? i : e[n] = r : s && "get" in s && (i = s.get(e, n)) !== null ? i : e[n]
},
propHooks: {
tabIndex: {
get: function (e) {
var n = e.getAttributeNode("tabindex");
return n && n.specified ? parseInt(n.value, 10) : W.test(e.nodeName) || X.test(e.nodeName) && e.href ? 0 : t
}
}
}
}), H.attrHooks.tabindex = H.propHooks.tabIndex, K = {
get: function (e, n) {
var r, i = H.prop(e, n);
return i === !0 || typeof i != "boolean" && (r = e.getAttributeNode(n)) && r.nodeValue !== !1 ? n.toLowerCase() : t
},
set: function (e, t, n) {
var r;
return t === !1 ? H.removeAttr(e, n) : (r = H.propFix[n] || n, r in e && (e[r] = !0), e.setAttribute(n, n.toLowerCase())), n
}
}, $ || (Q = {
name: !0,
id: !0,
coords: !0
}, J = H.valHooks.button = {
get: function (e, n) {
var r;
return r = e.getAttributeNode(n), r && (Q[n] ? r.nodeValue !== "" : r.specified) ? r.nodeValue : t
},
set: function (e, t, n) {
var r = e.getAttributeNode(n);
return r || (r = _.createAttribute(n), e.setAttributeNode(r)), r.nodeValue = t + ""
}
}, H.attrHooks.tabindex.set = J.set, H.each(["width", "height"], function (e, t) {
H.attrHooks[t] = H.extend(H.attrHooks[t], {
set: function (e, n) {
if (n === "") return e.setAttribute(t, "auto"), n
}
})
}), H.attrHooks.contenteditable = {
get: J.get,
set: function (e, t, n) {
t === "" && (t = "false"), J.set(e, t, n)
}
}), H.support.hrefNormalized || H.each(["href", "src", "width", "height"], function (e, n) {
H.attrHooks[n] = H.extend(H.attrHooks[n], {
get: function (e) {
var r = e.getAttribute(n, 2);
return r === null ? t : r
}
})
}), H.support.style || (H.attrHooks.style = {
get: function (e) {
return e.style.cssText.toLowerCase() || t
},
set: function (e, t) {
return e.style.cssText = "" + t
}
}), H.support.optSelected || (H.propHooks.selected = H.extend(H.propHooks.selected, {
get: function (e) {
var t = e.parentNode;
return t && (t.selectedIndex, t.parentNode && t.parentNode.selectedIndex), null
}
})), H.support.enctype || (H.propFix.enctype = "encoding"), H.support.checkOn || H.each(["radio", "checkbox"], function () {
H.valHooks[this] = {
get: function (e) {
return e.getAttribute("value") === null ? "on" : e.value
}
}
}), H.each(["radio", "checkbox"], function () {
H.valHooks[this] = H.extend(H.valHooks[this], {
set: function (e, t) {
if (H.isArray(t)) return e.checked = H.inArray(H(e).val(), t) >= 0
}
})
});
var G = /^(?:textarea|input|select)$/i,
Y = /^([^\.]*)?(?:\.(.+))?$/,
Z = /(?:^|\s)hover(\.\S+)?\b/,
et = /^key/,
tt = /^(?:mouse|contextmenu)|click/,
nt = /^(?:focusinfocus|focusoutblur)$/,
rt = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
it = function (e) {
var t = rt.exec(e);
return t && (t[1] = (t[1] || "").toLowerCase(), t[3] = t[3] && new RegExp("(?:^|\\s)" + t[3] + "(?:\\s|$)")), t
},
st = function (e, t) {
var n = e.attributes || {};
return (!t[1] || e.nodeName.toLowerCase() === t[1]) && (!t[2] || (n.id || {}).value === t[2]) && (!t[3] || t[3].test((n["class"] || {}).value))
},
ot = function (e) {
return H.event.special.hover ? e : e.replace(Z, "mouseenter$1 mouseleave$1")
};
H.event = {
add: function (e, n, r, i, s) {
var o, u, a, f, l, c, h, p, d, v, m, g;
if (!(e.nodeType === 3 || e.nodeType === 8 || !n || !r || !(o = H._data(e)))) {
r.handler && (d = r, r = d.handler, s = d.selector), r.guid || (r.guid = H.guid++), a = o.events, a || (o.events = a = {}), u = o.handle, u || (o.handle = u = function (e) {
return typeof H == "undefined" || !! e && H.event.triggered === e.type ? t : H.event.dispatch.apply(u.elem, arguments)
}, u.elem = e), n = H.trim(ot(n)).split(" ");
for (f = 0; f < n.length; f++) {
l = Y.exec(n[f]) || [], c = l[1], h = (l[2] || "").split(".").sort(), g = H.event.special[c] || {}, c = (s ? g.delegateType : g.bindType) || c, g = H.event.special[c] || {}, p = H.extend({
type: c,
origType: l[1],
data: i,
handler: r,
guid: r.guid,
selector: s,
quick: s && it(s),
namespace: h.join(".")
}, d), m = a[c];
if (!m) {
m = a[c] = [], m.delegateCount = 0;
if (!g.setup || g.setup.call(e, i, h, u) === !1) e.addEventListener ? e.addEventListener(c, u, !1) : e.attachEvent && e.attachEvent("on" + c, u)
}
g.add && (g.add.call(e, p), p.handler.guid || (p.handler.guid = r.guid)), s ? m.splice(m.delegateCount++, 0, p) : m.push(p), H.event.global[c] = !0
}
e = null
}
},
global: {},
remove: function (e, t, n, r, i) {
var s = H.hasData(e) && H._data(e),
o, u, a, f, l, c, h, p, d, v, m, g;
if ( !! s && !! (p = s.events)) {
t = H.trim(ot(t || "")).split(" ");
for (o = 0; o < t.length; o++) {
u = Y.exec(t[o]) || [], a = f = u[1], l = u[2];
if (!a) {
for (a in p) H.event.remove(e, a + t[o], n, r, !0);
continue
}
d = H.event.special[a] || {}, a = (r ? d.delegateType : d.bindType) || a, m = p[a] || [], c = m.length, l = l ? new RegExp("(^|\\.)" + l.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
for (h = 0; h < m.length; h++) g = m[h], (i || f === g.origType) && (!n || n.guid === g.guid) && (!l || l.test(g.namespace)) && (!r || r === g.selector || r === "**" && g.selector) && (m.splice(h--, 1), g.selector && m.delegateCount--, d.remove && d.remove.call(e, g));
m.length === 0 && c !== m.length && ((!d.teardown || d.teardown.call(e, l) === !1) && H.removeEvent(e, a, s.handle), delete p[a])
}
H.isEmptyObject(p) && (v = s.handle, v && (v.elem = null), H.removeData(e, ["events", "handle"], !0))
}
},
customEvent: {
getData: !0,
setData: !0,
changeData: !0
},
trigger: function (n, r, i, s) {
if (!i || i.nodeType !== 3 && i.nodeType !== 8) {
var o = n.type || n,
u = [],
a, f, l, c, h, p, d, v, m, g;
if (nt.test(o + H.event.triggered)) return;
o.indexOf("!") >= 0 && (o = o.slice(0, -1), f = !0), o.indexOf(".") >= 0 && (u = o.split("."), o = u.shift(), u.sort());
if ((!i || H.event.customEvent[o]) && !H.event.global[o]) return;
n = typeof n == "object" ? n[H.expando] ? n : new H.Event(o, n) : new H.Event(o), n.type = o, n.isTrigger = !0, n.exclusive = f, n.namespace = u.join("."), n.namespace_re = n.namespace ? new RegExp("(^|\\.)" + u.join("\\.(?:.*\\.)?") + "(\\.|$)") : null, p = o.indexOf(":") < 0 ? "on" + o : "";
if (!i) {
a = H.cache;
for (l in a) a[l].events && a[l].events[o] && H.event.trigger(n, r, a[l].handle.elem, !0);
return
}
n.result = t, n.target || (n.target = i), r = r != null ? H.makeArray(r) : [], r.unshift(n), d = H.event.special[o] || {};
if (d.trigger && d.trigger.apply(i, r) === !1) return;
m = [
[i, d.bindType || o]
];
if (!s && !d.noBubble && !H.isWindow(i)) {
g = d.delegateType || o, c = nt.test(g + o) ? i : i.parentNode, h = null;
for (; c; c = c.parentNode) m.push([c, g]), h = c;
h && h === i.ownerDocument && m.push([h.defaultView || h.parentWindow || e, g])
}
for (l = 0; l < m.length && !n.isPropagationStopped(); l++) c = m[l][0], n.type = m[l][1], v = (H._data(c, "events") || {})[n.type] && H._data(c, "handle"), v && v.apply(c, r), v = p && c[p], v && H.acceptData(c) && v.apply(c, r) === !1 && n.preventDefault();
return n.type = o, !s && !n.isDefaultPrevented() && (!d._default || d._default.apply(i.ownerDocument, r) === !1) && (o !== "click" || !H.nodeName(i, "a")) && H.acceptData(i) && p && i[o] && (o !== "focus" && o !== "blur" || n.target.offsetWidth !== 0) && !H.isWindow(i) && (h = i[p], h && (i[p] = null), H.event.triggered = o, i[o](), H.event.triggered = t, h && (i[p] = h)), n.result
}
},
dispatch: function (n) {
n = H.event.fix(n || e.event);
var r = (H._data(this, "events") || {})[n.type] || [],
i = r.delegateCount,
s = [].slice.call(arguments, 0),
o = !n.exclusive && !n.namespace,
u = H.event.special[n.type] || {},
a = [],
f, l, c, h, p, d, v, m, g, y, b;
s[0] = n, n.delegateTarget = this;
if (!u.preDispatch || u.preDispatch.call(this, n) !== !1) {
if (i && (!n.button || n.type !== "click")) {
h = H(this), h.context = this.ownerDocument || this;
for (c = n.target; c != this; c = c.parentNode || this) if (c.disabled !== !0) {
d = {}, m = [], h[0] = c;
for (f = 0; f < i; f++) g = r[f], y = g.selector, d[y] === t && (d[y] = g.quick ? st(c, g.quick) : h.is(y)), d[y] && m.push(g);
m.length && a.push({
elem: c,
matches: m
})
}
}
r.length > i && a.push({
elem: this,
matches: r.slice(i)
});
for (f = 0; f < a.length && !n.isPropagationStopped(); f++) {
v = a[f], n.currentTarget = v.elem;
for (l = 0; l < v.matches.length && !n.isImmediatePropagationStopped(); l++) {
g = v.matches[l];
if (o || !n.namespace && !g.namespace || n.namespace_re && n.namespace_re.test(g.namespace)) n.data = g.data, n.handleObj = g, p = ((H.event.special[g.origType] || {}).handle || g.handler).apply(v.elem, s), p !== t && (n.result = p, p === !1 && (n.preventDefault(), n.stopPropagation()))
}
}
return u.postDispatch && u.postDispatch.call(this, n), n.result
}
},
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function (e, t) {
return e.which == null && (e.which = t.charCode != null ? t.charCode : t.keyCode), e
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function (e, n) {
var r, i, s, o = n.button,
u = n.fromElement;
return e.pageX == null && n.clientX != null && (r = e.target.ownerDocument || _, i = r.documentElement, s = r.body, e.pageX = n.clientX + (i && i.scrollLeft || s && s.scrollLeft || 0) - (i && i.clientLeft || s && s.clientLeft || 0), e.pageY = n.clientY + (i && i.scrollTop || s && s.scrollTop || 0) - (i && i.clientTop || s && s.clientTop || 0)), !e.relatedTarget && u && (e.relatedTarget = u === e.target ? n.toElement : u), !e.which && o !== t && (e.which = o & 1 ? 1 : o & 2 ? 3 : o & 4 ? 2 : 0), e
}
},
fix: function (e) {
if (e[H.expando]) return e;
var n, r, i = e,
s = H.event.fixHooks[e.type] || {},
o = s.props ? this.props.concat(s.props) : this.props;
e = H.Event(i);
for (n = o.length; n;) r = o[--n], e[r] = i[r];
return e.target || (e.target = i.srcElement || _), e.target.nodeType === 3 && (e.target = e.target.parentNode), e.metaKey === t && (e.metaKey = e.ctrlKey), s.filter ? s.filter(e, i) : e
},
special: {
ready: {
setup: H.bindReady
},
load: {
noBubble: !0
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function (e, t, n) {
H.isWindow(this) && (this.onbeforeunload = n)
},
teardown: function (e, t) {
this.onbeforeunload === t && (this.onbeforeunload = null)
}
}
},
simulate: function (e, t, n, r) {
var i = H.extend(new H.Event, n, {
type: e,
isSimulated: !0,
originalEvent: {}
});
r ? H.event.trigger(i, null, t) : H.event.dispatch.call(t, i), i.isDefaultPrevented() && n.preventDefault()
}
}, H.event.handle = H.event.dispatch, H.removeEvent = _.removeEventListener ?
function (e, t, n) {
e.removeEventListener && e.removeEventListener(t, n, !1)
} : function (e, t, n) {
e.detachEvent && e.detachEvent("on" + t, n)
}, H.Event = function (e, t) {
if (!(this instanceof H.Event)) return new H.Event(e, t);
e && e.type ? (this.originalEvent = e, this.type = e.type, this.isDefaultPrevented = e.defaultPrevented || e.returnValue === !1 || e.getPreventDefault && e.getPreventDefault() ? C : k) : this.type = e, t && H.extend(this, t), this.timeStamp = e && e.timeStamp || H.now(), this[H.expando] = !0
}, H.Event.prototype = {
preventDefault: function () {
this.isDefaultPrevented = C;
var e = this.originalEvent;
!e || (e.preventDefault ? e.preventDefault() : e.returnValue = !1)
},
stopPropagation: function () {
this.isPropagationStopped = C;
var e = this.originalEvent;
!e || (e.stopPropagation && e.stopPropagation(), e.cancelBubble = !0)
},
stopImmediatePropagation: function () {
this.isImmediatePropagationStopped = C, this.stopPropagation()
},
isDefaultPrevented: k,
isPropagationStopped: k,
isImmediatePropagationStopped: k
}, H.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function (e, t) {
H.event.special[e] = {
delegateType: t,
bindType: t,
handle: function (e) {
var n = this,
r = e.relatedTarget,
i = e.handleObj,
s = i.selector,
o;
if (!r || r !== n && !H.contains(n, r)) e.type = i.origType, o = i.handler.apply(this, arguments), e.type = t;
return o
}
}
}), H.support.submitBubbles || (H.event.special.submit = {
setup: function () {
if (H.nodeName(this, "form")) return !1;
H.event.add(this, "click._submit keypress._submit", function (e) {
var n = e.target,
r = H.nodeName(n, "input") || H.nodeName(n, "button") ? n.form : t;
r && !r._submit_attached && (H.event.add(r, "submit._submit", function (e) {
e._submit_bubble = !0
}), r._submit_attached = !0)
})
},
postDispatch: function (e) {
e._submit_bubble && (delete e._submit_bubble, this.parentNode && !e.isTrigger && H.event.simulate("submit", this.parentNode, e, !0))
},
teardown: function () {
if (H.nodeName(this, "form")) return !1;
H.event.remove(this, "._submit")
}
}), H.support.changeBubbles || (H.event.special.change = {
setup: function () {
if (G.test(this.nodeName)) {
if (this.type === "checkbox" || this.type === "radio") H.event.add(this, "propertychange._change", function (e) {
e.originalEvent.propertyName === "checked" && (this._just_changed = !0)
}), H.event.add(this, "click._change", function (e) {
this._just_changed && !e.isTrigger && (this._just_changed = !1, H.event.simulate("change", this, e, !0))
});
return !1
}
H.event.add(this, "beforeactivate._change", function (e) {
var t = e.target;
G.test(t.nodeName) && !t._change_attached && (H.event.add(t, "change._change", function (e) {
this.parentNode && !e.isSimulated && !e.isTrigger && H.event.simulate("change", this.parentNode, e, !0)
}), t._change_attached = !0)
})
},
handle: function (e) {
var t = e.target;
if (this !== t || e.isSimulated || e.isTrigger || t.type !== "radio" && t.type !== "checkbox") return e.handleObj.handler.apply(this, arguments)
},
teardown: function () {
return H.event.remove(this, "._change"), G.test(this.nodeName)
}
}), H.support.focusinBubbles || H.each({
focus: "focusin",
blur: "focusout"
}, function (e, t) {
var n = 0,
r = function (e) {
H.event.simulate(t, e.target, H.event.fix(e), !0)
};
H.event.special[t] = {
setup: function () {
n++ === 0 && _.addEventListener(e, r, !0)
},
teardown: function () {
--n === 0 && _.removeEventListener(e, r, !0)
}
}
}), H.fn.extend({
on: function (e, n, r, i, s) {
var o, u;
if (typeof e == "object") {
typeof n != "string" && (r = r || n, n = t);
for (u in e) this.on(u, n, r, e[u], s);
return this
}
r == null && i == null ? (i = n, r = n = t) : i == null && (typeof n == "string" ? (i = r, r = t) : (i = r, r = n, n = t));
if (i === !1) i = k;
else if (!i) return this;
return s === 1 && (o = i, i = function (e) {
return H().off(e), o.apply(this, arguments)
}, i.guid = o.guid || (o.guid = H.guid++)), this.each(function () {
H.event.add(this, e, i, r, n)
})
},
one: function (e, t, n, r) {
return this.on(e, t, n, r, 1)
},
off: function (e, n, r) {
if (e && e.preventDefault && e.handleObj) {
var i = e.handleObj;
return H(e.delegateTarget).off(i.namespace ? i.origType + "." + i.namespace : i.origType, i.selector, i.handler), this
}
if (typeof e == "object") {
for (var s in e) this.off(s, n, e[s]);
return this
}
if (n === !1 || typeof n == "function") r = n, n = t;
return r === !1 && (r = k), this.each(function () {
H.event.remove(this, e, r, n)
})
},
bind: function (e, t, n) {
return this.on(e, null, t, n)
},
unbind: function (e, t) {
return this.off(e, null, t)
},
live: function (e, t, n) {
return H(this.context).on(e, this.selector, t, n), this
},
die: function (e, t) {
return H(this.context).off(e, this.selector || "**", t), this
},
delegate: function (e, t, n, r) {
return this.on(t, e, n, r)
},
undelegate: function (e, t, n) {
return arguments.length == 1 ? this.off(e, "**") : this.off(t, e, n)
},
trigger: function (e, t) {
return this.each(function () {
H.event.trigger(e, t, this)
})
},
triggerHandler: function (e, t) {
if (this[0]) return H.event.trigger(e, t, this[0], !0)
},
toggle: function (e) {
var t = arguments,
n = e.guid || H.guid++,
r = 0,
i = function (n) {
var i = (H._data(this, "lastToggle" + e.guid) || 0) % r;
return H._data(this, "lastToggle" + e.guid, i + 1), n.preventDefault(), t[i].apply(this, arguments) || !1
};
i.guid = n;
while (r < t.length) t[r++].guid = n;
return this.click(i)
},
hover: function (e, t) {
return this.mouseenter(e).mouseleave(t || e)
}
}), H.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function (e, t) {
H.fn[t] = function (e, n) {
return n == null && (n = e, e = null), arguments.length > 0 ? this.on(t, null, e, n) : this.trigger(t)
}, H.attrFn && (H.attrFn[t] = !0), et.test(t) && (H.event.fixHooks[t] = H.event.keyHooks), tt.test(t) && (H.event.fixHooks[t] = H.event.mouseHooks)
}), function () {
function e(e, t, n, r, s, o) {
for (var u = 0, a = r.length; u < a; u++) {
var f = r[u];
if (f) {
var l = !1;
f = f[e];
while (f) {
if (f[i] === n) {
l = r[f.sizset];
break
}
if (f.nodeType === 1) {
o || (f[i] = n, f.sizset = u);
if (typeof t != "string") {
if (f === t) {
l = !0;
break
}
} else if (h.filter(t, [f]).length > 0) {
l = f;
break
}
}
f = f[e]
}
r[u] = l
}
}
}
function n(e, t, n, r, s, o) {
for (var u = 0, a = r.length; u < a; u++) {
var f = r[u];
if (f) {
var l = !1;
f = f[e];
while (f) {
if (f[i] === n) {
l = r[f.sizset];
break
}
f.nodeType === 1 && !o && (f[i] = n, f.sizset = u);
if (f.nodeName.toLowerCase() === t) {
l = f;
break
}
f = f[e]
}
r[u] = l
}
}
}
var r = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
i = "sizcache" + (Math.random() + "").replace(".", ""),
s = 0,
o = Object.prototype.toString,
u = !1,
a = !0,
f = /\\/g,
l = /\r\n/g,
c = /\W/;
[0, 0].sort(function () {
return a = !1, 0
});
var h = function (e, t, n, i) {
n = n || [], t = t || _;
var s = t;
if (t.nodeType !== 1 && t.nodeType !== 9) return [];
if (!e || typeof e != "string") return n;
var u, a, f, l, c, p, m, g, b = !0,
w = h.isXML(t),
E = [],
x = e;
do {
r.exec(""), u = r.exec(x);
if (u) {
x = u[3], E.push(u[1]);
if (u[2]) {
l = u[3];
break
}
}
} while (u);
if (E.length > 1 && v.exec(e)) if (E.length === 2 && d.relative[E[0]]) a = S(E[0] + E[1], t, i);
else {
a = d.relative[E[0]] ? [t] : h(E.shift(), t);
while (E.length) e = E.shift(), d.relative[e] && (e += E.shift()), a = S(e, a, i)
} else {
!i && E.length > 1 && t.nodeType === 9 && !w && d.match.ID.test(E[0]) && !d.match.ID.test(E[E.length - 1]) && (c = h.find(E.shift(), t, w), t = c.expr ? h.filter(c.expr, c.set)[0] : c.set[0]);
if (t) {
c = i ? {
expr: E.pop(),
set: y(i)
} : h.find(E.pop(), E.length !== 1 || E[0] !== "~" && E[0] !== "+" || !t.parentNode ? t : t.parentNode, w), a = c.expr ? h.filter(c.expr, c.set) : c.set, E.length > 0 ? f = y(a) : b = !1;
while (E.length) p = E.pop(), m = p, d.relative[p] ? m = E.pop() : p = "", m == null && (m = t), d.relative[p](f, m, w)
} else f = E = []
}
f || (f = a), f || h.error(p || e);
if (o.call(f) === "[object Array]") if (!b) n.push.apply(n, f);
else if (t && t.nodeType === 1) for (g = 0; f[g] != null; g++) f[g] && (f[g] === !0 || f[g].nodeType === 1 && h.contains(t, f[g])) && n.push(a[g]);
else for (g = 0; f[g] != null; g++) f[g] && f[g].nodeType === 1 && n.push(a[g]);
else y(f, n);
return l && (h(l, s, n, i), h.uniqueSort(n)), n
};
h.uniqueSort = function (e) {
if (w) {
u = a, e.sort(w);
if (u) for (var t = 1; t < e.length; t++) e[t] === e[t - 1] && e.splice(t--, 1)
}
return e
}, h.matches = function (e, t) {
return h(e, null, null, t)
}, h.matchesSelector = function (e, t) {
return h(t, null, null, [e]).length > 0
}, h.find = function (e, t, n) {
var r, i, s, o, u, a;
if (!e) return [];
for (i = 0, s = d.order.length; i < s; i++) {
u = d.order[i];
if (o = d.leftMatch[u].exec(e)) {
a = o[1], o.splice(1, 1);
if (a.substr(a.length - 1) !== "\\") {
o[1] = (o[1] || "").replace(f, ""), r = d.find[u](o, t, n);
if (r != null) {
e = e.replace(d.match[u], "");
break
}
}
}
}
return r || (r = typeof t.getElementsByTagName != "undefined" ? t.getElementsByTagName("*") : []), {
set: r,
expr: e
}
}, h.filter = function (e, n, r, i) {
var s, o, u, a, f, l, c, p, v, m = e,
g = [],
y = n,
b = n && n[0] && h.isXML(n[0]);
while (e && n.length) {
for (u in d.filter) if ((s = d.leftMatch[u].exec(e)) != null && s[2]) {
l = d.filter[u], c = s[1], o = !1, s.splice(1, 1);
if (c.substr(c.length - 1) === "\\") continue;
y === g && (g = []);
if (d.preFilter[u]) {
s = d.preFilter[u](s, y, r, g, i, b);
if (!s) o = a = !0;
else if (s === !0) continue
}
if (s) for (p = 0;
(f = y[p]) != null; p++) f && (a = l(f, s, p, y), v = i ^ a, r && a != null ? v ? o = !0 : y[p] = !1 : v && (g.push(f), o = !0));
if (a !== t) {
r || (y = g), e = e.replace(d.match[u], "");
if (!o) return [];
break
}
}
if (e === m) {
if (o != null) break;
h.error(e)
}
m = e
}
return y
}, h.error = function (e) {
throw new Error("Syntax error, unrecognized expression: " + e)
};
var p = h.getText = function (e) {
var t, n, r = e.nodeType,
i = "";
if (r) {
if (r === 1 || r === 9 || r === 11) {
if (typeof e.textContent == "string") return e.textContent;
if (typeof e.innerText == "string") return e.innerText.replace(l, "");
for (e = e.firstChild; e; e = e.nextSibling) i += p(e)
} else if (r === 3 || r === 4) return e.nodeValue
} else for (t = 0; n = e[t]; t++) n.nodeType !== 8 && (i += p(n));
return i
},
d = h.selectors = {
order: ["ID", "NAME", "TAG"],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function (e) {
return e.getAttribute("href")
},
type: function (e) {
return e.getAttribute("type")
}
},
relative: {
"+": function (e, t) {
var n = typeof t == "string",
r = n && !c.test(t),
i = n && !r;
r && (t = t.toLowerCase());
for (var s = 0, o = e.length, u; s < o; s++) if (u = e[s]) {
while ((u = u.previousSibling) && u.nodeType !== 1);
e[s] = i || u && u.nodeName.toLowerCase() === t ? u || !1 : u === t
}
i && h.filter(t, e, !0)
},
">": function (e, t) {
var n, r = typeof t == "string",
i = 0,
s = e.length;
if (r && !c.test(t)) {
t = t.toLowerCase();
for (; i < s; i++) {
n = e[i];
if (n) {
var o = n.parentNode;
e[i] = o.nodeName.toLowerCase() === t ? o : !1
}
}
} else {
for (; i < s; i++) n = e[i], n && (e[i] = r ? n.parentNode : n.parentNode === t);
r && h.filter(t, e, !0)
}
},
"": function (t, r, i) {
var o, u = s++,
a = e;
typeof r == "string" && !c.test(r) && (r = r.toLowerCase(), o = r, a = n), a("parentNode", r, u, t, o, i)
},
"~": function (t, r, i) {
var o, u = s++,
a = e;
typeof r == "string" && !c.test(r) && (r = r.toLowerCase(), o = r, a = n), a("previousSibling", r, u, t, o, i)
}
},
find: {
ID: function (e, t, n) {
if (typeof t.getElementById != "undefined" && !n) {
var r = t.getElementById(e[1]);
return r && r.parentNode ? [r] : []
}
},
NAME: function (e, t) {
if (typeof t.getElementsByName != "undefined") {
var n = [],
r = t.getElementsByName(e[1]);
for (var i = 0, s = r.length; i < s; i++) r[i].getAttribute("name") === e[1] && n.push(r[i]);
return n.length === 0 ? null : n
}
},
TAG: function (e, t) {
if (typeof t.getElementsByTagName != "undefined") return t.getElementsByTagName(e[1])
}
},
preFilter: {
CLASS: function (e, t, n, r, i, s) {
e = " " + e[1].replace(f, "") + " ";
if (s) return e;
for (var o = 0, u;
(u = t[o]) != null; o++) u && (i ^ (u.className && (" " + u.className + " ").replace(/[\t\n\r]/g, " ").indexOf(e) >= 0) ? n || r.push(u) : n && (t[o] = !1));
return !1
},
ID: function (e) {
return e[1].replace(f, "")
},
TAG: function (e, t) {
return e[1].replace(f, "").toLowerCase()
},
CHILD: function (e) {
if (e[1] === "nth") {
e[2] || h.error(e[0]), e[2] = e[2].replace(/^\+|\s*/g, "");
var t = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2] === "even" && "2n" || e[2] === "odd" && "2n+1" || !/\D/.test(e[2]) && "0n+" + e[2] || e[2]);
e[2] = t[1] + (t[2] || 1) - 0, e[3] = t[3] - 0
} else e[2] && h.error(e[0]);
return e[0] = s++, e
},
ATTR: function (e, t, n, r, i, s) {
var o = e[1] = e[1].replace(f, "");
return !s && d.attrMap[o] && (e[1] = d.attrMap[o]), e[4] = (e[4] || e[5] || "").replace(f, ""), e[2] === "~=" && (e[4] = " " + e[4] + " "), e
},
PSEUDO: function (e, t, n, i, s) {
if (e[1] === "not") {
if (!((r.exec(e[3]) || "").length > 1 || /^\w/.test(e[3]))) {
var o = h.filter(e[3], t, n, !0 ^ s);
return n || i.push.apply(i, o), !1
}
e[3] = h(e[3], null, null, t)
} else if (d.match.POS.test(e[0]) || d.match.CHILD.test(e[0])) return !0;
return e
},
POS: function (e) {
return e.unshift(!0), e
}
},
filters: {
enabled: function (e) {
return e.disabled === !1 && e.type !== "hidden"
},
disabled: function (e) {
return e.disabled === !0
},
checked: function (e) {
return e.checked === !0
},
selected: function (e) {
return e.parentNode && e.parentNode.selectedIndex, e.selected === !0
},
parent: function (e) {
return !!e.firstChild
},
empty: function (e) {
return !e.firstChild
},
has: function (e, t, n) {
return !!h(n[3], e).length
},
header: function (e) {
return /h\d/i.test(e.nodeName)
},
text: function (e) {
var t = e.getAttribute("type"),
n = e.type;
return e.nodeName.toLowerCase() === "input" && "text" === n && (t === n || t === null)
},
radio: function (e) {
return e.nodeName.toLowerCase() === "input" && "radio" === e.type
},
checkbox: function (e) {
return e.nodeName.toLowerCase() === "input" && "checkbox" === e.type
},
file: function (e) {
return e.nodeName.toLowerCase() === "input" && "file" === e.type
},
password: function (e) {
return e.nodeName.toLowerCase() === "input" && "password" === e.type
},
submit: function (e) {
var t = e.nodeName.toLowerCase();
return (t === "input" || t === "button") && "submit" === e.type
},
image: function (e) {
return e.nodeName.toLowerCase() === "input" && "image" === e.type
},
reset: function (e) {
var t = e.nodeName.toLowerCase();
return (t === "input" || t === "button") && "reset" === e.type
},
button: function (e) {
var t = e.nodeName.toLowerCase();
return t === "input" && "button" === e.type || t === "button"
},
input: function (e) {
return /input|select|textarea|button/i.test(e.nodeName)
},
focus: function (e) {
return e === e.ownerDocument.activeElement
}
},
setFilters: {
first: function (e, t) {
return t === 0
},
last: function (e, t, n, r) {
return t === r.length - 1
},
even: function (e, t) {
return t % 2 === 0
},
odd: function (e, t) {
return t % 2 === 1
},
lt: function (e, t, n) {
return t < n[3] - 0
},
gt: function (e, t, n) {
return t > n[3] - 0
},
nth: function (e, t, n) {
return n[3] - 0 === t
},
eq: function (e, t, n) {
return n[3] - 0 === t
}
},
filter: {
PSEUDO: function (e, t, n, r) {
var i = t[1],
s = d.filters[i];
if (s) return s(e, n, t, r);
if (i === "contains") return (e.textContent || e.innerText || p([e]) || "").indexOf(t[3]) >= 0;
if (i === "not") {
var o = t[3];
for (var u = 0, a = o.length; u < a; u++) if (o[u] === e) return !1;
return !0
}
h.error(i)
},
CHILD: function (e, t) {
var n, r, s, o, u, a, f, l = t[1],
c = e;
switch (l) {
case "only":
case "first":
while (c = c.previousSibling) if (c.nodeType === 1) return !1;
if (l === "first") return !0;
c = e;
case "last":
while (c = c.nextSibling) if (c.nodeType === 1) return !1;
return !0;
case "nth":
n = t[2], r = t[3];
if (n === 1 && r === 0) return !0;
s = t[0], o = e.parentNode;
if (o && (o[i] !== s || !e.nodeIndex)) {
a = 0;
for (c = o.firstChild; c; c = c.nextSibling) c.nodeType === 1 && (c.nodeIndex = ++a);
o[i] = s
}
return f = e.nodeIndex - r, n === 0 ? f === 0 : f % n === 0 && f / n >= 0
}
},
ID: function (e, t) {
return e.nodeType === 1 && e.getAttribute("id") === t
},
TAG: function (e, t) {
return t === "*" && e.nodeType === 1 || !! e.nodeName && e.nodeName.toLowerCase() === t
},
CLASS: function (e, t) {
return (" " + (e.className || e.getAttribute("class")) + " ").indexOf(t) > -1
},
ATTR: function (e, t) {
var n = t[1],
r = h.attr ? h.attr(e, n) : d.attrHandle[n] ? d.attrHandle[n](e) : e[n] != null ? e[n] : e.getAttribute(n),
i = r + "",
s = t[2],
o = t[4];
return r == null ? s === "!=" : !s && h.attr ? r != null : s === "=" ? i === o : s === "*=" ? i.indexOf(o) >= 0 : s === "~=" ? (" " + i + " ").indexOf(o) >= 0 : o ? s === "!=" ? i !== o : s === "^=" ? i.indexOf(o) === 0 : s === "$=" ? i.substr(i.length - o.length) === o : s === "|=" ? i === o || i.substr(0, o.length + 1) === o + "-" : !1 : i && r !== !1
},
POS: function (e, t, n, r) {
var i = t[2],
s = d.setFilters[i];
if (s) return s(e, n, t, r)
}
}
},
v = d.match.POS,
m = function (e, t) {
return "\\" + (t - 0 + 1)
};
for (var g in d.match) d.match[g] = new RegExp(d.match[g].source + /(?![^\[]*\])(?![^\(]*\))/.source), d.leftMatch[g] = new RegExp(/(^(?:.|\r|\n)*?)/.source + d.match[g].source.replace(/\\(\d+)/g, m));
d.match.globalPOS = v;
var y = function (e, t) {
return e = Array.prototype.slice.call(e, 0), t ? (t.push.apply(t, e), t) : e
};
try {
Array.prototype.slice.call(_.documentElement.childNodes, 0)[0].nodeType
} catch (b) {
y = function (e, t) {
var n = 0,
r = t || [];
if (o.call(e) === "[object Array]") Array.prototype.push.apply(r, e);
else if (typeof e.length == "number") for (var i = e.length; n < i; n++) r.push(e[n]);
else for (; e[n]; n++) r.push(e[n]);
return r
}
}
var w, E;
_.documentElement.compareDocumentPosition ? w = function (e, t) {
return e === t ? (u = !0, 0) : !e.compareDocumentPosition || !t.compareDocumentPosition ? e.compareDocumentPosition ? -1 : 1 : e.compareDocumentPosition(t) & 4 ? -1 : 1
} : (w = function (e, t) {
if (e === t) return u = !0, 0;
if (e.sourceIndex && t.sourceIndex) return e.sourceIndex - t.sourceIndex;
var n, r, i = [],
s = [],
o = e.parentNode,
a = t.parentNode,
f = o;
if (o === a) return E(e, t);
if (!o) return -1;
if (!a) return 1;
while (f) i.unshift(f), f = f.parentNode;
f = a;
while (f) s.unshift(f), f = f.parentNode;
n = i.length, r = s.length;
for (var l = 0; l < n && l < r; l++) if (i[l] !== s[l]) return E(i[l], s[l]);
return l === n ? E(e, s[l], -1) : E(i[l], t, 1)
}, E = function (e, t, n) {
if (e === t) return n;
var r = e.nextSibling;
while (r) {
if (r === t) return -1;
r = r.nextSibling
}
return 1
}), function () {
var e = _.createElement("div"),
n = "script" + (new Date).getTime(),
r = _.documentElement;
e.innerHTML = "<a name='" + n + "'/>", r.insertBefore(e, r.firstChild), _.getElementById(n) && (d.find.ID = function (e, n, r) {
if (typeof n.getElementById != "undefined" && !r) {
var i = n.getElementById(e[1]);
return i ? i.id === e[1] || typeof i.getAttributeNode != "undefined" && i.getAttributeNode("id").nodeValue === e[1] ? [i] : t : []
}
}, d.filter.ID = function (e, t) {
var n = typeof e.getAttributeNode != "undefined" && e.getAttributeNode("id");
return e.nodeType === 1 && n && n.nodeValue === t
}), r.removeChild(e), r = e = null
}(), function () {
var e = _.createElement("div");
e.appendChild(_.createComment("")), e.getElementsByTagName("*").length > 0 && (d.find.TAG = function (e, t) {
var n = t.getElementsByTagName(e[1]);
if (e[1] === "*") {
var r = [];
for (var i = 0; n[i]; i++) n[i].nodeType === 1 && r.push(n[i]);
n = r
}
return n
}), e.innerHTML = "<a href='#'></a>", e.firstChild && typeof e.firstChild.getAttribute != "undefined" && e.firstChild.getAttribute("href") !== "#" && (d.attrHandle.href = function (e) {
return e.getAttribute("href", 2)
}), e = null
}(), _.querySelectorAll &&
function () {
var e = h,
t = _.createElement("div"),
n = "__sizzle__";
t.innerHTML = "<p class='TEST'></p>";
if (!t.querySelectorAll || t.querySelectorAll(".TEST").length !== 0) {
h = function (t, r, i, s) {
r = r || _;
if (!s && !h.isXML(r)) {
var o = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(t);
if (o && (r.nodeType === 1 || r.nodeType === 9)) {
if (o[1]) return y(r.getElementsByTagName(t), i);
if (o[2] && d.find.CLASS && r.getElementsByClassName) return y(r.getElementsByClassName(o[2]), i)
}
if (r.nodeType === 9) {
if (t === "body" && r.body) return y([r.body], i);
if (o && o[3]) {
var u = r.getElementById(o[3]);
if (!u || !u.parentNode) return y([], i);
if (u.id === o[3]) return y([u], i)
}
try {
return y(r.querySelectorAll(t), i)
} catch (a) {}
} else if (r.nodeType === 1 && r.nodeName.toLowerCase() !== "object") {
var f = r,
l = r.getAttribute("id"),
c = l || n,
p = r.parentNode,
v = /^\s*[+~]/.test(t);
l ? c = c.replace(/'/g, "\\$&") : r.setAttribute("id", c), v && p && (r = r.parentNode);
try {
if (!v || p) return y(r.querySelectorAll("[id='" + c + "'] " + t), i)
} catch (m) {} finally {
l || f.removeAttribute("id")
}
}
}
return e(t, r, i, s)
};
for (var r in e) h[r] = e[r];
t = null
}
}(), function () {
var e = _.documentElement,
t = e.matchesSelector || e.mozMatchesSelector || e.webkitMatchesSelector || e.msMatchesSelector;
if (t) {
var n = !t.call(_.createElement("div"), "div"),
r = !1;
try {
t.call(_.documentElement, "[test!='']:sizzle")
} catch (i) {
r = !0
}
h.matchesSelector = function (e, i) {
i = i.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if (!h.isXML(e)) try {
if (r || !d.match.PSEUDO.test(i) && !/!=/.test(i)) {
var s = t.call(e, i);
if (s || !n || e.document && e.document.nodeType !== 11) return s
}
} catch (o) {}
return h(i, null, null, [e]).length > 0
}
}
}(), function () {
var e = _.createElement("div");
e.innerHTML = "<div class='test e'></div><div class='test'></div>";
if ( !! e.getElementsByClassName && e.getElementsByClassName("e").length !== 0) {
e.lastChild.className = "e";
if (e.getElementsByClassName("e").length === 1) return;
d.order.splice(1, 0, "CLASS"), d.find.CLASS = function (e, t, n) {
if (typeof t.getElementsByClassName != "undefined" && !n) return t.getElementsByClassName(e[1])
}, e = null
}
}(), _.documentElement.contains ? h.contains = function (e, t) {
return e !== t && (e.contains ? e.contains(t) : !0)
} : _.documentElement.compareDocumentPosition ? h.contains = function (e, t) {
return !!(e.compareDocumentPosition(t) & 16)
} : h.contains = function () {
return !1
}, h.isXML = function (e) {
var t = (e ? e.ownerDocument || e : 0).documentElement;
return t ? t.nodeName !== "HTML" : !1
};
var S = function (e, t, n) {
var r, i = [],
s = "",
o = t.nodeType ? [t] : t;
while (r = d.match.PSEUDO.exec(e)) s += r[0], e = e.replace(d.match.PSEUDO, "");
e = d.relative[e] ? e + "*" : e;
for (var u = 0, a = o.length; u < a; u++) h(e, o[u], i, n);
return h.filter(s, i)
};
h.attr = H.attr, h.selectors.attrMap = {}, H.find = h, H.expr = h.selectors, H.expr[":"] = H.expr.filters, H.unique = h.uniqueSort, H.text = h.getText, H.isXMLDoc = h.isXML, H.contains = h.contains
}();
var ut = /Until$/,
at = /^(?:parents|prevUntil|prevAll)/,
ft = /,/,
lt = /^.[^:#\[\.,]*$/,
ct = Array.prototype.slice,
ht = H.expr.match.globalPOS,
pt = {
children: !0,
contents: !0,
next: !0,
prev: !0
};
H.fn.extend({
find: function (e) {
var t = this,
n, r;
if (typeof e != "string") return H(e).filter(function () {
for (n = 0, r = t.length; n < r; n++) if (H.contains(t[n], this)) return !0
});
var i = this.pushStack("", "find", e),
s, o, u;
for (n = 0, r = this.length; n < r; n++) {
s = i.length, H.find(e, this[n], i);
if (n > 0) for (o = s; o < i.length; o++) for (u = 0; u < s; u++) if (i[u] === i[o]) {
i.splice(o--, 1);
break
}
}
return i
},
has: function (e) {
var t = H(e);
return this.filter(function () {
for (var e = 0, n = t.length; e < n; e++) if (H.contains(this, t[e])) return !0
})
},
not: function (e) {
return this.pushStack(T(this, e, !1), "not", e)
},
filter: function (e) {
return this.pushStack(T(this, e, !0), "filter", e)
},
is: function (e) {
return !!e && (typeof e == "string" ? ht.test(e) ? H(e, this.context).index(this[0]) >= 0 : H.filter(e, this).length > 0 : this.filter(e).length > 0)
},
closest: function (e, t) {
var n = [],
r, i, s = this[0];
if (H.isArray(e)) {
var o = 1;
while (s && s.ownerDocument && s !== t) {
for (r = 0; r < e.length; r++) H(s).is(e[r]) && n.push({
selector: e[r],
elem: s,
level: o
});
s = s.parentNode, o++
}
return n
}
var u = ht.test(e) || typeof e != "string" ? H(e, t || this.context) : 0;
for (r = 0, i = this.length; r < i; r++) {
s = this[r];
while (s) {
if (u ? u.index(s) > -1 : H.find.matchesSelector(s, e)) {
n.push(s);
break
}
s = s.parentNode;
if (!s || !s.ownerDocument || s === t || s.nodeType === 11) break
}
}
return n = n.length > 1 ? H.unique(n) : n, this.pushStack(n, "closest", e)
},
index: function (e) {
return e ? typeof e == "string" ? H.inArray(this[0], H(e)) : H.inArray(e.jquery ? e[0] : e, this) : this[0] && this[0].parentNode ? this.prevAll().length : -1
},
add: function (e, t) {
var n = typeof e == "string" ? H(e, t) : H.makeArray(e && e.nodeType ? [e] : e),
r = H.merge(this.get(), n);
return this.pushStack(N(n[0]) || N(r[0]) ? r : H.unique(r))
},
andSelf: function () {
return this.add(this.prevObject)
}
}), H.each({
parent: function (e) {
var t = e.parentNode;
return t && t.nodeType !== 11 ? t : null
},
parents: function (e) {
return H.dir(e, "parentNode")
},
parentsUntil: function (e, t, n) {
return H.dir(e, "parentNode", n)
},
next: function (e) {
return H.nth(e, 2, "nextSibling")
},
prev: function (e) {
return H.nth(e, 2, "previousSibling")
},
nextAll: function (e) {
return H.dir(e, "nextSibling")
},
prevAll: function (e) {
return H.dir(e, "previousSibling")
},
nextUntil: function (e, t, n) {
return H.dir(e, "nextSibling", n)
},
prevUntil: function (e, t, n) {
return H.dir(e, "previousSibling", n)
},
siblings: function (e) {
return H.sibling((e.parentNode || {}).firstChild, e)
},
children: function (e) {
return H.sibling(e.firstChild)
},
contents: function (e) {
return H.nodeName(e, "iframe") ? e.contentDocument || e.contentWindow.document : H.makeArray(e.childNodes)
}
}, function (e, t) {
H.fn[e] = function (n, r) {
var i = H.map(this, t, n);
return ut.test(e) || (r = n), r && typeof r == "string" && (i = H.filter(r, i)), i = this.length > 1 && !pt[e] ? H.unique(i) : i, (this.length > 1 || ft.test(r)) && at.test(e) && (i = i.reverse()), this.pushStack(i, e, ct.call(arguments).join(","))
}
}), H.extend({
filter: function (e, t, n) {
return n && (e = ":not(" + e + ")"), t.length === 1 ? H.find.matchesSelector(t[0], e) ? [t[0]] : [] : H.find.matches(e, t)
},
dir: function (e, n, r) {
var i = [],
s = e[n];
while (s && s.nodeType !== 9 && (r === t || s.nodeType !== 1 || !H(s).is(r))) s.nodeType === 1 && i.push(s), s = s[n];
return i
},
nth: function (e, t, n, r) {
t = t || 1;
var i = 0;
for (; e; e = e[n]) if (e.nodeType === 1 && ++i === t) break;
return e
},
sibling: function (e, t) {
var n = [];
for (; e; e = e.nextSibling) e.nodeType === 1 && e !== t && n.push(e);
return n
}
});
var dt = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
vt = / jQuery\d+="(?:\d+|null)"/g,
mt = /^\s+/,
gt = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
yt = /<([\w:]+)/,
bt = /<tbody/i,
wt = /<|&#?\w+;/,
Et = /<(?:script|style)/i,
St = /<(?:script|object|embed|option|style)/i,
xt = new RegExp("<(?:" + dt + ")[\\s/>]", "i"),
Tt = /checked\s*(?:[^=]|=\s*.checked.)/i,
Nt = /\/(java|ecma)script/i,
Ct = /^\s*<!(?:\[CDATA\[|\-\-)/,
kt = {
option: [1, "<select multiple='multiple'>", "</select>"],
legend: [1, "<fieldset>", "</fieldset>"],
thead: [1, "<table>", "</table>"],
tr: [2, "<table><tbody>", "</tbody></table>"],
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"],
area: [1, "<map>", "</map>"],
_default: [0, "", ""]
},
Lt = x(_);
kt.optgroup = kt.option, kt.tbody = kt.tfoot = kt.colgroup = kt.caption = kt.thead, kt.th = kt.td, H.support.htmlSerialize || (kt._default = [1, "div<div>", "</div>"]), H.fn.extend({
text: function (e) {
return H.access(this, function (e) {
return e === t ? H.text(this) : this.empty().append((this[0] && this[0].ownerDocument || _).createTextNode(e))
}, null, e, arguments.length)
},
wrapAll: function (e) {
if (H.isFunction(e)) return this.each(function (t) {
H(this).wrapAll(e.call(this, t))
});
if (this[0]) {
var t = H(e, this[0].ownerDocument).eq(0).clone(!0);
this[0].parentNode && t.insertBefore(this[0]), t.map(function () {
var e = this;
while (e.firstChild && e.firstChild.nodeType === 1) e = e.firstChild;
return e
}).append(this)
}
return this
},
wrapInner: function (e) {
return H.isFunction(e) ? this.each(function (t) {
H(this).wrapInner(e.call(this, t))
}) : this.each(function () {
var t = H(this),
n = t.contents();
n.length ? n.wrapAll(e) : t.append(e)
})
},
wrap: function (e) {
var t = H.isFunction(e);
return this.each(function (n) {
H(this).wrapAll(t ? e.call(this, n) : e)
})
},
unwrap: function () {
return this.parent().each(function () {
H.nodeName(this, "body") || H(this).replaceWith(this.childNodes)
}).end()
},
append: function () {
return this.domManip(arguments, !0, function (e) {
this.nodeType === 1 && this.appendChild(e)
})
},
prepend: function () {
return this.domManip(arguments, !0, function (e) {
this.nodeType === 1 && this.insertBefore(e, this.firstChild)
})
},
before: function () {
if (this[0] && this[0].parentNode) return this.domManip(arguments, !1, function (e) {
this.parentNode.insertBefore(e, this)
});
if (arguments.length) {
var e = H.clean(arguments);
return e.push.apply(e, this.toArray()), this.pushStack(e, "before", arguments)
}
},
after: function () {
if (this[0] && this[0].parentNode) return this.domManip(arguments, !1, function (e) {
this.parentNode.insertBefore(e, this.nextSibling)
});
if (arguments.length) {
var e = this.pushStack(this, "after", arguments);
return e.push.apply(e, H.clean(arguments)), e
}
},
remove: function (e, t) {
for (var n = 0, r;
(r = this[n]) != null; n++) if (!e || H.filter(e, [r]).length)!t && r.nodeType === 1 && (H.cleanData(r.getElementsByTagName("*")), H.cleanData([r])), r.parentNode && r.parentNode.removeChild(r);
return this
},
empty: function () {
for (var e = 0, t;
(t = this[e]) != null; e++) {
t.nodeType === 1 && H.cleanData(t.getElementsByTagName("*"));
while (t.firstChild) t.removeChild(t.firstChild)
}
return this
},
clone: function (e, t) {
return e = e == null ? !1 : e, t = t == null ? e : t, this.map(function () {
return H.clone(this, e, t)
})
},
html: function (e) {
return H.access(this, function (e) {
var n = this[0] || {},
r = 0,
i = this.length;
if (e === t) return n.nodeType === 1 ? n.innerHTML.replace(vt, "") : null;
if (typeof e == "string" && !Et.test(e) && (H.support.leadingWhitespace || !mt.test(e)) && !kt[(yt.exec(e) || ["", ""])[1].toLowerCase()]) {
e = e.replace(gt, "<$1></$2>");
try {
for (; r < i; r++) n = this[r] || {}, n.nodeType === 1 && (H.cleanData(n.getElementsByTagName("*")), n.innerHTML = e);
n = 0
} catch (s) {}
}
n && this.empty().append(e)
}, null, e, arguments.length)
},
replaceWith: function (e) {
return this[0] && this[0].parentNode ? H.isFunction(e) ? this.each(function (t) {
var n = H(this),
r = n.html();
n.replaceWith(e.call(this, t, r))
}) : (typeof e != "string" && (e = H(e).detach()), this.each(function () {
var t = this.nextSibling,
n = this.parentNode;
H(this).remove(), t ? H(t).before(e) : H(n).append(e)
})) : this.length ? this.pushStack(H(H.isFunction(e) ? e() : e), "replaceWith", e) : this
},
detach: function (e) {
return this.remove(e, !0)
},
domManip: function (e, n, r) {
var i, s, o, u, a = e[0],
f = [];
if (!H.support.checkClone && arguments.length === 3 && typeof a == "string" && Tt.test(a)) return this.each(function () {
H(this).domManip(e, n, r, !0)
});
if (H.isFunction(a)) return this.each(function (i) {
var s = H(this);
e[0] = a.call(this, i, n ? s.html() : t), s.domManip(e, n, r)
});
if (this[0]) {
u = a && a.parentNode, H.support.parentNode && u && u.nodeType === 11 && u.childNodes.length === this.length ? i = {
fragment: u
} : i = H.buildFragment(e, this, f), o = i.fragment, o.childNodes.length === 1 ? s = o = o.firstChild : s = o.firstChild;
if (s) {
n = n && H.nodeName(s, "tr");
for (var l = 0, c = this.length, h = c - 1; l < c; l++) r.call(n ? S(this[l], s) : this[l], i.cacheable || c > 1 && l < h ? H.clone(o, !0, !0) : o)
}
f.length && H.each(f, function (e, t) {
t.src ? H.ajax({
type: "GET",
global: !1,
url: t.src,
async: !1,
dataType: "script"
}) : H.globalEval((t.text || t.textContent || t.innerHTML || "").replace(Ct, "/*$0*/")), t.parentNode && t.parentNode.removeChild(t)
})
}
return this
}
}), H.buildFragment = function (e, t, n) {
var r, i, s, o, u = e[0];
return t && t[0] && (o = t[0].ownerDocument || t[0]), o.createDocumentFragment || (o = _), e.length === 1 && typeof u == "string" && u.length < 512 && o === _ && u.charAt(0) === "<" && !St.test(u) && (H.support.checkClone || !Tt.test(u)) && (H.support.html5Clone || !xt.test(u)) && (i = !0, s = H.fragments[u], s && s !== 1 && (r = s)), r || (r = o.createDocumentFragment(), H.clean(e, o, r, n)), i && (H.fragments[u] = s ? r : 1), {
fragment: r,
cacheable: i
}
}, H.fragments = {}, H.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function (e, t) {
H.fn[e] = function (n) {
var r = [],
i = H(n),
s = this.length === 1 && this[0].parentNode;
if (s && s.nodeType === 11 && s.childNodes.length === 1 && i.length === 1) return i[t](this[0]), this;
for (var o = 0, u = i.length; o < u; o++) {
var a = (o > 0 ? this.clone(!0) : this).get();
H(i[o])[t](a), r = r.concat(a)
}
return this.pushStack(r, e, i.selector)
}
}), H.extend({
clone: function (e, t, n) {
var r, i, s, o = H.support.html5Clone || H.isXMLDoc(e) || !xt.test("<" + e.nodeName + ">") ? e.cloneNode(!0) : m(e);
if ((!H.support.noCloneEvent || !H.support.noCloneChecked) && (e.nodeType === 1 || e.nodeType === 11) && !H.isXMLDoc(e)) {
w(e, o), r = b(e), i = b(o);
for (s = 0; r[s]; ++s) i[s] && w(r[s], i[s])
}
if (t) {
E(e, o);
if (n) {
r = b(e), i = b(o);
for (s = 0; r[s]; ++s) E(r[s], i[s])
}
}
return r = i = null, o
},
clean: function (e, t, n, r) {
var i, s, o, u = [];
t = t || _, typeof t.createElement == "undefined" && (t = t.ownerDocument || t[0] && t[0].ownerDocument || _);
for (var a = 0, f;
(f = e[a]) != null; a++) {
typeof f == "number" && (f += "");
if (!f) continue;
if (typeof f == "string") if (!wt.test(f)) f = t.createTextNode(f);
else {
f = f.replace(gt, "<$1></$2>");
var l = (yt.exec(f) || ["", ""])[1].toLowerCase(),
c = kt[l] || kt._default,
h = c[0],
p = t.createElement("div"),
d = Lt.childNodes,
v;
t === _ ? Lt.appendChild(p) : x(t).appendChild(p), p.innerHTML = c[1] + f + c[2];
while (h--) p = p.lastChild;
if (!H.support.tbody) {
var m = bt.test(f),
y = l === "table" && !m ? p.firstChild && p.firstChild.childNodes : c[1] === "<table>" && !m ? p.childNodes : [];
for (o = y.length - 1; o >= 0; --o) H.nodeName(y[o], "tbody") && !y[o].childNodes.length && y[o].parentNode.removeChild(y[o])
}!H.support.leadingWhitespace && mt.test(f) && p.insertBefore(t.createTextNode(mt.exec(f)[0]), p.firstChild), f = p.childNodes, p && (p.parentNode.removeChild(p), d.length > 0 && (v = d[d.length - 1], v && v.parentNode && v.parentNode.removeChild(v)))
}
var b;
if (!H.support.appendChecked) if (f[0] && typeof (b = f.length) == "number") for (o = 0; o < b; o++) g(f[o]);
else g(f);
f.nodeType ? u.push(f) : u = H.merge(u, f)
}
if (n) {
i = function (e) {
return !e.type || Nt.test(e.type)
};
for (a = 0; u[a]; a++) {
s = u[a];
if (r && H.nodeName(s, "script") && (!s.type || Nt.test(s.type))) r.push(s.parentNode ? s.parentNode.removeChild(s) : s);
else {
if (s.nodeType === 1) {
var w = H.grep(s.getElementsByTagName("script"), i);
u.splice.apply(u, [a + 1, 0].concat(w))
}
n.appendChild(s)
}
}
}
return u
},
cleanData: function (e) {
var t, n, r = H.cache,
i = H.event.special,
s = H.support.deleteExpando;
for (var o = 0, u;
(u = e[o]) != null; o++) {
if (u.nodeName && H.noData[u.nodeName.toLowerCase()]) continue;
n = u[H.expando];
if (n) {
t = r[n];
if (t && t.events) {
for (var a in t.events) i[a] ? H.event.remove(u, a) : H.removeEvent(u, a, t.handle);
t.handle && (t.handle.elem = null)
}
s ? delete u[H.expando] : u.removeAttribute && u.removeAttribute(H.expando), delete r[n]
}
}
}
});
var At = /alpha\([^)]*\)/i,
Ot = /opacity=([^)]*)/,
Mt = /([A-Z]|^ms)/g,
_t = /^[\-+]?(?:\d*\.)?\d+$/i,
Dt = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
Pt = /^([\-+])=([\-+.\de]+)/,
Ht = /^margin/,
Bt = {
position: "absolute",
visibility: "hidden",
display: "block"
},
jt = ["Top", "Right", "Bottom", "Left"],
Ft, It, qt;
H.fn.css = function (e, n) {
return H.access(this, function (e, n, r) {
return r !== t ? H.style(e, n, r) : H.css(e, n)
}, e, n, arguments.length > 1)
}, H.extend({
cssHooks: {
opacity: {
get: function (e, t) {
if (t) {
var n = Ft(e, "opacity");
return n === "" ? "1" : n
}
return e.style.opacity
}
}
},
cssNumber: {
fillOpacity: !0,
fontWeight: !0,
lineHeight: !0,
opacity: !0,
orphans: !0,
widows: !0,
zIndex: !0,
zoom: !0
},
cssProps: {
"float": H.support.cssFloat ? "cssFloat" : "styleFloat"
},
style: function (e, n, r, i) {
if ( !! e && e.nodeType !== 3 && e.nodeType !== 8 && !! e.style) {
var s, o, u = H.camelCase(n),
a = e.style,
f = H.cssHooks[u];
n = H.cssProps[u] || u;
if (r === t) return f && "get" in f && (s = f.get(e, !1, i)) !== t ? s : a[n];
o = typeof r, o === "string" && (s = Pt.exec(r)) && (r = +(s[1] + 1) * +s[2] + parseFloat(H.css(e, n)), o = "number");
if (r == null || o === "number" && isNaN(r)) return;
o === "number" && !H.cssNumber[u] && (r += "px");
if (!f || !("set" in f) || (r = f.set(e, r)) !== t) try {
a[n] = r
} catch (l) {}
}
},
css: function (e, n, r) {
var i, s;
n = H.camelCase(n), s = H.cssHooks[n], n = H.cssProps[n] || n, n === "cssFloat" && (n = "float");
if (s && "get" in s && (i = s.get(e, !0, r)) !== t) return i;
if (Ft) return Ft(e, n)
},
swap: function (e, t, n) {
var r = {},
i, s;
for (s in t) r[s] = e.style[s], e.style[s] = t[s];
i = n.call(e);
for (s in t) e.style[s] = r[s];
return i
}
}), H.curCSS = H.css, _.defaultView && _.defaultView.getComputedStyle && (It = function (e, t) {
var n, r, i, s, o = e.style;
return t = t.replace(Mt, "-$1").toLowerCase(), (r = e.ownerDocument.defaultView) && (i = r.getComputedStyle(e, null)) && (n = i.getPropertyValue(t), n === "" && !H.contains(e.ownerDocument.documentElement, e) && (n = H.style(e, t))), !H.support.pixelMargin && i && Ht.test(t) && Dt.test(n) && (s = o.width, o.width = n, n = i.width, o.width = s), n
}), _.documentElement.currentStyle && (qt = function (e, t) {
var n, r, i, s = e.currentStyle && e.currentStyle[t],
o = e.style;
return s == null && o && (i = o[t]) && (s = i), Dt.test(s) && (n = o.left, r = e.runtimeStyle && e.runtimeStyle.left, r && (e.runtimeStyle.left = e.currentStyle.left), o.left = t === "fontSize" ? "1em" : s, s = o.pixelLeft + "px", o.left = n, r && (e.runtimeStyle.left = r)), s === "" ? "auto" : s
}), Ft = It || qt, H.each(["height", "width"], function (e, t) {
H.cssHooks[t] = {
get: function (e, n, r) {
if (n) return e.offsetWidth !== 0 ? v(e, t, r) : H.swap(e, Bt, function () {
return v(e, t, r)
})
},
set: function (e, t) {
return _t.test(t) ? t + "px" : t
}
}
}), H.support.opacity || (H.cssHooks.opacity = {
get: function (e, t) {
return Ot.test((t && e.currentStyle ? e.currentStyle.filter : e.style.filter) || "") ? parseFloat(RegExp.$1) / 100 + "" : t ? "1" : ""
},
set: function (e, t) {
var n = e.style,
r = e.currentStyle,
i = H.isNumeric(t) ? "alpha(opacity=" + t * 100 + ")" : "",
s = r && r.filter || n.filter || "";
n.zoom = 1;
if (t >= 1 && H.trim(s.replace(At, "")) === "") {
n.removeAttribute("filter");
if (r && !r.filter) return
}
n.filter = At.test(s) ? s.replace(At, i) : s + " " + i
}
}), H(function () {
H.support.reliableMarginRight || (H.cssHooks.marginRight = {
get: function (e, t) {
return H.swap(e, {
display: "inline-block"
}, function () {
return t ? Ft(e, "margin-right") : e.style.marginRight
})
}
})
}), H.expr && H.expr.filters && (H.expr.filters.hidden = function (e) {
var t = e.offsetWidth,
n = e.offsetHeight;
return t === 0 && n === 0 || !H.support.reliableHiddenOffsets && (e.style && e.style.display || H.css(e, "display")) === "none"
}, H.expr.filters.visible = function (e) {
return !H.expr.filters.hidden(e)
}), H.each({
margin: "",
padding: "",
border: "Width"
}, function (e, t) {
H.cssHooks[e + t] = {
expand: function (n) {
var r, i = typeof n == "string" ? n.split(" ") : [n],
s = {};
for (r = 0; r < 4; r++) s[e + jt[r] + t] = i[r] || i[r - 2] || i[0];
return s
}
}
});
var Rt = /%20/g,
Ut = /\[\]$/,
zt = /\r?\n/g,
Wt = /#.*$/,
Xt = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg,
Vt = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
$t = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
Jt = /^(?:GET|HEAD)$/,
Kt = /^\/\//,
Qt = /\?/,
Gt = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
Yt = /^(?:select|textarea)/i,
Zt = /\s+/,
en = /([?&])_=[^&]*/,
tn = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
nn = H.fn.load,
rn = {},
sn = {},
on, un, an = ["*/"] + ["*"];
try {
on = P.href
} catch (fn) {
on = _.createElement("a"), on.href = "", on = on.href
}
un = tn.exec(on.toLowerCase()) || [], H.fn.extend({
load: function (e, n, r) {
if (typeof e != "string" && nn) return nn.apply(this, arguments);
if (!this.length) return this;
var i = e.indexOf(" ");
if (i >= 0) {
var s = e.slice(i, e.length);
e = e.slice(0, i)
}
var o = "GET";
n && (H.isFunction(n) ? (r = n, n = t) : typeof n == "object" && (n = H.param(n, H.ajaxSettings.traditional), o = "POST"));
var u = this;
return H.ajax({
url: e,
type: o,
dataType: "html",
data: n,
complete: function (e, t, n) {
n = e.responseText, e.isResolved() && (e.done(function (e) {
n = e
}), u.html(s ? H("<div>").append(n.replace(Gt, "")).find(s) : n)), r && u.each(r, [n, t, e])
}
}), this
},
serialize: function () {
return H.param(this.serializeArray())
},
serializeArray: function () {
return this.map(function () {
return this.elements ? H.makeArray(this.elements) : this
}).filter(function () {
return this.name && !this.disabled && (this.checked || Yt.test(this.nodeName) || Vt.test(this.type))
}).map(function (e, t) {
var n = H(this).val();
return n == null ? null : H.isArray(n) ? H.map(n, function (e, n) {
return {
name: t.name,
value: e.replace(zt, "\r\n")
}
}) : {
name: t.name,
value: n.replace(zt, "\r\n")
}
}).get()
}
}), H.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function (e, t) {
H.fn[t] = function (e) {
return this.on(t, e)
}
}), H.each(["get", "post"], function (e, n) {
H[n] = function (e, r, i, s) {
return H.isFunction(r) && (s = s || i, i = r, r = t), H.ajax({
type: n,
url: e,
data: r,
success: i,
dataType: s
})
}
}), H.extend({
getScript: function (e, n) {
return H.get(e, t, n, "script")
},
getJSON: function (e, t, n) {
return H.get(e, t, n, "json")
},
ajaxSetup: function (e, t) {
return t ? h(e, H.ajaxSettings) : (t = e, e = H.ajaxSettings), h(e, t), e
},
ajaxSettings: {
url: on,
isLocal: $t.test(un[1]),
global: !0,
type: "GET",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
processData: !0,
async: !0,
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": an
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
converters: {
"* text": e.String,
"text html": !0,
"text json": H.parseJSON,
"text xml": H.parseXML
},
flatOptions: {
context: !0,
url: !0
}
},
ajaxPrefilter: d(rn),
ajaxTransport: d(sn),
ajax: function (e, n) {
function r(e, n, r, p) {
if (E !== 2) {
E = 2, b && clearTimeout(b), y = t, m = p || "", T.readyState = e > 0 ? 4 : 0;
var d, v, g, w = n,
x = r ? l(i, T, r) : t,
N, C;
if (e >= 200 && e < 300 || e === 304) {
if (i.ifModified) {
if (N = T.getResponseHeader("Last-Modified")) H.lastModified[h] = N;
if (C = T.getResponseHeader("Etag")) H.etag[h] = C
}
if (e === 304) w = "notmodified", d = !0;
else try {
v = f(i, x), w = "success", d = !0
} catch (k) {
w = "parsererror", g = k
}
} else {
g = w;
if (!w || e) w = "error", e < 0 && (e = 0)
}
T.status = e, T.statusText = "" + (n || w), d ? u.resolveWith(s, [v, w, T]) : u.rejectWith(s, [T, w, g]), T.statusCode(c), c = t, S && o.trigger("ajax" + (d ? "Success" : "Error"), [T, i, d ? v : g]), a.fireWith(s, [T, w]), S && (o.trigger("ajaxComplete", [T, i]), --H.active || H.event.trigger("ajaxStop"))
}
}
typeof e == "object" && (n = e, e = t), n = n || {};
var i = H.ajaxSetup({}, n),
s = i.context || i,
o = s !== i && (s.nodeType || s instanceof H) ? H(s) : H.event,
u = H.Deferred(),
a = H.Callbacks("once memory"),
c = i.statusCode || {},
h, d = {},
v = {},
m, g, y, b, w, E = 0,
S, x, T = {
readyState: 0,
setRequestHeader: function (e, t) {
if (!E) {
var n = e.toLowerCase();
e = v[n] = v[n] || e, d[e] = t
}
return this
},
getAllResponseHeaders: function () {
return E === 2 ? m : null
},
getResponseHeader: function (e) {
var n;
if (E === 2) {
if (!g) {
g = {};
while (n = Xt.exec(m)) g[n[1].toLowerCase()] = n[2]
}
n = g[e.toLowerCase()]
}
return n === t ? null : n
},
overrideMimeType: function (e) {
return E || (i.mimeType = e), this
},
abort: function (e) {
return e = e || "abort", y && y.abort(e), r(0, e), this
}
};
u.promise(T), T.success = T.done, T.error = T.fail, T.complete = a.add, T.statusCode = function (e) {
if (e) {
var t;
if (E < 2) for (t in e) c[t] = [c[t], e[t]];
else t = e[T.status], T.then(t, t)
}
return this
}, i.url = ((e || i.url) + "").replace(Wt, "").replace(Kt, un[1] + "//"), i.dataTypes = H.trim(i.dataType || "*").toLowerCase().split(Zt), i.crossDomain == null && (w = tn.exec(i.url.toLowerCase()), i.crossDomain = !(!w || w[1] == un[1] && w[2] == un[2] && (w[3] || (w[1] === "http:" ? 80 : 443)) == (un[3] || (un[1] === "http:" ? 80 : 443)))), i.data && i.processData && typeof i.data != "string" && (i.data = H.param(i.data, i.traditional)), p(rn, i, n, T);
if (E === 2) return !1;
S = i.global, i.type = i.type.toUpperCase(), i.hasContent = !Jt.test(i.type), S && H.active++ === 0 && H.event.trigger("ajaxStart");
if (!i.hasContent) {
i.data && (i.url += (Qt.test(i.url) ? "&" : "?") + i.data, delete i.data), h = i.url;
if (i.cache === !1) {
var N = H.now(),
C = i.url.replace(en, "$1_=" + N);
i.url = C + (C === i.url ? (Qt.test(i.url) ? "&" : "?") + "_=" + N : "")
}
}(i.data && i.hasContent && i.contentType !== !1 || n.contentType) && T.setRequestHeader("Content-Type", i.contentType), i.ifModified && (h = h || i.url, H.lastModified[h] && T.setRequestHeader("If-Modified-Since", H.lastModified[h]), H.etag[h] && T.setRequestHeader("If-None-Match", H.etag[h])), T.setRequestHeader("Accept", i.dataTypes[0] && i.accepts[i.dataTypes[0]] ? i.accepts[i.dataTypes[0]] + (i.dataTypes[0] !== "*" ? ", " + an + "; q=0.01" : "") : i.accepts["*"]);
for (x in i.headers) T.setRequestHeader(x, i.headers[x]);
if (!i.beforeSend || i.beforeSend.call(s, T, i) !== !1 && E !== 2) {
for (x in {
success: 1,
error: 1,
complete: 1
}) T[x](i[x]);
y = p(sn, i, n, T);
if (!y) r(-1, "No Transport");
else {
T.readyState = 1, S && o.trigger("ajaxSend", [T, i]), i.async && i.timeout > 0 && (b = setTimeout(function () {
T.abort("timeout")
}, i.timeout));
try {
E = 1, y.send(d, r)
} catch (k) {
if (!(E < 2)) throw k;
r(-1, k)
}
}
return T
}
return T.abort(), !1
},
param: function (e, n) {
var r = [],
i = function (e, t) {
t = H.isFunction(t) ? t() : t, r[r.length] = encodeURIComponent(e) + "=" + encodeURIComponent(t)
};
n === t && (n = H.ajaxSettings.traditional);
if (H.isArray(e) || e.jquery && !H.isPlainObject(e)) H.each(e, function () {
i(this.name, this.value)
});
else for (var s in e) c(s, e[s], n, i);
return r.join("&").replace(Rt, "+")
}
}), H.extend({
active: 0,
lastModified: {},
etag: {}
});
var ln = H.now(),
cn = /(\=)\?(&|$)|\?\?/i;
H.ajaxSetup({
jsonp: "callback",
jsonpCallback: function () {
return H.expando + "_" + ln++
}
}), H.ajaxPrefilter("json jsonp", function (t, n, r) {
var i = typeof t.data == "string" && /^application\/x\-www\-form\-urlencoded/.test(t.contentType);
if (t.dataTypes[0] === "jsonp" || t.jsonp !== !1 && (cn.test(t.url) || i && cn.test(t.data))) {
var s, o = t.jsonpCallback = H.isFunction(t.jsonpCallback) ? t.jsonpCallback() : t.jsonpCallback,
u = e[o],
a = t.url,
f = t.data,
l = "$1" + o + "$2";
return t.jsonp !== !1 && (a = a.replace(cn, l), t.url === a && (i && (f = f.replace(cn, l)), t.data === f && (a += (/\?/.test(a) ? "&" : "?") + t.jsonp + "=" + o))), t.url = a, t.data = f, e[o] = function (e) {
s = [e]
}, r.always(function () {
e[o] = u, s && H.isFunction(u) && e[o](s[0])
}), t.converters["script json"] = function () {
return s || H.error(o + " was not called"), s[0]
}, t.dataTypes[0] = "json", "script"
}
}), H.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function (e) {
return H.globalEval(e), e
}
}
}), H.ajaxPrefilter("script", function (e) {
e.cache === t && (e.cache = !1), e.crossDomain && (e.type = "GET", e.global = !1)
}), H.ajaxTransport("script", function (e) {
if (e.crossDomain) {
var n, r = _.head || _.getElementsByTagName("head")[0] || _.documentElement;
return {
send: function (i, s) {
n = _.createElement("script"), n.async = "async", e.scriptCharset && (n.charset = e.scriptCharset), n.src = e.url, n.onload = n.onreadystatechange = function (e, i) {
if (i || !n.readyState || /loaded|complete/.test(n.readyState)) n.onload = n.onreadystatechange = null, r && n.parentNode && r.removeChild(n), n = t, i || s(200, "success")
}, r.insertBefore(n, r.firstChild)
},
abort: function () {
n && n.onload(0, 1)
}
}
}
});
var hn = e.ActiveXObject ?
function () {
for (var e in dn) dn[e](0, 1)
} : !1, pn = 0, dn;
H.ajaxSettings.xhr = e.ActiveXObject ?
function () {
return !this.isLocal && a() || u()
} : a, function (e) {
H.extend(H.support, {
ajax: !! e,
cors: !! e && "withCredentials" in e
})
}(H.ajaxSettings.xhr()), H.support.ajax && H.ajaxTransport(function (n) {
if (!n.crossDomain || H.support.cors) {
var r;
return {
send: function (i, s) {
var o = n.xhr(),
u, a;
n.username ? o.open(n.type, n.url, n.async, n.username, n.password) : o.open(n.type, n.url, n.async);
if (n.xhrFields) for (a in n.xhrFields) o[a] = n.xhrFields[a];
n.mimeType && o.overrideMimeType && o.overrideMimeType(n.mimeType), !n.crossDomain && !i["X-Requested-With"] && (i["X-Requested-With"] = "XMLHttpRequest");
try {
for (a in i) o.setRequestHeader(a, i[a])
} catch (f) {}
o.send(n.hasContent && n.data || null), r = function (e, i) {
var a, f, l, c, h;
try {
if (r && (i || o.readyState === 4)) {
r = t, u && (o.onreadystatechange = H.noop, hn && delete dn[u]);
if (i) o.readyState !== 4 && o.abort();
else {
a = o.status, l = o.getAllResponseHeaders(), c = {}, h = o.responseXML, h && h.documentElement && (c.xml = h);
try {
c.text = o.responseText
} catch (e) {}
try {
f = o.statusText
} catch (p) {
f = ""
}!a && n.isLocal && !n.crossDomain ? a = c.text ? 200 : 404 : a === 1223 && (a = 204)
}
}
} catch (d) {
i || s(-1, d)
}
c && s(a, f, c, l)
}, !n.async || o.readyState === 4 ? r() : (u = ++pn, hn && (dn || (dn = {}, H(e).unload(hn)), dn[u] = r), o.onreadystatechange = r)
},
abort: function () {
r && r(0, 1)
}
}
}
});
var vn = {},
mn, gn, yn = /^(?:toggle|show|hide)$/,
bn = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
wn, En = [
["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"],
["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"],
["opacity"]
],
Sn;
H.fn.extend({
show: function (e, t, n) {
var s, o;
if (e || e === 0) return this.animate(i("show", 3), e, t, n);
for (var u = 0, a = this.length; u < a; u++) s = this[u], s.style && (o = s.style.display, !H._data(s, "olddisplay") && o === "none" && (o = s.style.display = ""), (o === "" && H.css(s, "display") === "none" || !H.contains(s.ownerDocument.documentElement, s)) && H._data(s, "olddisplay", r(s.nodeName)));
for (u = 0; u < a; u++) {
s = this[u];
if (s.style) {
o = s.style.display;
if (o === "" || o === "none") s.style.display = H._data(s, "olddisplay") || ""
}
}
return this
},
hide: function (e, t, n) {
if (e || e === 0) return this.animate(i("hide", 3), e, t, n);
var r, s, o = 0,
u = this.length;
for (; o < u; o++) r = this[o], r.style && (s = H.css(r, "display"), s !== "none" && !H._data(r, "olddisplay") && H._data(r, "olddisplay", s));
for (o = 0; o < u; o++) this[o].style && (this[o].style.display = "none");
return this
},
_toggle: H.fn.toggle,
toggle: function (e, t, n) {
var r = typeof e == "boolean";
return H.isFunction(e) && H.isFunction(t) ? this._toggle.apply(this, arguments) : e == null || r ? this.each(function () {
var t = r ? e : H(this).is(":hidden");
H(this)[t ? "show" : "hide"]()
}) : this.animate(i("toggle", 3), e, t, n), this
},
fadeTo: function (e, t, n, r) {
return this.filter(":hidden").css("opacity", 0).show().end().animate({
opacity: t
}, e, n, r)
},
animate: function (e, t, n, i) {
function s() {
o.queue === !1 && H._mark(this);
var t = H.extend({}, o),
n = this.nodeType === 1,
i = n && H(this).is(":hidden"),
s, u, a, f, l, c, h, p, d, v, m;
t.animatedProperties = {};
for (a in e) {
s = H.camelCase(a), a !== s && (e[s] = e[a], delete e[a]);
if ((l = H.cssHooks[s]) && "expand" in l) {
c = l.expand(e[s]), delete e[s];
for (a in c) a in e || (e[a] = c[a])
}
}
for (s in e) {
u = e[s], H.isArray(u) ? (t.animatedProperties[s] = u[1], u = e[s] = u[0]) : t.animatedProperties[s] = t.specialEasing && t.specialEasing[s] || t.easing || "swing";
if (u === "hide" && i || u === "show" && !i) return t.complete.call(this);
n && (s === "height" || s === "width") && (t.overflow = [this.style.overflow, this.style.overflowX, this.style.overflowY], H.css(this, "display") === "inline" && H.css(this, "float") === "none" && (!H.support.inlineBlockNeedsLayout || r(this.nodeName) === "inline" ? this.style.display = "inline-block" : this.style.zoom = 1))
}
t.overflow != null && (this.style.overflow = "hidden");
for (a in e) f = new H.fx(this, t, a), u = e[a], yn.test(u) ? (m = H._data(this, "toggle" + a) || (u === "toggle" ? i ? "show" : "hide" : 0), m ? (H._data(this, "toggle" + a, m === "show" ? "hide" : "show"), f[m]()) : f[u]()) : (h = bn.exec(u), p = f.cur(), h ? (d = parseFloat(h[2]), v = h[3] || (H.cssNumber[a] ? "" : "px"), v !== "px" && (H.style(this, a, (d || 1) + v), p = (d || 1) / f.cur() * p, H.style(this, a, p + v)), h[1] && (d = (h[1] === "-=" ? -1 : 1) * d + p), f.custom(p, d, v)) : f.custom(p, u, ""));
return !0
}
var o = H.speed(t, n, i);
return H.isEmptyObject(e) ? this.each(o.complete, [!1]) : (e = H.extend({}, e), o.queue === !1 ? this.each(s) : this.queue(o.queue, s))
},
stop: function (e, n, r) {
return typeof e != "string" && (r = n, n = e, e = t), n && e !== !1 && this.queue(e || "fx", []), this.each(function () {
function t(e, t, n) {
var i = t[n];
H.removeData(e, n, !0), i.stop(r)
}
var n, i = !1,
s = H.timers,
o = H._data(this);
r || H._unmark(!0, this);
if (e == null) for (n in o) o[n] && o[n].stop && n.indexOf(".run") === n.length - 4 && t(this, o, n);
else o[n = e + ".run"] && o[n].stop && t(this, o, n);
for (n = s.length; n--;) s[n].elem === this && (e == null || s[n].queue === e) && (r ? s[n](!0) : s[n].saveState(), i = !0, s.splice(n, 1));
(!r || !i) && H.dequeue(this, e)
})
}
}), H.each({
slideDown: i("show", 1),
slideUp: i("hide", 1),
slideToggle: i("toggle", 1),
fadeIn: {
opacity: "show"
},
fadeOut: {
opacity: "hide"
},
fadeToggle: {
opacity: "toggle"
}
}, function (e, t) {
H.fn[e] = function (e, n, r) {
return this.animate(t, e, n, r)
}
}), H.extend({
speed: function (e, t, n) {
var r = e && typeof e == "object" ? H.extend({}, e) : {
complete: n || !n && t || H.isFunction(e) && e,
duration: e,
easing: n && t || t && !H.isFunction(t) && t
};
r.duration = H.fx.off ? 0 : typeof r.duration == "number" ? r.duration : r.duration in H.fx.speeds ? H.fx.speeds[r.duration] : H.fx.speeds._default;
if (r.queue == null || r.queue === !0) r.queue = "fx";
return r.old = r.complete, r.complete = function (e) {
H.isFunction(r.old) && r.old.call(this), r.queue ? H.dequeue(this, r.queue) : e !== !1 && H._unmark(this)
}, r
},
easing: {
linear: function (e) {
return e
},
swing: function (e) {
return -Math.cos(e * Math.PI) / 2 + .5
}
},
timers: [],
fx: function (e, t, n) {
this.options = t, this.elem = e, this.prop = n, t.orig = t.orig || {}
}
}), H.fx.prototype = {
update: function () {
this.options.step && this.options.step.call(this.elem, this.now, this), (H.fx.step[this.prop] || H.fx.step._default)(this)
},
cur: function () {
if (this.elem[this.prop] == null || !! this.elem.style && this.elem.style[this.prop] != null) {
var e, t = H.css(this.elem, this.prop);
return isNaN(e = parseFloat(t)) ? !t || t === "auto" ? 0 : t : e
}
return this.elem[this.prop]
},
custom: function (e, n, r) {
function i(e) {
return s.step(e)
}
var s = this,
u = H.fx;
this.startTime = Sn || o(), this.end = n, this.now = this.start = e, this.pos = this.state = 0, this.unit = r || this.unit || (H.cssNumber[this.prop] ? "" : "px"), i.queue = this.options.queue, i.elem = this.elem, i.saveState = function () {
H._data(s.elem, "fxshow" + s.prop) === t && (s.options.hide ? H._data(s.elem, "fxshow" + s.prop, s.start) : s.options.show && H._data(s.elem, "fxshow" + s.prop, s.end))
}, i() && H.timers.push(i) && !wn && (wn = setInterval(u.tick, u.interval))
},
show: function () {
var e = H._data(this.elem, "fxshow" + this.prop);
this.options.orig[this.prop] = e || H.style(this.elem, this.prop), this.options.show = !0, e !== t ? this.custom(this.cur(), e) : this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()), H(this.elem).show()
},
hide: function () {
this.options.orig[this.prop] = H._data(this.elem, "fxshow" + this.prop) || H.style(this.elem, this.prop), this.options.hide = !0, this.custom(this.cur(), 0)
},
step: function (e) {
var t, n, r, i = Sn || o(),
s = !0,
u = this.elem,
a = this.options;
if (e || i >= a.duration + this.startTime) {
this.now = this.end, this.pos = this.state = 1, this.update(), a.animatedProperties[this.prop] = !0;
for (t in a.animatedProperties) a.animatedProperties[t] !== !0 && (s = !1);
if (s) {
a.overflow != null && !H.support.shrinkWrapBlocks && H.each(["", "X", "Y"], function (e, t) {
u.style["overflow" + t] = a.overflow[e]
}), a.hide && H(u).hide();
if (a.hide || a.show) for (t in a.animatedProperties) H.style(u, t, a.orig[t]), H.removeData(u, "fxshow" + t, !0), H.removeData(u, "toggle" + t, !0);
r = a.complete, r && (a.complete = !1, r.call(u))
}
return !1
}
return a.duration == Infinity ? this.now = i : (n = i - this.startTime, this.state = n / a.duration, this.pos = H.easing[a.animatedProperties[this.prop]](this.state, n, 0, 1, a.duration), this.now = this.start + (this.end - this.start) * this.pos), this.update(), !0
}
}, H.extend(H.fx, {
tick: function () {
var e, t = H.timers,
n = 0;
for (; n < t.length; n++) e = t[n], !e() && t[n] === e && t.splice(n--, 1);
t.length || H.fx.stop()
},
interval: 13,
stop: function () {
clearInterval(wn), wn = null
},
speeds: {
slow: 600,
fast: 200,
_default: 400
},
step: {
opacity: function (e) {
H.style(e.elem, "opacity", e.now)
},
_default: function (e) {
e.elem.style && e.elem.style[e.prop] != null ? e.elem.style[e.prop] = e.now + e.unit : e.elem[e.prop] = e.now
}
}
}), H.each(En.concat.apply([], En), function (e, t) {
t.indexOf("margin") && (H.fx.step[t] = function (e) {
H.style(e.elem, t, Math.max(0, e.now) + e.unit)
})
}), H.expr && H.expr.filters && (H.expr.filters.animated = function (e) {
return H.grep(H.timers, function (t) {
return e === t.elem
}).length
});
var xn, Tn = /^t(?:able|d|h)$/i,
Nn = /^(?:body|html)$/i;
"getBoundingClientRect" in _.documentElement ? xn = function (e, t, r, i) {
try {
i = e.getBoundingClientRect()
} catch (s) {}
if (!i || !H.contains(r, e)) return i ? {
top: i.top,
left: i.left
} : {
top: 0,
left: 0
};
var o = t.body,
u = n(t),
a = r.clientTop || o.clientTop || 0,
f = r.clientLeft || o.clientLeft || 0,
l = u.pageYOffset || H.support.boxModel && r.scrollTop || o.scrollTop,
c = u.pageXOffset || H.support.boxModel && r.scrollLeft || o.scrollLeft,
h = i.top + l - a,
p = i.left + c - f;
return {
top: h,
left: p
}
} : xn = function (e, t, n) {
var r, i = e.offsetParent,
s = e,
o = t.body,
u = t.defaultView,
a = u ? u.getComputedStyle(e, null) : e.currentStyle,
f = e.offsetTop,
l = e.offsetLeft;
while ((e = e.parentNode) && e !== o && e !== n) {
if (H.support.fixedPosition && a.position === "fixed") break;
r = u ? u.getComputedStyle(e, null) : e.currentStyle, f -= e.scrollTop, l -= e.scrollLeft, e === i && (f += e.offsetTop, l += e.offsetLeft, H.support.doesNotAddBorder && (!H.support.doesAddBorderForTableAndCells || !Tn.test(e.nodeName)) && (f += parseFloat(r.borderTopWidth) || 0, l += parseFloat(r.borderLeftWidth) || 0), s = i, i = e.offsetParent), H.support.subtractsBorderForOverflowNotVisible && r.overflow !== "visible" && (f += parseFloat(r.borderTopWidth) || 0, l += parseFloat(r.borderLeftWidth) || 0), a = r
}
if (a.position === "relative" || a.position === "static") f += o.offsetTop, l += o.offsetLeft;
return H.support.fixedPosition && a.position === "fixed" && (f += Math.max(n.scrollTop, o.scrollTop), l += Math.max(n.scrollLeft, o.scrollLeft)), {
top: f,
left: l
}
}, H.fn.offset = function (e) {
if (arguments.length) return e === t ? this : this.each(function (t) {
H.offset.setOffset(this, e, t)
});
var n = this[0],
r = n && n.ownerDocument;
return r ? n === r.body ? H.offset.bodyOffset(n) : xn(n, r, r.documentElement) : null
}, H.offset = {
bodyOffset: function (e) {
var t = e.offsetTop,
n = e.offsetLeft;
return H.support.doesNotIncludeMarginInBodyOffset && (t += parseFloat(H.css(e, "marginTop")) || 0, n += parseFloat(H.css(e, "marginLeft")) || 0), {
top: t,
left: n
}
},
setOffset: function (e, t, n) {
var r = H.css(e, "position");
r === "static" && (e.style.position = "relative");
var i = H(e),
s = i.offset(),
o = H.css(e, "top"),
u = H.css(e, "left"),
a = (r === "absolute" || r === "fixed") && H.inArray("auto", [o, u]) > -1,
f = {},
l = {},
c, h;
a ? (l = i.position(), c = l.top, h = l.left) : (c = parseFloat(o) || 0, h = parseFloat(u) || 0), H.isFunction(t) && (t = t.call(e, n, s)), t.top != null && (f.top = t.top - s.top + c), t.left != null && (f.left = t.left - s.left + h), "using" in t ? t.using.call(e, f) : i.css(f)
}
}, H.fn.extend({
position: function () {
if (!this[0]) return null;
var e = this[0],
t = this.offsetParent(),
n = this.offset(),
r = Nn.test(t[0].nodeName) ? {
top: 0,
left: 0
} : t.offset();
return n.top -= parseFloat(H.css(e, "marginTop")) || 0, n.left -= parseFloat(H.css(e, "marginLeft")) || 0, r.top += parseFloat(H.css(t[0], "borderTopWidth")) || 0, r.left += parseFloat(H.css(t[0], "borderLeftWidth")) || 0, {
top: n.top - r.top,
left: n.left - r.left
}
},
offsetParent: function () {
return this.map(function () {
var e = this.offsetParent || _.body;
while (e && !Nn.test(e.nodeName) && H.css(e, "position") === "static") e = e.offsetParent;
return e
})
}
}), H.each({
scrollLeft: "pageXOffset",
scrollTop: "pageYOffset"
}, function (e, r) {
var i = /Y/.test(r);
H.fn[e] = function (s) {
return H.access(this, function (e, s, o) {
var u = n(e);
if (o === t) return u ? r in u ? u[r] : H.support.boxModel && u.document.documentElement[s] || u.document.body[s] : e[s];
u ? u.scrollTo(i ? H(u).scrollLeft() : o, i ? o : H(u).scrollTop()) : e[s] = o
}, e, s, arguments.length, null)
}
}), H.each({
Height: "height",
Width: "width"
}, function (e, n) {
var r = "client" + e,
i = "scroll" + e,
s = "offset" + e;
H.fn["inner" + e] = function () {
var e = this[0];
return e ? e.style ? parseFloat(H.css(e, n, "padding")) : this[n]() : null
}, H.fn["outer" + e] = function (e) {
var t = this[0];
return t ? t.style ? parseFloat(H.css(t, n, e ? "margin" : "border")) : this[n]() : null
}, H.fn[n] = function (e) {
return H.access(this, function (e, n, o) {
var u, a, f, l;
if (H.isWindow(e)) return u = e.document, a = u.documentElement[r], H.support.boxModel && a || u.body && u.body[r] || a;
if (e.nodeType === 9) return u = e.documentElement, u[r] >= u[i] ? u[r] : Math.max(e.body[i], u[i], e.body[s], u[s]);
if (o === t) return f = H.css(e, n), l = parseFloat(f), H.isNumeric(l) ? l : f;
H(e).css(n, o)
}, n, e, arguments.length, null)
}
}), e.jQuery = e.$ = H, typeof define == "function" && define.amd && define.amd.jQuery && define("jquery", [], function () {
return H
})
})(window), function () {
var e = this,
t = e._,
n = {},
r = Array.prototype,
i = Object.prototype,
s = Function.prototype,
o = r.push,
u = r.slice,
a = r.concat,
f = i.toString,
l = i.hasOwnProperty,
c = r.forEach,
h = r.map,
p = r.reduce,
d = r.reduceRight,
v = r.filter,
m = r.every,
g = r.some,
y = r.indexOf,
b = r.lastIndexOf,
w = Array.isArray,
E = Object.keys,
S = s.bind,
x = function (e) {
return e instanceof x ? e : this instanceof x ? (this._wrapped = e, void 0) : new x(e)
};
"undefined" != typeof exports ? ("undefined" != typeof module && module.exports && (exports = module.exports = x), exports._ = x) : e._ = x, x.VERSION = "1.4.4";
var T = x.each = x.forEach = function (e, t, r) {
if (null != e) if (c && e.forEach === c) e.forEach(t, r);
else if (e.length === +e.length) {
for (var i = 0, s = e.length; s > i; i++) if (t.call(r, e[i], i, e) === n) return
} else for (var o in e) if (x.has(e, o) && t.call(r, e[o], o, e) === n) return
};
x.map = x.collect = function (e, t, n) {
var r = [];
return null == e ? r : h && e.map === h ? e.map(t, n) : (T(e, function (e, i, s) {
r[r.length] = t.call(n, e, i, s)
}), r)
};
var N = "Reduce of empty array with no initial value";
x.reduce = x.foldl = x.inject = function (e, t, n, r) {
var i = arguments.length > 2;
if (null == e && (e = []), p && e.reduce === p) return r && (t = x.bind(t, r)), i ? e.reduce(t, n) : e.reduce(t);
if (T(e, function (e, s, o) {
i ? n = t.call(r, n, e, s, o) : (n = e, i = !0)
}), !i) throw new TypeError(N);
return n
}, x.reduceRight = x.foldr = function (e, t, n, r) {
var i = arguments.length > 2;
if (null == e && (e = []), d && e.reduceRight === d) return r && (t = x.bind(t, r)), i ? e.reduceRight(t, n) : e.reduceRight(t);
var s = e.length;
if (s !== +s) {
var o = x.keys(e);
s = o.length
}
if (T(e, function (u, a, f) {
a = o ? o[--s] : --s, i ? n = t.call(r, n, e[a], a, f) : (n = e[a], i = !0)
}), !i) throw new TypeError(N);
return n
}, x.find = x.detect = function (e, t, n) {
var r;
return C(e, function (e, i, s) {
return t.call(n, e, i, s) ? (r = e, !0) : void 0
}), r
}, x.filter = x.select = function (e, t, n) {
var r = [];
return null == e ? r : v && e.filter === v ? e.filter(t, n) : (T(e, function (e, i, s) {
t.call(n, e, i, s) && (r[r.length] = e)
}), r)
}, x.reject = function (e, t, n) {
return x.filter(e, function (e, r, i) {
return !t.call(n, e, r, i)
}, n)
}, x.every = x.all = function (e, t, r) {
t || (t = x.identity);
var i = !0;
return null == e ? i : m && e.every === m ? e.every(t, r) : (T(e, function (e, s, o) {
return (i = i && t.call(r, e, s, o)) ? void 0 : n
}), !! i)
};
var C = x.some = x.any = function (e, t, r) {
t || (t = x.identity);
var i = !1;
return null == e ? i : g && e.some === g ? e.some(t, r) : (T(e, function (e, s, o) {
return i || (i = t.call(r, e, s, o)) ? n : void 0
}), !! i)
};
x.contains = x.include = function (e, t) {
return null == e ? !1 : y && e.indexOf === y ? e.indexOf(t) != -1 : C(e, function (e) {
return e === t
})
}, x.invoke = function (e, t) {
var n = u.call(arguments, 2),
r = x.isFunction(t);
return x.map(e, function (e) {
return (r ? t : e[t]).apply(e, n)
})
}, x.pluck = function (e, t) {
return x.map(e, function (e) {
return e[t]
})
}, x.where = function (e, t, n) {
return x.isEmpty(t) ? n ? null : [] : x[n ? "find" : "filter"](e, function (e) {
for (var n in t) if (t[n] !== e[n]) return !1;
return !0
})
}, x.findWhere = function (e, t) {
return x.where(e, t, !0)
}, x.max = function (e, t, n) {
if (!t && x.isArray(e) && e[0] === +e[0] && 65535 > e.length) return Math.max.apply(Math, e);
if (!t && x.isEmpty(e)) return -1 / 0;
var r = {
computed: -1 / 0,
value: -1 / 0
};
return T(e, function (e, i, s) {
var o = t ? t.call(n, e, i, s) : e;
o >= r.computed && (r = {
value: e,
computed: o
})
}), r.value
}, x.min = function (e, t, n) {
if (!t && x.isArray(e) && e[0] === +e[0] && 65535 > e.length) return Math.min.apply(Math, e);
if (!t && x.isEmpty(e)) return 1 / 0;
var r = {
computed: 1 / 0,
value: 1 / 0
};
return T(e, function (e, i, s) {
var o = t ? t.call(n, e, i, s) : e;
r.computed > o && (r = {
value: e,
computed: o
})
}), r.value
}, x.shuffle = function (e) {
var t, n = 0,
r = [];
return T(e, function (e) {
t = x.random(n++), r[n - 1] = r[t], r[t] = e
}), r
};
var k = function (e) {
return x.isFunction(e) ? e : function (t) {
return t[e]
}
};
x.sortBy = function (e, t, n) {
var r = k(t);
return x.pluck(x.map(e, function (e, t, i) {
return {
value: e,
index: t,
criteria: r.call(n, e, t, i)
}
}).sort(function (e, t) {
var n = e.criteria,
r = t.criteria;
if (n !== r) {
if (n > r || n === void 0) return 1;
if (r > n || r === void 0) return -1
}
return e.index < t.index ? -1 : 1
}), "value")
};
var L = function (e, t, n, r) {
var i = {},
s = k(t || x.identity);
return T(e, function (t, o) {
var u = s.call(n, t, o, e);
r(i, u, t)
}), i
};
x.groupBy = function (e, t, n) {
return L(e, t, n, function (e, t, n) {
(x.has(e, t) ? e[t] : e[t] = []).push(n)
})
}, x.countBy = function (e, t, n) {
return L(e, t, n, function (e, t) {
x.has(e, t) || (e[t] = 0), e[t]++
})
}, x.sortedIndex = function (e, t, n, r) {
n = null == n ? x.identity : k(n);
for (var i = n.call(r, t), s = 0, o = e.length; o > s;) {
var u = s + o >>> 1;
i > n.call(r, e[u]) ? s = u + 1 : o = u
}
return s
}, x.toArray = function (e) {
return e ? x.isArray(e) ? u.call(e) : e.length === +e.length ? x.map(e, x.identity) : x.values(e) : []
}, x.size = function (e) {
return null == e ? 0 : e.length === +e.length ? e.length : x.keys(e).length
}, x.first = x.head = x.take = function (e, t, n) {
return null == e ? void 0 : null == t || n ? e[0] : u.call(e, 0, t)
}, x.initial = function (e, t, n) {
return u.call(e, 0, e.length - (null == t || n ? 1 : t))
}, x.last = function (e, t, n) {
return null == e ? void 0 : null == t || n ? e[e.length - 1] : u.call(e, Math.max(e.length - t, 0))
}, x.rest = x.tail = x.drop = function (e, t, n) {
return u.call(e, null == t || n ? 1 : t)
}, x.compact = function (e) {
return x.filter(e, x.identity)
};
var A = function (e, t, n) {
return T(e, function (e) {
x.isArray(e) ? t ? o.apply(n, e) : A(e, t, n) : n.push(e)
}), n
};
x.flatten = function (e, t) {
return A(e, t, [])
}, x.without = function (e) {
return x.difference(e, u.call(arguments, 1))
}, x.uniq = x.unique = function (e, t, n, r) {
x.isFunction(t) && (r = n, n = t, t = !1);
var i = n ? x.map(e, n, r) : e,
s = [],
o = [];
return T(i, function (n, r) {
(t ? r && o[o.length - 1] === n : x.contains(o, n)) || (o.push(n), s.push(e[r]))
}), s
}, x.union = function () {
return x.uniq(a.apply(r, arguments))
}, x.intersection = function (e) {
var t = u.call(arguments, 1);
return x.filter(x.uniq(e), function (e) {
return x.every(t, function (t) {
return x.indexOf(t, e) >= 0
})
})
}, x.difference = function (e) {
var t = a.apply(r, u.call(arguments, 1));
return x.filter(e, function (e) {
return !x.contains(t, e)
})
}, x.zip = function () {
for (var e = u.call(arguments), t = x.max(x.pluck(e, "length")), n = Array(t), r = 0; t > r; r++) n[r] = x.pluck(e, "" + r);
return n
}, x.object = function (e, t) {
if (null == e) return {};
for (var n = {}, r = 0, i = e.length; i > r; r++) t ? n[e[r]] = t[r] : n[e[r][0]] = e[r][1];
return n
}, x.indexOf = function (e, t, n) {
if (null == e) return -1;
var r = 0,
i = e.length;
if (n) {
if ("number" != typeof n) return r = x.sortedIndex(e, t), e[r] === t ? r : -1;
r = 0 > n ? Math.max(0, i + n) : n
}
if (y && e.indexOf === y) return e.indexOf(t, n);
for (; i > r; r++) if (e[r] === t) return r;
return -1
}, x.lastIndexOf = function (e, t, n) {
if (null == e) return -1;
var r = null != n;
if (b && e.lastIndexOf === b) return r ? e.lastIndexOf(t, n) : e.lastIndexOf(t);
for (var i = r ? n : e.length; i--;) if (e[i] === t) return i;
return -1
}, x.range = function (e, t, n) {
1 >= arguments.length && (t = e || 0, e = 0), n = arguments[2] || 1;
for (var r = Math.max(Math.ceil((t - e) / n), 0), i = 0, s = Array(r); r > i;) s[i++] = e, e += n;
return s
}, x.bind = function (e, t) {
if (e.bind === S && S) return S.apply(e, u.call(arguments, 1));
var n = u.call(arguments, 2);
return function () {
return e.apply(t, n.concat(u.call(arguments)))
}
}, x.partial = function (e) {
var t = u.call(arguments, 1);
return function () {
return e.apply(this, t.concat(u.call(arguments)))
}
}, x.bindAll = function (e) {
var t = u.call(arguments, 1);
return 0 === t.length && (t = x.functions(e)), T(t, function (t) {
e[t] = x.bind(e[t], e)
}), e
}, x.memoize = function (e, t) {
var n = {};
return t || (t = x.identity), function () {
var r = t.apply(this, arguments);
return x.has(n, r) ? n[r] : n[r] = e.apply(this, arguments)
}
}, x.delay = function (e, t) {
var n = u.call(arguments, 2);
return setTimeout(function () {
return e.apply(null, n)
}, t)
}, x.defer = function (e) {
return x.delay.apply(x, [e, 1].concat(u.call(arguments, 1)))
}, x.throttle = function (e, t) {
var n, r, i, s, o = 0,
u = function () {
o = new Date, i = null, s = e.apply(n, r)
};
return function () {
var a = new Date,
f = t - (a - o);
return n = this, r = arguments, 0 >= f ? (clearTimeout(i), i = null, o = a, s = e.apply(n, r)) : i || (i = setTimeout(u, f)), s
}
}, x.debounce = function (e, t, n) {
var r, i;
return function () {
var s = this,
o = arguments,
u = function () {
r = null, n || (i = e.apply(s, o))
},
a = n && !r;
return clearTimeout(r), r = setTimeout(u, t), a && (i = e.apply(s, o)), i
}
}, x.once = function (e) {
var t, n = !1;
return function () {
return n ? t : (n = !0, t = e.apply(this, arguments), e = null, t)
}
}, x.wrap = function (e, t) {
return function () {
var n = [e];
return o.apply(n, arguments), t.apply(this, n)
}
}, x.compose = function () {
var e = arguments;
return function () {
for (var t = arguments, n = e.length - 1; n >= 0; n--) t = [e[n].apply(this, t)];
return t[0]
}
}, x.after = function (e, t) {
return 0 >= e ? t() : function () {
return 1 > --e ? t.apply(this, arguments) : void 0
}
}, x.keys = E ||
function (e) {
if (e !== Object(e)) throw new TypeError("Invalid object");
var t = [];
for (var n in e) x.has(e, n) && (t[t.length] = n);
return t
}, x.values = function (e) {
var t = [];
for (var n in e) x.has(e, n) && t.push(e[n]);
return t
}, x.pairs = function (e) {
var t = [];
for (var n in e) x.has(e, n) && t.push([n, e[n]]);
return t
}, x.invert = function (e) {
var t = {};
for (var n in e) x.has(e, n) && (t[e[n]] = n);
return t
}, x.functions = x.methods = function (e) {
var t = [];
for (var n in e) x.isFunction(e[n]) && t.push(n);
return t.sort()
}, x.extend = function (e) {
return T(u.call(arguments, 1), function (t) {
if (t) for (var n in t) e[n] = t[n]
}), e
}, x.pick = function (e) {
var t = {},
n = a.apply(r, u.call(arguments, 1));
return T(n, function (n) {
n in e && (t[n] = e[n])
}), t
}, x.omit = function (e) {
var t = {},
n = a.apply(r, u.call(arguments, 1));
for (var i in e) x.contains(n, i) || (t[i] = e[i]);
return t
}, x.defaults = function (e) {
return T(u.call(arguments, 1), function (t) {
if (t) for (var n in t) null == e[n] && (e[n] = t[n])
}), e
}, x.clone = function (e) {
return x.isObject(e) ? x.isArray(e) ? e.slice() : x.extend({}, e) : e
}, x.tap = function (e, t) {
return t(e), e
};
var O = function (e, t, n, r) {
if (e === t) return 0 !== e || 1 / e == 1 / t;
if (null == e || null == t) return e === t;
e instanceof x && (e = e._wrapped), t instanceof x && (t = t._wrapped);
var i = f.call(e);
if (i != f.call(t)) return !1;
switch (i) {
case "[object String]":
return e == t + "";
case "[object Number]":
return e != +e ? t != +t : 0 == e ? 1 / e == 1 / t : e == +t;
case "[object Date]":
case "[object Boolean]":
return +e == +t;
case "[object RegExp]":
return e.source == t.source && e.global == t.global && e.multiline == t.multiline && e.ignoreCase == t.ignoreCase
}
if ("object" != typeof e || "object" != typeof t) return !1;
for (var s = n.length; s--;) if (n[s] == e) return r[s] == t;
n.push(e), r.push(t);
var o = 0,
u = !0;
if ("[object Array]" == i) {
if (o = e.length, u = o == t.length) for (; o-- && (u = O(e[o], t[o], n, r)););
} else {
var a = e.constructor,
l = t.constructor;
if (a !== l && !(x.isFunction(a) && a instanceof a && x.isFunction(l) && l instanceof l)) return !1;
for (var c in e) if (x.has(e, c) && (o++, !(u = x.has(t, c) && O(e[c], t[c], n, r)))) break;
if (u) {
for (c in t) if (x.has(t, c) && !(o--)) break;
u = !o
}
}
return n.pop(), r.pop(), u
};
x.isEqual = function (e, t) {
return O(e, t, [], [])
}, x.isEmpty = function (e) {
if (null == e) return !0;
if (x.isArray(e) || x.isString(e)) return 0 === e.length;
for (var t in e) if (x.has(e, t)) return !1;
return !0
}, x.isElement = function (e) {
return !!e && 1 === e.nodeType
}, x.isArray = w ||
function (e) {
return "[object Array]" == f.call(e)
}, x.isObject = function (e) {
return e === Object(e)
}, T(["Arguments", "Function", "String", "Number", "Date", "RegExp"], function (e) {
x["is" + e] = function (t) {
return f.call(t) == "[object " + e + "]"
}
}), x.isArguments(arguments) || (x.isArguments = function (e) {
return !!e && !! x.has(e, "callee")
}), "function" != typeof / . / && (x.isFunction = function (e) {
return "function" == typeof e
}), x.isFinite = function (e) {
return isFinite(e) && !isNaN(parseFloat(e))
}, x.isNaN = function (e) {
return x.isNumber(e) && e != +e
}, x.isBoolean = function (e) {
return e === !0 || e === !1 || "[object Boolean]" == f.call(e)
}, x.isNull = function (e) {
return null === e
}, x.isUndefined = function (e) {
return e === void 0
}, x.has = function (e, t) {
return l.call(e, t)
}, x.noConflict = function () {
return e._ = t, this
}, x.identity = function (e) {
return e
}, x.times = function (e, t, n) {
for (var r = Array(e), i = 0; e > i; i++) r[i] = t.call(n, i);
return r
}, x.random = function (e, t) {
return null == t && (t = e, e = 0), e + Math.floor(Math.random() * (t - e + 1))
};
var M = {
escape: {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"/": "&#x2F;"
}
};
M.unescape = x.invert(M.escape);
var _ = {
escape: RegExp("[" + x.keys(M.escape).join("") + "]", "g"),
unescape: RegExp("(" + x.keys(M.unescape).join("|") + ")", "g")
};
x.each(["escape", "unescape"], function (e) {
x[e] = function (t) {
return null == t ? "" : ("" + t).replace(_[e], function (t) {
return M[e][t]
})
}
}), x.result = function (e, t) {
if (null == e) return null;
var n = e[t];
return x.isFunction(n) ? n.call(e) : n
}, x.mixin = function (e) {
T(x.functions(e), function (t) {
var n = x[t] = e[t];
x.prototype[t] = function () {
var e = [this._wrapped];
return o.apply(e, arguments), j.call(this, n.apply(x, e))
}
})
};
var D = 0;
x.uniqueId = function (e) {
var t = ++D + "";
return e ? e + t : t
}, x.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
};
var P = /(.)^/,
H = {
"'": "'",
"\\": "\\",
"\r": "r",
"\n": "n",
" ": "t",
"\u2028": "u2028",
"\u2029": "u2029"
},
B = /\\|'|\r|\n|\t|\u2028|\u2029/g;
x.template = function (e, t, n) {
var r;
n = x.defaults({}, n, x.templateSettings);
var i = RegExp([(n.escape || P).source, (n.interpolate || P).source, (n.evaluate || P).source].join("|") + "|$", "g"),
s = 0,
o = "__p+='";
e.replace(i, function (t, n, r, i, u) {
return o += e.slice(s, u).replace(B, function (e) {
return "\\" + H[e]
}), n && (o += "'+\n((__t=(" + n + "))==null?'':_.escape(__t))+\n'"), r && (o += "'+\n((__t=(" + r + "))==null?'':__t)+\n'"), i && (o += "';\n" + i + "\n__p+='"), s = u + t.length, t
}), o += "';\n", n.variable || (o = "with(obj||{}){\n" + o + "}\n"), o = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + o + "return __p;\n";
try {
r = Function(n.variable || "obj", "_", o)
} catch (u) {
throw u.source = o, u
}
if (t) return r(t, x);
var a = function (e) {
return r.call(this, e, x)
};
return a.source = "function(" + (n.variable || "obj") + "){\n" + o + "}", a
}, x.chain = function (e) {
return x(e).chain()
};
var j = function (e) {
return this._chain ? x(e).chain() : e
};
x.mixin(x), T(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (e) {
var t = r[e];
x.prototype[e] = function () {
var n = this._wrapped;
return t.apply(n, arguments), "shift" != e && "splice" != e || 0 !== n.length || delete n[0], j.call(this, n)
}
}), T(["concat", "join", "slice"], function (e) {
var t = r[e];
x.prototype[e] = function () {
return j.call(this, t.apply(this._wrapped, arguments))
}
}), x.extend(x.prototype, {
chain: function () {
return this._chain = !0, this
},
value: function () {
return this._wrapped
}
})
}.call(this), typeof JSON != "object" && (JSON = {}), function () {
"use strict";
function f(e) {
return e < 10 ? "0" + e : e
}
function quote(e) {
return escapable.lastIndex = 0, escapable.test(e) ? '"' + e.replace(escapable, function (e) {
var t = meta[e];
return typeof t == "string" ? t : "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4)
}) + '"' : '"' + e + '"'
}
function str(e, t) {
var n, r, i, s, o = gap,
u, a = t[e];
a && typeof a == "object" && typeof a.toJSON == "function" && (a = a.toJSON(e)), typeof rep == "function" && (a = rep.call(t, e, a));
switch (typeof a) {
case "string":
return quote(a);
case "number":
return isFinite(a) ? String(a) : "null";
case "boolean":
case "null":
return String(a);
case "object":
if (!a) return "null";
gap += indent, u = [];
if (Object.prototype.toString.apply(a) === "[object Array]") {
s = a.length;
for (n = 0; n < s; n += 1) u[n] = str(n, a) || "null";
return i = u.length === 0 ? "[]" : gap ? "[\n" + gap + u.join(",\n" + gap) + "\n" + o + "]" : "[" + u.join(",") + "]", gap = o, i
}
if (rep && typeof rep == "object") {
s = rep.length;
for (n = 0; n < s; n += 1) typeof rep[n] == "string" && (r = rep[n], i = str(r, a), i && u.push(quote(r) + (gap ? ": " : ":") + i))
} else for (r in a) Object.prototype.hasOwnProperty.call(a, r) && (i = str(r, a), i && u.push(quote(r) + (gap ? ": " : ":") + i));
return i = u.length === 0 ? "{}" : gap ? "{\n" + gap + u.join(",\n" + gap) + "\n" + o + "}" : "{" + u.join(",") + "}", gap = o, i
}
}
typeof Date.prototype.toJSON != "function" && (Date.prototype.toJSON = function (e) {
return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null
}, String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (e) {
return this.valueOf()
});
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap, indent, meta = {
"\b": "\\b",
" ": "\\t",
"\n": "\\n",
"\f": "\\f",
"\r": "\\r",
'"': '\\"',
"\\": "\\\\"
},
rep;
typeof JSON.stringify != "function" && (JSON.stringify = function (e, t, n) {
var r;
gap = "", indent = "";
if (typeof n == "number") for (r = 0; r < n; r += 1) indent += " ";
else typeof n == "string" && (indent = n);
rep = t;
if (!t || typeof t == "function" || typeof t == "object" && typeof t.length == "number") return str("", {
"": e
});
throw new Error("JSON.stringify")
}), typeof JSON.parse != "function" && (JSON.parse = function (text, reviver) {
function walk(e, t) {
var n, r, i = e[t];
if (i && typeof i == "object") for (n in i) Object.prototype.hasOwnProperty.call(i, n) && (r = walk(i, n), r !== undefined ? i[n] = r : delete i[n]);
return reviver.call(e, t, i)
}
var j;
text = String(text), cx.lastIndex = 0, cx.test(text) && (text = text.replace(cx, function (e) {
return "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4)
}));
if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return j = eval("(" + text + ")"), typeof reviver == "function" ? walk({
"": j
}, "") : j;
throw new SyntaxError("JSON.parse")
})
}(), function () {
var e = this,
t = e.Backbone,
n = Array.prototype.slice,
r = Array.prototype.splice,
i;
typeof exports != "undefined" ? i = exports : i = e.Backbone = {}, i.VERSION = "0.9.2";
var s = e._;
!s && typeof require != "undefined" && (s = require("underscore"));
var o = e.jQuery || e.Zepto || e.ender;
i.setDomLibrary = function (e) {
o = e
}, i.noConflict = function () {
return e.Backbone = t, this
}, i.emulateHTTP = !1, i.emulateJSON = !1;
var u = /\s+/,
a = i.Events = {
on: function (e, t, n) {
var r, i, s, o, a;
if (!t) return this;
e = e.split(u), r = this._callbacks || (this._callbacks = {});
while (i = e.shift()) a = r[i], s = a ? a.tail : {}, s.next = o = {}, s.context = n, s.callback = t, r[i] = {
tail: o,
next: a ? a.next : s
};
return this
},
off: function (e, t, n) {
var r, i, o, a, f, l;
if (!(i = this._callbacks)) return;
if (!(e || t || n)) return delete this._callbacks, this;
e = e ? e.split(u) : s.keys(i);
while (r = e.shift()) {
o = i[r], delete i[r];
if (!o || !t && !n) continue;
a = o.tail;
while ((o = o.next) !== a) f = o.callback, l = o.context, (t && f !== t || n && l !== n) && this.on(r, f, l)
}
return this
},
trigger: function (e) {
var t, r, i, s, o, a, f;
if (!(i = this._callbacks)) return this;
a = i.all, e = e.split(u), f = n.call(arguments, 1);
while (t = e.shift()) {
if (r = i[t]) {
s = r.tail;
while ((r = r.next) !== s) r.callback.apply(r.context || this, f)
}
if (r = a) {
s = r.tail, o = [t].concat(f);
while ((r = r.next) !== s) r.callback.apply(r.context || this, o)
}
}
return this
}
};
a.bind = a.on, a.unbind = a.off;
var f = i.Model = function (e, t) {
var n;
e || (e = {}), t && t.parse && (e = this.parse(e));
if (n = C(this, "defaults")) e = s.extend({}, n, e);
t && t.collection && (this.collection = t.collection), this.attributes = {}, this._escapedAttributes = {}, this.cid = s.uniqueId("c"), this.changed = {}, this._silent = {}, this._pending = {}, this.set(e, {
silent: !0
}), this.changed = {}, this._silent = {}, this._pending = {}, this._previousAttributes = s.clone(this.attributes), this.initialize.apply(this, arguments)
};
s.extend(f.prototype, a, {
changed: null,
_silent: null,
_pending: null,
idAttribute: "id",
initialize: function () {},
toJSON: function (e) {
return s.clone(this.attributes)
},
get: function (e) {
return this.attributes[e]
},
escape: function (e) {
var t;
if (t = this._escapedAttributes[e]) return t;
var n = this.get(e);
return this._escapedAttributes[e] = s.escape(n == null ? "" : "" + n)
},
has: function (e) {
return this.get(e) != null
},
set: function (e, t, n) {
var r, i, o;
s.isObject(e) || e == null ? (r = e, n = t) : (r = {}, r[e] = t), n || (n = {});
if (!r) return this;
r instanceof f && (r = r.attributes);
if (n.unset) for (i in r) r[i] = void 0;
if (!this._validate(r, n)) return !1;
this.idAttribute in r && (this.id = r[this.idAttribute]);
var u = n.changes = {},
a = this.attributes,
l = this._escapedAttributes,
c = this._previousAttributes || {};
for (i in r) {
o = r[i];
if (!s.isEqual(a[i], o) || n.unset && s.has(a, i)) delete l[i], (n.silent ? this._silent : u)[i] = !0;
n.unset ? delete a[i] : a[i] = o, !s.isEqual(c[i], o) || s.has(a, i) != s.has(c, i) ? (this.changed[i] = o, n.silent || (this._pending[i] = !0)) : (delete this.changed[i], delete this._pending[i])
}
return n.silent || this.change(n), this
},
unset: function (e, t) {
return (t || (t = {})).unset = !0, this.set(e, null, t)
},
clear: function (e) {
return (e || (e = {})).unset = !0, this.set(s.clone(this.attributes), e)
},
fetch: function (e) {
e = e ? s.clone(e) : {};
var t = this,
n = e.success;
return e.success = function (r, i, s) {
if (!t.set(t.parse(r, s), e)) return !1;
n && n(t, r)
}, e.error = i.wrapError(e.error, t, e), (this.sync || i.sync).call(this, "read", this, e)
},
save: function (e, t, n) {
var r, o;
s.isObject(e) || e == null ? (r = e, n = t) : (r = {}, r[e] = t), n = n ? s.clone(n) : {};
if (n.wait) {
if (!this._validate(r, n)) return !1;
o = s.clone(this.attributes)
}
var u = s.extend({}, n, {
silent: !0
});
if (r && !this.set(r, n.wait ? u : n)) return !1;
var a = this,
f = n.success;
n.success = function (e, t, i) {
var o = a.parse(e, i);
n.wait && (delete n.wait, o = s.extend(r || {}, o));
if (!a.set(o, n)) return !1;
f ? f(a, e) : a.trigger("sync", a, e, n)
}, n.error = i.wrapError(n.error, a, n);
var l = this.isNew() ? "create" : "update",
c = (this.sync || i.sync).call(this, l, this, n);
return n.wait && this.set(o, u), c
},
destroy: function (e) {
e = e ? s.clone(e) : {};
var t = this,
n = e.success,
r = function () {
t.trigger("destroy", t, t.collection, e)
};
if (this.isNew()) return r(), !1;
e.success = function (i) {
e.wait && r(), n ? n(t, i) : t.trigger("sync", t, i, e)
}, e.error = i.wrapError(e.error, t, e);
var o = (this.sync || i.sync).call(this, "delete", this, e);
return e.wait || r(), o
},
url: function () {
var e = C(this, "urlRoot") || C(this.collection, "url") || k();
return this.isNew() ? e : e + (e.charAt(e.length - 1) == "/" ? "" : "/") + encodeURIComponent(this.id)
},
parse: function (e, t) {
return e
},
clone: function () {
return new this.constructor(this.attributes)
},
isNew: function () {
return this.id == null
},
change: function (e) {
e || (e = {});
var t = this._changing;
this._changing = !0;
for (var n in this._silent) this._pending[n] = !0;
var r = s.extend({}, e.changes, this._silent);
this._silent = {};
for (var n in r) this.trigger("change:" + n, this, this.get(n), e);
if (t) return this;
while (!s.isEmpty(this._pending)) {
this._pending = {}, this.trigger("change", this, e);
for (var n in this.changed) {
if (this._pending[n] || this._silent[n]) continue;
delete this.changed[n]
}
this._previousAttributes = s.clone(this.attributes)
}
return this._changing = !1, this
},
hasChanged: function (e) {
return arguments.length ? s.has(this.changed, e) : !s.isEmpty(this.changed)
},
changedAttributes: function (e) {
if (!e) return this.hasChanged() ? s.clone(this.changed) : !1;
var t, n = !1,
r = this._previousAttributes;
for (var i in e) {
if (s.isEqual(r[i], t = e[i])) continue;
(n || (n = {}))[i] = t
}
return n
},
previous: function (e) {
return !arguments.length || !this._previousAttributes ? null : this._previousAttributes[e]
},
previousAttributes: function () {
return s.clone(this._previousAttributes)
},
isValid: function () {
return !this.validate(this.attributes)
},
_validate: function (e, t) {
if (t.silent || !this.validate) return !0;
e = s.extend({}, this.attributes, e);
var n = this.validate(e, t);
return n ? (t && t.error ? t.error(this, n, t) : this.trigger("error", this, n, t), !1) : !0
}
});
var l = i.Collection = function (e, t) {
t || (t = {}), t.model && (this.model = t.model), t.comparator && (this.comparator = t.comparator), this._reset(), this.initialize.apply(this, arguments), e && this.reset(e, {
silent: !0,
parse: t.parse
})
};
s.extend(l.prototype, a, {
model: f,
initialize: function () {},
toJSON: function (e) {
return this.map(function (t) {
return t.toJSON(e)
})
},
add: function (e, t) {
var n, i, o, u, a, f, l = {},
c = {},
h = [];
t || (t = {}), e = s.isArray(e) ? e.slice() : [e];
for (n = 0, o = e.length; n < o; n++) {
if (!(u = e[n] = this._prepareModel(e[n], t))) throw new Error("Can't add an invalid model to a collection");
a = u.cid, f = u.id;
if (l[a] || this._byCid[a] || f != null && (c[f] || this._byId[f])) {
h.push(n);
continue
}
l[a] = c[f] = u
}
n = h.length;
while (n--) e.splice(h[n], 1);
for (n = 0, o = e.length; n < o; n++)(u = e[n]).on("all", this._onModelEvent, this), this._byCid[u.cid] = u, u.id != null && (this._byId[u.id] = u);
this.length += o, i = t.at != null ? t.at : this.models.length, r.apply(this.models, [i, 0].concat(e)), this.comparator && this.sort({
silent: !0
});
if (t.silent) return this;
for (n = 0, o = this.models.length; n < o; n++) {
if (!l[(u = this.models[n]).cid]) continue;
t.index = n, u.trigger("add", u, this, t)
}
return this
},
remove: function (e, t) {
var n, r, i, o;
t || (t = {}), e = s.isArray(e) ? e.slice() : [e];
for (n = 0, r = e.length; n < r; n++) {
o = this.getByCid(e[n]) || this.get(e[n]);
if (!o) continue;
delete this._byId[o.id], delete this._byCid[o.cid], i = this.indexOf(o), this.models.splice(i, 1), this.length--, t.silent || (t.index = i, o.trigger("remove", o, this, t)), this._removeReference(o)
}
return this
},
push: function (e, t) {
return e = this._prepareModel(e, t), this.add(e, t), e
},
pop: function (e) {
var t = this.at(this.length - 1);
return this.remove(t, e), t
},
unshift: function (e, t) {
return e = this._prepareModel(e, t), this.add(e, s.extend({
at: 0
}, t)), e
},
shift: function (e) {
var t = this.at(0);
return this.remove(t, e), t
},
get: function (e) {
return e == null ? void 0 : this._byId[e.id != null ? e.id : e]
},
getByCid: function (e) {
return e && this._byCid[e.cid || e]
},
at: function (e) {
return this.models[e]
},
where: function (e) {
return s.isEmpty(e) ? [] : this.filter(function (t) {
for (var n in e) if (e[n] !== t.get(n)) return !1;
return !0
})
},
sort: function (e) {
e || (e = {});
if (!this.comparator) throw new Error("Cannot sort a set without a comparator");
var t = s.bind(this.comparator, this);
return this.comparator.length == 1 ? this.models = this.sortBy(t) : this.models.sort(t), e.silent || this.trigger("reset", this, e), this
},
pluck: function (e) {
return s.map(this.models, function (t) {
return t.get(e)
})
},
reset: function (e, t) {
e || (e = []), t || (t = {});
for (var n = 0, r = this.models.length; n < r; n++) this._removeReference(this.models[n]);
return this._reset(), this.add(e, s.extend({
silent: !0
}, t)), t.silent || this.trigger("reset", this, t), this
},
fetch: function (e) {
e = e ? s.clone(e) : {}, e.parse === undefined && (e.parse = !0);
var t = this,
n = e.success;
return e.success = function (r, i, s) {
t[e.add ? "add" : "reset"](t.parse(r, s), e), n && n(t, r)
}, e.error = i.wrapError(e.error, t, e), (this.sync || i.sync).call(this, "read", this, e)
},
create: function (e, t) {
var n = this;
t = t ? s.clone(t) : {}, e = this._prepareModel(e, t);
if (!e) return !1;
t.wait || n.add(e, t);
var r = t.success;
return t.success = function (i, s, o) {
t.wait && n.add(i, t), r ? r(i, s) : i.trigger("sync", e, s, t)
}, e.save(null, t), e
},
parse: function (e, t) {
return e
},
chain: function () {
return s(this.models).chain()
},
_reset: function (e) {
this.length = 0, this.models = [], this._byId = {}, this._byCid = {}
},
_prepareModel: function (e, t) {
t || (t = {});
if (e instanceof f) e.collection || (e.collection = this);
else {
var n = e;
t.collection = this, e = new this.model(n, t), e._validate(e.attributes, t) || (e = !1)
}
return e
},
_removeReference: function (e) {
this == e.collection && delete e.collection, e.off("all", this._onModelEvent, this)
},
_onModelEvent: function (e, t, n, r) {
if ((e == "add" || e == "remove") && n != this) return;
e == "destroy" && this.remove(t, r), t && e === "change:" + t.idAttribute && (delete this._byId[t.previous(t.idAttribute)], this._byId[t.id] = t), this.trigger.apply(this, arguments)
}
});
var c = ["forEach", "each", "map", "reduce", "reduceRight", "find", "detect", "filter", "select", "reject", "every", "all", "some", "any", "include", "contains", "invoke", "max", "min", "sortBy", "sortedIndex", "toArray", "size", "first", "initial", "rest", "last", "without", "indexOf", "shuffle", "lastIndexOf", "isEmpty", "groupBy"];
s.each(c, function (e) {
l.prototype[e] = function () {
return s[e].apply(s, [this.models].concat(s.toArray(arguments)))
}
});
var h = i.Router = function (e) {
e || (e = {}), e.routes && (this.routes = e.routes), this._bindRoutes(), this.initialize.apply(this, arguments)
},
p = /:\w+/g,
d = /\*\w+/g,
v = /[-[\]{}()+?.,\\^$|#\s]/g;
s.extend(h.prototype, a, {
initialize: function () {},
route: function (e, t, n) {
return i.history || (i.history = new m), s.isRegExp(e) || (e = this._routeToRegExp(e)), n || (n = this[t]), i.history.route(e, s.bind(function (r) {
var s = this._extractParameters(e, r);
n && n.apply(this, s), this.trigger.apply(this, ["route:" + t].concat(s)), i.history.trigger("route", this, t, s)
}, this)), this
},
navigate: function (e, t) {
i.history.navigate(e, t)
},
_bindRoutes: function () {
if (!this.routes) return;
var e = [];
for (var t in this.routes) e.unshift([t, this.routes[t]]);
for (var n = 0, r = e.length; n < r; n++) this.route(e[n][0], e[n][1], this[e[n][1]])
},
_routeToRegExp: function (e) {
return e = e.replace(v, "\\$&").replace(p, "([^/]+)").replace(d, "(.*?)"), new RegExp("^" + e + "$")
},
_extractParameters: function (e, t) {
return e.exec(t).slice(1)
}
});
var m = i.History = function () {
this.handlers = [], s.bindAll(this, "checkUrl")
},
g = /^[#\/]/,
y = /msie [\w.]+/;
m.started = !1, s.extend(m.prototype, a, {
interval: 50,
getHash: function (e) {
var t = e ? e.location : window.location,
n = t.href.match(/#(.*)$/);
return n ? n[1] : ""
},
getFragment: function (e, t) {
if (e == null) if (this._hasPushState || t) {
e = window.location.pathname;
var n = window.location.search;
n && (e += n)
} else e = this.getHash();
return e.indexOf(this.options.root) || (e = e.substr(this.options.root.length)), e.replace(g, "")
},
start: function (e) {
if (m.started) throw new Error("Backbone.history has already been started");
m.started = !0, this.options = s.extend({}, {
root: "/"
}, this.options, e), this._wantsHashChange = this.options.hashChange !== !1, this._wantsPushState = !! this.options.pushState, this._hasPushState = !! (this.options.pushState && window.history && window.history.pushState);
var t = this.getFragment(),
n = document.documentMode,
r = y.exec(navigator.userAgent.toLowerCase()) && (!n || n <= 7);
r && (this.iframe = o('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow, this.navigate(t)), this._hasPushState ? o(window).bind("popstate", this.checkUrl) : this._wantsHashChange && "onhashchange" in window && !r ? o(window).bind("hashchange", this.checkUrl) : this._wantsHashChange && (this._checkUrlInterval = setInterval(this.checkUrl, this.interval)), this.fragment = t;
var i = window.location,
u = i.pathname == this.options.root;
if (this._wantsHashChange && this._wantsPushState && !this._hasPushState && !u) return this.fragment = this.getFragment(null, !0), window.location.replace(this.options.root + "#" + this.fragment), !0;
this._wantsPushState && this._hasPushState && u && i.hash && (this.fragment = this.getHash().replace(g, ""), window.history.replaceState({}, document.title, i.protocol + "//" + i.host + this.options.root + this.fragment));
if (!this.options.silent) return this.loadUrl()
},
stop: function () {
o(window).unbind("popstate", this.checkUrl).unbind("hashchange", this.checkUrl), clearInterval(this._checkUrlInterval), m.started = !1
},
route: function (e, t) {
this.handlers.unshift({
route: e,
callback: t
})
},
checkUrl: function (e) {
var t = this.getFragment();
t == this.fragment && this.iframe && (t = this.getFragment(this.getHash(this.iframe)));
if (t == this.fragment) return !1;
this.iframe && this.navigate(t), this.loadUrl() || this.loadUrl(this.getHash())
},
loadUrl: function (e) {
var t = this.fragment = this.getFragment(e),
n = s.any(this.handlers, function (e) {
if (e.route.test(t)) return e.callback(t), !0
});
return n
},
navigate: function (e, t) {
if (!m.started) return !1;
if (!t || t === !0) t = {
trigger: t
};
var n = (e || "").replace(g, "");
if (this.fragment == n) return;
this._hasPushState ? (n.indexOf(this.options.root) != 0 && (n = this.options.root + n), this.fragment = n, window.history[t.replace ? "replaceState" : "pushState"]({}, document.title, n)) : this._wantsHashChange ? (this.fragment = n, this._updateHash(window.location, n, t.replace), this.iframe && n != this.getFragment(this.getHash(this.iframe)) && (t.replace || this.iframe.document.open().close(), this._updateHash(this.iframe.location, n, t.replace))) : window.location.assign(this.options.root + e), t.trigger && this.loadUrl(e)
},
_updateHash: function (e, t, n) {
n ? e.replace(e.toString().replace(/(javascript:|#).*$/, "") + "#" + t) : e.hash = t
}
});
var b = i.View = function (e) {
this.cid = s.uniqueId("view"), this._configure(e || {}), this._ensureElement(), this.initialize.apply(this, arguments), this.delegateEvents()
},
w = /^(\S+)\s*(.*)$/,
E = ["model", "collection", "el", "id", "attributes", "className", "tagName"];
s.extend(b.prototype, a, {
tagName: "div",
$: function (e) {
return this.$el.find(e)
},
initialize: function () {},
render: function () {
return this
},
remove: function () {
return this.$el.remove(), this
},
make: function (e, t, n) {
var r = document.createElement(e);
return t && o(r).attr(t), n && o(r).html(n), r
},
setElement: function (e, t) {
return this.$el && this.undelegateEvents(), this.$el = e instanceof o ? e : o(e), this.el = this.$el[0], t !== !1 && this.delegateEvents(), this
},
delegateEvents: function (e) {
if (!e && !(e = C(this, "events"))) return;
this.undelegateEvents();
for (var t in e) {
var n = e[t];
s.isFunction(n) || (n = this[e[t]]);
if (!n) throw new Error('Method "' + e[t] + '" does not exist');
var r = t.match(w),
i = r[1],
o = r[2];
n = s.bind(n, this), i += ".delegateEvents" + this.cid, o === "" ? this.$el.bind(i, n) : this.$el.delegate(o, i, n)
}
},
undelegateEvents: function () {
this.$el.unbind(".delegateEvents" + this.cid)
},
_configure: function (e) {
this.options && (e = s.extend({}, this.options, e));
for (var t = 0, n = E.length; t < n; t++) {
var r = E[t];
e[r] && (this[r] = e[r])
}
this.options = e
},
_ensureElement: function () {
if (!this.el) {
var e = C(this, "attributes") || {};
this.id && (e.id = this.id), this.className && (e["class"] = this.className), this.setElement(this.make(this.tagName, e), !1)
} else this.setElement(this.el, !1)
}
});
var S = function (e, t) {
var n = N(this, e, t);
return n.extend = this.extend, n
};
f.extend = l.extend = h.extend = b.extend = S;
var x = {
create: "POST",
update: "PUT",
"delete": "DELETE",
read: "GET"
};
i.sync = function (e, t, n) {
var r = x[e];
n || (n = {});
var u = {
type: r,
dataType: "json"
};
return n.url || (u.url = C(t, "url") || k()), !n.data && t && (e == "create" || e == "update") && (u.contentType = "application/json", u.data = JSON.stringify(t.toJSON())), i.emulateJSON && (u.contentType = "application/x-www-form-urlencoded", u.data = u.data ? {
model: u.data
} : {}), i.emulateHTTP && (r === "PUT" || r === "DELETE") && (i.emulateJSON && (u.data._method = r), u.type = "POST", u.beforeSend = function (e) {
e.setRequestHeader("X-HTTP-Method-Override", r)
}), u.type !== "GET" && !i.emulateJSON && (u.processData = !1), o.ajax(s.extend(u, n))
}, i.wrapError = function (e, t, n) {
return function (r, i) {
i = r === t ? i : r, e ? e(t, i, n) : t.trigger("error", t, i, n)
}
};
var T = function () {},
N = function (e, t, n) {
var r;
return t && t.hasOwnProperty("constructor") ? r = t.constructor : r = function () {
e.apply(this, arguments)
}, s.extend(r, e), T.prototype = e.prototype, r.prototype = new T, t && s.extend(r.prototype, t), n && s.extend(r, n), r.prototype.constructor = r, r.__super__ = e.prototype, r
},
C = function (e, t) {
return !e || !e[t] ? null : s.isFunction(e[t]) ? e[t]() : e[t]
},
k = function () {
throw new Error('A "url" property or function must be specified')
}
}.call(this), function (e, t, n) {
var r, i;
typeof exports != n + "" ? r = exports : (i = e.L, r = {}, r.noConflict = function () {
return e.L = i, this
}, e.L = r), r.version = "0.5.1", r.Util = {
extend: function (e) {
var t = Array.prototype.slice.call(arguments, 1),
n, r, i, s;
for (r = 0, i = t.length; r < i; r++) {
s = t[r] || {};
for (n in s) s.hasOwnProperty(n) && (e[n] = s[n])
}
return e
},
bind: function (e, t) {
var n = arguments.length > 2 ? Array.prototype.slice.call(arguments, 2) : null;
return function () {
return e.apply(t, n || arguments)
}
},
stamp: function () {
var e = 0,
t = "_leaflet_id";
return function (n) {
return n[t] = n[t] || ++e, n[t]
}
}(),
limitExecByInterval: function (e, t, n) {
var r, i;
return function s() {
var o = arguments;
if (r) {
i = !0;
return
}
r = !0, setTimeout(function () {
r = !1, i && (s.apply(n, o), i = !1)
}, t), e.apply(n, o)
}
},
falseFn: function () {
return !1
},
formatNum: function (e, t) {
var n = Math.pow(10, t || 5);
return Math.round(e * n) / n
},
splitWords: function (e) {
return e.replace(/^\s+|\s+$/g, "").split(/\s+/)
},
setOptions: function (e, t) {
return e.options = r.extend({}, e.options, t), e.options
},
getParamString: function (e, t) {
var n = [];
for (var r in e) e.hasOwnProperty(r) && n.push(r + "=" + e[r]);
return (!t || t.indexOf("?") === -1 ? "?" : "&") + n.join("&")
},
template: function (e, t) {
return e.replace(/\{ *([\w_]+) *\}/g, function (e, n) {
var r = t[n];
if (!t.hasOwnProperty(n)) throw new Error("No value provided for variable " + e);
return r
})
},
isArray: function (e) {
return Object.prototype.toString.call(e) === "[object Array]"
},
emptyImageUrl: "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
}, function () {
function t(t) {
var n, r, i = ["webkit", "moz", "o", "ms"];
for (n = 0; n < i.length && !r; n++) r = e[i[n] + t];
return r
}
function i(t) {
var r = +(new Date),
i = Math.max(0, 16 - (r - n));
return n = r + i, e.setTimeout(t, i)
}
var n = 0,
s = e.requestAnimationFrame || t("RequestAnimationFrame") || i,
o = e.cancelAnimationFrame || t("CancelAnimationFrame") || t("CancelRequestAnimationFrame") ||
function (t) {
e.clearTimeout(t)
};
r.Util.requestAnimFrame = function (t, n, o, u) {
t = r.bind(t, n);
if (!o || s !== i) return s.call(e, t, u);
t()
}, r.Util.cancelAnimFrame = function (t) {
t && o.call(e, t)
}
}(), r.extend = r.Util.extend, r.bind = r.Util.bind, r.stamp = r.Util.stamp, r.setOptions = r.Util.setOptions, r.Class = function () {}, r.Class.extend = function (e) {
var t = function () {
this.initialize && this.initialize.apply(this, arguments), this._initHooks && this.callInitHooks()
},
n = function () {};
n.prototype = this.prototype;
var i = new n;
i.constructor = t, t.prototype = i;
for (var s in this) this.hasOwnProperty(s) && s !== "prototype" && (t[s] = this[s]);
e.statics && (r.extend(t, e.statics), delete e.statics), e.includes && (r.Util.extend.apply(null, [i].concat(e.includes)), delete e.includes), e.options && i.options && (e.options = r.extend({}, i.options, e.options)), r.extend(i, e), i._initHooks = [];
var o = this;
return i.callInitHooks = function () {
if (this._initHooksCalled) return;
o.prototype.callInitHooks && o.prototype.callInitHooks.call(this), this._initHooksCalled = !0;
for (var e = 0, t = i._initHooks.length; e < t; e++) i._initHooks[e].call(this)
}, t
}, r.Class.include = function (e) {
r.extend(this.prototype, e)
}, r.Class.mergeOptions = function (e) {
r.extend(this.prototype.options, e)
}, r.Class.addInitHook = function (e) {
var t = Array.prototype.slice.call(arguments, 1),
n = typeof e == "function" ? e : function () {
this[e].apply(this, t)
};
this.prototype._initHooks = this.prototype._initHooks || [], this.prototype._initHooks.push(n)
};
var s = "_leaflet_events";
r.Mixin = {}, r.Mixin.Events = {
addEventListener: function (e, t, n) {
var i = this[s] = this[s] || {},
o, u, a;
if (typeof e == "object") {
for (o in e) e.hasOwnProperty(o) && this.addEventListener(o, e[o], t);
return this
}
e = r.Util.splitWords(e);
for (u = 0, a = e.length; u < a; u++) i[e[u]] = i[e[u]] || [], i[e[u]].push({
action: t,
context: n || this
});
return this
},
hasEventListeners: function (e) {
return s in this && e in this[s] && this[s][e].length > 0
},
removeEventListener: function (e, t, n) {
var i = this[s],
o, u, a, f, l;
if (typeof e == "object") {
for (o in e) e.hasOwnProperty(o) && this.removeEventListener(o, e[o], t);
return this
}
e = r.Util.splitWords(e);
for (u = 0, a = e.length; u < a; u++) if (this.hasEventListeners(e[u])) {
f = i[e[u]];
for (l = f.length - 1; l >= 0; l--)(!t || f[l].action === t) && (!n || f[l].context === n) && f.splice(l, 1)
}
return this
},
fireEvent: function (e, t) {
if (!this.hasEventListeners(e)) return this;
var n = r.extend({
type: e,
target: this
}, t),
i = this[s][e].slice();
for (var o = 0, u = i.length; o < u; o++) i[o].action.call(i[o].context || this, n);
return this
}
}, r.Mixin.Events.on = r.Mixin.Events.addEventListener, r.Mixin.Events.off = r.Mixin.Events.removeEventListener, r.Mixin.Events.fire = r.Mixin.Events.fireEvent, function () {
var i = !! e.ActiveXObject,
s = i && !e.XMLHttpRequest,
o = navigator.userAgent.toLowerCase(),
u = o.indexOf("webkit") !== -1,
a = o.indexOf("chrome") !== -1,
f = o.indexOf("android") !== -1,
l = o.search("android [23]") !== -1,
c = i && !t.querySelector && o.search("msie 7") !== -1,
h = i && o.search("msie 8") !== -1,
p = typeof orientation != n + "",
d = e.navigator && e.navigator.msPointerEnabled && e.navigator.msMaxTouchPoints,
v = "devicePixelRatio" in e && e.devicePixelRatio > 1 || "matchMedia" in e && e.matchMedia("(min-resolution:144dpi)") && e.matchMedia("(min-resolution:144dpi)").matches,
m = t.documentElement,
g = i && "transition" in m.style,
y = "WebKitCSSMatrix" in e && "m11" in new e.WebKitCSSMatrix,
b = "MozPerspective" in m.style,
w = "OTransition" in m.style,
E = !e.L_DISABLE_3D && (g || y || b || w),
S = !e.L_NO_TOUCH &&
function () {
var e = "ontouchstart";
if (d || e in m) return !0;
var n = t.createElement("div"),
r = !1;
return n.setAttribute ? (n.setAttribute(e, "return;"), typeof n[e] == "function" && (r = !0), n.removeAttribute(e), n = null, r) : !1
}();
r.Browser = {
ie: i,
ie6: s,
ie7: c,
ie8: h,
webkit: u,
android: f,
android23: l,
chrome: a,
ie3d: g,
webkit3d: y,
gecko3d: b,
opera3d: w,
any3d: E,
mobile: p,
mobileWebkit: p && u,
mobileWebkit3d: p && y,
mobileOpera: p && e.opera,
touch: S,
msTouch: d,
retina: v
}
}(), r.Point = function (e, t, n) {
this.x = n ? Math.round(e) : e, this.y = n ? Math.round(t) : t
}, r.Point.prototype = {
clone: function () {
return new r.Point(this.x, this.y)
},
add: function (e) {
return this.clone()._add(r.point(e))
},
_add: function (e) {
return this.x += e.x, this.y += e.y, this
},
subtract: function (e) {
return this.clone()._subtract(r.point(e))
},
_subtract: function (e) {
return this.x -= e.x, this.y -= e.y, this
},
divideBy: function (e) {
return this.clone()._divideBy(e)
},
_divideBy: function (e) {
return this.x /= e, this.y /= e, this
},
multiplyBy: function (e) {
return this.clone()._multiplyBy(e)
},
_multiplyBy: function (e) {
return this.x *= e, this.y *= e, this
},
round: function () {
return this.clone()._round()
},
_round: function () {
return this.x = Math.round(this.x), this.y = Math.round(this.y), this
},
floor: function () {
return this.clone()._floor()
},
_floor: function () {
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this
},
distanceTo: function (e) {
e = r.point(e);
var t = e.x - this.x,
n = e.y - this.y;
return Math.sqrt(t * t + n * n)
},
equals: function (e) {
return e.x === this.x && e.y === this.y
},
toString: function () {
return "Point(" + r.Util.formatNum(this.x) + ", " + r.Util.formatNum(this.y) + ")"
}
}, r.point = function (e, t, n) {
return e instanceof r.Point ? e : r.Util.isArray(e) ? new r.Point(e[0], e[1]) : isNaN(e) ? e : new r.Point(e, t, n)
}, r.Bounds = function (e, t) {
if (!e) return;
var n = t ? [e, t] : e;
for (var r = 0, i = n.length; r < i; r++) this.extend(n[r])
}, r.Bounds.prototype = {
extend: function (e) {
return e = r.point(e), !this.min && !this.max ? (this.min = e.clone(), this.max = e.clone()) : (this.min.x = Math.min(e.x, this.min.x), this.max.x = Math.max(e.x, this.max.x), this.min.y = Math.min(e.y, this.min.y), this.max.y = Math.max(e.y, this.max.y)), this
},
getCenter: function (e) {
return new r.Point((this.min.x + this.max.x) / 2, (this.min.y + this.max.y) / 2, e)
},
getBottomLeft: function () {
return new r.Point(this.min.x, this.max.y)
},
getTopRight: function () {
return new r.Point(this.max.x, this.min.y)
},
getSize: function () {
return this.max.subtract(this.min)
},
contains: function (e) {
var t, n;
return typeof e[0] == "number" || e instanceof r.Point ? e = r.point(e) : e = r.bounds(e), e instanceof r.Bounds ? (t = e.min, n = e.max) : t = n = e, t.x >= this.min.x && n.x <= this.max.x && t.y >= this.min.y && n.y <= this.max.y
},
intersects: function (e) {
e = r.bounds(e);
var t = this.min,
n = this.max,
i = e.min,
s = e.max,
o = s.x >= t.x && i.x <= n.x,
u = s.y >= t.y && i.y <= n.y;
return o && u
},
isValid: function () {
return !!this.min && !! this.max
}
}, r.bounds = function (e, t) {
return !e || e instanceof r.Bounds ? e : new r.Bounds(e, t)
}, r.Transformation = function (e, t, n, r) {
this._a = e, this._b = t, this._c = n, this._d = r
}, r.Transformation.prototype = {
transform: function (e, t) {
return this._transform(e.clone(), t)
},
_transform: function (e, t) {
return t = t || 1, e.x = t * (this._a * e.x + this._b), e.y = t * (this._c * e.y + this._d), e
},
untransform: function (e, t) {
return t = t || 1, new r.Point((e.x / t - this._b) / this._a, (e.y / t - this._d) / this._c)
}
}, r.DomUtil = {
get: function (e) {
return typeof e == "string" ? t.getElementById(e) : e
},
getStyle: function (e, n) {
var r = e.style[n];
!r && e.currentStyle && (r = e.currentStyle[n]);
if ((!r || r === "auto") && t.defaultView) {
var i = t.defaultView.getComputedStyle(e, null);
r = i ? i[n] : null
}
return r === "auto" ? null : r
},
getViewportOffset: function (e) {
var n = 0,
i = 0,
s = e,
o = t.body,
u, a = r.Browser.ie7;
do {
n += s.offsetTop || 0, i += s.offsetLeft || 0, n += parseInt(r.DomUtil.getStyle(s, "borderTopWidth"), 10) || 0, i += parseInt(r.DomUtil.getStyle(s, "borderLeftWidth"), 10) || 0, u = r.DomUtil.getStyle(s, "position");
if (s.offsetParent === o && u === "absolute") break;
if (u === "fixed") {
n += o.scrollTop || 0, i += o.scrollLeft || 0;
break
}
s = s.offsetParent
} while (s);
s = e;
do {
if (s === o) break;
n -= s.scrollTop || 0, i -= s.scrollLeft || 0, !r.DomUtil.documentIsLtr() && (r.Browser.webkit || a) && (i += s.scrollWidth - s.clientWidth, a && r.DomUtil.getStyle(s, "overflow-y") !== "hidden" && r.DomUtil.getStyle(s, "overflow") !== "hidden" && (i += 17)), s = s.parentNode
} while (s);
return new r.Point(i, n)
},
documentIsLtr: function () {
return r.DomUtil._docIsLtrCached || (r.DomUtil._docIsLtrCached = !0, r.DomUtil._docIsLtr = r.DomUtil.getStyle(t.body, "direction") === "ltr"), r.DomUtil._docIsLtr
},
create: function (e, n, r) {
var i = t.createElement(e);
return i.className = n, r && r.appendChild(i), i
},
disableTextSelection: function () {
t.selection && t.selection.empty && t.selection.empty(), this._onselectstart || (this._onselectstart = t.onselectstart || null, t.onselectstart = r.Util.falseFn)
},
enableTextSelection: function () {
t.onselectstart === r.Util.falseFn && (t.onselectstart = this._onselectstart, this._onselectstart = null)
},
hasClass: function (e, t) {
return e.className.length > 0 && (new RegExp("(^|\\s)" + t + "(\\s|$)")).test(e.className)
},
addClass: function (e, t) {
r.DomUtil.hasClass(e, t) || (e.className += (e.className ? " " : "") + t)
},
removeClass: function (e, t) {
function n(e, n) {
return n === t ? "" : e
}
e.className = e.className.replace(/(\S+)\s*/g, n).replace(/(^\s+|\s+$)/, "")
},
setOpacity: function (e, t) {
if ("opacity" in e.style) e.style.opacity = t;
else if ("filter" in e.style) {
var n = "alpha";
t = Math.round(t * 100), e.style.filter = n + "(opacity=" + t + ")"
}
},
testProp: function (e) {
var n = t.documentElement.style;
for (var r = 0; r < e.length; r++) if (e[r] in n) return e[r];
return !1
},
getTranslateString: function (e) {
var t = r.Browser.webkit3d,
n = "translate" + (t ? "3d" : "") + "(",
i = (t ? ",0" : "") + ")";
return n + e.x + "px," + e.y + "px" + i
},
getScaleString: function (e, t) {
var n = r.DomUtil.getTranslateString(t.add(t.multiplyBy(-1 * e))),
i = " scale(" + e + ") ";
return n + i
},
setPosition: function (e, t, n) {
e._leaflet_pos = t, !n && r.Browser.any3d ? (e.style[r.DomUtil.TRANSFORM] = r.DomUtil.getTranslateString(t), r.Browser.mobileWebkit3d && (e.style.WebkitBackfaceVisibility = "hidden")) : (e.style.left = t.x + "px", e.style.top = t.y + "px")
},
getPosition: function (e) {
return e._leaflet_pos
}
}, r.DomUtil.TRANSFORM = r.DomUtil.testProp(["transform", "WebkitTransform", "OTransform", "MozTransform", "msTransform"]), r.DomUtil.TRANSITION = r.DomUtil.testProp(["webkitTransition", "transition", "OTransition", "MozTransition", "msTransition"]), r.DomUtil.TRANSITION_END = r.DomUtil.TRANSITION === "webkitTransition" || r.DomUtil.TRANSITION === "OTransition" ? r.DomUtil.TRANSITION + "End" : "transitionend", r.LatLng = function (e, t) {
var n = parseFloat(e),
r = parseFloat(t);
if (isNaN(n) || isNaN(r)) throw new Error("Invalid LatLng object: (" + e + ", " + t + ")");
this.lat = n, this.lng = r
}, r.extend(r.LatLng, {
DEG_TO_RAD: Math.PI / 180,
RAD_TO_DEG: 180 / Math.PI,
MAX_MARGIN: 1e-9
}), r.LatLng.prototype = {
equals: function (e) {
if (!e) return !1;
e = r.latLng(e);
var t = Math.max(Math.abs(this.lat - e.lat), Math.abs(this.lng - e.lng));
return t <= r.LatLng.MAX_MARGIN
},
toString: function (e) {
return "LatLng(" + r.Util.formatNum(this.lat, e) + ", " + r.Util.formatNum(this.lng, e) + ")"
},
distanceTo: function (e) {
e = r.latLng(e);
var t = 6378137,
n = r.LatLng.DEG_TO_RAD,
i = (e.lat - this.lat) * n,
s = (e.lng - this.lng) * n,
o = this.lat * n,
u = e.lat * n,
a = Math.sin(i / 2),
f = Math.sin(s / 2),
l = a * a + f * f * Math.cos(o) * Math.cos(u);
return t * 2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l))
},
wrap: function (e, t) {
var n = this.lng;
return e = e || -180, t = t || 180, n = (n + t) % (t - e) + (n < e || n === t ? t : e), new r.LatLng(this.lat, n)
}
}, r.latLng = function (e, t) {
return e instanceof r.LatLng ? e : r.Util.isArray(e) ? new r.LatLng(e[0], e[1]) : isNaN(e) ? e : new r.LatLng(e, t)
}, r.LatLngBounds = function (e, t) {
if (!e) return;
var n = t ? [e, t] : e;
for (var r = 0, i = n.length; r < i; r++) this.extend(n[r])
}, r.LatLngBounds.prototype = {
extend: function (e) {
return typeof e[0] == "number" || typeof e[0] == "string" || e instanceof r.LatLng ? e = r.latLng(e) : e = r.latLngBounds(e), e instanceof r.LatLng ? !this._southWest && !this._northEast ? (this._southWest = new r.LatLng(e.lat, e.lng), this._northEast = new r.LatLng(e.lat, e.lng)) : (this._southWest.lat = Math.min(e.lat, this._southWest.lat), this._southWest.lng = Math.min(e.lng, this._southWest.lng), this._northEast.lat = Math.max(e.lat, this._northEast.lat), this._northEast.lng = Math.max(e.lng, this._northEast.lng)) : e instanceof r.LatLngBounds && (this.extend(e._southWest), this.extend(e._northEast)), this
},
pad: function (e) {
var t = this._southWest,
n = this._northEast,
i = Math.abs(t.lat - n.lat) * e,
s = Math.abs(t.lng - n.lng) * e;
return new r.LatLngBounds(new r.LatLng(t.lat - i, t.lng - s), new r.LatLng(n.lat + i, n.lng + s))
},
getCenter: function () {
return new r.LatLng((this._southWest.lat + this._northEast.lat) / 2, (this._southWest.lng + this._northEast.lng) / 2)
},
getSouthWest: function () {
return this._southWest
},
getNorthEast: function () {
return this._northEast
},
getNorthWest: function () {
return new r.LatLng(this._northEast.lat, this._southWest.lng)
},
getSouthEast: function () {
return new r.LatLng(this._southWest.lat, this._northEast.lng)
},
contains: function (e) {
typeof e[0] == "number" || e instanceof r.LatLng ? e = r.latLng(e) : e = r.latLngBounds(e);
var t = this._southWest,
n = this._northEast,
i, s;
return e instanceof r.LatLngBounds ? (i = e.getSouthWest(), s = e.getNorthEast()) : i = s = e, i.lat >= t.lat && s.lat <= n.lat && i.lng >= t.lng && s.lng <= n.lng
},
intersects: function (e) {
e = r.latLngBounds(e);
var t = this._southWest,
n = this._northEast,
i = e.getSouthWest(),
s = e.getNorthEast(),
o = s.lat >= t.lat && i.lat <= n.lat,
u = s.lng >= t.lng && i.lng <= n.lng;
return o && u
},
toBBoxString: function () {
var e = this._southWest,
t = this._northEast;
return [e.lng, e.lat, t.lng, t.lat].join(",")
},
equals: function (e) {
return e ? (e = r.latLngBounds(e), this._southWest.equals(e.getSouthWest()) && this._northEast.equals(e.getNorthEast())) : !1
},
isValid: function () {
return !!this._southWest && !! this._northEast
}
}, r.latLngBounds = function (e, t) {
return !e || e instanceof r.LatLngBounds ? e : new r.LatLngBounds(e, t)
}, r.Projection = {}, r.Projection.SphericalMercator = {
MAX_LATITUDE: 85.0511287798,
project: function (e) {
var t = r.LatLng.DEG_TO_RAD,
n = this.MAX_LATITUDE,
i = Math.max(Math.min(n, e.lat), -n),
s = e.lng * t,
o = i * t;
return o = Math.log(Math.tan(Math.PI / 4 + o / 2)), new r.Point(s, o)
},
unproject: function (e) {
var t = r.LatLng.RAD_TO_DEG,
n = e.x * t,
i = (2 * Math.atan(Math.exp(e.y)) - Math.PI / 2) * t;
return new r.LatLng(i, n)
}
}, r.Projection.LonLat = {
project: function (e) {
return new r.Point(e.lng, e.lat)
},
unproject: function (e) {
return new r.LatLng(e.y, e.x)
}
}, r.CRS = {
latLngToPoint: function (e, t) {
var n = this.projection.project(e),
r = this.scale(t);
return this.transformation._transform(n, r)
},
pointToLatLng: function (e, t) {
var n = this.scale(t),
r = this.transformation.untransform(e, n);
return this.projection.unproject(r)
},
project: function (e) {
return this.projection.project(e)
},
scale: function (e) {
return 256 * Math.pow(2, e)
}
}, r.CRS.Simple = r.extend({}, r.CRS, {
projection: r.Projection.LonLat,
transformation: new r.Transformation(1, 0, -1, 0),
scale: function (e) {
return Math.pow(2, e)
}
}), r.CRS.EPSG3857 = r.extend({}, r.CRS, {
code: "EPSG:3857",
projection: r.Projection.SphericalMercator,
transformation: new r.Transformation(.5 / Math.PI, .5, -0.5 / Math.PI, .5),
project: function (e) {
var t = this.projection.project(e),
n = 6378137;
return t.multiplyBy(n)
}
}), r.CRS.EPSG900913 = r.extend({}, r.CRS.EPSG3857, {
code: "EPSG:900913"
}), r.CRS.EPSG4326 = r.extend({}, r.CRS, {
code: "EPSG:4326",
projection: r.Projection.LonLat,
transformation: new r.Transformation(1 / 360, .5, -1 / 360, .5)
}), r.Map = r.Class.extend({
includes: r.Mixin.Events,
options: {
crs: r.CRS.EPSG3857,
fadeAnimation: r.DomUtil.TRANSITION && !r.Browser.android23,
trackResize: !0,
markerZoomAnimation: r.DomUtil.TRANSITION && r.Browser.any3d
},
initialize: function (e, t) {
t = r.setOptions(this, t), this._initContainer(e), this._initLayout(), this.callInitHooks(), this._initEvents(), t.maxBounds && this.setMaxBounds(t.maxBounds), t.center && t.zoom !== n && this.setView(r.latLng(t.center), t.zoom, !0), this._initLayers(t.layers)
},
setView: function (e, t) {
return this._resetView(r.latLng(e), this._limitZoom(t)), this
},
setZoom: function (e) {
return this.setView(this.getCenter(), e)
},
zoomIn: function (e) {
return this.setZoom(this._zoom + (e || 1))
},
zoomOut: function (e) {
return this.setZoom(this._zoom - (e || 1))
},
fitBounds: function (e) {
var t = this.getBoundsZoom(e);
return this.setView(r.latLngBounds(e).getCenter(), t)
},
fitWorld: function () {
var e = new r.LatLng(-60, -170),
t = new r.LatLng(85, 179);
return this.fitBounds(new r.LatLngBounds(e, t))
},
panTo: function (e) {
return this.setView(e, this._zoom)
},
panBy: function (e) {
return this.fire("movestart"), this._rawPanBy(r.point(e)), this.fire("move"), this.fire("moveend")
},
setMaxBounds: function (e) {
e = r.latLngBounds(e), this.options.maxBounds = e;
if (!e) return this._boundsMinZoom = null, this;
var t = this.getBoundsZoom(e, !0);
return this._boundsMinZoom = t, this._loaded && (this._zoom < t ? this.setView(e.getCenter(), t) : this.panInsideBounds(e)), this
},
panInsideBounds: function (e) {
e = r.latLngBounds(e);
var t = this.getBounds(),
n = this.project(t.getSouthWest()),
i = this.project(t.getNorthEast()),
s = this.project(e.getSouthWest()),
o = this.project(e.getNorthEast()),
u = 0,
a = 0;
return i.y < o.y && (a = o.y - i.y), i.x > o.x && (u = o.x - i.x), n.y > s.y && (a = s.y - n.y), n.x < s.x && (u = s.x - n.x), this.panBy(new r.Point(u, a, !0))
},
addLayer: function (e) {
var t = r.stamp(e);
return this._layers[t] ? this : (this._layers[t] = e, e.options && (!isNaN(e.options.maxZoom) || !isNaN(e.options.minZoom)) && (this._zoomBoundLayers[t] = e, this._updateZoomLevels()), this.options.zoomAnimation && r.TileLayer && e instanceof r.TileLayer && (this._tileLayersNum++, this._tileLayersToLoad++, e.on("load", this._onTileLayerLoad, this)), this.whenReady(function () {
e.onAdd(this), this.fire("layeradd", {
layer: e
})
}, this), this)
},
removeLayer: function (e) {
var t = r.stamp(e);
if (!this._layers[t]) return;
return e.onRemove(this), delete this._layers[t], this._zoomBoundLayers[t] && (delete this._zoomBoundLayers[t], this._updateZoomLevels()), this.options.zoomAnimation && r.TileLayer && e instanceof r.TileLayer && (this._tileLayersNum--, this._tileLayersToLoad--, e.off("load", this._onTileLayerLoad, this)), this.fire("layerremove", {
layer: e
})
},
hasLayer: function (e) {
var t = r.stamp(e);
return this._layers.hasOwnProperty(t)
},
invalidateSize: function (e) {
var t = this.getSize();
this._sizeChanged = !0, this.options.maxBounds && this.setMaxBounds(this.options.maxBounds);
if (!this._loaded) return this;
var n = t._subtract(this.getSize())._divideBy(2)._round();
return e === !0 ? this.panBy(n) : (this._rawPanBy(n), this.fire("move"), clearTimeout(this._sizeTimer), this._sizeTimer = setTimeout(r.bind(this.fire, this, "moveend"), 200)), this
},
addHandler: function (e, t) {
if (!t) return;
return this[e] = new t(this), this.options[e] && this[e].enable(), this
},
getCenter: function () {
return this.layerPointToLatLng(this._getCenterLayerPoint())
},
getZoom: function () {
return this._zoom
},
getBounds: function () {
var e = this.getPixelBounds(),
t = this.unproject(e.getBottomLeft()),
n = this.unproject(e.getTopRight());
return new r.LatLngBounds(t, n)
},
getMinZoom: function () {
var e = this.options.minZoom || 0,
t = this._layersMinZoom || 0,
n = this._boundsMinZoom || 0;
return Math.max(e, t, n)
},
getMaxZoom: function () {
var e = this.options.maxZoom === n ? Infinity : this.options.maxZoom,
t = this._layersMaxZoom === n ? Infinity : this._layersMaxZoom;
return Math.min(e, t)
},
getBoundsZoom: function (e, t) {
e = r.latLngBounds(e);
var n = this.getSize(),
i = this.options.minZoom || 0,
s = this.getMaxZoom(),
o = e.getNorthEast(),
u = e.getSouthWest(),
a, f, l, c = !0;
t && i--;
do i++, f = this.project(o, i), l = this.project(u, i), a = new r.Point(Math.abs(f.x - l.x), Math.abs(l.y - f.y)), t ? c = a.x < n.x || a.y < n.y : c = a.x <= n.x && a.y <= n.y;
while (c && i <= s);
return c && t ? null : t ? i : i - 1
},
getSize: function () {
if (!this._size || this._sizeChanged) this._size = new r.Point(this._container.clientWidth, this._container.clientHeight), this._sizeChanged = !1;
return this._size.clone()
},
getPixelBounds: function () {
var e = this._getTopLeftPoint();
return new r.Bounds(e, e.add(this.getSize()))
},
getPixelOrigin: function () {
return this._initialTopLeftPoint
},
getPanes: function () {
return this._panes
},
getContainer: function () {
return this._container
},
getZoomScale: function (e) {
var t = this.options.crs;
return t.scale(e) / t.scale(this._zoom)
},
getScaleZoom: function (e) {
return this._zoom + Math.log(e) / Math.LN2
},
project: function (e, t) {
return t = t === n ? this._zoom : t, this.options.crs.latLngToPoint(r.latLng(e), t)
},
unproject: function (e, t) {
return t = t === n ? this._zoom : t, this.options.crs.pointToLatLng(r.point(e), t)
},
layerPointToLatLng: function (e) {
var t = r.point(e).add(this._initialTopLeftPoint);
return this.unproject(t)
},
latLngToLayerPoint: function (e) {
var t = this.project(r.latLng(e))._round();
return t._subtract(this._initialTopLeftPoint)
},
containerPointToLayerPoint: function (e) {
return r.point(e).subtract(this._getMapPanePos())
},
layerPointToContainerPoint: function (e) {
return r.point(e).add(this._getMapPanePos())
},
containerPointToLatLng: function (e) {
var t = this.containerPointToLayerPoint(r.point(e));
return this.layerPointToLatLng(t)
},
latLngToContainerPoint: function (e) {
return this.layerPointToContainerPoint(this.latLngToLayerPoint(r.latLng(e)))
},
mouseEventToContainerPoint: function (e) {
return r.DomEvent.getMousePosition(e, this._container)
},
mouseEventToLayerPoint: function (e) {
return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))
},
mouseEventToLatLng: function (e) {
return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))
},
_initContainer: function (e) {
var t = this._container = r.DomUtil.get(e);
if (t._leaflet) throw new Error("Map container is already initialized.");
t._leaflet = !0
},
_initLayout: function () {
var e = this._container;
r.DomUtil.addClass(e, "leaflet-container"), r.Browser.touch && r.DomUtil.addClass(e, "leaflet-touch"), this.options.fadeAnimation && r.DomUtil.addClass(e, "leaflet-fade-anim");
var t = r.DomUtil.getStyle(e, "position");
t !== "absolute" && t !== "relative" && t !== "fixed" && (e.style.position = "relative"), this._initPanes(), this._initControlPos && this._initControlPos()
},
_initPanes: function () {
var e = this._panes = {};
this._mapPane = e.mapPane = this._createPane("leaflet-map-pane", this._container), this._tilePane = e.tilePane = this._createPane("leaflet-tile-pane", this._mapPane), e.objectsPane = this._createPane("leaflet-objects-pane", this._mapPane), e.shadowPane = this._createPane("leaflet-shadow-pane"), e.overlayPane = this._createPane("leaflet-overlay-pane"), e.markerPane = this._createPane("leaflet-marker-pane"), e.popupPane = this._createPane("leaflet-popup-pane");
var t = " leaflet-zoom-hide";
this.options.markerZoomAnimation || (r.DomUtil.addClass(e.markerPane, t), r.DomUtil.addClass(e.shadowPane, t), r.DomUtil.addClass(e.popupPane, t))
},
_createPane: function (e, t) {
return r.DomUtil.create("div", e, t || this._panes.objectsPane)
},
_initLayers: function (e) {
e = e ? r.Util.isArray(e) ? e : [e] : [], this._layers = {}, this._zoomBoundLayers = {}, this._tileLayersNum = 0;
var t, n;
for (t = 0, n = e.length; t < n; t++) this.addLayer(e[t])
},
_resetView: function (e, t, n, i) {
var s = this._zoom !== t;
i || (this.fire("movestart"), s && this.fire("zoomstart")), this._zoom = t, this._initialTopLeftPoint = this._getNewTopLeftPoint(e), n ? this._initialTopLeftPoint._add(this._getMapPanePos()) : r.DomUtil.setPosition(this._mapPane, new r.Point(0, 0)), this._tileLayersToLoad = this._tileLayersNum;
var o = !this._loaded;
this._loaded = !0, this.fire("viewreset", {
hard: !n
}), this.fire("move"), (s || i) && this.fire("zoomend"), this.fire("moveend", {
hard: !n
}), o && this.fire("load")
},
_rawPanBy: function (e) {
r.DomUtil.setPosition(this._mapPane, this._getMapPanePos().subtract(e))
},
_updateZoomLevels: function () {
var e, t = Infinity,
r = -Infinity;
for (e in this._zoomBoundLayers) if (this._zoomBoundLayers.hasOwnProperty(e)) {
var i = this._zoomBoundLayers[e];
isNaN(i.options.minZoom) || (t = Math.min(t, i.options.minZoom)), isNaN(i.options.maxZoom) || (r = Math.max(r, i.options.maxZoom))
}
e === n ? this._layersMaxZoom = this._layersMinZoom = n : (this._layersMaxZoom = r, this._layersMinZoom = t)
},
_initEvents: function () {
if (!r.DomEvent) return;
r.DomEvent.on(this._container, "click", this._onMouseClick, this);
var t = ["dblclick", "mousedown", "mouseup", "mouseenter", "mouseleave", "mousemove", "contextmenu"],
n, i;
for (n = 0, i = t.length; n < i; n++) r.DomEvent.on(this._container, t[n], this._fireMouseEvent, this);
this.options.trackResize && r.DomEvent.on(e, "resize", this._onResize, this)
},
_onResize: function () {
r.Util.cancelAnimFrame(this._resizeRequest), this._resizeRequest = r.Util.requestAnimFrame(this.invalidateSize, this, !1, this._container)
},
_onMouseClick: function (e) {
if (!this._loaded || this.dragging && this.dragging.moved()) return;
this.fire("preclick"), this._fireMouseEvent(e)
},
_fireMouseEvent: function (e) {
if (!this._loaded) return;
var t = e.type;
t = t === "mouseenter" ? "mouseover" : t === "mouseleave" ? "mouseout" : t;
if (!this.hasEventListeners(t)) return;
t === "contextmenu" && r.DomEvent.preventDefault(e);
var n = this.mouseEventToContainerPoint(e),
i = this.containerPointToLayerPoint(n),
s = this.layerPointToLatLng(i);
this.fire(t, {
latlng: s,
layerPoint: i,
containerPoint: n,
originalEvent: e
})
},
_onTileLayerLoad: function () {
this._tileLayersToLoad--, this._tileLayersNum && !this._tileLayersToLoad && this._tileBg && (clearTimeout(this._clearTileBgTimer), this._clearTileBgTimer = setTimeout(r.bind(this._clearTileBg, this), 500))
},
whenReady: function (e, t) {
return this._loaded ? e.call(t || this, this) : this.on("load", e, t), this
},
_getMapPanePos: function () {
return r.DomUtil.getPosition(this._mapPane)
},
_getTopLeftPoint: function () {
if (!this._loaded) throw new Error("Set map center and zoom first.");
return this._initialTopLeftPoint.subtract(this._getMapPanePos())
},
_getNewTopLeftPoint: function (e, t) {
var n = this.getSize()._divideBy(2);
return this.project(e, t)._subtract(n)._round()
},
_latLngToNewLayerPoint: function (e, t, n) {
var r = this._getNewTopLeftPoint(n, t).add(this._getMapPanePos());
return this.project(e, t)._subtract(r)
},
_getCenterLayerPoint: function () {
return this.containerPointToLayerPoint(this.getSize()._divideBy(2))
},
_getCenterOffset: function (e) {
return this.latLngToLayerPoint(e).subtract(this._getCenterLayerPoint())
},
_limitZoom: function (e) {
var t = this.getMinZoom(),
n = this.getMaxZoom();
return Math.max(t, Math.min(n, e))
}
}), r.map = function (e, t) {
return new r.Map(e, t)
}, r.Projection.Mercator = {
MAX_LATITUDE: 85.0840591556,
R_MINOR: 6356752.3142,
R_MAJOR: 6378137,
project: function (e) {
var t = r.LatLng.DEG_TO_RAD,
n = this.MAX_LATITUDE,
i = Math.max(Math.min(n, e.lat), -n),
s = this.R_MAJOR,
o = this.R_MINOR,
u = e.lng * t * s,
a = i * t,
f = o / s,
l = Math.sqrt(1 - f * f),
c = l * Math.sin(a);
c = Math.pow((1 - c) / (1 + c), l * .5);
var h = Math.tan(.5 * (Math.PI * .5 - a)) / c;
return a = -o * Math.log(h), new r.Point(u, a)
},
unproject: function (e) {
var t = r.LatLng.RAD_TO_DEG,
n = this.R_MAJOR,
i = this.R_MINOR,
s = e.x * t / n,
o = i / n,
u = Math.sqrt(1 - o * o),
a = Math.exp(-e.y / i),
f = Math.PI / 2 - 2 * Math.atan(a),
l = 15,
c = 1e-7,
h = l,
p = .1,
d;
while (Math.abs(p) > c && --h > 0) d = u * Math.sin(f), p = Math.PI / 2 - 2 * Math.atan(a * Math.pow((1 - d) / (1 + d), .5 * u)) - f, f += p;
return new r.LatLng(f * t, s)
}
}, r.CRS.EPSG3395 = r.extend({}, r.CRS, {
code: "EPSG:3395",
projection: r.Projection.Mercator,
transformation: function () {
var e = r.Projection.Mercator,
t = e.R_MAJOR,
n = e.R_MINOR;
return new r.Transformation(.5 / (Math.PI * t), .5, -0.5 / (Math.PI * n), .5)
}()
}), r.TileLayer = r.Class.extend({
includes: r.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
subdomains: "abc",
errorTileUrl: "",
attribution: "",
zoomOffset: 0,
opacity: 1,
unloadInvisibleTiles: r.Browser.mobile,
updateWhenIdle: r.Browser.mobile
},
initialize: function (e, t) {
t = r.setOptions(this, t), t.detectRetina && r.Browser.retina && t.maxZoom > 0 && (t.tileSize = Math.floor(t.tileSize / 2), t.zoomOffset++, t.minZoom > 0 && t.minZoom--, this.options.maxZoom--), this._url = e;
var n = this.options.subdomains;
typeof n == "string" && (this.options.subdomains = n.split(""))
},
onAdd: function (e) {
this._map = e, this._initContainer(), this._createTileProto(), e.on({
viewreset: this._resetCallback,
moveend: this._update
}, this), this.options.updateWhenIdle || (this._limitedUpdate = r.Util.limitExecByInterval(this._update, 150, this), e.on("move", this._limitedUpdate, this)), this._reset(), this._update()
},
addTo: function (e) {
return e.addLayer(this), this
},
onRemove: function (e) {
this._container.parentNode.removeChild(this._container), e.off({
viewreset: this._resetCallback,
moveend: this._update
}, this), this.options.updateWhenIdle || e.off("move", this._limitedUpdate, this), this._container = null, this._map = null
},
bringToFront: function () {
var e = this._map._panes.tilePane;
return this._container && (e.appendChild(this._container), this._setAutoZIndex(e, Math.max)), this
},
bringToBack: function () {
var e = this._map._panes.tilePane;
return this._container && (e.insertBefore(this._container, e.firstChild), this._setAutoZIndex(e, Math.min)), this
},
getAttribution: function () {
return this.options.attribution
},
setOpacity: function (e) {
return this.options.opacity = e, this._map && this._updateOpacity(), this
},
setZIndex: function (e) {
return this.options.zIndex = e, this._updateZIndex(), this
},
setUrl: function (e, t) {
return this._url = e, t || this.redraw(), this
},
redraw: function () {
return this._map && (this._map._panes.tilePane.empty = !1, this._reset(!0), this._update()), this
},
_updateZIndex: function () {
this._container && this.options.zIndex !== n && (this._container.style.zIndex = this.options.zIndex)
},
_setAutoZIndex: function (e, t) {
var n = e.children,
r = -t(Infinity, -Infinity),
i, s, o;
for (s = 0, o = n.length; s < o; s++) n[s] !== this._container && (i = parseInt(n[s].style.zIndex, 10), isNaN(i) || (r = t(r, i)));
this.options.zIndex = this._container.style.zIndex = (isFinite(r) ? r : 0) + t(1, -1)
},
_updateOpacity: function () {
var e, t = this._tiles;
if (!r.Browser.ie7 && !r.Browser.ie8) r.DomUtil.setOpacity(this._container, this.options.opacity);
else for (e in t) t.hasOwnProperty(e) && r.DomUtil.setOpacity(t[e], this.options.opacity);
if (r.Browser.webkit) for (e in t) t.hasOwnProperty(e) && (t[e].style.webkitTransform += " translate(0,0)")
},
_initContainer: function () {
var e = this._map._panes.tilePane;
if (!this._container || e.empty) this._container = r.DomUtil.create("div", "leaflet-layer"), this._updateZIndex(), e.appendChild(this._container), this.options.opacity < 1 && this._updateOpacity()
},
_resetCallback: function (e) {
this._reset(e.hard)
},
_reset: function (e) {
var t = this._tiles;
for (var n in t) t.hasOwnProperty(n) && this.fire("tileunload", {
tile: t[n]
});
this._tiles = {}, this._tilesToLoad = 0, this.options.reuseTiles && (this._unusedTiles = []), e && this._container && (this._container.innerHTML = ""), this._initContainer()
},
_update: function () {
if (!this._map) return;
var e = this._map.getPixelBounds(),
t = this._map.getZoom(),
n = this.options.tileSize;
if (t > this.options.maxZoom || t < this.options.minZoom) return;
var i = new r.Point(Math.floor(e.min.x / n), Math.floor(e.min.y / n)),
s = new r.Point(Math.floor(e.max.x / n), Math.floor(e.max.y / n)),
o = new r.Bounds(i, s);
this._addTilesFromCenterOut(o), (this.options.unloadInvisibleTiles || this.options.reuseTiles) && this._removeOtherTiles(o)
},
_addTilesFromCenterOut: function (e) {
var n = [],
i = e.getCenter(),
s, o, u;
for (s = e.min.y; s <= e.max.y; s++) for (o = e.min.x; o <= e.max.x; o++) u = new r.Point(o, s), this._tileShouldBeLoaded(u) && n.push(u);
var a = n.length;
if (a === 0) return;
n.sort(function (e, t) {
return e.distanceTo(i) - t.distanceTo(i)
});
var f = t.createDocumentFragment();
this._tilesToLoad || this.fire("loading"), this._tilesToLoad += a;
for (o = 0; o < a; o++) this._addTile(n[o], f);
this._container.appendChild(f)
},
_tileShouldBeLoaded: function (e) {
if (e.x + ":" + e.y in this._tiles) return !1;
if (!this.options.continuousWorld) {
var t = this._getWrapTileNum();
if (this.options.noWrap && (e.x < 0 || e.x >= t) || e.y < 0 || e.y >= t) return !1
}
return !0
},
_removeOtherTiles: function (e) {
var t, n, r, i;
for (i in this._tiles) this._tiles.hasOwnProperty(i) && (t = i.split(":"), n = parseInt(t[0], 10), r = parseInt(t[1], 10), (n < e.min.x || n > e.max.x || r < e.min.y || r > e.max.y) && this._removeTile(i))
},
_removeTile: function (e) {
var t = this._tiles[e];
this.fire("tileunload", {
tile: t,
url: t.src
}), this.options.reuseTiles ? (r.DomUtil.removeClass(t, "leaflet-tile-loaded"), this._unusedTiles.push(t)) : t.parentNode === this._container && this._container.removeChild(t), r.Browser.android || (t.src = r.Util.emptyImageUrl), delete this._tiles[e]
},
_addTile: function (e, t) {
var n = this._getTilePos(e),
i = this._getTile();
r.DomUtil.setPosition(i, n, r.Browser.chrome || r.Browser.android23), this._tiles[e.x + ":" + e.y] = i, this._loadTile(i, e), i.parentNode !== this._container && t.appendChild(i)
},
_getZoomForUrl: function () {
var e = this.options,
t = this._map.getZoom();
return e.zoomReverse && (t = e.maxZoom - t), t + e.zoomOffset
},
_getTilePos: function (e) {
var t = this._map.getPixelOrigin(),
n = this.options.tileSize;
return e.multiplyBy(n).subtract(t)
},
getTileUrl: function (e) {
return this._adjustTilePoint(e), r.Util.template(this._url, r.extend({
s: this._getSubdomain(e),
z: this._getZoomForUrl(),
x: e.x,
y: e.y
}, this.options))
},
_getWrapTileNum: function () {
return Math.pow(2, this._getZoomForUrl())
},
_adjustTilePoint: function (e) {
var t = this._getWrapTileNum();
!this.options.continuousWorld && !this.options.noWrap && (e.x = (e.x % t + t) % t), this.options.tms && (e.y = t - e.y - 1)
},
_getSubdomain: function (e) {
var t = (e.x + e.y) % this.options.subdomains.length;
return this.options.subdomains[t]
},
_createTileProto: function () {
var e = this._tileImg = r.DomUtil.create("img", "leaflet-tile");
e.style.width = e.style.height = this.options.tileSize + "px", e.galleryimg = "no"
},
_getTile: function () {
if (this.options.reuseTiles && this._unusedTiles.length > 0) {
var e = this._unusedTiles.pop();
return this._resetTile(e), e
}
return this._createTile()
},
_resetTile: function () {},
_createTile: function () {
var e = this._tileImg.cloneNode(!1);
return e.onselectstart = e.onmousemove = r.Util.falseFn, (r.Browser.ie7 || r.Browser.ie8) && this.options.opacity !== n && r.DomUtil.setOpacity(e, this.options.opacity), e
},
_loadTile: function (e, t) {
e._layer = this, e.onload = this._tileOnLoad, e.onerror = this._tileOnError, e.src = this.getTileUrl(t)
},
_tileLoaded: function () {
this._tilesToLoad--, this._tilesToLoad || this.fire("load")
},
_tileOnLoad: function () {
var e = this._layer;
this.src !== r.Util.emptyImageUrl && (r.DomUtil.addClass(this, "leaflet-tile-loaded"), e.fire("tileload", {
tile: this,
url: this.src
})), e._tileLoaded()
},
_tileOnError: function () {
var e = this._layer;
e.fire("tileerror", {
tile: this,
url: this.src
});
var t = e.options.errorTileUrl;
t && (this.src = t), e._tileLoaded()
}
}), r.tileLayer = function (e, t) {
return new r.TileLayer(e, t)
}, r.TileLayer.WMS = r.TileLayer.extend({
defaultWmsParams: {
service: "WMS",
request: "GetMap",
version: "1.1.1",
layers: "",
styles: "",
format: "image/jpeg",
transparent: !1
},
initialize: function (e, t) {
this._url = e;
var n = r.extend({}, this.defaultWmsParams);
t.detectRetina && r.Browser.retina ? n.width = n.height = this.options.tileSize * 2 : n.width = n.height = this.options.tileSize;
for (var i in t) this.options.hasOwnProperty(i) || (n[i] = t[i]);
this.wmsParams = n, r.setOptions(this, t)
},
onAdd: function (e) {
var t = parseFloat(this.wmsParams.version) >= 1.3 ? "crs" : "srs";
this.wmsParams[t] = e.options.crs.code, r.TileLayer.prototype.onAdd.call(this, e)
},
getTileUrl: function (e, t) {
this._adjustTilePoint(e);
var n = this._map,
i = n.options.crs,
s = this.options.tileSize,
o = e.multiplyBy(s),
u = o.add(new r.Point(s, s)),
a = i.project(n.unproject(o, t)),
f = i.project(n.unproject(u, t)),
l = [a.x, f.y, f.x, a.y].join(","),
c = r.Util.template(this._url, {
s: this._getSubdomain(e)
});
return c + r.Util.getParamString(this.wmsParams, c) + "&bbox=" + l
},
setParams: function (e, t) {
return r.extend(this.wmsParams, e), t || this.redraw(), this
}
}), r.tileLayer.wms = function (e, t) {
return new r.TileLayer.WMS(e, t)
}, r.TileLayer.Canvas = r.TileLayer.extend({
options: {
async: !1
},
initialize: function (e) {
r.setOptions(this, e)
},
redraw: function () {
var e = this._tiles;
for (var t in e) e.hasOwnProperty(t) && this._redrawTile(e[t])
},
_redrawTile: function (e) {
this.drawTile(e, e._tilePoint, this._map._zoom)
},
_createTileProto: function () {
var e = this._canvasProto = r.DomUtil.create("canvas", "leaflet-tile");
e.width = e.height = this.options.tileSize
},
_createTile: function () {
var e = this._canvasProto.cloneNode(!1);
return e.onselectstart = e.onmousemove = r.Util.falseFn, e
},
_loadTile: function (e, t) {
e._layer = this, e._tilePoint = t, this._redrawTile(e), this.options.async || this.tileDrawn(e)
},
drawTile: function () {},
tileDrawn: function (e) {
this._tileOnLoad.call(e)
}
}), r.tileLayer.canvas = function (e) {
return new r.TileLayer.Canvas(e)
}, r.ImageOverlay = r.Class.extend({
includes: r.Mixin.Events,
options: {
opacity: 1
},
initialize: function (e, t, n) {
this._url = e, this._bounds = r.latLngBounds(t), r.setOptions(this, n)
},
onAdd: function (e) {
this._map = e, this._image || this._initImage(), e._panes.overlayPane.appendChild(this._image), e.on("viewreset", this._reset, this), e.options.zoomAnimation && r.Browser.any3d && e.on("zoomanim", this._animateZoom, this), this._reset()
},
onRemove: function (e) {
e.getPanes().overlayPane.removeChild(this._image), e.off("viewreset", this._reset, this), e.options.zoomAnimation && e.off("zoomanim", this._animateZoom, this)
},
addTo: function (e) {
return e.addLayer(this), this
},
setOpacity: function (e) {
return this.options.opacity = e, this._updateOpacity(), this
},
bringToFront: function () {
return this._image && this._map._panes.overlayPane.appendChild(this._image), this
},
bringToBack: function () {
var e = this._map._panes.overlayPane;
return this._image && e.insertBefore(this._image, e.firstChild), this
},
_initImage: function () {
this._image = r.DomUtil.create("img", "leaflet-image-layer"), this._map.options.zoomAnimation && r.Browser.any3d ? r.DomUtil.addClass(this._image, "leaflet-zoom-animated") : r.DomUtil.addClass(this._image, "leaflet-zoom-hide"), this._updateOpacity(), r.extend(this._image, {
galleryimg: "no",
onselectstart: r.Util.falseFn,
onmousemove: r.Util.falseFn,
onload: r.bind(this._onImageLoad, this),
src: this._url
})
},
_animateZoom: function (e) {
var t = this._map,
n = this._image,
i = t.getZoomScale(e.zoom),
s = this._bounds.getNorthWest(),
o = this._bounds.getSouthEast(),
u = t._latLngToNewLayerPoint(s, e.zoom, e.center),
a = t._latLngToNewLayerPoint(o, e.zoom, e.center)._subtract(u),
f = u._add(a._multiplyBy(.5 * (1 - 1 / i)));
n.style[r.DomUtil.TRANSFORM] = r.DomUtil.getTranslateString(f) + " scale(" + i + ") "
},
_reset: function () {
var e = this._image,
t = this._map.latLngToLayerPoint(this._bounds.getNorthWest()),
n = this._map.latLngToLayerPoint(this._bounds.getSouthEast())._subtract(t);
r.DomUtil.setPosition(e, t), e.style.width = n.x + "px", e.style.height = n.y + "px"
},
_onImageLoad: function () {
this.fire("load")
},
_updateOpacity: function () {
r.DomUtil.setOpacity(this._image, this.options.opacity)
}
}), r.imageOverlay = function (e, t, n) {
return new r.ImageOverlay(e, t, n)
}, r.Icon = r.Class.extend({
options: {
className: ""
},
initialize: function (e) {
r.setOptions(this, e)
},
createIcon: function () {
return this._createIcon("icon")
},
createShadow: function () {
return this._createIcon("shadow")
},
_createIcon: function (e) {
var t = this._getIconUrl(e);
if (!t) {
if (e === "icon") throw new Error("iconUrl not set in Icon options (see the docs).");
return null
}
var n = this._createImg(t);
return this._setIconStyles(n, e), n
},
_setIconStyles: function (e, t) {
var n = this.options,
i = r.point(n[t + "Size"]),
s;
t === "shadow" ? s = r.point(n.shadowAnchor || n.iconAnchor) : s = r.point(n.iconAnchor), !s && i && (s = i.divideBy(2, !0)), e.className = "leaflet-marker-" + t + " " + n.className, s && (e.style.marginLeft = -s.x + "px", e.style.marginTop = -s.y + "px"), i && (e.style.width = i.x + "px", e.style.height = i.y + "px")
},
_createImg: function (e) {
var n;
return r.Browser.ie6 ? (n = t.createElement("div"), n.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + e + '")') : (n = t.createElement("img"), n.src = e), n
},
_getIconUrl: function (e) {
return r.Browser.retina && this.options[e + "RetinaUrl"] ? this.options[e + "RetinaUrl"] : this.options[e + "Url"]
}
}), r.icon = function (e) {
return new r.Icon(e)
}, r.Icon.Default = r.Icon.extend({
options: {
iconSize: new r.Point(25, 41),
iconAnchor: new r.Point(12, 41),
popupAnchor: new r.Point(1, -34),
shadowSize: new r.Point(41, 41)
},
_getIconUrl: function (e) {
var t = e + "Url";
if (this.options[t]) return this.options[t];
r.Browser.retina && e === "icon" && (e += "@2x");
var n = r.Icon.Default.imagePath;
if (!n) throw new Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");
return n + "/marker-" + e + ".png"
}
}), r.Icon.Default.imagePath = function () {
var e = t.getElementsByTagName("script"),
n = /\/?leaflet[\-\._]?([\w\-\._]*)\.js\??/,
r, i, s, o;
for (r = 0, i = e.length; r < i; r++) {
s = e[r].src, o = s.match(n);
if (o) return s.split(n)[0] + "/images"
}
}(), r.Marker = r.Class.extend({
includes: r.Mixin.Events,
options: {
icon: new r.Icon.Default,
title: "",
clickable: !0,
draggable: !1,
zIndexOffset: 0,
opacity: 1,
riseOnHover: !1,
riseOffset: 250
},
initialize: function (e, t) {
r.setOptions(this, t), this._latlng = r.latLng(e)
},
onAdd: function (e) {
this._map = e, e.on("viewreset", this.update, this), this._initIcon(), this.update(), e.options.zoomAnimation && e.options.markerZoomAnimation && e.on("zoomanim", this._animateZoom, this)
},
addTo: function (e) {
return e.addLayer(this), this
},
onRemove: function (e) {
this._removeIcon(), this.fire("remove"), e.off({
viewreset: this.update,
zoomanim: this._animateZoom
}, this), this._map = null
},
getLatLng: function () {
return this._latlng
},
setLatLng: function (e) {
return this._latlng = r.latLng(e), this.update(), this.fire("move", {
latlng: this._latlng
})
},
setZIndexOffset: function (e) {
return this.options.zIndexOffset = e, this.update(), this
},
setIcon: function (e) {
return this._map && this._removeIcon(), this.options.icon = e, this._map && (this._initIcon(), this.update()), this
},
update: function () {
if (this._icon) {
var e = this._map.latLngToLayerPoint(this._latlng).round();
this._setPos(e)
}
return this
},
_initIcon: function () {
var e = this.options,
t = this._map,
n = t.options.zoomAnimation && t.options.markerZoomAnimation,
i = n ? "leaflet-zoom-animated" : "leaflet-zoom-hide",
s = !1;
this._icon || (this._icon = e.icon.createIcon(), e.title && (this._icon.title = e.title), this._initInteraction(), s = this.options.opacity < 1, r.DomUtil.addClass(this._icon, i), e.riseOnHover && r.DomEvent.on(this._icon, "mouseover", this._bringToFront, this).on(this._icon, "mouseout", this._resetZIndex, this)), this._shadow || (this._shadow = e.icon.createShadow(), this._shadow && (r.DomUtil.addClass(this._shadow, i), s = this.options.opacity < 1)), s && this._updateOpacity();
var o = this._map._panes;
o.markerPane.appendChild(this._icon), this._shadow && o.shadowPane.appendChild(this._shadow)
},
_removeIcon: function () {
var e = this._map._panes;
this.options.riseOnHover && r.DomEvent.off(this._icon, "mouseover", this._bringToFront).off(this._icon, "mouseout", this._resetZIndex), e.markerPane.removeChild(this._icon), this._shadow && e.shadowPane.removeChild(this._shadow), this._icon = this._shadow = null
},
_setPos: function (e) {
r.DomUtil.setPosition(this._icon, e), this._shadow && r.DomUtil.setPosition(this._shadow, e), this._zIndex = e.y + this.options.zIndexOffset, this._resetZIndex()
},
_updateZIndex: function (e) {
this._icon.style.zIndex = this._zIndex + e
},
_animateZoom: function (e) {
var t = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);
this._setPos(t)
},
_initInteraction: function () {
if (!this.options.clickable) return;
var e = this._icon,
t = ["dblclick", "mousedown", "mouseover", "mouseout", "contextmenu"];
r.DomUtil.addClass(e, "leaflet-clickable"), r.DomEvent.on(e, "click", this._onMouseClick, this);
for (var n = 0; n < t.length; n++) r.DomEvent.on(e, t[n], this._fireMouseEvent, this);
r.Handler.MarkerDrag && (this.dragging = new r.Handler.MarkerDrag(this), this.options.draggable && this.dragging.enable())
},
_onMouseClick: function (e) {
var t = this.dragging && this.dragging.moved();
(this.hasEventListeners(e.type) || t) && r.DomEvent.stopPropagation(e);
if (t) return;
if ((!this.dragging || !this.dragging._enabled) && this._map.dragging && this._map.dragging.moved()) return;
this.fire(e.type, {
originalEvent: e
})
},
_fireMouseEvent: function (e) {
this.fire(e.type, {
originalEvent: e
}), e.type === "contextmenu" && this.hasEventListeners(e.type) && r.DomEvent.preventDefault(e), e.type !== "mousedown" && r.DomEvent.stopPropagation(e)
},
setOpacity: function (e) {
this.options.opacity = e, this._map && this._updateOpacity()
},
_updateOpacity: function () {
r.DomUtil.setOpacity(this._icon, this.options.opacity), this._shadow && r.DomUtil.setOpacity(this._shadow, this.options.opacity)
},
_bringToFront: function () {
this._updateZIndex(this.options.riseOffset)
},
_resetZIndex: function () {
this._updateZIndex(0)
}
}), r.marker = function (e, t) {
return new r.Marker(e, t)
}, r.DivIcon = r.Icon.extend({
options: {
iconSize: new r.Point(12, 12),
className: "leaflet-div-icon"
},
createIcon: function () {
var e = t.createElement("div"),
n = this.options;
return n.html && (e.innerHTML = n.html), n.bgPos && (e.style.backgroundPosition = -n.bgPos.x + "px " + -n.bgPos.y + "px"), this._setIconStyles(e, "icon"), e
},
createShadow: function () {
return null
}
}), r.divIcon = function (e) {
return new r.DivIcon(e)
}, r.Map.mergeOptions({
closePopupOnClick: !0
}), r.Popup = r.Class.extend({
includes: r.Mixin.Events,
options: {
minWidth: 50,
maxWidth: 300,
maxHeight: null,
autoPan: !0,
closeButton: !0,
offset: new r.Point(0, 6),
autoPanPadding: new r.Point(5, 5),
className: "",
zoomAnimation: !0
},
initialize: function (e, t) {
r.setOptions(this, e), this._source = t, this._animated = r.Browser.any3d && this.options.zoomAnimation
},
onAdd: function (e) {
this._map = e, this._container || this._initLayout(), this._updateContent();
var t = e.options.fadeAnimation;
t && r.DomUtil.setOpacity(this._container, 0), e._panes.popupPane.appendChild(this._container), e.on("viewreset", this._updatePosition, this), this._animated && e.on("zoomanim", this._zoomAnimation, this), e.options.closePopupOnClick && e.on("preclick", this._close, this), this._update(), t && r.DomUtil.setOpacity(this._container, 1)
},
addTo: function (e) {
return e.addLayer(this), this
},
openOn: function (e) {
return e.openPopup(this), this
},
onRemove: function (e) {
e._panes.popupPane.removeChild(this._container), r.Util.falseFn(this._container.offsetWidth), e.off({
viewreset: this._updatePosition,
preclick: this._close,
zoomanim: this._zoomAnimation
}, this), e.options.fadeAnimation && r.DomUtil.setOpacity(this._container, 0), this._map = null
},
setLatLng: function (e) {
return this._latlng = r.latLng(e), this._update(), this
},
setContent: function (e) {
return this._content = e, this._update(), this
},
_close: function () {
var e = this._map;
e && (e._popup = null, e.removeLayer(this).fire("popupclose", {
popup: this
}))
},
_initLayout: function () {
var e = "leaflet-popup",
t = e + " " + this.options.className + " leaflet-zoom-" + (this._animated ? "animated" : "hide"),
n = this._container = r.DomUtil.create("div", t),
i;
this.options.closeButton && (i = this._closeButton = r.DomUtil.create("a", e + "-close-button", n), i.href = "#close", i.innerHTML = "&#215;", r.DomEvent.on(i, "click", this._onCloseButtonClick, this));
var s = this._wrapper = r.DomUtil.create("div", e + "-content-wrapper", n);
r.DomEvent.disableClickPropagation(s), this._contentNode = r.DomUtil.create("div", e + "-content", s), r.DomEvent.on(this._contentNode, "mousewheel", r.DomEvent.stopPropagation), this._tipContainer = r.DomUtil.create("div", e + "-tip-container", n), this._tip = r.DomUtil.create("div", e + "-tip", this._tipContainer)
},
_update: function () {
if (!this._map) return;
this._container.style.visibility = "hidden", this._updateContent(), this._updateLayout(), this._updatePosition(), this._container.style.visibility = "", this._adjustPan()
},
_updateContent: function () {
if (!this._content) return;
if (typeof this._content == "string") this._contentNode.innerHTML = this._content;
else {
while (this._contentNode.hasChildNodes()) this._contentNode.removeChild(this._contentNode.firstChild);
this._contentNode.appendChild(this._content)
}
this.fire("contentupdate")
},
_updateLayout: function () {
var e = this._contentNode,
t = e.style;
t.width = "", t.whiteSpace = "nowrap";
var n = e.offsetWidth;
n = Math.min(n, this.options.maxWidth), n = Math.max(n, this.options.minWidth), t.width = n + 1 + "px", t.whiteSpace = "", t.height = "";
var i = e.offsetHeight,
s = this.options.maxHeight,
o = "leaflet-popup-scrolled";
s && i > s ? (t.height = s + "px", r.DomUtil.addClass(e, o)) : r.DomUtil.removeClass(e, o), this._containerWidth = this._container.offsetWidth
},
_updatePosition: function () {
if (!this._map) return;
var e = this._map.latLngToLayerPoint(this._latlng),
t = this._animated,
n = this.options.offset;
t && r.DomUtil.setPosition(this._container, e), this._containerBottom = -n.y - (t ? 0 : e.y), this._containerLeft = -Math.round(this._containerWidth / 2) + n.x + (t ? 0 : e.x), this._container.style.bottom = this._containerBottom + "px", this._container.style.left = this._containerLeft + "px"
},
_zoomAnimation: function (e) {
var t = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);
r.DomUtil.setPosition(this._container, t)
},
_adjustPan: function () {
if (!this.options.autoPan) return;
var e = this._map,
t = this._container.offsetHeight,
n = this._containerWidth,
i = new r.Point(this._containerLeft, -t - this._containerBottom);
this._animated && i._add(r.DomUtil.getPosition(this._container));
var s = e.layerPointToContainerPoint(i),
o = this.options.autoPanPadding,
u = e.getSize(),
a = 0,
f = 0;
s.x < 0 && (a = s.x - o.x), s.x + n > u.x && (a = s.x + n - u.x + o.x), s.y < 0 && (f = s.y - o.y), s.y + t > u.y && (f = s.y + t - u.y + o.y), (a || f) && e.panBy(new r.Point(a, f))
},
_onCloseButtonClick: function (e) {
this._close(), r.DomEvent.stop(e)
}
}), r.popup = function (e, t) {
return new r.Popup(e, t)
}, r.Marker.include({
openPopup: function () {
return this._popup && this._map && (this._popup.setLatLng(this._latlng), this._map.openPopup(this._popup)), this
},
closePopup: function () {
return this._popup && this._popup._close(), this
},
bindPopup: function (e, t) {
var n = r.point(this.options.icon.options.popupAnchor) || new r.Point(0, 0);
return n = n.add(r.Popup.prototype.options.offset), t && t.offset && (n = n.add(t.offset)), t = r.extend({
offset: n
}, t), this._popup || this.on("click", this.openPopup, this).on("remove", this.closePopup, this).on("move", this._movePopup, this), this._popup = (new r.Popup(t, this)).setContent(e), this
},
unbindPopup: function () {
return this._popup && (this._popup = null, this.off("click", this.openPopup).off("remove", this.closePopup).off("move", this._movePopup)), this
},
_movePopup: function (e) {
this._popup.setLatLng(e.latlng)
}
}), r.Map.include({
openPopup: function (e) {
return this.closePopup(), this._popup = e, this.addLayer(e).fire("popupopen", {
popup: this._popup
})
},
closePopup: function () {
return this._popup && this._popup._close(), this
}
}), r.LayerGroup = r.Class.extend({
initialize: function (e) {
this._layers = {};
var t, n;
if (e) for (t = 0, n = e.length; t < n; t++) this.addLayer(e[t])
},
addLayer: function (e) {
var t = r.stamp(e);
return this._layers[t] = e, this._map && this._map.addLayer(e), this
},
removeLayer: function (e) {
var t = r.stamp(e);
return delete this._layers[t], this._map && this._map.removeLayer(e), this
},
clearLayers: function () {
return this.eachLayer(this.removeLayer, this), this
},
invoke: function (e) {
var t = Array.prototype.slice.call(arguments, 1),
n, r;
for (n in this._layers) this._layers.hasOwnProperty(n) && (r = this._layers[n], r[e] && r[e].apply(r, t));
return this
},
onAdd: function (e) {
this._map = e, this.eachLayer(e.addLayer, e)
},
onRemove: function (e) {
this.eachLayer(e.removeLayer, e), this._map = null
},
addTo: function (e) {
return e.addLayer(this), this
},
eachLayer: function (e, t) {
for (var n in this._layers) this._layers.hasOwnProperty(n) && e.call(t, this._layers[n])
},
setZIndex: function (e) {
return this.invoke("setZIndex", e)
}
}), r.layerGroup = function (e) {
return new r.LayerGroup(e)
}, r.FeatureGroup = r.LayerGroup.extend({
includes: r.Mixin.Events,
statics: {
EVENTS: "click dblclick mouseover mouseout mousemove contextmenu"
},
addLayer: function (e) {
return this._layers[r.stamp(e)] ? this : (e.on(r.FeatureGroup.EVENTS, this._propagateEvent, this), r.LayerGroup.prototype.addLayer.call(this, e), this._popupContent && e.bindPopup && e.bindPopup(this._popupContent, this._popupOptions), this.fire("layeradd", {
layer: e
}))
},
removeLayer: function (e) {
return e.off(r.FeatureGroup.EVENTS, this._propagateEvent, this), r.LayerGroup.prototype.removeLayer.call(this, e), this._popupContent && this.invoke("unbindPopup"), this.fire("layerremove", {
layer: e
})
},
bindPopup: function (e, t) {
return this._popupContent = e, this._popupOptions = t, this.invoke("bindPopup", e, t)
},
setStyle: function (e) {
return this.invoke("setStyle", e)
},
bringToFront: function () {
return this.invoke("bringToFront")
},
bringToBack: function () {
return this.invoke("bringToBack")
},
getBounds: function () {
var e = new r.LatLngBounds;
return this.eachLayer(function (t) {
e.extend(t instanceof r.Marker ? t.getLatLng() : t.getBounds())
}), e
},
_propagateEvent: function (e) {
e.layer = e.target, e.target = this, this.fire(e.type, e)
}
}), r.featureGroup = function (e) {
return new r.FeatureGroup(e)
}, r.Path = r.Class.extend({
includes: [r.Mixin.Events],
statics: {
CLIP_PADDING: r.Browser.mobile ? Math.max(0, Math.min(.5, (1280 / Math.max(e.innerWidth, e.innerHeight) - 1) / 2)) : .5
},
options: {
stroke: !0,
color: "#0033ff",
dashArray: null,
weight: 5,
opacity: .5,
fill: !1,
fillColor: null,
fillOpacity: .2,
clickable: !0
},
initialize: function (e) {
r.setOptions(this, e)
},
onAdd: function (e) {
this._map = e, this._container || (this._initElements(), this._initEvents()), this.projectLatlngs(), this._updatePath(), this._container && this._map._pathRoot.appendChild(this._container), this.fire("add"), e.on({
viewreset: this.projectLatlngs,
moveend: this._updatePath
}, this)
},
addTo: function (e) {
return e.addLayer(this), this
},
onRemove: function (e) {
e._pathRoot.removeChild(this._container), this.fire("remove"), this._map = null, r.Browser.vml && (this._container = null, this._stroke = null, this._fill = null), e.off({
viewreset: this.projectLatlngs,
moveend: this._updatePath
}, this)
},
projectLatlngs: function () {},
setStyle: function (e) {
return r.setOptions(this, e), this._container && this._updateStyle(), this
},
redraw: function () {
return this._map && (this.projectLatlngs(), this._updatePath()), this
}
}), r.Map.include({
_updatePathViewport: function () {
var e = r.Path.CLIP_PADDING,
t = this.getSize(),
n = r.DomUtil.getPosition(this._mapPane),
i = n.multiplyBy(-1)._subtract(t.multiplyBy(e)._round()),
s = i.add(t.multiplyBy(1 + e * 2)._round());
this._pathViewport = new r.Bounds(i, s)
}
}), r.Path.SVG_NS = "http://www.w3.org/2000/svg", r.Browser.svg = !! t.createElementNS && !! t.createElementNS(r.Path.SVG_NS, "svg").createSVGRect, r.Path = r.Path.extend({
statics: {
SVG: r.Browser.svg
},
bringToFront: function () {
var e = this._map._pathRoot,
t = this._container;
return t && e.lastChild !== t && e.appendChild(t), this
},
bringToBack: function () {
var e = this._map._pathRoot,
t = this._container,
n = e.firstChild;
return t && n !== t && e.insertBefore(t, n), this
},
getPathString: function () {},
_createElement: function (e) {
return t.createElementNS(r.Path.SVG_NS, e)
},
_initElements: function () {
this._map._initPathRoot(), this._initPath(), this._initStyle()
},
_initPath: function () {
this._container = this._createElement("g"), this._path = this._createElement("path"), this._container.appendChild(this._path)
},
_initStyle: function () {
this.options.stroke && (this._path.setAttribute("stroke-linejoin", "round"), this._path.setAttribute("stroke-linecap", "round")), this.options.fill && this._path.setAttribute("fill-rule", "evenodd"), this._updateStyle()
},
_updateStyle: function () {
this.options.stroke ? (this._path.setAttribute("stroke", this.options.color), this._path.setAttribute("stroke-opacity", this.options.opacity), this._path.setAttribute("stroke-width", this.options.weight), this.options.dashArray ? this._path.setAttribute("stroke-dasharray", this.options.dashArray) : this._path.removeAttribute("stroke-dasharray")) : this._path.setAttribute("stroke", "none"), this.options.fill ? (this._path.setAttribute("fill", this.options.fillColor || this.options.color), this._path.setAttribute("fill-opacity", this.options.fillOpacity)) : this._path.setAttribute("fill", "none")
},
_updatePath: function () {
var e = this.getPathString();
e || (e = "M0 0"), this._path.setAttribute("d", e)
},
_initEvents: function () {
if (this.options.clickable) {
(r.Browser.svg || !r.Browser.vml) && this._path.setAttribute("class", "leaflet-clickable"), r.DomEvent.on(this._container, "click", this._onMouseClick, this);
var e = ["dblclick", "mousedown", "mouseover", "mouseout", "mousemove", "contextmenu"];
for (var t = 0; t < e.length; t++) r.DomEvent.on(this._container, e[t], this._fireMouseEvent, this)
}
},
_onMouseClick: function (e) {
if (this._map.dragging && this._map.dragging.moved()) return;
this._fireMouseEvent(e)
},
_fireMouseEvent: function (e) {
if (!this.hasEventListeners(e.type)) return;
var t = this._map,
n = t.mouseEventToContainerPoint(e),
i = t.containerPointToLayerPoint(n),
s = t.layerPointToLatLng(i);
this.fire(e.type, {
latlng: s,
layerPoint: i,
containerPoint: n,
originalEvent: e
}), e.type === "contextmenu" && r.DomEvent.preventDefault(e), e.type !== "mousemove" && r.DomEvent.stopPropagation(e)
}
}), r.Map.include({
_initPathRoot: function () {
this._pathRoot || (this._pathRoot = r.Path.prototype._createElement("svg"), this._panes.overlayPane.appendChild(this._pathRoot), this.options.zoomAnimation && r.Browser.any3d ? (this._pathRoot.setAttribute("class", " leaflet-zoom-animated"), this.on({
zoomanim: this._animatePathZoom,
zoomend: this._endPathZoom
})) : this._pathRoot.setAttribute("class", " leaflet-zoom-hide"), this.on("moveend", this._updateSvgViewport), this._updateSvgViewport())
},
_animatePathZoom: function (e) {
var t = this.getZoomScale(e.zoom),
n = this._getCenterOffset(e.center)._multiplyBy(-t)._add(this._pathViewport.min);
this._pathRoot.style[r.DomUtil.TRANSFORM] = r.DomUtil.getTranslateString(n) + " scale(" + t + ") ", this._pathZooming = !0
},
_endPathZoom: function () {
this._pathZooming = !1
},
_updateSvgViewport: function () {
if (this._pathZooming) return;
this._updatePathViewport();
var e = this._pathViewport,
t = e.min,
n = e.max,
i = n.x - t.x,
s = n.y - t.y,
o = this._pathRoot,
u = this._panes.overlayPane;
r.Browser.mobileWebkit && u.removeChild(o), r.DomUtil.setPosition(o, t), o.setAttribute("width", i), o.setAttribute("height", s), o.setAttribute("viewBox", [t.x, t.y, i, s].join(" ")), r.Browser.mobileWebkit && u.appendChild(o)
}
}), r.Path.include({
bindPopup: function (e, t) {
if (!this._popup || t) this._popup = new r.Popup(t, this);
return this._popup.setContent(e), this._popupHandlersAdded || (this.on("click", this._openPopup, this).on("remove", this.closePopup, this), this._popupHandlersAdded = !0), this
},
unbindPopup: function () {
return this._popup && (this._popup = null, this.off("click", this._openPopup).off("remove", this.closePopup), this._popupHandlersAdded = !1), this
},
openPopup: function (e) {
return this._popup && (e = e || this._latlng || this._latlngs[Math.floor(this._latlngs.length / 2)], this._openPopup({
latlng: e
})), this
},
closePopup: function () {
return this._popup && this._popup._close(), this
},
_openPopup: function (e) {
this._popup.setLatLng(e.latlng), this._map.openPopup(this._popup)
}
}), r.Browser.vml = !r.Browser.svg &&
function () {
try {
var e = t.createElement("div");
e.innerHTML = '<v:shape adj="1"/>';
var n = e.firstChild;
return n.style.behavior = "url(#default#VML)", n && typeof n.adj == "object"
} catch (r) {
return !1
}
}(), r.Path = r.Browser.svg || !r.Browser.vml ? r.Path : r.Path.extend({
statics: {
VML: !0,
CLIP_PADDING: .02
},
_createElement: function () {
try {
return t.namespaces.add("lvml", "urn:schemas-microsoft-com:vml"), function (e) {
return t.createElement("<lvml:" + e + ' class="lvml">')
}
} catch (e) {
return function (e) {
return t.createElement("<" + e + ' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')
}
}
}(),
_initPath: function () {
var e = this._container = this._createElement("shape");
r.DomUtil.addClass(e, "leaflet-vml-shape"), this.options.clickable && r.DomUtil.addClass(e, "leaflet-clickable"), e.coordsize = "1 1", this._path = this._createElement("path"), e.appendChild(this._path), this._map._pathRoot.appendChild(e)
},
_initStyle: function () {
this._updateStyle()
},
_updateStyle: function () {
var e = this._stroke,
t = this._fill,
n = this.options,
r = this._container;
r.stroked = n.stroke, r.filled = n.fill, n.stroke ? (e || (e = this._stroke = this._createElement("stroke"), e.endcap = "round", r.appendChild(e)), e.weight = n.weight + "px", e.color = n.color, e.opacity = n.opacity, n.dashArray ? e.dashStyle = n.dashArray instanceof Array ? n.dashArray.join(" ") : n.dashArray.replace(/ *, */g, " ") : e.dashStyle = "") : e && (r.removeChild(e), this._stroke = null), n.fill ? (t || (t = this._fill = this._createElement("fill"), r.appendChild(t)), t.color = n.fillColor || n.color, t.opacity = n.fillOpacity) : t && (r.removeChild(t), this._fill = null)
},
_updatePath: function () {
var e = this._container.style;
e.display = "none", this._path.v = this.getPathString() + " ", e.display = ""
}
}), r.Map.include(r.Browser.svg || !r.Browser.vml ? {} : {
_initPathRoot: function () {
if (this._pathRoot) return;
var e = this._pathRoot = t.createElement("div");
e.className = "leaflet-vml-container", this._panes.overlayPane.appendChild(e), this.on("moveend", this._updatePathViewport), this._updatePathViewport()
}
}), r.Browser.canvas = function () {
return !!t.createElement("canvas").getContext
}(), r.Path = r.Path.SVG && !e.L_PREFER_CANVAS || !r.Browser.canvas ? r.Path : r.Path.extend({
statics: {
CANVAS: !0,
SVG: !1
},
redraw: function () {
return this._map && (this.projectLatlngs(), this._requestUpdate()), this
},
setStyle: function (e) {
return r.setOptions(this, e), this._map && (this._updateStyle(), this._requestUpdate()), this
},
onRemove: function (e) {
e.off("viewreset", this.projectLatlngs, this).off("moveend", this._updatePath, this), this.options.clickable && this._map.off("click", this._onClick, this), this._requestUpdate(), this._map = null
},
_requestUpdate: function () {
this._map && !r.Path._updateRequest && (r.Path._updateRequest = r.Util.requestAnimFrame(this._fireMapMoveEnd, this._map))
},
_fireMapMoveEnd: function () {
r.Path._updateRequest = null, this.fire("moveend")
},
_initElements: function () {
this._map._initPathRoot(), this._ctx = this._map._canvasCtx
},
_updateStyle: function () {
var e = this.options;
e.stroke && (this._ctx.lineWidth = e.weight, this._ctx.strokeStyle = e.color), e.fill && (this._ctx.fillStyle = e.fillColor || e.color)
},
_drawPath: function () {
var e, t, n, i, s, o;
this._ctx.beginPath();
for (e = 0, n = this._parts.length; e < n; e++) {
for (t = 0, i = this._parts[e].length; t < i; t++) s = this._parts[e][t], o = (t === 0 ? "move" : "line") + "To", this._ctx[o](s.x, s.y);
this instanceof r.Polygon && this._ctx.closePath()
}
},
_checkIfEmpty: function () {
return !this._parts.length
},
_updatePath: function () {
if (this._checkIfEmpty()) return;
var e = this._ctx,
t = this.options;
this._drawPath(), e.save(), this._updateStyle(), t.fill && (e.globalAlpha = t.fillOpacity, e.fill()), t.stroke && (e.globalAlpha = t.opacity, e.stroke()), e.restore()
},
_initEvents: function () {
this.options.clickable && this._map.on("click", this._onClick, this)
},
_onClick: function (e) {
this._containsPoint(e.layerPoint) && this.fire("click", {
latlng: e.latlng,
layerPoint: e.layerPoint,
containerPoint: e.containerPoint,
originalEvent: e
})
}
}), r.Map.include(r.Path.SVG && !e.L_PREFER_CANVAS || !r.Browser.canvas ? {} : {
_initPathRoot: function () {
var e = this._pathRoot,
n;
e || (e = this._pathRoot = t.createElement("canvas"), e.style.position = "absolute", n = this._canvasCtx = e.getContext("2d"), n.lineCap = "round", n.lineJoin = "round", this._panes.overlayPane.appendChild(e), this.options.zoomAnimation && (this._pathRoot.className = "leaflet-zoom-animated", this.on("zoomanim", this._animatePathZoom), this.on("zoomend", this._endPathZoom)), this.on("moveend", this._updateCanvasViewport), this._updateCanvasViewport())
},
_updateCanvasViewport: function () {
if (this._pathZooming) return;
this._updatePathViewport();
var e = this._pathViewport,
t = e.min,
n = e.max.subtract(t),
i = this._pathRoot;
r.DomUtil.setPosition(i, t), i.width = n.x, i.height = n.y, i.getContext("2d").translate(-t.x, -t.y)
}
}), r.LineUtil = {
simplify: function (e, t) {
if (!t || !e.length) return e.slice();
var n = t * t;
return e = this._reducePoints(e, n), e = this._simplifyDP(e, n), e
},
pointToSegmentDistance: function (e, t, n) {
return Math.sqrt(this._sqClosestPointOnSegment(e, t, n, !0))
},
closestPointOnSegment: function (e, t, n) {
return this._sqClosestPointOnSegment(e, t, n)
},
_simplifyDP: function (e, t) {
var r = e.length,
i = typeof Uint8Array != n + "" ? Uint8Array : Array,
s = new i(r);
s[0] = s[r - 1] = 1, this._simplifyDPStep(e, s, t, 0, r - 1);
var o, u = [];
for (o = 0; o < r; o++) s[o] && u.push(e[o]);
return u
},
_simplifyDPStep: function (e, t, n, r, i) {
var s = 0,
o, u, a;
for (u = r + 1; u <= i - 1; u++) a = this._sqClosestPointOnSegment(e[u], e[r], e[i], !0), a > s && (o = u, s = a);
s > n && (t[o] = 1, this._simplifyDPStep(e, t, n, r, o), this._simplifyDPStep(e, t, n, o, i))
},
_reducePoints: function (e, t) {
var n = [e[0]];
for (var r = 1, i = 0, s = e.length; r < s; r++) this._sqDist(e[r], e[i]) > t && (n.push(e[r]), i = r);
return i < s - 1 && n.push(e[s - 1]), n
},
clipSegment: function (e, t, n, r) {
var i = r ? this._lastCode : this._getBitCode(e, n),
s = this._getBitCode(t, n),
o, u, a;
this._lastCode = s;
for (;;) {
if (!(i | s)) return [e, t];
if (i & s) return !1;
o = i || s, u = this._getEdgeIntersection(e, t, o, n), a = this._getBitCode(u, n), o === i ? (e = u, i = a) : (t = u, s = a)
}
},
_getEdgeIntersection: function (e, t, n, i) {
var s = t.x - e.x,
o = t.y - e.y,
u = i.min,
a = i.max;
if (n & 8) return new r.Point(e.x + s * (a.y - e.y) / o, a.y);
if (n & 4) return new r.Point(e.x + s * (u.y - e.y) / o, u.y);
if (n & 2) return new r.Point(a.x, e.y + o * (a.x - e.x) / s);
if (n & 1) return new r.Point(u.x, e.y + o * (u.x - e.x) / s)
},
_getBitCode: function (e, t) {
var n = 0;
return e.x < t.min.x ? n |= 1 : e.x > t.max.x && (n |= 2), e.y < t.min.y ? n |= 4 : e.y > t.max.y && (n |= 8), n
},
_sqDist: function (e, t) {
var n = t.x - e.x,
r = t.y - e.y;
return n * n + r * r
},
_sqClosestPointOnSegment: function (e, t, n, i) {
var s = t.x,
o = t.y,
u = n.x - s,
a = n.y - o,
f = u * u + a * a,
l;
return f > 0 && (l = ((e.x - s) * u + (e.y - o) * a) / f, l > 1 ? (s = n.x, o = n.y) : l > 0 && (s += u * l, o += a * l)), u = e.x - s, a = e.y - o, i ? u * u + a * a : new r.Point(s, o)
}
}, r.Polyline = r.Path.extend({
initialize: function (e, t) {
r.Path.prototype.initialize.call(this, t), this._latlngs = this._convertLatLngs(e)
},
options: {
smoothFactor: 1,
noClip: !1
},
projectLatlngs: function () {
this._originalPoints = [];
for (var e = 0, t = this._latlngs.length; e < t; e++) this._originalPoints[e] = this._map.latLngToLayerPoint(this._latlngs[e])
},
getPathString: function () {
for (var e = 0, t = this._parts.length, n = ""; e < t; e++) n += this._getPathPartStr(this._parts[e]);
return n
},
getLatLngs: function () {
return this._latlngs
},
setLatLngs: function (e) {
return this._latlngs = this._convertLatLngs(e), this.redraw()
},
addLatLng: function (e) {
return this._latlngs.push(r.latLng(e)), this.redraw()
},
spliceLatLngs: function () {
var e = [].splice.apply(this._latlngs, arguments);
return this._convertLatLngs(this._latlngs), this.redraw(), e
},
closestLayerPoint: function (e) {
var t = Infinity,
n = this._parts,
i, s, o = null;
for (var u = 0, a = n.length; u < a; u++) {
var f = n[u];
for (var l = 1, c = f.length; l < c; l++) {
i = f[l - 1], s = f[l];
var h = r.LineUtil._sqClosestPointOnSegment(e, i, s, !0);
h < t && (t = h, o = r.LineUtil._sqClosestPointOnSegment(e, i, s))
}
}
return o && (o.distance = Math.sqrt(t)), o
},
getBounds: function () {
var e = new r.LatLngBounds,
t = this.getLatLngs(),
n, i;
for (n = 0, i = t.length; n < i; n++) e.extend(t[n]);
return e
},
_convertLatLngs: function (e) {
var t, n;
for (t = 0, n = e.length; t < n; t++) {
if (r.Util.isArray(e[t]) && typeof e[t][0] != "number") return;
e[t] = r.latLng(e[t])
}
return e
},
_initEvents: function () {
r.Path.prototype._initEvents.call(this)
},
_getPathPartStr: function (e) {
var t = r.Path.VML;
for (var n = 0, i = e.length, s = "", o; n < i; n++) o = e[n], t && o._round(), s += (n ? "L" : "M") + o.x + " " + o.y;
return s
},
_clipPoints: function () {
var e = this._originalPoints,
t = e.length,
n, i, s;
if (this.options.noClip) {
this._parts = [e];
return
}
this._parts = [];
var o = this._parts,
u = this._map._pathViewport,
a = r.LineUtil;
for (n = 0, i = 0; n < t - 1; n++) {
s = a.clipSegment(e[n], e[n + 1], u, n);
if (!s) continue;
o[i] = o[i] || [], o[i].push(s[0]);
if (s[1] !== e[n + 1] || n === t - 2) o[i].push(s[1]), i++
}
},
_simplifyPoints: function () {
var e = this._parts,
t = r.LineUtil;
for (var n = 0, i = e.length; n < i; n++) e[n] = t.simplify(e[n], this.options.smoothFactor)
},
_updatePath: function () {
if (!this._map) return;
this._clipPoints(), this._simplifyPoints(), r.Path.prototype._updatePath.call(this)
}
}), r.polyline = function (e, t) {
return new r.Polyline(e, t)
}, r.PolyUtil = {}, r.PolyUtil.clipPolygon = function (e, t) {
var n, i = [1, 4, 2, 8],
s, o, u, a, f, l, c, h, p = r.LineUtil;
for (s = 0, l = e.length; s < l; s++) e[s]._code = p._getBitCode(e[s], t);
for (u = 0; u < 4; u++) {
c = i[u], n = [];
for (s = 0, l = e.length, o = l - 1; s < l; o = s++) a = e[s], f = e[o], a._code & c ? f._code & c || (h = p._getEdgeIntersection(f, a, c, t), h._code = p._getBitCode(h, t), n.push(h)) : (f._code & c && (h = p._getEdgeIntersection(f, a, c, t), h._code = p._getBitCode(h, t), n.push(h)), n.push(a));
e = n
}
return e
}, r.Polygon = r.Polyline.extend({
options: {
fill: !0
},
initialize: function (e, t) {
r.Polyline.prototype.initialize.call(this, e, t), e && r.Util.isArray(e[0]) && typeof e[0][0] != "number" && (this._latlngs = this._convertLatLngs(e[0]), this._holes = e.slice(1))
},
projectLatlngs: function () {
r.Polyline.prototype.projectLatlngs.call(this), this._holePoints = [];
if (!this._holes) return;
var e, t, n, i;
for (e = 0, n = this._holes.length; e < n; e++) {
this._holePoints[e] = [];
for (t = 0, i = this._holes[e].length; t < i; t++) this._holePoints[e][t] = this._map.latLngToLayerPoint(this._holes[e][t])
}
},
_clipPoints: function () {
var e = this._originalPoints,
t = [];
this._parts = [e].concat(this._holePoints);
if (this.options.noClip) return;
for (var n = 0, i = this._parts.length; n < i; n++) {
var s = r.PolyUtil.clipPolygon(this._parts[n], this._map._pathViewport);
s.length && t.push(s)
}
this._parts = t
},
_getPathPartStr: function (e) {
var t = r.Polyline.prototype._getPathPartStr.call(this, e);
return t + (r.Browser.svg ? "z" : "x")
}
}), r.polygon = function (e, t) {
return new r.Polygon(e, t)
}, function () {
function e(e) {
return r.FeatureGroup.extend({
initialize: function (e, t) {
this._layers = {}, this._options = t, this.setLatLngs(e)
},
setLatLngs: function (t) {
var n = 0,
r = t.length;
this.eachLayer(function (e) {
n < r ? e.setLatLngs(t[n++]) : this.removeLayer(e)
}, this);
while (n < r) this.addLayer(new e(t[n++], this._options));
return this
}
})
}
r.MultiPolyline = e(r.Polyline), r.MultiPolygon = e(r.Polygon), r.multiPolyline = function (e, t) {
return new r.MultiPolyline(e, t)
}, r.multiPolygon = function (e, t) {
return new r.MultiPolygon(e, t)
}
}(), r.Rectangle = r.Polygon.extend({
initialize: function (e, t) {
r.Polygon.prototype.initialize.call(this, this._boundsToLatLngs(e), t)
},
setBounds: function (e) {
this.setLatLngs(this._boundsToLatLngs(e))
},
_boundsToLatLngs: function (e) {
return e = r.latLngBounds(e), [e.getSouthWest(), e.getNorthWest(), e.getNorthEast(), e.getSouthEast()]
}
}), r.rectangle = function (e, t) {
return new r.Rectangle(e, t)
}, r.Circle = r.Path.extend({
initialize: function (e, t, n) {
r.Path.prototype.initialize.call(this, n), this._latlng = r.latLng(e), this._mRadius = t
},
options: {
fill: !0
},
setLatLng: function (e) {
return this._latlng = r.latLng(e), this.redraw()
},
setRadius: function (e) {
return this._mRadius = e, this.redraw()
},
projectLatlngs: function () {
var e = this._getLngRadius(),
t = new r.LatLng(this._latlng.lat, this._latlng.lng - e),
n = this._map.latLngToLayerPoint(t);
this._point = this._map.latLngToLayerPoint(this._latlng), this._radius = Math.max(Math.round(this._point.x - n.x), 1)
},
getBounds: function () {
var e = this._getLngRadius(),
t = this._mRadius / 40075017 * 360,
n = this._latlng,
i = new r.LatLng(n.lat - t, n.lng - e),
s = new r.LatLng(n.lat + t, n.lng + e);
return new r.LatLngBounds(i, s)
},
getLatLng: function () {
return this._latlng
},
getPathString: function () {
var e = this._point,
t = this._radius;
return this._checkIfEmpty() ? "" : r.Browser.svg ? "M" + e.x + "," + (e.y - t) + "A" + t + "," + t + ",0,1,1," + (e.x - .1) + "," + (e.y - t) + " z" : (e._round(), t = Math.round(t), "AL " + e.x + "," + e.y + " " + t + "," + t + " 0," + 23592600)
},
getRadius: function () {
return this._mRadius
},
_getLatRadius: function () {
return this._mRadius / 40075017 * 360
},
_getLngRadius: function () {
return this._getLatRadius() / Math.cos(r.LatLng.DEG_TO_RAD * this._latlng.lat)
},
_checkIfEmpty: function () {
if (!this._map) return !1;
var e = this._map._pathViewport,
t = this._radius,
n = this._point;
return n.x - t > e.max.x || n.y - t > e.max.y || n.x + t < e.min.x || n.y + t < e.min.y
}
}), r.circle = function (e, t, n) {
return new r.Circle(e, t, n)
}, r.CircleMarker = r.Circle.extend({
options: {
radius: 10,
weight: 2
},
initialize: function (e, t) {
r.Circle.prototype.initialize.call(this, e, null, t), this._radius = this.options.radius
},
projectLatlngs: function () {
this._point = this._map.latLngToLayerPoint(this._latlng)
},
_updateStyle: function () {
r.Circle.prototype._updateStyle.call(this), this.setRadius(this.options.radius)
},
setRadius: function (e) {
return this.options.radius = this._radius = e, this.redraw()
}
}), r.circleMarker = function (e, t) {
return new r.CircleMarker(e, t)
}, r.Polyline.include(r.Path.CANVAS ? {
_containsPoint: function (e, t) {
var n, i, s, o, u, a, f, l = this.options.weight / 2;
r.Browser.touch && (l += 10);
for (n = 0, o = this._parts.length; n < o; n++) {
f = this._parts[n];
for (i = 0, u = f.length, s = u - 1; i < u; s = i++) {
if (!t && i === 0) continue;
a = r.LineUtil.pointToSegmentDistance(e, f[s], f[i]);
if (a <= l) return !0
}
}
return !1
}
} : {}), r.Polygon.include(r.Path.CANVAS ? {
_containsPoint: function (e) {
var t = !1,
n, i, s, o, u, a, f, l;
if (r.Polyline.prototype._containsPoint.call(this, e, !0)) return !0;
for (o = 0, f = this._parts.length; o < f; o++) {
n = this._parts[o];
for (u = 0, l = n.length, a = l - 1; u < l; a = u++) i = n[u], s = n[a], i.y > e.y != s.y > e.y && e.x < (s.x - i.x) * (e.y - i.y) / (s.y - i.y) + i.x && (t = !t)
}
return t
}
} : {}), r.Circle.include(r.Path.CANVAS ? {
_drawPath: function () {
var e = this._point;
this._ctx.beginPath(), this._ctx.arc(e.x, e.y, this._radius, 0, Math.PI * 2, !1)
},
_containsPoint: function (e) {
var t = this._point,
n = this.options.stroke ? this.options.weight / 2 : 0;
return e.distanceTo(t) <= this._radius + n
}
} : {}), r.GeoJSON = r.FeatureGroup.extend({
initialize: function (e, t) {
r.setOptions(this, t), this._layers = {}, e && this.addData(e)
},
addData: function (e) {
var t = e instanceof Array ? e : e.features,
n, i;
if (t) {
for (n = 0, i = t.length; n < i; n++)(t[n].geometries || t[n].geometry) && this.addData(t[n]);
return this
}
var s = this.options;
if (s.filter && !s.filter(e)) return;
var o = r.GeoJSON.geometryToLayer(e, s.pointToLayer);
return o.feature = e, o.defaultOptions = o.options, this.resetStyle(o), s.onEachFeature && s.onEachFeature(e, o), this.addLayer(o)
},
resetStyle: function (e) {
var t = this.options.style;
t && (r.Util.extend(e.options, e.defaultOptions), this._setLayerStyle(e, t))
},
setStyle: function (e) {
this.eachLayer(function (t) {
this._setLayerStyle(t, e)
}, this)
},
_setLayerStyle: function (e, t) {
typeof t == "function" && (t = t(e.feature)), e.setStyle && e.setStyle(t)
}
}), r.extend(r.GeoJSON, {
geometryToLayer: function (e, t) {
var n = e.type === "Feature" ? e.geometry : e,
i = n.coordinates,
s = [],
o, u, a, f, l;
switch (n.type) {
case "Point":
return o = this.coordsToLatLng(i), t ? t(e, o) : new r.Marker(o);
case "MultiPoint":
for (a = 0, f = i.length; a < f; a++) o = this.coordsToLatLng(i[a]), l = t ? t(e, o) : new r.Marker(o), s.push(l);
return new r.FeatureGroup(s);
case "LineString":
return u = this.coordsToLatLngs(i), new r.Polyline(u);
case "Polygon":
return u = this.coordsToLatLngs(i, 1), u = this.removeLastPoint(u, 0), new r.Polygon(u);
case "MultiLineString":
return u = this.coordsToLatLngs(i, 1), new r.MultiPolyline(u);
case "MultiPolygon":
return u = this.coordsToLatLngs(i, 2), u = this.removeLastPoint(u, 1), new r.MultiPolygon(u);
case "GeometryCollection":
for (a = 0, f = n.geometries.length; a < f; a++) l = this.geometryToLayer(n.geometries[a], t), s.push(l);
return new r.FeatureGroup(s);
default:
throw new Error("Invalid GeoJSON object.")
}
},
removeLastPoint: function (e, t) {
var n, r = [],
i, s;
for (i = 0, s = e.length; i < s; i++) n = t ? this.removeLastPoint(e[i], t - 1) : e[i].slice(0, e[i].length - 1), r.push(n);
return r
},
coordsToLatLng: function (e, t) {
var n = parseFloat(e[t ? 0 : 1]),
i = parseFloat(e[t ? 1 : 0]);
return new r.LatLng(n, i)
},
coordsToLatLngs: function (e, t, n) {
var r, i = [],
s, o;
for (s = 0, o = e.length; s < o; s++) r = t ? this.coordsToLatLngs(e[s], t - 1, n) : this.coordsToLatLng(e[s], n), i.push(r);
return i
}
}), r.geoJson = function (e, t) {
return new r.GeoJSON(e, t)
}, r.DomEvent = {
addListener: function (e, t, n, i) {
var s = r.stamp(n),
o = "_leaflet_" + t + s,
u, a, f;
return e[o] ? this : (u = function (t) {
return n.call(i || e, t || r.DomEvent._getEvent())
}, r.Browser.msTouch && t.indexOf("touch") === 0 ? this.addMsTouchListener(e, t, u, s) : (r.Browser.touch && t === "dblclick" && this.addDoubleTapListener && this.addDoubleTapListener(e, u, s), "addEventListener" in e ? t === "mousewheel" ? (e.addEventListener("DOMMouseScroll", u, !1), e.addEventListener(t, u, !1)) : t === "mouseenter" || t === "mouseleave" ? (a = u, f = t === "mouseenter" ? "mouseover" : "mouseout", u = function (t) {
if (!r.DomEvent._checkMouse(e, t)) return;
return a(t)
}, e.addEventListener(f, u, !1)) : e.addEventListener(t, u, !1) : "attachEvent" in e && e.attachEvent("on" + t, u), e[o] = u, this))
},
removeListener: function (e, t, n) {
var i = r.stamp(n),
s = "_leaflet_" + t + i,
o = e[s];
if (!o) return;
return r.Browser.msTouch && t.indexOf("touch") === 0 ? this.removeMsTouchListener(e, t, i) : r.Browser.touch && t === "dblclick" && this.removeDoubleTapListener ? this.removeDoubleTapListener(e, i) : "removeEventListener" in e ? t === "mousewheel" ? (e.removeEventListener("DOMMouseScroll", o, !1), e.removeEventListener(t, o, !1)) : t === "mouseenter" || t === "mouseleave" ? e.removeEventListener(t === "mouseenter" ? "mouseover" : "mouseout", o, !1) : e.removeEventListener(t, o, !1) : "detachEvent" in e && e.detachEvent("on" + t, o), e[s] = null, this
},
stopPropagation: function (e) {
return e.stopPropagation ? e.stopPropagation() : e.cancelBubble = !0, this
},
disableClickPropagation: function (e) {
var t = r.DomEvent.stopPropagation;
for (var n = r.Draggable.START.length - 1; n >= 0; n--) r.DomEvent.addListener(e, r.Draggable.START[n], t);
return r.DomEvent.addListener(e, "click", t).addListener(e, "dblclick", t)
},
preventDefault: function (e) {
return e.preventDefault ? e.preventDefault() : e.returnValue = !1, this
},
stop: function (e) {
return r.DomEvent.preventDefault(e).stopPropagation(e)
},
getMousePosition: function (e, n) {
var i = t.body,
s = t.documentElement,
o = e.pageX ? e.pageX : e.clientX + i.scrollLeft + s.scrollLeft,
u = e.pageY ? e.pageY : e.clientY + i.scrollTop + s.scrollTop,
a = new r.Point(o, u);
return n ? a._subtract(r.DomUtil.getViewportOffset(n)) : a
},
getWheelDelta: function (e) {
var t = 0;
return e.wheelDelta && (t = e.wheelDelta / 120), e.detail && (t = -e.detail / 3), t
},
_checkMouse: function (e, t) {
var n = t.relatedTarget;
if (!n) return !0;
try {
while (n && n !== e) n = n.parentNode
} catch (r) {
return !1
}
return n !== e
},
_getEvent: function () {
var t = e.event;
if (!t) {
var n = arguments.callee.caller;
while (n) {
t = n.arguments[0];
if (t && e.Event === t.constructor) break;
n = n.caller
}
}
return t
}
}, r.DomEvent.on = r.DomEvent.addListener, r.DomEvent.off = r.DomEvent.removeListener, r.Draggable = r.Class.extend({
includes: r.Mixin.Events,
statics: {
START: r.Browser.touch ? ["touchstart", "mousedown"] : ["mousedown"],
END: {
mousedown: "mouseup",
touchstart: "touchend",
MSPointerDown: "touchend"
},
MOVE: {
mousedown: "mousemove",
touchstart: "touchmove",
MSPointerDown: "touchmove"
},
TAP_TOLERANCE: 15
},
initialize: function (e, t, n) {
this._element = e, this._dragStartTarget = t || e, this._longPress = n && !r.Browser.msTouch
},
enable: function () {
if (this._enabled) return;
for (var e = r.Draggable.START.length - 1; e >= 0; e--) r.DomEvent.on(this._dragStartTarget, r.Draggable.START[e], this._onDown, this);
this._enabled = !0
},
disable: function () {
if (!this._enabled) return;
for (var e = r.Draggable.START.length - 1; e >= 0; e--) r.DomEvent.off(this._dragStartTarget, r.Draggable.START[e], this._onDown, this);
this._enabled = !1, this._moved = !1
},
_onDown: function (e) {
if (!r.Browser.touch && e.shiftKey || e.which !== 1 && e.button !== 1 && !e.touches) return;
r.DomEvent.preventDefault(e), r.DomEvent.stopPropagation(e);
if (r.Draggable._disabled) return;
this._simulateClick = !0;
if (e.touches && e.touches.length > 1) {
this._simulateClick = !1, clearTimeout(this._longPressTimeout);
return
}
var n = e.touches && e.touches.length === 1 ? e.touches[0] : e,
i = n.target;
r.Browser.touch && i.tagName.toLowerCase() === "a" && r.DomUtil.addClass(i, "leaflet-active"), this._moved = !1;
if (this._moving) return;
this._startPoint = new r.Point(n.clientX, n.clientY), this._startPos = this._newPos = r.DomUtil.getPosition(this._element), e.touches && e.touches.length === 1 && r.Browser.touch && this._longPress && (this._longPressTimeout = setTimeout(r.bind(function () {
var e = this._newPos && this._newPos.distanceTo(this._startPos) || 0;
e < r.Draggable.TAP_TOLERANCE && (this._simulateClick = !1, this._onUp(), this._simulateEvent("contextmenu", n))
}, this), 1e3)), r.DomEvent.on(t, r.Draggable.MOVE[e.type], this._onMove, this), r.DomEvent.on(t, r.Draggable.END[e.type], this._onUp, this)
},
_onMove: function (e) {
if (e.touches && e.touches.length > 1) return;
var t = e.touches && e.touches.length === 1 ? e.touches[0] : e,
n = new r.Point(t.clientX, t.clientY),
i = n.subtract(this._startPoint);
if (!i.x && !i.y) return;
r.DomEvent.preventDefault(e), this._moved || (this.fire("dragstart"), this._moved = !0, this._startPos = r.DomUtil.getPosition(this._element).subtract(i), r.Browser.touch || (r.DomUtil.disableTextSelection(), this._setMovingCursor())), this._newPos = this._startPos.add(i), this._moving = !0, r.Util.cancelAnimFrame(this._animRequest), this._animRequest = r.Util.requestAnimFrame(this._updatePosition, this, !0, this._dragStartTarget)
},
_updatePosition: function () {
this.fire("predrag"), r.DomUtil.setPosition(this._element, this._newPos), this.fire("drag")
},
_onUp: function (e) {
var n;
clearTimeout(this._longPressTimeout);
if (this._simulateClick && e.changedTouches) {
var i = e.changedTouches[0],
s = i.target,
o = this._newPos && this._newPos.distanceTo(this._startPos) || 0;
s.tagName.toLowerCase() === "a" && r.DomUtil.removeClass(s, "leaflet-active"), o < r.Draggable.TAP_TOLERANCE && (n = i)
}
r.Browser.touch || (r.DomUtil.enableTextSelection(), this._restoreCursor());
for (var u in r.Draggable.MOVE) r.Draggable.MOVE.hasOwnProperty(u) && (r.DomEvent.off(t, r.Draggable.MOVE[u], this._onMove), r.DomEvent.off(t, r.Draggable.END[u], this._onUp));
this._moved && (r.Util.cancelAnimFrame(this._animRequest), this.fire("dragend")), this._moving = !1, n && (this._moved = !1, this._simulateEvent("click", n))
},
_setMovingCursor: function () {
r.DomUtil.addClass(t.body, "leaflet-dragging")
},
_restoreCursor: function () {
r.DomUtil.removeClass(t.body, "leaflet-dragging")
},
_simulateEvent: function (n, r) {
var i = t.createEvent("MouseEvents");
i.initMouseEvent(n, !0, !0, e, 1, r.screenX, r.screenY, r.clientX, r.clientY, !1, !1, !1, !1, 0, null), r.target.dispatchEvent(i)
}
}), r.Handler = r.Class.extend({
initialize: function (e) {
this._map = e
},
enable: function () {
if (this._enabled) return;
this._enabled = !0, this.addHooks()
},
disable: function () {
if (!this._enabled) return;
this._enabled = !1, this.removeHooks()
},
enabled: function () {
return !!this._enabled
}
}), r.Map.mergeOptions({
dragging: !0,
inertia: !r.Browser.android23,
inertiaDeceleration: 3400,
inertiaMaxSpeed: Infinity,
inertiaThreshold: r.Browser.touch ? 32 : 18,
easeLinearity: .25,
longPress: !0,
worldCopyJump: !1
}), r.Map.Drag = r.Handler.extend({
addHooks: function () {
if (!this._draggable) {
var e = this._map;
this._draggable = new r.Draggable(e._mapPane, e._container, e.options.longPress), this._draggable.on({
dragstart: this._onDragStart,
drag: this._onDrag,
dragend: this._onDragEnd
}, this), e.options.worldCopyJump && (this._draggable.on("predrag", this._onPreDrag, this), e.on("viewreset", this._onViewReset, this))
}
this._draggable.enable()
},
removeHooks: function () {
this._draggable.disable()
},
moved: function () {
return this._draggable && this._draggable._moved
},
_onDragStart: function () {
var e = this._map;
e._panAnim && e._panAnim.stop(), e.fire("movestart").fire("dragstart"), e.options.inertia && (this._positions = [], this._times = [])
},
_onDrag: function () {
if (this._map.options.inertia) {
var e = this._lastTime = +(new Date),
t = this._lastPos = this._draggable._newPos;
this._positions.push(t), this._times.push(e), e - this._times[0] > 200 && (this._positions.shift(), this._times.shift())
}
this._map.fire("move").fire("drag")
},
_onViewReset: function () {
var e = this._map.getSize()._divideBy(2),
t = this._map.latLngToLayerPoint(new r.LatLng(0, 0));
this._initialWorldOffset = t.subtract(e).x, this._worldWidth = this._map.project(new r.LatLng(0, 180)).x
},
_onPreDrag: function () {
var e = this._worldWidth,
t = Math.round(e / 2),
n = this._initialWorldOffset,
r = this._draggable._newPos.x,
i = (r - t + n) % e + t - n,
s = (r + t + n) % e - t - n,
o = Math.abs(i + n) < Math.abs(s + n) ? i : s;
this._draggable._newPos.x = o
},
_onDragEnd: function () {
var e = this._map,
t = e.options,
n = +(new Date) - this._lastTime,
i = !t.inertia || n > t.inertiaThreshold || !this._positions[0];
if (i) e.fire("moveend");
else {
var s = this._lastPos.subtract(this._positions[0]),
o = (this._lastTime + n - this._times[0]) / 1e3,
u = t.easeLinearity,
a = s.multiplyBy(u / o),
f = a.distanceTo(new r.Point(0, 0)),
l = Math.min(t.inertiaMaxSpeed, f),
c = a.multiplyBy(l / f),
h = l / (t.inertiaDeceleration * u),
p = c.multiplyBy(-h / 2).round();
r.Util.requestAnimFrame(function () {
e.panBy(p, h, u)
})
}
e.fire("dragend"), t.maxBounds && r.Util.requestAnimFrame(this._panInsideMaxBounds, e, !0, e._container)
},
_panInsideMaxBounds: function () {
this.panInsideBounds(this.options.maxBounds)
}
}), r.Map.addInitHook("addHandler", "dragging", r.Map.Drag), r.Map.mergeOptions({
doubleClickZoom: !0
}), r.Map.DoubleClickZoom = r.Handler.extend({
addHooks: function () {
this._map.on("dblclick", this._onDoubleClick)
},
removeHooks: function () {
this._map.off("dblclick", this._onDoubleClick)
},
_onDoubleClick: function (e) {
this.setView(e.latlng, this._zoom + 1)
}
}), r.Map.addInitHook("addHandler", "doubleClickZoom", r.Map.DoubleClickZoom), r.Map.mergeOptions({
scrollWheelZoom: !0
}), r.Map.ScrollWheelZoom = r.Handler.extend({
addHooks: function () {
r.DomEvent.on(this._map._container, "mousewheel", this._onWheelScroll, this), this._delta = 0
},
removeHooks: function () {
r.DomEvent.off(this._map._container, "mousewheel", this._onWheelScroll)
},
_onWheelScroll: function (e) {
var t = r.DomEvent.getWheelDelta(e);
this._delta += t, this._lastMousePos = this._map.mouseEventToContainerPoint(e), this._startTime || (this._startTime = +(new Date));
var n = Math.max(40 - (+(new Date) - this._startTime), 0);
clearTimeout(this._timer), this._timer = setTimeout(r.bind(this._performZoom, this), n), r.DomEvent.preventDefault(e), r.DomEvent.stopPropagation(e)
},
_performZoom: function () {
var e = this._map,
t = this._delta,
n = e.getZoom();
t = t > 0 ? Math.ceil(t) : Math.round(t), t = Math.max(Math.min(t, 4), -4), t = e._limitZoom(n + t) - n, this._delta = 0, this._startTime = null;
if (!t) return;
var r = n + t,
i = this._getCenterForScrollWheelZoom(r);
e.setView(i, r)
},
_getCenterForScrollWheelZoom: function (e) {
var t = this._map,
n = t.getZoomScale(e),
r = t.getSize()._divideBy(2),
i = this._lastMousePos._subtract(r)._multiplyBy(1 - 1 / n),
s = t._getTopLeftPoint()._add(r)._add(i);
return t.unproject(s)
}
}), r.Map.addInitHook("addHandler", "scrollWheelZoom", r.Map.ScrollWheelZoom), r.extend(r.DomEvent, {
_touchstart: r.Browser.msTouch ? "MSPointerDown" : "touchstart",
_touchend: r.Browser.msTouch ? "MSPointerUp" : "touchend",
addDoubleTapListener: function (e, n, i) {
function p(e) {
var t;
r.Browser.msTouch ? (h.push(e.pointerId), t = h.length) : t = e.touches.length;
if (t > 1) return;
var n = Date.now(),
i = n - (s || n);
a = e.touches ? e.touches[0] : e, o = i > 0 && i <= u, s = n
}
function d(e) {
if (r.Browser.msTouch) {
var t = h.indexOf(e.pointerId);
if (t === -1) return;
h.splice(t, 1)
}
if (o) {
if (r.Browser.msTouch) {
var i = {},
u;
for (var f in a) u = a[f], typeof u == "function" ? i[f] = u.bind(a) : i[f] = u;
a = i
}
a.type = "dblclick", n(a), s = null
}
}
var s, o = !1,
u = 250,
a, f = "_leaflet_",
l = this._touchstart,
c = this._touchend,
h = [];
e[f + l + i] = p, e[f + c + i] = d;
var v = r.Browser.msTouch ? t.documentElement : e;
return e.addEventListener(l, p, !1), v.addEventListener(c, d, !1), r.Browser.msTouch && v.addEventListener("MSPointerCancel", d, !1), this
},
removeDoubleTapListener: function (e, n) {
var i = "_leaflet_";
return e.removeEventListener(this._touchstart, e[i + this._touchstart + n], !1), (r.Browser.msTouch ? t.documentElement : e).removeEventListener(this._touchend, e[i + this._touchend + n], !1), r.Browser.msTouch && t.documentElement.removeEventListener("MSPointerCancel", e[i + this._touchend + n], !1), this
}
}), r.extend(r.DomEvent, {
_msTouches: [],
_msDocumentListener: !1,
addMsTouchListener: function (e, t, n, r) {
switch (t) {
case "touchstart":
return this.addMsTouchListenerStart(e, t, n, r);
case "touchend":
return this.addMsTouchListenerEnd(e, t, n, r);
case "touchmove":
return this.addMsTouchListenerMove(e, t, n, r);
default:
throw "Unknown touch event type"
}
},
addMsTouchListenerStart: function (e, n, r, i) {
var s = "_leaflet_",
o = this._msTouches,
u = function (e) {
var t = !1;
for (var n = 0; n < o.length; n++) if (o[n].pointerId === e.pointerId) {
t = !0;
break
}
t || o.push(e), e.touches = o.slice(), e.changedTouches = [e], r(e)
};
e[s + "touchstart" + i] = u, e.addEventListener("MSPointerDown", u, !1);
if (!this._msDocumentListener) {
var a = function (e) {
for (var t = 0; t < o.length; t++) if (o[t].pointerId === e.pointerId) {
o.splice(t, 1);
break
}
};
t.documentElement.addEventListener("MSPointerUp", a, !1), t.documentElement.addEventListener("MSPointerCancel", a, !1), this._msDocumentListener = !0
}
return this
},
addMsTouchListenerMove: function (e, t, n, r) {
function o(e) {
if (e.pointerType === e.MSPOINTER_TYPE_MOUSE && e.buttons === 0) return;
for (var t = 0; t < s.length; t++) if (s[t].pointerId === e.pointerId) {
s[t] = e;
break
}
e.touches = s.slice(), e.changedTouches = [e], n(e)
}
var i = "_leaflet_",
s = this._msTouches;
return e[i + "touchmove" + r] = o, e.addEventListener("MSPointerMove", o, !1), this
},
addMsTouchListenerEnd: function (e, t, n, r) {
var i = "_leaflet_",
s = this._msTouches,
o = function (e) {
for (var t = 0; t < s.length; t++) if (s[t].pointerId === e.pointerId) {
s.splice(t, 1);
break
}
e.touches = s.slice(), e.changedTouches = [e], n(e)
};
return e[i + "touchend" + r] = o, e.addEventListener("MSPointerUp", o, !1), e.addEventListener("MSPointerCancel", o, !1), this
},
removeMsTouchListener: function (e, t, n) {
var r = "_leaflet_",
i = e[r + t + n];
switch (t) {
case "touchstart":
e.removeEventListener("MSPointerDown", i, !1);
break;
case "touchmove":
e.removeEventListener("MSPointerMove", i, !1);
break;
case "touchend":
e.removeEventListener("MSPointerUp", i, !1), e.removeEventListener("MSPointerCancel", i, !1)
}
return this
}
}), r.Map.mergeOptions({
touchZoom: r.Browser.touch && !r.Browser.android23
}), r.Map.TouchZoom = r.Handler.extend({
addHooks: function () {
r.DomEvent.on(this._map._container, "touchstart", this._onTouchStart, this)
},
removeHooks: function () {
r.DomEvent.off(this._map._container, "touchstart", this._onTouchStart, this)
},
_onTouchStart: function (e) {
var n = this._map;
if (!e.touches || e.touches.length !== 2 || n._animatingZoom || this._zooming) return;
var i = n.mouseEventToLayerPoint(e.touches[0]),
s = n.mouseEventToLayerPoint(e.touches[1]),
o = n._getCenterLayerPoint();
this._startCenter = i.add(s)._divideBy(2), this._startDist = i.distanceTo(s), this._moved = !1, this._zooming = !0, this._centerOffset = o.subtract(this._startCenter), n._panAnim && n._panAnim.stop(), r.DomEvent.on(t, "touchmove", this._onTouchMove, this).on(t, "touchend", this._onTouchEnd, this), r.DomEvent.preventDefault(e)
},
_onTouchMove: function (e) {
if (!e.touches || e.touches.length !== 2) return;
var t = this._map,
n = t.mouseEventToLayerPoint(e.touches[0]),
i = t.mouseEventToLayerPoint(e.touches[1]);
this._scale = n.distanceTo(i) / this._startDist, this._delta = n._add(i)._divideBy(2)._subtract(this._startCenter);
if (this._scale === 1) return;
this._moved || (r.DomUtil.addClass(t._mapPane, "leaflet-zoom-anim leaflet-touching"), t.fire("movestart").fire("zoomstart")._prepareTileBg(), this._moved = !0), r.Util.cancelAnimFrame(this._animRequest), this._animRequest = r.Util.requestAnimFrame(this._updateOnMove, this, !0, this._map._container), r.DomEvent.preventDefault(e)
},
_updateOnMove: function () {
var e = this._map,
t = this._getScaleOrigin(),
n = e.layerPointToLatLng(t);
e.fire("zoomanim", {
center: n,
zoom: e.getScaleZoom(this._scale)
}), e._tileBg.style[r.DomUtil.TRANSFORM] = r.DomUtil.getTranslateString(this._delta) + " " + r.DomUtil.getScaleString(this._scale, this._startCenter)
},
_onTouchEnd: function () {
if (!this._moved || !this._zooming) return;
var e = this._map;
this._zooming = !1, r.DomUtil.removeClass(e._mapPane, "leaflet-touching"), r.DomEvent.off(t, "touchmove", this._onTouchMove).off(t, "touchend", this._onTouchEnd);
var n = this._getScaleOrigin(),
i = e.layerPointToLatLng(n),
s = e.getZoom(),
o = e.getScaleZoom(this._scale) - s,
u = o > 0 ? Math.ceil(o) : Math.floor(o),
a = e._limitZoom(s + u);
e.fire("zoomanim", {
center: i,
zoom: a
}), e._runAnimation(i, a, e.getZoomScale(a) / this._scale, n, !0)
},
_getScaleOrigin: function () {
var e = this._centerOffset.subtract(this._delta).divideBy(this._scale);
return this._startCenter.add(e)
}
}), r.Map.addInitHook("addHandler", "touchZoom", r.Map.TouchZoom), r.Map.mergeOptions({
boxZoom: !0
}), r.Map.BoxZoom = r.Handler.extend({
initialize: function (e) {
this._map = e, this._container = e._container, this._pane = e._panes.overlayPane
},
addHooks: function () {
r.DomEvent.on(this._container, "mousedown", this._onMouseDown, this)
},
removeHooks: function () {
r.DomEvent.off(this._container, "mousedown", this._onMouseDown)
},
_onMouseDown: function (e) {
if (!e.shiftKey || e.which !== 1 && e.button !== 1) return !1;
r.DomUtil.disableTextSelection(), this._startLayerPoint = this._map.mouseEventToLayerPoint(e), this._box = r.DomUtil.create("div", "leaflet-zoom-box", this._pane), r.DomUtil.setPosition(this._box, this._startLayerPoint), this._container.style.cursor = "crosshair", r.DomEvent.on(t, "mousemove", this._onMouseMove, this).on(t, "mouseup", this._onMouseUp, this).preventDefault(e), this._map.fire("boxzoomstart")
},
_onMouseMove: function (e) {
var t = this._startLayerPoint,
n = this._box,
i = this._map.mouseEventToLayerPoint(e),
s = i.subtract(t),
o = new r.Point(Math.min(i.x, t.x), Math.min(i.y, t.y));
r.DomUtil.setPosition(n, o), n.style.width = Math.max(0, Math.abs(s.x) - 4) + "px", n.style.height = Math.max(0, Math.abs(s.y) - 4) + "px"
},
_onMouseUp: function (e) {
this._pane.removeChild(this._box), this._container.style.cursor = "", r.DomUtil.enableTextSelection(), r.DomEvent.off(t, "mousemove", this._onMouseMove).off(t, "mouseup", this._onMouseUp);
var n = this._map,
i = n.mouseEventToLayerPoint(e);
if (this._startLayerPoint.equals(i)) return;
var s = new r.LatLngBounds(n.layerPointToLatLng(this._startLayerPoint), n.layerPointToLatLng(i));
n.fitBounds(s), n.fire("boxzoomend", {
boxZoomBounds: s
})
}
}), r.Map.addInitHook("addHandler", "boxZoom", r.Map.BoxZoom), r.Map.mergeOptions({
keyboard: !0,
keyboardPanOffset: 80,
keyboardZoomOffset: 1
}), r.Map.Keyboard = r.Handler.extend({
keyCodes: {
left: [37],
right: [39],
down: [40],
up: [38],
zoomIn: [187, 107, 61],
zoomOut: [189, 109, 173]
},
initialize: function (e) {
this._map = e, this._setPanOffset(e.options.keyboardPanOffset), this._setZoomOffset(e.options.keyboardZoomOffset)
},
addHooks: function () {
var e = this._map._container;
e.tabIndex === -1 && (e.tabIndex = "0"), r.DomEvent.on(e, "focus", this._onFocus, this).on(e, "blur", this._onBlur, this).on(e, "mousedown", this._onMouseDown, this), this._map.on("focus", this._addHooks, this).on("blur", this._removeHooks, this)
},
removeHooks: function () {
this._removeHooks();
var e = this._map._container;
r.DomEvent.off(e, "focus", this._onFocus, this).off(e, "blur", this._onBlur, this).off(e, "mousedown", this._onMouseDown, this), this._map.off("focus", this._addHooks, this).off("blur", this._removeHooks, this)
},
_onMouseDown: function () {
this._focused || this._map._container.focus()
},
_onFocus: function () {
this._focused = !0, this._map.fire("focus")
},
_onBlur: function () {
this._focused = !1, this._map.fire("blur")
},
_setPanOffset: function (e) {
var t = this._panKeys = {},
n = this.keyCodes,
r, i;
for (r = 0, i = n.left.length; r < i; r++) t[n.left[r]] = [-1 * e, 0];
for (r = 0, i = n.right.length; r < i; r++) t[n.right[r]] = [e, 0];
for (r = 0, i = n.down.length; r < i; r++) t[n.down[r]] = [0, e];
for (r = 0, i = n.up.length; r < i; r++) t[n.up[r]] = [0, -1 * e]
},
_setZoomOffset: function (e) {
var t = this._zoomKeys = {},
n = this.keyCodes,
r, i;
for (r = 0, i = n.zoomIn.length; r < i; r++) t[n.zoomIn[r]] = e;
for (r = 0, i = n.zoomOut.length; r < i; r++) t[n.zoomOut[r]] = -e
},
_addHooks: function () {
r.DomEvent.on(t, "keydown", this._onKeyDown, this)
},
_removeHooks: function () {
r.DomEvent.off(t, "keydown", this._onKeyDown, this)
},
_onKeyDown: function (e) {
var t = e.keyCode,
n = this._map;
if (this._panKeys.hasOwnProperty(t)) n.panBy(this._panKeys[t]), n.options.maxBounds && n.panInsideBounds(n.options.maxBounds);
else {
if (!this._zoomKeys.hasOwnProperty(t)) return;
n.setZoom(n.getZoom() + this._zoomKeys[t])
}
r.DomEvent.stop(e)
}
}), r.Map.addInitHook("addHandler", "keyboard", r.Map.Keyboard), r.Handler.MarkerDrag = r.Handler.extend({
initialize: function (e) {
this._marker = e
},
addHooks: function () {
var e = this._marker._icon;
this._draggable || (this._draggable = (new r.Draggable(e, e)).on("dragstart", this._onDragStart, this).on("drag", this._onDrag, this).on("dragend", this._onDragEnd, this)), this._draggable.enable()
},
removeHooks: function () {
this._draggable.disable()
},
moved: function () {
return this._draggable && this._draggable._moved
},
_onDragStart: function () {
this._marker.closePopup().fire("movestart").fire("dragstart")
},
_onDrag: function () {
var e = this._marker,
t = e._shadow,
n = r.DomUtil.getPosition(e._icon),
i = e._map.layerPointToLatLng(n);
t && r.DomUtil.setPosition(t, n), e._latlng = i, e.fire("move", {
latlng: i
}).fire("drag")
},
_onDragEnd: function () {
this._marker.fire("moveend").fire("dragend")
}
}), r.Handler.PolyEdit = r.Handler.extend({
options: {
icon: new r.DivIcon({
iconSize: new r.Point(8, 8),
className: "leaflet-div-icon leaflet-editing-icon"
})
},
initialize: function (e, t) {
this._poly = e, r.setOptions(this, t)
},
addHooks: function () {
this._poly._map && (this._markerGroup || this._initMarkers(), this._poly._map.addLayer(this._markerGroup))
},
removeHooks: function () {
this._poly._map && (this._poly._map.removeLayer(this._markerGroup), delete this._markerGroup, delete this._markers)
},
updateMarkers: function () {
this._markerGroup.clearLayers(), this._initMarkers()
},
_initMarkers: function () {
this._markerGroup || (this._markerGroup = new r.LayerGroup), this._markers = [];
var e = this._poly._latlngs,
t, n, i, s;
for (t = 0, i = e.length; t < i; t++) s = this._createMarker(e[t], t), s.on("click", this._onMarkerClick, this), this._markers.push(s);
var o, u;
for (t = 0, n = i - 1; t < i; n = t++) {
if (t === 0 && !(r.Polygon && this._poly instanceof r.Polygon)) continue;
o = this._markers[n], u = this._markers[t], this._createMiddleMarker(o, u), this._updatePrevNext(o, u)
}
},
_createMarker: function (e, t) {
var n = new r.Marker(e, {
draggable: !0,
icon: this.options.icon
});
return n._origLatLng = e, n._index = t, n.on("drag", this._onMarkerDrag, this), n.on("dragend", this._fireEdit, this), this._markerGroup.addLayer(n), n
},
_fireEdit: function () {
this._poly.fire("edit")
},
_onMarkerDrag: function (e) {
var t = e.target;
r.extend(t._origLatLng, t._latlng), t._middleLeft && t._middleLeft.setLatLng(this._getMiddleLatLng(t._prev, t)), t._middleRight && t._middleRight.setLatLng(this._getMiddleLatLng(t, t._next)), this._poly.redraw()
},
_onMarkerClick: function (e) {
if (this._poly._latlngs.length < 3) return;
var t = e.target,
n = t._index;
this._markerGroup.removeLayer(t), this._markers.splice(n, 1), this._poly.spliceLatLngs(n, 1), this._updateIndexes(n, -1), this._updatePrevNext(t._prev, t._next), t._middleLeft && this._markerGroup.removeLayer(t._middleLeft), t._middleRight && this._markerGroup.removeLayer(t._middleRight), t._prev && t._next ? this._createMiddleMarker(t._prev, t._next) : t._prev ? t._next || (t._prev._middleRight = null) : t._next._middleLeft = null, this._poly.fire("edit")
},
_updateIndexes: function (e, t) {
this._markerGroup.eachLayer(function (n) {
n._index > e && (n._index += t)
})
},
_createMiddleMarker: function (e, t) {
var n = this._getMiddleLatLng(e, t),
r = this._createMarker(n),
i, s, o;
r.setOpacity(.6), e._middleRight = t._middleLeft = r, s = function () {
var s = t._index;
r._index = s, r.off("click", i).on("click", this._onMarkerClick, this), n.lat = r.getLatLng().lat, n.lng = r.getLatLng().lng, this._poly.spliceLatLngs(s, 0, n), this._markers.splice(s, 0, r), r.setOpacity(1), this._updateIndexes(s, 1), t._index++, this._updatePrevNext(e, r), this._updatePrevNext(r, t)
}, o = function () {
r.off("dragstart", s, this), r.off("dragend", o, this), this._createMiddleMarker(e, r), this._createMiddleMarker(r, t)
}, i = function () {
s.call(this), o.call(this), this._poly.fire("edit")
}, r.on("click", i, this).on("dragstart", s, this).on("dragend", o, this), this._markerGroup.addLayer(r)
},
_updatePrevNext: function (e, t) {
e && (e._next = t), t && (t._prev = e)
},
_getMiddleLatLng: function (e, t) {
var n = this._poly._map,
r = n.latLngToLayerPoint(e.getLatLng()),
i = n.latLngToLayerPoint(t.getLatLng());
return n.layerPointToLatLng(r._add(i)._divideBy(2))
}
}), r.Polyline.addInitHook(function () {
r.Handler.PolyEdit && (this.editing = new r.Handler.PolyEdit(this), this.options.editable && this.editing.enable()), this.on("add", function () {
this.editing && this.editing.enabled() && this.editing.addHooks()
}), this.on("remove", function () {
this.editing && this.editing.enabled() && this.editing.removeHooks()
})
}), r.Control = r.Class.extend({
options: {
position: "topright"
},
initialize: function (e) {
r.setOptions(this, e)
},
getPosition: function () {
return this.options.position
},
setPosition: function (e) {
var t = this._map;
return t && t.removeControl(this), this.options.position = e, t && t.addControl(this), this
},
addTo: function (e) {
this._map = e;
var t = this._container = this.onAdd(e),
n = this.getPosition(),
i = e._controlCorners[n];
return r.DomUtil.addClass(t, "leaflet-control"), n.indexOf("bottom") !== -1 ? i.insertBefore(t, i.firstChild) : i.appendChild(t), this
},
removeFrom: function (e) {
var t = this.getPosition(),
n = e._controlCorners[t];
return n.removeChild(this._container), this._map = null, this.onRemove && this.onRemove(e), this
}
}), r.control = function (e) {
return new r.Control(e)
}, r.Map.include({
addControl: function (e) {
return e.addTo(this), this
},
removeControl: function (e) {
return e.removeFrom(this), this
},
_initControlPos: function () {
function i(i, s) {
var o = t + i + " " + t + s;
e[i + s] = r.DomUtil.create("div", o, n)
}
var e = this._controlCorners = {},
t = "leaflet-",
n = this._controlContainer = r.DomUtil.create("div", t + "control-container", this._container);
i("top", "left"), i("top", "right"), i("bottom", "left"), i("bottom", "right")
}
}), r.Control.Zoom = r.Control.extend({
options: {
position: "topleft"
},
onAdd: function (e) {
var t = "leaflet-control-zoom",
n = "leaflet-bar",
i = n + "-part",
s = r.DomUtil.create("div", t + " " + n);
return this._map = e, this._zoomInButton = this._createButton("+", "Zoom in", t + "-in " + i + " " + i + "-top", s, this._zoomIn, this), this._zoomOutButton = this._createButton("-", "Zoom out", t + "-out " + i + " " + i + "-bottom", s, this._zoomOut, this), e.on("zoomend", this._updateDisabled, this), s
},
onRemove: function (e) {
e.off("zoomend", this._updateDisabled, this)
},
_zoomIn: function (e) {
this._map.zoomIn(e.shiftKey ? 3 : 1)
},
_zoomOut: function (e) {
this._map.zoomOut(e.shiftKey ? 3 : 1)
},
_createButton: function (e, t, n, i, s, o) {
var u = r.DomUtil.create("a", n, i);
u.innerHTML = e, u.href = "#", u.title = t;
var a = r.DomEvent.stopPropagation;
return r.DomEvent.on(u, "click", a).on(u, "mousedown", a).on(u, "dblclick", a).on(u, "click", r.DomEvent.preventDefault).on(u, "click", s, o), u
},
_updateDisabled: function () {
var e = this._map,
t = "leaflet-control-zoom-disabled";
r.DomUtil.removeClass(this._zoomInButton, t), r.DomUtil.removeClass(this._zoomOutButton, t), e._zoom === e.getMinZoom() && r.DomUtil.addClass(this._zoomOutButton, t), e._zoom === e.getMaxZoom() && r.DomUtil.addClass(this._zoomInButton, t)
}
}), r.Map.mergeOptions({
zoomControl: !0
}), r.Map.addInitHook(function () {
this.options.zoomControl && (this.zoomControl = new r.Control.Zoom, this.addControl(this.zoomControl))
}), r.control.zoom = function (e) {
return new r.Control.Zoom(e)
}, r.Control.Attribution = r.Control.extend({
options: {
position: "bottomright",
prefix: 'Powered by <a href="http://leafletjs.com">Leaflet</a>'
},
initialize: function (e) {
r.setOptions(this, e), this._attributions = {}
},
onAdd: function (e) {
return this._container = r.DomUtil.create("div", "leaflet-control-attribution"), r.DomEvent.disableClickPropagation(this._container), e.on("layeradd", this._onLayerAdd, this).on("layerremove", this._onLayerRemove, this), this._update(), this._container
},
onRemove: function (e) {
e.off("layeradd", this._onLayerAdd).off("layerremove", this._onLayerRemove)
},
setPrefix: function (e) {
return this.options.prefix = e, this._update(), this
},
addAttribution: function (e) {
if (!e) return;
return this._attributions[e] || (this._attributions[e] = 0), this._attributions[e]++, this._update(), this
},
removeAttribution: function (e) {
if (!e) return;
return this._attributions[e]--, this._update(), this
},
_update: function () {
if (!this._map) return;
var e = [];
for (var t in this._attributions) this._attributions.hasOwnProperty(t) && this._attributions[t] && e.push(t);
var n = [];
this.options.prefix && n.push(this.options.prefix), e.length && n.push(e.join(", ")), this._container.innerHTML = n.join(" &#8212; ")
},
_onLayerAdd: function (e) {
e.layer.getAttribution && this.addAttribution(e.layer.getAttribution())
},
_onLayerRemove: function (e) {
e.layer.getAttribution && this.removeAttribution(e.layer.getAttribution())
}
}), r.Map.mergeOptions({
attributionControl: !0
}), r.Map.addInitHook(function () {
this.options.attributionControl && (this.attributionControl = (new r.Control.Attribution).addTo(this))
}), r.control.attribution = function (e) {
return new r.Control.Attribution(e)
}, r.Control.Scale = r.Control.extend({
options: {
position: "bottomleft",
maxWidth: 100,
metric: !0,
imperial: !0,
updateWhenIdle: !1
},
onAdd: function (e) {
this._map = e;
var t = "leaflet-control-scale",
n = r.DomUtil.create("div", t),
i = this.options;
return this._addScales(i, t, n), e.on(i.updateWhenIdle ? "moveend" : "move", this._update, this), e.whenReady(this._update, this), n
},
onRemove: function (e) {
e.off(this.options.updateWhenIdle ? "moveend" : "move", this._update, this)
},
_addScales: function (e, t, n) {
e.metric && (this._mScale = r.DomUtil.create("div", t + "-line", n)), e.imperial && (this._iScale = r.DomUtil.create("div", t + "-line", n))
},
_update: function () {
var e = this._map.getBounds(),
t = e.getCenter().lat,
n = 6378137 * Math.PI * Math.cos(t * Math.PI / 180),
r = n * (e.getNorthEast().lng - e.getSouthWest().lng) / 180,
i = this._map.getSize(),
s = this.options,
o = 0;
i.x > 0 && (o = r * (s.maxWidth / i.x)), this._updateScales(s, o)
},
_updateScales: function (e, t) {
e.metric && t && this._updateMetric(t), e.imperial && t && this._updateImperial(t)
},
_updateMetric: function (e) {
var t = this._getRoundNum(e);
this._mScale.style.width = this._getScaleWidth(t / e) + "px", this._mScale.innerHTML = t < 1e3 ? t + " m" : t / 1e3 + " km"
},
_updateImperial: function (e) {
var t = e * 3.2808399,
n = this._iScale,
r, i, s;
t > 5280 ? (r = t / 5280, i = this._getRoundNum(r), n.style.width = this._getScaleWidth(i / r) + "px", n.innerHTML = i + " mi") : (s = this._getRoundNum(t), n.style.width = this._getScaleWidth(s / t) + "px", n.innerHTML = s + " ft")
},
_getScaleWidth: function (e) {
return Math.round(this.options.maxWidth * e) - 10
},
_getRoundNum: function (e) {
var t = Math.pow(10, (Math.floor(e) + "").length - 1),
n = e / t;
return n = n >= 10 ? 10 : n >= 5 ? 5 : n >= 3 ? 3 : n >= 2 ? 2 : 1, t * n
}
}), r.control.scale = function (e) {
return new r.Control.Scale(e)
}, r.Control.Layers = r.Control.extend({
options: {
collapsed: !0,
position: "topright",
autoZIndex: !0
},
initialize: function (e, t, n) {
r.setOptions(this, n), this._layers = {}, this._lastZIndex = 0, this._handlingClick = !1;
for (var i in e) e.hasOwnProperty(i) && this._addLayer(e[i], i);
for (i in t) t.hasOwnProperty(i) && this._addLayer(t[i], i, !0)
},
onAdd: function (e) {
return this._initLayout(), this._update(), e.on("layeradd", this._onLayerChange, this).on("layerremove", this._onLayerChange, this), this._container
},
onRemove: function (e) {
e.off("layeradd", this._onLayerChange).off("layerremove", this._onLayerChange)
},
addBaseLayer: function (e, t) {
return this._addLayer(e, t), this._update(), this
},
addOverlay: function (e, t) {
return this._addLayer(e, t, !0), this._update(), this
},
removeLayer: function (e) {
var t = r.stamp(e);
return delete this._layers[t], this._update(), this
},
_initLayout: function () {
var e = "leaflet-control-layers",
t = this._container = r.DomUtil.create("div", e);
r.Browser.touch ? r.DomEvent.on(t, "click", r.DomEvent.stopPropagation) : (r.DomEvent.disableClickPropagation(t), r.DomEvent.on(t, "mousewheel", r.DomEvent.stopPropagation));
var n = this._form = r.DomUtil.create("form", e + "-list");
if (this.options.collapsed) {
r.DomEvent.on(t, "mouseover", this._expand, this).on(t, "mouseout", this._collapse, this);
var i = this._layersLink = r.DomUtil.create("a", e + "-toggle", t);
i.href = "#", i.title = "Layers", r.Browser.touch ? r.DomEvent.on(i, "click", r.DomEvent.stopPropagation).on(i, "click", r.DomEvent.preventDefault).on(i, "click", this._expand, this) : r.DomEvent.on(i, "focus", this._expand, this), this._map.on("movestart", this._collapse, this)
} else this._expand();
this._baseLayersList = r.DomUtil.create("div", e + "-base", n), this._separator = r.DomUtil.create("div", e + "-separator", n), this._overlaysList = r.DomUtil.create("div", e + "-overlays", n), t.appendChild(n)
},
_addLayer: function (e, t, n) {
var i = r.stamp(e);
this._layers[i] = {
layer: e,
name: t,
overlay: n
}, this.options.autoZIndex && e.setZIndex && (this._lastZIndex++, e.setZIndex(this._lastZIndex))
},
_update: function () {
if (!this._container) return;
this._baseLayersList.innerHTML = "", this._overlaysList.innerHTML = "";
var e = !1,
t = !1;
for (var n in this._layers) if (this._layers.hasOwnProperty(n)) {
var r = this._layers[n];
this._addItem(r), t = t || r.overlay, e = e || !r.overlay
}
this._separator.style.display = t && e ? "" : "none"
},
_onLayerChange: function (e) {
var t = r.stamp(e.layer);
this._layers[t] && !this._handlingClick && this._update()
},
_createRadioElement: function (e, n) {
var r = '<input type="radio" class="leaflet-control-layers-selector" name="' + e + '"';
n && (r += ' checked="checked"'), r += "/>";
var i = t.createElement("div");
return i.innerHTML = r, i.firstChild
},
_addItem: function (e) {
var n = t.createElement("label"),
i, s = this._map.hasLayer(e.layer);
e.overlay ? (i = t.createElement("input"), i.type = "checkbox", i.className = "leaflet-control-layers-selector", i.defaultChecked = s) : i = this._createRadioElement("leaflet-base-layers", s), i.layerId = r.stamp(e.layer), r.DomEvent.on(i, "click", this._onInputClick, this);
var o = t.createElement("span");
o.innerHTML = " " + e.name, n.appendChild(i), n.appendChild(o);
var u = e.overlay ? this._overlaysList : this._baseLayersList;
return u.appendChild(n), n
},
_onInputClick: function () {
var e, t, n, r = this._form.getElementsByTagName("input"),
i = r.length,
s;
this._handlingClick = !0;
for (e = 0; e < i; e++) t = r[e], n = this._layers[t.layerId], t.checked && !this._map.hasLayer(n.layer) ? (this._map.addLayer(n.layer), n.overlay || (s = n.layer)) : !t.checked && this._map.hasLayer(n.layer) && this._map.removeLayer(n.layer);
s && (this._map.setZoom(this._map.getZoom()), this._map.fire("baselayerchange", {
layer: s
})), this._handlingClick = !1
},
_expand: function () {
r.DomUtil.addClass(this._container, "leaflet-control-layers-expanded")
},
_collapse: function () {
this._container.className = this._container.className.replace(" leaflet-control-layers-expanded", "")
}
}), r.control.layers = function (e, t, n) {
return new r.Control.Layers(e, t, n)
}, r.PosAnimation = r.Class.extend({
includes: r.Mixin.Events,
run: function (e, t, n, i) {
this.stop(), this._el = e, this._inProgress = !0, this.fire("start"), e.style[r.DomUtil.TRANSITION] = "all " + (n || .25) + "s cubic-bezier(0,0," + (i || .5) + ",1)", r.DomEvent.on(e, r.DomUtil.TRANSITION_END, this._onTransitionEnd, this), r.DomUtil.setPosition(e, t), r.Util.falseFn(e.offsetWidth), this._stepTimer = setInterval(r.bind(this.fire, this, "step"), 50)
},
stop: function () {
if (!this._inProgress) return;
r.DomUtil.setPosition(this._el, this._getPos()), this._onTransitionEnd(), r.Util.falseFn(this._el.offsetWidth)
},
_transformRe: /(-?[\d\.]+), (-?[\d\.]+)\)/,
_getPos: function () {
var t, n, i, s = this._el,
o = e.getComputedStyle(s);
return r.Browser.any3d ? (i = o[r.DomUtil.TRANSFORM].match(this._transformRe), t = parseFloat(i[1]), n = parseFloat(i[2])) : (t = parseFloat(o.left), n = parseFloat(o.top)), new r.Point(t, n, !0)
},
_onTransitionEnd: function () {
r.DomEvent.off(this._el, r.DomUtil.TRANSITION_END, this._onTransitionEnd, this);
if (!this._inProgress) return;
this._inProgress = !1, this._el.style[r.DomUtil.TRANSITION] = "", clearInterval(this._stepTimer), this.fire("step").fire("end")
}
}), r.Map.include({
setView: function (e, t, n) {
t = this._limitZoom(t);
var r = this._zoom !== t;
if (this._loaded && !n && this._layers) {
this._panAnim && this._panAnim.stop();
var i = r ? this._zoomToIfClose && this._zoomToIfClose(e, t) : this._panByIfClose(e);
if (i) return clearTimeout(this._sizeTimer), this
}
return this._resetView(e, t), this
},
panBy: function (e, t, n) {
e = r.point(e);
if (!e.x && !e.y) return this;
this._panAnim || (this._panAnim = new r.PosAnimation, this._panAnim.on({
step: this._onPanTransitionStep,
end: this._onPanTransitionEnd
}, this)), this.fire("movestart"), r.DomUtil.addClass(this._mapPane, "leaflet-pan-anim");
var i = r.DomUtil.getPosition(this._mapPane).subtract(e)._round();
return this._panAnim.run(this._mapPane, i, t || .25, n), this
},
_onPanTransitionStep: function () {
this.fire("move")
},
_onPanTransitionEnd: function () {
r.DomUtil.removeClass(this._mapPane, "leaflet-pan-anim"), this.fire("moveend")
},
_panByIfClose: function (e) {
var t = this._getCenterOffset(e)._floor();
return this._offsetIsWithinView(t) ? (this.panBy(t), !0) : !1
},
_offsetIsWithinView: function (e, t) {
var n = t || 1,
r = this.getSize();
return Math.abs(e.x) <= r.x * n && Math.abs(e.y) <= r.y * n
}
}), r.PosAnimation = r.DomUtil.TRANSITION ? r.PosAnimation : r.PosAnimation.extend({
run: function (e, t, n, i) {
this.stop(), this._el = e, this._inProgress = !0, this._duration = n || .25, this._easeOutPower = 1 / Math.max(i || .5, .2), this._startPos = r.DomUtil.getPosition(e), this._offset = t.subtract(this._startPos), this._startTime = +(new Date), this.fire("start"), this._animate()
},
stop: function () {
if (!this._inProgress) return;
this._step(), this._complete()
},
_animate: function () {
this._animId = r.Util.requestAnimFrame(this._animate, this), this._step()
},
_step: function () {
var e = +(new Date) - this._startTime,
t = this._duration * 1e3;
e < t ? this._runFrame(this._easeOut(e / t)) : (this._runFrame(1), this._complete())
},
_runFrame: function (e) {
var t = this._startPos.add(this._offset.multiplyBy(e));
r.DomUtil.setPosition(this._el, t), this.fire("step")
},
_complete: function () {
r.Util.cancelAnimFrame(this._animId), this._inProgress = !1, this.fire("end")
},
_easeOut: function (e) {
return 1 - Math.pow(1 - e, this._easeOutPower)
}
}), r.Map.mergeOptions({
zoomAnimation: r.DomUtil.TRANSITION && !r.Browser.android23 && !r.Browser.mobileOpera
}), r.DomUtil.TRANSITION && r.Map.addInitHook(function () {
r.DomEvent.on(this._mapPane, r.DomUtil.TRANSITION_END, this._catchTransitionEnd, this)
}), r.Map.include(r.DomUtil.TRANSITION ? {
_zoomToIfClose: function (e, t) {
if (this._animatingZoom) return !0;
if (!this.options.zoomAnimation) return !1;
var n = this.getZoomScale(t),
i = this._getCenterOffset(e)._divideBy(1 - 1 / n);
if (!this._offsetIsWithinView(i, 1)) return !1;
r.DomUtil.addClass(this._mapPane, "leaflet-zoom-anim"), this.fire("movestart").fire("zoomstart"), this.fire("zoomanim", {
center: e,
zoom: t
});
var s = this._getCenterLayerPoint().add(i);
return this._prepareTileBg(), this._runAnimation(e, t, n, s), !0
},
_catchTransitionEnd: function () {
this._animatingZoom && this._onZoomTransitionEnd()
},
_runAnimation: function (e, t, n, i, s) {
this._animateToCenter = e, this._animateToZoom = t, this._animatingZoom = !0, r.Draggable && (r.Draggable._disabled = !0);
var o = r.DomUtil.TRANSFORM,
u = this._tileBg;
clearTimeout(this._clearTileBgTimer), r.Util.falseFn(u.offsetWidth);
var a = r.DomUtil.getScaleString(n, i),
f = u.style[o];
u.style[o] = s ? f + " " + a : a + " " + f
},
_prepareTileBg: function () {
var e = this._tilePane,
t = this._tileBg;
if (t && this._getLoadedTilesPercentage(t) > .5 && this._getLoadedTilesPercentage(e) < .5) {
e.style.visibility = "hidden", e.empty = !0, this._stopLoadingImages(e);
return
}
t || (t = this._tileBg = this._createPane("leaflet-tile-pane", this._mapPane), t.style.zIndex = 1), t.style[r.DomUtil.TRANSFORM] = "", t.style.visibility = "hidden", t.empty = !0, e.empty = !1, this._tilePane = this._panes.tilePane = t;
var n = this._tileBg = e;
r.DomUtil.addClass(n, "leaflet-zoom-animated"), this._stopLoadingImages(n)
},
_getLoadedTilesPercentage: function (e) {
var t = e.getElementsByTagName("img"),
n, r, i = 0;
for (n = 0, r = t.length; n < r; n++) t[n].complete && i++;
return i / r
},
_stopLoadingImages: function (e) {
var t = Array.prototype.slice.call(e.getElementsByTagName("img")),
n, i, s;
for (n = 0, i = t.length; n < i; n++) s = t[n], s.complete || (s.onload = r.Util.falseFn, s.onerror = r.Util.falseFn, s.src = r.Util.emptyImageUrl, s.parentNode.removeChild(s))
},
_onZoomTransitionEnd: function () {
this._restoreTileFront(), r.DomUtil.removeClass(this._mapPane, "leaflet-zoom-anim"), r.Util.falseFn(this._tileBg.offsetWidth), this._animatingZoom = !1, this._resetView(this._animateToCenter, this._animateToZoom, !0, !0), r.Draggable && (r.Draggable._disabled = !1)
},
_restoreTileFront: function () {
this._tilePane.innerHTML = "", this._tilePane.style.visibility = "", this._tilePane.style.zIndex = 2, this._tileBg.style.zIndex = 1
},
_clearTileBg: function () {
!this._animatingZoom && !this.touchZoom._zooming && (this._tileBg.innerHTML = "")
}
} : {}), r.Map.include({
_defaultLocateOptions: {
watch: !1,
setView: !1,
maxZoom: Infinity,
timeout: 1e4,
maximumAge: 0,
enableHighAccuracy: !1
},
locate: function (e) {
e = this._locationOptions = r.extend(this._defaultLocateOptions, e);
if (!navigator.geolocation) return this._handleGeolocationError({
code: 0,
message: "Geolocation not supported."
}), this;
var t = r.bind(this._handleGeolocationResponse, this),
n = r.bind(this._handleGeolocationError, this);
return e.watch ? this._locationWatchId = navigator.geolocation.watchPosition(t, n, e) : navigator.geolocation.getCurrentPosition(t, n, e), this
},
stopLocate: function () {
return navigator.geolocation && navigator.geolocation.clearWatch(this._locationWatchId), this
},
_handleGeolocationError: function (e) {
var t = e.code,
n = e.message || (t === 1 ? "permission denied" : t === 2 ? "position unavailable" : "timeout");
this._locationOptions.setView && !this._loaded && this.fitWorld(), this.fire("locationerror", {
code: t,
message: "Geolocation error: " + n + "."
})
},
_handleGeolocationResponse: function (e) {
var t = 180 * e.coords.accuracy / 4e7,
n = t * 2,
i = e.coords.latitude,
s = e.coords.longitude,
o = new r.LatLng(i, s),
u = new r.LatLng(i - t, s - n),
a = new r.LatLng(i + t, s + n),
f = new r.LatLngBounds(u, a),
l = this._locationOptions;
if (l.setView) {
var c = Math.min(this.getBoundsZoom(f), l.maxZoom);
this.setView(o, c)
}
this.fire("locationfound", {
latlng: o,
bounds: f,
accuracy: e.coords.accuracy
})
}
})
}(this, document), !
function (e, t, n) {
t[e] = n(e, t)
}("bean", this, function (e, t) {
var n = window,
r = t[e],
i = /over|out/,
s = /[^\.]*(?=\..*)\.|.*/,
o = /\..*/,
u = "addEventListener",
a = "attachEvent",
f = "removeEventListener",
l = "detachEvent",
c = document || {},
h = c.documentElement || {},
p = h[u],
d = p ? u : a,
v = Array.prototype.slice,
m = /click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,
g = /mouse.*(wheel|scroll)/i,
y = /^text/i,
b = /^touch|^gesture/i,
w = {
one: 1
},
E = function (e, t, n) {
for (n = 0; n < t.length; n++) e[t[n]] = 1;
return e
}({}, ("click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange error abort scroll " + (p ? "show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend MSPointerUp MSPointerDown MSPointerCancel MSPointerMove MSPointerOver MSPointerOut message readystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete " : "")).split(" ")),
S = function () {
function e(e, t) {
while ((t = t.parentNode) !== null) if (t === e) return !0;
return !1
}
function t(t) {
var n = t.relatedTarget;
return n ? n !== this && n.prefix !== "xul" && !/document/.test(this.toString()) && !e(this, n) : n === null
}
return {
mouseenter: {
base: "mouseover",
condition: t
},
mouseleave: {
base: "mouseout",
condition: t
},
mousewheel: {
base: /Firefox/.test(navigator.userAgent) ? "DOMMouseScroll" : "mousewheel"
}
}
}(),
x = function () {
var e = "altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which".split(" "),
t = e.concat("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" ")),
n = t.concat("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis".split(" ")),
r = e.concat("char charCode key keyCode keyIdentifier keyLocation".split(" ")),
s = e.concat(["data"]),
o = e.concat("touches targetTouches changedTouches scale rotation".split(" ")),
u = "preventDefault",
a = function (e) {
return function () {
e[u] ? e[u]() : e.returnValue = !1
}
},
f = "stopPropagation",
l = function (e) {
return function () {
e[f] ? e[f]() : e.cancelBubble = !0
}
},
p = function (e) {
return function () {
e[u](), e[f](), e.stopped = !0
}
},
d = function (e, t, n) {
var r, i;
for (r = n.length; r--;) i = n[r], !(i in t) && i in e && (t[i] = e[i])
};
return function (v, w) {
var E = {
originalEvent: v,
isNative: w
};
if (!v) return E;
var S, x = v.type,
T = v.target || v.srcElement;
E[u] = a(v), E[f] = l(v), E.stop = p(E), E.target = T && T.nodeType === 3 ? T.parentNode : T;
if (w) {
if (x.indexOf("key") !== -1) S = r, E.keyCode = v.which || v.keyCode;
else if (m.test(x)) {
S = t, E.rightClick = v.which === 3 || v.button === 2, E.pos = {
x: 0,
y: 0
};
if (v.pageX || v.pageY) E.clientX = v.pageX, E.clientY = v.pageY;
else if (v.clientX || v.clientY) E.clientX = v.clientX + c.body.scrollLeft + h.scrollLeft, E.clientY = v.clientY + c.body.scrollTop + h.scrollTop;
i.test(x) && (E.relatedTarget = v.relatedTarget || v[(x === "mouseover" ? "from" : "to") + "Element"])
} else b.test(x) ? S = o : g.test(x) ? S = n : y.test(x) && (S = s);
d(v, E, S || e)
}
return E
}
}(),
T = function (e, t) {
return !p && !t && (e === c || e === n) ? h : e
},
N = function () {
function e(e, t, n, r, i) {
this.element = e, this.type = t, this.handler = n, this.original = r, this.namespaces = i, this.custom = S[t], this.isNative = E[t] && e[d], this.eventType = p || this.isNative ? t : "propertychange", this.customType = !p && !this.isNative && t, this.target = T(e, this.isNative), this.eventSupport = this.target[d]
}
return e.prototype = {
inNamespaces: function (e) {
var t, n;
if (!e) return !0;
if (!this.namespaces) return !1;
for (t = e.length; t--;) for (n = this.namespaces.length; n--;) if (e[t] === this.namespaces[n]) return !0;
return !1
},
matches: function (e, t, n) {
return this.element === e && (!t || this.original === t) && (!n || this.handler === n)
}
}, e
}(),
C = function () {
var e = {},
t = function (n, r, i, s, o) {
if (!r || r === "*") for (var u in e) u.charAt(0) === "$" && t(n, u.substr(1), i, s, o);
else {
var a = 0,
f, l = e["$" + r],
c = n === "*";
if (!l) return;
for (f = l.length; a < f; a++) if (c || l[a].matches(n, i, s)) if (!o(l[a], l, a, r)) return
}
},
n = function (t, n, r) {
var i, s = e["$" + n];
if (s) for (i = s.length; i--;) if (s[i].matches(t, r, null)) return !0;
return !1
},
r = function (e, n, r) {
var i = [];
return t(e, n, r, null, function (e) {
return i.push(e)
}), i
},
i = function (t) {
return (e["$" + t.type] || (e["$" + t.type] = [])).push(t), t
},
s = function (n) {
t(n.element, n.type, null, n.handler, function (t, n, r) {
return n.splice(r, 1), n.length === 0 && delete e["$" + t.type], !1
})
},
o = function () {
var t, n = [];
for (t in e) t.charAt(0) === "$" && (n = n.concat(e[t]));
return n
};
return {
has: n,
get: r,
put: i,
del: s,
entries: o
}
}(),
k = p ?
function (e, t, n, r) {
e[r ? u : f](t, n, !1)
} : function (e, t, n, r, i) {
i && r && e["_on" + i] === null && (e["_on" + i] = 0), e[r ? a : l]("on" + t, n)
}, L = function (e, t, r) {
return function (i) {
return i = x(i || ((this.ownerDocument || this.document || this).parentWindow || n).event, !0), t.apply(e, [i].concat(r))
}
}, A = function (e, t, r, i, s, o) {
return function (u) {
if (i ? i.apply(this, arguments) : p ? !0 : u && u.propertyName === "_on" + r || !u) u && (u = x(u || ((this.ownerDocument || this.document || this).parentWindow || n).event, o)), t.apply(e, u && (!s || s.length === 0) ? arguments : v.call(arguments, u ? 0 : 1).concat(s))
}
}, O = function (e, t, n, r, i) {
return function () {
e(t, n, i), r.apply(this, arguments)
}
}, M = function (e, t, n, r) {
var i, s, u, a = t && t.replace(o, ""),
f = C.get(e, a, n);
for (i = 0, s = f.length; i < s; i++) f[i].inNamespaces(r) && ((u = f[i]).eventSupport && k(u.target, u.eventType, u.handler, !1, u.type), C.del(u))
}, _ = function (e, t, n, r, i) {
var u, a = t.replace(o, ""),
f = t.replace(s, "").split(".");
if (C.has(e, a, n)) return e;
a === "unload" && (n = O(M, e, a, n, r)), S[a] && (S[a].condition && (n = A(e, n, a, S[a].condition, !0)), a = S[a].base || a), u = C.put(new N(e, a, n, r, f[0] && f)), u.handler = u.isNative ? L(e, u.handler, i) : A(e, u.handler, a, !1, i, !1), u.eventSupport && k(u.target, u.eventType, u.handler, !0, u.customType)
}, D = function (e, t, n) {
return function (r) {
var i, s, o = typeof e == "string" ? n(e, this) : e;
for (i = r.target; i && i !== this; i = i.parentNode) for (s = o.length; s--;) if (o[s] === i) return t.apply(i, arguments)
}
}, P = function (e, t, n) {
var r, i, u, a, f, l = M,
c = t && typeof t == "string";
if (c && t.indexOf(" ") > 0) {
t = t.split(" ");
for (f = t.length; f--;) P(e, t[f], n);
return e
}
u = c && t.replace(o, ""), u && S[u] && (u = S[u].type);
if (!t || c) {
if (a = c && t.replace(s, "")) a = a.split(".");
l(e, u, n, a)
} else if (typeof t == "function") l(e, null, t);
else for (r in t) t.hasOwnProperty(r) && P(e, r, t[r]);
return e
}, H = function (e, t, n, r, i) {
var s, o, u, a, f = n,
l = n && typeof n == "string";
if (t && !n && typeof t == "object") for (s in t) t.hasOwnProperty(s) && H.apply(this, [e, s, t[s]]);
else {
a = arguments.length > 3 ? v.call(arguments, 3) : [], o = (l ? n : t).split(" "), l && (n = D(t, f = r, i)) && (a = v.call(a, 1)), this === w && (n = O(P, e, t, n, f));
for (u = o.length; u--;) _(e, o[u], n, f, a)
}
return e
}, B = function () {
return H.apply(w, arguments)
}, j = p ?
function (e, t, r) {
var i = c.createEvent(e ? "HTMLEvents" : "UIEvents");
i[e ? "initEvent" : "initUIEvent"](t, !0, !0, n, 1), r.dispatchEvent(i)
} : function (e, t, n) {
n = T(n, e), e ? n.fireEvent("on" + t, c.createEventObject()) : n["_on" + t]++
}, F = function (e, t, n) {
var r, i, u, a, f, l = t.split(" ");
for (r = l.length; r--;) {
t = l[r].replace(o, "");
if (a = l[r].replace(s, "")) a = a.split(".");
if (!a && !n && e[d]) j(E[t], t, e);
else {
f = C.get(e, t), n = [!1].concat(n);
for (i = 0, u = f.length; i < u; i++) f[i].inNamespaces(a) && f[i].handler.apply(e, n)
}
}
return e
}, I = function (e, t, n) {
var r = 0,
i = C.get(t, n),
s = i.length;
for (; r < s; r++) i[r].original && H(e, i[r].type, i[r].original);
return e
}, q = {
add: H,
one: B,
remove: P,
clone: I,
fire: F,
noConflict: function () {
return t[e] = r, this
}
};
if (n[a]) {
var R = function () {
var e, t = C.entries();
for (e in t) t[e].type && t[e].type !== "unload" && P(t[e].element, t[e].type);
n[l]("onunload", R), n.CollectGarbage && n.CollectGarbage()
};
n[a]("onunload", R)
}
return q
});
var html4 = {};
html4.atype = {
NONE: 0,
URI: 1,
URI_FRAGMENT: 11,
SCRIPT: 2,
STYLE: 3,
ID: 4,
IDREF: 5,
IDREFS: 6,
GLOBAL_NAME: 7,
LOCAL_NAME: 8,
CLASSES: 9,
FRAME_TARGET: 10
}, html4.ATTRIBS = {
"*::class": 9,
"*::dir": 0,
"*::id": 4,
"*::lang": 0,
"*::onclick": 2,
"*::ondblclick": 2,
"*::onkeydown": 2,
"*::onkeypress": 2,
"*::onkeyup": 2,
"*::onload": 2,
"*::onmousedown": 2,
"*::onmousemove": 2,
"*::onmouseout": 2,
"*::onmouseover": 2,
"*::onmouseup": 2,
"*::style": 3,
"*::title": 0,
"a::accesskey": 0,
"a::coords": 0,
"a::href": 1,
"a::hreflang": 0,
"a::name": 7,
"a::onblur": 2,
"a::onfocus": 2,
"a::rel": 0,
"a::rev": 0,
"a::shape": 0,
"a::tabindex": 0,
"a::target": 10,
"a::type": 0,
"area::accesskey": 0,
"area::alt": 0,
"area::coords": 0,
"area::href": 1,
"area::nohref": 0,
"area::onblur": 2,
"area::onfocus": 2,
"area::shape": 0,
"area::tabindex": 0,
"area::target": 10,
"bdo::dir": 0,
"blockquote::cite": 1,
"br::clear": 0,
"button::accesskey": 0,
"button::disabled": 0,
"button::name": 8,
"button::onblur": 2,
"button::onfocus": 2,
"button::tabindex": 0,
"button::type": 0,
"button::value": 0,
"canvas::height": 0,
"canvas::width": 0,
"caption::align": 0,
"col::align": 0,
"col::char": 0,
"col::charoff": 0,
"col::span": 0,
"col::valign": 0,
"col::width": 0,
"colgroup::align": 0,
"colgroup::char": 0,
"colgroup::charoff": 0,
"colgroup::span": 0,
"colgroup::valign": 0,
"colgroup::width": 0,
"del::cite": 1,
"del::datetime": 0,
"dir::compact": 0,
"div::align": 0,
"dl::compact": 0,
"font::color": 0,
"font::face": 0,
"font::size": 0,
"form::accept": 0,
"form::action": 1,
"form::autocomplete": 0,
"form::enctype": 0,
"form::method": 0,
"form::name": 7,
"form::onreset": 2,
"form::onsubmit": 2,
"form::target": 10,
"h1::align": 0,
"h2::align": 0,
"h3::align": 0,
"h4::align": 0,
"h5::align": 0,
"h6::align": 0,
"hr::align": 0,
"hr::noshade": 0,
"hr::size": 0,
"hr::width": 0,
"iframe::align": 0,
"iframe::frameborder": 0,
"iframe::height": 0,
"iframe::marginheight": 0,
"iframe::marginwidth": 0,
"iframe::width": 0,
"img::align": 0,
"img::alt": 0,
"img::border": 0,
"img::height": 0,
"img::hspace": 0,
"img::ismap": 0,
"img::name": 7,
"img::src": 1,
"img::usemap": 11,
"img::vspace": 0,
"img::width": 0,
"input::accept": 0,
"input::accesskey": 0,
"input::align": 0,
"input::alt": 0,
"input::autocomplete": 0,
"input::checked": 0,
"input::disabled": 0,
"input::ismap": 0,
"input::maxlength": 0,
"input::name": 8,
"input::onblur": 2,
"input::onchange": 2,
"input::onfocus": 2,
"input::onselect": 2,
"input::readonly": 0,
"input::size": 0,
"input::src": 1,
"input::tabindex": 0,
"input::type": 0,
"input::usemap": 11,
"input::value": 0,
"ins::cite": 1,
"ins::datetime": 0,
"label::accesskey": 0,
"label::for": 5,
"label::onblur": 2,
"label::onfocus": 2,
"legend::accesskey": 0,
"legend::align": 0,
"li::type": 0,
"li::value": 0,
"map::name": 7,
"menu::compact": 0,
"ol::compact": 0,
"ol::start": 0,
"ol::type": 0,
"optgroup::disabled": 0,
"optgroup::label": 0,
"option::disabled": 0,
"option::label": 0,
"option::selected": 0,
"option::value": 0,
"p::align": 0,
"pre::width": 0,
"q::cite": 1,
"select::disabled": 0,
"select::multiple": 0,
"select::name": 8,
"select::onblur": 2,
"select::onchange": 2,
"select::onfocus": 2,
"select::size": 0,
"select::tabindex": 0,
"table::align": 0,
"table::bgcolor": 0,
"table::border": 0,
"table::cellpadding": 0,
"table::cellspacing": 0,
"table::frame": 0,
"table::rules": 0,
"table::summary": 0,
"table::width": 0,
"tbody::align": 0,
"tbody::char": 0,
"tbody::charoff": 0,
"tbody::valign": 0,
"td::abbr": 0,
"td::align": 0,
"td::axis": 0,
"td::bgcolor": 0,
"td::char": 0,
"td::charoff": 0,
"td::colspan": 0,
"td::headers": 6,
"td::height": 0,
"td::nowrap": 0,
"td::rowspan": 0,
"td::scope": 0,
"td::valign": 0,
"td::width": 0,
"textarea::accesskey": 0,
"textarea::cols": 0,
"textarea::disabled": 0,
"textarea::name": 8,
"textarea::onblur": 2,
"textarea::onchange": 2,
"textarea::onfocus": 2,
"textarea::onselect": 2,
"textarea::readonly": 0,
"textarea::rows": 0,
"textarea::tabindex": 0,
"tfoot::align": 0,
"tfoot::char": 0,
"tfoot::charoff": 0,
"tfoot::valign": 0,
"th::abbr": 0,
"th::align": 0,
"th::axis": 0,
"th::bgcolor": 0,
"th::char": 0,
"th::charoff": 0,
"th::colspan": 0,
"th::headers": 6,
"th::height": 0,
"th::nowrap": 0,
"th::rowspan": 0,
"th::scope": 0,
"th::valign": 0,
"th::width": 0,
"thead::align": 0,
"thead::char": 0,
"thead::charoff": 0,
"thead::valign": 0,
"tr::align": 0,
"tr::bgcolor": 0,
"tr::char": 0,
"tr::charoff": 0,
"tr::valign": 0,
"ul::compact": 0,
"ul::type": 0
}, html4.eflags = {
OPTIONAL_ENDTAG: 1,
EMPTY: 2,
CDATA: 4,
RCDATA: 8,
UNSAFE: 16,
FOLDABLE: 32,
SCRIPT: 64,
STYLE: 128
}, html4.ELEMENTS = {
a: 0,
abbr: 0,
acronym: 0,
address: 0,
applet: 16,
area: 2,
b: 0,
base: 18,
basefont: 18,
bdo: 0,
big: 0,
blockquote: 0,
body: 49,
br: 2,
button: 0,
canvas: 0,
caption: 0,
center: 0,
cite: 0,
code: 0,
col: 2,
colgroup: 1,
dd: 1,
del: 0,
dfn: 0,
dir: 0,
div: 0,
dl: 0,
dt: 1,
em: 0,
fieldset: 0,
font: 0,
form: 0,
frame: 18,
frameset: 16,
h1: 0,
h2: 0,
h3: 0,
h4: 0,
h5: 0,
h6: 0,
head: 49,
hr: 2,
html: 49,
i: 0,
iframe: 4,
img: 2,
input: 2,
ins: 0,
isindex: 18,
kbd: 0,
label: 0,
legend: 0,
li: 1,
link: 18,
map: 0,
menu: 0,
meta: 18,
nobr: 0,
noembed: 4,
noframes: 20,
noscript: 20,
object: 16,
ol: 0,
optgroup: 0,
option: 1,
p: 1,
param: 18,
pre: 0,
q: 0,
s: 0,
samp: 0,
script: 84,
select: 0,
small: 0,
span: 0,
strike: 0,
strong: 0,
style: 148,
sub: 0,
sup: 0,
table: 0,
tbody: 1,
td: 1,
textarea: 8,
tfoot: 1,
th: 1,
thead: 1,
title: 24,
tr: 1,
tt: 0,
u: 0,
ul: 0,
"var": 0
}, html4.ueffects = {
NOT_LOADED: 0,
SAME_DOCUMENT: 1,
NEW_DOCUMENT: 2
}, html4.URIEFFECTS = {
"a::href": 2,
"area::href": 2,
"blockquote::cite": 0,
"body::background": 1,
"del::cite": 0,
"form::action": 2,
"img::src": 1,
"input::src": 1,
"ins::cite": 0,
"q::cite": 0
}, html4.ltypes = {
UNSANDBOXED: 2,
SANDBOXED: 1,
DATA: 0
}, html4.LOADERTYPES = {
"a::href": 2,
"area::href": 2,
"blockquote::cite": 2,
"body::background": 1,
"del::cite": 2,
"form::action": 2,
"img::src": 1,
"input::src": 1,
"ins::cite": 2,
"q::cite": 2
};
var html = function (e) {
function o(e) {
e = t(e);
if (n.hasOwnProperty(e)) return n[e];
var r = e.match(i);
return r ? String.fromCharCode(parseInt(r[1], 10)) : (r = e.match(s)) ? String.fromCharCode(parseInt(r[1], 16)) : ""
}
function u(e, t) {
return o(t)
}
function f(e) {
return e.replace(a, "")
}
function c(e) {
return e.replace(l, u)
}
function y(e) {
return e.replace(h, "&amp;").replace(d, "&lt;").replace(v, "&gt;").replace(m, "&#34;").replace(g, "&#61;")
}
function b(e) {
return e.replace(p, "&amp;$1").replace(d, "&lt;").replace(v, "&gt;")
}
function S(n) {
return function (i, s) {
i = String(i);
var o = null,
u = !1,
a = [],
l = void 0,
h = void 0,
p = void 0;
n.startDoc && n.startDoc(s);
while (i) {
var d = i.match(u ? w : E);
i = i.substring(d[0].length);
if (u) {
if (d[1]) {
var v = t(d[1]),
m;
if (d[2]) {
var g = d[3];
switch (g.charCodeAt(0)) {
case 34:
case 39:
g = g.substring(1, g.length - 1)
}
m = c(f(g))
} else m = v;
a.push(v, m)
} else if (d[4]) {
h !== void 0 && (p ? n.startTag && n.startTag(l, a, s) : n.endTag && n.endTag(l, s));
if (p && h & (e.eflags.CDATA | e.eflags.RCDATA)) {
o === null ? o = t(i) : o = o.substring(o.length - i.length);
var y = o.indexOf("</" + l);
y < 0 && (y = i.length), y && (h & e.eflags.CDATA ? n.cdata && n.cdata(i.substring(0, y), s) : n.rcdata && n.rcdata(b(i.substring(0, y)), s), i = i.substring(y))
}
l = h = p = void 0, a.length = 0, u = !1
}
} else if (d[1]) n.pcdata && n.pcdata(d[0], s);
else if (d[3]) p = !d[2], u = !0, l = t(d[3]), h = e.ELEMENTS.hasOwnProperty(l) ? e.ELEMENTS[l] : void 0;
else if (d[4]) n.pcdata && n.pcdata(d[4], s);
else if (d[5] && n.pcdata) {
var S = d[5];
n.pcdata(S === "<" ? "&lt;" : S === ">" ? "&gt;" : "&amp;", s)
}
}
n.endDoc && n.endDoc(s)
}
}
function x(t) {
var n, r;
return S({
startDoc: function (e) {
n = [], r = !1
},
startTag: function (i, s, o) {
if (r) return;
if (!e.ELEMENTS.hasOwnProperty(i)) return;
var u = e.ELEMENTS[i];
if (u & e.eflags.FOLDABLE) return;
if (u & e.eflags.UNSAFE) {
r = !(u & e.eflags.EMPTY);
return
}
s = t(i, s);
if (s) {
u & e.eflags.EMPTY || n.push(i), o.push("<", i);
for (var a = 0, f = s.length; a < f; a += 2) {
var l = s[a],
c = s[a + 1];
c !== null && c !== void 0 && o.push(" ", l, '="', y(c), '"')
}
o.push(">")
}
},
endTag: function (t, i) {
if (r) {
r = !1;
return
}
if (!e.ELEMENTS.hasOwnProperty(t)) return;
var s = e.ELEMENTS[t];
if (!(s & (e.eflags.UNSAFE | e.eflags.EMPTY | e.eflags.FOLDABLE))) {
var o;
if (s & e.eflags.OPTIONAL_ENDTAG) for (o = n.length; --o >= 0;) {
var u = n[o];
if (u === t) break;
if (!(e.ELEMENTS[u] & e.eflags.OPTIONAL_ENDTAG)) return
} else for (o = n.length; --o >= 0;) if (n[o] === t) break;
if (o < 0) return;
for (var a = n.length; --a > o;) {
var u = n[a];
e.ELEMENTS[u] & e.eflags.OPTIONAL_ENDTAG || i.push("</", u, ">")
}
n.length = o, i.push("</", t, ">")
}
},
pcdata: function (e, t) {
r || t.push(e)
},
rcdata: function (e, t) {
r || t.push(e)
},
cdata: function (e, t) {
r || t.push(e)
},
endDoc: function (e) {
for (var t = n.length; --t >= 0;) e.push("</", n[t], ">");
n.length = 0
}
})
}
function N(t, n, i) {
var s = [];
return x(function (s, o) {
for (var u = 0; u < o.length; u += 2) {
var a = o[u],
f = o[u + 1],
l = null,
c;
if ((c = s + "::" + a, e.ATTRIBS.hasOwnProperty(c)) || (c = "*::" + a, e.ATTRIBS.hasOwnProperty(c))) l = e.ATTRIBS[c];
if (l !== null) switch (l) {
case e.atype.NONE:
break;
case e.atype.SCRIPT:
case e.atype.STYLE:
f = null;
break;
case e.atype.ID:
case e.atype.IDREF:
case e.atype.IDREFS:
case e.atype.GLOBAL_NAME:
case e.atype.LOCAL_NAME:
case e.atype.CLASSES:
f = i ? i(f) : f;
break;
case e.atype.URI:
var h = ("" + f).match(T);
h ? !h[1] || r.test(h[1]) ? f = n && n(f) : f = null : f = null;
break;
case e.atype.URI_FRAGMENT:
f && "#" === f.charAt(0) ? (f = i ? i(f) : f, f && (f = "#" + f)) : f = null;
break;
default:
f = null
} else f = null;
o[u + 1] = f
}
return o
})(t, s), s.join("")
}
var t;
"script" === "SCRIPT".toLowerCase() ? t = function (e) {
return e.toLowerCase()
} : t = function (e) {
return e.replace(/[A-Z]/g, function (e) {
return String.fromCharCode(e.charCodeAt(0) | 32)
})
};
var n = {
lt: "<",
gt: ">",
amp: "&",
nbsp: "Â ",
quot: '"',
apos: "'"
},
r = /^(?:https?|mailto|data)$/i,
i = /^#(\d+)$/,
s = /^#x([0-9A-Fa-f]+)$/,
a = /\0/g,
l = /&(#\d+|#x[0-9A-Fa-f]+|\w+);/g,
h = /&/g,
p = /&([^a-z#]|#(?:[^0-9x]|x(?:[^0-9a-f]|$)|$)|$)/gi,
d = /</g,
v = />/g,
m = /\"/g,
g = /\=/g,
w = new RegExp("^\\s*(?:(?:([a-z][a-z-]*)(\\s*=\\s*(\"[^\"]*\"|'[^']*'|(?=[a-z][a-z-]*\\s*=)|[^>\"'\\s]*))?)|(/?>)|[\\s\\S][^a-z\\s>]*)", "i"),
E = new RegExp("^(?:&(\\#[0-9]+|\\#[x][0-9a-f]+|\\w+);|<!--[\\s\\S]*?-->|<!\\w[^>]*>|<\\?[^>*]*>|<(/)?([a-z][a-z0-9]*)|([^<&>]+)|([<&>]))", "i"),
T = new RegExp("^(?:([^:/?#]+):)?");
return {
escapeAttrib: y,
makeHtmlSanitizer: x,
makeSaxParser: S,
normalizeRCData: b,
sanitize: N,
unescapeEntities: c
}
}(html4),
html_sanitize = html.sanitize;
typeof window != "undefined" && (window.html = html, window.html_sanitize = html_sanitize), html4.ATTRIBS["*::style"] = 0, html4.ELEMENTS.style = 0, html4.ATTRIBS["a::target"] = 0, html4.ELEMENTS.video = 0, html4.ATTRIBS["video::src"] = 0, html4.ATTRIBS["video::poster"] = 0, html4.ATTRIBS["video::controls"] = 0, html4.ELEMENTS.audio = 0, html4.ATTRIBS["audio::src"] = 0, html4.ATTRIBS["video::autoplay"] = 0, html4.ATTRIBS["video::controls"] = 0;
var Mustache = typeof module != "undefined" && module.exports || {};
(function (e) {
function a(e) {
return u.test(e)
}
function p(e) {
return String(e).replace(/[&<>"'\/]/g, function (e) {
return h[e] || e
})
}
function d(e, t, n, r) {
r = r || "<template>";
var i = t.split("\n"),
s = Math.max(n - 3, 0),
o = Math.min(i.length, n + 3),
u = i.slice(s, o),
a;
for (var f = 0, l = u.length; f < l; ++f) a = f + s + 1, u[f] = (a === n ? " >> " : " ") + u[f];
return e.template = t, e.line = n, e.file = r, e.message = [r + ":" + n, u.join("\n"), "", e.message].join("\n"), e
}
function v(e, t, n) {
if (e === ".") return t[t.length - 1];
var r = e.split("."),
i = r.length - 1,
s = r[i],
o, u, a = t.length,
f, l;
while (a) {
l = t.slice(0), u = t[--a], f = 0;
while (f < i) {
u = u[r[f++]];
if (u == null) break;
l.push(u)
}
if (u && typeof u == "object" && s in u) {
o = u[s];
break
}
}
return typeof o == "function" && (o = o.call(l[l.length - 1])), o == null ? n : o
}
function m(e, t, n, r) {
var i = "",
u = v(e, t);
if (r) {
if (u == null || u === !1 || s(u) && u.length === 0) i += n()
} else if (s(u)) o(u, function (e) {
t.push(e), i += n(), t.pop()
});
else if (typeof u == "object") t.push(u), i += n(), t.pop();
else if (typeof u == "function") {
var a = t[t.length - 1],
f = function (e) {
return S(e, a)
};
i += u.call(a, n(), f) || ""
} else u && (i += n());
return i
}
function g(t, n) {
n = n || {};
var r = n.tags || e.tags,
i = r[0],
s = r[r.length - 1],
o = ['var buffer = "";', "\nvar line = 1;", "\ntry {", '\nbuffer += "'],
u = [],
l = !1,
c = !1,
h = function () {
if (l && !c && !n.space) while (u.length) o.splice(u.pop(), 1);
else u = [];
l = !1, c = !1
},
p = [],
v, m, g, y = function (e) {
r = f(e).split(/\s+/), m = r[0], g = r[r.length - 1]
},
b = function (e) {
o.push('";', v, '\nvar partial = partials["' + f(e) + '"];', "\nif (partial) {", "\n buffer += render(partial,stack[stack.length - 1],partials);", "\n}", '\nbuffer += "')
},
w = function (e, r) {
var i = f(e);
if (i === "") throw d(new Error("Section name may not be empty"), t, N, n.file);
p.push({
name: i,
inverted: r
}), o.push('";', v, '\nvar name = "' + i + '";', "\nvar callback = (function () {", "\n return function () {", '\n var buffer = "";', '\nbuffer += "')
},
E = function (e) {
w(e, !0)
},
S = function (e) {
var r = f(e),
i = p.length != 0 && p[p.length - 1].name;
if (!i || r != i) throw d(new Error('Section named "' + r + '" was never opened'), t, N, n.file);
var s = p.pop();
o.push('";', "\n return buffer;", "\n };", "\n})();"), s.inverted ? o.push("\nbuffer += renderSection(name,stack,callback,true);") : o.push("\nbuffer += renderSection(name,stack,callback);"), o.push('\nbuffer += "')
},
x = function (e) {
o.push('";', v, '\nbuffer += lookup("' + f(e) + '",stack,"");', '\nbuffer += "')
},
T = function (e) {
o.push('";', v, '\nbuffer += escapeHTML(lookup("' + f(e) + '",stack,""));', '\nbuffer += "')
},
N = 1,
C, k;
for (var L = 0, A = t.length; L < A; ++L) if (t.slice(L, L + i.length) === i) {
L += i.length, C = t.substr(L, 1), v = "\nline = " + N + ";", m = i, g = s, l = !0;
switch (C) {
case "!":
L++, k = null;
break;
case "=":
L++, s = "=" + s, k = y;
break;
case ">":
L++, k = b;
break;
case "#":
L++, k = w;
break;
case "^":
L++, k = E;
break;
case "/":
L++, k = S;
break;
case "{":
s = "}" + s;
case "&":
L++, c = !0, k = x;
break;
default:
c = !0, k = T
}
var O = t.indexOf(s, L);
if (O === -1) throw d(new Error('Tag "' + i + '" was not closed properly'), t, N, n.file);
var M = t.substring(L, O);
k && k(M);
var _ = 0;
while (~ (_ = M.indexOf("\n", _))) N++, _++;
L = O + s.length - 1, i = m, s = g
} else {
C = t.substr(L, 1);
switch (C) {
case '"':
case "\\":
c = !0, o.push("\\" + C);
break;
case "\r":
break;
case "\n":
u.push(o.length), o.push("\\n"), h(), N++;
break;
default:
a(C) ? u.push(o.length) : c = !0, o.push(C)
}
}
if (p.length != 0) throw d(new Error('Section "' + p[p.length - 1].name + '" was not closed properly'), t, N, n.file);
h(), o.push('";', "\nreturn buffer;", "\n} catch (e) { throw {error: e, line: line}; }");
var D = o.join("").replace(/buffer \+= "";\n/g, "");
return n.debug && (typeof console != "undefined" && console.log ? console.log(D) : typeof print == "function" && print(D)), D
}
function y(e, t) {
var n = "view,partials,stack,lookup,escapeHTML,renderSection,render",
r = g(e, t),
i = new Function(n, r);
return function (n, r) {
r = r || {};
var s = [n];
try {
return i(n, r, s, v, p, m, S)
} catch (o) {
throw d(o.error, e, o.line, t.file)
}
}
}
function w() {
b = {}
}
function E(e, t) {
return t = t || {}, t.cache !== !1 ? (b[e] || (b[e] = y(e, t)), b[e]) : y(e, t)
}
function S(e, t, n) {
return E(e)(t, n)
}
e.name = "mustache.js", e.version = "0.5.0-dev", e.tags = ["{{", "}}"], e.parse = g, e.compile = E, e.render = S, e.clearCache = w, e.to_html = function (e, t, n, r) {
var i = S(e, t, n);
if (typeof r != "function") return i;
r(i)
};
var t = Object.prototype.toString,
n = Array.isArray,
r = Array.prototype.forEach,
i = String.prototype.trim,
s;
n ? s = n : s = function (e) {
return t.call(e) === "[object Array]"
};
var o;
r ? o = function (e, t, n) {
return r.call(e, t, n)
} : o = function (e, t, n) {
for (var r = 0, i = e.length; r < i; ++r) t.call(n, e[r], r, e)
};
var u = /^\s*$/,
f;
if (i) f = function (e) {
return e == null ? "" : i.call(e)
};
else {
var l, c;
a("Â ") ? (l = /^\s+/, c = /\s+$/) : (l = /^[\s\xA0]+/, c = /[\s\xA0]+$/), f = function (e) {
return e == null ? "" : String(e).replace(l, "").replace(c, "")
}
}
var h = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#39;",
"/": "&#x2F;"
},
b = {}
})(Mustache), function (e, t, n) {
t[e] = n()
}("reqwest", this, function () {
function handleReadyState(e, t, n) {
return function () {
if (e._aborted) return n(e.request);
e.request && e.request[readyState] == 4 && (e.request.onreadystatechange = noop, twoHundo.test(e.request.status) ? t(e.request) : n(e.request))
}
}
function setHeaders(e, t) {
var n = t.headers || {},
r;
n.Accept = n.Accept || defaultHeaders.accept[t.type] || defaultHeaders.accept["*"], !t.crossOrigin && !n[requestedWith] && (n[requestedWith] = defaultHeaders.requestedWith), n[contentType] || (n[contentType] = t.contentType || defaultHeaders.contentType);
for (r in n) n.hasOwnProperty(r) && e.setRequestHeader(r, n[r])
}
function setCredentials(e, t) {
typeof t.withCredentials != "undefined" && typeof e.withCredentials != "undefined" && (e.withCredentials = !! t.withCredentials)
}
function generalCallback(e) {
lastValue = e
}
function urlappend(e, t) {
return e + (/\?/.test(e) ? "&" : "?") + t
}
function handleJsonp(e, t, n, r) {
var i = uniqid++,
s = e.jsonpCallback || "callback",
o = e.jsonpCallbackName || reqwest.getcallbackPrefix(i),
u = new RegExp("((^|\\?|&)" + s + ")=([^&]+)"),
a = r.match(u),
f = doc.createElement("script"),
l = 0,
c = navigator.userAgent.indexOf("MSIE 10.0") !== -1;
return a ? a[3] === "?" ? r = r.replace(u, "$1=" + o) : o = a[3] : r = urlappend(r, s + "=" + o), win[o] = generalCallback, f.type = "text/javascript", f.src = r, f.async = !0, typeof f.onreadystatechange != "undefined" && !c && (f.event = "onclick", f.htmlFor = f.id = "_reqwest_" + i), f.onload = f.onreadystatechange = function () {
if (f[readyState] && f[readyState] !== "complete" && f[readyState] !== "loaded" || l) return !1;
f.onload = f.onreadystatechange = null, f.onclick && f.onclick(), e.success && e.success(lastValue), lastValue = undefined, head.removeChild(f), l = 1
}, head.appendChild(f), {
abort: function () {
f.onload = f.onreadystatechange = null, e.error && e.error({}, "Request is aborted: timeout", {}), lastValue = undefined, head.removeChild(f), l = 1
}
}
}
function getRequest(e, t) {
var n = this.o,
r = (n.method || "GET").toUpperCase(),
i = typeof n == "string" ? n : n.url,
s = n.processData !== !1 && n.data && typeof n.data != "string" ? reqwest.toQueryString(n.data) : n.data || null,
o;
return (n.type == "jsonp" || r == "GET") && s && (i = urlappend(i, s), s = null), n.type == "jsonp" ? handleJsonp(n, e, t, i) : (o = xhr(), o.open(r, i, !0), setHeaders(o, n), setCredentials(o, n), o.onreadystatechange = handleReadyState(this, e, t), n.before && n.before(o), o.send(s), o)
}
function Reqwest(e, t) {
this.o = e, this.fn = t, init.apply(this, arguments)
}
function setType(e) {
var t = e.match(/\.(json|jsonp|html|xml)(\?|$)/);
return t ? t[1] : "js"
}
function init(o, fn) {
function complete(e) {
o.timeout && clearTimeout(self.timeout), self.timeout = null;
while (self._completeHandlers.length > 0) self._completeHandlers.shift()(e)
}
function success(resp) {
var r = resp.responseText;
if (r) switch (type) {
case "json":
try {
resp = win.JSON ? win.JSON.parse(r) : eval("(" + r + ")")
} catch (err) {
return error(resp, "Could not parse JSON in response", err)
}
break;
case "js":
resp = eval(r);
break;
case "html":
resp = r;
break;
case "xml":
resp = resp.responseXML && resp.responseXML.parseError && resp.responseXML.parseError.errorCode && resp.responseXML.parseError.reason ? null : resp.responseXML
}
self._responseArgs.resp = resp, self._fulfilled = !0, fn(resp);
while (self._fulfillmentHandlers.length > 0) self._fulfillmentHandlers.shift()(resp);
complete(resp)
}
function error(e, t, n) {
self._responseArgs.resp = e, self._responseArgs.msg = t, self._responseArgs.t = n, self._erred = !0;
while (self._errorHandlers.length > 0) self._errorHandlers.shift()(e, t, n);
complete(e)
}
this.url = typeof o == "string" ? o : o.url, this.timeout = null, this._fulfilled = !1, this._fulfillmentHandlers = [], this._errorHandlers = [], this._completeHandlers = [], this._erred = !1, this._responseArgs = {};
var self = this,
type = o.type || setType(this.url);
fn = fn ||
function () {}, o.timeout && (this.timeout = setTimeout(function () {
self.abort()
}, o.timeout)), o.success && this._fulfillmentHandlers.push(function () {
o.success.apply(o, arguments)
}), o.error && this._errorHandlers.push(function () {
o.error.apply(o, arguments)
}), o.complete && this._completeHandlers.push(function () {
o.complete.apply(o, arguments)
}), this.request = getRequest.call(this, success, error)
}
function reqwest(e, t) {
return new Reqwest(e, t)
}
function normalize(e) {
return e ? e.replace(/\r?\n/g, "\r\n") : ""
}
function serial(e, t) {
var n = e.name,
r = e.tagName.toLowerCase(),
i = function (e) {
e && !e.disabled && t(n, normalize(e.attributes.value && e.attributes.value.specified ? e.value : e.text))
},
s, o, u, a;
if (e.disabled || !n) return;
switch (r) {
case "input":
/reset|button|image|file/i.test(e.type) || (s = /checkbox/i.test(e.type), o = /radio/i.test(e.type), u = e.value, (!s && !o || e.checked) && t(n, normalize(s && u === "" ? "on" : u)));
break;
case "textarea":
t(n, normalize(e.value));
break;
case "select":
if (e.type.toLowerCase() === "select-one") i(e.selectedIndex >= 0 ? e.options[e.selectedIndex] : null);
else for (a = 0; e.length && a < e.length; a++) e.options[a].selected && i(e.options[a])
}
}
function eachFormElement() {
var e = this,
t, n, r = function (t, n) {
var r, i, s;
for (r = 0; r < n.length; r++) {
s = t[byTag](n[r]);
for (i = 0; i < s.length; i++) serial(s[i], e)
}
};
for (n = 0; n < arguments.length; n++) t = arguments[n], /input|select|textarea/i.test(t.tagName) && serial(t, e), r(t, ["input", "select", "textarea"])
}
function serializeQueryString() {
return reqwest.toQueryString(reqwest.serializeArray.apply(null, arguments))
}
function serializeHash() {
var e = {};
return eachFormElement.apply(function (t, n) {
t in e ? (e[t] && !isArray(e[t]) && (e[t] = [e[t]]), e[t].push(n)) : e[t] = n
}, arguments), e
}
var win = window,
doc = document,
twoHundo = /^20\d$/,
byTag = "getElementsByTagName",
readyState = "readyState",
contentType = "Content-Type",
requestedWith = "X-Requested-With",
head = doc[byTag]("head")[0],
uniqid = 0,
callbackPrefix = "reqwest_" + +(new Date),
lastValue, xmlHttpRequest = "XMLHttpRequest",
noop = function () {},
isArray = typeof Array.isArray == "function" ? Array.isArray : function (e) {
return e instanceof Array
},
defaultHeaders = {
contentType: "application/x-www-form-urlencoded",
requestedWith: xmlHttpRequest,
accept: {
"*": "text/javascript, text/html, application/xml, text/xml, */*",
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
js: "application/javascript, text/javascript"
}
},
xhr = win[xmlHttpRequest] ?
function () {
return new XMLHttpRequest
} : function () {
return new ActiveXObject("Microsoft.XMLHTTP")
};
return Reqwest.prototype = {
abort: function () {
this._aborted = !0, this.request.abort()
},
retry: function () {
init.call(this, this.o, this.fn)
},
then: function (e, t) {
return this._fulfilled ? e(this._responseArgs.resp) : this._erred ? t(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) : (this._fulfillmentHandlers.push(e), this._errorHandlers.push(t)), this
},
always: function (e) {
return this._fulfilled || this._erred ? e(this._responseArgs.resp) : this._completeHandlers.push(e), this
},
fail: function (e) {
return this._erred ? e(this._responseArgs.resp, this._responseArgs.msg, this._responseArgs.t) : this._errorHandlers.push(e), this
}
}, reqwest.serializeArray = function () {
var e = [];
return eachFormElement.apply(function (t, n) {
e.push({
name: t,
value: n
})
}, arguments), e
}, reqwest.serialize = function () {
if (arguments.length === 0) return "";
var e, t, n = Array.prototype.slice.call(arguments, 0);
return e = n.pop(), e && e.nodeType && n.push(e) && (e = null), e && (e = e.type), e == "map" ? t = serializeHash : e == "array" ? t = reqwest.serializeArray : t = serializeQueryString, t.apply(null, n)
}, reqwest.toQueryString = function (e) {
var t = "",
n, r = encodeURIComponent,
i = function (e, n) {
t += r(e) + "=" + r(n) + "&"
},
s, o;
if (isArray(e)) for (n = 0; e && n < e.length; n++) i(e[n].name, e[n].value);
else for (s in e) {
if (!Object.hasOwnProperty.call(e, s)) continue;
o = e[s];
if (isArray(o)) for (n = 0; n < o.length; n++) i(s, o[n]);
else i(s, e[s])
}
return t.replace(/&$/, "").replace(/%20/g, "+")
}, reqwest.getcallbackPrefix = function () {
return callbackPrefix
}, reqwest.compat = function (e, t) {
return e && (e.type && (e.method = e.type) && delete e.type, e.dataType && (e.type = e.dataType), e.jsonpCallback && (e.jsonpCallbackName = e.jsonpCallback) && delete e.jsonpCallback, e.jsonp && (e.jsonpCallback = e.jsonp)), new Reqwest(e, t)
}, reqwest
}), wax = wax || {}, wax.attribution = function () {
var e = {},
t = document.createElement("div");
return t.className = "map-attribution", e.content = function (e) {
return typeof e == "undefined" ? t.innerHTML : (t.innerHTML = wax.u.sanitize(e), this)
}, e.element = function () {
return t
}, e.init = function () {
return this
}, e
}, wax = wax || {}, wax.bwdetect = function (e, t) {
function a() {
wax.bw = -1;
var e = new Image;
e.src = s;
var t = !0,
i = setTimeout(function () {
t && wax.bw == -1 && (n.bw(0), t = !1)
}, r);
e.onload = function () {
t && wax.bw == -1 && (clearTimeout(i), n.bw(1), t = !1)
}
}
var n = {},
r = e.threshold || 400,
s = "http://a.tiles.mapbox.com/mapbox/1.0.0/blue-marble-topo-bathy-jul/0/0/0.png?preventcache=" + +(new Date),
o = 1,
u = e.auto === undefined ? !0 : e.auto;
return n.bw = function (e) {
if (!arguments.length) return o;
var n = o;
wax.bwlisteners && wax.bwlisteners.length &&
function () {
listeners = wax.bwlisteners, wax.bwlisteners = [];
for (i = 0; i < listeners; i++) listeners[i](e)
}(), wax.bw = e, o != (o = e) && t(e)
}, n.add = function () {
return u && a(), this
}, wax.bw == -1 ? (wax.bwlisteners = wax.bwlisteners || [], wax.bwlisteners.push(n.bw)) : wax.bw !== undefined ? n.bw(wax.bw) : n.add(), n
}, wax.formatter = function (x) {
var formatter = {},
f;
if (x && typeof x == "string") try {
eval("f = " + x)
} catch (e) {
console && console.log(e)
} else x && typeof x == "function" ? f = x : f = function () {};
return formatter.format = function (e, t) {
try {
return wax.u.sanitize(f(e, t))
} catch (n) {
console && console.log(n)
}
}, formatter
}, wax.gi = function (e, t) {
function s(e) {
return e >= 93 && e--, e >= 35 && e--, e -= 32, e
}
t = t || {};
var n = {},
r = t.resolution || 4,
i = t.tileSize || 256;
return n.grid_tile = function () {
return e
}, n.getKey = function (t, n) {
if (!e || !e.grid) return;
if (n < 0 || t < 0) return;
if (Math.floor(n) >= i || Math.floor(t) >= i) return;
return s(e.grid[Math.floor(n / r)].charCodeAt(Math.floor(t / r)))
}, n.gridFeature = function (t, n) {
var r = this.getKey(t, n),
i = e.keys;
if (i && i[r] && e.data[i[r]]) return e.data[i[r]]
}, n.tileFeature = function (t, n, r) {
if (!e) return;
var i = wax.u.offset(r);
return feature = this.gridFeature(t - i.left, n - i.top), feature
}, n
}, wax.gm = function () {
function o(e) {
return typeof e == "string" && (e = [e]), function (r) {
if (!r) return;
var i = new RegExp(n.tileRegexp()),
s = i.exec(r);
if (!s) return;
return e[parseInt(s[2], 10) % e.length].replace(/\{z\}/g, s[1]).replace(/\{x\}/g, s[2]).replace(/\{y\}/g, s[3])
}
}
var e = 4,
t = {},
n = {},
r, i, s = function (e) {
if (e) return e.replace(/(\.png|\.jpg|\.jpeg)(\d*)/, ".grid.json")
};
return n.tileRegexp = function () {
var e = r.tiles[0],
t = e.indexOf("?");
t !== -1 && (e = e.substr(0, t)), e = e.replace(/[\(\)\?\$\*\+\^]/g, "."), e.indexOf("https") === 0 ? e = e.replace(":443", "[:0-9]*") : e.indexOf("http") === 0 && (e = e.replace(":80", "[:0-9]*"));
var n = "";
if (r.tiles.length > 1) {
var i = r.tiles[0],
s = r.tiles[1];
for (var o = 0; o < i.length; ++o) i.charAt(o) != s.charAt(o) ? n += "." : n += e.charAt(o) || ""
} else n = e;
return n.replace(/\{x\}/, "(\\d+)").replace(/\{y\}/, "(\\d+)").replace(/\{z\}/, "(\\d+)")
}, n.formatter = function (e) {
return arguments.length ? (i = wax.formatter(e), n) : i
}, n.template = function (e) {
return arguments.length ? (i = wax.template(e), n) : i
}, n.gridUrl = function (e) {
return arguments.length ? (e ? s = typeof e == "function" ? e : o(e) : s = function () {
return null
}, n) : s
}, n.getGrid = function (t, r) {
var o = s(t);
return !i || !o ? r(null, null) : (wax.request.get(o, function (t, n) {
if (t) return r(t, null);
r(null, wax.gi(n, {
formatter: i,
resolution: e
}))
}), n)
}, n.tilejson = function (t) {
return arguments.length ? (t.template ? n.template(t.template) : t.formatter ? n.formatter(t.formatter) : i = undefined, n.gridUrl(t.grids), t.resolution && (e = t.resolution), r = t, n) : r
}, n
}, wax = wax || {}, wax.hash = function (e) {
function i() {
return location.hash.substring(1)
}
function s(e) {
var t = window.location;
t.replace(t.toString().replace(t.hash || /$/, "#" + e))
}
function o(t) {
var n = t.split("/");
for (var r = 0; r < n.length; r++) {
n[r] = Number(n[r]);
if (isNaN(n[r])) return !0
}
if (n.length < 3) return !0;
n.length == 3 && e.setCenterZoom(n)
}
function u() {
var n = e.getCenterZoom();
t !== n && (t = n, s(t))
}
function a(e) {
if (e === t) return;
o(t = e) && u()
}
e = e || {};
var t, n = {},
r = 90 - 1e-8,
f = wax.u.throttle(u, 500);
return n.add = function () {
return a(i()), e.bindChange(f), n
}, n.remove = function () {
return e.unbindChange(f), n
}, n
}, wax = wax || {}, wax.interaction = function () {
function v(t) {
var n = o(),
r = new RegExp(e.tileRegexp());
for (var i = 0; i < n.length; i++) if (t) {
var s = n[i][0] <= t.y && n[i][0] + 256 > t.y && n[i][1] <= t.x && n[i][1] + 256 > t.x;
if (s && r.exec(n[i][2].src)) return n[i][2]
}
return !1
}
function m() {
return r ? (window.clearTimeout(r), r = null, !0) : !1
}
function g(r) {
if (n) return;
var i = r.type != "MSPointerMove" ? r : r.originalEvent,
s = wax.u.eventoffset(i);
t.screen_feature(s, function (n) {
n ? bean.fire(t, "on", {
parent: f(),
data: n,
formatter: e.formatter().format,
e: r
}) : bean.fire(t, "off")
})
}
function y(e) {
n = !0;
var r = e.type != "MSPointerDown" ? e : e.originalEvent;
i = wax.u.eventoffset(r), e.type === "mousedown" ? (bean.add(document.body, "click", E), bean.add(document.body, "mouseup", b)) : e.type === "touchstart" && e.touches.length === 1 ? (bean.fire(t, "off"), bean.add(f(), p)) : e.originalEvent.type === "MSPointerDown" && e.originalEvent.touches.length === 1 && (bean.fire(t, "off"), bean.add(f(), d))
}
function b() {
n = !1
}
function w() {
bean.remove(f(), p), bean.remove(f(), d), n = !1
}
function E(e) {
var o = {},
u = e.type != "MSPointerMove" && e.type != "MSPointerUp" ? e : e.originalEvent,
a = wax.u.eventoffset(u);
n = !1;
for (var l in u) o[l] = u[l];
return o.changedTouches = [], bean.remove(document.body, "mouseup", E), bean.remove(f(), p), bean.remove(f(), d), e.type === "touchend" ? t.click(e, i) : o.type === "MSPointerMove" || o.type === "MSPointerUp" ? t.click(o, a) : Math.round(a.y / s) === Math.round(i.y / s) && Math.round(a.x / s) === Math.round(i.x / s) && (r ? m() : r = window.setTimeout(function () {
r = null, t.click(o, a)
}, 150)), E
}
var e = wax.gm(),
t = {},
n = !1,
r = null,
i, s = 4,
o, u, a, f, l, c, h = {
mousemove: g,
touchstart: y,
mousedown: y
},
p = {
touchend: E,
touchmove: E,
touchcancel: w
},
d = {
MSPointerUp: E,
MSPointerMove: E,
MSPointerCancel: w
};
return t.click = function (n, r) {
t.screen_feature(r, function (r) {
r && bean.fire(t, "on", {
parent: f(),
data: r,
formatter: e.formatter().format,
e: n
})
})
}, t.screen_feature = function (t, n) {
var r = v(t);
r || n(null), e.getGrid(r.src, function (e, i) {
if (e || !i) return n(null);
var s = i.tileFeature(t.x, t.y, r);
n(s)
})
}, t.attach = function (e) {
return arguments.length ? (u = e, t) : u
}, t.detach = function (e) {
return arguments.length ? (a = e, t) : a
}, t.map = function (e) {
return arguments.length ? (l = e, u && u(l), bean.add(f(), h), bean.add(f(), "touchstart", y), bean.add(f(), "MSPointerDown", y), t) : l
}, t.grid = function (e) {
return arguments.length ? (o = e, t) : o
}, t.remove = function (e) {
return a && a(l), bean.remove(f(), h), bean.fire(t, "remove"), t
}, t.tilejson = function (n) {
return arguments.length ? (e.tilejson(n), t) : e.tilejson()
}, t.formatter = function () {
return e.formatter()
}, t.on = function (e, n) {
return bean.add(t, e, n), t
}, t.off = function (e, n) {
return bean.remove(t, e, n), t
}, t.gridmanager = function (n) {
return arguments.length ? (e = n, t) : e
}, t.parent = function (e) {
return f = e, t
}, t
};
var wax = wax || {};
wax.location = function () {
function t(e) {
if (e.e.type === "mousemove" || !e.e.type) return;
var t = e.formatter({
format: "location"
}, e.data);
t && (window.location.href = t)
}
var e = {};
return e.events = function () {
return {
on: t
}
}, e
};
var wax = wax || {};
wax.request = {
cache: {},
locks: {},
promises: {},
get: function (e, t) {
if (this.cache[e]) return t(this.cache[e][0], this.cache[e][1]);
this.promises[e] = this.promises[e] || [], this.promises[e].push(t);
if (this.locks[e]) return;
var n = this;
this.locks[e] = !0, reqwest({
url: e + (~e.indexOf("?") ? "&" : "?") + "callback=grid",
type: "jsonp",
jsonpCallback: "callback",
success: function (t) {
n.locks[e] = !1, n.cache[e] = [null, t];
for (var r = 0; r < n.promises[e].length; r++) n.promises[e][r](n.cache[e][0], n.cache[e][1])
},
error: function (t) {
n.locks[e] = !1, n.cache[e] = [t, null];
for (var r = 0; r < n.promises[e].length; r++) n.promises[e][r](n.cache[e][0], n.cache[e][1])
}
})
}
}, wax.template = function (e) {
var t = {};
return t.format = function (t, n) {
var r = {};
for (var i in n) r[i] = n[i];
return t.format && (r["__" + t.format + "__"] = !0), wax.u.sanitize(Mustache.to_html(e, r))
}, t
};
if (!wax) var wax = {};
wax.tilejson = function (e, t) {
reqwest({
url: e + (~e.indexOf("?") ? "&" : "?") + "callback=grid",
type: "jsonp",
jsonpCallback: "callback",
success: t,
error: t
})
};
var wax = wax || {};
wax.u = {
offset: function (e) {
var t = e.offsetWidth || parseInt(e.style.width, 10),
n = e.offsetHeight || parseInt(e.style.height, 10),
r = document.body,
i = 0,
s = 0,
o = function (e) {
if (e === r || e === document.documentElement) return;
i += e.offsetTop, s += e.offsetLeft;
var t = e.style.transform || e.style.WebkitTransform || e.style.OTransform || e.style.MozTransform || e.style.msTransform;
if (t) {
var n;
if (n = t.match(/translate\((.+)px, (.+)px\)/)) i += parseInt(n[2], 10), s += parseInt(n[1], 10);
else if (n = t.match(/translate3d\((.+)px, (.+)px, (.+)px\)/)) i += parseInt(n[2], 10), s += parseInt(n[1], 10);
else if (n = t.match(/matrix3d\(([\-\d,\s]+)\)/)) {
var o = n[1].split(",");
i += parseInt(o[13], 10), s += parseInt(o[12], 10)
} else if (n = t.match(/matrix\(.+, .+, .+, .+, (.+), (.+)\)/)) i += parseInt(n[2], 10), s += parseInt(n[1], 10)
}
};
if (typeof e.getBoundingClientRect != "undefined") {
var u = document.body,
a = e.ownerDocument.documentElement,
f = document.clientTop || u.clientTop || 0,
l = document.clientLeft || u.clientLeft || 0,
c = window.pageYOffset || a.scrollTop,
h = window.pageXOffset || a.scrollLeft,
p = e.getBoundingClientRect();
i = p.top + c - f, s = p.left + h - l
} else {
o(e);
try {
while (e = e.offsetParent) o(e)
} catch (d) {}
}
i += r.offsetTop, s += r.offsetLeft, i += r.parentNode.offsetTop, s += r.parentNode.offsetLeft;
var v = document.defaultView ? window.getComputedStyle(r.parentNode, null) : r.parentNode.currentStyle;
return r.parentNode.offsetTop !== parseInt(v.marginTop, 10) && !isNaN(parseInt(v.marginTop, 10)) && (i += parseInt(v.marginTop, 10), s += parseInt(v.marginLeft, 10)), {
top: i,
left: s,
height: n,
width: t
}
},
$: function (e) {
return typeof e == "string" ? document.getElementById(e) : e
},
eventoffset: function (e) {
var t = 0,
n = 0;
e || (e = window.event);
if (e.type == "MSPointerMove" || e.type == "MSPointerDown" || e.type == "MSPointerUp") return {
x: e.pageX + window.pageXOffset,
y: e.pageY + window.pageYOffset
};
if (e.pageX || e.pageY) return {
x: e.pageX,
y: e.pageY
};
if (e.clientX || e.clientY) return {
x: e.clientX,
y: e.clientY
};
if (e.touches && e.touches.length === 1) return {
x: e.touches[0].pageX,
y: e.touches[0].pageY
}
},
limit: function (e, t, n) {
var r;
return function () {
var i = this,
s = arguments,
o = function () {
r = null, e.apply(i, s)
};
n && clearTimeout(r);
if (n || !r) r = setTimeout(o, t)
}
},
throttle: function (e, t) {
return this.limit(e, t, !1)
},
sanitize: function (e) {
function t(e) {
if (/^(https?:\/\/|data:image)/.test(e)) return e
}
function n(e) {
return e
}
return e ? html_sanitize(e, t, n) : ""
}
}, wax = wax || {}, wax.leaf = wax.leaf || {}, wax.leaf.hash = function (e) {
return wax.hash({
getCenterZoom: function () {
var t = e.getCenter(),
n = e.getZoom(),
r = Math.max(0, Math.ceil(Math.log(n) / Math.LN2));
return [n, t.lat.toFixed(r), t.lng.toFixed(r)].join("/")
},
setCenterZoom: function (t) {
e.setView(new L.LatLng(t[1], t[2]), t[0])
},
bindChange: function (t) {
e.on("moveend", t)
},
unbindChange: function (t) {
e.off("moveend", t)
}
})
}, wax = wax || {}, wax.leaf = wax.leaf || {}, wax.leaf.interaction = function () {
function r() {
e = !0
}
function i() {
return !e && t ? t : t = function (e) {
var t = [];
for (var n in e) if (e[n]._tiles) for (var r in e[n]._tiles) {
var i = e[n]._tiles[r];
if (i.src) {
var s = wax.u.offset(i);
t.push([s.top, s.left, i])
}
}
return t
}(n._layers)
}
function s(e) {
if (!arguments.length) return n;
n = e;
var t = ["moveend"];
for (var i = 0; i < t.length; i++) n.on(t[i], r)
}
function o(e) {
if (!arguments.length) return n;
n = e;
var t = ["moveend"];
for (var i = 0; i < t.length; i++) n.off(t[i], r)
}
var e = !1,
t, n;
return wax.interaction().attach(s).detach(o).parent(function () {
return n._container
}).grid(i)
}, wax = wax || {}, wax.leaf = wax.leaf || {}, wax.leaf.connector = L.TileLayer.extend({
initialize: function (e) {
e = e || {}, e.minZoom = e.minzoom || 0, e.maxZoom = e.maxzoom || 22, L.TileLayer.prototype.initialize.call(this, e.tiles[0], e)
}
}), wax = wax || {}, wax.g = wax.g || {}, wax.g.attribution = function (e, t) {
t = t || {};
var n, r = {};
return r.element = function () {
return n.element()
}, r.appendTo = function (e) {
return wax.u.$(e).appendChild(n.element()), this
}, r.init = function () {
return n = wax.attribution(), n.content(t.attribution), n.element().className = "map-attribution map-g", this
}, r.init()
}, wax = wax || {}, wax.g = wax.g || {}, wax.g.bwdetect = function (e, t) {
t = t || {};
var n = t.png || ".png128",
r = t.jpg || ".jpg70";
if (!e.mapTypes["mb-low"]) {
var i = e.mapTypes.mb,
s = {
tiles: [],
scheme: i.options.scheme,
blankImage: i.options.blankImage,
minzoom: i.minZoom,
maxzoom: i.maxZoom,
name: i.name,
description: i.description
};
for (var o = 0; o < i.options.tiles.length; o++) s.tiles.push(i.options.tiles[o].replace(".png", n).replace(".jpg", r));
m.mapTypes.set("mb-low", new wax.g.connector(s))
}
return wax.bwdetect(t, function (t) {
e.setMapTypeId(t ? "mb" : "mb-low")
})
}, wax = wax || {}, wax.g = wax.g || {}, wax.g.hash = function (e) {
return wax.hash({
getCenterZoom: function () {
var t = e.getCenter(),
n = e.getZoom(),
r = Math.max(0, Math.ceil(Math.log(n) / Math.LN2));
return [n.toFixed(2), t.lat().toFixed(r), t.lng().toFixed(r)].join("/")
},
setCenterZoom: function (n) {
e.setCenter(new google.maps.LatLng(n[1], n[2])), e.setZoom(n[0])
},
bindChange: function (t) {
google.maps.event.addListener(e, "idle", t)
},
unbindChange: function (t) {
google.maps.event.removeListener(e, "idle", t)
}
})
}, wax = wax || {}, wax.g = wax.g || {}, wax.g.interaction = function () {
function s() {
e = !0
}
function o() {
if (!e && t) return t;
t = [];
var r = n.getZoom(),
i = wax.u.offset(n.getDiv()),
s = function (e) {
if (!e.interactive) return;
for (var n in e.cache) {
if (n.split("/")[0] != r) continue;
var i = wax.u.offset(e.cache[n]);
t.push([i.top, i.left, e.cache[n]])
}
};
for (var o in n.mapTypes) s(n.mapTypes[o]);
return n.overlayMapTypes.forEach(s), t
}
function u(e) {
if (!arguments.length) return n;
n = e, r = google.maps.event.addListener(n, "tileloaded", s), i = google.maps.event.addListener(n, "idle", s)
}
function a(e) {
r && google.maps.event.removeListener(r), i && google.maps.event.removeListener(i)
}
var e = !1,
t, n, r = null,
i = null;
return wax.interaction().attach(u).detach(a).parent(function () {
return n.getDiv()
}).grid(o)
};
var wax = wax || {};
wax.g = wax.g || {}, wax.g.connector = function (e) {
e = e || {}, this.options = {
tiles: e.tiles,
scheme: e.scheme || "xyz",
blankImage: e.blankImage || "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
}, this.opacity = e.opacity || 0, this.minZoom = e.minzoom || 0, this.maxZoom = e.maxzoom || 22, this.name = e.name || "", this.description = e.description || "", this.interactive = !0, this.tileSize = new google.maps.Size(256, 256), this.cache = {}
}, wax.g.connector.prototype.getTile = function (e, t, n) {
var r = t + "/" + e.x + "/" + e.y;
if (!this.cache[r]) {
var i = this.cache[r] = new Image(256, 256);
this.cache[r].src = this.getTileUrl(e, t), this.cache[r].setAttribute("gTileKey", r), this.cache[r].setAttribute("style", "opacity: " + this.opacity + "; filter: alpha(opacity=" + this.opacity * 100 + ");"), this.cache[r].onerror = function () {
i.style.display = "none"
}
}
return this.cache[r]
}, wax.g.connector.prototype.releaseTile = function (e) {
var t = e.getAttribute("gTileKey");
this.cache[t] && delete this.cache[t], e.parentNode && e.parentNode.removeChild(e)
}, wax.g.connector.prototype.getTileUrl = function (e, t) {
var n = Math.pow(2, t),
r = this.options.scheme === "tms" ? n - 1 - e.y : e.y,
i = e.x % n;
return i = i < 0 ? e.x % n + n : i, r < 0 ? this.options.blankImage : this.options.tiles[parseInt(i + r, 10) % this.options.tiles.length].replace(/\{z\}/g, t).replace(/\{x\}/g, i).replace(/\{y\}/g, r)
};
var GeoJSON = function (e, t) {
var n = function (e, t, s) {
var o;
switch (e.type) {
case "Point":
t.position = new google.maps.LatLng(e.coordinates[1], e.coordinates[0]), o = new google.maps.Marker(t), s && o.set("geojsonProperties", s);
break;
case "MultiPoint":
o = [];
for (var u = 0; u < e.coordinates.length; u++) t.position = new google.maps.LatLng(e.coordinates[u][1], e.coordinates[u][0]), o.push(new google.maps.Marker(t));
if (s) for (var a = 0; a < o.length; a++) o[a].set("geojsonProperties", s);
break;
case "LineString":
var f = [];
for (var u = 0; u < e.coordinates.length; u++) {
var l = e.coordinates[u],
c = new google.maps.LatLng(l[1], l[0]);
f.push(c)
}
t.path = f, o = new google.maps.Polyline(t), s && o.set("geojsonProperties", s);
break;
case "MultiLineString":
o = [];
for (var u = 0; u < e.coordinates.length; u++) {
var f = [];
for (var h = 0; h < e.coordinates[u].length; h++) {
var l = e.coordinates[u][h],
c = new google.maps.LatLng(l[1], l[0]);
f.push(c)
}
t.path = f, o.push(new google.maps.Polyline(t))
}
if (s) for (var a = 0; a < o.length; a++) o[a].set("geojsonProperties", s);
break;
case "Polygon":
var p = [],
d, v;
for (var u = 0; u < e.coordinates.length; u++) {
var f = [];
for (var h = 0; h < e.coordinates[u].length; h++) {
var c = new google.maps.LatLng(e.coordinates[u][h][1], e.coordinates[u][h][0]);
f.push(c)
}
u ? u == 1 ? (v = i(f), d == v ? p.push(f.reverse()) : p.push(f)) : d == v ? p.push(f.reverse()) : p.push(f) : (d = i(f), p.push(f))
}
t.paths = p, o = new google.maps.Polygon(t), s && o.set("geojsonProperties", s);
break;
case "MultiPolygon":
o = [];
for (var u = 0; u < e.coordinates.length; u++) {
var p = [],
d, v;
for (var h = 0; h < e.coordinates[u].length; h++) {
var f = [];
for (var a = 0; a < e.coordinates[u][h].length - 1; a++) {
var c = new google.maps.LatLng(e.coordinates[u][h][a][1], e.coordinates[u][h][a][0]);
f.push(c)
}
h ? h == 1 ? (v = i(f), d == v ? p.push(f.reverse()) : p.push(f)) : d == v ? p.push(f.reverse()) : p.push(f) : (d = i(f), p.push(f))
}
t.paths = p, o.push(new google.maps.Polygon(t))
}
if (s) for (var a = 0; a < o.length; a++) o[a].set("geojsonProperties", s);
break;
case "GeometryCollection":
o = [];
if (!e.geometries) o = r('Invalid GeoJSON object: GeometryCollection object missing "geometries" member.');
else for (var u = 0; u < e.geometries.length; u++) o.push(n(e.geometries[u], t, s || null));
break;
default:
o = r('Invalid GeoJSON object: Geometry object must be one of "Point", "LineString", "Polygon" or "MultiPolygon".')
}
return o
},
r = function (e) {
return {
type: "Error",
message: e
}
},
i = function (e) {
var t, n = 0;
for (var r = 0; r < e.length - 2; r++) n += (e[r + 1].lat() - e[r].lat()) * (e[r + 2].lng() - e[r].lng()) - (e[r + 2].lat() - e[r].lat()) * (e[r + 1].lng() - e[r].lng());
return n > 0 ? t = !0 : t = !1, t
},
s, o = t || {};
switch (e.type) {
case "FeatureCollection":
if (!e.features) s = r('Invalid GeoJSON object: FeatureCollection object missing "features" member.');
else {
s = [];
for (var u = 0; u < e.features.length; u++) s.push(n(e.features[u].geometry, o, e.features[u].properties))
}
break;
case "GeometryCollection":
if (!e.geometries) s = r('Invalid GeoJSON object: GeometryCollection object missing "geometries" member.');
else {
s = [];
for (var u = 0; u < e.geometries.length; u++) s.push(n(e.geometries[u], o))
}
break;
case "Feature":
!e.properties || !e.geometry ? s = r('Invalid GeoJSON object: Feature object missing "properties" or "geometry" member.') : s = n(e.geometry, o, e.properties);
break;
case "Point":
case "MultiPoint":
case "LineString":
case "MultiLineString":
case "Polygon":
case "MultiPolygon":
s = e.coordinates ? s = n(e, o) : r('Invalid GeoJSON object: Geometry object missing "coordinates" member.');
break;
default:
s = r('Invalid GeoJSON object: GeoJSON object must be one of "Point", "LineString", "Polygon", "MultiPolygon", "Feature", "FeatureCollection" or "GeometryCollection".')
}
return s
};
(function (e, t, n) {
e.fn.jScrollPane = function (r) {
function i(r, i) {
function V(t) {
var i, o, g, y, w, E, x = !1,
T = !1;
s = t;
if (u === n) w = r.scrollTop(), E = r.scrollLeft(), r.css({
overflow: "hidden",
padding: 0
}), a = r.innerWidth() + F, f = r.innerHeight(), r.width(a), u = e('<div class="jspPane" />').css("padding", j).append(r.children()), l = e('<div class="jspContainer" />').css({
width: a + "px",
height: f + "px"
}).append(u).appendTo(r);
else {
r.css("width", ""), x = s.stickToBottom && mt(), T = s.stickToRight && gt(), y = r.innerWidth() + F != a || r.outerHeight() != f, y && (a = r.innerWidth() + F, f = r.innerHeight(), l.css({
width: a + "px",
height: f + "px"
}));
if (!y && I == c && u.outerHeight() == h) {
r.width(a);
return
}
I = c, u.css("width", ""), r.width(a), l.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()
}
u.css("overflow", "auto"), t.contentWidth ? c = t.contentWidth : c = u[0].scrollWidth, h = u[0].scrollHeight, u.css("overflow", ""), p = c / a, d = h / f, v = d > 1, m = p > 1, !m && !v ? (r.removeClass("jspScrollable"), u.css({
top: 0,
width: l.width() - F
}), bt(), St(), Tt(), rt()) : (r.addClass("jspScrollable"), i = s.maintainPosition && (b || S), i && (o = dt(), g = vt()), J(), Q(), Y(), i && (ht(T ? c - a : o, !1), ct(x ? h - f : g, !1)), Et(), yt(), kt(), s.enableKeyboardNavigation && xt(), s.clickOnTrack && nt(), Nt(), s.hijackInternalLinks && Ct()), s.autoReinitialise && !B ? B = setInterval(function () {
V(s)
}, s.autoReinitialiseDelay) : !s.autoReinitialise && B && clearInterval(B), w && r.scrollTop(0) && ct(w, !1), E && r.scrollLeft(0) && ht(E, !1), r.trigger("jsp-initialised", [m || v])
}
function J() {
v && (l.append(e('<div class="jspVerticalBar" />').append(e('<div class="jspCap jspCapTop" />'), e('<div class="jspTrack" />').append(e('<div class="jspDrag" />').append(e('<div class="jspDragTop" />'), e('<div class="jspDragBottom" />'))), e('<div class="jspCap jspCapBottom" />'))), x = l.find(">.jspVerticalBar"), T = x.find(">.jspTrack"), g = T.find(">.jspDrag"), s.showArrows && (L = e('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp", et(0, -1)).bind("click.jsp", wt), A = e('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp", et(0, 1)).bind("click.jsp", wt), s.arrowScrollOnHover && (L.bind("mouseover.jsp", et(0, -1, L)), A.bind("mouseover.jsp", et(0, 1, A))), Z(T, s.verticalArrowPositions, L, A)), C = f, l.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function () {
C -= e(this).outerHeight()
}), g.hover(function () {
g.addClass("jspHover")
}, function () {
g.removeClass("jspHover")
}).bind("mousedown.jsp", function (t) {
e("html").bind("dragstart.jsp selectstart.jsp", wt), g.addClass("jspActive");
var n = t.pageY - g.position().top;
return e("html").bind("mousemove.jsp", function (e) {
st(e.pageY - n, !1)
}).bind("mouseup.jsp mouseleave.jsp", it), !1
}), K())
}
function K() {
T.height(C + "px"), b = 0, N = s.verticalGutter + T.outerWidth(), u.width(a - N - F);
try {
x.position().left === 0 && u.css("margin-left", N + "px")
} catch (e) {}
}
function Q() {
m && (l.append(e('<div class="jspHorizontalBar" />').append(e('<div class="jspCap jspCapLeft" />'), e('<div class="jspTrack" />').append(e('<div class="jspDrag" />').append(e('<div class="jspDragLeft" />'), e('<div class="jspDragRight" />'))), e('<div class="jspCap jspCapRight" />'))), O = l.find(">.jspHorizontalBar"), M = O.find(">.jspTrack"), w = M.find(">.jspDrag"), s.showArrows && (P = e('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp", et(-1, 0)).bind("click.jsp", wt), H = e('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp", et(1, 0)).bind("click.jsp", wt), s.arrowScrollOnHover && (P.bind("mouseover.jsp", et(-1, 0, P)), H.bind("mouseover.jsp", et(1, 0, H))), Z(M, s.horizontalArrowPositions, P, H)), w.hover(function () {
w.addClass("jspHover")
}, function () {
w.removeClass("jspHover")
}).bind("mousedown.jsp", function (t) {
e("html").bind("dragstart.jsp selectstart.jsp", wt), w.addClass("jspActive");
var n = t.pageX - w.position().left;
return e("html").bind("mousemove.jsp", function (e) {
ut(e.pageX - n, !1)
}).bind("mouseup.jsp mouseleave.jsp", it), !1
}), _ = l.innerWidth(), G())
}
function G() {
l.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function () {
_ -= e(this).outerWidth()
}), M.width(_ + "px"), S = 0
}
function Y() {
if (m && v) {
var t = M.outerHeight(),
n = T.outerWidth();
C -= t, e(O).find(">.jspCap:visible,>.jspArrow").each(function () {
_ += e(this).outerWidth()
}), _ -= n, f -= n, a -= t, M.parent().append(e('<div class="jspCorner" />').css("width", t + "px")), K(), G()
}
m && u.width(l.outerWidth() - F + "px"), h = u.outerHeight(), d = h / f, m && (D = Math.ceil(1 / p * _), D > s.horizontalDragMaxWidth ? D = s.horizontalDragMaxWidth : D < s.horizontalDragMinWidth && (D = s.horizontalDragMinWidth), w.width(D + "px"), E = _ - D, at(S)), v && (k = Math.ceil(1 / d * C), k > s.verticalDragMaxHeight ? k = s.verticalDragMaxHeight : k < s.verticalDragMinHeight && (k = s.verticalDragMinHeight), g.height(k + "px"), y = C - k, ot(b))
}
function Z(e, t, n, r) {
var i = "before",
s = "after",
o;
t == "os" && (t = /Mac/.test(navigator.platform) ? "after" : "split"), t == i ? s = t : t == s && (i = t, o = n, n = r, r = o), e[i](n)[s](r)
}
function et(e, t, n) {
return function () {
return tt(e, t, this, n), this.blur(), !1
}
}
function tt(t, n, r, i) {
r = e(r).addClass("jspActive");
var u, a, f = !0,
l = function () {
t !== 0 && o.scrollByX(t * s.arrowButtonSpeed), n !== 0 && o.scrollByY(n * s.arrowButtonSpeed), a = setTimeout(l, f ? s.initialDelay : s.arrowRepeatFreq), f = !1
};
l(), u = i ? "mouseout.jsp" : "mouseup.jsp", i = i || e("html"), i.bind(u, function () {
r.removeClass("jspActive"), a && clearTimeout(a), a = null, i.unbind(u)
})
}
function nt() {
rt(), v && T.bind("mousedown.jsp", function (t) {
if (t.originalTarget === n || t.originalTarget == t.currentTarget) {
var r = e(this),
i = r.offset(),
u = t.pageY - i.top - b,
a, l = !0,
c = function () {
var e = r.offset(),
n = t.pageY - e.top - k / 2,
i = f * s.scrollPagePercent,
d = y * i / (h - f);
if (u < 0) b - d > n ? o.scrollByY(-i) : st(n);
else {
if (!(u > 0)) {
p();
return
}
b + d < n ? o.scrollByY(i) : st(n)
}
a = setTimeout(c, l ? s.initialDelay : s.trackClickRepeatFreq), l = !1
},
p = function () {
a && clearTimeout(a), a = null, e(document).unbind("mouseup.jsp", p)
};
return c(), e(document).bind("mouseup.jsp", p), !1
}
}), m && M.bind("mousedown.jsp", function (t) {
if (t.originalTarget === n || t.originalTarget == t.currentTarget) {
var r = e(this),
i = r.offset(),
u = t.pageX - i.left - S,
f, l = !0,
h = function () {
var e = r.offset(),
n = t.pageX - e.left - D / 2,
i = a * s.scrollPagePercent,
d = E * i / (c - a);
if (u < 0) S - d > n ? o.scrollByX(-i) : ut(n);
else {
if (!(u > 0)) {
p();
return
}
S + d < n ? o.scrollByX(i) : ut(n)
}
f = setTimeout(h, l ? s.initialDelay : s.trackClickRepeatFreq), l = !1
},
p = function () {
f && clearTimeout(f), f = null, e(document).unbind("mouseup.jsp", p)
};
return h(), e(document).bind("mouseup.jsp", p), !1
}
})
}
function rt() {
M && M.unbind("mousedown.jsp"), T && T.unbind("mousedown.jsp")
}
function it() {
e("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp"), g && g.removeClass("jspActive"), w && w.removeClass("jspActive")
}
function st(e, t) {
if (!v) return;
e < 0 ? e = 0 : e > y && (e = y), t === n && (t = s.animateScroll), t ? o.animate(g, "top", e, ot) : (g.css("top", e), ot(e))
}
function ot(e) {
e === n && (e = g.position().top), l.scrollTop(0), b = e;
var t = b === 0,
i = b == y,
s = e / y,
o = -s * (h - f);
if (q != t || U != i) q = t, U = i, r.trigger("jsp-arrow-change", [q, U, R, z]);
ft(t, i), u.css("top", o), r.trigger("jsp-scroll-y", [-o, t, i]).trigger("scroll")
}
function ut(e, t) {
if (!m) return;
e < 0 ? e = 0 : e > E && (e = E), t === n && (t = s.animateScroll), t ? o.animate(w, "left", e, at) : (w.css("left", e), at(e))
}
function at(e) {
e === n && (e = w.position().left), l.scrollTop(0), S = e;
var t = S === 0,
i = S == E,
s = e / E,
o = -s * (c - a);
if (R != t || z != i) R = t, z = i, r.trigger("jsp-arrow-change", [q, U, R, z]);
lt(t, i), u.css("left", o), r.trigger("jsp-scroll-x", [-o, t, i]).trigger("scroll")
}
function ft(e, t) {
s.showArrows && (L[e ? "addClass" : "removeClass"]("jspDisabled"), A[t ? "addClass" : "removeClass"]("jspDisabled"))
}
function lt(e, t) {
s.showArrows && (P[e ? "addClass" : "removeClass"]("jspDisabled"), H[t ? "addClass" : "removeClass"]("jspDisabled"))
}
function ct(e, t) {
var n = e / (h - f);
st(n * y, t)
}
function ht(e, t) {
var n = e / (c - a);
ut(n * E, t)
}
function pt(t, n, r) {
var i, o, u, c = 0,
h = 0,
p, d, v, m, g, y;
try {
i = e(t)
} catch (b) {
return
}
o = i.outerHeight(), u = i.outerWidth(), l.scrollTop(0), l.scrollLeft(0);
while (!i.is(".jspPane")) {
c += i.position().top, h += i.position().left, i = i.offsetParent();
if (/^body|html$/i.test(i[0].nodeName)) return
}
p = vt(), v = p + f, c < p || n ? g = c - s.verticalGutter : c + o > v && (g = c - f + o + s.verticalGutter), g && ct(g, r), d = dt(), m = d + a, h < d || n ? y = h - s.horizontalGutter : h + u > m && (y = h - a + u + s.horizontalGutter), y && ht(y, r)
}
function dt() {
return -u.position().left
}
function vt() {
return -u.position().top
}
function mt() {
var e = h - f;
return e > 20 && e - vt() < 10
}
function gt() {
var e = c - a;
return e > 20 && e - dt() < 10
}
function yt() {
l.unbind(X).bind(X, function (e, t, n, r) {
var i = S,
u = b;
return o.scrollBy(n * s.mouseWheelSpeed, -r * s.mouseWheelSpeed, !1), i == S && u == b
})
}
function bt() {
l.unbind(X)
}
function wt() {
return !1
}
function Et() {
u.find(":input,a").unbind("focus.jsp").bind("focus.jsp", function (e) {
pt(e.target, !1)
})
}
function St() {
u.find(":input,a").unbind("focus.jsp")
}
function xt() {
function a() {
var e = S,
r = b;
switch (t) {
case 40:
o.scrollByY(s.keyboardSpeed, !1);
break;
case 38:
o.scrollByY(-s.keyboardSpeed, !1);
break;
case 34:
case 32:
o.scrollByY(f * s.scrollPagePercent, !1);
break;
case 33:
o.scrollByY(-f * s.scrollPagePercent, !1);
break;
case 39:
o.scrollByX(s.keyboardSpeed, !1);
break;
case 37:
o.scrollByX(-s.keyboardSpeed, !1)
}
return n = e != S || r != b, n
}
var t, n, i = [];
m && i.push(O[0]), v && i.push(x[0]), u.focus(function () {
r.focus()
}), r.attr("tabindex", 0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp", function (r) {
if (r.target !== this && (!i.length || !e(r.target).closest(i).length)) return;
var s = S,
o = b;
switch (r.keyCode) {
case 40:
case 38:
case 34:
case 32:
case 33:
case 39:
case 37:
t = r.keyCode, a();
break;
case 35:
ct(h - f), t = null;
break;
case 36:
ct(0), t = null
}
return n = r.keyCode == t && s != S || o != b, !n
}).bind("keypress.jsp", function (e) {
return e.keyCode == t && a(), !n
}), s.hideFocus ? (r.css("outline", "none"), "hideFocus" in l[0] && r.attr("hideFocus", !0)) : (r.css("outline", ""), "hideFocus" in l[0] && r.attr("hideFocus", !1))
}
function Tt() {
r.attr("tabindex", "-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")
}
function Nt() {
if (location.hash && location.hash.length > 1) {
var t, n, r = escape(location.hash.substr(1));
try {
t = e("#" + r + ', a[name="' + r + '"]')
} catch (i) {
return
}
t.length && u.find(r) && (l.scrollTop() === 0 ? n = setInterval(function () {
l.scrollTop() > 0 && (pt(t, !0), e(document).scrollTop(l.position().top), clearInterval(n))
}, 50) : (pt(t, !0), e(document).scrollTop(l.position().top)))
}
}
function Ct() {
if (e(document.body).data("jspHijack")) return;
e(document.body).data("jspHijack", !0), e(document.body).delegate("a[href*=#]", "click", function (n) {
var r = this.href.substr(0, this.href.indexOf("#")),
i = location.href,
s, o, u, a, f, l;
location.href.indexOf("#") !== -1 && (i = location.href.substr(0, location.href.indexOf("#")));
if (r !== i) return;
s = escape(this.href.substr(this.href.indexOf("#") + 1)), o;
try {
o = e("#" + s + ', a[name="' + s + '"]')
} catch (c) {
return
}
if (!o.length) return;
u = o.closest(".jspScrollable"), a = u.data("jsp"), a.scrollToElement(o, !0), u[0].scrollIntoView && (f = e(t).scrollTop(), l = o.offset().top, (l < f || l > f + e(t).height()) && u[0].scrollIntoView()), n.preventDefault()
})
}
function kt() {
var e, t, n, r, i, s = !1;
l.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp", function (o) {
var u = o.originalEvent.touches[0];
e = dt(), t = vt(), n = u.pageX, r = u.pageY, i = !1, s = !0
}).bind("touchmove.jsp", function (u) {
if (!s) return;
var a = u.originalEvent.touches[0],
f = S,
l = b;
return o.scrollTo(e + n - a.pageX, t + r - a.pageY), i = i || Math.abs(n - a.pageX) > 5 || Math.abs(r - a.pageY) > 5, f == S && l == b
}).bind("touchend.jsp", function (e) {
s = !1
}).bind("click.jsp-touchclick", function (e) {
if (i) return i = !1, !1
})
}
function Lt() {
var e = vt(),
t = dt();
r.removeClass("jspScrollable").unbind(".jsp"), r.replaceWith(W.append(u.children())), W.scrollTop(e), W.scrollLeft(t), B && clearInterval(B)
}
var s, o = this,
u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S, x, T, N, C, k, L, A, O, M, _, D, P, H, B, j, F, I, q = !0,
R = !0,
U = !1,
z = !1,
W = r.clone(!1, !1).empty(),
X = e.fn.mwheelIntent ? "mwheelIntent.jsp" : "mousewheel.jsp";
j = r.css("paddingTop") + " " + r.css("paddingRight") + " " + r.css("paddingBottom") + " " + r.css("paddingLeft"), F = (parseInt(r.css("paddingLeft"), 10) || 0) + (parseInt(r.css("paddingRight"), 10) || 0), e.extend(o, {
reinitialise: function (t) {
t = e.extend({}, s, t), V(t)
},
scrollToElement: function (e, t, n) {
pt(e, t, n)
},
scrollTo: function (e, t, n) {
ht(e, n), ct(t, n)
},
scrollToX: function (e, t) {
ht(e, t)
},
scrollToY: function (e, t) {
ct(e, t)
},
scrollToPercentX: function (e, t) {
ht(e * (c - a), t)
},
scrollToPercentY: function (e, t) {
ct(e * (h - f), t)
},
scrollBy: function (e, t, n) {
o.scrollByX(e, n), o.scrollByY(t, n)
},
scrollByX: function (e, t) {
var n = dt() + Math[e < 0 ? "floor" : "ceil"](e),
r = n / (c - a);
ut(r * E, t)
},
scrollByY: function (e, t) {
var n = vt() + Math[e < 0 ? "floor" : "ceil"](e),
r = n / (h - f);
st(r * y, t)
},
positionDragX: function (e, t) {
ut(e, t)
},
positionDragY: function (e, t) {
st(e, t)
},
animate: function (e, t, n, r) {
var i = {};
i[t] = n, e.animate(i, {
duration: s.animateDuration,
easing: s.animateEase,
queue: !1,
step: r
})
},
getContentPositionX: function () {
return dt()
},
getContentPositionY: function () {
return vt()
},
getContentWidth: function () {
return c
},
getContentHeight: function () {
return h
},
getPercentScrolledX: function () {
return dt() / (c - a)
},
getPercentScrolledY: function () {
return vt() / (h - f)
},
getIsScrollableH: function () {
return m
},
getIsScrollableV: function () {
return v
},
getContentPane: function () {
return u
},
scrollToBottom: function (e) {
st(y, e)
},
hijackInternalLinks: e.noop,
destroy: function () {
Lt()
}
}), V(i)
}
return r = e.extend({}, e.fn.jScrollPane.defaults, r), e.each(["mouseWheelSpeed", "arrowButtonSpeed", "trackClickSpeed", "keyboardSpeed"], function () {
r[this] = r[this] || r.speed
}), this.each(function () {
var t = e(this),
n = t.data("jsp");
n ? n.reinitialise(r) : (e("script", t).filter('[type="text/javascript"],:not([type])').remove(), n = new i(t, r), t.data("jsp", n))
})
}, e.fn.jScrollPane.defaults = {
showArrows: !1,
maintainPosition: !0,
stickToBottom: !1,
stickToRight: !1,
clickOnTrack: !0,
autoReinitialise: !1,
autoReinitialiseDelay: 500,
verticalDragMinHeight: 0,
verticalDragMaxHeight: 99999,
horizontalDragMinWidth: 0,
horizontalDragMaxWidth: 99999,
contentWidth: n,
animateScroll: !1,
animateDuration: 300,
animateEase: "linear",
hijackInternalLinks: !1,
verticalGutter: 4,
horizontalGutter: 4,
mouseWheelSpeed: 0,
arrowButtonSpeed: 0,
arrowRepeatFreq: 50,
arrowScrollOnHover: !1,
trackClickSpeed: 0,
trackClickRepeatFreq: 70,
verticalArrowPositions: "split",
horizontalArrowPositions: "split",
enableKeyboardNavigation: !0,
hideFocus: !1,
keyboardSpeed: 0,
initialDelay: 300,
speed: 30,
scrollPagePercent: .8
}
})(jQuery, this), function (e) {
function r(t) {
var n = t || window.event,
r = [].slice.call(arguments, 1),
i = 0,
s = !0,
o = 0,
u = 0;
return t = e.event.fix(n), t.type = "mousewheel", n.wheelDelta && (i = n.wheelDelta / 120), n.detail && (i = -n.detail / 3), u = i, n.axis !== undefined && n.axis === n.HORIZONTAL_AXIS && (u = 0, o = -1 * i), n.wheelDeltaY !== undefined && (u = n.wheelDeltaY / 120), n.wheelDeltaX !== undefined && (o = -1 * n.wheelDeltaX / 120), r.unshift(t, i, o, u), (e.event.dispatch || e.event.handle).apply(this, r)
}
var t = ["DOMMouseScroll", "mousewheel"];
if (e.event.fixHooks) for (var n = t.length; n;) e.event.fixHooks[t[--n]] = e.event.mouseHooks;
e.event.special.mousewheel = {
setup: function () {
if (this.addEventListener) for (var e = t.length; e;) this.addEventListener(t[--e], r, !1);
else this.onmousewheel = r
},
teardown: function () {
if (this.removeEventListener) for (var e = t.length; e;) this.removeEventListener(t[--e], r, !1);
else this.onmousewheel = null
}
}, e.fn.extend({
mousewheel: function (e) {
return e ? this.bind("mousewheel", e) : this.trigger("mousewheel")
},
unmousewheel: function (e) {
return this.unbind("mousewheel", e)
}
})
}(jQuery), function (e) {
function a() {
this === t.elem && (t.pos = [-260, -260], t.elem = !1, n = 3)
}
var t = {
pos: [-260, -260]
},
n = 3,
r = document,
i = r.documentElement,
s = r.body,
o, u;
e.event.special.mwheelIntent = {
setup: function () {
var t = e(this).bind("mousewheel", e.event.special.mwheelIntent.handler);
return this !== r && this !== i && this !== s && t.bind("mouseleave", a), t = null, !0
},
teardown: function () {
return e(this).unbind("mousewheel", e.event.special.mwheelIntent.handler).unbind("mouseleave", a), !0
},
handler: function (r, i) {
var s = [r.clientX, r.clientY];
if (this === t.elem || Math.abs(t.pos[0] - s[0]) > n || Math.abs(t.pos[1] - s[1]) > n) return t.elem = this, t.pos = s, n = 250, clearTimeout(u), u = setTimeout(function () {
n = 10
}, 200), clearTimeout(o), o = setTimeout(function () {
n = 3
}, 1500), r = e.extend({}, r, {
type: "mwheelIntent"
}), e.event.handle.apply(this, arguments)
}
}, e.fn.extend({
mwheelIntent: function (e) {
return e ? this.bind("mwheelIntent", e) : this.trigger("mwheelIntent")
},
unmwheelIntent: function (e) {
return this.unbind("mwheelIntent", e)
}
}), e(function () {
s = r.body, e(r).bind("mwheelIntent.mwheelIntentDefault", e.noop)
})
}(jQuery), function (e, t, n) {
function r(e, n) {
var r = t.createElement(e || "div"),
i;
for (i in n) r[i] = n[i];
return r
}
function i(e) {
for (var t = 1, n = arguments.length; t < n; t++) e.appendChild(arguments[t]);
return e
}
function s(e, t, n, r) {
var i = ["opacity", t, ~~ (e * 100), n, r].join("-"),
s = .01 + n / r * 100,
o = Math.max(1 - (1 - e) / t * (100 - s), e),
u = h.substring(0, h.indexOf("Animation")).toLowerCase(),
a = u && "-" + u + "-" || "";
return c[i] || (p.insertRule("@" + a + "keyframes " + i + "{" + "0%{opacity:" + o + "}" + s + "%{opacity:" + e + "}" + (s + .01) + "%{opacity:1}" + (s + t) % 100 + "%{opacity:" + e + "}" + "100%{opacity:" + o + "}" + "}", 0), c[i] = 1), i
}
function o(e, t) {
var r = e.style,
i, s;
if (r[t] !== n) return t;
t = t.charAt(0).toUpperCase() + t.slice(1);
for (s = 0; s < l.length; s++) {
i = l[s] + t;
if (r[i] !== n) return i
}
}
function u(e, t) {
for (var n in t) e.style[o(e, n) || n] = t[n];
return e
}
function a(e) {
for (var t = 1; t < arguments.length; t++) {
var r = arguments[t];
for (var i in r) e[i] === n && (e[i] = r[i])
}
return e
}
function f(e) {
var t = {
x: e.offsetLeft,
y: e.offsetTop
};
while (e = e.offsetParent) t.x += e.offsetLeft, t.y += e.offsetTop;
return t
}
var l = ["webkit", "Moz", "ms", "O"],
c = {},
h, p = function () {
var e = r("style");
return i(t.getElementsByTagName("head")[0], e), e.sheet || e.styleSheet
}(),
d = {
lines: 12,
length: 7,
width: 5,
radius: 10,
rotate: 0,
color: "#000",
speed: 1,
trail: 100,
opacity: .25,
fps: 20,
zIndex: 2e9,
className: "spinner",
top: "auto",
left: "auto"
},
v = function m(e) {
if (!this.spin) return new m(e);
this.opts = a(e || {}, m.defaults, d)
};
v.defaults = {}, a(v.prototype, {
spin: function (e) {
this.stop();
var t = this,
n = t.opts,
i = t.el = u(r(0, {
className: n.className
}), {
position: "relative",
zIndex: n.zIndex
}),
s = n.radius + n.length + n.width,
o, a;
e && (e.insertBefore(i, e.firstChild || null), a = f(e), o = f(i), u(i, {
left: (n.left == "auto" ? a.x - o.x + (e.offsetWidth >> 1) : n.left + s) + "px",
top: (n.top == "auto" ? a.y - o.y + (e.offsetHeight >> 1) : n.top + s) + "px"
})), i.setAttribute("aria-role", "progressbar"), t.lines(i, t.opts);
if (!h) {
var l = 0,
c = n.fps,
p = c / n.speed,
d = (1 - n.opacity) / (p * n.trail / 100),
v = p / n.lines;
!
function m() {
l++;
for (var e = n.lines; e; e--) {
var r = Math.max(1 - (l + e * v) % p * d, n.opacity);
t.opacity(i, n.lines - e, r, n)
}
t.timeout = t.el && setTimeout(m, ~~ (1e3 / c))
}()
}
return t
},
stop: function () {
var e = this.el;
return e && (clearTimeout(this.timeout), e.parentNode && e.parentNode.removeChild(e), this.el = n), this
},
lines: function (e, t) {
function n(e, n) {
return u(r(), {
position: "absolute",
width: t.length + t.width + "px",
height: t.width + "px",
background: e,
boxShadow: n,
transformOrigin: "left",
transform: "rotate(" + ~~ (360 / t.lines * o + t.rotate) + "deg) translate(" + t.radius + "px" + ",0)",
borderRadius: (t.width >> 1) + "px"
})
}
var o = 0,
a;
for (; o < t.lines; o++) a = u(r(), {
position: "absolute",
top: 1 + ~ (t.width / 2) + "px",
transform: t.hwaccel ? "translate3d(0,0,0)" : "",
opacity: t.opacity,
animation: h && s(t.opacity, t.trail, o, t.lines) + " " + 1 / t.speed + "s linear infinite"
}), t.shadow && i(a, u(n("#000", "0 0 4px #000"), {
top: "2px"
})), i(e, i(a, n(t.color, "0 0 1px rgba(0,0,0,.1)")));
return e
},
opacity: function (e, t, n) {
t < e.childNodes.length && (e.childNodes[t].style.opacity = n)
}
}), !
function () {
function e(e, t) {
return r("<" + e + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', t)
}
var t = u(r("group"), {
behavior: "url(#default#VML)"
});
!o(t, "transform") && t.adj ? (p.addRule(".spin-vml", "behavior:url(#default#VML)"), v.prototype.lines = function (t, n) {
function r() {
return u(e("group", {
coordsize: a + " " + a,
coordorigin: -o + " " + -o
}), {
width: a,
height: a
})
}
function s(t, s, a) {
i(l, i(u(r(), {
rotation: 360 / n.lines * t + "deg",
left: ~~s
}), i(u(e("roundrect", {
arcsize: 1
}), {
width: o,
height: n.width,
left: n.radius,
top: -n.width >> 1,
filter: a
}), e("fill", {
color: n.color,
opacity: n.opacity
}), e("stroke", {
opacity: 0
}))))
}
var o = n.length + n.width,
a = 2 * o,
f = -(n.width + n.length) * 2 + "px",
l = u(r(), {
position: "absolute",
top: f,
left: f
}),
c;
if (n.shadow) for (c = 1; c <= n.lines; c++) s(c, -2, "progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");
for (c = 1; c <= n.lines; c++) s(c);
return i(t, l)
}, v.prototype.opacity = function (e, t, n, r) {
var i = e.firstChild;
r = r.shadow && r.lines || 0, i && t + r < i.childNodes.length && (i = i.childNodes[t + r], i = i && i.firstChild, i = i && i.firstChild, i && (i.opacity = n))
}) : h = o(t, "animation")
}(), e.Spinner = v
}(window, document);
var LZMA = function () {
function r(e, t) {
postMessage({
action: 3,
callback_num: t,
result: e
})
}
function y() {
return eo
}
function b() {}
function w() {
return to
}
function E() {}
function S() {
return no
}
function x() {}
function T(e, t) {
return e.detailMessage = t, e
}
function N() {
return ro
}
function C() {}
function k(e, t) {
return e
}
function L() {
return io
}
function A() {}
function O(e, t) {
e[e.explicitLength++] = t
}
function M(e, t) {
e[e.explicitLength++] = t
}
function _(e) {
var t, n;
return t = (n = e.join(""), e.length = e.explicitLength = 0, n), e[e.explicitLength++] = t, t
}
function D(e, t) {
var n = new Array(t);
if (e > 0) {
var r = [null, 0, !1, [0, 0]][e];
for (var i = 0; i < t; ++i) n[i] = r
}
return n
}
function P() {
return this.arrayClass$
}
function H(e, t, n, r, i) {
var s;
return s = D(i, r), I(), R(s, U, z), s.arrayClass$ = e, s.typeId$ = t, s.queryId$ = n, s
}
function B(e, t, n, r) {
return I(), R(r, U, z), r.arrayClass$ = e, r.typeId$ = t, r.queryId$ = n, r
}
function j(e, t, n) {
if (n != null) {
if (e.queryId$ > 0 && !X(n.typeId$, e.queryId$)) throw new nn;
if (e.queryId$ < 0 && (n.typeMarker$ == Zs || n.typeId$ == 2)) throw new nn
}
return e[t] = n
}
function F() {}
function I() {
I = Zs, U = [], z = [], q(new F, U, z)
}
function q(e, t, n) {
var r = 0,
i;
for (var s in e) if (i = e[s]) t[r] = s, n[r] = i, ++r
}
function R(e, t, n) {
I();
for (var r = 0, i = t.length; r < i; ++r) e[t[r]] = n[r]
}
function W(e, t) {
return e && !! K[e][t]
}
function X(e, t) {
return e && K[e][t]
}
function V(e, t) {
if (e != null && !X(e.typeId$, t)) throw new ln;
return e
}
function $(e, t) {
return e != null && W(e.typeId$, t)
}
function J(e) {
return ~~Math.max(Math.min(e, 2147483647), -2147483648)
}
function Q(e) {
return e != null && W(e.typeId$, 2) ? e : k(new A, e)
}
function G(e, t) {
var n, r;
return n = e[1] + t[1], r = e[0] + t[0], tt(r, n)
}
function Y(e, t, n) {
return t == 0 ? e : n == 0 ? e : G(e, tt(t * n, 0))
}
function Z(e, t) {
return at(~~Math.max(Math.min(e[1] / 4294967296, 2147483647), -2147483648) & ~~Math.max(Math.min(t[1] / 4294967296, 2147483647), -2147483648), ut(e) & ut(t))
}
function et(e, t) {
var n, r;
return e[0] == t[0] && e[1] == t[1] ? 0 : (n = e[1] < 0, r = t[1] < 0, n && !r ? -1 : !n && r ? 1 : mt(e, t)[1] < 0 ? -1 : 1)
}
function tt(e, t) {
var n, r;
t %= 0x10000000000000000, e %= 0x10000000000000000, n = t % 4294967296, r = Math.floor(e / 4294967296) * 4294967296, t = t - n + r, e = e - r + n;
while (e < 0) e += 4294967296, t -= 4294967296;
while (e > 4294967295) e -= 4294967296, t += 4294967296;
t %= 0x10000000000000000;
while (t > 0x7fffffff00000000) t -= 0x10000000000000000;
while (t < -0x8000000000000000) t += 0x10000000000000000;
return [e, t]
}
function nt(e, t) {
var n, r, i, s, o, u;
if (t[0] == 0 && t[1] == 0) throw Gt(new Zt, "/ by zero");
if (e[0] == 0 && e[1] == 0) return St(), Ot;
if (rt(e, (St(), Nt))) return rt(t, kt) || rt(t, Ct) ? Nt : (s = dt(e, 1), n = pt(nt(s, t), 1), o = mt(e, ft(t, n)), G(n, nt(o, t)));
if (rt(t, Nt)) return Ot;
if (e[1] < 0) return t[1] < 0 ? nt(ct(e), ct(t)) : ct(nt(ct(e), t));
if (t[1] < 0) return ct(nt(e, ct(t)));
u = Ot, o = e;
while (et(o, t) >= 0) i = it(Math.floor(gt(o) / yt(t))), i[0] == 0 && i[1] == 0 && (i = kt), r = ft(i, t), u = G(u, i), o = mt(o, r);
return u
}
function rt(e, t) {
return e[0] == t[0] && e[1] == t[1]
}
function it(e) {
return isNaN(e) ? (St(), Ot) : e < -0x8000000000000000 ? (St(), Nt) : e >= 0x8000000000000000 ? (St(), Tt) : e > 0 ? tt(Math.floor(e), 0) : tt(Math.ceil(e), 0)
}
function st(e) {
var t, n;
return e > -129 && e < 128 ? (t = e + 128, n = (wt(), Et)[t], n == null && (n = Et[t] = ot(e)), n) : ot(e)
}
function ot(e) {
return e >= 0 ? [e, 0] : [e + 4294967296, -4294967296]
}
function ut(e) {
return e[0] >= 2147483648 ? ~~Math.max(Math.min(e[0] - 4294967296, 2147483647), -2147483648) : ~~Math.max(Math.min(e[0], 2147483647), -2147483648)
}
function at(e, t) {
var n, r;
return n = e * 4294967296, r = t, t < 0 && (r += 4294967296), [r, n]
}
function ft(e, t) {
var n, r, i, s, o, u, a, f, l;
return e[0] == 0 && e[1] == 0 ? (St(), Ot) : t[0] == 0 && t[1] == 0 ? (St(), Ot) : rt(e, (St(), Nt)) ? lt(t) : rt(t, Nt) ? lt(e) : e[1] < 0 ? t[1] < 0 ? ft(ct(e), ct(t)) : ct(ft(ct(e), t)) : t[1] < 0 ? ct(ft(e, ct(t))) : et(e, At) < 0 && et(t, At) < 0 ? tt((e[1] + e[0]) * (t[1] + t[0]), 0) : (i = e[1] % 281474976710656, s = e[1] - i, n = e[0] % 65536, r = e[0] - n, a = t[1] % 281474976710656, f = t[1] - a, o = t[0] % 65536, u = t[0] - o, l = Ot, l = Y(l, s, o), l = Y(l, i, u), l = Y(l, i, o), l = Y(l, r, a), l = Y(l, r, u), l = Y(l, r, o), l = Y(l, n, f), l = Y(l, n, a), l = Y(l, n, u), l = Y(l, n, o), l)
}
function lt(e) {
return (ut(e) & 1) == 1 ? (St(), Nt) : (St(), Ot)
}
function ct(e) {
var t, n;
return rt(e, (St(), Nt)) ? Nt : (t = -e[1], n = -e[0], n > 4294967295 && (n -= 4294967296, t += 4294967296), n < 0 && (n += 4294967296, t -= 4294967296), [n, t])
}
function ht(e) {
return e <= 30 ? 1 << e : ht(30) * ht(e - 30)
}
function pt(e, t) {
var n, r, i, s;
return t &= 63, rt(e, (St(), Nt)) ? t == 0 ? e : Ot : e[1] < 0 ? ct(pt(ct(e), t)) : (s = ht(t), r = e[1] * s % 0x10000000000000000, i = e[0] * s, n = i - i % 4294967296, r += n, i -= n, r >= 0x8000000000000000 && (r -= 0x10000000000000000), [i, r])
}
function dt(e, t) {
var n, r, i;
return t &= 63, i = ht(t), n = e[1] / i, r = Math.floor(e[0] / i), tt(r, n)
}
function vt(e, t) {
var n;
return t &= 63, n = dt(e, t), e[1] < 0 && (n = G(n, pt((St(), Lt), 63 - t))), n
}
function mt(e, t) {
var n, r;
return n = e[1] - t[1], r = e[0] - t[0], tt(r, n)
}
function gt(e) {
var t, n, r;
return n = J(Math.log(e[1]) / (St(), xt)), n <= 48 ? e[1] + e[0] : (t = n - 48, r = (1 << t) - 1, e[1] + (e[0] - r))
}
function yt(e) {
var t, n, r;
return n = J(Math.log(e[1]) / (St(), xt)), n <= 48 ? e[1] + e[0] : (t = n - 48, r = (1 << t) - 1, e[1] + (e[0] + r))
}
function bt(e) {
var t, n, r, i, s, o;
if (e[0] == 0 && e[1] == 0) return "0";
if (rt(e, (St(), Nt))) return "-9223372036854775808";
if (e[1] < 0) return "-" + bt(ct(e));
n = e, i = "";
while (n[0] != 0 || n[1] != 0) {
s = st(1e9), r = nt(n, s), t = "" + ut(mt(n, ft(r, s))), n = r;
if (n[0] != 0 || n[1] != 0) {
o = 9 - t.length;
for (; o > 0; --o) t = "0" + t
}
i = t + i
}
return i
}
function wt() {
wt = Zs, Et = H(oo, 0, 9, 256, 0)
}
function St() {
St = Zs, xt = Math.log(2), Tt = g, Nt = u, Ct = st(-1), kt = st(1), Lt = st(2), At = d, Ot = st(0)
}
function Mt() {
return uo
}
function _t() {}
function Dt(e, t) {
return Pt(e, t, 0, t.length), e
}
function Pt(e, t, n, r) {
return e.buf = t, e.pos = n, e.count = n + r, e.count > t.length && (e.count = t.length), e
}
function Ht(e) {
return e.pos >= e.count ? -1 : e.buf[e.pos++] & 255
}
function Bt(e, t, n, r) {
return e.pos >= e.count ? -1 : (r = En(r, e.count - e.pos), On(e.buf, e.pos, t, n, r), e.pos += r, r)
}
function jt() {
return ao
}
function Ft() {}
function It() {
return lo
}
function qt() {}
function Rt(e) {
return e.buf = H(fo, 0, -1, 32, 1), e
}
function Ut(e, t) {
var n;
if (t <= e.buf.length) return;
t = wn(t, e.buf.length * 2), n = H(fo, 0, -1, t, 1), On(e.buf, 0, n, 0, e.buf.length), e.buf = n
}
function zt(e) {
var t;
return t = H(fo, 0, -1, e.count, 1), On(e.buf, 0, t, 0, e.count), t
}
function Wt(e, t) {
Ut(e, e.count + 1), e.buf[e.count++] = t << 24 >> 24
}
function Xt(e, t, n, r) {
Ut(e, e.count + r), On(t, n, e.buf, e.count, r), e.count += r
}
function Vt() {
return co
}
function $t() {}
function Jt(e, t) {
return e.detailMessage = t, e
}
function Kt() {
return ho
}
function Qt() {}
function Gt(e, t) {
return e.detailMessage = t, e
}
function Yt() {
return vo
}
function Zt() {}
function en(e, t) {
return e.detailMessage = t, e
}
function tn() {
return mo
}
function nn() {}
function rn(e, t) {
var n;
return n = new an, n.typeName = e + t, n
}
function sn(e, t) {
var n;
return n = new an, n.typeName = e + t, n
}
function on(e, t) {
var n;
return n = new an, n.typeName = e + t, n
}
function un() {
return yo
}
function an() {}
function fn() {
return bo
}
function ln() {}
function cn() {
return po
}
function hn() {}
function pn(e, t) {
return e.detailMessage = t, e
}
function dn() {
return wo
}
function vn() {}
function mn() {
return Eo
}
function gn() {}
function yn() {
return So
}
function bn() {}
function wn(e, t) {
return e > t ? e : t
}
function En(e, t) {
return e < t ? e : t
}
function Sn() {
return To
}
function xn() {}
function Tn(e, t) {
return t == null ? !1 : String(e) == t
}
function Nn(e, t, n, r, i) {
var s;
for (s = t; s < n; ++s) r[i++] = e.charCodeAt(s)
}
function Cn() {
return No
}
function kn(e) {
var t;
return e.data = (t = [], t.explicitLength = 0, t), e
}
function Ln() {
return Co
}
function An() {}
function On(e, t, n, r, i) {
var s, o, u, a, f, l, c, h;
if (e == null || n == null) throw new xn;
c = (e.typeMarker$ == Zs || e.typeId$ == 2 ? e.getClass$() : so).typeName, u = (n.typeMarker$ == Zs || n.typeId$ == 2 ? n.getClass$() : so).typeName;
if (c.charCodeAt(0) != 91 || u.charCodeAt(0) != 91) throw en(new nn, "Must be array types");
if (c.charCodeAt(1) != u.charCodeAt(1)) throw en(new nn, "Array types must match");
h = e.length, a = n.length;
if (t < 0 || r < 0 || i < 0 || t + i > h || r + i > a) throw new bn;
if (c.charCodeAt(1) != 76 && c.charCodeAt(1) != 91 || !! Tn(c, u)) for (f = 0; f < i; ++f) n[r + f] = e[t + f];
else {
l = V(e, 3), s = V(n, 3);
if ((e == null ? null : e) === (n == null ? null : n) && t < r) {
t += i;
for (o = r + i; o-- > r;) j(s, o, l[--t])
} else for (o = r + i; r < o;) j(s, r++, l[t++])
}
}
function Mn(e, t) {
if (!Ti(t, 1 << e.dictionarySize)) throw T(new C, "unexpected failure");
if (!ki(t, e.fb)) throw T(new C, "unexpected failure");
if (!Ci(t, e.matchFinder)) throw T(new C, "unexpected failure");
if (!Ni(t, e.lc, e.lp, e.pb)) throw T(new C, "unexpected failure")
}
function _n() {
return Zo
}
function Dn() {}
function Pn(e) {
var t;
try {
return Ar(e.chunker)
} catch (t) {
t = Q(t);
if ($(t, 10)) return !1;
throw t
}
}
function Hn(e, t, n, r, i) {
var s, o;
if (!i) throw pn(new vn, "null mode");
if (et(r, a) < 0) throw pn(new vn, "invalid length " + bt(r));
e.length_0 = r, s = ci(new Di), Mn(i, s), s._writeEndMark = !0, Li(s, n);
for (o = 0; o < 64; o += 8) Wt(n, ut(dt(r, o)) & 255);
e.chunker = (s._needReleaseMFStream = !1, s._inStream = t, s._finished = !1, li(s), s._rangeEncoder.Stream = n, bi(s), pi(s), hi(s), s._lenEncoder._tableSize = s._numFastBytes + 1 - 2, Wi(s._lenEncoder, 1 << s._posStateBits), s._repMatchLenEncoder._tableSize = s._numFastBytes + 1 - 2, Wi(s._repMatchLenEncoder, 1 << s._posStateBits), s.nowPos64 = f, undefined, kr(new Dr, s))
}
function Bn() {
return eu
}
function jn() {}
function Fn(e, t, n) {
var r;
e.output = Rt(new $t);
try {
Hn(e, Dt(new Ft, t), e.output, st(t.length), n)
} catch (r) {
throw r = Q(r), $(r, 10) ? T(new C, "impossible exception") : r
}
return e
}
function In() {
return tu
}
function qn() {}
function Rn(e) {
var t, n;
try {
return Ar(e.chunker)
} catch (t) {
t = Q(t);
if ($(t, 10)) return n = t, e.exception = n, !1;
throw t
}
}
function Un(e, t, n) {
var r, i = "",
s, o, u, f;
o = H(fo, 0, -1, 5, 1);
for (s = 0; s < o.length; ++s) {
u = Ht(t);
if (u == -1) throw Jt(new Qt, "truncated input");
o[s] = u << 24 >> 24
}
r = jr(new zr);
if (!Ir(r, o)) throw Jt(new Qt, "corrupted input");
for (s = 0; s < 64; s += 8) {
u = Ht(t);
if (u == -1) throw Jt(new Qt, "truncated input");
u = u.toString(16), u.length == 1 && (u = "0" + u), i = u + "" + i
}
i.toLowerCase() == "ffffffffffffffffff" || i == 0 ? e.length_0 = a : (f = parseInt(i, 16), f > 4294967295 ? e.length_0 = a : e.length_0 = it(f)), e.chunker = Hr(r, t, n, e.length_0)
}
function zn() {
return nu
}
function Wn() {}
function Xn(e, t) {
return e.output = Rt(new $t), Un(e, Dt(new Ft, t), e.output), e
}
function Vn() {
return ru
}
function $n() {}
function Jn(e, t, n, r) {
var i;
e._keepSizeBefore = t, e._keepSizeAfter = n, i = t + n + r;
if (e._bufferBase == null || e._blockSize != i) e._bufferBase = null, e._blockSize = i, e._bufferBase = H(fo, 0, -1, e._blockSize, 1);
e._pointerToLastSafePosition = e._blockSize - n
}
function Kn(e, t) {
return e._bufferBase[e._bufferOffset + e._pos + t]
}
function Qn(e, t, n, r) {
var i, s;
e._streamEndWasReached && e._pos + t + r > e._streamPos && (r = e._streamPos - (e._pos + t)), ++n, s = e._bufferOffset + e._pos + t;
for (i = 0; i < r && e._bufferBase[s + i] == e._bufferBase[s + i - n]; ++i);
return i
}
function Gn(e) {
return e._streamPos - e._pos
}
function Yn(e) {
var t, n, r;
r = e._bufferOffset + e._pos - e._keepSizeBefore, r > 0 && --r, n = e._bufferOffset + e._streamPos - r;
for (t = 0; t < n; ++t) e._bufferBase[t] = e._bufferBase[r + t];
e._bufferOffset -= r
}
function Zn(e) {
var t;
++e._pos, e._pos > e._posLimit && (t = e._bufferOffset + e._pos, t > e._pointerToLastSafePosition && Yn(e), er(e))
}
function er(e) {
var t, n, r;
if (e._streamEndWasReached) return;
for (;;) {
r = -e._bufferOffset + e._blockSize - e._streamPos;
if (r == 0) return;
t = Bt(e._stream, e._bufferBase, e._bufferOffset + e._streamPos, r);
if (t == -1) {
e._posLimit = e._streamPos, n = e._bufferOffset + e._posLimit, n > e._pointerToLastSafePosition && (e._posLimit = e._pointerToLastSafePosition - e._bufferOffset), e._streamEndWasReached = !0;
return
}
e._streamPos += t, e._streamPos >= e._pos + e._keepSizeAfter && (e._posLimit = e._streamPos - e._keepSizeAfter)
}
}
function tr(e, t) {
e._bufferOffset += t, e._posLimit -= t, e._pos -= t, e._streamPos -= t
}
function nr() {
return ko
}
function rr() {}
function ir() {
ir = Zs;
var e, t, n;
dr = H(xo, 0, -1, 256, 1);
for (e = 0; e < 256; ++e) {
n = e;
for (t = 0; t < 8; ++t)(n & 1) != 0 ? n = n >>> 1 ^ -306674912 : n >>>= 1;
dr[e] = n
}
}
function sr(e, t, n, r, i) {
var s, o, u;
return t > 1073741567 ? !1 : (e._cutValue = 16 + (r >> 1), u = ~~ ((t + n + r + i) / 2) + 256, Jn(e, t + n, r + i, u), e._matchMaxLen = r, s = t + 1, e._cyclicBufferSize != s && (e._son = H(xo, 0, -1, (e._cyclicBufferSize = s) * 2, 1)), o = 65536, e.HASH_ARRAY && (o = t - 1, o |= o >> 1, o |= o >> 2, o |= o >> 4, o |= o >> 8, o >>= 1, o |= 65535, o > 16777216 && (o >>= 1), e._hashMask = o, ++o, o += e.kFixHashSize), o != e._hashSizeSum && (e._hash = H(xo, 0, -1, e._hashSizeSum = o, 1)), !0)
}
function or(e, t) {
var n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S;
if (e._pos + e._matchMaxLen <= e._streamPos) v = e._matchMaxLen;
else {
v = e._streamPos - e._pos;
if (v < e.kMinMatchCheck) return ar(e), 0
}
y = 0, m = e._pos > e._cyclicBufferSize ? e._pos - e._cyclicBufferSize : 0, r = e._bufferOffset + e._pos, g = 1, f = 0, l = 0, e.HASH_ARRAY ? (S = dr[e._bufferBase[r] & 255] ^ e._bufferBase[r + 1] & 255, f = S & 1023, S ^= (e._bufferBase[r + 2] & 255) << 8, l = S & 65535, c = (S ^ dr[e._bufferBase[r + 3] & 255] << 5) & e._hashMask) : c = e._bufferBase[r] & 255 ^ (e._bufferBase[r + 1] & 255) << 8, i = e._hash[e.kFixHashSize + c], e.HASH_ARRAY && (s = e._hash[f], o = e._hash[1024 + l], e._hash[f] = e._pos, e._hash[1024 + l] = e._pos, s > m && e._bufferBase[e._bufferOffset + s] == e._bufferBase[r] && (t[y++] = g = 2, t[y++] = e._pos - s - 1), o > m && e._bufferBase[e._bufferOffset + o] == e._bufferBase[r] && (o == s && (y -= 2), t[y++] = g = 3, t[y++] = e._pos - o - 1, s = o), y != 0 && s == i && (y -= 2, g = 1)), e._hash[e.kFixHashSize + c] = e._pos, w = (e._cyclicBufferPos << 1) + 1, E = e._cyclicBufferPos << 1, p = d = e.kNumHashDirectBytes, e.kNumHashDirectBytes != 0 && i > m && e._bufferBase[e._bufferOffset + i + e.kNumHashDirectBytes] != e._bufferBase[r + e.kNumHashDirectBytes] && (t[y++] = g = e.kNumHashDirectBytes, t[y++] = e._pos - i - 1), n = e._cutValue;
for (;;) {
if (i <= m || n-- == 0) {
e._son[w] = e._son[E] = 0;
break
}
a = e._pos - i, u = (a <= e._cyclicBufferPos ? e._cyclicBufferPos - a : e._cyclicBufferPos - a + e._cyclicBufferSize) << 1, b = e._bufferOffset + i, h = p < d ? p : d;
if (e._bufferBase[b + h] == e._bufferBase[r + h]) {
while (++h != v) if (e._bufferBase[b + h] != e._bufferBase[r + h]) break;
if (g < h) {
t[y++] = g = h, t[y++] = a - 1;
if (h == v) {
e._son[E] = e._son[u], e._son[w] = e._son[u + 1];
break
}
}
}(e._bufferBase[b + h] & 255) < (e._bufferBase[r + h] & 255) ? (e._son[E] = i, E = u + 1, i = e._son[E], d = h) : (e._son[w] = i, w = u, i = e._son[w], p = h)
}
return ar(e), y
}
function ur(e) {
var t;
e._bufferOffset = 0, e._pos = 0, e._streamPos = 0, e._streamEndWasReached = !1, er(e);
for (t = 0; t < e._hashSizeSum; ++t) e._hash[t] = 0;
e._cyclicBufferPos = 0, tr(e, -1)
}
function ar(e) {
var t;
++e._cyclicBufferPos >= e._cyclicBufferSize && (e._cyclicBufferPos = 0), Zn(e), e._pos == 1073741823 && (t = e._pos - e._cyclicBufferSize, fr(e._son, e._cyclicBufferSize * 2, t), fr(e._hash, e._hashSizeSum, t), tr(e, t))
}
function fr(e, t, n) {
var r, i;
for (r = 0; r < t; ++r) i = e[r], i <= n ? i = 0 : i -= n, e[r] = i
}
function lr(e, t) {
e.HASH_ARRAY = t > 2, e.HASH_ARRAY ? (e.kNumHashDirectBytes = 0, e.kMinMatchCheck = 4, e.kFixHashSize = 66560) : (e.kNumHashDirectBytes = 2, e.kMinMatchCheck = 3, e.kFixHashSize = 0)
}
function cr(e, t) {
var n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y;
do {
if (e._pos + e._matchMaxLen <= e._streamPos) p = e._matchMaxLen;
else {
p = e._streamPos - e._pos;
if (p < e.kMinMatchCheck) {
ar(e);
continue
}
}
d = e._pos > e._cyclicBufferSize ? e._pos - e._cyclicBufferSize : 0, r = e._bufferOffset + e._pos, e.HASH_ARRAY ? (y = dr[e._bufferBase[r] & 255] ^ e._bufferBase[r + 1] & 255, u = y & 1023, e._hash[u] = e._pos, y ^= (e._bufferBase[r + 2] & 255) << 8, a = y & 65535, e._hash[1024 + a] = e._pos, f = (y ^ dr[e._bufferBase[r + 3] & 255] << 5) & e._hashMask) : f = e._bufferBase[r] & 255 ^ (e._bufferBase[r + 1] & 255) << 8, i = e._hash[e.kFixHashSize + f], e._hash[e.kFixHashSize + f] = e._pos, m = (e._cyclicBufferPos << 1) + 1, g = e._cyclicBufferPos << 1, c = h = e.kNumHashDirectBytes, n = e._cutValue;
for (;;) {
if (i <= d || n-- == 0) {
e._son[m] = e._son[g] = 0;
break
}
o = e._pos - i, s = (o <= e._cyclicBufferPos ? e._cyclicBufferPos - o : e._cyclicBufferPos - o + e._cyclicBufferSize) << 1, v = e._bufferOffset + i, l = c < h ? c : h;
if (e._bufferBase[v + l] == e._bufferBase[r + l]) {
while (++l != p) if (e._bufferBase[v + l] != e._bufferBase[r + l]) break;
if (l == p) {
e._son[g] = e._son[s], e._son[m] = e._son[s + 1];
break
}
}(e._bufferBase[v + l] & 255) < (e._bufferBase[r + l] & 255) ? (e._son[g] = i, g = s + 1, i = e._son[g], h = l) : (e._son[m] = i, m = s, i = e._son[m], c = l)
}
ar(e)
} while (--t != 0)
}
function hr() {
return Lo
}
function pr() {}
function vr(e, t, n) {
var r;
r = e._pos - t - 1, r < 0 && (r += e._windowSize);
for (; n != 0; --n) r >= e._windowSize && (r = 0), e._buffer[e._pos++] = e._buffer[r++], e._pos >= e._windowSize && gr(e)
}
function mr(e, t) {
if (e._buffer == null || e._windowSize != t) e._buffer = H(fo, 0, -1, t, 1);
e._windowSize = t, e._pos = 0, e._streamPos = 0
}
function gr(e) {
var t;
t = e._pos - e._streamPos;
if (t == 0) return;
Xt(e._stream, e._buffer, e._streamPos, t), e._pos >= e._windowSize && (e._pos = 0), e._streamPos = e._pos
}
function yr(e, t) {
var n;
return n = e._pos - t - 1, n < 0 && (n += e._windowSize), e._buffer[n]
}
function br(e, t) {
t || (e._streamPos = 0, e._pos = 0)
}
function wr(e, t) {
e._buffer[e._pos++] = t, e._pos >= e._windowSize && gr(e)
}
function Er(e) {
gr(e), e._stream = null
}
function Sr(e, t) {
gr(e), e._stream = null, e._stream = t
}
function xr() {
return Ao
}
function Tr() {}
function Nr(e) {
return e -= 2, e < 4 ? e : 3
}
function Cr(e) {
return e < 4 ? 0 : e < 10 ? e - 3 : e - 6
}
function kr(e, t) {
return e.encoder = t, e.decoder = null, e.alive = !0, e
}
function Lr(e, t) {
return e.decoder = t, e.encoder = null, e.alive = !0, e
}
function Ar(e) {
var t;
if (!e.alive) throw new gn;
t = !0;
try {
return e.encoder ? Mr(e) : Or(e), t = !1, e.alive
} finally {
t && (e.alive = !1)
}
}
function Or(e) {
var t;
t = Br(e.decoder);
if (t == -1) throw Jt(new Qt, "corrupted input");
e.inBytesProcessed = a, e.outBytesProcessed = e.decoder.nowPos64;
if (t == 1 || et(e.decoder.outSize, f) >= 0 && et(e.decoder.nowPos64, e.decoder.outSize) >= 0) Pr(e.decoder), e.alive = !1
}
function Mr(e) {
fi(e.encoder, e.encoder.processedInSize, e.encoder.processedOutSize, e.encoder.finished), e.inBytesProcessed = e.encoder.processedInSize[0], e.encoder.finished[0] && (xi(e.encoder), e.alive = !1)
}
function _r() {
return Oo
}
function Dr() {}
function Pr(e) {
gr(e.m_OutWindow), Er(e.m_OutWindow), e.m_RangeDecoder.Stream = null
}
function Hr(e, t, n, r) {
return e.m_RangeDecoder.Stream = t, Sr(e.m_OutWindow, n), Fr(e), e.state = 0, e.rep0 = 0, e.rep1 = 0, e.rep2 = 0, e.rep3 = 0, e.outSize = r, e.nowPos64 = f, e.prevByte = 0, Lr(new Dr, e)
}
function Br(e) {
var t, n, r, i, s, o;
o = ut(e.nowPos64) & e.m_PosStateMask;
if (xs(e.m_RangeDecoder, e.m_IsMatchDecoders, (e.state << 4) + o) == 0) t = Gr(e.m_LiteralDecoder, ut(e.nowPos64), e.prevByte), e.state < 7 ? e.prevByte = ti(t, e.m_RangeDecoder) : e.prevByte = ni(t, e.m_RangeDecoder, yr(e.m_OutWindow, e.rep0)), wr(e.m_OutWindow, e.prevByte), e.state = Cr(e.state), e.nowPos64 = G(e.nowPos64, l);
else {
if (xs(e.m_RangeDecoder, e.m_IsRepDecoders, e.state) == 1) r = 0, xs(e.m_RangeDecoder, e.m_IsRepG0Decoders, e.state) == 0 ? xs(e.m_RangeDecoder, e.m_IsRep0LongDecoders, (e.state << 4) + o) == 0 && (e.state = e.state < 7 ? 9 : 11, r = 1) : (xs(e.m_RangeDecoder, e.m_IsRepG1Decoders, e.state) == 0 ? n = e.rep1 : (xs(e.m_RangeDecoder, e.m_IsRepG2Decoders, e.state) == 0 ? n = e.rep2 : (n = e.rep3, e.rep3 = e.rep2), e.rep2 = e.rep1), e.rep1 = e.rep0, e.rep0 = n), r == 0 && (r = Xr(e.m_RepLenDecoder, e.m_RangeDecoder, o) + 2, e.state = e.state < 7 ? 8 : 11);
else {
e.rep3 = e.rep2, e.rep2 = e.rep1, e.rep1 = e.rep0, r = 2 + Xr(e.m_LenDecoder, e.m_RangeDecoder, o), e.state = e.state < 7 ? 7 : 10, s = fs(e.m_PosSlotDecoder[Nr(r)], e.m_RangeDecoder);
if (s >= 4) {
i = (s >> 1) - 1, e.rep0 = (2 | s & 1) << i;
if (s < 14) e.rep0 += cs(e.m_PosDecoders, e.rep0 - s - 1, e.m_RangeDecoder, i);
else {
e.rep0 += Ts(e.m_RangeDecoder, i - 4) << 4, e.rep0 += ls(e.m_PosAlignDecoder, e.m_RangeDecoder);
if (e.rep0 < 0) return e.rep0 == -1 ? 1 : -1
}
} else e.rep0 = s
}
if (et(st(e.rep0), e.nowPos64) >= 0 || e.rep0 >= e.m_DictionarySizeCheck) return -1;
vr(e.m_OutWindow, e.rep0, r), e.nowPos64 = G(e.nowPos64, st(r)), e.prevByte = yr(e.m_OutWindow, 0)
}
return 0
}
function jr(e) {
var t;
e.m_OutWindow = new Tr, e.m_RangeDecoder = new Ls, e.m_IsMatchDecoders = H(Mo, 0, -1, 192, 1), e.m_IsRepDecoders = H(Mo, 0, -1, 12, 1), e.m_IsRepG0Decoders = H(Mo, 0, -1, 12, 1), e.m_IsRepG1Decoders = H(Mo, 0, -1, 12, 1), e.m_IsRepG2Decoders = H(Mo, 0, -1, 12, 1), e.m_IsRep0LongDecoders = H(Mo, 0, -1, 192, 1), e.m_PosSlotDecoder = H(_o, 0, 7, 4, 0), e.m_PosDecoders = H(Mo, 0, -1, 114, 1), e.m_PosAlignDecoder = as(new ps, 4), e.m_LenDecoder = Vr(new Kr), e.m_RepLenDecoder = Vr(new Kr), e.m_LiteralDecoder = new ei;
for (t = 0; t < 4; ++t) e.m_PosSlotDecoder[t] = as(new ps, 6);
return e
}
function Fr(e) {
var t;
br(e.m_OutWindow, !1), Cs(e.m_IsMatchDecoders), Cs(e.m_IsRep0LongDecoders), Cs(e.m_IsRepDecoders), Cs(e.m_IsRepG0Decoders), Cs(e.m_IsRepG1Decoders), Cs(e.m_IsRepG2Decoders), Cs(e.m_PosDecoders), Yr(e.m_LiteralDecoder);
for (t = 0; t < 4; ++t) Cs(e.m_PosSlotDecoder[t].Models);
$r(e.m_LenDecoder), $r(e.m_RepLenDecoder), Cs(e.m_PosAlignDecoder.Models), Ns(e.m_RangeDecoder)
}
function Ir(e, t) {
var n, r, i, s, o, u, a;
if (t.length < 5) return !1;
a = t[0] & 255, i = a % 9, u = ~~ (a / 9), s = u % 5, o = ~~ (u / 5), n = 0;
for (r = 0; r < 4; ++r) n += (t[1 + r] & 255) << r * 8;
return Rr(e, i, s, o) ? qr(e, n) : !1
}
function qr(e, t) {
return t < 0 ? !1 : (e.m_DictionarySize != t && (e.m_DictionarySize = t, e.m_DictionarySizeCheck = wn(e.m_DictionarySize, 1), mr(e.m_OutWindow, wn(e.m_DictionarySizeCheck, 4096))), !0)
}
function Rr(e, t, n, r) {
var i;
return t > 8 || n > 4 || r > 4 ? !1 : (Qr(e.m_LiteralDecoder, n, t), i = 1 << r, Wr(e.m_LenDecoder, i), Wr(e.m_RepLenDecoder, i), e.m_PosStateMask = i - 1, !0)
}
function Ur() {
return Do
}
function zr() {}
function Wr(e, t) {
for (; e.m_NumPosStates < t; ++e.m_NumPosStates) e.m_LowCoder[e.m_NumPosStates] = as(new ps, 3), e.m_MidCoder[e.m_NumPosStates] = as(new ps, 3)
}
function Xr(e, t, n) {
var r;
return xs(t, e.m_Choice, 0) == 0 ? fs(e.m_LowCoder[n], t) : (r = 8, xs(t, e.m_Choice, 1) == 0 ? r += fs(e.m_MidCoder[n], t) : r += 8 + fs(e.m_HighCoder, t), r)
}
function Vr(e) {
return e.m_Choice = H(Mo, 0, -1, 2, 1), e.m_LowCoder = H(_o, 0, 7, 16, 0), e.m_MidCoder = H(_o, 0, 7, 16, 0), e.m_HighCoder = as(new ps, 8), e
}
function $r(e) {
var t;
Cs(e.m_Choice);
for (t = 0; t < e.m_NumPosStates; ++t) Cs(e.m_LowCoder[t].Models), Cs(e.m_MidCoder[t].Models);
Cs(e.m_HighCoder.Models)
}
function Jr() {
return Po
}
function Kr() {}
function Qr(e, t, n) {
var r, i;
if (e.m_Coders != null && e.m_NumPrevBits == n && e.m_NumPosBits == t) return;
e.m_NumPosBits = t, e.m_PosMask = (1 << t) - 1, e.m_NumPrevBits = n, i = 1 << e.m_NumPrevBits + e.m_NumPosBits, e.m_Coders = H(Ho, 0, 4, i, 0);
for (r = 0; r < i; ++r) e.m_Coders[r] = ri(new si)
}
function Gr(e, t, n) {
return e.m_Coders[((t & e.m_PosMask) << e.m_NumPrevBits) + ((n & 255) >>> 8 - e.m_NumPrevBits)]
}
function Yr(e) {
var t, n;
n = 1 << e.m_NumPrevBits + e.m_NumPosBits;
for (t = 0; t < n; ++t) Cs(e.m_Coders[t].m_Decoders)
}
function Zr() {
return Bo
}
function ei() {}
function ti(e, t) {
var n;
n = 1;
do n = n << 1 | xs(t, e.m_Decoders, n);
while (n < 256);
return n << 24 >> 24
}
function ni(e, t, n) {
var r, i, s;
s = 1;
do {
i = n >> 7 & 1, n <<= 1, r = xs(t, e.m_Decoders, (1 + i << 8) + s), s = s << 1 | r;
if (i != r) {
while (s < 256) s = s << 1 | xs(t, e.m_Decoders, s);
break
}
} while (s < 256);
return s << 24 >> 24
}
function ri(e) {
return e.m_Decoders = H(Mo, 0, -1, 768, 1), e
}
function ii() {
return jo
}
function si() {}
function oi() {
oi = Zs;
var e, t, n, r;
Pi = H(fo, 0, -1, 2048, 1), e = 2, Pi[0] = 0, Pi[1] = 1;
for (r = 2; r < 22; ++r) {
n = 1 << (r >> 1) - 1;
for (t = 0; t < n; ++t, ++e) Pi[e] = r << 24 >> 24
}
}
function ui(e, t) {
var n, r, i, s;
e._optimumEndIndex = t, i = e._optimum[t].PosPrev, r = e._optimum[t].BackPrev;
do e._optimum[t].Prev1IsChar && (is(e._optimum[i]), e._optimum[i].PosPrev = i - 1, e._optimum[t].Prev2 && (e._optimum[i - 1].Prev1IsChar = !1, e._optimum[i - 1].PosPrev = e._optimum[t].PosPrev2, e._optimum[i - 1].BackPrev = e._optimum[t].BackPrev2)), s = i, n = r, r = e._optimum[s].BackPrev, i = e._optimum[s].PosPrev, e._optimum[s].BackPrev = n, e._optimum[s].PosPrev = t, t = s;
while (t > 0);
return e.backRes = e._optimum[0].BackPrev, e._optimumCurrentIndex = e._optimum[0].PosPrev, e._optimumCurrentIndex
}
function ai(e) {
var t;
e._state = 0, e._previousByte = 0;
for (t = 0; t < 4; ++t) e._repDistances[t] = 0
}
function fi(e, t, n, r) {
var i, s, o, u, a, c, p, d, v, m, g, y, b, w, E;
t[0] = f, n[0] = f, r[0] = !0, e._inStream && (e._matchFinder._stream = e._inStream, ur(e._matchFinder), e._needReleaseMFStream = !0, e._inStream = null);
if (e._finished) return;
e._finished = !0, w = e.nowPos64;
if (rt(e.nowPos64, f)) {
if (Gn(e._matchFinder) == 0) {
di(e, ut(e.nowPos64));
return
}
Ei(e), b = ut(e.nowPos64) & e._posStateMask, Os(e._rangeEncoder, e._isMatch, (e._state << 4) + b, 0), e._state = Cr(e._state), o = Kn(e._matchFinder, -e._additionalOffset), Yi(Ji(e._literalEncoder, ut(e.nowPos64), e._previousByte), e._rangeEncoder, o), e._previousByte = o, --e._additionalOffset, e.nowPos64 = G(e.nowPos64, l)
}
if (Gn(e._matchFinder) == 0) {
di(e, ut(e.nowPos64));
return
}
for (;;) {
p = vi(e, ut(e.nowPos64)), m = e.backRes, b = ut(e.nowPos64) & e._posStateMask, s = (e._state << 4) + b;
if (p == 1 && m == -1) Os(e._rangeEncoder, e._isMatch, s, 0), o = Kn(e._matchFinder, -e._additionalOffset), E = Ji(e._literalEncoder, ut(e.nowPos64), e._previousByte), e._state < 7 ? Yi(E, e._rangeEncoder, o) : (v = Kn(e._matchFinder, -e._repDistances[0] - 1 - e._additionalOffset), Zi(E, e._rangeEncoder, v, o)), e._previousByte = o, e._state = Cr(e._state);
else {
Os(e._rangeEncoder, e._isMatch, s, 1);
if (m < 4) {
Os(e._rangeEncoder, e._isRep, e._state, 1), m == 0 ? (Os(e._rangeEncoder, e._isRepG0, e._state, 0), p == 1 ? Os(e._rangeEncoder, e._isRep0Long, s, 0) : Os(e._rangeEncoder, e._isRep0Long, s, 1)) : (Os(e._rangeEncoder, e._isRepG0, e._state, 1), m == 1 ? Os(e._rangeEncoder, e._isRepG1, e._state, 0) : (Os(e._rangeEncoder, e._isRepG1, e._state, 1), Os(e._rangeEncoder, e._isRepG2, e._state, m - 2))), p == 1 ? e._state = e._state < 7 ? 9 : 11 : (Ri(e._repMatchLenEncoder, e._rangeEncoder, p - 2, b), e._state = e._state < 7 ? 8 : 11), u = e._repDistances[m];
if (m != 0) {
for (c = m; c >= 1; --c) e._repDistances[c] = e._repDistances[c - 1];
e._repDistances[0] = u
}
} else {
Os(e._rangeEncoder, e._isRep, e._state, 0), e._state = e._state < 7 ? 7 : 10, Ri(e._lenEncoder, e._rangeEncoder, p - 2, b), m -= 4, y = Oi(m), d = Nr(p), vs(e._posSlotEncoder[d], e._rangeEncoder, y), y >= 4 && (a = (y >> 1) - 1, i = (2 | y & 1) << a, g = m - i, y < 14 ? bs(e._posEncoders, i - y - 1, e._rangeEncoder, a, g) : (Ms(e._rangeEncoder, g >> 4, a - 4), gs(e._posAlignEncoder, e._rangeEncoder, g & 15), ++e._alignPriceCount)), u = m;
for (c = 3; c >= 1; --c) e._repDistances[c] = e._repDistances[c - 1];
e._repDistances[0] = u, ++e._matchPriceCount
}
e._previousByte = Kn(e._matchFinder, p - 1 - e._additionalOffset)
}
e._additionalOffset -= p, e.nowPos64 = G(e.nowPos64, st(p));
if (e._additionalOffset == 0) {
e._matchPriceCount >= 128 && pi(e), e._alignPriceCount >= 16 && hi(e), t[0] = e.nowPos64, n[0] = Ds(e._rangeEncoder);
if (Gn(e._matchFinder) == 0) {
di(e, ut(e.nowPos64));
return
}
if (et(mt(e.nowPos64, w), h) >= 0) {
e._finished = !1, r[0] = !1;
return
}
}
}
}
function li(e) {
var t, n;
e._matchFinder || (t = (ir(), new pr), n = 4, e._matchFinderType == 0 && (n = 2), lr(t, n), e._matchFinder = t), $i(e._literalEncoder, e._numLiteralPosStateBits, e._numLiteralContextBits);
if (e._dictionarySize == e._dictionarySizePrev && e._numFastBytesPrev == e._numFastBytes) return;
sr(e._matchFinder, e._dictionarySize, 4096, e._numFastBytes, 274), e._dictionarySizePrev = e._dictionarySize, e._numFastBytesPrev = e._numFastBytes
}
function ci(e) {
var t;
oi(), e._repDistances = H(xo, 0, -1, 4, 1), e._optimum = H(Fo, 0, 6, 4096, 0), e._rangeEncoder = (As(), new Is), e._isMatch = H(Mo, 0, -1, 192, 1), e._isRep = H(Mo, 0, -1, 12, 1), e._isRepG0 = H(Mo, 0, -1, 12, 1), e._isRepG1 = H(Mo, 0, -1, 12, 1), e._isRepG2 = H(Mo, 0, -1, 12, 1), e._isRep0Long = H(Mo, 0, -1, 192, 1), e._posSlotEncoder = H(Io, 0, 8, 4, 0), e._posEncoders = H(Mo, 0, -1, 114, 1), e._posAlignEncoder = ds(new Ss, 4), e._lenEncoder = Ui(new Vi), e._repMatchLenEncoder = Ui(new Vi), e._literalEncoder = new Gi, e._matchDistances = H(xo, 0, -1, 548, 1), e._posSlotPrices = H(xo, 0, -1, 256, 1), e._distancesPrices = H(xo, 0, -1, 512, 1), e._alignPrices = H(xo, 0, -1, 16, 1), e.reps = H(xo, 0, -1, 4, 1), e.repLens = H(xo, 0, -1, 4, 1), e.processedInSize = H(qo, 0, -1, 1, 3), e.processedOutSize = H(qo, 0, -1, 1, 3), e.finished = H(Ro, 0, -1, 1, 2), e.properties = H(fo, 0, -1, 5, 1), e.tempPrices = H(xo, 0, -1, 128, 1);
for (t = 0; t < 4096; ++t) e._optimum[t] = new us;
for (t = 0; t < 4; ++t) e._posSlotEncoder[t] = ds(new Ss, 6);
return e
}
function hi(e) {
var t;
for (t = 0; t < 16; ++t) e._alignPrices[t] = ys(e._posAlignEncoder, t);
e._alignPriceCount = 0
}
function pi(e) {
var t, n, r, i, s, o, u, a;
for (i = 4; i < 128; ++i) o = Oi(i), r = (o >> 1) - 1, t = (2 | o & 1) << r, e.tempPrices[i] = ws(e._posEncoders, t - o - 1, r, i - t);
for (s = 0; s < 4; ++s) {
n = e._posSlotEncoder[s], u = s << 6;
for (o = 0; o < e._distTableSize; ++o) e._posSlotPrices[u + o] = ms(n, o);
for (o = 14; o < e._distTableSize; ++o) e._posSlotPrices[u + o] += (o >> 1) - 1 - 4 << 6;
a = s * 128;
for (i = 0; i < 4; ++i) e._distancesPrices[a + i] = e._posSlotPrices[u + i];
for (; i < 128; ++i) e._distancesPrices[a + i] = e._posSlotPrices[u + Oi(i)] + e.tempPrices[i]
}
e._matchPriceCount = 0
}
function di(e, t) {
Si(e), Ai(e, t & e._posStateMask), _s(e._rangeEncoder)
}
function vi(e, t) {
var n, r, i, s, o, u, a, f, l, c, h, p, d, v, m, g, y, b, w, E, S, x, T, N, C, k, L, A, O, M, _, D, P, H, B, j, F, I, q, R, U, z, W, X, V, $, J, K, Q, G;
if (e._optimumEndIndex != e._optimumCurrentIndex) return d = e._optimum[e._optimumCurrentIndex].PosPrev - e._optimumCurrentIndex, e.backRes = e._optimum[e._optimumCurrentIndex].BackPrev, e._optimumCurrentIndex = e._optimum[e._optimumCurrentIndex].PosPrev, d;
e._optimumCurrentIndex = e._optimumEndIndex = 0, e._longestMatchWasFound ? (p = e._longestMatchLength, e._longestMatchWasFound = !1) : p = Ei(e), L = e._numDistancePairs, C = Gn(e._matchFinder) + 1;
if (C < 2) return e.backRes = -1, 1;
C > 273 && (C = 273), R = 0;
for (l = 0; l < 4; ++l) e.reps[l] = e._repDistances[l], e.repLens[l] = Qn(e._matchFinder, -1, e.reps[l], 273), e.repLens[l] > e.repLens[R] && (R = l);
if (e.repLens[R] >= e._numFastBytes) return e.backRes = R, d = e.repLens[R], wi(e, d - 1), d;
if (p >= e._numFastBytes) return e.backRes = e._matchDistances[L - 1] + 4, wi(e, p - 1), p;
a = Kn(e._matchFinder, -1), y = Kn(e._matchFinder, -e._repDistances[0] - 1 - 1);
if (p < 2 && a != y && e.repLens[R] < 2) return e.backRes = -1, 1;
e._optimum[0].State = e._state, H = t & e._posStateMask, e._optimum[1].Price = (As(), qs[e._isMatch[(e._state << 4) + H] >>> 2]) + ts(Ji(e._literalEncoder, t, e._previousByte), e._state >= 7, y, a), is(e._optimum[1]), b = qs[2048 - e._isMatch[(e._state << 4) + H] >>> 2], q = b + qs[2048 - e._isRep[e._state] >>> 2], y == a && (U = q + yi(e, e._state, H), U < e._optimum[1].Price && (e._optimum[1].Price = U, ss(e._optimum[1]))), h = p >= e.repLens[R] ? p : e.repLens[R];
if (h < 2) return e.backRes = e._optimum[1].BackPrev, 1;
e._optimum[1].PosPrev = 0, e._optimum[0].Backs0 = e.reps[0], e._optimum[0].Backs1 = e.reps[1], e._optimum[0].Backs2 = e.reps[2], e._optimum[0].Backs3 = e.reps[3], c = h;
do e._optimum[c--].Price = 268435455;
while (c >= 2);
for (l = 0; l < 4; ++l) {
I = e.repLens[l];
if (I < 2) continue;
j = q + gi(e, l, e._state, H);
do s = j + zi(e._repMatchLenEncoder, I - 2, H), _ = e._optimum[I], s < _.Price && (_.Price = s, _.PosPrev = 0, _.BackPrev = l, _.Prev1IsChar = !1);
while (--I >= 2)
}
N = b + qs[e._isRep[e._state] >>> 2], c = e.repLens[0] >= 2 ? e.repLens[0] + 1 : 2;
if (c <= p) {
A = 0;
while (c > e._matchDistances[A]) A += 2;
for (;; ++c) {
f = e._matchDistances[A + 1], s = N + mi(e, f, c, H), _ = e._optimum[c], s < _.Price && (_.Price = s, _.PosPrev = 0, _.BackPrev = f + 4, _.Prev1IsChar = !1);
if (c == e._matchDistances[A]) {
A += 2;
if (A == L) break
}
}
}
n = 0;
for (;;) {
++n;
if (n == h) return ui(e, n);
w = Ei(e), L = e._numDistancePairs;
if (w >= e._numFastBytes) return e._longestMatchLength = w, e._longestMatchWasFound = !0, ui(e, n);
++t, P = e._optimum[n].PosPrev, e._optimum[n].Prev1IsChar ? (--P, e._optimum[n].Prev2 ? (W = e._optimum[e._optimum[n].PosPrev2].State, e._optimum[n].BackPrev2 < 4 ? W = W < 7 ? 8 : 11 : W = W < 7 ? 7 : 10) : W = e._optimum[P].State, W = Cr(W)) : W = e._optimum[P].State, P == n - 1 ? e._optimum[n].BackPrev == 0 ? W = W < 7 ? 9 : 11 : W = Cr(W) : (e._optimum[n].Prev1IsChar && e._optimum[n].Prev2 ? (P = e._optimum[n].PosPrev2, D = e._optimum[n].BackPrev2, W = W < 7 ? 8 : 11) : (D = e._optimum[n].BackPrev, D < 4 ? W = W < 7 ? 8 : 11 : W = W < 7 ? 7 : 10), M = e._optimum[P], D < 4 ? D == 0 ? (e.reps[0] = M.Backs0, e.reps[1] = M.Backs1, e.reps[2] = M.Backs2, e.reps[3] = M.Backs3) : D == 1 ? (e.reps[0] = M.Backs1, e.reps[1] = M.Backs0, e.reps[2] = M.Backs2, e.reps[3] = M.Backs3) : D == 2 ? (e.reps[0] = M.Backs2, e.reps[1] = M.Backs0, e.reps[2] = M.Backs1, e.reps[3] = M.Backs3) : (e.reps[0] = M.Backs3, e.reps[1] = M.Backs0, e.reps[2] = M.Backs1, e.reps[3] = M.Backs2) : (e.reps[0] = D - 4, e.reps[1] = M.Backs0, e.reps[2] = M.Backs1, e.reps[3] = M.Backs2)), e._optimum[n].State = W, e._optimum[n].Backs0 = e.reps[0], e._optimum[n].Backs1 = e.reps[1], e._optimum[n].Backs2 = e.reps[2], e._optimum[n].Backs3 = e.reps[3], u = e._optimum[n].Price, a = Kn(e._matchFinder, -1), y = Kn(e._matchFinder, -e.reps[0] - 1 - 1), H = t & e._posStateMask, r = u + qs[e._isMatch[(W << 4) + H] >>> 2] + ts(Ji(e._literalEncoder, t, Kn(e._matchFinder, -2)), W >= 7, y, a), x = e._optimum[n + 1], E = !1, r < x.Price && (x.Price = r, x.PosPrev = n, x.BackPrev = -1, x.Prev1IsChar = !1, E = !0), b = u + qs[2048 - e._isMatch[(W << 4) + H] >>> 2], q = b + qs[2048 - e._isRep[W] >>> 2], y == a && !(x.PosPrev < n && x.BackPrev == 0) && (U = q + (qs[e._isRepG0[W] >>> 2] + qs[e._isRep0Long[(W << 4) + H] >>> 2]), U <= x.Price && (x.Price = U, x.PosPrev = n, x.BackPrev = 0, x.Prev1IsChar = !1, E = !0)), k = Gn(e._matchFinder) + 1, k = 4095 - n < k ? 4095 - n : k, C = k;
if (C < 2) continue;
C > e._numFastBytes && (C = e._numFastBytes);
if (!E && y != a) {
V = En(k - 1, e._numFastBytes), m = Qn(e._matchFinder, 0, e.reps[0], V);
if (m >= 2) {
X = Cr(W), B = t + 1 & e._posStateMask, T = r + qs[2048 - e._isMatch[(X << 4) + B] >>> 2] + qs[2048 - e._isRep[X] >>> 2], O = n + 1 + m;
while (h < O) e._optimum[++h].Price = 268435455;
s = T + ($ = zi(e._repMatchLenEncoder, m - 2, B), $ + gi(e, 0, X, B)), _ = e._optimum[O], s < _.Price && (_.Price = s, _.PosPrev = n + 1, _.BackPrev = 0, _.Prev1IsChar = !0, _.Prev2 = !1)
}
}
z = 2;
for (F = 0; F < 4; ++F) {
v = Qn(e._matchFinder, -1, e.reps[F], C);
if (v < 2) continue;
g = v;
do {
while (h < n + v) e._optimum[++h].Price = 268435455;
s = q + (J = zi(e._repMatchLenEncoder, v - 2, H), J + gi(e, F, W, H)), _ = e._optimum[n + v], s < _.Price && (_.Price = s, _.PosPrev = n, _.BackPrev = F, _.Prev1IsChar = !1)
} while (--v >= 2);
v = g, F == 0 && (z = v + 1);
if (v < k) {
V = En(k - 1 - v, e._numFastBytes), m = Qn(e._matchFinder, v, e.reps[F], V);
if (m >= 2) {
X = W < 7 ? 8 : 11, B = t + v & e._posStateMask, i = q + (K = zi(e._repMatchLenEncoder, v - 2, H), K + gi(e, F, W, H)) + qs[e._isMatch[(X << 4) + B] >>> 2] + ts(Ji(e._literalEncoder, t + v, Kn(e._matchFinder, v - 1 - 1)), !0, Kn(e._matchFinder, v - 1 - (e.reps[F] + 1)), Kn(e._matchFinder, v - 1)), X = Cr(X), B = t + v + 1 & e._posStateMask, S = i + qs[2048 - e._isMatch[(X << 4) + B] >>> 2], T = S + qs[2048 - e._isRep[X] >>> 2], O = v + 1 + m;
while (h < n + O) e._optimum[++h].Price = 268435455;
s = T + (Q = zi(e._repMatchLenEncoder, m - 2, B), Q + gi(e, 0, X, B)), _ = e._optimum[n + O], s < _.Price && (_.Price = s, _.PosPrev = n + v + 1, _.BackPrev = 0, _.Prev1IsChar = !0, _.Prev2 = !0, _.PosPrev2 = n, _.BackPrev2 = F)
}
}
}
if (w > C) {
w = C;
for (L = 0; w > e._matchDistances[L]; L += 2);
e._matchDistances[L] = w, L += 2
}
if (w >= z) {
N = b + qs[e._isRep[W] >>> 2];
while (h < n + w) e._optimum[++h].Price = 268435455;
A = 0;
while (z > e._matchDistances[A]) A += 2;
for (v = z;; ++v) {
o = e._matchDistances[A + 1], s = N + mi(e, o, v, H), _ = e._optimum[n + v], s < _.Price && (_.Price = s, _.PosPrev = n, _.BackPrev = o + 4, _.Prev1IsChar = !1);
if (v == e._matchDistances[A]) {
if (v < k) {
V = En(k - 1 - v, e._numFastBytes), m = Qn(e._matchFinder, v, o, V);
if (m >= 2) {
X = W < 7 ? 7 : 10, B = t + v & e._posStateMask, i = s + qs[e._isMatch[(X << 4) + B] >>> 2] + ts(Ji(e._literalEncoder, t + v, Kn(e._matchFinder, v - 1 - 1)), !0, Kn(e._matchFinder, v - (o + 1) - 1), Kn(e._matchFinder, v - 1)), X = Cr(X), B = t + v + 1 & e._posStateMask, S = i + qs[2048 - e._isMatch[(X << 4) + B] >>> 2], T = S + qs[2048 - e._isRep[X] >>> 2], O = v + 1 + m;
while (h < n + O) e._optimum[++h].Price = 268435455;
s = T + (G = zi(e._repMatchLenEncoder, m - 2, B), G + gi(e, 0, X, B)), _ = e._optimum[n + O], s < _.Price && (_.Price = s, _.PosPrev = n + v + 1, _.BackPrev = 0, _.Prev1IsChar = !0, _.Prev2 = !0, _.PosPrev2 = n, _.BackPrev2 = o + 4)
}
}
A += 2;
if (A == L) break
}
}
}
}
}
function mi(e, t, n, r) {
var i, s;
return i = Nr(n), t < 128 ? s = e._distancesPrices[i * 128 + t] : s = e._posSlotPrices[(i << 6) + Mi(t)] + e._alignPrices[t & 15], s + zi(e._lenEncoder, n - 2, r)
}
function gi(e, t, n, r) {
var i;
return t == 0 ? (i = (As(), qs[e._isRepG0[n] >>> 2]), i += qs[2048 - e._isRep0Long[(n << 4) + r] >>> 2]) : (i = (As(), qs[2048 - e._isRepG0[n] >>> 2]), t == 1 ? i += qs[e._isRepG1[n] >>> 2] : (i += qs[2048 - e._isRepG1[n] >>> 2], i += Bs(e._isRepG2[n], t - 2))), i
}
function yi(e, t, n) {
return (As(), qs[e._isRepG0[t] >>> 2]) + qs[e._isRep0Long[(t << 4) + n] >>> 2]
}
function bi(e) {
var t;
ai(e), Ps(e._rangeEncoder), js(e._isMatch), js(e._isRep0Long), js(e._isRep), js(e._isRepG0), js(e._isRepG1), js(e._isRepG2), js(e._posEncoders), Ki(e._literalEncoder);
for (t = 0; t < 4; ++t) Cs(e._posSlotEncoder[t].Models);
ji(e._lenEncoder, 1 << e._posStateBits), ji(e._repMatchLenEncoder, 1 << e._posStateBits), Cs(e._posAlignEncoder.Models), e._longestMatchWasFound = !1, e._optimumEndIndex = 0, e._optimumCurrentIndex = 0, e._additionalOffset = 0
}
function wi(e, t) {
t > 0 && (cr(e._matchFinder, t), e._additionalOffset += t)
}
function Ei(e) {
var t;
return t = 0, e._numDistancePairs = or(e._matchFinder, e._matchDistances), e._numDistancePairs > 0 && (t = e._matchDistances[e._numDistancePairs - 2], t == e._numFastBytes && (t += Qn(e._matchFinder, t - 1, e._matchDistances[e._numDistancePairs - 1], 273 - t))), ++e._additionalOffset, t
}
function Si(e) { !! e._matchFinder && e._needReleaseMFStream && (e._matchFinder._stream = null, e._needReleaseMFStream = !1)
}
function xi(e) {
Si(e), e._rangeEncoder.Stream = null
}
function Ti(e, t) {
var n;
if (t < 1 || t > 536870912) return !1;
e._dictionarySize = t;
for (n = 0; t > 1 << n; ++n);
return e._distTableSize = n * 2, !0
}
function Ni(e, t, n, r) {
return n < 0 || n > 4 || t < 0 || t > 8 || r < 0 || r > 4 ? !1 : (e._numLiteralPosStateBits = n, e._numLiteralContextBits = t, e._posStateBits = r, e._posStateMask = (1 << e._posStateBits) - 1, !0)
}
function Ci(e, t) {
var n;
return t < 0 || t > 2 ? !1 : (n = e._matchFinderType, e._matchFinderType = t, !! e._matchFinder && n != e._matchFinderType && (e._dictionarySizePrev = -1, e._matchFinder = null), !0)
}
function ki(e, t) {
return t < 5 || t > 273 ? !1 : (e._numFastBytes = t, !0)
}
function Li(e, t) {
var n;
e.properties[0] = (e._posStateBits * 5 + e._numLiteralPosStateBits) * 9 + e._numLiteralContextBits << 24 >> 24;
for (n = 0; n < 4; ++n) e.properties[1 + n] = e._dictionarySize >> 8 * n << 24 >> 24;
Xt(t, e.properties, 0, 5)
}
function Ai(e, t) {
var n;
if (!e._writeEndMark) return;
Os(e._rangeEncoder, e._isMatch, (e._state << 4) + t, 1), Os(e._rangeEncoder, e._isRep, e._state, 0), e._state = e._state < 7 ? 7 : 10, Ri(e._lenEncoder, e._rangeEncoder, 0, t), n = Nr(2), vs(e._posSlotEncoder[n], e._rangeEncoder, 63), Ms(e._rangeEncoder, 67108863, 26), gs(e._posAlignEncoder, e._rangeEncoder, 15)
}
function Oi(e) {
return e < 2048 ? Pi[e] : e < 2097152 ? Pi[e >> 10] + 20 : Pi[e >> 20] + 40
}
function Mi(e) {
return e < 131072 ? Pi[e >> 6] + 12 : e < 134217728 ? Pi[e >> 16] + 32 : Pi[e >> 26] + 52
}
function _i() {
return Uo
}
function Di() {}
function Hi(e, t, n, r) {
n < 8 ? (Os(t, e._choice, 0, 0), vs(e._lowCoder[r], t, n)) : (n -= 8, Os(t, e._choice, 0, 1), n < 8 ? (Os(t, e._choice, 1, 0), vs(e._midCoder[r], t, n)) : (Os(t, e._choice, 1, 1), vs(e._highCoder, t, n - 8)))
}
function Bi(e) {
var t;
e._choice = H(Mo, 0, -1, 2, 1), e._lowCoder = H(Io, 0, 8, 16, 0), e._midCoder = H(Io, 0, 8, 16, 0), e._highCoder = ds(new Ss, 8);
for (t = 0; t < 16; ++t) e._lowCoder[t] = ds(new Ss, 3), e._midCoder[t] = ds(new Ss, 3);
return e
}
function ji(e, t) {
var n;
js(e._choice);
for (n = 0; n < t; ++n) Cs(e._lowCoder[n].Models), Cs(e._midCoder[n].Models);
Cs(e._highCoder.Models)
}
function Fi(e, t, n, r, i) {
var s, o, u, a, f;
s = (As(), qs[e._choice[0] >>> 2]), o = qs[2048 - e._choice[0] >>> 2], u = o + qs[e._choice[1] >>> 2], a = o + qs[2048 - e._choice[1] >>> 2], f = 0;
for (f = 0; f < 8; ++f) {
if (f >= n) return;
r[i + f] = s + ms(e._lowCoder[t], f)
}
for (; f < 16; ++f) {
if (f >= n) return;
r[i + f] = u + ms(e._midCoder[t], f - 8)
}
for (; f < n; ++f) r[i + f] = a + ms(e._highCoder, f - 8 - 8)
}
function Ii() {
return Vo
}
function qi() {}
function Ri(e, t, n, r) {
Hi(e, t, n, r), --e._counters[r] == 0 && (Fi(e, r, e._tableSize, e._prices, r * 272), e._counters[r] = e._tableSize)
}
function Ui(e) {
return Bi(e), e._prices = H(xo, 0, -1, 4352, 1), e._counters = H(xo, 0, -1, 16, 1), e
}
function zi(e, t, n) {
return e._prices[n * 272 + t]
}
function Wi(e, t) {
var n;
for (n = 0; n < t; ++n) Fi(e, n, e._tableSize, e._prices, n * 272), e._counters[n] = e._tableSize
}
function Xi() {
return $o
}
function Vi() {}
function $i(e, t, n) {
var r, i;
if (e.m_Coders != null && e.m_NumPrevBits == n && e.m_NumPosBits == t) return;
e.m_NumPosBits = t, e.m_PosMask = (1 << t) - 1, e.m_NumPrevBits = n, i = 1 << e.m_NumPrevBits + e.m_NumPosBits, e.m_Coders = H(zo, 0, 5, i, 0);
for (r = 0; r < i; ++r) e.m_Coders[r] = es(new rs)
}
function Ji(e, t, n) {
return e.m_Coders[((t & e.m_PosMask) << e.m_NumPrevBits) + ((n & 255) >>> 8 - e.m_NumPrevBits)]
}
function Ki(e) {
var t, n;
n = 1 << e.m_NumPrevBits + e.m_NumPosBits;
for (t = 0; t < n; ++t) js(e.m_Coders[t].m_Encoders)
}
function Qi() {
return Wo
}
function Gi() {}
function Yi(e, t, n) {
var r, i, s;
i = 1;
for (s = 7; s >= 0; --s) r = n >> s & 1, Os(t, e.m_Encoders, i, r), i = i << 1 | r
}
function Zi(e, t, n, r) {
var i, s, o, u, a, f;
s = 1, a = !0;
for (o = 7; o >= 0; --o) i = r >> o & 1, f = s, a && (u = n >> o & 1, f += 1 + u << 8, a = u == i), Os(t, e.m_Encoders, f, i), s = s << 1 | i
}
function es(e) {
return e.m_Encoders = H(Mo, 0, -1, 768, 1), e
}
function ts(e, t, n, r) {
var i, s, o, u, a;
a = 0, s = 1, o = 7;
if (t) for (; o >= 0; --o) {
u = n >> o & 1, i = r >> o & 1, a += Bs(e.m_Encoders[(1 + u << 8) + s], i), s = s << 1 | i;
if (u != i) {
--o;
break
}
}
for (; o >= 0; --o) i = r >> o & 1, a += Bs(e.m_Encoders[s], i), s = s << 1 | i;
return a
}
function ns() {
return Xo
}
function rs() {}
function is(e) {
e.BackPrev = -1, e.Prev1IsChar = !1
}
function ss(e) {
e.BackPrev = 0, e.Prev1IsChar = !1
}
function os() {
return Jo
}
function us() {}
function as(e, t) {
return e.NumBitLevels = t, e.Models = H(Mo, 0, -1, 1 << t, 1), e
}
function fs(e, t) {
var n, r;
r = 1;
for (n = e.NumBitLevels; n != 0; --n) r = (r << 1) + xs(t, e.Models, r);
return r - (1 << e.NumBitLevels)
}
function ls(e, t) {
var n, r, i, s;
i = 1, s = 0;
for (r = 0; r < e.NumBitLevels; ++r) n = xs(t, e.Models, i), i <<= 1, i += n, s |= n << r;
return s
}
function cs(e, t, n, r) {
var i, s, o, u;
o = 1, u = 0;
for (s = 0; s < r; ++s) i = xs(n, e, t + o), o <<= 1, o += i, u |= i << s;
return u
}
function hs() {
return Ko
}
function ps() {}
function ds(e, t) {
return e.NumBitLevels = t, e.Models = H(Mo, 0, -1, 1 << t, 1), e
}
function vs(e, t, n) {
var r, i, s;
s = 1;
for (i = e.NumBitLevels; i != 0;)--i, r = n >>> i & 1, Os(t, e.Models, s, r), s = s << 1 | r
}
function ms(e, t) {
var n, r, i, s;
s = 0, i = 1;
for (r = e.NumBitLevels; r != 0;)--r, n = t >>> r & 1, s += Bs(e.Models[i], n), i = (i << 1) + n;
return s
}
function gs(e, t, n) {
var r, i, s;
s = 1;
for (i = 0; i < e.NumBitLevels; ++i) r = n & 1, Os(t, e.Models, s, r), s = s << 1 | r, n >>= 1
}
function ys(e, t) {
var n, r, i, s;
s = 0, i = 1;
for (r = e.NumBitLevels; r != 0; --r) n = t & 1, t >>>= 1, s += Bs(e.Models[i], n), i = i << 1 | n;
return s
}
function bs(e, t, n, r, i) {
var s, o, u;
u = 1;
for (o = 0; o < r; ++o) s = i & 1, Os(n, e, t + u, s), u = u << 1 | s, i >>= 1
}
function ws(e, t, n, r) {
var i, s, o, u;
u = 0, o = 1;
for (s = n; s != 0; --s) i = r & 1, r >>>= 1, u += (As(), qs[((e[t + o] - i ^ -i) & 2047) >>> 2]), o = o << 1 | i;
return u
}
function Es() {
return Qo
}
function Ss() {}
function xs(e, t, n) {
var r, i;
return i = t[n], r = (e.Range >>> 11) * i, (e.Code ^ -2147483648) < (r ^ -2147483648) ? (e.Range = r, t[n] = i + (2048 - i >>> 5) << 16 >> 16, (e.Range & -16777216) == 0 && (e.Code = e.Code << 8 | Ht(e.Stream), e.Range <<= 8), 0) : (e.Range -= r, e.Code -= r, t[n] = i - (i >>> 5) << 16 >> 16, (e.Range & -16777216) == 0 && (e.Code = e.Code << 8 | Ht(e.Stream), e.Range <<= 8), 1)
}
function Ts(e, t) {
var n, r, i;
r = 0;
for (n = t; n != 0; --n) e.Range >>>= 1, i = e.Code - e.Range >>> 31, e.Code -= e.Range & i - 1, r = r << 1 | 1 - i, (e.Range & -16777216) == 0 && (e.Code = e.Code << 8 | Ht(e.Stream), e.Range <<= 8);
return r
}
function Ns(e) {
var t;
e.Code = 0, e.Range = -1;
for (t = 0; t < 5; ++t) e.Code = e.Code << 8 | Ht(e.Stream)
}
function Cs(e) {
var t;
for (t = 0; t < e.length; ++t) e[t] = 1024
}
function ks() {
return Go
}
function Ls() {}
function As() {
As = Zs;
var e, t, n, r;
qs = H(xo, 0, -1, 512, 1);
for (t = 8; t >= 0; --t) {
r = 1 << 9 - t - 1, e = 1 << 9 - t;
for (n = r; n < e; ++n) qs[n] = (t << 6) + (e - n << 6 >>> 9 - t - 1)
}
}
function Os(e, t, n, r) {
var i, s;
s = t[n], i = (e.Range >>> 11) * s, r == 0 ? (e.Range = i, t[n] = s + (2048 - s >>> 5) << 16 >> 16) : (e.Low = G(e.Low, Z(st(i), m)), e.Range -= i, t[n] = s - (s >>> 5) << 16 >> 16), (e.Range & -16777216) == 0 && (e.Range <<= 8, Hs(e))
}
function Ms(e, t, n) {
var r;
for (r = n - 1; r >= 0; --r) e.Range >>>= 1, (t >>> r & 1) == 1 && (e.Low = G(e.Low, st(e.Range))), (e.Range & -16777216) == 0 && (e.Range <<= 8, Hs(e))
}
function _s(e) {
var t;
for (t = 0; t < 5; ++t) Hs(e)
}
function Ds(e) {
return G(G(st(e._cacheSize), e._position), c)
}
function Ps(e) {
e._position = f, e.Low = f, e.Range = -1, e._cacheSize = 1, e._cache = 0
}
function Hs(e) {
var t, n;
t = ut(vt(e.Low, 32));
if (t != 0 || et(e.Low, v) < 0) {
e._position = G(e._position, st(e._cacheSize)), n = e._cache;
do Wt(e.Stream, n + t), n = 255;
while (--e._cacheSize != 0);
e._cache = ut(e.Low) >>> 24
}++e._cacheSize, e.Low = pt(Z(e.Low, p), 8)
}
function Bs(e, t) {
return As(), qs[((e - t ^ -t) & 2047) >>> 2]
}
function js(e) {
As();
var t;
for (t = 0; t < e.length; ++t) e[t] = 1024
}
function Fs() {
return Yo
}
function Is() {}
function Rs(e) {
var t, n, r, i, s;
t = kn(new An);
for (n = 0; n < e.length; ++n) {
r = e[n] & 255;
if ((r & 128) == 0) {
if (r == 0) throw pn(new vn, "invalid UTF-8");
M(t.data, String.fromCharCode(r & 65535))
} else if ((r & 224) == 192) {
if (n + 1 >= e.length) throw pn(new vn, "invalid UTF-8");
i = e[++n] & 255;
if ((i & 192) != 128) throw pn(new vn, "invalid UTF-8");
O(t.data, String.fromCharCode((r & 31) << 6 & 65535 | i & 63))
} else {
if ((r & 240) != 224) throw pn(new vn, "invalid UTF-8");
if (n + 2 >= e.length) throw pn(new vn, "invalid UTF-8");
i = e[++n] & 255;
if ((i & 192) != 128) throw pn(new vn, "invalid UTF-8");
s = e[++n] & 255;
if ((s & 192) != 128) throw pn(new vn, "invalid UTF-8");
M(t.data, String.fromCharCode(((r & 15) << 12 | (i & 63) << 6 | s & 63) & 65535))
}
}
return _(t.data)
}
function Us(e) {
var t, n, r, i, s, o, u;
n = (u = e.length, o = H(go, 0, -1, u, 1), Nn(e, 0, u, o, 0), o), i = 0;
for (s = 0; s < e.length; ++s) t = n[s], t >= 1 && t <= 127 ? ++i : t == 0 || t >= 128 && t <= 2047 ? i += 2 : i += 3;
r = H(fo, 0, -1, i, 1), i = 0;
for (s = 0; s < e.length; ++s) t = n[s], t >= 1 && t <= 127 ? r[i++] = t << 24 >> 24 : t == 0 || t >= 128 && t <= 2047 ? (r[i++] = (192 | t >> 6 & 31) << 24 >> 24, r[i++] = (128 | t & 63) << 24 >> 24) : (r[i++] = (224 | t >> 12 & 15) << 24 >> 24, r[i++] = (128 | t >> 6 & 63) << 24 >> 24, r[i++] = (128 | t & 63) << 24 >> 24);
return r
}
function zs(e) {
return e
}
function Ws(e) {
return e[1] + e[0]
}
function Xs() {
function l() {
var s;
i = (new Date).getTime();
while (Pn(t.c)) {
n = Ws(t.c.chunker.inBytesProcessed) / Ws(t.c.length_0);
if ((new Date).getTime() - i > 200) return f ? f(n) : typeof u != "undefined" && r(n, u), setTimeout(l, 0), !1
}
f ? f(1) : typeof u != "undefined" && r(1, u), s = zt(t.c.output).slice(0), a ? a(s) : typeof u != "undefined" && postMessage({
action: e,
callback_num: u,
result: s
})
}
var t = zs(new Ks),
n, i, s = arguments[0],
o = arguments[1],
u, a, f;
typeof arguments[2] == "function" ? (a = arguments[2], typeof arguments[3] == "function" && (f = arguments[3])) : u = arguments[2], t.mode = su(o), t.c = Fn(new qn, Us(s), t.mode), f ? f(0) : typeof u != "undefined" && r(0, u), setTimeout(l, 1)
}
function Vs() {
function c() {
var i;
s = (new Date).getTime();
while (Rn(e.d)) {
n = Ws(e.d.chunker.decoder.nowPos64) / Ws(e.d.length_0);
if ((new Date).getTime() - s > 200) return l ? l(n) : typeof a != "undefined" && r(n, a), setTimeout(c, 0), !1
}
l ? l(1) : typeof a != "undefined" && r(1, a), i = Rs(zt(e.d.output)), f ? f(i) : typeof a != "undefined" && postMessage({
action: t,
callback_num: a,
result: i
})
}
var e = zs(new Ks),
n, i, s, o, u = arguments[0],
a, f, l;
typeof arguments[1] == "function" ? (f = arguments[1], typeof arguments[2] == "function" && (l = arguments[2])) : a = arguments[1], i = B(fo, 0, -1, u), e.d = Xn(new $n, i), l ? l(0) : typeof a != "undefined" && r(0, a), setTimeout(c, 0)
}
function $s(e) {
Xs(e), Vs(e)
}
function Js() {
return iu
}
function Ks() {}
function Gs() { !! $stats && $stats({
moduleName: i,
subSystem: "startup",
evtGroup: "moduleStartup",
millis: (new Date).getTime(),
type: "onModuleLoadStart",
className: "org.dellroad.lzma.demo.client.LZMADemo"
})
}
function Ys(e, t, n) {
i = t, s = n;
if (e) try {
Gs()
} catch (r) {
e(t)
} else Gs()
}
function Zs() {}
var e = 1,
t = 2,
n = 3,
i, s, o, u = [0, -0x8000000000000000],
a = [4294967295, -4294967296],
f = [0, 0],
l = [1, 0],
c = [4, 0],
h = [4096, 0],
p = [16777215, 0],
d = [16777216, 0],
v = [4278190080, 0],
m = [4294967295, 0],
g = [4294967295, 0x7fffffff00000000];
o = b.prototype = {}, o.getClass$ = y, o.typeMarker$ = Zs, o.typeId$ = 1, o = E.prototype = new b, o.getClass$ = w, o.typeId$ = 3, o.detailMessage = null, o = x.prototype = new E, o.getClass$ = S, o.typeId$ = 4, o = C.prototype = new x, o.getClass$ = N, o.typeId$ = 5, o = A.prototype = new C, o.getClass$ = L, o.typeId$ = 6, o = F.prototype = new b, o.getClass$ = P, o.typeId$ = 0, o.arrayClass$ = null, o.length = 0, o.queryId$ = 0;
var U, z, K = [{}, {}, {
1: 1
}, {
2: 1
}, {
2: 1
}, {
2: 1
}, {
2: 1
}, {
2: 1,
10: 1
}, {
2: 1
}, {
2: 1
}, {
2: 1
}, {
2: 1
}, {
2: 1
}, {
2: 1,
11: 1
}, {
2: 1
}, {
2: 1
}, {
2: 1
}, {
4: 1
}, {
5: 1
}, {
6: 1
}, {
7: 1
}, {
8: 1
}, {
9: 1
}],
Et, xt, Tt, Nt, Ct, kt, Lt, At, Ot;
o = _t.prototype = new b, o.getClass$ = Mt, o.typeId$ = 0, o = Ft.prototype = new _t, o.getClass$ = jt, o.typeId$ = 0, o.buf = null, o.count = 0, o.pos = 0, o = qt.prototype = new b, o.getClass$ = It, o.typeId$ = 0, o = $t.prototype = new qt, o.getClass$ = Vt, o.typeId$ = 0, o.buf = null, o.count = 0, o = Qt.prototype = new x, o.getClass$ = Kt, o.typeId$ = 7, o = Zt.prototype = new C, o.getClass$ = Yt, o.typeId$ = 8, o = nn.prototype = new C, o.getClass$ = tn, o.typeId$ = 9, o = an.prototype = new b, o.getClass$ = un, o.typeId$ = 0, o.typeName = null, o = ln.prototype = new C, o.getClass$ = fn, o.typeId$ = 12, o = hn.prototype = new b, o.getClass$ = cn, o.typeId$ = 0, o = vn.prototype = new C, o.getClass$ = dn, o.typeId$ = 13, o = gn.prototype = new C, o.getClass$ = mn, o.typeId$ = 14, o = bn.prototype = new C, o.getClass$ = yn, o.typeId$ = 15, o = xn.prototype = new C, o.getClass$ = Sn, o.typeId$ = 16, o = String.prototype, o.getClass$ = Cn, o.typeId$ = 2, o = An.prototype = new b, o.getClass$ = Ln, o.typeId$ = 0, o = Dn.prototype = new hn, o.getClass$ = _n, o.typeId$ = 0, o.dictionarySize = 0, o.fb = 0, o.lc = 0, o.lp = 0, o.matchFinder = 0, o.pb = 0, o = jn.prototype = new b, o.getClass$ = Bn, o.typeId$ = 0, o.chunker = null, o = qn.prototype = new jn, o.getClass$ = In, o.typeId$ = 0, o.output = null, o = Wn.prototype = new b, o.getClass$ = zn, o.typeId$ = 0, o.chunker = null, o.exception = null, o.length_0 = f, o = $n.prototype = new Wn, o.getClass$ = Vn, o.typeId$ = 0, o.output = null, o = rr.prototype = new b, o.getClass$ = nr, o.typeId$ = 0, o._blockSize = 0, o._bufferBase = null, o._bufferOffset = 0, o._keepSizeAfter = 0, o._keepSizeBefore = 0, o._pointerToLastSafePosition = 0, o._pos = 0, o._posLimit = 0, o._stream = null, o._streamEndWasReached = !1, o._streamPos = 0, o = pr.prototype = new rr, o.getClass$ = hr, o.typeId$ = 0, o.HASH_ARRAY = !0, o._cutValue = 255, o._cyclicBufferPos = 0, o._cyclicBufferSize = 0, o._hash = null, o._hashMask = 0, o._hashSizeSum = 0, o._matchMaxLen = 0, o._son = null, o.kFixHashSize = 66560, o.kMinMatchCheck = 4, o.kNumHashDirectBytes = 0;
var dr;
o = Tr.prototype = new b, o.getClass$ = xr, o.typeId$ = 0, o._buffer = null, o._pos = 0, o._stream = null, o._streamPos = 0, o._windowSize = 0, o = Dr.prototype = new b, o.getClass$ = _r, o.typeId$ = 0, o.alive = !1, o.decoder = null, o.encoder = null, o = zr.prototype = new b, o.getClass$ = Ur, o.typeId$ = 0, o.m_DictionarySize = -1, o.m_DictionarySizeCheck = -1, o.m_PosStateMask = 0, o.nowPos64 = f, o.outSize = f, o.prevByte = 0, o.rep0 = 0, o.rep1 = 0, o.rep2 = 0, o.rep3 = 0, o.state = 0, o = Kr.prototype = new b, o.getClass$ = Jr, o.typeId$ = 0, o.m_NumPosStates = 0, o = ei.prototype = new b, o.getClass$ = Zr, o.typeId$ = 0, o.m_Coders = null, o.m_NumPosBits = 0, o.m_NumPrevBits = 0, o.m_PosMask = 0, o = si.prototype = new b, o.getClass$ = ii, o.typeId$ = 17, o = Di.prototype = new b, o.getClass$ = _i, o.typeId$ = 0, o._additionalOffset = 0, o._alignPriceCount = 0, o._dictionarySize = 4194304, o._dictionarySizePrev = -1, o._distTableSize = 44, o._finished = !1, o._inStream = null, o._longestMatchLength = 0, o._longestMatchWasFound = !1, o._matchFinder = null, o._matchFinderType = 1, o._matchPriceCount = 0, o._needReleaseMFStream = !1, o._numDistancePairs = 0, o._numFastBytes = 32, o._numFastBytesPrev = -1, o._numLiteralContextBits = 3, o._numLiteralPosStateBits = 0, o._optimumCurrentIndex = 0, o._optimumEndIndex = 0, o._posStateBits = 2, o._posStateMask = 3, o._previousByte = 0, o._state = 0, o._writeEndMark = !1, o.backRes = 0, o.nowPos64 = f;
var Pi;
o = qi.prototype = new b, o.getClass$ = Ii, o.typeId$ = 0, o = Vi.prototype = new qi, o.getClass$ = Xi, o.typeId$ = 0, o._tableSize = 0, o = Gi.prototype = new b, o.getClass$ = Qi, o.typeId$ = 0, o.m_Coders = null, o.m_NumPosBits = 0, o.m_NumPrevBits = 0, o.m_PosMask = 0, o = rs.prototype = new b, o.getClass$ = ns, o.typeId$ = 18, o = us.prototype = new b, o.getClass$ = os, o.typeId$ = 19, o.BackPrev = 0, o.BackPrev2 = 0, o.Backs0 = 0, o.Backs1 = 0, o.Backs2 = 0, o.Backs3 = 0, o.PosPrev = 0, o.PosPrev2 = 0, o.Prev1IsChar = !1, o.Prev2 = !1, o.Price = 0, o.State = 0, o = ps.prototype = new b, o.getClass$ = hs, o.typeId$ = 20, o.Models = null, o.NumBitLevels = 0, o = Ss.prototype = new b, o.getClass$ = Es, o.typeId$ = 21, o.Models = null, o.NumBitLevels = 0, o = Ls.prototype = new b, o.getClass$ = ks, o.typeId$ = 0, o.Code = 0, o.Range = 0, o.Stream = null, o = Is.prototype = new b, o.getClass$ = Fs, o.typeId$ = 0, o.Low = f, o.Range = 0, o.Stream = null, o._cache = 0, o._cacheSize = 0, o._position = f;
var qs;
o = Ks.prototype = new b, o.getClass$ = Js, o.typeId$ = 0, o.c = null, o.d = null;
var Qs, eo = sn("java.lang.", "Object"),
to = sn("java.lang.", "Throwable"),
no = sn("java.lang.", "Exception"),
ro = sn("java.lang.", "RuntimeException"),
io = sn("com.google.gwt.core.client.", "JavaScriptException"),
so = sn("com.google.gwt.core.client.", "JavaScriptObject$"),
oo = rn("", "[[D"),
uo = sn("java.io.", "InputStream"),
ao = sn("java.io.", "ByteArrayInputStream"),
fo = rn("", "[B"),
lo = sn("java.io.", "OutputStream"),
co = sn("java.io.", "ByteArrayOutputStream"),
ho = sn("java.io.", "IOException"),
po = sn("java.lang.", "Enum"),
vo = sn("java.lang.", "ArithmeticException"),
mo = sn("java.lang.", "ArrayStoreException"),
go = rn("", "[C"),
yo = sn("java.lang.", "Class"),
bo = sn("java.lang.", "ClassCastException"),
wo = sn("java.lang.", "IllegalArgumentException"),
Eo = sn("java.lang.", "IllegalStateException"),
So = sn("java.lang.", "IndexOutOfBoundsException"),
xo = rn("", "[I"),
To = sn("java.lang.", "NullPointerException"),
No = sn("java.lang.", "String"),
Co = sn("java.lang.", "StringBuilder"),
ko = sn("org.dellroad.lzma.client.SevenZip.Compression.LZ.", "InWindow"),
Lo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZ.", "BinTree"),
Ao = sn("org.dellroad.lzma.client.SevenZip.Compression.LZ.", "OutWindow"),
Oo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Chunker"),
Mo = rn("", "[S"),
_o = rn("[Lorg.dellroad.lzma.client.SevenZip.Compression.RangeCoder.", "BitTreeDecoder;"),
Do = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Decoder"),
Po = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Decoder$LenDecoder"),
Ho = rn("[Lorg.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Decoder$LiteralDecoder$Decoder2;"),
Bo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Decoder$LiteralDecoder"),
jo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Decoder$LiteralDecoder$Decoder2"),
Fo = rn("[Lorg.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Encoder$Optimal;"),
Io = rn("[Lorg.dellroad.lzma.client.SevenZip.Compression.RangeCoder.", "BitTreeEncoder;"),
qo = rn("", "[J"),
Ro = rn("", "[Z"),
Uo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Encoder"),
zo = rn("[Lorg.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Encoder$LiteralEncoder$Encoder2;"),
Wo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Encoder$LiteralEncoder"),
Xo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Encoder$LiteralEncoder$Encoder2"),
Vo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Encoder$LenEncoder"),
$o = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Encoder$LenPriceTableEncoder"),
Jo = sn("org.dellroad.lzma.client.SevenZip.Compression.LZMA.", "Encoder$Optimal"),
Ko = sn("org.dellroad.lzma.client.SevenZip.Compression.RangeCoder.", "BitTreeDecoder"),
Qo = sn("org.dellroad.lzma.client.SevenZip.Compression.RangeCoder.", "BitTreeEncoder"),
Go = sn("org.dellroad.lzma.client.SevenZip.Compression.RangeCoder.", "Decoder"),
Yo = sn("org.dellroad.lzma.client.SevenZip.Compression.RangeCoder.", "Encoder"),
Zo = on("org.dellroad.lzma.client.", "CompressionMode"),
eu = sn("org.dellroad.lzma.client.", "LZMACompressor"),
tu = sn("org.dellroad.lzma.client.", "LZMAByteArrayCompressor"),
nu = sn("org.dellroad.lzma.client.", "LZMADecompressor"),
ru = sn("org.dellroad.lzma.client.", "LZMAByteArrayDecompressor"),
iu = sn("org.dellroad.lzma.demo.client.", "LZMADemo");
Ys(function () {}, "lzma_demo", "");
var su = function () {
function t(e) {
return !isNaN(parseFloat(e)) && isFinite(e)
}
var e = [{
dictionarySize: 16,
fb: 64,
matchFinder: 0,
lc: 3,
lp: 0,
pb: 2
}, {
dictionarySize: 20,
fb: 64,
matchFinder: 0,
lc: 3,
lp: 0,
pb: 2
}, {
dictionarySize: 19,
fb: 64,
matchFinder: 1,
lc: 3,
lp: 0,
pb: 2
}, {
dictionarySize: 20,
fb: 64,
matchFinder: 1,
lc: 3,
lp: 0,
pb: 2
}, {
dictionarySize: 21,
fb: 128,
matchFinder: 1,
lc: 3,
lp: 0,
pb: 2
}, {
dictionarySize: 22,
fb: 128,
matchFinder: 1,
lc: 3,
lp: 0,
pb: 2
}, {
dictionarySize: 23,
fb: 128,
matchFinder: 1,
lc: 3,
lp: 0,
pb: 2
}, {
dictionarySize: 24,
fb: 255,
matchFinder: 1,
lc: 3,
lp: 0,
pb: 2
}, {
dictionarySize: 25,
fb: 255,
matchFinder: 1,
lc: 3,
lp: 0,
pb: 2
}];
return function (n) {
return t(n) ? n < 1 ? n = 1 : n > 9 && (n = 9) : n = 1, e[n - 1]
}
}();
return {
compress: Xs,
decompress: Vs
}
}();
this.LZMA = LZMA, root.Mustache = Mustache, function () {
function GeometryView() {}
function LayerDefinition(e, t) {
var n = this;
this.options = _.defaults(t, {
ajax: window.$ ? window.$.ajax : reqwest.compat,
pngParams: ["map_key", "api_key", "cache_policy", "updated_at"],
gridParams: ["map_key", "api_key", "cache_policy", "updated_at"],
cors: this.isCORSSupported(),
btoa: this.isBtoaSupported() ? this._encodeBase64Native : this._encodeBase64,
MAX_GET_SIZE: 2033,
force_cors: !1
}), this.setLayerDefinition(e, {
silent: !0
}), this.layerToken = null, this.urls = null, this.silent = !1, this.interactionEnabled = [], this._layerTokenQueue = [], this._timeout = -1, this._queue = [], this._waiting = !1, this.lastTimeUpdated = null, this._refreshTimer = -1
}
function SubLayer(e, t) {
this._parent = e, this._position = t, this._added = !0, this._bindInteraction(), this.infowindow = new Backbone.Model(this._parent.getLayer(this._position).infowindow), this.infowindow.bind("change", function () {
var e = this._parent.getLayer(this._position);
e.infowindow = this.infowindow.toJSON(), this._parent.setLayer(this._position, e)
}, this)
}
function CartoDBLayerCommon() {}
var $ = root.$,
jQuery = root.jQuery,
L = root.L,
Mustache = root.Mustache,
Backbone = root.Backbone,
_ = root._;
(function () {
var e = this,
t = e.cdb = {};
t.VERSION = "3.1.11", t.CARTOCSS_VERSIONS = {
"2.0.0": "",
"2.1.0": ""
}, t.CARTOCSS_DEFAULT_VERSION = "2.1.1", t.CDB_HOST = {
http: "tiles.cartocdn.com",
https: "d3pu9mtm6f0hk5.cloudfront.net"
}, e.cdb.config = {}, e.cdb.core = {}, e.cdb.geo = {}, e.cdb.geo.ui = {}, e.cdb.geo.geocoder = {}, e.cdb.ui = {}, e.cdb.ui.common = {}, e.cdb.vis = {}, e.cdb.decorators = {}, e.JST = e.JST || {}, e.cartodb = t, t.files = ["../vendor/jquery.min.js", "../vendor/underscore-min.js", "../vendor/json2.js", "../vendor/backbone.js", "../vendor/leaflet.js", "../vendor/wax.cartodb.js", "../vendor/GeoJSON.js", "../vendor/jscrollpane.js", "../vendor/mousewheel.js", "../vendor/mwheelIntent.js", "../vendor/spin.js", "../vendor/lzma.js", "core/decorator.js", "core/config.js", "core/log.js", "core/profiler.js", "core/template.js", "core/model.js", "core/view.js", "geo/geocoder.js", "geo/geometry.js", "geo/map.js", "geo/ui/zoom.js", "geo/ui/zoom_info.js", "geo/ui/legend.js", "geo/ui/switcher.js", "geo/ui/infowindow.js", "geo/ui/header.js", "geo/ui/search.js", "geo/ui/layer_selector.js", "geo/ui/tiles_loader.js", "geo/ui/infobox.js", "geo/ui/tooltip.js", "geo/layer_definition.js", "geo/common.js", "geo/leaflet/leaflet.geometry.js", "geo/leaflet/leaflet_base.js", "geo/leaflet/leaflet_plainlayer.js", "geo/leaflet/leaflet_tiledlayer.js", "geo/leaflet/leaflet_cartodb_layergroup.js", "geo/leaflet/leaflet_cartodb_layer.js", "geo/leaflet/leaflet.js", "geo/gmaps/gmaps_base.js", "geo/gmaps/gmaps_baselayer.js", "geo/gmaps/gmaps_plainlayer.js", "geo/gmaps/gmaps_tiledlayer.js", "geo/gmaps/gmaps_cartodb_layergroup.js", "geo/gmaps/gmaps_cartodb_layer.js", "geo/gmaps/gmaps.js", "ui/common/dialog.js", "ui/common/notification.js", "ui/common/table.js", "ui/common/dropdown.js", "vis/vis.js", "vis/overlays.js", "vis/layers.js", "api/layers.js", "api/sql.js", "api/vis.js"], t.init = function (n) {
var r = t.Class = function () {};
_.extend(r.prototype, Backbone.Events), t._loadJST(), e.cdb.god = new Backbone.Model, n && n()
}, t.load = function (e, n) {
var r = 0,
i = function () {
var s = document.createElement("script");
s.src = e + t.files[r], document.body.appendChild(s), ++r, r == t.files.length ? n && (s.onload = n) : s.onload = i
};
i()
}
})(), cdb.decorators.elder = function () {
var e = Backbone.Router.extend,
t = function (e, t) {
var n = null;
if (this.parent != null) {
var r = this.parent;
this.parent = this.parent.parent;
var t = Array.prototype.slice.call(arguments, 1);
r.hasOwnProperty(e) ? n = r[e].apply(this, t) : (t.splice(0, 0, e), n = r.elder.apply(this, t)), this.parent = r
}
return n
},
n = function (n, r) {
var i = e.call(this, n, r);
return i.prototype.parent = this.prototype, i.prototype.elder = function (e) {
var n = Array.prototype.slice.call(arguments, 1);
return e ? (n.splice(0, 0, e), t.apply(this, n)) : i.prototype.parent
}, i
},
r = function (e) {
e.extend = n, e.prototype.elder = function () {}, e.prototype.parent = null
};
return r
}(), cdb.decorators.elder(Backbone.Model), cdb.decorators.elder(Backbone.View), cdb.decorators.elder(Backbone.Collection), window.JSON || (window.JSON = {
stringify: function (e) {
if (typeof e == "number" || typeof e == "boolean") return e.toString();
if (typeof e == "string") return '"' + e.toString() + '"';
if (_.isArray(e)) {
var t = "[";
for (var n in e) n > 0 && (t += ", "), t += JSON.stringify(e[n]);
return t += "]", t
}
var t = "{";
for (var r in e) e.hasOwnProperty(r) && (t += '"' + r + '": ' + JSON.stringify(e[r]));
return t += "}", t
},
parse: function (param) {
return eval(param)
}
}), function () {
Config = Backbone.Model.extend({
VERSION: 2,
REPORT_ERROR_URL: "/api/v0/error",
ERROR_TRACK_ENABLED: !1,
getSqlApiUrl: function () {
var e = this.get("sql_api_protocol") + "://" + this.get("sql_api_domain") + ":" + this.get("sql_api_port");
return e
}
}), cdb.config = new Config
}(), function () {
cdb.core.Error = Backbone.Model.extend({
url: cdb.config.REPORT_ERROR_URL,
initialize: function () {
this.set({
browser: JSON.stringify($.browser)
})
}
}), cdb.core.ErrorList = Backbone.Collection.extend({
model: cdb.core.Error
}), cdb.errors = new cdb.core.ErrorList, cdb.config.ERROR_TRACK_ENABLED && (window.onerror = function (e, t, n) {
cdb.errors.create({
msg: e,
url: t,
line: n
})
});
var e = function () {};
e.prototype.error = function () {}, e.prototype.log = function () {}, typeof console != "undefined" ? _console = console : _console = new e, cdb.core.Log = Backbone.Model.extend({
error: function () {
_console.error.apply(_console, arguments), cdb.config.ERROR_TRACK_ENABLED && cdb.errors.create({
msg: Array.prototype.slice.call(arguments).join("")
})
},
log: function () {
_console.log.apply(_console, arguments)
},
info: function () {
_console.log.apply(_console, arguments)
},
debug: function () {
_console.log.apply(_console, arguments)
}
})
}(), cdb.log = new cdb.core.Log({
tag: "cdb"
}), function () {
function e() {}
function n(e, t) {
this.el = document.createElement("canvas"), this.el.width = e, this.el.height = t, this.el.style.float = "left", this.el.style.border = "3px solid rgba(0,0,0, 0.2)", this.ctx = this.el.getContext("2d");
var n = e;
this.value = 0, this.max = 0, this.min = 0, this.pos = 0, this.values = [], this.reset = function () {
for (var e = 0; e < n; ++e) this.values[e] = 0
}, this.set_value = function (e) {
this.value = e, this.values[this.pos] = e, this.pos = (this.pos + 1) % n, this.max = e;
for (var t = 0; t < n; ++t) {
var r = this.values[t];
this.max = Math.max(this.max, r)
}
this.scale = this.max, this.render()
}, this.render = function () {
this.el.width = this.el.width;
for (var e = 0; e < n; ++e) {
var r = n - e - 1,
i = (this.pos + r) % n;
i = .9 * t * this.values[i] / this.scale, this.ctx.fillRect(r, t - i, 1, i)
}
}, this.reset()
}
e.times = {}, e.new_time = function (t, n) {
var r = e.times[t] = e.times[t] || {
max: 0,
min: 1e7,
avg: 0,
total: 0,
count: 0
};
r.max = Math.max(r.max, n), r.total += n, r.min = Math.min(r.min, n), ++r.count, r.avg = r.total / r.count, this.callbacks && this.callbacks[t] && this.callbacks[t](t, n)
}, e.new_value = e.new_time, e.print_stats = function () {
for (k in e.times) {
var t = e.times[k];
console.log(" === " + k + " === "), console.log(" max: " + t.max), console.log(" min: " + t.min), console.log(" avg: " + t.avg), console.log(" total: " + t.total)
}
}, e.get = function (t) {
return {
t0: null,
start: function () {
this.t0 = (new Date).getTime()
},
end: function () {
this.t0 !== null && (e.new_time(t, this.time = (new Date).getTime() - this.t0), this.t0 = null)
}
}
}, typeof cdb != "undefined" ? cdb.core.Profiler = e : window.Profiler = e;
var t = t ||
function (e) {
var t = {};
return e.el ? t.el = e.el : e.clientWidth ? t.el = e : t.el = e[0] === "<" ? document.createElement(e.substr(1, e.length - 2)) : document.getElementById(e), t.append = function (e) {
return e.el ? t.el.appendChild(e.el) : t.el.innerHTML += e, t
}, t.attr = function (e, t) {
return this.el.setAttribute(e, t), this
}, t.css = function (e) {
for (var n in e) t.el.style[n] = e[n];
return t
}, t.width = function () {
return this.el.clientWidth
}, t.html = function (e) {
return t.el.innerHTML = e, this
}, t
};
e.ui = function () {
e.callbacks = {};
var r;
r || (r = t("<div>").css({
position: "fixed",
bottom: 10,
left: 10,
zIndex: 2e4,
width: t(document.body).width() - 80,
border: "1px solid #CCC",
padding: "10px 30px",
backgroundColor: "#fff",
fontFamily: "helvetica neue,sans-serif",
fontSize: "14px",
lineHeight: "1.3em"
}), t(document.body).append(r)), this.el = r;
var i = function () {
for (k in e.times) {
var i = "_prof_time_" + k,
s = t(i);
if (!s.el) {
s = t("<div>").attr("id", i), s.css({
margin: "0 0 20px 0",
"border-bottom": "1px solid #EEE"
});
var o = e.times[k],
u = t("<div>").append("<h1>" + k + "</h1>").css({
"font-weight": "bold",
margin: "10px 0 30px 0"
});
for (var a in o) s.append(u.append(t("<div>").append('<span style="display: inline-block; width: 60px;font-weight: 300;">' + a + '</span><span style="font-size: 21px" id="' + k + "-" + a + '"></span>').css({
padding: "5px 0"
})));
r.append(s);
var f = new n(250, 100);
s.append(f), e.callbacks[k] = function (e, t) {
f.set_value(t)
}
}
var o = e.times[k];
for (var a in o) t(k + "-" + a).html(o[a].toFixed(2))
}
};
setInterval(function () {
i()
}, 1e3)
}
}(), cdb.core.Template = Backbone.Model.extend({
initialize: function () {
this.bind("change", this._invalidate), this._invalidate()
},
url: function () {
return this.get("template_url")
},
parse: function (e) {
return {
template: e
}
},
_invalidate: function () {
this.compiled = null, this.get("template_url") && this.fetch()
},
compile: function () {
var e = this.get("type") || "underscore",
t = cdb.core.Template.compilers[e];
return t ? t(this.get("template")) : (cdb.log.error("can't get rendered for " + e), null)
},
render: function (e) {
var t = this.compiled = this.compiled || this.get("compiled") || this.compile(),
n = cdb.core.Profiler.get("template_render");
n.start();
var r = t(e);
return n.end(), r
},
asFunction: function () {
return _.bind(this.render, this)
}
}, {
compilers: {
underscore: _.template,
mustache: typeof Mustache == "undefined" ? null : Mustache.compile
},
compile: function (e, t) {
var n = new cdb.core.Template({
template: e,
type: t || "underscore"
});
return _.bind(n.render, n)
}
}), cdb.core.TemplateList = Backbone.Collection.extend({
model: cdb.core.Template,
getTemplate: function (e) {
this.namespace && (e = this.namespace + e);
var t = this.find(function (t) {
return t.get("name") === e
});
return t ? _.bind(t.render, t) : (cdb.log.error(e + " not found"), null)
}
}), cdb.templates = new cdb.core.TemplateList, cdb._loadJST = function () {
typeof window.JST !== undefined && cdb.templates.reset(_(JST).map(function (e, t) {
return {
name: t,
compiled: e
}
}))
}, function () {
cdb._debugCallbacks = function (e) {
var t = e._callbacks;
for (var n in t) {
var r = t[n];
console.log(" * ", n);
var i = r.tail;
while ((r = r.next) !== i) console.log(" - ", r.context, r.context && r.context.el || "none")
}
};
var e = cdb.core.Model = Backbone.Model.extend({
initialize: function (e) {
return _.bindAll(this, "fetch", "save", "retrigger"), Backbone.Model.prototype.initialize.call(this, e)
},
fetch: function (e) {
var t = this;
this.trigger("loadModelStarted"), $.when(this.elder("fetch", e)).done(function (e) {
t.trigger("loadModelCompleted", e)
}).fail(function (e) {
t.trigger("loadModelFailed", e)
})
},
setIdAttribute: function (e) {
this.idAttribute = e
},
retrigger: function (e, t, n) {
n || (n = e);
var r = this;
t.bind && t.bind(e, function () {
r.trigger(n)
}, r)
},
save: function (e, t) {
var n = this;
return (!t || !t.silent) && this.trigger("saving"), $promise = Backbone.Model.prototype.save.call(this, e, t), $.when($promise).done(function () {
(!t || !t.silent) && n.trigger("saved")
}).fail(function () {
(!t || !t.silent) && n.trigger("errorSaving")
}), $promise
}
})
}(), function () {
var e = cdb.core.View = Backbone.View.extend({
classLabel: "cdb.core.View",
constructor: function (t) {
this._models = [], this._subviews = {}, Backbone.View.call(this, t), e.viewCount++, e.views[this.cid] = this, this._created_at = new Date, cdb.core.Profiler.new_value("total_views", e.viewCount)
},
add_related_model: function (e) {
if (!e) throw "added non valid model";
this._models.push(e)
},
addView: function (e) {
this._subviews[e.cid] = e, e._parent = this
},
removeView: function (e) {
delete this._subviews[e.cid]
},
clearSubViews: function () {
_(this._subviews).each(function (e) {
e.clean()
}), this._subviews = {}
},
clean: function () {
var t = this;
return this.trigger("clean"), this.clearSubViews(), this._parent && (this._parent.removeView(this), this._parent = null), this.remove(), this.unbind(), _(this._models).each(function (e) {
e.unbind(null, null, t)
}), this._models = [], e.viewCount--, delete e.views[this.cid], this
},
getTemplate: function (e) {
return this.options.template ? _.template(this.options.template) : cdb.templates.getTemplate(e)
},
show: function () {
this.$el.show()
},
hide: function () {
this.$el.hide()
},
retrigger: function (e, t, n) {
n || (n = e);
var r = this;
t.bind && t.bind(e, function () {
r.trigger(n)
}, r), this.add_related_model(t)
},
killEvent: function (e) {
e && e.preventDefault && e.preventDefault(), e && e.stopPropagation && e.stopPropagation()
},
cleanTooltips: function () {
$(".tipsy").remove()
}
}, {
viewCount: 0,
views: {},
extendEvents: function (e) {
return function () {
return _.extend(e, this.constructor.__super__.events)
}
},
runChecker: function () {
_.each(cdb.core.View.views, function (e) {
_.each(e, function (t, n) {
n !== "_parent" && e.hasOwnProperty(n) && t instanceof cdb.core.View && e._subviews[t.cid] === undefined && (console.log("========="), console.log("untracked view: "), console.log(t.el), console.log("parent"), console.log(e.el), console.log(" "))
})
})
}
})
}(), cdb.geo.geocoder.YAHOO = {
keys: {
app_id: "nLQPTdTV34FB9L3yK2dCXydWXRv3ZKzyu_BdCSrmCBAM1HgGErsCyCbBbVP2Yg--"
},
geocode: function (e, t) {
e = e.toLowerCase().replace(/é/g, "e").replace(/á/g, "a").replace(/í/g, "i").replace(/ó/g, "o").replace(/ú/g, "u").replace(/ /g, "+");
var n = "";
location.protocol.indexOf("http") === -1 && (n = "http:"), $.getJSON(n + "//query.yahooapis.com/v1/public/yql?q=" + encodeURIComponent('SELECT * FROM json WHERE url="http://where.yahooapis.com/geocode?q=' + e + "&appid=" + this.keys.app_id + '&flags=JX"') + "&format=json&callback=?", function (e) {
var n = [];
if (e && e.query && e.query.results && e.query.results.json && e.query.results.json.ResultSet && e.query.results.json.ResultSet.Found != "0") {
var r;
_.isArray(e.query.results.json.ResultSet.Results) ? r = e.query.results.json.ResultSet.Results : r = [e.query.results.json.ResultSet.Results];
for (var i in r) {
var s = r[i],
o;
o = {
lat: s.latitude,
lon: s.longitude
}, s.boundingbox && (o.boundingbox = s.boundingbox), n.push(o)
}
}
t(n)
})
}
}, cdb.geo.geocoder.NOKIA = {
keys: {
app_id: "KuYppsdXZznpffJsKT24",
app_code: "A7tBPacePg9Mj_zghvKt9Q"
},
geocode: function (e, t) {
e = e.toLowerCase().replace(/é/g, "e").replace(/á/g, "a").replace(/í/g, "i").replace(/ó/g, "o").replace(/ú/g, "u").replace(/ /g, "+");
var n = "";
location.protocol.indexOf("http") === -1 && (n = "http:"), $.getJSON(n + "//places.nlp.nokia.com/places/v1/discover/search/?q=" + encodeURIComponent(e) + "&app_id=" + this.keys.app_id + "&app_code=" + this.keys.app_code + "&Accept-Language=en-US&at=0,0&callback=?", function (e) {
var n = [];
if (e && e.results && e.results.items && e.results.items.length > 0) {
var r = e.results.items;
for (var i in r) {
var s = r[i],
o;
o = {
lat: s.position[0],
lon: s.position[1]
}, s.bbox && (o.boundingbox = {
north: s.bbox[3],
south: s.bbox[1],
east: s.bbox[2],
west: s.bbox[0]
}), n.push(o)
}
}
t(n)
})
}
}, cdb.geo.Geometry = cdb.core.Model.extend({
isPoint: function () {
var e = this.get("geojson").type;
return e && e.toLowerCase() === "point" ? !0 : !1
}
}), cdb.geo.Geometries = Backbone.Collection.extend({}), _.extend(GeometryView.prototype, Backbone.Events, {
edit: function () {
throw new Error("to be implemented")
}
}), cdb.geo.MapLayer = cdb.core.Model.extend({
defaults: {
visible: !0,
type: "Tiled"
},
isEqual: function (e) {
var t = this.toJSON(),
n = e.toJSON(),
r = ["id", "order"];
_.each(r, function (e) {
delete t[e], delete n[e], t.options && delete t.options[e], n.options && delete n.options[e]
});
var i = t.type ? t.type : t.options.type,
s = n.type ? n.type : n.options.type;
if (i && i === s) {
if (i === "Tiled") {
var o = t.urlTemplate ? t.urlTemplate : t.options.urlTemplate,
u = n.urlTemplate ? n.urlTemplate : n.options.urlTemplate;
return o === u ? !0 : !1
}
var a = t.base_type ? t.base_type : t.options.base_type,
f = n.base_type ? n.base_type : n.options.base_type;
return a ? _.isEqual(t, n) ? !0 : !1 : !0
}
return !1
},
updateCartoCss: function (e, t) {
var n = this.get("tile_style"),
r = new RegExp("#" + e, "g");
n = n.replace(r, "#" + t), this.save({
tile_style: n
})
}
}), cdb.geo.TileLayer = cdb.geo.MapLayer.extend({
getTileLayer: function () {}
}), cdb.geo.GMapsBaseLayer = cdb.geo.MapLayer.extend({
OPTIONS: ["roadmap", "satellite", "terrain", "custom"],
defaults: {
type: "GMapsBase",
base_type: "gray_roadmap",
style: null
}
}), cdb.geo.PlainLayer = cdb.geo.MapLayer.extend({
defaults: {
type: "Plain",
base_type: "plain",
className: "plain",
color: "#FFFFFF"
}
}), cdb.geo.CartoDBLayer = cdb.geo.MapLayer.extend({
defaults: {
attribution: "CartoDB",
type: "CartoDB",
active: !0,
query: null,
opacity: .99,
interactivity: null,
interaction: !0,
debug: !1,
tiler_domain: "cartodb.com",
tiler_port: "80",
tiler_protocol: "http",
sql_api_domain: "cartodb.com",
sql_api_port: "80",
sql_api_protocol: "http",
extra_params: {},
cdn_url: null,
maxZoom: 28
},
activate: function () {
this.set({
active: !0,
opacity: .99,
visible: !0
})
},
deactivate: function () {
this.set({
active: !1,
opacity: 0,
visible: !1
})
},
invalidate: function () {
var e = this.get("extra_params") || e;
e.cache_buster = (new Date).getTime(), this.set("extra_params", e), this.trigger("change", this)
},
toggle: function () {
this.get("active") ? this.deactivate() : this.activate()
}
}), cdb.geo.CartoDBGroupLayer = cdb.geo.MapLayer.extend({
defaults: {
visible: !0,
type: "layergroup"
}
}), cdb.geo.Layers = Backbone.Collection.extend({
model: cdb.geo.MapLayer,
initialize: function () {
this.comparator = function (e) {
return parseInt(e.get("order"), 10)
}, this.bind("add", this._assignIndexes)
},
_assignIndexes: function (e, t, n) {
var r = this.size() - 1;
n && n.at !== undefined && (r = n.at), r === 0 && (this.models[0].set({
order: 0
}), ++r);
for (var i = r; i < this.size(); ++i) {
var s = this.models[i - 1].get("order");
this.models[i].set({
order: s + 1
})
}
}
}), cdb.geo.Map = cdb.core.Model.extend({
defaults: {
center: [0, 0],
zoom: 3,
minZoom: 0,
maxZoom: 28,
scrollwheel: !0,
provider: "leaflet"
},
initialize: function () {
this.layers = new cdb.geo.Layers, this.layers.bind("reset", function () {
this.layers.size() >= 1 && this._adjustZoomtoLayer(this.layers.models[0])
}, this), this.geometries = new cdb.geo.Geometries
},
setView: function (e, t) {
this.set({
center: e,
zoom: t
}, {
silent: !0
}), this.trigger("set_view")
},
setZoom: function (e) {
this.set({
zoom: e
})
},
enableScrollWheel: function () {
this.set({
scrollwheel: !0
})
},
disableScrollWheel: function () {
this.set({
scrollwheel: !1
})
},
getZoom: function () {
return this.get("zoom")
},
setCenter: function (e) {
this.set({
center: e
})
},
setOptions: function (e) {
if (typeof e != "object" || e.length) {
if (this.options.debug) throw e + " options has to be an object";
return
}
_.defaults(this.options, e)
},
getViewBounds: function () {
return this.has("view_bounds_sw") && this.has("view_bounds_ne") ? [this.get("view_bounds_sw"), this.get("view_bounds_ne")] : null
},
getLayerAt: function (e) {
return this.layers.at(e)
},
getLayerByCid: function (e) {
return this.layers.getByCid(e)
},
_adjustZoomtoLayer: function (e) {},
addLayer: function (e, t) {
return this.layers.size() == 0 && this._adjustZoomtoLayer(e), this.layers.add(e, t), this.trigger("layerAdded"), this.layers.length === 1 && this.trigger("firstLayerAdded"), e.cid
},
removeLayer: function (e) {
this.layers.remove(e)
},
removeLayerByCid: function (e) {
var t = this.layers.getByCid(e);
t ? this.removeLayer(t) : cdb.log.error("There's no layer with cid = " + e + ".")
},
removeLayerAt: function (e) {
var t = this.layers.at(e);
t ? this.removeLayer(t) : cdb.log.error("There's no layer in that position.")
},
clearLayers: function () {
while (this.layers.length > 0) this.removeLayer(this.layers.at(0))
},
getBaseLayer: function () {
return this.layers.at(0)
},
isBaseLayerAdded: function (e) {
var t = this.getBaseLayer();
return t && e.isEqual(t)
},
getLayerTemplate: function () {
var e = this.getBaseLayer();
if (e && e.get("options")) return e.get("options").urlTemplate
},
updateAttribution: function (e, t) {
var n = this.get("attribution") || [];
e && e.get("attribution") && (n = _.without(n, e.get("attribution"))), t.get("attribution") && (_.contains(n, t.get("attribution")) || n.push(t.get("attribution"))), this.set({
attribution: n
})
},
addGeometry: function (e) {
this.geometries.add(e)
},
removeGeometry: function (e) {
this.geometries.remove(e)
},
setBounds: function (e) {
this.attributes.view_bounds_sw = [e[0][0], e[0][1]], this.attributes.view_bounds_ne = [e[1][0], e[1][1]], this.trigger("change:view_bounds_ne", this)
},
fitBounds: function (e, t) {
var n = this.getBoundsZoom(e, t);
if (n == null) return;
var r = cdb.geo.Map.latlngToMercator(e[0], n),
i = cdb.geo.Map.latlngToMercator(e[1], n),
s = cdb.geo.Map.mercatorToLatLng({
x: (r[0] + i[0]) * .5,
y: (r[1] + i[1]) * .5
}, n);
this.set({
center: s,
zoom: n
})
},
getBoundsZoom: function (e, t) {
var n = [t.x, t.y],
r = this.get("minZoom") || 0,
i = this.get("maxZoom") || 24,
s = e[1],
o = e[0],
u = [],
a, f, l = !0;
do r++, a = cdb.geo.Map.latlngToMercator(s, r), f = cdb.geo.Map.latlngToMercator(o, r), u[0] = Math.abs(a[0] - f[0]), u[1] = Math.abs(f[1] - a[1]), l = u[0] <= n[0] || u[1] <= n[1];
while (l && r <= i);
return l ? null : r - 1
}
}, {
latlngToMercator: function (e, t) {
var n = new L.LatLng(e[0], e[1]),
r = L.CRS.EPSG3857.latLngToPoint(n, t);
return [r.x, r.y]
},
mercatorToLatLng: function (e, t) {
var n = L.CRS.EPSG3857.pointToLatLng(e, t);
return [n.lat, n.lng]
}
}), cdb.geo.MapView = cdb.core.View.extend({
initialize: function () {
if (this.options.map === undefined) throw "you should specify a map model";
this.map = this.options.map, this.add_related_model(this.map), this.add_related_model(this.map.layers), this.autoSaveBounds = !1, this.layers = {}, this.geometries = {}, this.bind("clean", this._removeLayers, this)
},
render: function () {
return this
},
addInfowindow: function (e) {
this.addOverlay(e)
},
addOverlay: function (e) {
e && (this.$el.append(e.render().el), this.addView(e))
},
getInfoWindows: function () {
var e = [];
for (var t in this._subviews) this._subviews[t] instanceof cdb.geo.ui.Infowindow && e.push(this._subviews[t]);
return e
},
showBounds: function (e) {
throw "to be implemented"
},
_removeLayers: function () {
for (var e in this.layers) this.layers[e].remove();
this.layers = {}
},
_setModelProperty: function (e) {
this._unbindModel(), this.map.set(e);
if (e.center !== undefined || e.zoom !== undefined) {
var t = this.getBounds();
this.map.set({
view_bounds_sw: t[0],
view_bounds_ne: t[1]
}), this.autoSaveBounds && this._saveLocation()
}
this._bindModel()
},
_bindModel: function () {
this._unbindModel(), this.map.bind("change:view_bounds_sw", this._changeBounds, this), this.map.bind("change:view_bounds_ne", this._changeBounds, this), this.map.bind("change:zoom", this._setZoom, this), this.map.bind("change:scrollwheel", this._setScrollWheel, this), this.map.bind("change:center", this._setCenter, this), this.map.bind("change:attribution", this._setAttribution, this)
},
_unbindModel: function () {
this.map.unbind("change:view_bounds_sw", null, this), this.map.unbind("change:view_bounds_ne", null, this), this.map.unbind("change:zoom", null, this), this.map.unbind("change:scrollwheel", null, this), this.map.unbind("change:center", null, this), this.map.unbind("change:attribution", null, this)
},
_changeBounds: function () {
var e = this.map.getViewBounds();
e && this.showBounds(e)
},
showBounds: function (e) {
this.map.fitBounds(e, this.getSize())
},
_setAttribution: function (e, t) {
this.setAttribution(e)
},
_addLayers: function () {
var e = this;
this._removeLayers(), this.map.layers.each(function (t) {
e._addLayer(t)
})
},
_removeLayers: function (e) {
for (var t in this.layers) {
var n = this.layers[t];
n.remove(), delete this.layers[t]
}
},
_removeLayer: function (e) {
var t = this.layers[e.cid];
t && (t.remove(), delete this.layers[e.cid])
},
_removeGeometry: function (e) {
var t = this.geometries[e.cid];
delete this.layers[layer.cid]
},
getLayerByCid: function (e) {
var t = this.layers[e];
return t || cdb.log.debug("layer with cid " + e + " can't be get"), t
},
_setZoom: function (e, t) {
throw "to be implemented"
},
_setCenter: function (e, t) {
throw "to be implemented"
},
_addLayer: function (e, t, n) {
throw "to be implemented"
},
_addGeomToMap: function (e) {
throw "to be implemented"
},
_removeGeomFromMap: function (e) {
throw "to be implemented"
},
setAutoSaveBounds: function () {
var e = this;
this.autoSaveBounds = !0
},
_saveLocation: _.debounce(function () {
this.map.save(null, {
silent: !0
})
}, 1e3),
_addGeometry: function (e) {
var t = this._addGeomToMap(e);
this.geometries[e.cid] = t
},
_removeGeometry: function (e) {
var t = this.geometries[e.cid];
this._removeGeomFromMap(t), delete this.geometries[e.cid]
}
}, {
_getClass: function (e) {
var t = cdb.geo.LeafletMapView;
return e === "googlemaps" && (typeof google != "undefined" && typeof google.maps != "undefined" ? t = cdb.geo.GoogleMapsMapView : cdb.log.error("you must include google maps library _before_ include cdb")), t
},
create: function (e, t) {
var n = cdb.geo.MapView._getClass(t.get("provider"));
return new n({
el: e,
map: t
})
}
}), cdb.geo.ui.Zoom = cdb.core.View.extend({
className: "cartodb-zoom",
events: {
"click .zoom_in": "zoom_in",
"click .zoom_out": "zoom_out"
},
default_options: {
timeout: 0,
msg: ""
},
initialize: function () {
this.map = this.model, _.defaults(this.options, this.default_options), this.template = this.options.template ? this.options.template : cdb.templates.getTemplate("geo/zoom")
},
render: function () {
return this.$el.html(this.template(this.options)), this
},
zoom_in: function (e) {
this.map.get("maxZoom") > this.map.getZoom() && this.map.setZoom(this.map.getZoom() + 1), e.preventDefault(), e.stopPropagation()
},
zoom_out: function (e) {
this.map.get("minZoom") < this.map.getZoom() && this.map.setZoom(this.map.getZoom() - 1), e.preventDefault(), e.stopPropagation()
}
}), cdb.geo.ui.ZoomInfo = cdb.core.View.extend({
className: "cartodb-zoom-info",
initialize: function () {
this.model.bind("change:zoom", this.render, this)
},
render: function () {
return this.$el.html(this.model.get("zoom")), this
}
}), cdb.geo.ui.LegendItemModel = cdb.core.Model.extend({
defaults: {
name: "Untitled",
value: ""
}
}), cdb.geo.ui.LegendItems = Backbone.Collection.extend({
model: cdb.geo.ui.LegendItemModel
}), cdb.geo.ui.LegendItem = cdb.core.View.extend({
tagName: "li",
initialize: function () {
_.bindAll(this, "render"), this.template = this.options.template ? _.template(this.options.template) : cdb.templates.getTemplate("geo/legend")
},
render: function () {
return this.$el.html(this.template(this.model.toJSON())), this.$el
}
}), cdb.geo.ui.ChoroplethLegend = cdb.core.View.extend({
tagName: "ul",
initialize: function () {
this.items = this.options.items, this.template = _.template('<li class="min"><%= leftLabel %></li><li class="max"><%= rightLabel %></li><li class="graph count_<%= buckets_count %>"><div class="colors"><%= colors %></div></li>'), this.model = new cdb.core.Model
},
render: function () {
if (this.items.length >= 2) {
this.leftLabel = this.items.at(0), this.rightLabel = this.items.at(1);
var e = this.leftLabel.get("value"),
t = this.rightLabel.get("value"),
n = "";
for (var r = 2; r < this.items.length; r++) {
var i = this.items.at(r).get("value");
n += '<div class="quartile" style="background-color:' + i + '"></div>'
}
this.model.set({
leftLabel: e,
rightLabel: t,
colors: n,
buckets_count: this.items.length - 2
}), this.$el.html(this.template(this.model.toJSON()))
}
return this
}
}), cdb.geo.ui.DensityLegend = cdb.core.View.extend({
tagName: "ul",
initialize: function () {
this.items = this.options.items, this.template = _.template('<li class="min"><%= leftLabel %></li><li class="max"><%= rightLabel %></li><li class="graph count_<%= buckets_count %>"><div class="colors"><%= colors %></div></li>'), this.model = new cdb.core.Model
},
render: function () {
if (this.items.length >= 2) {
this.leftLabel = this.items.at(0), this.rightLabel = this.items.at(1);
var e = this.leftLabel.get("value"),
t = this.rightLabel.get("value"),
n = "";
for (var r = 2; r < this.items.length; r++) {
var i = this.items.at(r).get("value");
n += '<div class="quartile" style="background-color:' + i + '"></div>'
}
this.model.set({
leftLabel: e,
rightLabel: t,
colors: n,
buckets_count: this.items.length - 2
}), this.$el.html(this.template(this.model.toJSON()))
}
return this
}
}), cdb.geo.ui.IntensityLegend = cdb.core.View.extend({
tagName: "ul",
initialize: function () {
this.items = this.options.items, this.template = _.template('<li class="min"><%= leftLabel %></li><li class="max"><%= rightLabel %></li><li class="graph"></li>'), this.model = new cdb.core.Model
},
_hexToRGB: function (e) {
var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
return t ? {
r: parseInt(t[1], 16),
g: parseInt(t[2], 16),
b: parseInt(t[3], 16)
} : null
},
_rgbToHex: function (e, t, n) {
function r(e) {
var t = e.toString(16);
return t.length == 1 ? "0" + t : t
}
return "#" + r(e) + r(t) + r(n)
},
_calculateMultiply: function (e, t) {
var n = this._hexToRGB(e);
if (n) {
var r = n.r,
i = n.g,
s = n.b;
for (var o = 0; o <= t; o++) r = Math.round(r * n.r / 255), i = Math.round(i * n.g / 255), s = Math.round(s * n.b / 255);
return this._rgbToHex(r, i, s)
}
return "#ffffff"
},
_renderGraph: function () {
var e = "";
e += "background: <%= color %>;", e += "background: -moz-linear-gradient(left, <%= color %> 0%, <%= right %> 100%);", e += "background: -webkit-gradient(linear, left top, right top, color-stop(0%,<%= color %>), color-stop(100%,<%= right %>));", e += "background: -webkit-linear-gradient(left, <%= color %> 0%,<%= right %> 100%);", e += "background: -o-linear-gradient(left, <%= color %> 0%,<%= right %> 100%);", e += "background: -ms-linear-gradient(left, <%= color %> 0%,<%= right %> 100%)", e += "background: linear-gradient(to right, <%= color %> 0%,<%= right %> 100%);", e += "filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='<%= color %>', endColorstr='<%= right %>',GradientType=1 );", e += "background-image: -ms-linear-gradient(left, <%= color %> 0%,<%= right %> 100%)";
var t = _.template(e),
n = this.color.get("value"),
r = this._calculateMultiply(n, 4);
this.$el.find(".graph").attr("style", t({
color: n,
right: r
}))
},
render: function () {
if (this.items.length >= 3) {
this.leftLabel = this.items.at(0), this.rightLabel = this.items.at(1), this.color = this.items.at(2);
var e = this.leftLabel.get("value"),
t = this.rightLabel.get("value");
this.model.set({
leftLabel: e,
rightLabel: t
}), this.$el.html(this.template(this.model.toJSON())), this._renderGraph()
}
return this
}
}), cdb.geo.ui.DebugLegend = cdb.core.View.extend({}), cdb.geo.ui.BubbleLegend = cdb.core.View.extend({
tagName: "ul",
initialize: function () {
this.items = this.options.items, this.template = _.template('<li><%= min %></li><li class="graph"><div class="bubbles"></div></li><li><%= max %></li>'), this.model = new cdb.core.Model, this.add_related_model(this.model)
},
_renderGraph: function () {
this.items.length >= 3 && this.$el.find(".graph").css("background", this.items.at(2).get("value"))
},
render: function () {
if (this.items.length >= 3) {
var e = this.items.at(0),
t = this.items.at(1);
this.model.set({
min: e.get("value"),
max: t.get("value")
}), this.$el.html(this.template(this.model.toJSON()))
}
return this._renderGraph(), this
}
}), cdb.geo.ui.CategoryLegend = cdb.core.View.extend({
tagName: "ul",
initialize: function () {
this.items = this.options.items, this.template = _.template(""), this.model = new cdb.core.Model({
type: "custom"
})
},
_renderItems: function () {
this.items.each(this._renderItem, this)
},
_renderItem: function (e) {
view = new cdb.geo.ui.LegendItem({
model: e,
template: '<div class="bullet" style="background:<%= value %>"></div><%= name || "null" %>'
}), this.$el.append(view.render())
},
render: function () {
return this.$el.html(this.template(this.model.toJSON())), this.items.length > 0 ? this._renderItems() : this.$el.html('<li class="warning">The category legend is empty</li>'), this
}
}), cdb.geo.ui.ColorLegend = cdb.core.View.extend({
tagName: "ul",
initialize: function () {
this.items = this.options.items, this.template = _.template(""), this.model = new cdb.core.Model({
type: "custom"
})
},
_renderItems: function () {
this.items.each(this._renderItem, this)
},
_renderItem: function (e) {
view = new cdb.geo.ui.LegendItem({
model: e,
template: '<div class="bullet" style="background:<%= value %>"></div><%= name || ((name === false) ? "false": "null") %>'
}), this.$el.append(view.render())
},
render: function () {
return this.$el.html(this.template(this.model.toJSON())), this.items.length > 0 ? this._renderItems() : this.$el.html('<li class="warning">The color legend is empty</li>'), this
}
}), cdb.geo.ui.CustomLegend = cdb.core.View.extend({
tagName: "ul",
initialize: function () {
this.items = this.options.items, this.template = _.template(""), this.model = new cdb.core.Model({
type: "custom"
})
},
_renderItems: function () {
this.items.each(this._renderItem, this)
},
_renderItem: function (e) {
view = new cdb.geo.ui.LegendItem({
model: e,
template: '<div class="bullet" style="background:<%= value %>"></div><%= name || "null" %>'
}), this.$el.append(view.render())
},
render: function () {
return this.$el.html(this.template(this.model.toJSON())), this.items.length > 0 ? this._renderItems() : this.$el.html('<li class="warning">The legend is empty</li>'), this
}
}), cdb.geo.ui.StackedLegend = cdb.core.View.extend({
className: "cartodb-legend-stack",
initialize: function () {
_.each(this.options.legends, this._setupBinding, this)
},
getLayerByIndex: function (e) {
if (!this._layerByIndex) {
this._layerByIndex = {};
var t = this.options.legends;
for (var n = 0; n < t.length; ++n) {
var r = t[n];
this._layerByIndex[r.options.index] = r
}
}
return this._layerByIndex[e]
},
_setupBinding: function (e) {
e.model.bind("change:type", this._checkVisibility, this), this.add_related_model(e.model)
},
_checkVisibility: function () {
var e = _.some(this.options.legends, function (e) {
return e.model.get("type")
}, this);
e ? this.show() : this.hide(), _.each(this.options.legends, function (e) {
e.model.get("type") ? e.show() : e.hide()
}, this)
},
_renderItems: function () {
_.each(this.options.legends, function (e) {
this.$el.append(e.render().$el)
}, this)
},
show: function () {
this.$el.show()
},
hide: function () {
this.$el.hide()
},
render: function () {
return this._renderItems(), this._checkVisibility(), this
}
}), cdb.geo.ui.LegendModel = cdb.core.Model.extend({
defaults: {
type: null
},
initialize: function () {
this.items = new cdb.geo.ui.LegendItems(this.get("items")), this.items.bind("add remove reset change", function () {
this.set("items", this.items.toJSON())
}, this), this.bind("change:items", this._onUpdateItems, this)
},
_onUpdateItems: function () {
var e = this.get("items");
this.items.reset(e)
}
}), cdb.geo.ui.Legend = cdb.core.View.extend({
className: "cartodb-legend",
initialize: function () {
_.bindAll(this, "render", "show", "hide"), _.defaults(this.options, this.default_options), this.map = this.options.map, this._setupModel(), this._setupItems(), this._updateLegendType()
},
_setupModel: function () {
this.model || (this.model = new cdb.geo.ui.LegendModel({
type: this.options.type || cdb.geo.ui.LegendModel.prototype.defaults.type
})), this.add_related_model(this.model), this.model.bind("change:type", this._updateLegendType, this), this.model.bind("change:items", this._updateLegendType, this)
},
_updateLegendType: function () {
var e = this.model.get("type");
this.legend_name = this._capitalize(e) + "Legend";
if (e == "none" || e == null) this.legend_name = null, this.model.set({
type: null
}, {
silent: !0
});
else if (!cdb.geo.ui[this.legend_name]) {
this.legend_name = null, this.model.set({
type: this.model.previous("type")
}, {
silent: !0
});
return
}
this._refresh()
},
_refresh: function () {
var e = this;
this.view && this.view.clean();
var t = this.model.get("type");
t ? (this.view = new cdb.geo.ui[this.legend_name]({
items: e.items
}), this.$el.removeClass(), this.$el.addClass(this.className + " " + this.model.get("type")), this.show()) : (this.hide(), this.$el.removeClass(), this.$el.addClass(this.className + " none")), this.render()
},
_setupItems: function () {
var e = this;
this.items = this.model.items, this.options.data && this.items.reset(this.options.data), this.items.bind("add remove change:value change:name", this.render, this)
},
show: function (e) {
this.model.get("type") && this.$el.show()
},
hide: function (e) {
this.model.get("type") && this.$el.hide()
},
_capitalize: function (e) {
if (e) return e.charAt(0).toUpperCase() + e.slice(1)
},
render: function () {
return this.view && this.$el.append(this.view.render().$el), this
}
}), cdb.geo.ui.SwitcherItemModel = Backbone.Model.extend({}), cdb.geo.ui.SwitcherItems = Backbone.Collection.extend({
model: cdb.geo.ui.SwitcherItemModel
}), cdb.geo.ui.SwitcherItem = cdb.core.View.extend({
tagName: "li",
events: {
"click a": "select"
},
initialize: function () {
_.bindAll(this, "render"), this.template = cdb.templates.getTemplate("templates/map/switcher/item"), this.parent = this.options.parent, this.model.on("change:selected", this.render)
},
select: function (e) {
e.preventDefault(), this.parent.toggle(this);
var t = this.model.get("callback");
t && t()
},
render: function () {
return this.model.get("selected") == 1 ? this.$el.addClass("selected") : this.$el.removeClass("selected"), this.$el.html(this.template(this.model.toJSON())), this.$el
}
}), cdb.geo.ui.Switcher = cdb.core.View.extend({
id: "switcher",
default_options: {},
initialize: function () {
this.map = this.model, this.add_related_model(this.model), _.bindAll(this, "render", "show", "hide", "toggle"), _.defaults(this.options, this.default_options), this.collection && (this.model.collection = this.collection), this.template = this.options.template ? this.options.template : cdb.templates.getTemplate("geo/switcher")
},
show: function () {
this.$el.fadeIn(250)
},
hide: function () {
this.$el.fadeOut(250)
},
toggle: function (e) {
this.collection && this.collection.each(function (e) {
e.set("selected", !e.get("selected"))
})
},
render: function () {
var e = this;
return this.model != undefined && this.$el.html(this.template(this.model.toJSON())), this.collection && this.collection.each(function (t) {
var n = new cdb.geo.ui.SwitcherItem({
parent: e,
className: t.get("className"),
model: t
});
e.$el.find("ul").append(n.render())
}), this
}
}), cdb.geo.ui.InfowindowModel = Backbone.Model.extend({
SYSTEM_COLUMNS: ["the_geom", "the_geom_webmercator", "created_at", "updated_at", "cartodb_id", "cartodb_georef_status"],
defaults: {
template_name: "geo/infowindow",
latlng: [0, 0],
offset: [28, 0],
autoPan: !0,
content: "",
visibility: !1,
fields: null
},
clearFields: function () {
this.set({
fields: []
})
},
saveFields: function () {
this.set("old_fields", _.clone(this.get("fields")))
},
fieldCount: function () {
return this.get("fields").length
},
restoreFields: function (e) {
var t = this.get("old_fields");
e && (t = t.filter(function (t) {
return _.contains(e, t.name)
})), t && t.length && this._setFields(t), this.unset("old_fields")
},
_cloneFields: function () {
return _(this.get("fields")).map(function (e) {
return _.clone(e)
})
},
_setFields: function (e) {
e.sort(function (e, t) {
return e.position - t.position
}), this.set({
fields: e
})
},
sortFields: function () {
this.get("fields").sort(function (e, t) {
return e.position - t.position
})
},
_addField: function (e, t) {
var n = $.Deferred();
if (!this.containsField(e)) {
var r = this.get("fields");
r ? (t = t === undefined ? r.length : t, r.push({
name: e,
title: !0,
position: t
})) : (t = t === undefined ? 0 : t, this.set("fields", [{
name: e,
title: !0,
position: t
}]))
}
return n.resolve(), n.promise()
},
addField: function (e, t) {
var n = this;
return $.when(this._addField(e, t)).then(function () {
n.sortFields(), n.trigger("change:fields"), n.trigger("add:fields")
}), this
},
getFieldProperty: function (e, t) {
if (this.containsField(e)) {
var n = this.get("fields") || [],
r = _.indexOf(_(n).pluck("name"), e);
return n[r][t]
}
return null
},
setFieldProperty: function (e, t, n) {
if (this.containsField(e)) {
var r = this._cloneFields() || [],
i = _.indexOf(_(r).pluck("name"), e);
r[i][t] = n, this._setFields(r)
}
return this
},
getFieldPos: function (e) {
var t = this.getFieldProperty(e, "position");
return t == undefined ? Number.MAX_VALUE : t
},
containsField: function (e) {
var t = this.get("fields") || [];
return _.contains(_(t).pluck("name"), e)
},
removeField: function (e) {
if (this.containsField(e)) {
var t = this._cloneFields() || [],
n = _.indexOf(_(t).pluck("name"), e);
n >= 0 && t.splice(n, 1), this._setFields(t), this.trigger("remove:fields")
}
return this
}
}), cdb.geo.ui.Infowindow = cdb.core.View.extend({
className: "cartodb-infowindow",
spin_options: {
lines: 10,
length: 0,
width: 4,
radius: 6,
corners: 1,
rotate: 0,
color: "rgba(0,0,0,0.5)",
speed: 1,
trail: 60,
shadow: !1,
hwaccel: !0,
className: "spinner",
zIndex: 2e9,
top: "auto",
left: "auto",
position: "absolute"
},
events: {
"click .close": "_closeInfowindow",
"touchstart .close": "_closeInfowindow",
"MSPointerDown .close": "_closeInfowindow",
dragstart: "_checkOrigin",
mousedown: "_checkOrigin",
touchstart: "_checkOrigin",
MSPointerDown: "_checkOrigin",
dblclick: "_stopPropagation",
mousewheel: "_stopPropagation",
DOMMouseScroll: "_stopPropagation",
dbclick: "_stopPropagation",
click: "_stopPropagation"
},
initialize: function () {
var e = this;
_.bindAll(this, "render", "setLatLng", "changeTemplate", "_updatePosition", "_update", "toggle", "show", "hide"), this.mapView = this.options.mapView, this.template = this.options.template ? this.options.template : cdb.templates.getTemplate(this.model.get("template_name")), this.add_related_model(this.model), this.model.bind("change:content", this.render, this), this.model.bind("change:template_name", this.changeTemplate, this), this.model.bind("change:latlng", this._update, this), this.model.bind("change:visibility", this.toggle, this), this.model.bind("change:template", this._compileTemplate, this), this.mapView.map.bind("change", this._updatePosition, this), this.mapView.bind("zoomstart", function () {
e.hide(!0)
}), this.mapView.bind("zoomend", function () {
e.show(!0)
}), this.minHeightToScroll = 180, this.render(), this.$el.hide()
},
render: function () {
if (this.template) {
var e = this.$el.find(".cartodb-popup-content");
e.length > 0 && e.data() != null && e.data().jsp && e.data().jsp.destroy();
var t = _.map(this.model.attributes.content.fields, function (e) {
return _.clone(e)
}),
n = _.clone(this.model.attributes.template_name),
r = this._fieldsToString(t, n),
i = this.model.get("content") ? this.model.get("content").data : {};
this.$el.html(this.template({
content: {
fields: r,
data: i
}
}));
var s = this;
setTimeout(function () {
var e = s.$el.find(".cartodb-popup-content").outerHeight() + s.$el.find(".cartodb-popup-header").outerHeight();
s.minHeightToScroll <= e && s.$el.find(".cartodb-popup-content").jScrollPane({
maintainPosition: !1,
verticalDragMinHeight: 20
})
}, 1), this._checkLoading(), this._loadCover()
}
return this
},
changeTemplate: function (e) {
this.template = cdb.templates.getTemplate(this.model.get("template_name")), this.render()
},
_compileTemplate: function () {
var e = this.model.get("template");
typeof e != "function" ? this.template = (new cdb.core.Template({
template: e,
type: this.model.get("template_type") || "mustache"
})).asFunction() : this.template = e, this.render()
},
_checkOrigin: function (e) {
var t = $(e.target).closest(".jspVerticalBar").length > 0 && e.type != "touchstart";
t || e.stopPropagation()
},
_fieldsToString: function (e, t) {
var n = [];
if (e && e.length > 0) {
var r = this;
n = _.map(e, function (e, n) {
return r._sanitizeField(e, t, e.index || n)
})
}
return n
},
_sanitizeField: function (e, t, n) {
if (e.value == null || e.value == undefined) e.value = "";
var r = e.value.toString();
return e.title && (e.title = e.title.replace(/_/g, " ")), !e.type && n == 0 && e.value.length > 35 && t && t.search("_header_") != -1 && (r = e.value.substr(0, 32) + "..."), !e.type && n == 1 && e.value.length > 35 && t && t.search("_header_with_image") != -1 && (r = e.value.substr(0, 32) + "..."), this._isValidURL(e.value) && (r = "<a href='" + e.value + "' target='_blank'>" + r + "</a>"), n == 0 && t.search("_header_with_image") != -1 && (r = e.value), e.value = r, e
},
_checkLoading: function () {
var e = this.model.get("content");
e.fields && e.fields.length == 1 && e.fields[0].type == "loading" ? this._startSpinner() : this._stopSpinner()
},
_stopSpinner: function () {
this.spinner && this.spinner.stop()
},
_startSpinner: function (e) {
this._stopSpinner();
var e = this.$el.find(".loading");
if (e) {
var t = this.model.get("template_name").search("dark") != -1;
t ? this.spin_options.color = "#FFF" : this.spin_options.color = "rgba(0,0,0,0.5)", this.spinner = (new Spinner(this.spin_options)).spin(), e.append(this.spinner.el)
}
},
_containsCover: function () {
return this.$el.find(".cartodb-popup.header").attr("data-cover") ? !0 : !1
},
_getCoverURL: function () {
var e = this.model.get("content");
return e && e.fields && e.fields.length > 0 ? e.fields[0].value.toString() : !1
},
_loadCover: function () {
if (!this._containsCover()) return;
var e = this,
t = this.$(".cover"),
n = this.$(".shadow"),
r = this._getCoverURL();
if (!this._isValidURL(r)) {
n.hide(), cdb.log.info("Header image url not valid");
return
}
var i = document.getElementById("spinner"),
s = {
lines: 9,
length: 4,
width: 2,
radius: 4,
corners: 1,
rotate: 0,
color: "#ccc",
speed: 1,
trail: 60,
shadow: !0,
hwaccel: !1,
zIndex: 2e9
},
o = (new Spinner(s)).spin(i),
u = t.find("img");
u.hide(function () {
this.remove()
}), u = $("<img />").attr("src", r), t.append(u), u.load(function () {
o.stop();
var e = u.width(),
n = u.height(),
r = t.width(),
i = t.height(),
s = n / e,
a = i / r;
if (e > r && n > i) if (s < a) u.css({
height: i
});
else {
var f = n / (e / r);
u.css({
width: r,
top: "50%",
position: "absolute",
"margin-top": -1 * parseInt(f, 10) / 2
})
} else {
var f = n / (e / r);
u.css({
width: r,
top: "50%",
position: "absolute",
"margin-top": -1 * parseInt(f, 10) / 2
})
}
u.fadeIn(300)
}).error(function () {
o.stop()
})
},
_isValidURL: function (e) {
if (e) {
var t = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&amp;:\/~+#-]*[\w@?^=%&amp;\/~+#-])?$/;
return String(e).match(t) != null ? !0 : !1
}
return !1
},
toggle: function () {
this.model.get("visibility") ? this.show() : this.hide()
},
_stopPropagation: function (e) {
e.stopPropagation()
},
setLoading: function () {
return this.model.set({
content: {
fields: [{
title: null,
value: "Loading content...",
index: null,
type: "loading"
}],
data: {}
}
}), this
},
setError: function () {
return this.model.set({
content: {
fields: [{
title: null,
value: "There has been an error...",
index: null,
type: "error"
}],
data: {}
}
}), this
},
setLatLng: function (e) {
return this.model.set("latlng", e), this
},
_closeInfowindow: function (e) {
e && (e.preventDefault(), e.stopPropagation()), this.model.set("visibility", !1)
},
showInfowindow: function () {
this.model.set("visibility", !0)
},
show: function (e) {
var t = this;
this.model.get("visibility") && (t.$el.css({
left: -5e3
}), t._update(e))
},
isHidden: function () {
return !this.model.get("visibility")
},
hide: function (e) {
(e || !this.model.get("visibility")) && this._animateOut()
},
_update: function (e) {
if (!this.isHidden()) {
var t = 0;
if (!e) var t = this.adjustPan();
this._updatePosition(), this._animateIn(t)
}
},
_animateIn: function (e) {
!$.browser.msie || $.browser.msie && parseInt($.browser.version) > 8 ? (this.$el.css({
marginBottom: "-10px",
display: "block",
opacity: 0
}), this.$el.delay(e).animate({
opacity: 1,
marginBottom: 0
}, 300)) : this.$el.show()
},
_animateOut: function () {
if (!$.browser.msie || $.browser.msie && parseInt($.browser.version) > 8) {
var e = this;
this.$el.animate({
marginBottom: "-10px",
opacity: "0",
display: "block"
}, 180, function () {
e.$el.css({
display: "none"
})
})
} else this.$el.hide()
},
_updatePosition: function () {
if (this.isHidden()) return;
var e = this.model.get("offset");
pos = this.mapView.latLonToPixel(this.model.get("latlng")), x = this.$el.position().left, y = this.$el.position().top, containerHeight = this.$el.outerHeight(!0), containerWidth = this.$el.width(), left = pos.x - e[0], size = this.mapView.getSize(), bottom = -1 * (pos.y - e[1] - size.y), this.$el.css({
bottom: bottom,
left: left
})
},
adjustPan: function (e) {
var t = this.model.get("offset");
if (!this.model.get("autoPan") || this.isHidden()) return;
var n = this.$el.position().left,
r = this.$el.position().top,
i = this.$el.outerHeight(!0) + 15,
s = this.$el.width(),
o = this.mapView.latLonToPixel(this.model.get("latlng")),
u = {
x: 0,
y: 0
};
size = this.mapView.getSize(), wait_callback = 0, o.x - t[0] < 0 && (u.x = o.x - t[0] - 10), o.x - t[0] + s > size.x && (u.x = o.x + s - size.x - t[0] + 10), o.y - i < 0 && (u.y = o.y - i - 10), o.y - i > size.y && (u.y = o.y + i - size.y);
if (u.x || u.y) this.mapView.panBy(u), wait_callback = 300;
return wait_callback
}
}), cdb.geo.ui.Header = cdb.core.View.extend({
className: "cartodb-header",
initialize: function () {},
render: function () {
return this.$el.html(this.options.template(this.options)), this
}
}), cdb.geo.ui.Search = cdb.core.View.extend({
className: "cartodb-searchbox",
events: {
"click input[type='text']": "_focus",
"submit form": "_submit",
click: "_stopPropagation",
dblclick: "_stopPropagation",
mousedown: "_stopPropagation"
},
initialize: function () {},
render: function () {
return this.$el.html(this.options.template(this.options)), this
},
_stopPropagation: function (e) {
e.stopPropagation()
},
_focus: function (e) {
e.preventDefault(), $(e.target).focus()
},
_showLoader: function () {
this.$("span.loader").show()
},
_hideLoader: function () {
this.$("span.loader").hide()
},
_submit: function (e) {
e.preventDefault();
var t = this,
n = this.$("input.text").val();
this._showLoader(), cdb.geo.geocoder.NOKIA.geocode(n, function (e) {
if (e.length > 0) {
var n = !0;
if (!e[0].boundingbox || e[0].boundingbox.south == e[0].boundingbox.north || e[0].boundingbox.east == e[0].boundingbox.west) n = !1;
n && e[0].boundingbox ? t.model.setBounds([
[parseFloat(e[0].boundingbox.south), parseFloat(e[0].boundingbox.west)],
[parseFloat(e[0].boundingbox.north), parseFloat(e[0].boundingbox.east)]
]) : e[0].lat && e[0].lon && (t.model.setCenter([e[0].lat, e[0].lon]), t.model.setZoom(10))
}
t._hideLoader()
})
}
}), cdb.geo.ui.LayerSelector = cdb.core.View.extend({
className: "cartodb-layer-selector-box",
events: {
click: "_openDropdown",
dblclick: "killEvent",
mousedown: "killEvent"
},
initialize: function () {
this.map = this.options.mapView.map, this.mapView = this.options.mapView, this.mapView.bind("click zoomstart drag", function () {
this.dropdown && this.dropdown.hide()
}, this), this.add_related_model(this.mapView), this.layers = []
},
render: function () {
return this.$el.html(this.options.template(this.options)), this.dropdown = new cdb.ui.common.Dropdown({
className: "cartodb-dropdown border",
template: this.options.dropdown_template,
target: this.$el.find("a"),
speedIn: 300,
speedOut: 200,
position: "position",
tick: "right",
vertical_position: "down",
horizontal_position: "right",
vertical_offset: 7,
horizontal_offset: 13
}), cdb.god && cdb.god.bind("closeDialogs", this.dropdown.hide, this.dropdown), this.$el.append(this.dropdown.render().el), this._getLayers(), this._setCount(), this
},
_getLayers: function () {
var e = this;
_.each(this.map.layers.models, function (t) {
if (t.get("type") == "layergroup") {
var n = e.mapView.getLayerByCid(t.cid);
for (var r = 0; r < n.getLayerCount(); ++r) {
var i = n.getLayer(r),
s = new cdb.core.Model(i);
s.set("order", r), s.set("type", "layergroup"), s.set("visible", !n.getSubLayer(r).get("hidden")), s.bind("change:visible", function (e) {
this.trigger("change:visible", e.get("visible"), e.get("order"))
}, e), e.options.layer_names ? s.set("layer_name", e.options.layer_names[r]) : s.set("layer_name", i.options.layer_name);
var o = e._createLayer("LayerViewFromLayerGroup", {
model: s,
layerView: n,
layerIndex: r
});
o.bind("switchChanged", e._setCount, e), e.layers.push(o)
}
} else if (t.get("type") == "CartoDB") {
var o = e._createLayer("LayerView", {
model: t
});
o.bind("switchChanged", e._setCount, e), e.layers.push(o)
}
})
},
_createLayer: function (e, t) {
var n = new cdb.geo.ui[e](t);
return this.$("ul").append(n.render().el), this.addView(n), n
},
_setCount: function () {
var e = 0;
for (var t = 0, n = this.layers.length; t < n; ++t) {
var r = this.layers[t];
r.model.get("visible") && e++
}
this.$(".count").text(e), this.trigger("switchChanged", this)
},
_openDropdown: function () {
this.dropdown.open()
}
}), cdb.geo.ui.LayerView = cdb.core.View.extend({
tagName: "li",
defaults: {
template: ' <a class="layer" href="#/change-layer"><%= table_name %></a> <a href="#switch" class="right <%= visible ? "enabled" : "disabled" %> switch"><span class="handle"></span></a> '
},
events: {
click: "_onSwitchClick"
},
initialize: function () {
this.model.has("visible") || this.model.set("visible", !1), this.model.bind("change:visible", this._onSwitchSelected, this), this.add_related_model(this.model), this._onSwitchSelected(), this.template = this.options.template ? cdb.templates.getTemplate(this.options.template) : _.template(this.defaults.template)
},
render: function () {
return this.$el.append(this.template(this.model.attributes)), this
},
_onSwitchSelected: function () {
var e = this.model.get("visible");
this.$el.find(".switch").removeClass(e ? "disabled" : "enabled").addClass(e ? "enabled" : "disabled"), this.trigger("switchChanged")
},
_onSwitchClick: function (e) {
this.killEvent(e), this.model.set("visible", !this.model.get("visible"))
}
}), cdb.geo.ui.LayerViewFromLayerGroup = cdb.geo.ui.LayerView.extend({
defaults: {
template: ' <a class="layer" href="#/change-layer"><%= layer_name %></a> <a href="#switch" class="right <%= visible ? "enabled" : "disabled" %> switch"><span class="handle"></span></a> '
},
_onSwitchSelected: function () {
cdb.geo.ui.LayerView.prototype._onSwitchSelected.call(this);
var e = this.options.layerView.getSubLayer(this.options.layerIndex),
t = this.model.get("visible");
t ? e.show() : e.hide()
}
}), cdb.geo.ui.TilesLoader = cdb.core.View.extend({
className: "cartodb-tiles-loader",
default_options: {
animationSpeed: 500
},
initialize: function () {
_.defaults(this.options, this.default_options), this.isVisible = !1, this.template = this.options.template ? this.options.template : cdb.templates.getTemplate("geo/tiles_loader")
},
render: function () {
return this.$el.html($(this.template(this.options))), this
},
show: function (e) {
this.isVisible = !0, !$.browser.msie || $.browser.msie && $.browser.version.indexOf("9.") != 0 ? this.$el.fadeTo(this.options.animationSpeed, 1) : this.$el.show()
},
hide: function (e) {
this.isVisible = !1, !$.browser.msie || $.browser.msie && $.browser.version.indexOf("9.") == 0 ? this.$el.stop(!0).fadeTo(this.options.animationSpeed, 0) : this.$el.hide()
}
}), cdb.geo.ui.InfoBox = cdb.core.View.extend({
className: "cartodb-infobox",
defaults: {
pos_margin: 20,
position: "bottom|right",
width: 200
},
initialize: function () {
var e = this;
_.defaults(this.options, this.defaults), this.options.layer && this.enable(), this.template = cdb.core.Template.compile(this.options.template || this.defaultTemplate, "mustache")
},
enable: function () {
this.options.layer && this.options.layer.on("featureOver", function (e, t, n, r) {
this.render(r).show()
}, this).on("featureOut", function () {
this.hide()
}, this)
},
disable: function () {
this.options.layer && this.options.layer.off(null, null, this)
},
setPosition: function (e) {
var t = {};
e.indexOf("top") !== -1 ? t.top = this.options.pos_margin : e.indexOf("bottom") !== -1 && (t.bottom = this.options.pos_margin), e.indexOf("left") !== -1 ? t.left = this.options.pos_margin : e.indexOf("right") !== -1 && (t.right = this.options.pos_margin), this.$el.css(t)
},
render: function (e) {
return this.$el.html(this.template(e)), this.options.width && this.$el.css("width", this.options.width), this.options.position && this.setPosition(this.options.position), this
}
}), cdb.geo.ui.Tooltip = cdb.geo.ui.InfoBox.extend({
DEFAULT_OFFSET_TOP: 30,
defaultTemplate: "<p>{{text}}</p>",
className: "cartodb-tooltip",
initialize: function () {
this.options.template = this.options.template || defaultTemplate, this.options.position = "none", this.options.width = null, cdb.geo.ui.InfoBox.prototype.initialize.call(this)
},
enable: function () {
this.options.layer && this.options.layer.on("featureOver", function (e, t, n, r) {
this.show(n, r)
}, this).on("featureOut", function () {
this.hide()
}, this)
},
show: function (e, t) {
this.render(t), this.elder("show"), this.$el.css({
left: e.x - this.$el.width() / 2,
top: e.y - (this.options.offset_top || this.DEFAULT_OFFSET_TOP)
})
},
render: function (e) {
return this.$el.html(this.template(e)), this
}
}), LayerDefinition.layerDefFromSubLayers = function (e) {
if (!e || e.length === undefined) throw new Error("sublayers should be an array");
var t = {
version: "1.0.0",
stat_tag: "API",
layers: []
};
for (var n in e) t.layers.push({
type: "cartodb",
options: e[n]
});
return t
}, LayerDefinition.prototype = {
isCORSSupported: function () {
return "withCredentials" in new XMLHttpRequest
},
isBtoaSupported: function () {
return typeof window["btoa"] == "function"
},
getLayerCount: function () {
return this.layers.length
},
setLayerDefinition: function (e, t) {
t = t || {}, this.version = e.version || "1.0.0", this.stat_tag = e.stat_tag, this.layers = _.clone(e.layers), t.silent || this._definitionUpdated()
},
toJSON: function () {
var e = {};
e.version = this.version, this.stat_tag && (e.stat_tag = this.stat_tag), e.layers = [];
for (var t in this.layers) {
var n = this.layers[t];
n.options.hidden || e.layers.push({
type: "cartodb",
options: {
sql: n.options.sql,
cartocss: n.options.cartocss,
cartocss_version: n.options.cartocss_version || "2.1.0",
interactivity: this._cleanInteractivity(n.options.interactivity)
}
})
}
return e
},
_encodeBase64Native: function (e) {
return btoa(e)
},
getLayerNumberByIndex: function (e) {
var t = [];
for (var n in this.layers) {
var r = this.layers[n];
r.options.hidden || t.push(n)
}
return e >= t.length ? -1 : +t[e]
},
_encodeBase64: function (e) {
var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
n, r, i, s, o, u, a, f, l = 0,
c = 0,
h = "",
p = [];
if (!e) return e;
do n = e.charCodeAt(l++), r = e.charCodeAt(l++), i = e.charCodeAt(l++), f = n << 16 | r << 8 | i, s = f >> 18 & 63, o = f >> 12 & 63, u = f >> 6 & 63, a = f & 63, p[c++] = t.charAt(s) + t.charAt(o) + t.charAt(u) + t.charAt(a);
while (l < e.length);
h = p.join("");
var d = e.length % 3;
return (d ? h.slice(0, d - 3) : h) + "===".slice(d || 3)
},
_array2hex: function (e) {
var t = [];
for (var n = 0; n < e.length; ++n) t.push(String.fromCharCode(e[n] + 128));
return this.options.btoa(t.join(""))
},
getLayerToken: function (e) {
var t = this;
clearTimeout(this._timeout), this._layerTokenQueue.push(e), this._timeout = setTimeout(function () {
t._getLayerToken(function (e, n) {
var r;
while (r = t._layerTokenQueue.pop()) r(e, n)
})
}, 4)
},
_requestFinished: function () {
var e = this;
this._waiting = !1, this.lastTimeUpdated = (new Date).getTime(), clearTimeout(this._refreshTimer), this._refreshTimer = setTimeout(function () {
e.invalidate()
}, this.options.refreshTime || 72e5), this._queue.length && this._getLayerToken(this._queue.pop())
},
_requestPOST: function (e, t) {
var n = this,
r = this.options.ajax;
r({
crossOrigin: !0,
type: "POST",
method: "POST",
dataType: "json",
contentType: "application/json",
url: this._tilerHost() + "/tiles/layergroup" + (e.length ? "?" + e.join("&") : ""),
data: JSON.stringify(this.toJSON()),
success: function (e) {
0 === n._queue.length && t(e), n._requestFinished()
},
error: function (e) {
var r = {
errors: ["unknow error"]
};
try {
r = JSON.parse(e.responseText)
} catch (i) {}
0 === n._queue.length && t(null, r), n._requestFinished()
}
})
},
_getCompressor: function (e) {
var t = this;
return this.options.compressor ? this.options.compressor : (e = e || JSON.stringify(this.toJSON()), !this.options.force_compress && e.length < this.options.MAX_GET_SIZE ?
function (e, t, n) {
n("config=" + encodeURIComponent(e))
} : function (e, n, r) {
e = JSON.stringify({
config: e
}), LZMA.compress(e, n, function (e) {
r("lzma=" + encodeURIComponent(t._array2hex(e)))
})
})
},
_requestGET: function (e, t) {
var n = this,
r = this.options.ajax,
i = JSON.stringify(this.toJSON()),
s = this._getCompressor(i);
s(i, 3, function (i) {
e.push(i), r({
dataType: "jsonp",
url: n._tilerHost() + "/tiles/layergroup?" + e.join("&"),
success: function (e) {
0 === n._queue.length && t(e), n._requestFinished()
},
error: function (e) {
var r = {
errors: ["unknow error"]
};
try {
r = JSON.parse(xhr.responseText)
} catch (i) {}
0 === n._queue.length && t(null, r), n._requestFinished()
}
})
})
},
_getLayerToken: function (e) {
var t = this,
n = [];
e = e ||
function () {};
if (this._waiting) return this._queue.push(e), this;
var r = this.options.extra_params || {},
i = this.options.map_key || this.options.api_key || r.map_key || r.api_key;
i && n.push("map_key=" + i), this._waiting = !0;
var s = null;
return this._usePOST() ? s = this._requestPOST : s = this._requestGET, s.call(this, n, e), this
},
_usePOST: function () {
if (this.options.cors) {
if (this.options.force_cors) return !0;
var e = JSON.stringify(this.toJSON());
if (e < this.options.MAX_GET_SIZE) return !1
}
return !1
},
removeLayer: function (e) {
return e < this.getLayerCount() && e >= 0 && (this.layers.splice(e, 1), this.interactionEnabled.splice(e, 1), this._reorderSubLayers(), this.invalidate()), this
},
_reorderSubLayers: function () {
for (var e = 0; e < this.layers.length; ++e) {
var t = this.layers[e];
t.sub && t.sub._setPosition(e)
}
},
getLayer: function (e) {
return _.clone(this.layers[e])
},
invalidate: function () {
this.layerToken = null, this.urls = null, this.onLayerDefinitionUpdated()
},
setLayer: function (e, t) {
return e < this.getLayerCount() && e >= 0 && (this.layers[e] = _.clone(t)), this.invalidate(), this
},
addLayer: function (e, t) {
t = t === undefined ? this.getLayerCount() : t;
if (t <= this.getLayerCount() && t >= 0) {
if (!e.sql || !e.cartocss) throw new Error("layer definition should contain at least a sql and a cartocss");
this.layers.splice(t, 0, {
type: "cartodb",
options: e
}), this._definitionUpdated()
}
return this
},
getTiles: function (e) {
var t = this;
return t.layerToken ? (e && e(t._layerGroupTiles(t.layerToken, t.options.extra_params)), this) : (this.getLayerToken(function (n, r) {
n ? (t.layerToken = n.layergroupid, t.urls = t._layerGroupTiles(n.layergroupid, t.options.extra_params), e && e(t.urls)) : e && e(null, r)
}), this)
},
isHttps: function () {
return this.options.tiler_protocol === "https"
},
_layerGroupTiles: function (e, t) {
var n = this.options.subdomains || ["0", "1", "2", "3"];
this.isHttps() && (n = [null]);
var r = "/{z}/{x}/{y}",
i = [],
s = [],
o = this._encodeParams(t, this.options.pngParams);
for (var u = 0; u < n.length; ++u) {
var a = n[u],
f = this._host(a) + "/tiles/layergroup/" + e;
s.push(f + r + ".png?" + o);
var l = this._encodeParams(t, this.options.gridParams);
for (var c in this.layers) i[c] = i[c] || [], i[c].push(f + "/" + c + r + ".grid.json?" + l)
}
return {
tiles: s,
grids: i
}
},
_cleanInteractivity: function (e) {
if (!e) return;
typeof e == "string" && (e = e.split(","));
for (var t = 0; t < e.length; ++t) e[t] = e[t].replace(/ /g, "");
return e
},
setInteractivity: function (e, t) {
t === undefined && (t = e, e = 0);
if (e >= this.getLayerCount() && e < 0) throw new Error("layer does not exist");
typeof t == "string" && (t = t.split(","));
for (var n = 0; n < t.length; ++n) t[n] = t[n].replace(/ /g, "");
return this.layers[e].options.interactivity = t, this._definitionUpdated(), this
},
onLayerDefinitionUpdated: function () {},
setSilent: function (e) {
this.silent = e
},
_definitionUpdated: function () {
if (this.silent) return;
this.invalidate()
},
_tileJSONfromTiles: function (e, t) {
return {
tilejson: "2.0.0",
scheme: "xyz",
grids: t.grids[e],
tiles: t.tiles,
formatter: function (e, t) {
return t
}
}
},
getTileJSON: function (e, t) {
e = e == undefined ? 0 : e, this.getTiles(function (n) {
if (!n) {
t(null);
return
}
t && t(this._tileJSONfromTiles(e, n))
})
},
setQuery: function (e, t) {
t === undefined && (t = e, e = 0), this.layers[e].options.sql = t, this._definitionUpdated()
},
getQuery: function (e) {
return e = e || 0, this.layers[e].options.sql
},
setCartoCSS: function (e, t, n) {
n === undefined && (n = t, t = e, e = 0), n = n || cartodb.CARTOCSS_DEFAULT_VERSION, this.layers[e].options.cartocss = t, this.layers[e].options.cartocss_version = n, this._definitionUpdated()
},
_encodeParams: function (e, t) {
if (!e) return "";
var n = [];
t = t || _.keys(e);
for (var r in t) {
var i = t[r],
s = e[i];
if (s) {
var o = encodeURIComponent(s);
o = o.replace(/%7Bx%7D/g, "{x}").replace(/%7By%7D/g, "{y}").replace(/%7Bz%7D/g, "{z}"), n.push(i + "=" + o)
}
}
return n.join("&")
},
_tilerHost: function () {
var e = this.options;
return e.tiler_protocol + "://" + (e.user_name ? e.user_name + "." : "") + e.tiler_domain + (e.tiler_port != "" ? ":" + e.tiler_port : "")
},
_host: function (e) {
var t = this.options;
if (t.no_cdn) return this._tilerHost();
var n = t.tiler_protocol + "://";
e && (n += e + ".");
var r = t.cdn_url || cdb.CDB_HOST;
if (!r.http && !r.https) throw new Error("cdn_host should contain http and/or https entries");
return n += r[t.tiler_protocol] + "/" + t.user_name, n
},
getInfowindowData: function (e) {
var t = this.layers[e].infowindow || this.options.layer_definition.layers[e].infowindow;
return t && t.fields && t.fields.length > 0 ? t : null
},
containInfowindow: function () {
var e = this.options.layer_definition.layers;
for (var t = 0; t < e.length; ++t) {
var n = e[t].infowindow;
if (n && n.fields && n.fields.length > 0) return !0
}
return !1
},
createSubLayer: function (e, t) {
return this.addLayer(e), this.getSubLayer(this.getLayerCount() - 1)
},
getSubLayer: function (e) {
var t = this.layers[e];
return t.sub = t.sub || new SubLayer(this, e), t.sub
},
getSubLayerCount: function () {
return this.getLayerCount()
}
}, SubLayer.prototype = {
remove: function () {
this._check(), this._parent.removeLayer(this._position), this._unbindInteraction(), this._added = !1
},
show: function () {
this.set({
hidden: !1
})
},
hide: function () {
this.set({
hidden: !0
})
},
setSQL: function (e) {
return this.set({
sql: e
})
},
setCartoCSS: function (e) {
return this.set({
cartocss: e
})
},
setInteractivity: function (e) {
return this.set({
interactivity: e
})
},
getSQL: function () {
return this.get("sql")
},
getCartoCSS: function () {
return this.get("cartocss")
},
setInteraction: function (e) {
this._parent.setInteraction(this._position, e)
},
get: function (e) {
this._check();
var t = this._parent.getLayer(this._position);
return t.options[e]
},
set: function (e) {
this._check();
var t = this._parent.getLayer(this._position),
n = t.options;
for (var r in e) n[r] = e[r];
return this._parent.setLayer(this._position, t), this
},
unset: function (e) {
var t = this._parent.getLayer(this._position);
delete t.options[e], this._parent.setLayer(this._position, t)
},
_check: function () {
if (!this._added) throw "sublayer was removed"
},
_unbindInteraction: function () {
if (!this._parent.off) return;
this._parent.off(null, null, this)
},
_bindInteraction: function () {
if (!this._parent.on) return;
var e = this,
t = function (t) {
e._parent.on(t, function () {
var n = Array.prototype.slice.call(arguments);
parseInt(n[n.length - 1], 10) == e._position && e.trigger.apply(e, [t].concat(n))
}, e)
};
t("featureOver"), t("featureOut"), t("featureClick")
},
_setPosition: function (e) {
this._position = e
}
}, _.extend(SubLayer.prototype, Backbone.Events), CartoDBLayerCommon.prototype = {
show: function () {
this.setOpacity(this.options.previous_opacity === undefined ? .99 : this.options.previous_opacity), delete this.options.previous_opacity, this.setInteraction(!0)
},
hide: function () {
this.options.previous_opacity == undefined && (this.options.previous_opacity = this.options.opacity), this.setOpacity(0), this.setInteraction(!1)
},
_isWadusAdded: function (e, t) {
var n = [],
r = new RegExp("\\b" + t + "\\b"),
i = e.getElementsByTagName("*");
for (var s = 0, o = i.length; s < o; s++) r.test(i[s].className) && n.push(i[s]);
return n.length > 0
},
_isRetinaBrowser: function () {
return "devicePixelRatio" in window && window.devicePixelRatio > 1 || "matchMedia" in window && window.matchMedia("(min-resolution:144dpi)") && window.matchMedia("(min-resolution:144dpi)").matches
},
_addWadus: function (e, t, n) {
var r = this;
setTimeout(function () {
if (r.options.cartodb_logo !== !1 && !r._isWadusAdded(n, "cartodb-logo")) {
var t = document.createElement("div"),
i = r._isRetinaBrowser();
t.setAttribute("class", "cartodb-logo"), t.setAttribute("style", "position:absolute; bottom:0; left:0; display:block; border:none; z-index:1000000;");
var s = location.protocol.indexOf("https") === -1 ? "http" : "https";
t.innerHTML = "<a href='http://www.cartodb.com' target='_blank'><img width='71' height='29' src='" + s + "://cartodb.s3.amazonaws.com/static/new_logo" + (i ? "@2x" : "") + ".png' style='position:absolute; bottom:" + (e.bottom || 0) + "px; left:" + (e.left || 0) + "px; display:block; width:71px!important; height:29px!important; border:none; outline:none;' alt='CartoDB' title='CartoDB' />", n.appendChild(t)
}
}, t || 0)
},
isVisible: function () {
return this.visible
},
setInteraction: function (e, t) {
t == undefined && (t = e, e = 0);
var n;
this.interactionEnabled[e] = t;
if (!t) n = this.interaction[e], n && (n.remove(), this.interaction[e] = null);
else if (this.urls) {
var r = this._tileJSONfromTiles(e, this.urls);
n = this.interaction[e], n && n.remove();
var i = this;
this.interaction[e] = this.interactionClass().map(this.options.map).tilejson(r).on("on", function (t) {
t.layer = e || 0, t.layer = i.getLayerNumberByIndex(t.layer), i._manageOnEvents(i.options.map, t)
}).on("off", function (t) {
t = t || {}, t.layer = e || 0, t.layer = i.getLayerNumberByIndex(t.layer), i._manageOffEvents(i.options.map, t)
})
}
return this
},
setOptions: function (e) {
if (typeof e != "object" || e.length) throw new Error(e + " options must be an object");
_.extend(this.options, e);
var e = this.options;
this.options.query = this.options.query || "select * from " + this.options.table_name, this.options.query_wrapper && (this.options.query = _.template(this.options.query_wrapper)({
sql: this.options.query
})), this.setSilent(!0), e.interaction && this.setInteraction(e.interaction), e.opacity && this.setOpacity(e.opacity), e.query && this.setQuery(e.query.replace(/\{\{table_name\}\}/g, this.options.table_name)), e.tile_style && this.setCartoCSS(e.tile_style.replace(new RegExp(e.table_name, "g"), "layer0")), e.cartocss && this.setCartoCSS(e.cartocss), e.interactivity && this.setInteractivity(e.interactivity), e.visible ? this.show() : this.hide(), this.setSilent(!1), this._definitionUpdated()
},
_getLayerDefinition: function () {
var e = {},
t = this.options,
n, r, i;
n = t.query || "select * from " + t.table_name, t.query_wrapper && (n = _.template(t.query_wrapper)({
sql: n
})), r = t.tile_style, i = t.cartocss_version || "2.1.0";
for (var s in t.extra_params) {
var o = t.extra_params[s];
e[s] = o.replace ? o.replace(/\{\{table_name\}\}/g, t.table_name) : o
}
return n = n.replace(/\{\{table_name\}\}/g, t.table_name), r = r.replace(/\{\{table_name\}\}/g, t.table_name), r = r.replace(new RegExp(t.table_name, "g"), "layer0"), {
sql: n,
cartocss: r,
cartocss_version: i,
params: e,
interactivity: t.interactivity
}
},
error: function (e) {},
tilesOk: function () {},
_clearInteraction: function () {
for (var e in this.interactionEnabled) this.interactionEnabled[e] && this.setInteraction(e, !1)
},
_reloadInteraction: function () {
for (var e in this.interactionEnabled) this.interactionEnabled[e] && (this.setInteraction(e, !1), this.setInteraction(e, !0))
},
_checkTiles: function () {
var e = {
z: 4,
x: 6,
y: 6
},
t = this,
n = new Image,
r = this._tileJSON();
getTiles(function (n) {
var r = n.tiles[0].replace(/\{z\}/g, e.z).replace(/\{x\}/g, e.x).replace(/\{y\}/g, e.y);
this.options.ajax({
method: "get",
url: r,
crossDomain: !0,
success: function () {
t.tilesOk(), clearTimeout(i)
},
error: function (e, n, r) {
clearTimeout(i), t.error(e.responseText && JSON.parse(e.responseText))
}
})
});
var i = setTimeout(function () {
clearTimeout(i), t.error("tile timeout")
}, 3e4)
}
}, function () {
function e(e) {
var t = this,
n = ["click", "dblclick", "mousedown", "mouseover", "mouseout", "dragstart", "drag", "dragend"];
this._eventHandlers = {}, this.model = e, this.points = [], this.geom = L.GeoJSON.geometryToLayer(e.get("geojson"), function (e, r) {
var i = L.marker(r, {
icon: L.icon({
iconUrl: "/assets/icons/default_marker.png",
iconAnchor: [11, 11]
})
}),
s;
for (s = 0; s < n.length; ++s) {
var o = n[s];
i.on(o, t._eventHandler(o))
}
return i
}), this.bind("dragend", function (t, n) {
e.set({
geojson: {
type: "Point",
coordinates: [n[1], n[0]]
}
})
})
}
function t(e) {
var t = this,
n = ["click", "dblclick", "mousedown", "mouseover", "mouseout"];
this._eventHandlers = {}, this.model = e, this.points = [], this.geom = L.GeoJSON.geometryToLayer(e.get("geojson")), _.each(this.geom._layers, function (n) {
n.setStyle(e.get("style")), n.on("edit", function () {
e.set("geojson", L.GeoJSON.toGeoJSON(t.geom))
}, t)
})
}
L.Util.extend(L.GeoJSON, {
toGeoJSON: function (e) {
if (e instanceof L.Marker) return {
coordinates: this.latLngToCoords(e.getLatLng()),
type: "Point"
};
if (e instanceof L.MultiPolygon || e instanceof L.MultiPolyline) {
var t = [],
n = e._layers;
for (var r in n) t.push(this.toGeoJSON(n[r]).coordinates);
return {
coordinates: t,
type: e instanceof L.MultiPolygon ? "MultiPolygon" : "MultiLineString"
}
}
if (e instanceof L.Polygon) {
var i = this.latLngsToCoords(e.getLatLngs());
return {
coordinates: [i],
type: "Polygon"
}
}
if (e instanceof L.Polyline) {
var i = this.latLngsToCoords(e.getLatLngs());
return {
coordinates: i,
type: "LineString"
}
}
if (e instanceof L.FeatureGroup) {
var t = [],
n = e._layers,
s = !0;
for (var r in n) {
var o = this.toGeoJSON(n[r]);
t.push(o), o.type !== "Point" && (s = !1)
}
if (s) {
var i = t.map(function (e) {
return e.coordinates
});
return {
coordinates: i,
type: "MultiPoint"
}
}
return {
geometries: t,
type: "GeometryCollection"
}
}
},
latLngToCoords: function (e) {
return [e.lng, e.lat]
},
latLngsToCoords: function (e) {
var t = [];
return e.forEach(function (e) {
t.push(this.latLngToCoords(e))
}, this), t
}
}), e.prototype = new GeometryView, e.prototype.edit = function () {
this.geom.dragging.enable()
}, e.prototype._eventHandler = function (e) {
var t = this,
n = this._eventHandlers[e];
return n || (n = function (n) {
var r = n.target.getLatLng(),
i = [r.lat, r.lng];
t.trigger(e, n.originalEvent, i)
}, this._eventHandlers[e] = n), n
}, t.prototype = new GeometryView, t.prototype.edit = function (e) {
var t = e ? "enable" : "disable";
_.each(this.geom._layers, function (e) {
e.editing[t](), e.off("edit", null, self)
})
}, cdb.geo.leaflet = cdb.geo.leaflet || {}, cdb.geo.leaflet.PointView = e, cdb.geo.leaflet.PathView = t
}(), function () {
var e = function (e, t, n) {
this.leafletLayer = t, this.leafletMap = n, this.model = e, this.model.bind("change", this._modelUpdated, this), this.type = e.get("type") || e.get("kind"), this.type = this.type.toLowerCase()
};
_.extend(e.prototype, Backbone.Events), _.extend(e.prototype, {
remove: function () {
this.leafletMap.removeLayer(this.leafletLayer), this.model.unbind(null, null, this), this.unbind()
},
reload: function () {
this.leafletLayer.redraw()
}
}), cdb.geo.LeafLetLayerView = e
}(), function () {
if (typeof L == "undefined") return;
var e = L.Class.extend({
includes: L.Mixin.Events,
initialize: function (e, t) {
cdb.geo.LeafLetLayerView.call(this, e, this, t)
},
onAdd: function () {
this.redraw()
},
onRemove: function () {
var e = this.leafletMap.getContainer();
e.style.background = "none"
},
_modelUpdated: function () {
this.redraw()
},
redraw: function () {
var e = this.leafletMap.getContainer();
e.style.backgroundColor = this.model.get("color") || "#FFF";
if (this.model.get("image")) {
var t = "url(" + this.model.get("image") + ") repeat center center";
this.model.get("color") && (e.style.background = t + " " + this.model.get("color"))
}
}
});
_.extend(e.prototype, cdb.geo.LeafLetLayerView.prototype), cdb.geo.LeafLetPlainLayerView = e
}(), function () {
if (typeof L == "undefined") return;
var e = L.TileLayer.extend({
initialize: function (e, t) {
L.TileLayer.prototype.initialize.call(this, e.get("urlTemplate"), {
tms: e.get("tms"),
attribution: e.get("attribution"),
minZoom: e.get("minZomm"),
maxZoom: e.get("maxZoom"),
subdomains: e.get("subdomains") || "abc",
errorTileUrl: e.get("errorTileUrl"),
opacity: e.get("opacity")
}), cdb.geo.LeafLetLayerView.call(this, e, this, t)
}
});
_.extend(e.prototype, cdb.geo.LeafLetLayerView.prototype, {
_modelUpdated: function () {
_.defaults(this.leafletLayer.options, _.clone(this.model.attributes)), this.leafletLayer.setUrl(this.model.get("urlTemplate"))
}
}), cdb.geo.LeafLetTiledLayerView = e
}(), function () {
if (typeof L == "undefined") return;
L.CartoDBGroupLayer = L.TileLayer.extend({
interactionClass: wax.leaf.interaction,
includes: [cdb.geo.LeafLetLayerView.prototype, LayerDefinition.prototype, CartoDBLayerCommon.prototype],
options: {
opacity: .99,
attribution: "CartoDB",
debug: !1,
visible: !0,
added: !1,
tiler_domain: "cartodb.com",
tiler_port: "80",
tiler_protocol: "http",
sql_api_domain: "cartodb.com",
sql_api_port: "80",
sql_api_protocol: "http",
extra_params: {
cache_policy: "persist"
},
cdn_url: null,
subdomains: null
},
initialize: function (e) {
e = e || {}, L.Util.setOptions(this, e);
if (!e.layer_definition && !e.sublayers) throw new Error("cartodb-leaflet needs at least the layer_definition or sublayer list");
e.layer_definition || (this.options.layer_definition = LayerDefinition.layerDefFromSubLayers(e.sublayers)), LayerDefinition.call(this, this.options.layer_definition, this.options), this.fire = this.trigger, CartoDBLayerCommon.call(this), L.TileLayer.prototype.initialize.call(this), this.interaction = []
},
getTileUrl: function (e) {
var t = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
this._adjustTilePoint(e);
var n = [t];
this.tilejson && (n = this.tilejson.tiles);
var r = (e.x + e.y) % n.length;
return L.Util.template(n[r], L.Util.extend({
z: this._getZoomForUrl(),
x: e.x,
y: e.y
}, this.options))
},
setOpacity: function (e) {
if (isNaN(e) || e > 1 || e < 0) throw new Error(e + " is not a valid value");
this.options.opacity = Math.min(e, .99), this.options.visible && (L.TileLayer.prototype.setOpacity.call(this, this.options.opacity), this.fire("updated"))
},
onAdd: function (e) {
var t = this;
this.options.map = e, this._addWadus({
left: 8,
bottom: 8
}, 0, e._container), this.__update(function () {
var n = function () {
e.off("zoomend", n);
var r = L.stamp(t);
if (!e._layers[r]) return;
L.TileLayer.prototype.onAdd.call(t, e), t.fire("added"), t.options.added = !0
};
e._animatingZoom ? e.on("zoomend", n) : n()
})
},
onRemove: function (e) {
this.options.added && (this.options.added = !1, L.TileLayer.prototype.onRemove.call(this, e))
},
onLayerDefinitionUpdated: function () {
this.__update()
},
__update: function (e) {
var t = this;
this.fire("updated"), this.fire("loading");
var n = this.options.map;
this.getTiles(function (r, i) {
var s = function () {
n.off("zoomend", s), r ? (t.tilejson = r, t.setUrl(t.tilejson.tiles[0]), t._reloadInteraction(), t.ok && t.ok(), e && e()) : (t.error && t.error(i), e && e())
};
n._animatingZoom ? n.on("zoomend", s) : s()
})
},
_checkLayer: function () {
if (!this.options.added) throw new Error("the layer is not still added to the map")
},
setAttribution: function (e) {
this._checkLayer(), this.map.attributionControl.removeAttribution(this.options.attribution), this.options.attribution = e, this.map.attributionControl.addAttribution(this.options.attribution), this.options.attribution = this.options.attribution, this.tilejson.attribution = this.options.attribution, this.fire("updated")
},
_manageOnEvents: function (e, t) {
var n = this._findPos(e, t),
r = e.layerPointToLatLng(n),
i = t.e.type.toLowerCase(),
s = e.layerPointToContainerPoint(n);
switch (i) {
case "mousemove":
if (this.options.featureOver) return this.options.featureOver(t.e, r, s, t.data, t.layer);
break;
case "click":
case "touchend":
case "mspointerup":
this.options.featureClick && this.options.featureClick(t.e, r, s, t.data, t.layer);
break;
default:
}
},
_manageOffEvents: function (e, t) {
if (this.options.featureOut) return this.options.featureOut && this.options.featureOut(t.e, t.layer)
},
_findPos: function (e, t) {
var n = 0,
r = 0,
i = e.getContainer();
if (i.offsetParent) {
do n += i.offsetLeft, r += i.offsetTop;
while (i = i.offsetParent);
return e.containerPointToLayerPoint(new L.Point((t.e.clientX || t.e.changedTouches[0].clientX) - n, (t.e.clientY || t.e.changedTouches[0].clientY) - r))
}
return e.mouseEventToLayerPoint(t.e)
}
}), cdb.geo.LeafLetCartoDBLayerGroupView = L.CartoDBGroupLayer.extend({
includes: [cdb.geo.LeafLetLayerView.prototype, Backbone.Events],
initialize: function (e, t) {
var n = this;
e.attributes.attribution = "CartoDB <a href='http://cartodb.com/attributions' target='_blank'>attribution</a>";
var r = _.clone(e.attributes);
r.map = t;
var i = r.featureOver,
s = r.featureOut,
o = r.featureClick;
r.featureOver = function () {
i && i.apply(n, arguments), n.featureOver && n.featureOver.apply(n, arguments)
}, r.featureOut = function () {
s && s.apply(n, arguments), n.featureOut && n.featureOut.apply(n, arguments)
}, r.featureClick = function () {
o && o.apply(n, arguments), n.featureClick && n.featureClick.apply(n, arguments)
}, L.CartoDBGroupLayer.prototype.initialize.call(this, r), cdb.geo.LeafLetLayerView.call(this, e, this, t)
},
featureOver: function (e, t, n, r, i) {
this.trigger("featureOver", e, [t.lat, t.lng], n, r, i)
},
featureOut: function (e, t) {
this.trigger("featureOut", e, t)
},
featureClick: function (e, t, n, r, i) {
this.trigger("featureClick", e, [t.lat, t.lng], n, r, i)
},
error: function (e) {
this.trigger("error", e ? e.errors : "unknown error"), this.model.trigger("error", e ? e.errors : "unknown error")
},
ok: function (e) {
this.model.trigger("tileOk")
}
})
}(), function () {
if (typeof L == "undefined") return;
L.CartoDBLayer = L.CartoDBGroupLayer.extend({
options: {
query: "SELECT * FROM {{table_name}}",
opacity: .99,
attribution: "CartoDB",
debug: !1,
visible: !0,
added: !1,
extra_params: {},
layer_definition_version: "1.0.0"
},
initialize: function (e) {
L.Util.setOptions(this, e);
if (!e.table_name || !e.user_name || !e.tile_style) throw "cartodb-leaflet needs at least a CartoDB table name, user_name and tile_style";
L.CartoDBGroupLayer.prototype.initialize.call(this, {
layer_definition: {
version: this.options.layer_definition_version,
layers: [{
type: "cartodb",
options: this._getLayerDefinition(),
infowindow: this.options.infowindow
}]
}
}), this.setOptions(this.options)
},
setQuery: function (e, t) {
t === undefined && (t = e, e = 0), t = t || "select * from " + this.options.table_name, LayerDefinition.prototype.setQuery.call(this, e, t)
},
isVisible: function () {
return this.visible
},
isAdded: function () {
return this.options.added
}
});
var e = L.CartoDBLayer.extend({
initialize: function (e, t) {
var n = this;
_.bindAll(this, "featureOut", "featureOver", "featureClick"), e.attributes.attribution = "CartoDB <a href='http://cartodb.com/attributions' target='_blank'>attribution</a>";
var r = _.clone(e.attributes);
r.map = t;
var i = r.featureOver,
s = r.featureOut,
o = r.featureClick;
r.featureOver = function () {
i && i.apply(this, arguments), n.featureOver && n.featureOver.apply(this, arguments)
}, r.featureOut = function () {
s && s.apply(this, arguments), n.featureOut && n.featureOut.apply(this, arguments)
}, r.featureClick = function () {
o && o.apply(this, arguments), n.featureClick && n.featureClick.apply(r, arguments)
}, e.bind("change:visible", function () {
n.model.get("visible") ? n.show() : n.hide()
}, this), L.CartoDBLayer.prototype.initialize.call(this, r), cdb.geo.LeafLetLayerView.call(this, e, this, t)
},
_modelUpdated: function () {
var e = _.clone(this.model.attributes);
this.leafletLayer.setOptions(e)
},
featureOver: function (e, t, n, r) {
this.trigger("featureOver", e, [t.lat, t.lng], n, r, 0)
},
featureOut: function (e) {
this.trigger("featureOut", e, 0)
},
featureClick: function (e, t, n, r) {
this.trigger("featureClick", e, [t.lat, t.lng], n, r, 0)
},
reload: function () {
this.model.invalidate()
},
error: function (e) {
this.trigger("error", e ? e.error : "unknown error"), this.model.trigger("tileError", e ? e.error : "unknown error")
},
tilesOk: function (e) {
this.model.trigger("tileOk")
},
includes: [cdb.geo.LeafLetLayerView.prototype, Backbone.Events]
});
cdb.geo.LeafLetLayerCartoDBView = e
}(), function () {
if (typeof L == "undefined") return;
cdb.geo.LeafletMapView = cdb.geo.MapView.extend({
initialize: function () {
_.bindAll(this, "_addLayer", "_removeLayer", "_setZoom", "_setCenter", "_setView"), cdb.geo.MapView.prototype.initialize.call(this);
var e = this,
t = this.map.get("center"),
n = {
zoomControl: !1,
center: new L.LatLng(t[0], t[1]),
zoom: this.map.get("zoom"),
minZoom: this.map.get("minZoom"),
maxZoom: this.map.get("maxZoom")
};
this.map.get("bounding_box_ne");
if (!this.options.map_object) this.map_leaflet = new L.Map(this.el, n), this.map_leaflet.attributionControl.setPrefix(""), this.map.get("scrollwheel") == 0 && this.map_leaflet.scrollWheelZoom.disable();
else {
this.map_leaflet = this.options.map_object, this.setElement(this.map_leaflet.getContainer());
var r = e.map_leaflet.getCenter();
e._setModelProperty({
center: [r.lat, r.lng]
}), e._setModelProperty({
zoom: e.map_leaflet.getZoom()
}), e.map.unset("view_bounds_sw", {
silent: !0
}), e.map.unset("view_bounds_ne", {
silent: !0
})
}
this.map.bind("set_view", this._setView, this), this.map.layers.bind("add", this._addLayer, this), this.map.layers.bind("remove", this._removeLayer, this), this.map.layers.bind("reset", this._addLayers, this), this.map.geometries.bind("add", this._addGeometry, this), this.map.geometries.bind("remove", this._removeGeometry, this), this._bindModel(), this._addLayers(), this.map_leaflet.on("layeradd", function (t) {
this.trigger("layeradd", t, e)
}, this), this.map_leaflet.on("zoomstart", function () {
e.trigger("zoomstart")
}), this.map_leaflet.on("click", function (t) {
e.trigger("click", t.originalEvent, [t.latlng.lat, t.latlng.lng])
}), this.map_leaflet.on("dblclick", function (t) {
e.trigger("dblclick", t.originalEvent)
}), this.map_leaflet.on("zoomend", function () {
e._setModelProperty({
zoom: e.map_leaflet.getZoom()
}), e.trigger("zoomend")
}, this), this.map_leaflet.on("move", function () {
var t = e.map_leaflet.getCenter();
e._setModelProperty({
center: [t.lat, t.lng]
})
}), this.map_leaflet.on("drag", function () {
var t = e.map_leaflet.getCenter();
e._setModelProperty({
center: [t.lat, t.lng]
}), e.trigger("drag")
}, this), this.map.bind("change:maxZoom", function () {
L.Util.setOptions(e.map_leaflet, {
maxZoom: e.map.get("maxZoom")
})
}, this), this.map.bind("change:minZoom", function () {
L.Util.setOptions(e.map_leaflet, {
minZoom: e.map.get("minZoom")
})
}, this), this.trigger("ready");
var i = this.map.getViewBounds();
i && this.showBounds(i)
},
clean: function () {
L.DomEvent.off(window, "resize", this.map_leaflet._onResize, this.map_leaflet);
for (var e in this.layers) {
var t = this.layers[e];
t.remove(), delete this.layers[e]
}
cdb.core.View.prototype.clean.call(this)
},
_setScrollWheel: function (e, t) {
t ? this.map_leaflet.scrollWheelZoom.enable() : this.map_leaflet.scrollWheelZoom.disable()
},
_setZoom: function (e, t) {
this._setView()
},
_setCenter: function (e, t) {
this._setView()
},
_setView: function () {
this.map_leaflet.setView(this.map.get("center"), this.map.get("zoom") || 0)
},
_addGeomToMap: function (e) {
var t = cdb.geo.LeafletMapView.createGeometry(e);
return t.geom.addTo(this.map_leaflet), t
},
_removeGeomFromMap: function (e) {
this.map_leaflet.removeLayer(e.geom)
},
createLayer: function (e) {
return cdb.geo.LeafletMapView.createLayer(e, this.map_leaflet)
},
_addLayer: function (e, t, n) {
var r = this,
i, s;
s = cdb.geo.LeafletMapView.createLayer(e, this.map_leaflet);
if (!s) return;
var o = !n || n.index === undefined || n.index === _.size(this.layers);
if (!o) for (var u in this.layers) this.map_leaflet.removeLayer(this.layers[u]);
this.layers[e.cid] = s, o ? (cdb.geo.LeafletMapView.addLayerToMap(s, r.map_leaflet), s.setZIndex && s.setZIndex(e.get("order"))) : this.map.layers.each(function (e) {
var t = r.layers[e.cid];
t && (cdb.geo.LeafletMapView.addLayerToMap(t, r.map_leaflet), t.setZIndex && t.setZIndex(e.get("order")))
});
var a = e.get("attribution");
if (a) {
var f = this.map.get("attribution") || [];
_.contains(f, a) || f.push(a), this.map.set({
attribution: f
})
}
return (n == undefined || !n.silent) && this.trigger("newLayerView", s, e, this), s
},
latLonToPixel: function (e) {
var t = this.map_leaflet.latLngToLayerPoint(new L.LatLng(e[0], e[1]));
return this.map_leaflet.layerPointToContainerPoint(t)
},
getBounds: function () {
var e = this.map_leaflet.getBounds(),
t = e.getSouthWest(),
n = e.getNorthEast();
return [[t.lat, t.lng], [n.lat, n.lng]]
},
setAttribution: function (e) {},
getSize: function () {
return this.map_leaflet.getSize()
},
panBy: function (e) {
this.map_leaflet.panBy(new L.Point(e.x, e.y))
},
setCursor: function (e) {
$(this.map_leaflet.getContainer()).css("cursor", e)
},
getNativeMap: function () {
return this.map_leaflet
},
invalidateSize: function () {
this.map_leaflet.invalidateSize()
}
}, {
layerTypeMap: {
tiled: cdb.geo.LeafLetTiledLayerView,
cartodb: cdb.geo.LeafLetLayerCartoDBView,
carto: cdb.geo.LeafLetLayerCartoDBView,
plain: cdb.geo.LeafLetPlainLayerView,
gmapsbase: cdb.geo.LeafLetPlainLayerView,
layergroup: cdb.geo.LeafLetCartoDBLayerGroupView
},
createLayer: function (e, t) {
var n = null,
r = this.layerTypeMap[e.get("type").toLowerCase()];
return r ? n = new r(e, t) : cdb.log.error("MAP: " + e.get("type") + " can't be created"), n
},
addLayerToMap: function (e, t, n) {
t.addLayer(e.leafletLayer), n != undefined && v.setZIndex && v.setZIndex(n)
},
createGeometry: function (e) {
return e.isPoint() ? new cdb.geo.leaflet.PointView(e) : new cdb.geo.leaflet.PathView(e)
}
}), L.Icon.Default.imagePath = function () {
var e = document.getElementsByTagName("script"),
t = /\/?cartodb[\-\._]?([\w\-\._]*)\.js\??/,
n, r, i, s;
for (n = 0, r = e.length; n < r; n++) {
i = e[n].src, s = i.match(t);
if (s) {
var o = i.split("/");
return delete o[o.length - 1], o.join("/") + "themes/css/images"
}
}
}()
}(), function () {
if (typeof google == "undefined" || typeof google.maps == "undefined") return;
var e = function (e, t, n) {
this.gmapsLayer = t, this.map = this.gmapsMap = n, this.model = e, this.model.bind("change", this._update, this), this.type = e.get("type") || e.get("kind"), this.type = this.type.toLowerCase()
};
_.extend(e.prototype, Backbone.Events), _.extend(e.prototype, {
_searchLayerIndex: function () {
var e = this,
t = -1;
return this.gmapsMap.overlayMapTypes.forEach(function (n, r) {
n == e && (t = r)
}), t
},
remove: function () {
if (!this.isBase) {
var e = this,
t = this._searchLayerIndex();
t > 0 && this.gmapsMap.overlayMapTypes.removeAt(t), this.model.unbind(null, null, this), this.unbind()
}
},
refreshView: function () {
var e = this;
if (this.isBase) {
var t = "_baseLayer";
this.gmapsMap.setMapTypeId(null), this.gmapsMap.mapTypes.set(t, this.gmapsLayer), this.gmapsMap.setMapTypeId(t)
} else {
var n = this._searchLayerIndex();
n >= 0 && this.gmapsMap.overlayMapTypes.setAt(n, this)
}
},
reload: function () {
this.refreshView()
},
_update: function () {
this.refreshView()
}
}), cdb.geo.GMapsLayerView = e
}(), function () {
if (typeof google == "undefined" || typeof google.maps == "undefined") return;
var e = function (e, t) {
cdb.geo.GMapsLayerView.call(this, e, null, t)
};
_.extend(e.prototype, cdb.geo.GMapsLayerView.prototype, {
_update: function () {
var e = this.model,
t = {
roadmap: google.maps.MapTypeId.ROADMAP,
gray_roadmap: google.maps.MapTypeId.ROADMAP,
dark_roadmap: google.maps.MapTypeId.ROADMAP,
hybrid: google.maps.MapTypeId.HYBRID,
satellite: google.maps.MapTypeId.SATELLITE,
terrain: google.maps.MapTypeId.TERRAIN
};
this.gmapsMap.setOptions({
mapTypeId: t[e.get("base_type")]
}), this.gmapsMap.setOptions({
styles: e.get("style") || DEFAULT_MAP_STYLE
})
},
remove: function () {}
}), cdb.geo.GMapsBaseLayerView = e
}(), function () {
if (typeof google == "undefined" || typeof google.maps == "undefined") return;
var e = function (e, t) {
this.color = e.get("color"), cdb.geo.GMapsLayerView.call(this, e, this, t)
};
_.extend(e.prototype, cdb.geo.GMapsLayerView.prototype, {
_update: function () {
this.color = this.model.get("color"), this.refreshView()
},
getTile: function (e, t, n) {
var r = document.createElement("div");
return r.style.width = this.tileSize.x, r.style.height = this.tileSize.y, r["background-color"] = this.color, r
},
tileSize: new google.maps.Size(256, 256),
maxZoom: 100,
minZoom: 0,
name: "plain layer",
alt: "plain layer"
}), cdb.geo.GMapsPlainLayerView = e
}(), function () {
if (typeof google == "undefined" || typeof google.maps == "undefined") return;
var e = function (e, t) {
cdb.geo.GMapsLayerView.call(this, e, this, t), this.tileSize = new google.maps.Size(256, 256), this.opacity = 1, this.isPng = !0, this.maxZoom = 22, this.minZoom = 0, this.name = "cartodb tiled layer", google.maps.ImageMapType.call(this, this)
};
_.extend(e.prototype, cdb.geo.GMapsLayerView.prototype, google.maps.ImageMapType.prototype, {
getTileUrl: function (e, t) {
var n = e.y,
r = 1 << t;
if (n < 0 || n >= r) return null;
var i = e.x;
if (i < 0 || i >= r) i = (i % r + r) % r;
this.model.get("tms") && (n = r - n - 1);
var s = this.model.get("urlTemplate");
return s.replace("{x}", i).replace("{y}", n).replace("{z}", t)
}
}), cdb.geo.GMapsTiledLayerView = e
}(), function () {
if (typeof google == "undefined" || typeof google.maps == "undefined") return;
var e = function (e) {
this.setMap(e)
};
e.prototype = new google.maps.OverlayView, e.prototype.draw = function () {}, e.prototype.latLngToPixel = function (e) {
var t = this.getProjection();
return t ? t.fromLatLngToContainerPixel(e) : [0, 0]
}, e.prototype.pixelToLatLng = function (e) {
var t = this.getProjection();
return t ? t.fromContainerPixelToLatLng(e) : [0, 0]
};
var t = function (t) {
var n = {
opacity: .99,
attribution: "CartoDB",
debug: !1,
visible: !0,
added: !1,
tiler_domain: "cartodb.com",
tiler_port: "80",
tiler_protocol: "http",
sql_api_domain: "cartodb.com",
sql_api_port: "80",
sql_api_protocol: "http",
extra_params: {
cache_policy: "persist"
},
cdn_url: null,
subdomains: null
};
this.options = _.defaults(t, n), this.tiles = 0, this.tilejson = null, this.interaction = [];
if (!t.layer_definition && !t.sublayers) throw new Error("cartodb-leaflet needs at least the layer_definition or sublayer list");
t.layer_definition || (t.layer_definition = LayerDefinition.layerDefFromSubLayers(t.sublayers)), this._addWadus({
left: 74,
bottom: 8
}, 2e3, this.options.map.getDiv()), wax.g.connector.call(this, t), _.extend(this.options, t), this.projector = new e(t.map), LayerDefinition.call(this, t.layer_definition, this.options), CartoDBLayerCommon.call(this), this.update()
};
t.Projector = e, t.prototype = new wax.g.connector, _.extend(t.prototype, CartoDBLayerCommon.prototype, LayerDefinition.prototype), t.prototype.interactionClass = wax.g.interaction, t.prototype.setOpacity = function (e) {
if (isNaN(e) || e > 1 || e < 0) throw new Error(e + " is not a valid value, should be in [0, 1] range");
this.opacity = this.options.opacity = e;
for (var t in this.cache) {
var n = this.cache[t];
n.style.opacity = e, n.style.filter = "alpha(opacity=" + e * 100 + ");"
}
}, t.prototype.setAttribution = function () {}, t.prototype.getTile = function (e, t, n) {
var r = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
i = this;
this.options.added = !0;
if (this.tilejson == null) {
var s = t + "/" + e.x + "/" + e.y,
o = this.cache[s] = new Image(256, 256);
return o.src = r, o.setAttribute("gTileKey", s), o.style.opacity = this.options.opacity, o
}
var u = wax.g.connector.prototype.getTile.call(this, e, t, n);
return this.tiles === 0 && this.loading && this.loading(), this.tiles++, u.onload = u.onerror = function () {
i.tiles--, i.tiles === 0 && i.finishLoading && i.finishLoading()
}, u
}, t.prototype.onAdd = function () {}, t.prototype.clear = function () {
this._clearInteraction(), self.finishLoading && self.finishLoading()
}, t.prototype.update = function (e) {
var t = this;
this.loading && this.loading(), this.getTiles(function (n, r) {
n ? (t.tilejson = n, t.options.tiles = n.tiles, t.tiles = 0, t.cache = {}, t._reloadInteraction(), t.refreshView(), t.ok && t.ok(), e && e()) : t.error && t.error(r)
})
}, t.prototype.refreshView = function () {
var e = this,
t = this.options.map;
t.overlayMapTypes.forEach(function (n, r) {
if (n == e) {
t.overlayMapTypes.setAt(r, e);
return
}
})
}, t.prototype.onLayerDefinitionUpdated = function () {
this.update()
}, t.prototype._checkLayer = function () {
if (!this.options.added) throw new Error("the layer is not still added to the map")
}, t.prototype._findPos = function (e, t) {
var n, r;
n = curtop = 0;
var i = e.getDiv();
do n += i.offsetLeft, curtop += i.offsetTop;
while (i = i.offsetParent);
return new google.maps.Point((t.e.clientX || t.e.changedTouches[0].clientX) - n, (t.e.clientY || t.e.changedTouches[0].clientY) - curtop)
}, t.prototype._manageOffEvents = function (e, t) {
if (this.options.featureOut) return this.options.featureOut && this.options.featureOut(t.e, t.layer)
}, t.prototype._manageOnEvents = function (e, t) {
var n = this._findPos(e, t),
r = this.projector.pixelToLatLng(n),
i = t.e.type.toLowerCase();
switch (i) {
case "mousemove":
if (this.options.featureOver) return this.options.featureOver(t.e, r, n, t.data, t.layer);
break;
case "click":
case "touchend":
case "mspointerup":
this.options.featureClick && this.options.featureClick(t.e, r, n, t.data, t.layer);
break;
default:
}
}, cdb.geo.CartoDBLayerGroupGMaps = t;
var n = function (e, n) {
var r = this;
_.bindAll(this, "featureOut", "featureOver", "featureClick"), e.attributes.attribution = "CartoDB <a href='http://cartodb.com/attributions' target='_blank'>attribution</a>";
var i = _.clone(e.attributes);
i.map = n;
var s = i.featureOver,
o = i.featureOut,
u = i.featureClick;
i.featureOver = function () {
s && s.apply(this, arguments), r.featureOver && r.featureOver.apply(this, arguments)
}, i.featureOut = function () {
o && o.apply(this, arguments), r.featureOut && r.featureOut.apply(this, arguments)
}, i.featureClick = function () {
u && u.apply(this, arguments), r.featureClick && r.featureClick.apply(i, arguments)
}, t.call(this, i), cdb.geo.GMapsLayerView.call(this, e, this, n)
};
_.extend(n.prototype, cdb.geo.GMapsLayerView.prototype, t.prototype, {
_update: function () {
this.setOptions(this.model.attributes)
},
reload: function () {
this.model.invalidate()
},
remove: function () {
cdb.geo.GMapsLayerView.prototype.remove.call(this), this.clear()
},
featureOver: function (e, t, n, r, i) {
this.trigger("featureOver", e, [t.lat(), t.lng()], n, r, i)
},
featureOut: function (e, t) {
this.trigger("featureOut", e, t)
},
featureClick: function (e, t, n, r, i) {
this.trigger("featureClick", e, [t.lat(), t.lng()], n, r, i)
},
error: function (e) {
this.model && (this.model.trigger("error", e ? e.errors : "unknown error"), this.model.trigger("tileError", e ? e.errors : "unknown error"))
},
ok: function (e) {
this.model.trigger("tileOk")
},
tilesOk: function (e) {
this.model.trigger("tileOk")
},
loading: function () {
this.trigger("loading")
},
finishLoading: function () {
this.trigger("load")
}
}), cdb.geo.GMapsCartoDBLayerGroupView = n
}(), function () {
if (typeof google == "undefined" || typeof google.maps == "undefined") return;
var e = function (e) {
this.setMap(e)
};
e.prototype = new google.maps.OverlayView, e.prototype.draw = function () {}, e.prototype.latLngToPixel = function (e) {
var t = this.getProjection();
return t ? t.fromLatLngToContainerPixel(e) : [0, 0]
}, e.prototype.pixelToLatLng = function (e) {
var t = this.getProjection();
return t ? t.fromContainerPixelToLatLng(e) : [0, 0]
};
var t = function (e) {
var t = {
query: "SELECT * FROM {{table_name}}",
opacity: .99,
attribution: "CartoDB",
opacity: 1,
debug: !1,
visible: !0,
added: !1,
extra_params: {},
layer_definition_version: "1.0.0"
};
this.options = _.defaults(e, t);
if (!e.table_name || !e.user_name || !e.tile_style) throw "cartodb-gmaps needs at least a CartoDB table name, user_name and tile_style";
this.options.layer_definition = {
version: this.options.layer_definition_version,
layers: [{
type: "cartodb",
options: this._getLayerDefinition(),
infowindow: this.options.infowindow
}]
}, cdb.geo.CartoDBLayerGroupGMaps.call(this, this.options), this.setOptions(this.options)
};
_.extend(t.prototype, cdb.geo.CartoDBLayerGroupGMaps.prototype), t.prototype.setQuery = function (e, t) {
t === undefined && (t = e, e = 0), t = t || "select * from " + this.options.table_name, LayerDefinition.prototype.setQuery.call(this, e, t)
}, cdb.geo.CartoDBLayerGMaps = t;
var n = function (e, t) {
var n = this;
_.bindAll(this, "featureOut", "featureOver", "featureClick"), e.attributes.attribution = "CartoDB <a href='http://cartodb.com/attributions' target='_blank'>attribution</a>";
var r = _.clone(e.attributes);
r.map = t;
var i = r.featureOver,
s = r.featureOut,
o = r.featureClick;
r.featureOver = function () {
i && i.apply(this, arguments), n.featureOver && n.featureOver.apply(this, arguments)
}, r.featureOut = function () {
s && s.apply(this, arguments), n.featureOut && n.featureOut.apply(this, arguments)
}, r.featureClick = function () {
o && o.apply(this, arguments), n.featureClick && n.featureClick.apply(r, arguments)
}, cdb.geo.CartoDBLayerGMaps.call(this, r), cdb.geo.GMapsLayerView.call(this, e, this, t)
};
cdb.geo.GMapsCartoDBLayerView = n, _.extend(n.prototype, cdb.geo.CartoDBLayerGMaps.prototype, cdb.geo.GMapsLayerView.prototype, {
_update: function () {
this.setOptions(this.model.attributes)
},
reload: function () {
this.model.invalidate()
},
remove: function () {
cdb.geo.GMapsLayerView.prototype.remove.call(this), this.clear()
},
featureOver: function (e, t, n, r) {
this.trigger("featureOver", e, [t.lat(), t.lng()], n, r, 0)
},
featureOut: function (e) {
this.trigger("featureOut", e)
},
featureClick: function (e, t, n, r, i) {
this.trigger("featureClick", e, [t.lat(), t.lng()], n, r, 0)
},
error: function (e) {
this.model && (this.model.trigger("error", e ? e.error : "unknown error"), this.model.trigger("tileError", e ? e.error : "unknown error"))
},
tilesOk: function (e) {
this.model.trigger("tileOk")
},
loading: function () {
this.trigger("loading")
},
finishLoading: function () {
this.trigger("load")
}
})
}();
if (typeof google != "undefined" && typeof google.maps != "undefined") {
var DEFAULT_MAP_STYLE = [{
stylers: [{
saturation: -65
}, {
gamma: 1.52
}]
}, {
featureType: "administrative",
stylers: [{
saturation: -95
}, {
gamma: 2.26
}]
}, {
featureType: "water",
elementType: "labels",
stylers: [{
visibility: "off"
}]
}, {
featureType: "administrative.locality",
stylers: [{
visibility: "off"
}]
}, {
featureType: "road",
stylers: [{
visibility: "simplified"
}, {
saturation: -99
}, {
gamma: 2.22
}]
}, {
featureType: "poi",
elementType: "labels",
stylers: [{
visibility: "off"
}]
}, {
featureType: "road.arterial",
stylers: [{
visibility: "off"
}]
}, {
featureType: "road.local",
elementType: "labels",
stylers: [{
visibility: "off"
}]
}, {
featureType: "transit",
stylers: [{
visibility: "off"
}]
}, {
featureType: "road",
elementType: "labels",
stylers: [{
visibility: "off"
}]
}, {
featureType: "poi",
stylers: [{
saturation: -55
}]
}];
cdb.geo.GoogleMapsMapView = cdb.geo.MapView.extend({
layerTypeMap: {
tiled: cdb.geo.GMapsTiledLayerView,
cartodb: cdb.geo.GMapsCartoDBLayerView,
carto: cdb.geo.GMapsCartoDBLayerView,
plain: cdb.geo.GMapsPlainLayerView,
gmapsbase: cdb.geo.GMapsBaseLayerView,
layergroup: cdb.geo.GMapsCartoDBLayerGroupView
},
initialize: function () {
_.bindAll(this, "_ready"), this._isReady = !1;
var e = this;
cdb.geo.MapView.prototype.initialize.call(this);
var t = this.map.getViewBounds();
t && this.showBounds(t);
var n = this.map.get("center");
if (!this.options.map_object) this.map_googlemaps = new google.maps.Map(this.el, {
center: new google.maps.LatLng(n[0], n[1]),
zoom: this.map.get("zoom"),
minZoom: this.map.get("minZoom"),
maxZoom: this.map.get("maxZoom"),
disableDefaultUI: !0,
scrollwheel: this.map.get("scrollwheel"),
mapTypeControl: !1,
mapTypeId: google.maps.MapTypeId.ROADMAP,
backgroundColor: "white",
tilt: 0
});
else {
this.map_googlemaps = this.options.map_object, this.setElement(this.map_googlemaps.getDiv());
var r = e.map_googlemaps.getCenter();
e._setModelProperty({
center: [r.lat(), r.lng()]
}), e._setModelProperty({
zoom: e.map_googlemaps.getZoom()
}), e.map.unset("view_bounds_sw", {
silent: !0
}), e.map.unset("view_bounds_ne", {
silent: !0
})
}
this.map.geometries.bind("add", this._addGeometry, this), this.map.geometries.bind("remove", this._removeGeometry, this), this._bindModel(), this._addLayers(), google.maps.event.addListener(this.map_googlemaps, "center_changed", function () {
var t = e.map_googlemaps.getCenter();
e._setModelProperty({
center: [t.lat(), t.lng()]
})
}), google.maps.event.addListener(this.map_googlemaps, "zoom_changed", function () {
e._setModelProperty({
zoom: e.map_googlemaps.getZoom()
})
}), google.maps.event.addListener(this.map_googlemaps, "click", function (t) {
e.trigger("click", t, [t.latLng.lat(), t.latLng.lng()])
}), google.maps.event.addListener(this.map_googlemaps, "dblclick", function (t) {
e.trigger("dblclick", t)
}), this.map.layers.bind("add", this._addLayer, this), this.map.layers.bind("remove", this._removeLayer, this), this.map.layers.bind("reset", this._addLayers, this), this.projector = new cdb.geo.CartoDBLayerGroupGMaps.Projector(this.map_googlemaps), this.projector.draw = this._ready
},
_ready: function () {
this.projector.draw = function () {}, this.trigger("ready"), this._isReady = !0
},
_setScrollWheel: function (e, t) {
this.map_googlemaps.setOptions({
scrollwheel: t
})
},
_setZoom: function (e, t) {
t = t || 0, this.map_googlemaps.setZoom(t)
},
_setCenter: function (e, t) {
var n = new google.maps.LatLng(t[0], t[1]);
this.map_googlemaps.setCenter(n)
},
createLayer: function (e) {
var t, n = this.layerTypeMap[e.get("type").toLowerCase()];
return n ? t = new n(e, this.map_googlemaps) : cdb.log.error("MAP: " + e.get("type") + " can't be created"), t
},
_addLayer: function (e, t, n) {
n = n || {};
var r = this,
i, s;
s = this.createLayer(e);
if (!s) return;
this.layers[e.cid] = s;
if (s) {
var o = _.keys(this.layers).length - 1,
u = o === 0 || n && n.index === 0;
if (u && !n.no_base_layer) {
var a = s.model;
a.get("type") == "GMapsBase" ? s._update() : (s.isBase = !0, s._update())
} else o -= 1, o = Math.max(0, o), r.map_googlemaps.overlayMapTypes.setAt(o, s.gmapsLayer);
(n == undefined || !n.silent) && this.trigger("newLayerView", s, e, this)
} else cdb.log.error("layer type not supported");
var f = e.get("attribution");
if (f) {
var l = this.map.get("attribution") || [];
_.contains(l, f) || l.push(f), this.map.set({
attribution: l
})
}
return s
},
latLonToPixel: function (e) {
return this.projector.latLngToPixel(new google.maps.LatLng(e[0], e[1]))
},
getSize: function () {
return {
x: this.$el.width(),
y: this.$el.height()
}
},
panBy: function (e) {
var t = this.map.get("center"),
n = this.latLonToPixel(t);
e.x += n.x, e.y += n.y;
var r = this.projector.pixelToLatLng(e);
this.map.setCenter([r.lat(), r.lng()])
},
getBounds: function () {
if (this._isReady) {
var e = this.map_googlemaps.getBounds(),
t = e.getSouthWest(),
n = e.getNorthEast();
return [[t.lat(), t.lng()], [n.lat(), n.lng()]]
}
return [[0, 0], [0, 0]]
},
setAttribution: function (e) {
var t = document.getElementById("cartodb-gmaps-attribution"),
n = e.get("attribution").join(", ");
t && t.parentNode.removeChild(t);
var r = this.map_googlemaps.getDiv(),
i = document.createElement("div");
i.setAttribute("id", "cartodb-gmaps-attribution"), i.setAttribute("class", "gmaps"), r.appendChild(i), i.innerHTML = n
},
setCursor: function (e) {
this.map_googlemaps.setOptions({
draggableCursor: e
})
},
_addGeomToMap: function (e) {
var t = cdb.geo.GoogleMapsMapView.createGeometry(e);
if (t.geom.length) for (var n = 0; n < t.geom.length; ++n) t.geom[n].setMap(this.map_googlemaps);
else t.geom.setMap(this.map_googlemaps);
return t
},
_removeGeomFromMap: function (e) {
if (e.geom.length) for (var t = 0; t < e.geom.length; ++t) e.geom[t].setMap(null);
else e.geom.setMap(null)
},
getNativeMap: function () {
return this.map_googlemaps
},
invalidateSize: function () {
google.maps.event.trigger(this.map_googlemaps, "resize")
}
}, {
addLayerToMap: function (e, t, n) {
n = n || 0, t.overlayMapTypes.setAt(n, e)
},
createGeometry: function (e) {
return e.isPoint() ? new cdb.geo.gmaps.PointView(e) : new cdb.geo.gmaps.PathView(e)
}
})
}
cdb.ui.common.Dialog = cdb.core.View.extend({
tagName: "div",
className: "dialog",
events: {
"click .ok": "_ok",
"click .cancel": "_cancel",
"click .close": "_cancel"
},
default_options: {
title: "title",
description: "",
ok_title: "Ok",
cancel_title: "Cancel",
width: 300,
height: 200,
clean_on_hide: !1,
enter_to_confirm: !1,
template_name: "common/views/dialog_base",
ok_button_classes: "button green",
cancel_button_classes: "",
modal_type: "",
modal_class: "",
include_footer: !0,
additionalButtons: []
},
initialize: function () {
_.defaults(this.options, this.default_options), _.bindAll(this, "render", "_keydown"), $(document).bind("keydown", this._keydown), this.bind("clean", this._reClean), this.template_base = this.options.template_base ? _.template(this.options.template_base) : cdb.templates.getTemplate(this.options.template_name)
},
render: function () {
var e = this.$el;
return e.html(this.template_base(this.options)), e.find(".modal").css({
width: this.options.width
}), this.render_content && this.$(".content").append(this.render_content()), this.options.modal_class && this.$el.addClass(this.options.modal_class), this
},
_keydown: function (e) {
e.keyCode === 27 ? this._cancel() : e.keyCode === 13 && this.options.enter_to_confirm && this._ok()
},
appendToBody: function () {
return $("body").append(this.render().el), this
},
_ok: function (e) {
e && e.preventDefault(), this.ok && this.ok(this.result), this.hide()
},
_cancel: function (e) {
e && (e.preventDefault(), e.stopPropagation()), this.cancel && this.cancel(), this.hide()
},
hide: function () {
this.$el.hide(), this.options.clean_on_hide && this.clean()
},
open: function () {
this.$el.show()
},
_reClean: function () {
$(document).unbind("keydown", this._keydown)
}
}), cdb.ui.common.Notification = cdb.core.View.extend({
tagName: "div",
className: "dialog",
events: {
"click .close": "hide"
},
default_options: {
timeout: 0,
msg: "",
hideMethod: "",
duration: "normal"
},
initialize: function () {
this.closeTimeout = -1, _.defaults(this.options, this.default_options), this.template = this.options.template ? _.template(this.options.template) : cdb.templates.getTemplate("common/notification"), this.$el.hide()
},
render: function () {
var e = this.$el;
return e.html(this.template(this.options)), this.render_content && this.$(".content").append(this.render_content()), this
},
hide: function (e) {
var t = this;
e && e.preventDefault(), clearTimeout(this.closeTimeout), this.options.hideMethod != "" && this.$el.is(":visible") ? this.$el[this.options.hideMethod](this.options.duration, "swing", function () {
t.$el.html(""), t.trigger("notificationDeleted"), t.remove()
}) : (this.$el.hide(), t.$el.html(""), t.trigger("notificationDeleted"), t.remove())
},
open: function (e, t) {
this.render(), this.$el.show(e, t), this.options.timeout && (this.closeTimeout = setTimeout(_.bind(this.hide, this), this.options.timeout))
}
}), cdb.ui.common.Row = cdb.core.Model.extend({}), cdb.ui.common.TableData = Backbone.Collection.extend({
model: cdb.ui.common.Row,
fetched: !1,
initialize: function () {
var e = this;
this.bind("reset", function () {
e.fetched = !0
})
},
getCell: function (e, t) {
var n = this.at(e);
return n ? n.get(t) : null
},
isEmpty: function () {
return this.length === 0
}
}), cdb.ui.common.TableProperties = cdb.core.Model.extend({
columnNames: function () {
return _.map(this.get("schema"), function (e) {
return e[0]
})
},
columnName: function (e) {
return this.columnNames()[e]
}
}), cdb.ui.common.RowView = cdb.core.View.extend({
tagName: "tr",
initialize: function () {
this.model.bind("change", this.render, this), this.model.bind("destroy", this.clean, this), this.model.bind("remove", this.clean, this), this.model.bind("change", this.triggerChange, this), this.model.bind("sync", this.triggerSync, this), this.model.bind("error", this.triggerError, this), this.add_related_model(this.model), this.order = this.options.order
},
triggerChange: function () {
this.trigger("changeRow")
},
triggerSync: function () {
this.trigger("syncRow")
},
triggerError: function () {
this.trigger("errorRow")
},
valueView: function (e, t) {
return t
},
render: function () {
var e = this,
t = this.model,
n = "",
r = 0,
i;
this.options.row_header ? i = '<td class="rowHeader" data-x="' + r + '">' : i = '<td class="EmptyRowHeader" data-x="' + r + '">';
var s = e.valueView("", "");
s.html && (s = s[0].outerHTML), i += s, i += "</td>", r++, n += i;
var o = this.order || _.keys(t.attributes),
u = "",
a = t.attributes;
for (var f = 0, l = o.length; f < l; ++f) {
var c = o[f],
h = a[c];
if (h !== undefined) {
var i = '<td id="cell_' + t.id + "_" + c + '" data-x="' + r + '">',
s = e.valueView(c, h);
s.html && (s = s[0].outerHTML), i += s, i += "</td>", r++, u += i
}
}
return n += u, this.$el.html(n).attr("id", "row_" + t.id), this
},
getCell: function (e) {
var t = e;
return this.options.row_header && ++e, this.$("td:eq(" + e + ")")
},
getTableView: function () {
return this.tableView
}
}), cdb.ui.common.Table = cdb.core.View.extend({
tagName: "table",
rowView: cdb.ui.common.RowView,
events: {
"click td": "_cellClick",
"dblclick td": "_cellDblClick"
},
default_options: {},
initialize: function () {
var e = this;
_.defaults(this.options, this.default_options), this.dataModel = this.options.dataModel, this.rowViews = [], this.setDataSource(this.dataModel), this.model.bind("change", this.render, this), this.model.bind("change:dataSource", this.setDataSource, this), this.bind("clean", this.clear_rows, this), this.add_related_model(this.dataModel), this.add_related_model(this.model), this.model.bind("removing:row", function () {
e.rowsBeingDeleted = e.rowsBeingDeleted ? e.rowsBeingDeleted + 1 : 1, e.rowDestroying()
}), this.model.bind("remove:row", function () {
e.rowsBeingDeleted > 0 && (e.rowsBeingDeleted--, e.rowDestroyed(), e.dataModel.length == 0 && e.emptyTable())
})
},
headerView: function (e) {
return e[0]
},
setDataSource: function (e) {
this.dataModel && this.dataModel.unbind(null, null, this), this.dataModel = e, this.dataModel.bind("reset", this._renderRows, this), this.dataModel.bind("error", this._renderRows, this), this.dataModel.bind("add", this.addRow, this)
},
_renderHeader: function () {
var e = this,
t = $("<thead>"),
n = $("<tr>");
return this.options.row_header ? n.append($("<th>").append(e.headerView(["", "header"]))) : n.append($("<th>").append(e.headerView(["", "header"]))), _(this.model.get("schema")).each(function (t) {
n.append($("<th>").append(e.headerView(t)))
}), t.append(n), t
},
clear_rows: function () {
this.$("tfoot").remove(), this.$("tr.noRows").remove();
var e = null;
while (e = this.rowViews.pop()) e.unbind(null, null, this), e.clean();
this.rowViews = []
},
addRow: function (e, t, n) {
var r = this,
i = new r.rowView({
model: e,
order: this.model.columnNames(),
row_header: this.options.row_header
});
i.tableView = this, i.bind("clean", function () {
var e = _.indexOf(r.rowViews, i);
r.rowViews.splice(e, 1);
for (var t = e; t < r.rowViews.length; ++t) r.rowViews[t].$el.attr("data-y", t)
}, this), i.bind("changeRow", this.rowChanged, this), i.bind("saved", this.rowSynched, this), i.bind("errorRow", this.rowFailed, this), i.bind("saving", this.rowSaving, this), this.retrigger("saving", i), i.render();
if (n && n.index !== undefined && n.index != r.rowViews.length) {
i.$el.insertBefore(r.rowViews[n.index].$el), r.rowViews.splice(n.index, 0, i);
for (var s = n.index; s < r.rowViews.length; ++s) r.rowViews[s].$el.attr("data-y", s)
} else i.$el.attr("data-y", r.rowViews.length), r.$el.append(i.el), r.rowViews.push(i);
this.trigger("createRow")
},
rowChanged: function () {},
rowSynched: function () {},
rowFailed: function () {},
rowSaving: function () {},
rowDestroying: function () {},
rowDestroyed: function () {},
emptyTable: function () {},
isEmptyTable: function () {
return this.dataModel.length === 0 && this.dataModel.fetched
},
_renderRows: function () {
this.clear_rows();
if (!this.isEmptyTable()) if (this.dataModel.fetched) {
var e = this;
this.dataModel.each(function (t) {
e.addRow(t)
})
} else this._renderLoading();
else this._renderEmpty()
},
_renderLoading: function () {},
_renderEmpty: function () {},
addEmptyTableInfo: function () {},
render: function () {
var e = this;
return e.$el.html(e._renderHeader()), e._renderRows(), this
},
getCell: function (e, t) {
return this.options.row_header && ++t, this.rowViews[t].getCell(e)
},
_cellClick: function (e, t) {
t = t || "cellClick", e.preventDefault();
var n = $(e.currentTarget || e.target),
r = parseInt(n.attr("data-x"), 10),
i = parseInt(n.parent().attr("data-y"), 10);
this.trigger(t, e, n, r, i)
},
_cellDblClick: function (e) {
this._cellClick(e, "cellDblClick")
}
}), cdb.ui.common.Dropdown = cdb.core.View.extend({
tagName: "div",
className: "dropdown",
events: {
"click ul li a": "_fireClick"
},
default_options: {
width: 160,
speedIn: 150,
speedOut: 300,
vertical_position: "down",
horizontal_position: "right",
tick: "right",
vertical_offset: 0,
horizontal_offset: 0
},
initialize: function () {
_.bindAll(this, "open", "hide", "_handleClick", "_keydown"), _.defaults(this.options, this.default_options), this.options.template_base ? this.template_base = cdb.templates.getTemplate(this.options.template_base) : this.options.template && (this.template_base = this.options.template), $(this.options.target).bind({
click: this._handleClick
}), $(document).bind("keydown", this._keydown), this.isOpen = !1
},
render: function () {
var e = this.$el;
return e.html(this.template_base(this.options)).css({
width: this.options.width
}), this
},
_handleClick: function (e) {
e && (e.preventDefault(), e.stopPropagation()), this.isOpen ? this.hide() : this.open()
},
_keydown: function (e) {
e.keyCode === 27 && this.hide()
},
hide: function () {
this.isOpen = !1, this.$el.hide()
},
show: function () {
this.$el.css({
display: "block",
opacity: 1
}), this.isOpen = !0
},
open: function (e, t) {
var n = t && $(t) || this.options.target;
this.options.target = n;
var r = n[this.options.position || "offset"](),
i = n.outerWidth(),
s = n.outerHeight(),
o = this.$el.outerWidth(),
u = this.$el.outerHeight(),
a = this;
this.$el.css({
top: r.top + parseInt(a.options.vertical_position == "up" ? -u - 10 - a.options.vertical_offset : s + 10 - a.options.vertical_offset),
left: r.left + parseInt(a.options.horizontal_position == "left" ? a.options.horizontal_offset - 15 : i - o + 15 - a.options.horizontal_offset)
}).addClass((this.options.vertical_position == "up" ? "vertical_top" : "vertical_bottom") + " " + (this.options.horizontal_position == "right" ? "horizontal_right" : "horizontal_left") + " " + "tick_" + this.options.tick), this.show(), this.isOpen = !0
},
_fireClick: function (e) {
this.trigger("optionClicked", e, this.el)
}
}), function () {
var e = {},
t = {
_types: {},
register: function (e, n) {
t._types[e] = n
},
create: function (e, n, r) {
var i = t._types[e];
i || cdb.log.error("Overlay: " + e + " does not exist");
var s = i(r, n);
return s.type = e, s
}
};
cdb.vis.Overlay = t;
var n = {
_types: {},
register: function (e, t) {
this._types[e] = t
},
create: function (e, t, n) {
if (!e) return cdb.log.error("creating a layer without type"), null;
var r = this._types[e.toLowerCase()],
i = {};
return i.type = e, _.extend(i, n, n.options), new r(t, i)
}
};
cdb.vis.Layers = n;
var r = cdb.vis.Loader = {
queue: [],
current: undefined,
_script: null,
head: null,
get: function (e, t) {
if (!r._script) {
r.current = t;
var n = document.createElement("script");
n.type = "text/javascript", n.src = e + (~e.indexOf("?") ? "&" : "?") + "callback=vizjson", n.async = !0, r._script = n, r.head || (r.head = document.getElementsByTagName("head")[0]), r.head.appendChild(n)
} else r.queue.push([e, t])
}
};
window.vizjson = function (e) {
r.current && r.current(e), r.head.removeChild(r._script), r._script = null;
var t = r.queue.shift();
t && r.get(t[0], t[1])
};
var i = cdb.core.View.extend({
initialize: function () {
_.bindAll(this, "loadingTiles", "loadTiles", "_onResize"), this.https = !1, this.overlays = [], this.options.mapView && (this.mapView = this.options.mapView, this.map = this.mapView.map)
},
load: function (e, t) {
var n = this;
if (typeof e == "string") {
var r = e;
return cdb.vis.Loader.get(r, function (e) {
e ? n.load(e, t) : n.trigger("error", "error fetching viz.json file")
}), this
}
window && window.location.protocol && window.location.protocol === "https:" && (this.https = !0), e.https && (this.https = e.https);
var i = !0;
t = t || {}, this._applyOptions(e, t), this.cartodb_logo = t.cartodb_logo, i = t.scrollwheel, e.maxZoom || (e.maxZoom = 20), e.minZoom || (e.minZoom = 0);
var s = {
title: e.title,
description: e.description,
maxZoom: e.maxZoom,
minZoom: e.minZoom,
scrollwheel: i,
provider: e.map_provider
};
e.bounding_box_sw && e.bounding_box_ne && (s.bounding_box_sw = e.bounding_box_sw, s.bounding_box_ne = e.bounding_box_ne);
if (e.bounds) s.view_bounds_sw = e.bounds[0], s.view_bounds_ne = e.bounds[1];
else {
var o = e.center;
typeof o == "string" && (o = $.parseJSON(o)), s.center = o || [0, 0], s.zoom = e.zoom == undefined ? 4 : e.zoom
}
var u = new cdb.geo.Map(s);
this.map = u, this.updated_at = e.updated_at || (new Date).getTime();
var a = this.$el.outerHeight();
a === 0 && (this.center = this.map.get("center"), $(window).bind("resize", this._onResize));
var f = $("<div>").css({
position: "relative",
width: "100%",
height: "100%"
});
this.container = f;
var l = $("<div>").addClass("cartodb-map-wrapper").css({
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
width: "100%"
});
f.append(l), this.$el.append(f);
var c = new cdb.geo.MapView.create(l, u);
this.mapView = c;
for (var h in e.layers) {
var p = e.layers[h];
this.loadLayer(p)
}
t.legends && this.addLegends(e.layers);
if (t.sublayer_options) {
var d = this.getLayers()[1];
for (h = 0; h < t.sublayer_options.length; ++h) {
var v = t.sublayer_options[h],
m = d.getSubLayer(h);
if (this.legends) {
var g = t.sublayer_options.length - h - 1,
y = this.legends && this.legends.options.legends[g];
y && (v.visible ? y.show() : y.hide())
}
v.visible ? m.show() : m.hide()
}
}
for (var h in e.overlays) this.addOverlay(e.overlays[h]);
return _.defer(function () {
n.trigger("done", n, n.getLayers())
}), this
},
addLegends: function (e) {
function t(e) {
var n = [];
for (var r = e.length - 1; r >= 0; --r) {
var i = e[r];
if (i.legend) {
i.legend.data = i.legend.items;
var s = i.legend;
s.items && s.items.length && (i.legend.index = r, n.push(new cdb.geo.ui.Legend(i.legend)))
}
i.options && i.options.layer_definition && (n = n.concat(t(i.options.layer_definition.layers)))
}
return n
}
legends = t(e);
var n = new cdb.geo.ui.StackedLegend({
legends: legends
});
this.legends = n, this.mapView.addOverlay(n)
},
addOverlay: function (e) {
e.map = this.map;
var n = t.create(e.type, this, e);
return n && (e.type == "loader" && (this.loader = n), this.addView(n), this.container.append(n.el), this.overlays.push(n), n.bind("clean", function () {
for (var e in this.overlays) {
var t = this.overlays[e];
if (n.cid === t.cid) {
this.overlays.splice(e, 1);
return
}
}
}, this), e.type == "header" && this.setMapPosition()), n
},
_applyOptions: function (e, t) {
function n(t) {
if (!e.overlays) return null;
for (var n = 0; n < e.overlays.length; ++n) if (e.overlays[n].type === t) return e.overlays[n]
}
function r(t) {
if (!e.overlays) return;
for (var n = 0; n < e.overlays.length; ++n) if (e.overlays[n].type === t) {
e.overlays.splice(n, 1);
return
}
}
t = t || {}, t = _.defaults(t, {
search: !1,
title: !1,
description: !1,
tiles_loader: !0,
zoomControl: !0,
loaderControl: !0,
layer_selector: !1,
searchControl: !1,
infowindow: !0,
legends: !0
}), e.overlays = e.overlays || [], e.layers = e.layers || [], this.infowindow = t.infowindow, t.https && (this.https = !0), (t.search || t.searchControl) && e.overlays.push({
type: "search"
}), (t.title || t.description || t.shareable) && e.overlays.unshift({
type: "header",
shareable: t.shareable ? !0 : !1,
url: e.url
}), t.layer_selector && e.overlays.push({
type: "layer_selector"
}), t.title || (e.title = null), t.description || (e.description = null), t.tiles_loader || r("loader"), t.zoomControl || r("zoom"), t.loaderControl || r("loader"), t.zoom !== undefined && (e.zoom = parseFloat(t.zoom), e.bounds = null), t.center_lat !== undefined && (e.center = [parseFloat(t.center_lat), parseFloat(t.center_lon)], e.bounds = null), t.center !== undefined && (e.center = t.center, e.bounds = null), t.sw_lat !== undefined && (e.bounds = [
[parseFloat(t.sw_lat), parseFloat(t.sw_lon)],
[parseFloat(t.ne_lat), parseFloat(t.ne_lon)]
]), e.layers.length > 1 && (t.sql && (e.layers[1].options.query = t.sql), t.style && (e.layers[1].options.tile_style = t.style), e.layers[1].options.no_cdn = t.no_cdn)
},
setMapPosition: function () {
var e = this.$el.outerHeight();
if (e !== 0) {
var t = this.$(".cartodb-header:not(.cartodb-popup)").outerHeight();
this.$el.find("div.cartodb-map-wrapper").css("top", t), this.mapView.invalidateSize()
}
},
createLayer: function (e, t) {
var r = n.create(e.type || e.kind, this, e);
return this.mapView.createLayer(r)
},
_getSqlApi: function (e) {
e = e || {};
var t = e.sql_api_port,
n = e.sql_api_domain + (t ? ":" + t : ""),
r = e.sql_api_protocol,
i = "v1";
n.indexOf("cartodb.com") !== -1 && (r = "http", n = "cartodb.com", i = "v2");
var s = new cartodb.SQL({
user: e.user_name,
protocol: r,
host: n,
version: i
});
return s
},
addInfowindow: function (e) {
if (!e.containInfowindow || !e.containInfowindow()) return;
var n = this.mapView,
r = "featureClick",
i = null;
for (var s = 0; s < e.getLayerCount(); ++s) {
var o = e.getSubLayer(s).get("interactivity");
e.getInfowindowData(s) && o && o.indexOf("cartodb_id") !== -1 && (i || (i = t.create("infowindow", this, e.getInfowindowData(s), !0), n.addInfowindow(i)), e.setInteraction(s, !0))
}
if (!i) return;
var u = this._getSqlApi(e.options);
e.bind(r, function (t, n, r, s, o) {
var a = s.cartodb_id,
f = e.getInfowindowData(o),
l = f.fields;
i.model.set({
template: f.template,
template_type: f.template_type
}), u.execute("select {{{fields}}} from ({{{sql}}}) as _cartodbjs_alias where cartodb_id = {{{ cartodb_id }}}", {
fields: _.pluck(l, "name").join(","),
cartodb_id: a,
sql: e.getQuery(o)
}).done(function (e) {
if (e.rows.length == 0) return;
e = e.rows[0];
if (f) {
var t = [],
n = f.fields;
for (var r = 0; r < n.length; ++r) {
var s = n[r],
o = String(e[s.name]);
e[s.name] != undefined && o != "" && t.push({
title: s.title ? s.name : null,
value: e[s.name],
index: r ? r : null
})
}
t.length === 0 && t.push({
title: null,
value: "No data available",
index: r ? r : null,
type: "empty"
}), content = t
}
i.model.set({
content: {
fields: content,
data: e
}
}), i.adjustPan()
}).error(function () {
i.setError()
}), i.setLatLng(n).setLoading().showInfowindow()
});
var a = [];
e.bind("featureOver", function (e, t, r, i, s) {
a[s] = 1, _.any(a) && n.setCursor("pointer")
}), e.bind("featureOut", function (e, t) {
a[t] = 0, _.any(a) || n.setCursor("auto")
}), e.infowindow = i.model
},
loadLayer: function (e, t) {
var r = this.map,
i = this.mapView,
s = r.addLayer(n.create(e.type || e.kind, this, e), t),
o = i.getLayerByCid(s);
return this.infowindow && o.containInfowindow && o.containInfowindow() && this.addInfowindow(o), o && (o.bind("loading", this.loadingTiles), o.bind("load", this.loadTiles)), o
},
loadingTiles: function () {
this.loader && this.loader.show()
},
loadTiles: function () {
this.loader && this.loader.hide()
},
error: function (e) {
return this.bind("error", e)
},
done: function (e) {
return this.bind("done", e)
},
getNativeMap: function () {
return this.mapView.getNativeMap()
},
getLayers: function () {
var e = this;
return this.map.layers.map(function (t) {
return e.mapView.getLayerByCid(t.cid)
})
},
getOverlays: function () {
return this.overlays
},
getOverlay: function (e) {
return _(this.overlays).find(function (t) {
return t.type == e
})
},
_onResize: function () {
$(window).unbind("resize", this._onResize);
var e = this;
setTimeout(function () {
e.setMapPosition(), e.center && e.mapView.map.set("center", e.center)
}, 101)
}
}, {
addInfowindow: function (e, t, n, r) {
var i = _.defaults(r || {}, {
infowindowTemplate: cdb.vis.INFOWINDOW_TEMPLATE.light,
templateType: "mustache",
triggerEvent: "featureClick",
templateName: "light",
extraFields: [],
cursorInteraction: !0
});
if (!e) throw new Error("map is not valid");
if (!t) throw new Error("layer is not valid");
if (!n && n.length === undefined) throw new Error("fields should be a list of strings");
var s = [];
n = n.concat(i.extraFields);
for (var o = 0; o < n.length; ++o) s.push({
name: n,
order: o
});
var u = new cdb.geo.ui.InfowindowModel({
fields: s,
template_name: i.templateName
}),
a = new cdb.geo.ui.Infowindow({
model: u,
mapView: e.viz.mapView,
template: (new cdb.core.Template({
template: i.infowindowTemplate,
type: i.templateType
})).asFunction()
});
return e.viz.mapView.addInfowindow(a), t.setInteractivity(n), t.setInteraction(!0), t.bind(i.triggerEvent, function (e, t, n, r, i) {
var s = [];
for (var o in r) s.push({
title: o,
value: r[o],
index: 0
});
a.model.set({
content: {
fields: s,
data: r
}
}), a.setLatLng(t).showInfowindow(), a.adjustPan()
}, a), a.bind("clean", function () {
t.unbind(i.triggerEvent, null, a)
}), i.cursorInteraction && cdb.vis.Vis.addCursorInteraction(e, t), a
},
addCursorInteraction: function (e, t) {
var n = [],
r = e.viz.mapView;
t.bind("featureOver", function (e, t, i, s, o) {
n[o] = 1, _.any(n) && r.setCursor("pointer")
}, r), t.bind("featureOut", function (e, t) {
n[t] = 0, _.any(n) || r.setCursor("auto")
}, r)
},
removeCursorInteraction: function (e, t) {
var n = e.viz.mapView;
t.unbind(null, null, n)
}
});
cdb.vis.INFOWINDOW_TEMPLATE = {
light: ['<div class="cartodb-popup">', '<a href="#close" class="cartodb-popup-close-button close">x</a>', '<div class="cartodb-popup-content-wrapper">', '<div class="cartodb-popup-content">', "{{#content.fields}}", "{{#title}}<h4>{{title}}</h4>{{/title}}", "{{#value}}", '<p {{#type}}class="{{ type }}"{{/type}}>{{{ value }}}</p>', "{{/value}}", "{{^value}}", '<p class="empty">null</p>', "{{/value}}", "{{/content.fields}}", "</div>", "</div>", '<div class="cartodb-popup-tip-container"></div>', "</div>"].join("")
}, cdb.vis.Vis = i
}(), function () {
cdb.vis.Overlay.register("zoom", function (e, t) {
if (!e.template) {
t.trigger("error", "zoom template is empty");
return
}
var n = new cdb.geo.ui.Zoom({
model: e.map,
template: cdb.core.Template.compile(e.template)
});
return n.render()
}), cdb.vis.Overlay.register("loader", function (e) {
var t = new cdb.geo.ui.TilesLoader({
template: cdb.core.Template.compile(e.template)
});
return t.render()
}), cdb.vis.Overlay.register("header", function (e, t) {
var n = 100;
location.href ? e.share_url = encodeURIComponent(location.href) : e.share_url = e.url;
var r = cdb.core.Template.compile(e.template || " {{#title}} <h1> {{#url}} <a href='#' onmousedown=\"window.open('{{url}}')\">{{title}}</a> {{/url}} {{^url}} {{title}} {{/url}} </h1> {{/title}} {{#description}}<p>{{description}}</p>{{/description}} {{#shareable}} <div class='social'> <a class='facebook' target='_blank' href='http://www.facebook.com/sharer.php?u={{share_url}}&text=Map of {{title}}: {{description}}'>F</a> <a class='twitter' href='https://twitter.com/share?url={{share_url}}&text=Map of {{title}}: {{descriptionShort}}... ' target='_blank'>T</a> </div> {{/shareable}} ", e.templateType || "mustache"),
i = e.map.get("title") ? e.map.get("title").length : 0,
s = e.map.get("description") ? e.map.get("description").length : 0,
o = n - i,
u = e.map.get("description"),
a = u;
if (s > o) {
var a = u.substr(0, o);
a = a.split(" "), a.pop(), a = a.join(" ")
}
var f = new cdb.geo.ui.Header({
title: e.map.get("title"),
description: u,
descriptionShort: a,
url: e.url,
share_url: e.share_url,
shareable: e.shareable == "false" || !e.shareable ? null : e.shareable,
template: r
});
return f.render()
}), cdb.vis.Overlay.register("infowindow", function (e, t) {
if (_.size(e.fields) == 0) return null;
var n = new cdb.geo.ui.InfowindowModel({
fields: e.fields,
template_name: e.template_name
}),
r = e.templateType || "mustache",
i = new cdb.geo.ui.Infowindow({
model: n,
mapView: t.mapView,
template: (new cdb.core.Template({
template: e.template,
type: r
})).asFunction()
});
return i
}), cdb.vis.Overlay.register("layer_selector", function (e, t) {
var n = cdb.core.Template.compile(e.template || ' <a href="#/change-visibility" class="layers">Visible layers<div class="count"></div></a> ', e.templateType || "underscore"),
r = cdb.core.Template.compile(e.template || ' <ul></ul><div class="tail"><span class="border"></span></div> ', e.templateType || "underscore"),
i = new cdb.geo.ui.LayerSelector({
mapView: t.mapView,
template: n,
dropdown_template: r,
layer_names: e.layer_names
});
return t.legends && i.bind("change:visible", function (e, n) {
var r = t.legends && t.legends.getLayerByIndex(n);
r && r[e ? "show" : "hide"]()
}), i.render()
}), cdb.vis.Overlay.register("search", function (e, t) {
var n = cdb.core.Template.compile(e.template || ' <form> <span class="loader"></span> <input type="text" class="text" value="" /> <input type="submit" class="submit" value="" /> </form> ', e.templateType || "mustache"),
r = new cdb.geo.ui.Search({
template: n,
model: t.map
});
return r.render()
}), cdb.vis.Overlay.register("tooltip", function (e, t) {
var n, r = t.getLayers();
r.length > 1 && (n = r[1]), e.layer = n;
var i = new cdb.geo.ui.Tooltip(e);
return i
}), cdb.vis.Overlay.register("infobox", function (e, t) {
var n, r = t.getLayers();
r.length > 1 && (n = r[1]), e.layer = n;
var i = new cdb.geo.ui.InfoBox(e);
return i
})
}(), function () {
function n(e) {
for (var n in t) if (e.indexOf(n) !== -1) return e.replace(n, t[n]);
return e
}
function r(e, t) {
t.infowindow && t.infowindow.fields && (t.interactivity ? t.interactivity.indexOf("cartodb_id") === -1 && (t.interactivity = t.interactivity + ",cartodb_id") : t.interactivity = "cartodb_id"), e.https && (t.tiler_protocol = "https", t.tiler_port = 443), t.cartodb_logo = e.cartodb_logo == undefined ? t.cartodb_logo : e.cartodb_logo
}
var e = cdb.vis.Layers,
t = {
"https://dnv9my2eseobd.cloudfront.net/": "http://a.tiles.mapbox.com/",
"https://maps.nlp.nokia.com/": "http://maps.nlp.nokia.com/",
"https://tile.stamen.com/": "http://tile.stamen.com/"
};
e.register("tilejson", function (e, t) {
var r = t.tiles[0];
return r = e.https ? r : n(r), new cdb.geo.TileLayer({
urlTemplate: r
})
}), e.register("tiled", function (e, t) {
var r = t.urlTemplate;
return r = e.https ? r : n(r), t.urlTemplate = r, new cdb.geo.TileLayer(t)
}), e.register("gmapsbase", function (e, t) {
return new cdb.geo.GMapsBaseLayer(t)
}), e.register("plain", function (e, t) {
return new cdb.geo.PlainLayer(t)
}), e.register("background", function (e, t) {
return new cdb.geo.PlainLayer(t)
});
var i = function (e, t) {
return r(e, t), t.sublayers ? (t.type = "layergroup", new cdb.geo.CartoDBGroupLayer(t)) : new cdb.geo.CartoDBLayer(t)
};
e.register("cartodb", i), e.register("carto", i), e.register("layergroup", function (e, t) {
return r(e, t), new cdb.geo.CartoDBGroupLayer(t)
})
}(), function () {
function e() {}
function n(e) {
var t = e.host || "cartodb.com",
n = e.protocol || "https";
return n + "://" + e.user + "." + t + "/api/v1/viz/" + e.table + "/viz.json"
}
function r(e, t) {
var r = null;
if (e.layers !== undefined || (e.kind || e.type) !== undefined) {
_.defer(function () {
t(e)
});
return
}
e.table !== undefined && e.user !== undefined ? r = n(e) : e.indexOf && e.indexOf("http") === 0 && (r = e), r ? cdb.vis.Loader.get(r, t) : _.defer(function () {
t(null)
})
}
_.extend(e.prototype, Backbone.Events, {
done: function (e) {
return this.bind("done", e)
},
error: function (e) {
return this.bind("error", e)
}
}), cdb._Promise = e;
var t = {};
cartodb.createLayer = function (t, n, i, s) {
var o = new e,
u, a;
if (t === undefined) throw new TypeError("map should be provided");
if (n === undefined) throw new TypeError("layer should be provided");
var f = arguments,
l = f[f.length - 1];
return _.isFunction(l) && (s = l), o.addTo = function (e, t) {
return o.on("done", function () {
a.addLayerToMap(u, e, t)
}), o
}, r(n, function (e) {
var n;
if (!e) {
o.trigger("error");
return
}
e.layers ? (e.layers.length < 2 && o.trigger("error", "visualization file does not contain layer info"), n = e.layers[1]) : n = e;
if (!n) {
o.trigger("error");
return
}
i && !_.isFunction(i) && (n.options = n.options || {}, _.extend(n.options, i)), i = i || {}, i = _.defaults(i, {
infowindow: !0,
https: !1,
legends: !0
});
if (typeof t.overlayMapTypes != "undefined") a = cdb.geo.GoogleMapsMapView;
else {
if (!(t instanceof L.Map || window.L && t instanceof window.L.Map)) return o.trigger("error", "cartodb.js can't guess the map type"), o;
a = cdb.geo.LeafletMapView
}
var r = t.viz;
if (!r) {
var f = new a({
map_object: t,
map: new cdb.geo.Map
});
t.viz = r = new cdb.vis.Vis({
mapView: f
}), r.updated_at = e.updated_at, r.https = i.https
}
u = r.createLayer(n, {
no_base_layer: !0
}), i.infowindow && r.addInfowindow(u), i.legends && r.addLegends([n]), s && s(u), o.trigger("done", u)
}), o
}
}(), function () {
function t(e) {
if (cartodb === this || window === this) return new t(e);
if (!e.user) throw new Error("user should be provided");
var n = new String(window.location.protocol);
n = n.slice(0, n.length - 1), n == "file" && (n = "https"), this.ajax = e.ajax || (typeof jQuery != "undefined" ? jQuery.ajax : reqwest);
if (!this.ajax) throw new Error("jQuery or reqwest should be loaded");
this.options = _.defaults(e, {
version: "v2",
protocol: n,
jsonp: typeof jQuery != "undefined" ? !jQuery.support.cors : !1
})
}
var e = this;
e.cartodb = e.cartodb || {}, t.prototype._host = function () {
var e = this.options;
if (e && e.completeDomain) return e.completeDomain + "/api/" + e.version + "/sql";
var t = e.host || "cartodb.com",
n = e.protocol || "https";
return n + "://" + e.user + "." + t + "/api/" + e.version + "/sql"
}, t.prototype.execute = function (e, t, n, r) {
var i = new cartodb._Promise;
if (!e) throw new TypeError("sql should not be null");
var s = arguments,
o = s[s.length - 1];
_.isFunction(o) && (r = o), n = _.defaults(n || {}, this.options);
var u = {
type: "get",
dataType: "json",
crossDomain: !0
};
n.jsonp && (delete u.crossDomain, u.dataType = "jsonp"), n.cache && (u.cache = n.cache);
var a = "156543.03515625",
f = "ST_MakeEnvelope(-20037508.5,-20037508.5,20037508.5,20037508.5,3857)";
e = e.replace("!bbox!", f).replace("!pixel_width!", a).replace("!pixel_height!", a);
var l = Mustache.render(e, t),
c = "q=" + encodeURIComponent(l),
h = ["format", "dp", "api_key"];
for (var p in h) {
var d = h[p],
v = n[d];
v && (c += "&" + d + "=" + v)
}
var m = n.type == "get" || u.type == "get";
u.url = this._host(), m ? u.url += "?" + c : u.data = c;
var g = n.success,
y = n.error;
return g && delete n.success, y && delete y.success, u.error = function (e) {
var t = e.responseText || e.response,
n = t && JSON.parse(t);
i.trigger("error", n && n.error, e), y && y(e)
}, u.success = function (e, t, n) {
t == undefined && (t = e.status, n = e, e = JSON.parse(e.response)), i.trigger("done", e, t, n), g && g(e, t, n), r && r(e)
}, delete n.jsonp, this.ajax(_.extend(u, n)), i
}, t.prototype.getBounds = function (e, t, n, r) {
var i = new cartodb._Promise,
s = arguments,
o = s[s.length - 1];
_.isFunction(o) && (r = o);
var u = "SELECT ST_XMin(ST_Extent(the_geom)) as minx, ST_YMin(ST_Extent(the_geom)) as miny, ST_XMax(ST_Extent(the_geom)) as maxx, ST_YMax(ST_Extent(the_geom)) as maxy from ({{{ sql }}}) as subq";
return e = Mustache.render(e, t), this.execute(u, {
sql: e
}, n).done(function (e) {
if (e.rows && e.rows.length > 0 && e.rows[0].maxx != null) {
var t = e.rows[0],
n = -85.0511,
s = 85.0511,
o = -179,
u = 179,
a = function (e, t, n) {
return e < t ? t : e > n ? n : e
},
f = a(t.maxx, o, u),
l = a(t.minx, o, u),
c = a(t.maxy, n, s),
h = a(t.miny, n, s),
p = [
[c, f],
[h, l]
];
i.trigger("done", p), r && r(p)
}
}).error(function (e) {
i.trigger("error", e)
}), i
}, t.prototype.table = function (e) {
function a() {
a.fetch.apply(a, arguments)
}
var t = e,
n, r = [],
i, s, o, u = this;
return a.fetch = function (e) {
e = e || {};
var t = arguments,
n = t[t.length - 1];
_.isFunction(n) && (callback = n, t.length === 1 && (e = {})), u.execute(a.sql(), e, callback)
}, a.sql = function () {
var e = "select";
return r.length ? e += " " + r.join(",") + " " : e += " * ", e += "from " + t, n && (e += " where " + n), i && (e += " limit " + i), s && (e += " order by " + s), o && (e += " " + o), e
}, a.filter = function (e) {
return n = e, a
}, a.order_by = function (e) {
return s = e, a
}, a.asc = function () {
return o = "asc", a
}, a.desc = function () {
return o = "desc", a
}, a.columns = function (e) {
return r = e, a
}, a.limit = function (e) {
return i = e, a
}, a
}, e.cartodb.SQL = t
}(), function () {
cartodb.createVis = function (e, t, n, r) {
if (!e) throw new TypeError("a DOM element should be provided");
var i = arguments,
s = i[i.length - 1];
_.isFunction(s) && (r = s), e = typeof e == "string" ? document.getElementById(e) : e;
var o = new cartodb.vis.Vis({
el: e
});
return t && (o.load(t, n), r && o.done(r)), o
}
}(), cdb.$ = $, cdb.L = L, cdb.Mustache = Mustache, cdb.Backbone = Backbone, cdb._ = _
}();
for (var i in __prev) __prev[i] && (window[i] = __prev[i])
})();
This file has been truncated, but you can view the full file.
/*
Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
/*
This is an optimized version of Dojo, built for deployment and not for
development. To get sources and documentation, please visit:
http://dojotoolkit.org
*/
//>>built
(function (_1, _2) {
var _3 = function () {},
_4 = function (it) {
for (var p in it) {
return 0;
}
return 1;
},
_5 = {}.toString,
_6 = function (it) {
return _5.call(it) == "[object Function]";
},
_7 = function (it) {
return _5.call(it) == "[object String]";
},
_8 = function (it) {
return _5.call(it) == "[object Array]";
},
_9 = function (_a, _b) {
if (_a) {
for (var i = 0; i < _a.length;) {
_b(_a[i++]);
}
}
},
_c = function (_d, _e) {
for (var p in _e) {
_d[p] = _e[p];
}
return _d;
},
_f = function (_10, _11) {
return _c(new Error(_10), {
src: "dojoLoader",
info: _11
});
},
_12 = 1,
uid = function () {
return "_" + _12++;
},
req = function (_13, _14, _15) {
return _16(_13, _14, _15, 0, req);
},
_17 = this,
doc = _17.document,
_18 = doc && doc.createElement("DiV"),
has = req.has = function (_19) {
return _6(_1a[_19]) ? (_1a[_19] = _1a[_19](_17, doc, _18)) : _1a[_19];
},
_1a = has.cache = _2.hasCache;
has.add = function (_1b, _1c, now, _1d) {
(_1a[_1b] === undefined || _1d) && (_1a[_1b] = _1c);
return now && has(_1b);
};
0 && has.add("host-node", _1.has && "host-node" in _1.has ? _1.has["host-node"] : (typeof process == "object" && process.versions && process.versions.node && process.versions.v8));
if (0) {
require("./_base/configNode.js").config(_2);
_2.loaderPatch.nodeRequire = require;
}
0 && has.add("host-rhino", _1.has && "host-rhino" in _1.has ? _1.has["host-rhino"] : (typeof load == "function" && (typeof Packages == "function" || typeof Packages == "object")));
if (0) {
for (var _1e = _1.baseUrl || ".", arg, _1f = this.arguments, i = 0; i < _1f.length;) {
arg = (_1f[i++] + "").split("=");
if (arg[0] == "baseUrl") {
_1e = arg[1];
break;
}
}
load(_1e + "/_base/configRhino.js");
rhinoDojoConfig(_2, _1e, _1f);
}
for (var p in _1.has) {
has.add(p, _1.has[p], 0, 1);
}
var _20 = 1,
_21 = 2,
_22 = 3,
_23 = 4,
_24 = 5;
if (0) {
_20 = "requested";
_21 = "arrived";
_22 = "not-a-module";
_23 = "executing";
_24 = "executed";
}
var _25 = 0,
_26 = "sync",
xd = "xd",
_27 = [],
_28 = 0,
_29 = _3,
_2a = _3,
_2b;
if (1) {
req.isXdUrl = _3;
req.initSyncLoader = function (_2c, _2d, _2e) {
if (!_28) {
_28 = _2c;
_29 = _2d;
_2a = _2e;
}
return {
sync: _26,
requested: _20,
arrived: _21,
nonmodule: _22,
executing: _23,
executed: _24,
syncExecStack: _27,
modules: _2f,
execQ: _30,
getModule: _31,
injectModule: _32,
setArrived: _33,
signal: _34,
finishExec: _35,
execModule: _36,
dojoRequirePlugin: _28,
getLegacyMode: function () {
return _25;
},
guardCheckComplete: _37
};
};
if (1) {
var _38 = location.protocol,
_39 = location.host;
req.isXdUrl = function (url) {
if (/^\./.test(url)) {
return false;
}
if (/^\/\//.test(url)) {
return true;
}
var _3a = url.match(/^([^\/\:]+\:)\/+([^\/]+)/);
return _3a && (_3a[1] != _38 || (_39 && _3a[2] != _39));
};
1 || has.add("dojo-xhr-factory", 1);
has.add("dojo-force-activex-xhr", 1 && !doc.addEventListener && window.location.protocol == "file:");
has.add("native-xhr", typeof XMLHttpRequest != "undefined");
if (has("native-xhr") && !has("dojo-force-activex-xhr")) {
_2b = function () {
return new XMLHttpRequest();
};
} else {
for (var _3b = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"], _3c, i = 0; i < 3;) {
try {
_3c = _3b[i++];
if (new ActiveXObject(_3c)) {
break;
}
} catch (e) {}
}
_2b = function () {
return new ActiveXObject(_3c);
};
}
req.getXhr = _2b;
has.add("dojo-gettext-api", 1);
req.getText = function (url, _3d, _3e) {
var xhr = _2b();
xhr.open("GET", _3f(url), false);
xhr.send(null);
if (xhr.status == 200 || (!location.host && !xhr.status)) {
if (_3e) {
_3e(xhr.responseText, _3d);
}
} else {
throw _f("xhrFailed", xhr.status);
}
return xhr.responseText;
};
}
} else {
req.async = 1;
}
var _40 = new Function("return eval(arguments[0]);");
req.eval = function (_41, _42) {
return _40(_41 + "\r\n////@ sourceURL=" + _42);
};
var _43 = {},
_44 = "error",
_34 = req.signal = function (_45, _46) {
var _47 = _43[_45];
_9(_47 && _47.slice(0), function (_48) {
_48.apply(null, _8(_46) ? _46 : [_46]);
});
},
on = req.on = function (_49, _4a) {
var _4b = _43[_49] || (_43[_49] = []);
_4b.push(_4a);
return {
remove: function () {
for (var i = 0; i < _4b.length; i++) {
if (_4b[i] === _4a) {
_4b.splice(i, 1);
return;
}
}
}
};
};
var _4c = [],
_4d = {},
_4e = [],
_4f = {},
map = req.map = {},
_50 = [],
_2f = {},
_51 = "",
_52 = {},
_53 = "url:",
_54 = {},
_55 = {};
if (1) {
var _56 = function (_57) {
var p, _58, _59, now, m;
for (p in _54) {
_58 = _54[p];
_59 = p.match(/^url\:(.+)/);
if (_59) {
_52[_53 + _5a(_59[1], _57)] = _58;
} else {
if (p == "*now") {
now = _58;
} else {
if (p != "*noref") {
m = _5b(p, _57);
_52[m.mid] = _52[_53 + m.url] = _58;
}
}
}
}
if (now) {
now(_5c(_57));
}
_54 = {};
},
_5d = function (s) {
return s.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, function (c) {
return "\\" + c;
});
},
_5e = function (map, _5f) {
_5f.splice(0, _5f.length);
for (var p in map) {
_5f.push([p, map[p], new RegExp("^" + _5d(p) + "(/|$)"), p.length]);
}
_5f.sort(function (lhs, rhs) {
return rhs[3] - lhs[3];
});
return _5f;
},
_60 = function (_61) {
var _62 = _61.name;
if (!_62) {
_62 = _61;
_61 = {
name: _62
};
}
_61 = _c({
main: "main"
}, _61);
_61.location = _61.location ? _61.location : _62;
if (_61.packageMap) {
map[_62] = _61.packageMap;
}
if (!_61.main.indexOf("./")) {
_61.main = _61.main.substring(2);
}
_4f[_62] = _61;
},
_63 = [],
_64 = function (_65, _66, _67) {
for (var p in _65) {
if (p == "waitSeconds") {
req.waitms = (_65[p] || 0) * 1000;
}
if (p == "cacheBust") {
_51 = _65[p] ? (_7(_65[p]) ? _65[p] : (new Date()).getTime() + "") : "";
}
if (p == "baseUrl" || p == "combo") {
req[p] = _65[p];
}
if (1 && p == "async") {
var _68 = _65[p];
req.legacyMode = _25 = (_7(_68) && /sync|legacyAsync/.test(_68) ? _68 : (!_68 ? _26 : false));
req.async = !_25;
}
if (_65[p] !== _1a) {
req.rawConfig[p] = _65[p];
p != "has" && has.add("config-" + p, _65[p], 0, _66);
}
}
if (!req.baseUrl) {
req.baseUrl = "./";
}
if (!/\/$/.test(req.baseUrl)) {
req.baseUrl += "/";
}
for (p in _65.has) {
has.add(p, _65.has[p], 0, _66);
}
_9(_65.packages, _60);
for (_1e in _65.packagePaths) {
_9(_65.packagePaths[_1e], function (_69) {
var _6a = _1e + "/" + _69;
if (_7(_69)) {
_69 = {
name: _69
};
}
_69.location = _6a;
_60(_69);
});
}
_5e(_c(map, _65.map), _50);
_9(_50, function (_6b) {
_6b[1] = _5e(_6b[1], []);
if (_6b[0] == "*") {
_50.star = _6b;
}
});
_5e(_c(_4d, _65.paths), _4e);
_9(_65.aliases, function (_6c) {
if (_7(_6c[0])) {
_6c[0] = new RegExp("^" + _5d(_6c[0]) + "$");
}
_4c.push(_6c);
});
if (_66) {
_63.push({
config: _65.config
});
} else {
for (p in _65.config) {
var _6d = _31(p, _67);
_6d.config = _c(_6d.config || {}, _65.config[p]);
}
}
if (_65.cache) {
_56();
_54 = _65.cache;
if (_65.cache["*noref"]) {
_56();
}
}
_34("config", [_65, req.rawConfig]);
};
if (has("dojo-cdn") || 1) {
var _6e = doc.getElementsByTagName("script"),
i = 0,
_6f, _70, src, _71;
while (i < _6e.length) {
_6f = _6e[i++];
if ((src = _6f.getAttribute("src")) && (_71 = src.match(/(((.*)\/)|^)dojo\.js(\W|$)/i))) {
_70 = _71[3] || "";
_2.baseUrl = _2.baseUrl || _70;
src = (_6f.getAttribute("data-dojo-config") || _6f.getAttribute("djConfig"));
if (src) {
_55 = req.eval("({ " + src + " })", "data-dojo-config");
}
if (0) {
var _72 = _6f.getAttribute("data-main");
if (_72) {
_55.deps = _55.deps || [_72];
}
}
break;
}
}
}
if (0) {
try {
if (window.parent != window && window.parent.require) {
var doh = window.parent.require("doh");
doh && _c(_55, doh.testConfig);
}
} catch (e) {}
}
req.rawConfig = {};
_64(_2, 1);
if (has("dojo-cdn")) {
_4f.dojo.location = _70;
if (_70) {
_70 += "/";
}
_4f.dijit.location = _70 + "../dijit/";
_4f.dojox.location = _70 + "../dojox/";
}
_64(_1, 1);
_64(_55, 1);
} else {
_4d = _2.paths;
_4e = _2.pathsMapProg;
_4f = _2.packs;
_4c = _2.aliases;
_50 = _2.mapProgs;
_2f = _2.modules;
_52 = _2.cache;
_51 = _2.cacheBust;
req.rawConfig = _2;
}
if (0) {
req.combo = req.combo || {
add: _3
};
var _73 = 0,
_74 = [],
_75 = null;
}
var _76 = function (_77) {
_37(function () {
_9(_77.deps, _32);
if (0 && _73 && !_75) {
_75 = setTimeout(function () {
_73 = 0;
_75 = null;
req.combo.done(function (_78, url) {
var _79 = function () {
_7a(0, _78);
_7b();
};
_74.push(_78);
_7c = _78;
req.injectUrl(url, _79, _78);
_7c = 0;
}, req);
}, 0);
}
});
},
_16 = function (a1, a2, a3, _7d, _7e) {
var _7f, _80;
if (_7(a1)) {
_7f = _31(a1, _7d, true);
if (_7f && _7f.executed) {
return _7f.result;
}
throw _f("undefinedModule", a1);
}
if (!_8(a1)) {
_64(a1, 0, _7d);
a1 = a2;
a2 = a3;
}
if (_8(a1)) {
if (!a1.length) {
a2 && a2();
} else {
_80 = "require*" + uid();
for (var mid, _81 = [], i = 0; i < a1.length;) {
mid = a1[i++];
_81.push(_31(mid, _7d));
}
_7f = _c(_82("", _80, 0, ""), {
injected: _21,
deps: _81,
def: a2 || _3,
require: _7d ? _7d.require : req,
gc: 1
});
_2f[_7f.mid] = _7f;
_76(_7f);
var _83 = _84 && _25 != _26;
_37(function () {
_36(_7f, _83);
});
if (!_7f.executed) {
_30.push(_7f);
}
_7b();
}
}
return _7e;
},
_5c = function (_85) {
if (!_85) {
return req;
}
var _86 = _85.require;
if (!_86) {
_86 = function (a1, a2, a3) {
return _16(a1, a2, a3, _85, _86);
};
_85.require = _c(_86, req);
_86.module = _85;
_86.toUrl = function (_87) {
return _5a(_87, _85);
};
_86.toAbsMid = function (mid) {
return _b4(mid, _85);
};
if (has("dojo-undef-api")) {
_86.undef = function (mid) {
req.undef(mid, _85);
};
}
if (1) {
_86.syncLoadNls = function (mid) {
var _88 = _5b(mid, _85),
_89 = _2f[_88.mid];
if (!_89 || !_89.executed) {
_8a = _52[_88.mid] || _52[_53 + _88.url];
if (_8a) {
_8b(_8a);
_89 = _2f[_88.mid];
}
}
return _89 && _89.executed && _89.result;
};
}
}
return _86;
},
_30 = [],
_8c = [],
_8d = {},
_8e = function (_8f) {
_8f.injected = _20;
_8d[_8f.mid] = 1;
if (_8f.url) {
_8d[_8f.url] = _8f.pack || 1;
}
_90();
},
_33 = function (_91) {
_91.injected = _21;
delete _8d[_91.mid];
if (_91.url) {
delete _8d[_91.url];
}
if (_4(_8d)) {
_92();
1 && _25 == xd && (_25 = _26);
}
},
_93 = req.idle = function () {
return !_8c.length && _4(_8d) && !_30.length && !_84;
},
_94 = function (_95, map) {
if (map) {
for (var i = 0; i < map.length; i++) {
if (map[i][2].test(_95)) {
return map[i];
}
}
}
return 0;
},
_96 = function (_97) {
var _98 = [],
_99, _9a;
_97 = _97.replace(/\\/g, "/").split("/");
while (_97.length) {
_99 = _97.shift();
if (_99 == ".." && _98.length && _9a != "..") {
_98.pop();
_9a = _98[_98.length - 1];
} else {
if (_99 != ".") {
_98.push(_9a = _99);
}
}
}
return _98.join("/");
},
_82 = function (pid, mid, _9b, url) {
if (1) {
var xd = req.isXdUrl(url);
return {
pid: pid,
mid: mid,
pack: _9b,
url: url,
executed: 0,
def: 0,
isXd: xd,
isAmd: !! (xd || (_4f[pid] && _4f[pid].isAmd))
};
} else {
return {
pid: pid,
mid: mid,
pack: _9b,
url: url,
executed: 0,
def: 0
};
}
},
_9c = function (mid, _9d, _9e, _9f, _a0, _a1, _a2, _a3) {
var pid, _a4, _a5, _a6, _a7, url, _a8, _a9, _aa;
_aa = mid;
_a9 = /^\./.test(mid);
if (/(^\/)|(\:)|(\.js$)/.test(mid) || (_a9 && !_9d)) {
return _82(0, mid, 0, mid);
} else {
mid = _96(_a9 ? (_9d.mid + "/../" + mid) : mid);
if (/^\./.test(mid)) {
throw _f("irrationalPath", mid);
}
if (_9d) {
_a7 = _94(_9d.mid, _a1);
}
_a7 = _a7 || _a1.star;
_a7 = _a7 && _94(mid, _a7[1]);
if (_a7) {
mid = _a7[1] + mid.substring(_a7[3]);
}
_71 = mid.match(/^([^\/]+)(\/(.+))?$/);
pid = _71 ? _71[1] : "";
if ((_a4 = _9e[pid])) {
mid = pid + "/" + (_a5 = (_71[3] || _a4.main));
} else {
pid = "";
}
var _ab = 0,
_ac = 0;
_9(_4c, function (_ad) {
var _ae = mid.match(_ad[0]);
if (_ae && _ae.length > _ab) {
_ac = _6(_ad[1]) ? mid.replace(_ad[0], _ad[1]) : _ad[1];
}
});
if (_ac) {
return _9c(_ac, 0, _9e, _9f, _a0, _a1, _a2, _a3);
}
_a8 = _9f[mid];
if (_a8) {
return _a3 ? _82(_a8.pid, _a8.mid, _a8.pack, _a8.url) : _9f[mid];
}
}
_a7 = _94(mid, _a2);
if (_a7) {
url = _a7[1] + mid.substring(_a7[3]);
} else {
if (pid) {
url = _a4.location + "/" + _a5;
} else {
if (has("config-tlmSiblingOfDojo")) {
url = "../" + mid;
} else {
url = mid;
}
}
}
if (!(/(^\/)|(\:)/.test(url))) {
url = _a0 + url;
}
url += ".js";
return _82(pid, mid, _a4, _96(url));
},
_5b = function (mid, _af) {
return _9c(mid, _af, _4f, _2f, req.baseUrl, _50, _4e);
},
_b0 = function (_b1, _b2, _b3) {
return _b1.normalize ? _b1.normalize(_b2, function (mid) {
return _b4(mid, _b3);
}) : _b4(_b2, _b3);
},
_b5 = 0,
_31 = function (mid, _b6, _b7) {
var _b8, _b9, _ba, _bb;
_b8 = mid.match(/^(.+?)\!(.*)$/);
if (_b8) {
_b9 = _31(_b8[1], _b6, _b7);
if (1 && _25 == _26 && !_b9.executed) {
_32(_b9);
if (_b9.injected === _21 && !_b9.executed) {
_37(function () {
_36(_b9);
});
}
if (_b9.executed) {
_bc(_b9);
} else {
_30.unshift(_b9);
}
}
if (_b9.executed === _24 && !_b9.load) {
_bc(_b9);
}
if (_b9.load) {
_ba = _b0(_b9, _b8[2], _b6);
mid = (_b9.mid + "!" + (_b9.dynamic ? ++_b5 + "!" : "") + _ba);
} else {
_ba = _b8[2];
mid = _b9.mid + "!" + (++_b5) + "!waitingForPlugin";
}
_bb = {
plugin: _b9,
mid: mid,
req: _5c(_b6),
prid: _ba
};
} else {
_bb = _5b(mid, _b6);
}
return _2f[_bb.mid] || (!_b7 && (_2f[_bb.mid] = _bb));
},
_b4 = req.toAbsMid = function (mid, _bd) {
return _5b(mid, _bd).mid;
},
_5a = req.toUrl = function (_be, _bf) {
var _c0 = _5b(_be + "/x", _bf),
url = _c0.url;
return _3f(_c0.pid === 0 ? _be : url.substring(0, url.length - 5));
},
_c1 = {
injected: _21,
executed: _24,
def: _22,
result: _22
},
_c2 = function (mid) {
return _2f[mid] = _c({
mid: mid
}, _c1);
},
_c3 = _c2("require"),
_c4 = _c2("exports"),
_c5 = _c2("module"),
_c6 = function (_c7, _c8) {
req.trace("loader-run-factory", [_c7.mid]);
var _c9 = _c7.def,
_ca;
1 && _27.unshift(_c7);
if (has("config-dojo-loader-catches")) {
try {
_ca = _6(_c9) ? _c9.apply(null, _c8) : _c9;
} catch (e) {
_34(_44, _c7.result = _f("factoryThrew", [_c7, e]));
}
} else {
_ca = _6(_c9) ? _c9.apply(null, _c8) : _c9;
}
_c7.result = _ca === undefined && _c7.cjs ? _c7.cjs.exports : _ca;
1 && _27.shift(_c7);
},
_cb = {},
_cc = 0,
_bc = function (_cd) {
var _ce = _cd.result;
_cd.dynamic = _ce.dynamic;
_cd.normalize = _ce.normalize;
_cd.load = _ce.load;
return _cd;
},
_cf = function (_d0) {
var map = {};
_9(_d0.loadQ, function (_d1) {
var _d2 = _b0(_d0, _d1.prid, _d1.req.module),
mid = _d0.dynamic ? _d1.mid.replace(/waitingForPlugin$/, _d2) : (_d0.mid + "!" + _d2),
_d3 = _c(_c({}, _d1), {
mid: mid,
prid: _d2,
injected: 0
});
if (!_2f[mid]) {
_e5(_2f[mid] = _d3);
}
map[_d1.mid] = _2f[mid];
_33(_d1);
delete _2f[_d1.mid];
});
_d0.loadQ = 0;
var _d4 = function (_d5) {
for (var _d6, _d7 = _d5.deps || [], i = 0; i < _d7.length; i++) {
_d6 = map[_d7[i].mid];
if (_d6) {
_d7[i] = _d6;
}
}
};
for (var p in _2f) {
_d4(_2f[p]);
}
_9(_30, _d4);
},
_35 = function (_d8) {
req.trace("loader-finish-exec", [_d8.mid]);
_d8.executed = _24;
_d8.defOrder = _cc++;
1 && _9(_d8.provides, function (cb) {
cb();
});
if (_d8.loadQ) {
_bc(_d8);
_cf(_d8);
}
for (i = 0; i < _30.length;) {
if (_30[i] === _d8) {
_30.splice(i, 1);
} else {
i++;
}
}
if (/^require\*/.test(_d8.mid)) {
delete _2f[_d8.mid];
}
},
_d9 = [],
_36 = function (_da, _db) {
if (_da.executed === _23) {
req.trace("loader-circular-dependency", [_d9.concat(_da.mid).join("->")]);
return (!_da.def || _db) ? _cb : (_da.cjs && _da.cjs.exports);
}
if (!_da.executed) {
if (!_da.def) {
return _cb;
}
var mid = _da.mid,
_dc = _da.deps || [],
arg, _dd, _de = [],
i = 0;
if (0) {
_d9.push(mid);
req.trace("loader-exec-module", ["exec", _d9.length, mid]);
}
_da.executed = _23;
while (i < _dc.length) {
arg = _dc[i++];
_dd = ((arg === _c3) ? _5c(_da) : ((arg === _c4) ? _da.cjs.exports : ((arg === _c5) ? _da.cjs : _36(arg, _db))));
if (_dd === _cb) {
_da.executed = 0;
req.trace("loader-exec-module", ["abort", mid]);
0 && _d9.pop();
return _cb;
}
_de.push(_dd);
}
_c6(_da, _de);
_35(_da);
0 && _d9.pop();
}
return _da.result;
},
_84 = 0,
_37 = function (_df) {
try {
_84++;
_df();
} finally {
_84--;
}
if (_93()) {
_34("idle", []);
}
},
_7b = function () {
if (_84) {
return;
}
_37(function () {
_29();
for (var _e0, _e1, i = 0; i < _30.length;) {
_e0 = _cc;
_e1 = _30[i];
_36(_e1);
if (_e0 != _cc) {
_29();
i = 0;
} else {
i++;
}
}
});
};
if (has("dojo-undef-api")) {
req.undef = function (_e2, _e3) {
var _e4 = _31(_e2, _e3);
_33(_e4);
delete _2f[_e4.mid];
};
}
if (1) {
if (has("dojo-loader-eval-hint-url") === undefined) {
has.add("dojo-loader-eval-hint-url", 1);
}
var _3f = function (url) {
url += "";
return url + (_51 ? ((/\?/.test(url) ? "&" : "?") + _51) : "");
},
_e5 = function (_e6) {
var _e7 = _e6.plugin;
if (_e7.executed === _24 && !_e7.load) {
_bc(_e7);
}
var _e8 = function (def) {
_e6.result = def;
_33(_e6);
_35(_e6);
_7b();
};
if (_e7.load) {
_e7.load(_e6.prid, _e6.req, _e8);
} else {
if (_e7.loadQ) {
_e7.loadQ.push(_e6);
} else {
_e7.loadQ = [_e6];
_30.unshift(_e7);
_32(_e7);
}
}
},
_8a = 0,
_7c = 0,
_e9 = 0,
_8b = function (_ea, _eb) {
if (has("config-stripStrict")) {
_ea = _ea.replace(/"use strict"/g, "");
}
_e9 = 1;
if (has("config-dojo-loader-catches")) {
try {
if (_ea === _8a) {
_8a.call(null);
} else {
req.eval(_ea, has("dojo-loader-eval-hint-url") ? _eb.url : _eb.mid);
}
} catch (e) {
_34(_44, _f("evalModuleThrew", _eb));
}
} else {
if (_ea === _8a) {
_8a.call(null);
} else {
req.eval(_ea, has("dojo-loader-eval-hint-url") ? _eb.url : _eb.mid);
}
}
_e9 = 0;
},
_32 = function (_ec) {
var mid = _ec.mid,
url = _ec.url;
if (_ec.executed || _ec.injected || _8d[mid] || (_ec.url && ((_ec.pack && _8d[_ec.url] === _ec.pack) || _8d[_ec.url] == 1))) {
return;
}
_8e(_ec);
if (0) {
var _ed = 0;
if (_ec.plugin && _ec.plugin.isCombo) {
req.combo.add(_ec.plugin.mid, _ec.prid, 0, req);
_ed = 1;
} else {
if (!_ec.plugin) {
_ed = req.combo.add(0, _ec.mid, _ec.url, req);
}
}
if (_ed) {
_73 = 1;
return;
}
}
if (_ec.plugin) {
_e5(_ec);
return;
}
var _ee = function () {
_7a(_ec);
if (_ec.injected !== _21) {
_33(_ec);
_c(_ec, _c1);
req.trace("loader-define-nonmodule", [_ec.url]);
}
if (1 && _25) {
!_27.length && _7b();
} else {
_7b();
}
};
_8a = _52[mid] || _52[_53 + _ec.url];
if (_8a) {
req.trace("loader-inject", ["cache", _ec.mid, url]);
_8b(_8a, _ec);
_ee();
return;
}
if (1 && _25) {
if (_ec.isXd) {
_25 == _26 && (_25 = xd);
} else {
if (_ec.isAmd && _25 != _26) {} else {
var _ef = function (_f0) {
if (_25 == _26) {
_27.unshift(_ec);
_8b(_f0, _ec);
_27.shift();
_7a(_ec);
if (!_ec.cjs) {
_33(_ec);
_35(_ec);
}
if (_ec.finish) {
var _f1 = mid + "*finish",
_f2 = _ec.finish;
delete _ec.finish;
def(_f1, ["dojo", ("dojo/require!" + _f2.join(",")).replace(/\./g, "/")], function (_f3) {
_9(_f2, function (mid) {
_f3.require(mid);
});
});
_30.unshift(_31(_f1));
}
_ee();
} else {
_f0 = _2a(_ec, _f0);
if (_f0) {
_8b(_f0, _ec);
_ee();
} else {
_7c = _ec;
req.injectUrl(_3f(url), _ee, _ec);
_7c = 0;
}
}
};
req.trace("loader-inject", ["xhr", _ec.mid, url, _25 != _26]);
if (has("config-dojo-loader-catches")) {
try {
req.getText(url, _25 != _26, _ef);
} catch (e) {
_34(_44, _f("xhrInjectFailed", [_ec, e]));
}
} else {
req.getText(url, _25 != _26, _ef);
}
return;
}
}
}
req.trace("loader-inject", ["script", _ec.mid, url]);
_7c = _ec;
req.injectUrl(_3f(url), _ee, _ec);
_7c = 0;
},
_f4 = function (_f5, _f6, def) {
req.trace("loader-define-module", [_f5.mid, _f6]);
if (0 && _f5.plugin && _f5.plugin.isCombo) {
_f5.result = _6(def) ? def() : def;
_33(_f5);
_35(_f5);
return _f5;
}
var mid = _f5.mid;
if (_f5.injected === _21) {
_34(_44, _f("multipleDefine", _f5));
return _f5;
}
_c(_f5, {
deps: _f6,
def: def,
cjs: {
id: _f5.mid,
uri: _f5.url,
exports: (_f5.result = {}),
setExports: function (_f7) {
_f5.cjs.exports = _f7;
},
config: function () {
return _f5.config;
}
}
});
for (var i = 0; i < _f6.length; i++) {
_f6[i] = _31(_f6[i], _f5);
}
if (1 && _25 && !_8d[mid]) {
_76(_f5);
_30.push(_f5);
_7b();
}
_33(_f5);
if (!_6(def) && !_f6.length) {
_f5.result = def;
_35(_f5);
}
return _f5;
},
_7a = function (_f8, _f9) {
var _fa = [],
_fb, _fc;
while (_8c.length) {
_fc = _8c.shift();
_f9 && (_fc[0] = _f9.shift());
_fb = (_fc[0] && _31(_fc[0])) || _f8;
_fa.push([_fb, _fc[1], _fc[2]]);
}
_56(_f8);
_9(_fa, function (_fd) {
_76(_f4.apply(null, _fd));
});
};
}
var _fe = 0,
_92 = _3,
_90 = _3;
if (1) {
_92 = function () {
_fe && clearTimeout(_fe);
_fe = 0;
}, _90 = function () {
_92();
if (req.waitms) {
_fe = window.setTimeout(function () {
_92();
_34(_44, _f("timeout", _8d));
}, req.waitms);
}
};
}
if (1) {
has.add("ie-event-behavior", !! doc.attachEvent && (typeof opera === "undefined" || opera.toString() != "[object Opera]"));
}
if (1 && (1 || 1)) {
var _ff = function (node, _100, _101, _102) {
if (!has("ie-event-behavior")) {
node.addEventListener(_100, _102, false);
return function () {
node.removeEventListener(_100, _102, false);
};
} else {
node.attachEvent(_101, _102);
return function () {
node.detachEvent(_101, _102);
};
}
},
_103 = _ff(window, "load", "onload", function () {
req.pageLoaded = 1;
doc.readyState != "complete" && (doc.readyState = "complete");
_103();
});
if (1) {
var _104 = doc.getElementsByTagName("script")[0],
_105 = _104.parentNode;
req.injectUrl = function (url, _106, _107) {
var node = _107.node = doc.createElement("script"),
_108 = function (e) {
e = e || window.event;
var node = e.target || e.srcElement;
if (e.type === "load" || /complete|loaded/.test(node.readyState)) {
_109();
_10a();
_106 && _106();
}
},
_109 = _ff(node, "load", "onreadystatechange", _108),
_10a = _ff(node, "error", "onerror", function (e) {
_109();
_10a();
_34(_44, _f("scriptError", [url, e]));
});
node.type = "text/javascript";
node.charset = "utf-8";
node.src = url;
_105.insertBefore(node, _104);
return node;
};
}
}
if (1) {
req.log = function () {
try {
for (var i = 0; i < arguments.length; i++) {
console.log(arguments[i]);
}
} catch (e) {}
};
} else {
req.log = _3;
}
if (0) {
var _10b = req.trace = function (_10c, args) {
if (_10b.on && _10b.group[_10c]) {
_34("trace", [_10c, args]);
for (var arg, dump = [], text = "trace:" + _10c + (args.length ? (":" + args[0]) : ""), i = 1; i < args.length;) {
arg = args[i++];
if (_7(arg)) {
text += ", " + arg;
} else {
dump.push(arg);
}
}
req.log(text);
dump.length && dump.push(".");
req.log.apply(req, dump);
}
};
_c(_10b, {
on: 1,
group: {},
set: function (_10d, _10e) {
if (_7(_10d)) {
_10b.group[_10d] = _10e;
} else {
_c(_10b.group, _10d);
}
}
});
_10b.set(_c(_c(_c({}, _2.trace), _1.trace), _55.trace));
on("config", function (_10f) {
_10f.trace && _10b.set(_10f.trace);
});
} else {
req.trace = _3;
}
var def = function (mid, _110, _111) {
var _112 = arguments.length,
_113 = ["require", "exports", "module"],
args = [0, mid, _110];
if (_112 == 1) {
args = [0, (_6(mid) ? _113 : []), mid];
} else {
if (_112 == 2 && _7(mid)) {
args = [mid, (_6(_110) ? _113 : []), _110];
} else {
if (_112 == 3) {
args = [mid, _110, _111];
}
}
}
if (0 && args[1] === _113) {
args[2].toString().replace(/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg, "").replace(/require\(["']([\w\!\-_\.\/]+)["']\)/g, function (_114, dep) {
args[1].push(dep);
});
}
req.trace("loader-define", args.slice(0, 2));
var _115 = args[0] && _31(args[0]),
_116;
if (_115 && !_8d[_115.mid]) {
_76(_f4(_115, args[1], args[2]));
} else {
if (!has("ie-event-behavior") || !1 || _e9) {
_8c.push(args);
} else {
_115 = _115 || _7c;
if (!_115) {
for (mid in _8d) {
_116 = _2f[mid];
if (_116 && _116.node && _116.node.readyState === "interactive") {
_115 = _116;
break;
}
}
if (0 && !_115) {
for (var i = 0; i < _74.length; i++) {
_115 = _74[i];
if (_115.node && _115.node.readyState === "interactive") {
break;
}
_115 = 0;
}
}
}
if (0 && _8(_115)) {
_76(_f4(_31(_115.shift()), args[1], args[2]));
if (!_115.length) {
_74.splice(i, 1);
}
} else {
if (_115) {
_56(_115);
_76(_f4(_115, args[1], args[2]));
} else {
_34(_44, _f("ieDefineFailed", args[0]));
}
}
_7b();
}
}
};
def.amd = {
vendor: "dojotoolkit.org"
};
if (0) {
req.def = def;
}
_c(_c(req, _2.loaderPatch), _1.loaderPatch);
on(_44, function (arg) {
try {
console.error(arg);
if (arg instanceof Error) {
for (var p in arg) {
console.log(p + ":", arg[p]);
}
console.log(".");
}
} catch (e) {}
});
_c(req, {
uid: uid,
cache: _52,
packs: _4f
});
if (0) {
_c(req, {
paths: _4d,
aliases: _4c,
modules: _2f,
legacyMode: _25,
execQ: _30,
defQ: _8c,
waiting: _8d,
packs: _4f,
mapProgs: _50,
pathsMapProg: _4e,
listenerQueues: _43,
computeMapProg: _5e,
runMapProg: _94,
compactPath: _96,
getModuleInfo: _9c
});
}
if (_17.define) {
if (1) {
_34(_44, _f("defineAlreadyDefined", 0));
}
return;
} else {
_17.define = def;
_17.require = req;
if (0) {
require = req;
}
}
if (0 && req.combo && req.combo.plugins) {
var _117 = req.combo.plugins,
_118;
for (_118 in _117) {
_c(_c(_31(_118), _117[_118]), {
isCombo: 1,
executed: "executed",
load: 1
});
}
}
if (1) {
_9(_63, function (c) {
_64(c);
});
var _119 = _55.deps || _1.deps || _2.deps,
_11a = _55.callback || _1.callback || _2.callback;
req.boot = (_119 || _11a) ? [_119 || [], _11a] : 0;
}
if (!1) {
!req.async && req(["dojo"]);
req.boot && req.apply(null, req.boot);
}
})(this.dojoConfig || this.djConfig || this.require || {}, {
async: 0,
baseUrl: (location.protocol === 'file:' ? 'http:' : location.protocol) + '//' + "js.arcgis.com/3.6/js/dojo/dojo",
hasCache: {
"config-selectorEngine": "acme",
"config-tlmSiblingOfDojo": 1,
"dojo-built": 1,
"dojo-loader": 1,
"dojo-undef-api": 0,
dom: 1,
"extend-esri": 1,
"host-browser": 1
},
packages: [{
location: "../dojox",
name: "dojox"
}, {
location: "../../dgrid",
main: "OnDemandGrid",
name: "dgrid"
}, {
location: "../dijit",
name: "dijit"
}, {
location: "../../xstyle",
main: "css",
name: "xstyle"
}, {
location: "../../esri",
name: "esri"
}, {
location: ".",
name: "dojo"
}, {
location: "../../put-selector",
main: "put",
name: "put-selector"
}]
});
require({
cache: {
"dojo/_base/fx": function () {
define(["./kernel", "./config", "./lang", "../Evented", "./Color", "./connect", "./sniff", "../dom", "../dom-style"], function (dojo, _11b, lang, _11c, _11d, _11e, has, dom, _11f) {
var _120 = lang.mixin;
var _121 = {};
var _122 = _121._Line = function (_123, end) {
this.start = _123;
this.end = end;
};
_122.prototype.getValue = function (n) {
return ((this.end - this.start) * n) + this.start;
};
var _124 = _121.Animation = function (args) {
_120(this, args);
if (lang.isArray(this.curve)) {
this.curve = new _122(this.curve[0], this.curve[1]);
}
};
_124.prototype = new _11c();
lang.extend(_124, {
duration: 350,
repeat: 0,
rate: 20,
_percent: 0,
_startRepeatCount: 0,
_getStep: function () {
var _125 = this._percent,
_126 = this.easing;
return _126 ? _126(_125) : _125;
},
_fire: function (evt, args) {
var a = args || [];
if (this[evt]) {
if (_11b.debugAtAllCosts) {
this[evt].apply(this, a);
} else {
try {
this[evt].apply(this, a);
} catch (e) {
console.error("exception in animation handler for:", evt);
console.error(e);
}
}
}
return this;
},
play: function (_127, _128) {
var _129 = this;
if (_129._delayTimer) {
_129._clearTimer();
}
if (_128) {
_129._stopTimer();
_129._active = _129._paused = false;
_129._percent = 0;
} else {
if (_129._active && !_129._paused) {
return _129;
}
}
_129._fire("beforeBegin", [_129.node]);
var de = _127 || _129.delay,
_12a = lang.hitch(_129, "_play", _128);
if (de > 0) {
_129._delayTimer = setTimeout(_12a, de);
return _129;
}
_12a();
return _129;
},
_play: function (_12b) {
var _12c = this;
if (_12c._delayTimer) {
_12c._clearTimer();
}
_12c._startTime = new Date().valueOf();
if (_12c._paused) {
_12c._startTime -= _12c.duration * _12c._percent;
}
_12c._active = true;
_12c._paused = false;
var _12d = _12c.curve.getValue(_12c._getStep());
if (!_12c._percent) {
if (!_12c._startRepeatCount) {
_12c._startRepeatCount = _12c.repeat;
}
_12c._fire("onBegin", [_12d]);
}
_12c._fire("onPlay", [_12d]);
_12c._cycle();
return _12c;
},
pause: function () {
var _12e = this;
if (_12e._delayTimer) {
_12e._clearTimer();
}
_12e._stopTimer();
if (!_12e._active) {
return _12e;
}
_12e._paused = true;
_12e._fire("onPause", [_12e.curve.getValue(_12e._getStep())]);
return _12e;
},
gotoPercent: function (_12f, _130) {
var _131 = this;
_131._stopTimer();
_131._active = _131._paused = true;
_131._percent = _12f;
if (_130) {
_131.play();
}
return _131;
},
stop: function (_132) {
var _133 = this;
if (_133._delayTimer) {
_133._clearTimer();
}
if (!_133._timer) {
return _133;
}
_133._stopTimer();
if (_132) {
_133._percent = 1;
}
_133._fire("onStop", [_133.curve.getValue(_133._getStep())]);
_133._active = _133._paused = false;
return _133;
},
status: function () {
if (this._active) {
return this._paused ? "paused" : "playing";
}
return "stopped";
},
_cycle: function () {
var _134 = this;
if (_134._active) {
var curr = new Date().valueOf();
var step = _134.duration === 0 ? 1 : (curr - _134._startTime) / (_134.duration);
if (step >= 1) {
step = 1;
}
_134._percent = step;
if (_134.easing) {
step = _134.easing(step);
}
_134._fire("onAnimate", [_134.curve.getValue(step)]);
if (_134._percent < 1) {
_134._startTimer();
} else {
_134._active = false;
if (_134.repeat > 0) {
_134.repeat--;
_134.play(null, true);
} else {
if (_134.repeat == -1) {
_134.play(null, true);
} else {
if (_134._startRepeatCount) {
_134.repeat = _134._startRepeatCount;
_134._startRepeatCount = 0;
}
}
}
_134._percent = 0;
_134._fire("onEnd", [_134.node]);
!_134.repeat && _134._stopTimer();
}
}
return _134;
},
_clearTimer: function () {
clearTimeout(this._delayTimer);
delete this._delayTimer;
}
});
var ctr = 0,
_135 = null,
_136 = {
run: function () {}
};
lang.extend(_124, {
_startTimer: function () {
if (!this._timer) {
this._timer = _11e.connect(_136, "run", this, "_cycle");
ctr++;
}
if (!_135) {
_135 = setInterval(lang.hitch(_136, "run"), this.rate);
}
},
_stopTimer: function () {
if (this._timer) {
_11e.disconnect(this._timer);
this._timer = null;
ctr--;
}
if (ctr <= 0) {
clearInterval(_135);
_135 = null;
ctr = 0;
}
}
});
var _137 = has("ie") ?
function (node) {
var ns = node.style;
if (!ns.width.length && _11f.get(node, "width") == "auto") {
ns.width = "auto";
}
} : function () {};
_121._fade = function (args) {
args.node = dom.byId(args.node);
var _138 = _120({
properties: {}
}, args),
_139 = (_138.properties.opacity = {});
_139.start = !("start" in _138) ?
function () {
return +_11f.get(_138.node, "opacity") || 0;
} : _138.start;
_139.end = _138.end;
var anim = _121.animateProperty(_138);
_11e.connect(anim, "beforeBegin", lang.partial(_137, _138.node));
return anim;
};
_121.fadeIn = function (args) {
return _121._fade(_120({
end: 1
}, args));
};
_121.fadeOut = function (args) {
return _121._fade(_120({
end: 0
}, args));
};
_121._defaultEasing = function (n) {
return 0.5 + ((Math.sin((n + 1.5) * Math.PI)) / 2);
};
var _13a = function (_13b) {
this._properties = _13b;
for (var p in _13b) {
var prop = _13b[p];
if (prop.start instanceof _11d) {
prop.tempColor = new _11d();
}
}
};
_13a.prototype.getValue = function (r) {
var ret = {};
for (var p in this._properties) {
var prop = this._properties[p],
_13c = prop.start;
if (_13c instanceof _11d) {
ret[p] = _11d.blendColors(_13c, prop.end, r, prop.tempColor).toCss();
} else {
if (!lang.isArray(_13c)) {
ret[p] = ((prop.end - _13c) * r) + _13c + (p != "opacity" ? prop.units || "px" : 0);
}
}
}
return ret;
};
_121.animateProperty = function (args) {
var n = args.node = dom.byId(args.node);
if (!args.easing) {
args.easing = dojo._defaultEasing;
}
var anim = new _124(args);
_11e.connect(anim, "beforeBegin", anim, function () {
var pm = {};
for (var p in this.properties) {
if (p == "width" || p == "height") {
this.node.display = "block";
}
var prop = this.properties[p];
if (lang.isFunction(prop)) {
prop = prop(n);
}
prop = pm[p] = _120({}, (lang.isObject(prop) ? prop : {
end: prop
}));
if (lang.isFunction(prop.start)) {
prop.start = prop.start(n);
}
if (lang.isFunction(prop.end)) {
prop.end = prop.end(n);
}
var _13d = (p.toLowerCase().indexOf("color") >= 0);
function _13e(node, p) {
var v = {
height: node.offsetHeight,
width: node.offsetWidth
}[p];
if (v !== undefined) {
return v;
}
v = _11f.get(node, p);
return (p == "opacity") ? +v : (_13d ? v : parseFloat(v));
};
if (!("end" in prop)) {
prop.end = _13e(n, p);
} else {
if (!("start" in prop)) {
prop.start = _13e(n, p);
}
}
if (_13d) {
prop.start = new _11d(prop.start);
prop.end = new _11d(prop.end);
} else {
prop.start = (p == "opacity") ? +prop.start : parseFloat(prop.start);
}
}
this.curve = new _13a(pm);
});
_11e.connect(anim, "onAnimate", lang.hitch(_11f, "set", anim.node));
return anim;
};
_121.anim = function (node, _13f, _140, _141, _142, _143) {
return _121.animateProperty({
node: node,
duration: _140 || _124.prototype.duration,
properties: _13f,
easing: _141,
onEnd: _142
}).play(_143 || 0);
};
if (1) {
_120(dojo, _121);
dojo._Animation = _124;
}
return _121;
});
},
"dojo/dom-form": function () {
define(["./_base/lang", "./dom", "./io-query", "./json"], function (lang, dom, ioq, json) {
function _144(obj, name, _145) {
if (_145 === null) {
return;
}
var val = obj[name];
if (typeof val == "string") {
obj[name] = [val, _145];
} else {
if (lang.isArray(val)) {
val.push(_145);
} else {
obj[name] = _145;
}
}
};
var _146 = "file|submit|image|reset|button";
var form = {
fieldToObject: function fieldToObject(_147) {
var ret = null;
_147 = dom.byId(_147);
if (_147) {
var _148 = _147.name,
type = (_147.type || "").toLowerCase();
if (_148 && type && !_147.disabled) {
if (type == "radio" || type == "checkbox") {
if (_147.checked) {
ret = _147.value;
}
} else {
if (_147.multiple) {
ret = [];
var _149 = [_147.firstChild];
while (_149.length) {
for (var node = _149.pop(); node; node = node.nextSibling) {
if (node.nodeType == 1 && node.tagName.toLowerCase() == "option") {
if (node.selected) {
ret.push(node.value);
}
} else {
if (node.nextSibling) {
_149.push(node.nextSibling);
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment