'), e(".working-indicator").append(o);
for (var a = 0; 3 > a; a++) {
var l = "working-indicator-bar" + a;
!function(e) {
e.z = Math.max(1 - (1 - e.alpha) / e.trail * (100 - e.start), e.alpha), i += t.template(s, t.extend({
prefix: ""
}, e)), i += t.template(s, t.extend({
prefix: "-webkit-"
}, e));
}({
name: l,
alpha: .25,
start: 20 * a,
trail: 50
});
var c = l + " 0.7s linear infinite";
o.append(e('
').css({
animation: c,
"-webkit-animation": c
}));
}
var u = n("style", {
type: "text/css"
});
document.head.appendChild(u), u.innerHTML = i;
}, a;
}), function(e) {
var t = function() {
return !1 === e.support.boxModel && e.support.objectAll && e.support.leadingWhitespace;
}();
e.jGrowl = function(t, n) {
0 == e("#jGrowl").size() && e('
').addClass(n && n.position ? n.position : e.jGrowl.defaults.position).appendTo("body"),
e("#jGrowl").jGrowl(t, n);
}, e.fn.jGrowl = function(t, n) {
if (e.isFunction(this.each)) {
var i = arguments;
return this.each(function() {
void 0 == e(this).data("jGrowl.instance") && (e(this).data("jGrowl.instance", e.extend(new e.fn.jGrowl(), {
notifications: [],
element: null,
interval: null
})), e(this).data("jGrowl.instance").startup(this)), e.isFunction(e(this).data("jGrowl.instance")[t]) ? e(this).data("jGrowl.instance")[t].apply(e(this).data("jGrowl.instance"), e.makeArray(i).slice(1)) : e(this).data("jGrowl.instance").create(t, n);
});
}
}, e.extend(e.fn.jGrowl.prototype, {
defaults: {
pool: 0,
header: "",
group: "",
sticky: !1,
position: "top-right",
glue: "after",
theme: "default",
themeState: "highlight",
corners: "10px",
check: 250,
life: 3e3,
closeDuration: "normal",
openDuration: "normal",
easing: "swing",
closer: !0,
closeTemplate: "×",
closerTemplate: "
[ close all ]
",
log: function() {},
beforeOpen: function() {},
afterOpen: function() {},
open: function() {},
beforeClose: function() {},
close: function() {},
animateOpen: {
opacity: "show"
},
animateClose: {
opacity: "hide"
}
},
notifications: [],
element: null,
interval: null,
create: function(t, n) {
var n = e.extend({}, this.defaults, n);
void 0 !== n.speed && (n.openDuration = n.speed, n.closeDuration = n.speed), this.notifications.push({
message: t,
options: n
}), n.log.apply(this.element, [ this.element, t, n ]);
},
render: function(t) {
var n = this, i = t.message, r = t.options;
r.themeState = "" == r.themeState ? "" : "ui-state-" + r.themeState;
var t = e("
").addClass("jGrowl-notification " + r.themeState + " ui-corner-all" + (void 0 != r.group && "" != r.group ? " " + r.group : "")).append(e("
").addClass("jGrowl-close").html(r.closeTemplate)).append(e("
").addClass("jGrowl-header").html(r.header)).append(e("
").addClass("jGrowl-message").html(i)).data("jGrowl", r).addClass(r.theme).children("div.jGrowl-close").bind("click.jGrowl", function() {
e(this).parent().trigger("jGrowl.beforeClose");
}).parent();
e(t).bind("mouseover.jGrowl", function() {
e("div.jGrowl-notification", n.element).data("jGrowl.pause", !0);
}).bind("mouseout.jGrowl", function() {
e("div.jGrowl-notification", n.element).data("jGrowl.pause", !1);
}).bind("jGrowl.beforeOpen", function() {
!1 !== r.beforeOpen.apply(t, [ t, i, r, n.element ]) && e(this).trigger("jGrowl.open");
}).bind("jGrowl.open", function() {
!1 !== r.open.apply(t, [ t, i, r, n.element ]) && ("after" == r.glue ? e("div.jGrowl-notification:last", n.element).after(t) : e("div.jGrowl-notification:first", n.element).before(t),
e(this).animate(r.animateOpen, r.openDuration, r.easing, function() {
!1 === e.support.opacity && this.style.removeAttribute("filter"), null !== e(this).data("jGrowl") && (e(this).data("jGrowl").created = new Date()),
e(this).trigger("jGrowl.afterOpen");
}));
}).bind("jGrowl.afterOpen", function() {
r.afterOpen.apply(t, [ t, i, r, n.element ]);
}).bind("jGrowl.beforeClose", function() {
!1 !== r.beforeClose.apply(t, [ t, i, r, n.element ]) && e(this).trigger("jGrowl.close");
}).bind("jGrowl.close", function() {
e(this).data("jGrowl.pause", !0), e(this).animate(r.animateClose, r.closeDuration, r.easing, function() {
e.isFunction(r.close) ? !1 !== r.close.apply(t, [ t, i, r, n.element ]) && e(this).remove() : e(this).remove();
});
}).trigger("jGrowl.beforeOpen"), "" != r.corners && void 0 != e.fn.corner && e(t).corner(r.corners),
e("div.jGrowl-notification:parent", n.element).size() > 1 && 0 == e("div.jGrowl-closer", n.element).size() && !1 !== this.defaults.closer && e(this.defaults.closerTemplate).addClass("jGrowl-closer " + this.defaults.themeState + " ui-corner-all").addClass(this.defaults.theme).appendTo(n.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing).bind("click.jGrowl", function() {
e(this).siblings().trigger("jGrowl.beforeClose"), e.isFunction(n.defaults.closer) && n.defaults.closer.apply(e(this).parent()[0], [ e(this).parent()[0] ]);
});
},
update: function() {
e(this.element).find("div.jGrowl-notification:parent").each(function() {
void 0 != e(this).data("jGrowl") && void 0 !== e(this).data("jGrowl").created && e(this).data("jGrowl").created.getTime() + parseInt(e(this).data("jGrowl").life) < new Date().getTime() && !0 !== e(this).data("jGrowl").sticky && (void 0 == e(this).data("jGrowl.pause") || !0 !== e(this).data("jGrowl.pause")) && e(this).trigger("jGrowl.beforeClose");
}), this.notifications.length > 0 && (0 == this.defaults.pool || e(this.element).find("div.jGrowl-notification:parent").size() < this.defaults.pool) && this.render(this.notifications.shift()),
e(this.element).find("div.jGrowl-notification:parent").size() < 2 && e(this.element).find("div.jGrowl-closer").animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
e(this).remove();
});
},
startup: function(n) {
this.element = e(n).addClass("jGrowl").append('
'),
this.interval = setInterval(function() {
e(n).data("jGrowl.instance").update();
}, parseInt(this.defaults.check)), t && e(this.element).addClass("ie6");
},
shutdown: function() {
e(this.element).removeClass("jGrowl").find("div.jGrowl-notification").trigger("jGrowl.close").parent().empty(),
clearInterval(this.interval);
},
close: function() {
e(this.element).find("div.jGrowl-notification").each(function() {
e(this).trigger("jGrowl.beforeClose");
});
}
}), e.jGrowl.defaults = e.fn.jGrowl.prototype.defaults;
}(jQuery), define("jgrowl", [ "jquery" ], function(e) {
return function() {
return e.jQuery.jGrowl;
};
}(this)), define("text!html/notificationsSettingsBlock.html", [], function() {
return '
Shows notification messages in the bottom-right corner of the\n screen.
\n
';
}), define("extensions/notifications", [ "jquery", "underscore", "utils", "logger", "classes/Extension", "jgrowl", "text!html/notificationsSettingsBlock.html" ], function(e, t, n, i, r, o, a) {
function s() {
!1 === h && (o.defaults.life = u.config.timeout, o.defaults.closer = !1, o.defaults.closeTemplate = "",
o.defaults.position = "bottom-right", h = !0);
}
function l(e, n, r) {
if (i.info(e), s(), e) {
var a = e.indexOf("|");
(-1 === a || (e = e.substring(0, a))) && (r = r || {}, n = n || "icon-info-circled",
o("
" + t.escape(e).replace(/\n/g, "
"), r));
}
}
function c() {
!1 !== f && (d.toggleClass("hide", !m), p.toggleClass("hide", m));
}
var u = new r("notifications", "Notifications");
u.settingsBlock = a, u.defaultConfig = {
timeout: 8e3
}, u.onLoadSettings = function() {
n.setInputValue("#input-notifications-timeout", u.config.timeout);
}, u.onSaveSettings = function(e, t) {
e.timeout = n.getInputIntValue("#input-notifications-timeout", t, 1, 6e4);
};
var d, p, h = !1, f = !1;
u.onReady = function() {
f = !0, d = e(".navbar .offline-status"), p = e(".navbar .extension-buttons"), c();
}, u.onMessage = function(e) {
l(e);
}, u.onError = function(e) {
i.error(e), t.isString(e) ? l(e, "icon-attention") : t.isObject(e) && l(e.message, "icon-attention");
};
var m = !1;
return u.onOfflineChanged = function(e) {
m = e, c(), !0 === m ? l("You are offline.", "icon-attention-circled msg-offline") : l("You are back online!", "icon-signal");
}, u.onSyncImportSuccess = function(e, n) {
l(t.map(e, function(e) {
return e.title;
}).join(", ") + " imported successfully from " + n.providerName + ".");
}, u.onSyncExportSuccess = function(e, t) {
l('"' + e.title + '" will now be synchronized on ' + t.provider.providerName + ".");
}, u.onSyncRemoved = function(e, t) {
l(t.provider.providerName + " synchronized location has been removed.");
}, u.onPublishSuccess = function(e) {
l('"' + e.title + '" successfully published.');
}, u.onNewPublishSuccess = function(e, t) {
l('"' + e.title + '" is now published on ' + t.provider.providerName + ".");
}, u.onPublishRemoved = function(e, t) {
l(t.provider.providerName + " publish location has been removed.");
}, u;
}), define("text!html/umlDiagramsSettingsBlock.html", [], function() {
return '
Creates UML diagrams from plain text description.
\n\n
\n
\n
Sequence diagrams:
\n
```sequence\nAlice->Bob: Hello Bob, how are you?\nBob-->Alice: I am good thanks!\n```
\n\n\n
Flow charts:
\n
```flow\nst=>start: Start\ne=>end\nop=>operation: My Operation\ncond=>condition: Yes or No?\nst->op->cond\ncond(yes)->e\ncond(no)->op\n```
\n\n
\n Note: Markdown Extra extension has to be enabled with GFM fenced code blocks option.
\n \n';
}), function(e) {
var t, n, i = "hasOwnProperty", r = /[\.\/]/, o = function() {}, a = function(e, t) {
return e - t;
}, s = {
n: {}
}, l = function(e, i) {
e = String(e);
var r, o = n, s = Array.prototype.slice.call(arguments, 2), c = l.listeners(e), u = 0, d = [], p = {}, h = [], f = t;
t = e, n = 0;
for (var m = 0, g = c.length; g > m; m++) "zIndex" in c[m] && (d.push(c[m].zIndex),
c[m].zIndex < 0 && (p[c[m].zIndex] = c[m]));
for (d.sort(a); d[u] < 0; ) if (r = p[d[u++]], h.push(r.apply(i, s)), n) return n = o,
h;
for (m = 0; g > m; m++) if ("zIndex" in (r = c[m])) if (r.zIndex == d[u]) {
if (h.push(r.apply(i, s)), n) break;
do if (u++, r = p[d[u]], r && h.push(r.apply(i, s)), n) break; while (r);
} else p[r.zIndex] = r; else if (h.push(r.apply(i, s)), n) break;
return n = o, t = f, h.length ? h : null;
};
l._events = s, l.listeners = function(e) {
var t, n, i, o, a, l, c, u, d = e.split(r), p = s, h = [ p ], f = [];
for (o = 0, a = d.length; a > o; o++) {
for (u = [], l = 0, c = h.length; c > l; l++) for (p = h[l].n, n = [ p[d[o]], p["*"] ],
i = 2; i--; ) (t = n[i]) && (u.push(t), f = f.concat(t.f || []));
h = u;
}
return f;
}, l.on = function(e, t) {
if (e = String(e), "function" != typeof t) return function() {};
for (var n = e.split(r), i = s, a = 0, l = n.length; l > a; a++) i = i.n, i = i.hasOwnProperty(n[a]) && i[n[a]] || (i[n[a]] = {
n: {}
});
for (i.f = i.f || [], a = 0, l = i.f.length; l > a; a++) if (i.f[a] == t) return o;
return i.f.push(t), function(e) {
+e == +e && (t.zIndex = +e);
};
}, l.f = function(e) {
var t = [].slice.call(arguments, 1);
return function() {
l.apply(null, [ e, null ].concat(t).concat([].slice.call(arguments, 0)));
};
}, l.stop = function() {
n = 1;
}, l.nt = function(e) {
return e ? new RegExp("(?:\\.|\\/|^)" + e + "(?:\\.|\\/|$)").test(t) : t;
}, l.nts = function() {
return t.split(r);
}, l.off = l.unbind = function(e, t) {
if (!e) return void (l._events = s = {
n: {}
});
var n, o, a, c, u, d, p, h = e.split(r), f = [ s ];
for (c = 0, u = h.length; u > c; c++) for (d = 0; d < f.length; d += a.length - 2) {
if (a = [ d, 1 ], n = f[d].n, "*" != h[c]) n[h[c]] && a.push(n[h[c]]); else for (o in n) n[i](o) && a.push(n[o]);
f.splice.apply(f, a);
}
for (c = 0, u = f.length; u > c; c++) for (n = f[c]; n.n; ) {
if (t) {
if (n.f) {
for (d = 0, p = n.f.length; p > d; d++) if (n.f[d] == t) {
n.f.splice(d, 1);
break;
}
!n.f.length && delete n.f;
}
for (o in n.n) if (n.n[i](o) && n.n[o].f) {
var m = n.n[o].f;
for (d = 0, p = m.length; p > d; d++) if (m[d] == t) {
m.splice(d, 1);
break;
}
!m.length && delete n.n[o].f;
}
} else {
delete n.f;
for (o in n.n) n.n[i](o) && n.n[o].f && delete n.n[o].f;
}
n = n.n;
}
}, l.once = function(e, t) {
var n = function() {
return l.unbind(e, n), t.apply(this, arguments);
};
return l.on(e, n);
}, l.version = "0.4.2", l.toString = function() {
return "You are running Eve 0.4.2";
}, "undefined" != typeof module && module.exports ? module.exports = l : "undefined" != typeof define ? define("eve", [], function() {
return l;
}) : e.eve = l;
}(window || this), function(e, t) {
"function" == typeof define && define.amd ? define("raphael", [ "eve" ], function(n) {
return t(e, n);
}) : t(e, e.eve || "function" == typeof require && require("eve"));
}(this, function(e, t) {
function n(e) {
if (n.is(e, "function")) return x ? e() : t.on("raphael.DOMload", e);
if (n.is(e, V)) return n._engine.create[D](n, e.splice(0, 3 + n.is(e[0], z))).add(e);
var i = Array.prototype.slice.call(arguments, 0);
if (n.is(i[i.length - 1], "function")) {
var r = i.pop();
return x ? r.call(n._engine.create[D](n, i)) : t.on("raphael.DOMload", function() {
r.call(n._engine.create[D](n, i));
});
}
return n._engine.create[D](n, arguments);
}
function i(e) {
if ("function" == typeof e || Object(e) !== e) return e;
var t = new e.constructor();
for (var n in e) e[k](n) && (t[n] = i(e[n]));
return t;
}
function r(e, t) {
for (var n = 0, i = e.length; i > n; n++) if (e[n] === t) return e.push(e.splice(n, 1)[0]);
}
function o(e, t, n) {
function i() {
var o = Array.prototype.slice.call(arguments, 0), a = o.join("\u2400"), s = i.cache = i.cache || {}, l = i.count = i.count || [];
return s[k](a) ? (r(l, a), n ? n(s[a]) : s[a]) : (l.length >= 1e3 && delete s[l.shift()],
l.push(a), s[a] = e[D](t, o), n ? n(s[a]) : s[a]);
}
return i;
}
function a() {
return this.hex;
}
function s(e, t) {
for (var n = [], i = 0, r = e.length; r - 2 * !t > i; i += 2) {
var o = [ {
x: +e[i - 2],
y: +e[i - 1]
}, {
x: +e[i],
y: +e[i + 1]
}, {
x: +e[i + 2],
y: +e[i + 3]
}, {
x: +e[i + 4],
y: +e[i + 5]
} ];
t ? i ? r - 4 == i ? o[3] = {
x: +e[0],
y: +e[1]
} : r - 2 == i && (o[2] = {
x: +e[0],
y: +e[1]
}, o[3] = {
x: +e[2],
y: +e[3]
}) : o[0] = {
x: +e[r - 2],
y: +e[r - 1]
} : r - 4 == i ? o[3] = o[2] : i || (o[0] = {
x: +e[i],
y: +e[i + 1]
}), n.push([ "C", (-o[0].x + 6 * o[1].x + o[2].x) / 6, (-o[0].y + 6 * o[1].y + o[2].y) / 6, (o[1].x + 6 * o[2].x - o[3].x) / 6, (o[1].y + 6 * o[2].y - o[3].y) / 6, o[2].x, o[2].y ]);
}
return n;
}
function l(e, t, n, i, r) {
return e * (e * (-3 * t + 9 * n - 9 * i + 3 * r) + 6 * t - 12 * n + 6 * i) - 3 * t + 3 * n;
}
function c(e, t, n, i, r, o, a, s, c) {
null == c && (c = 1), c = c > 1 ? 1 : 0 > c ? 0 : c;
for (var u = c / 2, d = [ -.1252, .1252, -.3678, .3678, -.5873, .5873, -.7699, .7699, -.9041, .9041, -.9816, .9816 ], p = [ .2491, .2491, .2335, .2335, .2032, .2032, .1601, .1601, .1069, .1069, .0472, .0472 ], h = 0, f = 0; 12 > f; f++) {
var m = u * d[f] + u, g = l(m, e, n, r, a), v = l(m, t, i, o, s), b = g * g + v * v;
h += p[f] * j.sqrt(b);
}
return u * h;
}
function u(e, t, n, i, r, o, a, s, l) {
if (!(0 > l || c(e, t, n, i, r, o, a, s) < l)) {
var u, d = .5, p = 1 - d;
for (u = c(e, t, n, i, r, o, a, s, p); q(u - l) > .01; ) d /= 2, p += (l > u ? 1 : -1) * d,
u = c(e, t, n, i, r, o, a, s, p);
return p;
}
}
function d(e, t, n, i, r, o, a, s) {
if (!($(e, n) < G(r, a) || G(e, n) > $(r, a) || $(t, i) < G(o, s) || G(t, i) > $(o, s))) {
var l = (e * i - t * n) * (r - a) - (e - n) * (r * s - o * a), c = (e * i - t * n) * (o - s) - (t - i) * (r * s - o * a), u = (e - n) * (o - s) - (t - i) * (r - a);
if (u) {
var d = l / u, p = c / u, h = +d.toFixed(2), f = +p.toFixed(2);
if (!(h < +G(e, n).toFixed(2) || h > +$(e, n).toFixed(2) || h < +G(r, a).toFixed(2) || h > +$(r, a).toFixed(2) || f < +G(t, i).toFixed(2) || f > +$(t, i).toFixed(2) || f < +G(o, s).toFixed(2) || f > +$(o, s).toFixed(2))) return {
x: d,
y: p
};
}
}
}
function p(e, t, i) {
var r = n.bezierBBox(e), o = n.bezierBBox(t);
if (!n.isBBoxIntersect(r, o)) return i ? 0 : [];
for (var a = c.apply(0, e), s = c.apply(0, t), l = $(~~(a / 5), 1), u = $(~~(s / 5), 1), p = [], h = [], f = {}, m = i ? 0 : [], g = 0; l + 1 > g; g++) {
var v = n.findDotsAtSegment.apply(n, e.concat(g / l));
p.push({
x: v.x,
y: v.y,
t: g / l
});
}
for (g = 0; u + 1 > g; g++) v = n.findDotsAtSegment.apply(n, t.concat(g / u)), h.push({
x: v.x,
y: v.y,
t: g / u
});
for (g = 0; l > g; g++) for (var b = 0; u > b; b++) {
var y = p[g], x = p[g + 1], w = h[b], S = h[b + 1], C = q(x.x - y.x) < .001 ? "y" : "x", _ = q(S.x - w.x) < .001 ? "y" : "x", k = d(y.x, y.y, x.x, x.y, w.x, w.y, S.x, S.y);
if (k) {
if (f[k.x.toFixed(4)] == k.y.toFixed(4)) continue;
f[k.x.toFixed(4)] = k.y.toFixed(4);
var E = y.t + q((k[C] - y[C]) / (x[C] - y[C])) * (x.t - y.t), T = w.t + q((k[_] - w[_]) / (S[_] - w[_])) * (S.t - w.t);
E >= 0 && 1.001 >= E && T >= 0 && 1.001 >= T && (i ? m++ : m.push({
x: k.x,
y: k.y,
t1: G(E, 1),
t2: G(T, 1)
}));
}
}
return m;
}
function h(e, t, i) {
e = n._path2curve(e), t = n._path2curve(t);
for (var r, o, a, s, l, c, u, d, h, f, m = i ? 0 : [], g = 0, v = e.length; v > g; g++) {
var b = e[g];
if ("M" == b[0]) r = l = b[1], o = c = b[2]; else {
"C" == b[0] ? (h = [ r, o ].concat(b.slice(1)), r = h[6], o = h[7]) : (h = [ r, o, r, o, l, c, l, c ],
r = l, o = c);
for (var y = 0, x = t.length; x > y; y++) {
var w = t[y];
if ("M" == w[0]) a = u = w[1], s = d = w[2]; else {
"C" == w[0] ? (f = [ a, s ].concat(w.slice(1)), a = f[6], s = f[7]) : (f = [ a, s, a, s, u, d, u, d ],
a = u, s = d);
var S = p(h, f, i);
if (i) m += S; else {
for (var C = 0, _ = S.length; _ > C; C++) S[C].segment1 = g, S[C].segment2 = y,
S[C].bez1 = h, S[C].bez2 = f;
m = m.concat(S);
}
}
}
}
}
return m;
}
function f(e, t, n, i, r, o) {
null != e ? (this.a = +e, this.b = +t, this.c = +n, this.d = +i, this.e = +r, this.f = +o) : (this.a = 1,
this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0);
}
function m() {
return this.x + A + this.y + A + this.width + " \xd7 " + this.height;
}
function g(e, t, n, i, r, o) {
function a(e) {
return ((u * e + c) * e + l) * e;
}
function s(e, t) {
var n, i, r, o, s, d;
for (r = e, d = 0; 8 > d; d++) {
if (o = a(r) - e, q(o) < t) return r;
if (s = (3 * u * r + 2 * c) * r + l, q(s) < 1e-6) break;
r -= o / s;
}
if (n = 0, i = 1, (r = e) < n) return n;
if (r > i) return i;
for (;i > n; ) {
if (o = a(r), q(o - e) < t) return r;
e > o ? n = r : i = r, r = (i - n) / 2 + n;
}
return r;
}
var l = 3 * t, c = 3 * (i - t) - l, u = 1 - l - c, d = 3 * n, p = 3 * (r - n) - d, h = 1 - d - p;
return function(e, t) {
var n = s(e, t);
return ((h * n + p) * n + d) * n;
}(e, 1 / (200 * o));
}
function v(e, t) {
var n = [], i = {};
if (this.ms = t, this.times = 1, e) {
for (var r in e) e[k](r) && (i[J(r)] = e[r], n.push(J(r)));
n.sort(ut);
}
this.anim = i, this.top = n[n.length - 1], this.percents = n;
}
function b(e, i, r, o, a, s) {
r = J(r);
var l, c, u, d, p, h, m = e.ms, v = {}, b = {}, y = {};
if (o) for (w = 0, C = ln.length; C > w; w++) {
var x = ln[w];
if (x.el.id == i.id && x.anim == e) {
x.percent != r ? (ln.splice(w, 1), u = 1) : c = x, i.attr(x.totalOrigin);
break;
}
} else o = +b;
for (var w = 0, C = e.percents.length; C > w; w++) {
if (e.percents[w] == r || e.percents[w] > o * e.top) {
r = e.percents[w], p = e.percents[w - 1] || 0, m = m / e.top * (r - p), d = e.percents[w + 1],
l = e.anim[r];
break;
}
o && i.attr(e.anim[e.percents[w]]);
}
if (l) {
if (c) c.initstatus = o, c.start = new Date() - c.ms * o; else {
for (var _ in l) if (l[k](_) && (nt[k](_) || i.paper.customAttributes[k](_))) switch (v[_] = i.attr(_),
null == v[_] && (v[_] = tt[_]), b[_] = l[_], nt[_]) {
case z:
y[_] = (b[_] - v[_]) / m;
break;
case "colour":
v[_] = n.getRGB(v[_]);
var E = n.getRGB(b[_]);
y[_] = {
r: (E.r - v[_].r) / m,
g: (E.g - v[_].g) / m,
b: (E.b - v[_].b) / m
};
break;
case "path":
var T = Pt(v[_], b[_]), I = T[1];
for (v[_] = T[0], y[_] = [], w = 0, C = v[_].length; C > w; w++) {
y[_][w] = [ 0 ];
for (var D = 1, M = v[_][w].length; M > D; D++) y[_][w][D] = (I[w][D] - v[_][w][D]) / m;
}
break;
case "transform":
var L = i._, A = $t(L[_], b[_]);
if (A) for (v[_] = A.from, b[_] = A.to, y[_] = [], y[_].real = !0, w = 0, C = v[_].length; C > w; w++) for (y[_][w] = [ v[_][w][0] ],
D = 1, M = v[_][w].length; M > D; D++) y[_][w][D] = (b[_][w][D] - v[_][w][D]) / m; else {
var O = i.matrix || new f(), F = {
_: {
transform: L.transform
},
getBBox: function() {
return i.getBBox(1);
}
};
v[_] = [ O.a, O.b, O.c, O.d, O.e, O.f ], Bt(F, b[_]), b[_] = F._.transform, y[_] = [ (F.matrix.a - O.a) / m, (F.matrix.b - O.b) / m, (F.matrix.c - O.c) / m, (F.matrix.d - O.d) / m, (F.matrix.e - O.e) / m, (F.matrix.f - O.f) / m ];
}
break;
case "csv":
var B = R(l[_])[P](S), j = R(v[_])[P](S);
if ("clip-rect" == _) for (v[_] = j, y[_] = [], w = j.length; w--; ) y[_][w] = (B[w] - v[_][w]) / m;
b[_] = B;
break;
default:
for (B = [][N](l[_]), j = [][N](v[_]), y[_] = [], w = i.paper.customAttributes[_].length; w--; ) y[_][w] = ((B[w] || 0) - (j[w] || 0)) / m;
}
var $ = l.easing, G = n.easing_formulas[$];
if (!G) if ((G = R($).match(Y)) && 5 == G.length) {
var q = G;
G = function(e) {
return g(e, +q[1], +q[2], +q[3], +q[4], m);
};
} else G = pt;
if (h = l.start || e.start || +new Date(), x = {
anim: e,
percent: r,
timestamp: h,
start: h + (e.del || 0),
status: 0,
initstatus: o || 0,
stop: !1,
ms: m,
easing: G,
from: v,
diff: y,
to: b,
el: i,
callback: l.callback,
prev: p,
next: d,
repeat: s || e.times,
origin: i.attr(),
totalOrigin: a
}, ln.push(x), o && !c && !u && (x.stop = !0, x.start = new Date() - m * o, 1 == ln.length)) return un();
u && (x.start = new Date() - x.ms * o), 1 == ln.length && cn(un);
}
t("raphael.anim.start." + i.id, i, e);
}
}
function y(e) {
for (var t = 0; t < ln.length; t++) ln[t].el.paper == e && ln.splice(t--, 1);
}
n.version = "2.1.2", n.eve = t;
var x, w, S = /[, ]+/, C = {
circle: 1,
rect: 1,
path: 1,
ellipse: 1,
text: 1,
image: 1
}, _ = /\{(\d+)\}/g, k = "hasOwnProperty", E = {
doc: document,
win: e
}, T = {
was: Object.prototype[k].call(E.win, "Raphael"),
is: E.win.Raphael
}, I = function() {
this.ca = this.customAttributes = {};
}, D = "apply", N = "concat", M = "ontouchstart" in E.win || E.win.DocumentTouch && E.doc instanceof DocumentTouch, L = "", A = " ", R = String, P = "split", O = "click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[P](A), F = {
mousedown: "touchstart",
mousemove: "touchmove",
mouseup: "touchend"
}, B = R.prototype.toLowerCase, j = Math, $ = j.max, G = j.min, q = j.abs, H = j.pow, U = j.PI, z = "number", V = "array", W = Object.prototype.toString, X = (n._ISURL = /^url\(['"]?(.+?)['"]?\)$/i,
/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i), Q = {
NaN: 1,
Infinity: 1,
"-Infinity": 1
}, Y = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/, K = j.round, J = parseFloat, Z = parseInt, et = R.prototype.toUpperCase, tt = n._availableAttrs = {
"arrow-end": "none",
"arrow-start": "none",
blur: 0,
"clip-rect": "0 0 1e9 1e9",
cursor: "default",
cx: 0,
cy: 0,
fill: "#fff",
"fill-opacity": 1,
font: '10px "Arial"',
"font-family": '"Arial"',
"font-size": "10",
"font-style": "normal",
"font-weight": 400,
gradient: 0,
height: 0,
href: "http://raphaeljs.com/",
"letter-spacing": 0,
opacity: 1,
path: "M0,0",
r: 0,
rx: 0,
ry: 0,
src: "",
stroke: "#000",
"stroke-dasharray": "",
"stroke-linecap": "butt",
"stroke-linejoin": "butt",
"stroke-miterlimit": 0,
"stroke-opacity": 1,
"stroke-width": 1,
target: "_blank",
"text-anchor": "middle",
title: "Raphael",
transform: "",
width: 0,
x: 0,
y: 0
}, nt = n._availableAnimAttrs = {
blur: z,
"clip-rect": "csv",
cx: z,
cy: z,
fill: "colour",
"fill-opacity": z,
"font-size": z,
height: z,
opacity: z,
path: "path",
r: z,
rx: z,
ry: z,
stroke: "colour",
"stroke-opacity": z,
"stroke-width": z,
transform: "transform",
width: z,
x: z,
y: z
}, it = /[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/, rt = {
hs: 1,
rg: 1
}, ot = /,?([achlmqrstvxz]),?/gi, at = /([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi, st = /([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/gi, lt = /(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/gi, ct = (n._radial_gradient = /^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,
{}), ut = function(e, t) {
return J(e) - J(t);
}, dt = function() {}, pt = function(e) {
return e;
}, ht = n._rectPath = function(e, t, n, i, r) {
return r ? [ [ "M", e + r, t ], [ "l", n - 2 * r, 0 ], [ "a", r, r, 0, 0, 1, r, r ], [ "l", 0, i - 2 * r ], [ "a", r, r, 0, 0, 1, -r, r ], [ "l", 2 * r - n, 0 ], [ "a", r, r, 0, 0, 1, -r, -r ], [ "l", 0, 2 * r - i ], [ "a", r, r, 0, 0, 1, r, -r ], [ "z" ] ] : [ [ "M", e, t ], [ "l", n, 0 ], [ "l", 0, i ], [ "l", -n, 0 ], [ "z" ] ];
}, ft = function(e, t, n, i) {
return null == i && (i = n), [ [ "M", e, t ], [ "m", 0, -i ], [ "a", n, i, 0, 1, 1, 0, 2 * i ], [ "a", n, i, 0, 1, 1, 0, -2 * i ], [ "z" ] ];
}, mt = n._getPath = {
path: function(e) {
return e.attr("path");
},
circle: function(e) {
var t = e.attrs;
return ft(t.cx, t.cy, t.r);
},
ellipse: function(e) {
var t = e.attrs;
return ft(t.cx, t.cy, t.rx, t.ry);
},
rect: function(e) {
var t = e.attrs;
return ht(t.x, t.y, t.width, t.height, t.r);
},
image: function(e) {
var t = e.attrs;
return ht(t.x, t.y, t.width, t.height);
},
text: function(e) {
var t = e._getBBox();
return ht(t.x, t.y, t.width, t.height);
},
set: function(e) {
var t = e._getBBox();
return ht(t.x, t.y, t.width, t.height);
}
}, gt = n.mapPath = function(e, t) {
if (!t) return e;
var n, i, r, o, a, s, l;
for (e = Pt(e), r = 0, a = e.length; a > r; r++) for (l = e[r], o = 1, s = l.length; s > o; o += 2) n = t.x(l[o], l[o + 1]),
i = t.y(l[o], l[o + 1]), l[o] = n, l[o + 1] = i;
return e;
};
if (n._g = E, n.type = E.win.SVGAngle || E.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML",
"VML" == n.type) {
var vt, bt = E.doc.createElement("div");
if (bt.innerHTML = '
', vt = bt.firstChild, vt.style.behavior = "url(#default#VML)",
!vt || "object" != typeof vt.adj) return n.type = L;
bt = null;
}
n.svg = !(n.vml = "VML" == n.type), n._Paper = I, n.fn = w = I.prototype = n.prototype,
n._id = 0, n._oid = 0, n.is = function(e, t) {
return t = B.call(t), "finite" == t ? !Q[k](+e) : "array" == t ? e instanceof Array : "null" == t && null === e || t == typeof e && null !== e || "object" == t && e === Object(e) || "array" == t && Array.isArray && Array.isArray(e) || W.call(e).slice(8, -1).toLowerCase() == t;
}, n.angle = function(e, t, i, r, o, a) {
if (null == o) {
var s = e - i, l = t - r;
return s || l ? (180 + 180 * j.atan2(-l, -s) / U + 360) % 360 : 0;
}
return n.angle(e, t, o, a) - n.angle(i, r, o, a);
}, n.rad = function(e) {
return e % 360 * U / 180;
}, n.deg = function(e) {
return Math.round(180 * e / U % 360 * 1e3) / 1e3;
}, n.snapTo = function(e, t, i) {
if (i = n.is(i, "finite") ? i : 10, n.is(e, V)) {
for (var r = e.length; r--; ) if (q(e[r] - t) <= i) return e[r];
} else {
e = +e;
var o = t % e;
if (i > o) return t - o;
if (o > e - i) return t - o + e;
}
return t;
}, n.createUUID = function(e, t) {
return function() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(e, t).toUpperCase();
};
}(/[xy]/g, function(e) {
var t = 16 * j.random() | 0;
return ("x" == e ? t : 3 & t | 8).toString(16);
}), n.setWindow = function(e) {
t("raphael.setWindow", n, E.win, e), E.win = e, E.doc = E.win.document, n._engine.initWin && n._engine.initWin(E.win);
};
var yt = function(e) {
if (n.vml) {
var t, i = /^\s+|\s+$/g;
try {
var r = new ActiveXObject("htmlfile");
r.write(""), r.close(), t = r.body;
} catch (e) {
t = createPopup().document.body;
}
var a = t.createTextRange();
yt = o(function(e) {
try {
t.style.color = R(e).replace(i, L);
var n = a.queryCommandValue("ForeColor");
return n = (255 & n) << 16 | 65280 & n | (16711680 & n) >>> 16, "#" + ("000000" + n.toString(16)).slice(-6);
} catch (e) {
return "none";
}
});
} else {
var s = E.doc.createElement("i");
s.title = "Rapha\xebl Colour Picker", s.style.display = "none", E.doc.body.appendChild(s),
yt = o(function(e) {
return s.style.color = e, E.doc.defaultView.getComputedStyle(s, L).getPropertyValue("color");
});
}
return yt(e);
}, xt = function() {
return "hsb(" + [ this.h, this.s, this.b ] + ")";
}, wt = function() {
return "hsl(" + [ this.h, this.s, this.l ] + ")";
}, St = function() {
return this.hex;
}, Ct = function(e, t, i) {
if (null == t && n.is(e, "object") && "r" in e && "g" in e && "b" in e && (i = e.b,
t = e.g, e = e.r), null == t && n.is(e, "string")) {
var r = n.getRGB(e);
e = r.r, t = r.g, i = r.b;
}
return (e > 1 || t > 1 || i > 1) && (e /= 255, t /= 255, i /= 255), [ e, t, i ];
}, _t = function(e, t, i, r) {
e *= 255, t *= 255, i *= 255;
var o = {
r: e,
g: t,
b: i,
hex: n.rgb(e, t, i),
toString: St
};
return n.is(r, "finite") && (o.opacity = r), o;
};
n.color = function(e) {
var t;
return n.is(e, "object") && "h" in e && "s" in e && "b" in e ? (t = n.hsb2rgb(e),
e.r = t.r, e.g = t.g, e.b = t.b, e.hex = t.hex) : n.is(e, "object") && "h" in e && "s" in e && "l" in e ? (t = n.hsl2rgb(e),
e.r = t.r, e.g = t.g, e.b = t.b, e.hex = t.hex) : (n.is(e, "string") && (e = n.getRGB(e)),
n.is(e, "object") && "r" in e && "g" in e && "b" in e ? (t = n.rgb2hsl(e), e.h = t.h,
e.s = t.s, e.l = t.l, t = n.rgb2hsb(e), e.v = t.b) : (e = {
hex: "none"
}, e.r = e.g = e.b = e.h = e.s = e.v = e.l = -1)), e.toString = St, e;
}, n.hsb2rgb = function(e, t, n, i) {
this.is(e, "object") && "h" in e && "s" in e && "b" in e && (n = e.b, t = e.s, i = e.o,
e = e.h), e *= 360;
var r, o, a, s, l;
return e = e % 360 / 60, l = n * t, s = l * (1 - q(e % 2 - 1)), r = o = a = n - l,
e = ~~e, r += [ l, s, 0, 0, s, l ][e], o += [ s, l, l, s, 0, 0 ][e], a += [ 0, 0, s, l, l, s ][e],
_t(r, o, a, i);
}, n.hsl2rgb = function(e, t, n, i) {
this.is(e, "object") && "h" in e && "s" in e && "l" in e && (n = e.l, t = e.s, e = e.h),
(e > 1 || t > 1 || n > 1) && (e /= 360, t /= 100, n /= 100), e *= 360;
var r, o, a, s, l;
return e = e % 360 / 60, l = 2 * t * (.5 > n ? n : 1 - n), s = l * (1 - q(e % 2 - 1)),
r = o = a = n - l / 2, e = ~~e, r += [ l, s, 0, 0, s, l ][e], o += [ s, l, l, s, 0, 0 ][e],
a += [ 0, 0, s, l, l, s ][e], _t(r, o, a, i);
}, n.rgb2hsb = function(e, t, n) {
n = Ct(e, t, n), e = n[0], t = n[1], n = n[2];
var i, r, o, a;
return o = $(e, t, n), a = o - G(e, t, n), i = 0 == a ? null : o == e ? (t - n) / a : o == t ? (n - e) / a + 2 : (e - t) / a + 4,
i = (i + 360) % 6 * 60 / 360, r = 0 == a ? 0 : a / o, {
h: i,
s: r,
b: o,
toString: xt
};
}, n.rgb2hsl = function(e, t, n) {
n = Ct(e, t, n), e = n[0], t = n[1], n = n[2];
var i, r, o, a, s, l;
return a = $(e, t, n), s = G(e, t, n), l = a - s, i = 0 == l ? null : a == e ? (t - n) / l : a == t ? (n - e) / l + 2 : (e - t) / l + 4,
i = (i + 360) % 6 * 60 / 360, o = (a + s) / 2, r = 0 == l ? 0 : .5 > o ? l / (2 * o) : l / (2 - 2 * o),
{
h: i,
s: r,
l: o,
toString: wt
};
}, n._path2string = function() {
return this.join(",").replace(ot, "$1");
}, n._preload = function(e, t) {
var n = E.doc.createElement("img");
n.style.cssText = "position:absolute;left:-9999em;top:-9999em", n.onload = function() {
t.call(this), this.onload = null, E.doc.body.removeChild(this);
}, n.onerror = function() {
E.doc.body.removeChild(this);
}, E.doc.body.appendChild(n), n.src = e;
}, n.getRGB = o(function(e) {
if (!e || (e = R(e)).indexOf("-") + 1) return {
r: -1,
g: -1,
b: -1,
hex: "none",
error: 1,
toString: a
};
if ("none" == e) return {
r: -1,
g: -1,
b: -1,
hex: "none",
toString: a
};
!(rt[k](e.toLowerCase().substring(0, 2)) || "#" == e.charAt()) && (e = yt(e));
var t, i, r, o, s, l, c = e.match(X);
return c ? (c[2] && (r = Z(c[2].substring(5), 16), i = Z(c[2].substring(3, 5), 16),
t = Z(c[2].substring(1, 3), 16)), c[3] && (r = Z((s = c[3].charAt(3)) + s, 16),
i = Z((s = c[3].charAt(2)) + s, 16), t = Z((s = c[3].charAt(1)) + s, 16)), c[4] && (l = c[4][P](it),
t = J(l[0]), "%" == l[0].slice(-1) && (t *= 2.55), i = J(l[1]), "%" == l[1].slice(-1) && (i *= 2.55),
r = J(l[2]), "%" == l[2].slice(-1) && (r *= 2.55), "rgba" == c[1].toLowerCase().slice(0, 4) && (o = J(l[3])),
l[3] && "%" == l[3].slice(-1) && (o /= 100)), c[5] ? (l = c[5][P](it), t = J(l[0]),
"%" == l[0].slice(-1) && (t *= 2.55), i = J(l[1]), "%" == l[1].slice(-1) && (i *= 2.55),
r = J(l[2]), "%" == l[2].slice(-1) && (r *= 2.55), ("deg" == l[0].slice(-3) || "\xb0" == l[0].slice(-1)) && (t /= 360),
"hsba" == c[1].toLowerCase().slice(0, 4) && (o = J(l[3])), l[3] && "%" == l[3].slice(-1) && (o /= 100),
n.hsb2rgb(t, i, r, o)) : c[6] ? (l = c[6][P](it), t = J(l[0]), "%" == l[0].slice(-1) && (t *= 2.55),
i = J(l[1]), "%" == l[1].slice(-1) && (i *= 2.55), r = J(l[2]), "%" == l[2].slice(-1) && (r *= 2.55),
("deg" == l[0].slice(-3) || "\xb0" == l[0].slice(-1)) && (t /= 360), "hsla" == c[1].toLowerCase().slice(0, 4) && (o = J(l[3])),
l[3] && "%" == l[3].slice(-1) && (o /= 100), n.hsl2rgb(t, i, r, o)) : (c = {
r: t,
g: i,
b: r,
toString: a
}, c.hex = "#" + (16777216 | r | i << 8 | t << 16).toString(16).slice(1), n.is(o, "finite") && (c.opacity = o),
c)) : {
r: -1,
g: -1,
b: -1,
hex: "none",
error: 1,
toString: a
};
}, n), n.hsb = o(function(e, t, i) {
return n.hsb2rgb(e, t, i).hex;
}), n.hsl = o(function(e, t, i) {
return n.hsl2rgb(e, t, i).hex;
}), n.rgb = o(function(e, t, n) {
return "#" + (16777216 | n | t << 8 | e << 16).toString(16).slice(1);
}), n.getColor = function(e) {
var t = this.getColor.start = this.getColor.start || {
h: 0,
s: 1,
b: e || .75
}, n = this.hsb2rgb(t.h, t.s, t.b);
return t.h += .075, t.h > 1 && (t.h = 0, t.s -= .2, t.s <= 0 && (this.getColor.start = {
h: 0,
s: 1,
b: t.b
})), n.hex;
}, n.getColor.reset = function() {
delete this.start;
}, n.parsePathString = function(e) {
if (!e) return null;
var t = kt(e);
if (t.arr) return Tt(t.arr);
var i = {
a: 7,
c: 6,
h: 1,
l: 2,
m: 2,
r: 4,
q: 4,
s: 4,
t: 2,
v: 1,
z: 0
}, r = [];
return n.is(e, V) && n.is(e[0], V) && (r = Tt(e)), r.length || R(e).replace(at, function(e, t, n) {
var o = [], a = t.toLowerCase();
if (n.replace(lt, function(e, t) {
t && o.push(+t);
}), "m" == a && o.length > 2 && (r.push([ t ][N](o.splice(0, 2))), a = "l", t = "m" == t ? "l" : "L"),
"r" == a) r.push([ t ][N](o)); else for (;o.length >= i[a] && (r.push([ t ][N](o.splice(0, i[a]))),
i[a]); ) ;
}), r.toString = n._path2string, t.arr = Tt(r), r;
}, n.parseTransformString = o(function(e) {
if (!e) return null;
var t = [];
return n.is(e, V) && n.is(e[0], V) && (t = Tt(e)), t.length || R(e).replace(st, function(e, n, i) {
var r = [];
B.call(n), i.replace(lt, function(e, t) {
t && r.push(+t);
}), t.push([ n ][N](r));
}), t.toString = n._path2string, t;
});
var kt = function(e) {
var t = kt.ps = kt.ps || {};
return t[e] ? t[e].sleep = 100 : t[e] = {
sleep: 100
}, setTimeout(function() {
for (var n in t) t[k](n) && n != e && !--t[n].sleep && delete t[n];
}), t[e];
};
n.findDotsAtSegment = function(e, t, n, i, r, o, a, s, l) {
var c = 1 - l, u = H(c, 3), d = H(c, 2), p = l * l, h = p * l, f = u * e + 3 * d * l * n + 3 * c * l * l * r + h * a, m = u * t + 3 * d * l * i + 3 * c * l * l * o + h * s, g = e + 2 * l * (n - e) + p * (r - 2 * n + e), v = t + 2 * l * (i - t) + p * (o - 2 * i + t), b = n + 2 * l * (r - n) + p * (a - 2 * r + n), y = i + 2 * l * (o - i) + p * (s - 2 * o + i), x = c * e + l * n, w = c * t + l * i, S = c * r + l * a, C = c * o + l * s, _ = 90 - 180 * j.atan2(g - b, v - y) / U;
return (g > b || y > v) && (_ += 180), {
x: f,
y: m,
m: {
x: g,
y: v
},
n: {
x: b,
y: y
},
start: {
x: x,
y: w
},
end: {
x: S,
y: C
},
alpha: _
};
}, n.bezierBBox = function(e, t, i, r, o, a, s, l) {
n.is(e, "array") || (e = [ e, t, i, r, o, a, s, l ]);
var c = Rt.apply(null, e);
return {
x: c.min.x,
y: c.min.y,
x2: c.max.x,
y2: c.max.y,
width: c.max.x - c.min.x,
height: c.max.y - c.min.y
};
}, n.isPointInsideBBox = function(e, t, n) {
return t >= e.x && t <= e.x2 && n >= e.y && n <= e.y2;
}, n.isBBoxIntersect = function(e, t) {
var i = n.isPointInsideBBox;
return i(t, e.x, e.y) || i(t, e.x2, e.y) || i(t, e.x, e.y2) || i(t, e.x2, e.y2) || i(e, t.x, t.y) || i(e, t.x2, t.y) || i(e, t.x, t.y2) || i(e, t.x2, t.y2) || (e.x < t.x2 && e.x > t.x || t.x < e.x2 && t.x > e.x) && (e.y < t.y2 && e.y > t.y || t.y < e.y2 && t.y > e.y);
}, n.pathIntersection = function(e, t) {
return h(e, t);
}, n.pathIntersectionNumber = function(e, t) {
return h(e, t, 1);
}, n.isPointInsidePath = function(e, t, i) {
var r = n.pathBBox(e);
return n.isPointInsideBBox(r, t, i) && h(e, [ [ "M", t, i ], [ "H", r.x2 + 10 ] ], 1) % 2 == 1;
}, n._removedFactory = function(e) {
return function() {
t("raphael.log", null, "Rapha\xebl: you are calling to method \u201c" + e + "\u201d of removed object", e);
};
};
var Et = n.pathBBox = function(e) {
var t = kt(e);
if (t.bbox) return i(t.bbox);
if (!e) return {
x: 0,
y: 0,
width: 0,
height: 0,
x2: 0,
y2: 0
};
e = Pt(e);
for (var n, r = 0, o = 0, a = [], s = [], l = 0, c = e.length; c > l; l++) if (n = e[l],
"M" == n[0]) r = n[1], o = n[2], a.push(r), s.push(o); else {
var u = Rt(r, o, n[1], n[2], n[3], n[4], n[5], n[6]);
a = a[N](u.min.x, u.max.x), s = s[N](u.min.y, u.max.y), r = n[5], o = n[6];
}
var d = G[D](0, a), p = G[D](0, s), h = $[D](0, a), f = $[D](0, s), m = h - d, g = f - p, v = {
x: d,
y: p,
x2: h,
y2: f,
width: m,
height: g,
cx: d + m / 2,
cy: p + g / 2
};
return t.bbox = i(v), v;
}, Tt = function(e) {
var t = i(e);
return t.toString = n._path2string, t;
}, It = n._pathToRelative = function(e) {
var t = kt(e);
if (t.rel) return Tt(t.rel);
n.is(e, V) && n.is(e && e[0], V) || (e = n.parsePathString(e));
var i = [], r = 0, o = 0, a = 0, s = 0, l = 0;
"M" == e[0][0] && (r = e[0][1], o = e[0][2], a = r, s = o, l++, i.push([ "M", r, o ]));
for (var c = l, u = e.length; u > c; c++) {
var d = i[c] = [], p = e[c];
if (p[0] != B.call(p[0])) switch (d[0] = B.call(p[0]), d[0]) {
case "a":
d[1] = p[1], d[2] = p[2], d[3] = p[3], d[4] = p[4], d[5] = p[5], d[6] = +(p[6] - r).toFixed(3),
d[7] = +(p[7] - o).toFixed(3);
break;
case "v":
d[1] = +(p[1] - o).toFixed(3);
break;
case "m":
a = p[1], s = p[2];
default:
for (var h = 1, f = p.length; f > h; h++) d[h] = +(p[h] - (h % 2 ? r : o)).toFixed(3);
} else {
d = i[c] = [], "m" == p[0] && (a = p[1] + r, s = p[2] + o);
for (var m = 0, g = p.length; g > m; m++) i[c][m] = p[m];
}
var v = i[c].length;
switch (i[c][0]) {
case "z":
r = a, o = s;
break;
case "h":
r += +i[c][v - 1];
break;
case "v":
o += +i[c][v - 1];
break;
default:
r += +i[c][v - 2], o += +i[c][v - 1];
}
}
return i.toString = n._path2string, t.rel = Tt(i), i;
}, Dt = n._pathToAbsolute = function(e) {
var t = kt(e);
if (t.abs) return Tt(t.abs);
if (n.is(e, V) && n.is(e && e[0], V) || (e = n.parsePathString(e)), !e || !e.length) return [ [ "M", 0, 0 ] ];
var i = [], r = 0, o = 0, a = 0, l = 0, c = 0;
"M" == e[0][0] && (r = +e[0][1], o = +e[0][2], a = r, l = o, c++, i[0] = [ "M", r, o ]);
for (var u, d, p = 3 == e.length && "M" == e[0][0] && "R" == e[1][0].toUpperCase() && "Z" == e[2][0].toUpperCase(), h = c, f = e.length; f > h; h++) {
if (i.push(u = []), d = e[h], d[0] != et.call(d[0])) switch (u[0] = et.call(d[0]),
u[0]) {
case "A":
u[1] = d[1], u[2] = d[2], u[3] = d[3], u[4] = d[4], u[5] = d[5], u[6] = +(d[6] + r),
u[7] = +(d[7] + o);
break;
case "V":
u[1] = +d[1] + o;
break;
case "H":
u[1] = +d[1] + r;
break;
case "R":
for (var m = [ r, o ][N](d.slice(1)), g = 2, v = m.length; v > g; g++) m[g] = +m[g] + r,
m[++g] = +m[g] + o;
i.pop(), i = i[N](s(m, p));
break;
case "M":
a = +d[1] + r, l = +d[2] + o;
default:
for (g = 1, v = d.length; v > g; g++) u[g] = +d[g] + (g % 2 ? r : o);
} else if ("R" == d[0]) m = [ r, o ][N](d.slice(1)), i.pop(), i = i[N](s(m, p)),
u = [ "R" ][N](d.slice(-2)); else for (var b = 0, y = d.length; y > b; b++) u[b] = d[b];
switch (u[0]) {
case "Z":
r = a, o = l;
break;
case "H":
r = u[1];
break;
case "V":
o = u[1];
break;
case "M":
a = u[u.length - 2], l = u[u.length - 1];
default:
r = u[u.length - 2], o = u[u.length - 1];
}
}
return i.toString = n._path2string, t.abs = Tt(i), i;
}, Nt = function(e, t, n, i) {
return [ e, t, n, i, n, i ];
}, Mt = function(e, t, n, i, r, o) {
return [ 1 / 3 * e + 2 / 3 * n, 1 / 3 * t + 2 / 3 * i, 1 / 3 * r + 2 / 3 * n, 1 / 3 * o + 2 / 3 * i, r, o ];
}, Lt = function(e, t, n, i, r, a, s, l, c, u) {
var d, p = 120 * U / 180, h = U / 180 * (+r || 0), f = [], m = o(function(e, t, n) {
return {
x: e * j.cos(n) - t * j.sin(n),
y: e * j.sin(n) + t * j.cos(n)
};
});
if (u) _ = u[0], k = u[1], S = u[2], C = u[3]; else {
d = m(e, t, -h), e = d.x, t = d.y, d = m(l, c, -h), l = d.x, c = d.y;
var g = (j.cos(U / 180 * r), j.sin(U / 180 * r), (e - l) / 2), v = (t - c) / 2, b = g * g / (n * n) + v * v / (i * i);
b > 1 && (b = j.sqrt(b), n *= b, i *= b);
var y = n * n, x = i * i, w = (a == s ? -1 : 1) * j.sqrt(q((y * x - y * v * v - x * g * g) / (y * v * v + x * g * g))), S = w * n * v / i + (e + l) / 2, C = w * -i * g / n + (t + c) / 2, _ = j.asin(((t - C) / i).toFixed(9)), k = j.asin(((c - C) / i).toFixed(9));
_ = S > e ? U - _ : _, k = S > l ? U - k : k, 0 > _ && (_ = 2 * U + _), 0 > k && (k = 2 * U + k),
s && _ > k && (_ -= 2 * U), !s && k > _ && (k -= 2 * U);
}
var E = k - _;
if (q(E) > p) {
var T = k, I = l, D = c;
k = _ + p * (s && k > _ ? 1 : -1), l = S + n * j.cos(k), c = C + i * j.sin(k), f = Lt(l, c, n, i, r, 0, s, I, D, [ k, T, S, C ]);
}
E = k - _;
var M = j.cos(_), L = j.sin(_), A = j.cos(k), R = j.sin(k), O = j.tan(E / 4), F = 4 / 3 * n * O, B = 4 / 3 * i * O, $ = [ e, t ], G = [ e + F * L, t - B * M ], H = [ l + F * R, c - B * A ], z = [ l, c ];
if (G[0] = 2 * $[0] - G[0], G[1] = 2 * $[1] - G[1], u) return [ G, H, z ][N](f);
f = [ G, H, z ][N](f).join()[P](",");
for (var V = [], W = 0, X = f.length; X > W; W++) V[W] = W % 2 ? m(f[W - 1], f[W], h).y : m(f[W], f[W + 1], h).x;
return V;
}, At = function(e, t, n, i, r, o, a, s, l) {
var c = 1 - l;
return {
x: H(c, 3) * e + 3 * H(c, 2) * l * n + 3 * c * l * l * r + H(l, 3) * a,
y: H(c, 3) * t + 3 * H(c, 2) * l * i + 3 * c * l * l * o + H(l, 3) * s
};
}, Rt = o(function(e, t, n, i, r, o, a, s) {
var l, c = r - 2 * n + e - (a - 2 * r + n), u = 2 * (n - e) - 2 * (r - n), d = e - n, p = (-u + j.sqrt(u * u - 4 * c * d)) / 2 / c, h = (-u - j.sqrt(u * u - 4 * c * d)) / 2 / c, f = [ t, s ], m = [ e, a ];
return q(p) > "1e12" && (p = .5), q(h) > "1e12" && (h = .5), p > 0 && 1 > p && (l = At(e, t, n, i, r, o, a, s, p),
m.push(l.x), f.push(l.y)), h > 0 && 1 > h && (l = At(e, t, n, i, r, o, a, s, h),
m.push(l.x), f.push(l.y)), c = o - 2 * i + t - (s - 2 * o + i), u = 2 * (i - t) - 2 * (o - i),
d = t - i, p = (-u + j.sqrt(u * u - 4 * c * d)) / 2 / c, h = (-u - j.sqrt(u * u - 4 * c * d)) / 2 / c,
q(p) > "1e12" && (p = .5), q(h) > "1e12" && (h = .5), p > 0 && 1 > p && (l = At(e, t, n, i, r, o, a, s, p),
m.push(l.x), f.push(l.y)), h > 0 && 1 > h && (l = At(e, t, n, i, r, o, a, s, h),
m.push(l.x), f.push(l.y)), {
min: {
x: G[D](0, m),
y: G[D](0, f)
},
max: {
x: $[D](0, m),
y: $[D](0, f)
}
};
}), Pt = n._path2curve = o(function(e, t) {
var n = !t && kt(e);
if (!t && n.curve) return Tt(n.curve);
for (var i = Dt(e), r = t && Dt(t), o = {
x: 0,
y: 0,
bx: 0,
by: 0,
X: 0,
Y: 0,
qx: null,
qy: null
}, a = {
x: 0,
y: 0,
bx: 0,
by: 0,
X: 0,
Y: 0,
qx: null,
qy: null
}, s = (function(e, t, n) {
var i, r, o = {
T: 1,
Q: 1
};
if (!e) return [ "C", t.x, t.y, t.x, t.y, t.x, t.y ];
switch (!(e[0] in o) && (t.qx = t.qy = null), e[0]) {
case "M":
t.X = e[1], t.Y = e[2];
break;
case "A":
e = [ "C" ][N](Lt[D](0, [ t.x, t.y ][N](e.slice(1))));
break;
case "S":
"C" == n || "S" == n ? (i = 2 * t.x - t.bx, r = 2 * t.y - t.by) : (i = t.x, r = t.y),
e = [ "C", i, r ][N](e.slice(1));
break;
case "T":
"Q" == n || "T" == n ? (t.qx = 2 * t.x - t.qx, t.qy = 2 * t.y - t.qy) : (t.qx = t.x,
t.qy = t.y), e = [ "C" ][N](Mt(t.x, t.y, t.qx, t.qy, e[1], e[2]));
break;
case "Q":
t.qx = e[1], t.qy = e[2], e = [ "C" ][N](Mt(t.x, t.y, e[1], e[2], e[3], e[4]));
break;
case "L":
e = [ "C" ][N](Nt(t.x, t.y, e[1], e[2]));
break;
case "H":
e = [ "C" ][N](Nt(t.x, t.y, e[1], t.y));
break;
case "V":
e = [ "C" ][N](Nt(t.x, t.y, t.x, e[1]));
break;
case "Z":
e = [ "C" ][N](Nt(t.x, t.y, t.X, t.Y));
}
return e;
}), l = function(e, t) {
if (e[t].length > 7) {
e[t].shift();
for (var n = e[t]; n.length; ) u[t] = "A", r && (d[t] = "A"), e.splice(t++, 0, [ "C" ][N](n.splice(0, 6)));
e.splice(t, 1), m = $(i.length, r && r.length || 0);
}
}, c = function(e, t, n, o, a) {
e && t && "M" == e[a][0] && "M" != t[a][0] && (t.splice(a, 0, [ "M", o.x, o.y ]),
n.bx = 0, n.by = 0, n.x = e[a][1], n.y = e[a][2], m = $(i.length, r && r.length || 0));
}, u = [], d = [], p = "", h = "", f = 0, m = $(i.length, r && r.length || 0); m > f; f++) {
i[f] && (p = i[f][0]), "C" != p && (u[f] = p, f && (h = u[f - 1])), i[f] = s(i[f], o, h),
"A" != u[f] && "C" == p && (u[f] = "C"), l(i, f), r && (r[f] && (p = r[f][0]), "C" != p && (d[f] = p,
f && (h = d[f - 1])), r[f] = s(r[f], a, h), "A" != d[f] && "C" == p && (d[f] = "C"),
l(r, f)), c(i, r, o, a, f), c(r, i, a, o, f);
var g = i[f], v = r && r[f], b = g.length, y = r && v.length;
o.x = g[b - 2], o.y = g[b - 1], o.bx = J(g[b - 4]) || o.x, o.by = J(g[b - 3]) || o.y,
a.bx = r && (J(v[y - 4]) || a.x), a.by = r && (J(v[y - 3]) || a.y), a.x = r && v[y - 2],
a.y = r && v[y - 1];
}
return r || (n.curve = Tt(i)), r ? [ i, r ] : i;
}, null, Tt), Ot = (n._parseDots = o(function(e) {
for (var t = [], i = 0, r = e.length; r > i; i++) {
var o = {}, a = e[i].match(/^([^:]*):?([\d\.]*)/);
if (o.color = n.getRGB(a[1]), o.color.error) return null;
o.color = o.color.hex, a[2] && (o.offset = a[2] + "%"), t.push(o);
}
for (i = 1, r = t.length - 1; r > i; i++) if (!t[i].offset) {
for (var s = J(t[i - 1].offset || 0), l = 0, c = i + 1; r > c; c++) if (t[c].offset) {
l = t[c].offset;
break;
}
l || (l = 100, c = r), l = J(l);
for (var u = (l - s) / (c - i + 1); c > i; i++) s += u, t[i].offset = s + "%";
}
return t;
}), n._tear = function(e, t) {
e == t.top && (t.top = e.prev), e == t.bottom && (t.bottom = e.next), e.next && (e.next.prev = e.prev),
e.prev && (e.prev.next = e.next);
}), Ft = (n._tofront = function(e, t) {
t.top !== e && (Ot(e, t), e.next = null, e.prev = t.top, t.top.next = e, t.top = e);
}, n._toback = function(e, t) {
t.bottom !== e && (Ot(e, t), e.next = t.bottom, e.prev = null, t.bottom.prev = e,
t.bottom = e);
}, n._insertafter = function(e, t, n) {
Ot(e, n), t == n.top && (n.top = e), t.next && (t.next.prev = e), e.next = t.next,
e.prev = t, t.next = e;
}, n._insertbefore = function(e, t, n) {
Ot(e, n), t == n.bottom && (n.bottom = e), t.prev && (t.prev.next = e), e.prev = t.prev,
t.prev = e, e.next = t;
}, n.toMatrix = function(e, t) {
var n = Et(e), i = {
_: {
transform: L
},
getBBox: function() {
return n;
}
};
return Bt(i, t), i.matrix;
}), Bt = (n.transformPath = function(e, t) {
return gt(e, Ft(e, t));
}, n._extractTransform = function(e, t) {
if (null == t) return e._.transform;
t = R(t).replace(/\.{3}|\u2026/g, e._.transform || L);
var i = n.parseTransformString(t), r = 0, o = 0, a = 0, s = 1, l = 1, c = e._, u = new f();
if (c.transform = i || [], i) for (var d = 0, p = i.length; p > d; d++) {
var h, m, g, v, b, y = i[d], x = y.length, w = R(y[0]).toLowerCase(), S = y[0] != w, C = S ? u.invert() : 0;
"t" == w && 3 == x ? S ? (h = C.x(0, 0), m = C.y(0, 0), g = C.x(y[1], y[2]), v = C.y(y[1], y[2]),
u.translate(g - h, v - m)) : u.translate(y[1], y[2]) : "r" == w ? 2 == x ? (b = b || e.getBBox(1),
u.rotate(y[1], b.x + b.width / 2, b.y + b.height / 2), r += y[1]) : 4 == x && (S ? (g = C.x(y[2], y[3]),
v = C.y(y[2], y[3]), u.rotate(y[1], g, v)) : u.rotate(y[1], y[2], y[3]), r += y[1]) : "s" == w ? 2 == x || 3 == x ? (b = b || e.getBBox(1),
u.scale(y[1], y[x - 1], b.x + b.width / 2, b.y + b.height / 2), s *= y[1], l *= y[x - 1]) : 5 == x && (S ? (g = C.x(y[3], y[4]),
v = C.y(y[3], y[4]), u.scale(y[1], y[2], g, v)) : u.scale(y[1], y[2], y[3], y[4]),
s *= y[1], l *= y[2]) : "m" == w && 7 == x && u.add(y[1], y[2], y[3], y[4], y[5], y[6]),
c.dirtyT = 1, e.matrix = u;
}
e.matrix = u, c.sx = s, c.sy = l, c.deg = r, c.dx = o = u.e, c.dy = a = u.f, 1 == s && 1 == l && !r && c.bbox ? (c.bbox.x += +o,
c.bbox.y += +a) : c.dirtyT = 1;
}), jt = function(e) {
var t = e[0];
switch (t.toLowerCase()) {
case "t":
return [ t, 0, 0 ];
case "m":
return [ t, 1, 0, 0, 1, 0, 0 ];
case "r":
return 4 == e.length ? [ t, 0, e[2], e[3] ] : [ t, 0 ];
case "s":
return 5 == e.length ? [ t, 1, 1, e[3], e[4] ] : 3 == e.length ? [ t, 1, 1 ] : [ t, 1 ];
}
}, $t = n._equaliseTransform = function(e, t) {
t = R(t).replace(/\.{3}|\u2026/g, e), e = n.parseTransformString(e) || [], t = n.parseTransformString(t) || [];
for (var i, r, o, a, s = $(e.length, t.length), l = [], c = [], u = 0; s > u; u++) {
if (o = e[u] || jt(t[u]), a = t[u] || jt(o), o[0] != a[0] || "r" == o[0].toLowerCase() && (o[2] != a[2] || o[3] != a[3]) || "s" == o[0].toLowerCase() && (o[3] != a[3] || o[4] != a[4])) return;
for (l[u] = [], c[u] = [], i = 0, r = $(o.length, a.length); r > i; i++) i in o && (l[u][i] = o[i]),
i in a && (c[u][i] = a[i]);
}
return {
from: l,
to: c
};
};
n._getContainer = function(e, t, i, r) {
var o;
return null != (o = null != r || n.is(e, "object") ? e : E.doc.getElementById(e)) ? o.tagName ? null == t ? {
container: o,
width: o.style.pixelWidth || o.offsetWidth,
height: o.style.pixelHeight || o.offsetHeight
} : {
container: o,
width: t,
height: i
} : {
container: 1,
x: e,
y: t,
width: i,
height: r
} : void 0;
}, n.pathToRelative = It, n._engine = {}, n.path2curve = Pt, n.matrix = function(e, t, n, i, r, o) {
return new f(e, t, n, i, r, o);
}, function(e) {
function t(e) {
return e[0] * e[0] + e[1] * e[1];
}
function i(e) {
var n = j.sqrt(t(e));
e[0] && (e[0] /= n), e[1] && (e[1] /= n);
}
e.add = function(e, t, n, i, r, o) {
var a, s, l, c, u = [ [], [], [] ], d = [ [ this.a, this.c, this.e ], [ this.b, this.d, this.f ], [ 0, 0, 1 ] ], p = [ [ e, n, r ], [ t, i, o ], [ 0, 0, 1 ] ];
for (e && e instanceof f && (p = [ [ e.a, e.c, e.e ], [ e.b, e.d, e.f ], [ 0, 0, 1 ] ]),
a = 0; 3 > a; a++) for (s = 0; 3 > s; s++) {
for (c = 0, l = 0; 3 > l; l++) c += d[a][l] * p[l][s];
u[a][s] = c;
}
this.a = u[0][0], this.b = u[1][0], this.c = u[0][1], this.d = u[1][1], this.e = u[0][2],
this.f = u[1][2];
}, e.invert = function() {
var e = this, t = e.a * e.d - e.b * e.c;
return new f(e.d / t, -e.b / t, -e.c / t, e.a / t, (e.c * e.f - e.d * e.e) / t, (e.b * e.e - e.a * e.f) / t);
}, e.clone = function() {
return new f(this.a, this.b, this.c, this.d, this.e, this.f);
}, e.translate = function(e, t) {
this.add(1, 0, 0, 1, e, t);
}, e.scale = function(e, t, n, i) {
null == t && (t = e), (n || i) && this.add(1, 0, 0, 1, n, i), this.add(e, 0, 0, t, 0, 0),
(n || i) && this.add(1, 0, 0, 1, -n, -i);
}, e.rotate = function(e, t, i) {
e = n.rad(e), t = t || 0, i = i || 0;
var r = +j.cos(e).toFixed(9), o = +j.sin(e).toFixed(9);
this.add(r, o, -o, r, t, i), this.add(1, 0, 0, 1, -t, -i);
}, e.x = function(e, t) {
return e * this.a + t * this.c + this.e;
}, e.y = function(e, t) {
return e * this.b + t * this.d + this.f;
}, e.get = function(e) {
return +this[R.fromCharCode(97 + e)].toFixed(4);
}, e.toString = function() {
return n.svg ? "matrix(" + [ this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5) ].join() + ")" : [ this.get(0), this.get(2), this.get(1), this.get(3), 0, 0 ].join();
}, e.toFilter = function() {
return "progid:DXImageTransform.Microsoft.Matrix(M11=" + this.get(0) + ", M12=" + this.get(2) + ", M21=" + this.get(1) + ", M22=" + this.get(3) + ", Dx=" + this.get(4) + ", Dy=" + this.get(5) + ", sizingmethod='auto expand')";
}, e.offset = function() {
return [ this.e.toFixed(4), this.f.toFixed(4) ];
}, e.split = function() {
var e = {};
e.dx = this.e, e.dy = this.f;
var r = [ [ this.a, this.c ], [ this.b, this.d ] ];
e.scalex = j.sqrt(t(r[0])), i(r[0]), e.shear = r[0][0] * r[1][0] + r[0][1] * r[1][1],
r[1] = [ r[1][0] - r[0][0] * e.shear, r[1][1] - r[0][1] * e.shear ], e.scaley = j.sqrt(t(r[1])),
i(r[1]), e.shear /= e.scaley;
var o = -r[0][1], a = r[1][1];
return 0 > a ? (e.rotate = n.deg(j.acos(a)), 0 > o && (e.rotate = 360 - e.rotate)) : e.rotate = n.deg(j.asin(o)),
e.isSimple = !(+e.shear.toFixed(9) || e.scalex.toFixed(9) != e.scaley.toFixed(9) && e.rotate),
e.isSuperSimple = !+e.shear.toFixed(9) && e.scalex.toFixed(9) == e.scaley.toFixed(9) && !e.rotate,
e.noRotation = !+e.shear.toFixed(9) && !e.rotate, e;
}, e.toTransformString = function(e) {
var t = e || this[P]();
return t.isSimple ? (t.scalex = +t.scalex.toFixed(4), t.scaley = +t.scaley.toFixed(4),
t.rotate = +t.rotate.toFixed(4), (t.dx || t.dy ? "t" + [ t.dx, t.dy ] : L) + (1 != t.scalex || 1 != t.scaley ? "s" + [ t.scalex, t.scaley, 0, 0 ] : L) + (t.rotate ? "r" + [ t.rotate, 0, 0 ] : L)) : "m" + [ this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5) ];
};
}(f.prototype);
var Gt = navigator.userAgent.match(/Version\/(.*?)\s/) || navigator.userAgent.match(/Chrome\/(\d+)/);
w.safari = "Apple Computer, Inc." == navigator.vendor && (Gt && Gt[1] < 4 || "iP" == navigator.platform.slice(0, 2)) || "Google Inc." == navigator.vendor && Gt && Gt[1] < 8 ? function() {
var e = this.rect(-99, -99, this.width + 99, this.height + 99).attr({
stroke: "none"
});
setTimeout(function() {
e.remove();
});
} : dt;
for (var qt = function() {
this.returnValue = !1;
}, Ht = function() {
return this.originalEvent.preventDefault();
}, Ut = function() {
this.cancelBubble = !0;
}, zt = function() {
return this.originalEvent.stopPropagation();
}, Vt = function(e) {
var t = E.doc.documentElement.scrollTop || E.doc.body.scrollTop, n = E.doc.documentElement.scrollLeft || E.doc.body.scrollLeft;
return {
x: e.clientX + n,
y: e.clientY + t
};
}, Wt = function() {
return E.doc.addEventListener ? function(e, t, n, i) {
var r = function(e) {
var t = Vt(e);
return n.call(i, e, t.x, t.y);
};
if (e.addEventListener(t, r, !1), M && F[t]) {
var o = function(t) {
for (var r = Vt(t), o = t, a = 0, s = t.targetTouches && t.targetTouches.length; s > a; a++) if (t.targetTouches[a].target == e) {
t = t.targetTouches[a], t.originalEvent = o, t.preventDefault = Ht, t.stopPropagation = zt;
break;
}
return n.call(i, t, r.x, r.y);
};
e.addEventListener(F[t], o, !1);
}
return function() {
return e.removeEventListener(t, r, !1), M && F[t] && e.removeEventListener(F[t], o, !1),
!0;
};
} : E.doc.attachEvent ? function(e, t, n, i) {
var r = function(e) {
e = e || E.win.event;
var t = E.doc.documentElement.scrollTop || E.doc.body.scrollTop, r = E.doc.documentElement.scrollLeft || E.doc.body.scrollLeft, o = e.clientX + r, a = e.clientY + t;
return e.preventDefault = e.preventDefault || qt, e.stopPropagation = e.stopPropagation || Ut,
n.call(i, e, o, a);
};
return e.attachEvent("on" + t, r), function() {
return e.detachEvent("on" + t, r), !0;
};
} : void 0;
}(), Xt = [], Qt = function(e) {
for (var n, i = e.clientX, r = e.clientY, o = E.doc.documentElement.scrollTop || E.doc.body.scrollTop, a = E.doc.documentElement.scrollLeft || E.doc.body.scrollLeft, s = Xt.length; s--; ) {
if (n = Xt[s], M && e.touches) {
for (var l, c = e.touches.length; c--; ) if (l = e.touches[c], l.identifier == n.el._drag.id) {
i = l.clientX, r = l.clientY, (e.originalEvent ? e.originalEvent : e).preventDefault();
break;
}
} else e.preventDefault();
var u, d = n.el.node, p = d.nextSibling, h = d.parentNode, f = d.style.display;
E.win.opera && h.removeChild(d), d.style.display = "none", u = n.el.paper.getElementByPoint(i, r),
d.style.display = f, E.win.opera && (p ? h.insertBefore(d, p) : h.appendChild(d)),
u && t("raphael.drag.over." + n.el.id, n.el, u), i += a, r += o, t("raphael.drag.move." + n.el.id, n.move_scope || n.el, i - n.el._drag.x, r - n.el._drag.y, i, r, e);
}
}, Yt = function(e) {
n.unmousemove(Qt).unmouseup(Yt);
for (var i, r = Xt.length; r--; ) i = Xt[r], i.el._drag = {}, t("raphael.drag.end." + i.el.id, i.end_scope || i.start_scope || i.move_scope || i.el, e);
Xt = [];
}, Kt = n.el = {}, Jt = O.length; Jt--; ) !function(e) {
n[e] = Kt[e] = function(t, i) {
return n.is(t, "function") && (this.events = this.events || [], this.events.push({
name: e,
f: t,
unbind: Wt(this.shape || this.node || E.doc, e, t, i || this)
})), this;
}, n["un" + e] = Kt["un" + e] = function(t) {
for (var i = this.events || [], r = i.length; r--; ) i[r].name != e || !n.is(t, "undefined") && i[r].f != t || (i[r].unbind(),
i.splice(r, 1), !i.length && delete this.events);
return this;
};
}(O[Jt]);
Kt.data = function(e, i) {
var r = ct[this.id] = ct[this.id] || {};
if (0 == arguments.length) return r;
if (1 == arguments.length) {
if (n.is(e, "object")) {
for (var o in e) e[k](o) && this.data(o, e[o]);
return this;
}
return t("raphael.data.get." + this.id, this, r[e], e), r[e];
}
return r[e] = i, t("raphael.data.set." + this.id, this, i, e), this;
}, Kt.removeData = function(e) {
return null == e ? ct[this.id] = {} : ct[this.id] && delete ct[this.id][e], this;
}, Kt.getData = function() {
return i(ct[this.id] || {});
}, Kt.hover = function(e, t, n, i) {
return this.mouseover(e, n).mouseout(t, i || n);
}, Kt.unhover = function(e, t) {
return this.unmouseover(e).unmouseout(t);
};
var Zt = [];
Kt.drag = function(e, i, r, o, a, s) {
function l(l) {
(l.originalEvent || l).preventDefault();
var c = l.clientX, u = l.clientY, d = E.doc.documentElement.scrollTop || E.doc.body.scrollTop, p = E.doc.documentElement.scrollLeft || E.doc.body.scrollLeft;
if (this._drag.id = l.identifier, M && l.touches) for (var h, f = l.touches.length; f--; ) if (h = l.touches[f],
this._drag.id = h.identifier, h.identifier == this._drag.id) {
c = h.clientX, u = h.clientY;
break;
}
this._drag.x = c + p, this._drag.y = u + d, !Xt.length && n.mousemove(Qt).mouseup(Yt),
Xt.push({
el: this,
move_scope: o,
start_scope: a,
end_scope: s
}), i && t.on("raphael.drag.start." + this.id, i), e && t.on("raphael.drag.move." + this.id, e),
r && t.on("raphael.drag.end." + this.id, r), t("raphael.drag.start." + this.id, a || o || this, l.clientX + p, l.clientY + d, l);
}
return this._drag = {}, Zt.push({
el: this,
start: l
}), this.mousedown(l), this;
}, Kt.onDragOver = function(e) {
e ? t.on("raphael.drag.over." + this.id, e) : t.unbind("raphael.drag.over." + this.id);
}, Kt.undrag = function() {
for (var e = Zt.length; e--; ) Zt[e].el == this && (this.unmousedown(Zt[e].start),
Zt.splice(e, 1), t.unbind("raphael.drag.*." + this.id));
!Zt.length && n.unmousemove(Qt).unmouseup(Yt), Xt = [];
}, w.circle = function(e, t, i) {
var r = n._engine.circle(this, e || 0, t || 0, i || 0);
return this.__set__ && this.__set__.push(r), r;
}, w.rect = function(e, t, i, r, o) {
var a = n._engine.rect(this, e || 0, t || 0, i || 0, r || 0, o || 0);
return this.__set__ && this.__set__.push(a), a;
}, w.ellipse = function(e, t, i, r) {
var o = n._engine.ellipse(this, e || 0, t || 0, i || 0, r || 0);
return this.__set__ && this.__set__.push(o), o;
}, w.path = function(e) {
e && !n.is(e, "string") && !n.is(e[0], V) && (e += L);
var t = n._engine.path(n.format[D](n, arguments), this);
return this.__set__ && this.__set__.push(t), t;
}, w.image = function(e, t, i, r, o) {
var a = n._engine.image(this, e || "about:blank", t || 0, i || 0, r || 0, o || 0);
return this.__set__ && this.__set__.push(a), a;
}, w.text = function(e, t, i) {
var r = n._engine.text(this, e || 0, t || 0, R(i));
return this.__set__ && this.__set__.push(r), r;
}, w.set = function(e) {
!n.is(e, "array") && (e = Array.prototype.splice.call(arguments, 0, arguments.length));
var t = new pn(e);
return this.__set__ && this.__set__.push(t), t.paper = this, t.type = "set", t;
}, w.setStart = function(e) {
this.__set__ = e || this.set();
}, w.setFinish = function() {
var e = this.__set__;
return delete this.__set__, e;
}, w.getSize = function() {
var e = this.canvas.parentNode;
return {
width: e.offsetWidth,
height: e.offsetHeight
};
}, w.setSize = function(e, t) {
return n._engine.setSize.call(this, e, t);
}, w.setViewBox = function(e, t, i, r, o) {
return n._engine.setViewBox.call(this, e, t, i, r, o);
}, w.top = w.bottom = null, w.raphael = n;
var en = function(e) {
var t = e.getBoundingClientRect(), n = e.ownerDocument, i = n.body, r = n.documentElement, o = r.clientTop || i.clientTop || 0, a = r.clientLeft || i.clientLeft || 0;
return {
y: t.top + (E.win.pageYOffset || r.scrollTop || i.scrollTop) - o,
x: t.left + (E.win.pageXOffset || r.scrollLeft || i.scrollLeft) - a
};
};
w.getElementByPoint = function(e, t) {
var n = this, i = n.canvas, r = E.doc.elementFromPoint(e, t);
if (E.win.opera && "svg" == r.tagName) {
var o = en(i), a = i.createSVGRect();
a.x = e - o.x, a.y = t - o.y, a.width = a.height = 1;
var s = i.getIntersectionList(a, null);
s.length && (r = s[s.length - 1]);
}
if (!r) return null;
for (;r.parentNode && r != i.parentNode && !r.raphael; ) r = r.parentNode;
return r == n.canvas.parentNode && (r = i), r = r && r.raphael ? n.getById(r.raphaelid) : null;
}, w.getElementsByBBox = function(e) {
var t = this.set();
return this.forEach(function(i) {
n.isBBoxIntersect(i.getBBox(), e) && t.push(i);
}), t;
}, w.getById = function(e) {
for (var t = this.bottom; t; ) {
if (t.id == e) return t;
t = t.next;
}
return null;
}, w.forEach = function(e, t) {
for (var n = this.bottom; n; ) {
if (!1 === e.call(t, n)) return this;
n = n.next;
}
return this;
}, w.getElementsByPoint = function(e, t) {
var n = this.set();
return this.forEach(function(i) {
i.isPointInside(e, t) && n.push(i);
}), n;
}, Kt.isPointInside = function(e, t) {
var i = this.realPath = mt[this.type](this);
return this.attr("transform") && this.attr("transform").length && (i = n.transformPath(i, this.attr("transform"))),
n.isPointInsidePath(i, e, t);
}, Kt.getBBox = function(e) {
if (this.removed) return {};
var t = this._;
return e ? (!t.dirty && t.bboxwt || (this.realPath = mt[this.type](this), t.bboxwt = Et(this.realPath),
t.bboxwt.toString = m, t.dirty = 0), t.bboxwt) : ((t.dirty || t.dirtyT || !t.bbox) && (!t.dirty && this.realPath || (t.bboxwt = 0,
this.realPath = mt[this.type](this)), t.bbox = Et(gt(this.realPath, this.matrix)),
t.bbox.toString = m, t.dirty = t.dirtyT = 0), t.bbox);
}, Kt.clone = function() {
if (this.removed) return null;
var e = this.paper[this.type]().attr(this.attr());
return this.__set__ && this.__set__.push(e), e;
}, Kt.glow = function(e) {
if ("text" == this.type) return null;
e = e || {};
var t = {
width: (e.width || 10) + (+this.attr("stroke-width") || 1),
fill: e.fill || !1,
opacity: e.opacity || .5,
offsetx: e.offsetx || 0,
offsety: e.offsety || 0,
color: e.color || "#000"
}, n = t.width / 2, i = this.paper, r = i.set(), o = this.realPath || mt[this.type](this);
o = this.matrix ? gt(o, this.matrix) : o;
for (var a = 1; n + 1 > a; a++) r.push(i.path(o).attr({
stroke: t.color,
fill: t.fill ? t.color : "none",
"stroke-linejoin": "round",
"stroke-linecap": "round",
"stroke-width": +(t.width / n * a).toFixed(3),
opacity: +(t.opacity / n).toFixed(3)
}));
return r.insertBefore(this).translate(t.offsetx, t.offsety);
};
var tn = function(e, t, i, r, o, a, s, l, d) {
return null == d ? c(e, t, i, r, o, a, s, l) : n.findDotsAtSegment(e, t, i, r, o, a, s, l, u(e, t, i, r, o, a, s, l, d));
}, nn = function(e, t) {
return function(i, r, o) {
i = Pt(i);
for (var a, s, l, c, u, d = "", p = {}, h = 0, f = 0, m = i.length; m > f; f++) {
if (l = i[f], "M" == l[0]) a = +l[1], s = +l[2]; else {
if (c = tn(a, s, l[1], l[2], l[3], l[4], l[5], l[6]), h + c > r) {
if (t && !p.start) {
if (u = tn(a, s, l[1], l[2], l[3], l[4], l[5], l[6], r - h), d += [ "C" + u.start.x, u.start.y, u.m.x, u.m.y, u.x, u.y ],
o) return d;
p.start = d, d = [ "M" + u.x, u.y + "C" + u.n.x, u.n.y, u.end.x, u.end.y, l[5], l[6] ].join(),
h += c, a = +l[5], s = +l[6];
continue;
}
if (!e && !t) return u = tn(a, s, l[1], l[2], l[3], l[4], l[5], l[6], r - h), {
x: u.x,
y: u.y,
alpha: u.alpha
};
}
h += c, a = +l[5], s = +l[6];
}
d += l.shift() + l;
}
return p.end = d, u = e ? h : t ? p : n.findDotsAtSegment(a, s, l[0], l[1], l[2], l[3], l[4], l[5], 1),
u.alpha && (u = {
x: u.x,
y: u.y,
alpha: u.alpha
}), u;
};
}, rn = nn(1), on = nn(), an = nn(0, 1);
n.getTotalLength = rn, n.getPointAtLength = on, n.getSubpath = function(e, t, n) {
if (this.getTotalLength(e) - n < 1e-6) return an(e, t).end;
var i = an(e, n, 1);
return t ? an(i, t).end : i;
}, Kt.getTotalLength = function() {
var e = this.getPath();
return e ? this.node.getTotalLength ? this.node.getTotalLength() : rn(e) : void 0;
}, Kt.getPointAtLength = function(e) {
var t = this.getPath();
return t ? on(t, e) : void 0;
}, Kt.getPath = function() {
var e, t = n._getPath[this.type];
return "text" != this.type && "set" != this.type ? (t && (e = t(this)), e) : void 0;
}, Kt.getSubpath = function(e, t) {
var i = this.getPath();
return i ? n.getSubpath(i, e, t) : void 0;
};
var sn = n.easing_formulas = {
linear: function(e) {
return e;
},
"<": function(e) {
return H(e, 1.7);
},
">": function(e) {
return H(e, .48);
},
"<>": function(e) {
var t = .48 - e / 1.04, n = j.sqrt(.1734 + t * t), i = n - t, r = H(q(i), 1 / 3) * (0 > i ? -1 : 1), o = -n - t, a = H(q(o), 1 / 3) * (0 > o ? -1 : 1), s = r + a + .5;
return 3 * (1 - s) * s * s + s * s * s;
},
backIn: function(e) {
var t = 1.70158;
return e * e * ((t + 1) * e - t);
},
backOut: function(e) {
e -= 1;
var t = 1.70158;
return e * e * ((t + 1) * e + t) + 1;
},
elastic: function(e) {
return e == !!e ? e : H(2, -10 * e) * j.sin(2 * U * (e - .075) / .3) + 1;
},
bounce: function(e) {
var t, n = 7.5625, i = 2.75;
return 1 / i > e ? t = n * e * e : 2 / i > e ? (e -= 1.5 / i, t = n * e * e + .75) : 2.5 / i > e ? (e -= 2.25 / i,
t = n * e * e + .9375) : (e -= 2.625 / i, t = n * e * e + .984375), t;
}
};
sn.easeIn = sn["ease-in"] = sn["<"], sn.easeOut = sn["ease-out"] = sn[">"], sn.easeInOut = sn["ease-in-out"] = sn["<>"],
sn["back-in"] = sn.backIn, sn["back-out"] = sn.backOut;
var ln = [], cn = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function(e) {
setTimeout(e, 16);
}, un = function() {
for (var e = +new Date(), i = 0; i < ln.length; i++) {
var r = ln[i];
if (!r.el.removed && !r.paused) {
var o, a, s = e - r.start, l = r.ms, c = r.easing, u = r.from, d = r.diff, p = r.to, h = (r.t,
r.el), f = {}, m = {};
if (r.initstatus ? (s = (r.initstatus * r.anim.top - r.prev) / (r.percent - r.prev) * l,
r.status = r.initstatus, delete r.initstatus, r.stop && ln.splice(i--, 1)) : r.status = (r.prev + (r.percent - r.prev) * (s / l)) / r.anim.top,
!(0 > s)) if (l > s) {
var g = c(s / l);
for (var v in u) if (u[k](v)) {
switch (nt[v]) {
case z:
o = +u[v] + g * l * d[v];
break;
case "colour":
o = "rgb(" + [ dn(K(u[v].r + g * l * d[v].r)), dn(K(u[v].g + g * l * d[v].g)), dn(K(u[v].b + g * l * d[v].b)) ].join(",") + ")";
break;
case "path":
o = [];
for (var y = 0, x = u[v].length; x > y; y++) {
o[y] = [ u[v][y][0] ];
for (var w = 1, S = u[v][y].length; S > w; w++) o[y][w] = +u[v][y][w] + g * l * d[v][y][w];
o[y] = o[y].join(A);
}
o = o.join(A);
break;
case "transform":
if (d[v].real) for (o = [], y = 0, x = u[v].length; x > y; y++) for (o[y] = [ u[v][y][0] ],
w = 1, S = u[v][y].length; S > w; w++) o[y][w] = u[v][y][w] + g * l * d[v][y][w]; else {
var C = function(e) {
return +u[v][e] + g * l * d[v][e];
};
o = [ [ "m", C(0), C(1), C(2), C(3), C(4), C(5) ] ];
}
break;
case "csv":
if ("clip-rect" == v) for (o = [], y = 4; y--; ) o[y] = +u[v][y] + g * l * d[v][y];
break;
default:
var _ = [][N](u[v]);
for (o = [], y = h.paper.customAttributes[v].length; y--; ) o[y] = +_[y] + g * l * d[v][y];
}
f[v] = o;
}
h.attr(f), function(e, n, i) {
setTimeout(function() {
t("raphael.anim.frame." + e, n, i);
});
}(h.id, h, r.anim);
} else {
if (function(e, i, r) {
setTimeout(function() {
t("raphael.anim.frame." + i.id, i, r), t("raphael.anim.finish." + i.id, i, r), n.is(e, "function") && e.call(i);
});
}(r.callback, h, r.anim), h.attr(p), ln.splice(i--, 1), r.repeat > 1 && !r.next) {
for (a in p) p[k](a) && (m[a] = r.totalOrigin[a]);
r.el.attr(m), b(r.anim, r.el, r.anim.percents[0], null, r.totalOrigin, r.repeat - 1);
}
r.next && !r.stop && b(r.anim, r.el, r.next, null, r.totalOrigin, r.repeat);
}
}
}
n.svg && h && h.paper && h.paper.safari(), ln.length && cn(un);
}, dn = function(e) {
return e > 255 ? 255 : 0 > e ? 0 : e;
};
Kt.animateWith = function(e, t, i, r, o, a) {
var s = this;
if (s.removed) return a && a.call(s), s;
var l = i instanceof v ? i : n.animation(i, r, o, a);
b(l, s, l.percents[0], null, s.attr());
for (var c = 0, u = ln.length; u > c; c++) if (ln[c].anim == t && ln[c].el == e) {
ln[u - 1].start = ln[c].start;
break;
}
return s;
}, Kt.onAnimation = function(e) {
return e ? t.on("raphael.anim.frame." + this.id, e) : t.unbind("raphael.anim.frame." + this.id),
this;
}, v.prototype.delay = function(e) {
var t = new v(this.anim, this.ms);
return t.times = this.times, t.del = +e || 0, t;
}, v.prototype.repeat = function(e) {
var t = new v(this.anim, this.ms);
return t.del = this.del, t.times = j.floor($(e, 0)) || 1, t;
}, n.animation = function(e, t, i, r) {
if (e instanceof v) return e;
!n.is(i, "function") && i || (r = r || i || null, i = null), e = Object(e), t = +t || 0;
var o, a, s = {};
for (a in e) e[k](a) && J(a) != a && J(a) + "%" != a && (o = !0, s[a] = e[a]);
if (o) return i && (s.easing = i), r && (s.callback = r), new v({
100: s
}, t);
if (r) {
var l = 0;
for (var c in e) {
var u = Z(c);
e[k](c) && u > l && (l = u);
}
l += "%", !e[l].callback && (e[l].callback = r);
}
return new v(e, t);
}, Kt.animate = function(e, t, i, r) {
var o = this;
if (o.removed) return r && r.call(o), o;
var a = e instanceof v ? e : n.animation(e, t, i, r);
return b(a, o, a.percents[0], null, o.attr()), o;
}, Kt.setTime = function(e, t) {
return e && null != t && this.status(e, G(t, e.ms) / e.ms), this;
}, Kt.status = function(e, t) {
var n, i, r = [], o = 0;
if (null != t) return b(e, this, -1, G(t, 1)), this;
for (n = ln.length; n > o; o++) if (i = ln[o], i.el.id == this.id && (!e || i.anim == e)) {
if (e) return i.status;
r.push({
anim: i.anim,
status: i.status
});
}
return e ? 0 : r;
}, Kt.pause = function(e) {
for (var n = 0; n < ln.length; n++) ln[n].el.id != this.id || e && ln[n].anim != e || !1 !== t("raphael.anim.pause." + this.id, this, ln[n].anim) && (ln[n].paused = !0);
return this;
}, Kt.resume = function(e) {
for (var n = 0; n < ln.length; n++) if (ln[n].el.id == this.id && (!e || ln[n].anim == e)) {
var i = ln[n];
!1 !== t("raphael.anim.resume." + this.id, this, i.anim) && (delete i.paused, this.status(i.anim, i.status));
}
return this;
}, Kt.stop = function(e) {
for (var n = 0; n < ln.length; n++) ln[n].el.id != this.id || e && ln[n].anim != e || !1 !== t("raphael.anim.stop." + this.id, this, ln[n].anim) && ln.splice(n--, 1);
return this;
}, t.on("raphael.remove", y), t.on("raphael.clear", y), Kt.toString = function() {
return "Rapha\xebl\u2019s object";
};
var pn = function(e) {
if (this.items = [], this.length = 0, this.type = "set", e) for (var t = 0, n = e.length; n > t; t++) !e[t] || e[t].constructor != Kt.constructor && e[t].constructor != pn || (this[this.items.length] = this.items[this.items.length] = e[t],
this.length++);
}, hn = pn.prototype;
hn.push = function() {
for (var e, t, n = 0, i = arguments.length; i > n; n++) !(e = arguments[n]) || e.constructor != Kt.constructor && e.constructor != pn || (t = this.items.length,
this[t] = this.items[t] = e, this.length++);
return this;
}, hn.pop = function() {
return this.length && delete this[this.length--], this.items.pop();
}, hn.forEach = function(e, t) {
for (var n = 0, i = this.items.length; i > n; n++) if (!1 === e.call(t, this.items[n], n)) return this;
return this;
};
for (var fn in Kt) Kt[k](fn) && (hn[fn] = function(e) {
return function() {
var t = arguments;
return this.forEach(function(n) {
n[e][D](n, t);
});
};
}(fn));
return hn.attr = function(e, t) {
if (e && n.is(e, V) && n.is(e[0], "object")) for (var i = 0, r = e.length; r > i; i++) this.items[i].attr(e[i]); else for (var o = 0, a = this.items.length; a > o; o++) this.items[o].attr(e, t);
return this;
}, hn.clear = function() {
for (;this.length; ) this.pop();
}, hn.splice = function(e, t) {
e = 0 > e ? $(this.length + e, 0) : e, t = $(0, G(this.length - e, t));
var n, i = [], r = [], o = [];
for (n = 2; n < arguments.length; n++) o.push(arguments[n]);
for (n = 0; t > n; n++) r.push(this[e + n]);
for (;n < this.length - e; n++) i.push(this[e + n]);
var a = o.length;
for (n = 0; n < a + i.length; n++) this.items[e + n] = this[e + n] = a > n ? o[n] : i[n - a];
for (n = this.items.length = this.length -= t - a; this[n]; ) delete this[n++];
return new pn(r);
}, hn.exclude = function(e) {
for (var t = 0, n = this.length; n > t; t++) if (this[t] == e) return this.splice(t, 1),
!0;
}, hn.animate = function(e, t, i, r) {
(n.is(i, "function") || !i) && (r = i || null);
var o, a, s = this.items.length, l = s, c = this;
if (!s) return this;
r && (a = function() {
!--s && r.call(c);
}), i = n.is(i, "string") ? i : a;
var u = n.animation(e, t, i, a);
for (o = this.items[--l].animate(u); l--; ) this.items[l] && !this.items[l].removed && this.items[l].animateWith(o, u, u),
this.items[l] && !this.items[l].removed || s--;
return this;
}, hn.insertAfter = function(e) {
for (var t = this.items.length; t--; ) this.items[t].insertAfter(e);
return this;
}, hn.getBBox = function() {
for (var e = [], t = [], n = [], i = [], r = this.items.length; r--; ) if (!this.items[r].removed) {
var o = this.items[r].getBBox();
e.push(o.x), t.push(o.y), n.push(o.x + o.width), i.push(o.y + o.height);
}
return e = G[D](0, e), t = G[D](0, t), n = $[D](0, n), i = $[D](0, i), {
x: e,
y: t,
x2: n,
y2: i,
width: n - e,
height: i - t
};
}, hn.clone = function(e) {
e = this.paper.set();
for (var t = 0, n = this.items.length; n > t; t++) e.push(this.items[t].clone());
return e;
}, hn.toString = function() {
return "Rapha\xebl\u2018s set";
}, hn.glow = function(e) {
var t = this.paper.set();
return this.forEach(function(n) {
var i = n.glow(e);
null != i && i.forEach(function(e) {
t.push(e);
});
}), t;
}, hn.isPointInside = function(e, t) {
var n = !1;
return this.forEach(function(i) {
return i.isPointInside(e, t) ? (n = !0, !1) : void 0;
}), n;
}, n.registerFont = function(e) {
if (!e.face) return e;
this.fonts = this.fonts || {};
var t = {
w: e.w,
face: {},
glyphs: {}
}, n = e.face["font-family"];
for (var i in e.face) e.face[k](i) && (t.face[i] = e.face[i]);
if (this.fonts[n] ? this.fonts[n].push(t) : this.fonts[n] = [ t ], !e.svg) {
t.face["units-per-em"] = Z(e.face["units-per-em"], 10);
for (var r in e.glyphs) if (e.glyphs[k](r)) {
var o = e.glyphs[r];
if (t.glyphs[r] = {
w: o.w,
k: {},
d: o.d && "M" + o.d.replace(/[mlcxtrv]/g, function(e) {
return {
l: "L",
c: "C",
x: "z",
t: "m",
r: "l",
v: "c"
}[e] || "M";
}) + "z"
}, o.k) for (var a in o.k) o[k](a) && (t.glyphs[r].k[a] = o.k[a]);
}
}
return e;
}, w.getFont = function(e, t, i, r) {
if (r = r || "normal", i = i || "normal", t = +t || {
normal: 400,
bold: 700,
lighter: 300,
bolder: 800
}[t] || 400, n.fonts) {
var o = n.fonts[e];
if (!o) {
var a = new RegExp("(^|\\s)" + e.replace(/[^\w\d\s+!~.:_-]/g, L) + "(\\s|$)", "i");
for (var s in n.fonts) if (n.fonts[k](s) && a.test(s)) {
o = n.fonts[s];
break;
}
}
var l;
if (o) for (var c = 0, u = o.length; u > c && (l = o[c], l.face["font-weight"] != t || l.face["font-style"] != i && l.face["font-style"] || l.face["font-stretch"] != r); c++) ;
return l;
}
}, w.print = function(e, t, i, r, o, a, s, l) {
a = a || "middle", s = $(G(s || 0, 1), -1), l = $(G(l || 1, 3), 1);
var c, u = R(i)[P](L), d = 0, p = 0, h = L;
if (n.is(r, "string") && (r = this.getFont(r)), r) {
c = (o || 16) / r.face["units-per-em"];
for (var f = r.face.bbox[P](S), m = +f[0], g = f[3] - f[1], v = 0, b = +f[1] + ("baseline" == a ? g + +r.face.descent : g / 2), y = 0, x = u.length; x > y; y++) {
if ("\n" == u[y]) d = 0, C = 0, p = 0, v += g * l; else {
var w = p && r.glyphs[u[y - 1]] || {}, C = r.glyphs[u[y]];
d += p ? (w.w || r.w) + (w.k && w.k[u[y]] || 0) + r.w * s : 0, p = 1;
}
C && C.d && (h += n.transformPath(C.d, [ "t", d * c, v * c, "s", c, c, m, b, "t", (e - m) / c, (t - b) / c ]));
}
}
return this.path(h).attr({
fill: "#000",
stroke: "none"
});
}, w.add = function(e) {
if (n.is(e, "array")) for (var t, i = this.set(), r = 0, o = e.length; o > r; r++) t = e[r] || {},
C[k](t.type) && i.push(this[t.type]().attr(t));
return i;
}, n.format = function(e, t) {
var i = n.is(t, V) ? [ 0 ][N](t) : arguments;
return e && n.is(e, "string") && i.length - 1 && (e = e.replace(_, function(e, t) {
return null == i[++t] ? L : i[t];
})), e || L;
}, n.fullfill = function() {
var e = /\{([^\}]+)\}/g, t = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g, n = function(e, n, i) {
var r = i;
return n.replace(t, function(e, t, n, i, o) {
t = t || i, r && (t in r && (r = r[t]), "function" == typeof r && o && (r = r()));
}), r = (null == r || r == i ? e : r) + "";
};
return function(t, i) {
return String(t).replace(e, function(e, t) {
return n(e, t, i);
});
};
}(), n.ninja = function() {
return T.was ? E.win.Raphael = T.is : delete Raphael, n;
}, n.st = hn, t.on("raphael.DOMload", function() {
x = !0;
}), function(e, t, i) {
function r() {
/in/.test(e.readyState) ? setTimeout(r, 9) : n.eve("raphael.DOMload");
}
null == e.readyState && e.addEventListener && (e.addEventListener("DOMContentLoaded", i = function() {
e.removeEventListener("DOMContentLoaded", i, !1), e.readyState = "complete";
}, !1), e.readyState = "loading"), r();
}(document), function() {
if (n.svg) {
var e = "hasOwnProperty", t = String, i = parseFloat, r = parseInt, o = Math, a = o.max, s = o.abs, l = o.pow, c = /[, ]+/, u = n.eve, d = "", p = " ", h = "http://www.w3.org/1999/xlink", f = {
block: "M5,0 0,2.5 5,5z",
classic: "M5,0 0,2.5 5,5 3.5,3 3.5,2z",
diamond: "M2.5,0 5,2.5 2.5,5 0,2.5z",
open: "M6,1 1,3.5 6,6",
oval: "M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"
}, m = {};
n.toString = function() {
return "Your browser supports SVG.\nYou are running Rapha\xebl " + this.version;
};
var g = function(i, r) {
if (r) {
"string" == typeof i && (i = g(i));
for (var o in r) r[e](o) && ("xlink:" == o.substring(0, 6) ? i.setAttributeNS(h, o.substring(6), t(r[o])) : i.setAttribute(o, t(r[o])));
} else i = n._g.doc.createElementNS("http://www.w3.org/2000/svg", i), i.style && (i.style.webkitTapHighlightColor = "rgba(0,0,0,0)");
return i;
}, v = function(e, r) {
var c = "linear", u = e.id + r, p = .5, h = .5, f = e.node, m = e.paper, v = f.style, b = n._g.doc.getElementById(u);
if (!b) {
if (r = t(r).replace(n._radial_gradient, function(e, t, n) {
if (c = "radial", t && n) {
p = i(t), h = i(n);
var r = 2 * (h > .5) - 1;
l(p - .5, 2) + l(h - .5, 2) > .25 && (h = o.sqrt(.25 - l(p - .5, 2)) * r + .5) && .5 != h && (h = h.toFixed(5) - 1e-5 * r);
}
return d;
}), r = r.split(/\s*\-\s*/), "linear" == c) {
var y = r.shift();
if (y = -i(y), isNaN(y)) return null;
var x = [ 0, 0, o.cos(n.rad(y)), o.sin(n.rad(y)) ], w = 1 / (a(s(x[2]), s(x[3])) || 1);
x[2] *= w, x[3] *= w, x[2] < 0 && (x[0] = -x[2], x[2] = 0), x[3] < 0 && (x[1] = -x[3],
x[3] = 0);
}
var S = n._parseDots(r);
if (!S) return null;
if (u = u.replace(/[\(\)\s,\xb0#]/g, "_"), e.gradient && u != e.gradient.id && (m.defs.removeChild(e.gradient),
delete e.gradient), !e.gradient) {
b = g(c + "Gradient", {
id: u
}), e.gradient = b, g(b, "radial" == c ? {
fx: p,
fy: h
} : {
x1: x[0],
y1: x[1],
x2: x[2],
y2: x[3],
gradientTransform: e.matrix.invert()
}), m.defs.appendChild(b);
for (var C = 0, _ = S.length; _ > C; C++) b.appendChild(g("stop", {
offset: S[C].offset ? S[C].offset : C ? "100%" : "0%",
"stop-color": S[C].color || "#fff"
}));
}
}
return g(f, {
fill: "url('" + document.location + "#" + u + "')",
opacity: 1,
"fill-opacity": 1
}), v.fill = d, v.opacity = 1, v.fillOpacity = 1, 1;
}, b = function(e) {
var t = e.getBBox(1);
g(e.pattern, {
patternTransform: e.matrix.invert() + " translate(" + t.x + "," + t.y + ")"
});
}, y = function(i, r, o) {
if ("path" == i.type) {
for (var a, s, l, c, u, p = t(r).toLowerCase().split("-"), h = i.paper, v = o ? "end" : "start", b = i.node, y = i.attrs, x = y["stroke-width"], w = p.length, S = "classic", C = 3, _ = 3, k = 5; w--; ) switch (p[w]) {
case "block":
case "classic":
case "oval":
case "diamond":
case "open":
case "none":
S = p[w];
break;
case "wide":
_ = 5;
break;
case "narrow":
_ = 2;
break;
case "long":
C = 5;
break;
case "short":
C = 2;
}
if ("open" == S ? (C += 2, _ += 2, k += 2, l = 1, c = o ? 4 : 1, u = {
fill: "none",
stroke: y.stroke
}) : (c = l = C / 2, u = {
fill: y.stroke,
stroke: "none"
}), i._.arrows ? o ? (i._.arrows.endPath && m[i._.arrows.endPath]--, i._.arrows.endMarker && m[i._.arrows.endMarker]--) : (i._.arrows.startPath && m[i._.arrows.startPath]--,
i._.arrows.startMarker && m[i._.arrows.startMarker]--) : i._.arrows = {}, "none" != S) {
var E = "raphael-marker-" + S, T = "raphael-marker-" + v + S + C + _ + "-obj" + i.id;
n._g.doc.getElementById(E) ? m[E]++ : (h.defs.appendChild(g(g("path"), {
"stroke-linecap": "round",
d: f[S],
id: E
})), m[E] = 1);
var I, D = n._g.doc.getElementById(T);
D ? (m[T]++, I = D.getElementsByTagName("use")[0]) : (D = g(g("marker"), {
id: T,
markerHeight: _,
markerWidth: C,
orient: "auto",
refX: c,
refY: _ / 2
}), I = g(g("use"), {
"xlink:href": "#" + E,
transform: (o ? "rotate(180 " + C / 2 + " " + _ / 2 + ") " : d) + "scale(" + C / k + "," + _ / k + ")",
"stroke-width": (1 / ((C / k + _ / k) / 2)).toFixed(4)
}), D.appendChild(I), h.defs.appendChild(D), m[T] = 1), g(I, u);
var N = l * ("diamond" != S && "oval" != S);
o ? (a = i._.arrows.startdx * x || 0, s = n.getTotalLength(y.path) - N * x) : (a = N * x,
s = n.getTotalLength(y.path) - (i._.arrows.enddx * x || 0)), u = {}, u["marker-" + v] = "url(#" + T + ")",
(s || a) && (u.d = n.getSubpath(y.path, a, s)), g(b, u), i._.arrows[v + "Path"] = E,
i._.arrows[v + "Marker"] = T, i._.arrows[v + "dx"] = N, i._.arrows[v + "Type"] = S,
i._.arrows[v + "String"] = r;
} else o ? (a = i._.arrows.startdx * x || 0, s = n.getTotalLength(y.path) - a) : (a = 0,
s = n.getTotalLength(y.path) - (i._.arrows.enddx * x || 0)), i._.arrows[v + "Path"] && g(b, {
d: n.getSubpath(y.path, a, s)
}), delete i._.arrows[v + "Path"], delete i._.arrows[v + "Marker"], delete i._.arrows[v + "dx"],
delete i._.arrows[v + "Type"], delete i._.arrows[v + "String"];
for (u in m) if (m[e](u) && !m[u]) {
var M = n._g.doc.getElementById(u);
M && M.parentNode.removeChild(M);
}
}
}, x = {
"": [ 0 ],
none: [ 0 ],
"-": [ 3, 1 ],
".": [ 1, 1 ],
"-.": [ 3, 1, 1, 1 ],
"-..": [ 3, 1, 1, 1, 1, 1 ],
". ": [ 1, 3 ],
"- ": [ 4, 3 ],
"--": [ 8, 3 ],
"- .": [ 4, 3, 1, 3 ],
"--.": [ 8, 3, 1, 3 ],
"--..": [ 8, 3, 1, 3, 1, 3 ]
}, w = function(e, n, i) {
if (n = x[t(n).toLowerCase()]) {
for (var r = e.attrs["stroke-width"] || "1", o = {
round: r,
square: r,
butt: 0
}[e.attrs["stroke-linecap"] || i["stroke-linecap"]] || 0, a = [], s = n.length; s--; ) a[s] = n[s] * r + (s % 2 ? 1 : -1) * o;
g(e.node, {
"stroke-dasharray": a.join(",")
});
}
}, S = function(i, o) {
var l = i.node, u = i.attrs, p = l.style.visibility;
l.style.visibility = "hidden";
for (var f in o) if (o[e](f)) {
if (!n._availableAttrs[e](f)) continue;
var m = o[f];
switch (u[f] = m, f) {
case "blur":
i.blur(m);
break;
case "title":
var x = l.getElementsByTagName("title");
if (x.length && (x = x[0])) x.firstChild.nodeValue = m; else {
x = g("title");
var S = n._g.doc.createTextNode(m);
x.appendChild(S), l.appendChild(x);
}
break;
case "href":
case "target":
var _ = l.parentNode;
if ("a" != _.tagName.toLowerCase()) {
var k = g("a");
_.insertBefore(k, l), k.appendChild(l), _ = k;
}
"target" == f ? _.setAttributeNS(h, "show", "blank" == m ? "new" : m) : _.setAttributeNS(h, f, m);
break;
case "cursor":
l.style.cursor = m;
break;
case "transform":
i.transform(m);
break;
case "arrow-start":
y(i, m);
break;
case "arrow-end":
y(i, m, 1);
break;
case "clip-rect":
var E = t(m).split(c);
if (4 == E.length) {
i.clip && i.clip.parentNode.parentNode.removeChild(i.clip.parentNode);
var T = g("clipPath"), I = g("rect");
T.id = n.createUUID(), g(I, {
x: E[0],
y: E[1],
width: E[2],
height: E[3]
}), T.appendChild(I), i.paper.defs.appendChild(T), g(l, {
"clip-path": "url(#" + T.id + ")"
}), i.clip = I;
}
if (!m) {
var D = l.getAttribute("clip-path");
if (D) {
var N = n._g.doc.getElementById(D.replace(/(^url\(#|\)$)/g, d));
N && N.parentNode.removeChild(N), g(l, {
"clip-path": d
}), delete i.clip;
}
}
break;
case "path":
"path" == i.type && (g(l, {
d: m ? u.path = n._pathToAbsolute(m) : "M0,0"
}), i._.dirty = 1, i._.arrows && ("startString" in i._.arrows && y(i, i._.arrows.startString),
"endString" in i._.arrows && y(i, i._.arrows.endString, 1)));
break;
case "width":
if (l.setAttribute(f, m), i._.dirty = 1, !u.fx) break;
f = "x", m = u.x;
case "x":
u.fx && (m = -u.x - (u.width || 0));
case "rx":
if ("rx" == f && "rect" == i.type) break;
case "cx":
l.setAttribute(f, m), i.pattern && b(i), i._.dirty = 1;
break;
case "height":
if (l.setAttribute(f, m), i._.dirty = 1, !u.fy) break;
f = "y", m = u.y;
case "y":
u.fy && (m = -u.y - (u.height || 0));
case "ry":
if ("ry" == f && "rect" == i.type) break;
case "cy":
l.setAttribute(f, m), i.pattern && b(i), i._.dirty = 1;
break;
case "r":
"rect" == i.type ? g(l, {
rx: m,
ry: m
}) : l.setAttribute(f, m), i._.dirty = 1;
break;
case "src":
"image" == i.type && l.setAttributeNS(h, "href", m);
break;
case "stroke-width":
1 == i._.sx && 1 == i._.sy || (m /= a(s(i._.sx), s(i._.sy)) || 1), l.setAttribute(f, m),
u["stroke-dasharray"] && w(i, u["stroke-dasharray"], o), i._.arrows && ("startString" in i._.arrows && y(i, i._.arrows.startString),
"endString" in i._.arrows && y(i, i._.arrows.endString, 1));
break;
case "stroke-dasharray":
w(i, m, o);
break;
case "fill":
var M = t(m).match(n._ISURL);
if (M) {
T = g("pattern");
var L = g("image");
T.id = n.createUUID(), g(T, {
x: 0,
y: 0,
patternUnits: "userSpaceOnUse",
height: 1,
width: 1
}), g(L, {
x: 0,
y: 0,
"xlink:href": M[1]
}), T.appendChild(L), function(e) {
n._preload(M[1], function() {
var t = this.offsetWidth, n = this.offsetHeight;
g(e, {
width: t,
height: n
}), g(L, {
width: t,
height: n
}), i.paper.safari();
});
}(T), i.paper.defs.appendChild(T), g(l, {
fill: "url(#" + T.id + ")"
}), i.pattern = T, i.pattern && b(i);
break;
}
var A = n.getRGB(m);
if (A.error) {
if (("circle" == i.type || "ellipse" == i.type || "r" != t(m).charAt()) && v(i, m)) {
if ("opacity" in u || "fill-opacity" in u) {
var R = n._g.doc.getElementById(l.getAttribute("fill").replace(/^url\(#|\)$/g, d));
if (R) {
var P = R.getElementsByTagName("stop");
g(P[P.length - 1], {
"stop-opacity": ("opacity" in u ? u.opacity : 1) * ("fill-opacity" in u ? u["fill-opacity"] : 1)
});
}
}
u.gradient = m, u.fill = "none";
break;
}
} else delete o.gradient, delete u.gradient, !n.is(u.opacity, "undefined") && n.is(o.opacity, "undefined") && g(l, {
opacity: u.opacity
}), !n.is(u["fill-opacity"], "undefined") && n.is(o["fill-opacity"], "undefined") && g(l, {
"fill-opacity": u["fill-opacity"]
});
A[e]("opacity") && g(l, {
"fill-opacity": A.opacity > 1 ? A.opacity / 100 : A.opacity
});
case "stroke":
A = n.getRGB(m), l.setAttribute(f, A.hex), "stroke" == f && A[e]("opacity") && g(l, {
"stroke-opacity": A.opacity > 1 ? A.opacity / 100 : A.opacity
}), "stroke" == f && i._.arrows && ("startString" in i._.arrows && y(i, i._.arrows.startString),
"endString" in i._.arrows && y(i, i._.arrows.endString, 1));
break;
case "gradient":
("circle" == i.type || "ellipse" == i.type || "r" != t(m).charAt()) && v(i, m);
break;
case "opacity":
u.gradient && !u[e]("stroke-opacity") && g(l, {
"stroke-opacity": m > 1 ? m / 100 : m
});
case "fill-opacity":
if (u.gradient) {
R = n._g.doc.getElementById(l.getAttribute("fill").replace(/^url\(#|\)$/g, d)),
R && (P = R.getElementsByTagName("stop"), g(P[P.length - 1], {
"stop-opacity": m
}));
break;
}
default:
"font-size" == f && (m = r(m, 10) + "px");
var O = f.replace(/(\-.)/g, function(e) {
return e.substring(1).toUpperCase();
});
l.style[O] = m, i._.dirty = 1, l.setAttribute(f, m);
}
}
C(i, o), l.style.visibility = p;
}, C = function(i, o) {
if ("text" == i.type && (o[e]("text") || o[e]("font") || o[e]("font-size") || o[e]("x") || o[e]("y"))) {
var a = i.attrs, s = i.node, l = s.firstChild ? r(n._g.doc.defaultView.getComputedStyle(s.firstChild, d).getPropertyValue("font-size"), 10) : 10;
if (o[e]("text")) {
for (a.text = o.text; s.firstChild; ) s.removeChild(s.firstChild);
for (var c, u = t(o.text).split("\n"), p = [], h = 0, f = u.length; f > h; h++) c = g("tspan"),
h && g(c, {
dy: 1.2 * l,
x: a.x
}), c.appendChild(n._g.doc.createTextNode(u[h])), s.appendChild(c), p[h] = c;
} else for (p = s.getElementsByTagName("tspan"), h = 0, f = p.length; f > h; h++) h ? g(p[h], {
dy: 1.2 * l,
x: a.x
}) : g(p[0], {
dy: 0
});
g(s, {
x: a.x,
y: a.y
}), i._.dirty = 1;
var m = i._getBBox(), v = a.y - (m.y + m.height / 2);
v && n.is(v, "finite") && g(p[0], {
dy: v
});
}
}, _ = function(e) {
return e.parentNode && "a" === e.parentNode.tagName.toLowerCase() ? e.parentNode : e;
}, k = function(e, t) {
this[0] = this.node = e, e.raphael = !0, this.id = n._oid++, e.raphaelid = this.id,
this.matrix = n.matrix(), this.realPath = null, this.paper = t, this.attrs = this.attrs || {},
this._ = {
transform: [],
sx: 1,
sy: 1,
deg: 0,
dx: 0,
dy: 0,
dirty: 1
}, !t.bottom && (t.bottom = this), this.prev = t.top, t.top && (t.top.next = this),
t.top = this, this.next = null;
}, E = n.el;
k.prototype = E, E.constructor = k, n._engine.path = function(e, t) {
var n = g("path");
t.canvas && t.canvas.appendChild(n);
var i = new k(n, t);
return i.type = "path", S(i, {
fill: "none",
stroke: "#000",
path: e
}), i;
}, E.rotate = function(e, n, r) {
if (this.removed) return this;
if (e = t(e).split(c), e.length - 1 && (n = i(e[1]), r = i(e[2])), e = i(e[0]),
null == r && (n = r), null == n || null == r) {
var o = this.getBBox(1);
n = o.x + o.width / 2, r = o.y + o.height / 2;
}
return this.transform(this._.transform.concat([ [ "r", e, n, r ] ])), this;
}, E.scale = function(e, n, r, o) {
if (this.removed) return this;
if (e = t(e).split(c), e.length - 1 && (n = i(e[1]), r = i(e[2]), o = i(e[3])),
e = i(e[0]), null == n && (n = e), null == o && (r = o), null == r || null == o) var a = this.getBBox(1);
return r = null == r ? a.x + a.width / 2 : r, o = null == o ? a.y + a.height / 2 : o,
this.transform(this._.transform.concat([ [ "s", e, n, r, o ] ])), this;
}, E.translate = function(e, n) {
return this.removed ? this : (e = t(e).split(c), e.length - 1 && (n = i(e[1])),
e = i(e[0]) || 0, n = +n || 0, this.transform(this._.transform.concat([ [ "t", e, n ] ])),
this);
}, E.transform = function(t) {
var i = this._;
if (null == t) return i.transform;
if (n._extractTransform(this, t), this.clip && g(this.clip, {
transform: this.matrix.invert()
}), this.pattern && b(this), this.node && g(this.node, {
transform: this.matrix
}), 1 != i.sx || 1 != i.sy) {
var r = this.attrs[e]("stroke-width") ? this.attrs["stroke-width"] : 1;
this.attr({
"stroke-width": r
});
}
return this;
}, E.hide = function() {
return !this.removed && this.paper.safari(this.node.style.display = "none"), this;
}, E.show = function() {
return !this.removed && this.paper.safari(this.node.style.display = ""), this;
}, E.remove = function() {
var e = _(this.node);
if (!this.removed && e.parentNode) {
var t = this.paper;
t.__set__ && t.__set__.exclude(this), u.unbind("raphael.*.*." + this.id), this.gradient && t.defs.removeChild(this.gradient),
n._tear(this, t), e.parentNode.removeChild(e), this.removeData();
for (var i in this) this[i] = "function" == typeof this[i] ? n._removedFactory(i) : null;
this.removed = !0;
}
}, E._getBBox = function() {
if ("none" == this.node.style.display) {
this.show();
var e = !0;
}
var t, n = !1;
this.paper.canvas.parentElement ? t = this.paper.canvas.parentElement.style : this.paper.canvas.parentNode && (t = this.paper.canvas.parentNode.style),
t && "none" == t.display && (n = !0, t.display = "");
var i = {};
try {
i = this.node.getBBox();
} catch (e) {
i = {
x: this.node.clientLeft,
y: this.node.clientTop,
width: this.node.clientWidth,
height: this.node.clientHeight
};
} finally {
i = i || {}, n && (t.display = "none");
}
return e && this.hide(), i;
}, E.attr = function(t, i) {
if (this.removed) return this;
if (null == t) {
var r = {};
for (var o in this.attrs) this.attrs[e](o) && (r[o] = this.attrs[o]);
return r.gradient && "none" == r.fill && (r.fill = r.gradient) && delete r.gradient,
r.transform = this._.transform, r;
}
if (null == i && n.is(t, "string")) {
if ("fill" == t && "none" == this.attrs.fill && this.attrs.gradient) return this.attrs.gradient;
if ("transform" == t) return this._.transform;
for (var a = t.split(c), s = {}, l = 0, d = a.length; d > l; l++) t = a[l], s[t] = t in this.attrs ? this.attrs[t] : n.is(this.paper.customAttributes[t], "function") ? this.paper.customAttributes[t].def : n._availableAttrs[t];
return d - 1 ? s : s[a[0]];
}
if (null == i && n.is(t, "array")) {
for (s = {}, l = 0, d = t.length; d > l; l++) s[t[l]] = this.attr(t[l]);
return s;
}
if (null != i) {
var p = {};
p[t] = i;
} else null != t && n.is(t, "object") && (p = t);
for (var h in p) u("raphael.attr." + h + "." + this.id, this, p[h]);
for (h in this.paper.customAttributes) if (this.paper.customAttributes[e](h) && p[e](h) && n.is(this.paper.customAttributes[h], "function")) {
var f = this.paper.customAttributes[h].apply(this, [].concat(p[h]));
this.attrs[h] = p[h];
for (var m in f) f[e](m) && (p[m] = f[m]);
}
return S(this, p), this;
}, E.toFront = function() {
if (this.removed) return this;
var e = _(this.node);
e.parentNode.appendChild(e);
var t = this.paper;
return t.top != this && n._tofront(this, t), this;
}, E.toBack = function() {
if (this.removed) return this;
var e = _(this.node), t = e.parentNode;
return t.insertBefore(e, t.firstChild), n._toback(this, this.paper), this.paper,
this;
}, E.insertAfter = function(e) {
if (this.removed || !e) return this;
var t = _(this.node), i = _(e.node || e[e.length - 1].node);
return i.nextSibling ? i.parentNode.insertBefore(t, i.nextSibling) : i.parentNode.appendChild(t),
n._insertafter(this, e, this.paper), this;
}, E.insertBefore = function(e) {
if (this.removed || !e) return this;
var t = _(this.node), i = _(e.node || e[0].node);
return i.parentNode.insertBefore(t, i), n._insertbefore(this, e, this.paper), this;
}, E.blur = function(e) {
var t = this;
if (0 != +e) {
var i = g("filter"), r = g("feGaussianBlur");
t.attrs.blur = e, i.id = n.createUUID(), g(r, {
stdDeviation: +e || 1.5
}), i.appendChild(r), t.paper.defs.appendChild(i), t._blur = i, g(t.node, {
filter: "url(#" + i.id + ")"
});
} else t._blur && (t._blur.parentNode.removeChild(t._blur), delete t._blur, delete t.attrs.blur),
t.node.removeAttribute("filter");
return t;
}, n._engine.circle = function(e, t, n, i) {
var r = g("circle");
e.canvas && e.canvas.appendChild(r);
var o = new k(r, e);
return o.attrs = {
cx: t,
cy: n,
r: i,
fill: "none",
stroke: "#000"
}, o.type = "circle", g(r, o.attrs), o;
}, n._engine.rect = function(e, t, n, i, r, o) {
var a = g("rect");
e.canvas && e.canvas.appendChild(a);
var s = new k(a, e);
return s.attrs = {
x: t,
y: n,
width: i,
height: r,
rx: o || 0,
ry: o || 0,
fill: "none",
stroke: "#000"
}, s.type = "rect", g(a, s.attrs), s;
}, n._engine.ellipse = function(e, t, n, i, r) {
var o = g("ellipse");
e.canvas && e.canvas.appendChild(o);
var a = new k(o, e);
return a.attrs = {
cx: t,
cy: n,
rx: i,
ry: r,
fill: "none",
stroke: "#000"
}, a.type = "ellipse", g(o, a.attrs), a;
}, n._engine.image = function(e, t, n, i, r, o) {
var a = g("image");
g(a, {
x: n,
y: i,
width: r,
height: o,
preserveAspectRatio: "none"
}), a.setAttributeNS(h, "href", t), e.canvas && e.canvas.appendChild(a);
var s = new k(a, e);
return s.attrs = {
x: n,
y: i,
width: r,
height: o,
src: t
}, s.type = "image", s;
}, n._engine.text = function(e, t, i, r) {
var o = g("text");
e.canvas && e.canvas.appendChild(o);
var a = new k(o, e);
return a.attrs = {
x: t,
y: i,
"text-anchor": "middle",
text: r,
"font-family": n._availableAttrs["font-family"],
"font-size": n._availableAttrs["font-size"],
stroke: "none",
fill: "#000"
}, a.type = "text", S(a, a.attrs), a;
}, n._engine.setSize = function(e, t) {
return this.width = e || this.width, this.height = t || this.height, this.canvas.setAttribute("width", this.width),
this.canvas.setAttribute("height", this.height), this._viewBox && this.setViewBox.apply(this, this._viewBox),
this;
}, n._engine.create = function() {
var e = n._getContainer.apply(0, arguments), t = e && e.container, i = e.x, r = e.y, o = e.width, a = e.height;
if (!t) throw new Error("SVG container not found.");
var s, l = g("svg"), c = "overflow:hidden;";
return i = i || 0, r = r || 0, o = o || 512, a = a || 342, g(l, {
height: a,
version: 1.1,
width: o,
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink"
}), 1 == t ? (l.style.cssText = c + "position:absolute;left:" + i + "px;top:" + r + "px",
n._g.doc.body.appendChild(l), s = 1) : (l.style.cssText = c + "position:relative",
t.firstChild ? t.insertBefore(l, t.firstChild) : t.appendChild(l)), t = new n._Paper(),
t.width = o, t.height = a, t.canvas = l, t.clear(), t._left = t._top = 0, s && (t.renderfix = function() {}),
t.renderfix(), t;
}, n._engine.setViewBox = function(e, t, n, i, r) {
u("raphael.setViewBox", this, this._viewBox, [ e, t, n, i, r ]);
var o, s, l = this.getSize(), c = a(n / l.width, i / l.height), d = this.top, h = r ? "xMidYMid meet" : "xMinYMin";
for (null == e ? (this._vbSize && (c = 1), delete this._vbSize, o = "0 0 " + this.width + p + this.height) : (this._vbSize = c,
o = e + p + t + p + n + p + i), g(this.canvas, {
viewBox: o,
preserveAspectRatio: h
}); c && d; ) s = "stroke-width" in d.attrs ? d.attrs["stroke-width"] : 1, d.attr({
"stroke-width": s
}), d._.dirty = 1, d._.dirtyT = 1, d = d.prev;
return this._viewBox = [ e, t, n, i, !!r ], this;
}, n.prototype.renderfix = function() {
var e, t = this.canvas, n = t.style;
try {
e = t.getScreenCTM() || t.createSVGMatrix();
} catch (n) {
e = t.createSVGMatrix();
}
var i = -e.e % 1, r = -e.f % 1;
(i || r) && (i && (this._left = (this._left + i) % 1, n.left = this._left + "px"),
r && (this._top = (this._top + r) % 1, n.top = this._top + "px"));
}, n.prototype.clear = function() {
n.eve("raphael.clear", this);
for (var e = this.canvas; e.firstChild; ) e.removeChild(e.firstChild);
this.bottom = this.top = null, (this.desc = g("desc")).appendChild(n._g.doc.createTextNode("Created with Rapha\xebl " + n.version)),
e.appendChild(this.desc), e.appendChild(this.defs = g("defs"));
}, n.prototype.remove = function() {
u("raphael.remove", this), this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
for (var e in this) this[e] = "function" == typeof this[e] ? n._removedFactory(e) : null;
};
var T = n.st;
for (var I in E) E[e](I) && !T[e](I) && (T[I] = function(e) {
return function() {
var t = arguments;
return this.forEach(function(n) {
n[e].apply(n, t);
});
};
}(I));
}
}(), function() {
if (n.vml) {
var e = "hasOwnProperty", t = String, i = parseFloat, r = Math, o = r.round, a = r.max, s = r.min, l = r.abs, c = /[, ]+/, u = n.eve, d = " ", p = "", h = {
M: "m",
L: "l",
C: "c",
Z: "x",
m: "t",
l: "r",
c: "v",
z: "x"
}, f = /([clmz]),?([^clmz]*)/gi, m = / progid:\S+Blur\([^\)]+\)/g, g = /-?[^,\s-]+/g, v = "position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)", b = 21600, y = {
path: 1,
rect: 1,
image: 1
}, x = {
circle: 1,
ellipse: 1
}, w = function(e) {
var i = /[ahqstv]/gi, r = n._pathToAbsolute;
if (t(e).match(i) && (r = n._path2curve), i = /[clmz]/g, r == n._pathToAbsolute && !t(e).match(i)) {
var a = t(e).replace(f, function(e, t, n) {
var i = [], r = "m" == t.toLowerCase(), a = h[t];
return n.replace(g, function(e) {
r && 2 == i.length && (a += i + h["m" == t ? "l" : "L"], i = []), i.push(o(e * b));
}), a + i;
});
return a;
}
var s, l, c = r(e);
a = [];
for (var u = 0, m = c.length; m > u; u++) {
s = c[u], l = c[u][0].toLowerCase(), "z" == l && (l = "x");
for (var v = 1, y = s.length; y > v; v++) l += o(s[v] * b) + (v != y - 1 ? "," : p);
a.push(l);
}
return a.join(d);
}, S = function(e, t, i) {
var r = n.matrix();
return r.rotate(-e, .5, .5), {
dx: r.x(t, i),
dy: r.y(t, i)
};
}, C = function(e, t, n, i, r, o) {
var a = e._, s = e.matrix, c = a.fillpos, u = e.node, p = u.style, h = 1, f = "", m = b / t, g = b / n;
if (p.visibility = "hidden", t && n) {
if (u.coordsize = l(m) + d + l(g), p.rotation = o * (0 > t * n ? -1 : 1), o) {
var v = S(o, i, r);
i = v.dx, r = v.dy;
}
if (0 > t && (f += "x"), 0 > n && (f += " y") && (h = -1), p.flip = f, u.coordorigin = i * -m + d + r * -g,
c || a.fillsize) {
var y = u.getElementsByTagName("fill");
y = y && y[0], u.removeChild(y), c && (v = S(o, s.x(c[0], c[1]), s.y(c[0], c[1])),
y.position = v.dx * h + d + v.dy * h), a.fillsize && (y.size = a.fillsize[0] * l(t) + d + a.fillsize[1] * l(n)),
u.appendChild(y);
}
p.visibility = "visible";
}
};
n.toString = function() {
return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version;
};
var _ = function(e, n, i) {
for (var r = t(n).toLowerCase().split("-"), o = i ? "end" : "start", a = r.length, s = "classic", l = "medium", c = "medium"; a--; ) switch (r[a]) {
case "block":
case "classic":
case "oval":
case "diamond":
case "open":
case "none":
s = r[a];
break;
case "wide":
case "narrow":
c = r[a];
break;
case "long":
case "short":
l = r[a];
}
var u = e.node.getElementsByTagName("stroke")[0];
u[o + "arrow"] = s, u[o + "arrowlength"] = l, u[o + "arrowwidth"] = c;
}, k = function(r, l) {
r.attrs = r.attrs || {};
var u = r.node, h = r.attrs, f = u.style, m = y[r.type] && (l.x != h.x || l.y != h.y || l.width != h.width || l.height != h.height || l.cx != h.cx || l.cy != h.cy || l.rx != h.rx || l.ry != h.ry || l.r != h.r), g = x[r.type] && (h.cx != l.cx || h.cy != l.cy || h.r != l.r || h.rx != l.rx || h.ry != l.ry), v = r;
for (var S in l) l[e](S) && (h[S] = l[S]);
if (m && (h.path = n._getPath[r.type](r), r._.dirty = 1), l.href && (u.href = l.href),
l.title && (u.title = l.title), l.target && (u.target = l.target), l.cursor && (f.cursor = l.cursor),
"blur" in l && r.blur(l.blur), (l.path && "path" == r.type || m) && (u.path = w(~t(h.path).toLowerCase().indexOf("r") ? n._pathToAbsolute(h.path) : h.path),
r._.dirty = 1, "image" == r.type && (r._.fillpos = [ h.x, h.y ], r._.fillsize = [ h.width, h.height ],
C(r, 1, 1, 0, 0, 0))), "transform" in l && r.transform(l.transform), g) {
var k = +h.cx, T = +h.cy, I = +h.rx || +h.r || 0, N = +h.ry || +h.r || 0;
u.path = n.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x", o((k - I) * b), o((T - N) * b), o((k + I) * b), o((T + N) * b), o(k * b)),
r._.dirty = 1;
}
if ("clip-rect" in l) {
var M = t(l["clip-rect"]).split(c);
if (4 == M.length) {
M[2] = +M[2] + +M[0], M[3] = +M[3] + +M[1];
var L = u.clipRect || n._g.doc.createElement("div"), A = L.style;
A.clip = n.format("rect({1}px {2}px {3}px {0}px)", M), u.clipRect || (A.position = "absolute",
A.top = 0, A.left = 0, A.width = r.paper.width + "px", A.height = r.paper.height + "px",
u.parentNode.insertBefore(L, u), L.appendChild(u), u.clipRect = L);
}
l["clip-rect"] || u.clipRect && (u.clipRect.style.clip = "auto");
}
if (r.textpath) {
var R = r.textpath.style;
l.font && (R.font = l.font), l["font-family"] && (R.fontFamily = '"' + l["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g, p) + '"'),
l["font-size"] && (R.fontSize = l["font-size"]), l["font-weight"] && (R.fontWeight = l["font-weight"]),
l["font-style"] && (R.fontStyle = l["font-style"]);
}
if ("arrow-start" in l && _(v, l["arrow-start"]), "arrow-end" in l && _(v, l["arrow-end"], 1),
null != l.opacity || null != l["stroke-width"] || null != l.fill || null != l.src || null != l.stroke || null != l["stroke-width"] || null != l["stroke-opacity"] || null != l["fill-opacity"] || null != l["stroke-dasharray"] || null != l["stroke-miterlimit"] || null != l["stroke-linejoin"] || null != l["stroke-linecap"]) {
var P = u.getElementsByTagName("fill");
if (P = P && P[0], !P && (P = D("fill")), "image" == r.type && l.src && (P.src = l.src),
l.fill && (P.on = !0), null != P.on && "none" != l.fill && null !== l.fill || (P.on = !1),
P.on && l.fill) {
var O = t(l.fill).match(n._ISURL);
if (O) {
P.parentNode == u && u.removeChild(P), P.rotate = !0, P.src = O[1], P.type = "tile";
var F = r.getBBox(1);
P.position = F.x + d + F.y, r._.fillpos = [ F.x, F.y ], n._preload(O[1], function() {
r._.fillsize = [ this.offsetWidth, this.offsetHeight ];
});
} else P.color = n.getRGB(l.fill).hex, P.src = p, P.type = "solid", n.getRGB(l.fill).error && (v.type in {
circle: 1,
ellipse: 1
} || "r" != t(l.fill).charAt()) && E(v, l.fill, P) && (h.fill = "none", h.gradient = l.fill,
P.rotate = !1);
}
if ("fill-opacity" in l || "opacity" in l) {
var B = ((+h["fill-opacity"] + 1 || 2) - 1) * ((+h.opacity + 1 || 2) - 1) * ((+n.getRGB(l.fill).o + 1 || 2) - 1);
B = s(a(B, 0), 1), P.opacity = B, P.src && (P.color = "none");
}
u.appendChild(P);
var j = u.getElementsByTagName("stroke") && u.getElementsByTagName("stroke")[0], $ = !1;
!j && ($ = j = D("stroke")), (l.stroke && "none" != l.stroke || l["stroke-width"] || null != l["stroke-opacity"] || l["stroke-dasharray"] || l["stroke-miterlimit"] || l["stroke-linejoin"] || l["stroke-linecap"]) && (j.on = !0),
("none" == l.stroke || null === l.stroke || null == j.on || 0 == l.stroke || 0 == l["stroke-width"]) && (j.on = !1);
var G = n.getRGB(l.stroke);
j.on && l.stroke && (j.color = G.hex), B = ((+h["stroke-opacity"] + 1 || 2) - 1) * ((+h.opacity + 1 || 2) - 1) * ((+G.o + 1 || 2) - 1);
var q = .75 * (i(l["stroke-width"]) || 1);
if (B = s(a(B, 0), 1), null == l["stroke-width"] && (q = h["stroke-width"]), l["stroke-width"] && (j.weight = q),
q && 1 > q && (B *= q) && (j.weight = 1), j.opacity = B, l["stroke-linejoin"] && (j.joinstyle = l["stroke-linejoin"] || "miter"),
j.miterlimit = l["stroke-miterlimit"] || 8, l["stroke-linecap"] && (j.endcap = "butt" == l["stroke-linecap"] ? "flat" : "square" == l["stroke-linecap"] ? "square" : "round"),
"stroke-dasharray" in l) {
var H = {
"-": "shortdash",
".": "shortdot",
"-.": "shortdashdot",
"-..": "shortdashdotdot",
". ": "dot",
"- ": "dash",
"--": "longdash",
"- .": "dashdot",
"--.": "longdashdot",
"--..": "longdashdotdot"
};
j.dashstyle = H[e](l["stroke-dasharray"]) ? H[l["stroke-dasharray"]] : p;
}
$ && u.appendChild(j);
}
if ("text" == v.type) {
v.paper.canvas.style.display = p;
var U = v.paper.span, z = h.font && h.font.match(/\d+(?:\.\d*)?(?=px)/);
f = U.style, h.font && (f.font = h.font), h["font-family"] && (f.fontFamily = h["font-family"]),
h["font-weight"] && (f.fontWeight = h["font-weight"]), h["font-style"] && (f.fontStyle = h["font-style"]),
z = i(h["font-size"] || z && z[0]) || 10, f.fontSize = 100 * z + "px", v.textpath.string && (U.innerHTML = t(v.textpath.string).replace(/"));
var V = U.getBoundingClientRect();
v.W = h.w = (V.right - V.left) / 100, v.H = h.h = (V.bottom - V.top) / 100, v.X = h.x,
v.Y = h.y + v.H / 2, ("x" in l || "y" in l) && (v.path.v = n.format("m{0},{1}l{2},{1}", o(h.x * b), o(h.y * b), o(h.x * b) + 1));
for (var W = [ "x", "y", "text", "font", "font-family", "font-weight", "font-style", "font-size" ], X = 0, Q = W.length; Q > X; X++) if (W[X] in l) {
v._.dirty = 1;
break;
}
switch (h["text-anchor"]) {
case "start":
v.textpath.style["v-text-align"] = "left", v.bbx = v.W / 2;
break;
case "end":
v.textpath.style["v-text-align"] = "right", v.bbx = -v.W / 2;
break;
default:
v.textpath.style["v-text-align"] = "center", v.bbx = 0;
}
v.textpath.style["v-text-kern"] = !0;
}
}, E = function(e, o, a) {
e.attrs = e.attrs || {};
var s = (e.attrs, Math.pow), l = "linear", c = ".5 .5";
if (e.attrs.gradient = o, o = t(o).replace(n._radial_gradient, function(e, t, n) {
return l = "radial", t && n && (t = i(t), n = i(n), s(t - .5, 2) + s(n - .5, 2) > .25 && (n = r.sqrt(.25 - s(t - .5, 2)) * (2 * (n > .5) - 1) + .5),
c = t + d + n), p;
}), o = o.split(/\s*\-\s*/), "linear" == l) {
var u = o.shift();
if (u = -i(u), isNaN(u)) return null;
}
var h = n._parseDots(o);
if (!h) return null;
if (e = e.shape || e.node, h.length) {
e.removeChild(a), a.on = !0, a.method = "none", a.color = h[0].color, a.color2 = h[h.length - 1].color;
for (var f = [], m = 0, g = h.length; g > m; m++) h[m].offset && f.push(h[m].offset + d + h[m].color);
a.colors = f.length ? f.join() : "0% " + a.color, "radial" == l ? (a.type = "gradientTitle",
a.focus = "100%", a.focussize = "0 0", a.focusposition = c, a.angle = 0) : (a.type = "gradient",
a.angle = (270 - u) % 360), e.appendChild(a);
}
return 1;
}, T = function(e, t) {
this[0] = this.node = e, e.raphael = !0, this.id = n._oid++, e.raphaelid = this.id,
this.X = 0, this.Y = 0, this.attrs = {}, this.paper = t, this.matrix = n.matrix(),
this._ = {
transform: [],
sx: 1,
sy: 1,
dx: 0,
dy: 0,
deg: 0,
dirty: 1,
dirtyT: 1
}, !t.bottom && (t.bottom = this), this.prev = t.top, t.top && (t.top.next = this),
t.top = this, this.next = null;
}, I = n.el;
T.prototype = I, I.constructor = T, I.transform = function(e) {
if (null == e) return this._.transform;
var i, r = this.paper._viewBoxShift, o = r ? "s" + [ r.scale, r.scale ] + "-1-1t" + [ r.dx, r.dy ] : p;
r && (i = e = t(e).replace(/\.{3}|\u2026/g, this._.transform || p)), n._extractTransform(this, o + e);
var a, s = this.matrix.clone(), l = this.skew, c = this.node, u = ~t(this.attrs.fill).indexOf("-"), h = !t(this.attrs.fill).indexOf("url(");
if (s.translate(1, 1), h || u || "image" == this.type) if (l.matrix = "1 0 0 1",
l.offset = "0 0", a = s.split(), u && a.noRotation || !a.isSimple) {
c.style.filter = s.toFilter();
var f = this.getBBox(), m = this.getBBox(1), g = f.x - m.x, v = f.y - m.y;
c.coordorigin = g * -b + d + v * -b, C(this, 1, 1, g, v, 0);
} else c.style.filter = p, C(this, a.scalex, a.scaley, a.dx, a.dy, a.rotate); else c.style.filter = p,
l.matrix = t(s), l.offset = s.offset();
return null !== i && (this._.transform = i, n._extractTransform(this, i)), this;
}, I.rotate = function(e, n, r) {
if (this.removed) return this;
if (null != e) {
if (e = t(e).split(c), e.length - 1 && (n = i(e[1]), r = i(e[2])), e = i(e[0]),
null == r && (n = r), null == n || null == r) {
var o = this.getBBox(1);
n = o.x + o.width / 2, r = o.y + o.height / 2;
}
return this._.dirtyT = 1, this.transform(this._.transform.concat([ [ "r", e, n, r ] ])),
this;
}
}, I.translate = function(e, n) {
return this.removed ? this : (e = t(e).split(c), e.length - 1 && (n = i(e[1])),
e = i(e[0]) || 0, n = +n || 0, this._.bbox && (this._.bbox.x += e, this._.bbox.y += n),
this.transform(this._.transform.concat([ [ "t", e, n ] ])), this);
}, I.scale = function(e, n, r, o) {
if (this.removed) return this;
if (e = t(e).split(c), e.length - 1 && (n = i(e[1]), r = i(e[2]), o = i(e[3]), isNaN(r) && (r = null),
isNaN(o) && (o = null)), e = i(e[0]), null == n && (n = e), null == o && (r = o),
null == r || null == o) var a = this.getBBox(1);
return r = null == r ? a.x + a.width / 2 : r, o = null == o ? a.y + a.height / 2 : o,
this.transform(this._.transform.concat([ [ "s", e, n, r, o ] ])), this._.dirtyT = 1,
this;
}, I.hide = function() {
return !this.removed && (this.node.style.display = "none"), this;
}, I.show = function() {
return !this.removed && (this.node.style.display = p), this;
}, I.auxGetBBox = n.el.getBBox, I.getBBox = function() {
var e = this.auxGetBBox();
if (this.paper && this.paper._viewBoxShift) {
var t = {}, n = 1 / this.paper._viewBoxShift.scale;
return t.x = e.x - this.paper._viewBoxShift.dx, t.x *= n, t.y = e.y - this.paper._viewBoxShift.dy,
t.y *= n, t.width = e.width * n, t.height = e.height * n, t.x2 = t.x + t.width,
t.y2 = t.y + t.height, t;
}
return e;
}, I._getBBox = function() {
return this.removed ? {} : {
x: this.X + (this.bbx || 0) - this.W / 2,
y: this.Y - this.H,
width: this.W,
height: this.H
};
}, I.remove = function() {
if (!this.removed && this.node.parentNode) {
this.paper.__set__ && this.paper.__set__.exclude(this), n.eve.unbind("raphael.*.*." + this.id),
n._tear(this, this.paper), this.node.parentNode.removeChild(this.node), this.shape && this.shape.parentNode.removeChild(this.shape);
for (var e in this) this[e] = "function" == typeof this[e] ? n._removedFactory(e) : null;
this.removed = !0;
}
}, I.attr = function(t, i) {
if (this.removed) return this;
if (null == t) {
var r = {};
for (var o in this.attrs) this.attrs[e](o) && (r[o] = this.attrs[o]);
return r.gradient && "none" == r.fill && (r.fill = r.gradient) && delete r.gradient,
r.transform = this._.transform, r;
}
if (null == i && n.is(t, "string")) {
if ("fill" == t && "none" == this.attrs.fill && this.attrs.gradient) return this.attrs.gradient;
for (var a = t.split(c), s = {}, l = 0, d = a.length; d > l; l++) t = a[l], s[t] = t in this.attrs ? this.attrs[t] : n.is(this.paper.customAttributes[t], "function") ? this.paper.customAttributes[t].def : n._availableAttrs[t];
return d - 1 ? s : s[a[0]];
}
if (this.attrs && null == i && n.is(t, "array")) {
for (s = {}, l = 0, d = t.length; d > l; l++) s[t[l]] = this.attr(t[l]);
return s;
}
var p;
null != i && (p = {}, p[t] = i), null == i && n.is(t, "object") && (p = t);
for (var h in p) u("raphael.attr." + h + "." + this.id, this, p[h]);
if (p) {
for (h in this.paper.customAttributes) if (this.paper.customAttributes[e](h) && p[e](h) && n.is(this.paper.customAttributes[h], "function")) {
var f = this.paper.customAttributes[h].apply(this, [].concat(p[h]));
this.attrs[h] = p[h];
for (var m in f) f[e](m) && (p[m] = f[m]);
}
p.text && "text" == this.type && (this.textpath.string = p.text), k(this, p);
}
return this;
}, I.toFront = function() {
return !this.removed && this.node.parentNode.appendChild(this.node), this.paper && this.paper.top != this && n._tofront(this, this.paper),
this;
}, I.toBack = function() {
return this.removed ? this : (this.node.parentNode.firstChild != this.node && (this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild),
n._toback(this, this.paper)), this);
}, I.insertAfter = function(e) {
return this.removed ? this : (e.constructor == n.st.constructor && (e = e[e.length - 1]),
e.node.nextSibling ? e.node.parentNode.insertBefore(this.node, e.node.nextSibling) : e.node.parentNode.appendChild(this.node),
n._insertafter(this, e, this.paper), this);
}, I.insertBefore = function(e) {
return this.removed ? this : (e.constructor == n.st.constructor && (e = e[0]), e.node.parentNode.insertBefore(this.node, e.node),
n._insertbefore(this, e, this.paper), this);
}, I.blur = function(e) {
var t = this.node.runtimeStyle, i = t.filter;
return i = i.replace(m, p), 0 != +e ? (this.attrs.blur = e, t.filter = i + d + " progid:DXImageTransform.Microsoft.Blur(pixelradius=" + (+e || 1.5) + ")",
t.margin = n.format("-{0}px 0 0 -{0}px", o(+e || 1.5))) : (t.filter = i, t.margin = 0,
delete this.attrs.blur), this;
}, n._engine.path = function(e, t) {
var n = D("shape");
n.style.cssText = v, n.coordsize = b + d + b, n.coordorigin = t.coordorigin;
var i = new T(n, t), r = {
fill: "none",
stroke: "#000"
};
e && (r.path = e), i.type = "path", i.path = [], i.Path = p, k(i, r), t.canvas.appendChild(n);
var o = D("skew");
return o.on = !0, n.appendChild(o), i.skew = o, i.transform(p), i;
}, n._engine.rect = function(e, t, i, r, o, a) {
var s = n._rectPath(t, i, r, o, a), l = e.path(s), c = l.attrs;
return l.X = c.x = t, l.Y = c.y = i, l.W = c.width = r, l.H = c.height = o, c.r = a,
c.path = s, l.type = "rect", l;
}, n._engine.ellipse = function(e, t, n, i, r) {
var o = e.path();
return o.attrs, o.X = t - i, o.Y = n - r, o.W = 2 * i, o.H = 2 * r, o.type = "ellipse",
k(o, {
cx: t,
cy: n,
rx: i,
ry: r
}), o;
}, n._engine.circle = function(e, t, n, i) {
var r = e.path();
return r.attrs, r.X = t - i, r.Y = n - i, r.W = r.H = 2 * i, r.type = "circle",
k(r, {
cx: t,
cy: n,
r: i
}), r;
}, n._engine.image = function(e, t, i, r, o, a) {
var s = n._rectPath(i, r, o, a), l = e.path(s).attr({
stroke: "none"
}), c = l.attrs, u = l.node, d = u.getElementsByTagName("fill")[0];
return c.src = t, l.X = c.x = i, l.Y = c.y = r, l.W = c.width = o, l.H = c.height = a,
c.path = s, l.type = "image", d.parentNode == u && u.removeChild(d), d.rotate = !0,
d.src = t, d.type = "tile", l._.fillpos = [ i, r ], l._.fillsize = [ o, a ], u.appendChild(d),
C(l, 1, 1, 0, 0, 0), l;
}, n._engine.text = function(e, i, r, a) {
var s = D("shape"), l = D("path"), c = D("textpath");
i = i || 0, r = r || 0, a = a || "", l.v = n.format("m{0},{1}l{2},{1}", o(i * b), o(r * b), o(i * b) + 1),
l.textpathok = !0, c.string = t(a), c.on = !0, s.style.cssText = v, s.coordsize = b + d + b,
s.coordorigin = "0 0";
var u = new T(s, e), h = {
fill: "#000",
stroke: "none",
font: n._availableAttrs.font,
text: a
};
u.shape = s, u.path = l, u.textpath = c, u.type = "text", u.attrs.text = t(a), u.attrs.x = i,
u.attrs.y = r, u.attrs.w = 1, u.attrs.h = 1, k(u, h), s.appendChild(c), s.appendChild(l),
e.canvas.appendChild(s);
var f = D("skew");
return f.on = !0, s.appendChild(f), u.skew = f, u.transform(p), u;
}, n._engine.setSize = function(e, t) {
var i = this.canvas.style;
return this.width = e, this.height = t, e == +e && (e += "px"), t == +t && (t += "px"),
i.width = e, i.height = t, i.clip = "rect(0 " + e + " " + t + " 0)", this._viewBox && n._engine.setViewBox.apply(this, this._viewBox),
this;
}, n._engine.setViewBox = function(e, t, i, r, o) {
n.eve("raphael.setViewBox", this, this._viewBox, [ e, t, i, r, o ]);
var a, s, l = this.getSize(), c = l.width, u = l.height;
return o && (a = u / r, s = c / i, c > i * a && (e -= (c - i * a) / 2 / a), u > r * s && (t -= (u - r * s) / 2 / s)),
this._viewBox = [ e, t, i, r, !!o ], this._viewBoxShift = {
dx: -e,
dy: -t,
scale: l
}, this.forEach(function(e) {
e.transform("...");
}), this;
};
var D;
n._engine.initWin = function(e) {
var t = e.document;
t.styleSheets.length < 31 ? t.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)") : t.styleSheets[0].addRule(".rvml", "behavior:url(#default#VML)");
try {
!t.namespaces.rvml && t.namespaces.add("rvml", "urn:schemas-microsoft-com:vml"),
D = function(e) {
return t.createElement("
');
};
} catch (e) {
D = function(e) {
return t.createElement("<" + e + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
};
}
}, n._engine.initWin(n._g.win), n._engine.create = function() {
var e = n._getContainer.apply(0, arguments), t = e.container, i = e.height, r = e.width, o = e.x, a = e.y;
if (!t) throw new Error("VML container not found.");
var s = new n._Paper(), l = s.canvas = n._g.doc.createElement("div"), c = l.style;
return o = o || 0, a = a || 0, r = r || 512, i = i || 342, s.width = r, s.height = i,
r == +r && (r += "px"), i == +i && (i += "px"), s.coordsize = 216e5 + d + 216e5,
s.coordorigin = "0 0", s.span = n._g.doc.createElement("span"), s.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",
l.appendChild(s.span), c.cssText = n.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", r, i),
1 == t ? (n._g.doc.body.appendChild(l), c.left = o + "px", c.top = a + "px", c.position = "absolute") : t.firstChild ? t.insertBefore(l, t.firstChild) : t.appendChild(l),
s.renderfix = function() {}, s;
}, n.prototype.clear = function() {
n.eve("raphael.clear", this), this.canvas.innerHTML = p, this.span = n._g.doc.createElement("span"),
this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",
this.canvas.appendChild(this.span), this.bottom = this.top = null;
}, n.prototype.remove = function() {
n.eve("raphael.remove", this), this.canvas.parentNode.removeChild(this.canvas);
for (var e in this) this[e] = "function" == typeof this[e] ? n._removedFactory(e) : null;
return !0;
};
var N = n.st;
for (var M in I) I[e](M) && !N[e](M) && (N[M] = function(e) {
return function() {
var t = arguments;
return this.forEach(function(n) {
n[e].apply(n, t);
});
};
}(M));
}
}(), T.was ? E.win.Raphael = n : Raphael = n, "object" == typeof exports && (module.exports = n),
n;
}), function() {
"use strict";
function e() {
this.title = void 0, this.actors = [], this.signals = [];
}
function t(e, t) {
_.extend(this, t), this.name = "ParseError", this.message = e || "";
}
e.prototype.getActor = function(t) {
var n = /^(.+) as (\S+)$/i.exec(t.trim());
n ? (name = n[1].trim(), t = n[2].trim()) : name = t.trim(), name = name.replace(/\\n/gm, "\n");
var i, r = this.actors;
for (i in r) if (r[i].alias == t) return r[i];
return i = r.push(new e.Actor(t, name, r.length)), r[i - 1];
}, e.prototype.setTitle = function(e) {
this.title = e;
}, e.prototype.addSignal = function(e) {
this.signals.push(e);
}, e.Actor = function(e, t, n) {
this.alias = e, this.name = t, this.index = n;
}, e.Signal = function(e, t, n, i) {
this.type = "Signal", this.actorA = e, this.actorB = n, this.linetype = 3 & t, this.arrowtype = t >> 2 & 3,
this.message = i;
}, e.Signal.prototype.isSelf = function() {
return this.actorA.index == this.actorB.index;
}, e.Note = function(e, t, n) {
if (this.type = "Note", this.actor = e, this.placement = t, this.message = n, this.hasManyActors() && e[0] == e[1]) throw new Error("Note should be over two different actors");
}, e.Note.prototype.hasManyActors = function() {
return _.isArray(this.actor);
}, e.LINETYPE = {
SOLID: 0,
DOTTED: 1
}, e.ARROWTYPE = {
FILLED: 0,
OPEN: 1
}, e.PLACEMENT = {
LEFTOF: 0,
RIGHTOF: 1,
OVER: 2
};
var n = function() {
function t() {
this.yy = {};
}
var n = {
trace: function() {},
yy: {},
symbols_: {
error: 2,
start: 3,
document: 4,
EOF: 5,
line: 6,
statement: 7,
NL: 8,
participant: 9,
actor: 10,
signal: 11,
note_statement: 12,
title: 13,
message: 14,
note: 15,
placement: 16,
over: 17,
actor_pair: 18,
",": 19,
left_of: 20,
right_of: 21,
signaltype: 22,
ACTOR: 23,
linetype: 24,
arrowtype: 25,
LINE: 26,
DOTLINE: 27,
ARROW: 28,
OPENARROW: 29,
MESSAGE: 30,
$accept: 0,
$end: 1
},
terminals_: {
2: "error",
5: "EOF",
8: "NL",
9: "participant",
13: "title",
15: "note",
17: "over",
19: ",",
20: "left_of",
21: "right_of",
23: "ACTOR",
26: "LINE",
27: "DOTLINE",
28: "ARROW",
29: "OPENARROW",
30: "MESSAGE"
},
productions_: [ 0, [ 3, 2 ], [ 4, 0 ], [ 4, 2 ], [ 6, 1 ], [ 6, 1 ], [ 7, 2 ], [ 7, 1 ], [ 7, 1 ], [ 7, 2 ], [ 12, 4 ], [ 12, 4 ], [ 18, 1 ], [ 18, 3 ], [ 16, 1 ], [ 16, 1 ], [ 11, 4 ], [ 10, 1 ], [ 22, 2 ], [ 22, 1 ], [ 24, 1 ], [ 24, 1 ], [ 25, 1 ], [ 25, 1 ], [ 14, 1 ] ],
performAction: function(t, n, i, r, o, a) {
var s = a.length - 1;
switch (o) {
case 1:
return r;
case 4:
break;
case 6:
a[s];
break;
case 7:
case 8:
r.addSignal(a[s]);
break;
case 9:
r.setTitle(a[s]);
break;
case 10:
this.$ = new e.Note(a[s - 1], a[s - 2], a[s]);
break;
case 11:
this.$ = new e.Note(a[s - 1], e.PLACEMENT.OVER, a[s]);
break;
case 12:
this.$ = a[s];
break;
case 13:
this.$ = [ a[s - 2], a[s] ];
break;
case 14:
this.$ = e.PLACEMENT.LEFTOF;
break;
case 15:
this.$ = e.PLACEMENT.RIGHTOF;
break;
case 16:
this.$ = new e.Signal(a[s - 3], a[s - 2], a[s - 1], a[s]);
break;
case 17:
this.$ = r.getActor(a[s]);
break;
case 18:
this.$ = a[s - 1] | a[s] << 2;
break;
case 19:
this.$ = a[s];
break;
case 20:
this.$ = e.LINETYPE.SOLID;
break;
case 21:
this.$ = e.LINETYPE.DOTTED;
break;
case 22:
this.$ = e.ARROWTYPE.FILLED;
break;
case 23:
this.$ = e.ARROWTYPE.OPEN;
break;
case 24:
this.$ = a[s].substring(1).trim().replace(/\\n/gm, "\n");
}
},
table: [ {
3: 1,
4: 2,
5: [ 2, 2 ],
8: [ 2, 2 ],
9: [ 2, 2 ],
13: [ 2, 2 ],
15: [ 2, 2 ],
23: [ 2, 2 ]
}, {
1: [ 3 ]
}, {
5: [ 1, 3 ],
6: 4,
7: 5,
8: [ 1, 6 ],
9: [ 1, 7 ],
10: 11,
11: 8,
12: 9,
13: [ 1, 10 ],
15: [ 1, 12 ],
23: [ 1, 13 ]
}, {
1: [ 2, 1 ]
}, {
5: [ 2, 3 ],
8: [ 2, 3 ],
9: [ 2, 3 ],
13: [ 2, 3 ],
15: [ 2, 3 ],
23: [ 2, 3 ]
}, {
5: [ 2, 4 ],
8: [ 2, 4 ],
9: [ 2, 4 ],
13: [ 2, 4 ],
15: [ 2, 4 ],
23: [ 2, 4 ]
}, {
5: [ 2, 5 ],
8: [ 2, 5 ],
9: [ 2, 5 ],
13: [ 2, 5 ],
15: [ 2, 5 ],
23: [ 2, 5 ]
}, {
10: 14,
23: [ 1, 13 ]
}, {
5: [ 2, 7 ],
8: [ 2, 7 ],
9: [ 2, 7 ],
13: [ 2, 7 ],
15: [ 2, 7 ],
23: [ 2, 7 ]
}, {
5: [ 2, 8 ],
8: [ 2, 8 ],
9: [ 2, 8 ],
13: [ 2, 8 ],
15: [ 2, 8 ],
23: [ 2, 8 ]
}, {
14: 15,
30: [ 1, 16 ]
}, {
22: 17,
24: 18,
26: [ 1, 19 ],
27: [ 1, 20 ]
}, {
16: 21,
17: [ 1, 22 ],
20: [ 1, 23 ],
21: [ 1, 24 ]
}, {
5: [ 2, 17 ],
8: [ 2, 17 ],
9: [ 2, 17 ],
13: [ 2, 17 ],
15: [ 2, 17 ],
19: [ 2, 17 ],
23: [ 2, 17 ],
26: [ 2, 17 ],
27: [ 2, 17 ],
30: [ 2, 17 ]
}, {
5: [ 2, 6 ],
8: [ 2, 6 ],
9: [ 2, 6 ],
13: [ 2, 6 ],
15: [ 2, 6 ],
23: [ 2, 6 ]
}, {
5: [ 2, 9 ],
8: [ 2, 9 ],
9: [ 2, 9 ],
13: [ 2, 9 ],
15: [ 2, 9 ],
23: [ 2, 9 ]
}, {
5: [ 2, 24 ],
8: [ 2, 24 ],
9: [ 2, 24 ],
13: [ 2, 24 ],
15: [ 2, 24 ],
23: [ 2, 24 ]
}, {
10: 25,
23: [ 1, 13 ]
}, {
23: [ 2, 19 ],
25: 26,
28: [ 1, 27 ],
29: [ 1, 28 ]
}, {
23: [ 2, 20 ],
28: [ 2, 20 ],
29: [ 2, 20 ]
}, {
23: [ 2, 21 ],
28: [ 2, 21 ],
29: [ 2, 21 ]
}, {
10: 29,
23: [ 1, 13 ]
}, {
10: 31,
18: 30,
23: [ 1, 13 ]
}, {
23: [ 2, 14 ]
}, {
23: [ 2, 15 ]
}, {
14: 32,
30: [ 1, 16 ]
}, {
23: [ 2, 18 ]
}, {
23: [ 2, 22 ]
}, {
23: [ 2, 23 ]
}, {
14: 33,
30: [ 1, 16 ]
}, {
14: 34,
30: [ 1, 16 ]
}, {
19: [ 1, 35 ],
30: [ 2, 12 ]
}, {
5: [ 2, 16 ],
8: [ 2, 16 ],
9: [ 2, 16 ],
13: [ 2, 16 ],
15: [ 2, 16 ],
23: [ 2, 16 ]
}, {
5: [ 2, 10 ],
8: [ 2, 10 ],
9: [ 2, 10 ],
13: [ 2, 10 ],
15: [ 2, 10 ],
23: [ 2, 10 ]
}, {
5: [ 2, 11 ],
8: [ 2, 11 ],
9: [ 2, 11 ],
13: [ 2, 11 ],
15: [ 2, 11 ],
23: [ 2, 11 ]
}, {
10: 36,
23: [ 1, 13 ]
}, {
30: [ 2, 13 ]
} ],
defaultActions: {
3: [ 2, 1 ],
23: [ 2, 14 ],
24: [ 2, 15 ],
26: [ 2, 18 ],
27: [ 2, 22 ],
28: [ 2, 23 ],
36: [ 2, 13 ]
},
parseError: function(e, t) {
if (!t.recoverable) throw new Error(e);
this.trace(e);
},
parse: function(e) {
var t = this, n = [ 0 ], i = [ null ], r = [], o = this.table, a = "", s = 0, l = 0, c = 0, u = 1;
this.lexer.setInput(e), this.lexer.yy = this.yy, this.yy.lexer = this.lexer, this.yy.parser = this,
void 0 === this.lexer.yylloc && (this.lexer.yylloc = {});
var d = this.lexer.yylloc;
r.push(d);
var p = this.lexer.options && this.lexer.options.ranges;
this.parseError = "function" == typeof this.yy.parseError ? this.yy.parseError : Object.getPrototypeOf(this).parseError;
for (var h, f, m, g, v, b, y, x, w, S = {}; ;) {
if (m = n[n.length - 1], this.defaultActions[m] ? g = this.defaultActions[m] : (null !== h && void 0 !== h || (h = function() {
var e;
return e = t.lexer.lex() || u, "number" != typeof e && (e = t.symbols_[e] || e),
e;
}()), g = o[m] && o[m][h]), void 0 === g || !g.length || !g[0]) {
var C = "";
w = [];
for (b in o[m]) this.terminals_[b] && b > 2 && w.push("'" + this.terminals_[b] + "'");
C = this.lexer.showPosition ? "Parse error on line " + (s + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + w.join(", ") + ", got '" + (this.terminals_[h] || h) + "'" : "Parse error on line " + (s + 1) + ": Unexpected " + (h == u ? "end of input" : "'" + (this.terminals_[h] || h) + "'"),
this.parseError(C, {
text: this.lexer.match,
token: this.terminals_[h] || h,
line: this.lexer.yylineno,
loc: d,
expected: w
});
}
if (g[0] instanceof Array && g.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + m + ", token: " + h);
switch (g[0]) {
case 1:
n.push(h), i.push(this.lexer.yytext), r.push(this.lexer.yylloc), n.push(g[1]), h = null,
f ? (h = f, f = null) : (l = this.lexer.yyleng, a = this.lexer.yytext, s = this.lexer.yylineno,
d = this.lexer.yylloc, c > 0 && c--);
break;
case 2:
if (y = this.productions_[g[1]][1], S.$ = i[i.length - y], S._$ = {
first_line: r[r.length - (y || 1)].first_line,
last_line: r[r.length - 1].last_line,
first_column: r[r.length - (y || 1)].first_column,
last_column: r[r.length - 1].last_column
}, p && (S._$.range = [ r[r.length - (y || 1)].range[0], r[r.length - 1].range[1] ]),
void 0 !== (v = this.performAction.call(S, a, l, s, this.yy, g[1], i, r))) return v;
y && (n = n.slice(0, -1 * y * 2), i = i.slice(0, -1 * y), r = r.slice(0, -1 * y)),
n.push(this.productions_[g[1]][0]), i.push(S.$), r.push(S._$), x = o[n[n.length - 2]][n[n.length - 1]],
n.push(x);
break;
case 3:
return !0;
}
}
return !0;
}
}, i = function() {
return {
EOF: 1,
parseError: function(e, t) {
if (!this.yy.parser) throw new Error(e);
this.yy.parser.parseError(e, t);
},
setInput: function(e) {
return this._input = e, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0,
this.yytext = this.matched = this.match = "", this.conditionStack = [ "INITIAL" ],
this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [ 0, 0 ]), this.offset = 0, this;
},
input: function() {
var e = this._input[0];
return this.yytext += e, this.yyleng++, this.offset++, this.match += e, this.matched += e,
e.match(/(?:\r\n?|\n).*/g) ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++,
this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1),
e;
},
unput: function(e) {
var t = e.length, n = e.split(/(?:\r\n?|\n)/g);
this._input = e + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - t - 1),
this.offset -= t;
var i = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1),
n.length - 1 && (this.yylineno -= n.length - 1);
var r = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: n ? (n.length === i.length ? this.yylloc.first_column : 0) + i[i.length - n.length].length - n[0].length : this.yylloc.first_column - t
}, this.options.ranges && (this.yylloc.range = [ r[0], r[0] + this.yyleng - t ]),
this.yyleng = this.yytext.length, this;
},
more: function() {
return this._more = !0, this;
},
reject: function() {
return this.options.backtrack_lexer ? (this._backtrack = !0, this) : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
less: function(e) {
this.unput(this.match.slice(e));
},
pastInput: function() {
var e = this.matched.substr(0, this.matched.length - this.match.length);
return (e.length > 20 ? "..." : "") + e.substr(-20).replace(/\n/g, "");
},
upcomingInput: function() {
var e = this.match;
return e.length < 20 && (e += this._input.substr(0, 20 - e.length)), (e.substr(0, 20) + (e.length > 20 ? "..." : "")).replace(/\n/g, "");
},
showPosition: function() {
var e = this.pastInput(), t = new Array(e.length + 1).join("-");
return e + this.upcomingInput() + "\n" + t + "^";
},
test_match: function(e, t) {
var n, i, r;
if (this.options.backtrack_lexer && (r = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (r.yylloc.range = this.yylloc.range.slice(0))), i = e[0].match(/(?:\r\n?|\n).*/g),
i && (this.yylineno += i.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: i ? i[i.length - 1].length - i[i.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + e[0].length
}, this.yytext += e[0], this.match += e[0], this.matches = e, this.yyleng = this.yytext.length,
this.options.ranges && (this.yylloc.range = [ this.offset, this.offset += this.yyleng ]),
this._more = !1, this._backtrack = !1, this._input = this._input.slice(e[0].length),
this.matched += e[0], n = this.performAction.call(this, this.yy, this, t, this.conditionStack[this.conditionStack.length - 1]),
this.done && this._input && (this.done = !1), n) return n;
if (this._backtrack) {
for (var o in r) this[o] = r[o];
return !1;
}
return !1;
},
next: function() {
if (this.done) return this.EOF;
this._input || (this.done = !0);
var e, t, n, i;
this._more || (this.yytext = "", this.match = "");
for (var r = this._currentRules(), o = 0; o < r.length; o++) if ((n = this._input.match(this.rules[r[o]])) && (!t || n[0].length > t[0].length)) {
if (t = n, i = o, this.options.backtrack_lexer) {
if (!1 !== (e = this.test_match(n, r[o]))) return e;
if (this._backtrack) {
t = !1;
continue;
}
return !1;
}
if (!this.options.flex) break;
}
return t ? !1 !== (e = this.test_match(t, r[i])) && e : "" === this._input ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
},
lex: function() {
var e = this.next();
return e || this.lex();
},
begin: function(e) {
this.conditionStack.push(e);
},
popState: function() {
return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
},
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
},
topState: function(e) {
return e = this.conditionStack.length - 1 - Math.abs(e || 0), e >= 0 ? this.conditionStack[e] : "INITIAL";
},
pushState: function(e) {
this.begin(e);
},
stateStackSize: function() {
return this.conditionStack.length;
},
options: {
"case-insensitive": !0
},
performAction: function(e, t, n) {
switch (n) {
case 0:
return 8;
case 1:
case 2:
break;
case 3:
return 9;
case 4:
return 20;
case 5:
return 21;
case 6:
return 17;
case 7:
return 15;
case 8:
return 13;
case 9:
return 19;
case 10:
return 23;
case 11:
return 27;
case 12:
return 26;
case 13:
return 29;
case 14:
return 28;
case 15:
return 30;
case 16:
return 5;
case 17:
return "INVALID";
}
},
rules: [ /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:participant\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:title\b)/i, /^(?:,)/i, /^(?:[^\->:\n,]+)/i, /^(?:--)/i, /^(?:-)/i, /^(?:>>)/i, /^(?:>)/i, /^(?:[^#\n]+)/i, /^(?:$)/i, /^(?:.)/i ],
conditions: {
INITIAL: {
rules: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 ],
inclusive: !0
}
}
};
}();
return n.lexer = i, t.prototype = n, n.Parser = t, new t();
}();
"undefined" != typeof require && "undefined" != typeof exports && (exports.parser = n,
exports.Parser = n.Parser, exports.parse = function() {
return n.parse.apply(n, arguments);
}, exports.main = function(e) {
e[1] || (console.log("Usage: " + e[0] + " FILE"), process.exit(1));
var t = require("fs").readFileSync(require("path").normalize(e[1]), "utf8");
return exports.parser.parse(t);
}, "undefined" != typeof module && require.main === module && exports.main(process.argv.slice(1))),
t.prototype = new Error(), e.ParseError = t, n.parseError = function(e, n) {
throw new t(e, n);
}, e.parse = function(t) {
return n.yy = new e(), n.parse(t);
}, this.Diagram = e;
}.call(this), define("diagram-grammar", [ "underscore" ], function() {}), function(e) {
"function" == typeof define && define.amd ? define("Diagram", [ "raphael" ], function(t) {
return e(t), Diagram;
}) : e(Raphael);
}(function(e) {
"use strict";
function t(e) {
this.message = e;
}
function n(e, n) {
if (!e) throw new t(n);
}
function i(e) {
return e.x + e.width / 2;
}
function r(e) {
return e.y + e.height / 2;
}
var o = Diagram.PLACEMENT, a = Diagram.LINETYPE, s = Diagram.ARROWTYPE, l = {
stroke: "#000",
"stroke-width": 2
}, c = {
fill: "#fff"
};
t.prototype.toString = function() {
return "AssertException: " + this.message;
}, String.prototype.trim || (String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
}), e.fn.line = function(e, t, i, r) {
return n(_.all([ e, i, t, r ], _.isFinite), "x1,x2,y1,y2 must be numeric"), this.path("M{0},{1} L{2},{3}", e, t, i, r);
}, e.fn.wobble = function(e, t, i, r) {
n(_.all([ e, i, t, r ], _.isFinite), "x1,x2,y1,y2 must be numeric");
var o = Math.sqrt((i - e) * (i - e) + (r - t) * (r - t)) / 25, a = Math.random(), s = Math.random(), l = Math.random() > .5 ? o : -o, c = Math.random() > .5 ? o : -o, u = {
x: (i - e) * a + e + l,
y: (r - t) * a + t + c
}, d = {
x: (i - e) * s + e - l,
y: (r - t) * s + t - c
};
return "C" + u.x + "," + u.y + " " + d.x + "," + d.y + " " + i + "," + r;
}, e.fn.text_bbox = function(e, t) {
var n;
t._obj ? n = this.print_center(0, 0, e, t._obj, t["font-size"]) : (n = this.text(0, 0, e),
n.attr(t));
var i = n.getBBox();
return n.remove(), i;
}, e.fn.handRect = function(e, t, i, r) {
return n(_.all([ e, t, i, r ], _.isFinite), "x, y, w, h must be numeric"), this.path("M" + e + "," + t + this.wobble(e, t, e + i, t) + this.wobble(e + i, t, e + i, t + r) + this.wobble(e + i, t + r, e, t + r) + this.wobble(e, t + r, e, t)).attr(c);
}, e.fn.handLine = function(e, t, i, r) {
return n(_.all([ e, i, t, r ], _.isFinite), "x1,x2,y1,y2 must be numeric"), this.path("M" + e + "," + t + this.wobble(e, t, i, r));
}, e.fn.print_center = function(t, n, i, r, o, a) {
var s = this.print(t, n, i, r, o, "baseline", a), l = s.getBBox(), c = t - l.x - l.width / 2, u = n - l.y - l.height / 2, d = new e.matrix();
return d.translate(c, u), s.attr("path", e.mapPath(s.attr("path"), d));
};
var u = function(e) {
this.init(e);
};
_.extend(u.prototype, {
init: function(e) {
this.diagram = e, this._paper = void 0, this._font = void 0, this._title = void 0,
this._actors_height = 0, this._signals_height = 0;
var t = this.arrow_types = {};
t[s.FILLED] = "block", t[s.OPEN] = "open";
var n = this.line_types = {};
n[a.SOLID] = "", n[a.DOTTED] = "-";
},
init_paper: function(t) {
this._paper = new e(t, 320, 200);
},
init_font: function() {},
draw_line: function(e, t, n, i) {
return this._paper.line(e, t, n, i);
},
draw_rect: function(e, t, n, i) {
return this._paper.rect(e, t, n, i);
},
draw: function(e) {
var t = this.diagram;
this.init_paper(e), this.init_font(), this.layout();
var n = this._title ? this._title.height : 0;
this._paper.setStart(), this._paper.setSize(t.width, t.height);
var i = 10 + n;
this.draw_title(), this.draw_actors(i), this.draw_signals(i + this._actors_height),
this._paper.setFinish();
},
layout: function() {
function e(e, t, i) {
n(t > e, "a must be less than or equal to b"), 0 > e ? (t = a[t], t.x = Math.max(i - t.width / 2, t.x)) : t >= a.length ? (e = a[e],
e.padding_right = Math.max(i, e.padding_right)) : (e = a[e], e.distances[t] = Math.max(i, e.distances[t] ? e.distances[t] : 0));
}
var t = this.diagram, i = this._paper, r = this._font, a = t.actors, s = t.signals;
if (t.width = 0, t.height = 0, t.title) {
var l = this._title = {}, c = i.text_bbox(t.title, r);
l.text_bb = c, l.message = t.title, l.width = c.width + 10, l.height = c.height + 10,
l.x = 10, l.y = 10, t.width += l.width, t.height += l.height;
}
_.each(a, function(e) {
var t = i.text_bbox(e.name, r);
e.text_bb = t, e.x = 0, e.y = 0, e.width = t.width + 40, e.height = t.height + 40,
e.distances = [], e.padding_right = 0, this._actors_height = Math.max(e.height, this._actors_height);
}, this), _.each(s, function(t) {
var n, a, s = i.text_bbox(t.message, r);
t.text_bb = s, t.width = s.width, t.height = s.height;
var l = 0;
if ("Signal" == t.type) t.width += 20, t.height += 20, t.isSelf() ? (n = t.actorA.index,
a = n + 1, t.width += 20) : (n = Math.min(t.actorA.index, t.actorB.index), a = Math.max(t.actorA.index, t.actorB.index)); else {
if ("Note" != t.type) throw new Error("Unhandled signal type:" + t.type);
if (t.width += 30, t.height += 30, l = 20, t.placement == o.LEFTOF) a = t.actor.index,
n = a - 1; else if (t.placement == o.RIGHTOF) n = t.actor.index, a = n + 1; else if (t.placement == o.OVER && t.hasManyActors()) n = Math.min(t.actor[0].index, t.actor[1].index),
a = Math.max(t.actor[0].index, t.actor[1].index), l = -40; else if (t.placement == o.OVER) return n = t.actor.index,
e(n - 1, n, t.width / 2), e(n, n + 1, t.width / 2), void (this._signals_height += t.height);
}
e(n, a, t.width + l), this._signals_height += t.height;
}, this);
var u = 0;
return _.each(a, function(e) {
e.x = Math.max(u, e.x), _.each(e.distances, function(t, n) {
void 0 !== t && (n = a[n], t = Math.max(t, e.width / 2, n.width / 2), n.x = Math.max(n.x, e.x + e.width / 2 + t - n.width / 2));
}), u = e.x + e.width + e.padding_right;
}, this), t.width = Math.max(u, t.width), t.width += 20, t.height += 20 + 2 * this._actors_height + this._signals_height,
this;
},
draw_title: function() {
var e = this._title;
e && this.draw_text_box(e, e.message, 0, 5, this._font);
},
draw_actors: function(e) {
var t = e;
_.each(this.diagram.actors, function(e) {
this.draw_actor(e, t, this._actors_height), this.draw_actor(e, t + this._actors_height + this._signals_height, this._actors_height);
var n = i(e);
this.draw_line(n, t + this._actors_height - 10, n, t + this._actors_height + 10 + this._signals_height).attr(l);
}, this);
},
draw_actor: function(e, t, n) {
e.y = t, e.height = n, this.draw_text_box(e, e.name, 10, 10, this._font);
},
draw_signals: function(e) {
var t = e;
_.each(this.diagram.signals, function(e) {
"Signal" == e.type ? e.isSelf() ? this.draw_self_signal(e, t) : this.draw_signal(e, t) : "Note" == e.type && this.draw_note(e, t),
t += e.height;
}, this);
},
draw_self_signal: function(e, t) {
n(e.isSelf(), "signal must be a self signal");
var r = e.text_bb, o = i(e.actorA), a = o + 20 + 5 - r.x, s = t + e.height / 2;
this.draw_text(a, s, e.message, this._font);
var c, u = _.extend({}, l, {
"stroke-dasharray": this.line_types[e.linetype]
}), d = t + 5, p = d + e.height - 5;
c = this.draw_line(o, d, o + 20, d), c.attr(u), c = this.draw_line(o + 20, d, o + 20, p),
c.attr(u), c = this.draw_line(o + 20, p, o, p), u["arrow-end"] = this.arrow_types[e.arrowtype] + "-wide-long",
c.attr(u);
},
draw_signal: function(e, t) {
var n = i(e.actorA), r = i(e.actorB), o = (r - n) / 2 + n, a = t + 5 + 10;
this.draw_text(o, a, e.message, this._font), a = t + e.height - 5 - 5;
var s = this.draw_line(n, a, r, a);
s.attr(l), s.attr({
"arrow-end": this.arrow_types[e.arrowtype] + "-wide-long",
"stroke-dasharray": this.line_types[e.linetype]
});
},
draw_note: function(e, t) {
e.y = t;
var n = e.hasManyActors() ? e.actor[0] : e.actor, r = i(n);
switch (e.placement) {
case o.RIGHTOF:
e.x = r + 10;
break;
case o.LEFTOF:
e.x = r - 10 - e.width;
break;
case o.OVER:
if (e.hasManyActors()) {
var a = i(e.actor[1]);
e.x = r - 20, e.width = a + 20 - e.x;
} else e.x = r - e.width / 2;
break;
default:
throw new Error("Unhandled note placement:" + e.placement);
}
this.draw_text_box(e, e.message, 10, 5, this._font);
},
draw_text: function(e, t, n, i) {
var r, o = this._paper, a = i || {};
a._obj ? r = o.print_center(e, t, n, a._obj, a["font-size"]) : (r = o.text(e, t, n),
r.attr(a));
var s = r.getBBox();
o.rect(s.x, s.y, s.width, s.height).attr({
fill: "#fff",
stroke: "none"
}), r.toFront();
},
draw_text_box: function(e, t, n, o, a) {
var s = e.x + n, c = e.y + n, u = e.width - 2 * n, d = e.height - 2 * n;
this.draw_rect(s, c, u, d).attr(l), s = i(e), c = r(e), this.draw_text(s, c, t, a);
}
});
var d = function(e) {
this.init(e);
};
_.extend(d.prototype, u.prototype, {
init_font: function() {
this._font = {
"font-size": 16,
"font-family": "Andale Mono, monospace"
};
}
});
var p = function(e) {
this.init(e);
};
_.extend(p.prototype, u.prototype, {
init_font: function() {
this._font = {
"font-size": 16,
"font-family": "daniel"
}, this._font._obj = this._paper.getFont("daniel");
},
draw_line: function(e, t, n, i) {
return this._paper.handLine(e, t, n, i);
},
draw_rect: function(e, t, n, i) {
return this._paper.handRect(e, t, n, i);
}
});
var h = {
simple: d,
hand: p
};
Diagram.prototype.drawSVG = function(e, t) {
var n = {
theme: "hand"
};
if (t = _.defaults(t || {}, n), !(t.theme in h)) throw new Error("Unsupported theme: " + t.theme);
new h[t.theme](this).draw(e);
};
}), function(e, t) {
"object" == typeof exports ? module.exports = t() : "function" == typeof define && define.amd && define("flow-chart", [], t);
}(0, function() {
function e(t, n) {
if (!t || "function" == typeof t) return n;
var i = {};
for (var r in n) i[r] = n[r];
for (r in t) t[r] && (i[r] = "object" == typeof i[r] ? e(i[r], t[r]) : t[r]);
return i;
}
function t(e, t) {
if ("function" == typeof Object.create) e.super_ = t, e.prototype = Object.create(t.prototype, {
constructor: {
value: e,
enumerable: !1,
writable: !0,
configurable: !0
}
}); else {
e.super_ = t;
var n = function() {};
n.prototype = t.prototype, e.prototype = new n(), e.prototype.constructor = e;
}
}
function n(e, t, n) {
var i, r, o = "M{0},{1}";
for (i = 2, r = 2 * n.length + 2; r > i; i += 2) o += " L{" + i + "},{" + (i + 1) + "}";
var a = [ t.x, t.y ];
for (i = 0, r = n.length; r > i; i++) a.push(n[i].x), a.push(n[i].y);
var s = e.paper.path(o, a);
s.attr("stroke", e.options["element-color"]), s.attr("stroke-width", e.options["line-width"]);
var l = e.options.font, c = e.options["font-family"], u = e.options["font-weight"];
return l && s.attr({
font: l
}), c && s.attr({
"font-family": c
}), u && s.attr({
"font-weight": u
}), s;
}
function i(e, t, n, i) {
var r, o;
"[object Array]" !== Object.prototype.toString.call(n) && (n = [ n ]);
var a = "M{0},{1}";
for (r = 2, o = 2 * n.length + 2; o > r; r += 2) a += " L{" + r + "},{" + (r + 1) + "}";
var s = [ t.x, t.y ];
for (r = 0, o = n.length; o > r; r++) s.push(n[r].x), s.push(n[r].y);
var l = e.paper.path(a, s);
l.attr({
stroke: e.options["line-color"],
"stroke-width": e.options["line-width"],
"arrow-end": e.options["arrow-end"]
});
var c = e.options.font, u = e.options["font-family"], d = e.options["font-weight"];
if (c && l.attr({
font: c
}), u && l.attr({
"font-family": u
}), d && l.attr({
"font-weight": d
}), i) {
var p = e.paper.text(0, 0, i), h = !1, f = n[0];
t.y === f.y && (h = !0);
var m = 0, g = 0;
m = t.x, g = t.y, h ? (m += e.options["text-margin"] / 2, g -= e.options["text-margin"]) : (m += e.options["text-margin"] / 2,
g += e.options["text-margin"]), p.attr({
"text-anchor": "start",
"font-size": e.options["font-size"],
fill: e.options["font-color"],
x: m,
y: g
}), c && p.attr({
font: c
}), u && p.attr({
"font-family": u
}), d && p.attr({
"font-weight": d
});
}
return l;
}
function r(e, t, n, i, r, o, a, s) {
var l, c, u, d, p, h = {
x: null,
y: null,
onLine1: !1,
onLine2: !1
};
return l = (s - o) * (n - e) - (a - r) * (i - t), 0 === l ? h : (c = t - o, u = e - r,
d = (a - r) * c - (s - o) * u, p = (n - e) * c - (i - t) * u, c = d / l, u = p / l,
h.x = e + c * (n - e), h.y = t + c * (i - t), c > 0 && 1 > c && (h.onLine1 = !0),
u > 0 && 1 > u && (h.onLine2 = !0), h);
}
function o(e, t) {
t = t || {}, this.paper = new Raphael(e), this.options = g.defaults(t, m), this.symbols = [],
this.lines = [], this.start = null;
}
function a(e, t, n) {
this.chart = e, this.group = this.chart.paper.set(), this.symbol = n, this.connectedTo = [],
this.symbolType = t.symbolType, this.flowstate = t.flowstate || "future", this.next_direction = t.next && t.direction_next ? t.direction_next : void 0,
this.text = this.chart.paper.text(0, 0, t.text), t.key && (this.text.node.id = t.key + "t"),
this.text.node.setAttribute("class", this.getAttr("class") + "t"), this.text.attr({
"text-anchor": "start",
x: this.getAttr("text-margin"),
fill: this.getAttr("font-color"),
"font-size": this.getAttr("font-size")
});
var i = this.getAttr("font"), r = this.getAttr("font-family"), o = this.getAttr("font-weight");
i && this.text.attr({
font: i
}), r && this.text.attr({
"font-family": r
}), o && this.text.attr({
"font-weight": o
}), t.link && this.text.attr("href", t.link), t.target && this.text.attr("target", t.target);
var a = this.getAttr("maxWidth");
if (a) {
for (var s = t.text.split(" "), l = "", c = 0, u = s.length; u > c; c++) {
var d = s[c];
this.text.attr("text", l + " " + d), l += this.text.getBBox().width > a ? "\n" + d : " " + d;
}
this.text.attr("text", l.substring(1));
}
if (this.group.push(this.text), n) {
var p = this.getAttr("text-margin");
n.attr({
fill: this.getAttr("fill"),
stroke: this.getAttr("element-color"),
"stroke-width": this.getAttr("line-width"),
width: this.text.getBBox().width + 2 * p,
height: this.text.getBBox().height + 2 * p
}), n.node.setAttribute("class", this.getAttr("class")), t.link && n.attr("href", t.link),
t.target && n.attr("target", t.target), t.key && (n.node.id = t.key), this.group.push(n),
n.insertBefore(this.text), this.text.attr({
y: n.getBBox().height / 2
}), this.initialize();
}
}
function s(e, t) {
var n = e.paper.rect(0, 0, 0, 0, 20);
t = t || {}, t.text = t.text || "Start", a.call(this, e, t, n);
}
function l(e, t) {
var n = e.paper.rect(0, 0, 0, 0, 20);
t = t || {}, t.text = t.text || "End", a.call(this, e, t, n);
}
function c(e, t) {
var n = e.paper.rect(0, 0, 0, 0);
t = t || {}, a.call(this, e, t, n);
}
function u(e, t) {
var n = e.paper.rect(0, 0, 0, 0);
t = t || {}, a.call(this, e, t, n), n.attr({
width: this.text.getBBox().width + 4 * this.getAttr("text-margin")
}), this.text.attr({
x: 2 * this.getAttr("text-margin")
});
var i = e.paper.rect(0, 0, 0, 0);
i.attr({
x: this.getAttr("text-margin"),
stroke: this.getAttr("element-color"),
"stroke-width": this.getAttr("line-width"),
width: this.text.getBBox().width + 2 * this.getAttr("text-margin"),
height: this.text.getBBox().height + 2 * this.getAttr("text-margin"),
fill: this.getAttr("fill")
}), t.key && (i.node.id = t.key + "i");
var r = this.getAttr("font"), o = this.getAttr("font-family"), s = this.getAttr("font-weight");
r && i.attr({
font: r
}), o && i.attr({
"font-family": o
}), s && i.attr({
"font-weight": s
}), t.link && i.attr("href", t.link), t.target && i.attr("target", t.target), this.group.push(i),
i.insertBefore(this.text), this.initialize();
}
function d(e, t) {
t = t || {}, a.call(this, e, t), this.textMargin = this.getAttr("text-margin"),
this.text.attr({
x: 3 * this.textMargin
});
var i = this.text.getBBox().width + 4 * this.textMargin, r = this.text.getBBox().height + 2 * this.textMargin, o = this.textMargin, s = r / 2, l = {
x: o,
y: s
}, c = [ {
x: o - this.textMargin,
y: r
}, {
x: o - this.textMargin + i,
y: r
}, {
x: o - this.textMargin + i + 2 * this.textMargin,
y: 0
}, {
x: o - this.textMargin + 2 * this.textMargin,
y: 0
}, {
x: o,
y: s
} ], u = n(e, l, c);
u.attr({
stroke: this.getAttr("element-color"),
"stroke-width": this.getAttr("line-width"),
fill: this.getAttr("fill")
}), t.link && u.attr("href", t.link), t.target && u.attr("target", t.target), t.key && (u.node.id = t.key),
u.node.setAttribute("class", this.getAttr("class")), this.text.attr({
y: u.getBBox().height / 2
}), this.group.push(u), u.insertBefore(this.text), this.initialize();
}
function p(e, t) {
t = t || {}, a.call(this, e, t), this.textMargin = this.getAttr("text-margin"),
this.yes_direction = "bottom", this.no_direction = "right", t.yes && t.direction_yes && t.no && !t.direction_no ? "right" === t.direction_yes ? (this.no_direction = "bottom",
this.yes_direction = "right") : (this.no_direction = "right", this.yes_direction = "bottom") : t.yes && !t.direction_yes && t.no && t.direction_no ? "right" === t.direction_no ? (this.yes_direction = "bottom",
this.no_direction = "right") : (this.yes_direction = "right", this.no_direction = "bottom") : (this.yes_direction = "bottom",
this.no_direction = "right"), this.yes_direction = this.yes_direction || "bottom",
this.no_direction = this.no_direction || "right", this.text.attr({
x: 2 * this.textMargin
});
var i = this.text.getBBox().width + 3 * this.textMargin;
i += i / 2;
var r = this.text.getBBox().height + 2 * this.textMargin;
r += r / 2, r = Math.max(.5 * i, r);
var o = i / 4, s = r / 4;
this.text.attr({
x: o + this.textMargin / 2
});
var l = {
x: o,
y: s
}, c = [ {
x: o - i / 4,
y: s + r / 4
}, {
x: o - i / 4 + i / 2,
y: s + r / 4 + r / 2
}, {
x: o - i / 4 + i,
y: s + r / 4
}, {
x: o - i / 4 + i / 2,
y: s + r / 4 - r / 2
}, {
x: o - i / 4,
y: s + r / 4
} ], u = n(e, l, c);
u.attr({
stroke: this.getAttr("element-color"),
"stroke-width": this.getAttr("line-width"),
fill: this.getAttr("fill")
}), t.link && u.attr("href", t.link), t.target && u.attr("target", t.target), t.key && (u.node.id = t.key),
u.node.setAttribute("class", this.getAttr("class")), this.text.attr({
y: u.getBBox().height / 2
}), this.group.push(u), u.insertBefore(this.text), this.initialize();
}
function h(e) {
function t(e) {
var t = e.indexOf("(") + 1, i = e.indexOf(")");
return t >= 0 && i >= 0 ? n.symbols[e.substring(0, t - 1)] : n.symbols[e];
}
e = e || "", e = e.trim();
for (var n = {
symbols: {},
start: null,
drawSVG: function(e, t) {
function n(e) {
if (a[e.key]) return a[e.key];
switch (e.symbolType) {
case "start":
a[e.key] = new s(r, e);
break;
case "end":
a[e.key] = new l(r, e);
break;
case "operation":
a[e.key] = new c(r, e);
break;
case "inputoutput":
a[e.key] = new d(r, e);
break;
case "subroutine":
a[e.key] = new u(r, e);
break;
case "condition":
a[e.key] = new p(r, e);
break;
default:
return new Error("Wrong symbol type!");
}
return a[e.key];
}
var i = this;
this.diagram && this.diagram.clean();
var r = new o(e, t);
this.diagram = r;
var a = {};
!function h(e, t, o) {
var a = n(e);
return i.start === e ? r.startWith(a) : t && o && !t.pathOk && (t instanceof p ? (o.yes === e && t.yes(a),
o.no === e && t.no(a)) : t.then(a)), a.pathOk ? a : (a instanceof p ? (e.yes && h(e.yes, a, e),
e.no && h(e.no, a, e)) : e.next && h(e.next, a, e), a);
}(this.start), r.render();
},
clean: function() {
this.diagram.clean();
}
}, i = [], r = 0, a = 1, h = e.length; h > a; a++) if ("\n" === e[a] && "\\" !== e[a - 1]) {
var f = e.substring(r, a);
r = a + 1, i.push(f.replace(/\\\n/g, "\n"));
}
r < e.length && i.push(e.substr(r));
for (var m = 1, g = i.length; g > m; ) {
var v = i[m];
v.indexOf(": ") < 0 && v.indexOf("(") < 0 && v.indexOf(")") < 0 && v.indexOf("->") < 0 && v.indexOf("=>") < 0 ? (i[m - 1] += "\n" + v,
i.splice(m, 1), g--) : m++;
}
for (;i.length > 0; ) {
var b = i.splice(0, 1)[0];
if (b.indexOf("=>") >= 0) {
var y, x = b.split("=>"), w = {
key: x[0],
symbolType: x[1],
text: null,
link: null,
target: null,
flowstate: null
};
if (w.symbolType.indexOf(": ") >= 0 && (y = w.symbolType.split(": "), w.symbolType = y[0],
w.text = y[1]), w.text && w.text.indexOf(":>") >= 0 ? (y = w.text.split(":>"), w.text = y[0],
w.link = y[1]) : w.symbolType.indexOf(":>") >= 0 && (y = w.symbolType.split(":>"),
w.symbolType = y[0], w.link = y[1]), w.symbolType.indexOf("\n") >= 0 && (w.symbolType = w.symbolType.split("\n")[0]),
w.link) {
var S = w.link.indexOf("[") + 1, C = w.link.indexOf("]");
S >= 0 && C >= 0 && (w.target = w.link.substring(S, C), w.link = w.link.substring(0, S - 1));
}
if (w.text && w.text.indexOf("|") >= 0) {
var _ = w.text.split("|");
w.text = _[0], w.flowstate = _[1].trim();
}
n.symbols[w.key] = w;
} else if (b.indexOf("->") >= 0) for (var k = b.split("->"), E = 0, T = k.length; T > E; E++) {
var I = k[E], D = t(I), N = function(e) {
var t = "next", n = e.indexOf("(") + 1, i = e.indexOf(")");
return n >= 0 && i >= 0 && (t = I.substring(n, i), t.indexOf(",") < 0 && "yes" !== t && "no" !== t && (t = "next, " + t)),
t;
}(I), M = null;
if (N.indexOf(",") >= 0) {
var L = N.split(",");
N = L[0], M = L[1].trim();
}
if (n.start || (n.start = D), T > E + 1) {
var A = k[E + 1];
D[N] = t(A), D["direction_" + N] = M, M = null;
}
}
}
return n;
}
Array.prototype.indexOf || (Array.prototype.indexOf = function(e) {
"use strict";
if (null === this) throw new TypeError();
var t = Object(this), n = t.length >>> 0;
if (0 === n) return -1;
var i = 0;
if (arguments.length > 0 && (i = Number(arguments[1]), i != i ? i = 0 : 0 !== i && 1 / 0 != i && i != -1 / 0 && (i = (i > 0 || -1) * Math.floor(Math.abs(i)))),
i >= n) return -1;
for (var r = i >= 0 ? i : Math.max(n - Math.abs(i), 0); n > r; r++) if (r in t && t[r] === e) return r;
return -1;
}), Array.prototype.lastIndexOf || (Array.prototype.lastIndexOf = function(e) {
"use strict";
if (null === this) throw new TypeError();
var t = Object(this), n = t.length >>> 0;
if (0 === n) return -1;
var i = n;
arguments.length > 1 && (i = Number(arguments[1]), i != i ? i = 0 : 0 !== i && i != 1 / 0 && i != -1 / 0 && (i = (i > 0 || -1) * Math.floor(Math.abs(i))));
for (var r = i >= 0 ? Math.min(i, n - 1) : n - Math.abs(i); r >= 0; r--) if (r in t && t[r] === e) return r;
return -1;
}), String.prototype.trim || (String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
});
var f = {}, m = {
x: 0,
y: 0,
"line-width": 3,
"line-length": 50,
"text-margin": 10,
"font-size": 14,
"font-color": "black",
"line-color": "black",
"element-color": "black",
fill: "white",
"yes-text": "yes",
"no-text": "no",
"arrow-end": "block",
"class": "flowchart",
symbols: {
start: {},
end: {},
condition: {},
inputoutput: {},
operation: {},
subroutine: {}
}
}, g = {
defaults: e,
inherits: t
};
return o.prototype.handle = function(e) {
this.symbols.indexOf(e) <= -1 && this.symbols.push(e);
var t = this;
return e instanceof p ? (e.yes = function(n) {
return e.yes_symbol = n, e.no_symbol && (e.pathOk = !0), t.handle(n);
}, e.no = function(n) {
return e.no_symbol = n, e.yes_symbol && (e.pathOk = !0), t.handle(n);
}) : e.then = function(n) {
return e.next = n, e.pathOk = !0, t.handle(n);
}, e;
}, o.prototype.startWith = function(e) {
return this.start = e, this.handle(e);
}, o.prototype.render = function() {
var e, t = 0, n = 0, i = 0, r = 0, o = 0, a = 0;
for (i = 0, r = this.symbols.length; r > i; i++) e = this.symbols[i], e.width > t && (t = e.width),
e.height > n && (n = e.height);
for (i = 0, r = this.symbols.length; r > i; i++) e = this.symbols[i], e.shiftX(this.options.x + (t - e.width) / 2 + this.options["line-width"]),
e.shiftY(this.options.y + (n - e.height) / 2 + this.options["line-width"]);
for (this.start.render(), i = 0, r = this.symbols.length; r > i; i++) e = this.symbols[i],
e.renderLines();
for (o = this.maxXFromLine, i = 0, r = this.symbols.length; r > i; i++) {
e = this.symbols[i];
var s = e.getX() + e.width, l = e.getY() + e.height;
s > o && (o = s), l > a && (a = l);
}
this.paper.setSize(o + this.options["line-width"], a + this.options["line-width"]);
}, o.prototype.clean = function() {
if (this.paper) {
var e = this.paper.canvas;
e.parentNode.removeChild(e);
}
}, a.prototype.getAttr = function(e) {
if (this.chart) {
var t, n = this.chart.options ? this.chart.options[e] : void 0, i = this.chart.options.symbols ? this.chart.options.symbols[this.symbolType][e] : void 0;
return this.chart.options.flowstate && this.chart.options.flowstate[this.flowstate] && (t = this.chart.options.flowstate[this.flowstate][e]),
t || i || n;
}
}, a.prototype.initialize = function() {
this.group.transform("t" + this.getAttr("line-width") + "," + this.getAttr("line-width")),
this.width = this.group.getBBox().width, this.height = this.group.getBBox().height;
}, a.prototype.getCenter = function() {
return {
x: this.getX() + this.width / 2,
y: this.getY() + this.height / 2
};
}, a.prototype.getX = function() {
return this.group.getBBox().x;
}, a.prototype.getY = function() {
return this.group.getBBox().y;
}, a.prototype.shiftX = function(e) {
this.group.transform("t" + (this.getX() + e) + "," + this.getY());
}, a.prototype.setX = function(e) {
this.group.transform("t" + e + "," + this.getY());
}, a.prototype.shiftY = function(e) {
this.group.transform("t" + this.getX() + "," + (this.getY() + e));
}, a.prototype.setY = function(e) {
this.group.transform("t" + this.getX() + "," + e);
}, a.prototype.getTop = function() {
var e = this.getY();
return {
x: this.getX() + this.width / 2,
y: e
};
}, a.prototype.getBottom = function() {
var e = this.getY() + this.height;
return {
x: this.getX() + this.width / 2,
y: e
};
}, a.prototype.getLeft = function() {
var e = this.getY() + this.group.getBBox().height / 2;
return {
x: this.getX(),
y: e
};
}, a.prototype.getRight = function() {
var e = this.getY() + this.group.getBBox().height / 2;
return {
x: this.getX() + this.group.getBBox().width,
y: e
};
}, a.prototype.render = function() {
if (this.next) {
var e = this.getAttr("line-length");
if ("right" === this.next_direction) {
var t = this.getRight();
if (this.next.getLeft(), !this.next.isPositioned) {
this.next.setY(t.y - this.next.height / 2), this.next.shiftX(this.group.getBBox().x + this.width + e);
var n = this;
!function r() {
for (var t, i = !1, o = 0, a = n.chart.symbols.length; a > o; o++) {
t = n.chart.symbols[o];
var s = Math.abs(t.getCenter().x - n.next.getCenter().x);
if (t.getCenter().y > n.next.getCenter().y && s <= n.next.width / 2) {
i = !0;
break;
}
}
i && (n.next.setX(t.getX() + t.width + e), r());
}(), this.next.isPositioned = !0, this.next.render();
}
} else {
var i = this.getBottom();
this.next.getTop(), this.next.isPositioned || (this.next.shiftY(this.getY() + this.height + e),
this.next.setX(i.x - this.next.width / 2), this.next.isPositioned = !0, this.next.render());
}
}
}, a.prototype.renderLines = function() {
this.next && (this.next_direction ? this.drawLineTo(this.next, "", this.next_direction) : this.drawLineTo(this.next));
}, a.prototype.drawLineTo = function(e, t, n) {
this.connectedTo.indexOf(e) < 0 && this.connectedTo.push(e);
var o, a = this.getCenter().x, s = this.getCenter().y, l = (this.getTop(), this.getRight()), c = this.getBottom(), u = this.getLeft(), d = e.getCenter().x, p = e.getCenter().y, h = e.getTop(), f = e.getRight(), m = (e.getBottom(),
e.getLeft()), g = a === d, v = s === p, b = p > s, y = s > p, x = a > d, w = d > a, S = 0, C = this.getAttr("line-length"), _ = this.getAttr("line-width");
if (n && "bottom" !== n || !g || !b) if (n && "right" !== n || !v || !w) if (n && "left" !== n || !v || !x) if (n && "right" !== n || !g || !y) if (n && "right" !== n || !g || !b) if (n && "bottom" !== n || !x) if (n && "bottom" !== n || !w) if (n && "right" === n && x) o = i(this.chart, l, [ {
x: l.x + C / 2,
y: l.y
}, {
x: l.x + C / 2,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t), this.rightStart = !0, e.topEnd = !0, S = l.x + C / 2; else if (n && "right" === n && w) o = i(this.chart, l, [ {
x: h.x,
y: l.y
}, {
x: h.x,
y: h.y
} ], t), this.rightStart = !0, e.topEnd = !0, S = l.x + C / 2; else if (n && "bottom" === n && g && y) o = i(this.chart, c, [ {
x: c.x,
y: c.y + C / 2
}, {
x: l.x + C / 2,
y: c.y + C / 2
}, {
x: l.x + C / 2,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t), this.bottomStart = !0, e.topEnd = !0, S = c.x + C / 2; else if ("left" === n && g && y) {
var k = u.x - C / 2;
m.x < u.x && (k = m.x - C / 2), o = i(this.chart, u, [ {
x: k,
y: u.y
}, {
x: k,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t), this.leftStart = !0, e.topEnd = !0, S = u.x;
} else "left" === n && (o = i(this.chart, u, [ {
x: h.x + (u.x - h.x) / 2,
y: u.y
}, {
x: h.x + (u.x - h.x) / 2,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t), this.leftStart = !0, e.topEnd = !0, S = u.x); else o = i(this.chart, c, [ {
x: c.x,
y: c.y + C / 2
}, {
x: c.x + (c.x - h.x) / 2,
y: c.y + C / 2
}, {
x: c.x + (c.x - h.x) / 2,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t), this.bottomStart = !0, e.topEnd = !0, S = c.x + (c.x - h.x) / 2; else o = this.leftEnd && y ? i(this.chart, c, [ {
x: c.x,
y: c.y + C / 2
}, {
x: c.x + (c.x - h.x) / 2,
y: c.y + C / 2
}, {
x: c.x + (c.x - h.x) / 2,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t) : i(this.chart, c, [ {
x: c.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t), this.bottomStart = !0, e.topEnd = !0, S = c.x + (c.x - h.x) / 2; else o = i(this.chart, l, [ {
x: l.x + C / 2,
y: l.y
}, {
x: l.x + C / 2,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t), this.rightStart = !0, e.topEnd = !0, S = l.x + C / 2; else o = i(this.chart, l, [ {
x: l.x + C / 2,
y: l.y
}, {
x: l.x + C / 2,
y: h.y - C / 2
}, {
x: h.x,
y: h.y - C / 2
}, {
x: h.x,
y: h.y
} ], t), this.rightStart = !0, e.topEnd = !0, S = l.x + C / 2; else o = i(this.chart, u, f, t),
this.leftStart = !0, e.rightEnd = !0, S = f.x; else o = i(this.chart, l, m, t),
this.rightStart = !0, e.leftEnd = !0, S = m.x; else o = i(this.chart, c, h, t),
this.bottomStart = !0, e.topEnd = !0, S = c.x;
if (o) {
for (var E = 0, T = this.chart.lines.length; T > E; E++) for (var I, D = this.chart.lines[E], N = D.attr("path"), M = o.attr("path"), L = 0, A = N.length - 1; A > L; L++) {
var R = [];
R.push([ "M", N[L][1], N[L][2] ]), R.push([ "L", N[L + 1][1], N[L + 1][2] ]);
for (var P = R[0][1], O = R[0][2], F = R[1][1], B = R[1][2], j = 0, $ = M.length - 1; $ > j; j++) {
var G = [];
G.push([ "M", M[j][1], M[j][2] ]), G.push([ "L", M[j + 1][1], M[j + 1][2] ]);
var q = G[0][1], H = G[0][2], U = G[1][1], z = G[1][2], V = r(P, O, F, B, q, H, U, z);
if (V.onLine1 && V.onLine2) {
var W;
H === z ? q > U ? (W = [ "L", V.x + 2 * _, H ], M.splice(j + 1, 0, W), W = [ "C", V.x + 2 * _, H, V.x, H - 4 * _, V.x - 2 * _, H ],
M.splice(j + 2, 0, W), o.attr("path", M)) : (W = [ "L", V.x - 2 * _, H ], M.splice(j + 1, 0, W),
W = [ "C", V.x - 2 * _, H, V.x, H - 4 * _, V.x + 2 * _, H ], M.splice(j + 2, 0, W),
o.attr("path", M)) : H > z ? (W = [ "L", q, V.y + 2 * _ ], M.splice(j + 1, 0, W),
W = [ "C", q, V.y + 2 * _, q + 4 * _, V.y, q, V.y - 2 * _ ], M.splice(j + 2, 0, W),
o.attr("path", M)) : (W = [ "L", q, V.y - 2 * _ ], M.splice(j + 1, 0, W), W = [ "C", q, V.y - 2 * _, q + 4 * _, V.y, q, V.y + 2 * _ ],
M.splice(j + 2, 0, W), o.attr("path", M)), j += 2, I += 2;
}
}
}
this.chart.lines.push(o);
}
(!this.chart.maxXFromLine || this.chart.maxXFromLine && S > this.chart.maxXFromLine) && (this.chart.maxXFromLine = S);
}, g.inherits(s, a), g.inherits(l, a), g.inherits(c, a), g.inherits(u, a), g.inherits(d, a),
d.prototype.getLeft = function() {
var e = this.getY() + this.group.getBBox().height / 2;
return {
x: this.getX() + this.textMargin,
y: e
};
}, d.prototype.getRight = function() {
var e = this.getY() + this.group.getBBox().height / 2;
return {
x: this.getX() + this.group.getBBox().width - this.textMargin,
y: e
};
}, g.inherits(p, a), p.prototype.render = function() {
this.yes_direction && (this[this.yes_direction + "_symbol"] = this.yes_symbol),
this.no_direction && (this[this.no_direction + "_symbol"] = this.no_symbol);
var e = this.getAttr("line-length");
if (this.bottom_symbol) {
var t = this.getBottom();
this.bottom_symbol.getTop(), this.bottom_symbol.isPositioned || (this.bottom_symbol.shiftY(this.getY() + this.height + e),
this.bottom_symbol.setX(t.x - this.bottom_symbol.width / 2), this.bottom_symbol.isPositioned = !0,
this.bottom_symbol.render());
}
if (this.right_symbol) {
var n = this.getRight();
if (this.right_symbol.getLeft(), !this.right_symbol.isPositioned) {
this.right_symbol.setY(n.y - this.right_symbol.height / 2), this.right_symbol.shiftX(this.group.getBBox().x + this.width + e);
var i = this;
!function r() {
for (var t, n = !1, o = 0, a = i.chart.symbols.length; a > o; o++) {
t = i.chart.symbols[o];
var s = Math.abs(t.getCenter().x - i.right_symbol.getCenter().x);
if (t.getCenter().y > i.right_symbol.getCenter().y && s <= i.right_symbol.width / 2) {
n = !0;
break;
}
}
n && (i.right_symbol.setX(t.getX() + t.width + e), r());
}(), this.right_symbol.isPositioned = !0, this.right_symbol.render();
}
}
}, p.prototype.renderLines = function() {
this.yes_symbol && this.drawLineTo(this.yes_symbol, this.getAttr("yes-text"), this.yes_direction),
this.no_symbol && this.drawLineTo(this.no_symbol, this.getAttr("no-text"), this.no_direction);
}, f.parse = h, f;
}), define("extensions/umlDiagrams", [ "jquery", "underscore", "utils", "logger", "classes/Extension", "text!html/umlDiagramsSettingsBlock.html", "crel", "Diagram", "flow-chart" ], function(e, t, n, i, r, o, a, s, l) {
var c = new r("umlDiagrams", "UML Diagrams", !0);
return c.settingsBlock = o, c.defaultConfig = {
flowchartOptions: [ "{", ' "line-width": 2,', ' "font-family": "sans-serif",', ' "font-weight": "normal"', "}" ].join("\n")
}, c.onLoadSettings = function() {
n.setInputValue("#textarea-umldiagram-flowchart-options", c.config.flowchartOptions);
}, c.onSaveSettings = function(e, t) {
e.flowchartOptions = n.getInputJSONValue("#textarea-umldiagram-flowchart-options", t);
}, c.onPagedownConfigure = function(e) {
var n = document.getElementById("preview-contents");
e.hooks.chain("onPreviewRefresh", function() {
t.each(n.querySelectorAll(".prettyprint > .language-sequence"), function(e) {
try {
var t = s.parse(e.textContent), n = e.parentNode, i = a("div", {
"class": "sequence-diagram"
});
n.parentNode.replaceChild(i, n), t.drawSVG(i, {
theme: "simple"
});
} catch (e) {}
}), t.each(n.querySelectorAll(".prettyprint > .language-flow"), function(e) {
try {
var t = l.parse(e.textContent), n = e.parentNode, i = a("div", {
"class": "flow-chart"
});
n.parentNode.replaceChild(i, n), t.drawSVG(i, JSON.parse(c.config.flowchartOptions));
} catch (e) {}
});
});
}, c;
}), define("text!html/buttonToc.html", [], function() {
return '\n \n \n\n';
}), define("text!html/tocSettingsBlock.html", [], function() {
return 'Generates a table of contents when a [TOC] marker is found.
\n';
}), define("extensions/toc", [ "jquery", "underscore", "utils", "classes/Extension", "text!html/buttonToc.html", "text!html/tocSettingsBlock.html" ], function(e, t, n, i, r, o) {
function a(e, t, n) {
this.tagName = e, this.anchor = t, this.text = n, this.children = [];
}
function s(e, n) {
function i() {
void 0 !== r && (r.children.length > 0 && (r.children = s(r.children, n + 1)), l.push(r));
}
n = n || 1;
var r, o = "H" + n, l = [];
return t.each(e, function(e) {
e.tagName != o ? n !== c.config.maxDepth && (void 0 === r && (r = new a()), r.children.push(e)) : (i(),
r = e);
}), i(), l;
}
function l() {
function e(e) {
for (var r = e.id || n.slugify(e.textContent) || "title", o = r, a = 0; t.has(i, o); ) o = r + "-" + ++a;
return i[o] = !0, e.id = o, o;
}
var i = {}, r = [];
return t.each(u.querySelectorAll("h1, h2, h3, h4, h5, h6"), function(t) {
r.push(new a(t.tagName, e(t), t.textContent));
}), r = s(r), '\n";
}
var c = new i("toc", "Table of Contents", !0);
c.settingsBlock = o, c.defaultConfig = {
marker: "\\[(TOC|toc)\\]",
maxDepth: 6,
button: !0
}, c.onLoadSettings = function() {
n.setInputValue("#input-toc-marker", c.config.marker), n.setInputValue("#input-toc-maxdepth", c.config.maxDepth),
n.setInputChecked("#input-toc-button", c.config.button);
}, c.onSaveSettings = function(e, t) {
e.marker = n.getInputRegExpValue("#input-toc-marker", t), e.maxDepth = n.getInputIntValue("#input-toc-maxdepth"),
e.button = n.getInputChecked("#input-toc-button");
}, c.onCreatePreviewButton = function() {
return c.config.button ? r : void 0;
}, a.prototype.childrenToString = function() {
if (0 === this.children.length) return "";
var e = "\n";
return t.each(this.children, function(t) {
e += t.toString();
}), e += " \n";
}, a.prototype.toString = function() {
var e = "";
return this.anchor && this.text && (e += '' + this.text + " "),
e += this.childrenToString() + " \n";
};
var u;
return c.onPagedownConfigure = function(e) {
u = document.getElementById("preview-contents");
var n = new RegExp("^\\s*" + c.config.marker + "\\s*$");
e.hooks.chain("onPreviewRefresh", function() {
var e = document.querySelectorAll(".table-of-contents, .toc"), i = l();
t.each(u.getElementsByTagName("p"), function(e) {
n.test(e.innerHTML) && (e.innerHTML = i);
}), t.each(e, function(e) {
e.innerHTML = i;
});
});
}, c.onReady = function() {
var t = !0;
e(".preview-panel").on("hide.layout.toggle", function() {
t = !1;
}).on("shown.layout.toggle", function() {
t = !0;
}), e(".extension-preview-buttons .table-of-contents").on("click", "a", function(e) {
!t && e.preventDefault();
});
}, c;
}), define("extensions/emailConverter", [ "classes/Extension" ], function(e) {
var t = new e("emailConverter", "Markdown Email", !0);
return t.settingsBlock = "Converts email addresses in the form <email@example.com> into clickable links.
",
t.onPagedownConfigure = function(e) {
e.getConverter().hooks.chain("postConversion", function(e) {
return e.replace(/<(mailto\:)?([^\s>]+@[^\s>]+\.\S+?)>/g, function(e, t, n) {
return '' + n + " ";
});
});
}, t;
}), define("text!html/scrollSyncSettingsBlock.html", [], function() {
return "Binds together editor and preview scrollbars.
\n\n Note: The mapping between Markdown and HTML is based on the\n position of the title elements (h1, h2...) in the page. Therefore if\n your document does not contain any title, the mapping will be linear and\n consequently less accurate.
\n ";
}), define("extensions/scrollSync", [ "jquery", "underscore", "classes/Extension", "text!html/scrollSyncSettingsBlock.html" ], function(e, t, n, i) {
function r(e, n, i) {
var r, o = t.find(n, function(t, n) {
return r = n, e < t.endOffset;
});
if (void 0 !== o) {
var a = (e - o.startOffset) / (o.height || 1), s = i[r];
return s.startOffset + s.height * a;
}
}
function o(e, t, n, i, r) {
function o() {
var l = Date.now(), c = (l - s) / 200;
if (1 > c) {
var u = t + a * Math.cos((1 - c) * Math.PI / 2);
e.scrollTop = u, i(u), p = setTimeout(o, 1);
} else h = void 0, e.scrollTop = n, setTimeout(r, 100);
}
h && (clearTimeout(p), h()), h = r;
var a = n - t, s = Date.now();
o();
}
var a = new n("scrollSync", "Scroll Sync", !0, !0);
a.settingsBlock = i;
var s;
a.onSectionsCreated = function(e) {
s = e;
};
var l, c, u, d, p, h, f = [], m = [], g = t.debounce(function() {
f = [];
var e, n;
t.each(l.querySelectorAll(".wmd-input-section"), function(t) {
if (void 0 === e) return void (e = 0);
t = t.firstChild;
var n = t.offsetTop;
f.push({
startOffset: e,
endOffset: n,
height: n - e
}), e = n;
}), n = l.scrollHeight, f.push({
startOffset: e,
endOffset: n,
height: n - e
}), m = [];
var i;
t.each(c.querySelectorAll(".wmd-preview-section"), function(e) {
if (void 0 === i) return void (i = 0);
var t = e.offsetTop;
m.push({
startOffset: i,
endOffset: t,
height: t - i
}), i = t;
}), n = c.scrollHeight, m.push({
startOffset: i,
endOffset: n,
height: n - i
}), u = -10, d = -10, S();
}, 500), v = !0, b = !1, y = !1, x = !1, w = !1, S = t.throttle(function() {
if (v && 0 !== f.length && f.length === m.length) {
var e = l.scrollTop;
0 > e && (e = 0);
var n, i = c.scrollTop;
if (!0 === b) {
if (Math.abs(e - u) <= 9) return;
if (b = !1, u = e, n = r(e, f, m), n = t.min([ n, c.scrollHeight - c.offsetHeight ]),
Math.abs(n - i) <= 9) return void (d = i);
o(c, i, n, function(e) {
w = !0, d = e;
}, function() {
w = !1;
});
} else if (!0 === y) {
if (Math.abs(i - d) <= 9) return;
if (y = !1, d = i, n = r(i, m, f), n = t.min([ n, l.scrollHeight - l.offsetHeight ]),
Math.abs(n - e) <= 9) return void (u = e);
o(l, e, n, function(e) {
x = !0, u = e;
}, function() {
x = !1;
});
}
}
}, 100);
a.onLayoutResize = function() {
b = !0, g();
}, a.onFileClosed = function() {
f = [];
};
var C = !1;
a.onReady = function() {
c = document.querySelector(".preview-container"), l = document.querySelector("#wmd-input"),
e(c).scroll(function() {
!1 === w && !1 === C && (y = !0, b = !1, S()), C = !1;
}), e(l).scroll(function() {
!1 === x && (b = !0, y = !1, S());
}), e(".preview-panel").on("hide.layout.toggle", function() {
v = !1;
}).on("shown.layout.toggle", function() {
v = !0;
}), e(".extension-preview-buttons .table-of-contents").on("click", "a", function(t) {
t.preventDefault();
var n = this.hash, i = e(n);
if (i.length) {
var o = i[0].getBoundingClientRect().top - c.getBoundingClientRect().top + c.scrollTop;
c.scrollTop = o;
var a = r(o, m, f);
l.scrollTop = a;
}
});
};
var _, k;
return a.onPagedownConfigure = function(e) {
_ = document.getElementById("preview-contents"), e.getConverter().hooks.chain("postConversion", function(e) {
return k = _.offsetHeight, _.style.height = k + "px", e;
});
}, a.onPreviewFinished = function() {
_.style.removeProperty("height");
var e = _.offsetHeight;
b = !0, k > e && (C = !0), g();
}, a;
}), define("text!html/buttonSyncSettingsBlock.html", [], function() {
return 'Adds a "Synchronize documents" button in the navigation bar.
\n';
}), define("extensions/buttonSync", [ "jquery", "underscore", "crel", "utils", "classes/Extension", "mousetrap", "text!html/buttonSyncSettingsBlock.html" ], function(e, t, n, i, r, o, a) {
var s = new r("buttonSync", 'Button "Synchronize"', !1, !0);
s.settingsBlock = a, s.defaultConfig = {
syncPeriod: 18e4,
syncShortcut: "mod+s"
}, s.onLoadSettings = function() {
i.setInputValue("#input-sync-period", s.config.syncPeriod), i.setInputValue("#input-sync-shortcut", s.config.syncShortcut);
}, s.onSaveSettings = function(e, t) {
e.syncPeriod = i.getInputIntValue("#input-sync-period", t, 0), e.syncShortcut = i.getInputTextValue("#input-sync-shortcut", t);
};
var l;
s.onSynchronizerCreated = function(e) {
l = e;
};
var c, u = !1, d = !1, p = function() {
void 0 !== c && (!0 === u || !1 === l.hasSync() || d ? c.addClass("disabled") : c.removeClass("disabled"));
}, h = 0;
return s.onPeriodicRun = function() {
!s.config.syncPeriod || h + s.config.syncPeriod > i.currentTime || l.sync() && (h = i.currentTime);
}, s.onCreateButton = function() {
var t = n("a", {
"class": "btn btn-success button-synchronize",
title: "Force synchronization Ctrl/Cmd+S"
}, n("i", {
"class": "icon-refresh"
}));
return c = e(t), c.click(function() {
c.hasClass("disabled") || l.sync() && (h = i.currentTime);
}), t;
}, s.onReady = p, s.onFileCreated = p, s.onFileDeleted = p, s.onSyncImportSuccess = p,
s.onSyncExportSuccess = p, s.onSyncRemoved = p, s.onSyncRunning = function(e) {
u = e, p();
}, s.onOfflineChanged = function(e) {
d = e, p();
}, s.onReady = function() {
o.bind(s.config.syncShortcut, function(e) {
l.sync() && (h = i.currentTime), e.preventDefault();
}), e(".action-force-synchronization").click(function() {
l.sync() && (h = i.currentTime);
});
}, s;
}), define("extensions/buttonPublish", [ "jquery", "underscore", "crel", "classes/Extension" ], function(e, t, n, i) {
function r() {
void 0 !== o && (!0 === c || !1 === u || !0 === d ? o.addClass("disabled") : o.removeClass("disabled"));
}
var o, a, s, l = new i("buttonPublish", 'Button "Publish"'), c = !1, u = !1, d = !1;
l.onPublisherCreated = function(e) {
s = e;
}, l.onCreateButton = function() {
var t = n("a", {
"class": "btn btn-success button-publish",
title: "Update document publication"
}, n("i", {
"class": "icon-upload"
}));
return o = e(t).click(function() {
o.hasClass("disabled") || s.publish();
}), t;
}, l.onPublishRunning = function(e) {
c = e, r();
}, l.onOfflineChanged = function(e) {
d = e, r();
};
var p = function() {
u = 0 !== t.size(a.publishLocations), r();
};
return l.onFileSelected = function(e) {
a = e, p();
}, l.onReady = function() {
e(".action-update-publication").click(s.publish);
}, l.onPublishRemoved = p, l.onNewPublishSuccess = p, l;
}), define("text!html/buttonStat.html", [], function() {
return '\n \n \n \n\n';
}), define("text!html/buttonStatSettingsBlock.html", [], function() {
return 'Adds a "Document statistics" button over the preview.
\n\n';
}), define("extensions/buttonStat", [ "jquery", "underscore", "utils", "classes/Extension", "text!html/buttonStat.html", "text!html/buttonStatSettingsBlock.html" ], function(e, t, n, i, r, o) {
var a = new i("buttonStat", 'Button "Statistics"', !0);
a.settingsBlock = o, a.defaultConfig = {
name1: "Characters",
value1: "\\S",
name2: "Words",
value2: "\\S+",
name3: "Paragraphs",
value3: "\\S.*"
};
var s;
a.onEventMgrCreated = function(e) {
s = e;
}, a.onLoadSettings = function() {
t.each([ 1, 2, 3 ], function(e) {
n.setInputValue("#input-stat-name" + e, a.config["name" + e]), n.setInputValue("#input-stat-value" + e, a.config["value" + e]);
});
}, a.onSaveSettings = function(e, i) {
t.each([ 1, 2, 3 ], function(t) {
e["name" + t] = n.getInputTextValue("#input-stat-name" + t, i), e["value" + t] = n.getInputRegExpValue("#input-stat-value" + t, i);
});
}, a.onCreatePreviewButton = function() {
return t.template(r, a.config);
};
var l, c, u, d, p;
a.onReady = function() {
l = document.getElementById("preview-contents"), c = document.querySelector(".stat-button .value"),
u = document.querySelector(".stat-button-dropdown .value1"), d = document.querySelector(".stat-button-dropdown .value2"),
p = document.querySelector(".stat-button-dropdown .value3");
};
var h, f, m;
return a.onInit = function() {
h = new RegExp(a.config.value1, "g"), f = new RegExp(a.config.value2, "g"), m = new RegExp(a.config.value3, "g");
}, a.onPreviewFinished = function() {
for (var e = l.cloneNode(!0), t = e.getElementsByTagName("script"), n = t.length - 1; n >= 0; n--) {
var i = t[n];
i.parentNode.removeChild(i);
}
var r = e.textContent;
c.textContent = u.textContent = (r.match(h) || []).length, d.textContent = (r.match(f) || []).length,
p.textContent = (r.match(m) || []).length, s.onExtensionButtonResize();
}, a;
}), define("text!html/buttonHtmlCode.html", [], function() {
return '\n \n \n\n';
}), define("text!html/buttonHtmlCodeSettingsBlock.html", [], function() {
return 'Adds a "HTML code" button over the preview.
\n';
}), define("extensions/buttonHtmlCode", [ "jquery", "underscore", "utils", "classes/Extension", "text!html/buttonHtmlCode.html", "text!html/buttonHtmlCodeSettingsBlock.html" ], function(e, t, n, i, r, o) {
var a = new i("buttonHtmlCode", 'Button "HTML code"', !0);
a.settingsBlock = o, a.defaultConfig = {
template: "<%= documentHTML %>"
}, a.onLoadSettings = function() {
n.setInputValue("#textarea-html-code-template", a.config.template);
}, a.onSaveSettings = function(e) {
e.template = n.getInputValue("#textarea-html-code-template");
};
var s;
a.onEventMgrCreated = function(e) {
s = e;
}, a.onCreatePreviewButton = function() {
return r;
};
var l;
a.onFileSelected = function(e) {
l = e;
};
var c, u;
return a.onPreviewFinished = function(e, t) {
c = e, u = t;
}, a.onReady = function() {
var n = document.getElementById("input-html-code");
e(".action-html-code").click(function() {
setTimeout(function() {
e("#input-html-code").each(function() {
e(this).is(":hidden") || this.select();
});
}, 10);
}).parent().on("show.bs.dropdown", function() {
try {
var e = t.template(a.config.template, {
documentTitle: l.title,
documentMarkdown: l.content,
strippedDocumentMarkdown: l.content.substring(l.frontMatter ? l.frontMatter._frontMatter.length : 0),
documentHTML: u,
documentHTMLWithFrontMatter: (l.frontMatter ? l.frontMatter._frontMatter : "") + u,
documentHTMLWithComments: c,
frontMatter: l.frontMatter,
publishAttributes: void 0
});
n.value = e;
} catch (e) {
s.onError(e);
}
});
}, a;
}), define("text!html/buttonViewer.html", [], function() {
return '\n \n \n';
}), define("extensions/buttonViewer", [ "jquery", "classes/Extension", "text!html/buttonViewer.html" ], function(e, t, n) {
var i = new t("buttonViewer", 'Button "Viewer"', !0, !0);
return i.settingsBlock = 'Adds a "Viewer" button over the preview.
', i.onCreatePreviewButton = function() {
return n;
}, i;
}), "undefined" == typeof jQuery) throw new Error("Bootstrap requires jQuery");
+function(e) {
"use strict";
function t() {
var e = document.createElement("bootstrap"), t = {
WebkitTransition: "webkitTransitionEnd",
MozTransition: "transitionend",
OTransition: "oTransitionEnd otransitionend",
transition: "transitionend"
};
for (var n in t) if (void 0 !== e.style[n]) return {
end: t[n]
};
}
e.fn.emulateTransitionEnd = function(t) {
var n = !1, i = this;
e(this).one(e.support.transition.end, function() {
n = !0;
});
var r = function() {
n || e(i).trigger(e.support.transition.end);
};
return setTimeout(r, t), this;
}, e(function() {
e.support.transition = t();
});
}(jQuery), function(e) {
"use strict";
var t = '[data-dismiss="alert"]', n = function(n) {
e(n).on("click", t, this.close);
};
n.prototype.close = function(t) {
function n() {
o.trigger("closed.bs.alert").remove();
}
var i = e(this), r = i.attr("data-target");
r || (r = i.attr("href"), r = r && r.replace(/.*(?=#[^\s]*$)/, ""));
var o = e(r);
t && t.preventDefault(), o.length || (o = i.hasClass("alert") ? i : i.parent()),
o.trigger(t = e.Event("close.bs.alert")), t.isDefaultPrevented() || (o.removeClass("in"),
e.support.transition && o.hasClass("fade") ? o.one(e.support.transition.end, n).emulateTransitionEnd(150) : n());
};
var i = e.fn.alert;
e.fn.alert = function(t) {
return this.each(function() {
var i = e(this), r = i.data("bs.alert");
r || i.data("bs.alert", r = new n(this)), "string" == typeof t && r[t].call(i);
});
}, e.fn.alert.Constructor = n, e.fn.alert.noConflict = function() {
return e.fn.alert = i, this;
}, e(document).on("click.bs.alert.data-api", t, n.prototype.close);
}(jQuery), function(e) {
"use strict";
var t = function(n, i) {
this.$element = e(n), this.options = e.extend({}, t.DEFAULTS, i);
};
t.DEFAULTS = {
loadingText: "loading..."
}, t.prototype.setState = function(e) {
var t = "disabled", n = this.$element, i = n.is("input") ? "val" : "html", r = n.data();
e += "Text", r.resetText || n.data("resetText", n[i]()), n[i](r[e] || this.options[e]),
setTimeout(function() {
"loadingText" == e ? n.addClass(t).attr(t, t) : n.removeClass(t).removeAttr(t);
}, 0);
}, t.prototype.toggle = function() {
var e = this.$element.closest('[data-toggle="buttons"]'), t = !0;
if (e.length) {
var n = this.$element.find("input");
"radio" === n.prop("type") && (n.prop("checked") && this.$element.hasClass("active") ? t = !1 : e.find(".active").removeClass("active")),
t && n.prop("checked", !this.$element.hasClass("active")).trigger("change");
}
t && this.$element.toggleClass("active");
};
var n = e.fn.button;
e.fn.button = function(n) {
return this.each(function() {
var i = e(this), r = i.data("bs.button"), o = "object" == typeof n && n;
r || i.data("bs.button", r = new t(this, o)), "toggle" == n ? r.toggle() : n && r.setState(n);
});
}, e.fn.button.Constructor = t, e.fn.button.noConflict = function() {
return e.fn.button = n, this;
}, e(document).on("click.bs.button.data-api", "[data-toggle^=button]", function(t) {
var n = e(t.target);
n.hasClass("btn") || (n = n.closest(".btn")), n.button("toggle"), t.preventDefault();
});
}(jQuery), function(e) {
"use strict";
var t = function(t, n) {
this.$element = e(t), this.$indicators = this.$element.find(".carousel-indicators"),
this.options = n, this.paused = this.sliding = this.interval = this.$active = this.$items = null,
"hover" == this.options.pause && this.$element.on("mouseenter", e.proxy(this.pause, this)).on("mouseleave", e.proxy(this.cycle, this));
};
t.DEFAULTS = {
interval: 5e3,
pause: "hover",
wrap: !0
}, t.prototype.cycle = function(t) {
return t || (this.paused = !1), this.interval && clearInterval(this.interval), this.options.interval && !this.paused && (this.interval = setInterval(e.proxy(this.next, this), this.options.interval)),
this;
}, t.prototype.getActiveIndex = function() {
return this.$active = this.$element.find(".item.active"), this.$items = this.$active.parent().children(),
this.$items.index(this.$active);
}, t.prototype.to = function(t) {
var n = this, i = this.getActiveIndex();
return t > this.$items.length - 1 || 0 > t ? void 0 : this.sliding ? this.$element.one("slid.bs.carousel", function() {
n.to(t);
}) : i == t ? this.pause().cycle() : this.slide(t > i ? "next" : "prev", e(this.$items[t]));
}, t.prototype.pause = function(t) {
return t || (this.paused = !0), this.$element.find(".next, .prev").length && e.support.transition.end && (this.$element.trigger(e.support.transition.end),
this.cycle(!0)), this.interval = clearInterval(this.interval), this;
}, t.prototype.next = function() {
return this.sliding ? void 0 : this.slide("next");
}, t.prototype.prev = function() {
return this.sliding ? void 0 : this.slide("prev");
}, t.prototype.slide = function(t, n) {
var i = this.$element.find(".item.active"), r = n || i[t](), o = this.interval, a = "next" == t ? "left" : "right", s = "next" == t ? "first" : "last", l = this;
if (!r.length) {
if (!this.options.wrap) return;
r = this.$element.find(".item")[s]();
}
this.sliding = !0, o && this.pause();
var c = e.Event("slide.bs.carousel", {
relatedTarget: r[0],
direction: a
});
if (!r.hasClass("active")) {
if (this.$indicators.length && (this.$indicators.find(".active").removeClass("active"),
this.$element.one("slid.bs.carousel", function() {
var t = e(l.$indicators.children()[l.getActiveIndex()]);
t && t.addClass("active");
})), e.support.transition && this.$element.hasClass("slide")) {
if (this.$element.trigger(c), c.isDefaultPrevented()) return;
r.addClass(t), r[0].offsetWidth, i.addClass(a), r.addClass(a), i.one(e.support.transition.end, function() {
r.removeClass([ t, a ].join(" ")).addClass("active"), i.removeClass([ "active", a ].join(" ")),
l.sliding = !1, setTimeout(function() {
l.$element.trigger("slid.bs.carousel");
}, 0);
}).emulateTransitionEnd(600);
} else {
if (this.$element.trigger(c), c.isDefaultPrevented()) return;
i.removeClass("active"), r.addClass("active"), this.sliding = !1, this.$element.trigger("slid.bs.carousel");
}
return o && this.cycle(), this;
}
};
var n = e.fn.carousel;
e.fn.carousel = function(n) {
return this.each(function() {
var i = e(this), r = i.data("bs.carousel"), o = e.extend({}, t.DEFAULTS, i.data(), "object" == typeof n && n), a = "string" == typeof n ? n : o.slide;
r || i.data("bs.carousel", r = new t(this, o)), "number" == typeof n ? r.to(n) : a ? r[a]() : o.interval && r.pause().cycle();
});
}, e.fn.carousel.Constructor = t, e.fn.carousel.noConflict = function() {
return e.fn.carousel = n, this;
}, e(document).on("click.bs.carousel.data-api", "[data-slide], [data-slide-to]", function(t) {
var n, i = e(this), r = e(i.attr("data-target") || (n = i.attr("href")) && n.replace(/.*(?=#[^\s]+$)/, "")), o = e.extend({}, r.data(), i.data()), a = i.attr("data-slide-to");
a && (o.interval = !1), r.carousel(o), (a = i.attr("data-slide-to")) && r.data("bs.carousel").to(a),
t.preventDefault();
}), e(window).on("load", function() {
e('[data-ride="carousel"]').each(function() {
var t = e(this);
t.carousel(t.data());
});
});
}(jQuery), function(e) {
"use strict";
var t = function(n, i) {
this.$element = e(n), this.options = e.extend({}, t.DEFAULTS, i), this.transitioning = null,
this.options.parent && (this.$parent = e(this.options.parent)), this.options.toggle && this.toggle();
};
t.DEFAULTS = {
toggle: !0
}, t.prototype.dimension = function() {
return this.$element.hasClass("width") ? "width" : "height";
}, t.prototype.show = function() {
if (!this.transitioning && !this.$element.hasClass("in")) {
var t = e.Event("show.bs.collapse");
if (this.$element.trigger(t), !t.isDefaultPrevented()) {
var n = this.$parent && this.$parent.find("> .panel > .in");
if (n && n.length) {
var i = n.data("bs.collapse");
if (i && i.transitioning) return;
n.collapse("hide"), i || n.data("bs.collapse", null);
}
var r = this.dimension();
this.$element.removeClass("collapse").addClass("collapsing")[r](0), this.transitioning = 1;
var o = function() {
this.$element.removeClass("collapsing").addClass("in")[r]("auto"), this.transitioning = 0,
this.$element.trigger("shown.bs.collapse");
};
if (!e.support.transition) return o.call(this);
var a = e.camelCase([ "scroll", r ].join("-"));
this.$element.one(e.support.transition.end, e.proxy(o, this)).emulateTransitionEnd(350)[r](this.$element[0][a]);
}
}
}, t.prototype.hide = function() {
if (!this.transitioning && this.$element.hasClass("in")) {
var t = e.Event("hide.bs.collapse");
if (this.$element.trigger(t), !t.isDefaultPrevented()) {
var n = this.dimension();
this.$element[n](this.$element[n]())[0].offsetHeight, this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),
this.transitioning = 1;
var i = function() {
this.transitioning = 0, this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse");
};
if (!e.support.transition) return i.call(this);
this.$element[n](0).one(e.support.transition.end, e.proxy(i, this)).emulateTransitionEnd(350);
}
}
}, t.prototype.toggle = function() {
this[this.$element.hasClass("in") ? "hide" : "show"]();
};
var n = e.fn.collapse;
e.fn.collapse = function(n) {
return this.each(function() {
var i = e(this), r = i.data("bs.collapse"), o = e.extend({}, t.DEFAULTS, i.data(), "object" == typeof n && n);
r || i.data("bs.collapse", r = new t(this, o)), "string" == typeof n && r[n]();
});
}, e.fn.collapse.Constructor = t, e.fn.collapse.noConflict = function() {
return e.fn.collapse = n, this;
}, e(document).on("click.bs.collapse.data-api", "[data-toggle=collapse]", function(t) {
var n, i = e(this), r = i.attr("data-target") || t.preventDefault() || (n = i.attr("href")) && n.replace(/.*(?=#[^\s]+$)/, ""), o = e(r), a = o.data("bs.collapse"), s = a ? "toggle" : i.data(), l = i.attr("data-parent"), c = l && e(l);
a && a.transitioning || (c && c.find('[data-toggle=collapse][data-parent="' + l + '"]').not(i).addClass("collapsed"),
i[o.hasClass("in") ? "addClass" : "removeClass"]("collapsed")), o.collapse(s);
});
}(jQuery), function(e) {
"use strict";
function t() {
e(i).remove(), e(r).each(function(t) {
var i = n(e(this));
i.hasClass("open") && (i.trigger(t = e.Event("hide.bs.dropdown")), t.isDefaultPrevented() || i.removeClass("open").trigger("hidden.bs.dropdown"));
});
}
function n(t) {
var n = t.attr("data-target");
n || (n = t.attr("href"), n = n && /#/.test(n) && n.replace(/.*(?=#[^\s]*$)/, ""));
var i = n && e(n);
return i && i.length ? i : t.parent();
}
var i = ".dropdown-backdrop", r = "[data-toggle=dropdown]", o = function(t) {
e(t).on("click.bs.dropdown", this.toggle);
};
o.prototype.toggle = function(i) {
var r = e(this);
if (!r.is(".disabled, :disabled")) {
var o = n(r), a = o.hasClass("open");
if (t(), !a) {
if ("ontouchstart" in document.documentElement && !o.closest(".navbar-nav").length && e('
').insertAfter(e(this)).on("click", t),
o.trigger(i = e.Event("show.bs.dropdown")), i.isDefaultPrevented()) return;
o.toggleClass("open").trigger("shown.bs.dropdown"), r.focus();
}
return !1;
}
}, o.prototype.keydown = function(t) {
if (/(38|40|27)/.test(t.keyCode)) {
var i = e(this);
if (t.preventDefault(), t.stopPropagation(), !i.is(".disabled, :disabled")) {
var o = n(i), a = o.hasClass("open");
if (!a || a && 27 == t.keyCode) return 27 == t.which && o.find(r).focus(), i.click();
var s = e("[role=menu] li:not(.divider):visible a", o);
if (s.length) {
var l = s.index(s.filter(":focus"));
38 == t.keyCode && l > 0 && l--, 40 == t.keyCode && l < s.length - 1 && l++, ~l || (l = 0),
s.eq(l).focus();
}
}
}
};
var a = e.fn.dropdown;
e.fn.dropdown = function(t) {
return this.each(function() {
var n = e(this), i = n.data("bs.dropdown");
i || n.data("bs.dropdown", i = new o(this)), "string" == typeof t && i[t].call(n);
});
}, e.fn.dropdown.Constructor = o, e.fn.dropdown.noConflict = function() {
return e.fn.dropdown = a, this;
}, e(document).on("click.bs.dropdown.data-api", t).on("click.bs.dropdown.data-api", ".dropdown form", function(e) {
e.stopPropagation();
}).on("click.bs.dropdown.data-api", r, o.prototype.toggle).on("keydown.bs.dropdown.data-api", r + ", [role=menu]", o.prototype.keydown);
}(jQuery), function(e) {
"use strict";
var t = function(t, n) {
this.options = n, this.$element = e(t), this.$backdrop = this.isShown = null, this.options.remote && this.$element.load(this.options.remote);
};
t.DEFAULTS = {
backdrop: !0,
keyboard: !0,
show: !0
}, t.prototype.toggle = function(e) {
return this[this.isShown ? "hide" : "show"](e);
}, t.prototype.show = function(t) {
var n = this, i = e.Event("show.bs.modal", {
relatedTarget: t
});
this.$element.trigger(i), this.isShown || i.isDefaultPrevented() || (this.isShown = !0,
this.escape(), this.$element.on("click.dismiss.modal", '[data-dismiss="modal"]', e.proxy(this.hide, this)),
this.backdrop(function() {
var i = e.support.transition && n.$element.hasClass("fade");
n.$element.parent().length || n.$element.appendTo(document.body), n.$element.show(),
i && n.$element[0].offsetWidth, n.$element.addClass("in").attr("aria-hidden", !1),
n.enforceFocus();
var r = e.Event("shown.bs.modal", {
relatedTarget: t
});
i ? n.$element.find(".modal-dialog").one(e.support.transition.end, function() {
n.$element.focus().trigger(r);
}).emulateTransitionEnd(300) : n.$element.focus().trigger(r);
}));
}, t.prototype.hide = function(t) {
t && t.preventDefault(), t = e.Event("hide.bs.modal"), this.$element.trigger(t),
this.isShown && !t.isDefaultPrevented() && (this.isShown = !1, this.escape(), e(document).off("focusin.bs.modal"),
this.$element.removeClass("in").attr("aria-hidden", !0).off("click.dismiss.modal"),
e.support.transition && this.$element.hasClass("fade") ? this.$element.one(e.support.transition.end, e.proxy(this.hideModal, this)).emulateTransitionEnd(300) : this.hideModal());
}, t.prototype.enforceFocus = function() {
e(document).off("focusin.bs.modal").on("focusin.bs.modal", e.proxy(function(e) {
this.$element[0] === e.target || this.$element.has(e.target).length || this.$element.focus();
}, this));
}, t.prototype.escape = function() {
this.isShown && this.options.keyboard ? this.$element.on("keyup.dismiss.bs.modal", e.proxy(function(e) {
27 == e.which && this.hide();
}, this)) : this.isShown || this.$element.off("keyup.dismiss.bs.modal");
}, t.prototype.hideModal = function() {
var e = this;
this.$element.hide(), this.backdrop(function() {
e.removeBackdrop(), e.$element.trigger("hidden.bs.modal");
});
}, t.prototype.removeBackdrop = function() {
this.$backdrop && this.$backdrop.remove(), this.$backdrop = null;
}, t.prototype.backdrop = function(t) {
var n = this.$element.hasClass("fade") ? "fade" : "";
if (this.isShown && this.options.backdrop) {
var i = e.support.transition && n;
if (this.$backdrop = e('
').appendTo(document.body),
this.$element.on("click.dismiss.modal", e.proxy(function(e) {
e.target === e.currentTarget && ("static" == this.options.backdrop ? this.$element[0].focus.call(this.$element[0]) : this.hide.call(this));
}, this)), i && this.$backdrop[0].offsetWidth, this.$backdrop.addClass("in"), !t) return;
i ? this.$backdrop.one(e.support.transition.end, t).emulateTransitionEnd(150) : t();
} else !this.isShown && this.$backdrop ? (this.$backdrop.removeClass("in"), e.support.transition && this.$element.hasClass("fade") ? this.$backdrop.one(e.support.transition.end, t).emulateTransitionEnd(150) : t()) : t && t();
};
var n = e.fn.modal;
e.fn.modal = function(n, i) {
return this.each(function() {
var r = e(this), o = r.data("bs.modal"), a = e.extend({}, t.DEFAULTS, r.data(), "object" == typeof n && n);
o || r.data("bs.modal", o = new t(this, a)), "string" == typeof n ? o[n](i) : a.show && o.show(i);
});
}, e.fn.modal.Constructor = t, e.fn.modal.noConflict = function() {
return e.fn.modal = n, this;
}, e(document).on("click.bs.modal.data-api", '[data-toggle="modal"]', function(t) {
var n = e(this), i = n.attr("href"), r = e(n.attr("data-target") || i && i.replace(/.*(?=#[^\s]+$)/, "")), o = r.data("modal") ? "toggle" : e.extend({
remote: !/#/.test(i) && i
}, r.data(), n.data());
t.preventDefault(), r.modal(o, this).one("hide", function() {
n.is(":visible") && n.focus();
});
}), e(document).on("show.bs.modal", ".modal", function() {
e(document.body).addClass("modal-open");
}).on("hidden.bs.modal", ".modal", function() {
e(document.body).removeClass("modal-open");
});
}(jQuery), function(e) {
"use strict";
var t = function(e, t) {
this.type = this.options = this.enabled = this.timeout = this.hoverState = this.$element = null,
this.init("tooltip", e, t);
};
t.DEFAULTS = {
animation: !0,
placement: "top",
selector: !1,
template: '',
trigger: "hover focus",
title: "",
delay: 0,
html: !1,
container: !1
}, t.prototype.init = function(t, n, i) {
this.enabled = !0, this.type = t, this.$element = e(n), this.options = this.getOptions(i);
for (var r = this.options.trigger.split(" "), o = r.length; o--; ) {
var a = r[o];
if ("click" == a) this.$element.on("click." + this.type, this.options.selector, e.proxy(this.toggle, this)); else if ("manual" != a) {
var s = "hover" == a ? "mouseenter" : "focus", l = "hover" == a ? "mouseleave" : "blur";
this.$element.on(s + "." + this.type, this.options.selector, e.proxy(this.enter, this)),
this.$element.on(l + "." + this.type, this.options.selector, e.proxy(this.leave, this));
}
}
this.options.selector ? this._options = e.extend({}, this.options, {
trigger: "manual",
selector: ""
}) : this.fixTitle();
}, t.prototype.getDefaults = function() {
return t.DEFAULTS;
}, t.prototype.getOptions = function(t) {
return t = e.extend({}, this.getDefaults(), this.$element.data(), t), t.delay && "number" == typeof t.delay && (t.delay = {
show: t.delay,
hide: t.delay
}), t;
}, t.prototype.getDelegateOptions = function() {
var t = {}, n = this.getDefaults();
return this._options && e.each(this._options, function(e, i) {
n[e] != i && (t[e] = i);
}), t;
}, t.prototype.enter = function(t) {
var n = t instanceof this.constructor ? t : e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
return clearTimeout(n.timeout), n.hoverState = "in", n.options.delay && n.options.delay.show ? void (n.timeout = setTimeout(function() {
"in" == n.hoverState && n.show();
}, n.options.delay.show)) : n.show();
}, t.prototype.leave = function(t) {
var n = t instanceof this.constructor ? t : e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type);
return clearTimeout(n.timeout), n.hoverState = "out", n.options.delay && n.options.delay.hide ? void (n.timeout = setTimeout(function() {
"out" == n.hoverState && n.hide();
}, n.options.delay.hide)) : n.hide();
}, t.prototype.show = function() {
var t = e.Event("show.bs." + this.type);
if (this.hasContent() && this.enabled) {
if (this.$element.trigger(t), t.isDefaultPrevented()) return;
var n = this.tip();
this.setContent(), this.options.animation && n.addClass("fade");
var i = "function" == typeof this.options.placement ? this.options.placement.call(this, n[0], this.$element[0]) : this.options.placement, r = /\s?auto?\s?/i, o = r.test(i);
o && (i = i.replace(r, "") || "top"), n.detach().css({
top: 0,
left: 0,
display: "block"
}).addClass(i), this.options.container ? n.appendTo(this.options.container) : n.insertAfter(this.$element);
var a = this.getPosition(), s = n[0].offsetWidth, l = n[0].offsetHeight;
if (o) {
var c = this.$element.parent(), u = i, d = document.documentElement.scrollTop || document.body.scrollTop, p = "body" == this.options.container ? window.innerWidth : c.outerWidth(), h = "body" == this.options.container ? window.innerHeight : c.outerHeight(), f = "body" == this.options.container ? 0 : c.offset().left;
i = "bottom" == i && a.top + a.height + l - d > h ? "top" : "top" == i && a.top - d - l < 0 ? "bottom" : "right" == i && a.right + s > p ? "left" : "left" == i && a.left - s < f ? "right" : i,
n.removeClass(u).addClass(i);
}
var m = this.getCalculatedOffset(i, a, s, l);
this.applyPlacement(m, i), this.$element.trigger("shown.bs." + this.type);
}
}, t.prototype.applyPlacement = function(e, t) {
var n, i = this.tip(), r = i[0].offsetWidth, o = i[0].offsetHeight, a = parseInt(i.css("margin-top"), 10), s = parseInt(i.css("margin-left"), 10);
isNaN(a) && (a = 0), isNaN(s) && (s = 0), e.top = e.top + a, e.left = e.left + s,
i.offset(e).addClass("in");
var l = i[0].offsetWidth, c = i[0].offsetHeight;
if ("top" == t && c != o && (n = !0, e.top = e.top + o - c), /bottom|top/.test(t)) {
var u = 0;
e.left < 0 && (u = -2 * e.left, e.left = 0, i.offset(e), l = i[0].offsetWidth, c = i[0].offsetHeight),
this.replaceArrow(u - r + l, l, "left");
} else this.replaceArrow(c - o, c, "top");
n && i.offset(e);
}, t.prototype.replaceArrow = function(e, t, n) {
this.arrow().css(n, e ? 50 * (1 - e / t) + "%" : "");
}, t.prototype.setContent = function() {
var e = this.tip(), t = this.getTitle();
e.find(".tooltip-inner")[this.options.html ? "html" : "text"](t), e.removeClass("fade in top bottom left right");
}, t.prototype.hide = function() {
function t() {
"in" != n.hoverState && i.detach();
}
var n = this, i = this.tip(), r = e.Event("hide.bs." + this.type);
return this.$element.trigger(r), r.isDefaultPrevented() ? void 0 : (i.removeClass("in"),
e.support.transition && this.$tip.hasClass("fade") ? i.one(e.support.transition.end, t).emulateTransitionEnd(150) : t(),
this.$element.trigger("hidden.bs." + this.type), this);
}, t.prototype.fixTitle = function() {
var e = this.$element;
(e.attr("title") || "string" != typeof e.attr("data-original-title")) && e.attr("data-original-title", e.attr("title") || "").attr("title", "");
}, t.prototype.hasContent = function() {
return this.getTitle();
}, t.prototype.getPosition = function() {
var t = this.$element[0];
return e.extend({}, "function" == typeof t.getBoundingClientRect ? t.getBoundingClientRect() : {
width: t.offsetWidth,
height: t.offsetHeight
}, this.$element.offset());
}, t.prototype.getCalculatedOffset = function(e, t, n, i) {
return "bottom" == e ? {
top: t.top + t.height,
left: t.left + t.width / 2 - n / 2
} : "top" == e ? {
top: t.top - i,
left: t.left + t.width / 2 - n / 2
} : "left" == e ? {
top: t.top + t.height / 2 - i / 2,
left: t.left - n
} : {
top: t.top + t.height / 2 - i / 2,
left: t.left + t.width
};
}, t.prototype.getTitle = function() {
var e = this.$element, t = this.options;
return e.attr("data-original-title") || ("function" == typeof t.title ? t.title.call(e[0]) : t.title);
}, t.prototype.tip = function() {
return this.$tip = this.$tip || e(this.options.template);
}, t.prototype.arrow = function() {
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow");
}, t.prototype.validate = function() {
this.$element[0].parentNode || (this.hide(), this.$element = null, this.options = null);
}, t.prototype.enable = function() {
this.enabled = !0;
}, t.prototype.disable = function() {
this.enabled = !1;
}, t.prototype.toggleEnabled = function() {
this.enabled = !this.enabled;
}, t.prototype.toggle = function(t) {
var n = t ? e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs." + this.type) : this;
n.tip().hasClass("in") ? n.leave(n) : n.enter(n);
}, t.prototype.destroy = function() {
this.hide().$element.off("." + this.type).removeData("bs." + this.type);
};
var n = e.fn.tooltip;
e.fn.tooltip = function(n) {
return this.each(function() {
var i = e(this), r = i.data("bs.tooltip"), o = "object" == typeof n && n;
r || i.data("bs.tooltip", r = new t(this, o)), "string" == typeof n && r[n]();
});
}, e.fn.tooltip.Constructor = t, e.fn.tooltip.noConflict = function() {
return e.fn.tooltip = n, this;
};
}(jQuery), function(e) {
"use strict";
var t = function(e, t) {
this.init("popover", e, t);
};
if (!e.fn.tooltip) throw new Error("Popover requires tooltip.js");
t.DEFAULTS = e.extend({}, e.fn.tooltip.Constructor.DEFAULTS, {
placement: "right",
trigger: "click",
content: "",
template: ''
}), t.prototype = e.extend({}, e.fn.tooltip.Constructor.prototype), t.prototype.constructor = t,
t.prototype.getDefaults = function() {
return t.DEFAULTS;
}, t.prototype.setContent = function() {
var e = this.tip(), t = this.getTitle(), n = this.getContent();
e.find(".popover-title")[this.options.html ? "html" : "text"](t), e.find(".popover-content")[this.options.html ? "html" : "text"](n),
e.removeClass("fade top bottom left right in"), e.find(".popover-title").html() || e.find(".popover-title").hide();
}, t.prototype.hasContent = function() {
return this.getTitle() || this.getContent();
}, t.prototype.getContent = function() {
var e = this.$element, t = this.options;
return e.attr("data-content") || ("function" == typeof t.content ? t.content.call(e[0]) : t.content);
}, t.prototype.arrow = function() {
return this.$arrow = this.$arrow || this.tip().find(".arrow");
}, t.prototype.tip = function() {
return this.$tip || (this.$tip = e(this.options.template)), this.$tip;
};
var n = e.fn.popover;
e.fn.popover = function(n) {
return this.each(function() {
var i = e(this), r = i.data("bs.popover"), o = "object" == typeof n && n;
r || i.data("bs.popover", r = new t(this, o)), "string" == typeof n && r[n]();
});
}, e.fn.popover.Constructor = t, e.fn.popover.noConflict = function() {
return e.fn.popover = n, this;
};
}(jQuery), function(e) {
"use strict";
function t(n, i) {
var r, o = e.proxy(this.process, this);
this.$element = e(e(n).is("body") ? window : n), this.$body = e("body"), this.$scrollElement = this.$element.on("scroll.bs.scroll-spy.data-api", o),
this.options = e.extend({}, t.DEFAULTS, i), this.selector = (this.options.target || (r = e(n).attr("href")) && r.replace(/.*(?=#[^\s]+$)/, "") || "") + " .nav li > a",
this.offsets = e([]), this.targets = e([]), this.activeTarget = null, this.refresh(),
this.process();
}
t.DEFAULTS = {
offset: 10
}, t.prototype.refresh = function() {
var t = this.$element[0] == window ? "offset" : "position";
this.offsets = e([]), this.targets = e([]);
var n = this;
this.$body.find(this.selector).map(function() {
var i = e(this), r = i.data("target") || i.attr("href"), o = /^#\w/.test(r) && e(r);
return o && o.length && [ [ o[t]().top + (!e.isWindow(n.$scrollElement.get(0)) && n.$scrollElement.scrollTop()), r ] ] || null;
}).sort(function(e, t) {
return e[0] - t[0];
}).each(function() {
n.offsets.push(this[0]), n.targets.push(this[1]);
});
}, t.prototype.process = function() {
var e, t = this.$scrollElement.scrollTop() + this.options.offset, n = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight, i = n - this.$scrollElement.height(), r = this.offsets, o = this.targets, a = this.activeTarget;
if (t >= i) return a != (e = o.last()[0]) && this.activate(e);
for (e = r.length; e--; ) a != o[e] && t >= r[e] && (!r[e + 1] || t <= r[e + 1]) && this.activate(o[e]);
}, t.prototype.activate = function(t) {
this.activeTarget = t, e(this.selector).parents(".active").removeClass("active");
var n = this.selector + '[data-target="' + t + '"],' + this.selector + '[href="' + t + '"]', i = e(n).parents("li").addClass("active");
i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("active")),
i.trigger("activate.bs.scrollspy");
};
var n = e.fn.scrollspy;
e.fn.scrollspy = function(n) {
return this.each(function() {
var i = e(this), r = i.data("bs.scrollspy"), o = "object" == typeof n && n;
r || i.data("bs.scrollspy", r = new t(this, o)), "string" == typeof n && r[n]();
});
}, e.fn.scrollspy.Constructor = t, e.fn.scrollspy.noConflict = function() {
return e.fn.scrollspy = n, this;
}, e(window).on("load", function() {
e('[data-spy="scroll"]').each(function() {
var t = e(this);
t.scrollspy(t.data());
});
});
}(jQuery), function(e) {
"use strict";
var t = function(t) {
this.element = e(t);
};
t.prototype.show = function() {
var t = this.element, n = t.closest("ul:not(.dropdown-menu)"), i = t.data("target");
if (i || (i = t.attr("href"), i = i && i.replace(/.*(?=#[^\s]*$)/, "")), !t.parent("li").hasClass("active")) {
var r = n.find(".active:last a")[0], o = e.Event("show.bs.tab", {
relatedTarget: r
});
if (t.trigger(o), !o.isDefaultPrevented()) {
var a = e(i);
this.activate(t.parent("li"), n), this.activate(a, a.parent(), function() {
t.trigger({
type: "shown.bs.tab",
relatedTarget: r
});
});
}
}
}, t.prototype.activate = function(t, n, i) {
function r() {
o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),
t.addClass("active"), a ? (t[0].offsetWidth, t.addClass("in")) : t.removeClass("fade"),
t.parent(".dropdown-menu") && t.closest("li.dropdown").addClass("active"), i && i();
}
var o = n.find("> .active"), a = i && e.support.transition && o.hasClass("fade");
a ? o.one(e.support.transition.end, r).emulateTransitionEnd(150) : r(), o.removeClass("in");
};
var n = e.fn.tab;
e.fn.tab = function(n) {
return this.each(function() {
var i = e(this), r = i.data("bs.tab");
r || i.data("bs.tab", r = new t(this)), "string" == typeof n && r[n]();
});
}, e.fn.tab.Constructor = t, e.fn.tab.noConflict = function() {
return e.fn.tab = n, this;
}, e(document).on("click.bs.tab.data-api", '[data-toggle="tab"], [data-toggle="pill"]', function(t) {
t.preventDefault(), e(this).tab("show");
});
}(jQuery), function(e) {
"use strict";
var t = function(n, i) {
this.options = e.extend({}, t.DEFAULTS, i), this.$window = e(window).on("scroll.bs.affix.data-api", e.proxy(this.checkPosition, this)).on("click.bs.affix.data-api", e.proxy(this.checkPositionWithEventLoop, this)),
this.$element = e(n), this.affixed = this.unpin = null, this.checkPosition();
};
t.RESET = "affix affix-top affix-bottom", t.DEFAULTS = {
offset: 0
}, t.prototype.checkPositionWithEventLoop = function() {
setTimeout(e.proxy(this.checkPosition, this), 1);
}, t.prototype.checkPosition = function() {
if (this.$element.is(":visible")) {
var n = e(document).height(), i = this.$window.scrollTop(), r = this.$element.offset(), o = this.options.offset, a = o.top, s = o.bottom;
"object" != typeof o && (s = a = o), "function" == typeof a && (a = o.top()), "function" == typeof s && (s = o.bottom());
var l = !(null != this.unpin && i + this.unpin <= r.top) && (null != s && r.top + this.$element.height() >= n - s ? "bottom" : null != a && a >= i && "top");
this.affixed !== l && (this.unpin && this.$element.css("top", ""), this.affixed = l,
this.unpin = "bottom" == l ? r.top - i : null, this.$element.removeClass(t.RESET).addClass("affix" + (l ? "-" + l : "")),
"bottom" == l && this.$element.offset({
top: document.body.offsetHeight - s - this.$element.height()
}));
}
};
var n = e.fn.affix;
e.fn.affix = function(n) {
return this.each(function() {
var i = e(this), r = i.data("bs.affix"), o = "object" == typeof n && n;
r || i.data("bs.affix", r = new t(this, o)), "string" == typeof n && r[n]();
});
}, e.fn.affix.Constructor = t, e.fn.affix.noConflict = function() {
return e.fn.affix = n, this;
}, e(window).on("load", function() {
e('[data-spy="affix"]').each(function() {
var t = e(this), n = t.data();
n.offset = n.offset || {}, n.offsetBottom && (n.offset.bottom = n.offsetBottom),
n.offsetTop && (n.offset.top = n.offsetTop), t.affix(n);
});
});
}(jQuery), define("bootstrap", [ "jquery" ], function() {}), function(e, t) {
var n, i;
i = t.document, n = function() {
function n(n) {
this._options = e.extend({
name: "tour",
container: "body",
keyboard: !0,
storage: t.localStorage,
debug: !1,
backdrop: !1,
redirect: !0,
orphan: !1,
duration: !1,
basePath: "",
template: "
« Prev Next » Pause
End tour ",
afterSetState: function() {},
afterGetState: function() {},
afterRemoveState: function() {},
onStart: function() {},
onEnd: function() {},
onShow: function() {},
onShown: function() {},
onHide: function() {},
onHidden: function() {},
onNext: function() {},
onPrev: function() {},
onPause: function() {},
onResume: function() {}
}, n), this._force = !1, this._inited = !1, this._steps = [], this.backdrop = {
overlay: null,
$element: null,
$background: null,
backgroundShown: !1,
overlayElementShown: !1
};
}
return n.prototype.setState = function(e, t) {
var n, i;
if (this._options.storage) {
i = this._options.name + "_" + e;
try {
this._options.storage.setItem(i, t);
} catch (e) {
n = e, n.code === DOMException.QUOTA_EXCEEDED_ERR && this.debug("LocalStorage quota exceeded. setState failed.");
}
return this._options.afterSetState(i, t);
}
return null == this._state && (this._state = {}), this._state[e] = t;
}, n.prototype.removeState = function(e) {
var t;
return this._options.storage ? (t = this._options.name + "_" + e, this._options.storage.removeItem(t),
this._options.afterRemoveState(t)) : null != this._state ? delete this._state[e] : void 0;
}, n.prototype.getState = function(e) {
var t, n;
return this._options.storage ? (t = this._options.name + "_" + e, n = this._options.storage.getItem(t)) : null != this._state && (n = this._state[e]),
void 0 !== n && "null" !== n || (n = null), this._options.afterGetState(e, n), n;
}, n.prototype.addSteps = function(e) {
var t, n, i, r;
for (r = [], n = 0, i = e.length; i > n; n++) t = e[n], r.push(this.addStep(t));
return r;
}, n.prototype.addStep = function(e) {
return this._steps.push(e);
}, n.prototype.getStep = function(t) {
return null != this._steps[t] ? e.extend({
id: "step-" + t,
path: "",
placement: "right",
title: "",
content: "
",
next: t === this._steps.length - 1 ? -1 : t + 1,
prev: t - 1,
animation: !0,
container: this._options.container,
backdrop: this._options.backdrop,
redirect: this._options.redirect,
orphan: this._options.orphan,
duration: this._options.duration,
template: this._options.template,
onShow: this._options.onShow,
onShown: this._options.onShown,
onHide: this._options.onHide,
onHidden: this._options.onHidden,
onNext: this._options.onNext,
onPrev: this._options.onPrev,
onPause: this._options.onPause,
onResume: this._options.onResume
}, this._steps[t]) : void 0;
}, n.prototype.init = function(e) {
var t = this;
return this._force = e, this.ended() ? this._debug("Tour ended, init prevented.") : (this.setCurrentStep(),
this._setupMouseNavigation(), this._setupKeyboardNavigation(), this._onResize(function() {
return t.showStep(t._current);
}), null !== this._current && this.showStep(this._current), this._inited = !0, this);
}, n.prototype.start = function(e) {
var t;
return null == e && (e = !1), this._inited || this.init(e), null === this._current ? (t = this._makePromise(null != this._options.onStart ? this._options.onStart(this) : void 0),
this._callOnPromiseDone(t, this.showStep, 0)) : void 0;
}, n.prototype.next = function() {
var e;
return this.ended() ? this._debug("Tour ended, next prevented.") : (e = this.hideStep(this._current),
this._callOnPromiseDone(e, this._showNextStep));
}, n.prototype.prev = function() {
var e;
return this.ended() ? this._debug("Tour ended, prev prevented.") : (e = this.hideStep(this._current),
this._callOnPromiseDone(e, this._showPrevStep));
}, n.prototype.goTo = function(e) {
var t;
return this.ended() ? this._debug("Tour ended, goTo prevented.") : (t = this.hideStep(this._current),
this._callOnPromiseDone(t, this.showStep, e));
}, n.prototype.end = function() {
var n, r, o = this;
return n = function() {
return e(i).off("click.tour-" + o._options.name), e(i).off("keyup.tour-" + o._options.name),
e(t).off("resize.tour-" + o._options.name), o.setState("end", "yes"), o._inited = !1,
o._force = !1, o._clearTimer(), null != o._options.onEnd ? o._options.onEnd(o) : void 0;
}, r = this.hideStep(this._current), this._callOnPromiseDone(r, n);
}, n.prototype.ended = function() {
return !this.force && !!this.getState("end");
}, n.prototype.restart = function() {
return this.removeState("current_step"), this.removeState("end"), this.setCurrentStep(0),
this.start();
}, n.prototype.pause = function() {
var e;
return (e = this.getStep(this._current)) && e.duration ? (this._paused = !0, this._duration -= new Date().getTime() - this._start,
t.clearTimeout(this._timer), this._debug("Paused/Stopped step " + (this._current + 1) + " timer (" + this._duration + " remaining)."),
null != e.onPause ? e.onPause(this, this._duration) : void 0) : void 0;
}, n.prototype.resume = function() {
var e, n = this;
return (e = this.getStep(this._current)) && e.duration ? (this._paused = !1, this._start = new Date().getTime(),
this._duration = this._duration || e.duration, this._timer = t.setTimeout(function() {
return n._isLast() ? n.next() : n.end();
}, this._duration), this._debug("Started step " + (this._current + 1) + " timer with duration " + this._duration),
null != e.onResume && this._duration !== e.duration ? e.onResume(this, this._duration) : void 0) : void 0;
}, n.prototype.hideStep = function(t) {
var n, i, r, o = this;
return (r = this.getStep(t)) ? (this._clearTimer(), i = this._makePromise(null != r.onHide ? r.onHide(this, t) : void 0),
n = function() {
var t;
return t = e(r.element), t.data("bs.popover") || t.data("popover") || (t = e("body")),
t.popover("destroy"), r.reflex && t.css("cursor", "").off("click.tour-" + o._options.name),
r.backdrop && o._hideBackdrop(), null != r.onHidden ? r.onHidden(o) : void 0;
}, this._callOnPromiseDone(i, n), i) : void 0;
}, n.prototype.showStep = function(t) {
var n, r, o, a, s = this;
return (a = this.getStep(t)) ? (o = t < this._current, n = this._makePromise(null != a.onShow ? a.onShow(this, t) : void 0),
r = function() {
var n, r;
if (s.setCurrentStep(t), r = e.isFunction(a.path) ? a.path.call() : s._options.basePath + a.path,
n = [ i.location.pathname, i.location.hash ].join(""), s._isRedirect(r, n)) return void s._redirect(a, r);
if (s._isOrphan(a)) {
if (!a.orphan) return s._debug("Skip the orphan step " + (s._current + 1) + ". Orphan option is false and the element doesn't exist or is hidden."),
void (o ? s._showPrevStep() : s._showNextStep());
s._debug("Show the orphan step " + (s._current + 1) + ". Orphans option is true.");
}
return a.backdrop && s._showBackdrop(s._isOrphan(a) ? void 0 : a.element), s._scrollIntoView(a.element, function() {
return null != a.element && a.backdrop && s._showOverlayElement(a.element), s._showPopover(a, t),
null != a.onShown && a.onShown(s), s._debug("Step " + (s._current + 1) + " of " + s._steps.length);
}), a.duration ? s.resume() : void 0;
}, this._callOnPromiseDone(n, r), n) : void 0;
}, n.prototype.setCurrentStep = function(e) {
return null != e ? (this._current = e, this.setState("current_step", e)) : (this._current = this.getState("current_step"),
this._current = null === this._current ? null : parseInt(this._current, 10)), this;
}, n.prototype._showNextStep = function() {
var e, t, n, i = this;
return n = this.getStep(this._current), t = function() {
return i.showStep(n.next);
}, e = this._makePromise(null != n.onNext ? n.onNext(this) : void 0), this._callOnPromiseDone(e, t);
}, n.prototype._showPrevStep = function() {
var e, t, n, i = this;
return n = this.getStep(this._current), t = function() {
return i.showStep(n.prev);
}, e = this._makePromise(null != n.onPrev ? n.onPrev(this) : void 0), this._callOnPromiseDone(e, t);
}, n.prototype._debug = function(e) {
return this._options.debug ? t.console.log("Bootstrap Tour '" + this._options.name + "' | " + e) : void 0;
}, n.prototype._isRedirect = function(e, t) {
return null != e && "" !== e && e.replace(/\?.*$/, "").replace(/\/?$/, "") !== t.replace(/\/?$/, "");
}, n.prototype._redirect = function(t, n) {
return e.isFunction(t.redirect) ? t.redirect.call(this, n) : !0 === t.redirect ? (this._debug("Redirect to " + n),
i.location.href = n) : void 0;
}, n.prototype._isOrphan = function(t) {
return null == t.element || !e(t.element).length || e(t.element).is(":hidden") && "http://www.w3.org/2000/svg" !== e(t.element)[0].namespaceURI;
}, n.prototype._isLast = function() {
return this._current < this._steps.length - 1;
}, n.prototype._showPopover = function(t, n) {
var i, r, o, a, s, l, c = this;
return l = e.extend({}, this._options), o = e(e.isFunction(t.template) ? t.template(n, t) : t.template),
r = o.find(".popover-navigation"), s = this._isOrphan(t), s && (t.element = "body",
t.placement = "top", o = o.addClass("orphan")), i = e(t.element), o.addClass("tour-" + this._options.name),
t.options && e.extend(l, t.options), t.reflex && i.css("cursor", "pointer").on("click.tour-" + this._options.name, function() {
return c._isLast() ? c.next() : c.end();
}), t.prev < 0 && r.find("*[data-role=prev]").addClass("disabled"), t.next < 0 && r.find("*[data-role=next]").addClass("disabled"),
t.duration || r.find("*[data-role='pause-resume']").remove(), t.template = o.clone().wrap("").parent().html(),
i.popover({
placement: t.placement,
trigger: "manual",
title: t.title,
content: t.content,
html: !0,
animation: t.animation,
container: t.container,
template: t.template,
selector: t.element
}).popover("show"), a = i.data("bs.popover") ? i.data("bs.popover").tip() : i.data("popover").tip(),
a.attr("id", t.id), this._reposition(a, t), s ? this._center(a) : void 0;
}, n.prototype._reposition = function(t, n) {
var r, o, a, s, l, c, u;
if (s = t[0].offsetWidth, o = t[0].offsetHeight, u = t.offset(), l = u.left, c = u.top,
r = e(i).outerHeight() - u.top - t.outerHeight(), 0 > r && (u.top = u.top + r),
a = e("html").outerWidth() - u.left - t.outerWidth(), 0 > a && (u.left = u.left + a),
u.top < 0 && (u.top = 0), u.left < 0 && (u.left = 0), t.offset(u), "bottom" === n.placement || "top" === n.placement) {
if (l !== u.left) return this._replaceArrow(t, 2 * (u.left - l), s, "left");
} else if (c !== u.top) return this._replaceArrow(t, 2 * (u.top - c), o, "top");
}, n.prototype._center = function(n) {
return n.css("top", e(t).outerHeight() / 2 - n.outerHeight() / 2);
}, n.prototype._replaceArrow = function(e, t, n, i) {
return e.find(".arrow").css(i, t ? 50 * (1 - t / n) + "%" : "");
}, n.prototype._scrollIntoView = function(n, i) {
var r, o, a, s, l, c = this;
return n ? (r = e(n), o = e(t), a = r.offset().top, l = o.height(), s = Math.max(0, a - l / 2),
this._debug("Scroll into view. ScrollTop: " + s + ". Element offset: " + a + ". Window height: " + l + "."),
e("body").stop().animate({
scrollTop: Math.ceil(s)
}, function() {
return i(), c._debug("Scroll into view. Animation end element offset: " + r.offset().top + ". Window height: " + o.height() + ".");
})) : i();
}, n.prototype._onResize = function(n, i) {
return e(t).on("resize.tour-" + this._options.name, function() {
return clearTimeout(i), i = setTimeout(n, 100);
});
}, n.prototype._setupMouseNavigation = function() {
var t = this;
return t = this, e(i).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role=next]:not(.disabled)").on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role=next]:not(.disabled)", function(e) {
return e.preventDefault(), t.next();
}), e(i).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role=prev]:not(.disabled)").on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role=prev]:not(.disabled)", function(e) {
return e.preventDefault(), t.prev();
}), e(i).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role=end]").on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role=end]", function(e) {
return e.preventDefault(), t.end();
}), e(i).off("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role=pause-resume]").on("click.tour-" + this._options.name, ".popover.tour-" + this._options.name + " *[data-role=pause-resume]", function(n) {
var i;
return n.preventDefault(), i = e(this), i.text(i.data(t._paused ? "pause-text" : "resume-text")),
t._paused ? t.resume() : t.pause();
});
}, n.prototype._setupKeyboardNavigation = function() {
var t = this;
return this._options.keyboard ? e(i).on("keyup.tour-" + this._options.name, function(e) {
if (e.which) switch (e.which) {
case 39:
return e.preventDefault(), t._isLast() ? t.next() : t.end();
case 37:
if (e.preventDefault(), t._current > 0) return t.prev();
break;
case 27:
return e.preventDefault(), t.end();
}
}) : void 0;
}, n.prototype._makePromise = function(t) {
return t && e.isFunction(t.then) ? t : null;
}, n.prototype._callOnPromiseDone = function(e, t, n) {
var i = this;
return e ? e.then(function() {
return t.call(i, n);
}) : t.call(this, n);
}, n.prototype._showBackdrop = function() {
return this.backdrop.backgroundShown ? void 0 : (this.backdrop = e("
", {
"class": "tour-backdrop"
}), this.backdrop.backgroundShown = !0, e("body").append(this.backdrop));
}, n.prototype._hideBackdrop = function() {
return this._hideOverlayElement(), this._hideBackground();
}, n.prototype._hideBackground = function() {
return this.backdrop.remove(), this.backdrop.overlay = null, this.backdrop.backgroundShown = !1;
}, n.prototype._showOverlayElement = function(t) {
var n, i, r;
return this.backdrop.overlayElementShown ? void 0 : (this.backdrop.overlayElementShown = !0,
i = e(t), n = e("
"), r = i.offset(), r.top = r.top, r.left = r.left, n.width(i.innerWidth()).height(i.innerHeight()).addClass("tour-step-background").offset(r),
i.addClass("tour-step-backdrop"), e("body").append(n), this.backdrop.$element = i,
this.backdrop.$background = n);
}, n.prototype._hideOverlayElement = function() {
return this.backdrop.overlayElementShown ? (this.backdrop.$element.removeClass("tour-step-backdrop"),
this.backdrop.$background.remove(), this.backdrop.$element = null, this.backdrop.$background = null,
this.backdrop.overlayElementShown = !1) : void 0;
}, n.prototype._clearTimer = function() {
return t.clearTimeout(this._timer), this._timer = null, this._duration = null;
}, n;
}(), t.Tour = n;
}(jQuery, window), define("bootstrap-tour", [ "bootstrap" ], function(e) {
return function() {
return e.Tour;
};
}(this)), define("extensions/welcomeTour", [ "underscore", "jquery", "storage", "classes/Extension", "bootstrap-tour" ], function(e, t, n, i, r) {
var o, a = new i("welcomeTour", "Welcome tour", !1, !0);
return a.onEventMgrCreated = function(e) {
o = e;
}, a.onReady = function() {
function i(e, n, i) {
var r = t(e).tooltip({
html: !0,
placement: i,
trigger: "manual",
title: n
}).tooltip("show").addClass("info-tooltip");
r.parent().addClass("info-tooltip-container"), r.one("click", function() {
r.tooltip("hide").removeClass("info-tooltip").parent().removeClass("info-tooltip-container");
}), setTimeout(function() {
r.tooltip("hide").removeClass("info-tooltip").parent().removeClass("info-tooltip-container");
}, 3e4);
}
var a = new r({
keyboard: !1,
storage: {
getItem: function() {},
setItem: function() {},
removeItem: function() {}
},
onEnd: function() {
n.welcomeTour_1 = "done", i(".drag-me", "Drag me!", "left"), i(".layout-toggler-preview", "Toggle preview", "right");
},
template: [ '
', '
', '
', '
', '
', ' Next ', ' Got it! ', " ", "
" ].join("")
});
a.addSteps([ {
element: ".navbar-inner",
title: "StackEdit 5 is coming...",
content: [ '
A new version of StackEdit is on its way and you can try it here !
', "
It's still in beta. Some of the features may not be available just yet.
", "You can always click
Next to go through the StackEdit 4 tour." ].join(""),
placement: "bottom"
}, {
element: ".document-panel .toggle-button",
title: "Documents",
content: [ '
The document panel allows you to manage your local documents.
', "
Tip: Use
Ctrl+[ and
Ctrl+] to toggle documents." ].join(""),
placement: "left",
reflex: !0
}, {
element: ".menu-panel .toggle-button",
title: "Menu",
content: [ '
The menu panel allows you to synchronize your documents on Google Drive, Dropbox or to publish them on GitHub, Blogger...
', '
Tip: Use the
menu panel to access the settings.' ].join(""),
placement: "right",
reflex: !0
}, {
element: ".navbar-inner > .nav .button-open-discussion, .navbar .buttons-dropdown > .nav > .btn:not(:hidden)",
title: "Comments/discussions",
content: [ '
New in StackEdit 4: the comments button lets you create inline discussions!
', "
Tip: Reopen the Hello! document from Settings>Utils to discover other new features." ].join(""),
placement: "right",
reflex: !0
}, {
element: ".navbar-inner",
title: "Happy StackWriting!",
content: [ '
Enjoy, and don\'t forget to rate 5 stars on the Chrome Web Store ...
', '' ].join(""),
placement: "bottom",
onShown: function() {
o.onTweet();
}
} ]), e.has(n, "welcomeTour_1") || a.start(), t(".action-welcome-tour").click(function() {
a.restart();
});
}, a;
}), define("text!extensions/shortcutsDefaultMapping.settings", [], function() {
return "{\n 'mod+b': bindPagedownButton('bold'),\n 'mod+i': bindPagedownButton('italic'),\n 'mod+l': bindPagedownButton('link'),\n 'mod+q': bindPagedownButton('quote'),\n 'mod+k': bindPagedownButton('code'),\n 'mod+g': bindPagedownButton('image'),\n 'mod+o': bindPagedownButton('olist'),\n 'mod+u': bindPagedownButton('ulist'),\n 'mod+h': bindPagedownButton('heading'),\n 'mod+r': bindPagedownButton('hr'),\n 'mod+z': bindPagedownButton('undo'),\n 'mod+y': bindPagedownButton('redo'),\n 'mod+shift+z': bindPagedownButton('redo'),\n 'mod+m': function(evt) {\n $('.button-open-discussion').click();\n evt.preventDefault();\n },\n '= = > space': function() {\n expand('==> ', '\u21d2 ');\n },\n '< = = space': function() {\n expand('<== ', '\u21d0 ');\n },\n 'S t a c k E d i t': function() {\n eventMgr.onMessage(\"You are stunned!!! Aren't you?\");\n }\n}\n";
}), define("text!html/shortcutsSettingsBlock.html", [], function() {
return '
Maps keyboard shortcuts to JavaScript functions.
\n
\n';
}), define("text!html/tooltipSettingsShortcutsExtension.html", [], function() {
return 'You can create expanding macros like this:\n
\n
\n\'- - > space\': function() {\n
\n expand(\'--> \', \'\u2192 \');\n
\n}\n
\n
\n
More\n info \n
\n
\n
Careful! This is subject to malicious code. Don\'t copy/paste untrusted content.\n';
}), define("extensions/shortcuts", [ "jquery", "underscore", "utils", "mousetrap", "classes/Extension", "text!extensions/shortcutsDefaultMapping.settings", "text!html/shortcutsSettingsBlock.html", "text!html/tooltipSettingsShortcutsExtension.html" ], function($, _, utils, mousetrap, Extension, shortcutsDefaultMapping, shortcutsSettingsBlockHTML, tooltipSettingsShortcutsExtensionHTML) {
function bindPagedownButton(e) {
return function(t) {
pagedownEditor.uiManager.doClick(pagedownEditor.uiManager.buttons[e]), t.preventDefault();
};
}
function expand(e, t) {
utils.defer(function() {
require("editor").replacePreviousText(e, t);
});
}
var shortcuts = new Extension("shortcuts", "Shortcuts", !0, !0);
shortcuts.settingsBlock = shortcutsSettingsBlockHTML, shortcuts.defaultConfig = {
mapping: shortcutsDefaultMapping
};
var eventMgr, pagedownEditor;
return shortcuts.onEventMgrCreated = function(e) {
eventMgr = e, eventMgr.addListener("onPagedownConfigure", function(e) {
pagedownEditor = e;
});
}, shortcuts.onLoadSettings = function() {
utils.setInputValue("#textarea-shortcuts-mapping", shortcuts.config.mapping);
}, shortcuts.onSaveSettings = function(newConfig, event) {
newConfig.code = utils.getInputValue("#textarea-shortcuts-mapping");
try {
eval("var test = " + newConfig.code);
} catch (t) {
eventMgr.onError(t), utils.getInputTextValue("#textarea-shortcuts-mapping", event, /^$/);
}
}, shortcuts.onInit = function() {
try {
var shortcutMap;
eval("shortcutMap = " + shortcuts.config.mapping), _.each(shortcutMap, function(e, t) {
mousetrap.bind(t, e);
});
} catch (t) {
console.error(t);
}
}, shortcuts.onReady = function() {
utils.createTooltip(".tooltip-shortcuts-extension", tooltipSettingsShortcutsExtensionHTML);
}, shortcuts;
}), define("text!html/userCustomSettingsBlock.html", [], function() {
return '
Allows users to implement their own extension.
\n
\n
More info ';
}), define("text!html/tooltipUserCustomExtension.html", [], function() {
return 'Extension variable name:\n
userCustom \n
\n
\n
Example: \n
\nuserCustom.onPreviewFinished = function() {\n
\n eventMgr.onMessage("Finished!");\n
\n};\n
\n
\n
More\n info \n
\n
\n
Careful! This is subject to malicious code. Don\'t copy/paste untrusted content.';
}), define("extensions/userCustom", [ "jquery", "underscore", "utils", "classes/Extension", "fileSystem", "settings", "text!html/userCustomSettingsBlock.html", "text!html/tooltipUserCustomExtension.html" ], function($, _, utils, Extension, fileSystem, settings, userCustomSettingsBlockHTML, tooltipUserCustomExtensionHTML) {
var userCustom = new Extension("userCustom", "UserCustom extension", !0);
userCustom.settingsBlock = userCustomSettingsBlockHTML, userCustom.defaultConfig = {
code: ""
};
var fileMgr;
userCustom.onFileMgrCreated = function(e) {
fileMgr = e;
};
var synchronizer;
userCustom.onSynchronizerCreated = function(e) {
synchronizer = e;
};
var publisher;
userCustom.onPublisherCreated = function(e) {
publisher = e;
};
var eventMgr;
return userCustom.onEventMgrCreated = function(e) {
eventMgr = e, eventMgr.addListener("onReady", function() {
utils.createTooltip(".tooltip-usercustom-extension", tooltipUserCustomExtensionHTML);
});
}, userCustom.onLoadSettings = function() {
utils.setInputValue("#textarea-usercustom-code", userCustom.config.code);
}, userCustom.onSaveSettings = function(newConfig, event) {
newConfig.code = utils.getInputValue("#textarea-usercustom-code");
try {
eval(newConfig.code);
} catch (t) {
eventMgr.onError(t), utils.getInputTextValue("#textarea-usercustom-code", event, /^$/);
}
}, userCustom.onInit = function() {
try {
eval(userCustom.config.code);
} catch (t) {
console.error(t);
}
}, userCustom;
}), define("text!html/commentsPopoverContent.html", [], function() {
return '
\n \n \n
\n
\n';
}), define("extensions/comments", [ "jquery", "underscore", "utils", "storage", "crel", "rangy", "classes/Extension", "text!html/commentsPopoverContent.html", "bootstrap" ], function(e, t, n, i, r, o, a, s) {
function l(e, t, n) {
t = Math.round(t);
for (var i = t - 21; t + 22 > i; ) S[i] && (t = i + 22), i++;
!n && (S[t] = 1);
var r = -8;
-1 !== e.className.indexOf(" icon-split") && (r = -12);
var o = t + r;
e.style.top = o + "px", e.style.right = "12px";
}
function c(t, n) {
this.commentElt = t, this.$commentElt = e(t).addClass("active"), this.fileDesc = n,
this.discussionIndex = t.discussionIndex;
}
function u(e) {
var t = _.getPopoverElt(), n = 0;
t.offsetWidth < x.offsetWidth - 10 && (n = x.offsetWidth - 10 - t.offsetWidth),
t.style.left = n + "px", t.querySelector(".arrow").style.left = x.offsetWidth - parseInt(e.style.right) - e.offsetWidth / 2 - n + "px";
var i = window.innerHeight - _.hr.getBoundingClientRect().top;
0 > i && (t.style.top = parseInt(t.style.top) + i + "px");
}
function d() {
_ && _.$commentElt.popover("toggle").popover("destroy");
}
function p() {
var e = _.getDiscussion(), n = i["author.name"], r = [];
return e.commentList && (r = e.commentList.map(function(e) {
var i = e.author || "Anonymous";
return t.template(m, {
author: i,
content: e.content,
reply: e.author != n
});
})), "conflict" == e.type && r.unshift(t.template(m, {
author: "StackEdit",
content: "Conflicting changes have been detected.",
reply: !0
})), r.join("");
}
var h, f = new a("comments", "Comments", !1, !0), m = [ "" ].join(""), g = [ '
', ' ', ' ', " ", " \u201c<%- title %>\u201d", " " ].join("");
f.onEventMgrCreated = function(e) {
h = e;
};
var v, b;
f.onEditorCreated = function(e) {
v = e, b = v.selectionMgr;
};
var y, x, w, S = [], C = r("a", {
"class": "discussion icon-comment new"
});
c.prototype.getDiscussion = function() {
return this.discussionIndex ? this.fileDesc.discussionList[this.discussionIndex] : this.fileDesc.newDiscussion;
}, c.prototype.getPopoverElt = function() {
return document.querySelector(".comments-popover .popover:last-child");
};
var _, k, E, T, I, D, N = {}, M = [], L = !1, A = t.debounce(function() {
function e() {
var i;
if (0 === o.length) return t.filter(N, function(e, n) {
return !t.has(E.discussionList, n);
}).forEach(function(e) {
x.removeChild(e), delete N[e.discussionIndex];
}), l(C, w, !0), _ && !_.discussionIndex && (y.scrollTop += parseInt(C.style.top) - y.scrollTop - 3 * y.offsetHeight / 4,
u(C)), M = t.sortBy(N, function(e) {
return e.selectionEnd;
}), I.toggleClass("some", 0 !== M.length), I.toggleClass("replied", L), void D.toggleClass("icon-chat", 0 !== M.length);
var a = o.shift(), s = N[a.discussionIndex];
s || (s = r("a"));
var c = "discussion", d = !a.commentList || !n || t.last(a.commentList).author != n;
d && (L = !0), c += "conflict" == a.type ? " icon-split" : " icon-comment", c += d ? " replied" : " added",
s.className = c, s.discussionIndex = a.discussionIndex, s.selectionEnd = a.selectionEnd,
i = b.getCoordinates(a.selectionEnd), l(s, i.y), x.appendChild(s), N[a.discussionIndex] = s,
_ && _.getDiscussion() === a && (y.scrollTop += parseInt(s.style.top) - y.scrollTop - 3 * y.offsetHeight / 4,
u(s)), T = setTimeout(e, 5);
}
if (void 0 !== E) {
L = !1, M = [];
var n = i["author.name"];
S = [];
var o = t.sortBy(E.discussionList, function(e) {
return e.selectionEnd;
});
clearTimeout(T), T = setTimeout(e, 5);
}
}, 50);
return f.onLayoutResize = A, f.onFileOpen = function(e) {
E = e, A();
}, f.onContentChanged = function(e) {
E === e && A();
}, f.onCursorCoordinates = function(e, t) {
w = t, l(C, t, !0);
}, f.onCommentsChanged = function(e) {
if (E === e) {
if (void 0 !== _) {
var t = _;
t.discussionIndex && (t.getPopoverElt().querySelector(".discussion-comment-list").innerHTML = p());
try {
k.undoToRange(t.rangyRange);
} catch (e) {}
var n = t.getDiscussion();
t.selectionRange = b.createRange(n.selectionStart, n.selectionEnd), t.rangyRange = o.createRange(),
t.rangyRange.setStart(t.selectionRange.startContainer, t.selectionRange.startOffset),
t.rangyRange.setEnd(t.selectionRange.endContainer, t.selectionRange.endOffset),
setTimeout(function() {
_ === t && k.applyToRange(t.rangyRange);
}, 50);
}
A();
}
}, f.onEditorPopover = function() {
d();
}, f.onDiscussionCreated = function(e) {
E === e && A();
}, f.onDiscussionRemoved = function(e, t) {
E === e && (void 0 !== _ && _.discussionIndex == t.discussionIndex && d(), A());
}, f.onReady = function() {
k = o.createCssClassApplier("comment-highlight", {
normalize: !1
});
var a = "";
y = document.getElementById("wmd-input"), x = document.querySelector("#wmd-input > .editor-margin"),
x.appendChild(C);
var l = e(r("div", {
"class": "comments-popover"
}));
e(document.body).append(l).on("click", function(e) {
_ && _.$commentElt[0] !== e.target && d();
}).popover({
placement: "auto top",
container: ".comments-popover",
html: !0,
title: function() {
if (!_) return !0;
var e = _.getDiscussion(), n = e.selectionEnd - e.selectionStart, i = v.getValue().substr(e.selectionStart, n > 20 ? 20 : n);
return n > 20 && (i += "..."), t.template(g, {
title: i
});
},
content: function() {
return t.template(s, {
commentList: p()
});
},
selector: "#wmd-input > .editor-margin > .discussion"
}), e(x).on("show.bs.popover", function(e) {
h.onEditorPopover();
var t = new c(e.target, E);
_ = t;
var n = t.getDiscussion();
if (!n) {
var i = Math.min(b.selectionStart, b.selectionEnd), r = Math.max(b.selectionStart, b.selectionEnd);
if (i === r) {
var o = b.getClosestWordOffset(i);
i = o.start, r = o.end;
}
n = {
selectionStart: i,
selectionEnd: r,
commentList: []
}, E.newDiscussion = n;
}
t.selectionRange = b.createRange(n.selectionStart, n.selectionEnd), y.scrollTop += parseInt(e.target.style.top) - y.scrollTop - 3 * y.offsetHeight / 4;
}).on("shown.bs.popover", function(r) {
var s = _, l = s.getPopoverElt();
s.$authorInputElt = e(l.querySelector(".input-comment-author")).val(i["author.name"]),
s.$contentInputElt = e(l.querySelector(".input-comment-content")), s.hr = l.querySelector("hr"),
u(s.commentElt), l.querySelector(".scrollport").scrollTop = 9999999;
var c = e(l.querySelector(".action-add-comment"));
e().add(s.$contentInputElt).add(s.$authorInputElt).keydown(function(e) {
13 === e.which && (e.preventDefault(), c.click());
}), c.click(function(e) {
var i = n.getInputTextValue(s.$authorInputElt), r = n.getInputTextValue(s.$contentInputElt, e);
if (!e.isPropagationStopped()) {
var o = s.getDiscussion();
s.$contentInputElt.val(""), d(), o.commentList = o.commentList || [], o.commentList.push({
author: i,
content: r
});
var a = s.fileDesc.discussionList || {};
if (o.discussionIndex) s.fileDesc.discussionList = a, h.onCommentsChanged(s.fileDesc); else {
var l;
do l = n.id(); while (t.has(a, l));
o.discussionIndex = l, a[l] = o, s.fileDesc.discussionList = a, h.onDiscussionCreated(s.fileDesc, o);
}
y.focus();
}
});
var p = e(l.querySelector(".action-remove-discussion"));
r.target.discussionIndex ? p.click(function() {
d();
var e = s.getDiscussion();
delete s.fileDesc.discussionList[e.discussionIndex], s.fileDesc.discussionList = s.fileDesc.discussionList,
h.onDiscussionRemoved(s.fileDesc, e), y.focus();
}) : p.hide(), s.rangyRange = o.createRange(), s.rangyRange.setStart(s.selectionRange.startContainer, s.selectionRange.startOffset),
s.rangyRange.setEnd(s.selectionRange.endContainer, s.selectionRange.endOffset),
setTimeout(function() {
_ === s && k.applyToRange(s.rangyRange);
}, 50), s.$contentInputElt.focus().val(a);
}).on("hide.bs.popover", function() {
if (_) {
_.$commentElt.removeClass("active"), a = _.$contentInputElt.val(), i["author.name"] = _.$authorInputElt.val();
try {
k.undoToRange(_.rangyRange);
} catch (e) {}
_ = void 0, delete E.newDiscussion;
}
}), l.on("click", ".popover", function(e) {
e.stopPropagation();
});
var f = e(C);
I = e(".button-open-discussion").click(function(n) {
var i = f;
if (_) if (_.discussionIndex) {
var r = -1;
M.some(function(e, t) {
return e === _.commentElt ? (r = t, !0) : void 0;
}), i = e(M[r + 1]);
} else i = e(t.first(M)); else b.selectionStart === b.selectionEnd && M.length && (i = e(t.first(M)));
0 === i.length ? (d(), v.focus(), v.adjustCursorPosition(!0)) : i.click(), n.stopPropagation();
}), D = I.find("i");
}, f;
}), define("text!html/findReplace.html", [], function() {
return '
\xd7 \n
\n
\n
\n 0 found\n
\n
\n Search \n Replace \n All \n
\n
\n
\n';
}), define("text!html/findReplaceSettingsBlock.html", [], function() {
return '
Helps find and replace text in the current document.
\n
';
}), define("extensions/findReplace", [ "jquery", "underscore", "crel", "utils", "classes/Extension", "mousetrap", "rangy", "text!html/findReplace.html", "text!html/findReplaceSettingsBlock.html" ], function(e, t, n, i, r, o, a, s, l) {
function c() {
u(), M.forEach(function(e) {
try {
x.undoToRange(e);
} catch (e) {}
}), M = [];
}
function u() {
if (S) {
try {
S && w.undoToRange(S);
} catch (e) {}
S = void 0;
}
}
function d(e) {
function t(e) {
return e.container === s.container ? {
container: o.endContainer.parentElement.nextSibling,
offsetInContainer: e.offsetInContainer - s.offsetInContainer,
offset: e.offset
} : e;
}
if (O) {
var n = k.val(), i = I.prop("checked"), r = D.prop("checked");
if (e || n != A || i != R || r != P) {
A = n, R = i, P = r, c();
var o, s = {};
L = [];
var l = 0;
if (n.length) try {
var u = i ? "gm" : "gmi";
if (n = r ? n : n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), N = new RegExp(n, u),
b.getValue().replace(N, function(e, t) {
L.push({
start: t,
end: t + e.length
});
}), l = L.length, L.length < 200) {
var d = [];
L.forEach(function(e) {
d.push(e.start), d.push(e.end);
}), d = b.selectionMgr.findOffsets(d);
for (var p = 0; p < d.length; p += 2) {
var h = d[p], f = d[p + 1], m = t(h), g = t(f), v = a.createRange();
v.setStart(m.container, m.offsetInContainer), v.setEnd(g.container, g.offsetInContainer),
s = f, o = v, x.applyToRange(v), M[h.offset] = v;
}
b.selectionMgr.hasFocus && b.selectionMgr.updateSelectionRange();
}
} catch (e) {}
T.innerHTML = l;
}
}
}
function p() {
y.onEditorPopover(), O = !0, _.show(), k.focus()[0].setSelectionRange(0, k.val().length),
b.selectionMgr.adjustTop = 50, b.selectionMgr.adjustBottom = 220, d(!0);
}
function h() {
O = !1, _.hide(), c(), b.selectionMgr.adjustTop = 0, b.selectionMgr.adjustBottom = 0,
b.focus();
}
function f() {
u();
var e = Math.min(b.selectionMgr.selectionStart, b.selectionMgr.selectionEnd), n = t.find(L, function(t) {
return t.start > e;
});
if (n || (n = t.first(L)), n) {
if (!(S = M[n.start])) {
var i = b.selectionMgr.createRange(n.start, n.end);
S = a.createRange(), S.setStart(i.startContainer, i.startOffset), S.setEnd(i.endContainer, i.endOffset);
}
w.applyToRange(S), S.start = n.start, S.end = n.end, b.selectionMgr.setSelectionStartEnd(n.start, n.end),
b.selectionMgr.updateCursorCoordinates(!0);
}
}
function m() {
if (!S) return f();
var e = E.val();
b.replace(S.start, S.end, e), setTimeout(function() {
f(), E.focus();
}, 1);
}
function g() {
var e = E.val();
b.replaceAll(N, e);
}
var v = new r("findReplace", "Find and Replace", !0, !0);
v.settingsBlock = l, v.defaultConfig = {
findReplaceShortcut: "mod+f"
}, v.onLoadSettings = function() {
i.setInputValue("#input-find-replace-shortcut", v.config.findReplaceShortcut);
}, v.onSaveSettings = function(e, t) {
e.findReplaceShortcut = i.getInputTextValue("#input-find-replace-shortcut", t);
};
var b;
v.onEditorCreated = function(e) {
b = e;
};
var y;
v.onEventMgrCreated = function(e) {
y = e;
};
var x, w, S, C, _, k, E, T, I, D, N, M = [], L = [], A = "", R = !1, P = !1, O = !1;
return v.onEditorPopover = function() {
h();
}, v.onContentChanged = t.bind(d, null, !0), v.onFileOpen = t.bind(d, null, !0),
v.onReady = function() {
x = a.createCssClassApplier("find-replace-highlight", {
normalize: !1
}), w = a.createCssClassApplier("find-replace-select", {
normalize: !1
}), C = document.querySelector("#wmd-input .editor-content");
var i = n("div", {
"class": "find-replace"
});
_ = e(i).hide(), i.innerHTML = s, document.querySelector(".layout-wrapper-l2").appendChild(i),
e(".button-find-replace-dismiss").click(function() {
h();
}), T = i.querySelector(".found-counter"), I = _.find(".checkbox-case-sensitive").change(t.bind(d, null, !1)),
D = _.find(".checkbox-regexp").change(t.bind(d, null, !1)), _.find(".search-button").click(f),
k = e("#input-find-replace-search-for").keyup(t.bind(d, null, !1)), _.find(".replace-button").click(m),
E = e("#input-find-replace-replace-with"), _.find(".replace-all-button").click(g),
e().add(k).add(E).keydown(function(e) {
13 === e.which && (e.preventDefault(), f());
}), o.bind(v.config.findReplaceShortcut, function(e) {
var t = b.selectionMgr.getSelectedText();
t && k.val(t), p(), e.preventDefault();
});
}, v;
}), define("text!html/htmlSanitizerSettingsBlock.html", [], function() {
return '
Prevents cross-site-scripting attacks (XSS).
\n
Careful: Disable at your own risk!
\n';
}), define("extensions/htmlSanitizer", [ "jquery", "underscore", "utils", "logger", "classes/Extension", "text!html/htmlSanitizerSettingsBlock.html" ], function(e, t, n, i, r, o) {
function a(e, t) {
var i, r = t ? m : f;
return "" === (i = n.urlResolve(e).href) || i.match(r) ? void 0 : "unsafe:" + i;
}
function s(e) {
var t, n = {}, i = e.split(",");
for (t = 0; t < i.length; t++) n[i[t]] = !0;
return n;
}
function l(e, t) {
function n(e, n, r, o) {
if (n = n && n.toLowerCase(), D[n]) for (;s.last() && N[s.last()]; ) i("", s.last());
I[n] && s.last() == n && i("", n), (o = k[n] || !!o) || s.push(n);
var a = {};
r.replace(b, function(e, t, n, i, r) {
var o = n || i || r || "";
a[t] = c(o);
}), t.start && t.start(n, a, o);
}
function i(e, n) {
var i, r = 0;
if (n = n && n.toLowerCase()) for (r = s.length - 1; r >= 0 && s[r] != n; r--) ;
if (r >= 0) {
for (i = s.length - 1; i >= r; i--) t.end && t.end(s[i]);
s.length = r;
}
}
var r, o, a, s = [], l = e;
for (s.last = function() {
return s[s.length - 1];
}; e; ) {
if (o = !0, s.last() && M[s.last()]) e = e.replace(new RegExp("(.*)<\\s*\\/\\s*" + s.last() + "[^>]*>", "i"), function(e, n) {
return n = n.replace(w, "$1").replace(C, "$1"), t.chars && t.chars(c(n)), "";
}), i("", s.last()); else if (0 === e.indexOf("", r) === r && (t.comment && t.comment(e.substring(4, r)),
e = e.substring(r + 3), o = !1) : S.test(e) ? (a = e.match(S)) && (e = e.replace(a[0], ""),
o = !1) : x.test(e) ? (a = e.match(v)) && (e = e.substring(a[0].length), a[0].replace(v, i),
o = !1) : y.test(e) && (a = e.match(g)) && (e = e.substring(a[0].length), a[0].replace(g, n),
o = !1), o) {
r = e.indexOf("<");
var u = 0 > r ? e : e.substring(0, r);
e = 0 > r ? "" : e.substring(r), t.chars && t.chars(c(u));
}
if (e == l) return s.reverse(), s.forEach(function(e) {
h.push(""), h.push(e), h.push(">");
});
l = e;
}
i();
}
function c(e) {
if (!e) return "";
var t = O.exec(e), n = t[1], i = t[3], r = t[2];
return r && (P.innerHTML = r.replace(//g, ">");
}
function d(e, n) {
var i = !1, r = t.bind(e.push, e);
return {
start: function(e, o, a) {
e = e && e.toLowerCase(), !i && M[e] && (i = e), i || !0 !== L[e] || (r("<"), r(e),
t.forEach(o, function(t, i) {
var o = i && i.toLowerCase(), a = "img" === e && "src" === o || "background" === o;
!0 !== R[o] || !0 === A[o] && !n(t, a) || (r(" "), r(i), r('="'), r(u(t)), r('"'));
}), r(a ? "/>" : ">"));
},
end: function(e) {
e = e && e.toLowerCase(), i || !0 !== L[e] || (r(""), r(e), r(">")), e == i && (i = !1);
},
chars: function(e) {
i || r(u(e));
},
comment: function(e) {
i || (r(""));
}
};
}
var p = new r("htmlSanitizer", "HTML Sanitizer", !0);
p.settingsBlock = o;
var h;
p.onPagedownConfigure = function(e) {
e.getConverter().hooks.chain("postConversion", function(e) {
return h = [], e.split('
').forEach(function(e) {
l(e, d(h, function(e, t) {
return !/^unsafe/.test(a(e, t));
})), h.push('
');
}), h.slice(0, -1).join("");
});
};
var f = /^\s*(https?|ftp|mailto|tel|file):/, m = /^\s*(https?|ftp|file):|data:image\//, g = /^<\s*([\w:-]+)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*>/, v = /^<\s*\/\s*([\w:-]+)[^>]*>/, b = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, y = /^, x = /^<\s*\//, w = //g, S = /]*?)>/i, C = //g, _ = /([^\#-~| |!])/g, k = s("area,br,col,hr,img,wbr"), E = s("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"), T = s("rp,rt"), I = t.extend({}, T, E), D = t.extend({}, E, s("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")), N = t.extend({}, T, s("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")), M = s("script,style");
D.iframe = !0;
var L = t.extend({}, k, D, N, I), A = s("background,cite,href,longdesc,src,usemap"), R = t.extend({}, A, s("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width"));
R.id = !0, R.allowfullscreen = !0;
var P = document.createElement("pre"), O = /^(\s*)([\s\S]*?)(\s*)$/;
return p;
}), function(e) {
e.waitForImages = {
hasImageProperties: [ "backgroundImage", "listStyleImage", "borderImage", "borderCornerImage" ]
}, e.expr[":"].uncached = function(t) {
if (!e(t).is('img[src!=""]')) return !1;
var n = new Image();
return n.src = t.src, !n.complete;
}, e.fn.waitForImages = function(t, n, i) {
var r = 0, o = 0;
if (e.isPlainObject(arguments[0]) && (i = arguments[0].waitForAll, n = arguments[0].each,
t = arguments[0].finished), t = t || e.noop, n = n || e.noop, i = !!i, !e.isFunction(t) || !e.isFunction(n)) throw new TypeError("An invalid callback was supplied.");
return this.each(function() {
var a = e(this), s = [], l = e.waitForImages.hasImageProperties || [], c = /url\(\s*(['"]?)(.*?)\1\s*\)/g;
i ? a.find("*").andSelf().each(function() {
var t = e(this);
t.is("img:uncached") && s.push({
src: t.attr("src"),
element: t[0]
}), e.each(l, function(e, n) {
var i, r = t.css(n);
if (!r) return !0;
for (;i = c.exec(r); ) s.push({
src: i[2],
element: t[0]
});
});
}) : a.find("img:uncached").each(function() {
s.push({
src: this.src,
element: this
});
}), r = s.length, o = 0, 0 === r && t.call(a[0]), e.each(s, function(i, s) {
var l = new Image();
e(l).bind("load.waitForImages error.waitForImages", function(e) {
return o++, n.call(s.element, o, r, "load" == e.type), o == r ? (t.call(a[0]), !1) : void 0;
}), l.src = s.src;
});
});
};
}(jQuery), define("jquery-waitforimages", [ "jquery" ], function() {}), define("eventMgr", [ "jquery", "underscore", "crel", "mousetrap", "utils", "logger", "classes/Extension", "settings", "text!html/settingsExtensionsAccordion.html", "extensions/yamlFrontMatterParser", "extensions/markdownSectionParser", "extensions/partialRendering", "extensions/buttonMarkdownSyntax", "extensions/googleAnalytics", "extensions/twitter", "extensions/dialogAbout", "extensions/dialogManagePublication", "extensions/dialogManageSynchronization", "extensions/dialogManageSharing", "extensions/dialogOpenHarddrive", "extensions/documentTitle", "extensions/documentSelector", "extensions/documentPanel", "extensions/documentManager", "extensions/workingIndicator", "extensions/notifications", "extensions/umlDiagrams", "extensions/markdownExtra", "extensions/toc", "extensions/mathJax", "extensions/emailConverter", "extensions/scrollSync", "extensions/buttonSync", "extensions/buttonPublish", "extensions/buttonStat", "extensions/buttonHtmlCode", "extensions/buttonViewer", "extensions/welcomeTour", "extensions/shortcuts", "extensions/userCustom", "extensions/comments", "extensions/findReplace", "extensions/htmlSanitizer", "bootstrap", "jquery-waitforimages" ], function(e, t, n, i, r, o, a, s, l) {
function c(e) {
return t.chain(h).map(function(t) {
return t.enabled && t[e];
}).compact().value();
}
function u(e) {
return m[e] = c(e), function() {
o.log(e, arguments);
var n = arguments;
t.each(m[e], function(e) {
try {
e.apply(null, n);
} catch (e) {
console.error(t.isObject(e) ? e.stack : e);
}
});
};
}
function d(e) {
p[e] = u(e);
}
var p = {}, h = t.chain(arguments).map(function(e) {
return e instanceof a && e;
}).compact().value(), f = s.extensionSettings || {};
t.each(h, function(e) {
e.config = t.extend({}, e.defaultConfig, f[e.extensionId]), e.enabled = !0 === window.viewerMode && !0 === e.disableInViewer ? !1 : !e.isOptional || void 0 === e.config.enabled || !0 === e.config.enabled;
});
var m = {};
p.addListener = function(e, t) {
try {
m[e].push(t);
} catch (t) {
console.error("No event listener called " + e);
}
}, u("onInit")(), p.onLoadSettings = function() {
o.log("onLoadSettings"), t.each(h, function(e) {
var t = !e.isOptional || void 0 === e.config.enabled || !0 === e.config.enabled;
r.setInputChecked("#input-enable-extension-" + e.extensionId, t), "markdownExtra" == e.extensionId ? r.setInputChecked("#input-settings-markdown-extra", t) : "mathJax" == e.extensionId && r.setInputChecked("#input-settings-mathjax", t);
var n = e.onLoadSettings;
n && n();
});
}, p.onSaveSettings = function(e, n) {
o.log("onSaveSettings"), t.each(h, function(i) {
var o = t.extend({}, i.defaultConfig);
o.enabled = r.getInputChecked("#input-enable-extension-" + i.extensionId);
var a;
"markdownExtra" == i.extensionId ? (a = r.getInputChecked("#input-settings-markdown-extra")) != i.enabled && (o.enabled = a) : "mathJax" == i.extensionId && (a = r.getInputChecked("#input-settings-mathjax")) != i.enabled && (o.enabled = a);
var s = i.onSaveSettings;
s && s(o, n), e[i.extensionId] = o;
});
}, d("onMessage"), d("onError"), d("onOfflineChanged"), d("onUserActive"), d("onAsyncRunning"),
d("onPeriodicRun"), d("onEditorCreated"), d("onFileMgrCreated"), d("onSynchronizerCreated"),
d("onPublisherCreated"), d("onSharingCreated"), d("onEventMgrCreated"), d("onFileCreated"),
d("onFileDeleted"), d("onFileSelected"), d("onFileOpen"), d("onFileClosed"), d("onContentChanged"),
d("onTitleChanged"), d("onFoldersChanged"), d("onSyncRunning"), d("onSyncSuccess"),
d("onSyncImportSuccess"), d("onSyncExportSuccess"), d("onSyncRemoved"), d("onPublishRunning"),
d("onPublishSuccess"), d("onNewPublishSuccess"), d("onPublishRemoved"), d("onLayoutCreated"),
d("onLayoutResize"), d("onExtensionButtonResize"), d("onPagedownConfigure"), d("onSectionsCreated"),
d("onCursorCoordinates"), d("onEditorPopover"), d("onDiscussionCreated"), d("onDiscussionRemoved"),
d("onCommentsChanged"), d("onTweet");
var g, v, b = u("onPreviewFinished"), y = c("onAsyncPreview");
p.onAsyncPreview = function() {
function e(n) {
(n.length ? n.shift() : function() {
setTimeout(function() {
var e = "";
t.each(g.children, function(n) {
if (!n.exportableHtml) {
var i = n.cloneNode(!0);
t.each(i.querySelectorAll(".MathJax_SVG, .MathJax_SVG_Display, .MathJax_Preview"), function(e) {
e.parentNode.removeChild(e);
}), n.exportableHtml = i.innerHTML;
}
e += n.exportableHtml;
});
var n = r.trim(e), i = n.replace(/
', ' ', "<%= document.title %>
", "" ].join("");
w = e("#input-sync-import-couchdb-documentid");
var h, m, g, v, b = document.querySelector(".modal-download-couchdb"), x = e(b.querySelector(".document-list")), S = e(b.querySelector(".selected-document-list")), C = e(b.querySelector(".please-wait")), _ = e(b.querySelector(".no-document")), k = e(b.querySelector(".more-documents"));
l();
var E = t.debounce(function() {
C.removeClass("hide"), _.addClass("hide"), k.addClass("hide"), f.listDocuments(I.val(), m && m.updated, function(e, n) {
if (C.addClass("hide"), e) return void k.removeClass("hide");
n.length === r.COUCHDB_PAGE_SIZE && (k.removeClass("hide"), m = n.pop());
var i = t.reduce(n, function(e, n) {
return h[n._id] = n, e + t.template(p, {
document: n,
date: o.formatDate(n.updated)
});
}, "");
x.append(i), 0 === x.children().length && _.removeClass("hide");
}), u("list");
}, 10, !0), T = o.retrieveIgnoreError(y + ".tagList") || [], I = e("#input-sync-import-couchdb-tag").on("change", function() {
l(), E();
});
d(), e(b).on("show.bs.modal", function() {
l(), E();
}).on("click", ".document-list .document", function() {
e(this).toggleClass("active"), s();
}).on("click", ".more-documents", E).on("click", ".action-unselect-all", function() {
x.children().removeClass("active"), s();
}).on("click", ".action-byid-mode", function() {
u("byid");
}).on("click", ".action-add-tag", function() {
i.prompt("Enter a tag (case sensitive):", function(e, n) {
e && n && (T.push(n), T = t.chain(T).sortBy(function(e) {
return e.toLowerCase();
}).unique(!0).value(), a[y + ".tagList"] = JSON.stringify(T), d(), I.val(n).change());
}, "Tag");
}).on("click", ".action-remove-tag", function() {
var e = I.val();
e && i.confirm("You are removing " + I.val() + " from your list of filters.", function(n) {
n && (T = t.without(T, e), a[y + ".tagList"] = JSON.stringify(T), d(), I.val("").change());
});
}).on("click", ".action-delete-items", function() {
v.length && u("delete");
}).on("click", ".action-delete-items-confirm", function() {
f.deleteDocuments(g), l(), E();
}).on("click", ".action-cancel", function() {
u("list");
});
}), x;
}), define("helpers/googleHelper", [ "underscore", "jquery", "constants", "core", "utils", "storage", "logger", "settings", "eventMgr", "classes/AsyncTask" ], function(e, t, n, i, r, o, a, s, l, c) {
function u(t) {
var n = {
profile: !0
}, i = !0;
e.each((o[t + ".permissions"] || "").split(";"), function(e) {
e && (n[e] = !0);
}), this.setRefreshFlag = function() {
i = !0;
}, this.isAuthorized = function(t) {
return !1 === i && e.has(n, t);
}, this.add = function(r) {
n[r] = !0, o[t + ".permissions"] = e.keys(n).join(";"), i = !1;
}, this.getListWithNew = function(t) {
var i = e.keys(n);
return e.has(n, t) || i.push(t), i;
};
var r = o[t + ".userId"];
this.setUserId = function(e) {
r = e, o[t + ".userId"] = r;
}, this.getUserId = function() {
return r;
};
var a = parseInt(o[t + ".authUser"] || 0);
this.setAuthUser = function(e) {
a = e, o[t + ".authUser"] = a;
}, this.getAuthUser = function() {
return a;
};
}
function d(e) {
e.onRun(function() {
return !0 === y ? (g = !1, e.error(new Error("Operation not available in offline mode.|stopPublish"))) : !0 === g ? e.chain() : (window.delayedFunction = function() {
gapi.load("client", function() {
gapi.client.load("drive", "v2", function() {
g = !0, e.chain();
});
});
}, void t.ajax({
url: "https://apis.google.com/js/api.js?onload=runDelayedFunction",
dataType: "script",
timeout: n.AJAX_TIMEOUT
}).fail(function(t) {
f({
code: t.status,
message: t.statusText
}, e);
}));
});
}
function p(i, o, a) {
var s = b.getAuthorizationMgr(a);
i.onRun(function() {
function a() {
t.ajax({
url: "https://www.googleapis.com/oauth2/v1/tokeninfo",
data: {
access_token: d.access_token
},
timeout: n.AJAX_TIMEOUT,
type: "GET"
}).done(function(e) {
s.getUserId() && s.getUserId() != e.user_id ? u() : (s.setUserId(e.user_id), s.add(o),
s.token = d, i.chain());
}).fail(function(e) {
f({
code: e.status,
message: e.statusText
}, i);
});
}
function l() {
if (m > 5) return i.error(new Error("Unable to authenticate user " + s.getUserId() + ", please sign in with Google."));
!1 === p && (i.timeout = n.ASYNC_TASK_LONG_TIMEOUT);
var t = e.chain(x).pick(s.getListWithNew(o)).flatten().value();
gapi.auth.authorize({
client_id: n.GOOGLE_CLIENT_ID,
scope: t,
immediate: p,
authuser: !1 === p ? "" : m
}, function(e) {
d = gapi.auth.getToken(), gapi.auth.setToken(h), !e || e.error ? !0 === g && !0 === p ? (5 > m && s.getUserId() ? m++ : p = !1,
i.chain(c)) : i.error(new Error("Access to Google account is not authorized.")) : (s.setAuthUser(m),
!0 === p && m++, i.chain(a));
});
}
function c() {
return !0 === p ? i.chain(l) : void r.redirectConfirm("You are being redirected to Google authorization page.", function() {
i.chain(l);
}, function() {
i.error(new Error("Operation canceled."));
});
}
function u() {
return p = !0, s.token && s.isAuthorized(o) ? i.chain() : (s.getUserId() || (p = !1),
void i.chain(c));
}
var d, p, h = gapi.auth.getToken(), m = 0;
u();
});
}
function h(e, t) {
var n = gapi.auth.getToken(), i = v[e];
gapi.auth.setToken(i.token), t(), gapi.auth.setToken(n);
}
function f(t, n) {
var r;
if (t) if (a.error(t), "string" == typeof t) r = t; else {
if (r = "Google error (" + t.code + ": " + t.message + ").", t.code >= 500 && t.code < 600) return n.retry(new Error(r));
if (401 === t.code || 403 === t.code || "token_refresh_required" == t.code) return e.each(v, function(e) {
e.setRefreshFlag();
}), r = "Access to Google account is not authorized.", n.retry(new Error(r), 1);
0 !== t.code && -1 !== t.code || (g = !1, e.each(v, function(e) {
e.setRefreshFlag();
}), i.setOffline(), r = "|stopPublish");
}
n.error(new Error(r));
}
function m(e) {
e.onRun(function() {
return !0 === w ? e.chain() : void t.ajax({
url: "//www.google.com/jsapi",
data: {
key: n.GOOGLE_API_KEY
},
dataType: "script",
timeout: n.AJAX_TIMEOUT
}).done(function() {
google.load("picker", "1", {
callback: function() {
e.chain();
}
}), w = !0;
}).fail(function(t) {
f({
code: t.status,
message: t.statusText
}, e);
});
});
}
var g = !1, v = {}, b = {}, y = !1;
l.addListener("onOfflineChanged", function(e) {
y = e;
});
var x = {
profile: [ "https://www.googleapis.com/auth/userinfo.profile" ],
gdrive: [ "https://www.googleapis.com/auth/drive.install", !0 === s.gdriveFullAccess ? "https://www.googleapis.com/auth/drive" : "https://www.googleapis.com/auth/drive.file" ],
blogger: [ "https://www.googleapis.com/auth/blogger" ],
picasa: [ "https://www.googleapis.com/auth/photos" ]
};
b.getAuthorizationMgr = function(e) {
var t = v[e];
return t || (t = new u(e), v[e] = t), t;
}, b.refreshGdriveToken = function(e) {
var t = new c();
d(t);
var n = v[e];
n && n.setRefreshFlag(), p(t, "gdrive", e), t.enqueue();
}, b.upload = function(e, t, n, i, a, l, u, m) {
var g, v = new c();
d(v), p(v, "gdrive", u), v.onRun(function() {
var l = "-------314159265358979323846", c = "\r\n--" + l + "\r\n";
a = a || s.markdownMimeType;
var d = {
title: n,
mimeType: a
};
t && (d.parents = [ {
kind: "drive#fileLink",
id: t
} ]);
var p = "/upload/drive/v2/files", m = "POST";
e && (p += "/" + e, m = "PUT");
var b = {
"Content-Type": 'multipart/mixed; boundary="' + l + '"'
}, y = r.encodeBase64(i), x = [ c, "Content-Type: application/json\r\n\r\n", JSON.stringify(d), c, "Content-Type: ", a, "\r\n", "Content-Transfer-Encoding: base64\r\n", "\r\n", y, "\r\n---------314159265358979323846--" ].join("");
h(u, function() {
gapi.client.request({
path: p,
method: m,
params: {
uploadType: "multipart"
},
headers: b,
body: x
}).execute(function(t) {
if (t && t.id) return g = t, g.content = i, v.chain();
var n = t.error;
void 0 !== n && void 0 !== e && (404 === n.code ? n = 'File ID "' + e + '" not found on Google Drive.|removePublish' : 412 === n.code && (o.removeItem(u + ".gdrive.lastChangeId"),
n = 'Conflict on file ID "' + e + '". Please restart the synchronization.')), f(n, v);
});
});
}), v.onSuccess(function() {
m(void 0, g);
}), v.onError(function(e) {
m(e);
}), v.enqueue();
}, b.rename = function(e, t, n, i) {
var r, o = new c();
d(o), p(o, "gdrive", n), o.onRun(function() {
var i = {
title: t
};
h(n, function() {
gapi.client.drive.files.patch({
fileId: e,
resource: i
}).execute(function(t) {
if (t && t.id) return r = t, o.chain();
var n = t.error;
void 0 !== n && void 0 !== e && 404 === n.code && (n = 'File ID "' + e + '" not found on Google Drive.|removePublish'),
f(n, o);
});
});
}), o.onSuccess(function() {
i(void 0, r);
}), o.onError(function(e) {
i(e);
}), o.enqueue();
}, b.checkChanges = function(e, t, n) {
var i = [], r = e || 0, o = new c();
d(o), p(o, "gdrive", t), o.onRun(function() {
function e() {
h(t, function() {
var t;
t = gapi.client.drive.changes.list(void 0 === n ? {
startChangeId: r + 1
} : {
pageToken: n
}), t.execute(function(t) {
return t && t.largestChangeId ? (r = t.largestChangeId, n = t.nextPageToken, void 0 !== t.items && (i = i.concat(t.items)),
void 0 !== n ? o.chain(e) : o.chain(), void 0) : f(t.error, o);
});
});
}
var n;
o.chain(e);
}), o.onSuccess(function() {
n(void 0, i, r);
}), o.onError(function(e) {
n(e);
}), o.enqueue();
}, b.downloadMetadata = function(e, i, r, o) {
var a = [], s = new c();
d(s), o || p(s, "gdrive", i), s.onRun(function() {
function r() {
if (0 === e.length) return s.chain();
var o = e[0], l = {}, c = v[i];
c && c.token && (l.Authorization = "Bearer " + c.token.access_token), t.ajax({
url: "https://www.googleapis.com/drive/v2/files/" + o,
headers: l,
data: {
key: n.GOOGLE_API_KEY
},
dataType: "json",
timeout: n.AJAX_TIMEOUT
}).done(function(t) {
a.push(t), e.shift(), s.chain(r);
}).fail(function(e) {
var t = {
code: e.status,
message: e.statusText
};
404 === t.code && (t = 'File ID "' + o + '" not found on Google Drive.'), f(t, s);
});
}
s.chain(r);
}), s.onSuccess(function() {
r(void 0, a);
}), s.onError(function(e) {
r(e);
}), s.enqueue();
}, b.downloadContent = function(e, i, r, o) {
var a = [], s = new c();
s.timeout = n.ASYNC_TASK_LONG_TIMEOUT, d(s), o || p(s, "gdrive", i), s.onRun(function() {
function r() {
if (0 === e.length) return s.chain();
var o = e[0];
a.push(o);
var l;
if ("drive#file" == o.kind ? l = o : "drive#change" == o.kind && (l = o.file), !l) return e.shift(),
s.chain(r);
var c = l.downloadUrl;
0 === l.mimeType.indexOf("application/vnd.google-apps.drive-sdk") && (l.isRealtime = !0,
c = "https://www.googleapis.com/drive/v2/files/" + l.id + "/realtime");
var u = {}, d = v[i];
d && d.token && (u.Authorization = "Bearer " + d.token.access_token), t.ajax({
url: c,
headers: u,
data: {
key: n.GOOGLE_API_KEY
},
dataType: l.isRealtime ? "json" : "text",
timeout: n.AJAX_TIMEOUT
}).done(function(t) {
l.content = l.isRealtime ? t.data.value.content.value : t, e.shift(), s.chain(r);
}).fail(function(e) {
f({
code: e.status,
message: e.statusText
}, s);
});
}
s.chain(r);
}), s.onSuccess(function() {
r(void 0, a);
}), s.onError(function(e) {
r(e);
}), s.enqueue();
}, b.uploadImg = function(e, i, r, o) {
var a, s = new c();
d(s), p(s, "picasa", "google.picasa0"), s.onRun(function() {
var o = {
Slug: e
};
e.match(/.jpe?g$/i) ? o["Content-Type"] = "image/jpeg" : e.match(/.png$/i) ? o["Content-Type"] = "image/png" : e.match(/.gif$/i) && (o["Content-Type"] = "image/gif");
var l = v["google.picasa0"];
l && l.token && (o.Authorization = "Bearer " + l.token.access_token), t.ajax({
url: n.PICASA_IMPORT_IMG_URL + "?" + t.param({
albumId: r
}),
headers: o,
data: i,
processData: !1,
dataType: "xml",
timeout: n.AJAX_TIMEOUT,
type: "POST"
}).done(function(e) {
a = e, s.chain();
}).fail(function(e) {
var t = {
code: e.status,
message: e.statusText
};
200 == t.code && (t.message = e.responseText), f(t, s);
});
}), s.onSuccess(function() {
o(void 0, a);
}), s.onError(function(e) {
o(e);
}), s.enqueue();
};
var w = !1;
return b.picker = function(e, i, o) {
function a() {
void 0 !== s && (s.setVisible(!1), t(".modal-backdrop, .picker").remove());
}
var s, l = [], u = new c();
u.timeout = n.ASYNC_TASK_LONG_TIMEOUT, d(u), "doc" == i || "folder" == i ? p(u, "gdrive", o) : (o = "google.picasa0",
p(u, "picasa", o)), m(u), u.onRun(function() {
var e = v[o], c = new google.picker.PickerBuilder();
c.setAppId(n.GOOGLE_DRIVE_APP_ID);
var d;
"doc" == i ? (d = new google.picker.DocsView(google.picker.ViewId.DOCS), d.setParent("root"),
d.setIncludeFolders(!0), d.setMimeTypes([ "text/x-markdown", "text/plain", "application/octet-stream", "application/vnd.google-apps.drive-sdk." + n.GOOGLE_DRIVE_APP_ID ].join(",")),
c.enableFeature(google.picker.Feature.NAV_HIDDEN), c.enableFeature(google.picker.Feature.MULTISELECT_ENABLED),
c.addView(d), e && e.token && c.setOAuthToken(e.token.access_token)) : "folder" == i ? (d = new google.picker.DocsView(google.picker.ViewId.FOLDERS),
d.setParent("root"), d.setIncludeFolders(!0), d.setSelectFolderEnabled(!0), d.setMimeTypes("application/vnd.google-apps.folder"),
c.enableFeature(google.picker.Feature.NAV_HIDDEN), c.addView(d), e && e.token && c.setOAuthToken(e.token.access_token)) : "img" == i && (d = new google.picker.PhotosView(),
d.setType("flat"), c.addView(d), d = new google.picker.PhotosView(), d.setType("ofuser"),
c.addView(d), c.addView(google.picker.ViewId.PHOTO_UPLOAD), e && e.token && c.setOAuthToken(e.token.access_token)),
c.setCallback(function(e) {
e.action != google.picker.Action.PICKED && e.action != google.picker.Action.CANCEL || (e.action == google.picker.Action.PICKED && (l = e.docs),
a(), u.chain());
}), s = c.build(), t(r.createBackdrop()).on("click.backdrop", function() {
a(), u.chain();
}), s.setVisible(!0);
}), u.onSuccess(function() {
e(void 0, l);
}), u.onError(function(t) {
a(), e(t);
}), u.enqueue();
}, b.uploadBlogger = function(e, i, r, o, a, s, l, u, h) {
var m = new c();
d(m), p(m, "blogger", "google.blogger0"), m.onRun(function() {
function c() {
var e = "https://www.googleapis.com/blogger/v3/blogs/" + i + "/posts/", a = {
kind: "blogger#post",
blog: {
id: i
},
labels: o,
title: l,
content: u
};
s && (a.published = s.toISOString());
var c = "POST";
void 0 !== r && (e += r, a.id = r, c = "PUT"), t.ajax({
url: e,
data: JSON.stringify(a),
headers: h,
type: c,
contentType: "application/json",
dataType: "json",
timeout: n.AJAX_TIMEOUT
}).done(function(e) {
r = e.id, m.chain(d);
}).fail(function(e) {
var t = {
code: e.status,
message: e.statusText
};
404 === t.code && void 0 !== r && (t = "Post " + r + " not found on Blogger.|removePublish"),
f(t, m);
});
}
function d() {
var e = "https://www.googleapis.com/blogger/v3/blogs/" + i + "/posts/" + r;
a ? e += "/revert" : (e += "/publish", s && (e += "?publishDate=" + s.toISOString())),
t.ajax({
url: e,
headers: h,
type: "POST",
dataType: "json",
timeout: n.AJAX_TIMEOUT
}).done(function() {
m.chain();
}).fail(function(e) {
var t = {
code: e.status,
message: e.statusText
};
404 === t.code && (t = "Post " + r + " not found on Blogger.|removePublish"), f(t, m);
});
}
function p() {
return void 0 !== i ? void m.chain(c) : void t.ajax({
url: "https://www.googleapis.com/blogger/v3/blogs/byurl",
data: {
url: e
},
headers: h,
dataType: "json",
timeout: n.AJAX_TIMEOUT
}).done(function(e) {
i = e.id, m.chain(c);
}).fail(function(t) {
var n = {
code: t.status,
message: t.statusText
};
404 === n.code && (n = 'Blog "' + e + '" not found on Blogger.|removePublish'),
f(n, m);
});
}
var h = {}, g = v["google.blogger0"];
g && g.token && (h.Authorization = "Bearer " + g.token.access_token), m.chain(p);
}), m.onSuccess(function() {
h(void 0, i, r);
}), m.onError(function(e) {
h(e);
}), m.enqueue();
}, b.uploadBloggerPage = function(e, i, r, o, a, s, l, u) {
var h = new c();
d(h), p(h, "blogger", "google.blogger0"), h.onRun(function() {
function o() {
var e = "https://www.googleapis.com/blogger/v3/blogs/" + i + "/pages/", o = {
kind: "blogger#page",
blog: {
id: i
},
title: s,
content: l
}, a = "POST";
void 0 !== r && (e += r, o.id = r, a = "PUT"), t.ajax({
url: e,
data: JSON.stringify(o),
headers: c,
type: a,
contentType: "application/json",
dataType: "json",
timeout: n.AJAX_TIMEOUT
}).done(function(e) {
r = e.id, h.chain();
}).fail(function(e) {
var t = {
code: e.status,
message: e.statusText
};
404 === t.code && void 0 !== r && (t = "Page " + r + " not found on Blogger.|removePublish"),
f(t, h);
});
}
function a() {
return void 0 !== i ? void h.chain(o) : void t.ajax({
url: "https://www.googleapis.com/blogger/v3/blogs/byurl",
data: {
url: e
},
headers: c,
dataType: "json",
timeout: n.AJAX_TIMEOUT
}).done(function(e) {
i = e.id, h.chain(o);
}).fail(function(t) {
var n = {
code: t.status,
message: t.statusText
};
404 === n.code && (n = 'Blog "' + e + '" not found on Blogger.|removePublish'),
f(n, h);
});
}
var c = {}, u = v["google.blogger0"];
u && u.token && (c.Authorization = "Bearer " + u.token.access_token), h.chain(a);
}), h.onSuccess(function() {
u(void 0, i, r);
}), h.onError(function(e) {
u(e);
}), h.enqueue();
}, window.delayedFunction = void 0, window.runDelayedFunction = function() {
void 0 !== window.delayedFunction && window.delayedFunction();
}, b;
}), define("text!html/dialogExportGdrive.html", [], function() {
return '\n
\n\n \n
\n
\n This will save " " to your \n Google Drive \n account and keep it synchronized.\n
\n
\n
\n \n Options \n \n
\n
\n Tip: You can move or rename the file afterwards within Google\n Drive.
\n \n
\n \n
\n
\n';
}), define("text!html/dialogAutoSyncGdrive.html", [], function() {
return '\n
\n\n \n
\n
\n AutoSync feature automatically saves all documents to your \n Google Drive \n account and keep them synchronized.\n
\n
\n
\n Note: Removing a local document will not delete the linked file on Google\n Drive.
\n \n
\n \n
\n
\n';
}), define("providers/gdriveProviderBuilder", [ "jquery", "underscore", "constants", "utils", "storage", "logger", "classes/Provider", "settings", "eventMgr", "fileMgr", "editor", "helpers/googleHelper", "text!html/dialogExportGdrive.html", "text!html/dialogAutoSyncGdrive.html" ], function(e, t, n, i, r, o, a, s, l, c, u, d, p, h) {
return function(o, u, f) {
function m(e) {
return "sync." + o + "." + e;
}
function g(e, t, n, r, o) {
o = o || "{}";
var a = {};
return a.provider = y, a.id = e, a.etag = t, a.contentCRC = i.crc32(n), a.titleCRC = i.crc32(r),
a.discussionListCRC = i.crc32(o), a.syncIndex = m(e), !0 === x && (a.content = n,
a.title = r, a.discussionList = o), a;
}
function v(e, n) {
d.downloadMetadata(e, b, function(e, i) {
return e ? n && n(e) : void d.downloadContent(i, b, function(e, i) {
if (e) return n && n(e);
var r, o = [];
t.each(i, function(e) {
var t, n = y.parseContent(e.content);
if (e.isRealtime) l.onError("Real time synchronization is not supported anymore. Please use standard synchronization."); else {
var i = g(e.id, e.etag, n.content, e.title, n.discussionListJSON);
t = {}, t[i.syncIndex] = i;
}
r = c.createFile(e.title, n.content, n.discussionListJSON, t), o.push(r);
}), void 0 !== r && (l.onSyncImportSuccess(o, y), c.selectFile(r)), n && n();
});
});
}
var b = "google.gdrive" + f, y = new a(o, u);
y.defaultPublishFormat = "template", y.exportPreferencesInputIds = [ o + "-parentid" ],
y.getSyncLocationLink = y.getPublishLocationLink = function(e) {
var t = d.getAuthorizationMgr(b).getAuthUser();
return [ "https://docs.google.com/file/d/", e.id, "/edit", t ? "?authuser=" + t : "" ].join("");
};
var x = "merge" == s.conflictMode;
return y.importFiles = function() {
d.picker(function(e, n) {
if (!e && 0 !== n.length) {
var i = [];
t.each(n, function(e) {
var t = m(e.id), n = c.getFileFromSyncIndex(t);
return void 0 !== n ? l.onError('"' + n.title + '" is already in your local documents.') : void i.push(e.id);
}), v(i);
}
}, "doc", b);
}, y.exportFile = function(e, t, n, r, a, s) {
var u = i.getInputTextValue("#input-sync-export-" + o + "-fileid");
if (u) {
var p = m(u), h = c.getFileFromSyncIndex(p);
if (void 0 !== h) return l.onError('File ID is already synchronized with "' + h.title + '".'),
s(!0);
}
var f = i.getInputTextValue("#input-sync-export-" + o + "-parentid"), v = y.serializeContent(n, r);
d.upload(u, f, t, v, void 0, void 0, b, function(e, i) {
if (e) return s(e);
var o = g(i.id, i.etag, n, t, r);
s(void 0, o);
});
}, y.syncUp = function(e, t, n, i, r, o, a, s, u) {
if (s.contentCRC == t && s.titleCRC == i && s.discussionListCRC == o) return u(void 0, !1);
if (s.isRealtime) {
var p = c.getFileFromSyncIndex(s.syncIndex);
return p.removeSyncLocation(s), l.onSyncRemoved(p, s), l.onError("Real time synchronization is not supported anymore. Please use standard synchronization.");
}
var h = y.serializeContent(e, r);
d.upload(s.id, void 0, n, h, void 0, s.etag, b, function(a, l) {
return a ? u(a, !0) : (s.etag = l.etag, delete s.isRealtime, !0 === x && (s.content = e,
s.title = n, s.discussionList = r), s.contentCRC = t, s.titleCRC = i, s.discussionListCRC = o,
u(void 0, !0), void 0);
});
}, y.syncDown = function(e) {
var n = parseInt(r[b + ".gdrive.lastChangeId"], 10);
d.checkChanges(n, b, function(n, o, a) {
if (n) return e(n);
var s = [];
t.each(o, function(e) {
var t = m(e.fileId), n = c.getFileFromSyncIndex(t), i = n && n.syncLocations[t];
if (i) {
if (e.fileDesc = n, e.syncAttributes = i, !0 === e.deleted) return void s.push(e);
i.etag != e.file.etag && s.push(e);
}
}), d.downloadContent(s, b, function(t, n) {
function o() {
if (0 === n.length) return r[b + ".gdrive.lastChangeId"] = a, e();
var t = n.pop(), s = t.fileDesc, c = t.syncAttributes;
if (!0 === t.deleted) return l.onError('"' + s.title + '" has been removed from ' + u + "."),
s.removeSyncLocation(c), l.onSyncRemoved(s, c);
var d = t.file, p = y.parseContent(d.content), h = p.content, f = d.title, m = p.discussionListJSON, g = p.discussionList, v = y.syncMerge(s, c, h, f, g, m);
c.etag = d.etag, !0 === x && (c.content = h, c.title = f, c.discussionList = m),
c.contentCRC = v.contentCRC, c.titleCRC = v.titleCRC, c.discussionListCRC = v.discussionListCRC,
i.storeAttributes(c), setTimeout(o, 5);
}
return t ? void e(t) : void setTimeout(o, 5);
});
});
}, y.publish = function(e, t, n, i, r) {
var o = "markdown" != e.format ? "text/html" : void 0;
d.upload(e.id, void 0, e.fileName || n, i, o, void 0, b, function(t, n) {
return t ? void r(t) : (e.id = n.id, void r());
});
}, y.newPublishAttributes = function(e) {
var t = {};
return t.id = i.getInputTextValue("#input-publish-" + o + "-fileid"), t.fileName = i.getInputTextValue("#input-publish-" + o + "-filename"),
e.isPropagationStopped() ? void 0 : t;
}, y.setAutosyncDialogConfig = function() {
var e = y.autosyncConfig;
i.setInputRadio("radio-autosync-" + o + "-mode", e.mode || "off"), i.setInputValue("#input-autosync-" + o + "-parentid", e.parentId);
}, y.getAutosyncDialogConfig = function() {
var e = {};
return e.mode = i.getInputRadio("radio-autosync-" + o + "-mode"), e.parentId = i.getInputTextValue("#input-autosync-" + o + "-parentid"),
e;
}, y.autosyncFile = function(e, t, n, i, r) {
var o = i.parentId;
d.upload(void 0, o, e, t, void 0, void 0, b, function(i, o) {
if (i) return void r(i);
var a = g(o.id, o.etag, t, e, n);
r(void 0, a);
});
}, y.isPublishEnabled = s.gdriveMultiAccount > f, l.addListener("onReady", function() {
e(".submenu-sync-" + o).toggle(s.gdriveMultiAccount > f);
var a = document.querySelector(".modal-upload-" + o);
a && (a.innerHTML = t.template(p, {
providerId: o,
providerName: u
}));
var y = document.querySelector(".modal-autosync-" + o);
if (y && (y.innerHTML = t.template(h, {
providerId: o,
providerName: u
})), e(".action-export-" + o + "-choose-folder").click(function() {
d.picker(function(t, n) {
t || 0 === n.length || (e(".modal-upload-" + o).modal(), i.setInputValue("#input-sync-export-" + o + "-parentid", n[0].id));
}, "folder", b);
}), e(".action-autosync-" + o + "-choose-folder").click(function() {
d.picker(function(t, n) {
t || 0 === n.length || (e(".modal-autosync-" + o).modal(), i.setInputValue("#input-autosync-" + o + "-parentid", n[0].id));
}, "folder", b);
}), e(".action-remove-google-drive-state").click(function() {
r.removeItem("gdrive.state");
}), !(f >= s.gdriveMultiAccount)) {
var x = i.retrieveIgnoreError("gdrive.state"), w = r[b + ".userId"];
if (void 0 !== x) {
if (w && x.userId != w) return void (f === s.gdriveMultiAccount - 1 && (3 === s.gdriveMultiAccount ? (l.onError("None of your 3 Google Drive accounts is able to perform this request."),
r.removeItem("gdrive.state")) : e(".modal-add-google-drive-account").modal()));
if (r.removeItem("gdrive.state"), "create" == x.action) d.upload(void 0, x.folderId, n.GDRIVE_DEFAULT_FILE_TITLE, s.defaultContent, void 0, void 0, b, i.lockUI(function(e, t) {
if (!e) {
var n = g(t.id, t.etag, t.content, t.title), i = {};
i[n.syncIndex] = n;
var r = c.createFile(t.title, t.content, void 0, i);
c.selectFile(r), l.onMessage('"' + t.title + '" created successfully on ' + u + ".");
}
})); else if ("open" == x.action) {
var S = [];
t.each(x.ids, function(e) {
var t = m(e), n = c.getFileFromSyncIndex(t);
void 0 !== n ? n !== c.currentFile && c.selectFile(n) : S.push(e);
}), v(S, i.lockUI());
}
}
}
}), y;
};
}), define("providers/gdriveProvider", [ "providers/gdriveProviderBuilder" ], function(e) {
return e("gdrive", "Google Drive", 0);
}), define("providers/gdrivesecProvider", [ "providers/gdriveProviderBuilder" ], function(e) {
return e("gdrivesec", "Google Drive (2nd account)", 1);
}), define("providers/gdriveterProvider", [ "providers/gdriveProviderBuilder" ], function(e) {
return e("gdriveter", "Google Drive (3rd account)", 2);
}), define("synchronizer", [ "jquery", "underscore", "utils", "storage", "eventMgr", "fileSystem", "fileMgr", "classes/Provider", "providers/dropboxProvider", "providers/couchdbProvider", "providers/gdriveProvider", "providers/gdrivesecProvider", "providers/gdriveterProvider" ], function(e, t, n, i, r, o, a, s) {
function l(e) {
function i() {
function o() {
if (0 === s.length) return i();
var t = s.pop();
t.provider.syncUp(c, u, d, p, h, f, m, t, function(i, r) {
return !0 === r && (g = !0), i ? e(i) : (r && n.storeAttributes(t), void o());
});
}
if (0 === r.length) return l(e);
var a = r.pop(), s = t.values(a.syncLocations);
if (0 === s.length) return i();
var c = a.content, u = n.crc32(c), d = a.title, p = n.crc32(d), h = a.discussionListJSON, f = n.crc32(h), m = a.frontMatter;
o();
}
var r = [];
!0 === g ? (g = !1, r = t.values(o), i()) : e();
}
function c(e) {
function n() {
if (0 === i.length) return e();
var t = i.pop();
return f.hasSync(t) ? void t.syncDown(function(t) {
return t ? e(t) : void n();
}) : n();
}
var i = t.values(m);
n();
}
function u(e) {
function n() {
function o() {
if (0 === s.length) return n();
var t = s.pop();
t.autosyncFile(a.title, a.content, a.discussionListJSON, t.autosyncConfig, function(t, n) {
return t ? e(t) : (a.addSyncLocation(n), r.onSyncExportSuccess(a, n), o(), void 0);
});
}
if (0 === i.length) return e();
var a = i.pop(), s = t.filter(m, function(e) {
return "all" == e.autosyncConfig.mode;
});
o();
}
var i = t.filter(o, function(e) {
return 0 === t.size(e.syncLocations);
});
n();
}
function d(e, i) {
n.resetModalInputs();
var r = n.retrieveIgnoreError(e.providerId + "." + i + "Preferences");
r && t.each(e[i + "PreferencesInputIds"], function(e) {
var o = r[e], a = n.setInputValue;
t.isBoolean(o) && (a = n.setInputChecked), a("#input-sync-" + i + "-" + e, o);
});
}
function p(t) {
d(t, "import"), e(".modal-download-" + t.providerId).modal();
}
function h(t) {
d(t, "export"), e(".modal-upload-" + t.providerId).modal();
}
var f = {}, m = t.chain(arguments).map(function(e) {
return e instanceof s && [ e.providerId, e ];
}).compact().object().value();
!function() {
var e = {};
t.each(o, function(e) {
n.retrieveIndexArray(e.fileIndex + ".sync").forEach(function(t) {
try {
var o = JSON.parse(i[t]);
o.syncIndex = t;
var a = m[o.provider];
if (!a) throw new Error("Invalid provider ID: " + o.provider);
o.provider = a, e.syncLocations[t] = o, s[t] = o;
} catch (s) {
r.onError(s), n.removeIndexFromArray(e.fileIndex + ".sync", t);
}
});
}), Object.keys(i).forEach(function(t) {
var n = t.match(/sync\.\S+/);
n && !e.hasOwnProperty(n[0]) && i.removeItem(t);
});
}(), t.each(m, function(e) {
e.autosyncConfig = n.retrieveIgnoreError(e.providerId + ".autosyncConfig") || {};
}), f.hasSync = function(e) {
return t.some(o, function(n) {
return t.some(n.syncLocations, function(t) {
return void 0 === e || t.provider === e;
});
});
};
var g = !1, v = !1;
r.addListener("onOfflineChanged", function(e) {
v = e;
});
var b = !1;
return f.sync = function() {
function e(e) {
return void 0 !== e && (b = !1, r.onSyncRunning(!1), !0);
}
return !0 !== b && !0 !== v && (b = !0, r.onSyncRunning(!0), g = !0, u(function(t) {
e(t) || c(function(t) {
e(t) || l(function(t) {
e(t) || (b = !1, r.onSyncRunning(!1), r.onSyncSuccess());
});
});
}), !0);
}, r.addListener("onFileCreated", function(e) {
0 === t.size(e.syncLocations) && t.each(m, function(t) {
"new" == t.autosyncConfig.mode && t.autosyncFile(e.title, e.content, e.discussionListJSON, t.autosyncConfig, function(t, n) {
t || (e.addSyncLocation(n), r.onSyncExportSuccess(e, n));
});
});
}), r.addListener("onReady", function() {
t.each(m, function(o) {
e(".action-sync-import-" + o.providerId).click(function(e) {
o.importFiles(e);
var n = {};
t.each(o.importPreferencesInputIds, function(e) {
var t = document.getElementById("input-sync-import-" + e);
n[e] = "checkbox" == t.type ? t.checked : t.value;
}), i[o.providerId + ".importPreferences"] = JSON.stringify(n);
}), e(".action-sync-import-dialog-" + o.providerId).click(function() {
p(o);
}), e(".action-sync-export-dialog-" + o.providerId).click(function() {
h(o);
}), e(".action-autosync-dialog-" + o.providerId).click(function() {
n.resetModalInputs(), o.setAutosyncDialogConfig(o), e(".modal-autosync-" + o.providerId).modal();
}), e(".action-sync-export-" + o.providerId).click(function(e) {
var n = a.currentFile;
o.exportFile(e, n.title, n.content, n.discussionListJSON, n.frontMatter, function(e, t) {
e || (n.addSyncLocation(t), r.onSyncExportSuccess(n, t));
});
var s = {};
t.each(o.exportPreferencesInputIds, function(e) {
var t = document.getElementById("input-sync-export-" + e);
s[e] = "checkbox" == t.type ? t.checked : t.value;
}), i[o.providerId + ".exportPreferences"] = JSON.stringify(s);
}), e(".action-autosync-" + o.providerId).click(function(e) {
var t = o.getAutosyncDialogConfig(e);
void 0 !== t && (i[o.providerId + ".autosyncConfig"] = JSON.stringify(t), o.autosyncConfig = t);
});
});
}), r.onSynchronizerCreated(f), f;
}), define("providers/bloggerProvider", [ "underscore", "utils", "classes/Provider", "helpers/googleHelper" ], function(e, t, n, i) {
var r = new n("blogger", "Blogger");
return r.defaultPublishFormat = "html", r.publishPreferencesInputIds = [ "blogger-url" ],
r.getPublishLocationLink = function(e) {
return [ "https://www.blogger.com/blogger.g?blogID=", e.blogId, "#editor/target=post;postID=", e.postId ].join("");
}, r.publish = function(t, n, r, o, a) {
var s = t.labelList || [];
n && void 0 !== n.tags && (s = n.tags), e.isString(s) && (s = e.compact(s.split(/[\s,]/)));
var l = n && !1 === n.published, c = n && n.date;
i.uploadBlogger(t.blogUrl, t.blogId, t.postId, s, l, c, r, o, function(e, n, i) {
return e ? void a(e) : (t.blogId = n, t.postId = i, a(), void 0);
});
}, r.newPublishAttributes = function(e) {
var n = {}, i = t.getInputTextValue("#input-publish-blogger-url", e);
return void 0 !== i && (n.blogUrl = t.checkUrl(i)), n.postId = t.getInputTextValue("#input-publish-postid"),
e.isPropagationStopped() ? void 0 : n;
}, r;
}), define("providers/bloggerPageProvider", [ "underscore", "utils", "classes/Provider", "helpers/googleHelper" ], function(e, t, n, i) {
var r = new n("bloggerpage", "Blogger Page");
return r.defaultPublishFormat = "html", r.publishPreferencesInputIds = [ "blogger-url" ],
r.getPublishLocationLink = function(e) {
return [ "https://www.blogger.com/blogger.g?blogID=", e.blogId, "#editor/target=page;pageID=", e.pageId ].join("");
}, r.publish = function(e, t, n, r, o) {
var a = t && !1 === t.published, s = t && t.date;
i.uploadBloggerPage(e.blogUrl, e.blogId, e.pageId, a, s, n, r, function(t, n, i) {
return t ? void o(t) : (e.blogId = n, e.pageId = i, o(), void 0);
});
}, r.newPublishAttributes = function(e) {
var n = {}, i = t.getInputTextValue("#input-publish-blogger-url", e);
return void 0 !== i && (n.blogUrl = t.checkUrl(i)), n.pageId = t.getInputTextValue("#input-publish-pageid"),
e.isPropagationStopped() ? void 0 : n;
}, r;
}), define("helpers/githubHelper", [ "jquery", "constants", "core", "utils", "storage", "logger", "settings", "eventMgr", "classes/AsyncTask" ], function(e, t, n, i, r, o, a, s, l) {
function c(n) {
n.onRun(function() {
return !0 === m ? (p = !1, void n.error(new Error("Operation not available in offline mode.|stopPublish"))) : !0 === p ? void n.chain() : void e.ajax({
url: "libs/github.js",
dataType: "script",
timeout: t.AJAX_TIMEOUT
}).done(function() {
p = !0, n.chain();
}).fail(function(e) {
d({
error: e.status,
message: e.statusText
}, n);
});
});
}
function u(n) {
var o, s;
n.onRun(function() {
function l() {
i.redirectConfirm("You are being redirected to GitHub authorization page.", function() {
n.chain(c);
}, function() {
n.error(new Error("Operation canceled."));
});
}
function c() {
r.removeItem("githubCode");
var e = a.githubFullAccess ? "repo,gist" : "public_repo,gist";
o = i.popupWindow("html/github-oauth-client.html?client_id=" + t.GITHUB_CLIENT_ID + "&scope=" + e, "stackedit-github-oauth", 960, 600),
o.focus(), s = setInterval(function() {
if (!0 === o.closed) {
if (clearInterval(s), o = void 0, s = void 0, void 0 === (f = r.githubCode)) return void n.error(new Error(p));
r.removeItem("githubCode"), n.chain(u);
}
}, 500);
}
function u() {
e.getJSON(t.GATEKEEPER_URL + "authenticate/" + f, function(e) {
void 0 !== e.token ? (d = e.token, r.githubToken = d, h = new Github({
token: d,
auth: "oauth"
}), n.chain()) : n.error(new Error(p));
});
}
if (void 0 !== h) return void n.chain();
var d = r.githubToken;
if (void 0 !== d) return h = new Github({
token: d,
auth: "oauth"
}), void n.chain();
var p = "Failed to retrieve a token from GitHub.";
n.timeout = t.ASYNC_TASK_LONG_TIMEOUT;
var f;
n.chain(l);
}), n.onError(function() {
void 0 !== s && clearInterval(s), void 0 !== o && o.close();
});
}
function d(e, t) {
var i;
if (e) if (o.error(e), "string" == typeof e) i = e; else {
if (i = "Could not publish on GitHub.", 401 === e.error || 403 === e.error) return h = void 0,
r.removeItem("githubToken"), i = "Access to GitHub account is not authorized.",
void t.retry(new Error(i), 1);
e.error <= 0 && (p = !1, h = void 0, n.setOffline(), i = "|stopPublish");
}
t.error(new Error(i));
}
var p, h, f = {}, m = !1;
return s.addListener("onOfflineChanged", function(e) {
m = e;
}), f.upload = function(e, t, n, i, r, o, a) {
var s = new l();
c(s), u(s), s.onRun(function() {
function a() {
h.getUser().show(void 0, function(e, n) {
return e ? void d(e, s) : (t = n.login, void s.chain(l));
});
}
function l() {
h.getRepo(t, e).write(n, i, r, o, function(e) {
return e ? void d(e, s) : void s.chain();
});
}
s.chain(t ? l : a);
}), s.onSuccess(function() {
a(void 0, t);
}), s.onError(function(e) {
a(e);
}), s.enqueue();
}, f.uploadGist = function(e, t, n, i, r, o) {
var a = new l();
c(a), u(a), a.onRun(function() {
var o = h.getGist(e), s = {};
s[t] = {
content: r
};
var l = o.update;
void 0 === e && (l = o.create), l({
description: i,
"public": n,
files: s
}, function(t, n) {
return t ? (404 === t.error && void 0 !== e && (t = "Gist " + e + " not found on GitHub.|removePublish"),
void d(t, a)) : (e = n.id, void a.chain());
});
}), a.onSuccess(function() {
o(void 0, e);
}), a.onError(function(e) {
o(e);
}), a.enqueue();
}, f.downloadGist = function(e, t, n) {
var i = new l(!0);
c(i);
var r, o;
i.onRun(function() {
new Github({}).getGist(e).read(function(n, a) {
if (n) return void i.error(new Error("Error trying to access Gist " + e + "."));
r = a.description;
var s = a.files[t];
return void 0 === s ? void i.error(new Error("Gist " + e + ' does not contain "' + t + '".')) : (o = s.content,
void i.chain());
});
}), i.onSuccess(function() {
n(void 0, r, o);
}), i.onError(function(e) {
n(e);
}), i.enqueue();
}, f;
}), define("providers/gistProvider", [ "utils", "classes/Provider", "helpers/githubHelper" ], function(e, t, n) {
var i = new t("gist", "Gist");
return i.publishPreferencesInputIds = [ "gist-public" ], i.viewerSharingAttributes = [ "gistId", "filename" ],
i.getPublishLocationLink = function(e) {
return [ "https://gist.github.com/", e.gistId ].join("");
}, i.publish = function(e, t, i, r, o) {
n.uploadGist(e.gistId, e.filename, e.isPublic, i, r, function(t, n) {
return t ? void o(t) : (e.gistId = n, void o());
});
}, i.newPublishAttributes = function(t) {
var n = {};
return n.gistId = e.getInputTextValue("#input-publish-gist-id"), n.filename = e.getInputTextValue("#input-publish-filename", t),
n.isPublic = e.getInputChecked("#input-publish-gist-public"), t.isPropagationStopped() ? void 0 : n;
}, i.importPublic = function(e, t) {
n.downloadGist(e.gistId, e.filename, t);
}, i;
}), define("providers/githubProvider", [ "utils", "classes/Provider", "settings", "helpers/githubHelper" ], function(e, t, n, i) {
var r = new t("github", "GitHub");
return r.publishPreferencesInputIds = [ "github-repo", "github-branch" ], r.getPublishLocationLink = function(e) {
return [ "https://github.com", e.username, e.repository, "blob", e.branch ].concat(e.path.split("/").map(encodeURIComponent)).join("/");
}, r.publish = function(e, t, r, o, a) {
var s = n.commitMsg;
i.upload(e.repository, e.username, e.branch, e.path, o, s, function(t, n) {
e.username = n, a(t);
});
}, r.newPublishAttributes = function(t) {
var n = {};
if (n.repository = e.getInputTextValue("#input-publish-github-repo", t), n.branch = e.getInputTextValue("#input-publish-github-branch", t),
n.path = e.getInputTextValue("#input-publish-file-path", t), !t.isPropagationStopped()) {
var i = n.repository.match(/[\/:]?([^\/:]+)\/([^\/]+?)(?:\.git)?$/);
return i && (n.repository = i[2], n.username = i[1]), n;
}
}, r;
}), define("helpers/sshHelper", [ "jquery", "constants", "core", "logger", "eventMgr", "settings", "classes/AsyncTask" ], function(e, t, n, i, r, o, a) {
function s(e) {
e.onRun(function() {
return !0 === u ? e.error(new Error("Operation not available in offline mode.|stopPublish")) : void e.chain();
});
}
function l(e, t) {
var r;
e && (i.error(e), "string" == typeof e ? r = "SSH error: " + e + "." : (r = "Could not publish on SSH server.",
e.code <= 0 && (n.setOffline(), r = "|stopPublish"))), t.error(new Error(r));
}
var c = {}, u = !1;
return r.addListener("onOfflineChanged", function(e) {
u = e;
}), c.upload = function(n, i, r, o, c, u, d, p) {
var h = new a();
s(h), h.onRun(function() {
var a = t.SSH_PUBLISH_URL + "?" + e.param({
host: n,
port: i,
username: r,
password: o,
path: c,
title: u
});
e.ajax({
url: a,
data: d,
type: "POST",
timeout: t.AJAX_TIMEOUT
}).done(function(e) {
return void 0 === e.error ? h.chain() : void l(e.error, h);
}).fail(function(e) {
l({
code: e.status,
message: e.statusText
}, h);
});
}), h.onSuccess(function() {
p();
}), h.onError(function(e) {
p(e);
}), h.enqueue();
}, c;
}), define("providers/sshProvider", [ "utils", "classes/Provider", "helpers/sshHelper" ], function(e, t, n) {
var i = new t("ssh", "SSH server");
return i.publishPreferencesInputIds = [ "ssh-host", "ssh-port", "ssh-username", "ssh-password" ],
i.publish = function(e, t, i, r, o) {
n.upload(e.host, e.port, e.username, e.password, e.path, i, r, o);
}, i.newPublishAttributes = function(t) {
var n = {};
return n.host = e.getInputTextValue("#input-publish-ssh-host", t, /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),
n.port = e.getInputIntValue("#input-publish-ssh-port", void 0, 0), n.username = e.getInputTextValue("#input-publish-ssh-username", t),
n.password = e.getInputTextValue("#input-publish-ssh-password", t), n.path = e.getInputTextValue("#input-publish-file-path", t),
t.isPropagationStopped() ? void 0 : n;
}, i;
}), define("helpers/tumblrHelper", [ "jquery", "constants", "core", "utils", "storage", "logger", "eventMgr", "classes/AsyncTask" ], function(e, t, n, i, r, o, a, s) {
function l(e) {
e.onRun(function() {
return !0 === h ? void e.error(new Error("Operation not available in offline mode.|stopPublish")) : void e.chain();
});
}
function c(n) {
var o, a;
n.onRun(function() {
function s() {
e.getJSON(t.TUMBLR_PROXY_URL + "request_token", function(e) {
void 0 !== e.oauth_token ? (f = e, n.chain(l)) : n.error(new Error(h));
});
}
function l() {
i.redirectConfirm("You are being redirected to Tumblr authorization page.", function() {
n.chain(c);
}, function() {
n.error(new Error("Operation canceled."));
});
}
function c() {
r.removeItem("tumblrVerifier"), o = i.popupWindow("html/tumblr-oauth-client.html?oauth_token=" + f.oauth_token, "stackedit-tumblr-oauth", 800, 600),
o.focus(), a = setInterval(function() {
if (!0 === o.closed) {
if (clearInterval(a), o = void 0, a = void 0, f.oauth_verifier = r.tumblrVerifier,
void 0 === f.oauth_verifier) return void n.error(new Error(h));
r.removeItem("tumblrVerifier"), n.chain(u);
}
}, 500);
}
function u() {
e.getJSON(t.TUMBLR_PROXY_URL + "access_token", f, function(e) {
void 0 !== e.access_token && void 0 !== e.access_token_secret ? (r.tumblrOauthParams = JSON.stringify(e),
d = e, n.chain()) : n.error(new Error(h));
});
}
if (void 0 !== d) return void n.chain();
var p = r.tumblrOauthParams;
if (void 0 !== p) return d = JSON.parse(p), void n.chain();
var h = "Failed to retrieve a token from Tumblr.";
n.timeout = t.ASYNC_TASK_LONG_TIMEOUT;
var f;
n.chain(s);
}), n.onError(function() {
void 0 !== a && clearInterval(a), void 0 !== o && o.close();
});
}
function u(e, t) {
var i;
if (e) if (o.error(e), "string" == typeof e) i = e; else {
if (i = "Could not publish on Tumblr.", 401 === e.code || 403 === e.code) return d = void 0,
r.removeItem("tumblrOauthParams"), i = "Access to Tumblr account is not authorized.",
void t.retry(new Error(i), 1);
e.code <= 0 && (n.setOffline(), i = "|stopPublish");
}
t.error(new Error(i));
}
var d, p = {}, h = !1;
return a.addListener("onOfflineChanged", function(e) {
h = e;
}), p.upload = function(n, i, r, o, a, p, h, f, m) {
var g = new s();
l(g), c(g), g.onRun(function() {
var s = e.extend({
blog_hostname: n,
post_id: i,
tags: r,
format: o,
state: a,
date: p,
title: h,
content: f
}, d);
e.ajax({
url: t.TUMBLR_PROXY_URL + "post",
data: s,
type: "POST",
dataType: "json",
timeout: t.AJAX_TIMEOUT
}).done(function(e) {
i = e.id, g.chain();
}).fail(function(e) {
var t = {
code: e.status,
message: e.statusText
};
404 === t.code && void 0 !== i && (t = "Post " + i + " not found on Tumblr.|removePublish"),
u(t, g);
});
}), g.onSuccess(function() {
m(void 0, i);
}), g.onError(function(e) {
m(e);
}), g.enqueue();
}, p;
}), define("providers/tumblrProvider", [ "underscore", "settings", "utils", "classes/Provider", "helpers/tumblrHelper" ], function(e, t, n, i, r) {
var o = new i("tumblr", "Tumblr");
return o.publishPreferencesInputIds = [ "tumblr-hostname" ], o.getPublishLocationLink = function(e) {
return [ "http://", e.blogHostname, "/post/", e.postId ].join("");
}, o.publish = function(n, i, o, a, s) {
var l = n.tags || [];
i && void 0 !== i.tags && (l = i.tags), e.isString(l) && (l = e.compact(l.split(/[\s,]/)));
var c = function() {
return "html" == n.format ? "html" : "template" == n.format && -1 !== (n.customTmpl || t.template).indexOf("documentHTML") ? "html" : "markdown";
}(), u = i && !1 === i.published ? "draft" : "published", d = i && i.date;
r.upload(n.blogHostname, n.postId, l.join(","), c, u, d, o, a, function(e, t) {
return e ? void s(e) : (n.postId = t, void s());
});
}, o.newPublishAttributes = function(e) {
var t = {};
return t.blogHostname = n.getInputTextValue("#input-publish-tumblr-hostname", e, /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),
t.postId = n.getInputTextValue("#input-publish-postid"), e.isPropagationStopped() ? void 0 : t;
}, o;
}), define("helpers/wordpressHelper", [ "jquery", "constants", "core", "utils", "storage", "logger", "eventMgr", "classes/AsyncTask" ], function(e, t, n, i, r, o, a, s) {
function l(e) {
e.onRun(function() {
return !0 === h ? e.error(new Error("Operation not available in offline mode.|stopPublish")) : void e.chain();
});
}
function c(n) {
var o, a;
n.onRun(function() {
function s() {
i.redirectConfirm("You are being redirected to WordPress authorization page.", function() {
n.chain(l);
}, function() {
n.error(new Error("Operation canceled."));
});
}
function l() {
r.removeItem("wordpressCode"), o = i.popupWindow("html/wordpress-oauth-client.html?client_id=" + t.WORDPRESS_CLIENT_ID, "stackedit-wordpress-oauth", 960, 600),
o.focus(), a = setInterval(function() {
if (!0 === o.closed) {
if (clearInterval(a), o = void 0, a = void 0, void 0 === (p = r.wordpressCode)) return n.error(new Error(u));
r.removeItem("wordpressCode"), n.chain(c);
}
}, 500);
}
function c() {
e.getJSON(t.WORDPRESS_PROXY_URL + "authenticate/" + p, function(e) {
void 0 !== e.token ? (d = e.token, r.wordpressToken = d, n.chain()) : n.error(new Error(u));
});
}
if (void 0 !== (d = r.wordpressToken)) return n.chain();
var u = "Failed to retrieve a token from Wordpress.";
n.timeout = t.ASYNC_TASK_LONG_TIMEOUT;
var p;
n.chain(s);
}), n.onError(function() {
void 0 !== a && clearInterval(a), void 0 !== o && o.close();
});
}
function u(e, t) {
var i;
if (e) if (o.error(e), "string" == typeof e) i = e; else {
if (i = "Could not publish on WordPress.", 400 === e.code && "invalid_token" == e.message || 401 === e.code || 403 === e.code) return r.removeItem("wordpressToken"),
i = "Access to WordPress account is not authorized.", t.retry(new Error(i), 1);
e.code <= 0 && (n.setOffline(), i = "|stopPublish");
}
t.error(new Error(i));
}
var d, p = {}, h = !1;
return a.addListener("onOfflineChanged", function(e) {
h = e;
}), p.upload = function(n, i, r, o, a, p, h, f) {
var m = new s();
l(m), c(m);
var g;
m.onRun(function() {
var s = t.WORDPRESS_PROXY_URL + "post", l = {
token: d,
site: n,
postId: i,
tags: r,
status: o,
date: a,
title: p,
content: h
};
e.ajax({
url: s,
data: l,
type: "POST",
dataType: "json",
timeout: t.AJAX_TIMEOUT
}).done(function(e) {
if (e.body.ID) return i = e.body.ID, g = e.body.site_ID, m.chain();
var t = {
code: e.code,
message: e.body.error
};
404 === t.code && ("unknown_blog" == t.message ? t = 'Site "' + n + '" not found on WordPress.|removePublish' : "unknown_post" == t.message && (t = "Post " + i + " not found on WordPress.|removePublish")),
u(t, m);
}).fail(function(e) {
u({
code: e.status,
message: e.statusText
}, m);
});
}), m.onSuccess(function() {
f(void 0, g, i);
}), m.onError(function(e) {
f(e);
}), m.enqueue();
}, p;
}), define("providers/wordpressProvider", [ "underscore", "utils", "classes/Provider", "helpers/wordpressHelper" ], function(e, t, n, i) {
var r = new n("wordpress", "WordPress");
return r.defaultPublishFormat = "html", r.publishPreferencesInputIds = [ "wordpress-site" ],
r.getPublishLocationLink = function(e) {
return e.siteId && [ "https://wordpress.com/post", e.siteId, e.postId ].join("/");
}, r.publish = function(t, n, r, o, a) {
var s = t.tags || [];
n && void 0 !== n.tags && (s = n.tags);
var l = n && !1 === n.published ? "draft" : "publish", c = n && n.date;
e.isString(s) && (s = e.compact(s.split(/[\s,]/))), i.upload(t.site, t.postId, s.join(","), l, c, r, o, function(e, n, i) {
return e ? a(e) : (t.siteId = n, t.postId = i, a(), void 0);
});
}, r.newPublishAttributes = function(e) {
var n = {};
return n.site = t.getInputTextValue("#input-publish-wordpress-site", e, /^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/),
n.postId = t.getInputTextValue("#input-publish-postid"), e.isPropagationStopped() ? void 0 : n;
}, r;
}), define("publisher", [ "jquery", "underscore", "constants", "utils", "storage", "settings", "eventMgr", "fileSystem", "fileMgr", "monetizejs", "classes/Provider", "classes/AsyncTask", "providers/bloggerProvider", "providers/bloggerPageProvider", "providers/dropboxProvider", "providers/gistProvider", "providers/githubProvider", "providers/gdriveProvider", "providers/gdrivesecProvider", "providers/gdriveterProvider", "providers/sshProvider", "providers/tumblrProvider", "providers/wordpressProvider" ], function(e, t, n, i, r, o, a, s, l, c, u, d) {
function p(e, t, n) {
return void 0 === t.format && (t.format = i.getInputRadio("radio-publish-format"),
"template" == t.format && i.getInputChecked("#checkbox-publish-custom-template") && (t.customTmpl = i.getInputValue("#textarea-publish-custom-template"))),
"markdown" == t.format ? e.content : "html" == t.format ? n.withoutComments : v.applyTemplate(e, t, n);
}
function h(e, t) {
if (0 === S.length) return void e(t);
var n = S.pop(), i = p(y, n, x), r = (y.frontMatter || {}).title || y.title;
n.provider.publish(n, y.frontMatter, r, i, function(i) {
if (void 0 !== i) {
var r = i.toString();
if (-1 !== r.indexOf("|removePublish") && (y.removePublishLocation(n), a.onPublishRemoved(y, n)),
-1 !== r.indexOf("|stopPublish")) return void e(i);
}
h(e, t || i);
});
}
function f(e, n) {
var o;
do o = "publish." + i.id(); while (t.has(r, o));
n.publishIndex = o, e.addPublishLocation(n), a.onNewPublishSuccess(e, n);
}
function m(n) {
var r = n.defaultPublishFormat || "markdown";
k = n, e(".publish-provider-name").text(n.providerName), e('.modal-publish [class*=" modal-publish-"]').hide().filter(".modal-publish-" + n.providerId).show(),
i.resetModalInputs(), i.setInputRadio("radio-publish-format", r), i.setInputChecked("#checkbox-publish-custom-template", !1),
i.setInputValue("#textarea-publish-custom-template", o.template);
var a = i.retrieveIgnoreError(n.providerId + ".publishPreferences");
a && (t.each(n.publishPreferencesInputIds, function(e) {
var n = a[e];
t.isBoolean(n) ? i.setInputChecked("#input-publish-" + e, n) : i.setInputValue("#input-publish-" + e, n);
}), i.setInputRadio("radio-publish-format", a.format), i.setInputChecked("#checkbox-publish-custom-template", void 0 !== a.customTmpl),
i.setInputValue("#textarea-publish-custom-template", a.customTmpl || o.template)),
e(".modal-publish").modal();
}
function g(e) {
var n = k, i = n.newPublishAttributes(e);
if (void 0 !== i) {
var o = l.currentFile, a = p(o, i, w), s = o.frontMatter && o.frontMatter.title || o.title;
n.publish(i, o.frontMatter, s, a, function(e) {
void 0 === e && (i.provider = n, f(o, i));
});
var c = {};
t.each(n.publishPreferencesInputIds, function(e) {
var t = document.getElementById("input-publish-" + e);
c[e] = "checkbox" == t.type ? t.checked : t.value;
}), c.format = i.format, c.customTmpl = i.customTmpl, r[n.providerId + ".publishPreferences"] = JSON.stringify(c);
}
}
var v = {}, b = t.chain(arguments).map(function(e) {
return e instanceof u && !0 === e.isPublishEnabled && [ e.providerId, e ];
}).compact().object().value();
!function() {
var e = {};
t.each(s, function(e) {
i.retrieveIndexArray(e.fileIndex + ".publish").forEach(function(t) {
try {
var n = JSON.parse(r[t]);
n.publishIndex = t;
var o = b[n.provider];
if (!o) throw new Error("Invalid provider ID: " + n.provider);
n.provider = o, e.publishLocations[t] = n, s[t] = n;
} catch (s) {
a.onError(s), i.removeIndexFromArray(e.fileIndex + ".publish", t);
}
});
}), Object.keys(r).forEach(function(t) {
var n = t.match(/publish\.\S+/);
n && !e.hasOwnProperty(n[0]) && r.removeItem(t);
});
}(), v.applyTemplate = function(e, n, i) {
try {
var r = n && n.customTmpl || o.template;
return t.template(r, {
documentTitle: e.title,
documentMarkdown: e.content,
strippedDocumentMarkdown: e.content.substring(e.frontMatter ? e.frontMatter._frontMatter.length : 0),
documentHTML: i.withoutComments,
documentHTMLWithFrontMatter: (e.frontMatter ? e.frontMatter._frontMatter : "") + i.withoutComments,
documentHTMLWithComments: i.withComments,
frontMatter: e.frontMatter,
publishAttributes: n
});
} catch (e) {
return a.onError(e), e.message;
}
};
var y, x, w, S = [];
a.addListener("onPreviewFinished", function(e, t) {
w = {
withComments: e,
withoutComments: t
};
});
var C = !1;
a.addListener("onOfflineChanged", function(e) {
C = e;
});
var _ = !1;
v.publish = function() {
!0 !== _ && !0 !== C && (_ = !0, a.onPublishRunning(!0), y = l.currentFile, x = w,
S = t.values(y.publishLocations), h(function(e) {
_ = !1, a.onPublishRunning(!1), void 0 === e && a.onPublishSuccess(y);
}));
};
var k, E = [ "", ' ', ' <%= provider.providerName %>', " ", " " ].join("");
return a.addListener("onReady", function() {
if (!1 === window.viewerMode) {
var r = document.querySelector(".menu-panel .publish-on-provider-list"), s = t.reduce(b, function(e, n) {
return e + t.template(E, {
provider: n
});
}, "");
r.innerHTML = s, t.each(b, function(t) {
e(r.querySelector(".action-init-publish-" + t.providerId)).click(function() {
m(t);
}), e(".action-publish-" + t.providerId).click(function() {
m(t);
});
});
}
e(".action-process-publish").click(g);
var u = e(".publish-custom-template-collapse").collapse({
toggle: !1
}), p = e("#textarea-publish-custom-template"), h = t.debounce(function() {
u.collapse("template" == i.getInputRadio("radio-publish-format") ? "show" : "hide");
}, 100);
e("#checkbox-publish-custom-template").change(function() {
p.prop("disabled", !this.checked);
}), e("input:radio[name=radio-publish-format]").change(function() {
h();
}), e(".modal-publish").on("hidden.bs.modal", function() {
u.collapse("hide");
}), e(".action-download-md").click(function() {
var e = l.currentFile.content, t = l.currentFile.title;
i.saveAs(e, t + ".md");
}), e(".action-download-html").click(function() {
var e = l.currentFile.title;
i.saveAs(w.withoutComments, e + ".html");
}), e(".action-download-template").click(function() {
var e = l.currentFile, t = v.applyTemplate(e, void 0, w);
i.saveAs(t, e.title + (-1 === o.template.indexOf("documentHTML") ? ".md" : ".html"));
});
var f = new c({
applicationID: "ESTHdCYOi18iLhhO"
});
e(".action-download-pdf").click(function() {
var t, r, s = l.currentFile, c = v.applyTemplate(s, {
customTmpl: o.pdfTemplate
}, w), u = new d();
u.onRun(function() {
return !0 === C ? (a.onError("Operation not available in offline mode."), u.chain()) : a.isSponsor ? void f.getTokenImmediate(function(e, t) {
r = t, u.chain();
}) : (e(".modal-sponsor-only").modal("show"), u.chain());
}), u.onRun(function() {
if (!r) return u.chain();
var i = new XMLHttpRequest();
i.open("POST", n.PDF_EXPORT_URL + "?" + e.param({
token: r,
options: o.pdfOptions
}), !0), i.setRequestHeader("Content-type", "application/x-www-form-urlencoded"),
i.responseType = "blob", i.onreadystatechange = function() {
4 == this.readyState && (200 == this.status ? t = this.response : a.onError("Error when trying to generate PDF: " + this.statusText),
u.chain());
}, i.send(c);
}), u.onSuccess(function() {
t && i.saveAs(t, l.currentFile.title + ".pdf");
}), u.enqueue();
});
}), a.onPublisherCreated(v), v;
}), define("providers/downloadProvider", [ "jquery", "constants", "eventMgr", "utils", "fileMgr", "classes/Provider", "classes/AsyncTask" ], function(e, t, n, i, r, o, a) {
var s = new o("download");
return s.viewerSharingAttributes = [ "url" ], s.importPublic = function(n, i) {
var r, o, s = new a(!0);
s.onRun(function() {
var i = n.url, a = i.lastIndexOf("/");
return -1 === a ? void s.error(new Error("Invalid URL parameter.")) : (r = i.substring(a + 1),
void e.ajax({
url: t.DOWNLOAD_IMPORT_URL + "?" + e.param({
url: i
}),
dataType: "text",
timeout: t.AJAX_TIMEOUT
}).done(function(e) {
o = e, s.chain();
}).fail(function() {
s.error(new Error("Unable to access URL " + i));
}));
}), s.onSuccess(function() {
i(void 0, r, o);
}), s.onError(function(e) {
i(e);
}), s.enqueue();
}, n.addListener("onReady", function() {
e(".action-import-url").click(function(e) {
var t = i.getInputTextValue("#input-import-url", e);
t && s.importPublic({
url: t
}, function(e, t, n) {
if (!e) {
var i = r.createFile(t, n);
r.selectFile(i);
}
});
});
}), s;
}), define("sharing", [ "jquery", "underscore", "constants", "utils", "eventMgr", "fileMgr", "classes/AsyncTask", "classes/Provider", "providers/couchdbProvider", "providers/downloadProvider", "providers/gistProvider" ], function(e, t, n, i, r, o, a, s) {
var l = {}, c = t.chain(arguments).map(function(e) {
return e instanceof s && [ e.providerId, e ];
}).compact().object().value(), u = !1;
return r.addListener("onOfflineChanged", function(e) {
u = e;
}), l.getEditorParams = function(e) {
var n = e.provider, i = {
provider: n.providerId
};
return n.editorSharingAttributes ? (t.each(n.editorSharingAttributes, function(t) {
i[t] = e[t];
}), i) : void 0;
}, l.getViewerParams = function(e) {
var n = e.provider;
if ("markdown" == e.format) {
var i = {
provider: n.providerId
};
if (n.viewerSharingAttributes) return t.each(n.viewerSharingAttributes, function(t) {
i[t] = e[t];
}), i;
}
}, r.addListener("onReady", function() {
var e, n, r = i.getURLParameter("provider");
if (window.viewerMode) {
if (void 0 === r && (r = "download"), void 0 === (n = c[r])) return;
if (e = {}, t.some(n.viewerSharingAttributes, function(t) {
var n = i.getURLParameter(t);
return n ? void (e[t] = n) : 1;
})) return;
n.importPublic(e, i.lockUI(function(e, t, n) {
if (!e) {
var i = o.createFile(t, n, void 0, void 0, !0);
o.selectFile(i);
}
}));
} else if (r) {
if (void 0 === (n = c[r])) return;
if (e = {}, t.some(n.editorSharingAttributes, function(t) {
var n = i.getURLParameter(t);
return n ? void (e[t] = n) : 1;
})) return;
n.importPrivate(e, i.lockUI());
}
}), r.onSharingCreated(l), l;
}), define("providers/gplusProvider", [ "jquery", "underscore", "utils", "storage", "classes/Provider", "eventMgr", "helpers/googleHelper" ], function(e, t, n, i, r, o, a) {
function s(e, n) {
var i;
return t.find(e.thumbnails, function(e) {
var t = !1;
return e.url.replace(/^(.*[\/=]s)\d.*?(\/[^\/]+)?$/, function(e, r, o) {
i = r + n + (o || ""), t = !0;
}), t;
}), i;
}
function l() {
return c.thumbnails ? (n.resetModalInputs(), e(".modal-import-image img").prop("src", s(c, 128)),
n.setInputValue("#input-import-image-title", c.name), p && n.setInputValue("#input-import-image-size", p.size),
e(".modal-import-image").modal(), void 0) : (o.onError("Image " + c.name + " is not accessible."),
void u(!0));
}
var c, u, d = new r("gplus", "Google+"), p = n.retrieveIgnoreError("gplus.importImagePreferences");
return d.importImage = function(e) {
u = e, a.picker(function(t, n) {
return t || 0 === n.length ? void e(t) : (c = n[0], void l());
}, "img");
}, d.uploadImage = function(t, n, i) {
u = i, a.uploadImg(t, n, "default", function(n, r) {
return n || !r ? void i(n) : (c = {
name: t,
thumbnails: []
}, e(r).find("thumbnail").each(function() {
c.thumbnails.push({
url: e(this).attr("url")
});
}), l(), void 0);
});
}, o.addListener("onReady", function() {
e(".action-import-image").click(function() {
var e = n.getInputIntValue("#input-import-image-size", void 0, 0) || 0, t = n.getInputTextValue("#input-import-image-title"), r = s(c, e);
t && (r += ' "' + t + '"'), u(void 0, r), p = {}, e && (p.size = e), i["gplus.importImagePreferences"] = JSON.stringify(p);
});
}), d;
}), define("mediaImporter", [ "jquery", "underscore", "constants", "classes/Provider", "core", "eventMgr", "providers/gplusProvider" ], function(e, t, n, i, r, o) {
var a = {}, s = t.chain(arguments).map(function(e) {
return e instanceof i && [ e.providerId, e ];
}).compact().object().value();
return o.addListener("onReady", function() {
function i(i) {
var o = (i.dataTransfer || i.target).files, a = t.first(o);
if (a.name.match(/.(jpe?g|png|gif)$/i)) {
i.stopPropagation(), i.preventDefault();
var l = new FileReader();
l.onload = function(t) {
return function(n) {
var i = new Uint8Array(n.target.result);
s.gplus.uploadImage(t.name, i, function(t, n) {
if (!t) {
r.catchModal = !0, e("#wmd-image-button").click(), r.catchModal = !1;
var i = r.insertLinkCallback;
r.insertLinkCallback = void 0, i(n || null);
}
});
};
}(a);
var c = a.slice(0, n.IMPORT_IMG_MAX_CONTENT_SIZE);
l.readAsArrayBuffer(c);
}
}
function o(e) {
e.stopPropagation(), e.preventDefault(), e.dataTransfer.dropEffect = "copy";
}
t.each(s, function(t) {
e(".action-import-image-" + t.providerId).click(function() {
var e = r.insertLinkCallback;
r.insertLinkCallback = void 0, t.importImage(function(t, n) {
return t ? void e(null) : void e(n || null);
});
});
}), !window.viewerMode && function(e) {
e.addEventListener("dragover", o, !1), e.addEventListener("drop", i, !1);
}(document.querySelector(".layout-wrapper-l3"));
}), a;
}), define("css/css", [], function() {
if ("undefined" == typeof window) return {
load: function(e, t, n) {
n();
}
};
var e = document.getElementsByTagName("head")[0], t = window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)/) || 0, n = !1, i = !0;
t[1] || t[7] ? n = parseInt(t[1]) < 6 || parseInt(t[7]) <= 9 : t[2] ? i = !1 : t[4] && (n = parseInt(t[4]) < 18);
var r = {};
r.pluginBuilder = "./css-builder";
var o, a, s, l = function() {
o = document.createElement("style"), e.appendChild(o), a = o.styleSheet || o.sheet;
}, c = 0, u = [], d = function(e) {
c++, 32 == c && (l(), c = 0), a.addImport(e), o.onload = function() {
p();
};
}, p = function() {
s();
var e = u.shift();
return e ? (s = e[1], void d(e[0])) : void (s = null);
}, h = function(e, t) {
if (a && a.addImport || l(), a && a.addImport) s ? u.push([ e, t ]) : (d(e), s = t); else {
o.textContent = '@import "' + e + '";';
var n = setInterval(function() {
try {
o.sheet.cssRules, clearInterval(n), t();
} catch (e) {}
}, 10);
}
}, f = function(t, n) {
var r = document.createElement("link");
if (r.type = "text/css", r.rel = "stylesheet", i) r.onload = function() {
r.onload = function() {}, setTimeout(n, 7);
}; else var o = setInterval(function() {
for (var e = 0; e < document.styleSheets.length; e++) if (document.styleSheets[e].href == r.href) return clearInterval(o),
n();
}, 10);
r.href = t, e.appendChild(r);
};
return r.normalize = function(e, t) {
return ".css" == e.substr(e.length - 4, 4) && (e = e.substr(0, e.length - 4)), t(e);
}, r.load = function(e, t, i) {
(n ? h : f)(t.toUrl(e + ".css"), i);
}, r;
}), define("css", [ "css/css" ], function(e) {
return e;
}), rangy.createModule("CssClassApplier", function(e, t) {
function n(e) {
return e.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
}
function i(e, t) {
return e.className && new RegExp("(?:^|\\s)" + t + "(?:\\s|$)").test(e.className);
}
function r(e, t) {
e.className ? i(e, t) || (e.className += " " + t) : e.className = t;
}
function o(e) {
return e.split(/\s+/).sort().join(" ");
}
function a(e) {
return o(e.className);
}
function s(e, t) {
return a(e) == a(t);
}
function l(e) {
for (var t = e.parentNode; e.hasChildNodes(); ) t.insertBefore(e.firstChild, e);
t.removeChild(e);
}
function c(e, t) {
var n = e.cloneRange();
n.selectNodeContents(t);
var i = n.intersection(e), r = i ? i.toString() : "";
return n.detach(), "" != r;
}
function u(e) {
return e.getNodes([ 3 ], function(t) {
return c(e, t);
});
}
function d(e, t) {
if (e.attributes.length != t.attributes.length) return !1;
for (var n, i, r, o = 0, a = e.attributes.length; a > o; ++o) if (n = e.attributes[o],
"class" != (r = n.name)) {
if (i = t.attributes.getNamedItem(r), n.specified != i.specified) return !1;
if (n.specified && n.nodeValue !== i.nodeValue) return !1;
}
return !0;
}
function p(e, t) {
for (var n, i = 0, r = e.attributes.length; r > i; ++i) if (n = e.attributes[i].name,
(!t || !E.arrayContains(t, n)) && e.attributes[i].specified && "class" != n) return !0;
return !1;
}
function h(e, t) {
for (var n in t) if (t.hasOwnProperty(n) && e[n] !== t[n]) return !1;
return !0;
}
function f(e) {
var t;
return e && 1 == e.nodeType && ((t = e.parentNode) && 9 == t.nodeType && "on" == t.designMode || I(e) && !I(e.parentNode));
}
function m(e) {
return (I(e) || 1 != e.nodeType && I(e.parentNode)) && !f(e);
}
function g(e) {
return e && 1 == e.nodeType && !D.test(k(e, "display"));
}
function v(e) {
if (0 == e.data.length) return !0;
if (N.test(e.data)) return !1;
switch (k(e.parentNode, "whiteSpace")) {
case "pre":
case "pre-wrap":
case "-moz-pre-wrap":
return !1;
case "pre-line":
if (/[\r\n]/.test(e.data)) return !1;
}
return g(e.previousSibling) || g(e.nextSibling);
}
function b(e, t) {
return E.isCharacterDataNode(e) ? 0 == t ? !!e.previousSibling : t != e.length || !!e.nextSibling : t > 0 && t < e.childNodes.length;
}
function y(e, n, i, r) {
var o, a = 0 == i;
if (E.isAncestorOf(n, e)) return e;
if (E.isCharacterDataNode(n)) if (0 == i) i = E.getNodeIndex(n), n = n.parentNode; else {
if (i != n.length) throw t.createError("splitNodeAt should not be called with offset in the middle of a data node (" + i + " in " + n.data);
i = E.getNodeIndex(n) + 1, n = n.parentNode;
}
if (b(n, i)) {
if (!o) {
o = n.cloneNode(!1), o.id && o.removeAttribute("id");
for (var s; s = n.childNodes[i]; ) o.appendChild(s);
E.insertAfter(o, n);
}
return n == e ? o : y(e, o.parentNode, E.getNodeIndex(o), r);
}
if (e != n) {
o = n.parentNode;
var l = E.getNodeIndex(n);
return a || l++, y(e, o, l, r);
}
return e;
}
function x(e, t) {
return e.tagName == t.tagName && s(e, t) && d(e, t);
}
function w(e) {
var t = e ? "nextSibling" : "previousSibling";
return function(n, i) {
var r = n.parentNode, o = n[t];
if (o) {
if (o && 3 == o.nodeType) return o;
} else if (i && (o = r[t]) && 1 == o.nodeType && x(r, o)) return o[e ? "firstChild" : "lastChild"];
return null;
};
}
function S(e) {
this.isElementMerge = 1 == e.nodeType, this.firstTextNode = this.isElementMerge ? e.lastChild : e,
this.textNodes = [ this.firstTextNode ];
}
function C(e, t, i) {
this.cssClass = e;
var r, a, s, l, c = null;
if ("object" == typeof t && null !== t) {
for (i = t.tagNames, c = t.elementProperties, a = 0; l = A[a++]; ) t.hasOwnProperty(l) && (this[l] = t[l]);
r = t.normalize;
} else r = t;
this.normalize = void 0 === r || r, this.attrExceptions = [];
var u = document.createElement(this.elementTagName);
this.elementProperties = {};
for (var d in c) c.hasOwnProperty(d) && (R.hasOwnProperty(d) && (d = R[d]), u[d] = c[d],
this.elementProperties[d] = u[d], this.attrExceptions.push(d));
this.elementSortedClassName = this.elementProperties.hasOwnProperty("className") ? o(this.elementProperties.className + " " + e) : e,
this.applyToAnyTagName = !1;
var p = typeof i;
if ("string" == p) "*" == i ? this.applyToAnyTagName = !0 : this.tagNames = n(i.toLowerCase()).split(/\s*,\s*/); else if ("object" == p && "number" == typeof i.length) for (this.tagNames = [],
a = 0, s = i.length; s > a; ++a) "*" == i[a] ? this.applyToAnyTagName = !0 : this.tagNames.push(i[a].toLowerCase()); else this.tagNames = [ this.elementTagName ];
}
function _(e, t, n) {
return new C(e, t, n);
}
e.requireModules([ "WrappedSelection", "WrappedRange" ]);
var k, E = e.dom, T = function() {
function e(e, t, n) {
return t && n ? " " : "";
}
return function(t, n) {
t.className && (t.className = t.className.replace(new RegExp("(?:^|\\s)" + n + "(?:\\s|$)"), e));
};
}();
void 0 !== window.getComputedStyle ? k = function(e, t) {
return E.getWindow(e).getComputedStyle(e, null)[t];
} : void 0 !== document.documentElement.currentStyle ? k = function(e, t) {
return e.currentStyle[t];
} : t.fail("No means of obtaining computed style properties found");
var I;
!function() {
var e = document.createElement("div");
I = "boolean" == typeof e.isContentEditable ? function(e) {
return e && 1 == e.nodeType && e.isContentEditable;
} : function(e) {
return !(!e || 1 != e.nodeType || "false" == e.contentEditable || "true" != e.contentEditable && !I(e.parentNode));
};
}();
var D = /^inline(-block|-table)?$/i, N = /[^\r\n\t\f \u200B]/, M = w(!1), L = w(!0);
S.prototype = {
doMerge: function() {
for (var e, t, n, i = [], r = 0, o = this.textNodes.length; o > r; ++r) e = this.textNodes[r],
t = e.parentNode, i[r] = e.data, r && (t.removeChild(e), t.hasChildNodes() || t.parentNode.removeChild(t));
return this.firstTextNode.data = n = i.join(""), n;
},
getLength: function() {
for (var e = this.textNodes.length, t = 0; e--; ) t += this.textNodes[e].length;
return t;
},
toString: function() {
for (var e = [], t = 0, n = this.textNodes.length; n > t; ++t) e[t] = "'" + this.textNodes[t].data + "'";
return "[Merge(" + e.join(",") + ")]";
}
};
var A = [ "elementTagName", "ignoreWhiteSpace", "applyToEditableOnly" ], R = {
"class": "className"
};
C.prototype = {
elementTagName: "span",
elementProperties: {},
ignoreWhiteSpace: !0,
applyToEditableOnly: !1,
hasClass: function(e) {
return 1 == e.nodeType && E.arrayContains(this.tagNames, e.tagName.toLowerCase()) && i(e, this.cssClass);
},
getSelfOrAncestorWithClass: function(e) {
for (;e; ) {
if (this.hasClass(e, this.cssClass)) return e;
e = e.parentNode;
}
return null;
},
isModifiable: function(e) {
return !this.applyToEditableOnly || m(e);
},
isIgnorableWhiteSpaceNode: function(e) {
return this.ignoreWhiteSpace && e && 3 == e.nodeType && v(e);
},
postApply: function(e, t, n) {
for (var i, r, o, a = e[0], s = e[e.length - 1], l = [], c = a, u = s, d = 0, p = s.length, h = 0, f = e.length; f > h; ++h) r = e[h],
o = M(r, !n), o ? (i || (i = new S(o), l.push(i)), i.textNodes.push(r), r === a && (c = i.firstTextNode,
d = c.length), r === s && (u = i.firstTextNode, p = i.getLength())) : i = null;
var m = L(s, !n);
if (m && (i || (i = new S(s), l.push(i)), i.textNodes.push(m)), l.length) {
for (h = 0, f = l.length; f > h; ++h) l[h].doMerge();
t.setStart(c, d), t.setEnd(u, p);
}
},
createContainer: function(t) {
var n = t.createElement(this.elementTagName);
return e.util.extend(n, this.elementProperties), r(n, this.cssClass), n;
},
applyToTextNode: function(e) {
var t = e.parentNode;
if (1 == t.childNodes.length && E.arrayContains(this.tagNames, t.tagName.toLowerCase())) r(t, this.cssClass); else {
var n = this.createContainer(E.getDocument(e));
e.parentNode.insertBefore(n, e), n.appendChild(e);
}
},
isRemovable: function(e) {
return e.tagName.toLowerCase() == this.elementTagName && a(e) == this.elementSortedClassName && h(e, this.elementProperties) && !p(e, this.attrExceptions) && this.isModifiable(e);
},
undoToTextNode: function(e, t, n) {
if (!t.containsNode(n)) {
var i = t.cloneRange();
i.selectNode(n), i.isPointInRange(t.endContainer, t.endOffset) && (y(n, t.endContainer, t.endOffset, [ t ]),
t.setEndAfter(n)), i.isPointInRange(t.startContainer, t.startOffset) && (n = y(n, t.startContainer, t.startOffset, [ t ]));
}
this.isRemovable(n) ? l(n) : T(n, this.cssClass);
},
applyToRange: function(e) {
e.splitBoundaries();
var t = u(e);
if (t.length) {
for (var n, i = 0, r = t.length; r > i; ++i) n = t[i], this.isIgnorableWhiteSpaceNode(n) || this.getSelfOrAncestorWithClass(n) || !this.isModifiable(n) || this.applyToTextNode(n);
e.setStart(t[0], 0), n = t[t.length - 1], e.setEnd(n, n.length), this.normalize && this.postApply(t, e, !1);
}
},
applyToSelection: function(t) {
t = t || window;
var n, i = e.getSelection(t), r = i.getAllRanges();
i.removeAllRanges();
for (var o = r.length; o--; ) n = r[o], this.applyToRange(n), i.addRange(n);
},
undoToRange: function(e) {
e.splitBoundaries();
var t, n, i = u(e), r = i[i.length - 1];
if (i.length) {
for (var o = 0, a = i.length; a > o; ++o) t = i[o], n = this.getSelfOrAncestorWithClass(t),
n && this.isModifiable(t) && this.undoToTextNode(t, e, n), e.setStart(i[0], 0),
e.setEnd(r, r.length);
this.normalize && this.postApply(i, e, !0);
}
},
undoToSelection: function(t) {
t = t || window;
var n, i = e.getSelection(t), r = i.getAllRanges();
i.removeAllRanges();
for (var o = 0, a = r.length; a > o; ++o) n = r[o], this.undoToRange(n), i.addRange(n);
},
getTextSelectedByRange: function(e, t) {
var n = t.cloneRange();
n.selectNodeContents(e);
var i = n.intersection(t), r = i ? i.toString() : "";
return n.detach(), r;
},
isAppliedToRange: function(e) {
if (e.collapsed) return !!this.getSelfOrAncestorWithClass(e.commonAncestorContainer);
for (var t, n = e.getNodes([ 3 ]), i = 0; t = n[i++]; ) if (!this.isIgnorableWhiteSpaceNode(t) && c(e, t) && this.isModifiable(t) && !this.getSelfOrAncestorWithClass(t)) return !1;
return !0;
},
isAppliedToSelection: function(t) {
t = t || window;
for (var n = e.getSelection(t), i = n.getAllRanges(), r = i.length; r--; ) if (!this.isAppliedToRange(i[r])) return !1;
return !0;
},
toggleRange: function(e) {
this.isAppliedToRange(e) ? this.undoToRange(e) : this.applyToRange(e);
},
toggleSelection: function(e) {
this.isAppliedToSelection(e) ? this.undoToSelection(e) : this.applyToSelection(e);
},
detach: function() {}
}, C.util = {
hasClass: i,
addClass: r,
removeClass: T,
hasSameClasses: s,
replaceWithOwnChildren: l,
elementsHaveSameNonClassAttributes: d,
elementHasNonClassAttributes: p,
splitNodeAt: y,
isEditableElement: I,
isEditingHost: f,
isEditable: m
}, e.CssClassApplier = C, e.createCssClassApplier = _;
}), define("rangy-cssclassapplier", [ "rangy" ], function() {}), requirejs.config({
waitSeconds: 0,
packages: [ {
name: "css",
location: "bower-libs/require-css",
main: "css"
}, {
name: "less",
location: "bower-libs/require-less",
main: "less"
} ],
paths: {
jquery: "bower-libs/jquery/jquery",
underscore: "bower-libs/underscore/underscore",
crel: "bower-libs/crel/crel",
jgrowl: "bower-libs/jgrowl/jquery.jgrowl",
mousetrap: "bower-libs/mousetrap/mousetrap",
"mousetrap-record": "bower-libs/mousetrap/plugins/record/mousetrap-record",
toMarkdown: "bower-libs/to-markdown/src/to-markdown",
text: "bower-libs/requirejs-text/text",
mathjax: "../res/bower-libs/MathJax/MathJax.js?config=TeX-AMS_SVG",
bootstrap: "bower-libs/bootstrap/dist/js/bootstrap",
requirejs: "bower-libs/requirejs/require",
"google-code-prettify": "bower-libs/google-code-prettify/src/prettify",
highlightjs: "libs/highlight/highlight.pack",
"jquery-waitforimages": "bower-libs/waitForImages/src/jquery.waitforimages",
"jquery-ui": "bower-libs/jquery-ui/ui/jquery-ui",
"jquery-ui-core": "bower-libs/jquery-ui/ui/jquery.ui.core",
"jquery-ui-widget": "bower-libs/jquery-ui/ui/jquery.ui.widget",
"jquery-ui-mouse": "bower-libs/jquery-ui/ui/jquery.ui.mouse",
"jquery-ui-draggable": "bower-libs/jquery-ui/ui/jquery.ui.draggable",
"jquery-ui-effect": "bower-libs/jquery-ui/ui/jquery.ui.effect",
"jquery-ui-effect-slide": "bower-libs/jquery-ui/ui/jquery.ui.effect-slide",
FileSaver: "bower-libs/FileSaver/FileSaver",
stacktrace: "bower-libs/stacktrace/stacktrace",
"requirejs-text": "bower-libs/requirejs-text/text",
"bootstrap-tour": "bower-libs/bootstrap-tour/build/js/bootstrap-tour",
css_browser_selector: "bower-libs/css_browser_selector/css_browser_selector",
"pagedown-extra": "bower-libs/pagedown-extra/node-pagedown-extra",
pagedownExtra: "bower-libs/pagedown-extra/Markdown.Extra",
pagedown: "libs/Markdown.Editor",
"require-css": "bower-libs/require-css/css",
xregexp: "bower-libs/xregexp/xregexp-all",
yaml: "bower-libs/yaml.js/bin/yaml",
"yaml.js": "bower-libs/yaml.js",
"yaml-js": "bower-libs/yaml.js/bin/yaml",
css: "bower-libs/require-css/css",
"css-builder": "bower-libs/require-css/css-builder",
normalize: "bower-libs/require-css/normalize",
prism: "bower-libs/prism/prism",
"prism-core": "bower-libs/prism/components/prism-core",
MutationObservers: "bower-libs/MutationObservers/MutationObserver",
WeakMap: "bower-libs/WeakMap/weakmap",
rangy: "bower-libs/rangy/rangy-core",
"rangy-cssclassapplier": "bower-libs/rangy/rangy-cssclassapplier",
diff_match_patch: "bower-libs/google-diff-match-patch-js/diff_match_patch",
diff_match_patch_uncompressed: "bower-libs/google-diff-match-patch-js/diff_match_patch_uncompressed",
jsondiffpatch: "bower-libs/jsondiffpatch/build/bundle",
hammerjs: "bower-libs/hammerjs/hammer",
Diagram: "bower-libs/js-sequence-diagrams/src/sequence-diagram",
"diagram-grammar": "bower-libs/js-sequence-diagrams/build/diagram-grammar",
raphael: "bower-libs/raphael/raphael",
"flow-chart": "bower-libs/flowchart/release/flowchart.amd-1.3.4.min",
flowchart: "bower-libs/flowchart/release/flowchart-1.3.4.min",
monetizejs: "bower-libs/monetizejs/src/monetize",
"to-markdown": "bower-libs/to-markdown/src/to-markdown",
waitForImages: "bower-libs/waitForImages/dist/jquery.waitforimages",
MathJax: "bower-libs/MathJax/MathJax",
alertify: "bower-libs/alertify.js/lib/alertify"
},
shim: {
underscore: {
exports: "_"
},
mathjax: [ "libs/mathjax_init" ],
jgrowl: {
deps: [ "jquery" ],
exports: "jQuery.jGrowl"
},
diff_match_patch_uncompressed: {
exports: "diff_match_patch"
},
jsondiffpatch: [ "diff_match_patch_uncompressed" ],
rangy: {
exports: "rangy"
},
"rangy-cssclassapplier": [ "rangy" ],
mousetrap: {
exports: "Mousetrap"
},
"yaml-js": {
exports: "YAML"
},
"prism-core": {
exports: "Prism"
},
"bower-libs/prism/components/prism-markup": [ "prism-core" ],
"libs/prism-latex": [ "prism-core" ],
"libs/prism-markdown": [ "bower-libs/prism/components/prism-markup", "libs/prism-latex" ],
"bootstrap-record": [ "mousetrap" ],
toMarkdown: {
deps: [ "jquery" ],
exports: "toMarkdown"
},
stacktrace: {
exports: "printStackTrace"
},
FileSaver: {
exports: "saveAs"
},
MutationObservers: [ "WeakMap" ],
highlightjs: {
exports: "hljs"
},
"bootstrap-tour": {
deps: [ "bootstrap" ],
exports: "Tour"
},
bootstrap: [ "jquery" ],
"jquery-waitforimages": [ "jquery" ],
pagedown: [ "libs/Markdown.Converter" ],
pagedownExtra: [ "libs/Markdown.Converter" ],
"flow-chart": [ "raphael" ],
"diagram-grammar": [ "underscore" ],
Diagram: [ "raphael", "diagram-grammar" ]
}
});
try {
var test = "seLocalStorageCheck";
localStorage.setItem(test, test), localStorage.removeItem(test);
var obj = {};
Object.defineProperty(obj, "prop", {
get: function() {},
set: function() {}
});
} catch (t) {
throw alert("Your browser is not supported, sorry!"), t;
}
window.viewerMode = /(^| )viewer($| )/.test(document.body.className), window.theme = localStorage.themeV4 || "default";
var themeModule = "less!themes/" + window.theme;
-1 !== window.baseDir.indexOf("-min") && (themeModule = "css!themes/" + window.theme),
require([ "jquery", "rangy", "core", "eventMgr", "synchronizer", "publisher", "sharing", "mediaImporter", "css", "rangy-cssclassapplier", themeModule ], function(e, t, n, i) {
window.noStart || e(function() {
t.init(), n.onReady(), window.applicationCache && window.applicationCache.addEventListener("updateready", function() {
window.applicationCache.status === window.applicationCache.UPDATEREADY && (window.applicationCache.swapCache(),
i.onMessage("New version available!\nJust refresh the page to upgrade."));
}, !1);
});
}), define("main", function() {});