@testim/testim-cli
Version:
Command line interface for running Testing on you CI
91 lines • 134 kB
JavaScript
/*! @license Firebase v2.3.1
License: https://www.firebase.com/terms/terms-of-service.html */
var g,aa=this;function n(a){return void 0!==a}function ba(){}function ca(a){a.sb=function(){return a.rf?a.rf:a.rf=new a}}
function da(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 ea(a){return"array"==da(a)}function fa(a){var b=da(a);return"array"==b||"object"==b&&"number"==typeof a.length}function p(a){return"string"==typeof a}function ga(a){return"number"==typeof a}function ha(a){return"function"==da(a)}function ia(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ja(a,b,c){return a.call.apply(a.bind,arguments)}
function ka(a,b,c){if(!a)throw 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 q(a,b,c){q=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ja:ka;return q.apply(null,arguments)}var la=Date.now||function(){return+new Date};
function ma(a,b){function c(){}c.prototype=b.prototype;a.fh=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Zg=function(a,c,f){for(var h=Array(arguments.length-2),k=2;k<arguments.length;k++)h[k-2]=arguments[k];return b.prototype[c].apply(a,h)}};function t(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function na(a,b){var c={},d;for(d in a)c[d]=b.call(void 0,a[d],d,a);return c}function oa(a,b){for(var c in a)if(!b.call(void 0,a[c],c,a))return!1;return!0}function pa(a){var b=0,c;for(c in a)b++;return b}function qa(a){for(var b in a)return b}function ra(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function sa(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function ta(a,b){for(var c in a)if(a[c]==b)return!0;return!1}
function ua(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return d}function va(a,b){var c=ua(a,b,void 0);return c&&a[c]}function wa(a){for(var b in a)return!1;return!0}function xa(a){var b={},c;for(c in a)b[c]=a[c];return b}var ya="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
function za(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<ya.length;f++)c=ya[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};function Aa(a){a=String(a);if(/^\s*$/.test(a)?0:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,"")))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);}function Ba(){this.Qd=void 0}
function Ca(a,b,c){switch(typeof b){case "string":Da(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(null==b){c.push("null");break}if(ea(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],Ca(a,a.Qd?a.Qd.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),Da(f,c),
c.push(":"),Ca(a,a.Qd?a.Qd.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:throw Error("Unknown type: "+typeof b);}}var Ea={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Fa=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Da(a,b){b.push('"',a.replace(Fa,function(a){if(a in Ea)return Ea[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Ea[a]=e+b.toString(16)}),'"')};function Ga(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^la()).toString(36)};var Ha;a:{var Ia=aa.navigator;if(Ia){var Ja=Ia.userAgent;if(Ja){Ha=Ja;break a}}Ha=""};function Ka(){this.Ua=-1};function La(){this.Ua=-1;this.Ua=64;this.N=[];this.ie=[];this.Vf=[];this.Jd=[];this.Jd[0]=128;for(var a=1;a<this.Ua;++a)this.Jd[a]=0;this.ae=this.$b=0;this.reset()}ma(La,Ka);La.prototype.reset=function(){this.N[0]=1732584193;this.N[1]=4023233417;this.N[2]=2562383102;this.N[3]=271733878;this.N[4]=3285377520;this.ae=this.$b=0};
function Ma(a,b,c){c||(c=0);var d=a.Vf;if(p(b))for(var e=0;16>e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;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}b=a.N[0];c=a.N[1];for(var h=a.N[2],k=a.N[3],m=a.N[4],l,e=0;80>e;e++)40>e?20>e?(f=k^c&(h^k),l=1518500249):(f=c^h^k,l=1859775393):60>e?(f=c&h|k&(c|h),l=2400959708):(f=c^h^k,l=3395469782),f=(b<<
5|b>>>27)+f+m+l+d[e]&4294967295,m=k,k=h,h=(c<<30|c>>>2)&4294967295,c=b,b=f;a.N[0]=a.N[0]+b&4294967295;a.N[1]=a.N[1]+c&4294967295;a.N[2]=a.N[2]+h&4294967295;a.N[3]=a.N[3]+k&4294967295;a.N[4]=a.N[4]+m&4294967295}
La.prototype.update=function(a,b){if(null!=a){n(b)||(b=a.length);for(var c=b-this.Ua,d=0,e=this.ie,f=this.$b;d<b;){if(0==f)for(;d<=c;)Ma(this,a,d),d+=this.Ua;if(p(a))for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.Ua){Ma(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.Ua){Ma(this,e);f=0;break}}this.$b=f;this.ae+=b}};var Na=Array.prototype,Oa=Na.indexOf?function(a,b,c){return Na.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(p(a))return p(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Pa=Na.forEach?function(a,b,c){Na.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=p(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Qa=Na.filter?function(a,b,c){return Na.filter.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=[],f=
0,h=p(a)?a.split(""):a,k=0;k<d;k++)if(k in h){var m=h[k];b.call(c,m,k,a)&&(e[f++]=m)}return e},Ra=Na.map?function(a,b,c){return Na.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=p(a)?a.split(""):a,h=0;h<d;h++)h in f&&(e[h]=b.call(c,f[h],h,a));return e},Sa=Na.reduce?function(a,b,c,d){for(var e=[],f=1,h=arguments.length;f<h;f++)e.push(arguments[f]);d&&(e[0]=q(b,d));return Na.reduce.apply(a,e)}:function(a,b,c,d){var e=c;Pa(a,function(c,h){e=b.call(d,e,c,h,a)});return e},Ta=Na.every?
function(a,b,c){return Na.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=p(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};function Ua(a,b){var c=Va(a,b,void 0);return 0>c?null:p(a)?a.charAt(c):a[c]}function Va(a,b,c){for(var d=a.length,e=p(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1}function Wa(a,b){var c=Oa(a,b);0<=c&&Na.splice.call(a,c,1)}function Xa(a,b){a.sort(b||Ya)}function Ya(a,b){return a>b?1:a<b?-1:0};var Za=-1!=Ha.indexOf("Opera")||-1!=Ha.indexOf("OPR"),$a=-1!=Ha.indexOf("Trident")||-1!=Ha.indexOf("MSIE"),ab=-1!=Ha.indexOf("Gecko")&&-1==Ha.toLowerCase().indexOf("webkit")&&!(-1!=Ha.indexOf("Trident")||-1!=Ha.indexOf("MSIE")),bb=-1!=Ha.toLowerCase().indexOf("webkit");
(function(){var a="",b;if(Za&&aa.opera)return a=aa.opera.version,ha(a)?a():a;ab?b=/rv\:([^\);]+)(\)|;)/:$a?b=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:bb&&(b=/WebKit\/(\S+)/);b&&(a=(a=b.exec(Ha))?a[1]:"");return $a&&(b=(b=aa.document)?b.documentMode:void 0,b>parseFloat(a))?String(b):a})();var cb=null,db=null;
function eb(a,b){if(!fa(a))throw Error("encodeByteArray takes an array as a parameter");if(!cb){cb={};db={};for(var c=0;65>c;c++)cb[c]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c),db[c]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(c)}for(var c=b?db:cb,d=[],e=0;e<a.length;e+=3){var f=a[e],h=e+1<a.length,k=h?a[e+1]:0,m=e+2<a.length,l=m?a[e+2]:0,r=f>>2,f=(f&3)<<4|k>>4,k=(k&15)<<2|l>>6,l=l&63;m||(l=64,h||(k=64));d.push(c[r],c[f],c[k],c[l])}return d.join("")}
;var fb=fb||"2.3.1";function u(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function v(a,b){if(Object.prototype.hasOwnProperty.call(a,b))return a[b]}function gb(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b(c,a[c])}function hb(a){var b={};gb(a,function(a,d){b[a]=d});return b};function ib(a){var b=[];gb(a,function(a,d){ea(d)?Pa(d,function(d){b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))}):b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))});return b.length?"&"+b.join("&"):""}function jb(a){var b={};a=a.replace(/^\?/,"").split("&");Pa(a,function(a){a&&(a=a.split("="),b[a[0]]=a[1])});return b};function w(a,b,c,d){var e;d<b?e="at least "+b:d>c&&(e=0===c?"none":"no more than "+c);if(e)throw Error(a+" failed: Was called with "+d+(1===d?" argument.":" arguments.")+" Expects "+e+".");}function y(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:throw Error("errorPrefix called with argumentNumber > 4. Need to update it?");}return a=a+" failed: "+(d+" argument ")}
function z(a,b,c,d){if((!d||n(c))&&!ha(c))throw Error(y(a,b,d)+"must be a valid function.");}function kb(a,b,c){if(n(c)&&(!ia(c)||null===c))throw Error(y(a,b,!0)+"must be a valid context object.");};function lb(a){return"undefined"!==typeof JSON&&n(JSON.parse)?JSON.parse(a):Aa(a)}function A(a){if("undefined"!==typeof JSON&&n(JSON.stringify))a=JSON.stringify(a);else{var b=[];Ca(new Ba,a,b);a=b.join("")}return a};function mb(){this.Ud=B}mb.prototype.j=function(a){return this.Ud.Q(a)};mb.prototype.toString=function(){return this.Ud.toString()};function nb(){}nb.prototype.nf=function(){return null};nb.prototype.ue=function(){return null};var ob=new nb;function pb(a,b,c){this.Sf=a;this.Ja=b;this.Id=c}pb.prototype.nf=function(a){var b=this.Ja.O;if(qb(b,a))return b.j().R(a);b=null!=this.Id?new rb(this.Id,!0,!1):this.Ja.w();return this.Sf.wc(a,b)};pb.prototype.ue=function(a,b,c){var d=null!=this.Id?this.Id:sb(this.Ja);a=this.Sf.je(d,b,1,c,a);return 0===a.length?null:a[0]};function tb(){this.rb=[]}function ub(a,b){for(var c=null,d=0;d<b.length;d++){var e=b[d],f=e.Yb();null===c||f.ca(c.Yb())||(a.rb.push(c),c=null);null===c&&(c=new vb(f));c.add(e)}c&&a.rb.push(c)}function wb(a,b,c){ub(a,c);xb(a,function(a){return a.ca(b)})}function yb(a,b,c){ub(a,c);xb(a,function(a){return a.contains(b)||b.contains(a)})}
function xb(a,b){for(var c=!0,d=0;d<a.rb.length;d++){var e=a.rb[d];if(e)if(e=e.Yb(),b(e)){for(var e=a.rb[d],f=0;f<e.sd.length;f++){var h=e.sd[f];if(null!==h){e.sd[f]=null;var k=h.Ub();zb&&Ab("event: "+h.toString());Bb(k)}}a.rb[d]=null}else c=!1}c&&(a.rb=[])}function vb(a){this.ra=a;this.sd=[]}vb.prototype.add=function(a){this.sd.push(a)};vb.prototype.Yb=function(){return this.ra};function C(a,b,c,d){this.type=a;this.Ia=b;this.Va=c;this.He=d;this.Od=void 0}function Cb(a){return new C(Db,a)}var Db="value";function Eb(a,b,c,d){this.qe=b;this.Wd=c;this.Od=d;this.rd=a}Eb.prototype.Yb=function(){var a=this.Wd.Gb();return"value"===this.rd?a.path:a.parent().path};Eb.prototype.ve=function(){return this.rd};Eb.prototype.Ub=function(){return this.qe.Ub(this)};Eb.prototype.toString=function(){return this.Yb().toString()+":"+this.rd+":"+A(this.Wd.jf())};function Fb(a,b,c){this.qe=a;this.error=b;this.path=c}Fb.prototype.Yb=function(){return this.path};Fb.prototype.ve=function(){return"cancel"};
Fb.prototype.Ub=function(){return this.qe.Ub(this)};Fb.prototype.toString=function(){return this.path.toString()+":cancel"};function rb(a,b,c){this.A=a;this.ea=b;this.Tb=c}function Gb(a){return a.ea}function Hb(a){return a.Tb}function Ib(a,b){return b.e()?a.ea&&!a.Tb:qb(a,D(b))}function qb(a,b){return a.ea&&!a.Tb||a.A.Da(b)}rb.prototype.j=function(){return this.A};function Jb(a){this.fg=a;this.Ad=null}Jb.prototype.get=function(){var a=this.fg.get(),b=xa(a);if(this.Ad)for(var c in this.Ad)b[c]-=this.Ad[c];this.Ad=a;return b};function Kb(a,b){this.Nf={};this.cd=new Jb(a);this.ba=b;var c=1E4+2E4*Math.random();setTimeout(q(this.Gf,this),Math.floor(c))}Kb.prototype.Gf=function(){var a=this.cd.get(),b={},c=!1,d;for(d in a)0<a[d]&&u(this.Nf,d)&&(b[d]=a[d],c=!0);c&&this.ba.Re(b);setTimeout(q(this.Gf,this),Math.floor(6E5*Math.random()))};function Lb(){this.Cc={}}function Mb(a,b,c){n(c)||(c=1);u(a.Cc,b)||(a.Cc[b]=0);a.Cc[b]+=c}Lb.prototype.get=function(){return xa(this.Cc)};var Nb={},Ob={};function Pb(a){a=a.toString();Nb[a]||(Nb[a]=new Lb);return Nb[a]}function Qb(a,b){var c=a.toString();Ob[c]||(Ob[c]=b());return Ob[c]};function E(a,b){this.name=a;this.S=b}function Rb(a,b){return new E(a,b)};function Sb(a,b){return Tb(a.name,b.name)}function Ub(a,b){return Tb(a,b)};function Vb(a,b,c){this.type=Wb;this.source=a;this.path=b;this.Fa=c}Vb.prototype.Vc=function(a){return this.path.e()?new Vb(this.source,F,this.Fa.R(a)):new Vb(this.source,G(this.path),this.Fa)};Vb.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" overwrite: "+this.Fa.toString()+")"};function Xb(a,b){this.type=Yb;this.source=a;this.path=b}Xb.prototype.Vc=function(){return this.path.e()?new Xb(this.source,F):new Xb(this.source,G(this.path))};Xb.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" listen_complete)"};function Zb(a,b){this.Ka=a;this.wa=b?b:$b}g=Zb.prototype;g.Na=function(a,b){return new Zb(this.Ka,this.wa.Na(a,b,this.Ka).Y(null,null,!1,null,null))};g.remove=function(a){return new Zb(this.Ka,this.wa.remove(a,this.Ka).Y(null,null,!1,null,null))};g.get=function(a){for(var b,c=this.wa;!c.e();){b=this.Ka(a,c.key);if(0===b)return c.value;0>b?c=c.left:0<b&&(c=c.right)}return null};
function ac(a,b){for(var c,d=a.wa,e=null;!d.e();){c=a.Ka(b,d.key);if(0===c){if(d.left.e())return e?e.key:null;for(d=d.left;!d.right.e();)d=d.right;return d.key}0>c?d=d.left:0<c&&(e=d,d=d.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?");}g.e=function(){return this.wa.e()};g.count=function(){return this.wa.count()};g.Qc=function(){return this.wa.Qc()};g.ec=function(){return this.wa.ec()};g.ia=function(a){return this.wa.ia(a)};
g.Wb=function(a){return new bc(this.wa,null,this.Ka,!1,a)};g.Xb=function(a,b){return new bc(this.wa,a,this.Ka,!1,b)};g.Zb=function(a,b){return new bc(this.wa,a,this.Ka,!0,b)};g.pf=function(a){return new bc(this.wa,null,this.Ka,!0,a)};function bc(a,b,c,d,e){this.Sd=e||null;this.Be=d;this.Oa=[];for(e=1;!a.e();)if(e=b?c(a.key,b):1,d&&(e*=-1),0>e)a=this.Be?a.left:a.right;else if(0===e){this.Oa.push(a);break}else this.Oa.push(a),a=this.Be?a.right:a.left}
function H(a){if(0===a.Oa.length)return null;var b=a.Oa.pop(),c;c=a.Sd?a.Sd(b.key,b.value):{key:b.key,value:b.value};if(a.Be)for(b=b.left;!b.e();)a.Oa.push(b),b=b.right;else for(b=b.right;!b.e();)a.Oa.push(b),b=b.left;return c}function cc(a){if(0===a.Oa.length)return null;var b;b=a.Oa;b=b[b.length-1];return a.Sd?a.Sd(b.key,b.value):{key:b.key,value:b.value}}function dc(a,b,c,d,e){this.key=a;this.value=b;this.color=null!=c?c:!0;this.left=null!=d?d:$b;this.right=null!=e?e:$b}g=dc.prototype;
g.Y=function(a,b,c,d,e){return new dc(null!=a?a:this.key,null!=b?b:this.value,null!=c?c:this.color,null!=d?d:this.left,null!=e?e:this.right)};g.count=function(){return this.left.count()+1+this.right.count()};g.e=function(){return!1};g.ia=function(a){return this.left.ia(a)||a(this.key,this.value)||this.right.ia(a)};function ec(a){return a.left.e()?a:ec(a.left)}g.Qc=function(){return ec(this).key};g.ec=function(){return this.right.e()?this.key:this.right.ec()};
g.Na=function(a,b,c){var d,e;e=this;d=c(a,e.key);e=0>d?e.Y(null,null,null,e.left.Na(a,b,c),null):0===d?e.Y(null,b,null,null,null):e.Y(null,null,null,null,e.right.Na(a,b,c));return fc(e)};function gc(a){if(a.left.e())return $b;a.left.fa()||a.left.left.fa()||(a=hc(a));a=a.Y(null,null,null,gc(a.left),null);return fc(a)}
g.remove=function(a,b){var c,d;c=this;if(0>b(a,c.key))c.left.e()||c.left.fa()||c.left.left.fa()||(c=hc(c)),c=c.Y(null,null,null,c.left.remove(a,b),null);else{c.left.fa()&&(c=ic(c));c.right.e()||c.right.fa()||c.right.left.fa()||(c=jc(c),c.left.left.fa()&&(c=ic(c),c=jc(c)));if(0===b(a,c.key)){if(c.right.e())return $b;d=ec(c.right);c=c.Y(d.key,d.value,null,null,gc(c.right))}c=c.Y(null,null,null,null,c.right.remove(a,b))}return fc(c)};g.fa=function(){return this.color};
function fc(a){a.right.fa()&&!a.left.fa()&&(a=kc(a));a.left.fa()&&a.left.left.fa()&&(a=ic(a));a.left.fa()&&a.right.fa()&&(a=jc(a));return a}function hc(a){a=jc(a);a.right.left.fa()&&(a=a.Y(null,null,null,null,ic(a.right)),a=kc(a),a=jc(a));return a}function kc(a){return a.right.Y(null,null,a.color,a.Y(null,null,!0,null,a.right.left),null)}function ic(a){return a.left.Y(null,null,a.color,null,a.Y(null,null,!0,a.left.right,null))}
function jc(a){return a.Y(null,null,!a.color,a.left.Y(null,null,!a.left.color,null,null),a.right.Y(null,null,!a.right.color,null,null))}function lc(){}g=lc.prototype;g.Y=function(){return this};g.Na=function(a,b){return new dc(a,b,null)};g.remove=function(){return this};g.count=function(){return 0};g.e=function(){return!0};g.ia=function(){return!1};g.Qc=function(){return null};g.ec=function(){return null};g.fa=function(){return!1};var $b=new lc;(function(){var a=process.version;if("v0.10.22"===a||"v0.10.23"===a||"v0.10.24"===a){var b=function(a,b,c){this.chunk=a;this.encoding=b;this.callback=c},c=function(a,c,d,e,l){c.objectMode||!1===c.decodeStrings||"string"!==typeof d||(d=new Buffer(d,e));Buffer.isBuffer(d)&&(e="buffer");var r=c.objectMode?1:d.length;c.length+=r;var x=c.length<c.highWaterMark;x||(c.needDrain=!0);c.writing?c.buffer.push(new b(d,e,l)):(c.writelen=r,c.writecb=l,c.writing=!0,c.sync=!0,a._write(d,e,c.onwrite),c.sync=!1);return x},
d=function(a,b,c,d){var e=!0;if(!Buffer.isBuffer(c)&&"string"!==typeof c&&null!==c&&void 0!==c&&!b.objectMode){var r=new TypeError("Invalid non-string/buffer chunk");a.emit("error",r);process.nextTick(function(){d(r)});e=!1}return e},e=function(a,b){var c=Error("write after end");a.emit("error",c);process.nextTick(function(){b(c)})},a=require("_stream_writable");a.prototype.write=function(a,b,k){var m=this._writableState,l=!1;"function"===typeof b&&(k=b,b=null);Buffer.isBuffer(a)?b="buffer":b||(b=
m.defaultEncoding);"function"!==typeof k&&(k=function(){});m.ended?e(this,k):d(this,m,a,k)&&(l=c(this,m,a,b,k));return l};require("_stream_duplex").prototype.write=a.prototype.write}})();function mc(a,b){return a&&"object"===typeof a?(I(".sv"in a,"Unexpected leaf node or priority contents"),b[a[".sv"]]):a}function nc(a,b){var c=new oc;pc(a,new K(""),function(a,e){c.mc(a,qc(e,b))});return c}function qc(a,b){var c=a.C().I(),c=mc(c,b),d;if(a.K()){var e=mc(a.Ca(),b);return e!==a.Ca()||c!==a.C().I()?new rc(e,L(c)):a}d=a;c!==a.C().I()&&(d=d.ga(new rc(c)));a.P(M,function(a,c){var e=qc(c,b);e!==c&&(d=d.U(a,e))});return d};function sc(){this.vc={}}sc.prototype.set=function(a,b){null==b?delete this.vc[a]:this.vc[a]=b};sc.prototype.get=function(a){return u(this.vc,a)?this.vc[a]:null};sc.prototype.remove=function(a){delete this.vc[a]};sc.prototype.sf=!0;function tc(a){this.Dc=a;this.Nd="firebase:"}g=tc.prototype;g.set=function(a,b){null==b?this.Dc.removeItem(this.Nd+a):this.Dc.setItem(this.Nd+a,A(b))};g.get=function(a){a=this.Dc.getItem(this.Nd+a);return null==a?null:lb(a)};g.remove=function(a){this.Dc.removeItem(this.Nd+a)};g.sf=!1;g.toString=function(){return this.Dc.toString()};function uc(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 tc(b)}}catch(c){}return new sc}var vc=uc("localStorage"),wc=uc("sessionStorage");function xc(a,b,c,d,e){this.host=a.toLowerCase();this.domain=this.host.substr(this.host.indexOf(".")+1);this.ib=b;this.fc=c;this.Xg=d;this.Md=e||"";this.Xa=vc.get("host:"+a)||this.host}function yc(a,b){b!==a.Xa&&(a.Xa=b,"s-"===a.Xa.substr(0,2)&&vc.set("host:"+a.host,a.Xa))}
function zc(a,b,c){I("string"===typeof b,"typeof type must == string");I("object"===typeof c,"typeof params must == object");if(b===Ac)b=(a.ib?"wss://":"ws://")+a.Xa+"/.ws?";else if(b===Bc)b=(a.ib?"https://":"http://")+a.Xa+"/.lp?";else throw Error("Unknown connection type: "+b);a.host!==a.Xa&&(c.ns=a.fc);var d=[];t(c,function(a,b){d.push(b+"="+a)});return b+d.join("&")}xc.prototype.toString=function(){var a=(this.ib?"https://":"http://")+this.host;this.Md&&(a+="<"+this.Md+">");return a};var Cc=function(){var a=1;return function(){return a++}}();function I(a,b){if(!a)throw Dc(b);}function Dc(a){return Error("Firebase ("+fb+") INTERNAL ASSERT FAILED: "+a)}function Ec(a){try{return(new Buffer(a,"base64")).toString("utf8")}catch(b){Ab("base64Decode failed: ",b)}return null}
function Fc(a){var b=Gc(a);a=new La;a.update(b);var b=[],c=8*a.ae;56>a.$b?a.update(a.Jd,56-a.$b):a.update(a.Jd,a.Ua-(a.$b-56));for(var d=a.Ua-1;56<=d;d--)a.ie[d]=c&255,c/=256;Ma(a,a.ie);for(d=c=0;5>d;d++)for(var e=24;0<=e;e-=8)b[c]=a.N[d]>>e&255,++c;return eb(b)}function Hc(a){for(var b="",c=0;c<arguments.length;c++)b=fa(arguments[c])?b+Hc.apply(null,arguments[c]):"object"===typeof arguments[c]?b+A(arguments[c]):b+arguments[c],b+=" ";return b}var zb=null,Ic=!0;
function Ab(a){!0===Ic&&(Ic=!1,null===zb&&!0===wc.get("logging_enabled")&&Jc(!0));if(zb){var b=Hc.apply(null,arguments);zb(b)}}function Kc(a){return function(){Ab(a,arguments)}}function Lc(a){if("undefined"!==typeof console){var b="FIREBASE INTERNAL ERROR: "+Hc.apply(null,arguments);"undefined"!==typeof console.error?console.error(b):console.log(b)}}function Mc(a){var b=Hc.apply(null,arguments);throw Error("FIREBASE FATAL ERROR: "+b);}
function N(a){if("undefined"!==typeof console){var b="FIREBASE WARNING: "+Hc.apply(null,arguments);"undefined"!==typeof console.warn?console.warn(b):console.log(b)}}
function Nc(a){var b="",c="",d="",e="",f=!0,h="https",k=443;if(p(a)){var m=a.indexOf("//");0<=m&&(h=a.substring(0,m-1),a=a.substring(m+2));m=a.indexOf("/");-1===m&&(m=a.length);b=a.substring(0,m);e="";a=a.substring(m).split("/");for(m=0;m<a.length;m++)if(0<a[m].length){var l=a[m];try{l=decodeURIComponent(l.replace(/\+/g," "))}catch(r){}e+="/"+l}a=b.split(".");3===a.length?(c=a[1],d=a[0].toLowerCase()):2===a.length&&(c=a[0]);m=b.indexOf(":");0<=m&&(f="https"===h||"wss"===h,k=b.substring(m+1),isFinite(k)&&
(k=String(k)),k=p(k)?/^\s*-?0x/i.test(k)?parseInt(k,16):parseInt(k,10):NaN)}return{host:b,port:k,domain:c,Tg:d,ib:f,scheme:h,kc:e}}function Oc(a){return ga(a)&&(a!=a||a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY)}function Pc(a){a()}function Tb(a,b){if(a===b)return 0;if("[MIN_NAME]"===a||"[MAX_NAME]"===b)return-1;if("[MIN_NAME]"===b||"[MAX_NAME]"===a)return 1;var c=Qc(a),d=Qc(b);return null!==c?null!==d?0==c-d?a.length-b.length:c-d:-1:null!==d?1:a<b?-1:1}
function Rc(a,b){if(b&&a in b)return b[a];throw Error("Missing required key ("+a+") in object: "+A(b));}function Sc(a){if("object"!==typeof a||null===a)return A(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+=A(b[d]),c+=":",c+=Sc(a[b[d]]);return c+"}"}function Tc(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 Uc(a,b){if(ea(a))for(var c=0;c<a.length;++c)b(c,a[c]);else t(a,b)}
function Vc(a){I(!Oc(a),"Invalid JSON number");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)e.push(d%2?1:0),d=Math.floor(d/2);for(a=11;a;--a)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 Wc=/^-?\d{1,10}$/;function Qc(a){return Wc.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}function Bb(a){try{a()}catch(b){setTimeout(function(){N("Exception was thrown by user callback.",b.stack||"");throw b;},Math.floor(0))}}function O(a,b){if(ha(a)){var c=Array.prototype.slice.call(arguments,1).slice();Bb(function(){a.apply(null,c)})}};function Gc(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);55296<=e&&56319>=e&&(e-=55296,d++,I(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 Xc(a){for(var b=0,c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b++:2048>d?b+=2:55296<=d&&56319>=d?(b+=4,c++):b+=3}return b};function Yc(a){var b={},c={},d={},e="";try{var f=a.split("."),b=lb(Ec(f[0])||""),c=lb(Ec(f[1])||""),e=f[2],d=c.d||{};delete c.d}catch(h){}return{bh:b,Ac:c,data:d,Qg:e}}function Zc(a){a=Yc(a).Ac;return"object"===typeof a&&a.hasOwnProperty("iat")?v(a,"iat"):null}function $c(a){a=Yc(a);var b=a.Ac;return!!a.Qg&&!!b&&"object"===typeof b&&b.hasOwnProperty("iat")};function ad(a){this.W=a;this.g=a.n.g}function bd(a,b,c,d){var e=[],f=[];Pa(b,function(b){"child_changed"===b.type&&a.g.xd(b.He,b.Ia)&&f.push(new C("child_moved",b.Ia,b.Va))});cd(a,e,"child_removed",b,d,c);cd(a,e,"child_added",b,d,c);cd(a,e,"child_moved",f,d,c);cd(a,e,"child_changed",b,d,c);cd(a,e,Db,b,d,c);return e}function cd(a,b,c,d,e,f){d=Qa(d,function(a){return a.type===c});Xa(d,q(a.hg,a));Pa(d,function(c){var d=dd(a,c,f);Pa(e,function(e){e.If(c.type)&&b.push(e.createEvent(d,a.W))})})}
function dd(a,b,c){"value"!==b.type&&"child_removed"!==b.type&&(b.Od=c.of(b.Va,b.Ia,a.g));return b}ad.prototype.hg=function(a,b){if(null==a.Va||null==b.Va)throw Dc("Should only compare child_ events.");return this.g.compare(new E(a.Va,a.Ia),new E(b.Va,b.Ia))};function ed(){this.ab={}}
function fd(a,b){var c=b.type,d=b.Va;I("child_added"==c||"child_changed"==c||"child_removed"==c,"Only child changes supported for tracking");I(".priority"!==d,"Only non-priority child changes can be tracked.");var e=v(a.ab,d);if(e){var f=e.type;if("child_added"==c&&"child_removed"==f)a.ab[d]=new C("child_changed",b.Ia,d,e.Ia);else if("child_removed"==c&&"child_added"==f)delete a.ab[d];else if("child_removed"==c&&"child_changed"==f)a.ab[d]=new C("child_removed",e.He,d);else if("child_changed"==c&&
"child_added"==f)a.ab[d]=new C("child_added",b.Ia,d);else if("child_changed"==c&&"child_changed"==f)a.ab[d]=new C("child_changed",b.Ia,d,e.He);else throw Dc("Illegal combination of changes: "+b+" occurred after "+e);}else a.ab[d]=b};function gd(a,b,c){this.Pb=a;this.nb=b;this.pb=c||null}g=gd.prototype;g.If=function(a){return"value"===a};g.createEvent=function(a,b){var c=b.n.g;return new Eb("value",this,new P(a.Ia,b.Gb(),c))};g.Ub=function(a){var b=this.pb;if("cancel"===a.ve()){I(this.nb,"Raising a cancel event on a listener with no cancel callback");var c=this.nb;return function(){c.call(b,a.error)}}var d=this.Pb;return function(){d.call(b,a.Wd)}};g.df=function(a,b){return this.nb?new Fb(this,a,b):null};
g.matches=function(a){return a instanceof gd?a.Pb&&this.Pb?a.Pb===this.Pb&&a.pb===this.pb:!0:!1};g.qf=function(){return null!==this.Pb};function hd(a,b,c){this.ha=a;this.nb=b;this.pb=c}g=hd.prototype;g.If=function(a){a="children_added"===a?"child_added":a;return("children_removed"===a?"child_removed":a)in this.ha};g.df=function(a,b){return this.nb?new Fb(this,a,b):null};
g.createEvent=function(a,b){I(null!=a.Va,"Child events should have a childName.");var c=b.Gb().u(a.Va);return new Eb(a.type,this,new P(a.Ia,c,b.n.g),a.Od)};g.Ub=function(a){var b=this.pb;if("cancel"===a.ve()){I(this.nb,"Raising a cancel event on a listener with no cancel callback");var c=this.nb;return function(){c.call(b,a.error)}}var d=this.ha[a.rd];return function(){d.call(b,a.Wd,a.Od)}};
g.matches=function(a){if(a instanceof hd){if(!this.ha||!a.ha)return!0;if(this.pb===a.pb){var b=pa(a.ha);if(b===pa(this.ha)){if(1===b){var b=qa(a.ha),c=qa(this.ha);return c===b&&(!a.ha[b]||!this.ha[c]||a.ha[b]===this.ha[c])}return oa(this.ha,function(b,c){return a.ha[c]===b})}}}return!1};g.qf=function(){return null!==this.ha};function id(a){this.g=a}g=id.prototype;g.G=function(a,b,c,d,e,f){I(a.Hc(this.g),"A node must be indexed if only a child is updated");e=a.R(b);if(e.Q(d).ca(c.Q(d))&&e.e()==c.e())return a;null!=f&&(c.e()?a.Da(b)?fd(f,new C("child_removed",e,b)):I(a.K(),"A child remove without an old child only makes sense on a leaf node"):e.e()?fd(f,new C("child_added",c,b)):fd(f,new C("child_changed",c,b,e)));return a.K()&&c.e()?a:a.U(b,c).jb(this.g)};
g.xa=function(a,b,c){null!=c&&(a.K()||a.P(M,function(a,e){b.Da(a)||fd(c,new C("child_removed",e,a))}),b.K()||b.P(M,function(b,e){if(a.Da(b)){var f=a.R(b);f.ca(e)||fd(c,new C("child_changed",e,b,f))}else fd(c,new C("child_added",e,b))}));return b.jb(this.g)};g.ga=function(a,b){return a.e()?B:a.ga(b)};g.Ma=function(){return!1};g.Vb=function(){return this};function jd(a){this.xe=new id(a.g);this.g=a.g;var b;a.ma?(b=kd(a),b=a.g.Nc(ld(a),b)):b=a.g.Rc();this.bd=b;a.pa?(b=md(a),a=a.g.Nc(nd(a),b)):a=a.g.Oc();this.Ec=a}g=jd.prototype;g.matches=function(a){return 0>=this.g.compare(this.bd,a)&&0>=this.g.compare(a,this.Ec)};g.G=function(a,b,c,d,e,f){this.matches(new E(b,c))||(c=B);return this.xe.G(a,b,c,d,e,f)};
g.xa=function(a,b,c){b.K()&&(b=B);var d=b.jb(this.g),d=d.ga(B),e=this;b.P(M,function(a,b){e.matches(new E(a,b))||(d=d.U(a,B))});return this.xe.xa(a,d,c)};g.ga=function(a){return a};g.Ma=function(){return!0};g.Vb=function(){return this.xe};function od(a){this.sa=new jd(a);this.g=a.g;I(a.ja,"Only valid if limit has been set");this.ka=a.ka;this.Hb=!pd(a)}g=od.prototype;g.G=function(a,b,c,d,e,f){this.sa.matches(new E(b,c))||(c=B);return a.R(b).ca(c)?a:a.Bb()<this.ka?this.sa.Vb().G(a,b,c,d,e,f):qd(this,a,b,c,e,f)};
g.xa=function(a,b,c){var d;if(b.K()||b.e())d=B.jb(this.g);else if(2*this.ka<b.Bb()&&b.Hc(this.g)){d=B.jb(this.g);b=this.Hb?b.Zb(this.sa.Ec,this.g):b.Xb(this.sa.bd,this.g);for(var e=0;0<b.Oa.length&&e<this.ka;){var f=H(b),h;if(h=this.Hb?0>=this.g.compare(this.sa.bd,f):0>=this.g.compare(f,this.sa.Ec))d=d.U(f.name,f.S),e++;else break}}else{d=b.jb(this.g);d=d.ga(B);var k,m,l;if(this.Hb){b=d.pf(this.g);k=this.sa.Ec;m=this.sa.bd;var r=rd(this.g);l=function(a,b){return r(b,a)}}else b=d.Wb(this.g),k=this.sa.bd,
m=this.sa.Ec,l=rd(this.g);for(var e=0,x=!1;0<b.Oa.length;)f=H(b),!x&&0>=l(k,f)&&(x=!0),(h=x&&e<this.ka&&0>=l(f,m))?e++:d=d.U(f.name,B)}return this.sa.Vb().xa(a,d,c)};g.ga=function(a){return a};g.Ma=function(){return!0};g.Vb=function(){return this.sa.Vb()};
function qd(a,b,c,d,e,f){var h;if(a.Hb){var k=rd(a.g);h=function(a,b){return k(b,a)}}else h=rd(a.g);I(b.Bb()==a.ka,"");var m=new E(c,d),l=a.Hb?sd(b,a.g):td(b,a.g),r=a.sa.matches(m);if(b.Da(c)){for(var x=b.R(c),l=e.ue(a.g,l,a.Hb);null!=l&&(l.name==c||b.Da(l.name));)l=e.ue(a.g,l,a.Hb);e=null==l?1:h(l,m);if(r&&!d.e()&&0<=e)return null!=f&&fd(f,new C("child_changed",d,c,x)),b.U(c,d);null!=f&&fd(f,new C("child_removed",x,c));b=b.U(c,B);return null!=l&&a.sa.matches(l)?(null!=f&&fd(f,new C("child_added",
l.S,l.name)),b.U(l.name,l.S)):b}return d.e()?b:r&&0<=h(l,m)?(null!=f&&(fd(f,new C("child_removed",l.S,l.name)),fd(f,new C("child_added",d,c))),b.U(c,d).U(l.name,B)):b};function ud(a,b){this.fe=a;this.eg=b}function wd(a){this.V=a}
wd.prototype.$a=function(a,b,c,d){var e=new ed,f;if(b.type===Wb)b.source.se?c=xd(this,a,b.path,b.Fa,c,d,e):(I(b.source.mf,"Unknown source."),f=b.source.Ye||Hb(a.w())&&!b.path.e(),c=yd(this,a,b.path,b.Fa,c,d,f,e));else if(b.type===zd)b.source.se?c=Ad(this,a,b.path,b.children,c,d,e):(I(b.source.mf,"Unknown source."),f=b.source.Ye||Hb(a.w()),c=Bd(this,a,b.path,b.children,c,d,f,e));else if(b.type===Cd)if(b.Td)if(b=b.path,null!=c.sc(b))c=a;else{f=new pb(c,a,d);d=a.O.j();if(b.e()||".priority"===D(b))Gb(a.w())?
b=c.za(sb(a)):(b=a.w().j(),I(b instanceof Q,"serverChildren would be complete if leaf node"),b=c.xc(b)),b=this.V.xa(d,b,e);else{var h=D(b),k=c.wc(h,a.w());null==k&&qb(a.w(),h)&&(k=d.R(h));b=null!=k?this.V.G(d,h,k,G(b),f,e):a.O.j().Da(h)?this.V.G(d,h,B,G(b),f,e):d;b.e()&&Gb(a.w())&&(d=c.za(sb(a)),d.K()&&(b=this.V.xa(b,d,e)))}d=Gb(a.w())||null!=c.sc(F);c=Dd(a,b,d,this.V.Ma())}else c=Ed(this,a,b.path,b.Ob,c,d,e);else if(b.type===Yb)d=b.path,b=a.w(),f=b.j(),h=b.ea||d.e(),c=Fd(this,new Gd(a.O,new rb(f,
h,b.Tb)),d,c,ob,e);else throw Dc("Unknown operation type: "+b.type);e=ra(e.ab);d=c;b=d.O;b.ea&&(f=b.j().K()||b.j().e(),h=Hd(a),(0<e.length||!a.O.ea||f&&!b.j().ca(h)||!b.j().C().ca(h.C()))&&e.push(Cb(Hd(d))));return new ud(c,e)};
function Fd(a,b,c,d,e,f){var h=b.O;if(null!=d.sc(c))return b;var k;if(c.e())I(Gb(b.w()),"If change path is empty, we must have complete server data"),Hb(b.w())?(e=sb(b),d=d.xc(e instanceof Q?e:B)):d=d.za(sb(b)),f=a.V.xa(b.O.j(),d,f);else{var m=D(c);if(".priority"==m)I(1==Id(c),"Can't have a priority with additional path components"),f=h.j(),k=b.w().j(),d=d.hd(c,f,k),f=null!=d?a.V.ga(f,d):h.j();else{var l=G(c);qb(h,m)?(k=b.w().j(),d=d.hd(c,h.j(),k),d=null!=d?h.j().R(m).G(l,d):h.j().R(m)):d=d.wc(m,
b.w());f=null!=d?a.V.G(h.j(),m,d,l,e,f):h.j()}}return Dd(b,f,h.ea||c.e(),a.V.Ma())}function yd(a,b,c,d,e,f,h,k){var m=b.w();h=h?a.V:a.V.Vb();if(c.e())d=h.xa(m.j(),d,null);else if(h.Ma()&&!m.Tb)d=m.j().G(c,d),d=h.xa(m.j(),d,null);else{var l=D(c);if(!Ib(m,c)&&1<Id(c))return b;var r=G(c);d=m.j().R(l).G(r,d);d=".priority"==l?h.ga(m.j(),d):h.G(m.j(),l,d,r,ob,null)}m=m.ea||c.e();b=new Gd(b.O,new rb(d,m,h.Ma()));return Fd(a,b,c,e,new pb(e,b,f),k)}
function xd(a,b,c,d,e,f,h){var k=b.O;e=new pb(e,b,f);if(c.e())h=a.V.xa(b.O.j(),d,h),a=Dd(b,h,!0,a.V.Ma());else if(f=D(c),".priority"===f)h=a.V.ga(b.O.j(),d),a=Dd(b,h,k.ea,k.Tb);else{c=G(c);var m=k.j().R(f);if(!c.e()){var l=e.nf(f);d=null!=l?".priority"===Jd(c)&&l.Q(c.parent()).e()?l:l.G(c,d):B}m.ca(d)?a=b:(h=a.V.G(k.j(),f,d,c,e,h),a=Dd(b,h,k.ea,a.V.Ma()))}return a}
function Ad(a,b,c,d,e,f,h){var k=b;Kd(d,function(d,l){var r=c.u(d);qb(b.O,D(r))&&(k=xd(a,k,r,l,e,f,h))});Kd(d,function(d,l){var r=c.u(d);qb(b.O,D(r))||(k=xd(a,k,r,l,e,f,h))});return k}function Ld(a,b){Kd(b,function(b,d){a=a.G(b,d)});return a}
function Bd(a,b,c,d,e,f,h,k){if(b.w().j().e()&&!Gb(b.w()))return b;var m=b;c=c.e()?d:Md(Nd,c,d);var l=b.w().j();c.children.ia(function(c,d){if(l.Da(c)){var J=b.w().j().R(c),J=Ld(J,d);m=yd(a,m,new K(c),J,e,f,h,k)}});c.children.ia(function(c,d){var J=!qb(b.w(),c)&&null==d.value;l.Da(c)||J||(J=b.w().j().R(c),J=Ld(J,d),m=yd(a,m,new K(c),J,e,f,h,k))});return m}
function Ed(a,b,c,d,e,f,h){if(null!=e.sc(c))return b;var k=Hb(b.w()),m=b.w();if(null!=d.value){if(c.e()&&m.ea||Ib(m,c))return yd(a,b,c,m.j().Q(c),e,f,k,h);if(c.e()){var l=Nd;m.j().P(Od,function(a,b){l=l.set(new K(a),b)});return Bd(a,b,c,l,e,f,k,h)}return b}l=Nd;Kd(d,function(a){var b=c.u(a);Ib(m,b)&&(l=l.set(a,m.j().Q(b)))});return Bd(a,b,c,l,e,f,k,h)};function Pd(){}var Qd={};function rd(a){return q(a.compare,a)}Pd.prototype.xd=function(a,b){return 0!==this.compare(new E("[MIN_NAME]",a),new E("[MIN_NAME]",b))};Pd.prototype.Rc=function(){return Rd};function Sd(a){I(!a.e()&&".priority"!==D(a),"Can't create PathIndex with empty path or .priority key");this.bc=a}ma(Sd,Pd);g=Sd.prototype;g.Gc=function(a){return!a.Q(this.bc).e()};g.compare=function(a,b){var c=a.S.Q(this.bc),d=b.S.Q(this.bc),c=c.Bc(d);return 0===c?Tb(a.name,b.name):c};
g.Nc=function(a,b){var c=L(a),c=B.G(this.bc,c);return new E(b,c)};g.Oc=function(){var a=B.G(this.bc,Td);return new E("[MAX_NAME]",a)};g.toString=function(){return this.bc.slice().join("/")};function Ud(){}ma(Ud,Pd);g=Ud.prototype;g.compare=function(a,b){var c=a.S.C(),d=b.S.C(),c=c.Bc(d);return 0===c?Tb(a.name,b.name):c};g.Gc=function(a){return!a.C().e()};g.xd=function(a,b){return!a.C().ca(b.C())};g.Rc=function(){return Rd};g.Oc=function(){return new E("[MAX_NAME]",new rc("[PRIORITY-POST]",Td))};
g.Nc=function(a,b){var c=L(a);return new E(b,new rc("[PRIORITY-POST]",c))};g.toString=function(){return".priority"};var M=new Ud;function Vd(){}ma(Vd,Pd);g=Vd.prototype;g.compare=function(a,b){return Tb(a.name,b.name)};g.Gc=function(){throw Dc("KeyIndex.isDefinedOn not expected to be called.");};g.xd=function(){return!1};g.Rc=function(){return Rd};g.Oc=function(){return new E("[MAX_NAME]",B)};g.Nc=function(a){I(p(a),"KeyIndex indexValue must always be a string.");return new E(a,B)};g.toString=function(){return".key"};
var Od=new Vd;function Wd(){}ma(Wd,Pd);g=Wd.prototype;g.compare=function(a,b){var c=a.S.Bc(b.S);return 0===c?Tb(a.name,b.name):c};g.Gc=function(){return!0};g.xd=function(a,b){return!a.ca(b)};g.Rc=function(){return Rd};g.Oc=function(){return Xd};g.Nc=function(a,b){var c=L(a);return new E(b,c)};g.toString=function(){return".value"};var Yd=new Wd;function Zd(){this.Sb=this.pa=this.Jb=this.ma=this.ja=!1;this.ka=0;this.Lb="";this.dc=null;this.vb="";this.ac=null;this.tb="";this.g=M}var $d=new Zd;function pd(a){return""===a.Lb?a.ma:"l"===a.Lb}function ld(a){I(a.ma,"Only valid if start has been set");return a.dc}function kd(a){I(a.ma,"Only valid if start has been set");return a.Jb?a.vb:"[MIN_NAME]"}function nd(a){I(a.pa,"Only valid if end has been set");return a.ac}
function md(a){I(a.pa,"Only valid if end has been set");return a.Sb?a.tb:"[MAX_NAME]"}function ae(a){var b=new Zd;b.ja=a.ja;b.ka=a.ka;b.ma=a.ma;b.dc=a.dc;b.Jb=a.Jb;b.vb=a.vb;b.pa=a.pa;b.ac=a.ac;b.Sb=a.Sb;b.tb=a.tb;b.g=a.g;return b}g=Zd.prototype;g.De=function(a){var b=ae(this);b.ja=!0;b.ka=a;b.Lb="";return b};g.Ee=function(a){var b=ae(this);b.ja=!0;b.ka=a;b.Lb="l";return b};g.Fe=function(a){var b=ae(this);b.ja=!0;b.ka=a;b.Lb="r";return b};
g.Xd=function(a,b){var c=ae(this);c.ma=!0;n(a)||(a=null);c.dc=a;null!=b?(c.Jb=!0,c.vb=b):(c.Jb=!1,c.vb="");return c};g.qd=function(a,b){var c=ae(this);c.pa=!0;n(a)||(a=null);c.ac=a;n(b)?(c.Sb=!0,c.tb=b):(c.eh=!1,c.tb="");return c};function be(a,b){var c=ae(a);c.g=b;return c}function ce(a){var b={};a.ma&&(b.sp=a.dc,a.Jb&&(b.sn=a.vb));a.pa&&(b.ep=a.ac,a.Sb&&(b.en=a.tb));if(a.ja){b.l=a.ka;var c=a.Lb;""===c&&(c=pd(a)?"l":"r");b.vf=c}a.g!==M&&(b.i=a.g.toString());return b}
function R(a){return!(a.ma||a.pa||a.ja)}function de(a){return R(a)&&a.g==M}function ee(a){var b={};if(de(a))return b;var c;a.g===M?c="$priority":a.g===Yd?c="$value":a.g===Od?c="$key":(I(a.g instanceof Sd,"Unrecognized index type!"),c=a.g.toString());b.orderBy=A(c);a.ma&&(b.startAt=A(a.dc),a.Jb&&(b.startAt+=","+A(a.vb)));a.pa&&(b.endAt=A(a.ac),a.Sb&&(b.endAt+=","+A(a.tb)));a.ja&&(pd(a)?b.limitToFirst=a.ka:b.limitToLast=a.ka);return b}g.toString=function(){return A(ce(this))};function fe(a,b){this.yd=a;this.cc=b}fe.prototype.get=function(a){var b=v(this.yd,a);if(!b)throw Error("No index defined for "+a);return b===Qd?null:b};function ge(a,b,c){var d=na(a.yd,function(d,f){var h=v(a.cc,f);I(h,"Missing index implementation for "+f);if(d===Qd){if(h.Gc(b.S)){for(var k=[],m=c.Wb(Rb),l=H(m);l;)l.name!=b.name&&k.push(l),l=H(m);k.push(b);return he(k,rd(h))}return Qd}h=c.get(b.name);k=d;h&&(k=k.remove(new E(b.name,h)));return k.Na(b,b.S)});return new fe(d,a.cc)}
function ie(a,b,c){var d=na(a.yd,function(a){if(a===Qd)return a;var d=c.get(b.name);return d?a.remove(new E(b.name,d)):a});return new fe(d,a.cc)}var je=new fe({".priority":Qd},{".priority":M});function rc(a,b){this.B=a;I(n(this.B)&&null!==this.B,"LeafNode shouldn't be created with null/undefined value.");this.aa=b||B;ke(this.aa);this.Ab=null}var le=["object","boolean","number","string"];g=rc.prototype;g.K=function(){return!0};g.C=function(){return this.aa};g.ga=function(a){return new rc(this.B,a)};g.R=function(a){return".priority"===a?this.aa:B};g.Q=function(a){return a.e()?this:".priority"===D(a)?this.aa:B};g.Da=function(){return!1};g.of=function(){return null};
g.U=function(a,b){return".priority"===a?this.ga(b):b.e()&&".priority"!==a?this:B.U(a,b).ga(this.aa)};g.G=function(a,b){var c=D(a);if(null===c)return b;if(b.e()&&".priority"!==c)return this;I(".priority"!==c||1===Id(a),".priority must be the last token in a path");return this.U(c,B.G(G(a),b))};g.e=function(){return!1};g.Bb=function(){return 0};g.P=function(){return!1};g.I=function(a){return a&&!this.C().e()?{".value":this.Ca(),".priority":this.C().I()}:this.Ca()};
g.hash=function(){if(null===this.Ab){var a="";this.aa.e()||(a+="priority:"+me(this.aa.I())+":");var b=typeof this.B,a=a+(b+":"),a="number"===b?a+Vc(this.B):a+this.B;this.Ab=Fc(a)}return this.Ab};g.Ca=function(){return this.B};g.Bc=function(a){if(a===B)return 1;if(a instanceof Q)return-1;I(a.K(),"Unknown node type");var b=typeof a.B,c=typeof this.B,d=Oa(le,b),e=Oa(le,c);I(0<=d,"Unknown leaf type: "+b);I(0<=e,"Unknown leaf type: "+c);return d===e?"object"===c?0:this.B<a.B?-1:this.B===a.B?0:1:e-d};
g.jb=function(){return this};g.Hc=function(){return!0};g.ca=function(a){return a===this?!0:a.K()?this.B===a.B&&this.aa.ca(a.aa):!1};g.toString=function(){return A(this.I(!0))};function Q(a,b,c){this.m=a;(this.aa=b)&&ke(this.aa);a.e()&&I(!this.aa||this.aa.e(),"An empty node cannot have a priority");this.ub=c;this.Ab=null}g=Q.prototype;g.K=function(){return!1};g.C=function(){return this.aa||B};g.ga=function(a){return this.m.e()?this:new Q(this.m,a,this.ub)};g.R=function(a){if(".priority"===a)return this.C();a=this.m.get(a);return null===a?B:a};g.Q=function(a){var b=D(a);return null===b?this:this.R(b).Q(G(a))};g.Da=function(a){return null!==this.m.get(a)};
g.U=function(a,b){I(b,"We should always be passing snapshot nodes");if(".priority"===a)return this.ga(b);var c=new E(a,b),d,e;b.e()?(d=this.m.remove(a),c=ie(this.ub,c,this.m)):(d=this.m.Na(a,b),c=ge(this.ub,c,this.m));e=d.e()?B:this.aa;return new Q(d,e,c)};g.G=function(a,b){var c=D(a);if(null===c)return b;I(".priority"!==D(a)||1===Id(a),".priority must be the last token in a path");var d=this.R(c).G(G(a),b);return this.U(c,d)};g.e=function(){return this.m.e()};g.Bb=function(){return this.m.count()};
var ne=/^(0|[1-9]\d*)$/;g=Q.prototype;g.I=function(a){if(this.e())return null;var b={},c=0,d=0,e=!0;this.P(M,function(f,h){b[f]=h.I(a);c++;e&&ne.test(f)?d=Math.max(d,Number(f)):e=!1});if(!a&&e&&d<2*c){var f=[],h;for(h in b)f[h]=b[h];return f}a&&!this.C().e()&&(b[".priority"]=this.C().I());return b};g.hash=function(){if(null===this.Ab){var a="";this.C().e()||(a+="priority:"+me(this.C().I())+":");this.P(M,function(b,c){var d=c.hash();""!==d&&(a+=":"+b+":"+d)});this.Ab=""===a?"":Fc(a)}return this.Ab};
g.of=function(a,b,c){return(c=oe(this,c))?(a=ac(c,new E(a,b)))?a.name:null:ac(this.m,a)};function sd(a,b){var c;c=(c=oe(a,b))?(c=c.Qc())&&c.name:a.m.Qc();return c?new E(c,a.m.get(c)):null}function td(a,b){var c;c=(c=oe(a,b))?(c=c.ec())&&c.name:a.m.ec();return c?new E(c,a.m.get(c)):null}g.P=function(a,b){var c=oe(this,a);return c?c.ia(function(a){return b(a.name,a.S)}):this.m.ia(b)};g.Wb=function(a){return this.Xb(a.Rc(),a)};
g.Xb=function(a,b){var c=oe(this,b);if(c)return c.Xb(a,function(a){return a});for(var c=this.m.Xb(a.name,Rb),d=cc(c);null!=d&&0>b.compare(d,a);)H(c),d=cc(c);return c};g.pf=function(a){return this.Zb(a.Oc(),a)};g.Zb=function(a,b){var c=oe(this,b);if(c)return c.Zb(a,function(a){return a});for(var c=this.m.Zb(a.name,Rb),d=cc(c);null!=d&&0<b.compare(d,a);)H(c),d=cc(c);return c};g.Bc=function(a){return this.e()?a.e()?0:-1:a.K()||a.e()?1:a===Td?-1:0};
g.jb=function(a){if(a===Od||ta(this.ub.cc,a.toString()))return this;var b=this.ub,c=this.m;I(a!==Od,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var d=[],e=!1,c=c.Wb(Rb),f=H(c);f;)e=e||a.Gc(f.S),d.push(f),f=H(c);d=e?he(d,rd(a)):Qd;e=a.toString();c=xa(b.cc);c[e]=a;a=xa(b.yd);a[e]=d;return new Q(this.m,this.aa,new fe(a,c))};g.Hc=function(a){return a===Od||ta(this.ub.cc,a.toString())};
g.ca=function(a){if(a===this)return!0;if(a.K())return!1;if(this.C().ca(a.C())&&this.m.count()===a.m.count()){var b=this.Wb(M);a=a.Wb(M);for(var c=H(b),d=H(a);c&&d;){if(c.name!==d.name||!c.S.ca(d.S))return!1;c=H(b);d=H(a)}return null===c&&null===d}return!1};function oe(a,b){return b===Od?null:a.ub.get(b.toString())}g.toString=function(){return A(this.I(!0))};function L(a,b){if(null===a)return B;var c=null;"object"===typeof a&&".priority"in a?c=a[".priority"]:"undefined"!==typeof b&&(c=b);I(null===c||"string"===typeof c||"number"===typeof c||"object"===typeof c&&".sv"in c,"Invalid priority type found: "+typeof c);"object"===typeof a&&".value"in a&&null!==a[".value"]&&(a=a[".value"]);if("object"!==typeof a||".sv"in a)return new rc(a,L(c));if(a instanceof Array){var d=B,e=a;t(e,function(a,b){if(u(e,b)&&"."!==b.substring(0,1)){var c=L(a);if(c.K()||!c.e())d=
d.U(b,c)}});return d.ga(L(c))}var f=[],h=!1,k=a;gb(k,function(a){if("string"!==typeof a||"."!==a.substring(0,1)){var b=L(k[a]);b.e()||(h=h||!b.C().e(),f.push(new E(a,b)))}});if(0==f.length)return B;var m=he(f,Sb,function(a){return a.name},Ub);if(h){var l=he(f,rd(M));return new Q(m,L(c),new fe({".priority":l},{".priority":M}))}return new Q(m,L(c),je)}var pe=Math.log(2);
function qe(a){this.count=parseInt(Math.log(a+1)/pe,10);this.ff=this.count-1;this.dg=a+1&parseInt(Array(this.count+1).join("1"),2)}function re(a){var b=!(a.dg&1<<a.ff);a.ff--;return b}
function he(a,b,c,d){function e(b,d){var f=d-b;if(0==f)return null;if(1==f){var l=a[b],r=c?c(l):l;return new dc(r,l.S,!1,null,null)}var l=parseInt(f/2,10)+b,f=e(b,l),x=e(l+1,d),l=a[l],r=c?c(l):l;return new dc(r,l.S,!1,f,x)}a.sort(b);var f=function(b){function d(b,h){var k=r-b,x=r;r-=b;var x=e(k+1,x),k=a[k],J=c?c(k):k,x=new dc(J,k.S,h,null,x);f?f.left=x:l=x;f=x}for(var f=null,l=null,r=a.length,x=0;x<b.count;++x){var J=re(b),vd=Math.pow(2,b.count-(x+1));J?d(vd,!1):(d(vd,!1),d(vd,!0))}return l}(new qe(a.length));
return null!==f?new Zb(d||b,f):new Zb(d||b)}function me(a){return"number"===typeof a?"number:"+Vc(a):"string:"+a}function ke(a){if(a.K()){var b=a.I();I("string"===typeof b||"number"===typeof b||"object"===typeof b&&u(b,".sv"),"Priority must be a string or number.")}else I(a===Td||a.e(),"priority of unexpected type.");I(a===Td||a.C().e(),"Priority nodes can't have a priority of their own.")}var B=new Q(new Zb(Ub),null,je);function se(){Q.call(this,new Zb(Ub),B,je)}ma(se,Q);g=se.prototype;
g.Bc=function(a){return a===this?0:1};g.ca=function(a){return a===this};g.C=function(){return this};g.R=function(){return B};g.e=function(){return!1};var Td=new se,Rd=new E("[MIN_NAME]",B),Xd=new E("[MAX_NAME]",Td);function Gd(a,b){this.O=a;this.Vd=b}function Dd(a,b,c,d){return new Gd(new rb(b,c,d),a.Vd)}function Hd(a){return a.O.ea?a.O.j():null}Gd.prototype.w=function(){return this.Vd};function sb(a){return a.Vd.ea?a.Vd.j():null};function te(a,b){this.W=a;var c=a.n,d=new id(c.g),c=R(c)?new id(c.g):c.ja?new od(c):new jd(c);this.Ff=new wd(c);var e=b.w(),f=b.O,h=d.xa(B,e.j(),null),k=c.xa(B,f.j(),null);this.Ja=new Gd(new rb(k,f.ea,c.Ma()),new rb(h,e.ea,d.Ma()));this.Wa=[];this.lg=new ad(a)}function ue(a){return a.W}g=te.prototype;g.w=function(){return this.Ja.w().j()};g.bb=function(a){var b=sb(this.Ja);return b&&(R(this.W.n)||!a.e()&&!b.R(D(a)).e())?b.Q(a):null};g.e=function(){return 0===this.Wa.length};g.Nb=function(a){this.Wa.push(a)};
g.hb=function(a,b){var c=[];if(b){I(null==a,"A cancel should cancel all event registrations.");var d=this.W.path;Pa(this.Wa,function(a){(a=a.df(b,d))&&c.push(a)})}if(a){for(var e=[],f=0;f<this.Wa.length;++f){var h=this.Wa[f];if(!h.matches(a))e.push(h);else if(a.qf()){e=e.concat(this.Wa.slice(f+1));break}}this.Wa=e}else this.Wa=[];return c};
g.$a=function(a,b,c){a.type===zd&&null!==a.source.Fb&&(I(sb(this.Ja),"We should always have a full cache before handling merges"),I(Hd(this.Ja),"Missing event cache, even though we have a server cache"));var d=this.Ja;a=this.Ff.$a(d,a,b,c);b=this.Ff;c=a.fe;I(c.O.j().Hc(b.V.g),"Event snap not indexed");I(c.w().j().Hc(b.V.g),"Server snap not indexed");I(Gb(a.fe.w())||!Gb(d.w()),"Once a server snap is complete, it should never go back");this.Ja=a.fe;return ve(this,a.eg,a.fe.O.j(),null)};
function we(a,b){var c=a.Ja.O,d=[];c.j().K()||c.j().P(M,function(a,b){d.push(new C("child_added",b,a))});c.ea&&d.push(Cb(c.j()));return ve(a,d,c.j(),b)}function ve(a,b,c,d){return bd(a.lg,b,c,d?[d]:a.Wa)};function xe(a,b,c){this.type=zd;this.source=a;this.path=b;this.children=c}xe.prototype.Vc=function(a){if(this.path.e())return a=this.children.subtree(new K(a)),a.e()?null:a.value?new Vb(this.source,F,a.value):new xe(this.source,F,a);I(D(this.path)===a,"Can't get a merge for a child not on the path of the operation");return new xe(this.source,G(this.path),this.children)};xe.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"};function ye(a,b){this.f=Kc("p:rest:");this.F=a;this.Eb=b;this.Aa=null;this.$={}}function ze(a,b){if(n(b))return"tag$"+b;I(de(a.n),"should have a tag if it's not a default query.");return a.path.toString()}g=ye.prototype;
g.uf=function(a,b,c,d){var e=a.path.toString();this.f("Listen called for "+e+" "+a.va());var f=ze(a,c),h={};this.$[f]=h;a=ee(a.n);var k=this;Ae(this,e+".json",a,function(a,b){var r=b;404===a&&(a=r=null);null===a&&k.Eb(e,r,!1,c);v(k.$,f)===h&&d(a?401==a?"permission_denied":"rest_error:"+a:"ok",null)})};g.Qf=function(a,b){var c=ze(a,b);delete this.$[c]};g.M=function(a,b){this.Aa=a;var c=Yc(a),d=c.data,c=c.Ac&&c.Ac.exp;b&&b("ok",{auth:d,expires:c})};g.de=function(a){this.Aa=null;a("ok",null)};g.Je=function(){};
g.Bf=function(){};g.Hd=function(){};g.put=function(){};g.wf=function(){};g.Re=function(){};
function Ae(a,b,c,d){c=c||{};c.format="export