iobroker.vis-2
Version:
Next generation graphical user interface for ioBroker.
992 lines (988 loc) • 118 kB
JavaScript
/*!
* CanJS - 2.3.25
* http://canjs.com/
* Copyright (c) 2016 Bitovi
* Sun, 14 Aug 2016 06:25:49 GMT
* Licensed MIT
* Includes: can/construct/construct,can/map/map,can/list/list,can/compute/compute,can/view/view,can/view/ejs/ejs
* Download from: http://bitbuilder.herokuapp.com/can.custom.js?configuration=jquery&minify=true&plugins=can%2Fconstruct%2Fconstruct&plugins=can%2Fmap%2Fmap&plugins=can%2Flist%2Flist&plugins=can%2Fcompute%2Fcompute&plugins=can%2Fview%2Fview&plugins=can%2Fview%2Fejs%2Fejs
*/
/*[global-shim-start]*/
!function (exports, global) {
var origDefine = global.define, get = function (e) {
var o, l = e.split("."), n = global;
for (o = 0; o < l.length && n; o++) n = n[l[o]];
return n
}, modules = global.define && global.define.modules || global._define && global._define.modules || {},
ourDefine = global.define = function (e, o, l) {
var n;
"function" == typeof o && (l = o, o = []);
var r, t = [];
for (r = 0; r < o.length; r++) t.push(exports[o[r]] ? get(exports[o[r]]) : modules[o[r]] || get(o[r]));
if (!o.length && l.length) {
n = {exports: {}};
var i = function (e) {
return exports[e] ? get(exports[e]) : modules[e]
};
t.push(i, n.exports, n)
} else t[0] || "exports" !== o[0] ? t[0] || "module" !== o[0] || (t[0] = {id: e}) : (n = {exports: {}}, t[0] = n.exports, "module" === o[1] && (t[1] = n));
global.define = origDefine;
var a = l ? l.apply(null, t) : void 0;
global.define = ourDefine, modules[e] = n && n.exports ? n.exports : a
};
global.define.orig = origDefine, global.define.modules = modules, global.define.amd = !0, ourDefine("@loader", [], function () {
var noop = function () {
};
return {
get: function () {
return {prepareGlobal: noop, retrieveGlobal: noop}
}, global: global, __exec: function (__load) {
eval("(function() { " + __load.source + " \n }).call(global);")
}
}
})
}({}, window);
/*can/util/can*/
define("can/util/can", [], function () {
var e = "undefined" != typeof window ? window : "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope ? self : global,
n = {};
("undefined" == typeof GLOBALCAN || GLOBALCAN !== !1) && (e.can = n), n.global = e, n.k = function () {
}, n.isDeferred = function (e) {
return n.dev && n.dev.warn("can.isDeferred: this function is deprecated and will be removed in a future release. can.isPromise replaces the functionality of can.isDeferred."), e && "function" == typeof e.then && "function" == typeof e.pipe
}, n.isPromise = function (e) {
return !!e && (window.Promise && e instanceof Promise || n.isFunction(e.then) && (void 0 === n.List || !(e instanceof n.List)))
}, n.isMapLike = function (e) {
return n.Map && (e instanceof n.Map || e && e.___get)
};
var t = 0;
n.cid = function (e, n) {
return e._cid || (t++, e._cid = (n || "") + t), e._cid
}, n.VERSION = "@EDGE", n.simpleExtend = function (e, n) {
for (var t in n) e[t] = n[t];
return e
}, n.last = function (e) {
return e && e[e.length - 1]
}, n.isDOM = function (e) {
return (e.ownerDocument || e) === n.global.document
}, n.childNodes = function (e) {
var n = e.childNodes;
if ("length" in n) return n;
for (var t = e.firstChild, o = []; t;) o.push(t), t = t.nextSibling;
return o
};
var o = Function.prototype.bind;
o ? n.proxy = function (e, n) {
return o.call(e, n)
} : n.proxy = function (e, n) {
return function () {
return e.apply(n, arguments)
}
}, n.frag = function (e, t) {
var o, r = t || n.document || n.global.document;
return e && "string" != typeof e ? 11 === e.nodeType ? e : "number" == typeof e.nodeType ? (o = r.createDocumentFragment(), o.appendChild(e), o) : "number" == typeof e.length ? (o = r.createDocumentFragment(), n.each(e, function (e) {
o.appendChild(n.frag(e))
}), n.childNodes(o).length || o.appendChild(r.createTextNode("")), o) : (o = n.buildFragment("" + e, r), n.childNodes(o).length || o.appendChild(r.createTextNode("")), o) : (o = n.buildFragment(null == e ? "" : "" + e, r), o.childNodes.length || o.appendChild(r.createTextNode("")), o)
}, n.scope = n.viewModel = function (e, t, o) {
e = n.$(e);
var r = n.data(e, "scope") || n.data(e, "viewModel");
switch (r || (r = new n.Map, n.data(e, "scope", r), n.data(e, "viewModel", r)), arguments.length) {
case 0:
case 1:
return r;
case 2:
return r.attr(t);
default:
return r.attr(t, o), e
}
};
var r = function (e) {
var n = String(e).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
return n ? {
href: n[0] || "",
protocol: n[1] || "",
authority: n[2] || "",
host: n[3] || "",
hostname: n[4] || "",
port: n[5] || "",
pathname: n[6] || "",
search: n[7] || "",
hash: n[8] || ""
} : null
};
return n.joinURIs = function (e, n) {
function t(e) {
var n = [];
return e.replace(/^(\.\.?(\/|$))+/, "").replace(/\/(\.(\/|$))+/g, "/").replace(/\/\.\.$/, "/../").replace(/\/?[^\/]*/g, function (e) {
"/.." === e ? n.pop() : n.push(e)
}), n.join("").replace(/^\//, "/" === e.charAt(0) ? "/" : "")
}
return n = r(n || ""), e = r(e || ""), n && e ? (n.protocol || e.protocol) + (n.protocol || n.authority ? n.authority : e.authority) + t(n.protocol || n.authority || "/" === n.pathname.charAt(0) ? n.pathname : n.pathname ? (e.authority && !e.pathname ? "/" : "") + e.pathname.slice(0, e.pathname.lastIndexOf("/") + 1) + n.pathname : e.pathname) + (n.protocol || n.authority || n.pathname ? n.search : n.search || e.search) + n.hash : null
}, n["import"] = function (e, t) {
var o = new n.Deferred;
return "object" == typeof window.System && n.isFunction(window.System["import"]) ? window.System["import"](e, {name: t}).then(n.proxy(o.resolve, o), n.proxy(o.reject, o)) : window.define && window.define.amd ? window.require([e], function (e) {
o.resolve(e)
}) : window.steal ? steal.steal(e, function (e) {
o.resolve(e)
}) : window.require ? o.resolve(window.require(e)) : o.resolve(), o.promise()
}, n.__observe = function () {
}, n.isNode = "object" == typeof process && "[object process]" === {}.toString.call(process), n.isBrowserWindow = "undefined" != typeof window && "undefined" != typeof document && "undefined" == typeof SimpleDOM, n.isWebWorker = "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope, n
});
/*can/util/attr/attr*/
define("can/util/attr/attr", ["can/util/can"], function (t) {
var e = t.global.setImmediate || function (t) {
return setTimeout(t, 0)
}, r = {input: !0, textarea: !0, select: !0}, n = function (e, n) {
return n in e || t.document && r[e.nodeName.toLowerCase()]
}, a = {
MutationObserver: t.global.MutationObserver || t.global.WebKitMutationObserver || t.global.MozMutationObserver,
map: {
"class": function (t, e) {
return e = e || "", "http://www.w3.org/2000/svg" === t.namespaceURI ? t.setAttribute("class", e) : t.className = e, e
},
value: "value",
innertext: "innerText",
innerhtml: "innerHTML",
textcontent: "textContent",
"for": "htmlFor",
checked: !0,
disabled: !0,
readonly: function (t, e) {
return t.readOnly = e || "string" == typeof e ? !0 : !1, e
},
required: !0,
src: function (t, e) {
return null == e || "" === e ? (t.removeAttribute("src"), null) : (t.setAttribute("src", e), e)
},
style: function () {
var e = t.global.document && document.createElement("div");
return e && e.style && "cssText" in e.style ? function (t, e) {
return t.style.cssText = e || ""
} : function (t, e) {
return t.setAttribute("style", e)
}
}()
},
defaultValue: ["input", "textarea"],
setAttrOrProp: function (t, e, r) {
e = e.toLowerCase();
var n = a.map[e];
n !== !0 || r ? this.set(t, e, r) : this.remove(t, e)
},
setSelectValue: function (t, e) {
if (null != e) for (var r = t.getElementsByTagName("option"), n = 0; n < r.length; n++) if (e == r[n].value) return void (r[n].selected = !0);
t.selectedIndex = -1
},
set: function (e, r, u) {
var o = t.isDOM(e) && a.MutationObserver;
r = r.toLowerCase();
var i;
o || (i = a.get(e, r));
var s, l = a.map[r];
"function" == typeof l ? s = l(e, u) : l === !0 && n(e, r) ? (s = e[r] = !0, "checked" === r && "radio" === e.type && t.inArray((e.nodeName + "").toLowerCase(), a.defaultValue) >= 0 && (e.defaultChecked = !0)) : "string" == typeof l && n(e, l) ? (s = u, (e[l] !== u || "OPTION" === e.nodeName.toUpperCase()) && (e[l] = u), "value" === l && t.inArray((e.nodeName + "").toLowerCase(), a.defaultValue) >= 0 && (e.defaultValue = u)) : a.setAttribute(e, r, u), o || s === i || a.trigger(e, r, i)
},
setAttribute: function () {
var e = t.global.document;
if (e && document.createAttribute) try {
e.createAttribute("{}")
} catch (r) {
var n = {}, a = document.createElement("div");
return function (t, e, r) {
var u, o, i = e.charAt(0);
"{" !== i && "(" !== i && "*" !== i || !t.setAttributeNode ? t.setAttribute(e, r) : (u = n[e], u || (a.innerHTML = "<div " + e + '=""></div>', u = n[e] = a.childNodes[0].attributes[0]), o = u.cloneNode(), o.value = r, t.setAttributeNode(o))
}
}
return function (t, e, r) {
t.setAttribute(e, r)
}
}(),
trigger: function (r, n, a) {
return t.data(t.$(r), "canHasAttributesBindings") ? (n = n.toLowerCase(), e(function () {
t.trigger(r, {type: "attributes", attributeName: n, target: r, oldValue: a, bubbles: !1}, [])
})) : void 0
},
get: function (t, e) {
e = e.toLowerCase();
var r = a.map[e];
return "string" == typeof r && n(t, r) ? t[r] : r === !0 && n(t, e) ? t[e] : t.getAttribute(e)
},
remove: function (t, e) {
e = e.toLowerCase();
var r;
a.MutationObserver || (r = a.get(t, e));
var u = a.map[e];
"function" == typeof u && u(t, void 0), u === !0 && n(t, e) ? t[e] = !1 : "string" == typeof u && n(t, u) ? t[u] = "" : t.removeAttribute(e), a.MutationObserver || null == r || a.trigger(t, e, r)
},
has: function () {
var e = t.global.document && document.createElement("div");
return e && e.hasAttribute ? function (t, e) {
return t.hasAttribute(e)
} : function (t, e) {
return null !== t.getAttribute(e)
}
}()
};
return a
});
/*can/event/event*/
define("can/event/event", ["can/util/can"], function (t) {
return t.addEvent = function (t, n) {
var e = this.__bindEvents || (this.__bindEvents = {}), i = e[t] || (e[t] = []);
return i.push({handler: n, name: t}), this
}, t.listenTo = function (n, e, i) {
var r = this.__listenToEvents;
r || (r = this.__listenToEvents = {});
var s = t.cid(n), o = r[s];
o || (o = r[s] = {obj: n, events: {}});
var a = o.events[e];
a || (a = o.events[e] = []), a.push(i), t.bind.call(n, e, i)
}, t.stopListening = function (n, e, i) {
var r = this.__listenToEvents, s = r, o = 0;
if (!r) return this;
if (n) {
var a = t.cid(n);
if ((s = {})[a] = r[a], !r[a]) return this
}
for (var v in s) {
var l, h = s[v];
n = r[v].obj, e ? (l = {})[e] = h.events[e] : l = h.events;
for (var u in l) {
var d = l[u] || [];
for (o = 0; o < d.length;) i && i === d[o] || !i ? (t.unbind.call(n, u, d[o]), d.splice(o, 1)) : o++;
d.length || delete h.events[u]
}
t.isEmptyObject(h.events) && delete r[v]
}
return this
}, t.removeEvent = function (t, n, e) {
if (!this.__bindEvents) return this;
for (var i, r = this.__bindEvents[t] || [], s = 0, o = "function" == typeof n; s < r.length;) i = r[s], (e ? e(i, t, n) : o && i.handler === n || !o && (i.cid === n || !n)) ? r.splice(s, 1) : s++;
return this
}, t.dispatch = function (t, n) {
var e = this.__bindEvents;
if (e) {
var i;
"string" == typeof t ? (i = t, t = {type: t}) : i = t.type;
var r = e[i];
if (r) {
r = r.slice(0);
var s = [t];
n && s.push.apply(s, n);
for (var o = 0, a = r.length; a > o; o++) r[o].handler.apply(this, s);
return t
}
}
}, t.one = function (n, e) {
var i = function () {
return t.unbind.call(this, n, i), e.apply(this, arguments)
};
return t.bind.call(this, n, i), this
}, t.event = {
on: function () {
return 0 === arguments.length && t.Control && this instanceof t.Control ? t.Control.prototype.on.call(this) : t.addEvent.apply(this, arguments)
},
off: function () {
return 0 === arguments.length && t.Control && this instanceof t.Control ? t.Control.prototype.off.call(this) : t.removeEvent.apply(this, arguments)
},
bind: t.addEvent,
unbind: t.removeEvent,
delegate: function (n, e, i) {
return t.addEvent.call(this, e, i)
},
undelegate: function (n, e, i) {
return t.removeEvent.call(this, e, i)
},
trigger: t.dispatch,
one: t.one,
addEvent: t.addEvent,
removeEvent: t.removeEvent,
listenTo: t.listenTo,
stopListening: t.stopListening,
dispatch: t.dispatch
}, t.event
});
/*can/util/fragment*/
define("can/util/fragment", ["can/util/can"], function (e) {
var t = /^\s*<(\w+)[^>]*>/, i = {}.toString, l = function (l, n, r) {
void 0 === n && (n = t.test(l) && RegExp.$1), l && "[object Function]" === i.call(l.replace) && (l = l.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, "<$1></$2>"));
var d = r.createElement("div"), a = r.createElement("div");
"tbody" === n || "tfoot" === n || "thead" === n || "colgroup" === n ? (a.innerHTML = "<table>" + l + "</table>", d = 3 === a.firstChild.nodeType ? a.lastChild : a.firstChild) : "col" === n ? (a.innerHTML = "<table><colgroup>" + l + "</colgroup></table>", d = 3 === a.firstChild.nodeType ? a.lastChild : a.firstChild.firstChild) : "tr" === n ? (a.innerHTML = "<table><tbody>" + l + "</tbody></table>", d = 3 === a.firstChild.nodeType ? a.lastChild : a.firstChild.firstChild) : "td" === n || "th" === n ? (a.innerHTML = "<table><tbody><tr>" + l + "</tr></tbody></table>", d = 3 === a.firstChild.nodeType ? a.lastChild : a.firstChild.firstChild.firstChild) : "option" === n ? (a.innerHTML = "<select>" + l + "</select>", d = 3 === a.firstChild.nodeType ? a.lastChild : a.firstChild) : d.innerHTML = "" + l;
var o = {}, h = e.childNodes(d);
o.length = h.length;
for (var c = 0; c < h.length; c++) o[c] = h[c];
return [].slice.call(o)
};
return e.buildFragment = function (e, t) {
if (e && 11 === e.nodeType) return e;
t ? t.length && (t = t[0]) : t = document;
for (var i = l(e, void 0, t), n = (t || document).createDocumentFragment(), r = 0, d = i.length; d > r; r++) n.appendChild(i[r]);
return n
}, function () {
var t = "<-\n>", i = e.buildFragment(t, document);
if (t !== i.firstChild.nodeValue) {
var l = e.buildFragment;
e.buildFragment = function (e, t) {
var i = l(e, t);
return 1 === i.childNodes.length && 3 === i.childNodes[0].nodeType && (i.childNodes[0].nodeValue = e), i
}
}
}(), e
});
/*can/util/array/isArrayLike*/
define("can/util/array/isArrayLike", ["can/util/can"], function (n) {
n.isArrayLike = function (n) {
var e = n && "boolean" != typeof n && "number" != typeof n && "length" in n && n.length;
return "function" != typeof arr && (0 === e || "number" == typeof e && e > 0 && e - 1 in n)
}
});
/*can/util/array/each*/
define("can/util/array/each", ["can/util/can", "can/util/array/isArrayLike"], function (a) {
return a.each = function (e, t, r) {
var i, n, l, c = 0;
if (e) if (a.isArrayLike(e)) if (a.List && e instanceof a.List) for (n = e.attr("length"); n > c && (l = e.attr(c), t.call(r || l, l, c, e) !== !1); c++) ; else for (n = e.length; n > c && (l = e[c], t.call(r || l, l, c, e) !== !1); c++) ; else if ("object" == typeof e) if (a.Map && e instanceof a.Map || e === a.route) {
var f = a.Map.keys(e);
for (c = 0, n = f.length; n > c && (i = f[c], l = e.attr(i), t.call(r || l, l, i, e) !== !1); c++) ;
} else for (i in e) if (Object.prototype.hasOwnProperty.call(e, i) && t.call(r || e[i], e[i], i, e) === !1) break;
return e
}, a
});
/*can/util/inserted/inserted*/
define("can/util/inserted/inserted", ["can/util/can"], function (e) {
e.inserted = function (n, r) {
if (n.length) {
n = e.makeArray(n);
for (var i, t, a = r || n[0].ownerDocument || n[0], d = !1, o = e.$(a.contains ? a : a.body), s = 0; void 0 !== (t = n[s]); s++) {
if (!d) {
if (!t.getElementsByTagName) continue;
if (!e.has(o, t).length) return;
d = !0
}
if (d && t.getElementsByTagName) {
i = e.makeArray(t.getElementsByTagName("*")), e.trigger(t, "inserted", [], !1);
for (var f, c = 0; void 0 !== (f = i[c]); c++) e.trigger(f, "inserted", [], !1)
}
}
}
}, e.appendChild = function (n, r, i) {
var t;
t = 11 === r.nodeType ? e.makeArray(e.childNodes(r)) : [r], n.appendChild(r), e.inserted(t, i)
}, e.insertBefore = function (n, r, i, t) {
var a;
a = 11 === r.nodeType ? e.makeArray(e.childNodes(r)) : [r], n.insertBefore(r, i), e.inserted(a, t)
}
});
/*can/util/jquery/jquery*/
define("can/util/jquery/jquery", ["jquery/dist/jquery", "can/util/can", "can/util/attr/attr", "can/event/event", "can/util/fragment", "can/util/array/each", "can/util/inserted/inserted"], function (t, e, n, r) {
var i = function (t) {
return t.nodeName && (1 === t.nodeType || 9 === t.nodeType) || t == window || t.addEventListener
};
t = t || window.jQuery, t.extend(e, t, {
trigger: function (n, r, a, s) {
i(n) ? t.event.trigger(r, a, n, !s) : n.trigger ? n.trigger(r, a) : ("string" == typeof r && (r = {type: r}), r.target = r.target || n, a && (a.length && "string" == typeof a ? a = [a] : a.length || (a = [a])), a || (a = []), e.dispatch.call(n, r, a))
},
event: e.event,
addEvent: e.addEvent,
removeEvent: e.removeEvent,
buildFragment: e.buildFragment,
$: t,
each: e.each,
bind: function (n, r) {
return this.bind && this.bind !== e.bind ? this.bind(n, r) : i(this) ? t.event.add(this, n, r) : e.addEvent.call(this, n, r), this
},
unbind: function (n, r) {
return this.unbind && this.unbind !== e.unbind ? this.unbind(n, r) : i(this) ? t.event.remove(this, n, r) : e.removeEvent.call(this, n, r), this
},
delegate: function (n, r, a) {
return this.delegate ? this.delegate(n, r, a) : i(this) ? t(this).delegate(n, r, a) : e.bind.call(this, r, a), this
},
undelegate: function (n, r, a) {
return this.undelegate ? this.undelegate(n, r, a) : i(this) ? t(this).undelegate(n, r, a) : e.unbind.call(this, r, a), this
},
proxy: e.proxy,
attr: n
}), e.on = e.bind, e.off = e.unbind, t.each(["append", "filter", "addClass", "remove", "data", "get", "has"], function (t, n) {
e[n] = function (t) {
return t[n].apply(t, e.makeArray(arguments).slice(1))
}
});
var a = t.cleanData;
t.cleanData = function (n) {
t.each(n, function (t, n) {
n && e.trigger(n, "removed", [], !1)
}), a(n)
};
var s, u = t.fn.domManip;
t.fn.domManip = function (t, e, n) {
for (var r = 1; r < arguments.length; r++) if ("function" == typeof arguments[r]) {
s = r;
break
}
return u.apply(this, arguments)
}, t(document.createElement("div")).append(document.createElement("div"));
var d = function (t) {
var n = t.childNodes;
if ("length" in n) return e.makeArray(n);
for (var r = t.firstChild, i = []; r;) i.push(r), r = r.nextSibling;
return i
};
void 0 === s ? (t.fn.domManip = u, e.each(["after", "prepend", "before", "append", "replaceWith"], function (n) {
var r = t.fn[n];
t.fn[n] = function () {
var t = [], n = e.makeArray(arguments);
null != n[0] && ("string" == typeof n[0] && (n[0] = e.buildFragment(n[0])), t = 11 === n[0].nodeType ? d(n[0]) : e.isArrayLike(n[0]) ? e.makeArray(n[0]) : [n[0]]);
var i = r.apply(this, n);
return e.inserted(t), i
}
})) : t.fn.domManip = 2 === s ? function (t, n, r) {
return u.call(this, t, n, function (t) {
var n;
11 === t.nodeType && (n = e.makeArray(e.childNodes(t)));
var i = r.apply(this, arguments);
return e.inserted(n ? n : [t]), i
})
} : function (t, n) {
return u.call(this, t, function (t) {
var r;
11 === t.nodeType && (r = e.makeArray(e.childNodes(t)));
var i = n.apply(this, arguments);
return e.inserted(r ? r : [t]), i
})
};
var l = t.attr;
t.attr = function (t, n) {
if (e.isDOM(t) && e.attr.MutationObserver) return l.apply(this, arguments);
var r, i;
arguments.length >= 3 && (r = l.call(this, t, n));
var a = l.apply(this, arguments);
return arguments.length >= 3 && (i = l.call(this, t, n)), i !== r && e.attr.trigger(t, n, r), a
};
var o = t.removeAttr;
return t.removeAttr = function (t, n) {
if (e.isDOM(t) && e.attr.MutationObserver) return o.apply(this, arguments);
var r = l.call(this, t, n), i = o.apply(this, arguments);
return null != r && e.attr.trigger(t, n, r), i
}, t.event.special.attributes = {
setup: function () {
if (e.isDOM(this) && e.attr.MutationObserver) {
var t = this, n = new e.attr.MutationObserver(function (n) {
n.forEach(function (n) {
var r = e.simpleExtend({}, n);
e.trigger(t, r, [])
})
});
n.observe(this, {attributes: !0, attributeOldValue: !0}), e.data(e.$(this), "canAttributesObserver", n)
} else e.data(e.$(this), "canHasAttributesBindings", !0)
}, teardown: function () {
e.isDOM(this) && e.attr.MutationObserver ? (e.data(e.$(this), "canAttributesObserver").disconnect(), t.removeData(this, "canAttributesObserver")) : t.removeData(this, "canHasAttributesBindings")
}
}, t.event.special.inserted = {}, t.event.special.removed = {}, e
});
/*can/util/util*/
define("can/util/util", ["can/util/jquery/jquery"], function (u) {
return u
});
/*can/util/string/string*/
define("can/util/string/string", ["can/util/util"], function (e) {
var r = /_|-/, n = /\=\=/, t = /([A-Z]+)([A-Z][a-z])/g, a = /([a-z\d])([A-Z])/g, u = /([a-z\d])([A-Z])/g,
i = /\{([^\}]+)\}/g, c = /"/g, o = /'/g, l = /-+(.)?/g, p = /[a-z][A-Z]/g, f = function (e, r, n) {
var t = e[r];
return void 0 === t && n === !0 && (t = e[r] = {}), t
}, g = function (e) {
return /^f|^o/.test(typeof e)
}, d = function (e) {
var r = null === e || void 0 === e || isNaN(e) && "" + e == "NaN";
return "" + (r ? "" : e)
};
return e.extend(e, {
esc: function (e) {
return d(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(c, """).replace(o, "'")
}, getObject: function (r, n, t) {
var a, u, i, c, o = r ? r.split(".") : [], l = o.length, p = 0;
if (n = e.isArray(n) ? n : [n || window], c = n.length, !l) return n[0];
for (p; c > p; p++) {
for (a = n[p], i = void 0, u = 0; l > u && g(a); u++) i = a, a = f(i, o[u]);
if (void 0 !== i && void 0 !== a) break
}
if (t === !1 && void 0 !== a && delete i[o[u - 1]], t === !0 && void 0 === a) for (a = n[0], u = 0; l > u && g(a); u++) a = f(a, o[u], !0);
return a
}, capitalize: function (e, r) {
return e.charAt(0).toUpperCase() + e.slice(1)
}, camelize: function (e) {
return d(e).replace(l, function (e, r) {
return r ? r.toUpperCase() : ""
})
}, hyphenate: function (e) {
return d(e).replace(p, function (e, r) {
return e.charAt(0) + "-" + e.charAt(1).toLowerCase()
})
}, underscore: function (e) {
return e.replace(n, "/").replace(t, "$1_$2").replace(a, "$1_$2").replace(u, "_").toLowerCase()
}, sub: function (r, n, t) {
var a = [];
return r = r || "", a.push(r.replace(i, function (r, u) {
var i = e.getObject(u, n, t === !0 ? !1 : void 0);
return void 0 === i || null === i ? (a = null, "") : g(i) && a ? (a.push(i), "") : "" + i
})), null === a ? a : a.length <= 1 ? a[0] : a
}, replacer: i, undHash: r
}), e
});
/*can/construct/construct*/
define("can/construct/construct", ["can/util/string/string"], function (t) {
var n, e = 0;
try {
Object.getOwnPropertyDescriptor({}), n = !0
} catch (r) {
n = !1
}
var o = function (t, n) {
var e = Object.getOwnPropertyDescriptor(t, n);
return e && (e.get || e.set) ? e : null
}, s = function (n, e, r) {
r = r || n;
var s;
for (var i in n) (s = o(n, i)) ? this._defineProperty(r, e, i, s) : t.Construct._overwrite(r, e, i, n[i])
}, i = function (n, e, r) {
r = r || n;
for (var o in n) t.Construct._overwrite(r, e, o, n[o])
};
return t.Construct = function () {
return arguments.length ? t.Construct.extend.apply(t.Construct, arguments) : void 0
}, t.extend(t.Construct, {
constructorExtends: !0, newInstance: function () {
var t, n = this.instance();
return n.setup && (n.__inSetup = !0, t = n.setup.apply(n, arguments), delete n.__inSetup), n.init && n.init.apply(n, t || arguments), n
}, _inherit: n ? s : i, _defineProperty: function (t, n, e, r) {
Object.defineProperty(t, e, r)
}, _overwrite: function (t, n, e, r) {
t[e] = r
}, setup: function (n, e) {
this.defaults = t.extend(!0, {}, n.defaults, this.defaults)
}, instance: function () {
e = 1;
var t = new this;
return e = 0, t
}, extend: function (n, r, o) {
function s() {
return e ? void 0 : this.constructor !== a && arguments.length && a.constructorExtends ? a.extend.apply(a, arguments) : a.newInstance.apply(a, arguments)
}
var i = n, u = r, c = o;
"string" != typeof i && (c = u, u = i, i = null), c || (c = u, u = null), c = c || {};
var a, p, f, l, h, d, y, m, g, v = this, _ = this.prototype;
g = this.instance(), t.Construct._inherit(c, _, g), i ? (p = i.split("."), y = p.pop()) : u && u.shortName ? y = u.shortName : this.shortName && (y = this.shortName), "undefined" == typeof constructorName && (a = function () {
return s.apply(this, arguments)
});
for (d in v) v.hasOwnProperty(d) && (a[d] = v[d]);
t.Construct._inherit(u, v, a), i && (f = t.getObject(p.join("."), window, !0), m = f, l = t.underscore(i.replace(/\./g, "_")), h = t.underscore(y), f[y] = a), t.extend(a, {
constructor: a,
prototype: g,
namespace: m,
_shortName: h,
fullName: i,
_fullName: l
}), void 0 !== y && (a.shortName = y), a.prototype.constructor = a;
var w = [v].concat(t.makeArray(arguments)), C = a.setup.apply(a, w);
return a.init && a.init.apply(a, C || w), a
}
}), t.Construct.prototype.setup = function () {
}, t.Construct.prototype.init = function () {
}, t.Construct
});
/*can/util/bind/bind*/
define("can/util/bind/bind", ["can/util/util"], function (i) {
return i.bindAndSetup = function () {
return i.addEvent.apply(this, arguments), this.__inSetup || (this._bindings ? this._bindings++ : (this._bindings = 1, this._bindsetup && this._bindsetup())), this
}, i.unbindAndTeardown = function (n, t) {
if (!this.__bindEvents) return this;
var s = this.__bindEvents[n] || [], d = s.length;
return i.removeEvent.apply(this, arguments), null === this._bindings ? this._bindings = 0 : this._bindings = this._bindings - (d - s.length), !this._bindings && this._bindteardown && this._bindteardown(), this
}, i
});
/*can/map/bubble*/
define("can/map/bubble", ["can/util/util"], function (n) {
var i = n.bubble = {
bind: function (n, e) {
if (!n.__inSetup) {
var b, t = i.events(n, e), r = t.length;
n._bubbleBindings || (n._bubbleBindings = {});
for (var u = 0; r > u; u++) b = t[u], n._bubbleBindings[b] ? n._bubbleBindings[b]++ : (n._bubbleBindings[b] = 1, i.childrenOf(n, b))
}
}, unbind: function (e, b) {
for (var t, r = i.events(e, b), u = r.length, d = 0; u > d; d++) t = r[d], e._bubbleBindings && e._bubbleBindings[t]--, e._bubbleBindings && !e._bubbleBindings[t] && (delete e._bubbleBindings[t], i.teardownChildrenFrom(e, t), n.isEmptyObject(e._bubbleBindings) && delete e._bubbleBindings)
}, add: function (e, b, t) {
if (b instanceof n.Map && e._bubbleBindings) for (var r in e._bubbleBindings) e._bubbleBindings[r] && (i.teardownFromParent(e, b, r), i.toParent(b, e, t, r))
}, addMany: function (n, e) {
for (var b = 0, t = e.length; t > b; b++) i.add(n, e[b], b)
}, remove: function (e, b) {
if (b instanceof n.Map && e._bubbleBindings) for (var t in e._bubbleBindings) e._bubbleBindings[t] && i.teardownFromParent(e, b, t)
}, removeMany: function (n, e) {
for (var b = 0, t = e.length; t > b; b++) i.remove(n, e[b])
}, set: function (e, b, t, r) {
return n.isMapLike(t) && i.add(e, t, b), n.isMapLike(r) && i.remove(e, r), t
}, events: function (n, i) {
return n.constructor._bubbleRule(i, n)
}, toParent: function (i, e, b, t) {
n.listenTo.call(e, i, t, function () {
var r = n.makeArray(arguments), u = r.shift();
r[0] = (n.List && e instanceof n.List ? e.indexOf(i) : b) + (r[0] ? "." + r[0] : ""), u.triggeredNS = u.triggeredNS || {}, u.triggeredNS[e._cid] || (u.triggeredNS[e._cid] = !0, n.trigger(e, u, r), "change" === t && n.trigger(e, r[0], [r[2], r[3]]))
})
}, childrenOf: function (n, e) {
n._each(function (b, t) {
b && b.bind && i.toParent(b, n, t, e)
})
}, teardownFromParent: function (i, e, b) {
e && e.unbind && n.stopListening.call(i, e, b)
}, teardownChildrenFrom: function (n, e) {
n._each(function (b) {
i.teardownFromParent(n, b, e)
})
}, isBubbling: function (n, i) {
return n._bubbleBindings && n._bubbleBindings[i]
}
};
return i
});
/*can/util/object/isplain/isplain*/
define("can/util/object/isplain/isplain", ["can/util/can"], function (t) {
var n = Object.prototype.hasOwnProperty, r = function (t) {
return null !== t && t == t.window
}, o = function (t) {
if (!t || "object" != typeof t || t.nodeType || r(t)) return !1;
try {
if (t.constructor && !n.call(t, "constructor") && !n.call(t.constructor.prototype, "isPrototypeOf")) return !1
} catch (o) {
return !1
}
var c;
for (c in t) ;
return void 0 === c || n.call(t, c)
};
return t.isPlainObject = o, t
});
/*can/map/map_helpers*/
define("can/map/map_helpers", ["can/util/util", "can/util/object/isplain/isplain"], function (n) {
var t = {
attrParts: function (n, t) {
return t ? [n] : "object" == typeof n ? n : ("" + n).split(".")
}, canMakeObserve: function (t) {
return t && !n.isPromise(t) && (n.isArray(t) || n.isPlainObject(t))
}, serialize: function () {
var e = null;
return function (i, r, a) {
var u = n.cid(i), c = !1;
return e || (c = !0, e = {attr: {}, serialize: {}}), e[r][u] = a, i.each(function (u, c) {
var o, d = n.isMapLike(u), l = d && e[r][n.cid(u)];
o = l ? l : i["___" + r] ? i["___" + r](c, u) : t.getValue(i, c, u, r), void 0 !== o && (a[c] = o)
}), c && (e = null), a
}
}(), getValue: function (t, e, i, r) {
return n.isMapLike(i) ? i[r]() : i
}, define: null, addComputedAttr: function (n, t, e) {
n._computedAttrs[t] = {
compute: e, count: 0, handler: function (e, i, r) {
n._triggerChange(t, "set", i, r, e.batchNum)
}
}
}, addToMap: function (t, r) {
var a;
e || (a = i, e = {});
var u = t._cid, c = n.cid(t);
return e[c] || (e[c] = {obj: t, instance: r, added: !u}), a
}, getMapFromObject: function (n) {
return e && e[n._cid] && e[n._cid].instance
}
}, e = null, i = function () {
for (var n in e) e[n].added && delete e[n].obj._cid;
e = null
};
return t
});
/*can/util/batch/batch*/
define("can/util/batch/batch", ["can/util/can"], function (t) {
var a = 1, n = 0, c = null, e = null, s = [], u = !1;
t.batch = {
start: function (t) {
if (n++, 1 === n) {
var c = {events: [], callbacks: [], number: a++};
s.push(c), t && c.callbacks.push(t), e = c
}
}, stop: function (a, l) {
if (a ? n = 0 : n--, 0 === n) {
e = null;
var h;
if (u === !1) {
u = !0;
for (var r, i = []; h = s.shift();) {
var b = h.events;
i.push.apply(i, h.callbacks), c = h, t.batch.batchNum = h.number;
var p;
for (l && t.batch.start(), r = 0, p = b.length; p > r; r++) t.dispatch.apply(b[r][0], b[r][1]);
t.batch._onDispatchedEvents(h.number), c = null, t.batch.batchNum = void 0
}
for (r = i.length - 1; r >= 0; r--) i[r]();
u = !1
}
}
}, _onDispatchedEvents: function () {
}, trigger: function (a, n, c) {
a.__inSetup || (n = "string" == typeof n ? {type: n} : n, e ? (n.batchNum = e.number, e.events.push([a, [n, c]])) : n.batchNum ? t.dispatch.call(a, n, c) : s.length ? (t.batch.start(), n.batchNum = e.number, e.events.push([a, [n, c]]), t.batch.stop()) : t.dispatch.call(a, n, c))
}, afterPreviousEvents: function (a) {
var n = t.last(s);
if (n) {
var c = {};
t.bind.call(c, "ready", a), n.events.push([c, [{type: "ready"}, []]])
} else a({})
}, after: function (t) {
var a = e || c;
a ? a.callbacks.push(t) : t({})
}
}
});
/*can/compute/get_value_and_bind*/
define("can/compute/get_value_and_bind", ["can/util/util"], function (e) {
function t(t, n, r) {
this.newObserved = {}, this.oldObserved = null, this.func = t, this.context = n, this.compute = r, this.onDependencyChange = e.proxy(this.onDependencyChange, this), this.depth = null, this.childDepths = {}, this.ignore = 0, this.inBatch = !1, this.ready = !1, r.observedInfo = this, this.setReady = e.proxy(this._setReady, this)
}
e.simpleExtend(t.prototype, {
getPrimaryDepth: function () {
return this.compute._primaryDepth
}, _setReady: function () {
this.ready = !0
}, getDepth: function () {
return null !== this.depth ? this.depth : this.depth = this._getDepth()
}, _getDepth: function () {
var e = 0, t = this.childDepths;
for (var n in t) t[n] > e && (e = t[n]);
return e + 1
}, addEdge: function (e) {
e.obj.bind(e.event, this.onDependencyChange), e.obj.observedInfo && (this.childDepths[e.obj._cid] = e.obj.observedInfo.getDepth(), this.depth = null)
}, removeEdge: function (e) {
e.obj.unbind(e.event, this.onDependencyChange), e.obj.observedInfo && (delete this.childDepths[e.obj._cid], this.depth = null)
}, dependencyChange: function (e) {
this.bound && this.ready && (void 0 !== e.batchNum ? e.batchNum !== this.batchNum && (t.registerUpdate(this), this.batchNum = e.batchNum) : this.updateCompute(e.batchNum))
}, onDependencyChange: function (e, t, n) {
this.dependencyChange(e, t, n)
}, updateCompute: function (e) {
if (this.bound) {
var t = this.value;
this.getValueAndBind(), this.compute.updater(this.value, t, e)
}
}, getValueAndBind: function () {
this.bound = !0, this.oldObserved = this.newObserved || {}, this.ignore = 0, this.newObserved = {}, this.ready = !1, h.push(this), this.value = this.func.call(this.context), h.pop(), this.updateBindings(), e.batch.afterPreviousEvents(this.setReady)
}, updateBindings: function () {
var e, t, n = this.newObserved, r = this.oldObserved;
for (e in n) t = n[e], r[e] ? r[e] = null : this.addEdge(t);
for (e in r) t = r[e], t && this.removeEdge(t)
}, teardown: function () {
this.bound = !1;
for (var e in this.newObserved) {
var t = this.newObserved[e];
this.removeEdge(t)
}
this.newObserved = {}
}
});
var n, r = [], i = 1 / 0, s = 0;
t.registerUpdate = function (e, t) {
var n = e.getDepth() - 1, h = e.getPrimaryDepth();
i = Math.min(h, i), s = Math.max(h, s);
var o = r[h] || (r[h] = {observeInfos: [], current: 1 / 0, max: 0}),
a = o.observeInfos[n] || (o.observeInfos[n] = []);
a.push(e), o.current = Math.min(n, o.current), o.max = Math.max(n, o.max)
}, t.updateUntil = function (e) {
for (var t; ;) {
if (!(s >= i)) return;
var h = r[i];
if (h && h.current <= h.max) {
var o = h.observeInfos[h.current];
if (o && (t = o.pop())) {
if (t.updateCompute(n), t === e) return
} else h.current++
} else i++
}
}, t.batchEnd = function (e) {
var t;
for (n = e; ;) {
if (!(s >= i)) return r = [], i = 1 / 0, void (s = 0);
var h = r[i];
if (h && h.current <= h.max) {
var o = h.observeInfos[h.current];
o && (t = o.pop()) ? t.updateCompute(e) : h.current++
} else i++
}
};
var h = [];
return e.__observe = function (e, t) {
var n = h[h.length - 1];
if (n && !n.ignore) {
var r = t + "", i = e._cid + "|" + r;
n.traps ? n.traps.push({obj: e, event: r, name: i}) : n.newObserved[i] || (n.newObserved[i] = {
obj: e,
event: r
})
}
}, e.__reading = e.__observe, e.__trapObserves = function () {
if (h.length) {
var e = h[h.length - 1], t = e.traps = [];
return function () {
return e.traps = null, t
}
}
return function () {
return []
}
}, e.__observes = function (e) {
var t = h[h.length - 1];
if (t) for (var n = 0, r = e.length; r > n; n++) {
var i = e[n], s = i.name;
t.newObserved[s] || (t.newObserved[s] = i)
}
}, e.__isRecordingObserves = function () {
var e = h.length, t = h[e - 1];
return e && 0 === t.ignore && t
}, e.__notObserve = function (e) {
return function () {
if (h.length) {
var t = h[h.length - 1];
t.ignore++;
var n = e.apply(this, arguments);
return t.ignore--, n
}
return e.apply(this, arguments)
}
}, e.batch._onDispatchedEvents = t.batchEnd, t
});
/*can/map/map*/
define("can/map/map", ["can/util/util", "can/util/bind/bind", "can/map/bubble", "can/map/map_helpers", "can/construct/construct", "can/util/batch/batch", "can/compute/get_value_and_bind"], function (t, e, i, n) {
var r = {constructor: !0}, s = t.Map = t.Construct.extend({
setup: function () {
if (t.Construct.setup.apply(this, arguments), this._computedPropertyNames = [], t.Map) {
this.defaults || (this.defaults = {});
for (var e in this.prototype) "define" !== e && "constructor" !== e && ("function" != typeof this.prototype[e] || this.prototype[e].prototype instanceof t.Construct) ? this.defaults[e] = this.prototype[e] : this.prototype[e].isComputed && this._computedPropertyNames.push(e);
n.define && n.define(this)
}
!t.List || this.prototype instanceof t.List || (this.List = s.List.extend({Map: this}, {}))
}, shortName: "Map", _bubbleRule: function (t) {
return "change" === t || t.indexOf(".") >= 0 ? ["change"] : []
}, bind: t.bindAndSetup, unbind: t.unbindAndTeardown, id: "id", keys: function (e) {
var i = [];
t.__observe(e, "__keys");
for (var n in e._data) i.push(n);
return i
}
}, {
setup: function (e) {
e instanceof t.Map && (e = e.serialize()), this._data = {}, t.cid(this, ".map"), this._setupComputedProperties();
var i = e && n.addToMap(e, this), r = this._setupDefaults(e), s = t.extend(t.extend(!0, {}, r), e);
this.attr(s), i && i()
}, _setupComputedProperties: function () {
this._computedAttrs = {};
for (var t = this.constructor._computedPropertyNames, e = 0, i = t.length; i > e; e++) {
var r = t[e];
n.addComputedAttr(this, r, this[r].clone(this))
}
}, _setupDefaults: function () {
return this.constructor.defaults || {}
}, attr: function (attr, val) {
var type = typeof attr;
if(attr === undefined) {
return this._getAttrs();
} else if (type !== "string" && type !== "number") {
// Get or set multiple attributes.
return this._setAttrs(attr, val);
}
else if (arguments.length === 1) {
// Get a single attribute.
return this._get(attr+"");
} else {
// Set an attribute.
this._set(attr+"", val);
return this;
}
}, _get: function (e) {
var i = e.indexOf(".");
if (i >= 0) {
var n = this.___get(e);
if (void 0 !== n) return t.__observe(this, e), n;
var r = e.substr(0, i), s = e.substr(i + 1), o = this.__get(r);
return o && o._get ? o._get(s) : void 0
}
return this.__get(e)
}, __get: function (e) {
return r[e] || this._computedAttrs[e] || t.__observe(this, e), this.___get(e)
}, ___get: function (t) {
if (void 0 !== t) {
var e = this._computedAttrs[t];
return e && e.compute ? e.compute() : this._data.hasOwnProperty(t) ? this._data[t] : void 0
}
return this._data
}, _set: function (e, i, n) {
var r, s = e.indexOf(".");
if (s >= 0 && !n) {
var o = e.substr(0, s), a = e.substr(s + 1);
if (r = this.__inSetup ? void 0 : this.___get(o), !t.isMapLike(r)) throw new Error("can.Map: Object does not exist");
r._set(a, i)
} else r = this.__inSetup ? void 0 : this.___get(e), this.__convert && (i = this.__convert(e, i)), this.__set(e, this.__type(i, e), r)
}, __type: function (e, i) {
if ("object" == typeof e && !(e instanceof t.Map) && n.canMakeObserve(e)) {
var r = n.getMapFromObject(e);
if (r) return r;
if (t.isArray(e)) {
var s = t.List;
return new s(e)
}
var o = this.constructor.Map || t.Map;
return new o(e)
}
return e
}, __set: function (t, e, n) {
if (e !== n) {
var r = this._computedAttrs[t],
s = r || void 0 !== n || this.___get().hasOwnProperty(t) ? "set" : "add";
this.___set(t, "object" == typeof e ? i.set(this, t, e, n) : e), r && r.count || this._triggerChange(t, s, e, n), "object" == typeof n && i.teardownFromParent(this, n)
}
}, ___set: function (t, e) {
var i = this._computedAttrs[t];
i && i.compute ? i.compute(e) : this._data[t] = e, "function" == typeof this.constructor.prototype[t] || i || (this[t] = e)
}, removeAttr: function (t) {
return this._remove(t)
}, _remove: function (t) {
var e = n.attrParts(t), i = e.shift(), r = this.___get(i);
return e.length && r ? r.removeAttr(e) : ("string" == typeof t && ~t.indexOf(".") && (i = t), this.__remove(i, r), r)
}, __remove: function (t, e) {
t in this._data && (this.___remove(t), this._triggerChange(t, "remove", void 0, e))
}, ___remove: function (t) {
delete this._data[t], t in this.constructor.prototype || delete this[t]
}, ___serialize: function (t, e) {
return n.getValue(this, t, e, "serialize")
}, _getAttrs: function () {
return n.serialize(this, "attr", {})
}, _setAttrs: function (e, i) {
e = t.simpleExtend({}, e);
var r, s, o = this;
t.batch.start(), this._each(function (r, a) {
if ("_cid" !== a) {
if (s = e[a], void 0 === s) return void (i && o.removeAttr(a));
o.__convert && (s = o.__convert(a, s)), t.isMapLike(r) && n.canMakeObserve(s) ? r.attr(s, i) : r !== s && o.__set(a, o.__type(s, a), r), delete e[a]
}
});
for (r in e) "_cid" !== r && (s = e[r], this._set(r, s, !0));
return t.batch.stop(), this
}, serialize: function () {
return n.serialize(this, "serialize", {})
}, _triggerChange: function (e, n, r, s, o) {
i.isBubbling(this, "change") && t.batch.trigger(this, {
type: "change",
target: this,
batchNum: o
}, [e, n, r, s]), t.batch.trigger(this, {
type: e,
target: this,
batchNum: o
}, [r, s]), ("remove" === n || "add" === n) && t.batch.trigger(this, {
type: "__keys",
target: this,
batchNum: o
})
}, _bindsetup: function () {
}, _bindteardown: function () {
}, one: t.one, bind: function (e, n) {
var r = this._computedAttrs && this._c