Skip to content

Instantly share code, notes, and snippets.

@notslang
Last active August 29, 2015 14:01
Show Gist options
  • Save notslang/f91b15f69d90bd90967f to your computer and use it in GitHub Desktop.
Save notslang/f91b15f69d90bd90967f to your computer and use it in GitHub Desktop.
beautify
function g(a) {
throw a;
}
var j = void 0,
k = !0,
m = null,
o = !1;
function aa() {
return function () {}
}
function ba(a) {
return function () {
return this[a]
}
}
function s(a) {
return function () {
return a
}
}
var t, ca = this;
function da() {}
function ea(a) {
a.tb = function () {
return a.ld ? a.ld : a.ld = new a
}
}
function fa(a) {
var b = typeof a;
if ("object" == b)
if (a) {
if (a instanceof Array) return "array";
if (a instanceof Object) return b;
var c = Object.prototype.toString.call(a);
if ("[object Window]" == c) return "object";
if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) return "array";
if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) return "function"
} else return "null";
else if ("function" == b && "undefined" == typeof a.call) return "object";
return b
}
function u(a) {
return a !== j
}
function ga(a) {
var b = fa(a);
return "array" == b || "object" == b && "number" == typeof a.length
}
function v(a) {
return "string" == typeof a
}
function ha(a) {
return "number" == typeof a
}
function ia(a) {
var b = typeof a;
return "object" == b && a != m || "function" == b
}
Math.floor(2147483648 * Math.random()).toString(36);
function ja(a, b, c) {
return a.call.apply(a.bind, arguments)
}
function ka(a, b, c) {
a || g(Error());
if (2 < arguments.length) {
var d = Array.prototype.slice.call(arguments, 2);
return function () {
var c = Array.prototype.slice.call(arguments);
Array.prototype.unshift.apply(c, d);
return a.apply(b, c)
}
}
return function () {
return a.apply(b, arguments)
}
}
function w(a, b, c) {
w = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? ja : ka;
return w.apply(m, arguments)
}
function la(a, b) {
function c() {}
c.prototype = b.prototype;
a.ne = b.prototype;
a.prototype = new c
};
function ma(a) {
a = String(a);
if (/^\s*$/.test(a) ? 0 : /^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g, "@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x10-\x1f\x80-\x9f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g, ""))) try {
return eval("(" + a + ")")
} catch (b) {}
g(Error("Invalid JSON string: " + a))
}
function na() {
this.tc = j
}
function oa(a, b, c) {
switch (typeof b) {
case "string":
pa(b, c);
break;
case "number":
c.push(isFinite(b) && !isNaN(b) ? b : "null");
break;
case "boolean":
c.push(b);
break;
case "undefined":
c.push("null");
break;
case "object":
if (b == m) {
c.push("null");
break
}
if ("array" == fa(b)) {
var d = b.length;
c.push("[");
for (var e = "", f = 0; f < d; f++) c.push(e), e = b[f], oa(a, a.tc ? a.tc.call(b, String(f), e) : e, c), e = ",";
c.push("]");
break
}
c.push("{");
d = "";
for (f in b) Object.prototype.hasOwnProperty.call(b, f) && (e = b[f], "function" != typeof e && (c.push(d),
pa(f, c), c.push(":"), oa(a, a.tc ? a.tc.call(b, f, e) : e, c), d = ","));
c.push("}");
break;
case "function":
break;
default:
g(Error("Unknown type: " + typeof b))
}
}
var qa = {
'"': '\\"',
"\\": "\\\\",
"/": "\\/",
"\b": "\\b",
"\f": "\\f",
"\n": "\\n",
"\r": "\\r",
"\t": "\\t",
"\x0B": "\\u000b"
},
ra = /\uffff/.test("\uffff") ? /[\\\"\x00-\x1f\x7f-\uffff]/g : /[\\\"\x00-\x1f\x7f-\xff]/g;
function pa(a, b) {
b.push('"', a.replace(ra, function (a) {
if (a in qa) return qa[a];
var b = a.charCodeAt(0),
e = "\\u";
16 > b ? e += "000" : 256 > b ? e += "00" : 4096 > b && (e += "0");
return qa[a] = e + b.toString(16)
}), '"')
};
function sa(a) {
return "undefined" !== typeof JSON && u(JSON.parse) ? JSON.parse(a) : ma(a)
}
function y(a) {
if ("undefined" !== typeof JSON && u(JSON.stringify)) a = JSON.stringify(a);
else {
var b = [];
oa(new na, a, b);
a = b.join("")
}
return a
};
function ta(a) {
for (var b = [], c = 0, d = 0; d < a.length; d++) {
var e = a.charCodeAt(d);
55296 <= e && 56319 >= e && (e -= 55296, d++, z(d < a.length, "Surrogate pair missing trail surrogate."), e = 65536 + (e << 10) + (a.charCodeAt(d) - 56320));
128 > e ? b[c++] = e : (2048 > e ? b[c++] = e >> 6 | 192 : (65536 > e ? b[c++] = e >> 12 | 224 : (b[c++] = e >> 18 | 240, b[c++] = e >> 12 & 63 | 128), b[c++] = e >> 6 & 63 | 128), b[c++] = e & 63 | 128)
}
return b
};
function A(a, b, c, d) {
var e;
d < b ? e = "at least " + b : d > c && (e = 0 === c ? "none" : "no more than " + c);
e && g(Error(a + " failed: Was called with " + d + (1 === d ? " argument." : " arguments.") + " Expects " + e + "."))
}
function B(a, b, c) {
var d = "";
switch (b) {
case 1:
d = c ? "first" : "First";
break;
case 2:
d = c ? "second" : "Second";
break;
case 3:
d = c ? "third" : "Third";
break;
case 4:
d = c ? "fourth" : "Fourth";
break;
default:
ua.assert(o, "errorPrefix_ called with argumentNumber > 4. Need to update it?")
}
return a + " failed: " + (d + " argument ")
}
function C(a, b, c, d) {
(!d || u(c)) && "function" != fa(c) && g(Error(B(a, b, d) + "must be a valid function."))
}
function va(a, b, c) {
u(c) && (!ia(c) || c === m) && g(Error(B(a, b, k) + "must be a valid context object."))
};
function D(a, b) {
return Object.prototype.hasOwnProperty.call(a, b)
}
function wa(a, b) {
if (Object.prototype.hasOwnProperty.call(a, b)) return a[b]
};
var ua = {},
xa = /[\[\].#$\/]/,
ya = /[\[\].#$]/;
function za(a) {
return v(a) && 0 !== a.length && !xa.test(a)
}
function Aa(a, b, c) {
(!c || u(b)) && Ba(B(a, 1, c), b)
}
function Ba(a, b, c, d) {
c || (c = 0);
d || (d = []);
u(b) || g(Error(a + "contains undefined" + Ca(d)));
"function" == fa(b) && g(Error(a + "contains a function" + Ca(d) + " with contents: " + b.toString()));
Da(b) && g(Error(a + "contains " + b.toString() + Ca(d)));
1E3 < c && g(new TypeError(a + "contains a cyclic object value (" + d.slice(0, 100).join(".") + "...)"));
v(b) && (b.length > 10485760 / 3 && 10485760 < ta(b).length) && g(Error(a + "contains a string greater than 10485760 utf8 bytes" + Ca(d) + " ('" + b.substring(0, 50) + "...')"));
if (ia(b))
for (var e in b) D(b,
e) && (".priority" !== e && (".value" !== e && ".sv" !== e && !za(e)) && g(Error(a + "contains an invalid key (" + e + ")" + Ca(d) + '. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"')), d.push(e), Ba(a, b[e], c + 1, d), d.pop())
}
function Ca(a) {
return 0 == a.length ? "" : " in property '" + a.join(".") + "'"
}
function Ea(a, b) {
ia(b) || g(Error(B(a, 1, o) + " must be an object containing the children to replace."));
Aa(a, b, o)
}
function Fa(a, b, c, d) {
if (!d || u(c)) c !== m && (!ha(c) && !v(c) && (!ia(c) || !D(c, ".sv"))) && g(Error(B(a, b, d) + "must be a valid firebase priority (a string, number, or null)."))
}
function Ga(a, b, c) {
if (!c || u(b)) switch (b) {
case "value":
case "child_added":
case "child_removed":
case "child_changed":
case "child_moved":
break;
default:
g(Error(B(a, 1, c) + 'must be a valid event type: "value", "child_added", "child_removed", "child_changed", or "child_moved".'))
}
}
function Ha(a, b) {
u(b) && !za(b) && g(Error(B(a, 2, k) + 'was an invalid key: "' + b + '". Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").'))
}
function Ia(a, b) {
(!v(b) || 0 === b.length || ya.test(b)) && g(Error(B(a, 1, o) + 'was an invalid path: "' + b + '". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"'))
}
function E(a, b) {
".info" === F(b) && g(Error(a + " failed: Can't modify data under /.info/"))
};
function H(a, b, c, d, e, f, h) {
this.n = a;
this.path = b;
this.Ea = c;
this.ga = d;
this.za = e;
this.Ca = f;
this.Va = h;
u(this.ga) && (u(this.Ca) && u(this.Ea)) && g("Query: Can't combine startAt(), endAt(), and limit().")
}
H.prototype.Tc = function () {
A("Query.ref", 0, 0, arguments.length);
return new J(this.n, this.path)
};
H.prototype.ref = H.prototype.Tc;
H.prototype.ab = function (a, b) {
A("Query.on", 2, 4, arguments.length);
Ga("Query.on", a, o);
C("Query.on", 2, b, o);
var c = Ja("Query.on", arguments[2], arguments[3]);
this.n.Vb(this, a, b, c.cancel, c.U);
return b
};
H.prototype.on = H.prototype.ab;
H.prototype.Cb = function (a, b, c) {
A("Query.off", 0, 3, arguments.length);
Ga("Query.off", a, k);
C("Query.off", 2, b, k);
va("Query.off", 3, c);
this.n.sc(this, a, b, c)
};
H.prototype.off = H.prototype.Cb;
H.prototype.Xd = function (a, b) {
function c(h) {
f && (f = o, e.Cb(a, c), b.call(d.U, h))
}
A("Query.once", 2, 4, arguments.length);
Ga("Query.once", a, o);
C("Query.once", 2, b, o);
var d = Ja("Query.once", arguments[2], arguments[3]),
e = this,
f = k;
this.ab(a, c, function (b) {
e.Cb(a, c);
d.cancel && d.cancel.call(d.U, b)
})
};
H.prototype.once = H.prototype.Xd;
H.prototype.Rd = function (a) {
A("Query.limit", 1, 1, arguments.length);
(!ha(a) || Math.floor(a) !== a || 0 >= a) && g("Query.limit: First argument must be a positive integer.");
return new H(this.n, this.path, a, this.ga, this.za, this.Ca, this.Va)
};
H.prototype.limit = H.prototype.Rd;
H.prototype.ge = function (a, b) {
A("Query.startAt", 0, 2, arguments.length);
Fa("Query.startAt", 1, a, k);
Ha("Query.startAt", b);
u(a) || (b = a = m);
return new H(this.n, this.path, this.Ea, a, b, this.Ca, this.Va)
};
H.prototype.startAt = H.prototype.ge;
H.prototype.Ld = function (a, b) {
A("Query.endAt", 0, 2, arguments.length);
Fa("Query.endAt", 1, a, k);
Ha("Query.endAt", b);
return new H(this.n, this.path, this.Ea, this.ga, this.za, a, b)
};
H.prototype.endAt = H.prototype.Ld;
function Ka(a) {
var b = {};
u(a.ga) && (b.sp = a.ga);
u(a.za) && (b.sn = a.za);
u(a.Ca) && (b.ep = a.Ca);
u(a.Va) && (b.en = a.Va);
u(a.Ea) && (b.l = a.Ea);
u(a.ga) && (u(a.za) && a.ga === m && a.za === m) && (b.vf = "l");
return b
}
H.prototype.Oa = function () {
var a = La(Ka(this));
return "{}" === a ? "default" : a
};
function Ja(a, b, c) {
var d = {};
b && c ? (d.cancel = b, C(a, 3, d.cancel, k), d.U = c, va(a, 4, d.U)) : b && ("object" === typeof b && b !== m ? d.U = b : "function" === typeof b ? d.cancel = b : g(Error(B(a, 3, k) + "must either be a cancel callback or a context object.")));
return d
};
function K(a) {
if (a instanceof K) return a;
if (1 == arguments.length) {
this.m = a.split("/");
for (var b = 0, c = 0; c < this.m.length; c++) 0 < this.m[c].length && (this.m[b] = this.m[c], b++);
this.m.length = b;
this.aa = 0
} else this.m = arguments[0], this.aa = arguments[1]
}
function F(a) {
return a.aa >= a.m.length ? m : a.m[a.aa]
}
function Ma(a) {
var b = a.aa;
b < a.m.length && b++;
return new K(a.m, b)
}
t = K.prototype;
t.toString = function () {
for (var a = "", b = this.aa; b < this.m.length; b++) "" !== this.m[b] && (a += "/" + this.m[b]);
return a || "/"
};
t.parent = function () {
if (this.aa >= this.m.length) return m;
for (var a = [], b = this.aa; b < this.m.length - 1; b++) a.push(this.m[b]);
return new K(a, 0)
};
t.G = function (a) {
for (var b = [], c = this.aa; c < this.m.length; c++) b.push(this.m[c]);
if (a instanceof K)
for (c = a.aa; c < a.m.length; c++) b.push(a.m[c]);
else {
a = a.split("/");
for (c = 0; c < a.length; c++) 0 < a[c].length && b.push(a[c])
}
return new K(b, 0)
};
t.f = function () {
return this.aa >= this.m.length
};
function Na(a, b) {
var c = F(a);
if (c === m) return b;
if (c === F(b)) return Na(Ma(a), Ma(b));
g("INTERNAL ERROR: innerPath (" + b + ") is not within outerPath (" + a + ")")
}
t.contains = function (a) {
var b = 0;
if (this.m.length > a.m.length) return o;
for (; b < this.m.length;) {
if (this.m[b] !== a.m[b]) return o;
++b
}
return k
};
function Oa() {
this.children = {};
this.Xb = 0;
this.value = m
}
function Pa(a, b, c) {
this.Fa = a ? a : "";
this.Ib = b ? b : m;
this.z = c ? c : new Oa
}
function L(a, b) {
for (var c = b instanceof K ? b : new K(b), d = a, e;
(e = F(c)) !== m;) d = new Pa(e, d, wa(d.z.children, e) || new Oa), c = Ma(c);
return d
}
t = Pa.prototype;
t.k = function () {
return this.z.value
};
function Qa(a, b) {
z("undefined" !== typeof b);
a.z.value = b;
Ra(a)
}
t.clear = function () {
this.z.value = m;
this.z.children = {};
this.z.Xb = 0;
Ra(this)
};
t.ub = function () {
return 0 < this.z.Xb
};
t.f = function () {
return this.k() === m && !this.ub()
};
t.A = function (a) {
for (var b in this.z.children) a(new Pa(b, this, this.z.children[b]))
};
function Sa(a, b, c, d) {
c && !d && b(a);
a.A(function (a) {
Sa(a, b, k, d)
});
c && d && b(a)
}
function Ta(a, b, c) {
for (a = c ? a : a.parent(); a !== m;) {
if (b(a)) return k;
a = a.parent()
}
return o
}
t.path = function () {
return new K(this.Ib === m ? this.Fa : this.Ib.path() + "/" + this.Fa)
};
t.name = ba("Fa");
t.parent = ba("Ib");
function Ra(a) {
if (a.Ib !== m) {
var b = a.Ib,
c = a.Fa,
d = a.f(),
e = D(b.z.children, c);
d && e ? (delete b.z.children[c], b.z.Xb--, Ra(b)) : !d && !e && (b.z.children[c] = a.z, b.z.Xb++, Ra(b))
}
};
function Ua(a, b) {
this.Sa = a ? a : Va;
this.fa = b ? b : Wa
}
function Va(a, b) {
return a < b ? -1 : a > b ? 1 : 0
}
t = Ua.prototype;
t.sa = function (a, b) {
return new Ua(this.Sa, this.fa.sa(a, b, this.Sa).copy(m, m, o, m, m))
};
t.remove = function (a) {
return new Ua(this.Sa, this.fa.remove(a, this.Sa).copy(m, m, o, m, m))
};
t.get = function (a) {
for (var b, c = this.fa; !c.f();) {
b = this.Sa(a, c.key);
if (0 === b) return c.value;
0 > b ? c = c.left : 0 < b && (c = c.right)
}
return m
};
function Xa(a, b) {
for (var c, d = a.fa, e = m; !d.f();) {
c = a.Sa(b, d.key);
if (0 === c) {
if (d.left.f()) return e ? e.key : m;
for (d = d.left; !d.right.f();) d = d.right;
return d.key
}
0 > c ? d = d.left : 0 < c && (e = d, d = d.right)
}
g(Error("Attempted to find predecessor key for a nonexistent key. What gives?"))
}
t.f = function () {
return this.fa.f()
};
t.count = function () {
return this.fa.count()
};
t.Ab = function () {
return this.fa.Ab()
};
t.$a = function () {
return this.fa.$a()
};
t.Da = function (a) {
return this.fa.Da(a)
};
t.Pa = function (a) {
return this.fa.Pa(a)
};
t.Ya = function (a) {
return new Ya(this.fa, a)
};
function Ya(a, b) {
this.vd = b;
for (this.fc = []; !a.f();) this.fc.push(a), a = a.left
}
function Za(a) {
if (0 === a.fc.length) return m;
var b = a.fc.pop(),
c;
c = a.vd ? a.vd(b.key, b.value) : {
key: b.key,
value: b.value
};
for (b = b.right; !b.f();) a.fc.push(b), b = b.left;
return c
}
function $a(a, b, c, d, e) {
this.key = a;
this.value = b;
this.color = c != m ? c : k;
this.left = d != m ? d : Wa;
this.right = e != m ? e : Wa
}
t = $a.prototype;
t.copy = function (a, b, c, d, e) {
return new $a(a != m ? a : this.key, b != m ? b : this.value, c != m ? c : this.color, d != m ? d : this.left, e != m ? e : this.right)
};
t.count = function () {
return this.left.count() + 1 + this.right.count()
};
t.f = s(o);
t.Da = function (a) {
return this.left.Da(a) || a(this.key, this.value) || this.right.Da(a)
};
t.Pa = function (a) {
return this.right.Pa(a) || a(this.key, this.value) || this.left.Pa(a)
};
function ab(a) {
return a.left.f() ? a : ab(a.left)
}
t.Ab = function () {
return ab(this).key
};
t.$a = function () {
return this.right.f() ? this.key : this.right.$a()
};
t.sa = function (a, b, c) {
var d, e;
e = this;
d = c(a, e.key);
e = 0 > d ? e.copy(m, m, m, e.left.sa(a, b, c), m) : 0 === d ? e.copy(m, b, m, m, m) : e.copy(m, m, m, m, e.right.sa(a, b, c));
return bb(e)
};
function cb(a) {
if (a.left.f()) return Wa;
!a.left.O() && !a.left.left.O() && (a = db(a));
a = a.copy(m, m, m, cb(a.left), m);
return bb(a)
}
t.remove = function (a, b) {
var c, d;
c = this;
if (0 > b(a, c.key))!c.left.f() && (!c.left.O() && !c.left.left.O()) && (c = db(c)), c = c.copy(m, m, m, c.left.remove(a, b), m);
else {
c.left.O() && (c = eb(c));
!c.right.f() && (!c.right.O() && !c.right.left.O()) && (c = hb(c), c.left.left.O() && (c = eb(c), c = hb(c)));
if (0 === b(a, c.key)) {
if (c.right.f()) return Wa;
d = ab(c.right);
c = c.copy(d.key, d.value, m, m, cb(c.right))
}
c = c.copy(m, m, m, m, c.right.remove(a, b))
}
return bb(c)
};
t.O = ba("color");
function bb(a) {
a.right.O() && !a.left.O() && (a = ib(a));
a.left.O() && a.left.left.O() && (a = eb(a));
a.left.O() && a.right.O() && (a = hb(a));
return a
}
function db(a) {
a = hb(a);
a.right.left.O() && (a = a.copy(m, m, m, m, eb(a.right)), a = ib(a), a = hb(a));
return a
}
function ib(a) {
var b;
b = a.copy(m, m, k, m, a.right.left);
return a.right.copy(m, m, a.color, b, m)
}
function eb(a) {
var b;
b = a.copy(m, m, k, a.left.right, m);
return a.left.copy(m, m, a.color, m, b)
}
function hb(a) {
var b, c;
b = a.left.copy(m, m, !a.left.color, m, m);
c = a.right.copy(m, m, !a.right.color, m, m);
return a.copy(m, m, !a.color, b, c)
}
function jb() {}
t = jb.prototype;
t.copy = function () {
return this
};
t.sa = function (a, b) {
return new $a(a, b, j, j, j)
};
t.remove = function () {
return this
};
t.count = s(0);
t.f = s(k);
t.Da = s(o);
t.Pa = s(o);
t.Ab = s(m);
t.$a = s(m);
t.O = s(o);
var Wa = new jb;
function kb(a) {
this.$b = a;
this.oc = "firebase:"
}
kb.prototype.set = function (a, b) {
b == m ? this.$b.removeItem(this.oc + a) : this.$b.setItem(this.oc + a, y(b))
};
kb.prototype.get = function (a) {
a = this.$b.getItem(this.oc + a);
return a == m ? m : sa(a)
};
kb.prototype.remove = function (a) {
this.$b.removeItem(this.oc + a)
};
kb.prototype.nd = o;
function lb() {
this.nb = {}
}
lb.prototype.set = function (a, b) {
b == m ? delete this.nb[a] : this.nb[a] = b
};
lb.prototype.get = function (a) {
return D(this.nb, a) ? this.nb[a] : m
};
lb.prototype.remove = function (a) {
delete this.nb[a]
};
lb.prototype.nd = k;
function mb(a) {
try {
if ("undefined" !== typeof window && "undefined" !== typeof window[a]) {
var b = window[a];
b.setItem("firebase:sentinel", "cache");
b.removeItem("firebase:sentinel");
return new kb(b)
}
} catch (c) {}
return new lb
}
var nb = mb("localStorage"),
ob = mb("sessionStorage");
function pb(a, b, c, d) {
this.host = a.toLowerCase();
this.domain = this.host.substr(this.host.indexOf(".") + 1);
this.Qb = b;
this.Bb = c;
this.ie = d;
this.X = nb.get("host:" + a) || this.host
}
function qb(a, b) {
b !== a.X && (a.X = b, "s-" === a.X.substr(0, 2) && nb.set("host:" + a.host, a.X))
}
pb.prototype.toString = function () {
return (this.Qb ? "https://" : "http://") + this.host
};
function rb() {};
function sb() {
this.B = [];
this.zc = [];
this.Fd = [];
this.lc = [];
this.lc[0] = 128;
for (var a = 1; 64 > a; ++a) this.lc[a] = 0;
this.reset()
}
la(sb, rb);
sb.prototype.reset = function () {
this.B[0] = 1732584193;
this.B[1] = 4023233417;
this.B[2] = 2562383102;
this.B[3] = 271733878;
this.B[4] = 3285377520;
this.bd = this.vb = 0
};
function tb(a, b) {
var c;
c || (c = 0);
for (var d = a.Fd, e = c; e < c + 64; e += 4) d[e / 4] = b[e] << 24 | b[e + 1] << 16 | b[e + 2] << 8 | b[e + 3];
for (e = 16; 80 > e; e++) {
var f = d[e - 3] ^ d[e - 8] ^ d[e - 14] ^ d[e - 16];
d[e] = (f << 1 | f >>> 31) & 4294967295
}
c = a.B[0];
for (var h = a.B[1], i = a.B[2], l = a.B[3], n = a.B[4], p, e = 0; 80 > e; e++) 40 > e ? 20 > e ? (f = l ^ h & (i ^ l), p = 1518500249) : (f = h ^ i ^ l, p = 1859775393) : 60 > e ? (f = h & i | l & (h | i), p = 2400959708) : (f = h ^ i ^ l, p = 3395469782), f = (c << 5 | c >>> 27) + f + n + p + d[e] & 4294967295, n = l, l = i, i = (h << 30 | h >>> 2) & 4294967295, h = c, c = f;
a.B[0] = a.B[0] + c & 4294967295;
a.B[1] = a.B[1] + h &
4294967295;
a.B[2] = a.B[2] + i & 4294967295;
a.B[3] = a.B[3] + l & 4294967295;
a.B[4] = a.B[4] + n & 4294967295
}
sb.prototype.update = function (a, b) {
u(b) || (b = a.length);
var c = this.zc,
d = this.vb,
e = 0;
if (v(a))
for (; e < b;) c[d++] = a.charCodeAt(e++), 64 == d && (tb(this, c), d = 0);
else
for (; e < b;) c[d++] = a[e++], 64 == d && (tb(this, c), d = 0);
this.vb = d;
this.bd += b
};
var ub = Array.prototype,
vb = ub.forEach ? function (a, b, c) {
ub.forEach.call(a, b, c)
} : function (a, b, c) {
for (var d = a.length, e = v(a) ? a.split("") : a, f = 0; f < d; f++) f in e && b.call(c, e[f], f, a)
},
wb = ub.map ? function (a, b, c) {
return ub.map.call(a, b, c)
} : function (a, b, c) {
for (var d = a.length, e = Array(d), f = v(a) ? a.split("") : a, h = 0; h < d; h++) h in f && (e[h] = b.call(c, f[h], h, a));
return e
},
xb = ub.every ? function (a, b, c) {
return ub.every.call(a, b, c)
} : function (a, b, c) {
for (var d = a.length, e = v(a) ? a.split("") : a, f = 0; f < d; f++)
if (f in e && !b.call(c, e[f], f,
a)) return o;
return k
};
var yb, zb, Ab, Bb;
function Cb() {
return ca.navigator ? ca.navigator.userAgent : m
}
Bb = Ab = zb = yb = o;
var Db;
if (Db = Cb()) {
var Eb = ca.navigator;
yb = 0 == Db.indexOf("Opera");
zb = !yb && -1 != Db.indexOf("MSIE");
Ab = !yb && -1 != Db.indexOf("WebKit");
Bb = !yb && !Ab && "Gecko" == Eb.product
}
var Fb = zb,
Gb = Bb,
Hb = Ab;
var Ib;
if (yb && ca.opera) {
var Jb = ca.opera.version;
"function" == typeof Jb && Jb()
} else Gb ? Ib = /rv\:([^\);]+)(\)|;)/ : Fb ? Ib = /MSIE\s+([^\);]+)(\)|;)/ : Hb && (Ib = /WebKit\/(\S+)/), Ib && Ib.exec(Cb());
var Kb = m,
Lb = m;
function Mb(a, b) {
ga(a) || g(Error("encodeByteArray takes an array as a parameter"));
if (!Kb) {
Kb = {};
Lb = {};
for (var c = 0; 65 > c; c++) Kb[c] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c), Lb[c] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(c)
}
for (var c = b ? Lb : Kb, d = [], e = 0; e < a.length; e += 3) {
var f = a[e],
h = e + 1 < a.length,
i = h ? a[e + 1] : 0,
l = e + 2 < a.length,
n = l ? a[e + 2] : 0,
p = f >> 2,
f = (f & 3) << 4 | i >> 4,
i = (i & 15) << 2 | n >> 6,
n = n & 63;
l || (n = 64, h || (i = 64));
d.push(c[p], c[f], c[i], c[n])
}
return d.join("")
};
var Nb, Ob = 1;
Nb = function () {
return Ob++
};
function z(a, b) {
a || g(Error("Firebase INTERNAL ASSERT FAILED:" + b))
}
function Pb(a) {
a = ta(a);
return Mb(a, k)
}
function Qb(a) {
var b = ta(a),
a = new sb;
a.update(b);
var b = [],
c = 8 * a.bd;
56 > a.vb ? a.update(a.lc, 56 - a.vb) : a.update(a.lc, 64 - (a.vb - 56));
for (var d = 63; 56 <= d; d--) a.zc[d] = c & 255, c /= 256;
tb(a, a.zc);
for (d = c = 0; 5 > d; d++)
for (var e = 24; 0 <= e; e -= 8) b[c++] = a.B[d] >> e & 255;
return Mb(b)
}
function Rb() {
for (var a = "", b = 0; b < arguments.length; b++) a = ga(arguments[b]) ? a + Rb.apply(m, arguments[b]) : "object" === typeof arguments[b] ? a + y(arguments[b]) : a + arguments[b], a += " ";
return a
}
var Sb = m,
Tb = k;
function Ub() {
Tb === k && (Tb = o, Sb === m && ob.get("logging_enabled") === k && Vb(k));
if (Sb) {
var a = Rb.apply(m, arguments);
Sb(a)
}
}
function Wb(a) {
return function () {
Ub(a, arguments)
}
}
function Xb() {
if ("undefined" !== typeof console) {
var a = "FIREBASE INTERNAL ERROR: " + Rb.apply(m, arguments);
"undefined" !== typeof console.error ? console.error(a) : console.log(a)
}
}
function Yb() {
var a = Rb.apply(m, arguments);
g(Error("FIREBASE FATAL ERROR: " + a))
}
function M() {
if ("undefined" !== typeof console) {
var a = "FIREBASE WARNING: " + Rb.apply(m, arguments);
"undefined" !== typeof console.warn ? console.warn(a) : console.log(a)
}
}
function Da(a) {
return ha(a) && (a != a || a == Number.POSITIVE_INFINITY || a == Number.NEGATIVE_INFINITY)
}
function Zb(a, b) {
return a !== b ? a === m ? -1 : b === m ? 1 : typeof a !== typeof b ? "number" === typeof a ? -1 : 1 : a > b ? 1 : -1 : 0
}
function $b(a, b) {
if (a === b) return 0;
var c = ac(a),
d = ac(b);
return c !== m ? d !== m ? c - d : -1 : d !== m ? 1 : a < b ? -1 : 1
}
function bc(a, b) {
if (b && a in b) return b[a];
g(Error("Missing required key (" + a + ") in object: " + y(b)))
}
function La(a) {
if ("object" !== typeof a || a === m) return y(a);
var b = [],
c;
for (c in a) b.push(c);
b.sort();
c = "{";
for (var d = 0; d < b.length; d++) 0 !== d && (c += ","), c += y(b[d]), c += ":", c += La(a[b[d]]);
return c + "}"
}
function cc(a, b) {
if (a.length <= b) return [a];
for (var c = [], d = 0; d < a.length; d += b) d + b > a ? c.push(a.substring(d, a.length)) : c.push(a.substring(d, d + b));
return c
}
function dc(a, b) {
if ("array" == fa(a))
for (var c = 0; c < a.length; ++c) b(c, a[c]);
else ec(a, b)
}
function fc(a) {
z(!Da(a));
var b, c, d, e;
0 === a ? (d = c = 0, b = -Infinity === 1 / a ? 1 : 0) : (b = 0 > a, a = Math.abs(a), a >= Math.pow(2, -1022) ? (d = Math.min(Math.floor(Math.log(a) / Math.LN2), 1023), c = d + 1023, d = Math.round(a * Math.pow(2, 52 - d) - Math.pow(2, 52))) : (c = 0, d = Math.round(a / Math.pow(2, -1074))));
e = [];
for (a = 52; a; a -= 1) e.push(d % 2 ? 1 : 0), d = Math.floor(d / 2);
for (a = 11; a; a -= 1) e.push(c % 2 ? 1 : 0), c = Math.floor(c / 2);
e.push(b ? 1 : 0);
e.reverse();
b = e.join("");
c = "";
for (a = 0; 64 > a; a += 8) d = parseInt(b.substr(a, 8), 2).toString(16), 1 === d.length && (d = "0" + d), c += d;
return c.toLowerCase()
}
var gc = /^-?\d{1,10}$/;
function ac(a) {
return gc.test(a) && (a = Number(a), -2147483648 <= a && 2147483647 >= a) ? a : m
}
function hc(a) {
try {
a()
} catch (b) {
setTimeout(function () {
g(b)
})
}
};
function ic(a, b) {
this.F = a;
z(this.F !== m, "LeafNode shouldn't be created with null value.");
this.bb = "undefined" !== typeof b ? b : m
}
t = ic.prototype;
t.N = s(k);
t.j = ba("bb");
t.Ja = function (a) {
return new ic(this.F, a)
};
t.M = function () {
return N
};
t.S = function (a) {
return F(a) === m ? this : N
};
t.ha = s(m);
t.J = function (a, b) {
return (new O).J(a, b).Ja(this.bb)
};
t.Ba = function (a, b) {
var c = F(a);
return c === m ? b : this.J(c, N.Ba(Ma(a), b))
};
t.f = s(o);
t.gc = s(0);
t.W = function (a) {
return a && this.j() !== m ? {
".value": this.k(),
".priority": this.j()
} : this.k()
};
t.hash = function () {
var a = "";
this.j() !== m && (a += "priority:" + jc(this.j()) + ":");
var b = typeof this.F,
a = a + (b + ":"),
a = "number" === b ? a + fc(this.F) : a + this.F;
return Qb(a)
};
t.k = ba("F");
t.toString = function () {
return "string" === typeof this.F ? '"' + this.F + '"' : this.F
};
function kc(a, b) {
return Zb(a.la, b.la) || $b(a.name, b.name)
}
function lc(a, b) {
return $b(a.name, b.name)
}
function mc(a, b) {
return $b(a, b)
};
function O(a, b) {
this.o = a || new Ua(mc);
this.bb = "undefined" !== typeof b ? b : m
}
t = O.prototype;
t.N = s(o);
t.j = ba("bb");
t.Ja = function (a) {
return new O(this.o, a)
};
t.J = function (a, b) {
var c = this.o.remove(a);
b && b.f() && (b = m);
b !== m && (c = c.sa(a, b));
return b && b.j() !== m ? new nc(c, m, this.bb) : new O(c, this.bb)
};
t.Ba = function (a, b) {
var c = F(a);
if (c === m) return b;
var d = this.M(c).Ba(Ma(a), b);
return this.J(c, d)
};
t.f = function () {
return this.o.f()
};
t.gc = function () {
return this.o.count()
};
var oc = /^\d+$/;
t = O.prototype;
t.W = function (a) {
if (this.f()) return m;
var b = {},
c = 0,
d = 0,
e = k;
this.A(function (f, h) {
b[f] = h.W(a);
c++;
e && oc.test(f) ? d = Math.max(d, Number(f)) : e = o
});
if (!a && e && d < 2 * c) {
var f = [],
h;
for (h in b) f[h] = b[h];
return f
}
a && this.j() !== m && (b[".priority"] = this.j());
return b
};
t.hash = function () {
var a = "";
this.j() !== m && (a += "priority:" + jc(this.j()) + ":");
this.A(function (b, c) {
var d = c.hash();
"" !== d && (a += ":" + b + ":" + d)
});
return "" === a ? "" : Qb(a)
};
t.M = function (a) {
a = this.o.get(a);
return a === m ? N : a
};
t.S = function (a) {
var b = F(a);
return b === m ? this : this.M(b).S(Ma(a))
};
t.ha = function (a) {
return Xa(this.o, a)
};
t.jd = function () {
return this.o.Ab()
};
t.kd = function () {
return this.o.$a()
};
t.A = function (a) {
return this.o.Da(a)
};
t.Dc = function (a) {
return this.o.Pa(a)
};
t.Ya = function () {
return this.o.Ya()
};
t.toString = function () {
var a = "{",
b = k;
this.A(function (c, d) {
b ? b = o : a += ", ";
a += '"' + c + '" : ' + d.toString()
});
return a += "}"
};
var N = new O;
function nc(a, b, c) {
O.call(this, a, c);
b === m && (b = new Ua(kc), a.Da(function (a, c) {
b = b.sa({
name: a,
la: c.j()
}, c)
}));
this.ya = b
}
la(nc, O);
t = nc.prototype;
t.J = function (a, b) {
var c = this.M(a),
d = this.o,
e = this.ya;
c !== m && (d = d.remove(a), e = e.remove({
name: a,
la: c.j()
}));
b && b.f() && (b = m);
b !== m && (d = d.sa(a, b), e = e.sa({
name: a,
la: b.j()
}, b));
return new nc(d, e, this.j())
};
t.ha = function (a, b) {
var c = Xa(this.ya, {
name: a,
la: b.j()
});
return c ? c.name : m
};
t.A = function (a) {
return this.ya.Da(function (b, c) {
return a(b.name, c)
})
};
t.Dc = function (a) {
return this.ya.Pa(function (b, c) {
return a(b.name, c)
})
};
t.Ya = function () {
return this.ya.Ya(function (a, b) {
return {
key: a.name,
value: b
}
})
};
t.jd = function () {
return this.ya.f() ? m : this.ya.Ab().name
};
t.kd = function () {
return this.ya.f() ? m : this.ya.$a().name
};
function Q(a, b) {
if (a === m) return N;
var c = m;
"object" === typeof a && ".priority" in a ? c = a[".priority"] : "undefined" !== typeof b && (c = b);
z(c === m || "string" === typeof c || "number" === typeof c || "object" === typeof c && ".sv" in c);
"object" === typeof a && (".value" in a && a[".value"] !== m) && (a = a[".value"]);
if ("object" !== typeof a || ".sv" in a) return new ic(a, c);
if (a instanceof Array) {
var d = N;
ec(a, function (b, c) {
if (D(a, c) && "." !== c.substring(0, 1)) {
var e = Q(b);
if (e.N() || !e.f()) d = d.J(c, e)
}
});
return d.Ja(c)
}
var e = [],
f = {},
h = o;
dc(a, function (b,
c) {
if ("string" !== typeof c || "." !== c.substring(0, 1)) {
var d = Q(a[c]);
d.f() || (h = h || d.j() !== m, e.push({
name: c,
la: d.j()
}), f[c] = d)
}
});
var i = pc(e, f, o);
if (h) {
var l = pc(e, f, k);
return new nc(i, l, c)
}
return new O(i, c)
}
var qc = Math.log(2);
function rc(a) {
this.count = parseInt(Math.log(a + 1) / qc);
this.gd = this.count - 1;
this.Hd = a + 1 & parseInt(Array(this.count + 1).join("1"), 2)
}
function pc(a, b, c) {
function d(d, f) {
var h = n - d,
p = n;
n -= d;
var q = a[h].name,
h = new $a(c ? a[h] : q, b[q], f, m, e(h + 1, p));
i ? i.left = h : l = h;
i = h
}
function e(d, f) {
var h = f - d;
if (0 == h) return m;
if (1 == h) {
var h = a[d].name,
i = c ? a[d] : h;
return new $a(i, b[h], o, m, m)
}
var i = parseInt(h / 2) + d,
l = e(d, i),
n = e(i + 1, f),
h = a[i].name,
i = c ? a[i] : h;
return new $a(i, b[h], o, l, n)
}
var f = c ? kc : lc;
a.sort(f);
var h, f = new rc(a.length),
i = m,
l = m,
n = a.length;
for (h = 0; h < f.count; ++h) {
var p = !(f.Hd & 1 << f.gd);
f.gd--;
var q = Math.pow(2, f.count - (h + 1));
p ? d(q, o) : (d(q, o), d(q, k))
}
h =
l;
f = c ? kc : mc;
return h !== m ? new Ua(f, h) : new Ua(f)
}
function jc(a) {
return "number" === typeof a ? "number:" + fc(a) : "string:" + a
};
function R(a, b) {
this.z = a;
this.rc = b
}
R.prototype.W = function () {
A("Firebase.DataSnapshot.val", 0, 0, arguments.length);
return this.z.W()
};
R.prototype.val = R.prototype.W;
R.prototype.Md = function () {
A("Firebase.DataSnapshot.exportVal", 0, 0, arguments.length);
return this.z.W(k)
};
R.prototype.exportVal = R.prototype.Md;
R.prototype.G = function (a) {
A("Firebase.DataSnapshot.child", 0, 1, arguments.length);
ha(a) && (a = String(a));
Ia("Firebase.DataSnapshot.child", a);
var b = new K(a),
c = this.rc.G(b);
return new R(this.z.S(b), c)
};
R.prototype.child = R.prototype.G;
R.prototype.Hc = function (a) {
A("Firebase.DataSnapshot.hasChild", 1, 1, arguments.length);
Ia("Firebase.DataSnapshot.hasChild", a);
var b = new K(a);
return !this.z.S(b).f()
};
R.prototype.hasChild = R.prototype.Hc;
R.prototype.j = function () {
A("Firebase.DataSnapshot.getPriority", 0, 0, arguments.length);
return this.z.j()
};
R.prototype.getPriority = R.prototype.j;
R.prototype.forEach = function (a) {
A("Firebase.DataSnapshot.forEach", 1, 1, arguments.length);
C("Firebase.DataSnapshot.forEach", 1, a, o);
if (this.z.N()) return o;
var b = this;
return this.z.A(function (c, d) {
return a(new R(d, b.rc.G(c)))
})
};
R.prototype.forEach = R.prototype.forEach;
R.prototype.ub = function () {
A("Firebase.DataSnapshot.hasChildren", 0, 0, arguments.length);
return this.z.N() ? o : !this.z.f()
};
R.prototype.hasChildren = R.prototype.ub;
R.prototype.name = function () {
A("Firebase.DataSnapshot.name", 0, 0, arguments.length);
return this.rc.name()
};
R.prototype.name = R.prototype.name;
R.prototype.gc = function () {
A("Firebase.DataSnapshot.numChildren", 0, 0, arguments.length);
return this.z.gc()
};
R.prototype.numChildren = R.prototype.gc;
R.prototype.Tc = function () {
A("Firebase.DataSnapshot.ref", 0, 0, arguments.length);
return this.rc
};
R.prototype.ref = R.prototype.Tc;
function sc(a) {
z("array" == fa(a) && 0 < a.length);
this.Gd = a;
this.zb = {}
}
sc.prototype.Fc = aa();
sc.prototype.dd = function (a) {
for (var b = this.zb[a] || [], c = 0; c < b.length; c++) b[c].$.apply(b[c].U, Array.prototype.slice.call(arguments, 1))
};
sc.prototype.ab = function (a, b, c) {
tc(this, a);
this.zb[a] = this.zb[a] || [];
this.zb[a].push({
$: b,
U: c
});
(a = this.Fc(a)) && b.apply(c, a)
};
sc.prototype.Cb = function (a, b, c) {
tc(this, a);
for (var a = this.zb[a] || [], d = 0; d < a.length; d++)
if (a[d].$ === b && (!c || c === a[d].U)) {
a.splice(d, 1);
break
}
};
function tc(a, b) {
var c = a.Gd,
d;
a: {
d = function (a) {
return a === b
};
for (var e = c.length, f = v(c) ? c.split("") : c, h = 0; h < e; h++)
if (h in f && d.call(j, f[h])) {
d = h;
break a
}
d = -1
}
z(0 > d ? m : v(c) ? c.charAt(d) : c[d], "Unknown event: " + b)
};
function vc() {
sc.call(this, ["visible"]);
var a, b;
"undefined" !== typeof document && "undefined" !== typeof document.addEventListener && ("undefined" !== typeof document.hidden ? (b = "visibilitychange", a = "hidden") : "undefined" !== typeof document.mozHidden ? (b = "mozvisibilitychange", a = "mozHidden") : "undefined" !== typeof document.msHidden ? (b = "msvisibilitychange", a = "msHidden") : "undefined" !== typeof document.webkitHidden && (b = "webkitvisibilitychange", a = "webkitHidden"));
this.kb = k;
if (b) {
var c = this;
document.addEventListener(b,
function () {
var b = !document[a];
if (b !== c.kb) {
c.kb = b;
c.dd("visible", b)
}
}, o)
}
}
la(vc, sc);
ea(vc);
vc.prototype.Fc = function (a) {
z("visible" === a);
return [this.kb]
};
var wc = process.version;
if ("v0.10.22" === wc || "v0.10.23" === wc || "v0.10.24" === wc) {
var xc = require("_stream_writable");
xc.prototype.write = function (a, b, c) {
var d = this._writableState,
e = o;
"function" === typeof b && (c = b, b = m);
Buffer.isBuffer(a) ? b = "buffer" : b || (b = d.defaultEncoding);
"function" !== typeof c && (c = aa());
if (d.ended) {
var f = c,
h = Error("write after end");
this.emit("error", h);
process.nextTick(function () {
f(h)
})
} else {
var i = c,
l = k;
if (!Buffer.isBuffer(a) && "string" !== typeof a && a !== m && a !== j && !d.objectMode) {
var n = new TypeError("Invalid non-string/buffer chunk");
this.emit("error",
n);
process.nextTick(function () {
i(n)
});
l = o
}
l && (!d.objectMode && (d.decodeStrings !== o && "string" === typeof a) && (a = new Buffer(a, b)), Buffer.isBuffer(a) && (b = "buffer"), e = d.objectMode ? 1 : a.length, d.length += e, (l = d.length < d.highWaterMark) || (d.needDrain = k), d.writing ? d.buffer.push(new yc(a, b, c)) : (d.writelen = e, d.writecb = c, d.writing = k, d.sync = k, this._write(a, b, d.onwrite), d.sync = o), e = l)
}
return e
};
var yc = function (a, b, c) {
this.chunk = a;
this.encoding = b;
this.callback = c
};
require("_stream_duplex").prototype.write = xc.prototype.write
};
function ec(a, b) {
for (var c in a) b.call(j, a[c], c, a)
}
function zc(a) {
var b = {},
c;
for (c in a) b[c] = a[c];
return b
};
function Ac() {
this.ob = {}
}
function Bc(a, b, c) {
u(c) || (c = 1);
D(a.ob, b) || (a.ob[b] = 0);
a.ob[b] += c
}
Ac.prototype.get = function () {
return zc(this.ob)
};
function Cc(a) {
this.Id = a;
this.bc = m
}
Cc.prototype.get = function () {
var a = this.Id.get(),
b = zc(a);
if (this.bc)
for (var c in this.bc) b[c] -= this.bc[c];
this.bc = a;
return b
};
function Dc(a, b) {
this.Zc = {};
this.uc = new Cc(a);
this.u = b;
setTimeout(w(this.td, this), 10 + 6E4 * Math.random())
}
Dc.prototype.td = function () {
var a = this.uc.get(),
b = {},
c = o,
d;
for (d in a) 0 < a[d] && D(this.Zc, d) && (b[d] = a[d], c = k);
c && (a = this.u, a.R && (b = {
c: b
}, a.e("reportStats", b), a.Ha("s", b)));
setTimeout(w(this.td, this), 6E5 * Math.random())
};
var Ec = {},
Fc = {};
function Gc(a) {
a = a.toString();
Ec[a] || (Ec[a] = new Ac);
return Ec[a]
};
var Hc = m,
Hc = require("faye-websocket").Client;
function Ic(a, b, c) {
this.Yb = a;
this.e = Wb(this.Yb);
this.frames = this.xb = m;
this.ad = 0;
this.Z = Gc(b);
this.Ta = (b.Qb ? "wss://" : "ws://") + b.X + "/.ws?v=5";
b.host !== b.X && (this.Ta = this.Ta + "&ns=" + b.Bb);
c && (this.Ta = this.Ta + "&s=" + c)
}
var Jc;
Ic.prototype.open = function (a, b) {
this.ka = b;
this.Td = a;
this.e("Websocket connecting to " + this.Ta);
this.Y = new Hc(this.Ta);
this.La = o;
nb.set("previous_websocket_failure", k);
var c = this;
this.Y.onopen = function () {
c.e("Websocket connected.");
c.La = k
};
this.Y.onclose = function () {
c.e("Websocket connection was disconnected.");
c.Y = m;
c.ja()
};
this.Y.onmessage = function (a) {
if (c.Y !== m)
if (a = a.data, Bc(c.Z, "bytes_received", a.length), Kc(c), c.frames !== m) Lc(c, a);
else {
a: {
z(c.frames === m, "We already have a frame buffer");
if (6 >=
a.length) {
var b = Number(a);
if (!isNaN(b)) {
c.ad = b;
c.frames = [];
a = m;
break a
}
}
c.ad = 1;
c.frames = []
}
a !== m && Lc(c, a)
}
};
this.Y.onerror = function (a) {
c.e("WebSocket error. Closing connection.");
a.data && c.e(a.data);
c.ja()
}
};
Ic.prototype.start = aa();
Ic.isAvailable = function () {
var a = o;
if ("undefined" !== typeof navigator && navigator.userAgent) {
var b = navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);
b && 1 < b.length && 4.4 > parseFloat(b[1]) && (a = k)
}
return !a && Hc !== m && !Jc
};
Ic.responsesRequiredToBeHealthy = 2;
Ic.healthyTimeout = 3E4;
t = Ic.prototype;
t.cc = function () {
nb.remove("previous_websocket_failure")
};
function Lc(a, b) {
a.frames.push(b);
if (a.frames.length == a.ad) {
var c = a.frames.join("");
a.frames = m;
c = sa(c);
a.Td(c)
}
}
t.send = function (a) {
Kc(this);
a = y(a);
Bc(this.Z, "bytes_sent", a.length);
a = cc(a, 16384);
1 < a.length && this.Y.send(String(a.length));
for (var b = 0; b < a.length; b++) this.Y.send(a[b])
};
t.Ia = function () {
this.ca = k;
this.xb && (clearInterval(this.xb), this.xb = m);
this.Y && (this.Y.close(), this.Y = m)
};
t.ja = function () {
this.ca || (this.e("WebSocket is closing itself"), this.Ia(), this.ka && (this.ka(this.La), this.ka = m))
};
t.close = function () {
this.ca || (this.e("WebSocket is being closed"), this.Ia())
};
function Kc(a) {
clearInterval(a.xb);
a.xb = setInterval(function () {
a.Y && a.Y.send("0");
Kc(a)
}, 45E3)
};
function Mc(a) {
this.Pc = a;
this.nc = [];
this.Ua = 0;
this.Ac = -1;
this.Na = m
}
function Nc(a, b, c) {
for (a.nc[b] = c; a.nc[a.Ua];) {
var d = a.nc[a.Ua];
delete a.nc[a.Ua];
for (var e = 0; e < d.length; ++e)
if (d[e]) {
var f = a;
hc(function () {
f.Pc(d[e])
})
}
if (a.Ua === a.Ac) {
a.Na && (clearTimeout(a.Na), a.Na(), a.Na = m);
break
}
a.Ua++
}
};
function Oc() {
this.set = {}
}
t = Oc.prototype;
t.add = function (a, b) {
this.set[a] = b !== m ? b : k
};
t.contains = function (a) {
return D(this.set, a)
};
t.get = function (a) {
return this.contains(a) ? this.set[a] : j
};
t.remove = function (a) {
delete this.set[a]
};
t.clear = function () {
this.set = {}
};
t.f = function () {
var a;
a: {
for (a in this.set) {
a = o;
break a
}
a = k
}
return a
};
t.count = function () {
var a = 0,
b;
for (b in this.set) a++;
return a
};
function S(a, b) {
for (var c in a.set) D(a.set, c) && b(c, a.set[c])
}
t.keys = function () {
var a = [],
b;
for (b in this.set) D(this.set, b) && a.push(b);
return a
};
function Pc(a, b, c) {
this.Yb = a;
this.e = Wb(a);
this.me = b;
this.Z = Gc(b);
this.Qa = c;
this.La = o;
this.Ub = function (a) {
b.host !== b.X && (a.ns = b.Bb);
var c = [],
f;
for (f in a) a.hasOwnProperty(f) && c.push(f + "=" + a[f]);
return (b.Qb ? "https://" : "http://") + b.X + "/.lp?" + c.join("&")
}
}
var Qc, Rc;
Pc.prototype.open = function (a, b) {
this.pb = 0;
this.H = b;
this.qd = new Mc(a);
this.ca = o;
var c = this;
this.Q = setTimeout(function () {
c.e("Timed out trying to connect.");
c.ja();
c.Q = m
}, 3E4);
if (!c.ca) {
c.na = new Sc(function (a, b, d, i, l) {
Bc(c.Z, "bytes_received", y(arguments).length);
if (c.na)
if (c.Q && (clearTimeout(c.Q), c.Q = m), c.La = k, "start" == a) c.id = b, c.Jb = d;
else if ("close" === a)
if (b) {
c.na.yd = o;
var n = c.qd;
n.Ac = b;
n.Na = function () {
c.ja()
};
n.Ac < n.Ua && (n.Na(), n.Na = m)
} else c.ja();
else g(Error("Unrecognized command received: " + a))
},
function (a, b) {
Bc(c.Z, "bytes_received", y(arguments).length);
Nc(c.qd, a, b)
}, function () {
c.ja()
}, c.Ub);
var d = {
start: "t"
};
d.ser = Math.floor(1E8 * Math.random());
c.na.he && (d.cb = c.na.he);
d.v = "5";
c.Qa && (d.s = c.Qa);
d = c.Ub(d);
c.e("Connecting via long-poll to " + d);
Tc(c.na, d, aa())
}
};
Pc.prototype.start = function () {
var a = this.na,
b = this.Jb;
a.Lc = this.id;
a.pd = b;
for (a.xc = k; a.Ga(););
};
Pc.isAvailable = function () {
return !Rc && !("object" === typeof window && window.chrome && window.chrome.extension && !/^chrome/.test(window.location.href)) && !("object" === typeof Windows && "object" === typeof Windows.je) && (Qc || o)
};
t = Pc.prototype;
t.cc = aa();
t.Ia = function () {
this.ca = k;
this.na && (this.na.close(), this.na = m);
this.od && (document.body.removeChild(this.od), this.od = m);
this.Q && (clearTimeout(this.Q), this.Q = m)
};
t.ja = function () {
this.ca || (this.e("Longpoll is closing itself"), this.Ia(), this.H && (this.H(this.La), this.H = m))
};
t.close = function () {
this.ca || (this.e("Longpoll is being closed."), this.Ia())
};
t.send = function (a) {
a = y(a);
Bc(this.Z, "bytes_sent", a.length);
for (var a = Pb(a), a = cc(a, 1840), b = 0; b < a.length; b++) {
var c = this.na;
c.ea.push({
Vc: this.pb,
ed: a.length,
rb: a[b]
});
c.xc && c.Ga();
this.pb++
}
};
function Sc(a, b, c, d) {
this.Ub = d;
this.ka = c;
this.da = new Oc;
this.ea = [];
this.qb = Math.floor(1E8 * Math.random());
this.yd = k;
this.Jd = a;
this.Ud = b
}
Sc.prototype.close = function () {
this.xc = o;
if (this.ec) {
this.ec.ke.body.innerHTML = "";
var a = this;
setTimeout(function () {
a.ec !== m && (document.body.removeChild(a.ec), a.ec = m)
}, 0)
}
if (this.Lc) {
var b = {
disconn: "t"
};
b.id = this.Lc;
b.pw = this.pd;
b = this.Ub(b);
Uc(b)
}
if (b = this.ka) this.ka = m, b()
};
Sc.prototype.Ga = function () {
if (this.xc && this.yd && this.da.count() < (0 < this.ea.length ? 2 : 1)) {
this.qb++;
var a = {};
a.id = this.Lc;
a.pw = this.pd;
a.ser = this.qb;
for (var a = this.Ub(a), b = "", c = 0; 0 < this.ea.length;)
if (1870 >= this.ea[0].rb.length + 30 + b.length) {
var d = this.ea.shift(),
b = b + "&seg" + c + "=" + d.Vc + "&ts" + c + "=" + d.ed + "&d" + c + "=" + d.rb;
c++
} else break;
var a = a + b,
e = this.qb,
f = this;
f.da.add(e);
var h = function () {
f.da.remove(e);
f.Ga()
},
i = setTimeout(h, 25E3);
Tc(this, a, function () {
clearTimeout(i);
h()
});
return k
}
return o
};
function Uc(a, b) {
Vc || (Vc = require("request"));
Vc(a, function (a, d, e) {
a && g("Rest request for " + url + " failed.");
b && b(e)
})
}
var Vc;
function Tc(a, b, c) {
Uc({
url: b,
le: k
}, function (b) {
Wc(a, b);
c()
})
}
function Wc(a, b) {
eval("var document = function(pLPCommand, pRTLPCB) {" + b + "}");
document(a.Jd, a.Ud)
};
var Xc = require("http");
function Yc(a, b, c) {
this.Yb = a;
this.e = Wb(a);
this.D = b;
this.Z = Gc(b);
this.Qa = c;
this.ca = this.La = o;
this.da = new Oc;
this.buffer = {};
this.ea = [];
this.Zd = function (a) {
b.host !== b.X && (a.ns = b.Bb);
var c = [],
f;
for (f in a) a.hasOwnProperty(f) && c.push(f + "=" + a[f]);
return "/.hp?" + c.join("&")
}
}
Yc.isAvailable = s(o);
t = Yc.prototype;
t.cc = aa();
t.open = function (a, b) {
this.pb = 0;
this.H = b;
this.Yd = new Mc(a);
var c = this;
this.Q = setTimeout(function () {
c.e("Timed out trying to connect.");
c.close();
c.Q = m
}, 3E4);
var d = Math.floor(1E8 * Math.random()),
e = {
start: "t"
};
e.ser = d;
e.v = "5";
this.Qa && (e.s = this.Qa);
this.e("Connecting via httppoll to " + this.D.X);
Zc(this, d, e)
};
t.start = function () {
this.lb = k;
for (this.qb = Math.floor(1E8 * Math.random()); this.Ga(););
};
t.send = function (a) {
for (var a = y(a), a = Pb(a), a = cc(a, 1048576), b = 0; b < a.length; ++b) this.ea.push({
Vc: this.pb,
ed: a.length,
rb: a[b]
}), this.lb && this.Ga(), this.pb++
};
t.close = function () {
if (!this.ca) {
this.e("Httppoll is being closed");
if (this.lb && this.id && this.Jb) {
this.e("doing a disconnect");
var a = {};
a.id = this.id;
a.pw = this.Jb;
a.disconn = "t";
Zc(this, 0, a)
}
this.Ia()
}
};
t.Ga = function () {
if (this.lb && this.da.count() < (0 < this.ea.length ? 2 : 1)) {
var a = this.qb++,
b = {};
b.id = this.id;
b.pw = this.Jb;
b.ser = a;
for (var c = []; 0 < this.ea.length;)
if (1048608 >= this.ea[0].rb.length) {
var d = this.ea.shift();
c.push(d.Vc + ":" + d.ed + ":" + d.rb)
} else break;
var e = this,
d = setTimeout(function () {
e.da.remove(a);
e.Ga()
}, 25E3);
this.da.add(a, d);
Zc(this, a, b, c.join("\n"));
return k
}
return o
};
t.ja = function () {
this.ca || (this.e("Httppoll is closing itself"), this.Ia(), this.H && (this.H(this.La), this.H = m))
};
t.Ia = function () {
this.ca = k;
this.lb = o;
this.Q && (clearTimeout(this.Q), this.Q = m);
S(this.da, function (a) {
clearTimeout(a)
});
this.da.clear()
};
function Zc(a, b, c, d) {
var d = d || "",
c = a.Zd(c),
e = a.D.X,
f = e.split(":"),
h = a.D.Qb ? 443 : 80;
1 < f.length && (e = f[0], h = parseInt(f[1]));
c = Xc.request({
method: "POST",
host: e,
port: h,
path: c
}, function (c) {
if (a.Q) {
clearTimeout(a.Q);
a.Q = m
}
var d = a.da.get(b);
d && clearTimeout(d);
a.da.remove(b);
a.Ga();
if (c.statusCode != 200) {
a.e("error code received: " + c.statusCode);
a.ja()
} else {
if ("x-firebase-poll-id" in c.headers && "x-firebase-poll-pw" in c.headers) {
a.id = c.headers["x-firebase-poll-id"];
a.Jb = c.headers["x-firebase-poll-pw"]
}
if ("x-firebase-poll-close" in
c.headers) {
a.e("recvd close");
a.lb = o
}
c.on("data", function (b) {
b = b.toString();
a.buffer[c] = c in a.buffer ? a.buffer[c] + b : b
});
c.on("end", function () {
if (c in a.buffer) {
var b = a.buffer[c];
delete a.buffer[c];
var b = sa(b),
d = parseInt(bc("x-firebase-response", c.headers));
Nc(a.Yd, d, b)
}
})
}
});
c.on("error", function (b) {
a.e("An error occurred: " + b.message);
a.ja()
});
c.end(d)
};
function $c(a) {
var b = Ic && Ic.isAvailable(),
c = b && !(nb.nd || nb.get("previous_websocket_failure") === k);
a.ie && (b || M("wss:// URL used, but browser isn't known to support websockets. Trying anyway."), c = k);
if (c) this.Rb = [Ic];
else {
var d = this.Rb = [];
dc(ad, function (a, b) {
b && b.isAvailable() && d.push(b)
})
}
}
var ad = [Pc, Yc, Ic];
function bd(a, b, c, d, e, f) {
this.id = a;
this.e = Wb("c:" + this.id + ":");
this.Pc = c;
this.Fb = d;
this.H = e;
this.Oc = f;
this.D = b;
this.mc = [];
this.fd = 0;
this.cd = new $c(b);
this.oa = 0;
this.e("Connection created");
cd(this)
}
function cd(a) {
var b;
var c = a.cd;
0 < c.Rb.length ? b = c.Rb[0] : g(Error("No transports available"));
a.K = new b("c:" + a.id + ":" + a.fd++, a.D);
a.Sc = b.responsesRequiredToBeHealthy || 0;
var d = ed(a, a.K),
e = fd(a, a.K);
a.Sb = a.K;
a.Pb = a.K;
a.w = m;
a.Za = o;
setTimeout(function () {
a.K && a.K.open(d, e)
}, 0);
b = b.healthyTimeout || 0;
0 < b && (a.ac = setTimeout(function () {
a.ac = m;
a.Za || (a.e("Closing unhealthy connection after timeout."), a.close())
}, b))
}
function fd(a, b) {
return function (c) {
b === a.K ? (a.K = m, !c && 0 === a.oa ? (a.e("Realtime connection failed."), "s-" === a.D.X.substr(0, 2) && (nb.remove("host:" + a.D.host), a.D.X = a.D.host)) : 1 === a.oa && a.e("Realtime connection lost."), a.close()) : b === a.w ? (a.e("Secondary connection lost."), c = a.w, a.w = m, (a.Sb === c || a.Pb === c) && a.close()) : a.e("closing an old connection")
}
}
function ed(a, b) {
return function (c) {
if (2 != a.oa)
if (b === a.Pb) {
var d = bc("t", c),
c = bc("d", c);
if ("c" == d) {
if (d = bc("t", c), "d" in c)
if (c = c.d, "h" === d) {
var d = c.ts,
e = c.v,
f = c.h;
a.Qa = c.s;
qb(a.D, f);
if (0 == a.oa && (a.K.start(), c = a.K, a.e("Realtime connection established."), a.K = c, a.oa = 1, a.Fb && (a.Fb(d), a.Fb = m), 0 === a.Sc ? (a.e("Primary connection is healthy."), a.Za = k) : setTimeout(function () {
gd(a)
}, 5E3), "5" !== e && M("Protocol version mismatch detected"), c = 1 < a.cd.Rb.length ? a.cd.Rb[1] : m)) a.w = new c("c:" + a.id + ":" + a.fd++, a.D, a.Qa),
a.xd = c.responsesRequiredToBeHealthy || 0, a.w.open(ed(a, a.w), fd(a, a.w)), setTimeout(function () {
if (a.w) {
a.e("Timed out trying to upgrade.");
a.w.close()
}
}, 6E4)
} else if ("n" === d) {
a.e("recvd end transmission on primary");
a.Pb = a.w;
for (c = 0; c < a.mc.length; ++c) a.jc(a.mc[c]);
a.mc = [];
hd(a)
} else "s" === d ? (a.e("Connection shutdown command received. Shutting down..."), a.Oc && (a.Oc(c), a.Oc = m), a.H = m, a.close()) : "r" === d ? (a.e("Reset packet received. New host: " + c), qb(a.D, c), 1 === a.oa ? a.close() : (id(a), cd(a))) : "e" === d ? Xb("Server Error: " +
c) : "o" === d ? (a.e("got pong on primary."), jd(a), gd(a)) : Xb("Unknown control packet command: " + d)
} else "d" == d && a.jc(c)
} else b === a.w ? (d = bc("t", c), c = bc("d", c), "c" == d ? "t" in c && (c = c.t, "a" === c ? kd(a) : "r" === c ? (a.e("Got a reset on secondary, closing it"), a.w.close(), (a.Sb === a.w || a.Pb === a.w) && a.close()) : "o" === c && (a.e("got pong on secondary."), a.xd--, kd(a))) : "d" == d ? a.mc.push(c) : g(Error("Unknown protocol layer: " + d))) : a.e("message on old connection")
}
}
bd.prototype.zd = function (a) {
ld(this, {
t: "d",
d: a
})
};
function hd(a) {
a.Sb === a.w && a.Pb === a.w && (a.e("cleaning up and promoting a connection: " + a.w.Yb), a.K = a.w, a.w = m)
}
function kd(a) {
0 >= a.xd ? (a.e("Secondary connection is healthy."), a.Za = k, a.w.cc(), a.w.start(), a.e("sending client ack on secondary"), a.w.send({
t: "c",
d: {
t: "a",
d: {}
}
}), a.e("Ending transmission on primary"), a.K.send({
t: "c",
d: {
t: "n",
d: {}
}
}), a.Sb = a.w, hd(a)) : (a.e("sending ping on secondary."), a.w.send({
t: "c",
d: {
t: "p",
d: {}
}
}))
}
bd.prototype.jc = function (a) {
jd(this);
this.Pc(a)
};
function jd(a) {
a.Za || (a.Sc--, 0 >= a.Sc && (a.e("Primary connection is healthy."), a.Za = k, a.K.cc()))
}
function gd(a) {
!a.Za && 1 === a.oa && (a.e("sending ping on primary."), ld(a, {
t: "c",
d: {
t: "p",
d: {}
}
}))
}
function ld(a, b) {
1 !== a.oa && g("Connection is not connected");
a.Sb.send(b)
}
bd.prototype.close = function () {
2 !== this.oa && (this.e("Closing realtime connection."), this.oa = 2, id(this), this.H && (this.H(), this.H = m))
};
function id(a) {
a.e("Shutting down all connections");
a.K && (a.K.close(), a.K = m);
a.w && (a.w.close(), a.w = m);
a.ac && (clearTimeout(a.ac), a.ac = m)
};
function md() {
sc.call(this, ["online"]);
this.Gb = k;
if ("undefined" !== typeof window && "undefined" !== typeof window.addEventListener) {
var a = this;
window.addEventListener("online", function () {
a.Gb || a.dd("online", k);
a.Gb = k
}, o);
window.addEventListener("offline", function () {
a.Gb && a.dd("online", o);
a.Gb = o
}, o)
}
}
la(md, sc);
ea(md);
md.prototype.Fc = function (a) {
z("online" === a);
return [this.Gb]
};
function nd(a, b, c, d, e, f) {
this.id = od++;
this.e = Wb("p:" + this.id + ":");
this.Ra = k;
this.ia = {};
this.V = [];
this.Hb = 0;
this.Eb = [];
this.R = o;
this.ua = 1E3;
this.dc = 3E5;
this.kc = b || da;
this.ic = c || da;
this.Db = d || da;
this.Qc = e || da;
this.Gc = f || da;
this.D = a;
this.Uc = m;
this.Ob = {};
this.ce = 0;
this.yb = this.Kc = m;
pd(this, 0);
vc.tb().ab("visible", this.Wd, this); - 1 === a.host.indexOf("fblocal") && md.tb().ab("online", this.Vd, this)
}
var od = 0,
qd = 0;
t = nd.prototype;
t.Ha = function (a, b, c) {
var d = ++this.ce,
a = {
r: d,
a: a,
b: b
};
this.e(y(a));
z(this.R, "sendRequest_ call when we're not connected not allowed.");
this.ma.zd(a);
c && (this.Ob[d] = c)
};
function rd(a, b, c, d, e) {
a.e("Listen on " + b + " for " + c);
var f = {
p: b
},
d = wb(d, function (a) {
return Ka(a)
});
"{}" !== c && (f.q = d);
f.h = a.Gc(b);
a.Ha("l", f, function (d) {
a.e("listen response", d);
d = d.s;
"ok" !== d && sd(a, b, c);
e && e(d)
})
}
t.mb = function (a, b, c) {
this.Ka = {
Kd: a,
hd: o,
$: b,
Wb: c
};
this.e("Authenticating using credential: " + this.Ka);
td(this);
if (!(b = 40 == a.length)) a: {
var d;
try {
var e = a.split(".");
if (3 !== e.length) {
b = o;
break a
}
var f;
b: {
try {
f = (new Buffer(e[1], "base64")).toString("utf8");
break b
} catch (h) {
Ub("base64DecodeIfNativeSupport failed: ", h)
}
f = m
}
f !== m && (d = sa(f))
} catch (i) {
Ub("isAdminAuthToken_ failed", i)
}
b = "object" === typeof d && wa(d, "admin") === k
}
b && (this.e("Admin auth credential detected. Reducing max reconnect time."), this.dc =
3E4)
};
t.Tb = function (a) {
delete this.Ka;
this.Db(o);
this.R && this.Ha("unauth", {}, function (b) {
a(b.s, b.d)
})
};
function td(a) {
var b = a.Ka;
a.R && b && a.Ha("auth", {
cred: b.Kd
}, function (c) {
var d = c.s,
c = c.d || "error";
"ok" !== d && a.Ka === b && delete a.Ka;
a.Db("ok" === d);
b.hd ? "ok" !== d && b.Wb && b.Wb(d, c) : (b.hd = k, b.$ && b.$(d, c))
})
}
function ud(a, b, c, d) {
b = b.toString();
sd(a, b, c) && a.R && (a.e("Unlisten on " + b + " for " + c), b = {
p: b
}, d = wb(d, function (a) {
return Ka(a)
}), "{}" !== c && (b.q = d), a.Ha("u", b))
}
function vd(a, b, c, d) {
a.R ? wd(a, "o", b, c, d) : a.Eb.push({
Rc: b,
action: "o",
data: c,
C: d
})
}
t.Nc = function (a, b) {
this.R ? wd(this, "oc", a, m, b) : this.Eb.push({
Rc: a,
action: "oc",
data: m,
C: b
})
};
function wd(a, b, c, d, e) {
c = {
p: c,
d: d
};
a.e("onDisconnect " + b, c);
a.Ha(b, c, function (a) {
e && setTimeout(function () {
e(a.s, a.d)
}, 0)
})
}
t.put = function (a, b, c, d) {
xd(this, "p", a, b, c, d)
};
function xd(a, b, c, d, e, f) {
c = {
p: c,
d: d
};
u(f) && (c.h = f);
a.V.push({
action: b,
ud: c,
C: e
});
a.Hb++;
b = a.V.length - 1;
a.R && yd(a, b)
}
function yd(a, b) {
var c = a.V[b].action,
d = a.V[b].ud,
e = a.V[b].C;
a.V[b].$d = a.R;
a.Ha(c, d, function (d) {
a.e(c + " response", d);
delete a.V[b];
a.Hb--;
0 === a.Hb && (a.V = []);
e && e(d.s, d.d)
})
}
t.jc = function (a) {
if ("r" in a) {
this.e("from server: " + y(a));
var b = a.r,
c = this.Ob[b];
c && (delete this.Ob[b], c(a.b))
} else "error" in a && g("A server-side error has occurred: " + a.error), "a" in a && (b = a.a, a = a.b, this.e("handleServerMessage", b, a), "d" === b ? this.kc(a.p, a.d) : "m" === b ? this.kc(a.p, a.d, k) : "c" === b ? (b = a.p, a = (a = a.q) ? wb(a, function (a) {
return La(a)
}).join("$") : "{}", (a = sd(this, b, a)) && a.C && a.C("permission_denied")) : "ac" === b ? (b = a.s, a = a.d, c = this.Ka, delete this.Ka, c && c.Wb && c.Wb(b, a), this.Db(o)) : "sd" === b ? this.Uc ? this.Uc(a) :
"msg" in a && "undefined" !== typeof console && console.log("FIREBASE: " + a.msg.replace("\n", "\nFIREBASE: ")) : Xb("Unrecognized action received from server: " + y(b) + "\nAre you using the latest client?"))
};
t.Fb = function (a) {
this.e("connection ready");
this.R = k;
this.yb = (new Date).getTime();
this.Qc({
serverTimeOffset: a - (new Date).getTime()
});
td(this);
for (var b in this.ia)
for (var c in this.ia[b]) a = this.ia[b][c], rd(this, b, c, a.eb, a.C);
for (b = 0; b < this.V.length; b++) this.V[b] && yd(this, b);
for (; this.Eb.length;) b = this.Eb.shift(), wd(this, b.action, b.Rc, b.data, b.C);
this.ic(k)
};
function pd(a, b) {
z(!a.ma, "Scheduling a connect when we're already connected/ing?");
a.Wa && clearTimeout(a.Wa);
a.Wa = setTimeout(function () {
a.Wa = m;
if (a.Ra) {
a.e("Making a connection attempt");
a.Kc = (new Date).getTime();
a.yb = m;
var b = w(a.jc, a),
d = w(a.Fb, a),
e = w(a.rd, a),
f = a.id + ":" + qd++;
a.ma = new bd(f, a.D, b, d, e, function (b) {
M(b + " (" + a.D.toString() + ")");
a.Ra = o
})
}
}, b)
}
t.Wd = function (a) {
a && (!this.kb && this.ua === this.dc) && (this.e("Window became visible. Reducing delay."), this.ua = 1E3, this.ma || pd(this, 0));
this.kb = a
};
t.Vd = function (a) {
a ? (this.e("Browser went online. Reconnecting."), this.ua = 1E3, this.Ra = k, this.ma || pd(this, 0)) : (this.e("Browser went offline. Killing connection; don't reconnect."), this.Ra = o, this.ma && this.ma.close())
};
t.rd = function () {
this.e("data client disconnected");
this.R = o;
this.ma = m;
for (var a = 0; a < this.V.length; a++) {
var b = this.V[a];
b && ("h" in b.ud && b.$d) && (b.C && b.C("disconnect"), delete this.V[a], this.Hb--)
}
0 === this.Hb && (this.V = []);
if (this.Ra) this.kb ? this.yb && (3E4 < (new Date).getTime() - this.yb && (this.ua = 1E3), this.yb = m) : (this.e("Window isn't visible. Delaying reconnect."), this.ua = this.dc, this.Kc = (new Date).getTime()), a = Math.max(0, this.ua - ((new Date).getTime() - this.Kc)), a *= Math.random(), this.e("Trying to reconnect in " +
a + "ms"), pd(this, a), this.ua = Math.min(this.dc, 1.3 * this.ua);
else
for (var c in this.Ob) delete this.Ob[c];
this.ic(o)
};
t.Ma = function () {
this.Ra = o;
this.ma ? this.ma.close() : (this.Wa && (clearTimeout(this.Wa), this.Wa = m), this.R && this.rd())
};
t.gb = function () {
this.Ra = k;
this.ua = 1E3;
this.R || pd(this, 0)
};
function sd(a, b, c) {
b = (new K(b)).toString();
c || (c = "{}");
var d = a.ia[b][c];
delete a.ia[b][c];
return d
};
function zd() {
this.o = this.F = m
}
function Ad(a, b, c) {
if (b.f()) a.F = c, a.o = m;
else if (a.F !== m) a.F = a.F.Ba(b, c);
else {
a.o == m && (a.o = new Oc);
var d = F(b);
a.o.contains(d) || a.o.add(d, new zd);
a = a.o.get(d);
b = Ma(b);
Ad(a, b, c)
}
}
function Bd(a, b) {
if (b.f()) return a.F = m, a.o = m, k;
if (a.F !== m) {
if (a.F.N()) return o;
var c = a.F;
a.F = m;
c.A(function (b, c) {
Ad(a, new K(b), c)
});
return Bd(a, b)
}
return a.o !== m ? (c = F(b), b = Ma(b), a.o.contains(c) && Bd(a.o.get(c), b) && a.o.remove(c), a.o.f() ? (a.o = m, k) : o) : k
}
function Cd(a, b, c) {
a.F !== m ? c(b, a.F) : a.A(function (a, e) {
var f = new K(b.toString() + "/" + a);
Cd(e, f, c)
})
}
zd.prototype.A = function (a) {
this.o !== m && S(this.o, function (b, c) {
a(b, c)
})
};
function Dd() {
this.va = N
}
function T(a, b) {
return a.va.S(b)
}
function U(a, b, c) {
a.va = a.va.Ba(b, c)
}
Dd.prototype.toString = function () {
return this.va.toString()
};
function Ed() {
this.wa = new Dd;
this.P = new Dd;
this.qa = new Dd;
this.Kb = new Pa
}
function Fd(a, b) {
for (var c = T(a.wa, b), d = T(a.P, b), e = L(a.Kb, b), f = o, h = e; h !== m;) {
if (h.k() !== m) {
f = k;
break
}
h = h.parent()
}
if (f) return o;
c = Gd(c, d, e);
return c !== d ? (U(a.P, b, c), k) : o
}
function Gd(a, b, c) {
if (c.f()) return a;
if (c.k() !== m) return b;
a = a || N;
c.A(function (d) {
var d = d.name(),
e = a.M(d),
f = b.M(d),
h = L(c, d),
e = Gd(e, f, h);
a = a.J(d, e)
});
return a
}
Ed.prototype.set = function (a, b) {
var c = this,
d = [];
vb(b, function (a) {
var b = a.path,
a = a.ta,
h = Nb();
Qa(L(c.Kb, b), h);
U(c.P, b, a);
d.push({
path: b,
de: h
})
});
return d
};
function Hd(a, b) {
vb(b, function (b) {
var d = b.de,
b = L(a.Kb, b.path),
e = b.k();
z(e !== m, "pendingPut should not be null.");
e === d && Qa(b, m)
})
};
function Id() {
this.Xa = []
}
function Jd(a, b) {
if (0 !== b.length)
for (var c = 0; c < b.length; c++) a.Xa.push(b[c])
}
Id.prototype.Mb = function () {
for (var a = 0; a < this.Xa.length; a++)
if (this.Xa[a]) {
var b = this.Xa[a];
this.Xa[a] = m;
Kd(b)
}
this.Xa = []
};
function Kd(a) {
var b = a.$,
c = a.Ad,
d = a.Lb;
hc(function () {
b(c, d)
})
};
function V(a, b, c, d) {
this.type = a;
this.xa = b;
this.ba = c;
this.Lb = d
};
function Ld(a) {
this.L = a;
this.ra = [];
this.Cc = new Id
}
function Md(a, b, c, d, e) {
a.ra.push({
type: b,
$: c,
cancel: d,
U: e
});
var d = [],
f = Nd(a.i);
a.wb && f.push(new V("value", a.i));
for (var h = 0; h < f.length; h++)
if (f[h].type === b) {
var i = new J(a.L.n, a.L.path);
f[h].ba && (i = i.G(f[h].ba));
d.push({
$: e ? w(c, e) : c,
Ad: new R(f[h].xa, i),
Lb: f[h].Lb
})
}
Jd(a.Cc, d)
}
Ld.prototype.pc = function (a, b) {
b = this.qc(a, b);
b != m && Od(this, b)
};
function Od(a, b) {
for (var c = [], d = 0; d < b.length; d++) {
var e = b[d],
f = e.type,
h = new J(a.L.n, a.L.path);
b[d].ba && (h = h.G(b[d].ba));
h = new R(b[d].xa, h);
"value" === e.type && !h.ub() ? f += "(" + h.W() + ")" : "value" !== e.type && (f += " " + h.name());
Ub(a.L.n.u.id + ": event:" + a.L.path + ":" + a.L.Oa() + ":" + f);
for (f = 0; f < a.ra.length; f++) {
var i = a.ra[f];
b[d].type === i.type && c.push({
$: i.U ? w(i.$, i.U) : i.$,
Ad: h,
Lb: e.Lb
})
}
}
Jd(a.Cc, c)
}
Ld.prototype.Mb = function () {
this.Cc.Mb()
};
function Nd(a) {
var b = [];
if (!a.N()) {
var c = m;
a.A(function (a, e) {
b.push(new V("child_added", e, a, c));
c = a
})
}
return b
}
function Qd(a) {
a.wb || (a.wb = k, Od(a, [new V("value", a.i)]))
};
function Rd(a, b) {
Ld.call(this, a);
this.i = b
}
la(Rd, Ld);
Rd.prototype.qc = function (a, b) {
this.i = a;
this.wb && b != m && b.push(new V("value", this.i));
return b
};
Rd.prototype.sb = function () {
return {}
};
function Sd(a, b) {
this.Zb = a;
this.Mc = b
}
function Td(a, b, c, d, e) {
var f = a.S(c),
h = b.S(c),
d = new Sd(d, e),
e = Ud(d, c, f, h),
h = !f.f() && !h.f() && f.j() !== h.j();
if (e || h) {
f = c;
for (c = e; f.parent() !== m;) {
var i = a.S(f),
e = b.S(f),
l = f.parent();
if (!d.Zb || L(d.Zb, l).k()) {
var n = b.S(l),
p = [],
f = f.aa < f.m.length ? f.m[f.m.length - 1] : m;
i.f() ? (i = n.ha(f, e), p.push(new V("child_added", e, f, i))) : e.f() ? p.push(new V("child_removed", i, f)) : (i = n.ha(f, e), h && p.push(new V("child_moved", e, f, i)), c && p.push(new V("child_changed", e, f, i)));
d.Mc(l, n, p)
}
h && (h = o, c = k);
f = l
}
}
}
function Ud(a, b, c, d) {
var e, f = [];
c === d ? e = o : c.N() && d.N() ? e = c.k() !== d.k() : c.N() ? (Vd(a, b, N, d, f), e = k) : d.N() ? (Vd(a, b, c, N, f), e = k) : e = Vd(a, b, c, d, f);
e ? a.Mc(b, d, f) : c.j() !== d.j() && a.Mc(b, d, m);
return e
}
function Vd(a, b, c, d, e) {
var f = o,
h = !a.Zb || !L(a.Zb, b).f(),
i = [],
l = [],
n = [],
p = [],
q = {},
r = {},
x, P, I, G;
x = c.Ya();
I = Za(x);
P = d.Ya();
for (G = Za(P); I !== m || G !== m;) {
c = I === m ? 1 : G === m ? -1 : I.key === G.key ? 0 : kc({
name: I.key,
la: I.value.j()
}, {
name: G.key,
la: G.value.j()
});
if (0 > c) f = wa(q, I.key), u(f) ? (n.push({
Ec: I,
$c: i[f]
}), i[f] = m) : (r[I.key] = l.length, l.push(I)), f = k, I = Za(x);
else {
if (0 < c) f = wa(r, G.key), u(f) ? (n.push({
Ec: l[f],
$c: G
}), l[f] = m) : (q[G.key] = i.length, i.push(G)), f = k;
else {
c = b.G(G.key);
if (c = Ud(a, c, I.value, G.value)) p.push(G), f = k;
I.value.j() !==
G.value.j() && (n.push({
Ec: I,
$c: G
}), f = k);
I = Za(x)
}
G = Za(P)
} if (!h && f) return k
}
for (h = 0; h < l.length; h++)
if (q = l[h]) c = b.G(q.key), Ud(a, c, q.value, N), e.push(new V("child_removed", q.value, q.key));
for (h = 0; h < i.length; h++)
if (q = i[h]) c = b.G(q.key), l = d.ha(q.key, q.value), Ud(a, c, N, q.value), e.push(new V("child_added", q.value, q.key, l));
for (h = 0; h < n.length; h++) q = n[h].Ec, i = n[h].$c, c = b.G(i.key), l = d.ha(i.key, i.value), e.push(new V("child_moved", i.value, i.key, l)), (c = Ud(a, c, q.value, i.value)) && p.push(i);
for (h = 0; h < p.length; h++) a = p[h],
l = d.ha(a.key, a.value), e.push(new V("child_changed", a.value, a.key, l));
return f
};
function Wd() {
this.T = this.Aa = m;
this.set = {}
}
la(Wd, Oc);
t = Wd.prototype;
t.setActive = function (a) {
this.Aa = a
};
function Xd(a) {
return a.contains("default")
}
function Yd(a) {
return a.Aa != m && Xd(a)
}
t.defaultView = function () {
return Xd(this) ? this.get("default") : m
};
t.path = ba("T");
t.toString = function () {
return wb(this.keys(), function (a) {
return "default" === a ? "{}" : a
}).join("$")
};
t.eb = function () {
var a = [];
S(this, function (b, c) {
a.push(c.L)
});
return a
};
function Zd(a, b) {
Ld.call(this, a);
this.i = N;
this.qc(b, Nd(b))
}
la(Zd, Ld);
Zd.prototype.qc = function (a, b) {
if (b === m) return b;
var c = [],
d = this.L;
u(d.ga) && (u(d.za) && d.za != m ? c.push(function (a, b) {
var c = Zb(b, d.ga);
return 0 < c || 0 === c && 0 <= $b(a, d.za)
}) : c.push(function (a, b) {
return 0 <= Zb(b, d.ga)
}));
u(d.Ca) && (u(d.Va) ? c.push(function (a, b) {
var c = Zb(b, d.Ca);
return 0 > c || 0 === c && 0 >= $b(a, d.Va)
}) : c.push(function (a, b) {
return 0 >= Zb(b, d.Ca)
}));
var e = m,
f = m;
if (u(this.L.Ea))
if (u(this.L.ga)) {
if (e = $d(a, c, this.L.Ea, o)) {
var h = a.M(e).j();
c.push(function (a, b) {
var c = Zb(b, h);
return 0 > c || 0 === c && 0 >= $b(a, e)
})
}
} else if (f =
$d(a, c, this.L.Ea, k)) {
var i = a.M(f).j();
c.push(function (a, b) {
var c = Zb(b, i);
return 0 < c || 0 === c && 0 <= $b(a, f)
})
}
for (var l = [], n = [], p = [], q = [], r = 0; r < b.length; r++) {
var x = b[r].ba,
P = b[r].xa;
switch (b[r].type) {
case "child_added":
ae(c, x, P) && (this.i = this.i.J(x, P), n.push(b[r]));
break;
case "child_removed":
this.i.M(x).f() || (this.i = this.i.J(x, m), l.push(b[r]));
break;
case "child_changed":
!this.i.M(x).f() && ae(c, x, P) && (this.i = this.i.J(x, P), q.push(b[r]));
break;
case "child_moved":
var I = !this.i.M(x).f(),
G = ae(c, x, P);
I ? G ? (this.i =
this.i.J(x, P), p.push(b[r])) : (l.push(new V("child_removed", this.i.M(x), x)), this.i = this.i.J(x, m)) : G && (this.i = this.i.J(x, P), n.push(b[r]))
}
}
var dd = e || f;
if (dd) {
var Pd = (r = f !== m) ? this.i.jd() : this.i.kd(),
uc = o,
fb = o,
gb = this;
(r ? a.Dc : a.A).call(a, function (a, b) {
!fb && Pd === m && (fb = k);
if (fb && uc) return k;
uc ? (l.push(new V("child_removed", gb.i.M(a), a)), gb.i = gb.i.J(a, m)) : fb && (n.push(new V("child_added", b, a)), gb.i = gb.i.J(a, b));
Pd === a && (fb = k);
a === dd && (uc = k)
})
}
for (r = 0; r < n.length; r++) c = n[r], x = this.i.ha(c.ba, c.xa), l.push(new V("child_added",
c.xa, c.ba, x));
for (r = 0; r < p.length; r++) c = p[r], x = this.i.ha(c.ba, c.xa), l.push(new V("child_moved", c.xa, c.ba, x));
for (r = 0; r < q.length; r++) c = q[r], x = this.i.ha(c.ba, c.xa), l.push(new V("child_changed", c.xa, c.ba, x));
this.wb && 0 < l.length && l.push(new V("value", this.i));
return l
};
function $d(a, b, c, d) {
if (a.N()) return m;
var e = m;
(d ? a.Dc : a.A).call(a, function (a, d) {
if (ae(b, a, d) && (e = a, c--, 0 === c)) return k
});
return e
}
function ae(a, b, c) {
for (var d = 0; d < a.length; d++)
if (!a[d](b, c.j())) return o;
return k
}
Zd.prototype.Hc = function (a) {
return this.i.M(a) !== N
};
Zd.prototype.sb = function (a, b, c) {
var d = {};
this.i.N() || this.i.A(function (a) {
d[a] = 3
});
var e = this.i,
c = T(c, new K("")),
f = new Pa;
Qa(L(f, this.L.path), k);
var b = N.Ba(a, b),
h = this;
Td(c, b, a, f, function (a, b, c) {
c !== m && a.toString() === h.L.path.toString() && h.qc(b, c)
});
this.i.N() ? ec(d, function (a, b) {
d[b] = 2
}) : (this.i.A(function (a) {
D(d, a) || (d[a] = 1)
}), ec(d, function (a, b) {
h.i.M(b).f() && (d[b] = 2)
}));
this.i = e;
return d
};
function be(a, b) {
this.u = a;
this.g = b;
this.hc = b.va;
this.pa = new Pa
}
be.prototype.Vb = function (a, b, c, d, e) {
var f = a.path,
h = L(this.pa, f),
i = h.k();
i === m ? (i = new Wd, Qa(h, i)) : z(!i.f(), "We shouldn't be storing empty QueryMaps");
var l = a.Oa();
if (i.contains(l)) a = i.get(l), Md(a, b, c, d, e);
else {
var n = this.g.va.S(f),
n = a = "default" === a.Oa() ? new Rd(a, n) : new Zd(a, n);
if (Yd(i) || ce(h)) i.add(l, n), i.T || (i.T = n.L.path);
else {
var p, q;
i.f() || (p = i.toString(), q = i.eb());
i.add(l, n);
i.T || (i.T = n.L.path);
i.setActive(de(this, i));
p && q && ud(this.u, i.path(), p, q)
}
Yd(i) && Sa(h, function (a) {
if (a = a.k()) {
a.Aa && a.Aa();
a.Aa = m
}
});
Md(a, b, c, d, e);
(b = (b = Ta(L(this.pa, f), function (a) {
var b;
if (b = a.k())
if (b = a.k().defaultView()) b = a.k().defaultView().wb;
if (b) return k
}, k)) || this.u === m && !T(this.g, f).f()) && Qd(a)
}
a.Mb()
};
function ee(a, b, c, d, e) {
var f = a.get(b),
h;
if (h = f) {
h = o;
for (var i = f.ra.length - 1; 0 <= i; i--) {
var l = f.ra[i];
if ((!c || l.type === c) && (!d || l.$ === d) && (!e || l.U === e))
if (f.ra.splice(i, 1), h = k, c && d) break
}
h = h && !(0 < f.ra.length)
}(c = h) && a.remove(b);
return c
}
be.prototype.sc = function (a, b, c, d) {
var e = L(this.pa, a.path).k();
return e === m ? m : fe(this, e, a, b, c, d)
};
function fe(a, b, c, d, e, f) {
var h = b.path(),
h = L(a.pa, h),
c = c ? c.Oa() : m,
i = [];
c && "default" !== c ? ee(b, c, d, e, f) && i.push(c) : vb(b.keys(), function (a) {
ee(b, a, d, e, f) && i.push(a)
});
b.f() && Qa(h, m);
c = ce(h);
if (0 < i.length && !c) {
for (var l = h, n = h.parent(), c = o; !c && n;) {
var p = n.k();
if (p) {
z(!Yd(p));
var q = l.name(),
r = o;
S(p, function (a, b) {
r = b.Hc(q) || r
});
r && (c = k)
}
l = n;
n = n.parent()
}
l = m;
if (!Yd(b)) {
n = b.Aa;
b.Aa = m;
var x = [],
P = function (b) {
var c = b.k();
if (c && Xd(c)) x.push(c.path()), c.Aa == m && c.setActive(de(a, c));
else {
if (c) {
c.Aa != m || c.setActive(de(a,
c));
var d = {};
S(c, function (a, b) {
b.i.A(function (a) {
D(d, a) || (d[a] = k, a = c.path().G(a), x.push(a))
})
})
}
b.A(P)
}
};
P(h);
l = x;
n && n()
}
return c ? m : l
}
return m
}
function ge(a, b, c) {
Sa(L(a.pa, b), function (a) {
(a = a.k()) && S(a, function (a, b) {
Qd(b)
})
}, c, k)
}
function W(a, b, c) {
function d(a) {
do {
if (h[a.toString()]) return k;
a = a.parent()
} while (a !== m);
return o
}
var e = a.hc,
f = a.g.va;
a.hc = f;
for (var h = {}, i = 0; i < c.length; i++) h[c[i].toString()] = k;
Td(e, f, b, a.pa, function (c, e, f) {
if (b.contains(c)) {
var h = d(c);
h && ge(a, c, o);
a.pc(c, e, f);
h && ge(a, c, k)
} else a.pc(c, e, f)
});
d(b) && ge(a, b, k);
he(a, b)
}
function he(a, b) {
var c = L(a.pa, b);
Sa(c, function (a) {
(a = a.k()) && S(a, function (a, b) {
b.Mb()
})
}, k, k);
Ta(c, function (a) {
(a = a.k()) && S(a, function (a, b) {
b.Mb()
})
}, o)
}
be.prototype.pc = function (a, b, c) {
a = L(this.pa, a).k();
a !== m && S(a, function (a, e) {
e.pc(b, c)
})
};
function ce(a) {
return Ta(a, function (a) {
return a.k() && Yd(a.k())
})
}
function de(a, b) {
if (a.u) {
var c = a.u,
d = b.path(),
e = b.toString(),
f = b.eb(),
h, i = b.keys(),
l = Xd(b),
n = a.u,
p = function (c) {
if ("ok" !== c) {
var d = "Unknown Error";
"too_big" === c ? d = "The data requested exceeds the maximum size that can be accessed with a single request." : "permission_denied" == c ? d = "Client doesn't have permission to access the desired data." : "unavailable" == c && (d = "The service is unavailable");
var e = Error(c + ": " + d);
e.code = c.toUpperCase();
M("on() or once() for " + b.path().toString() + " failed: " + e.toString());
b && (S(b, function (a, b) {
for (var c = 0; c < b.ra.length; c++) {
var d = b.ra[c];
d.cancel && (d.U ? w(d.cancel, d.U) : d.cancel)(e)
}
}), fe(a, b))
} else h || (l ? ge(a, b.path(), k) : vb(i, function (a) {
(a = b.get(a)) && Qd(a)
}), he(a, b.path()))
},
q = b.toString(),
r = b.path().toString();
n.ia[r] = n.ia[r] || {};
z(!n.ia[r][q], "listen() called twice for same path/queryId.");
n.ia[r][q] = {
eb: b.eb(),
C: p
};
n.R && rd(n, r, q, b.eb(), p);
return function () {
h = k;
ud(c, d, e, f)
}
}
return da
}
be.prototype.sb = function (a, b, c, d) {
var e = {};
S(b, function (b, h) {
var i = h.sb(a, c, d);
ec(i, function (a, b) {
e[b] = 3 === a ? 3 : (wa(e, b) || a) === a ? a : 3
})
});
c.N() || c.A(function (a) {
D(e, a) || (e[a] = 4)
});
return e
};
function ie(a, b, c, d, e) {
var f = b.path(),
b = a.sb(f, b, d, e),
h = N,
i = [];
ec(b, function (b, n) {
var p = new K(n);
3 === b || 1 === b ? h = h.J(n, d.S(p)) : (2 === b && i.push({
path: f.G(n),
ta: N
}), i = i.concat(je(a, d.S(p), L(c, p), e)))
});
return [{
path: f,
ta: h
}].concat(i)
}
function ke(a, b, c, d) {
var e;
a: {
var f = L(a.pa, b);
e = f.parent();
for (var h = []; e !== m;) {
var i = e.k();
if (i !== m) {
if (Xd(i)) {
e = [{
path: b,
ta: c
}];
break a
}
i = a.sb(b, i, c, d);
f = wa(i, f.name());
if (3 === f || 1 === f) {
e = [{
path: b,
ta: c
}];
break a
}
2 === f && h.push({
path: b,
ta: N
})
}
f = e;
e = e.parent()
}
e = h
}
if (1 == e.length && (!e[0].ta.f() || c.f())) return e;
h = L(a.pa, b);
f = h.k();
f !== m ? Xd(f) ? e.push({
path: b,
ta: c
}) : e = e.concat(ie(a, f, h, c, d)) : e = e.concat(je(a, c, h, d));
return e
}
function je(a, b, c, d) {
var e = c.k();
if (e !== m) return Xd(e) ? [{
path: c.path(),
ta: b
}] : ie(a, e, c, b, d);
var f = [];
c.A(function (c) {
var e = b.N() ? N : b.M(c.name()),
c = je(a, e, c, d);
f = f.concat(c)
});
return f
};
function le(a, b) {
if (!a || "object" !== typeof a) return a;
z(".sv" in a, "Unexpected leaf node or priority contents");
return b[a[".sv"]]
}
function me(a, b) {
var c = le(a.j(), b),
d;
if (a.N()) {
var e = le(a.k(), b);
return e !== a.k() || c !== a.j() ? new ic(e, c) : a
}
d = a;
c !== a.j() && (d = d.Ja(c));
a.A(function (a, c) {
var e = me(c, b);
e !== c && (d = d.J(a, e))
});
return d
};
function ne(a) {
this.D = a;
this.Z = Gc(a);
this.u = new nd(this.D, w(this.kc, this), w(this.ic, this), w(this.Db, this), w(this.Qc, this), w(this.Gc, this));
var b = w(function () {
return new Dc(this.Z, this.u)
}, this),
a = a.toString();
Fc[a] || (Fc[a] = b());
this.Bd = Fc[a];
this.ib = new Pa;
this.jb = new Dd;
this.g = new Ed;
this.I = new be(this.u, this.g.qa);
this.Ic = new Dd;
this.Jc = new be(m, this.Ic);
oe(this, "connected", o);
oe(this, "authenticated", o);
this.H = new zd;
this.Bc = 0
}
t = ne.prototype;
t.toString = function () {
return (this.D.Qb ? "https://" : "http://") + this.D.host
};
t.name = function () {
return this.D.Bb
};
function pe(a) {
a = T(a.Ic, new K(".info/serverTimeOffset")).W() || 0;
return (new Date).getTime() + a
}
function qe(a) {
a = a = {
timestamp: pe(a)
};
a.timestamp = a.timestamp || (new Date).getTime();
return a
}
t.kc = function (a, b, c) {
this.Bc++;
this.md && (b = this.md(a, b));
var d, e, f = [];
9 <= a.length && a.lastIndexOf(".priority") === a.length - 9 ? (d = new K(a.substring(0, a.length - 9)), e = T(this.g.wa, d).Ja(b), f.push(d)) : c ? (d = new K(a), e = T(this.g.wa, d), ec(b, function (a, b) {
var c = new K(b);
".priority" === b ? e = e.Ja(a) : (e = e.Ba(c, Q(a)), f.push(d.G(b)))
})) : (d = new K(a), e = Q(b), f.push(d));
a = ke(this.I, d, e, this.g.P);
b = o;
for (c = 0; c < a.length; ++c) {
var h = a[c],
i = this.g,
l = h.path;
U(i.wa, l, h.ta);
b = Fd(i, l) || b
}
b && (d = re(this, d));
W(this.I, d, f)
};
t.ic = function (a) {
oe(this, "connected", a);
if (a === o) {
this.e("onDisconnectEvents");
var b = this,
c = [],
d = qe(this),
a = Cd,
e = new zd;
Cd(this.H, new K(""), function (a, b) {
Ad(e, a, me(b, d))
});
a(e, new K(""), function (a, d) {
var e = ke(b.I, a, d, b.g.P);
c.push.apply(c, b.g.set(a, e));
e = se(b, a);
re(b, e);
W(b.I, e, [a])
});
Hd(this.g, c);
this.H = new zd
}
};
t.Qc = function (a) {
var b = this;
dc(a, function (a, d) {
oe(b, d, a)
})
};
t.Gc = function (a) {
a = new K(a);
return T(this.g.wa, a).hash()
};
t.Db = function (a) {
oe(this, "authenticated", a)
};
function oe(a, b, c) {
b = new K("/.info/" + b);
U(a.Ic, b, Q(c));
W(a.Jc, b, [b])
}
t.mb = function (a, b, c) {
"firebaseio-demo.com" === this.D.domain && M("FirebaseRef.auth() not supported on demo (*.firebaseio-demo.com) Firebases. Please use on production (*.firebaseio.com) Firebases only.");
this.u.mb(a, function (a, c) {
X(b, a, c)
}, function (a, b) {
M("auth() was canceled: " + b);
if (c) {
var f = Error(b);
f.code = a.toUpperCase();
c(f)
}
})
};
t.Tb = function (a) {
this.u.Tb(function (b, c) {
X(a, b, c)
})
};
t.hb = function (a, b, c, d) {
this.e("set", {
path: a.toString(),
value: b,
la: c
});
var e = qe(this),
b = Q(b, c),
e = me(b, e),
e = ke(this.I, a, e, this.g.P),
f = this.g.set(a, e),
h = this;
this.u.put(a.toString(), b.W(k), function (b, c) {
"ok" !== b && M("set at " + a + " failed: " + b);
Hd(h.g, f);
Fd(h.g, a);
var e = re(h, a);
W(h.I, e, []);
X(d, b, c)
});
e = se(this, a);
re(this, e);
W(this.I, e, [a])
};
t.update = function (a, b, c) {
this.e("update", {
path: a.toString(),
value: b
});
var d = T(this.g.qa, a),
e = k,
f = [],
h = qe(this),
i = [],
l;
for (l in b) {
var e = o,
n = Q(b[l]),
n = me(n, h),
d = d.J(l, n),
p = a.G(l);
f.push(p);
n = ke(this.I, p, n, this.g.P);
i = i.concat(this.g.set(a, n))
}
if (e) Ub("update() called with empty data. Don't do anything."), X(c, "ok");
else {
var q = this;
xd(this.u, "m", a.toString(), b, function (b, d) {
z("ok" === b || "permission_denied" === b, "merge at " + a + " failed.");
"ok" !== b && M("update at " + a + " failed: " + b);
Hd(q.g, i);
Fd(q.g, a);
var e =
re(q, a);
W(q.I, e, []);
X(c, b, d)
}, j);
b = se(this, a);
re(this, b);
W(q.I, b, f)
}
};
t.Wc = function (a, b, c) {
this.e("setPriority", {
path: a.toString(),
la: b
});
var d = qe(this),
d = le(b, d),
d = T(this.g.P, a).Ja(d),
d = ke(this.I, a, d, this.g.P),
e = this.g.set(a, d),
f = this;
this.u.put(a.toString() + "/.priority", b, function (b, d) {
"permission_denied" === b && M("setPriority at " + a + " failed: " + b);
Hd(f.g, e);
Fd(f.g, a);
var l = re(f, a);
W(f.I, l, []);
X(c, b, d)
});
b = re(this, a);
W(f.I, b, [])
};
t.Nc = function (a, b) {
var c = this;
this.u.Nc(a.toString(), function (d, e) {
"ok" === d && Bd(c.H, a);
X(b, d, e)
})
};
function te(a, b, c, d) {
var e = Q(c);
vd(a.u, b.toString(), e.W(k), function (c, h) {
"ok" === c && Ad(a.H, b, e);
X(d, c, h)
})
}
function ue(a) {
Bc(a.Z, "deprecated_on_disconnect");
a.Bd.Zc.deprecated_on_disconnect = k
}
t.Vb = function (a, b, c, d, e) {
".info" === F(a.path) ? this.Jc.Vb(a, b, c, d, e) : this.I.Vb(a, b, c, d, e)
};
t.sc = function (a, b, c, d) {
if (".info" === F(a.path)) this.Jc.sc(a, b, c, d);
else {
b = this.I.sc(a, b, c, d);
if (c = b !== m) {
for (var c = this.g, d = a.path, e = [], f = 0; f < b.length; ++f) e[f] = T(c.wa, b[f]);
U(c.wa, d, N);
for (f = 0; f < b.length; ++f) U(c.wa, b[f], e[f]);
c = Fd(c, d)
}
c && (z(this.g.qa.va === this.I.hc, "We should have raised any outstanding events by now. Else, we'll blow them away."), U(this.g.qa, a.path, T(this.g.P, a.path)), this.I.hc = this.g.qa.va)
}
};
t.Ma = function () {
this.u.Ma()
};
t.gb = function () {
this.u.gb()
};
t.Xc = function (a) {
if ("undefined" !== typeof console) {
a ? (this.uc || (this.uc = new Cc(this.Z)), a = this.uc.get()) : a = this.Z.get();
var b = a,
c = [],
d = 0,
e;
for (e in b) c[d++] = e;
var f = function (a, b) {
return Math.max(b.length, a)
};
if (c.reduce) e = c.reduce(f, 0);
else {
var h = 0;
vb(c, function (a) {
h = f.call(j, h, a)
});
e = h
}
for (var i in a) {
b = a[i];
for (c = i.length; c < e + 2; c++) i += " ";
console.log(i + b)
}
}
};
t.Yc = function (a) {
Bc(this.Z, a);
this.Bd.Zc[a] = k
};
t.e = function () {
Ub("r:" + this.u.id + ":", arguments)
};
function X(a, b, c) {
a && hc(function () {
if ("ok" == b) a(m, c);
else {
var d = (b || "error").toUpperCase(),
e = d;
c && (e += ": " + c);
e = Error(e);
e.code = d;
a(e)
}
})
};
function ve(a, b) {
var c = b || a.ib;
b || we(a, c);
if (c.k() !== m) {
var d = xe(a, c);
z(0 < d.length);
if (xb(d, function (a) {
return 1 === a.status
})) {
for (var e = c.path(), f = 0; f < d.length; f++) z(1 === d[f].status, "tryToSendTransactionQueue_: items in queue should all be run."), d[f].status = 2, d[f].wd++;
c = T(a.g.P, e).hash();
U(a.g.P, e, T(a.g.qa, e));
for (var h = T(a.jb, e).W(k), i = Nb(), l = {}, n = 0; n < d.length; n++) d[n].yc && (l[d[n].path.toString()] = d[n].path);
var p = [],
q;
for (q in l) p.push(l[q]);
for (f = 0; f < p.length; f++) Qa(L(a.g.Kb, p[f]), i);
a.u.put(e.toString(),
h, function (b) {
a.e("transaction put response", {
path: e.toString(),
status: b
});
for (f = 0; f < p.length; f++) {
var c = L(a.g.Kb, p[f]),
h = c.k();
z(h !== m, "sendTransactionQueue_: pendingPut should not be null.");
h === i && (Qa(c, m), U(a.g.P, p[f], T(a.g.wa, p[f])))
}
if ("ok" === b) {
b = [];
for (f = 0; f < d.length; f++) d[f].status = 3, d[f].C && (c = ye(a, d[f].path), b.push(w(d[f].C, m, m, k, c))), d[f].vc();
we(a, L(a.ib, e));
ve(a);
for (f = 0; f < b.length; f++) hc(b[f])
} else {
if ("datastale" === b)
for (f = 0; f < d.length; f++) d[f].status = 4 === d[f].status ? 5 : 1;
else {
M("transaction at " +
e + " failed: " + b);
for (f = 0; f < d.length; f++) d[f].status = 5, d[f].wc = b
}
b = re(a, e);
W(a.I, b, [e])
}
}, c)
}
} else c.ub() && c.A(function (b) {
ve(a, b)
})
}
function re(a, b) {
var c = ze(a, b),
d = c.path(),
c = xe(a, c);
U(a.g.qa, d, T(a.g.P, d));
U(a.jb, d, T(a.g.P, d));
if (0 !== c.length) {
for (var e = T(a.g.qa, d), f = e, h = [], i = 0; i < c.length; i++) {
var l = Na(d, c[i].path),
n = o,
p;
z(l !== m, "rerunTransactionsUnderNode_: relativePath should not be null.");
if (5 === c[i].status) n = k, p = c[i].wc;
else if (1 === c[i].status)
if (25 <= c[i].wd) n = k, p = "maxretry";
else {
var q = e.S(l),
r = c[i].update(q.W());
if (u(r)) {
Ba("transaction failed: Data returned ", r);
var x = Q(r);
"object" === typeof r && r != m && D(r, ".priority") ||
(x = x.Ja(q.j()));
e = e.Ba(l, x);
c[i].yc && (f = f.Ba(l, x))
} else n = k, p = "nodata"
}
n && (c[i].status = 3, setTimeout(c[i].vc, 0), c[i].C && (n = new J(a, c[i].path), l = new R(e.S(l), n), "nodata" === p ? h.push(w(c[i].C, m, m, o, l)) : h.push(w(c[i].C, m, Error(p), o, l))))
}
U(a.jb, d, e);
U(a.g.qa, d, f);
we(a, a.ib);
for (i = 0; i < h.length; i++) hc(h[i]);
ve(a)
}
return d
}
function ze(a, b) {
for (var c, d = a.ib;
(c = F(b)) !== m && d.k() === m;) d = L(d, c), b = Ma(b);
return d
}
function xe(a, b) {
var c = [];
Ae(a, b, c);
c.sort(function (a, b) {
return a.sd - b.sd
});
return c
}
function Ae(a, b, c) {
var d = b.k();
if (d !== m)
for (var e = 0; e < d.length; e++) c.push(d[e]);
b.A(function (b) {
Ae(a, b, c)
})
}
function we(a, b) {
var c = b.k();
if (c) {
for (var d = 0, e = 0; e < c.length; e++) 3 !== c[e].status && (c[d] = c[e], d++);
c.length = d;
Qa(b, 0 < c.length ? c : m)
}
b.A(function (b) {
we(a, b)
})
}
function se(a, b) {
var c = ze(a, b).path(),
d = L(a.ib, b);
Ta(d, function (a) {
Be(a)
});
Be(d);
Sa(d, function (a) {
Be(a)
});
return c
}
function Be(a) {
var b = a.k();
if (b !== m) {
for (var c = [], d = -1, e = 0; e < b.length; e++) 4 !== b[e].status && (2 === b[e].status ? (z(d === e - 1, "All SENT items should be at beginning of queue."), d = e, b[e].status = 4, b[e].wc = "set") : (z(1 === b[e].status), b[e].vc(), b[e].C && c.push(w(b[e].C, m, Error("set"), o, m)))); - 1 === d ? Qa(a, m) : b.length = d + 1;
for (e = 0; e < c.length; e++) hc(c[e])
}
}
function ye(a, b) {
var c = new J(a, b);
return new R(T(a.jb, b), c)
};
function Y() {
this.fb = {}
}
ea(Y);
Y.prototype.Ma = function () {
for (var a in this.fb) this.fb[a].Ma()
};
Y.prototype.interrupt = Y.prototype.Ma;
Y.prototype.gb = function () {
for (var a in this.fb) this.fb[a].gb()
};
Y.prototype.resume = Y.prototype.gb;
var Z = {
Pd: function (a) {
var b = O.prototype.hash;
O.prototype.hash = a;
var c = ic.prototype.hash;
ic.prototype.hash = a;
return function () {
O.prototype.hash = b;
ic.prototype.hash = c
}
}
};
Z.hijackHash = Z.Pd;
Z.Oa = function (a) {
return a.Oa()
};
Z.queryIdentifier = Z.Oa;
Z.Sd = function (a) {
return a.n.u.ia
};
Z.listens = Z.Sd;
Z.ae = function (a) {
return a.n.u.ma
};
Z.refConnection = Z.ae;
Z.Dd = nd;
Z.DataConnection = Z.Dd;
nd.prototype.sendRequest = nd.prototype.Ha;
nd.prototype.interrupt = nd.prototype.Ma;
Z.Ed = bd;
Z.RealTimeConnection = Z.Ed;
bd.prototype.sendRequest = bd.prototype.zd;
bd.prototype.close = bd.prototype.close;
Z.Cd = pb;
Z.ConnectionTarget = Z.Cd;
Z.Nd = function () {
Qc = Jc = k
};
Z.forceLongPolling = Z.Nd;
Z.Od = function () {
Rc = k
};
Z.forceWebSockets = Z.Od;
Z.fe = function (a, b) {
a.n.u.Uc = b
};
Z.setSecurityDebugCallback = Z.fe;
Z.Xc = function (a, b) {
a.n.Xc(b)
};
Z.stats = Z.Xc;
Z.Yc = function (a, b) {
a.n.Yc(b)
};
Z.statsIncrementCounter = Z.Yc;
Z.Bc = function (a) {
return a.n.Bc
};
Z.Qd = function (a, b) {
a.n.md = b
};
Z.interceptServerData = Z.Qd;
function $(a, b, c) {
this.Nb = a;
this.T = b;
this.Fa = c
}
$.prototype.cancel = function (a) {
A("Firebase.onDisconnect().cancel", 0, 1, arguments.length);
C("Firebase.onDisconnect().cancel", 1, a, k);
this.Nb.Nc(this.T, a)
};
$.prototype.cancel = $.prototype.cancel;
$.prototype.remove = function (a) {
A("Firebase.onDisconnect().remove", 0, 1, arguments.length);
E("Firebase.onDisconnect().remove", this.T);
C("Firebase.onDisconnect().remove", 1, a, k);
te(this.Nb, this.T, m, a)
};
$.prototype.remove = $.prototype.remove;
$.prototype.set = function (a, b) {
A("Firebase.onDisconnect().set", 1, 2, arguments.length);
E("Firebase.onDisconnect().set", this.T);
Aa("Firebase.onDisconnect().set", a, o);
C("Firebase.onDisconnect().set", 2, b, k);
te(this.Nb, this.T, a, b)
};
$.prototype.set = $.prototype.set;
$.prototype.hb = function (a, b, c) {
A("Firebase.onDisconnect().setWithPriority", 2, 3, arguments.length);
E("Firebase.onDisconnect().setWithPriority", this.T);
Aa("Firebase.onDisconnect().setWithPriority", a, o);
Fa("Firebase.onDisconnect().setWithPriority", 2, b, o);
C("Firebase.onDisconnect().setWithPriority", 3, c, k);
(".length" === this.Fa || ".keys" === this.Fa) && g("Firebase.onDisconnect().setWithPriority failed: " + this.Fa + " is a read-only object.");
var d = this.Nb,
e = this.T,
f = Q(a, b);
vd(d.u, e.toString(), f.W(k), function (a,
b) {
"ok" === a && Ad(d.H, e, f);
X(c, a, b)
})
};
$.prototype.setWithPriority = $.prototype.hb;
$.prototype.update = function (a, b) {
A("Firebase.onDisconnect().update", 1, 2, arguments.length);
E("Firebase.onDisconnect().update", this.T);
Ea("Firebase.onDisconnect().update", a);
C("Firebase.onDisconnect().update", 2, b, k);
var c = this.Nb,
d = this.T,
e = k,
f;
for (f in a) e = o;
if (e) Ub("onDisconnect().update() called with empty data. Don't do anything."), X(b, "ok");
else {
e = c.u;
f = d.toString();
var h = function (e, f) {
if ("ok" === e)
for (var h in a) {
var p = Q(a[h]);
Ad(c.H, d.G(h), p)
}
X(b, e, f)
};
e.R ? wd(e, "om", f, a, h) : e.Eb.push({
Rc: f,
action: "om",
data: a,
C: h
})
}
};
$.prototype.update = $.prototype.update;
var Ce, De = 0,
Ee = [];
Ce = function (a) {
var b = a === De;
De = a;
for (var c = Array(8), d = 7; 0 <= d; d--) c[d] = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(a % 64), a = Math.floor(a / 64);
z(0 === a);
a = c.join("");
if (b) {
for (d = 11; 0 <= d && 63 === Ee[d]; d--) Ee[d] = 0;
Ee[d]++
} else
for (d = 0; 12 > d; d++) Ee[d] = Math.floor(64 * Math.random());
for (d = 0; 12 > d; d++) a += "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(Ee[d]);
z(20 === a.length, "NextPushId: Length should be 20.");
return a
};
function J() {
var a, b, c;
if (arguments[0] instanceof ne) c = arguments[0], a = arguments[1];
else {
A("new Firebase", 1, 2, arguments.length);
var d = arguments[0];
b = a = "";
var e = k,
f = "";
if (v(d)) {
var h = d.indexOf("//");
if (0 <= h) var i = d.substring(0, h - 1),
d = d.substring(h + 2);
h = d.indexOf("/"); - 1 === h && (h = d.length);
a = d.substring(0, h);
var d = d.substring(h + 1),
l = a.split(".");
if (3 == l.length) {
h = l[2].indexOf(":");
e = 0 <= h ? "https" === i || "wss" === i : k;
if ("firebase" === l[1]) Yb(a + " is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead");
else {
b = l[0];
f = "";
d = ("/" + d).split("/");
for (h = 0; h < d.length; h++)
if (0 < d[h].length) {
l = d[h];
try {
l = decodeURIComponent(l.replace(/\+/g, " "))
} catch (n) {}
f += "/" + l
}
}
b = b.toLowerCase()
} else b = m
}
e || "undefined" !== typeof window && (window.location && window.location.protocol && -1 !== window.location.protocol.indexOf("https:")) && M("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");
a = new pb(a, e, b, "ws" === i || "wss" === i);
b = new K(f);
e = b.toString();
if (!(i = !v(a.host)))
if (!(i = 0 === a.host.length))
if (!(i = !za(a.Bb)))
if (i = 0 !== e.length) e && (e = e.replace(/^\/*\.info(\/|$)/, "/")), i = !(v(e) && 0 !== e.length && !ya.test(e));
i && g(Error(B("new Firebase", 1, o) + 'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".'));
arguments[1] ? arguments[1] instanceof Y ? c = arguments[1] : g(Error("Expected a valid Firebase.Context for second argument to new Firebase()")) : c = Y.tb();
e = a.toString();
i = wa(c.fb, e);
i || (i = new ne(a), c.fb[e] = i);
c = i;
a = b
}
H.call(this, c, a)
}
la(J, H);
var Fe = J,
Ge = ["Firebase"],
He = ca;
!(Ge[0] in He) && He.execScript && He.execScript("var " + Ge[0]);
for (var Ie; Ge.length && (Ie = Ge.shift());)!Ge.length && u(Fe) ? He[Ie] = Fe : He = He[Ie] ? He[Ie] : He[Ie] = {};
module.exports = J;
J.prototype.name = function () {
A("Firebase.name", 0, 0, arguments.length);
return this.path.f() ? m : this.path.aa < this.path.m.length ? this.path.m[this.path.m.length - 1] : m
};
J.prototype.name = J.prototype.name;
J.prototype.G = function (a) {
A("Firebase.child", 1, 1, arguments.length);
if (ha(a)) a = String(a);
else if (!(a instanceof K))
if (F(this.path) === m) {
var b = a;
b && (b = b.replace(/^\/*\.info(\/|$)/, "/"));
Ia("Firebase.child", b)
} else Ia("Firebase.child", a);
return new J(this.n, this.path.G(a))
};
J.prototype.child = J.prototype.G;
J.prototype.parent = function () {
A("Firebase.parent", 0, 0, arguments.length);
var a = this.path.parent();
return a === m ? m : new J(this.n, a)
};
J.prototype.parent = J.prototype.parent;
J.prototype.root = function () {
A("Firebase.ref", 0, 0, arguments.length);
for (var a = this; a.parent() !== m;) a = a.parent();
return a
};
J.prototype.root = J.prototype.root;
J.prototype.toString = function () {
A("Firebase.toString", 0, 0, arguments.length);
var a;
if (this.parent() === m) a = this.n.toString();
else {
a = this.parent().toString() + "/";
var b = this.name();
a += encodeURIComponent(String(b))
}
return a
};
J.prototype.toString = J.prototype.toString;
J.prototype.set = function (a, b) {
A("Firebase.set", 1, 2, arguments.length);
E("Firebase.set", this.path);
Aa("Firebase.set", a, o);
C("Firebase.set", 2, b, k);
return this.n.hb(this.path, a, m, b)
};
J.prototype.set = J.prototype.set;
J.prototype.update = function (a, b) {
A("Firebase.update", 1, 2, arguments.length);
E("Firebase.update", this.path);
Ea("Firebase.update", a);
C("Firebase.update", 2, b, k);
D(a, ".priority") && g(Error("update() does not currently support updating .priority."));
return this.n.update(this.path, a, b)
};
J.prototype.update = J.prototype.update;
J.prototype.hb = function (a, b, c) {
A("Firebase.setWithPriority", 2, 3, arguments.length);
E("Firebase.setWithPriority", this.path);
Aa("Firebase.setWithPriority", a, o);
Fa("Firebase.setWithPriority", 2, b, o);
C("Firebase.setWithPriority", 3, c, k);
(".length" === this.name() || ".keys" === this.name()) && g("Firebase.setWithPriority failed: " + this.name() + " is a read-only object.");
return this.n.hb(this.path, a, b, c)
};
J.prototype.setWithPriority = J.prototype.hb;
J.prototype.remove = function (a) {
A("Firebase.remove", 0, 1, arguments.length);
E("Firebase.remove", this.path);
C("Firebase.remove", 1, a, k);
this.set(m, a)
};
J.prototype.remove = J.prototype.remove;
J.prototype.transaction = function (a, b, c) {
function d() {}
A("Firebase.transaction", 1, 3, arguments.length);
E("Firebase.transaction", this.path);
C("Firebase.transaction", 1, a, o);
C("Firebase.transaction", 2, b, k);
u(c) && "boolean" != typeof c && g(Error(B("Firebase.transaction", 3, k) + "must be a boolean."));
(".length" === this.name() || ".keys" === this.name()) && g("Firebase.transaction failed: " + this.name() + " is a read-only object.");
"undefined" === typeof c && (c = k);
var e = this.n,
f = this.path,
h = c;
e.e("transaction on " + f);
var i =
new J(e, f);
i.ab("value", d);
var h = {
path: f,
update: a,
C: b,
status: m,
sd: Nb(),
yc: h,
wd: 0,
vc: function () {
i.Cb("value", d)
},
wc: m
},
l = h.update(T(e.jb, f).W());
if (u(l)) {
Ba("transaction failed: Data returned ", l);
h.status = 1;
var n = L(e.ib, f),
p = n.k() || [];
p.push(h);
Qa(n, p);
p = "object" === typeof l && l !== m && D(l, ".priority") ? l[".priority"] : T(e.g.P, f).j();
n = qe(e);
l = Q(l, p);
l = me(l, n);
U(e.jb, f, l);
h.yc && (U(e.g.qa, f, l), W(e.I, f, [f]));
ve(e)
} else h.vc(), h.C && (e = ye(e, f), h.C(m, o, e))
};
J.prototype.transaction = J.prototype.transaction;
J.prototype.Wc = function (a, b) {
A("Firebase.setPriority", 1, 2, arguments.length);
E("Firebase.setPriority", this.path);
Fa("Firebase.setPriority", 1, a, o);
C("Firebase.setPriority", 2, b, k);
this.n.Wc(this.path, a, b)
};
J.prototype.setPriority = J.prototype.Wc;
J.prototype.push = function (a, b) {
A("Firebase.push", 0, 2, arguments.length);
E("Firebase.push", this.path);
Aa("Firebase.push", a, k);
C("Firebase.push", 2, b, k);
var c = pe(this.n),
c = Ce(c),
c = this.G(c);
"undefined" !== typeof a && a !== m && c.set(a, b);
return c
};
J.prototype.push = J.prototype.push;
J.prototype.ka = function () {
return new $(this.n, this.path, this.name())
};
J.prototype.onDisconnect = J.prototype.ka;
J.prototype.be = function () {
M("FirebaseRef.removeOnDisconnect() being deprecated. Please use FirebaseRef.onDisconnect().remove() instead.");
this.ka().remove();
ue(this.n)
};
J.prototype.removeOnDisconnect = J.prototype.be;
J.prototype.ee = function (a) {
M("FirebaseRef.setOnDisconnect(value) being deprecated. Please use FirebaseRef.onDisconnect().set(value) instead.");
this.ka().set(a);
ue(this.n)
};
J.prototype.setOnDisconnect = J.prototype.ee;
J.prototype.mb = function (a, b, c) {
A("Firebase.auth", 1, 3, arguments.length);
v(a) || g(Error(B("Firebase.auth", 1, o) + "must be a valid credential (a string)."));
C("Firebase.auth", 2, b, k);
C("Firebase.auth", 3, b, k);
this.n.mb(a, b, c)
};
J.prototype.auth = J.prototype.mb;
J.prototype.Tb = function (a) {
A("Firebase.unauth", 0, 1, arguments.length);
C("Firebase.unauth", 1, a, k);
this.n.Tb(a)
};
J.prototype.unauth = J.prototype.Tb;
J.goOffline = function () {
A("Firebase.goOffline", 0, 0, arguments.length);
Y.tb().Ma()
};
J.goOnline = function () {
A("Firebase.goOnline", 0, 0, arguments.length);
Y.tb().gb()
};
function Vb(a, b) {
z(!b || a === k || a === o, "Can't turn on custom loggers persistently.");
a === k ? ("undefined" !== typeof console && ("function" === typeof console.log ? Sb = w(console.log, console) : "object" === typeof console.log && (Sb = function (a) {
console.log(a)
})), b && ob.set("logging_enabled", k)) : a ? Sb = a : (Sb = m, ob.remove("logging_enabled"))
}
J.enableLogging = Vb;
J.ServerValue = {
TIMESTAMP: {
".sv": "timestamp"
}
};
J.INTERNAL = Z;
J.Context = Y;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment