/*! @license Firebase v4.2.0 Build: rev-d6b2db4 Terms: https://firebase.google.com/terms/ --- typedarray.js Copyright (c) 2010, Linden Research, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var firebase=function(){var e=void 0===e?self:e;return function(t){function n(e){if(o[e])return o[e].exports;var r=o[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}var r=e.webpackJsonpFirebase;e.webpackJsonpFirebase=function(e,o,c){for(var s,a,u,f=0,l=[];f"}),n=this.serviceName+": "+n+" ("+o+").";var c=new i(o,n);for(var s in t)t.hasOwnProperty(s)&&"_"!==s.slice(-1)&&(c[s]=t[s]);return c},e}()},,,function(e,t,n){"use strict";function r(e,t){var n=new a(e,t);return n.subscribe.bind(n)}function o(e,t){if("object"!==(void 0===e?"undefined":s(e))||null===e)return!1;for(var n=0,r=t;n1)for(var n=1;n>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var r=arguments[1],o=0;o>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var r=arguments[1],o=0;o=0&&(e.x=setTimeout(function(){e.S&&e.S()},t))},r(22),n.setImmediate=setImmediate,n.clearImmediate=clearImmediate},function(e,t,n){(function(e,t){!function(e,n){"use strict";function r(e){"function"!=typeof e&&(e=Function(""+e));for(var t=Array(arguments.length-1),n=0;n")&&(a=a.replace(ta,">"));-1!=a.indexOf('"')&&(a=a.replace(ua,"""));-1!=a.indexOf("'")&& (a=a.replace(va,"'"));-1!=a.indexOf("\x00")&&(a=a.replace(wa,"�"));return a},ra=/&/g,sa=//g,ua=/"/g,va=/'/g,wa=/\x00/g,qa=/[\x00&<>"']/,v=function(a,b){return-1!=a.indexOf(b)},ya=function(a,b){return ab?1:0};var za=function(a,b){b.unshift(a);u.call(this,oa.apply(null,b));b.shift()};t(za,u);za.prototype.name="AssertionError"; var Aa=function(a,b,c,d){var e="Assertion failed";if(c){e+=": "+c;var f=d}else a&&(e+=": "+a,f=b);throw new za(""+e,f||[]);},w=function(a,b,c){a||Aa("",null,b,Array.prototype.slice.call(arguments,2));return a},Ba=function(a,b){throw new za("Failure"+(a?": "+a:""),Array.prototype.slice.call(arguments,1));},Ca=function(a,b,c){da(a)||Aa("Expected number but got %s: %s.",[fa(a),a],b,Array.prototype.slice.call(arguments,2));return a},Da=function(a,b,c){m(a)||Aa("Expected string but got %s: %s.",[fa(a), a],b,Array.prototype.slice.call(arguments,2))},Ea=function(a,b,c){p(a)||Aa("Expected function but got %s: %s.",[fa(a),a],b,Array.prototype.slice.call(arguments,2))};var Ga=function(){this.Rc="";this.$e=Fa};Ga.prototype.mb=!0;Ga.prototype.kb=function(){return this.Rc};Ga.prototype.toString=function(){return"Const{"+this.Rc+"}"};var Ha=function(a){if(a instanceof Ga&&a.constructor===Ga&&a.$e===Fa)return a.Rc;Ba("expected object of type Const, got '"+a+"'");return"type_error:Const"},Fa={},Ia=function(a){var b=new Ga;b.Rc=a;return b};Ia("");var Ka=function(){this.Kc="";this.af=Ja};Ka.prototype.mb=!0;Ka.prototype.kb=function(){return this.Kc};Ka.prototype.toString=function(){return"TrustedResourceUrl{"+this.Kc+"}"}; var La=function(a){if(a instanceof Ka&&a.constructor===Ka&&a.af===Ja)return a.Kc;Ba("expected object of type TrustedResourceUrl, got '"+a+"' of type "+fa(a));return"type_error:TrustedResourceUrl"},Na=function(a,b){a=Ma(a,b);b=new Ka;b.Kc=a;return b},Ma=function(a,b){var c=Ha(a);if(!Oa.test(c))throw Error("Invalid TrustedResourceUrl format: "+c);return c.replace(Pa,function(a,e){if(!Object.prototype.hasOwnProperty.call(b,e))throw Error('Found marker, "'+e+'", in format string, "'+c+'", but no valid label mapping found in args: '+ JSON.stringify(b));a=b[e];return a instanceof Ga?Ha(a):encodeURIComponent(String(a))})},Pa=/%{(\w+)}/g,Oa=/^(?:https:)?\/\/[0-9a-z.:[\]-]+\/|^\/[^\/\\]|^about:blank(#|$)/i,Ja={};var Qa=Array.prototype.indexOf?function(a,b,c){w(null!=a.length);return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(m(a))return m(b)&&1==b.length?a.indexOf(b,c):-1;for(;cb?null:m(a)?a.charAt(b):a[b]},Wa=function(a,b){return 0<=Qa(a,b)},Ya=function(a,b){b=Qa(a,b);var c;(c=0<=b)&&Xa(a,b);return c},Xa=function(a,b){w(null!=a.length);return 1==Array.prototype.splice.call(a,b,1).length},Za=function(a,b){var c=0;Ra(a,function(d,e){b.call(void 0,d,e,a)&&Xa(a,e)&&c++})},$a=function(a){return Array.prototype.concat.apply([],arguments)}, ab=function(a){var b=a.length;if(0parseFloat(zb)){yb=String(Bb);break a}}yb=zb} var Cb=yb,pb={},A=function(a){return qb(a,function(){for(var b=0,c=pa(String(Cb)).split("."),d=pa(String(a)).split("."),e=Math.max(c.length,d.length),f=0;0==b&&f>4);64!=g&&(b(f<<4&240|g>>2),64!=l&&b(g<<6&192|l))}},Jb=function(){if(!Fb){Fb={};Gb={};for(var a=0;65>a;a++)Fb[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a), Gb[Fb[a]]=a,62<=a&&(Gb["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var Kb=function(){this.Ia=-1};var Nb=function(a,b){this.Ia=64;this.oc=k.Uint8Array?new Uint8Array(this.Ia):Array(this.Ia);this.Vc=this.nb=0;this.l=[];this.Sf=a;this.we=b;this.tg=k.Int32Array?new Int32Array(64):Array(64);ba(Lb)||(Lb=k.Int32Array?new Int32Array(Mb):Mb);this.reset()},Lb;t(Nb,Kb);for(var Ob=[],Pb=0;63>Pb;Pb++)Ob[Pb]=0;var Qb=$a(128,Ob);Nb.prototype.reset=function(){this.Vc=this.nb=0;this.l=k.Int32Array?new Int32Array(this.we):ab(this.we)}; var Rb=function(a){var b=a.oc;w(b.length==a.Ia);for(var c=a.tg,d=0,e=0;eb;b++){d=c[b-15]|0;e=c[b-2]|0;e=(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10;var f=(c[b-16]|0)+((d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3)|0;var g=(c[b-7]|0)+e|0;c[b]=f+g|0}d=a.l[0]|0;e=a.l[1]|0;var l=a.l[2]|0,n=a.l[3]|0,C=a.l[4]|0,wb=a.l[5]|0,ec=a.l[6]|0;f=a.l[7]|0;for(b=0;64>b;b++){var mi=((d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10))+(d&e^d&l^e&l)|0;g=C&wb^~C&ec;f=f+ ((C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7))|0;g=g+(Lb[b]|0)|0;g=f+(g+(c[b]|0)|0)|0;f=ec;ec=wb;wb=C;C=n+g|0;n=l;l=e;e=d;d=g+mi|0}a.l[0]=a.l[0]+d|0;a.l[1]=a.l[1]+e|0;a.l[2]=a.l[2]+l|0;a.l[3]=a.l[3]+n|0;a.l[4]=a.l[4]+C|0;a.l[5]=a.l[5]+wb|0;a.l[6]=a.l[6]+ec|0;a.l[7]=a.l[7]+f|0}; Nb.prototype.update=function(a,b){ba(b)||(b=a.length);var c=0,d=this.nb;if(m(a))for(;c=e&&e==(e|0)))throw Error("message must be a byte array");this.oc[d++]=e;d==this.Ia&&(Rb(this),d=0)}else throw Error("message must be string or array");this.nb=d;this.Vc+=b}; Nb.prototype.digest=function(){var a=[],b=8*this.Vc;56>this.nb?this.update(Qb,56-this.nb):this.update(Qb,this.Ia-(this.nb-56));for(var c=63;56<=c;c--)this.oc[c]=b&255,b/=256;Rb(this);for(c=b=0;c>d&255;return a}; var Mb=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804, 4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];var Tb=function(){Nb.call(this,8,Sb)};t(Tb,Nb);var Sb=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];var Ub=function(){this.Ka=this.Ka;this.Hc=this.Hc};Ub.prototype.Ka=!1;Ub.prototype.isDisposed=function(){return this.Ka};Ub.prototype.ib=function(){if(this.Hc)for(;this.Hc.length;)this.Hc.shift()()};var Vb=!z||9<=Number(Db),Wb=z&&!A("9");!vb||A("528");ub&&A("1.9b")||z&&A("8")||rb&&A("9.5")||vb&&A("528");ub&&!A("8")||z&&A("9");var Xb=function(){if(!k.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});k.addEventListener("test",ea,b);k.removeEventListener("test",ea,b);return a}();var B=function(a,b){this.type=a;this.currentTarget=this.target=b;this.defaultPrevented=this.Ua=!1;this.Je=!0};B.prototype.stopPropagation=function(){this.Ua=!0};B.prototype.preventDefault=function(){this.defaultPrevented=!0;this.Je=!1};var Yb=function(a,b){B.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.key="";this.charCode=this.keyCode=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.fa=this.state=null;a&&this.init(a,b)};t(Yb,B); Yb.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.currentTarget=b;if(b=a.relatedTarget){if(ub){a:{try{ob(b.nodeName);var e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;null===d?(this.offsetX=vb||void 0!==a.offsetX?a.offsetX:a.layerX,this.offsetY=vb||void 0!==a.offsetY?a.offsetY:a.layerY,this.clientX=void 0!==a.clientX?a.clientX:a.pageX, this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.keyCode=a.keyCode||0;this.key=a.key||"";this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;this.fa=a;a.defaultPrevented&& this.preventDefault()};Yb.prototype.stopPropagation=function(){Yb.Sc.stopPropagation.call(this);this.fa.stopPropagation?this.fa.stopPropagation():this.fa.cancelBubble=!0};Yb.prototype.preventDefault=function(){Yb.Sc.preventDefault.call(this);var a=this.fa;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Wb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};Yb.prototype.wf=function(){return this.fa};var Zb="closure_listenable_"+(1E6*Math.random()|0),$b=0;var ac=function(a,b,c,d,e){this.listener=a;this.Lc=null;this.src=b;this.type=c;this.capture=!!d;this.uc=e;this.key=++$b;this.yb=this.nc=!1},bc=function(a){a.yb=!0;a.listener=null;a.Lc=null;a.src=null;a.uc=null};var cc=function(a){this.src=a;this.J={};this.hc=0};cc.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.J[f];a||(a=this.J[f]=[],this.hc++);var g=dc(a,b,d,e);-1d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e= b.currentTarget;e;e=e.parentNode)d.push(e);e=a.type;for(var f=d.length-1;!b.Ua&&0<=f;f--)b.currentTarget=d[f],a=vc(d[f],e,!0,b),c=c&&a;for(f=0;!b.Ua&&f>>0),lc=function(a){w(a,"Listener can not be null.");if(p(a))return a;w(a.handleEvent,"An object listener must have handleEvent method.");a[wc]||(a[wc]=function(b){return a.handleEvent(b)}); return a[wc]};var xc=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;var zc=function(){this.wa="";this.Ze=yc};zc.prototype.mb=!0;zc.prototype.kb=function(){return this.wa};zc.prototype.toString=function(){return"SafeUrl{"+this.wa+"}"}; var Ac=function(a){if(a instanceof zc&&a.constructor===zc&&a.Ze===yc)return a.wa;Ba("expected object of type SafeUrl, got '"+a+"' of type "+fa(a));return"type_error:SafeUrl"},Bc=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i,Dc=function(a){if(a instanceof zc)return a;a=a.mb?a.kb():String(a);Bc.test(a)||(a="about:invalid#zClosurez");return Cc(a)},yc={},Cc=function(a){var b=new zc;b.wa=a;return b};Cc("about:blank");var Gc=function(a){var b=[];Ec(new Fc,a,b);return b.join("")},Fc=function(){this.Mc=void 0},Ec=function(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(ia(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;f");f=f.join("")}f=e.createElement(f);g&&(m(g)?f.className=g:ia(g)?f.className=g.join(" "):nd(f,g));2=b.ed&&b.cancel())}this.De?this.De.call(this.je,this):this.Ud=!0;this.jb||Od(this,new Pd)}};Nd.prototype.he=function(a,b){this.dd=!1;Qd(this,a,b)}; var Qd=function(a,b,c){a.jb=!0;a.ya=c;a.Lb=!b;Rd(a)},Td=function(a){if(a.jb){if(!a.Ud)throw new Sd;a.Ud=!1}};Nd.prototype.callback=function(a){Td(this);Ud(a);Qd(this,!0,a)};var Od=function(a,b){Td(a);Ud(b);Qd(a,!1,b)},Ud=function(a){w(!(a instanceof Nd),"An execution sequence may not be initiated with a blocking Deferred.")},Wd=function(a,b){Vd(a,null,b,void 0)},Vd=function(a,b,c,d){w(!a.$d,"Blocking Deferreds can not be re-used");a.Oc.push([b,c,d]);a.jb&&Rd(a)}; Nd.prototype.then=function(a,b,c){var d,e,f=new D(function(a,b){d=a;e=b});Vd(this,d,function(a){a instanceof Pd?f.cancel():e(a)});return f.then(a,b,c)};rd(Nd); var Xd=function(a){return Ta(a.Oc,function(a){return p(a[1])})},Rd=function(a){if(a.Wc&&a.jb&&Xd(a)){var b=a.Wc,c=Yd[b];c&&(k.clearTimeout(c.Mb),delete Yd[b]);a.Wc=0}a.w&&(a.w.ed--,delete a.w);b=a.ya;for(var d=c=!1;a.Oc.length&&!a.dd;){var e=a.Oc.shift(),f=e[0],g=e[1];e=e[2];if(f=a.Lb?g:f)try{var l=f.call(e||a.je,b);ba(l)&&(a.Lb=a.Lb&&(l==b||l instanceof Error),a.ya=b=l);if(sd(b)||"function"===typeof k.Promise&&b instanceof k.Promise)d=!0,a.dd=!0}catch(n){b=n,a.Lb=!0,Xd(a)||(c=!0)}}a.ya=b;d&&(l=r(a.he, a,!0),d=r(a.he,a,!1),b instanceof Nd?(Vd(b,l,d),b.$d=!0):b.then(l,d));c&&(b=new Zd(b),Yd[b.Mb]=b,a.Wc=b.Mb)},Sd=function(){u.call(this)};t(Sd,u);Sd.prototype.message="Deferred has already fired";Sd.prototype.name="AlreadyCalledError";var Pd=function(){u.call(this)};t(Pd,u);Pd.prototype.message="Deferred was canceled";Pd.prototype.name="CanceledError";var Zd=function(a){this.Mb=k.setTimeout(r(this.pg,this),0);this.$=a}; Zd.prototype.pg=function(){w(Yd[this.Mb],"Cannot throw an error that is not scheduled.");delete Yd[this.Mb];throw this.$;};var Yd={};var de=function(a){var b={},c=b.document||document,d=La(a),e=document.createElement("SCRIPT"),f={Ke:e,gc:void 0},g=new Nd($d,f),l=null,n=null!=b.timeout?b.timeout:5E3;0=me(this).value)for(p(b)&&(b=b()),a=new ee(a,String(b),this.Be),c&&(a.le=c),c="log:"+a.Rf,(b=k.console)&&b.timeStamp&&b.timeStamp(c),(b=k.msWriteProfilerMark)&&b(c),c=this;c;){var d=c,e=a;if(d.re)for(var f=0;b=d.re[f];f++)b(e);c=c.getParent()}};ge.prototype.info=function(a,b){this.log(je,a,b)};ge.prototype.config=function(a,b){this.log(ke,a,b)}; var ne={},oe=null,pe=function(a){oe||(oe=new ge(""),ne[""]=oe,oe.Me(ke));var b;if(!(b=ne[a])){b=new ge(a);var c=a.lastIndexOf("."),d=a.substr(c+1);c=pe(a.substr(0,c));c.gd||(c.gd={});c.gd[d]=b;b.w=c;ne[a]=b}return b};var G=function(){Ub.call(this);this.ea=new cc(this);this.cf=this;this.Ed=null};t(G,Ub);G.prototype[Zb]=!0;h=G.prototype;h.addEventListener=function(a,b,c,d){kc(this,a,b,c,d)};h.removeEventListener=function(a,b,c,d){sc(this,a,b,c,d)}; h.dispatchEvent=function(a){qe(this);var b=this.Ed;if(b){var c=[];for(var d=1;b;b=b.Ed)c.push(b),w(1E3>++d,"infinite loop")}b=this.cf;d=a.type||a;if(m(a))a=new B(a,b);else if(a instanceof B)a.target=a.target||b;else{var e=a;a=new B(d,b);nb(a,e)}e=!0;if(c)for(var f=c.length-1;!a.Ua&&0<=f;f--){var g=a.currentTarget=c[f];e=re(g,d,!0,a)&&e}a.Ua||(g=a.currentTarget=b,e=re(g,d,!0,a)&&e,a.Ua||(e=re(g,d,!1,a)&&e));if(c)for(f=0;!a.Ua&&f2*this.s&&ve(this),!0):!1};var ve=function(a){var b,c;if(a.s!=a.A.length){for(b=c=0;c=d.A.length)throw se;var e=d.A[b++];return a?e:d.ia[e]};return e};var we=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var xe=function(a){if(a.ga&&"function"==typeof a.ga)return a.ga();if(m(a))return a.split("");if(ja(a)){for(var b=[],c=a.length,d=0;db)throw Error("Bad port number "+b);a.rb=b}else a.rb=null},We=function(a,b,c){J(a);a.Da=c?Ye(b,!0):b},Xe=function(a,b,c){J(a);b instanceof Ze?(a.ca=b,a.ca.Rd(a.ba)):(c||(b=$e(b,ef)),a.ca=new Ze(b,0,a.ba))},K=function(a,b,c){J(a);a.ca.set(b,c)},ff=function(a,b){return a.ca.get(b)}; Se.prototype.removeParameter=function(a){J(this);this.ca.remove(a);return this};var J=function(a){if(a.Mf)throw Error("Tried to modify a read-only Uri");};Se.prototype.Rd=function(a){this.ba=a;this.ca&&this.ca.Rd(a);return this}; var gf=function(a){return a instanceof Se?a.clone():new Se(a,void 0)},hf=function(a,b){var c=new Se(null,void 0);Te(c,"https");a&&Ue(c,a);b&&We(c,b);return c},Ye=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},$e=function(a,b,c){return m(a)?(a=encodeURI(a).replace(b,jf),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},jf=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},af=/[#\/\?@]/g,cf=/[\#\?:]/g,bf=/[\#\?]/g,ef=/[\#\?@]/g, df=/#/g,Ze=function(a,b,c){this.s=this.m=null;this.T=a||null;this.ba=!!c},kf=function(a){a.m||(a.m=new ue,a.s=0,a.T&&De(a.T,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},mf=function(a){var b=ye(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new Ze(null,0,void 0);a=xe(a);for(var d=0;da?!1:!z||!Db||9',Da(Ha(a),"must provide justification"), w(!/^[\s\xa0]*$/.test(Ha(a)),"must provide non-empty justification"),g.document.write(jd((new id).If(d))),g.document.close())):g=a.open(Ac(b),c,g);if(g)try{g.focus()}catch(l){}return g},wf=function(a){return new D(function(b){var c=function(){Be(2E3).then(function(){if(!a||a.closed)b();else return c()})};return c()})},xf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,yf=function(){var a=null;return(new D(function(b){"complete"==k.document.readyState?b():(a=function(){b()},jc(window,"load",a))})).f(function(b){sc(window, "load",a);throw b;})},Af=function(){return zf(void 0)?yf().then(function(){return new D(function(a,b){var c=k.document,d=setTimeout(function(){b(Error("Cordova framework is not ready."))},1E3);c.addEventListener("deviceready",function(){clearTimeout(d);a()},!1)})}):F(Error("Cordova must run in an Android or iOS file scheme."))},zf=function(a){a=a||L();return!("file:"!==Bf()||!a.toLowerCase().match(/iphone|ipad|ipod|android/))},Cf=function(){var a=k.window;try{return!(!a||a==a.top)}catch(b){return!1}}, Df=function(){return firebase.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":firebase.INTERNAL.hasOwnProperty("node")?"Node":"Browser"},Ef=function(){var a=Df();return"ReactNative"===a||"Node"===a},rf=function(a){var b=a.toLowerCase();if(v(b,"opera/")||v(b,"opr/")||v(b,"opios/"))return"Opera";if(v(b,"iemobile"))return"IEMobile";if(v(b,"msie")||v(b,"trident/"))return"IE";if(v(b,"edge/"))return"Edge";if(v(b,"firefox/"))return"Firefox";if(v(b,"silk/"))return"Silk";if(v(b,"blackberry"))return"Blackberry"; if(v(b,"webos"))return"Webos";if(!v(b,"safari/")||v(b,"chrome/")||v(b,"crios/")||v(b,"android"))if(!v(b,"chrome/")&&!v(b,"crios/")||v(b,"edge/")){if(v(b,"android"))return"Android";if((a=a.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==a.length)return a[1]}else return"Chrome";else return"Safari";return"Other"},Ff=function(a){var b=Df();return("Browser"===b?rf(L()):b)+"/JsCore/"+a},L=function(){return k.navigator&&k.navigator.userAgent||""},M=function(a,b){a=a.split(".");b=b||k;for(var c=0;cb)throw Error("Short delay should be less than long delay!");this.lg=a;this.Qf=b;a=c||L();d=d||Df();this.Lf=tf(a)||"ReactNative"===d};Rf.prototype.get=function(){return this.Lf?this.Qf:this.lg}; var Sf=function(){var a=k.document;return a&&"undefined"!==typeof a.visibilityState?"visible"==a.visibilityState:!0},Tf=function(){var a=k.document,b=null;return Sf()||!a?E():(new D(function(c){b=function(){Sf()&&(a.removeEventListener("visibilitychange",b,!1),c())};a.addEventListener("visibilitychange",b,!1)})).f(function(c){a.removeEventListener("visibilitychange",b,!1);throw c;})};var Uf={};var Vf;try{var Wf={};Object.defineProperty(Wf,"abcd",{configurable:!0,enumerable:!0,value:1});Object.defineProperty(Wf,"abcd",{configurable:!0,enumerable:!0,value:2});Vf=2==Wf.abcd}catch(a){Vf=!1} var N=function(a,b,c){Vf?Object.defineProperty(a,b,{configurable:!0,enumerable:!0,value:c}):a[b]=c},Xf=function(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&N(a,c,b[c])},Yf=function(a){var b={};Xf(b,a);return b},Zf=function(a){var b={},c;for(c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},$f=function(a,b){if(!b||!b.length)return!0;if(!a)return!1;for(var c=0;c Auth section -> Sign in method tab.",a):"http"==d||"https"==d?c=oa("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",a):b= "operation-not-supported-in-this-environment";O.call(this,b,c)};t(jg,O);var kg=function(a){this.Pf=a.sub;na();this.Ib=a.email||null;this.Zf=a.provider_id||null;this.ef=!!a.is_anonymous||"anonymous"==this.Zf};kg.prototype.getEmail=function(){return this.Ib};kg.prototype.isAnonymous=function(){return this.ef};var lg=function(a,b){return a.then(function(a){if(a.idToken){a:{var c=a.idToken.split(".");if(3==c.length){c=c[1];for(var e=(4-c.length%4)%4,f=0;fa.Yd&&(a.Qa=a.Yd);return b},Fi=function(a,b){a.stop();a.qb=Be(Gi(a,b)).then(function(){return a.eg?E():Tf()}).then(function(){return a.Wf()}).then(function(){Fi(a,!0)}).f(function(b){a.dg(b)&&Fi(a,!1)})};Ei.prototype.stop=function(){this.qb&&(this.qb.cancel(),this.qb=null)};var Mi=function(a){var b={};b["facebook.com"]=Hi;b["google.com"]=Ii;b["github.com"]=Ji;b["twitter.com"]=Ki;var c=a&&a.providerId;return c?b[c]?new b[c](a):new Li(a):null},Li=function(a){var b=Nf(a.rawUserInfo||"{}");a=a.providerId;if(!a)throw Error("Invalid additional user info!");N(this,"profile",ag(b||{}));N(this,"providerId",a)},Hi=function(a){Li.call(this,a);if("facebook.com"!=this.providerId)throw Error("Invalid provider id!");};t(Hi,Li); var Ji=function(a){Li.call(this,a);if("github.com"!=this.providerId)throw Error("Invalid provider id!");N(this,"username",this.profile&&this.profile.login||null)};t(Ji,Li);var Ii=function(a){Li.call(this,a);if("google.com"!=this.providerId)throw Error("Invalid provider id!");};t(Ii,Li);var Ki=function(a){Li.call(this,a);if("twitter.com"!=this.providerId)throw Error("Invalid provider id!");N(this,"username",a.screenName||null)};t(Ki,Li);var Ni={zg:"local",NONE:"none",Ag:"session"},Oi=function(a){var b=new O("invalid-persistence-type"),c=new O("unsupported-persistence-type");a:{for(d in Ni)if(Ni[d]==a){var d=!0;break a}d=!1}if(!d||"string"!==typeof a)throw b;switch(Df()){case "ReactNative":if("session"===a)throw c;break;case "Node":if("none"!==a)throw c;break;default:if(!Hf()&&"none"!==a)throw c;}},Pi=function(a,b,c,d){this.Ce=a;this.Pd=b;this.fg=c;this.ac=d;this.V={};yi||(yi=new xi);a=yi;try{if(nf()){oi||(oi=new ni("firebaseLocalStorageDb", "firebaseLocalStorage","fbase_key","value",1));var e=oi}else e=new a.ke.B;this.He=e}catch(f){this.He=new gi,this.ac=!0}try{this.Re=new a.ke.Xd}catch(f){this.Re=new gi}this.Ff=new gi;this.Wd=r(this.Pe,this);this.W={}},Qi,Ri=function(){Qi||(Qi=new Pi("firebase",":",!Of(L())&&Cf()?!0:!1,Kf()));return Qi},Si=function(a,b){switch(b){case "session":return a.Re;case "none":return a.Ff;default:return a.He}};h=Pi.prototype;h.aa=function(a,b){return this.Ce+this.Pd+a.name+(b?this.Pd+b:"")}; h.get=function(a,b){return Si(this,a.B).get(this.aa(a,b))};h.remove=function(a,b){b=this.aa(a,b);"local"!=a.B||this.ac||(this.W[b]=null);return Si(this,a.B).remove(b)};h.set=function(a,b,c){var d=this.aa(a,c),e=this,f=Si(this,a.B);return f.set(d,b).then(function(){return f.get(d)}).then(function(b){"local"!=a.B||this.ac||(e.W[d]=b)})};h.addListener=function(a,b,c){a=this.aa(a,b);this.ac||(this.W[a]=k.localStorage.getItem(a));jb(this.V)&&this.Vd();this.V[a]||(this.V[a]=[]);this.V[a].push(c)}; h.removeListener=function(a,b,c){a=this.aa(a,b);this.V[a]&&(Za(this.V[a],function(a){return a==c}),0==this.V[a].length&&delete this.V[a]);jb(this.V)&&this.Qc()};h.Vd=function(){Si(this,"local").gb(this.Wd);this.ac||nf()||Ti(this)};var Ti=function(a){Ui(a);a.zd=setInterval(function(){for(var b in a.V){var c=k.localStorage.getItem(b),d=a.W[b];c!=d&&(a.W[b]=c,c=new Yb({type:"storage",key:b,target:window,oldValue:d,newValue:c,Gd:!0}),a.Pe(c))}},1E3)},Ui=function(a){a.zd&&(clearInterval(a.zd),a.zd=null)}; Pi.prototype.Qc=function(){Si(this,"local").Xa(this.Wd);Ui(this)}; Pi.prototype.Pe=function(a){if(a&&a.wf){var b=a.fa.key;if(0==b.indexOf(this.Ce+this.Pd)&&this.V[b]){"undefined"!==typeof a.fa.Gd?Si(this,"local").Xa(this.Wd):Ui(this);if(this.fg){var c=k.localStorage.getItem(b),d=a.fa.newValue;if(d!==c)null!==d?k.localStorage.setItem(b,d):k.localStorage.removeItem(b);else if(this.W[b]===d&&"undefined"===typeof a.fa.Gd)return}if("undefined"!==typeof a.fa.Gd||this.W[b]!==k.localStorage.getItem(b))this.W[b]=k.localStorage.getItem(b),this.ce(b)}}else x(a,r(this.ce,this))}; Pi.prototype.ce=function(a){this.V[a]&&x(this.V[a],function(a){a()})};var Vi=function(a,b){this.j=a;this.h=b||Ri()},Wi={name:"authEvent",B:"local"},Xi=function(a){return a.h.get(Wi,a.j).then(function(a){return ig(a)})};Vi.prototype.fb=function(a){this.h.addListener(Wi,this.j,a)};Vi.prototype.$b=function(a){this.h.removeListener(Wi,this.j,a)};var Yi=function(a){this.h=a||Ri()},Zi={name:"sessionId",B:"session"};Yi.prototype.sc=function(a){return this.h.get(Zi,a)};var $i=function(a,b,c,d,e,f){this.C=a;this.o=b;this.u=c;this.Ja=d||null;this.Qe=b+":"+c;this.gg=new Yi;this.oe=new Vi(this.Qe);this.ud=null;this.sa=[];this.Kf=e||500;this.$f=f||2E3;this.Nb=this.Ic=null},aj=function(a){return new O("invalid-cordova-configuration",a)}; $i.prototype.Pa=function(){return this.Pb?this.Pb:this.Pb=Af().then(function(){if("function"!==typeof M("universalLinks.subscribe",k))throw aj("cordova-universal-links-plugin is not installed");if("undefined"===typeof M("BuildInfo.packageName",k))throw aj("cordova-plugin-buildinfo is not installed");if("function"!==typeof M("cordova.plugins.browsertab.openUrl",k))throw aj("cordova-plugin-browsertab is not installed");if("function"!==typeof M("cordova.InAppBrowser.open",k))throw aj("cordova-plugin-inappbrowser is not installed"); },function(){throw new O("cordova-not-ready");})};var bj=function(){for(var a=20,b=[];0this.La-3E4?this.da?Ej(this,{grant_type:"refresh_token",refresh_token:this.da}):E(null):E({accessToken:this.Ga,expirationTime:this.La,refreshToken:this.da})};var Fj=function(a,b,c,d,e,f){Xf(this,{uid:a,displayName:d||null,photoURL:e||null,email:c||null,phoneNumber:f||null,providerId:b})},Gj=function(a,b){B.call(this,a);for(var c in b)this[c]=b[c]};t(Gj,B); var S=function(a,b,c){this.K=[];this.o=a.apiKey;this.u=a.appName;this.C=a.authDomain||null;a=firebase.SDK_VERSION?Ff(firebase.SDK_VERSION):null;this.g=new R(this.o,null,a);this.qa=new Bj(this.g);Hj(this,b.idToken);Dj(this.qa,b);N(this,"refreshToken",this.qa.da);Ij(this,c||{});G.call(this);this.Jc=!1;this.C&&Jf()&&(this.v=wj(this.C,this.o,this.u));this.Pc=[];this.ra=null;this.sb=Jj(this);this.Cb=r(this.rd,this);var d=this;this.ha=null;this.Ee=function(a){d.bc(a.Nf)};this.xd=null};t(S,G); S.prototype.bc=function(a){this.ha=a;Vg(this.g,a)};var Kj=function(a,b){a.xd&&sc(a.xd,"languageCodeChanged",a.Ee);(a.xd=b)&&kc(b,"languageCodeChanged",a.Ee)};S.prototype.rd=function(){this.sb.qb&&(this.sb.stop(),this.sb.start())}; var Lj=function(a){try{return firebase.app(a.u).auth()}catch(b){throw new O("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+a.u+"'!");}},Jj=function(a){return new Ei(function(){return a.getIdToken(!0)},function(a){return a&&"auth/network-request-failed"==a.code?!0:!1},function(){var b=a.qa.La-na()-3E5;return 0this.Ma&&(this.Ma=0);0==this.Ma&&U(this)&&Nj(U(this));this.removeAuthTokenListener(a)};h.addAuthTokenListener=function(a){var b=this;this.Ha.push(a);this.c(this.xa.then(function(){b.Ba||Wa(b.Ha,a)&&a(Ik(b))}))};h.removeAuthTokenListener=function(a){Za(this.Ha,function(b){return b==a})};var Hk=function(a,b){a.Bb.push(b);a.c(a.xa.then(function(){!a.Ba&&Wa(a.Bb,b)&&a.jc!==a.getUid()&&(a.jc=a.getUid(),b(Ik(a)))}))};h=T.prototype; h["delete"]=function(){this.Ba=!0;for(var a=0;al||l>=Jk.length)throw new O("internal-error","Argument validator received an unsupported number of arguments.");e=Jk[l]+" argument "+(e.name?'"'+e.name+'" ':"")+"must be "+e.R+".";break a}e=null}}if(e)throw new O("argument-error",d+" failed: "+e);return b.apply(this,a)};for(var e in b)a[e]=b[e];for(e in b.prototype)a.prototype[e]= b.prototype[e];return a},Uk=function(a){a=a.split(".");return a[a.length-1]};Y(T.prototype,{applyActionCode:{name:"applyActionCode",a:[V("code")]},checkActionCode:{name:"checkActionCode",a:[V("code")]},confirmPasswordReset:{name:"confirmPasswordReset",a:[V("code"),V("newPassword")]},createUserWithEmailAndPassword:{name:"createUserWithEmailAndPassword",a:[V("email"),V("password")]},fetchProvidersForEmail:{name:"fetchProvidersForEmail",a:[V("email")]},getRedirectResult:{name:"getRedirectResult",a:[]},onAuthStateChanged:{name:"onAuthStateChanged",a:[X(W(),Lk(),"nextOrObserver"), Lk("opt_error",!0),Lk("opt_completed",!0)]},onIdTokenChanged:{name:"onIdTokenChanged",a:[X(W(),Lk(),"nextOrObserver"),Lk("opt_error",!0),Lk("opt_completed",!0)]},sendPasswordResetEmail:{name:"sendPasswordResetEmail",a:[V("email"),X(W("opt_actionCodeSettings",!0),Mk(null,!0),"opt_actionCodeSettings",!0)]},Sd:{name:"setPersistence",a:[V("persistence")]},signInAndRetrieveDataWithCredential:{name:"signInAndRetrieveDataWithCredential",a:[Qk()]},signInAnonymously:{name:"signInAnonymously",a:[]},signInWithCredential:{name:"signInWithCredential", a:[Qk()]},signInWithCustomToken:{name:"signInWithCustomToken",a:[V("token")]},signInWithEmailAndPassword:{name:"signInWithEmailAndPassword",a:[V("email"),V("password")]},signInWithPhoneNumber:{name:"signInWithPhoneNumber",a:[V("phoneNumber"),Sk()]},signInWithPopup:{name:"signInWithPopup",a:[Rk()]},signInWithRedirect:{name:"signInWithRedirect",a:[Rk()]},signOut:{name:"signOut",a:[]},toJSON:{name:"toJSON",a:[V(null,!0)]},verifyPasswordResetCode:{name:"verifyPasswordResetCode",a:[V("code")]}}); T.Persistence=Ni;T.Persistence.LOCAL="local";T.Persistence.SESSION="session";T.Persistence.NONE="none"; Y(S.prototype,{"delete":{name:"delete",a:[]},getIdToken:{name:"getIdToken",a:[Kk()]},getToken:{name:"getToken",a:[Kk()]},linkAndRetrieveDataWithCredential:{name:"linkAndRetrieveDataWithCredential",a:[Qk()]},linkWithCredential:{name:"linkWithCredential",a:[Qk()]},linkWithPhoneNumber:{name:"linkWithPhoneNumber",a:[V("phoneNumber"),Sk()]},linkWithPopup:{name:"linkWithPopup",a:[Rk()]},linkWithRedirect:{name:"linkWithRedirect",a:[Rk()]},reauthenticateAndRetrieveDataWithCredential:{name:"reauthenticateAndRetrieveDataWithCredential", a:[Qk()]},reauthenticateWithCredential:{name:"reauthenticateWithCredential",a:[Qk()]},reauthenticateWithPhoneNumber:{name:"reauthenticateWithPhoneNumber",a:[V("phoneNumber"),Sk()]},reauthenticateWithPopup:{name:"reauthenticateWithPopup",a:[Rk()]},reauthenticateWithRedirect:{name:"reauthenticateWithRedirect",a:[Rk()]},reload:{name:"reload",a:[]},sendEmailVerification:{name:"sendEmailVerification",a:[X(W("opt_actionCodeSettings",!0),Mk(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",a:[V(null, !0)]},unlink:{name:"unlink",a:[V("provider")]},updateEmail:{name:"updateEmail",a:[V("email")]},updatePassword:{name:"updatePassword",a:[V("password")]},updatePhoneNumber:{name:"updatePhoneNumber",a:[Qk("phone")]},updateProfile:{name:"updateProfile",a:[W("profile")]}});Y(D.prototype,{f:{name:"catch"},then:{name:"then"}});Y(Bi.prototype,{confirm:{name:"confirm",a:[V("verificationCode")]}});Z(Dg,"credential",function(a,b){return new Ag(a,b)},[V("email"),V("password")]); Y(sg.prototype,{addScope:{name:"addScope",a:[V("scope")]},setCustomParameters:{name:"setCustomParameters",a:[W("customOAuthParameters")]}});Z(sg,"credential",tg,[X(V(),W(),"token")]);Y(ug.prototype,{addScope:{name:"addScope",a:[V("scope")]},setCustomParameters:{name:"setCustomParameters",a:[W("customOAuthParameters")]}});Z(ug,"credential",vg,[X(V(),W(),"token")]);Y(wg.prototype,{addScope:{name:"addScope",a:[V("scope")]},setCustomParameters:{name:"setCustomParameters",a:[W("customOAuthParameters")]}}); Z(wg,"credential",xg,[X(V(),X(W(),Mk()),"idToken"),X(V(),Mk(),"accessToken",!0)]);Y(yg.prototype,{setCustomParameters:{name:"setCustomParameters",a:[W("customOAuthParameters")]}});Z(yg,"credential",zg,[X(V(),W(),"token"),V("secret",!0)]);Y(P.prototype,{addScope:{name:"addScope",a:[V("scope")]},credential:{name:"credential",a:[X(V(),Mk(),"idToken",!0),X(V(),Mk(),"accessToken",!0)]},setCustomParameters:{name:"setCustomParameters",a:[W("customOAuthParameters")]}}); Z(Ig,"credential",Kg,[V("verificationId"),V("verificationCode")]);Y(Ig.prototype,{verifyPhoneNumber:{name:"verifyPhoneNumber",a:[V("phoneNumber"),Sk()]}});Y(O.prototype,{toJSON:{name:"toJSON",a:[V(null,!0)]}});Y(Ng.prototype,{toJSON:{name:"toJSON",a:[V(null,!0)]}});Y(jg.prototype,{toJSON:{name:"toJSON",a:[V(null,!0)]}});Y(Yh.prototype,{clear:{name:"clear",a:[]},render:{name:"render",a:[]},verify:{name:"verify",a:[]}}); (function(){if("undefined"!==typeof firebase&&firebase.INTERNAL&&firebase.INTERNAL.registerService){var a={Auth:T,Error:O};Z(a,"EmailAuthProvider",Dg,[]);Z(a,"FacebookAuthProvider",sg,[]);Z(a,"GithubAuthProvider",ug,[]);Z(a,"GoogleAuthProvider",wg,[]);Z(a,"TwitterAuthProvider",yg,[]);Z(a,"OAuthProvider",P,[V("providerId")]);Z(a,"PhoneAuthProvider",Ig,[Ok()]);Z(a,"RecaptchaVerifier",Yh,[X(V(),Nk(),"recaptchaContainer"),W("recaptchaParameters",!0),Pk()]);firebase.INTERNAL.registerService("auth",function(a, c){a=new T(a);c({INTERNAL:{getUid:r(a.getUid,a),getToken:r(a.xf,a),addAuthTokenListener:r(a.df,a),removeAuthTokenListener:r(a.ag,a)}});return a},a,function(a,c){if("create"===a)try{c.auth()}catch(d){}});firebase.INTERNAL.extendNamespace({User:S})}else throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");})();}).call(this); try{webpackJsonpFirebase([0],[function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"b",function(){return o});var r=n(7),i=function(t,e){if(!t)throw o(e)},o=function(t){return Error("Firebase Database ("+r.a.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(14),i=function(t){for(var e=[],n=0,r=0;r255;)e[n++]=255&i,i>>=8;e[n++]=i}return e},o=function(t){if(t.length<8192)return String.fromCharCode.apply(null,t);for(var e="",n=0;n>2,l=(3&o)<<4|a>>4,p=(15&a)<<2|c>>6,d=63&c;u||(d=64,s||(p=64)),r.push(n[h],n[l],n[p],n[d])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(i(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):o(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.N();for(var n=e?this.T:this.O,r=[],i=0;i>4;if(r.push(p),64!=c){var d=a<<4&240|c>>2;if(r.push(d),64!=l){var f=c<<6&192|l;r.push(f)}}}return r},N:function(){if(!this._){this._={},this.O={},this.S={},this.T={};for(var t=0;t=this.ENCODED_VALS_BASE.length&&(this.O[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.T[this.ENCODED_VALS.charAt(t)]=t)}}},a=function(){function t(){this.blockSize=-1}return t}(),u=this&&this.I||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),c=function(t){function e(){var e=t.call(this)||this;e.P=[],e.R=[],e.D=[],e.F=[],e.L=0,e.M=0,e.blockSize=64,e.F[0]=128;for(var n=1;n>>31)}for(var o,s,a=this.P[0],u=this.P[1],c=this.P[2],h=this.P[3],l=this.P[4],r=0;r<80;r++){r<40?r<20?(o=h^u&(c^h),s=1518500249):(o=u^c^h,s=1859775393):r<60?(o=u&c|h&(u|c),s=2400959708):(o=u^c^h,s=3395469782);var i=(a<<5|a>>>27)+o+l+s+n[r]&4294967295;l=h,h=c,c=4294967295&(u<<30|u>>>2),u=a,a=i}this.P[0]=this.P[0]+a&4294967295,this.P[1]=this.P[1]+u&4294967295,this.P[2]=this.P[2]+c&4294967295,this.P[3]=this.P[3]+h&4294967295,this.P[4]=this.P[4]+l&4294967295},e.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.R,o=this.L;r=56;n--)this.R[n]=255&e,e/=256;this.W(this.R);for(var r=0,n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.P[n]>>i&255,++r;return t},e}(a);n.d(e,"a",function(){return g}),n.d(e,"f",function(){return m}),n.d(e,"e",function(){return b}),n.d(e,"y",function(){return C}),n.d(e,"u",function(){return w}),n.d(e,"j",function(){return S}),n.d(e,"s",function(){return T}),n.d(e,"t",function(){return N}),n.d(e,"k",function(){return I}),n.d(e,"o",function(){return P}),n.d(e,"B",function(){return R}),n.d(e,"C",function(){return D}),n.d(e,"q",function(){return j}),n.d(e,"n",function(){return x}),n.d(e,"c",function(){return k}),n.d(e,"b",function(){return F}),n.d(e,"v",function(){return A}),n.d(e,"A",function(){return L}),n.d(e,"w",function(){return M}),n.d(e,"d",function(){return W}),n.d(e,"z",function(){return q}),n.d(e,"i",function(){return Q}),n.d(e,"h",function(){return U}),n.d(e,"p",function(){return V}),n.d(e,"r",function(){return B}),n.d(e,"l",function(){return H}),n.d(e,"m",function(){return z}),n.d(e,"g",function(){return G}),n.d(e,"x",function(){return X});var h,l=n(0),p=n(2),d=n(11),f=n(3),_=n(8),y=n(6),v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g=function(){var t=1;return function(){return t++}}(),m=function(t){var e=Object(d.b)(t);return s.encodeByteArray(e,!0)},b=function(t){try{return h?new h(t,"base64").toString("utf8"):s.decodeString(t,!0)}catch(t){T("base64Decode failed: ",t)}return null},C=function(t){var e=Object(d.b)(t),n=new c;n.update(e);var r=n.digest();return s.encodeByteArray(r)},E=function t(){for(var e=[],n=0;nn?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r},Q=function(t,e){if(Array.isArray(t))for(var n=0;n=Math.pow(2,-1022)?(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023),n=i+1023,r=Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,r=Math.round(t/Math.pow(2,-1074)))),s=[],o=52;o;o-=1)s.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse(),a=s.join("");var u="";for(o=0;o<64;o+=8){var c=parseInt(a.substr(o,8),2).toString(16);1===c.length&&(c="0"+c),u+=c}return u.toLowerCase()},V=function(){return!("object"!==("undefined"==typeof window?"undefined":v(window))||!window.chrome||!window.chrome.extension||/^chrome/.test(window.location.href))},B=function(){return"object"===("undefined"==typeof Windows?"undefined":v(Windows))&&"object"===v(Windows.UI)},H=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==t?n="Client doesn't have permission to access the desired data.":"unavailable"==t&&(n="The service is unavailable");var r=Error(t+" at "+e.path+": "+n);return r.code=t.toUpperCase(),r},K=RegExp("^-?\\d{1,10}$"),Y=function(t){if(K.test(t)){var e=+t;if(e>=-2147483648&&e<=2147483647)return e}return null},z=function(t){try{t()}catch(t){setTimeout(function(){var e=t.stack||"";throw R("Exception was thrown by user callback.",e),t},Math.floor(0))}},G=function(){return("object"===("undefined"==typeof window?"undefined":v(window))&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},X=function(t,e){var n=setTimeout(t,e);return"object"===(void 0===n?"undefined":v(n))&&n.unref&&n.unref(),n}},function(t,e,n){"use strict";n.d(e,"b",function(){return r}),n.d(e,"l",function(){return i}),n.d(e,"f",function(){return o}),n.d(e,"a",function(){return a}),n.d(e,"j",function(){return u}),n.d(e,"h",function(){return c}),n.d(e,"k",function(){return h}),n.d(e,"d",function(){return l}),n.d(e,"e",function(){return p}),n.d(e,"g",function(){return d}),n.d(e,"i",function(){return f}),n.d(e,"c",function(){return _});var r=("function"==typeof Symbol&&Symbol.iterator,function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}),i=function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]},o=function(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])},s=function(t,e){return o(e,function(e,n){t[e]=n}),t},a=function(t){return s({},t)},u=function(t){for(var e in t)return!1;return!0},c=function(t){var e=0;for(var n in t)e++;return e},h=function(t,e,n){var r={};for(var i in t)r[i]=e.call(n,t[i],i,t);return r},l=function(t,e,n){for(var r in t)if(e.call(n,t[r],r,t))return r},p=function(t,e,n){var r=l(t,e,n);return r&&t[r]},d=function(t){for(var e in t)return e},f=function(t){var e=[],n=0;for(var r in t)e[n++]=t[r];return e},_=function(t,e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&!e(n,t[n]))return!1;return!0}},function(t,e,n){"use strict";n.d(e,"a",function(){return r}),n.d(e,"b",function(){return i});var r=function(t){return JSON.parse(t)},i=function(t){return JSON.stringify(t)}},,,function(t,e,n){"use strict";n.d(e,"a",function(){return s}),n.d(e,"c",function(){return a}),n.d(e,"b",function(){return u});var r=n(7),i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""},s=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(o())},a=function(){return"object"===("undefined"==typeof navigator?"undefined":i(navigator))&&"ReactNative"===navigator.product},u=function(){return!0===r.a.NODE_CLIENT||!0===r.a.NODE_ADMIN}},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var r={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"4.2.0"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),i=function(){function t(t){this.Q=t,this.U="firebase:"}return t.prototype.set=function(t,e){null==e?this.Q.removeItem(this.V(t)):this.Q.setItem(this.V(t),Object(r.b)(e))},t.prototype.get=function(t){var e=this.Q.getItem(this.V(t));return null==e?null:Object(r.a)(e)},t.prototype.remove=function(t){this.Q.removeItem(this.V(t))},t.prototype.V=function(t){return this.U+t},t.prototype.toString=function(){return""+this.Q},t}(),o=n(2),s=function(){function t(){this.H={},this.isInMemoryStorage=!0}return t.prototype.set=function(t,e){null==e?delete this.H[t]:this.H[t]=e},t.prototype.get=function(t){return Object(o.b)(this.H,t)?this.H[t]:null},t.prototype.remove=function(t){delete this.H[t]},t}();n.d(e,"a",function(){return u}),n.d(e,"b",function(){return c});var a=function(t){try{if("undefined"!=typeof window&&void 0!==window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new i(e)}}catch(t){}return new s},u=a("localStorage"),c=a("sessionStorage")},function(t,e,n){"use strict";n.d(e,"e",function(){return r}),n.d(e,"h",function(){return i}),n.d(e,"g",function(){return o}),n.d(e,"f",function(){return s}),n.d(e,"b",function(){return a}),n.d(e,"a",function(){return u}),n.d(e,"c",function(){return c}),n.d(e,"i",function(){return h}),n.d(e,"d",function(){return l});var r="5",i="v",o="s",s="r",a="f",u="firebaseio.com",c="ls",h="websocket",l="long_polling"},,function(t,e,n){"use strict";n.d(e,"b",function(){return i}),n.d(e,"a",function(){return o});var r=n(0),i=function(t){for(var e=[],n=0,i=0;i=55296&&o<=56319){var s=o-55296;i++,Object(r.a)(i>6|192,e[n++]=63&o|128):o<65536?(e[n++]=o>>12|224,e[n++]=o>>6&63|128,e[n++]=63&o|128):(e[n++]=o>>18|240,e[n++]=o>>12&63|128,e[n++]=o>>6&63|128,e[n++]=63&o|128)}return e},o=function(t){for(var e=0,n=0;n=55296&&r<=56319?(e+=4,n++):e+=3}return e}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(17),i=n(2),o=function(){function t(){this.K={}}return t.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),Object(i.b)(this.K,t)||(this.K[t]=0),this.K[t]+=e},t.prototype.get=function(){return Object(r.a)(this.K)},t}();n.d(e,"a",function(){return s});var s=function(){function t(){}return t.getCollection=function(t){var e=""+t;return this.Y[e]||(this.Y[e]=new o),this.Y[e]},t.getOrCreateReporter=function(t,e){var n=""+t;return this.G[n]||(this.G[n]=e()),this.G[n]},t.Y={},t.G={},t}()},,,,,,function(t,e,n){"use strict";(function(t){n.d(e,"a",function(){return d});var r=n(5),i=n(0),o=n(1),s=n(12),a=n(9),u=n(7),c=n(8),h=n(3),l=n(6),p=null;"undefined"!=typeof MozWebSocket?p=MozWebSocket:"undefined"!=typeof WebSocket&&(p=WebSocket);var d=function(){function e(t,n,r,i){this.connId=t,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.X=Object(o.t)(this.connId),this.$=s.a.getCollection(n),this.connURL=e.J(n,r,i)}return e.J=function(t,e,n){var r={};return r[a.h]=a.e,!Object(l.b)()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(a.a)&&(r[a.f]=a.b),e&&(r[a.g]=e),n&&(r[a.c]=n),t.connectionURL(a.i,r)},e.prototype.open=function(e,n){var i=this;this.onDisconnect=n,this.onMessage=e,this.X("Websocket connecting to "+this.connURL),this.Z=!1,c.a.set("previous_websocket_failure",!0);try{if(Object(l.b)()){var o=u.a.NODE_ADMIN?"AdminNode":"Node",s={headers:{"User-Agent":"Firebase/"+a.e+"/"+r.default.SDK_VERSION+"/"+t.platform+"/"+o}},h=t.env,d=0==this.connURL.indexOf("wss://")?h.HTTPS_PROXY||h.https_proxy:h.HTTP_PROXY||h.http_proxy;d&&(s.proxy={origin:d}),this.mySock=new p(this.connURL,[],s)}else this.mySock=new p(this.connURL)}catch(t){this.X("Error instantiating WebSocket.");var f=t.message||t.data;return f&&this.X(f),void this.tt()}this.mySock.onopen=function(){i.X("Websocket connected."),i.Z=!0},this.mySock.onclose=function(){i.X("Websocket connection was disconnected."),i.mySock=null,i.tt()},this.mySock.onmessage=function(t){i.handleIncomingFrame(t)},this.mySock.onerror=function(t){i.X("WebSocket error. Closing connection.");var e=t.message||t.data;e&&i.X(e),i.tt()}},e.prototype.start=function(){},e.forceDisallow=function(){e.et=!0},e.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var n=/Android ([0-9]{0,}\.[0-9]{0,})/,r=navigator.userAgent.match(n);r&&r.length>1&&parseFloat(r[1])<4.4&&(t=!0)}return!t&&null!==p&&!e.et},e.previouslyFailed=function(){return c.a.isInMemoryStorage||!0===c.a.get("previous_websocket_failure")},e.prototype.markConnectionHealthy=function(){c.a.remove("previous_websocket_failure")},e.prototype.nt=function(t){if(this.frames.push(t),this.frames.length==this.totalFrames){var e=this.frames.join("");this.frames=null;var n=Object(h.a)(e);this.onMessage(n)}},e.prototype.rt=function(t){this.totalFrames=t,this.frames=[]},e.prototype.it=function(t){if(Object(i.a)(null===this.frames,"We already have a frame buffer"),t.length<=6){var e=+t;if(!isNaN(e))return this.rt(e),null}return this.rt(1),t},e.prototype.handleIncomingFrame=function(t){if(null!==this.mySock){var e=t.data;if(this.bytesReceived+=e.length,this.$.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.nt(e);else{var n=this.it(e);null!==n&&this.nt(n)}}},e.prototype.send=function(t){this.resetKeepAlive();var e=Object(h.b)(t);this.bytesSent+=e.length,this.$.incrementCounter("bytes_sent",e.length);var n=Object(o.z)(e,16384);n.length>1&&this.ot(n.length+"");for(var r=0;r0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}function i(t,e,n){var r="";switch(e){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw Error("errorPrefix called with argumentNumber > 4. Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}function o(t,e){return Object(Wt.v)(t.name,e.name)}function s(t,e){return Object(Wt.v)(t,e)}function a(t,e){if(void 0===e&&(e=null),null===t)return Vt.EMPTY_NODE;if("object"===(void 0===t?"undefined":zt(t))&&".priority"in t&&(e=t[".priority"]),Object(Yt.a)(null===e||"string"==typeof e||"number"==typeof e||"object"===(void 0===e?"undefined":zt(e))&&".sv"in e,"Invalid priority type found: "+(void 0===e?"undefined":zt(e))),"object"===(void 0===t?"undefined":zt(t))&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!==(void 0===t?"undefined":zt(t))||".sv"in t)return new wt(t,a(e));if(t instanceof Array||!Gt){var n=Vt.EMPTY_NODE,r=t;return Object(Kt.f)(r,function(t,e){if(Object(Kt.b)(r,t)&&"."!==t.substring(0,1)){var i=a(e);!i.isLeafNode()&&i.isEmpty()||(n=n.updateImmediateChild(t,i))}}),n.updatePriority(a(e))}var i=[],u=!1,c=t;if(Object(Kt.f)(c,function(t,e){if("string"!=typeof t||"."!==t.substring(0,1)){var n=a(c[t]);n.isEmpty()||(u=u||!n.getPriority().isEmpty(),i.push(new st(t,n)))}}),0==i.length)return Vt.EMPTY_NODE;var h=kt(i,o,function(t){return t.name},s);if(u){var l=kt(i,Nt.getCompare());return new Vt(h,a(e),new Mt({".priority":l},{".priority":Nt}))}return new Vt(h,a(e),Mt.Default)}Object.defineProperty(e,"__esModule",{value:!0});var u,c,h,l,p,d,f,_=n(1),y=n(11),v=function(){function t(t,e){if(void 0===e){this.ct=t.split("/");for(var n=0,r=0;r0&&(this.ct[n]=this.ct[r],n++);this.ct.length=n,this.ht=0}else this.ct=t,this.ht=e}return Object.defineProperty(t,"Empty",{get:function(){return new t("")},enumerable:!0,configurable:!0}),t.prototype.getFront=function(){return this.ht>=this.ct.length?null:this.ct[this.ht]},t.prototype.getLength=function(){return this.ct.length-this.ht},t.prototype.popFront=function(){var e=this.ht;return e=this.ct.length)return null;for(var e=[],n=this.ht;n0&&n.push(i[r]);return new t(n,0)},t.prototype.isEmpty=function(){return this.ht>=this.ct.length},t.relativePath=function(e,n){var r=e.getFront(),i=n.getFront();if(null===r)return n;if(r===i)return t.relativePath(e.popFront(),n.popFront());throw Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+e+")")},t.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;it.getLength())return!1;for(;e0&&(this.dt+=1),this.pt.push(t),this.dt+=Object(y.a)(t),this.ft()},t.prototype.pop=function(){var t=this.pt.pop();this.dt-=Object(y.a)(t),this.pt.length>0&&(this.dt-=1)},t.prototype.ft=function(){if(this.dt>t.MAX_PATH_LENGTH_BYTES)throw Error(this.lt+"has a key path longer than "+t.MAX_PATH_LENGTH_BYTES+" bytes ("+this.dt+").");if(this.pt.length>t.MAX_PATH_DEPTH)throw Error(this.lt+"path specified exceeds the maximum depth that can be written ("+t.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},t.prototype.toErrorString=function(){return 0==this.pt.length?"":"in property '"+this.pt.join(".")+"'"},t}(),m=n(0),b=n(2),C=n(8),E=n(9),w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O=function(){function t(t,e,n,r,i){void 0===i&&(i=""),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=C.a.get("host:"+t)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost},t.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},t.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},t.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},t.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&C.a.set("host:"+this.host,this.internalHost))},t.prototype.connectionURL=function(t,e){Object(m.a)("string"==typeof t,"typeof type must == string"),Object(m.a)("object"===(void 0===e?"undefined":w(e)),"typeof params must == object");var n;if(t===E.i)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==E.d)throw Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return Object(b.f)(e,function(t,e){r.push(t+"="+e)}),n+r.join("&")},t.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},t.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},t}(),S=n(1),T=function(t){var e=N(t),n=e.subdomain;"firebase"===e.domain&&Object(S.o)(e.host+" is no longer supported. Please use .firebaseio.com instead"),n&&"undefined"!=n||Object(S.o)("Cannot parse Firebase url. Please use https://.firebaseio.com"),e.secure||Object(S.C)();var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new O(e.host,e.secure,n,r),path:new v(e.pathString)}},N=function(t){var e="",n="",i="",o="",s=!0,a="https",u=443;if("string"==typeof t){var c=t.indexOf("//");c>=0&&(a=t.substring(0,c-1),t=t.substring(c+2));var h=t.indexOf("/");-1===h&&(h=t.length),e=t.substring(0,h),o=r(t.substring(h));var l=e.split(".");3===l.length?(n=l[1],i=l[0].toLowerCase()):2===l.length&&(n=l[0]),(c=e.indexOf(":"))>=0&&(s="https"===a||"wss"===a,u=parseInt(e.substring(c+1),10))}return{host:e,port:u,domain:n,subdomain:i,secure:s,scheme:a,pathString:o}},I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},P=function(t,e,n,r){var i;if(rn&&(i=0===n?"none":"no more than "+n),i){var o=t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".";throw Error(o)}},R=function(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw Error(i(t,e,r)+"must be a valid function.")},D=function(t,e,n,r){if((!r||n)&&("object"!==(void 0===n?"undefined":I(n))||null===n))throw Error(i(t,e,r)+"must be a valid context object.")},j=n(2),x=n(1),k=n(11),F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A=/[\[\].#$\/\u0000-\u001F\u007F]/,L=/[\[\].#$\u0000-\u001F\u007F]/,M=function(t){return"string"==typeof t&&0!==t.length&&!A.test(t)},W=function(t){return"string"==typeof t&&0!==t.length&&!L.test(t)},q=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),W(t)},Q=function(t){return null===t||"string"==typeof t||"number"==typeof t&&!Object(x.q)(t)||t&&"object"===(void 0===t?"undefined":F(t))&&Object(j.b)(t,".sv")},U=function(t,e,n,r,o){o&&void 0===n||V(i(t,e,o),n,r)},V=function t(e,n,r){var i=r instanceof v?new g(r,e):r;if(void 0===n)throw Error(e+"contains undefined "+i.toErrorString());if("function"==typeof n)throw Error(e+"contains a function "+i.toErrorString()+" with contents = "+n);if(Object(x.q)(n))throw Error(e+"contains "+n+" "+i.toErrorString());if("string"==typeof n&&n.length>10485760/3&&Object(k.a)(n)>10485760)throw Error(e+"contains a string greater than 10485760 utf8 bytes "+i.toErrorString()+" ('"+n.substring(0,50)+"...')");if(n&&"object"===(void 0===n?"undefined":F(n))){var o=!1,s=!1;if(Object(j.f)(n,function(n,r){if(".value"===n)o=!0;else if(".priority"!==n&&".sv"!==n&&(s=!0,!M(n)))throw Error(e+" contains an invalid key ("+n+") "+i.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');i.push(n),t(e,r,i),i.pop()}),o&&s)throw Error(e+' contains ".value" child '+i.toErrorString()+" in addition to actual children.")}},B=function(t,e){var n,r;for(n=0;n=0;o--)s[o]=t.charAt(r%64),r=Math.floor(r/64);Object(it.a)(0===r,"Cannot push at time == 0");var a=s.join("");if(i){for(o=11;o>=0&&63===n[o];o--)n[o]=0;n[o]++}else for(o=0;o<12;o++)n[o]=Math.floor(64*Math.random());for(o=0;o<12;o++)a+=t.charAt(n[o]);return Object(it.a)(20===a.length,"nextPushId: Length should be 20."),a}}(),st=function(){function t(t,e){this.name=t,this.node=e}return t.Wrap=function(e,n){return new t(e,n)},t}(),at=n(1),ut=function(){function t(){}return t.prototype.getCompare=function(){return this.compare.bind(this)},t.prototype.indexedValueChanged=function(t,e){var n=new st(at.c,t),r=new st(at.c,e);return 0!==this.compare(n,r)},t.prototype.minPost=function(){return st.MIN},t}(),ct=n(1),ht=n(0),lt=this&&this.I||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return lt(e,t),Object.defineProperty(e,"__EMPTY_NODE",{get:function(){return u},set:function(t){u=t},enumerable:!0,configurable:!0}),e.prototype.compare=function(t,e){return Object(ct.v)(t.name,e.name)},e.prototype.isDefinedOn=function(t){throw Object(ht.b)("KeyIndex.isDefinedOn not expected to be called.")},e.prototype.indexedValueChanged=function(t,e){return!1},e.prototype.minPost=function(){return st.MIN},e.prototype.maxPost=function(){return new st(ct.b,u)},e.prototype.makePost=function(t,e){return Object(ht.a)("string"==typeof t,"KeyIndex indexValue must always be a string."),new st(t,u)},e.prototype.toString=function(){return".key"},e}(ut),dt=new pt,ft=n(0),_t=n(1),yt=n(2),vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt=function(t){return"number"==typeof t?"number:"+Object(_t.h)(t):"string:"+t},mt=function(t){if(t.isLeafNode()){var e=t.val();Object(ft.a)("string"==typeof e||"number"==typeof e||"object"===(void 0===e?"undefined":vt(e))&&Object(yt.b)(e,".sv"),"Priority must be a string or number.")}else Object(ft.a)(t===c||t.isEmpty(),"priority of unexpected type.");Object(ft.a)(t===c||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},bt=n(0),Ct=n(1),Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wt=function(){function t(e,n){void 0===n&&(n=t.vt.EMPTY_NODE),this.gt=e,this.mt=n,this.bt=null,Object(bt.a)(void 0!==this.gt&&null!==this.gt,"LeafNode shouldn't be created with null/undefined value."),mt(this.mt)}return Object.defineProperty(t,"__childrenNodeConstructor",{get:function(){return h},set:function(t){h=t},enumerable:!0,configurable:!0}),t.prototype.isLeafNode=function(){return!0},t.prototype.getPriority=function(){return this.mt},t.prototype.updatePriority=function(e){return new t(this.gt,e)},t.prototype.getImmediateChild=function(e){return".priority"===e?this.mt:t.vt.EMPTY_NODE},t.prototype.getChild=function(e){return e.isEmpty()?this:".priority"===e.getFront()?this.mt:t.vt.EMPTY_NODE},t.prototype.hasChild=function(){return!1},t.prototype.getPredecessorChildName=function(t,e){return null},t.prototype.updateImmediateChild=function(e,n){return".priority"===e?this.updatePriority(n):n.isEmpty()&&".priority"!==e?this:t.vt.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.mt)},t.prototype.updateChild=function(e,n){var r=e.getFront();return null===r?n:n.isEmpty()&&".priority"!==r?this:(Object(bt.a)(".priority"!==r||1===e.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(r,t.vt.EMPTY_NODE.updateChild(e.popFront(),n)))},t.prototype.isEmpty=function(){return!1},t.prototype.numChildren=function(){return 0},t.prototype.forEachChild=function(t,e){return!1},t.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},t.prototype.hash=function(){if(null===this.bt){var t="";this.mt.isEmpty()||(t+="priority:"+gt(this.mt.val())+":");var e=Et(this.gt);t+=e+":",t+="number"===e?Object(Ct.h)(this.gt):this.gt,this.bt=Object(Ct.y)(t)}return this.bt},t.prototype.getValue=function(){return this.gt},t.prototype.compareTo=function(e){return e===t.vt.EMPTY_NODE?1:e instanceof t.vt?-1:(Object(bt.a)(e.isLeafNode(),"Unknown node type"),this.Ct(e))},t.prototype.Ct=function(e){var n=Et(e.gt),r=Et(this.gt),i=t.VALUE_TYPE_ORDER.indexOf(n),o=t.VALUE_TYPE_ORDER.indexOf(r);return Object(bt.a)(i>=0,"Unknown leaf type: "+n),Object(bt.a)(o>=0,"Unknown leaf type: "+r),i===o?"object"===r?0:this.gt0},t.prototype.peek=function(){if(0===this.Ot.length)return null;var t=this.Ot[this.Ot.length-1];return this.wt?this.wt(t.key,t.value):{key:t.key,value:t.value}},t}(),Pt=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:Dt.EMPTY_NODE,this.right=null!=o?o:Dt.EMPTY_NODE}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.count=function(){return this.left.count()+1+this.right.count()},t.prototype.isEmpty=function(){return!1},t.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},t.prototype.St=function(){return this.left.isEmpty()?this:this.left.St()},t.prototype.minKey=function(){return this.St().key},t.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},t.prototype.insert=function(t,e,n){var r,i;return i=this,r=n(t,i.key),i=r<0?i.copy(null,null,null,i.left.insert(t,e,n),null):0===r?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n)),i.Tt()},t.prototype.Nt=function(){if(this.left.isEmpty())return Dt.EMPTY_NODE;var t=this;return t.left.It()||t.left.left.It()||(t=t.Pt()),t=t.copy(null,null,null,t.left.Nt(),null),t.Tt()},t.prototype.remove=function(t,e){var n,r;if(n=this,e(t,n.key)<0)n.left.isEmpty()||n.left.It()||n.left.left.It()||(n=n.Pt()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.It()&&(n=n.Rt()),n.right.isEmpty()||n.right.It()||n.right.left.It()||(n=n.Dt()),0===e(t,n.key)){if(n.right.isEmpty())return Dt.EMPTY_NODE;r=n.right.St(),n=n.copy(r.key,r.value,null,null,n.right.Nt())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.Tt()},t.prototype.It=function(){return this.color},t.prototype.Tt=function(){var t=this;return t.right.It()&&!t.left.It()&&(t=t.jt()),t.left.It()&&t.left.left.It()&&(t=t.Rt()),t.left.It()&&t.right.It()&&(t=t.xt()),t},t.prototype.Pt=function(){var t=this.xt();return t.right.left.It()&&(t=t.copy(null,null,null,null,t.right.Rt()),t=t.jt(),t=t.xt()),t},t.prototype.Dt=function(){var t=this.xt();return t.left.left.It()&&(t=t.Rt(),t=t.xt()),t},t.prototype.jt=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.Rt=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.xt=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.kt=function(){var t=this.Ft();return Math.pow(2,t)<=this.count()+1},t.prototype.Ft=function(){var t;if(this.It()&&this.left.It())throw Error("Red node has red child("+this.key+","+this.value+")");if(this.right.It())throw Error("Right child of ("+this.key+","+this.value+") is red");if((t=this.left.Ft())!==this.right.Ft())throw Error("Black depths differ");return t+(this.It()?0:1)},t.RED=!0,t.BLACK=!1,t}(),Rt=function(){function t(){}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new Pt(t,e,null)},t.prototype.remove=function(t,e){return this},t.prototype.count=function(){return 0},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(t){return!1},t.prototype.reverseTraversal=function(t){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.Ft=function(){return 0},t.prototype.It=function(){return!1},t}(),Dt=function(){function t(e,n){void 0===n&&(n=t.EMPTY_NODE),this.At=e,this.Lt=n}return t.prototype.insert=function(e,n){return new t(this.At,this.Lt.insert(e,n,this.At).copy(null,null,Pt.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.At,this.Lt.remove(e,this.At).copy(null,null,Pt.BLACK,null,null))},t.prototype.get=function(t){for(var e,n=this.Lt;!n.isEmpty();){if(0===(e=this.At(t,n.key)))return n.value;e<0?n=n.left:e>0&&(n=n.right)}return null},t.prototype.getPredecessorKey=function(t){for(var e,n=this.Lt,r=null;!n.isEmpty();){if(0===(e=this.At(t,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:e>0&&(r=n,n=n.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?")},t.prototype.isEmpty=function(){return this.Lt.isEmpty()},t.prototype.count=function(){return this.Lt.count()},t.prototype.minKey=function(){return this.Lt.minKey()},t.prototype.maxKey=function(){return this.Lt.maxKey()},t.prototype.inorderTraversal=function(t){return this.Lt.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.Lt.reverseTraversal(t)},t.prototype.getIterator=function(t){return new It(this.Lt,null,this.At,!1,t)},t.prototype.getIteratorFrom=function(t,e){return new It(this.Lt,t,this.At,!1,e)},t.prototype.getReverseIteratorFrom=function(t,e){return new It(this.Lt,t,this.At,!0,e)},t.prototype.getReverseIterator=function(t){return new It(this.Lt,null,this.At,!0,t)},t.EMPTY_NODE=new Rt,t}(),jt=Math.log(2),xt=function(){function t(t){this.count=function(t){return parseInt(Math.log(t)/jt,10)}(t+1),this.Mt=this.count-1;var e=function(t){return parseInt(Array(t+1).join("1"),2)}(this.count);this.Wt=t+1&e}return t.prototype.nextBitIsOne=function(){var t=!(this.Wt&1<0;)r.getNext(),i=r.peek();return r},t.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Ht?-1:0},t.prototype.withIndex=function(e){if(e===dt||this.Vt.hasIndex(e))return this;var n=this.Vt.addIndex(e,this.Ut);return new t(this.Ut,this.mt,n)},t.prototype.isIndexed=function(t){return t===dt||this.Vt.hasIndex(t)},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;var e=t;if(this.getPriority().equals(e.getPriority())){if(this.Ut.count()===e.Ut.count()){for(var n=this.getIterator(Nt),r=e.getIterator(Nt),i=n.getNext(),o=r.getNext();i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1}return!1},t.prototype.Ht=function(t){return t===dt?null:this.Vt.get(""+t)},t.Bt=/^(0|[1-9]\d*)$/,t}(),Bt=function(t){function e(){return t.call(this,new Dt(s),Vt.EMPTY_NODE,Mt.Default)||this}return Ut(e,t),e.prototype.compareTo=function(t){return t===this?0:1},e.prototype.equals=function(t){return t===this},e.prototype.getPriority=function(){return this},e.prototype.getImmediateChild=function(t){return Vt.EMPTY_NODE},e.prototype.isEmpty=function(){return!1},e}(Vt),Ht=new Bt;Object.defineProperties(st,{MIN:{value:new st(Qt.c,Vt.EMPTY_NODE)},MAX:{value:new st(Qt.b,Ht)}}),pt.Kt=Vt.EMPTY_NODE,wt.vt=Vt,function(t){c=t}(Ht),function(t){p=t}(Ht);var Kt=n(2),Yt=n(0),zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gt=!0;!function(t){l=t}(a);var Xt,$t,Jt=n(1),Zt=this&&this.I||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),te=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Zt(e,t),e.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?Object(Jt.v)(t.name,e.name):n},e.prototype.isDefinedOn=function(t){return!0},e.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},e.prototype.minPost=function(){return st.MIN},e.prototype.maxPost=function(){return st.MAX},e.prototype.makePost=function(t,e){var n=a(t);return new st(e,n)},e.prototype.toString=function(){return".value"},e}(ut),ee=new te,ne=n(0),re=n(1),ie=this&&this.I||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oe=function(t){function e(e){var n=t.call(this)||this;return n.Yt=e,Object(ne.a)(!e.isEmpty()&&".priority"!==e.getFront(),"Can't create PathIndex with empty path or .priority key"),n}return ie(e,t),e.prototype.extractChild=function(t){return t.getChild(this.Yt)},e.prototype.isDefinedOn=function(t){return!t.getChild(this.Yt).isEmpty()},e.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),i=n.compareTo(r);return 0===i?Object(re.v)(t.name,e.name):i},e.prototype.makePost=function(t,e){var n=a(t),r=Vt.EMPTY_NODE.updateChild(this.Yt,n);return new st(e,r)},e.prototype.maxPost=function(){var t=Vt.EMPTY_NODE.updateChild(this.Yt,Ht);return new st(re.b,t)},e.prototype.toString=function(){return this.Yt.slice().join("/")},e}(ut),se=function(){function t(t,e,n){this.zt=t,this.Gt=e,this.Xt=n}return t.prototype.val=function(){return P("DataSnapshot.val",0,0,arguments.length),this.zt.val()},t.prototype.exportVal=function(){return P("DataSnapshot.exportVal",0,0,arguments.length),this.zt.val(!0)},t.prototype.toJSON=function(){return P("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},t.prototype.exists=function(){return P("DataSnapshot.exists",0,0,arguments.length),!this.zt.isEmpty()},t.prototype.child=function(e){P("DataSnapshot.child",0,1,arguments.length),e+="",G("DataSnapshot.child",1,e,!1);var n=new v(e),r=this.Gt.child(n);return new t(this.zt.getChild(n),r,Nt)},t.prototype.hasChild=function(t){P("DataSnapshot.hasChild",1,1,arguments.length),G("DataSnapshot.hasChild",1,t,!1);var e=new v(t);return!this.zt.getChild(e).isEmpty()},t.prototype.getPriority=function(){return P("DataSnapshot.getPriority",0,0,arguments.length),this.zt.getPriority().val()},t.prototype.forEach=function(e){var n=this;return P("DataSnapshot.forEach",1,1,arguments.length),R("DataSnapshot.forEach",1,e,!1),!this.zt.isLeafNode()&&!!this.zt.forEachChild(this.Xt,function(r,i){return e(new t(i,n.Gt.child(r),Nt))})},t.prototype.hasChildren=function(){return P("DataSnapshot.hasChildren",0,0,arguments.length),!this.zt.isLeafNode()&&!this.zt.isEmpty()},Object.defineProperty(t.prototype,"key",{get:function(){return this.Gt.getKey()},enumerable:!0,configurable:!0}),t.prototype.numChildren=function(){return P("DataSnapshot.numChildren",0,0,arguments.length),this.zt.numChildren()},t.prototype.getRef=function(){return P("DataSnapshot.ref",0,0,arguments.length),this.Gt},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),ae=n(3),ue=function(){function t(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}return t.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},t.prototype.getEventType=function(){return this.eventType},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.getPath()+":"+this.eventType+":"+Object(ae.b)(this.snapshot.exportVal())},t}(),ce=function(){function t(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}return t.prototype.getPath=function(){return this.path},t.prototype.getEventType=function(){return"cancel"},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.path+":cancel"},t}(),he=n(2),le=n(0),pe=function(){function t(t,e,n){this.$t=t,this.Jt=e,this.Zt=n}return t.prototype.respondsTo=function(t){return"value"===t},t.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new ue("value",this,new se(t.snapshotNode,e.getRef(),n))},t.prototype.getEventRunner=function(t){var e=this.Zt;if("cancel"===t.getEventType()){Object(le.a)(this.Jt,"Raising a cancel event on a listener with no cancel callback");var n=this.Jt;return function(){n.call(e,t.error)}}var r=this.$t;return function(){r.call(e,t.snapshot)}},t.prototype.createCancelEvent=function(t,e){return this.Jt?new ce(this,t,e):null},t.prototype.matches=function(e){return e instanceof t&&(!e.$t||!this.$t||e.$t===this.$t&&e.Zt===this.Zt)},t.prototype.hasAnyCallback=function(){return null!==this.$t},t}(),de=function(){function t(t,e,n){this.te=t,this.Jt=e,this.Zt=n}return t.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,Object(he.b)(this.te,e)},t.prototype.createCancelEvent=function(t,e){return this.Jt?new ce(this,t,e):null},t.prototype.createEvent=function(t,e){Object(le.a)(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new ue(t.type,this,new se(t.snapshotNode,n,r),t.prevName)},t.prototype.getEventRunner=function(t){var e=this.Zt;if("cancel"===t.getEventType()){Object(le.a)(this.Jt,"Raising a cancel event on a listener with no cancel callback");var n=this.Jt;return function(){n.call(e,t.error)}}var r=this.te[t.eventType];return function(){r.call(e,t.snapshot,t.prevName)}},t.prototype.matches=function(e){if(e instanceof t){if(!this.te||!e.te)return!0;if(this.Zt===e.Zt){var n=Object(he.h)(e.te);if(n===Object(he.h)(this.te)){if(1===n){var r=Object(he.g)(e.te),i=Object(he.g)(this.te);return!(i!==r||e.te[r]&&this.te[i]&&e.te[r]!==this.te[i])}return Object(he.c)(this.te,function(t,n){return e.te[t]===n})}}}return!1},t.prototype.hasAnyCallback=function(){return null!==this.te},t}(),fe=n(0),_e=n(1),ye=n(4),ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge=function(){function t(t,e,n,r){this.repo=t,this.path=e,this.ee=n,this.ne=r}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return Object(fe.a)(Xt,"Reference.ts has not been loaded"),Xt},set:function(t){Xt=t},enumerable:!0,configurable:!0}),t.re=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===dt){var r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!=_e.c)throw Error(r);if("string"!=typeof e)throw Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!=_e.b)throw Error(r);if("string"!=typeof n)throw Error(i)}}else if(t.getIndex()===Nt){if(null!=e&&!Q(e)||null!=n&&!Q(n))throw Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(Object(fe.a)(t.getIndex()instanceof oe||t.getIndex()===ee,"unknown index type."),null!=e&&"object"===(void 0===e?"undefined":ve(e))||null!=n&&"object"===(void 0===n?"undefined":ve(n)))throw Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},t.ie=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},t.prototype.oe=function(t){if(!0===this.ne)throw Error(t+": You can't combine multiple orderBy calls.")},t.prototype.getQueryParams=function(){return this.ee},t.prototype.getRef=function(){return P("Query.ref",0,0,arguments.length),new t.se(this.repo,this.path)},t.prototype.on=function(e,n,r,i){P("Query.on",2,4,arguments.length),Y("Query.on",1,e,!1),R("Query.on",2,n,!1);var o=t.ae("Query.on",r,i);if("value"===e)this.onValueEvent(n,o.cancel,o.context);else{var s={};s[e]=n,this.onChildEvent(s,o.cancel,o.context)}return n},t.prototype.onValueEvent=function(t,e,n){var r=new pe(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},t.prototype.onChildEvent=function(t,e,n){var r=new de(t,e,n);this.repo.addEventCallbackForQuery(this,r)},t.prototype.off=function(t,e,n){P("Query.off",0,3,arguments.length),Y("Query.off",1,t,!0),R("Query.off",2,e,!0),D("Query.off",3,n,!0);var r=null,i=null;"value"===t?r=new pe(e||null,null,n||null):t&&(e&&(i={},i[t]=e),r=new de(i,null,n||null)),this.repo.removeEventCallbackForQuery(this,r)},t.prototype.once=function(e,n,r,i){var o=this;P("Query.once",1,4,arguments.length),Y("Query.once",1,e,!1),R("Query.once",2,n,!0);var s=t.ae("Query.once",r,i),a=!0,u=new ye.a;Object(ye.c)(u.promise);var c=function t(r){a&&(a=!1,o.off(e,t),n&&n.bind(s.context)(r),u.resolve(r))};return this.on(e,c,function(t){o.off(e,c),s.cancel&&s.cancel.bind(s.context)(t),u.reject(t)}),u.promise},t.prototype.limitToFirst=function(e){if(P("Query.limitToFirst",1,1,arguments.length),"number"!=typeof e||Math.floor(e)!==e||e<=0)throw Error("Query.limitToFirst: First argument must be a positive integer.");if(this.ee.hasLimit())throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.ee.limitToFirst(e),this.ne)},t.prototype.limitToLast=function(e){if(P("Query.limitToLast",1,1,arguments.length),"number"!=typeof e||Math.floor(e)!==e||e<=0)throw Error("Query.limitToLast: First argument must be a positive integer.");if(this.ee.hasLimit())throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.ee.limitToLast(e),this.ne)},t.prototype.orderByChild=function(e){if(P("Query.orderByChild",1,1,arguments.length),"$key"===e)throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===e)throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===e)throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');G("Query.orderByChild",1,e,!1),this.oe("Query.orderByChild");var n=new v(e);if(n.isEmpty())throw Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");var r=new oe(n),i=this.ee.orderBy(r);return t.re(i),new t(this.repo,this.path,i,!0)},t.prototype.orderByKey=function(){P("Query.orderByKey",0,0,arguments.length),this.oe("Query.orderByKey");var e=this.ee.orderBy(dt);return t.re(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByPriority=function(){P("Query.orderByPriority",0,0,arguments.length),this.oe("Query.orderByPriority");var e=this.ee.orderBy(Nt);return t.re(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByValue=function(){P("Query.orderByValue",0,0,arguments.length),this.oe("Query.orderByValue");var e=this.ee.orderBy(ee);return t.re(e),new t(this.repo,this.path,e,!0)},t.prototype.startAt=function(e,n){void 0===e&&(e=null),P("Query.startAt",0,2,arguments.length),U("Query.startAt",1,e,this.path,!0),z("Query.startAt",2,n,!0);var r=this.ee.startAt(e,n);if(t.ie(r),t.re(r),this.ee.hasStart())throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===e&&(e=null,n=null),new t(this.repo,this.path,r,this.ne)},t.prototype.endAt=function(e,n){void 0===e&&(e=null),P("Query.endAt",0,2,arguments.length),U("Query.endAt",1,e,this.path,!0),z("Query.endAt",2,n,!0);var r=this.ee.endAt(e,n);if(t.ie(r),t.re(r),this.ee.hasEnd())throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new t(this.repo,this.path,r,this.ne)},t.prototype.equalTo=function(t,e){if(P("Query.equalTo",1,2,arguments.length),U("Query.equalTo",1,t,this.path,!1),z("Query.equalTo",2,e,!0),this.ee.hasStart())throw Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.ee.hasEnd())throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(t,e).endAt(t,e)},t.prototype.toString=function(){return P("Query.toString",0,0,arguments.length),""+this.repo+this.path.toUrlEncodedString()},t.prototype.toJSON=function(){return P("Query.toJSON",0,1,arguments.length),""+this},t.prototype.queryObject=function(){return this.ee.getQueryObject()},t.prototype.queryIdentifier=function(){var t=this.queryObject(),e=Object(_e.d)(t);return"{}"===e?"default":e},t.prototype.isEqual=function(e){if(P("Query.isEqual",1,1,arguments.length),!(e instanceof t))throw Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.");var n=this.repo===e.repo,r=this.path.equals(e.path),i=this.queryIdentifier()===e.queryIdentifier();return n&&r&&i},t.ae=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,R(t,3,r.cancel,!0),r.context=n,D(t,4,r.context,!0);else if(e)if("object"===(void 0===e?"undefined":ve(e))&&null!==e)r.context=e;else{if("function"!=typeof e)throw Error(i(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),me=n(2),be=function(){function t(){this.set={}}return t.prototype.add=function(t,e){this.set[t]=null===e||e},t.prototype.contains=function(t){return Object(me.b)(this.set,t)},t.prototype.get=function(t){return this.contains(t)?this.set[t]:void 0},t.prototype.remove=function(t){delete this.set[t]},t.prototype.clear=function(){this.set={}},t.prototype.isEmpty=function(){return Object(me.j)(this.set)},t.prototype.count=function(){return Object(me.h)(this.set)},t.prototype.each=function(t){Object(me.f)(this.set,function(e,n){return t(e,n)})},t.prototype.keys=function(){var t=[];return Object(me.f)(this.set,function(e){t.push(e)}),t},t}(),Ce=function(){function t(){this.gt=null,this.Ut=null}return t.prototype.find=function(t){if(null!=this.gt)return this.gt.getChild(t);if(t.isEmpty()||null==this.Ut)return null;var e=t.getFront();return t=t.popFront(),this.Ut.contains(e)?this.Ut.get(e).find(t):null},t.prototype.remember=function(e,n){if(e.isEmpty())this.gt=n,this.Ut=null;else if(null!==this.gt)this.gt=this.gt.updateChild(e,n);else{null==this.Ut&&(this.Ut=new be);var r=e.getFront();this.Ut.contains(r)||this.Ut.add(r,new t);var i=this.Ut.get(r);e=e.popFront(),i.remember(e,n)}},t.prototype.forget=function(t){if(t.isEmpty())return this.gt=null,this.Ut=null,!0;if(null!==this.gt){if(this.gt.isLeafNode())return!1;var e=this.gt;this.gt=null;var n=this;return e.forEachChild(Nt,function(t,e){n.remember(new v(t),e)}),this.forget(t)}if(null!==this.Ut){var r=t.getFront();return t=t.popFront(),this.Ut.contains(r)&&this.Ut.get(r).forget(t)&&this.Ut.remove(r),!!this.Ut.isEmpty()&&(this.Ut=null,!0)}return!0},t.prototype.forEachTree=function(t,e){null!==this.gt?e(t,this.gt):this.forEachChild(function(n,r){var i=new v(t+"/"+n);r.forEachTree(i,e)})},t.prototype.forEachChild=function(t){null!==this.Ut&&this.Ut.each(function(e,n){t(e,n)})},t}(),Ee=n(0),we="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oe=function(t){return t=t||{},t.timestamp=t.timestamp||(new Date).getTime(),t},Se=function(t,e){return t&&"object"===(void 0===t?"undefined":we(t))?(Object(Ee.a)(".sv"in t,"Unexpected leaf node or priority contents"),e[t[".sv"]]):t},Te=function(t,e){var n=new Ce;return t.forEachTree(new v(""),function(t,r){n.remember(t,Ne(r,e))}),n},Ne=function t(e,n){var r,i=e.getPriority().val(),o=Se(i,n);if(e.isLeafNode()){var s=e,u=Se(s.getValue(),n);return u!==s.getValue()||o!==s.getPriority().val()?new wt(u,a(o)):e}var c=e;return r=c,o!==c.getPriority().val()&&(r=r.updatePriority(new wt(o))),c.forEachChild(Nt,function(e,i){var o=t(i,n);o!==i&&(r=r.updateImmediateChild(e,o))}),r},Ie=n(0);!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}($t||($t={}));var Pe,Re,De=function(){function t(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,Object(Ie.a)(!r||e,"Tagged queries must be from server.")}return t.User=new t(!0,!1,null,!1),t.Server=new t(!1,!0,null,!1),t.forServerTaggedQuery=function(e){return new t(!1,!0,e,!0)},t}(),je=n(0),xe=function(){function t(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=$t.ACK_USER_WRITE,this.source=De.User}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return Object(je.a)(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var n=this.affectedTree.subtree(new v(e));return new t(v.Empty,n,this.revert)}return Object(je.a)(this.path.getFront()===e,"operationForChild called for unrelated child."),new t(this.path.popFront(),this.affectedTree,this.revert)},t}(),ke=n(1),Fe=n(2),Ae=function(){return Pe||(Pe=new Dt(ke.A)),Pe},Le=function(){function t(t,e){void 0===e&&(e=Ae()),this.value=t,this.children=e}return t.fromObject=function(e){var n=t.Empty;return Object(Fe.f)(e,function(t,e){n=n.set(new v(t),e)}),n},t.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},t.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:v.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null!==r){var i=r.findRootMostMatchingPathAndValue(t.popFront(),e);return null!=i?{path:new v(n).child(i.path),value:i.value}:null}return null},t.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},t.prototype.subtree=function(e){if(e.isEmpty())return this;var n=e.getFront(),r=this.children.get(n);return null!==r?r.subtree(e.popFront()):t.Empty},t.prototype.set=function(e,n){if(e.isEmpty())return new t(n,this.children);var r=e.getFront(),i=this.children.get(r)||t.Empty,o=i.set(e.popFront(),n),s=this.children.insert(r,o);return new t(this.value,s)},t.prototype.remove=function(e){if(e.isEmpty())return this.children.isEmpty()?t.Empty:new t(null,this.children);var n=e.getFront(),r=this.children.get(n);if(r){var i=r.remove(e.popFront()),o=void 0;return o=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&o.isEmpty()?t.Empty:new t(this.value,o)}return this},t.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),n=this.children.get(e);return n?n.get(t.popFront()):null},t.prototype.setTree=function(e,n){if(e.isEmpty())return n;var r=e.getFront(),i=this.children.get(r)||t.Empty,o=i.setTree(e.popFront(),n),s=void 0;return s=o.isEmpty()?this.children.remove(r):this.children.insert(r,o),new t(this.value,s)},t.prototype.fold=function(t){return this.ue(v.Empty,t)},t.prototype.ue=function(t,e){var n={};return this.children.inorderTraversal(function(r,i){n[r]=i.ue(t.child(r),e)}),e(t,this.value,n)},t.prototype.findOnPath=function(t,e){return this.ce(t,v.Empty,e)},t.prototype.ce=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),o=this.children.get(i);return o?o.ce(t.popFront(),e.child(i),n):null},t.prototype.foreachOnPath=function(t,e){return this.he(t,v.Empty,e)},t.prototype.he=function(e,n,r){if(e.isEmpty())return this;this.value&&r(n,this.value);var i=e.getFront(),o=this.children.get(i);return o?o.he(e.popFront(),n.child(i),r):t.Empty},t.prototype.foreach=function(t){this.le(v.Empty,t)},t.prototype.le=function(t,e){this.children.inorderTraversal(function(n,r){r.le(t.child(n),e)}),this.value&&e(t,this.value)},t.prototype.foreachChild=function(t){this.children.inorderTraversal(function(e,n){n.value&&t(e,n.value)})},t.Empty=new t(null),t}(),Me=function(){function t(t,e){this.source=t,this.path=e,this.type=$t.LISTEN_COMPLETE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,v.Empty):new t(this.source,this.path.popFront())},t}(),We=function(){function t(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=$t.OVERWRITE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,v.Empty,this.snap.getImmediateChild(e)):new t(this.source,this.path.popFront(),this.snap)},t}(),qe=n(0),Qe=function(){function t(t,e,n){this.source=t,this.path=e,this.children=n,this.type=$t.MERGE}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){var n=this.children.subtree(new v(e));return n.isEmpty()?null:n.value?new We(this.source,v.Empty,n.value):new t(this.source,v.Empty,n)}return Object(qe.a)(this.path.getFront()===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,this.path.popFront(),this.children)},t.prototype.toString=function(){return"Operation("+this.path+": "+this.source+" merge: "+this.children+")"},t}(),Ue=function(){function t(t,e,n){this.zt=t,this.pe=e,this.de=n}return t.prototype.isFullyInitialized=function(){return this.pe},t.prototype.isFiltered=function(){return this.de},t.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.de;var e=t.getFront();return this.isCompleteForChild(e)},t.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.de||this.zt.hasChild(t)},t.prototype.getNode=function(){return this.zt},t}(),Ve=function(){function t(t,e){this.fe=t,this._e=e}return t.prototype.updateEventSnap=function(e,n,r){return new t(new Ue(e,n,r),this._e)},t.prototype.updateServerSnap=function(e,n,r){return new t(this.fe,new Ue(e,n,r))},t.prototype.getEventCache=function(){return this.fe},t.prototype.getCompleteEventSnap=function(){return this.fe.isFullyInitialized()?this.fe.getNode():null},t.prototype.getServerCache=function(){return this._e},t.prototype.getCompleteServerSnap=function(){return this._e.isFullyInitialized()?this._e.getNode():null},t.Empty=new t(new Ue(Vt.EMPTY_NODE,!1,!1),new Ue(Vt.EMPTY_NODE,!1,!1)),t}(),Be=function(){function t(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}return t.valueChange=function(e){return new t(t.VALUE,e)},t.childAddedChange=function(e,n){return new t(t.CHILD_ADDED,n,e)},t.childRemovedChange=function(e,n){return new t(t.CHILD_REMOVED,n,e)},t.childChangedChange=function(e,n,r){return new t(t.CHILD_CHANGED,n,e,r)},t.childMovedChange=function(e,n){return new t(t.CHILD_MOVED,n,e)},t.CHILD_ADDED="child_added",t.CHILD_REMOVED="child_removed",t.CHILD_CHANGED="child_changed",t.CHILD_MOVED="child_moved",t.VALUE="value",t}(),He=n(0),Ke=function(){function t(t){this.Xt=t}return t.prototype.updateChild=function(t,e,n,r,i,o){Object(He.a)(t.isIndexed(this.Xt),"A node must be indexed if only a child is updated");var s=t.getImmediateChild(e);return s.getChild(r).equals(n.getChild(r))&&s.isEmpty()==n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(Be.childRemovedChange(e,s)):Object(He.a)(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(Be.childAddedChange(e,n)):o.trackChildChange(Be.childChangedChange(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.Xt))},t.prototype.updateFullNode=function(t,e,n){return null!=n&&(t.isLeafNode()||t.forEachChild(Nt,function(t,r){e.hasChild(t)||n.trackChildChange(Be.childRemovedChange(t,r))}),e.isLeafNode()||e.forEachChild(Nt,function(e,r){if(t.hasChild(e)){var i=t.getImmediateChild(e);i.equals(r)||n.trackChildChange(Be.childChangedChange(e,r,i))}else n.trackChildChange(Be.childAddedChange(e,r))})),e.withIndex(this.Xt)},t.prototype.updatePriority=function(t,e){return t.isEmpty()?Vt.EMPTY_NODE:t.updatePriority(e)},t.prototype.filtersNodes=function(){return!1},t.prototype.getIndexedFilter=function(){return this},t.prototype.getIndex=function(){return this.Xt},t}(),Ye=n(2),ze=n(0),Ge=function(){function t(){this.ye={}}return t.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;Object(ze.a)(e==Be.CHILD_ADDED||e==Be.CHILD_CHANGED||e==Be.CHILD_REMOVED,"Only child changes supported for tracking"),Object(ze.a)(".priority"!==n,"Only non-priority child changes can be tracked.");var r=Object(Ye.l)(this.ye,n);if(r){var i=r.type;if(e==Be.CHILD_ADDED&&i==Be.CHILD_REMOVED)this.ye[n]=Be.childChangedChange(n,t.snapshotNode,r.snapshotNode);else if(e==Be.CHILD_REMOVED&&i==Be.CHILD_ADDED)delete this.ye[n];else if(e==Be.CHILD_REMOVED&&i==Be.CHILD_CHANGED)this.ye[n]=Be.childRemovedChange(n,r.oldSnap);else if(e==Be.CHILD_CHANGED&&i==Be.CHILD_ADDED)this.ye[n]=Be.childAddedChange(n,t.snapshotNode);else{if(e!=Be.CHILD_CHANGED||i!=Be.CHILD_CHANGED)throw Object(ze.b)("Illegal combination of changes: "+t+" occurred after "+r);this.ye[n]=Be.childChangedChange(n,t.snapshotNode,r.oldSnap)}}else this.ye[n]=t},t.prototype.getChanges=function(){return Object(Ye.i)(this.ye)},t}(),Xe=function(){function t(){}return t.prototype.getCompleteChild=function(t){return null},t.prototype.getChildAfterChild=function(t,e,n){return null},t}(),$e=new Xe,Je=function(){function t(t,e,n){void 0===n&&(n=null),this.ve=t,this.ge=e,this.me=n}return t.prototype.getCompleteChild=function(t){var e=this.ge.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.me?new Ue(this.me,!0,!1):this.ge.getServerCache();return this.ve.calcCompleteChild(t,n)},t.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.me?this.me:this.ge.getCompleteServerSnap(),i=this.ve.calcIndexedSlice(r,e,1,n,t);return 0===i.length?null:i[0]},t}(),Ze=n(0),tn=function(){function t(t,e){this.viewCache=t,this.changes=e}return t}(),en=function(){function t(t){this.be=t}return t.prototype.assertIndexed=function(t){Object(Ze.a)(t.getEventCache().getNode().isIndexed(this.be.getIndex()),"Event snap not indexed"),Object(Ze.a)(t.getServerCache().getNode().isIndexed(this.be.getIndex()),"Server snap not indexed")},t.prototype.applyOperation=function(e,n,r,i){var o,s,a=new Ge;if(n.type===$t.OVERWRITE){var u=n;u.source.fromUser?o=this.Ce(e,u.path,u.snap,r,i,a):(Object(Ze.a)(u.source.fromServer,"Unknown source."),s=u.source.tagged||e.getServerCache().isFiltered()&&!u.path.isEmpty(),o=this.Ee(e,u.path,u.snap,r,i,s,a))}else if(n.type===$t.MERGE){var c=n;c.source.fromUser?o=this.we(e,c.path,c.children,r,i,a):(Object(Ze.a)(c.source.fromServer,"Unknown source."),s=c.source.tagged||e.getServerCache().isFiltered(),o=this.Oe(e,c.path,c.children,r,i,s,a))}else if(n.type===$t.ACK_USER_WRITE){var h=n;o=h.revert?this.Se(e,h.path,r,i,a):this.Te(e,h.path,h.affectedTree,r,i,a)}else{if(n.type!==$t.LISTEN_COMPLETE)throw Object(Ze.b)("Unknown operation type: "+n.type);o=this.Ne(e,n.path,r,a)}var l=a.getChanges();return t.Ie(e,o,l),new tn(o,l)},t.Ie=function(t,e,n){var r=e.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=t.getCompleteEventSnap();(n.length>0||!t.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(Be.valueChange(e.getCompleteEventSnap()))}},t.prototype.Pe=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s=void 0,a=void 0;if(e.isEmpty())if(Object(Ze.a)(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var u=t.getCompleteServerSnap(),c=u instanceof Vt?u:Vt.EMPTY_NODE,h=n.calcCompleteEventChildren(c);s=this.be.updateFullNode(t.getEventCache().getNode(),h,i)}else{var l=n.calcCompleteEventCache(t.getCompleteServerSnap());s=this.be.updateFullNode(t.getEventCache().getNode(),l,i)}else{var p=e.getFront();if(".priority"==p){Object(Ze.a)(1==e.getLength(),"Can't have a priority with additional path components");var d=o.getNode();a=t.getServerCache().getNode();var f=n.calcEventCacheAfterServerOverwrite(e,d,a);s=null!=f?this.be.updatePriority(d,f):o.getNode()}else{var _=e.popFront(),y=void 0;if(o.isCompleteForChild(p)){a=t.getServerCache().getNode();var v=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),a);y=null!=v?o.getNode().getImmediateChild(p).updateChild(_,v):o.getNode().getImmediateChild(p)}else y=n.calcCompleteChild(p,t.getServerCache());s=null!=y?this.be.updateChild(o.getNode(),p,y,_,r,i):o.getNode()}}return t.updateEventSnap(s,o.isFullyInitialized()||e.isEmpty(),this.be.filtersNodes())},t.prototype.Ee=function(t,e,n,r,i,o,s){var a,u=t.getServerCache(),c=o?this.be:this.be.getIndexedFilter();if(e.isEmpty())a=c.updateFullNode(u.getNode(),n,null);else if(c.filtersNodes()&&!u.isFiltered()){var h=u.getNode().updateChild(e,n);a=c.updateFullNode(u.getNode(),h,null)}else{var l=e.getFront();if(!u.isCompleteForPath(e)&&e.getLength()>1)return t;var p=e.popFront(),d=u.getNode().getImmediateChild(l),f=d.updateChild(p,n);a=".priority"==l?c.updatePriority(u.getNode(),f):c.updateChild(u.getNode(),l,f,p,$e,null)}var _=t.updateServerSnap(a,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),y=new Je(r,_,i);return this.Pe(_,e,r,y,s)},t.prototype.Ce=function(t,e,n,r,i,o){var s,a,u=t.getEventCache(),c=new Je(r,t,i);if(e.isEmpty())a=this.be.updateFullNode(t.getEventCache().getNode(),n,o),s=t.updateEventSnap(a,!0,this.be.filtersNodes());else{var h=e.getFront();if(".priority"===h)a=this.be.updatePriority(t.getEventCache().getNode(),n),s=t.updateEventSnap(a,u.isFullyInitialized(),u.isFiltered());else{var l=e.popFront(),p=u.getNode().getImmediateChild(h),d=void 0;if(l.isEmpty())d=n;else{var f=c.getCompleteChild(h);d=null!=f?".priority"===l.getBack()&&f.getChild(l.parent()).isEmpty()?f:f.updateChild(l,n):Vt.EMPTY_NODE}if(p.equals(d))s=t;else{var _=this.be.updateChild(u.getNode(),h,d,l,c,o);s=t.updateEventSnap(_,u.isFullyInitialized(),this.be.filtersNodes())}}}return s},t.Re=function(t,e){return t.getEventCache().isCompleteForChild(e)},t.prototype.we=function(e,n,r,i,o,s){var a=this,u=e;return r.foreach(function(r,c){var h=n.child(r);t.Re(e,h.getFront())&&(u=a.Ce(u,h,c,i,o,s))}),r.foreach(function(r,c){var h=n.child(r);t.Re(e,h.getFront())||(u=a.Ce(u,h,c,i,o,s))}),u},t.prototype.De=function(t,e){return e.foreach(function(e,n){t=t.updateChild(e,n)}),t},t.prototype.Oe=function(t,e,n,r,i,o,s){var a=this;if(t.getServerCache().getNode().isEmpty()&&!t.getServerCache().isFullyInitialized())return t;var u,c=t;u=e.isEmpty()?n:Le.Empty.setTree(e,n);var h=t.getServerCache().getNode();return u.children.inorderTraversal(function(e,n){if(h.hasChild(e)){var u=t.getServerCache().getNode().getImmediateChild(e),l=a.De(u,n);c=a.Ee(c,new v(e),l,r,i,o,s)}}),u.children.inorderTraversal(function(e,n){var u=!t.getServerCache().isCompleteForChild(e)&&null==n.value;if(!h.hasChild(e)&&!u){var l=t.getServerCache().getNode().getImmediateChild(e),p=a.De(l,n);c=a.Ee(c,new v(e),p,r,i,o,s)}}),c},t.prototype.Te=function(t,e,n,r,i,o){if(null!=r.shadowingWrite(e))return t;var s=t.getServerCache().isFiltered(),a=t.getServerCache();if(null!=n.value){if(e.isEmpty()&&a.isFullyInitialized()||a.isCompleteForPath(e))return this.Ee(t,e,a.getNode().getChild(e),r,i,s,o);if(e.isEmpty()){var u=Le.Empty;return a.getNode().forEachChild(dt,function(t,e){u=u.set(new v(t),e)}),this.Oe(t,e,u,r,i,s,o)}return t}var c=Le.Empty;return n.foreach(function(t,n){var r=e.child(t);a.isCompleteForPath(r)&&(c=c.set(t,a.getNode().getChild(r)))}),this.Oe(t,e,c,r,i,s,o)},t.prototype.Ne=function(t,e,n,r){var i=t.getServerCache(),o=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.Pe(o,e,n,$e,r)},t.prototype.Se=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s=new Je(n,t,r),a=t.getEventCache().getNode(),u=void 0;if(e.isEmpty()||".priority"===e.getFront()){var c=void 0;if(t.getServerCache().isFullyInitialized())c=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var h=t.getServerCache().getNode();Object(Ze.a)(h instanceof Vt,"serverChildren would be complete if leaf node"),c=n.calcCompleteEventChildren(h)}c=c,u=this.be.updateFullNode(a,c,i)}else{var l=e.getFront(),p=n.calcCompleteChild(l,t.getServerCache());null==p&&t.getServerCache().isCompleteForChild(l)&&(p=a.getImmediateChild(l)),u=null!=p?this.be.updateChild(a,l,p,e.popFront(),s,i):t.getEventCache().getNode().hasChild(l)?this.be.updateChild(a,l,Vt.EMPTY_NODE,e.popFront(),s,i):a,u.isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap()),o.isLeafNode()&&(u=this.be.updateFullNode(u,o,i)))}return o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(v.Empty),t.updateEventSnap(u,o,this.be.filtersNodes())},t}(),nn=n(0),rn=function(){function t(t){this.je=t,this.Xt=this.je.getQueryParams().getIndex()}return t.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach(function(t){t.type===Be.CHILD_CHANGED&&r.Xt.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(Be.childMovedChange(t.childName,t.snapshotNode))}),this.xe(i,Be.CHILD_REMOVED,t,n,e),this.xe(i,Be.CHILD_ADDED,t,n,e),this.xe(i,Be.CHILD_MOVED,o,n,e),this.xe(i,Be.CHILD_CHANGED,t,n,e),this.xe(i,Be.VALUE,t,n,e),i},t.prototype.xe=function(t,e,n,r,i){var o=this,s=n.filter(function(t){return t.type===e});s.sort(this.ke.bind(this)),s.forEach(function(e){var n=o.Fe(e,i);r.forEach(function(r){r.respondsTo(e.type)&&t.push(r.createEvent(n,o.je))})})},t.prototype.Fe=function(t,e){return"value"===t.type||"child_removed"===t.type?t:(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.Xt),t)},t.prototype.ke=function(t,e){if(null==t.childName||null==e.childName)throw Object(nn.b)("Should only compare child_ events.");var n=new st(t.childName,t.snapshotNode),r=new st(e.childName,e.snapshotNode);return this.Xt.compare(n,r)},t}(),on=n(0),sn=function(){function t(t,e){this.je=t,this.Ae=[];var n=this.je.getQueryParams(),r=new Ke(n.getIndex()),i=n.getNodeFilter();this.Le=new en(i);var o=e.getServerCache(),s=e.getEventCache(),a=r.updateFullNode(Vt.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(Vt.EMPTY_NODE,s.getNode(),null),c=new Ue(a,o.isFullyInitialized(),r.filtersNodes()),h=new Ue(u,s.isFullyInitialized(),i.filtersNodes());this.ge=new Ve(h,c),this.Me=new rn(this.je)}return t.prototype.getQuery=function(){return this.je},t.prototype.getServerCache=function(){return this.ge.getServerCache().getNode()},t.prototype.getCompleteServerCache=function(t){var e=this.ge.getCompleteServerSnap();return e&&(this.je.getQueryParams().loadsAllData()||!t.isEmpty()&&!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},t.prototype.isEmpty=function(){return 0===this.Ae.length},t.prototype.addEventRegistration=function(t){this.Ae.push(t)},t.prototype.removeEventRegistration=function(t,e){var n=[];if(e){Object(on.a)(null==t,"A cancel should cancel all event registrations.");var r=this.je.path;this.Ae.forEach(function(t){e=e;var i=t.createCancelEvent(e,r);i&&n.push(i)})}if(t){for(var i=[],o=0;othis.He,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.Be.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.Ve=this.Ve.addWrite(t,e)),this.He=n},t.prototype.addMerge=function(t,e,n){Object(fn.a)(n>this.He,"Stacking an older merge on top of newer ones"),this.Be.push({path:t,children:e,writeId:n,visible:!0}),this.Ve=this.Ve.addWrites(t,e),this.He=n},t.prototype.getWrite=function(t){for(var e=0;e=0,"removeWrite called with nonexistent writeId.");var r=this.Be[n];this.Be.splice(n,1);for(var i=r.visible,o=!1,s=this.Be.length-1;i&&s>=0;){var a=this.Be[s];a.visible&&(s>=n&&this.Ke(a,r.path)?i=!1:r.path.contains(a.path)&&(o=!0)),s--}if(i){if(o)return this.Ye(),!0;if(r.snap)this.Ve=this.Ve.removeWrite(r.path);else{var u=r.children;Object(dn.f)(u,function(t){e.Ve=e.Ve.removeWrite(r.path.child(t))})}return!0}return!1},t.prototype.getCompleteWriteData=function(t){return this.Ve.getCompleteNode(t)},t.prototype.calcCompleteEventCache=function(e,n,r,i){if(r||i){var o=this.Ve.childCompoundWrite(e);if(!i&&o.isEmpty())return n;if(i||null!=n||o.hasCompleteWrite(v.Empty)){var s=function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))},a=t.ze(this.Be,s,e),u=n||Vt.EMPTY_NODE;return a.apply(u)}return null}var c=this.Ve.getCompleteNode(e);if(null!=c)return c;var h=this.Ve.childCompoundWrite(e);if(h.isEmpty())return n;if(null!=n||h.hasCompleteWrite(v.Empty)){var u=n||Vt.EMPTY_NODE;return h.apply(u)}return null},t.prototype.calcCompleteEventChildren=function(t,e){var n=Vt.EMPTY_NODE,r=this.Ve.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(Nt,function(t,e){n=n.updateImmediateChild(t,e)}),n;if(e){var i=this.Ve.childCompoundWrite(t);return e.forEachChild(Nt,function(t,e){var r=i.childCompoundWrite(new v(t)).apply(e);n=n.updateImmediateChild(t,r)}),i.getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n}return this.Ve.childCompoundWrite(t).getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){Object(fn.a)(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=t.child(e);if(this.Ve.hasCompleteWrite(i))return null;var o=this.Ve.childCompoundWrite(i);return o.isEmpty()?r.getChild(e):o.apply(r.getChild(e))},t.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),i=this.Ve.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(e)?this.Ve.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):null},t.prototype.shadowingWrite=function(t){return this.Ve.getCompleteNode(t)},t.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var s,a=this.Ve.childCompoundWrite(t),u=a.getCompleteNode(v.Empty);if(null!=u)s=u;else{if(null==e)return[];s=a.apply(e)}if(s=s.withIndex(o),s.isEmpty()||s.isLeafNode())return[];for(var c=[],h=o.getCompare(),l=i?s.getReverseIteratorFrom(n,o):s.getIteratorFrom(n,o),p=l.getNext();p&&c.length0?this.He=this.Be[this.Be.length-1].writeId:this.He=-1},t.Ge=function(t){return t.visible},t.ze=function(t,e,n){for(var r=pn.Empty,i=0;i0&&!r&&(h?this.$e.stopListening(t.pn(e),null):c.forEach(function(e){var n=i.en[t.an(e)];i.$e.stopListening(t.pn(e),n)})),this.fn(c)}return a},t.prototype.calcCompleteEventCache=function(t,e){var n=this.Ze,r=this.Je.findOnPath(t,function(e,n){var r=v.relativePath(e,t),i=n.getCompleteServerCache(r);if(i)return i});return n.calcCompleteEventCache(t,r,e,!0)},t.prototype.hn=function(t){return t.fold(function(t,e,n){if(e&&e.hasCompleteView())return[e.getCompleteView()];var r=[];return e&&(r=e.getQueryViews()),Object(mn.f)(n,function(t,e){r=r.concat(e)}),r})},t.prototype.fn=function(e){for(var n=0;n0&&Object(Tn.b)(t.wn,e)&&(n[e]=i,r=!0)}),r&&this.En.reportStats(n),Object(Nn.x)(this.Sn.bind(this),Math.floor(2*Math.random()*3e5))},t}(),Dn=n(1),jn=function(){function t(){this.Tn=[],this.Nn=0}return t.prototype.queueEvents=function(t){for(var e=null,n=0;n0,"Requires a non-empty array")}return t.prototype.trigger=function(t){for(var e=[],n=1;ndocument.domain="'+document.domain+'";<\/script>');var s=""+o+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(t){Object($n.s)("frame writing exception"),t.stack&&Object($n.s)(t.stack),Object($n.s)(t)}}}return t.qn=function(){var t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||Object($n.s)("No IE domain setting required")}catch(n){var e=document.domain;t.src="proxy.php?url=javascript:void((function(){document.open();document.domain='"+e+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t},t.prototype.close=function(){var e=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==e.myIFrame&&(document.body.removeChild(e.myIFrame),e.myIFrame=null)},Math.floor(0))),Object(er.b)()&&this.myID){var n={};n.disconn="t",n.id=this.myID,n.pw=this.myPW;var r=this.urlFn(n);t.nodeRestRequest(r)}var i=this.onDisconnect;i&&(this.onDisconnect=null,i())},t.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.Qn(););},t.prototype.Qn=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;for(var e=this.urlFn(t),n="",r=0;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+30+n.length<=1870;){var i=this.pendingSegs.shift();n=n+"&seg"+r+"="+i.seg+"&ts"+r+"="+i.ts+"&d"+r+"="+i.d,r++}return e+=n,this.Un(e,this.currentSerial),!0}return!1},t.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.Qn()},t.prototype.Un=function(t,e){var n=this;this.outstandingRequests.add(e,1);var r=function(){n.outstandingRequests.remove(e),n.Qn()},i=setTimeout(r,Math.floor(25e3)),o=function(){clearTimeout(i),r()};this.addTag(t,o)},t.prototype.addTag=function(t,e){var n=this;Object(er.b)()?this.doNodeLongPoll(t,e):setTimeout(function(){try{if(!n.sendNewPolls)return;var r=n.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=t,r.onload=r.onreadystatechange=function(){var t=r.readyState;t&&"loaded"!==t&&"complete"!==t||(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),e())},r.onerror=function(){Object($n.s)("Long-poll script failed to load: "+t),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(r)}catch(t){}},Math.floor(1))},t}(),sr=n(18),ar=n(1),ur=function(){function t(t){this.Vn(t)}return Object.defineProperty(t,"ALL_TRANSPORTS",{get:function(){return[ir,sr.a]},enumerable:!0,configurable:!0}),t.prototype.Vn=function(e){var n=sr.a&&sr.a.isAvailable(),r=n&&!sr.a.previouslyFailed();if(e.webSocketOnly&&(n||Object(ar.B)("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),r=!0),r)this.Bn=[sr.a];else{var i=this.Bn=[];Object(ar.i)(t.ALL_TRANSPORTS,function(t,e){e&&e.isAvailable()&&i.push(e)})}},t.prototype.initialTransport=function(){if(this.Bn.length>0)return this.Bn[0];throw Error("No transports available")},t.prototype.upgradeTransport=function(){return this.Bn.length>1?this.Bn[1]:null},t}(),cr=n(1),hr=n(8),lr=n(9),pr=function(){function t(t,e,n,r,i,o,s){this.id=t,this.Hn=e,this.Fn=n,this.Kn=r,this.An=i,this.Yn=o,this.lastSessionId=s,this.connectionCount=0,this.pendingDataMessages=[],this.zn=0,this.X=Object(cr.t)("c:"+this.id+":"),this.Gn=new ur(e),this.X("Connection created"),this.Xn()}return t.prototype.Xn=function(){var t=this,e=this.Gn.initialTransport();this.$n=new e(this.Jn(),this.Hn,void 0,this.lastSessionId),this.Zn=e.responsesRequiredToBeHealthy||0;var n=this.tr(this.$n),r=this.er(this.$n);this.nr=this.$n,this.rr=this.$n,this.ir=null,this.or=!1,setTimeout(function(){t.$n&&t.$n.open(n,r)},Math.floor(0));var i=e.healthyTimeout||0;i>0&&(this.sr=Object(cr.x)(function(){t.sr=null,t.or||(t.$n&&t.$n.bytesReceived>102400?(t.X("Connection exceeded healthy timeout but has received "+t.$n.bytesReceived+" bytes. Marking connection healthy."),t.or=!0,t.$n.markConnectionHealthy()):t.$n&&t.$n.bytesSent>10240?t.X("Connection exceeded healthy timeout but has sent "+t.$n.bytesSent+" bytes. Leaving connection alive."):(t.X("Closing unhealthy connection after timeout."),t.close()))},Math.floor(i)))},t.prototype.Jn=function(){return"c:"+this.id+":"+this.connectionCount++},t.prototype.er=function(t){var e=this;return function(n){t===e.$n?e.ar(n):t===e.ir?(e.X("Secondary connection lost."),e.ur()):e.X("closing an old connection")}},t.prototype.tr=function(t){var e=this;return function(n){2!=e.zn&&(t===e.rr?e.cr(n):t===e.ir?e.hr(n):e.X("message on old connection"))}},t.prototype.sendRequest=function(t){var e={t:"d",d:t};this.lr(e)},t.prototype.tryCleanupConnection=function(){this.nr===this.ir&&this.rr===this.ir&&(this.X("cleaning up and promoting a connection: "+this.ir.connId),this.$n=this.ir,this.ir=null)},t.prototype.pr=function(t){if("t"in t){var e=t.t;"a"===e?this.dr():"r"===e?(this.X("Got a reset on secondary, closing it"),this.ir.close(),this.nr!==this.ir&&this.rr!==this.ir||this.close()):"o"===e&&(this.X("got pong on secondary."),this.fr--,this.dr())}},t.prototype.hr=function(t){var e=Object(cr.w)("t",t),n=Object(cr.w)("d",t);if("c"==e)this.pr(n);else{if("d"!=e)throw Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}},t.prototype.dr=function(){this.fr<=0?(this.X("Secondary connection is healthy."),this.or=!0,this.ir.markConnectionHealthy(),this._r()):(this.X("sending ping on secondary."),this.ir.send({t:"c",d:{t:"p",d:{}}}))},t.prototype._r=function(){this.ir.start(),this.X("sending client ack on secondary"),this.ir.send({t:"c",d:{t:"a",d:{}}}),this.X("Ending transmission on primary"),this.$n.send({t:"c",d:{t:"n",d:{}}}),this.nr=this.ir,this.tryCleanupConnection()},t.prototype.cr=function(t){var e=Object(cr.w)("t",t),n=Object(cr.w)("d",t);"c"==e?this.yr(n):"d"==e&&this.vr(n)},t.prototype.vr=function(t){this.gr(),this.Fn(t)},t.prototype.gr=function(){this.or||--this.Zn<=0&&(this.X("Primary connection is healthy."),this.or=!0,this.$n.markConnectionHealthy())},t.prototype.yr=function(t){var e=Object(cr.w)("t",t);if("d"in t){var n=t.d;if("h"===e)this.mr(n);else if("n"===e){this.X("recvd end transmission on primary"),this.rr=this.ir;for(var r=0;r3e4&&(this.Wr=wr),this.$r=null}}else this.X("Window isn't visible. Delaying reconnect."),this.Wr=this.qr,this.Xr=(new Date).getTime();var e=(new Date).getTime()-this.Xr,n=Math.max(0,this.Wr-e);n=Math.random()*n,this.X("Trying to reconnect in "+n+"ms"),this.Jr(n),this.Wr=Math.min(this.qr,1.3*this.Wr)}this.Ir(!1)},e.prototype._i=function(){if(this.gi()){this.X("Making a connection attempt"),this.Xr=(new Date).getTime(),this.$r=null;var t=this.vr.bind(this),n=this.Kn.bind(this),r=this.yi.bind(this),i=this.id+":"+e.mi++,o=this,s=this.lastSessionId,a=!1,u=null,c=function(){u?u.close():(a=!0,r())},h=function(t){Object(vr.a)(u,"sendRequest call when we're not connected not allowed."),u.sendRequest(t)};this.Hr={close:c,sendRequest:h};var l=this.Yr;this.Yr=!1,this.Rr.getToken(l).then(function(e){a?Object(gr.s)("getToken() completed but was canceled"):(Object(gr.s)("getToken() completed. Creating connection."),o.Kr=e&&e.accessToken,u=new pr(i,o.Hn,t,n,r,function(t){Object(gr.B)(t+" ("+o.Hn+")"),o.interrupt("server_kill")},s))}).then(null,function(t){o.X("Failed to get token: "+t),a||(mr.a.NODE_ADMIN&&Object(gr.B)(t),c())})}},e.prototype.interrupt=function(t){Object(gr.s)("Interrupting connection for reason: "+t),this.xr[t]=!0,this.Hr?this.Hr.close():(this.Ur&&(clearTimeout(this.Ur),this.Ur=null),this.Mr&&this.yi())},e.prototype.resume=function(t){Object(gr.s)("Resuming connection for reason: "+t),delete this.xr[t],Object(_r.j)(this.xr)&&(this.Wr=wr,this.Hr||this.Jr(0))},e.prototype.pi=function(t){var e=t-(new Date).getTime();this.Pr({serverTimeOffset:e})},e.prototype.vi=function(){for(var t=0;t=3&&(this.Wr=3e4,this.Rr.notifyForInvalidToken())},e.prototype.li=function(t){this.Qr?this.Qr(t):"msg"in t&&"undefined"!=typeof console&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},e.prototype.fi=function(){var t=this;this.tryAuth(),Object(_r.f)(this.kr,function(e,n){Object(_r.f)(n,function(e,n){t.ei(n)})});for(var e=0;e=200&&a.status<300){try{t=Object(Rr.a)(a.responseText)}catch(t){Object(Pr.B)("Failed to parse JSON response for "+s+": "+a.responseText)}n(null,t)}else 401!==a.status&&404!==a.status&&Object(Pr.B)("Got unsuccessful REST response for "+s+" Status: "+a.status),n(a.status);n=null}},a.open("GET",s,!0),a.send()})},e}(dr),kr=n(3),Fr=n(1),Ar=n(2),Lr=n(12),Mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wr=function(){function t(t,e,n){var r=this;this.Hn=t,this.app=n,this.dataUpdateCount=0,this.On=null,this.Ei=new jn,this.wi=1,this.Oi=null,this.An=new Ce,this.Si=null;var i=new wn(n);if(this.$=Lr.a.getCollection(t),e||Object(Fr.g)())this.En=new xr(this.Hn,this.Nr.bind(this),i),setTimeout(this.Ir.bind(this,!0),0);else{var o=n.options.databaseAuthVariableOverride;if(void 0!==o&&null!==o){if("object"!==(void 0===o?"undefined":Mr(o)))throw Error("Only objects are supported for option databaseAuthVariableOverride");try{Object(kr.b)(o)}catch(t){throw Error("Invalid authOverride provided: "+t)}}this.Si=new Sr(this.Hn,this.Nr.bind(this),this.Ir.bind(this),this.Pr.bind(this),i,o),this.En=this.Si}i.addTokenChangeListener(function(t){r.En.refreshAuthToken(t)}),this.Ti=Lr.a.getOrCreateReporter(t,function(){return new Rn(r.$,r.En)}),this.Ni(),this.Ii=new Cn,this.Pi=new bn({startListening:function(t,e,n,i){var o=[],s=r.Ii.getNode(t.path);return s.isEmpty()||(o=r.Pi.applyServerOverwrite(t.path,s),setTimeout(function(){i("ok")},0)),o},stopListening:function(){}}),this.Ri("connected",!1),this.Di=new bn({startListening:function(t,e,n,i){return r.En.listen(t,n,e,function(e,n){var o=i(e,n);r.Ei.raiseEventsForChangedPath(t.path,o)}),[]},stopListening:function(t,e){r.En.unlisten(t,e)}})}return t.prototype.toString=function(){return(this.Hn.secure?"https://":"http://")+this.Hn.host},t.prototype.name=function(){return this.Hn.namespace},t.prototype.serverTime=function(){var t=this.Ii.getNode(new v(".info/serverTimeOffset")),e=t.val()||0;return(new Date).getTime()+e},t.prototype.generateServerValues=function(){return Oe({timestamp:this.serverTime()})},t.prototype.Nr=function(t,e,n,r){this.dataUpdateCount++;var i=new v(t);e=this.Oi?this.Oi(t,e):e;var o=[];if(r)if(n){var s=Object(Ar.k)(e,function(t){return a(t)});o=this.Di.applyTaggedQueryMerge(i,s,r)}else{var u=a(e);o=this.Di.applyTaggedQueryOverwrite(i,u,r)}else if(n){var c=Object(Ar.k)(e,function(t){return a(t)});o=this.Di.applyServerMerge(i,c)}else{var h=a(e);o=this.Di.applyServerOverwrite(i,h)}var l=i;o.length>0&&(l=this.ji(i)),this.Ei.raiseEventsForChangedPath(l,o)},t.prototype.xi=function(t){this.Oi=t},t.prototype.Ir=function(t){this.Ri("connected",t),!1===t&&this.ki()},t.prototype.Pr=function(t){var e=this;Object(Fr.i)(t,function(t,n){e.Ri(n,t)})},t.prototype.Ri=function(t,e){var n=new v("/.info/"+t),r=a(e);this.Ii.updateSnapshot(n,r);var i=this.Pi.applyServerOverwrite(n,r);this.Ei.raiseEventsForChangedPath(n,i)},t.prototype.Fi=function(){return this.wi++},t.prototype.setWithPriority=function(t,e,n,r){var i=this;this.X("set",{path:""+t,value:e,priority:n});var o=this.generateServerValues(),s=a(e,n),u=Ne(s,o),c=this.Fi(),h=this.Di.applyUserOverwrite(t,u,c,!0);this.Ei.queueEvents(h),this.En.put(""+t,s.val(!0),function(e,n){var o="ok"===e;o||Object(Fr.B)("set at "+t+" failed: "+e);var s=i.Di.ackUserWrite(c,!o);i.Ei.raiseEventsForChangedPath(t,s),i.callOnCompleteCallback(r,e,n)});var l=this.Ai(t);this.ji(l),this.Ei.raiseEventsForChangedPath(l,[])},t.prototype.update=function(t,e,n){var r=this;this.X("update",{path:""+t,value:e});var i=!0,o=this.generateServerValues(),s={};if(Object(Ar.f)(e,function(t,e){i=!1;var n=a(e);s[t]=Ne(n,o)}),i)Object(Fr.s)("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var u=this.Fi(),c=this.Di.applyUserMerge(t,s,u);this.Ei.queueEvents(c),this.En.merge(""+t,e,function(e,i){var o="ok"===e;o||Object(Fr.B)("update at "+t+" failed: "+e);var s=r.Di.ackUserWrite(u,!o),a=s.length>0?r.ji(t):t;r.Ei.raiseEventsForChangedPath(a,s),r.callOnCompleteCallback(n,e,i)}),Object(Ar.f)(e,function(e){var n=r.Ai(t.child(e));r.ji(n)}),this.Ei.raiseEventsForChangedPath(t,[])}},t.prototype.ki=function(){var t=this;this.X("onDisconnectEvents");var e=this.generateServerValues(),n=Te(this.An,e),r=[];n.forEachTree(v.Empty,function(e,n){r=r.concat(t.Di.applyServerOverwrite(e,n));var i=t.Ai(e);t.ji(i)}),this.An=new Ce,this.Ei.raiseEventsForChangedPath(v.Empty,r)},t.prototype.onDisconnectCancel=function(t,e){var n=this;this.En.onDisconnectCancel(""+t,function(r,i){"ok"===r&&n.An.forget(t),n.callOnCompleteCallback(e,r,i)})},t.prototype.onDisconnectSet=function(t,e,n){var r=this,i=a(e);this.En.onDisconnectPut(""+t,i.val(!0),function(e,o){"ok"===e&&r.An.remember(t,i),r.callOnCompleteCallback(n,e,o)})},t.prototype.onDisconnectSetWithPriority=function(t,e,n,r){var i=this,o=a(e,n);this.En.onDisconnectPut(""+t,o.val(!0),function(e,n){"ok"===e&&i.An.remember(t,o),i.callOnCompleteCallback(r,e,n)})},t.prototype.onDisconnectUpdate=function(t,e,n){var r=this;if(Object(Ar.j)(e))return Object(Fr.s)("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(n,"ok");this.En.onDisconnectMerge(""+t,e,function(i,o){"ok"===i&&Object(Ar.f)(e,function(e,n){var i=a(n);r.An.remember(t.child(e),i)}),r.callOnCompleteCallback(n,i,o)})},t.prototype.addEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.Pi.addEventRegistration(t,e):this.Di.addEventRegistration(t,e),this.Ei.raiseEventsAtPath(t.path,n)},t.prototype.removeEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.Pi.removeEventRegistration(t,e):this.Di.removeEventRegistration(t,e),this.Ei.raiseEventsAtPath(t.path,n)},t.prototype.interrupt=function(){this.Si&&this.Si.interrupt("repo_interrupt")},t.prototype.resume=function(){this.Si&&this.Si.resume("repo_interrupt")},t.prototype.stats=function(t){if(void 0===t&&(t=!1),"undefined"!=typeof console){var e;t?(this.On||(this.On=new Sn(this.$)),e=this.On.get()):e=this.$.get();var n=Object.keys(e).reduce(function(t,e){return Math.max(e.length,t)},0);Object(Ar.f)(e,function(t,e){for(var r=t.length;r=0)return null!=i&&i.trackChildChange(Be.childChangedChange(e,n,l)),a.updateImmediateChild(e,n);null!=i&&i.trackChildChange(Be.childRemovedChange(e,l));var f=a.updateImmediateChild(e,Vt.EMPTY_NODE);return null!=p&&this.Vi.matches(p)?(null!=i&&i.trackChildChange(Be.childAddedChange(p.name,p.node)),f.updateImmediateChild(p.name,p.node)):f}return n.isEmpty()?t:h&&o(c,u)>=0?(null!=i&&(i.trackChildChange(Be.childRemovedChange(c.name,c.node)),i.trackChildChange(Be.childAddedChange(e,n))),a.updateImmediateChild(e,n).updateImmediateChild(c.name,Vt.EMPTY_NODE)):t},t}(),Vr=n(0),Br=n(1),Hr=n(3),Kr=function(){function t(){this.Yi=!1,this.zi=!1,this.Gi=!1,this.Xi=!1,this.$i=!1,this.Bi=0,this.Ji="",this.Zi=null,this.to="",this.eo=null,this.no="",this.Xt=Nt}return t.prototype.hasStart=function(){return this.zi},t.prototype.isViewFromLeft=function(){return""===this.Ji?this.zi:this.Ji===t.ro.VIEW_FROM_LEFT},t.prototype.getIndexStartValue=function(){return Object(Vr.a)(this.zi,"Only valid if start has been set"),this.Zi},t.prototype.getIndexStartName=function(){return Object(Vr.a)(this.zi,"Only valid if start has been set"),this.Gi?this.to:Br.c},t.prototype.hasEnd=function(){return this.Xi},t.prototype.getIndexEndValue=function(){return Object(Vr.a)(this.Xi,"Only valid if end has been set"),this.eo},t.prototype.getIndexEndName=function(){return Object(Vr.a)(this.Xi,"Only valid if end has been set"),this.$i?this.no:Br.b},t.prototype.hasLimit=function(){return this.Yi},t.prototype.hasAnchoredLimit=function(){return this.Yi&&""!==this.Ji},t.prototype.getLimit=function(){return Object(Vr.a)(this.Yi,"Only valid if limit has been set"),this.Bi},t.prototype.getIndex=function(){return this.Xt},t.prototype.io=function(){var e=new t;return e.Yi=this.Yi,e.Bi=this.Bi,e.zi=this.zi,e.Zi=this.Zi,e.Gi=this.Gi,e.to=this.to,e.Xi=this.Xi,e.eo=this.eo,e.$i=this.$i,e.no=this.no,e.Xt=this.Xt,e.Ji=this.Ji,e},t.prototype.limit=function(t){var e=this.io();return e.Yi=!0,e.Bi=t,e.Ji="",e},t.prototype.limitToFirst=function(e){var n=this.io();return n.Yi=!0,n.Bi=e,n.Ji=t.ro.VIEW_FROM_LEFT,n},t.prototype.limitToLast=function(e){var n=this.io();return n.Yi=!0,n.Bi=e,n.Ji=t.ro.VIEW_FROM_RIGHT,n},t.prototype.startAt=function(t,e){var n=this.io();return n.zi=!0,void 0===t&&(t=null),n.Zi=t,null!=e?(n.Gi=!0,n.to=e):(n.Gi=!1,n.to=""),n},t.prototype.endAt=function(t,e){var n=this.io();return n.Xi=!0,void 0===t&&(t=null),n.eo=t,void 0!==e?(n.$i=!0,n.no=e):(n.$i=!1,n.no=""),n},t.prototype.orderBy=function(t){var e=this.io();return e.Xt=t,e},t.prototype.getQueryObject=function(){var e=t.ro,n={};if(this.zi&&(n[e.INDEX_START_VALUE]=this.Zi,this.Gi&&(n[e.INDEX_START_NAME]=this.to)),this.Xi&&(n[e.INDEX_END_VALUE]=this.eo,this.$i&&(n[e.INDEX_END_NAME]=this.no)),this.Yi){n[e.LIMIT]=this.Bi;var r=this.Ji;""===r&&(r=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),n[e.VIEW_FROM]=r}return this.Xt!==Nt&&(n[e.INDEX]=""+this.Xt),n},t.prototype.loadsAllData=function(){return!(this.zi||this.Xi||this.Yi)},t.prototype.isDefault=function(){return this.loadsAllData()&&this.Xt==Nt},t.prototype.getNodeFilter=function(){return this.loadsAllData()?new Ke(this.getIndex()):this.hasLimit()?new Ur(this):new qr(this)},t.prototype.toRestQueryStringParameters=function(){var e=t.oo,n={};if(this.isDefault())return n;var r;return this.Xt===Nt?r=e.PRIORITY_INDEX:this.Xt===ee?r=e.VALUE_INDEX:this.Xt===dt?r=e.KEY_INDEX:(Object(Vr.a)(this.Xt instanceof oe,"Unrecognized index type!"),r=""+this.Xt),n[e.ORDER_BY]=Object(Hr.b)(r),this.zi&&(n[e.START_AT]=Object(Hr.b)(this.Zi),this.Gi&&(n[e.START_AT]+=","+Object(Hr.b)(this.to))),this.Xi&&(n[e.END_AT]=Object(Hr.b)(this.eo),this.$i&&(n[e.END_AT]+=","+Object(Hr.b)(this.no))),this.Yi&&(this.isViewFromLeft()?n[e.LIMIT_TO_FIRST]=this.Bi:n[e.LIMIT_TO_LAST]=this.Bi),n},t.ro={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},t.oo={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},t.DEFAULT=new t,t}(),Yr=n(1),zr=n(4),Gr=this&&this.I||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Xr=function(t){function e(e,n){if(!(e instanceof Wr))throw Error("new Reference() no longer supported - use app.database().");return t.call(this,e,n,Kr.DEFAULT,!1)||this}return Gr(e,t),e.prototype.getKey=function(){return P("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},e.prototype.child=function(t){return P("Reference.child",1,1,arguments.length),"number"==typeof t?t+="":t instanceof v||(null===this.path.getFront()?X("Reference.child",1,t,!1):G("Reference.child",1,t,!1)),new e(this.repo,this.path.child(t))},e.prototype.getParent=function(){P("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new e(this.repo,t)},e.prototype.getRoot=function(){P("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},e.prototype.databaseProp=function(){return this.repo.database},e.prototype.set=function(t,e){P("Reference.set",1,2,arguments.length),$("Reference.set",this.path),U("Reference.set",1,t,this.path,!1),R("Reference.set",2,e,!0);var n=new zr.a;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},e.prototype.update=function(t,e){if(P("Reference.update",1,2,arguments.length),$("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r0},t.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},t.prototype.forEachChild=function(e){var n=this;Object(Zr.f)(this.zt.children,function(r,i){e(new t(r,n,i))})},t.prototype.forEachDescendant=function(t,e,n){e&&!n&&t(this),this.forEachChild(function(e){e.forEachDescendant(t,!0,n)}),e&&n&&t(this)},t.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},t.prototype.forEachImmediateDescendantWithValue=function(t){this.forEachChild(function(e){null!==e.getValue()?t(e):e.forEachImmediateDescendantWithValue(t)})},t.prototype.path=function(){return new v(null===this.ao?this.so:this.ao.path()+"/"+this.so)},t.prototype.name=function(){return this.so},t.prototype.parent=function(){return this.ao},t.prototype.uo=function(){null!==this.ao&&this.ao.co(this.so,this)},t.prototype.co=function(t,e){var n=e.isEmpty(),r=Object(Zr.b)(this.zt.children,t);n&&r?(delete this.zt.children[t],this.zt.childCount--,this.uo()):n||r||(this.zt.children[t]=e.zt,this.zt.childCount++,this.uo())},t}(),ni=n(0),ri=n(1),ii=n(2),oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t){t[t.RUN=0]="RUN",t[t.SENT=1]="SENT",t[t.COMPLETED=2]="COMPLETED",t[t.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",t[t.NEEDS_ABORT=4]="NEEDS_ABORT"}($r||($r={})),Wr.ho=25,Wr.prototype.Ni=function(){this.lo=new ei},Wr.prototype.startTransaction=function(t,e,n,r){this.X("transaction on "+t);var i=function(){},o=new Xr(this,t);o.on("value",i);var s=function(){o.off("value",i)},u={path:t,update:e,onComplete:n,status:null,order:Object(ri.a)(),applyLocally:r,retryCount:0,unwatcher:s,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},c=this.po(t);u.currentInputSnapshot=c;var h=u.update(c.val());if(void 0===h){if(u.unwatcher(),u.currentOutputSnapshotRaw=null,u.currentOutputSnapshotResolved=null,u.onComplete){var l=new se(u.currentInputSnapshot,new Xr(this,u.path),Nt);u.onComplete(null,!1,l)}}else{V("transaction failed: Data returned ",h,u.path),u.status=$r.RUN;var p=this.lo.subTree(t),d=p.getValue()||[];d.push(u),p.setValue(d);var f=void 0;"object"===(void 0===h?"undefined":oi(h))&&null!==h&&Object(ii.b)(h,".priority")?(f=Object(ii.l)(h,".priority"),Object(ni.a)(Q(f),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):f=(this.Di.calcCompleteEventCache(t)||Vt.EMPTY_NODE).getPriority().val(),f=f;var _=this.generateServerValues(),y=a(h,f),v=Ne(y,_);u.currentOutputSnapshotRaw=y,u.currentOutputSnapshotResolved=v,u.currentWriteId=this.Fi();var g=this.Di.applyUserOverwrite(t,v,u.currentWriteId,u.applyLocally);this.Ei.raiseEventsForChangedPath(t,g),this.do()}},Wr.prototype.po=function(t,e){return this.Di.calcCompleteEventCache(t,e)||Vt.EMPTY_NODE},Wr.prototype.do=function(t){var e=this;if(void 0===t&&(t=this.lo),t||this.fo(t),null!==t.getValue()){var n=this._o(t);Object(ni.a)(n.length>0,"Sending zero length transaction queue"),n.every(function(t){return t.status===$r.RUN})&&this.yo(t.path(),n)}else t.hasChildren()&&t.forEachChild(function(t){e.do(t)})},Wr.prototype.yo=function(t,e){for(var n=this,r=e.map(function(t){return t.currentWriteId}),i=this.po(t,r),o=i,s=i.hash(),a=0;a=Wr.ho)h=!0,l="maxretry",r=r.concat(this.Di.ackUserWrite(u.currentWriteId,!0));else{var p=this.po(u.path,o);u.currentInputSnapshot=p;var d=t[s].update(p.val());if(void 0!==d){V("transaction failed: Data returned ",d,u.path);var f=a(d),_="object"===(void 0===d?"undefined":oi(d))&&null!=d&&Object(ii.b)(d,".priority");_||(f=f.updatePriority(p.getPriority()));var y=u.currentWriteId,g=this.generateServerValues(),m=Ne(f,g);u.currentOutputSnapshotRaw=f,u.currentOutputSnapshotResolved=m,u.currentWriteId=this.Fi(),o.splice(o.indexOf(y),1),r=r.concat(this.Di.applyUserOverwrite(u.path,m,u.currentWriteId,u.applyLocally)),r=r.concat(this.Di.ackUserWrite(y,!0))}else h=!0,l="nodata",r=r.concat(this.Di.ackUserWrite(u.currentWriteId,!0))}if(this.Ei.raiseEventsForChangedPath(e,r),r=[],h&&(t[s].status=$r.COMPLETED,function(t){setTimeout(t,Math.floor(0))}(t[s].unwatcher),t[s].onComplete))if("nodata"===l){var b=new Xr(this,t[s].path),C=t[s].currentInputSnapshot,E=new se(C,b,Nt);n.push(t[s].onComplete.bind(null,null,!1,E))}else n.push(t[s].onComplete.bind(null,Error(l),!1,null))}this.fo(this.lo);for(var s=0;s0?n:null)}t.forEachChild(function(t){e.fo(t)})},Wr.prototype.Ai=function(t){var e=this,n=this.vo(t).path(),r=this.lo.subTree(t);return r.forEachAncestor(function(t){e.bo(t)}),this.bo(r),r.forEachDescendant(function(t){e.bo(t)}),n},Wr.prototype.bo=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o>6,128|63&r);else if(55296==(64512&r)){var o=n>18,128|r>>12&63,128|r>>6&63,128|63&r)}else e.push(239,191,189)}else 56320==(64512&r)?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(e)}function T(t){var e;try{e=decodeURIComponent(t)}catch(t){throw g(ee.DATA_URL,"Malformed data URL.")}return U(e)}function A(t,e){switch(t){case ee.BASE64:var n=-1!==e.indexOf("-"),r=-1!==e.indexOf("_");if(n||r){var o=n?"-":"_";throw g(t,"Invalid character '"+o+"' found: is it base64url encoded?")}break;case ee.BASE64URL:var i=-1!==e.indexOf("+"),a=-1!==e.indexOf("/");if(i||a){var o=i?"+":"/";throw g(t,"Invalid character '"+o+"' found: is it base64 encoded?")}e=e.replace(/-/g,"+").replace(/_/g,"/")}var u;try{u=atob(e)}catch(e){throw g(t,"Invalid character found")}for(var s=new Uint8Array(u.length),c=0;c=e.length)&&t.substring(t.length-e.length)===e}function S(t){switch(t){case ie.RUNNING:case ie.PAUSING:case ie.CANCELING:return ae.RUNNING;case ie.PAUSED:return ae.PAUSED;case ie.SUCCESS:return ae.SUCCESS;case ie.CANCELED:return ae.CANCELED;case ie.ERROR:default:return ae.ERROR}}function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function I(t,e){for(var n in t)k(t,n)&&e(n,t[n])}function L(t){if(null==t)return{};var e={};return I(t,function(t,n){e[t]=n}),e}function x(t){return new ue.b(t)}function P(t){return ue.b.resolve(t)}function D(t){return ue.b.reject(t)}function M(t){return null!=t}function W(t){return void 0!==t}function B(t){return"function"==typeof t}function G(t){return"object"===(void 0===t?"undefined":se(t))}function j(t){return G(t)&&null!==t}function q(t){return G(t)&&!Array.isArray(t)}function F(t){return"string"==typeof t||t instanceof String}function H(t){return"number"==typeof t||t instanceof Number}function z(t){return X()&&t instanceof Blob}function X(){return"undefined"!=typeof Blob}function V(t){var e;try{e=JSON.parse(t)}catch(t){return null}return q(e)?e:null}function K(t){if(0==t.length)return null;var e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}function Z(t,e){var n=e.split("/").filter(function(t){return t.length>0}).join("/");return 0===t.length?n:t+"/"+n}function J(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function Q(t){return Xt+Kt+t}function Y(t){return Vt+Kt+t}function $(t){return Xt+Zt+t}function tt(t){var e=encodeURIComponent,n="?";return I(t,function(t,r){var o=e(t)+"="+e(r);n=n+o+"&"}),n=n.slice(0,-1)}function et(t,e){return e}function nt(t){return!F(t)||t.length<2?t:(t=t,J(t))}function rt(){function t(t,e){return nt(e)}function e(t,e){return M(e)?+e:e}function n(t,e){if(!(F(e)&&e.length>0))return[];var n=encodeURIComponent;return e.split(",").map(function(e){var r=t.bucket,o=t.fullPath;return Y("/b/"+n(r)+"/o/"+n(o))+tt({alt:"media",token:e})})}if(fe)return fe;var r=[];r.push(new he("bucket")),r.push(new he("generation")),r.push(new he("metageneration")),r.push(new he("name","fullPath",!0));var o=new he("name");o.xform=t,r.push(o);var i=new he("size");return i.xform=e,r.push(i),r.push(new he("timeCreated")),r.push(new he("updated")),r.push(new he("md5Hash",null,!0)),r.push(new he("cacheControl",null,!0)),r.push(new he("contentDisposition",null,!0)),r.push(new he("contentEncoding",null,!0)),r.push(new he("contentLanguage",null,!0)),r.push(new he("contentType",null,!0)),r.push(new he("metadata","customMetadata",!0)),r.push(new he("downloadTokens","downloadURLs",!1,n)),fe=r}function ot(t,e){function n(){var n=t.bucket,r=t.fullPath,o=new pe(n,r);return e.makeStorageReference(o)}Object.defineProperty(t,"ref",{get:n})}function it(t,e,n){var r={};r.type="file";for(var o=n.length,i=0;i=0))throw"Expected a number 0 or greater."}return new de(t)}function _t(t,e){function n(e){if(!(null===e||M(e)&&e instanceof Object))throw"Expected an Object.";void 0!==t&&null!==t&&t(e)}return new de(n,e)}function vt(t){function e(t){if(null!==t&&!B(t))throw"Expected a Function."}return new de(e,t)}function bt(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function mt(){for(var t=[],e=0;e0&&(p=Math.min(p,o));var h=c.current,_=h+p,v=p===l?"upload, finalize":"upload",b={"X-Goog-Upload-Command":v,"X-Goog-Upload-Offset":c.current},m=r.slice(h,_);if(null===m)throw f();var y=e.maxUploadRetryTime(),g=new ve(n,"POST",s,y);return g.headers=b,g.body=m.uploadData(),g.progressCallback=u||null,g.errorHandler=Tt(t),g}function Mt(t){return function(){for(var e=[],n=0;n0&&(t.Authorization="Firebase "+e)}function jt(t){var e="undefined"!=typeof firebase?firebase.SDK_VERSION:"AppManager";t["X-Firebase-Storage-Version"]="webjs/"+e}function qt(t,e,n){var r=tt(t.urlParams),o=t.url+r,i=L(t.headers);return Gt(i,e),jt(i),new Te(o,t.method,i,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,n)}function Ft(t,e,n){return new Ne(t,new le,n)}function Ht(t){var e={TaskState:ae,TaskEvent:oe,StringFormat:ee,Storage:Ne,Reference:Re};t.INTERNAL.registerService(Ce,Ft,e,void 0,!0)}Object.defineProperty(e,"__esModule",{value:!0});var zt,Xt="https://firebasestorage.googleapis.com",Vt="https://firebasestorage.googleapis.com",Kt="/v0",Zt="/v0",Jt=12e4,Qt=6e4,Yt=-9007199254740991,$t=function(){function t(t,e){this.t=r(t),this.e="Firebase Storage: "+e,this.n=null,this.r="FirebaseError"}return t.prototype.codeProp=function(){return this.code},t.prototype.codeEquals=function(t){return r(t)===this.codeProp()},t.prototype.serverResponseProp=function(){return this.n},t.prototype.setServerResponseProp=function(t){this.n=t},Object.defineProperty(t.prototype,"name",{get:function(){return this.r},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"code",{get:function(){return this.t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"message",{get:function(){return this.e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"serverResponse",{get:function(){return this.n},enumerable:!0,configurable:!0}),t}(),te={UNKNOWN:"unknown",OBJECT_NOT_FOUND:"object-not-found",BUCKET_NOT_FOUND:"bucket-not-found",PROJECT_NOT_FOUND:"project-not-found",QUOTA_EXCEEDED:"quota-exceeded",UNAUTHENTICATED:"unauthenticated",UNAUTHORIZED:"unauthorized",RETRY_LIMIT_EXCEEDED:"retry-limit-exceeded",INVALID_CHECKSUM:"invalid-checksum",CANCELED:"canceled",INVALID_EVENT_NAME:"invalid-event-name",INVALID_URL:"invalid-url",INVALID_DEFAULT_BUCKET:"invalid-default-bucket",NO_DEFAULT_BUCKET:"no-default-bucket",CANNOT_SLICE_BLOB:"cannot-slice-blob",SERVER_FILE_WRONG_SIZE:"server-file-wrong-size",NO_DOWNLOAD_URL:"no-download-url",INVALID_ARGUMENT:"invalid-argument",INVALID_ARGUMENT_COUNT:"invalid-argument-count",APP_DELETED:"app-deleted",INVALID_ROOT_OPERATION:"invalid-root-operation",INVALID_FORMAT:"invalid-format",INTERNAL_ERROR:"internal-error"},ee={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},ne=function(){function t(t,e){this.data=t,this.contentType=e||null}return t}(),re=function(){function t(t){this.base64=!1,this.contentType=null;var e=t.match(/^data:([^,]+)?,/);if(null===e)throw g(ee.DATA_URL,"Must be formatted 'data:[][;base64],");var n=e[1]||null;null!=n&&(this.base64=C(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-7):n),this.rest=t.substring(t.indexOf(",")+1)}return t}(),oe={STATE_CHANGED:"state_changed"},ie={RUNNING:"running",PAUSING:"pausing",PAUSED:"paused",SUCCESS:"success",CANCELING:"canceling",CANCELED:"canceled",ERROR:"error"},ae={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"},ue=n(4),se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(zt||(zt={}));var ce=function(){function t(){var t=this;this.o=!1,this.i=new XMLHttpRequest,this.a=zt.NO_ERROR,this.u=x(function(e,n){t.i.addEventListener("abort",function(n){t.a=zt.ABORT,e(t)}),t.i.addEventListener("error",function(n){t.a=zt.NETWORK_ERROR,e(t)}),t.i.addEventListener("load",function(n){e(t)})})}return t.prototype.send=function(t,e,n,r){var o=this;if(this.o)throw R("cannot .send() more than once");return this.o=!0,this.i.open(e,t,!0),M(r)&&I(r,function(t,e){o.i.setRequestHeader(t,""+e)}),M(n)?this.i.send(n):this.i.send(),this.u},t.prototype.getErrorCode=function(){if(!this.o)throw R("cannot .getErrorCode() before sending");return this.a},t.prototype.getStatus=function(){if(!this.o)throw R("cannot .getStatus() before sending");try{return this.i.status}catch(t){return-1}},t.prototype.getResponseText=function(){if(!this.o)throw R("cannot .getResponseText() before sending");return this.i.responseText},t.prototype.abort=function(){this.i.abort()},t.prototype.getResponseHeader=function(t){return this.i.getResponseHeader(t)},t.prototype.addUploadProgressListener=function(t){M(this.i.upload)&&this.i.upload.addEventListener("progress",t)},t.prototype.removeUploadProgressListener=function(t){M(this.i.upload)&&this.i.upload.removeEventListener("progress",t)},t}(),le=function(){function t(){}return t.prototype.createXhrIo=function(){return new ce},t}(),pe=function(){function t(t,e){this.bucket=t,this.s=e}return Object.defineProperty(t.prototype,"path",{get:function(){return this.s},enumerable:!0,configurable:!0}),t.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},t.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},t.makeFromBucketSpec=function(e){var n;try{n=t.makeFromUrl(e)}catch(n){return new t(e,"")}if(""===n.path)return n;throw h(e)},t.makeFromUrl=function(e){function n(t){"/"===t.path.charAt(t.path.length-1)&&(t.s=t.s.slice(0,-1))}function r(t){t.s=decodeURIComponent(t.path)}for(var o=null,i=RegExp("^gs://([A-Za-z0-9.\\-]+)(/(.*))?$","i"),a={bucket:1,path:3},u=RegExp("^https?://firebasestorage\\.googleapis\\.com/v[A-Za-z0-9_]+/b/([A-Za-z0-9.\\-]+)/o(/([^?#]*).*)?$","i"),s={bucket:1,path:3},c=[{regex:i,indices:a,postModify:n},{regex:u,indices:s,postModify:r}],l=0;l262144},t.prototype.W=function(){this.I===ie.RUNNING&&null===this.y&&(this.S?null===this.m?this.j():this.f?this.q():this.d?this.F():this.H():this.z())},t.prototype.X=function(t){var e=this;this.T.getAuthToken().then(function(n){switch(e.I){case ie.RUNNING:t(n);break;case ie.CANCELING:e.P(ie.CANCELED);break;case ie.PAUSING:e.P(ie.PAUSED)}})},t.prototype.j=function(){var t=this;this.X(function(e){var n=xt(t.T,t.A,t.C,t.N,t.O),r=t.T.makeRequest(n,e);t.y=r,r.getPromise().then(function(e){t.y=null,t.m=e,t.f=!1,t.x()},t.L)})},t.prototype.q=function(){var t=this,e=this.m;this.X(function(n){var r=Pt(t.T,t.A,e,t.N),o=t.T.makeRequest(r,n);t.y=o,o.getPromise().then(function(e){e=e,t.y=null,t.G(e.current),t.f=!1,e.finalized&&(t.d=!0),t.x()},t.L)})},t.prototype.H=function(){var t=this,e=262144*this.g,n=new be(this.h,this.N.size()),r=this.m;this.X(function(o){var i;try{i=Dt(t.A,t.T,r,t.N,e,t.C,n,t.B())}catch(e){return t.v=e,void t.P(ie.ERROR)}var a=t.T.makeRequest(i,o);t.y=a,a.getPromise().then(function(e){t.V(),t.y=null,t.G(e.current),e.finalized?(t.O=e.metadata,t.P(ie.SUCCESS)):t.x()},t.L)})},t.prototype.V=function(){262144*this.g<33554432&&(this.g*=2)},t.prototype.F=function(){var t=this;this.X(function(e){var n=Nt(t.T,t.A,t.C),r=t.T.makeRequest(n,e);t.y=r,r.getPromise().then(function(e){t.y=null,t.O=e,t.P(ie.SUCCESS)},t.D)})},t.prototype.z=function(){var t=this;this.X(function(e){var n=It(t.T,t.A,t.C,t.N,t.O),r=t.T.makeRequest(n,e);t.y=r,r.getPromise().then(function(e){t.y=null,t.O=e,t.G(t.N.size()),t.P(ie.SUCCESS)},t.L)})},t.prototype.G=function(t){var e=this.h;this.h=t,this.h!==e&&this.K()},t.prototype.P=function(t){if(this.I!==t)switch(t){case ie.CANCELING:case ie.PAUSING:this.I=t,null!==this.y&&this.y.cancel();break;case ie.RUNNING:var e=this.I===ie.PAUSED;this.I=t,e&&(this.K(),this.W());break;case ie.PAUSED:this.I=t,this.K();break;case ie.CANCELED:this.v=l(),this.I=t,this.K();break;case ie.ERROR:case ie.SUCCESS:this.I=t,this.K()}},t.prototype.x=function(){switch(this.I){case ie.PAUSING:this.P(ie.PAUSED);break;case ie.CANCELING:this.P(ie.CANCELED);break;case ie.RUNNING:this.W()}},Object.defineProperty(t.prototype,"snapshot",{get:function(){var t=S(this.I);return new ye(this.h,this.N.size(),t,this.O,this,this.U)},enumerable:!0,configurable:!0}),t.prototype.on=function(t,e,n,r){function o(e){if(t!==oe.STATE_CHANGED)throw"Expected one of the event types: ["+oe.STATE_CHANGED+"]."}function i(t){try{return void c(t)}catch(t){}try{if(l(t),!(W(t.next)||W(t.error)||W(t.complete)))throw"";return}catch(t){throw s}}function a(t){function e(e,n,o){null!==t&&ct("on",t,arguments);var i=new me(e,n,r);return p.Z(i),function(){p.J(i)}}return e}function u(t){if(null===t)throw s;i(t)}void 0===e&&(e=void 0),void 0===n&&(n=void 0),void 0===r&&(r=void 0);var s="Expected a function or an Object with one of `next`, `error`, `complete` properties.",c=vt(!0).validator,l=_t(null,!0).validator;ct("on",[pt(o),_t(i,!0),vt(!0),vt(!0)],arguments);var p=this,h=[_t(u),vt(!0),vt(!0)];return W(e)||W(n)||W(r)?a(null)(e,n,r):a(h)},t.prototype.then=function(t,e){return this.M.then(t,e)},t.prototype.catch=function(t){return this.then(null,t)},t.prototype.Z=function(t){this._.push(t),this.Q(t)},t.prototype.J=function(t){Et(this._,t)},t.prototype.K=function(){var t=this;this.Y(),Rt(this._).forEach(function(e){t.Q(e)})},t.prototype.Y=function(){if(null!==this.R){var t=!0;switch(S(this.I)){case ae.SUCCESS:Mt(this.R.bind(null,this.snapshot))();break;case ae.CANCELED:case ae.ERROR:Mt(this.w.bind(null,this.v))();break;default:t=!1}t&&(this.R=null,this.w=null)}},t.prototype.Q=function(t){switch(S(this.I)){case ae.RUNNING:case ae.PAUSED:null!==t.next&&Mt(t.next.bind(t,this.snapshot))();break;case ae.SUCCESS:null!==t.complete&&Mt(t.complete.bind(t))();break;case ae.CANCELED:case ae.ERROR:null!==t.error&&Mt(t.error.bind(t,this.v))();break;default:null!==t.error&&Mt(t.error.bind(t,this.v))()}},t.prototype.resume=function(){ct("resume",[],arguments);var t=this.I===ie.PAUSED||this.I===ie.PAUSING;return t&&this.P(ie.RUNNING),t},t.prototype.pause=function(){ct("pause",[],arguments);var t=this.I===ie.RUNNING;return t&&this.P(ie.PAUSING),t},t.prototype.cancel=function(){ct("cancel",[],arguments);var t=this.I===ie.RUNNING||this.I===ie.PAUSING;return t&&this.P(ie.CANCELING),t},t}(),Re=function(){function t(t,e){this.authWrapper=t,this.location=e instanceof pe?e:pe.makeFromUrl(e)}return t.prototype.toString=function(){return ct("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},t.prototype.newRef=function(e,n){return new t(e,n)},t.prototype.mappings=function(){return rt()},t.prototype.child=function(t){ct("child",[pt()],arguments);var e=Z(this.location.path,t),n=new pe(this.location.bucket,e);return this.newRef(this.authWrapper,n)},Object.defineProperty(t.prototype,"parent",{get:function(){var t=K(this.location.path);if(null===t)return null;var e=new pe(this.location.bucket,t);return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){var t=new pe(this.location.bucket,"");return this.newRef(this.authWrapper,t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return J(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),t.prototype.put=function(t,e){return void 0===e&&(e=null),ct("put",[ht(),ft(!0)],arguments),this.$("put"),new ge(this,this.authWrapper,this.location,this.mappings(),new _e(t),e)},t.prototype.putString=function(t,e,n){void 0===e&&(e=ee.RAW),ct("putString",[pt(),pt(E,!0),ft(!0)],arguments),this.$("putString");var r=w(e,t),o=L(n);return!M(o.contentType)&&M(r.contentType)&&(o.contentType=r.contentType),new ge(this,this.authWrapper,this.location,this.mappings(),new _e(r.data,!0),o)},t.prototype.delete=function(){ct("delete",[],arguments),this.$("delete");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=Ct(t.authWrapper,t.location);return t.authWrapper.makeRequest(n,e).getPromise()})},t.prototype.getMetadata=function(){ct("getMetadata",[],arguments),this.$("getMetadata");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=Nt(t.authWrapper,t.location,t.mappings());return t.authWrapper.makeRequest(n,e).getPromise()})},t.prototype.updateMetadata=function(t){ct("updateMetadata",[ft()],arguments),this.$("updateMetadata");var e=this;return this.authWrapper.getAuthToken().then(function(n){var r=Ot(e.authWrapper,e.location,t,e.mappings());return e.authWrapper.makeRequest(r,n).getPromise()})},t.prototype.getDownloadURL=function(){return ct("getDownloadURL",[],arguments),this.$("getDownloadURL"),this.getMetadata().then(function(t){var e=t.downloadURLs[0];if(M(e))return e;throw _()})},t.prototype.$=function(t){if(""===this.location.path)throw y(t)},t}(),Ee=function(){function t(t){this.M=D(t)}return t.prototype.getPromise=function(){return this.M},t.prototype.cancel=function(t){void 0===t&&(t=!1)},t}(),we=function(){function t(){this.tt={},this.et=Yt}return t.prototype.addRequest=function(t){function e(){delete r.tt[n]}var n=this.et;this.et++,this.tt[n]=t;var r=this;t.getPromise().then(e,e)},t.prototype.clear=function(){I(this.tt,function(t,e){e&&e.cancel(!0)}),this.tt={}},t}(),Ue=function(){function t(e,n,r,o,i){if(this.nt=null,this.rt=!1,this.ot=e,null!==this.ot){var a=this.ot.options;M(a)&&(this.nt=t.it(a))}this.ut=n,this.st=r,this.ct=i,this.lt=o,this.pt=Jt,this.ht=Qt,this.ft=new we}return t.it=function(t){var e=t.storageBucket||null;return null==e?null:pe.makeFromBucketSpec(e).bucket},t.prototype.getAuthToken=function(){return null!==this.ot&&M(this.ot.INTERNAL)&&M(this.ot.INTERNAL.getToken)?this.ot.INTERNAL.getToken().then(function(t){return null!==t?t.accessToken:null},function(t){return null}):P(null)},t.prototype.bucket=function(){if(this.rt)throw m();return this.nt},t.prototype.service=function(){return this.lt},t.prototype.makeStorageReference=function(t){return this.ut(this,t)},t.prototype.makeRequest=function(t,e){if(this.rt)return new Ee(m());var n=this.st(t,e,this.ct);return this.ft.addRequest(n),n},t.prototype.deleteApp=function(){this.rt=!0,this.ot=null,this.ft.clear()},t.prototype.maxUploadRetryTime=function(){return this.ht},t.prototype.setMaxUploadRetryTime=function(t){this.ht=t},t.prototype.maxOperationRetryTime=function(){return this.pt},t.prototype.setMaxOperationRetryTime=function(t){this.pt=t},t}(),Te=function(){function t(t,e,n,r,o,i,a,u,s,c,l){this.dt=null,this._t=null,this.R=null,this.w=null,this.vt=!1,this.bt=!1,this.mt=t,this.yt=e,this.gt=n,this.Rt=r,this.Et=o.slice(),this.wt=i.slice(),this.Ut=a,this.Tt=u,this.At=c,this.Nt=s,this.ct=l;var p=this;this.M=x(function(t,e){p.R=t,p.w=e,p.W()})}return t.prototype.W=function(){function t(t,e){function r(t){var e=t.loaded,r=t.lengthComputable?t.total:-1;null!==n.At&&n.At(e,r)}if(e)return void t(!1,new Ae(!1,null,!0));var o=n.ct.createXhrIo();n.dt=o,null!==n.At&&o.addUploadProgressListener(r),o.send(n.mt,n.yt,n.Rt,n.gt).then(function(e){null!==n.At&&e.removeUploadProgressListener(r),n.dt=null,e=e;var o=e.getErrorCode()===zt.NO_ERROR,i=e.getStatus();if(!o||n.Ot(i)){var a=e.getErrorCode()===zt.ABORT;return void t(!1,new Ae(!1,null,a))}var u=gt(n.Et,i);t(!0,new Ae(u,e))})}function e(t,e){var r=n.R,i=n.w,a=e.xhr;if(e.wasSuccessCode)try{var u=n.Ut(a,a.getResponseText());W(u)?r(u):r()}catch(t){i(t)}else if(null!==a){var s=o();s.setServerResponseProp(a.getResponseText()),i(n.Tt?n.Tt(a,s):s)}else if(e.canceled){var s=n.bt?m():l();i(s)}else{var s=c();i(s)}}var n=this;this.vt?e(!1,new Ae(!1,null,!0)):this._t=Wt(t,e,this.Nt)},t.prototype.getPromise=function(){return this.M},t.prototype.cancel=function(t){this.vt=!0,this.bt=t||!1,null!==this._t&&Bt(this._t),null!==this.dt&&this.dt.abort()},t.prototype.Ot=function(t){var e=t>=500&&t<600,n=[408,429],r=gt(n,t),o=gt(this.wt,t);return e||r||o},t}(),Ae=function(){function t(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n}return t}(),Ne=function(){function t(t,e,n){function r(t,e){return new Re(t,e)}if(this.nt=null,this.T=new Ue(t,r,qt,this,e),this.ot=t,null!=n)this.nt=pe.makeFromBucketSpec(n);else{var o=this.T.bucket();null!=o&&(this.nt=new pe(o,""))}this.Ct=new Oe(this)}return t.prototype.ref=function(t){function e(t){if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."}if(ct("ref",[pt(e,!0)],arguments),null==this.nt)throw Error("No Storage Bucket defined in Firebase Options.");var n=new Re(this.T,this.nt);return null!=t?n.child(t):n},t.prototype.refFromURL=function(t){function e(t){if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{pe.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}}return ct("refFromURL",[pt(e,!1)],arguments),new Re(this.T,t)},Object.defineProperty(t.prototype,"maxUploadRetryTime",{get:function(){return this.T.maxUploadRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxUploadRetryTime=function(t){ct("setMaxUploadRetryTime",[dt()],arguments),this.T.setMaxUploadRetryTime(t)},Object.defineProperty(t.prototype,"maxOperationRetryTime",{get:function(){return this.T.maxOperationRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxOperationRetryTime=function(t){ct("setMaxOperationRetryTime",[dt()],arguments),this.T.setMaxOperationRetryTime(t)},Object.defineProperty(t.prototype,"app",{get:function(){return this.ot},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"INTERNAL",{get:function(){return this.Ct},enumerable:!0,configurable:!0}),t}(),Oe=function(){function t(t){this.lt=t}return t.prototype.delete=function(){return this.lt.T.deleteApp(),P(void 0)},t}();e.registerStorage=Ht;var Ce="storage";Ht(n(5).default)}},[23])}catch(t){throw Error("Cannot instantiate firebase-storage.js - be sure to load firebase-app.js first.")} //# sourceMappingURL=firebase.js.map