/*! * @license Firebase v4.12.0 * Build: rev-ef14d4f * Terms: https://firebase.google.com/terms/ */ var firebase=function(){var e=void 0===e?self:e;return function(t){function r(e){if(o[e])return o[e].exports;var n=o[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var n=e.webpackJsonpFirebase;e.webpackJsonpFirebase=function(e,o,a){for(var c,s,u,f=0,l=[];f=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function a(e,t){return function(r,n){t(r,n,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function s(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,c)}s((n=n.apply(e,t||[])).next())})}function u(e,t){function r(e){return function(t){return n([e,t])}}function n(r){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,i&&(a=i[2&r[0]?"return":r[0]?"throw":"next"])&&!(a=a.call(i,r[1])).done)return a;switch(i=0,a&&(r=[0,a.value]),r[0]){case 0:case 1:a=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,i=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(a=s.trys,!(a=a.length>0&&a[a.length-1])&&(6===r[0]||2===r[0])){s=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function p(){for(var e=[],t=0;t1||o(e,t)})})}function o(e,t){try{i(f[e](t))}catch(e){s(l[0][3],e)}}function i(e){e.value instanceof d?Promise.resolve(e.value.v).then(a,c):s(l[0][2],e)}function a(e){o("next",e)}function c(e){o("throw",e)}function s(e,t){e(t),l.shift(),l.length&&o(l[0][0],l[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var u,f=r.apply(e,t||[]),l=[];return u={},n("next"),n("throw"),n("return"),u[Symbol.asyncIterator]=function(){return this},u}function y(e){function t(t,o){e[t]&&(r[t]=function(r){return(n=!n)?{value:d(e[t](r)),done:"return"===t}:o?o(r):r})}var r,n;return r={},t("next"),t("throw",function(e){throw e}),t("return"),r[Symbol.iterator]=function(){return this},r}function b(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator];return t?t.call(e):"function"==typeof l?l(e):e[Symbol.iterator]()}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function m(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function g(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.__extends=n,r.d(t,"__assign",function(){return E}),t.__rest=o,t.__decorate=i,t.__param=a,t.__metadata=c,t.__awaiter=s,t.__generator=u,t.__exportStar=f,t.__values=l,t.__read=h,t.__spread=p,t.__await=d,t.__asyncGenerator=v,t.__asyncDelegator=y,t.__asyncValues=b,t.__makeTemplateObject=_,t.__importStar=m,t.__importDefault=g;/*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},E=Object.assign||function(e){for(var t,r=1,n=arguments.length;r1)for(var r=1;r>6|192,t[r++]=63&o|128):55296==(64512&o)&&n+1>18|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128,t[r++]=63&o|128):(t[r++]=o>>12|224,t[r++]=o>>6&63|128,t[r++]=63&o|128)}return t},o=function(e){for(var t=[],r=0,n=0;r191&&o<224){var i=e[r++];t[n++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){var i=e[r++],a=e[r++],c=e[r++],s=((7&o)<<18|(63&i)<<12|(63&a)<<6|63&c)-65536;t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))}else{var i=e[r++],a=e[r++];t[n++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&a)}}return t.join("")};t.base64={y:null,b:null,_:null,g:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.O();for(var r=t?this._:this.y,n=[],o=0;o>2,l=(3&i)<<4|c>>4,h=(15&c)<<2|u>>6,p=63&u;s||(p=64,a||(h=64)),n.push(r[f],r[l],r[h],r[p])}return n.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):o(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.O();for(var r=t?this.g:this.b,n=[],o=0;o>4;if(n.push(h),64!=u){var p=c<<4&240|u>>2;if(n.push(p),64!=l){var d=u<<6&192|l;n.push(d)}}}return n},O:function(){if(!this.y){this.y={},this.b={},this._={},this.g={};for(var e=0;e=this.ENCODED_VALS_BASE.length&&(this.b[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.g[this.ENCODED_VALS.charAt(e)]=e)}}},t.base64Encode=function(e){var r=n(e);return t.base64.encodeByteArray(r,!0)},t.base64Decode=function(e){try{return t.base64.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}},function(e,t,r){"use strict";function n(e){return JSON.parse(e)}function o(e){return JSON.stringify(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.jsonEval=n,t.stringify=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.safeGet=function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]},t.forEach=function(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(r,e[r])},t.extend=function(e,r){return t.forEach(r,function(t,r){e[t]=r}),e},t.clone=function(e){return t.extend({},e)},t.isNonNullObject=function(e){return"object"==typeof e&&null!==e},t.isEmpty=function(e){for(var t in e)return!1;return!0},t.getCount=function(e){var t=0;for(var r in e)t++;return t},t.map=function(e,t,r){var n={};for(var o in e)n[o]=t.call(r,e[o],o,e);return n},t.findKey=function(e,t,r){for(var n in e)if(t.call(r,e[n],n,e))return n},t.findValue=function(e,r,n){var o=t.findKey(e,r,n);return o&&e[o]},t.getAnyKey=function(e){for(var t in e)return t},t.getValues=function(e){var t=[],r=0;for(var n in e)t[r++]=e[n];return t},t.every=function(e,t){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&!t(r,e[r]))return!1;return!0}},,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){r(60),e.exports=r(7).default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(61),o=(r.n(n),r(65)),i=(r.n(o),r(66));r.n(i)},function(t,r,n){(function(t){var r=function(){if(void 0!==t)return t;if(void 0!==e)return e;if("undefined"!=typeof self)return self;throw Error("unable to locate global object")}();"undefined"==typeof Promise&&(r.Promise=Promise=n(62))}).call(r,n(11))},function(e,t,r){"use strict";(function(t){function r(){}function n(e,t){return function(){e.apply(t,arguments)}}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this.T=[],f(e,this)}function i(e,t){for(;3===e._state;)e=e._value;if(0===e._state)return void e.T.push(t);e._handled=!0,o.A(function(){var r=1===e._state?t.onFulfilled:t.onRejected;if(null===r)return void(1===e._state?a:c)(t.promise,e._value);var n;try{n=r(e._value)}catch(e){return void c(t.promise,e)}a(t.promise,n)})}function a(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var r=t.then;if(t instanceof o)return e._state=3,e._value=t,void s(e);if("function"==typeof r)return void f(n(r,t),e)}e._state=1,e._value=t,s(e)}catch(t){c(e,t)}}function c(e,t){e._state=2,e._value=t,s(e)}function s(e){2===e._state&&0===e.T.length&&o.A(function(){e._handled||o.S(e._value)});for(var t=0,r=e.T.length;t=0&&(e.j=setTimeout(function(){e.N&&e.N()},t))},n(64),r.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,r.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(r,n(11))},function(e,t,r){(function(e,t){!function(e,r){"use strict";function n(e){"function"!=typeof e&&(e=Function(""+e));for(var t=Array(arguments.length-1),r=0;r>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],o=0;o>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],o=0;o"}),r=this.serviceName+": "+r+" ("+o+").";var i=new a(o,r);for(var c in t)t.hasOwnProperty(c)&&"_"!==c.slice(-1)&&(i[c]=t[c]);return i},e}();t.ErrorFactory=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(31),o=r(32);t.decode=function(e){var t={},r={},i={},a="";try{var c=e.split(".");t=o.jsonEval(n.base64Decode(c[0])||""),r=o.jsonEval(n.base64Decode(c[1])||""),a=c[2],i=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:i,signature:a}},t.isValidTimestamp=function(e){var r,n,o=t.decode(e).claims,i=Math.floor((new Date).getTime()/1e3);return"object"==typeof o&&(o.hasOwnProperty("nbf")?r=o.nbf:o.hasOwnProperty("iat")&&(r=o.iat),n=o.hasOwnProperty("exp")?o.exp:r+86400),i&&r&&n&&i>=r&&i<=n},t.issuedAtTime=function(e){var r=t.decode(e).claims;return"object"==typeof r&&r.hasOwnProperty("iat")?r.iat:null},t.isValidFormat=function(e){var r=t.decode(e),n=r.claims;return!!r.signature&&!!n&&"object"==typeof n&&n.hasOwnProperty("iat")},t.isAdmin=function(e){var r=t.decode(e).claims;return"object"==typeof r&&!0===r.admin}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(33);t.querystring=function(e){var t=[];return n.forEach(e,function(e,r){Array.isArray(r)?r.forEach(function(r){t.push(encodeURIComponent(e)+"="+encodeURIComponent(r))}):t.push(encodeURIComponent(e)+"="+encodeURIComponent(r))}),t.length?"&"+t.join("&"):""},t.querystringDecode=function(e){var t={};return e.replace(/^\?/,"").split("&").forEach(function(e){if(e){var r=e.split("=");t[r[0]]=r[1]}}),t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(2),o=r(74),i=function(e){function t(){var t=e.call(this)||this;t.k=[],t.x=[],t.M=[],t.D=[],t.I=0,t.F=0,t.blockSize=64,t.D[0]=128;for(var r=1;r>>31)}for(var i,a,c=this.k[0],s=this.k[1],u=this.k[2],f=this.k[3],l=this.k[4],n=0;n<80;n++){n<40?n<20?(i=f^s&(u^f),a=1518500249):(i=s^u^f,a=1859775393):n<60?(i=s&u|f&(s|u),a=2400959708):(i=s^u^f,a=3395469782);var o=(c<<5|c>>>27)+i+l+a+r[n]&4294967295;l=f,f=u,u=4294967295&(s<<30|s>>>2),s=c,c=o}this.k[0]=this.k[0]+c&4294967295,this.k[1]=this.k[1]+s&4294967295,this.k[2]=this.k[2]+u&4294967295,this.k[3]=this.k[3]+f&4294967295,this.k[4]=this.k[4]+l&4294967295},t.prototype.update=function(e,t){if(null!=e){void 0===t&&(t=e.length);for(var r=t-this.blockSize,n=0,o=this.x,i=this.I;n=56;r--)this.x[r]=255&t,t/=256;this.R(this.x);for(var n=0,r=0;r<5;r++)for(var o=24;o>=0;o-=8)e[n]=this.k[r]>>o&255,++n;return e},t}(o.Hash);t.Sha1=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.blockSize=-1}return e}();t.Hash=n},function(e,t,r){"use strict";function n(e,t){var r=new c(e,t);return r.subscribe.bind(r)}function o(e,t){return function(){for(var r=[],n=0;n 4. Need to update it?")}var o=e+" failed: ";return o+=n+" argument "}function o(e,t,r,o){if((!o||r)&&"string"!=typeof r)throw Error(n(e,t,o)+"must be a valid firebase namespace.")}function i(e,t,r,o){if((!o||r)&&"function"!=typeof r)throw Error(n(e,t,o)+"must be a valid function.")}function a(e,t,r,o){if((!o||r)&&("object"!=typeof r||null===r))throw Error(n(e,t,o)+"must be a valid context object.")}Object.defineProperty(t,"__esModule",{value:!0}),t.validateArgCount=function(e,t,r,n){var o;if(nr&&(o=0===r?"none":"no more than "+r),o){var i=e+" failed: Was called with "+n+(1===n?" argument.":" arguments.")+" Expects "+o+".";throw Error(i)}},t.errorPrefix=n,t.validateNamespace=o,t.validateCallback=i,t.validateContextObject=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(30);t.stringToByteArray=function(e){for(var t=[],r=0,o=0;o=55296&&i<=56319){var a=i-55296;o++,n.assert(o>6|192,t[r++]=63&i|128):i<65536?(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t},t.stringLength=function(e){for(var t=0,r=0;r=55296&&n<=56319?(t+=4,r++):t+=3}return t}}])}().default; /*! * @license Firebase v4.12.0 * Build: rev-ef14d4f * Terms: https://firebase.google.com/terms/ */ try{webpackJsonpFirebase([5],{78:function(t,e,n){n(79)},79:function(t,e,n){(function(t){(function(){function t(t){return"string"==typeof t}function e(t){return"boolean"==typeof t}function i(){}function r(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function o(t){return null===t}function a(t){return"array"==r(t)}function s(t){var e=r(t);return"array"==e||"object"==e&&"number"==typeof t.length}function u(t){return"function"==r(t)}function c(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}function h(t,e,n){return t.call.apply(t.bind,arguments)}function f(t,e,n){if(!t)throw Error();if(2t.b&&(t.b++,e.next=t.a,t.a=e)}function T(){this.b=this.a=null}function E(){var t=Du,e=null;return t.a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e}function k(){this.next=this.b=this.a=null}function A(e,n){var i=e.length,r=t(e)?e.split(""):e;for(--i;0<=i;--i)i in r&&n.call(void 0,r[i],i,e)}function N(e){t:{for(var n=Hi,i=e.length,r=t(e)?e.split(""):e,o=0;on?null:t(e)?e.charAt(n):e[n]}function S(t,e){return 0<=vu(t,e)}function _(t,e){e=vu(t,e);var n;return(n=0<=e)&&Array.prototype.splice.call(t,e,1),n}function O(t,e){var n=0;A(t,function(i,r){e.call(void 0,i,r,t)&&1==Array.prototype.splice.call(t,r,1).length&&n++})}function P(t){return Array.prototype.concat.apply([],arguments)}function C(t){var e=t.length;if(0")&&(t=t.replace(Tu,">")),-1!=t.indexOf('"')&&(t=t.replace(Eu,""")),-1!=t.indexOf("'")&&(t=t.replace(ku,"'")),-1!=t.indexOf("\0")&&(t=t.replace(Au,"�")),t):t}function L(t,e){return-1!=t.indexOf(e)}function x(t,e){return te?1:0}function M(t){return L(pu,t)}function j(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function U(t){for(var e in t)return!1;return!0}function V(t){var e,n={};for(e in t)n[e]=t[e];return n}function F(t,e){for(var n,i,r=1;ri.keyCode||void 0!=i.returnValue)){t:{var r=!1;if(0==i.keyCode)try{i.keyCode=-1;break t}catch(t){r=!0}(r||void 0==i.returnValue)&&(i.returnValue=!0)}for(i=[],r=e.b;r;r=r.parentNode)i.push(r);for(t=t.type,r=i.length-1;0<=r;r--){e.b=i[r];var o=Rt(i[r],t,!0,e);n=n&&o}for(r=0;re)throw Error("Bad port number "+e);t.i=e}else t.i=null}function Qt(t,e,n){e instanceof se?(t.a=e,pe(t.a,t.f)):(n||(e=oe(e,vc)),t.a=new se(e,t.f))}function te(t,e,n){t.a.set(e,n)}function ee(t,e){return t.a.get(e)}function ne(t){return t instanceof Yt?new Yt(t):new Yt(t,void 0)}function ie(t,e){var n=new Yt(null,void 0);return $t(n,"https"),t&&(n.b=t),e&&(n.g=e),n}function re(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function oe(e,n,i){return t(e)?(e=encodeURI(e).replace(n,ae),i&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ae(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function se(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function ue(t){t.a||(t.a=new Xt,t.b=0,t.c&&Jt(t.c,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function ce(t){var e=Gt(t);if(void 0===e)throw Error("Keys are undefined");var n=new se(null,void 0);t=qt(t);for(var i=0;i2*t.c&&Wt(t)))}function fe(t,e){return ue(t),e=de(t,e),zt(t.a.b,e)}function le(t,e,n){he(t,e),0"),s=s.join("")}return s=o.createElement(s),u&&(t(u)?s.className=u:a(u)?s.className=u.join(" "):Pe(s,u)),2t||qu&&$u&&!(9<$u))}function qe(t){return t=(t||nn()).toLowerCase(),!!(t.match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function Ge(t){t=t||cu.window;try{t.close()}catch(t){}}function Be(t,e,n){var i=""+Math.floor(1e9*Math.random());e=e||500,n=n||600;var r=(window.screen.availHeight-n)/2,o=(window.screen.availWidth-e)/2;e={width:e,height:n,top:0',t=_e(t),a.document.write(Se(t)),a.document.close())):(a=i.open(Ee(e),n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(t){}return a}function Xe(t){return new X(function(e){function n(){Ht(2e3).then(function(){if(t&&!t.closed)return n();e()})}return n()})}function We(){var t=null;return new X(function(e){"complete"==cu.document.readyState?e():(t=function(){e()},_t(window,"load",t))}).o(function(e){throw Ot(window,"load",t),e})}function ze(){return Je(void 0)?We().then(function(){return new X(function(t,e){var n=cu.document,i=setTimeout(function(){e(Error("Cordova framework is not ready."))},1e3);n.addEventListener("deviceready",function(){clearTimeout(i),t()},!1)})}):Y(Error("Cordova must run in an Android or iOS file scheme."))}function Je(t){return t=t||nn(),!("file:"!==un()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function Ye(){var t=cu.window;try{return!(!t||t==t.top)}catch(t){return!1}}function $e(){return"object"!=typeof cu.window&&"function"==typeof cu.importScripts}function Ze(){return su.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":su.INTERNAL.hasOwnProperty("node")?"Node":$e()?"Worker":"Browser"}function Qe(){var t=Ze();return"ReactNative"===t||"Node"===t}function tn(t){var e=t.toLowerCase();return L(e,"opera/")||L(e,"opr/")||L(e,"opios/")?"Opera":L(e,"iemobile")?"IEMobile":L(e,"msie")||L(e,"trident/")?"IE":L(e,"edge/")?"Edge":L(e,"firefox/")?Oc:L(e,"silk/")?"Silk":L(e,"blackberry")?"Blackberry":L(e,"webos")?"Webos":!L(e,"safari/")||L(e,"chrome/")||L(e,"crios/")||L(e,"android")?!L(e,"chrome/")&&!L(e,"crios/")||L(e,"edge/")?L(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":Pc:"Safari"}function en(t,e){e=e||[];var n,i=[],r={};for(n in Cc)r[Cc[n]]=!0;for(n=0;ne)throw Error("Short delay should be less than long delay!");this.c=t,this.b=e,t=nn(),e=Ze(),this.a=qe(t)||"ReactNative"===e}function gn(){var t=cu.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function wn(){var t=cu.document,e=null;return gn()||!t?J():new X(function(n){e=function(){gn()&&(t.removeEventListener("visibilitychange",e,!1),n())},t.addEventListener("visibilitychange",e,!1)}).o(function(n){throw t.removeEventListener("visibilitychange",e,!1),n})}function yn(t){try{var e=new Date(parseInt(t,10));if(!isNaN(e.getTime())&&!/[^0-9]/.test(t))return e.toUTCString()}catch(t){}return null}function In(){return!(!rn("fireauth.oauthhelper",cu)&&!rn("fireauth.iframe",cu))}function Tn(t,e,n){Rc?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function En(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&Tn(t,n,e[n])}function kn(t){var e={};return En(e,t),e}function An(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}function Nn(t,e){if(!e||!e.length)return!0;if(!t)return!1;for(var n=0;n>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}}function Mn(){if(!Qc){Qc={},th={};for(var t=0;65>t;t++)Qc[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t),th[Qc[t]]=t,62<=t&&(th["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(t)]=t)}}function jn(t){this.c=t.sub,lu(),this.a=t.provider_id||t.firebase&&t.firebase.sign_in_provider||null,this.b=!!t.is_anonymous||"anonymous"==this.a}function Un(t){if(t=t.split("."),3!=t.length)return null;t=t[1];for(var e=(4-t.length%4)%4,n=0;n Auth section -> Sign in method tab.",t):"http"==i||"https"==i?n=R("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.",t):e="operation-not-supported-in-this-environment",On.call(this,e,n)}function Ii(t,e,n){On.call(this,t,n),t=e||{},t.ub&&Tn(this,"email",t.ub),t.Y&&Tn(this,"phoneNumber",t.Y),t.credential&&Tn(this,"credential",t.credential)}function Ti(t){if(t.code){var e=t.code||"";0==e.indexOf(qc)&&(e=e.substring(qc.length));var n={credential:vi(t)};if(t.email)n.ub=t.email;else{if(!t.phoneNumber)return new On(e,t.message||void 0);n.Y=t.phoneNumber}return new Ii(e,n,t.message)}return null}function Ei(){}function ki(t){return t.c||(t.c=t.b())}function Ai(){}function Ni(t){if(!t.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n<4;n++){var i=e[n];try{return new ActiveXObject(i),t.f=i}catch(t){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return t.f}function Si(){}function _i(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseText="",this.status=-1,this.statusText="",this.a.onload=l(this.ac,this),this.a.onerror=l(this.zb,this),this.a.onprogress=l(this.bc,this),this.a.ontimeout=l(this.ec,this)}function Oi(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function Pi(t,e,n){this.reset(t,e,n,void 0,void 0)}function Ci(t){this.f=t,this.b=this.c=this.a=null}function Ri(t,e){this.name=t,this.value=e}function Di(t){return t.c?t.c:t.a?Di(t.a):(w("Root logger has no level set."),null)}function Li(t){vh||(vh=new Ci(""),ph[""]=vh,vh.c=lh);var e;if(!(e=ph[t])){e=new Ci(t);var n=t.lastIndexOf("."),i=t.substr(n+1);n=Li(t.substr(0,n)),n.b||(n.b={}),n.b[i]=e,e.a=n,ph[t]=e}return e}function xi(t,e){t&&t.log(dh,e,void 0)}function Mi(t){this.f=t}function ji(t){jt.call(this),this.i=t,this.readyState=mh,this.status=0,this.responseText=this.statusText="",this.onreadystatechange=null,this.g=new Headers,this.b=null,this.h="GET",this.c="",this.a=!1,this.f=Li("goog.net.FetchXmlHttp")}function Ui(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function Vi(t){jt.call(this),this.headers=new Xt,this.D=t||null,this.c=!1,this.A=this.a=null,this.h=this.N=this.l="",this.f=this.I=this.i=this.G=!1,this.g=0,this.s=null,this.m=bh,this.v=this.O=!1}function Fi(t,e,n,i,r){if(t.a)throw Error("[goog.net.XhrIo] Object is active with another request="+t.l+"; newUri="+e);n=n?n.toUpperCase():"GET",t.l=e,t.h="",t.N=n,t.G=!1,t.c=!0,t.a=t.D?t.D.a():uh.a(),t.A=ki(t.D?t.D:uh),t.a.onreadystatechange=l(t.Db,t);try{xi(t.b,$i(t,"Opening Xhr")),t.I=!0,t.a.open(n,e+"",!0),t.I=!1}catch(e){return xi(t.b,$i(t,"Error opening Xhr: "+e.message)),void qi(t,e)}e=i||"";var o=new Xt(t.headers);r&&Bt(r,function(t,e){o.set(e,t)}),r=N(o.T()),i=cu.FormData&&e instanceof cu.FormData,!S(wh,n)||r||i||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},t),t.m&&(t.a.responseType=t.m),"withCredentials"in t.a&&t.a.withCredentials!==t.O&&(t.a.withCredentials=t.O);try{Wi(t),0e;e++){r=0|n[e-15],i=0|n[e-2];var o=(0|n[e-16])+((r>>>7|r<<25)^(r>>>18|r<<14)^r>>>3)|0,a=(0|n[e-7])+((i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10)|0;n[e]=o+a|0}i=0|t.a[0],r=0|t.a[1];var s=0|t.a[2],u=0|t.a[3],c=0|t.a[4],h=0|t.a[5],f=0|t.a[6];for(o=0|t.a[7],e=0;64>e;e++){var l=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&r^i&s^r&s)|0;a=c&h^~c&f,o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0,a=a+(0|yf[e])|0,a=o+(a+(0|n[e])|0)|0,o=f,f=h,h=c,c=u+a|0,u=s,s=r,r=i,i=a+l|0}t.a[0]=t.a[0]+i|0,t.a[1]=t.a[1]+r|0,t.a[2]=t.a[2]+s|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+h|0,t.a[6]=t.a[6]+f|0,t.a[7]=t.a[7]+o|0}function Lo(e,n,i){void 0===i&&(i=n.length);var r=0,o=e.c;if(t(n))for(;r=a&&a==(0|a)))throw Error("message must be a byte array");e.f[o++]=a,o==e.b&&(Do(e),o=0)}}e.c=o,e.g+=i}function xo(){Ro.call(this,8,_f)}function Mo(t,e,n,i,r){this.u=t,this.i=e,this.l=n,this.m=i||null,this.s=r||null,this.h=e+":"+n,this.v=new Po,this.g=new _o(this.h),this.f=null,this.b=[],this.a=this.c=null}function jo(t){return new On("invalid-cordova-configuration",t)}function Uo(){for(var t=20,e=[];0e.c?Lo(e,Nf,56-e.c):Lo(e,Nf,e.b-(e.c-56));for(var i=63;56<=i;i--)e.f[i]=255&n,n/=256;for(Do(e),i=n=0;i>r&255;return Dn(t)}function Fo(t,e,n,i){var r=Uo(),o=new bi(e,i,null,r,new On("no-auth-event")),a=rn("BuildInfo.packageName",cu);if("string"!=typeof a)throw new On("invalid-cordova-configuration");var s=rn("BuildInfo.displayName",cu),u={};if(nn().toLowerCase().match(/iphone|ipad|ipod/))u.ibi=a;else{if(!nn().toLowerCase().match(/android/))return Y(new On("operation-not-supported-in-this-environment"));u.apn=a}s&&(u.appDisplayName=s),r=Vo(r),u.sessionId=r;var c=Zr(t.u,t.i,t.l,e,n,null,i,t.m,u,t.s);return t.ca().then(function(){var e=t.h;return t.v.a.set(If,o.C(),e)}).then(function(){var e=rn("cordova.plugins.browsertab.isAvailable",cu);if("function"!=typeof e)throw new On("invalid-cordova-configuration");var n=null;e(function(e){if(e){if("function"!=typeof(n=rn("cordova.plugins.browsertab.openUrl",cu)))throw new On("invalid-cordova-configuration");n(c)}else{if("function"!=typeof(n=rn("cordova.InAppBrowser.open",cu)))throw new On("invalid-cordova-configuration");e=nn(),e=!(!e.match(/(iPad|iPhone|iPod).*OS 7_\d/i)&&!e.match(/(iPad|iPhone|iPod).*OS 8_\d/i)),t.a=n(c,e?"_blank":"_system","location=yes")}})})}function Ko(t,e){for(var n=0;nt.f&&(t.a=t.f),e)}function va(t,e){t.stop(),t.b=Ht(pa(t,e)).then(function(){return wn()}).then(function(){return t.h()}).then(function(){va(t,!0)}).o(function(e){t.i(e)&&va(t,!1)})}function ma(t){this.f=t,this.b=this.a=null,this.c=0}function ba(t,e){var n=e[kh],i=e.refreshToken;e=ga(e.expiresIn),t.b=n,t.c=e,t.a=i}function ga(t){return lu()+1e3*parseInt(t,10)}function wa(t,e){return wr(t.f,e).then(function(e){return t.b=e.access_token,t.c=ga(e.expires_in),t.a=e.refresh_token,{accessToken:t.b,expirationTime:t.c,refreshToken:t.a}}).o(function(e){throw"auth/user-token-expired"==e.code&&(t.a=null),e})}function ya(t,e){this.a=t||null,this.b=e||null,En(this,{lastSignInTime:yn(e||null),creationTime:yn(t||null)})}function Ia(t){return new ya(t.a,t.b)}function Ta(t,e,n,i,r,o){En(this,{uid:t,displayName:i||null,photoURL:r||null,email:n||null,phoneNumber:o||null,providerId:e})}function Ea(t,e){gt.call(this,t);for(var n in e)this[n]=e[n]}function ka(t,e,n){this.D=[],this.G=t.apiKey,this.s=t.appName,this.A=t.authDomain||null,t=su.SDK_VERSION?en(su.SDK_VERSION):null,this.b=new pr(this.G,Vr(Rh),t),this.h=new ma(this.b),Ra(this,e[kh]),ba(this.h,e),Tn(this,"refreshToken",this.h.a),Ma(this,n||{}),jt.call(this),this.I=!1,this.A&&an()&&(this.a=ea(this.A,this.G,this.s)),this.N=[],this.i=null,this.l=Oa(this),this.U=l(this.Ga,this);var i=this;this.ha=null,this.sa=function(t){i.na(t.h)},this.W=null,this.O=[],this.ra=function(t){Na(i,t.f)},this.V=null}function Aa(t,e){t.W&&Ot(t.W,"languageCodeChanged",t.sa),(t.W=e)&&At(e,"languageCodeChanged",t.sa)}function Na(t,e){t.O=e,mr(t.b,su.SDK_VERSION?en(su.SDK_VERSION,t.O):null)}function Sa(t,e){t.V&&Ot(t.V,"frameworkChanged",t.ra),(t.V=e)&&At(e,"frameworkChanged",t.ra)}function _a(t){try{return su.app(t.s).auth()}catch(e){throw new On("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+t.s+"'!")}}function Oa(t){return new da(function(){return t.F(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var e=t.h.c-lu()-3e5;return 0r||r>=Kf.length)throw new On("internal-error","Argument validator received an unsupported number of arguments.");n=Kf[r],i=(i?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.K+".";break t}i=null}}if(i)throw new On("argument-error",t+" failed: "+i)}function Gs(e,n){return{name:e||"",K:"a valid string",optional:!!n,M:t}}function Bs(){return{name:"opt_forceRefresh",K:"a boolean",optional:!0,M:e}}function Xs(t,e){return{name:t||"",K:"a valid object",optional:!!e,M:c}}function Ws(t,e){return{name:t||"",K:"a function",optional:!!e,M:u}}function zs(t,e){return{name:t||"",K:"null",optional:!!e,M:o}}function Js(){return{name:"",K:"an HTML element",optional:!1,M:function(t){return!!(t&&t instanceof Element)}}}function Ys(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(t){return!!(t&&t instanceof ms)}}}function $s(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(t){return!!(t&&t instanceof su.app.App)}}}function Zs(t){return{name:t?t+"Credential":"credential",K:t?"a valid "+t+" credential":"a valid credential",optional:!1,M:function(e){if(!e)return!1;var n=!t||e.providerId===t;return!(!e.xa||!n)}}}function Qs(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}}function tu(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(e){return!!(e&&t(e.type)&&u(e.verify))}}}function eu(t,e,n,i){return{name:n||"",K:t.K+" or "+e.K,optional:!!i,M:function(n){return t.M(n)||e.M(n)}}}function nu(t,e){for(var n in e){var i=e[n].name;t[i]=ru(i,t[n],e[n].j)}}function iu(t,e,n,i){t[e]=ru(e,n,i)}function ru(t,e,n){function i(){var t=Array.prototype.slice.call(arguments);return qs(o,n,t),e.apply(this,t)}if(!n)return e;var r,o=ou(t);for(r in e)i[r]=e[r];for(r in e.prototype)i.prototype[r]=e.prototype[r];return i}function ou(t){return t=t.split("."),t[t.length-1]}var au,su=n(7).default,uu=uu||{},cu=this,hu="closure_uid_"+(1e9*Math.random()>>>0),fu=0,lu=Date.now||function(){return+new Date};p(b,Error),b.prototype.name="CustomError",p(g,b),g.prototype.name="AssertionError",y.prototype.get=function(){if(0/g,Eu=/"/g,ku=/'/g,Au=/\x00/g,Nu=/[\x00&<>"']/;t:{var Su=cu.navigator;if(Su){var _u=Su.userAgent;if(_u){pu=_u;break t}}pu=""}var Ou,Pu,Cu="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Ru=!1,Du=new T,Lu=0,xu=2,Mu=3;W.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var ju=new y(function(){return new W},function(t){t.reset()});X.prototype.then=function(t,e,n){return nt(this,u(t)?t:null,u(e)?e:null,n)},v(X),au=X.prototype,au.ga=function(t,e){return t=z(t,t,e),t.c=!0,et(this,t),this},au.o=function(t,e){return nt(this,null,t,e)},au.cancel=function(t){this.a==Lu&&q(function(){tt(this,new ft(t))},this)},au.Jc=function(t){this.a=Lu,it(this,xu,t)},au.Kc=function(t){this.a=Lu,it(this,Mu,t)},au.Ub=function(){for(var t;t=st(this);)ut(this,t,this.a,this.i);this.h=!1};var Uu=K;p(ft,b),ft.prototype.name="cancel";var Vu=0,Fu={};lt.prototype.pa=!1,lt.prototype.ua=function(){if(this.oa)for(;this.oa.length;)this.oa.shift()()},pt[" "]=i;var Ku,Hu=M("Opera"),qu=M("Trident")||M("MSIE"),Gu=M("Edge"),Bu=Gu||qu,Xu=M("Gecko")&&!(L(pu.toLowerCase(),"webkit")&&!M("Edge"))&&!(M("Trident")||M("MSIE"))&&!M("Edge"),Wu=L(pu.toLowerCase(),"webkit")&&!M("Edge");t:{var zu="",Ju=function(){var t=pu;return Xu?/rv:([^\);]+)(\)|;)/.exec(t):Gu?/Edge\/([\d\.]+)/.exec(t):qu?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):Wu?/WebKit\/(\S+)/.exec(t):Hu?/(?:Version)[ \/]?(\S+)/.exec(t):void 0}();if(Ju&&(zu=Ju?Ju[1]:""),qu){var Yu=mt();if(null!=Yu&&Yu>parseFloat(zu)){Ku=Yu+"";break t}}Ku=zu}var $u,Zu={},Qu=cu.document;$u=Qu&&qu?mt()||("CSS1Compat"==Qu.compatMode?parseInt(Ku,10):5):void 0;var tc=Object.freeze||function(t){return t},ec=!qu||9<=+$u,nc=qu&&!bt("9"),ic=function(){if(!cu.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});return cu.addEventListener("test",i,e),cu.removeEventListener("test",i,e),t}();gt.prototype.c=function(){this.Eb=!1},p(wt,gt);var rc=tc({2:"touch",3:"pen",4:"mouse"});wt.prototype.c=function(){wt.lb.c.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,nc)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(t){}},wt.prototype.g=function(){return this.a};var oc="closure_listenable_"+(1e6*Math.random()|0),ac=0;Tt.prototype.add=function(t,e,n,i,r){var o=""+t;(t=this.a[o])||(t=this.a[o]=[],this.b++);var a=kt(t,e,i,r);return-1>>0);p(jt,lt),jt.prototype[oc]=!0,jt.prototype.addEventListener=function(t,e,n,i){At(this,t,e,n,i)},jt.prototype.removeEventListener=function(t,e,n,i){Ot(this,t,e,n,i)},jt.prototype.dispatchEvent=function(e){var n,i=this.Ta;if(i)for(n=[];i;i=i.Ta)n.push(i);i=this.Mb;var r=e.type||e;if(t(e))e=new gt(e,i);else if(e instanceof gt)e.target=e.target||i;else{var o=e;e=new gt(r,i),F(e,o)}if(o=!0,n)for(var a=n.length-1;0<=a;a--){var s=e.b=n[a];o=Ft(s,r,!0,e)&&o}if(s=e.b=i,o=Ft(s,r,!0,e)&&o,o=Ft(s,r,!1,e)&&o,n)for(a=0;a"),_e(""),_e("
");var Ac={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"},Nc={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Sc=/\uffff/.test("ï¿¿")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g,_c=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Oc="Firefox",Pc="Chrome",Cc={Pc:"FirebaseCore-web",Rc:"FirebaseUI-web"};bn.prototype.get=function(){return this.a?this.b:this.c};var Rc,Dc={};try{var Lc={};Object.defineProperty(Lc,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Lc,"abcd",{configurable:!0,enumerable:!0,value:2}),Rc=2==Lc.abcd}catch(t){Rc=!1}var xc="EMAIL_SIGNIN",Mc="email",jc="newEmail",Uc="requestType",Vc="email",Fc="fromEmail",Kc="data",Hc="operation";p(On,Error),On.prototype.C=function(){return{code:this.code,message:this.message}},On.prototype.toJSON=function(){return this.C()};var qc="auth/",Gc={"argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal error has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","user-cancelled":"User did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."},Bc="android",Xc="handleCodeInApp",Wc="iOS",zc="url",Jc="installApp",Yc="minimumVersion",$c="packageName",Zc="bundleId",Qc=null,th=null;jn.prototype.f=function(){return this.b};var eh="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),nh=["client_id","response_type","scope","redirect_uri","state"],ih={Qc:{Ma:"locale",Aa:500,za:600,Na:"facebook.com",cb:nh},Sc:{Ma:null,Aa:500,za:620,Na:"github.com",cb:nh},Tc:{Ma:"hl",Aa:515,za:680,Na:"google.com",cb:nh},Zc:{Ma:"lang",Aa:485,za:705,Na:"twitter.com",cb:eh}},rh="idToken",oh="providerId";p(Hn,Kn),p(qn,Hn),p(Gn,Hn),p(Bn,Hn),p(Xn,Hn),Jn.prototype.xa=function(t){return Rr(t,Yn(this))},Jn.prototype.c=function(t,e){var n=Yn(this);return n.idToken=e,Dr(t,n)},Jn.prototype.f=function(t,e){return zn(Lr(t,Yn(this)),e)},Jn.prototype.C=function(){var t={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(t.oauthIdToken=this.idToken),this.accessToken&&(t.oauthAccessToken=this.accessToken),this.secret&&(t.oauthTokenSecret=this.secret),t},$n.prototype.Ca=function(t){return this.tb=V(t),this},p(Zn,$n),Zn.prototype.ta=function(t){return S(this.a,t)||this.a.push(t),this},Zn.prototype.yb=function(){return C(this.a)},Zn.prototype.credential=function(t,e){if(!t&&!e)throw new On("argument-error","credential failed: must provide the ID token and/or the access token.");return new Jn(this.providerId,{idToken:t||null,accessToken:e||null},this.providerId)},p(Qn,Zn),Tn(Qn,"PROVIDER_ID","facebook.com"),Tn(Qn,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),p(ei,Zn),Tn(ei,"PROVIDER_ID","github.com"),Tn(ei,"GITHUB_SIGN_IN_METHOD","github.com"),p(ii,Zn),Tn(ii,"PROVIDER_ID","google.com"),Tn(ii,"GOOGLE_SIGN_IN_METHOD","google.com"),p(oi,$n),Tn(oi,"PROVIDER_ID","twitter.com"),Tn(oi,"TWITTER_SIGN_IN_METHOD","twitter.com"),si.prototype.xa=function(t){return this.signInMethod==ui.EMAIL_LINK_SIGN_IN_METHOD?Mr(t,Vh,{email:this.a,oobCode:this.b}):Mr(t,nf,{email:this.a,password:this.b})},si.prototype.c=function(t,e){return this.signInMethod==ui.EMAIL_LINK_SIGN_IN_METHOD?Mr(t,Fh,{idToken:e,email:this.a,oobCode:this.b}):Mr(t,Yh,{idToken:e,email:this.a,password:this.b})},si.prototype.f=function(t,e){return zn(this.xa(t),e)},si.prototype.C=function(){return{email:this.a,password:this.b,signInMethod:this.signInMethod}},En(ui,{PROVIDER_ID:"password"}),En(ui,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),En(ui,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),fi.prototype.xa=function(t){return t.Sa(li(this))},fi.prototype.c=function(t,e){var n=li(this);return n.idToken=e,Mr(t,of,n)},fi.prototype.f=function(t,e){var n=li(this);return n.operation="REAUTH",t=Mr(t,af,n),zn(t,e)},fi.prototype.C=function(){var t={providerId:"phone"};return this.a.Ra&&(t.verificationId=this.a.Ra),this.a.Qa&&(t.verificationCode=this.a.Qa),this.a.Ea&&(t.temporaryProof=this.a.Ea),this.a.Y&&(t.phoneNumber=this.a.Y),t},di.prototype.Sa=function(e,n){var i=this.a.b;return J(n.verify()).then(function(r){if(!t(r))throw new On("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(n.type){case"recaptcha":return _r(i,{phoneNumber:e,recaptchaToken:r}).then(function(t){return"function"==typeof n.reset&&n.reset(),t},function(t){throw"function"==typeof n.reset&&n.reset(),t});default:throw new On("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})},En(di,{PROVIDER_ID:"phone"}),En(di,{PHONE_SIGN_IN_METHOD:"phone"}),bi.prototype.C=function(){return{type:this.b,eventId:this.c,urlResponse:this.f,sessionId:this.g,error:this.a&&this.a.C()}};var ah=null;wi.prototype.subscribe=function(t){var e=this;this.a.push(t),this.b||(this.b=function(t){for(var n=0;n=Di(this).value)for(u(e)&&(e=e()),t=new Pi(t,e+"",this.f),n&&(t.a=n),n=this;n;)n=n.a};var ph={},vh=null;p(Mi,Ei),Mi.prototype.a=function(){return new ji(this.f)},Mi.prototype.b=function(t){return function(){return t}}({}),p(ji,jt);var mh=0;au=ji.prototype,au.open=function(t,e){if(this.readyState!=mh)throw this.abort(),Error("Error reopening a connection");this.h=t,this.c=e,this.readyState=1,Ui(this)},au.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.g,method:this.h,credentials:void 0,cache:void 0};t&&(e.body=t),this.i.fetch(new Request(this.c,e)).then(this.dc.bind(this),this.Ab.bind(this))},au.abort=function(){this.responseText="",this.g=new Headers,this.status=0,1<=this.readyState&&this.a&&4!=this.readyState&&(this.readyState=4,this.a=!1,Ui(this)),this.readyState=mh},au.dc=function(t){this.a&&(this.b||(this.b=t.headers,this.readyState=2,Ui(this)),this.a&&(this.readyState=3,Ui(this),this.a&&t.text().then(this.cc.bind(this,t),this.Ab.bind(this))))},au.cc=function(t,e){this.a&&(this.status=t.status,this.statusText=t.statusText,this.responseText=e,this.readyState=4,Ui(this))},au.Ab=function(t){var e=this.f;e&&e.log(fh,"Failed to fetch url "+this.c,t instanceof Error?t:Error(t)),this.a&&(this.readyState=4,Ui(this))},au.setRequestHeader=function(t,e){this.g.append(t,e)},au.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.f)&&t.log(fh,"Attempting to get response header but no headers have been received for url: "+this.c,void 0),"")},au.getAllResponseHeaders=function(){if(!this.b){var t=this.f;return t&&t.log(fh,"Attempting to get all response headers but no headers have been received for url: "+this.c,void 0),""}t=[];for(var e=this.b.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},p(Vi,jt);var bh="";Vi.prototype.b=Li("goog.net.XhrIo");var gh=/^https?$/i,wh=["POST","PUT"];au=Vi.prototype,au.Fa=function(){void 0!==uu&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",xi(this.b,$i(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},au.abort=function(){this.a&&this.c&&(xi(this.b,$i(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),Xi(this))},au.ua=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),Xi(this,!0)),Vi.lb.ua.call(this)},au.Db=function(){this.pa||(this.I||this.i||this.f?Bi(this):this.sc())},au.sc=function(){Bi(this)},au.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case bh:case"text":return this.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in this.a)return this.a.mozResponseArrayBuffer}var t=this.b;return t&&t.log(hh,"Response type "+this.m+" is not supported on this browser",void 0),null}catch(t){return xi(this.b,"Can not get response: "+t.message),null}},Zi.prototype.cancel=function(t){if(this.a)this.c instanceof Zi&&this.c.cancel();else{if(this.b){var e=this.b;delete this.b,t?e.cancel(t):0>=--e.l&&e.cancel()}this.v?this.v.call(this.s,this):this.u=!0,this.a||(t=new ar(this),tr(this),Qi(this,!1,t))}},Zi.prototype.m=function(t,e){this.i=!1,Qi(this,t,e)},Zi.prototype.D=function(){tr(this),Qi(this,!0,null)},Zi.prototype.then=function(t,e,n){var i,r,o=new X(function(t,e){i=t,r=e});return nr(this,i,function(t){t instanceof ar?o.cancel():r(t)}),o.then(t,e,n)},v(Zi),p(or,b),or.prototype.message="Deferred has already fired",or.prototype.name="AlreadyCalledError",p(ar,b),ar.prototype.message="Deferred was canceled",ar.prototype.name="CanceledError",sr.prototype.c=function(){throw delete yh[this.a],this.b};var yh={},Ih=0,Th=1;p(lr,b),p(dr,Ei),dr.prototype.a=function(){return new this.f},dr.prototype.b=function(){return{}};var Eh,kh="idToken",Ah=new bn(3e4,6e4),Nh={"Content-Type":"application/x-www-form-urlencoded"},Sh=new bn(3e4,6e4),_h={"Content-Type":"application/json"};pr.prototype.m=function(t,e,n,i,r,o){var a=new Vi(this.c);if(o){a.g=Math.max(0,o);var s=setTimeout(function(){a.dispatchEvent("timeout")},o)}Ut(a,"complete",function(){s&&clearTimeout(s);var t=null;try{t=JSON.parse(Yi(this))||null}catch(e){t=null}e&&e(t)}),Vt(a,"ready",function(){s&&clearTimeout(s),dt(this)}),Vt(a,"timeout",function(){s&&clearTimeout(s),dt(this),e&&e(null)}),Fi(a,t,n,i,r)};var Oh=be("https://apis.google.com/js/client.js?onload=%{onload}"),Ph="__fcb"+Math.floor(1e6*Math.random());pr.prototype.u=function(t,e,n,i,r){var o=this;Eh.then(function(){window.gapi.client.setApiKey(o.b);var a=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:t,method:n,body:i,headers:r,authType:"none",callback:function(t){window.gapi.auth.setToken(a),e&&e(t)}})}).o(function(t){e&&e({error:{message:t&&t.message||"CORS_UNSUPPORTED"}})})},pr.prototype.jb=function(){return Mr(this,$h,{})},pr.prototype.mb=function(t,e){return Mr(this,Jh,{idToken:t,email:e})},pr.prototype.nb=function(t,e){return Mr(this,Yh,{idToken:t,password:e})};var Ch={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};au=pr.prototype,au.ob=function(t,e){var n={idToken:t},i=[];return j(Ch,function(t,r){var o=e[r];null===o?i.push(t):r in e&&(n[r]=o)}),i.length&&(n.deleteAttribute=i),Mr(this,Jh,n)},au.gb=function(t,e){return t={requestType:"PASSWORD_RESET",email:t},F(t,e),Mr(this,Gh,t)},au.hb=function(t,e){return t={requestType:"EMAIL_SIGNIN",email:t},F(t,e),Mr(this,Hh,t)},au.fb=function(t,e){return t={requestType:"VERIFY_EMAIL",idToken:t},F(t,e),Mr(this,qh,t)},au.Sa=function(t){return Mr(this,rf,t)},au.Wa=function(t,e){return Mr(this,Wh,{oobCode:t,newPassword:e})},au.Ia=function(t){return Mr(this,Lh,{oobCode:t})},au.Ua=function(t){return Mr(this,Dh,{oobCode:t})};var Rh,Dh={endpoint:"setAccountInfo",w:xr,$:"email"},Lh={endpoint:"resetPassword",w:xr,J:function(t){if(!t.email||!t.requestType)throw new On("internal-error")}},xh={endpoint:"signupNewUser",w:function(t){if(Ir(t),!t.password)throw new On("weak-password")},J:Nr,P:!0},Mh={endpoint:"createAuthUri"},jh={endpoint:"deleteAccount",S:["idToken"]},Uh={endpoint:"setAccountInfo",S:["idToken","deleteProvider"],w:function(t){if(!a(t.deleteProvider))throw new On("internal-error")}},Vh={endpoint:"emailLinkSignin",S:["email","oobCode"],w:Ir,J:Nr,P:!0},Fh={endpoint:"emailLinkSignin",S:["idToken","email","oobCode"],w:Ir,J:Nr,P:!0},Kh={endpoint:"getAccountInfo"},Hh={endpoint:"getOobConfirmationCode",S:["requestType"],w:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new On("internal-error");Ir(t)},$:"email"},qh={endpoint:"getOobConfirmationCode",S:["idToken","requestType"],w:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new On("internal-error")},$:"email"},Gh={endpoint:"getOobConfirmationCode",S:["requestType"],w:function(t){if("PASSWORD_RESET"!=t.requestType)throw new On("internal-error");Ir(t)},$:"email"},Bh={pb:!0,endpoint:"getProjectConfig",Cb:"GET"},Xh={pb:!0,endpoint:"getRecaptchaParam",Cb:"GET",J:function(t){if(!t.recaptchaSiteKey)throw new On("internal-error")}},Wh={endpoint:"resetPassword",w:xr,$:"email"},zh={endpoint:"sendVerificationCode",S:["phoneNumber","recaptchaToken"],$:"sessionInfo"},Jh={endpoint:"setAccountInfo",S:["idToken"],w:Tr,P:!0},Yh={endpoint:"setAccountInfo",S:["idToken"],w:function(t){if(Tr(t),!t.password)throw new On("weak-password")},J:Nr,P:!0},$h={endpoint:"signupNewUser",J:Nr,P:!0},Zh={endpoint:"verifyAssertion",w:Pr,J:Cr,P:!0},Qh={endpoint:"verifyAssertion",w:Pr,J:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new On("user-not-found");if(t.errorMessage)throw jr(t.errorMessage);if(!t[kh])throw new On("internal-error")},P:!0},tf={endpoint:"verifyAssertion",w:function(t){if(Pr(t),!t.idToken)throw new On("internal-error")},J:Cr,P:!0},ef={endpoint:"verifyCustomToken",w:function(t){if(!t.token)throw new On("invalid-custom-token")},J:Nr,P:!0},nf={endpoint:"verifyPassword",w:function(t){if(Ir(t),!t.password)throw new On("wrong-password")},J:Nr,P:!0},rf={endpoint:"verifyPhoneNumber",w:Sr,J:Nr},of={endpoint:"verifyPhoneNumber",w:function(t){if(!t.idToken)throw new On("internal-error");Sr(t)},J:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",Ti(t);Nr(t)}},af={Tb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",w:Sr,J:Nr},sf={Vc:{Ya:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",eb:"https://securetoken.googleapis.com/v1/token",id:"p"},Xc:{Ya:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",eb:"https://staging-securetoken.sandbox.googleapis.com/v1/token",id:"s"},Yc:{Ya:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",eb:"https://test-securetoken.sandbox.googleapis.com/v1/token",id:"t"}};Rh=Vr("__EID__")?"__EID__":void 0;var uf=be("https://apis.google.com/js/api.js?onload=%{onload}"),cf=new bn(3e4,6e4),hf=new bn(5e3,15e3),ff=null;Br.prototype.toString=function(){return this.f?te(this.a,"v",this.f):he(this.a.a,"v"),this.b?te(this.a,"eid",this.b):he(this.a.a,"eid"),this.c.length?te(this.a,"fw",this.c.join(",")):he(this.a.a,"fw"),""+this.a},Xr.prototype.toString=function(){var t=ie(this.m,"/__/auth/handler");if(te(t,"apiKey",this.u),te(t,"appName",this.c),te(t,"authType",this.l),this.a.isOAuthProvider){var e=this.a;try{var n=su.app(this.c).auth().aa()}catch(t){n=null}e.Xa=n,te(t,"providerId",this.a.providerId),e=this.a,n=fn(e.tb);for(var i in n)n[i]=""+n[i];i=e.zc,n=V(n);for(var r=0;rthis.c-3e4?this.a?wa(this,{grant_type:"refresh_token",refresh_token:this.a}):J(null):J({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},ya.prototype.C=function(){return{lastLoginAt:this.b,createdAt:this.a}},p(Ea,gt),p(ka,jt),ka.prototype.na=function(t){this.ha=t,vr(this.b,t)},ka.prototype.aa=function(){return this.ha},ka.prototype.Ka=function(){return C(this.O)},ka.prototype.Ga=function(){this.l.b&&(this.l.stop(),this.l.start())},Tn(ka.prototype,"providerId","firebase"),au=ka.prototype,au.reload=function(){var t=this;return ts(this,Ua(this).then(function(){return Ga(t).then(function(){return La(t)}).then(ja)}))},au.F=function(t){var e=this;return ts(this,Ua(this).then(function(){return e.h.getToken(t)}).then(function(t){if(!t)throw new On("internal-error");return t.accessToken!=e.qa&&(Ra(e,t.accessToken),e.dispatchEvent(new Ea("tokenChanged"))),Ha(e,"refreshToken",t.refreshToken),t.accessToken}))},au.getToken=function(t){return Dc["firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead."]||(Dc["firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead."]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn("firebase.User.prototype.getToken is deprecated. Please use firebase.User.prototype.getIdToken instead.")),this.F(t)},au.tc=function(t){if(!(t=t.users)||!t.length)throw new On("internal-error");t=t[0],Ma(this,{uid:t.localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt});for(var e=Wa(t),n=0;nthis.s&&(this.s=0),0==this.s&&Os(this)&&Ca(Os(this)),this.removeAuthTokenListener(t)},au.addAuthTokenListener=function(t){var e=this;this.m.push(t),Ds(this,this.i.then(function(){e.l||S(e.m,t)&&t(Ps(e))}))},au.removeAuthTokenListener=function(t){O(this.m,function(e){return e==t})},au.delete=function(){this.l=!0;for(var t=0;tn?r.push(e.substring(i,n)):r.push(e.substring(i,i+t));return r},t.each=function(e,t){if(Array.isArray(e))for(var n=0;n=Math.pow(2,-1022)?(a=Math.min(Math.floor(Math.log(e)/Math.LN2),1023),i=a+1023,o=Math.round(e*Math.pow(2,52-a)-Math.pow(2,52))):(i=0,o=Math.round(e/Math.pow(2,-1074)))),u=[],s=52;s;s-=1)u.push(o%2?1:0),o=Math.floor(o/2);for(s=11;s;s-=1)u.push(i%2?1:0),i=Math.floor(i/2);u.push(n?1:0),u.reverse(),l=u.join("");var h="";for(s=0;s<64;s+=8){var c=parseInt(l.substr(s,8),2).toString(16);1===c.length&&(c="0"+c),h+=c}return h.toLowerCase()},t.isChromeExtensionContentScript=function(){return!("object"!=typeof window||!window.chrome||!window.chrome.extension||/^chrome/.test(window.location.href))},t.isWindowsStoreApp=function(){return"object"==typeof Windows&&"object"==typeof Windows.UI},t.errorForServerCode=function(e,t){var n="Unknown Error";"too_big"===e?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==e?n="Client doesn't have permission to access the desired data.":"unavailable"==e&&(n="The service is unavailable");var r=Error(e+" at "+t.path+": "+n);return r.code=e.toUpperCase(),r},t.e=RegExp("^-?\\d{1,10}$"),t.tryParseInt=function(e){if(t.e.test(e)){var n=+e;if(n>=-2147483648&&n<=2147483647)return n}return null},t.exceptionGuard=function(e){try{e()}catch(e){setTimeout(function(){var n=e.stack||"";throw t.warn("Exception was thrown by user callback.",n),e},Math.floor(0))}},t.callUserCallback=function(e){for(var n=[],r=1;r=0},t.exportPropGetter=function(e,t,n){Object.defineProperty(e,t,{get:n})},t.setTimeoutNonBlocking=function(e,t){var n=setTimeout(e,t);return"object"==typeof n&&n.unref&&n.unref(),n}},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=n(0),o=function(){function e(e,t){if(void 0===t){this.n=e.split("/");for(var n=0,r=0;r0&&(this.n[n]=this.n[r],n++);this.n.length=n,this.i=0}else this.n=e,this.i=t}return Object.defineProperty(e,"Empty",{get:function(){return new e("")},enumerable:!0,configurable:!0}),e.prototype.getFront=function(){return this.i>=this.n.length?null:this.n[this.i]},e.prototype.getLength=function(){return this.n.length-this.i},e.prototype.popFront=function(){var t=this.i;return t=this.n.length)return null;for(var t=[],n=this.i;n0&&n.push(i[r]);return new e(n,0)},e.prototype.isEmpty=function(){return this.i>=this.n.length},e.relativePath=function(t,n){var r=t.getFront(),i=n.getFront();if(null===r)return n;if(r===i)return e.relativePath(t.popFront(),n.popFront());throw Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+t+")")},e.comparePaths=function(e,t){for(var n=e.slice(),i=t.slice(),o=0;oe.getLength())return!1;for(;t0&&(this.l+=1),this.u.push(e),this.l+=i.stringLength(e),this.f()},e.prototype.pop=function(){var e=this.u.pop();this.l-=i.stringLength(e),this.u.length>0&&(this.l-=1)},e.prototype.f=function(){if(this.l>e.MAX_PATH_LENGTH_BYTES)throw Error(this.o+"has a key path longer than "+e.MAX_PATH_LENGTH_BYTES+" bytes ("+this.l+").");if(this.u.length>e.MAX_PATH_DEPTH)throw Error(this.o+"path specified exceeds the maximum depth that can be written ("+e.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},e.prototype.toErrorString=function(){return 0==this.u.length?"":"in property '"+this.u.join(".")+"'"},e}();t.ValidationPath=a},function(e,t,n){"use strict";function r(e){o=e}function i(e){a=e}Object.defineProperty(t,"__esModule",{value:!0});var o,a,s=n(2),u=n(16),l=n(1),h=n(6),c=n(17);t.setNodeFromJSON=r,t.setMaxNode=i;var p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s.__extends(t,e),t.prototype.compare=function(e,t){var n=e.node.getPriority(),r=t.node.getPriority(),i=n.compareTo(r);return 0===i?l.nameCompare(e.name,t.name):i},t.prototype.isDefinedOn=function(e){return!e.getPriority().isEmpty()},t.prototype.indexedValueChanged=function(e,t){return!e.getPriority().equals(t.getPriority())},t.prototype.minPost=function(){return h.NamedNode.MIN},t.prototype.maxPost=function(){return new h.NamedNode(l.MAX_NAME,new c.LeafNode("[PRIORITY-POST]",a))},t.prototype.makePost=function(e,t){var n=o(e);return new h.NamedNode(t,new c.LeafNode("[PRIORITY-POST]",n))},t.prototype.toString=function(){return".priority"},t}(u.Index);t.PriorityIndex=p,t.PRIORITY_INDEX=new p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(2),o=n(0),a=n(1),s=n(18),u=n(6),l=n(39),h=n(4),c=n(12),p=n(41),d=n(17),f=n(43),_=function(){function e(e,t,n){this._=e,this.y=t,this.g=n,this.m=null,this.y&&l.validatePriorityNode(this.y),this._.isEmpty()&&o.assert(!this.y||this.y.isEmpty(),"An empty node cannot have a priority")}return Object.defineProperty(e,"EMPTY_NODE",{get:function(){return r||(r=new e(new s.SortedMap(f.NAME_COMPARATOR),null,p.IndexMap.Default))},enumerable:!0,configurable:!0}),e.prototype.isLeafNode=function(){return!1},e.prototype.getPriority=function(){return this.y||r},e.prototype.updatePriority=function(t){return this._.isEmpty()?this:new e(this._,t,this.g)},e.prototype.getImmediateChild=function(e){if(".priority"===e)return this.getPriority();var t=this._.get(e);return null===t?r:t},e.prototype.getChild=function(e){var t=e.getFront();return null===t?this:this.getImmediateChild(t).getChild(e.popFront())},e.prototype.hasChild=function(e){return null!==this._.get(e)},e.prototype.updateImmediateChild=function(t,n){if(o.assert(n,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(n);var i=new u.NamedNode(t,n),a=void 0,s=void 0,l=void 0;return n.isEmpty()?(a=this._.remove(t),s=this.g.removeFromIndexes(i,this._)):(a=this._.insert(t,n),s=this.g.addToIndexes(i,this._)),l=a.isEmpty()?r:this.y,new e(a,l,s)},e.prototype.updateChild=function(e,t){var n=e.getFront();if(null===n)return t;o.assert(".priority"!==e.getFront()||1===e.getLength(),".priority must be the last token in a path");var r=this.getImmediateChild(n).updateChild(e.popFront(),t);return this.updateImmediateChild(n,r)},e.prototype.isEmpty=function(){return this._.isEmpty()},e.prototype.numChildren=function(){return this._.count()},e.prototype.val=function(t){if(this.isEmpty())return null;var n={},r=0,i=0,o=!0;if(this.forEachChild(h.PRIORITY_INDEX,function(a,s){n[a]=s.val(t),r++,o&&e.e.test(a)?i=Math.max(i,+a):o=!1}),!t&&o&&i<2*r){var a=[];for(var s in n)a[s]=n[s];return a}return t&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n},e.prototype.hash=function(){if(null===this.m){var e="";this.getPriority().isEmpty()||(e+="priority:"+l.priorityHashText(this.getPriority().val())+":"),this.forEachChild(h.PRIORITY_INDEX,function(t,n){var r=n.hash();""!==r&&(e+=":"+t+":"+r)}),this.m=""===e?"":a.sha1(e)}return this.m},e.prototype.getPredecessorChildName=function(e,t,n){var r=this.C(n);if(r){var i=r.getPredecessorKey(new u.NamedNode(e,t));return i?i.name:null}return this._.getPredecessorKey(e)},e.prototype.getFirstChildName=function(e){var t=this.C(e);if(t){var n=t.minKey();return n&&n.name}return this._.minKey()},e.prototype.getFirstChild=function(e){var t=this.getFirstChildName(e);return t?new u.NamedNode(t,this._.get(t)):null},e.prototype.getLastChildName=function(e){var t=this.C(e);if(t){var n=t.maxKey();return n&&n.name}return this._.maxKey()},e.prototype.getLastChild=function(e){var t=this.getLastChildName(e);return t?new u.NamedNode(t,this._.get(t)):null},e.prototype.forEachChild=function(e,t){var n=this.C(e);return n?n.inorderTraversal(function(e){return t(e.name,e.node)}):this._.inorderTraversal(t)},e.prototype.getIterator=function(e){return this.getIteratorFrom(e.minPost(),e)},e.prototype.getIteratorFrom=function(e,t){var n=this.C(t);if(n)return n.getIteratorFrom(e,function(e){return e});for(var r=this._.getIteratorFrom(e.name,u.NamedNode.Wrap),i=r.peek();null!=i&&t.compare(i,e)<0;)r.getNext(),i=r.peek();return r},e.prototype.getReverseIterator=function(e){return this.getReverseIteratorFrom(e.maxPost(),e)},e.prototype.getReverseIteratorFrom=function(e,t){var n=this.C(t);if(n)return n.getReverseIteratorFrom(e,function(e){return e});for(var r=this._.getReverseIteratorFrom(e.name,u.NamedNode.Wrap),i=r.peek();null!=i&&t.compare(i,e)>0;)r.getNext(),i=r.peek();return r},e.prototype.compareTo=function(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===t.MAX_NODE?-1:0},e.prototype.withIndex=function(t){if(t===c.KEY_INDEX||this.g.hasIndex(t))return this;var n=this.g.addIndex(t,this._);return new e(this._,this.y,n)},e.prototype.isIndexed=function(e){return e===c.KEY_INDEX||this.g.hasIndex(e)},e.prototype.equals=function(e){if(e===this)return!0;if(e.isLeafNode())return!1;var t=e;if(this.getPriority().equals(t.getPriority())){if(this._.count()===t._.count()){for(var n=this.getIterator(h.PRIORITY_INDEX),r=t.getIterator(h.PRIORITY_INDEX),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},e.prototype.C=function(e){return e===c.KEY_INDEX?null:this.g.get(""+e)},e.e=/^(0|[1-9]\d*)$/,e}();t.ChildrenNode=_;var y=function(e){function t(){return e.call(this,new s.SortedMap(f.NAME_COMPARATOR),_.EMPTY_NODE,p.IndexMap.Default)||this}return i.__extends(t,e),t.prototype.compareTo=function(e){return e===this?0:1},t.prototype.equals=function(e){return e===this},t.prototype.getPriority=function(){return this},t.prototype.getImmediateChild=function(e){return _.EMPTY_NODE},t.prototype.isEmpty=function(){return!1},t}(_);t.MaxNode=y,t.MAX_NODE=new y,Object.defineProperties(u.NamedNode,{MIN:{value:new u.NamedNode(a.MIN_NAME,_.EMPTY_NODE)},MAX:{value:new u.NamedNode(a.MAX_NAME,t.MAX_NODE)}}),c.KeyIndex.__EMPTY_NODE=_.EMPTY_NODE,d.LeafNode.__childrenNodeConstructor=_,l.setMaxNode(t.MAX_NODE),h.setMaxNode(t.MAX_NODE)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){this.name=e,this.node=t}return e.Wrap=function(t,n){return new e(t,n)},e}();t.NamedNode=r},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=n(0),o=n(1),a=n(0),s=n(0);t.N=/[\[\].#$\/\u0000-\u001F\u007F]/,t.P=/[\[\].#$\u0000-\u001F\u007F]/,t.S=10485760,t.isValidKey=function(e){return"string"==typeof e&&0!==e.length&&!t.N.test(e)},t.isValidPathString=function(e){return"string"==typeof e&&0!==e.length&&!t.P.test(e)},t.isValidRootPathString=function(e){return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),t.isValidPathString(e)},t.isValidPriority=function(e){return null===e||"string"==typeof e||"number"==typeof e&&!o.isInvalidJSONNumber(e)||e&&"object"==typeof e&&i.contains(e,".sv")},t.validateFirebaseDataArg=function(e,n,r,i,o){o&&void 0===r||t.validateFirebaseData(a.errorPrefix(e,n,o),r,i)},t.validateFirebaseData=function(e,n,a){var u=a instanceof r.Path?new r.ValidationPath(a,e):a;if(void 0===n)throw Error(e+"contains undefined "+u.toErrorString());if("function"==typeof n)throw Error(e+"contains a function "+u.toErrorString()+" with contents = "+n);if(o.isInvalidJSONNumber(n))throw Error(e+"contains "+n+" "+u.toErrorString());if("string"==typeof n&&n.length>t.S/3&&s.stringLength(n)>t.S)throw Error(e+"contains a string greater than "+t.S+" utf8 bytes "+u.toErrorString()+" ('"+n.substring(0,50)+"...')");if(n&&"object"==typeof n){var l=!1,h=!1;if(i.forEach(n,function(n,r){if(".value"===n)l=!0;else if(".priority"!==n&&".sv"!==n&&(h=!0,!t.isValidKey(n)))throw Error(e+" contains an invalid key ("+n+") "+u.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');u.push(n),t.validateFirebaseData(e,r,u),u.pop()}),l&&h)throw Error(e+' contains ".value" child '+u.toErrorString()+" in addition to actual children.")}},t.validateFirebaseMergePaths=function(e,n){var i,o;for(i=0;i=0,"Unknown leaf type: "+n),i.assert(a>=0,"Unknown leaf type: "+r),o===a?"object"===r?0:this.T0},e.prototype.peek=function(){if(0===this.O.length)return null;var e=this.O[this.O.length-1];return this.w?this.w(e.key,e.value):{key:e.key,value:e.value}},e}();t.SortedMapIterator=r;var i=function(){function e(t,n,r,i,o){this.key=t,this.value=n,this.color=null!=r?r:e.RED,this.left=null!=i?i:a.EMPTY_NODE,this.right=null!=o?o:a.EMPTY_NODE}return e.prototype.copy=function(t,n,r,i,o){return new e(null!=t?t:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},e.prototype.count=function(){return this.left.count()+1+this.right.count()},e.prototype.isEmpty=function(){return!1},e.prototype.inorderTraversal=function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)},e.prototype.reverseTraversal=function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)},e.prototype.A=function(){return this.left.isEmpty()?this:this.left.A()},e.prototype.minKey=function(){return this.A().key},e.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},e.prototype.insert=function(e,t,n){var r,i;return i=this,r=n(e,i.key),i=r<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===r?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n)),i.D()},e.prototype.M=function(){if(this.left.isEmpty())return a.EMPTY_NODE;var e=this;return e.left.L()||e.left.left.L()||(e=e.F()),e=e.copy(null,null,null,e.left.M(),null),e.D()},e.prototype.remove=function(e,t){var n,r;if(n=this,t(e,n.key)<0)n.left.isEmpty()||n.left.L()||n.left.left.L()||(n=n.F()),n=n.copy(null,null,null,n.left.remove(e,t),null);else{if(n.left.L()&&(n=n.x()),n.right.isEmpty()||n.right.L()||n.right.left.L()||(n=n.k()),0===t(e,n.key)){if(n.right.isEmpty())return a.EMPTY_NODE;r=n.right.A(),n=n.copy(r.key,r.value,null,null,n.right.M())}n=n.copy(null,null,null,null,n.right.remove(e,t))}return n.D()},e.prototype.L=function(){return this.color},e.prototype.D=function(){var e=this;return e.right.L()&&!e.left.L()&&(e=e.W()),e.left.L()&&e.left.left.L()&&(e=e.x()),e.left.L()&&e.right.L()&&(e=e.V()),e},e.prototype.F=function(){var e=this.V();return e.right.left.L()&&(e=e.copy(null,null,null,null,e.right.x()),e=e.W(),e=e.V()),e},e.prototype.k=function(){var e=this.V();return e.left.left.L()&&(e=e.x(),e=e.V()),e},e.prototype.W=function(){var t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},e.prototype.x=function(){var t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},e.prototype.V=function(){var e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)},e.prototype.Q=function(){var e=this.j();return Math.pow(2,e)<=this.count()+1},e.prototype.j=function(){var e;if(this.L()&&this.left.L())throw Error("Red node has red child("+this.key+","+this.value+")");if(this.right.L())throw Error("Right child of ("+this.key+","+this.value+") is red");if((e=this.left.j())!==this.right.j())throw Error("Black depths differ");return e+(this.L()?0:1)},e.RED=!0,e.BLACK=!1,e}();t.LLRBNode=i;var o=function(){function e(){}return e.prototype.copy=function(e,t,n,r,i){return this},e.prototype.insert=function(e,t,n){return new i(e,t,null)},e.prototype.remove=function(e,t){return this},e.prototype.count=function(){return 0},e.prototype.isEmpty=function(){return!0},e.prototype.inorderTraversal=function(e){return!1},e.prototype.reverseTraversal=function(e){return!1},e.prototype.minKey=function(){return null},e.prototype.maxKey=function(){return null},e.prototype.j=function(){return 0},e.prototype.L=function(){return!1},e}();t.LLRBEmptyNode=o;var a=function(){function e(t,n){void 0===n&&(n=e.EMPTY_NODE),this.U=t,this.B=n}return e.prototype.insert=function(t,n){return new e(this.U,this.B.insert(t,n,this.U).copy(null,null,i.BLACK,null,null))},e.prototype.remove=function(t){return new e(this.U,this.B.remove(t,this.U).copy(null,null,i.BLACK,null,null))},e.prototype.get=function(e){for(var t,n=this.B;!n.isEmpty();){if(0===(t=this.U(e,n.key)))return n.value;t<0?n=n.left:t>0&&(n=n.right)}return null},e.prototype.getPredecessorKey=function(e){for(var t,n=this.B,r=null;!n.isEmpty();){if(0===(t=this.U(e,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}t<0?n=n.left:t>0&&(r=n,n=n.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?")},e.prototype.isEmpty=function(){return this.B.isEmpty()},e.prototype.count=function(){return this.B.count()},e.prototype.minKey=function(){return this.B.minKey()},e.prototype.maxKey=function(){return this.B.maxKey()},e.prototype.inorderTraversal=function(e){return this.B.inorderTraversal(e)},e.prototype.reverseTraversal=function(e){return this.B.reverseTraversal(e)},e.prototype.getIterator=function(e){return new r(this.B,null,this.U,!1,e)},e.prototype.getIteratorFrom=function(e,t){return new r(this.B,e,this.U,!1,t)},e.prototype.getReverseIteratorFrom=function(e,t){return new r(this.B,e,this.U,!0,t)},e.prototype.getReverseIterator=function(e){return new r(this.B,null,this.U,!0,e)},e.EMPTY_NODE=new o,e}();t.SortedMap=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(45),i=n(13),o=n(3),a=n(46),s=n(88),u=n(99),l=n(0),h=n(1),c=n(0),p=n(100),d=n(27),f=n(102),_=n(51),y=n(103),v=n(52),g=n(108),m=n(34),C=function(){function e(e,t,n){var r=this;this.H=e,this.app=n,this.dataUpdateCount=0,this.G=null,this.K=new y.EventQueue,this.Y=1,this.X=null,this.z=new a.SparseSnapshotTree,this.J=null;var i=new p.AuthTokenProvider(n);if(this.$=d.StatsManager.getCollection(e),t||h.beingCrawled())this.Z=new g.ReadonlyRestClient(this.H,this.ee.bind(this),i),setTimeout(this.te.bind(this,!0),0);else{var o=n.options.databaseAuthVariableOverride;if(void 0!==o&&null!==o){if("object"!=typeof o)throw Error("Only objects are supported for option databaseAuthVariableOverride");try{l.stringify(o)}catch(e){throw Error("Invalid authOverride provided: "+e)}}this.J=new v.PersistentConnection(this.H,this.ee.bind(this),this.te.bind(this),this.ne.bind(this),i,o),this.Z=this.J}i.addTokenChangeListener(function(e){r.Z.refreshAuthToken(e)}),this.re=d.StatsManager.getOrCreateReporter(e,function(){return new f.StatsReporter(r.$,r.Z)}),this.ie(),this.oe=new u.SnapshotHolder,this.ae=new s.SyncTree({startListening:function(e,t,n,i){var o=[],a=r.oe.getNode(e.path);return a.isEmpty()||(o=r.ae.applyServerOverwrite(e.path,a),setTimeout(function(){i("ok")},0)),o},stopListening:function(){}}),this.se("connected",!1),this.ue=new s.SyncTree({startListening:function(e,t,n,i){return r.Z.listen(e,n,t,function(t,n){var o=i(t,n);r.K.raiseEventsForChangedPath(e.path,o)}),[]},stopListening:function(e,t){r.Z.unlisten(e,t)}})}return e.prototype.toString=function(){return(this.H.secure?"https://":"http://")+this.H.host},e.prototype.name=function(){return this.H.namespace},e.prototype.serverTime=function(){var e=this.oe.getNode(new o.Path(".info/serverTimeOffset")),t=e.val()||0;return(new Date).getTime()+t},e.prototype.generateServerValues=function(){return r.generateWithValues({timestamp:this.serverTime()})},e.prototype.ee=function(e,t,n,r){this.dataUpdateCount++;var a=new o.Path(e);t=this.X?this.X(e,t):t;var s=[];if(r)if(n){var u=c.map(t,function(e){return i.nodeFromJSON(e)});s=this.ue.applyTaggedQueryMerge(a,u,r)}else{var l=i.nodeFromJSON(t);s=this.ue.applyTaggedQueryOverwrite(a,l,r)}else if(n){var h=c.map(t,function(e){return i.nodeFromJSON(e)});s=this.ue.applyServerMerge(a,h)}else{var p=i.nodeFromJSON(t);s=this.ue.applyServerOverwrite(a,p)}var d=a;s.length>0&&(d=this.le(a)),this.K.raiseEventsForChangedPath(d,s)},e.prototype.he=function(e){this.X=e},e.prototype.te=function(e){this.se("connected",e),!1===e&&this.ce()},e.prototype.ne=function(e){var t=this;h.each(e,function(e,n){t.se(n,e)})},e.prototype.se=function(e,t){var n=new o.Path("/.info/"+e),r=i.nodeFromJSON(t);this.oe.updateSnapshot(n,r);var a=this.ae.applyServerOverwrite(n,r);this.K.raiseEventsForChangedPath(n,a)},e.prototype.pe=function(){return this.Y++},e.prototype.setWithPriority=function(e,t,n,o){var a=this;this.de("set",{path:""+e,value:t,priority:n});var s=this.generateServerValues(),u=i.nodeFromJSON(t,n),l=r.resolveDeferredValueSnapshot(u,s),c=this.pe(),p=this.ue.applyUserOverwrite(e,l,c,!0);this.K.queueEvents(p),this.Z.put(""+e,u.val(!0),function(t,n){var r="ok"===t;r||h.warn("set at "+e+" failed: "+t);var i=a.ue.ackUserWrite(c,!r);a.K.raiseEventsForChangedPath(e,i),a.callOnCompleteCallback(o,t,n)});var d=this.fe(e);this.le(d),this.K.raiseEventsForChangedPath(d,[])},e.prototype.update=function(e,t,n){var o=this;this.de("update",{path:""+e,value:t});var a=!0,s=this.generateServerValues(),u={};if(c.forEach(t,function(e,t){a=!1;var n=i.nodeFromJSON(t);u[e]=r.resolveDeferredValueSnapshot(n,s)}),a)h.log("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var l=this.pe(),p=this.ue.applyUserMerge(e,u,l);this.K.queueEvents(p),this.Z.merge(""+e,t,function(t,r){var i="ok"===t;i||h.warn("update at "+e+" failed: "+t);var a=o.ue.ackUserWrite(l,!i),s=a.length>0?o.le(e):e;o.K.raiseEventsForChangedPath(s,a),o.callOnCompleteCallback(n,t,r)}),c.forEach(t,function(t){var n=o.fe(e.child(t));o.le(n)}),this.K.raiseEventsForChangedPath(e,[])}},e.prototype.ce=function(){var e=this;this.de("onDisconnectEvents");var t=this.generateServerValues(),n=r.resolveDeferredValueTree(this.z,t),i=[];n.forEachTree(o.Path.Empty,function(t,n){i=i.concat(e.ue.applyServerOverwrite(t,n));var r=e.fe(t);e.le(r)}),this.z=new a.SparseSnapshotTree,this.K.raiseEventsForChangedPath(o.Path.Empty,i)},e.prototype.onDisconnectCancel=function(e,t){var n=this;this.Z.onDisconnectCancel(""+e,function(r,i){"ok"===r&&n.z.forget(e),n.callOnCompleteCallback(t,r,i)})},e.prototype.onDisconnectSet=function(e,t,n){var r=this,o=i.nodeFromJSON(t);this.Z.onDisconnectPut(""+e,o.val(!0),function(t,i){"ok"===t&&r.z.remember(e,o),r.callOnCompleteCallback(n,t,i)})},e.prototype.onDisconnectSetWithPriority=function(e,t,n,r){var o=this,a=i.nodeFromJSON(t,n);this.Z.onDisconnectPut(""+e,a.val(!0),function(t,n){"ok"===t&&o.z.remember(e,a),o.callOnCompleteCallback(r,t,n)})},e.prototype.onDisconnectUpdate=function(e,t,n){var r=this;if(c.isEmpty(t))return h.log("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(n,"ok");this.Z.onDisconnectMerge(""+e,t,function(o,a){"ok"===o&&c.forEach(t,function(t,n){var o=i.nodeFromJSON(n);r.z.remember(e.child(t),o)}),r.callOnCompleteCallback(n,o,a)})},e.prototype.addEventCallbackForQuery=function(e,t){var n;n=".info"===e.path.getFront()?this.ae.addEventRegistration(e,t):this.ue.addEventRegistration(e,t),this.K.raiseEventsAtPath(e.path,n)},e.prototype.removeEventCallbackForQuery=function(e,t){var n;n=".info"===e.path.getFront()?this.ae.removeEventRegistration(e,t):this.ue.removeEventRegistration(e,t),this.K.raiseEventsAtPath(e.path,n)},e.prototype.interrupt=function(){this.J&&this.J.interrupt("repo_interrupt")},e.prototype.resume=function(){this.J&&this.J.resume("repo_interrupt")},e.prototype.stats=function(e){if(void 0===e&&(e=!1),"undefined"!=typeof console){var t;e?(this.G||(this.G=new _.StatsListener(this.$)),t=this.G.get()):t=this.$.get();var n=Object.keys(t).reduce(function(e,t){return Math.max(t.length,e)},0);c.forEach(t,function(e,t){for(var r=e.length;r0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(e){}t+="/"+i}return t}function i(e){var t={};e.startsWith("?")&&(e=e.substring(1));for(var n=0,r=e.split("&");n.firebaseio.com instead"),r&&"undefined"!=r||"localhost"===n.domain||s.fatal("Cannot parse Firebase url. Please use https://.firebaseio.com"),n.secure||s.warnIfPageIsSecure();var i="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new a.RepoInfo(n.host,n.secure,r,i),path:new o.Path(n.pathString)}},t.parseURL=function(e){var t="",n="",o="",a="",s=!0,u="https",l=443;if("string"==typeof e){var h=e.indexOf("//");h>=0&&(u=e.substring(0,h-1),e=e.substring(h+2));var c=e.indexOf("/");-1===c&&(c=e.length);var p=e.indexOf("?");-1===p&&(p=e.length),t=e.substring(0,Math.min(c,p)),c=0?(s="https"===u||"wss"===u,l=parseInt(t.substring(h+1),10)):h=e.length;var f=t.split(".");3===f.length?(n=f[1],o=f[0].toLowerCase()):2===f.length?n=f[0]:"localhost"===f[0].slice(0,h).toLowerCase()&&(n="localhost"),""===o&&"ns"in d&&(o=d.ns)}return{host:t,port:l,domain:n,subdomain:o,secure:s,scheme:u,pathString:a}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(0),o=n(14),a=n(15),s=function(){function e(e,t,n,r,i){void 0===i&&(i=""),this.secure=t,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.host=e.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=o.PersistentStorage.get("host:"+e)||this.host}return e.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()},e.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},e.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},e.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},e.prototype.updateHost=function(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&o.PersistentStorage.set("host:"+this.host,this.internalHost))},e.prototype.connectionURL=function(e,t){r.assert("string"==typeof e,"typeof type must == string"),r.assert("object"==typeof t,"typeof params must == object");var n;if(e===a.WEBSOCKET)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(e!==a.LONG_POLLING)throw Error("Unknown connection type: "+e);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(t.ns=this.namespace);var o=[];return i.forEach(t,function(e,t){o.push(e+"="+t)}),n+o.join("&")},e.prototype.toString=function(){var e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e},e.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},e}();t.RepoInfo=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(8),o=n(1),a=n(0),s=function(){function e(e,t){this.Oe=e,this.De=t}return e.prototype.cancel=function(e){r.validateArgCount("OnDisconnect.cancel",0,1,arguments.length),r.validateCallback("OnDisconnect.cancel",1,e,!0);var t=new a.Deferred;return this.Oe.onDisconnectCancel(this.De,t.wrapCallback(e)),t.promise},e.prototype.remove=function(e){r.validateArgCount("OnDisconnect.remove",0,1,arguments.length),i.validateWritablePath("OnDisconnect.remove",this.De),r.validateCallback("OnDisconnect.remove",1,e,!0);var t=new a.Deferred;return this.Oe.onDisconnectSet(this.De,null,t.wrapCallback(e)),t.promise},e.prototype.set=function(e,t){r.validateArgCount("OnDisconnect.set",1,2,arguments.length),i.validateWritablePath("OnDisconnect.set",this.De),i.validateFirebaseDataArg("OnDisconnect.set",1,e,this.De,!1),r.validateCallback("OnDisconnect.set",2,t,!0);var n=new a.Deferred;return this.Oe.onDisconnectSet(this.De,e,n.wrapCallback(t)),n.promise},e.prototype.setWithPriority=function(e,t,n){r.validateArgCount("OnDisconnect.setWithPriority",2,3,arguments.length),i.validateWritablePath("OnDisconnect.setWithPriority",this.De),i.validateFirebaseDataArg("OnDisconnect.setWithPriority",1,e,this.De,!1),i.validatePriority("OnDisconnect.setWithPriority",2,t,!1),r.validateCallback("OnDisconnect.setWithPriority",3,n,!0);var o=new a.Deferred;return this.Oe.onDisconnectSetWithPriority(this.De,e,t,o.wrapCallback(n)),o.promise},e.prototype.update=function(e,t){if(r.validateArgCount("OnDisconnect.update",1,2,arguments.length),i.validateWritablePath("OnDisconnect.update",this.De),Array.isArray(e)){for(var n={},s=0;s3e4&&(this.it=v),this.vt=null}}else this.de("Window isn't visible. Delaying reconnect."),this.it=this.ot,this.yt=(new Date).getTime();var t=(new Date).getTime()-this.yt,n=Math.max(0,this.it-t);n=Math.random()*n,this.de("Trying to reconnect in "+n+"ms"),this.gt(n),this.it=Math.min(this.ot,1.3*this.it)}this.te(!1)},t.prototype.kt=function(){if(this.Qt()){this.de("Making a connection attempt"),this.yt=(new Date).getTime(),this.vt=null;var e=this.wt.bind(this),n=this.Mt.bind(this),r=this.Wt.bind(this),i=this.id+":"+t.qt++,o=this,a=this.lastSessionId,l=!1,h=null,c=function(){h?h.close():(l=!0,r())},p=function(e){s.assert(h,"sendRequest call when we're not connected not allowed."),h.sendRequest(e)};this.ct={close:c,sendRequest:p};var _=this.dt;this.dt=!1,this.Xe.getToken(_).then(function(t){l?u.log("getToken() completed but was canceled"):(u.log("getToken() completed. Creating connection."),o.pt=t&&t.accessToken,h=new d.Connection(i,o.H,e,n,r,function(e){u.warn(e+" ("+o.H+")"),o.interrupt("server_kill")},a))}).then(null,function(e){o.de("Failed to get token: "+e),l||(f.CONSTANTS.NODE_ADMIN&&u.warn(e),c())})}},t.prototype.interrupt=function(e){u.log("Interrupting connection for reason: "+e),this.$e[e]=!0,this.ct?this.ct.close():(this.st&&(clearTimeout(this.st),this.st=null),this.rt&&this.Wt())},t.prototype.resume=function(e){u.log("Resuming connection for reason: "+e),delete this.$e[e],o.isEmpty(this.$e)&&(this.it=v,this.ct||this.gt(0))},t.prototype.Lt=function(e){var t=e-(new Date).getTime();this.ne({serverTimeOffset:t})},t.prototype.Vt=function(){for(var e=0;e=3&&(this.it=3e4,this.Xe.notifyForInvalidToken())},t.prototype.Dt=function(e){this.at?this.at(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace("\n","\nFIREBASE: "))},t.prototype.xt=function(){var e=this;this.tryAuth(),o.forEach(this.Ze,function(t,n){o.forEach(n,function(t,n){e.Et(n)})});for(var t=0;t0,"Requires a non-empty array")}return e.prototype.trigger=function(e){for(var t=[],n=1;n0&&(this.an=r.setTimeoutNonBlocking(function(){e.an=null,e.in||(e.zt&&e.zt.bytesReceived>102400?(e.de("Connection exceeded healthy timeout but has received "+e.zt.bytesReceived+" bytes. Marking connection healthy."),e.in=!0,e.zt.markConnectionHealthy()):e.zt&&e.zt.bytesSent>10240?e.de("Connection exceeded healthy timeout but has sent "+e.zt.bytesSent+" bytes. Leaving connection alive."):(e.de("Closing unhealthy connection after timeout."),e.close()))},Math.floor(o)))},e.prototype.Jt=function(){return"c:"+this.id+":"+this.connectionCount++},e.prototype.en=function(e){var t=this;return function(n){e===t.zt?t.sn(n):e===t.rn?(t.de("Secondary connection lost."),t.un()):t.de("closing an old connection")}},e.prototype.Zt=function(e){var t=this;return function(n){2!=t.Kt&&(e===t.nn?t.ln(n):e===t.rn?t.hn(n):t.de("message on old connection"))}},e.prototype.sendRequest=function(e){var t={t:"d",d:e};this.cn(t)},e.prototype.tryCleanupConnection=function(){this.tn===this.rn&&this.nn===this.rn&&(this.de("cleaning up and promoting a connection: "+this.rn.connId),this.zt=this.rn,this.rn=null)},e.prototype.pn=function(e){if("t"in e){var t=e.t;"a"===t?this.dn():"r"===t?(this.de("Got a reset on secondary, closing it"),this.rn.close(),this.tn!==this.rn&&this.nn!==this.rn||this.close()):"o"===t&&(this.de("got pong on secondary."),this.fn--,this.dn())}},e.prototype.hn=function(e){var t=r.requireKey("t",e),n=r.requireKey("d",e);if("c"==t)this.pn(n);else{if("d"!=t)throw Error("Unknown protocol layer: "+t);this.pendingDataMessages.push(n)}},e.prototype.dn=function(){this.fn<=0?(this.de("Secondary connection is healthy."),this.in=!0,this.rn.markConnectionHealthy(),this._n()):(this.de("sending ping on secondary."),this.rn.send({t:"c",d:{t:"p",d:{}}}))},e.prototype._n=function(){this.rn.start(),this.de("sending client ack on secondary"),this.rn.send({t:"c",d:{t:"a",d:{}}}),this.de("Ending transmission on primary"),this.zt.send({t:"c",d:{t:"n",d:{}}}),this.tn=this.rn,this.tryCleanupConnection()},e.prototype.ln=function(e){var t=r.requireKey("t",e),n=r.requireKey("d",e);"c"==t?this.yn(n):"d"==t&&this.wt(n)},e.prototype.wt=function(e){this.vn(),this.Ht(e)},e.prototype.vn=function(){this.in||--this.$t<=0&&(this.de("Primary connection is healthy."),this.in=!0,this.zt.markConnectionHealthy())},e.prototype.yn=function(e){var t=r.requireKey("t",e);if("d"in e){var n=e.d;if("h"===t)this.gn(n);else if("n"===t){this.de("recvd end transmission on primary"),this.nn=this.rn;for(var i=0;idocument.domain="'+document.domain+'";<\/script>');var h=""+u+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(h),this.myIFrame.doc.close()}catch(e){r.log("frame writing exception"),e.stack&&r.log(e.stack),r.log(e)}}}return e.Ln=function(){var e=document.createElement("iframe");if(e.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(e);try{e.contentWindow.document||r.log("No IE domain setting required")}catch(n){var t=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+t+"';document.close();})())"}return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e},e.prototype.close=function(){var n=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==n.myIFrame&&(document.body.removeChild(n.myIFrame),n.myIFrame=null)},Math.floor(0))),l.isNodeSdk()&&this.myID){var r={};r[t.FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM]="t",r[t.FIREBASE_LONGPOLL_ID_PARAM]=this.myID,r[t.FIREBASE_LONGPOLL_PW_PARAM]=this.myPW;var i=this.urlFn(r);e.nodeRestRequest(i)}var o=this.onDisconnect;o&&(this.onDisconnect=null,o())},e.prototype.startLongPoll=function(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.Fn(););},e.prototype.Fn=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var e={};e[t.FIREBASE_LONGPOLL_ID_PARAM]=this.myID,e[t.FIREBASE_LONGPOLL_PW_PARAM]=this.myPW,e[t.FIREBASE_LONGPOLL_SERIAL_PARAM]=this.currentSerial;for(var n=this.urlFn(e),r="",i=0;this.pendingSegs.length>0&&this.pendingSegs[0].d.length+30+r.length<=1870;){var o=this.pendingSegs.shift();r=r+"&"+t.FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM+i+"="+o.seg+"&"+t.FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET+i+"="+o.ts+"&"+t.FIREBASE_LONGPOLL_DATA_PARAM+i+"="+o.d,i++}return n+=r,this.xn(n,this.currentSerial),!0}return!1},e.prototype.enqueueSegment=function(e,t,n){this.pendingSegs.push({seg:e,ts:t,d:n}),this.alive&&this.Fn()},e.prototype.xn=function(e,t){var n=this;this.outstandingRequests.add(t,1);var r=function(){n.outstandingRequests.remove(t),n.Fn()},i=setTimeout(r,Math.floor(25e3)),o=function(){clearTimeout(i),r()};this.addTag(e,o)},e.prototype.addTag=function(e,t){var n=this;l.isNodeSdk()?this.doNodeLongPoll(e,t):setTimeout(function(){try{if(!n.sendNewPolls)return;var i=n.myIFrame.doc.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.onload=i.onreadystatechange=function(){var e=i.readyState;e&&"loaded"!==e&&"complete"!==e||(i.onload=i.onreadystatechange=null,i.parentNode&&i.parentNode.removeChild(i),t())},i.onerror=function(){r.log("Long-poll script failed to load: "+e),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(i)}catch(e){}},Math.floor(1))},e}();t.FirebaseIFrameScriptHolder=c},function(e,t,n){"use strict";(function(e){function r(e){d=e}Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),o=n(0),a=n(1),s=n(27),u=n(15),l=n(0),h=n(14),c=n(0),p=n(0),d=null;"undefined"!=typeof MozWebSocket?d=MozWebSocket:"undefined"!=typeof WebSocket&&(d=WebSocket),t.setWebSocketImpl=r;var f=function(){function t(e,n,r,i){this.connId=e,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.de=a.logWrapper(this.connId),this.$=s.StatsManager.getCollection(n),this.connURL=t.kn(n,r,i)}return t.kn=function(e,t,n){var r={};return r[u.VERSION_PARAM]=u.PROTOCOL_VERSION,!p.isNodeSdk()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(u.FORGE_DOMAIN)&&(r[u.REFERER_PARAM]=u.FORGE_REF),t&&(r[u.TRANSPORT_SESSION_PARAM]=t),n&&(r[u.LAST_SESSION_PARAM]=n),e.connectionURL(u.WEBSOCKET,r)},t.prototype.open=function(t,n){var r=this;this.onDisconnect=n,this.onMessage=t,this.de("Websocket connecting to "+this.connURL),this.Tn=!1,h.PersistentStorage.set("previous_websocket_failure",!0);try{if(p.isNodeSdk()){var o=l.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",a={headers:{"User-Agent":"Firebase/"+u.PROTOCOL_VERSION+"/"+i.default.SDK_VERSION+"/"+e.platform+"/"+o}},s=e.env,c=0==this.connURL.indexOf("wss://")?s.HTTPS_PROXY||s.https_proxy:s.HTTP_PROXY||s.http_proxy;c&&(a.proxy={origin:c}),this.mySock=new d(this.connURL,[],a)}else this.mySock=new d(this.connURL)}catch(e){this.de("Error instantiating WebSocket.");var f=e.message||e.data;return f&&this.de(f),void this.wn()}this.mySock.onopen=function(){r.de("Websocket connected."),r.Tn=!0},this.mySock.onclose=function(){r.de("Websocket connection was disconnected."),r.mySock=null,r.wn()},this.mySock.onmessage=function(e){r.handleIncomingFrame(e)},this.mySock.onerror=function(e){r.de("WebSocket error. Closing connection.");var t=e.message||e.data;t&&r.de(t),r.wn()}},t.prototype.start=function(){},t.forceDisallow=function(){t.Dn=!0},t.isAvailable=function(){var e=!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&&(e=!0)}return!e&&null!==d&&!t.Dn},t.previouslyFailed=function(){return h.PersistentStorage.isInMemoryStorage||!0===h.PersistentStorage.get("previous_websocket_failure")},t.prototype.markConnectionHealthy=function(){h.PersistentStorage.remove("previous_websocket_failure")},t.prototype.Wn=function(e){if(this.frames.push(e),this.frames.length==this.totalFrames){var t=this.frames.join("");this.frames=null;var n=c.jsonEval(t);this.onMessage(n)}},t.prototype.Vn=function(e){this.totalFrames=e,this.frames=[]},t.prototype.Qn=function(e){if(o.assert(null===this.frames,"We already have a frame buffer"),e.length<=6){var t=+e;if(!isNaN(t))return this.Vn(t),null}return this.Vn(1),e},t.prototype.handleIncomingFrame=function(e){if(null!==this.mySock){var t=e.data;if(this.bytesReceived+=t.length,this.$.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames)this.Wn(t);else{var n=this.Qn(t);null!==n&&this.Wn(n)}}},t.prototype.send=function(e){this.resetKeepAlive();var t=c.stringify(e);this.bytesSent+=t.length,this.$.incrementCounter("bytes_sent",t.length);var n=a.splitStringBySize(t,16384);n.length>1&&this.qn(n.length+"");for(var r=0;r=0;a--)s[a]=e.charAt(i%64),i=Math.floor(i/64);r.assert(0===i,"Cannot push at time == 0");var u=s.join("");if(o){for(a=11;a>=0&&63===n[a];a--)n[a]=0;n[a]++}else for(a=0;a<12;a++)n[a]=Math.floor(64*Math.random());for(a=0;a<12;a++)u+=e.charAt(n[a]);return r.assert(20===u.length,"nextPushId: Length should be 20."),u}}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(24),i=n(87),o=n(0),a=n(0),s=function(){function e(e,t,n){this.Jn=e,this.$n=t,this.Zn=n}return e.prototype.respondsTo=function(e){return"value"===e},e.prototype.createEvent=function(e,t){var n=t.getQueryParams().getIndex();return new i.DataEvent("value",this,new r.DataSnapshot(e.snapshotNode,t.getRef(),n))},e.prototype.getEventRunner=function(e){var t=this.Zn;if("cancel"===e.getEventType()){a.assert(this.$n,"Raising a cancel event on a listener with no cancel callback");var n=this.$n;return function(){n.call(t,e.error)}}var r=this.Jn;return function(){r.call(t,e.snapshot)}},e.prototype.createCancelEvent=function(e,t){return this.$n?new i.CancelEvent(this,e,t):null},e.prototype.matches=function(t){return t instanceof e&&(!t.Jn||!this.Jn||t.Jn===this.Jn&&t.Zn===this.Zn)},e.prototype.hasAnyCallback=function(){return null!==this.Jn},e}();t.ValueEventRegistration=s;var u=function(){function e(e,t,n){this.er=e,this.$n=t,this.Zn=n}return e.prototype.respondsTo=function(e){var t="children_added"===e?"child_added":e;return t="children_removed"===t?"child_removed":t,o.contains(this.er,t)},e.prototype.createCancelEvent=function(e,t){return this.$n?new i.CancelEvent(this,e,t):null},e.prototype.createEvent=function(e,t){a.assert(null!=e.childName,"Child events should have a childName.");var n=t.getRef().child(e.childName),o=t.getQueryParams().getIndex();return new i.DataEvent(e.type,this,new r.DataSnapshot(e.snapshotNode,n,o),e.prevName)},e.prototype.getEventRunner=function(e){var t=this.Zn;if("cancel"===e.getEventType()){a.assert(this.$n,"Raising a cancel event on a listener with no cancel callback");var n=this.$n;return function(){n.call(t,e.error)}}var r=this.er[e.eventType];return function(){r.call(t,e.snapshot,e.prevName)}},e.prototype.matches=function(t){if(t instanceof e){if(!this.er||!t.er)return!0;if(this.Zn===t.Zn){var n=o.getCount(t.er);if(n===o.getCount(this.er)){if(1===n){var r=o.getAnyKey(t.er),i=o.getAnyKey(this.er);return!(i!==r||t.er[r]&&this.er[i]&&t.er[r]!==this.er[i])}return o.every(this.er,function(e,n){return t.er[e]===n})}}}return!1},e.prototype.hasAnyCallback=function(){return null!==this.er},e}();t.ChildEventRegistration=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(e,t,n,r){this.eventType=e,this.eventRegistration=t,this.snapshot=n,this.prevName=r}return e.prototype.getPath=function(){var e=this.snapshot.getRef();return"value"===this.eventType?e.path:e.getParent().path},e.prototype.getEventType=function(){return this.eventType},e.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},e.prototype.toString=function(){return this.getPath()+":"+this.eventType+":"+r.stringify(this.snapshot.exportVal())},e}();t.DataEvent=i;var o=function(){function e(e,t,n){this.eventRegistration=e,this.error=t,this.path=n}return e.prototype.getPath=function(){return this.path},e.prototype.getEventType=function(){return"cancel"},e.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},e.prototype.toString=function(){return this.path+":cancel"},e}();t.CancelEvent=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(1),o=n(89),a=n(5),s=n(0),u=n(25),l=n(90),h=n(91),c=n(9),p=n(48),d=n(3),f=n(49),_=n(97),y=function(){function e(e){this.tr=e,this.nr=u.ImmutableTree.Empty,this.rr=new _.WriteTree,this.ir={},this.or={}}return e.prototype.applyUserOverwrite=function(e,t,n,r){return this.rr.addOverwrite(e,t,n,r),r?this.ar(new p.Overwrite(c.OperationSource.User,e,t)):[]},e.prototype.applyUserMerge=function(e,t,n){this.rr.addMerge(e,t,n);var r=u.ImmutableTree.fromObject(t);return this.ar(new h.Merge(c.OperationSource.User,e,r))},e.prototype.ackUserWrite=function(e,t){void 0===t&&(t=!1);var n=this.rr.getWrite(e);if(this.rr.removeWrite(e)){var r=u.ImmutableTree.Empty;return null!=n.snap?r=r.set(d.Path.Empty,!0):s.forEach(n.children,function(e,t){r=r.set(new d.Path(e),t)}),this.ar(new o.AckUserWrite(n.path,r,t))}return[]},e.prototype.applyServerOverwrite=function(e,t){return this.ar(new p.Overwrite(c.OperationSource.Server,e,t))},e.prototype.applyServerMerge=function(e,t){var n=u.ImmutableTree.fromObject(t);return this.ar(new h.Merge(c.OperationSource.Server,e,n))},e.prototype.applyListenComplete=function(e){return this.ar(new l.ListenComplete(c.OperationSource.Server,e))},e.prototype.applyTaggedQueryOverwrite=function(t,n,r){var i=this.sr(r);if(null!=i){var o=e.ur(i),a=o.path,s=o.queryId,u=d.Path.relativePath(a,t),l=new p.Overwrite(c.OperationSource.forServerTaggedQuery(s),u,n);return this.lr(a,l)}return[]},e.prototype.applyTaggedQueryMerge=function(t,n,r){var i=this.sr(r);if(i){var o=e.ur(i),a=o.path,s=o.queryId,l=d.Path.relativePath(a,t),p=u.ImmutableTree.fromObject(n),f=new h.Merge(c.OperationSource.forServerTaggedQuery(s),l,p);return this.lr(a,f)}return[]},e.prototype.applyTaggedListenComplete=function(t,n){var r=this.sr(n);if(r){var i=e.ur(r),o=i.path,a=i.queryId,s=d.Path.relativePath(o,t),u=new l.ListenComplete(c.OperationSource.forServerTaggedQuery(a),s);return this.lr(o,u)}return[]},e.prototype.addEventRegistration=function(t,n){var i=t.path,o=null,s=!1;this.nr.foreachOnPath(i,function(e,t){var n=d.Path.relativePath(e,i);o=o||t.getCompleteServerCache(n),s=s||t.hasCompleteView()});var u=this.nr.get(i);u?(s=s||u.hasCompleteView(),o=o||u.getCompleteServerCache(d.Path.Empty)):(u=new f.SyncPoint,this.nr=this.nr.set(i,u));var l;null!=o?l=!0:(l=!1,o=a.ChildrenNode.EMPTY_NODE,this.nr.subtree(i).foreachChild(function(e,t){var n=t.getCompleteServerCache(d.Path.Empty);n&&(o=o.updateImmediateChild(e,n))}));var h=u.viewExistsForQuery(t);if(!h&&!t.getQueryParams().loadsAllData()){var c=e.hr(t);r.assert(!(c in this.or),"View does not exist, but we have a tag");var p=e.cr();this.or[c]=p,this.ir["_"+p]=c}var _=this.rr.childWrites(i),y=u.addEventRegistration(t,n,_,o,l);if(!h&&!s){var v=u.viewForQuery(t);y=y.concat(this.pr(t,v))}return y},e.prototype.removeEventRegistration=function(t,n,r){var i=this,o=t.path,a=this.nr.get(o),s=[];if(a&&("default"===t.queryIdentifier()||a.viewExistsForQuery(t))){var u=a.removeEventRegistration(t,n,r);a.isEmpty()&&(this.nr=this.nr.remove(o));var l=u.removed;s=u.events;var h=-1!==l.findIndex(function(e){return e.getQueryParams().loadsAllData()}),c=this.nr.findOnPath(o,function(e,t){return t.hasCompleteView()});if(h&&!c){var p=this.nr.subtree(o);if(!p.isEmpty())for(var d=this.dr(p),f=0;f0&&!r&&(h?this.tr.stopListening(e._r(t),null):l.forEach(function(t){var n=i.or[e.hr(t)];i.tr.stopListening(e._r(t),n)})),this.vr(l)}return s},e.prototype.calcCompleteEventCache=function(e,t){var n=this.rr,r=this.nr.findOnPath(e,function(t,n){var r=d.Path.relativePath(t,e),i=n.getCompleteServerCache(r);if(i)return i});return n.calcCompleteEventCache(e,r,t,!0)},e.prototype.dr=function(e){return e.fold(function(e,t,n){if(t&&t.hasCompleteView())return[t.getCompleteView()];var r=[];return t&&(r=t.getQueryViews()),s.forEach(n,function(e,t){r=r.concat(t)}),r})},e.prototype.vr=function(t){for(var n=0;n0||!e.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(a.Change.valueChange(t.getCompleteEventSnap()))}},e.prototype.xr=function(e,t,n,r,o){var a=e.getEventCache();if(null!=n.shadowingWrite(t))return e;var u=void 0,l=void 0;if(t.isEmpty())if(i.assert(e.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),e.getServerCache().isFiltered()){var h=e.getCompleteServerSnap(),c=h instanceof s.ChildrenNode?h:s.ChildrenNode.EMPTY_NODE,p=n.calcCompleteEventChildren(c);u=this.Rr.updateFullNode(e.getEventCache().getNode(),p,o)}else{var d=n.calcCompleteEventCache(e.getCompleteServerSnap());u=this.Rr.updateFullNode(e.getEventCache().getNode(),d,o)}else{var f=t.getFront();if(".priority"==f){i.assert(1==t.getLength(),"Can't have a priority with additional path components");var _=a.getNode();l=e.getServerCache().getNode();var y=n.calcEventCacheAfterServerOverwrite(t,_,l);u=null!=y?this.Rr.updatePriority(_,y):a.getNode()}else{var v=t.popFront(),g=void 0;if(a.isCompleteForChild(f)){l=e.getServerCache().getNode();var m=n.calcEventCacheAfterServerOverwrite(t,a.getNode(),l);g=null!=m?a.getNode().getImmediateChild(f).updateChild(v,m):a.getNode().getImmediateChild(f)}else g=n.calcCompleteChild(f,e.getServerCache());u=null!=g?this.Rr.updateChild(a.getNode(),f,g,v,r,o):a.getNode()}}return e.updateEventSnap(u,a.isFullyInitialized()||t.isEmpty(),this.Rr.filtersNodes())},e.prototype.wr=function(e,t,n,r,i,o,a){var s,u=e.getServerCache(),l=o?this.Rr:this.Rr.getIndexedFilter();if(t.isEmpty())s=l.updateFullNode(u.getNode(),n,null);else if(l.filtersNodes()&&!u.isFiltered()){var h=u.getNode().updateChild(t,n);s=l.updateFullNode(u.getNode(),h,null)}else{var p=t.getFront();if(!u.isCompleteForPath(t)&&t.getLength()>1)return e;var d=t.popFront(),f=u.getNode().getImmediateChild(p),_=f.updateChild(d,n);s=".priority"==p?l.updatePriority(u.getNode(),_):l.updateChild(u.getNode(),p,_,d,c.NO_COMPLETE_CHILD_SOURCE,null)}var y=e.updateServerSnap(s,u.isFullyInitialized()||t.isEmpty(),l.filtersNodes()),v=new c.WriteTreeCompleteChildSource(r,y,i);return this.xr(y,t,r,v,a)},e.prototype.Ir=function(e,t,n,r,i,o){var a,u,l=e.getEventCache(),h=new c.WriteTreeCompleteChildSource(r,e,i);if(t.isEmpty())u=this.Rr.updateFullNode(e.getEventCache().getNode(),n,o),a=e.updateEventSnap(u,!0,this.Rr.filtersNodes());else{var p=t.getFront();if(".priority"===p)u=this.Rr.updatePriority(e.getEventCache().getNode(),n),a=e.updateEventSnap(u,l.isFullyInitialized(),l.isFiltered());else{var d=t.popFront(),f=l.getNode().getImmediateChild(p),_=void 0;if(d.isEmpty())_=n;else{var y=h.getCompleteChild(p);_=null!=y?".priority"===d.getBack()&&y.getChild(d.parent()).isEmpty()?y:y.updateChild(d,n):s.ChildrenNode.EMPTY_NODE}if(f.equals(_))a=e;else{var v=this.Rr.updateChild(l.getNode(),p,_,d,h,o);a=e.updateEventSnap(v,l.isFullyInitialized(),this.Rr.filtersNodes())}}}return a},e.kr=function(e,t){return e.getEventCache().isCompleteForChild(t)},e.prototype.Or=function(t,n,r,i,o,a){var s=this,u=t;return r.foreach(function(r,l){var h=n.child(r);e.kr(t,h.getFront())&&(u=s.Ir(u,h,l,i,o,a))}),r.foreach(function(r,l){var h=n.child(r);e.kr(t,h.getFront())||(u=s.Ir(u,h,l,i,o,a))}),u},e.prototype.Wr=function(e,t){return t.foreach(function(t,n){e=e.updateChild(t,n)}),e},e.prototype.Ar=function(e,t,n,r,i,o,a){var s=this;if(e.getServerCache().getNode().isEmpty()&&!e.getServerCache().isFullyInitialized())return e;var u,c=e;u=t.isEmpty()?n:l.ImmutableTree.Empty.setTree(t,n);var p=e.getServerCache().getNode();return u.children.inorderTraversal(function(t,n){if(p.hasChild(t)){var u=e.getServerCache().getNode().getImmediateChild(t),l=s.Wr(u,n);c=s.wr(c,new h.Path(t),l,r,i,o,a)}}),u.children.inorderTraversal(function(t,n){var u=!e.getServerCache().isCompleteForChild(t)&&null==n.value;if(!p.hasChild(t)&&!u){var l=e.getServerCache().getNode().getImmediateChild(t),d=s.Wr(l,n);c=s.wr(c,new h.Path(t),d,r,i,o,a)}}),c},e.prototype.Mr=function(e,t,n,r,i,o){if(null!=r.shadowingWrite(t))return e;var a=e.getServerCache().isFiltered(),s=e.getServerCache();if(null!=n.value){if(t.isEmpty()&&s.isFullyInitialized()||s.isCompleteForPath(t))return this.wr(e,t,s.getNode().getChild(t),r,i,a,o);if(t.isEmpty()){var c=l.ImmutableTree.Empty;return s.getNode().forEachChild(u.KEY_INDEX,function(e,t){c=c.set(new h.Path(e),t)}),this.Ar(e,t,c,r,i,a,o)}return e}var p=l.ImmutableTree.Empty;return n.foreach(function(e,n){var r=t.child(e);s.isCompleteForPath(r)&&(p=p.set(e,s.getNode().getChild(r)))}),this.Ar(e,t,p,r,i,a,o)},e.prototype.Lr=function(e,t,n,r){var i=e.getServerCache(),o=e.updateServerSnap(i.getNode(),i.isFullyInitialized()||t.isEmpty(),i.isFiltered());return this.xr(o,t,n,c.NO_COMPLETE_CHILD_SOURCE,r)},e.prototype.Dr=function(e,t,n,r,o){var a;if(null!=n.shadowingWrite(t))return e;var u=new c.WriteTreeCompleteChildSource(n,e,r),l=e.getEventCache().getNode(),p=void 0;if(t.isEmpty()||".priority"===t.getFront()){var d=void 0;if(e.getServerCache().isFullyInitialized())d=n.calcCompleteEventCache(e.getCompleteServerSnap());else{var f=e.getServerCache().getNode();i.assert(f instanceof s.ChildrenNode,"serverChildren would be complete if leaf node"),d=n.calcCompleteEventChildren(f)}d=d,p=this.Rr.updateFullNode(l,d,o)}else{var _=t.getFront(),y=n.calcCompleteChild(_,e.getServerCache());null==y&&e.getServerCache().isCompleteForChild(_)&&(y=l.getImmediateChild(_)),p=null!=y?this.Rr.updateChild(l,_,y,t.popFront(),u,o):e.getEventCache().getNode().hasChild(_)?this.Rr.updateChild(l,_,s.ChildrenNode.EMPTY_NODE,t.popFront(),u,o):l,p.isEmpty()&&e.getServerCache().isFullyInitialized()&&(a=n.calcCompleteEventCache(e.getCompleteServerSnap()),a.isLeafNode()&&(p=this.Rr.updateFullNode(p,a,o)))}return a=e.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(h.Path.Empty),e.updateEventSnap(p,a,this.Rr.filtersNodes())},e}();t.ViewProcessor=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(10),o=n(0),a=function(){function e(){this.Vr={}}return e.prototype.trackChildChange=function(e){var t=e.type,n=e.childName;o.assert(t==i.Change.CHILD_ADDED||t==i.Change.CHILD_CHANGED||t==i.Change.CHILD_REMOVED,"Only child changes supported for tracking"),o.assert(".priority"!==n,"Only non-priority child changes can be tracked.");var a=r.safeGet(this.Vr,n);if(a){var s=a.type;if(t==i.Change.CHILD_ADDED&&s==i.Change.CHILD_REMOVED)this.Vr[n]=i.Change.childChangedChange(n,e.snapshotNode,a.snapshotNode);else if(t==i.Change.CHILD_REMOVED&&s==i.Change.CHILD_ADDED)delete this.Vr[n];else if(t==i.Change.CHILD_REMOVED&&s==i.Change.CHILD_CHANGED)this.Vr[n]=i.Change.childRemovedChange(n,a.oldSnap);else if(t==i.Change.CHILD_CHANGED&&s==i.Change.CHILD_ADDED)this.Vr[n]=i.Change.childAddedChange(n,e.snapshotNode);else{if(t!=i.Change.CHILD_CHANGED||s!=i.Change.CHILD_CHANGED)throw o.assertionError("Illegal combination of changes: "+e+" occurred after "+a);this.Vr[n]=i.Change.childChangedChange(n,e.snapshotNode,a.oldSnap)}}else this.Vr[n]=e},e.prototype.getChanges=function(){return r.getValues(this.Vr)},e}();t.ChildChangeAccumulator=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(20),i=function(){function e(){}return e.prototype.getCompleteChild=function(e){return null},e.prototype.getChildAfterChild=function(e,t,n){return null},e}();t.Qr=i,t.NO_COMPLETE_CHILD_SOURCE=new i;var o=function(){function e(e,t,n){void 0===n&&(n=null),this.qr=e,this.Sr=t,this.jr=n}return e.prototype.getCompleteChild=function(e){var t=this.Sr.getEventCache();if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);var n=null!=this.jr?new r.CacheNode(this.jr,!0,!1):this.Sr.getServerCache();return this.qr.calcCompleteChild(e,n)},e.prototype.getChildAfterChild=function(e,t,n){var r=null!=this.jr?this.jr:this.Sr.getCompleteServerSnap(),i=this.qr.calcIndexedSlice(r,t,1,n,e);return 0===i.length?null:i[0]},e}();t.WriteTreeCompleteChildSource=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),i=n(10),o=n(0),a=function(){function e(e){this.Er=e,this.Ee=this.Er.getQueryParams().getIndex()}return e.prototype.generateEventsForChanges=function(e,t,n){var r=this,o=[],a=[];return e.forEach(function(e){e.type===i.Change.CHILD_CHANGED&&r.Ee.indexedValueChanged(e.oldSnap,e.snapshotNode)&&a.push(i.Change.childMovedChange(e.childName,e.snapshotNode))}),this.Ur(o,i.Change.CHILD_REMOVED,e,n,t),this.Ur(o,i.Change.CHILD_ADDED,e,n,t),this.Ur(o,i.Change.CHILD_MOVED,a,n,t),this.Ur(o,i.Change.CHILD_CHANGED,e,n,t),this.Ur(o,i.Change.VALUE,e,n,t),o},e.prototype.Ur=function(e,t,n,r,i){var o=this,a=n.filter(function(e){return e.type===t});a.sort(this.Br.bind(this)),a.forEach(function(t){var n=o.Hr(t,i);r.forEach(function(r){r.respondsTo(t.type)&&e.push(r.createEvent(n,o.Er))})})},e.prototype.Hr=function(e,t){return"value"===e.type||"child_removed"===e.type?e:(e.prevName=t.getPredecessorChildName(e.childName,e.snapshotNode,this.Ee),e)},e.prototype.Br=function(e,t){if(null==e.childName||null==t.childName)throw o.assertionError("Should only compare child_ events.");var n=new r.NamedNode(e.childName,e.snapshotNode),i=new r.NamedNode(t.childName,t.snapshotNode);return this.Ee.compare(n,i)},e}();t.EventGenerator=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(0),o=n(3),a=n(98),s=n(4),u=n(5),l=function(){function e(){this.Gr=a.CompoundWrite.Empty,this.Kr=[],this.Yr=-1}return e.prototype.childWrites=function(e){return new h(e,this)},e.prototype.addOverwrite=function(e,t,n,r){i.assert(n>this.Yr,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.Kr.push({path:e,snap:t,writeId:n,visible:r}),r&&(this.Gr=this.Gr.addWrite(e,t)),this.Yr=n},e.prototype.addMerge=function(e,t,n){i.assert(n>this.Yr,"Stacking an older merge on top of newer ones"),this.Kr.push({path:e,children:t,writeId:n,visible:!0}),this.Gr=this.Gr.addWrites(e,t),this.Yr=n},e.prototype.getWrite=function(e){for(var t=0;t=0,"removeWrite called with nonexistent writeId.");var o=this.Kr[n];this.Kr.splice(n,1);for(var a=o.visible,s=!1,u=this.Kr.length-1;a&&u>=0;){var l=this.Kr[u];l.visible&&(u>=n&&this.Xr(l,o.path)?a=!1:o.path.contains(l.path)&&(s=!0)),u--}if(a){if(s)return this.zr(),!0;if(o.snap)this.Gr=this.Gr.removeWrite(o.path);else{var h=o.children;r.forEach(h,function(e){t.Gr=t.Gr.removeWrite(o.path.child(e))})}return!0}return!1},e.prototype.getCompleteWriteData=function(e){return this.Gr.getCompleteNode(e)},e.prototype.calcCompleteEventCache=function(t,n,r,i){if(r||i){var a=this.Gr.childCompoundWrite(t);if(!i&&a.isEmpty())return n;if(i||null!=n||a.hasCompleteWrite(o.Path.Empty)){var s=function(e){return(e.visible||i)&&(!r||!~r.indexOf(e.writeId))&&(e.path.contains(t)||t.contains(e.path))},l=e.Jr(this.Kr,s,t),h=n||u.ChildrenNode.EMPTY_NODE;return l.apply(h)}return null}var c=this.Gr.getCompleteNode(t);if(null!=c)return c;var p=this.Gr.childCompoundWrite(t);if(p.isEmpty())return n;if(null!=n||p.hasCompleteWrite(o.Path.Empty)){var h=n||u.ChildrenNode.EMPTY_NODE;return p.apply(h)}return null},e.prototype.calcCompleteEventChildren=function(e,t){var n=u.ChildrenNode.EMPTY_NODE,r=this.Gr.getCompleteNode(e);if(r)return r.isLeafNode()||r.forEachChild(s.PRIORITY_INDEX,function(e,t){n=n.updateImmediateChild(e,t)}),n;if(t){var i=this.Gr.childCompoundWrite(e);return t.forEachChild(s.PRIORITY_INDEX,function(e,t){var r=i.childCompoundWrite(new o.Path(e)).apply(t);n=n.updateImmediateChild(e,r)}),i.getCompleteChildren().forEach(function(e){n=n.updateImmediateChild(e.name,e.node)}),n}return this.Gr.childCompoundWrite(e).getCompleteChildren().forEach(function(e){n=n.updateImmediateChild(e.name,e.node)}),n},e.prototype.calcEventCacheAfterServerOverwrite=function(e,t,n,r){i.assert(n||r,"Either existingEventSnap or existingServerSnap must exist");var o=e.child(t);if(this.Gr.hasCompleteWrite(o))return null;var a=this.Gr.childCompoundWrite(o);return a.isEmpty()?r.getChild(t):a.apply(r.getChild(t))},e.prototype.calcCompleteChild=function(e,t,n){var r=e.child(t),i=this.Gr.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(t)?this.Gr.childCompoundWrite(r).apply(n.getNode().getImmediateChild(t)):null},e.prototype.shadowingWrite=function(e){return this.Gr.getCompleteNode(e)},e.prototype.calcIndexedSlice=function(e,t,n,r,i,a){var s,u=this.Gr.childCompoundWrite(e),l=u.getCompleteNode(o.Path.Empty);if(null!=l)s=l;else{if(null==t)return[];s=u.apply(t)}if(s=s.withIndex(a),s.isEmpty()||s.isLeafNode())return[];for(var h=[],c=a.getCompare(),p=i?s.getReverseIteratorFrom(n,a):s.getIteratorFrom(n,a),d=p.getNext();d&&h.length0?this.Yr=this.Kr[this.Kr.length-1].writeId:this.Yr=-1},e.$r=function(e){return e.visible},e.Jr=function(e,t,n){for(var s=a.CompoundWrite.Empty,u=0;u0&&r.contains(e.oi,t)&&(n[t]=i,o=!0)}),o&&this.Z.reportStats(n),i.setTimeoutNonBlocking(this.ai.bind(this),Math.floor(2*Math.random()*3e5))},e}();t.StatsReporter=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=function(){function e(){this.si=[],this.ui=0}return e.prototype.queueEvents=function(e){for(var t=null,n=0;n0)return this.di[0];throw Error("No transports available")},e.prototype.upgradeTransport=function(){return this.di.length>1?this.di[1]:null},e}();t.TransportManager=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=function(){function e(e){this.Ht=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}return e.prototype.closeAfter=function(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse=200&&h.status<300){try{e=a.jsonEval(h.responseText)}catch(e){o.warn("Failed to parse JSON response for "+l+": "+h.responseText)}n(null,e)}else 401!==h.status&&404!==h.status&&o.warn("Got unsuccessful REST response for "+l+" Status: "+h.status),n(h.status);n=null}},h.open("GET",l,!0),h.send()})},t}(l.ServerActions);t.ReadonlyRestClient=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(1),o=n(12),a=n(4),s=n(40),u=n(44),l=n(26),h=n(110),c=n(58),p=n(0),d=function(){function e(){this.yi=!1,this.vi=!1,this.gi=!1,this.mi=!1,this.Ci=!1,this.Ei=0,this.Ni="",this.Pi=null,this.Si="",this.bi=null,this.Ti="",this.Ee=a.PRIORITY_INDEX}return e.prototype.hasStart=function(){return this.vi},e.prototype.isViewFromLeft=function(){return""===this.Ni?this.vi:this.Ni===e.Ri.VIEW_FROM_LEFT},e.prototype.getIndexStartValue=function(){return r.assert(this.vi,"Only valid if start has been set"),this.Pi},e.prototype.getIndexStartName=function(){return r.assert(this.vi,"Only valid if start has been set"),this.gi?this.Si:i.MIN_NAME},e.prototype.hasEnd=function(){return this.mi},e.prototype.getIndexEndValue=function(){return r.assert(this.mi,"Only valid if end has been set"),this.bi},e.prototype.getIndexEndName=function(){return r.assert(this.mi,"Only valid if end has been set"),this.Ci?this.Ti:i.MAX_NAME},e.prototype.hasLimit=function(){return this.yi},e.prototype.hasAnchoredLimit=function(){return this.yi&&""!==this.Ni},e.prototype.getLimit=function(){return r.assert(this.yi,"Only valid if limit has been set"),this.Ei},e.prototype.getIndex=function(){return this.Ee},e.prototype.Ii=function(){var t=new e;return t.yi=this.yi,t.Ei=this.Ei,t.vi=this.vi,t.Pi=this.Pi,t.gi=this.gi,t.Si=this.Si,t.mi=this.mi,t.bi=this.bi,t.Ci=this.Ci,t.Ti=this.Ti,t.Ee=this.Ee,t.Ni=this.Ni,t},e.prototype.limit=function(e){var t=this.Ii();return t.yi=!0,t.Ei=e,t.Ni="",t},e.prototype.limitToFirst=function(t){var n=this.Ii();return n.yi=!0,n.Ei=t,n.Ni=e.Ri.VIEW_FROM_LEFT,n},e.prototype.limitToLast=function(t){var n=this.Ii();return n.yi=!0,n.Ei=t,n.Ni=e.Ri.VIEW_FROM_RIGHT,n},e.prototype.startAt=function(e,t){var n=this.Ii();return n.vi=!0,void 0===e&&(e=null),n.Pi=e,null!=t?(n.gi=!0,n.Si=t):(n.gi=!1,n.Si=""),n},e.prototype.endAt=function(e,t){var n=this.Ii();return n.mi=!0,void 0===e&&(e=null),n.bi=e,void 0!==t?(n.Ci=!0,n.Ti=t):(n.Ci=!1,n.Ti=""),n},e.prototype.orderBy=function(e){var t=this.Ii();return t.Ee=e,t},e.prototype.getQueryObject=function(){var t=e.Ri,n={};if(this.vi&&(n[t.INDEX_START_VALUE]=this.Pi,this.gi&&(n[t.INDEX_START_NAME]=this.Si)),this.mi&&(n[t.INDEX_END_VALUE]=this.bi,this.Ci&&(n[t.INDEX_END_NAME]=this.Ti)),this.yi){n[t.LIMIT]=this.Ei;var r=this.Ni;""===r&&(r=this.isViewFromLeft()?t.VIEW_FROM_LEFT:t.VIEW_FROM_RIGHT),n[t.VIEW_FROM]=r}return this.Ee!==a.PRIORITY_INDEX&&(n[t.INDEX]=""+this.Ee),n},e.prototype.loadsAllData=function(){return!(this.vi||this.mi||this.yi)},e.prototype.isDefault=function(){return this.loadsAllData()&&this.Ee==a.PRIORITY_INDEX},e.prototype.getNodeFilter=function(){return this.loadsAllData()?new l.IndexedFilter(this.getIndex()):this.hasLimit()?new h.LimitedFilter(this):new c.RangedFilter(this)},e.prototype.toRestQueryStringParameters=function(){var t=e.wi,n={};if(this.isDefault())return n;var i;return this.Ee===a.PRIORITY_INDEX?i=t.PRIORITY_INDEX:this.Ee===s.VALUE_INDEX?i=t.VALUE_INDEX:this.Ee===o.KEY_INDEX?i=t.KEY_INDEX:(r.assert(this.Ee instanceof u.PathIndex,"Unrecognized index type!"),i=""+this.Ee),n[t.ORDER_BY]=p.stringify(i),this.vi&&(n[t.START_AT]=p.stringify(this.Pi),this.gi&&(n[t.START_AT]+=","+p.stringify(this.Si))),this.mi&&(n[t.END_AT]=p.stringify(this.bi),this.Ci&&(n[t.END_AT]+=","+p.stringify(this.Ti))),this.yi&&(this.isViewFromLeft()?n[t.LIMIT_TO_FIRST]=this.Ei:n[t.LIMIT_TO_LAST]=this.Ei),n},e.Ri={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"},e.wi={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"},e.DEFAULT=new e,e}();t.QueryParams=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(58),i=n(5),o=n(6),a=n(0),s=n(10),u=function(){function e(e){this.Oi=new r.RangedFilter(e),this.Ee=e.getIndex(),this.Ei=e.getLimit(),this.Ai=!e.isViewFromLeft()}return e.prototype.updateChild=function(e,t,n,r,a,s){return this.Oi.matches(new o.NamedNode(t,n))||(n=i.ChildrenNode.EMPTY_NODE),e.getImmediateChild(t).equals(n)?e:e.numChildren()=0)return null!=u&&u.trackChildChange(s.Change.childChangedChange(t,n,_)),c.updateImmediateChild(t,n);null!=u&&u.trackChildChange(s.Change.childRemovedChange(t,_));var g=c.updateImmediateChild(t,i.ChildrenNode.EMPTY_NODE);return null!=y&&this.Oi.matches(y)?(null!=u&&u.trackChildChange(s.Change.childAddedChange(y.name,y.node)),g.updateImmediateChild(y.name,y.node)):g}return n.isEmpty()?e:f&&l(d,p)>=0?(null!=u&&(u.trackChildChange(s.Change.childRemovedChange(d.name,d.node)),u.trackChildChange(s.Change.childAddedChange(t,n))),c.updateImmediateChild(t,n).updateImmediateChild(d.name,i.ChildrenNode.EMPTY_NODE)):e},e}();t.LimitedFilter=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(0),o=n(23),a=n(24),s=n(3),u=n(112),l=n(4),h=n(1),c=n(45),p=n(8),d=n(0),f=n(13),_=n(5),y=n(19);!function(e){e[e.RUN=0]="RUN",e[e.SENT=1]="SENT",e[e.COMPLETED=2]="COMPLETED",e[e.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",e[e.NEEDS_ABORT=4]="NEEDS_ABORT"}(r=t.TransactionStatus||(t.TransactionStatus={})),y.Repo.Mi=25,y.Repo.prototype.ie=function(){this.Li=new u.Tree},y.Repo.prototype.startTransaction=function(e,t,n,s){this.de("transaction on "+e);var u=function(){},y=new o.Reference(this,e);y.on("value",u);var v=function(){y.off("value",u)},g={path:e,update:t,onComplete:n,status:null,order:h.LUIDGenerator(),applyLocally:s,retryCount:0,unwatcher:v,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},m=this.Fi(e);g.currentInputSnapshot=m;var C=g.update(m.val());if(void 0===C){if(g.unwatcher(),g.currentOutputSnapshotRaw=null,g.currentOutputSnapshotResolved=null,g.onComplete){var E=new a.DataSnapshot(g.currentInputSnapshot,new o.Reference(this,g.path),l.PRIORITY_INDEX);g.onComplete(null,!1,E)}}else{p.validateFirebaseData("transaction failed: Data returned ",C,g.path),g.status=r.RUN;var N=this.Li.subTree(e),P=N.getValue()||[];P.push(g),N.setValue(P);var S=void 0;"object"==typeof C&&null!==C&&d.contains(C,".priority")?(S=d.safeGet(C,".priority"),i.assert(p.isValidPriority(S),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):S=(this.ue.calcCompleteEventCache(e)||_.ChildrenNode.EMPTY_NODE).getPriority().val(),S=S;var b=this.generateServerValues(),T=f.nodeFromJSON(C,S),R=c.resolveDeferredValueSnapshot(T,b);g.currentOutputSnapshotRaw=T,g.currentOutputSnapshotResolved=R,g.currentWriteId=this.pe();var I=this.ue.applyUserOverwrite(e,R,g.currentWriteId,g.applyLocally);this.K.raiseEventsForChangedPath(e,I),this.xi()}},y.Repo.prototype.Fi=function(e,t){return this.ue.calcCompleteEventCache(e,t)||_.ChildrenNode.EMPTY_NODE},y.Repo.prototype.xi=function(e){var t=this;if(void 0===e&&(e=this.Li),e||this.ki(e),null!==e.getValue()){var n=this.Wi(e);i.assert(n.length>0,"Sending zero length transaction queue"),n.every(function(e){return e.status===r.RUN})&&this.Vi(e.path(),n)}else e.hasChildren()&&e.forEachChild(function(e){t.xi(e)})},y.Repo.prototype.Vi=function(e,t){for(var n=this,u=t.map(function(e){return e.currentWriteId}),c=this.Fi(e,u),p=c,d=c.hash(),f=0;f=y.Repo.Mi)E=!0,N="maxretry",u=u.concat(this.ue.ackUserWrite(m.currentWriteId,!0));else{var P=this.Fi(m.path,v);m.currentInputSnapshot=P;var S=e[g].update(P.val());if(void 0!==S){p.validateFirebaseData("transaction failed: Data returned ",S,m.path);var b=f.nodeFromJSON(S),T="object"==typeof S&&null!=S&&d.contains(S,".priority");T||(b=b.updatePriority(P.getPriority()));var R=m.currentWriteId,I=this.generateServerValues(),w=c.resolveDeferredValueSnapshot(b,I);m.currentOutputSnapshotRaw=b,m.currentOutputSnapshotResolved=w,m.currentWriteId=this.pe(),v.splice(v.indexOf(R),1),u=u.concat(this.ue.applyUserOverwrite(m.path,w,m.currentWriteId,m.applyLocally)),u=u.concat(this.ue.ackUserWrite(R,!0))}else E=!0,N="nodata",u=u.concat(this.ue.ackUserWrite(m.currentWriteId,!0))}if(this.K.raiseEventsForChangedPath(t,u),u=[],E&&(e[g].status=r.COMPLETED,function(e){setTimeout(e,Math.floor(0))}(e[g].unwatcher),e[g].onComplete))if("nodata"===N){var O=new o.Reference(this,e[g].path),A=e[g].currentInputSnapshot,D=new a.DataSnapshot(A,O,l.PRIORITY_INDEX);n.push(e[g].onComplete.bind(null,null,!1,D))}else n.push(e[g].onComplete.bind(null,Error(N),!1,null))}this.ki(this.Li);for(var g=0;g0?n:null)}e.forEachChild(function(e){t.ki(e)})},y.Repo.prototype.fe=function(e){var t=this,n=this.Qi(e).path(),r=this.Li.subTree(e);return r.forEachAncestor(function(e){t.Ui(e)}),this.Ui(r),r.forEachDescendant(function(e){t.Ui(e)}),n},y.Repo.prototype.Ui=function(e){var t=e.getValue();if(null!==t){for(var n=[],o=[],a=-1,s=0;s0},e.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},e.prototype.forEachChild=function(t){var n=this;o.forEach(this._e.children,function(r,i){t(new e(r,n,i))})},e.prototype.forEachDescendant=function(e,t,n){t&&!n&&e(this),this.forEachChild(function(t){t.forEachDescendant(e,!0,n)}),t&&n&&e(this)},e.prototype.forEachAncestor=function(e,t){for(var n=t?this:this.parent();null!==n;){if(e(n))return!0;n=n.parent()}return!1},e.prototype.forEachImmediateDescendantWithValue=function(e){this.forEachChild(function(t){null!==t.getValue()?e(t):t.forEachImmediateDescendantWithValue(e)})},e.prototype.path=function(){return new i.Path(null===this.Hi?this.Bi:this.Hi.path()+"/"+this.Bi)},e.prototype.name=function(){return this.Bi},e.prototype.parent=function(){return this.Hi},e.prototype.Gi=function(){null!==this.Hi&&this.Hi.Ki(this.Bi,this)},e.prototype.Ki=function(e,t){var n=t.isEmpty(),r=o.contains(this._e.children,e);n&&r?(delete this._e.children[e],this._e.childCount--,this.Gi()):n||r||(this._e.children[e]=t._e,this._e.childCount++,this.Gi())},e}();t.Tree=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(56),i=n(55);t.forceLongPolling=function(){r.WebSocketConnection.forceDisallow(),i.BrowserPollConnection.forceAllow()},t.forceWebSockets=function(){i.BrowserPollConnection.forceDisallow()},t.isWebSocketsAvailable=function(){return r.WebSocketConnection.isAvailable()},t.setSecurityDebugCallback=function(e,t){e.repo.J.at=t},t.stats=function(e,t){e.repo.stats(t)},t.statsIncrementCounter=function(e,t){e.repo.statsIncrementCounter(t)},t.dataUpdateCount=function(e){return e.repo.dataUpdateCount},t.interceptServerData=function(e,t){return e.repo.he(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(36),i=n(52),o=n(28),a=n(54);t.DataConnection=i.PersistentConnection,i.PersistentConnection.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)},i.PersistentConnection.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)},t.RealTimeConnection=a.Connection,t.hijackHash=function(e){var t=i.PersistentConnection.prototype.put;return i.PersistentConnection.prototype.put=function(n,r,i,o){void 0!==o&&(o=e()),t.call(this,n,r,i,o)},function(){i.PersistentConnection.prototype.put=t}},t.ConnectionTarget=r.RepoInfo,t.queryIdentifier=function(e){return e.queryIdentifier()},t.listens=function(e){return e.repo.J.Ze},t.forceRestClient=function(e){o.RepoManager.getInstance().forceRestClient(e)}}],[80])}catch(e){throw Error("Cannot instantiate firebase-database.js - be sure to load firebase-app.js first.")} /*! * @license Firebase v4.12.0 * Build: rev-ef14d4f * Terms: https://firebase.google.com/terms/ */ try{webpackJsonpFirebase([3],{120:function(e,t,r){r(121)},121:function(e,t,r){"use strict";function o(e){var t=new Uint8Array(e);return window.btoa(String.fromCharCode.apply(null,t))}function n(e){if(e.objectStoreNames.contains(v)){var t=e.transaction(v),r=t.objectStore(v),o=new m,n=r.openCursor();n.onerror=function(e){console.warn("Unable to cleanup old IDB.",e)},n.onsuccess=function(){var t=n.result;if(t){var r=t.value;o.deleteToken(r.fcmSenderId,r.fcmToken,r.fcmPushSet),t.continue()}else e.close(),indexedDB.deleteDatabase(y)}}}function i(){var e=indexedDB.open(y);e.onerror=function(e){},e.onsuccess=function(t){n(e.result)}}function s(){}function a(e){var t=function(e){return self&&"ServiceWorkerGlobalScope"in self?new Y(e):new j(e)},r={Messaging:j};e.INTERNAL.registerService("messaging",t,r)}Object.defineProperty(t,"__esModule",{value:!0});var c,u=r(2),_=r(0),d={AVAILABLE_IN_WINDOW:"only-available-in-window",AVAILABLE_IN_SW:"only-available-in-sw",SHOULD_BE_INHERITED:"should-be-overriden",BAD_SENDER_ID:"bad-sender-id",INCORRECT_GCM_SENDER_ID:"incorrect-gcm-sender-id",PERMISSION_DEFAULT:"permission-default",PERMISSION_BLOCKED:"permission-blocked",UNSUPPORTED_BROWSER:"unsupported-browser",NOTIFICATIONS_BLOCKED:"notifications-blocked",FAILED_DEFAULT_REGISTRATION:"failed-serviceworker-registration",SW_REGISTRATION_EXPECTED:"sw-registration-expected",GET_SUBSCRIPTION_FAILED:"get-subscription-failed",INVALID_SAVED_TOKEN:"invalid-saved-token",SW_REG_REDUNDANT:"sw-reg-redundant",TOKEN_SUBSCRIBE_FAILED:"token-subscribe-failed",TOKEN_SUBSCRIBE_NO_TOKEN:"token-subscribe-no-token",TOKEN_SUBSCRIBE_NO_PUSH_SET:"token-subscribe-no-push-set",TOKEN_UNSUBSCRIBE_FAILED:"token-unsubscribe-failed",TOKEN_UPDATE_FAILED:"token-update-failed",TOKEN_UPDATE_NO_TOKEN:"token-update-no-token",USE_SW_BEFORE_GET_TOKEN:"use-sw-before-get-token",INVALID_DELETE_TOKEN:"invalid-delete-token",DELETE_TOKEN_NOT_FOUND:"delete-token-not-found",DELETE_SCOPE_NOT_FOUND:"delete-scope-not-found",BG_HANDLER_FUNCTION_EXPECTED:"bg-handler-function-expected",NO_WINDOW_CLIENT_TO_MSG:"no-window-client-to-msg",UNABLE_TO_RESUBSCRIBE:"unable-to-resubscribe",NO_FCM_TOKEN_FOR_RESUBSCRIBE:"no-fcm-token-for-resubscribe",FAILED_TO_DELETE_TOKEN:"failed-to-delete-token",NO_SW_IN_REG:"no-sw-in-reg",BAD_SCOPE:"bad-scope",BAD_VAPID_KEY:"bad-vapid-key",BAD_SUBSCRIPTION:"bad-subscription",BAD_TOKEN:"bad-token",BAD_PUSH_SET:"bad-push-set",FAILED_DELETE_VAPID_KEY:"failed-delete-vapid-key",INVALID_PUBLIC_VAPID_KEY:"invalid-public-vapid-key",USE_PUBLIC_KEY_BEFORE_GET_TOKEN:"use-public-key-before-get-token",PUBLIC_KEY_DECRYPTION_FAILED:"public-vapid-key-decryption-failed"},p=(c={},c[d.AVAILABLE_IN_WINDOW]="This method is available in a Window context.",c[d.AVAILABLE_IN_SW]="This method is available in a service worker context.",c["should-be-overriden"]="This method should be overriden by extended classes.",c["bad-sender-id"]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",c["permission-default"]="The required permissions were not granted and dismissed instead.",c["permission-blocked"]="The required permissions were not granted and blocked instead.",c["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",c["notifications-blocked"]="Notifications have been blocked.",c[d.FAILED_DEFAULT_REGISTRATION]="We are unable to register the default service worker. {$browserErrorMessage}",c["sw-registration-expected"]="A service worker registration was the expected input.",c["get-subscription-failed"]="There was an error when trying to get any existing Push Subscriptions.",c["invalid-saved-token"]="Unable to access details of the saved token.",c["sw-reg-redundant"]="The service worker being used for push was made redundant.",c["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$message}",c["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",c["token-subscribe-no-push-set"]="FCM returned an invalid response when getting an FCM token.",c["token-unsubscribe-failed"]="A problem occured while unsubscribing the user from FCM: {$message}",c["token-update-failed"]="A problem occured while updating the user from FCM: {$message}",c["token-update-no-token"]="FCM returned no token when updating the user to push.",c["use-sw-before-get-token"]="You must call useServiceWorker() before calling getToken() to ensure your service worker is used.",c["invalid-delete-token"]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",c["delete-token-not-found"]="The deletion attempt for token could not be performed as the token was not found.",c["delete-scope-not-found"]="The deletion attempt for service worker scope could not be performed as the scope was not found.",c["bg-handler-function-expected"]="The input to setBackgroundMessageHandler() must be a function.",c["no-window-client-to-msg"]="An attempt was made to message a non-existant window client.",c["unable-to-resubscribe"]="There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$message}",c["no-fcm-token-for-resubscribe"]="Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.",c["failed-to-delete-token"]="Unable to delete the currently saved token.",c["no-sw-in-reg"]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",c["incorrect-gcm-sender-id"]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",c["bad-scope"]="The service worker scope must be a string with at least one character.",c["bad-vapid-key"]="The public VAPID key is not a Uint8Array with 65 bytes.",c["bad-subscription"]="The subscription must be a valid PushSubscription.",c["bad-token"]="The FCM Token used for storage / lookup was not a valid token string.",c["bad-push-set"]="The FCM push set used for storage / lookup was not not a valid push set string.",c["failed-delete-vapid-key"]="The VAPID key could not be deleted.",c["invalid-public-vapid-key"]="The public VAPID key must be a string.",c[d.PUBLIC_KEY_DECRYPTION_FAILED]="The public VAPID key did not equal 65 bytes when decrypted.",c),f={codes:d,map:p},h=function(){function e(e,t){this.e=new _.ErrorFactory("messaging","Messaging",f.map),this.t=e,this.r=t,this.o=null,this.TRANSACTION_READ_WRITE="readwrite"}return e.prototype.openDatabase=function(){var e=this;return this.o?this.o:(this.o=new Promise(function(t,r){var o=indexedDB.open(e.t,e.r);o.onerror=function(e){r(e.target.error)},o.onsuccess=function(e){t(e.target.result)},o.onupgradeneeded=function(t){try{var o=t.target.result;e.onDBUpgrade(o,t)}catch(e){o.close(),r(e)}}}),this.o)},e.prototype.closeDatabase=function(){var e=this;return Promise.resolve().then(function(){if(e.o)return e.o.then(function(t){t.close(),e.o=null})})},e.prototype.onDBUpgrade=function(e,t){throw this.e.create(f.codes.SHOULD_BE_INHERITED)},e}(),l=h,g=function(e){return o(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},E=new Uint8Array([4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110]),S={userVisibleOnly:!0,applicationServerKey:E},T={DEFAULT_PUBLIC_VAPID_KEY:E,SUBSCRIPTION_DETAILS:S,ENDPOINT:"https://fcm.googleapis.com"},b=function(){function e(){this.e=new _.ErrorFactory("messaging","Messaging",f.map)}return e.prototype.getToken=function(e,t,r){var o=this,n=g(t.getKey("p256dh")),i=g(t.getKey("auth")),s="authorized_entity="+e+"&endpoint="+t.endpoint+"&encryption_key="+n+"&encryption_auth="+i;r!==T.DEFAULT_PUBLIC_VAPID_KEY&&(s+="&application_pub_key="+g(r));var a=new Headers;a.append("Content-Type","application/x-www-form-urlencoded");var c={method:"POST",headers:a,body:s};return fetch(T.ENDPOINT+"/fcm/connect/subscribe",c).then(function(e){return e.json()}).catch(function(){throw o.e.create(f.codes.TOKEN_SUBSCRIBE_FAILED)}).then(function(e){var t=e;if(t.error){var r=t.error.message;throw o.e.create(f.codes.TOKEN_SUBSCRIBE_FAILED,{message:r})}if(!t.token)throw o.e.create(f.codes.TOKEN_SUBSCRIBE_NO_TOKEN);if(!t.pushSet)throw o.e.create(f.codes.TOKEN_SUBSCRIBE_NO_PUSH_SET);return{token:t.token,pushSet:t.pushSet}})},e.prototype.updateToken=function(e,t,r,o,n){var i=this,s=g(o.getKey("p256dh")),a=g(o.getKey("auth")),c="push_set="+r+"&token="+t+"&authorized_entity="+e+"&endpoint="+o.endpoint+"&encryption_key="+s+"&encryption_auth="+a;n!==T.DEFAULT_PUBLIC_VAPID_KEY&&(c+="&application_pub_key="+g(n));var u=new Headers;u.append("Content-Type","application/x-www-form-urlencoded");var _,d={method:"POST",headers:u,body:c};return fetch(T.ENDPOINT+"/fcm/connect/subscribe",d).then(function(e){return _=e,e.json()}).catch(function(){throw i.e.create(f.codes.TOKEN_UPDATE_FAILED)}).then(function(e){if(!_.ok){var t=e.error.message;throw i.e.create(f.codes.TOKEN_UPDATE_FAILED,{message:t})}if(!e.token)throw i.e.create(f.codes.TOKEN_UPDATE_NO_TOKEN);return e.token})},e.prototype.deleteToken=function(e,t,r){var o=this,n="authorized_entity="+e+"&token="+t+"&pushSet="+r,i=new Headers;i.append("Content-Type","application/x-www-form-urlencoded");var s={method:"POST",headers:i,body:n};return fetch(T.ENDPOINT+"/fcm/connect/unsubscribe",s).then(function(e){if(!e.ok)return e.json().then(function(e){if(e.error){var t=e.error.message;throw o.e.create(f.codes.TOKEN_UNSUBSCRIBE_FAILED,{message:t})}},function(e){throw o.e.create(f.codes.TOKEN_UNSUBSCRIBE_FAILED)})})},e}(),m=b,y="undefined",v="fcm_token_object_Store",D="fcm_token_details_db",I=2;s.prototype.fcmToken,s.prototype.swScope,s.prototype.vapidKey,s.prototype.subscription,s.prototype.fcmSenderId,s.prototype.fcmPushSet;var k=function(e){function t(){return e.call(this,D,I)||this}return u.__extends(t,e),t.prototype.onDBUpgrade=function(e,t){if(t.oldVersion<1){var r=e.createObjectStore("fcm_token_object_Store",{keyPath:"swScope"});r.createIndex("fcmSenderId","fcmSenderId",{unique:!1}),r.createIndex("fcmToken","fcmToken",{unique:!0})}t.oldVersion<2&&i()},t.prototype.n=function(e){return u.__awaiter(this,void 0,void 0,function(){return u.__generator(this,function(t){return!e.fcmToken||"string"==typeof e.fcmToken&&0!==e.fcmToken.length?!e.swScope||"string"==typeof e.swScope&&0!==e.swScope.length?!e.vapidKey||e.vapidKey instanceof Uint8Array&&65===e.vapidKey.length?!e.subscription||e.subscription instanceof PushSubscription?!e.fcmSenderId||"string"==typeof e.fcmSenderId&&0!==e.fcmSenderId.length?!e.fcmPushSet||"string"==typeof e.fcmPushSet&&0!==e.fcmPushSet.length?[2]:[2,Promise.reject(this.e.create(f.codes.BAD_PUSH_SET))]:[2,Promise.reject(this.e.create(f.codes.BAD_SENDER_ID))]:[2,Promise.reject(this.e.create(f.codes.BAD_SUBSCRIPTION))]:[2,Promise.reject(this.e.create(f.codes.BAD_VAPID_KEY))]:[2,Promise.reject(this.e.create(f.codes.BAD_SCOPE))]:[2,Promise.reject(this.e.create(f.codes.BAD_TOKEN))]})})},t.prototype.getTokenDetailsFromToken=function(e){var t=this;return e?this.n({fcmToken:e}).then(function(){return t.openDatabase()}).then(function(t){return new Promise(function(r,o){var n=t.transaction(["fcm_token_object_Store"]),i=n.objectStore("fcm_token_object_Store"),s=i.index("fcmToken"),a=s.get(e);a.onerror=function(e){o(e.target.error)},a.onsuccess=function(e){var t=e.target.result?e.target.result:null;r(t)}})}):Promise.reject(this.e.create(f.codes.BAD_TOKEN))},t.prototype.getTokenDetailsFromSWScope=function(e){var t=this;return e?this.n({swScope:e}).then(function(){return t.openDatabase()}).then(function(t){return new Promise(function(r,o){var n=t.transaction(["fcm_token_object_Store"]),i=n.objectStore("fcm_token_object_Store"),s=i.get(e);s.onerror=function(e){o(e.target.error)},s.onsuccess=function(e){var t=e.target.result?e.target.result:null;r(t)}})}):Promise.reject(this.e.create(f.codes.BAD_SCOPE))},t.prototype.saveTokenDetails=function(e){var t=this,r=e.swScope,o=e.vapidKey,n=e.subscription,i=e.fcmSenderId,s=e.fcmToken,a=e.fcmPushSet;return r?o?n?i?s?a?this.n({swScope:r,vapidKey:o,subscription:n,fcmSenderId:i,fcmToken:s,fcmPushSet:a}).then(function(){return t.openDatabase()}).then(function(e){var c={swScope:r,vapidKey:g(o),endpoint:n.endpoint,auth:g(n.getKey("auth")),p256dh:g(n.getKey("p256dh")),fcmSenderId:i,fcmToken:s,fcmPushSet:a,createTime:Date.now()};return new Promise(function(r,o){var n=e.transaction(["fcm_token_object_Store"],t.TRANSACTION_READ_WRITE),i=n.objectStore("fcm_token_object_Store"),s=i.put(c);s.onerror=function(e){o(e.target.error)},s.onsuccess=function(e){r()}})}):Promise.reject(this.e.create(f.codes.BAD_PUSH_SET)):Promise.reject(this.e.create(f.codes.BAD_TOKEN)):Promise.reject(this.e.create(f.codes.BAD_SENDER_ID)):Promise.reject(this.e.create(f.codes.BAD_SUBSCRIPTION)):Promise.reject(this.e.create(f.codes.BAD_VAPID_KEY)):Promise.reject(this.e.create(f.codes.BAD_SCOPE))},t.prototype.deleteToken=function(e){var t=this;return"string"!=typeof e||0===e.length?Promise.reject(this.e.create(f.codes.INVALID_DELETE_TOKEN)):this.getTokenDetailsFromToken(e).then(function(e){if(!e)throw t.e.create(f.codes.DELETE_TOKEN_NOT_FOUND);return t.openDatabase().then(function(r){return new Promise(function(o,n){var i=r.transaction(["fcm_token_object_Store"],t.TRANSACTION_READ_WRITE),s=i.objectStore("fcm_token_object_Store"),a=s.delete(e.swScope);a.onerror=function(e){n(e.target.error)},a.onsuccess=function(r){if(0===r.target.result)return void n(t.e.create(f.codes.FAILED_TO_DELETE_TOKEN));o(e)}})})})},t}(l),w=k,N="fcm_vapid_details_db",P=1,A=function(e){function t(){return e.call(this,N,P)||this}return u.__extends(t,e),t.prototype.onDBUpgrade=function(e){e.createObjectStore("fcm_vapid_object_Store",{keyPath:"swScope"})},t.prototype.getVapidFromSWScope=function(e){return"string"!=typeof e||0===e.length?Promise.reject(this.e.create(f.codes.BAD_SCOPE)):this.openDatabase().then(function(t){return new Promise(function(r,o){var n=t.transaction(["fcm_vapid_object_Store"]),i=n.objectStore("fcm_vapid_object_Store"),s=i.get(e);s.onerror=function(){o(s.error)},s.onsuccess=function(){var e=s.result,t=null;e&&(t=e.vapidKey),r(t)}})})},t.prototype.saveVapidDetails=function(e,t){var r=this;if("string"!=typeof e||0===e.length)return Promise.reject(this.e.create(f.codes.BAD_SCOPE));if(null===t||65!==t.length)return Promise.reject(this.e.create(f.codes.BAD_VAPID_KEY));var o={swScope:e,vapidKey:t};return this.openDatabase().then(function(e){return new Promise(function(t,n){var i=e.transaction(["fcm_vapid_object_Store"],r.TRANSACTION_READ_WRITE),s=i.objectStore("fcm_vapid_object_Store"),a=s.put(o);a.onerror=function(){n(a.error)},a.onsuccess=function(){t()}})})},t.prototype.deleteVapidDetails=function(e){var t=this;return this.getVapidFromSWScope(e).then(function(r){if(!r)throw t.e.create(f.codes.DELETE_SCOPE_NOT_FOUND);return t.openDatabase().then(function(o){return new Promise(function(n,i){var s=o.transaction(["fcm_vapid_object_Store"],t.TRANSACTION_READ_WRITE),a=s.objectStore("fcm_vapid_object_Store"),c=a.delete(e);c.onerror=function(){i(c.error)},c.onsuccess=function(){if(0===c.result)return void i(t.e.create(f.codes.FAILED_DELETE_VAPID_KEY));n(r)}})})})},t}(l),O=A,F="messagingSenderId",C=function(){function e(e){var t=this;if(this.e=new _.ErrorFactory("messaging","Messaging",f.map),!e.options[F]||"string"!=typeof e.options[F])throw this.e.create(f.codes.BAD_SENDER_ID);this.i=e.options[F],this.s=new w,this.a=new O,this.c=new m,this.app=e,this.INTERNAL={},this.INTERNAL.delete=function(){return t.delete()}}return e.prototype.getToken=function(){var e=this,t=this.u();if("granted"!==t)return"denied"===t?Promise.reject(this.e.create(f.codes.NOTIFICATIONS_BLOCKED)):Promise.resolve(null);var r;return this._().then(function(t){return r=t,e.s.getTokenDetailsFromSWScope(r.scope)}).then(function(t){return t?e.manageExistingToken(t,r):e.getNewToken(r)})},e.prototype.manageExistingToken=function(e,t){var r=this;return this.isTokenStillValid(e).then(function(o){return o?Date.now()>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 y(ne.DATA_URL,"Malformed data URL.")}return U(e)}function A(t,e){switch(t){case ne.BASE64:var n=-1!==e.indexOf("-"),r=-1!==e.indexOf("_");if(n||r){var o=n?"-":"_";throw y(t,"Invalid character '"+o+"' found: is it base64url encoded?")}break;case ne.BASE64URL:var i=-1!==e.indexOf("+"),a=-1!==e.indexOf("/");if(i||a){var o=i?"+":"/";throw y(t,"Invalid character '"+o+"' found: is it base64 encoded?")}e=e.replace(/-/g,"+").replace(/_/g,"/")}var s;try{s=atob(e)}catch(e){throw y(t,"Invalid character found")}for(var u=new Uint8Array(s.length),c=0;c=e.length)&&t.substring(t.length-e.length)===e}function S(t){switch(t){case ae.RUNNING:case ae.PAUSING:case ae.CANCELING:return se.RUNNING;case ae.PAUSED:return se.PAUSED;case ae.SUCCESS:return se.SUCCESS;case ae.CANCELED:return se.CANCELED;case ae.ERROR:default:return se.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 P(t){return new Promise(t)}function x(t){return Promise.resolve(t)}function D(t){return Promise.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"==typeof 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 Vt+Zt+t}function Y(t){return Kt+Zt+t}function $(t){return Vt+Jt+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(pe)return pe;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)),pe=r}function ot(t,e){function n(){var n=t.bucket,r=t.fullPath,o=new le(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 fe(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 fe(n,e)}function vt(t){function e(t){if(null!==t&&!B(t))throw"Expected a Function."}return new fe(e,t)}function bt(){return"undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function mt(){for(var t=[],e=0;e0&&(h=Math.min(h,o));var p=c.current,_=p+h,v=h===l?"upload, finalize":"upload",b={"X-Goog-Upload-Command":v,"X-Goog-Upload-Offset":c.current},m=r.slice(p,_);if(null===m)throw f();var g=e.maxUploadRetryTime(),y=new _e(n,"POST",u,g);return y.headers=b,y.body=m.uploadData(),y.progressCallback=s||null,y.errorHandler=Tt(t),y}function Mt(t){return function(){for(var e=[],n=0;n0&&(t.Authorization="Firebase "+e)}function jt(t){var e=void 0!==Xt.default?Xt.default.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 Ue(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 Ae(t,new ce,n)}function Ht(t){var e={TaskState:se,TaskEvent:ie,StringFormat:ne,Storage:Ae,Reference:ye};t.INTERNAL.registerService(Oe,Ft,e,void 0,!0)}Object.defineProperty(e,"__esModule",{value:!0});var zt,Xt=n(7),Vt="https://firebasestorage.googleapis.com",Kt="https://firebasestorage.googleapis.com",Zt="/v0",Jt="/v0",Qt=12e4,Yt=6e4,$t=-9007199254740991,te=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}(),ee={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"},ne={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},re=function(){function t(t,e){this.data=t,this.contentType=e||null}return t}(),oe=function(){function t(t){this.base64=!1,this.contentType=null;var e=t.match(/^data:([^,]+)?,/);if(null===e)throw y(ne.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}(),ie={STATE_CHANGED:"state_changed"},ae={RUNNING:"running",PAUSING:"pausing",PAUSED:"paused",SUCCESS:"success",CANCELING:"canceling",CANCELED:"canceled",ERROR:"error"},se={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(zt||(zt={}));var ue=function(){function t(){var t=this;this.o=!1,this.i=new XMLHttpRequest,this.a=zt.NO_ERROR,this.s=P(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.s},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}(),ce=function(){function t(){}return t.prototype.createXhrIo=function(){return new ue},t}(),le=function(){function t(t,e){this.bucket=t,this.u=e}return Object.defineProperty(t.prototype,"path",{get:function(){return this.u},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 p(e)},t.makeFromUrl=function(e){function n(t){"/"===t.path.charAt(t.path.length-1)&&(t.u=t.u.slice(0,-1))}function r(t){t.u=decodeURIComponent(t.path)}for(var o=null,i=RegExp("^gs://([A-Za-z0-9.\\-]+)(/(.*))?$","i"),a={bucket:1,path:3},s=RegExp("^https?://firebasestorage\\.googleapis\\.com/v[A-Za-z0-9_]+/b/([A-Za-z0-9.\\-]+)/o(/([^?#]*).*)?$","i"),u={bucket:1,path:3},c=[{regex:i,indices:a,postModify:n},{regex:s,indices:u,postModify:r}],l=0;l262144},t.prototype.M=function(){this.k===ae.RUNNING&&null===this.m&&(this.C?null===this.b?this.G():this.f?this.j():this.d?this.q():this.F():this.H())},t.prototype.z=function(t){var e=this;this.U.getAuthToken().then(function(n){switch(e.k){case ae.RUNNING:t(n);break;case ae.CANCELING:e.P(ae.CANCELED);break;case ae.PAUSING:e.P(ae.PAUSED)}})},t.prototype.G=function(){var t=this;this.z(function(e){var n=Pt(t.U,t.T,t.O,t.A,t.N),r=t.U.makeRequest(n,e);t.m=r,r.getPromise().then(function(e){t.m=null,t.b=e,t.f=!1,t.L()},t.I)})},t.prototype.j=function(){var t=this,e=this.b;this.z(function(n){var r=xt(t.U,t.T,e,t.A),o=t.U.makeRequest(r,n);t.m=o,o.getPromise().then(function(e){e=e,t.m=null,t.B(e.current),t.f=!1,e.finalized&&(t.d=!0),t.L()},t.I)})},t.prototype.F=function(){var t=this,e=262144*this.g,n=new ve(this.p,this.A.size()),r=this.b;this.z(function(o){var i;try{i=Dt(t.T,t.U,r,t.A,e,t.O,n,t.W())}catch(e){return t.v=e,void t.P(ae.ERROR)}var a=t.U.makeRequest(i,o);t.m=a,a.getPromise().then(function(e){t.X(),t.m=null,t.B(e.current),e.finalized?(t.N=e.metadata,t.P(ae.SUCCESS)):t.L()},t.I)})},t.prototype.X=function(){262144*this.g<33554432&&(this.g*=2)},t.prototype.q=function(){var t=this;this.z(function(e){var n=Nt(t.U,t.T,t.O),r=t.U.makeRequest(n,e);t.m=r,r.getPromise().then(function(e){t.m=null,t.N=e,t.P(ae.SUCCESS)},t.x)})},t.prototype.H=function(){var t=this;this.z(function(e){var n=It(t.U,t.T,t.O,t.A,t.N),r=t.U.makeRequest(n,e);t.m=r,r.getPromise().then(function(e){t.m=null,t.N=e,t.B(t.A.size()),t.P(ae.SUCCESS)},t.I)})},t.prototype.B=function(t){var e=this.p;this.p=t,this.p!==e&&this.V()},t.prototype.P=function(t){if(this.k!==t)switch(t){case ae.CANCELING:case ae.PAUSING:this.k=t,null!==this.m&&this.m.cancel();break;case ae.RUNNING:var e=this.k===ae.PAUSED;this.k=t,e&&(this.V(),this.M());break;case ae.PAUSED:this.k=t,this.V();break;case ae.CANCELED:this.v=l(),this.k=t,this.V();break;case ae.ERROR:case ae.SUCCESS:this.k=t,this.V()}},t.prototype.L=function(){switch(this.k){case ae.PAUSING:this.P(ae.PAUSED);break;case ae.CANCELING:this.P(ae.CANCELED);break;case ae.RUNNING:this.M()}},Object.defineProperty(t.prototype,"snapshot",{get:function(){var t=S(this.k);return new me(this.p,this.A.size(),t,this.N,this,this.w)},enumerable:!0,configurable:!0}),t.prototype.on=function(t,e,n,r){function o(e){if(t!==ie.STATE_CHANGED)throw"Expected one of the event types: ["+ie.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 u}}function a(t){function e(e,n,o){null!==t&&ct("on",t,arguments);var i=new be(e,n,r);return h.K(i),function(){h.Z(i)}}return e}function s(t){if(null===t)throw u;i(t)}void 0===e&&(e=void 0),void 0===n&&(n=void 0),void 0===r&&(r=void 0);var u="Expected a function or an Object with one of `next`, `error`, `complete` properties.",c=vt(!0).validator,l=_t(null,!0).validator;ct("on",[ht(o),_t(i,!0),vt(!0),vt(!0)],arguments);var h=this,p=[_t(s),vt(!0),vt(!0)];return W(e)||W(n)||W(r)?a(null)(e,n,r):a(p)},t.prototype.then=function(t,e){return this.D.then(t,e)},t.prototype.catch=function(t){return this.then(null,t)},t.prototype.K=function(t){this._.push(t),this.J(t)},t.prototype.Z=function(t){Et(this._,t)},t.prototype.V=function(){var t=this;this.Q(),Rt(this._).forEach(function(e){t.J(e)})},t.prototype.Q=function(){if(null!==this.y){var t=!0;switch(S(this.k)){case se.SUCCESS:Mt(this.y.bind(null,this.snapshot))();break;case se.CANCELED:case se.ERROR:Mt(this.R.bind(null,this.v))();break;default:t=!1}t&&(this.y=null,this.R=null)}},t.prototype.J=function(t){switch(S(this.k)){case se.RUNNING:case se.PAUSED:null!==t.next&&Mt(t.next.bind(t,this.snapshot))();break;case se.SUCCESS:null!==t.complete&&Mt(t.complete.bind(t))();break;case se.CANCELED:case se.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.k===ae.PAUSED||this.k===ae.PAUSING;return t&&this.P(ae.RUNNING),t},t.prototype.pause=function(){ct("pause",[],arguments);var t=this.k===ae.RUNNING;return t&&this.P(ae.PAUSING),t},t.prototype.cancel=function(){ct("cancel",[],arguments);var t=this.k===ae.RUNNING||this.k===ae.PAUSING;return t&&this.P(ae.CANCELING),t},t}(),ye=function(){function t(t,e){this.authWrapper=t,this.location=e instanceof le?e:le.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",[ht()],arguments);var e=Z(this.location.path,t),n=new le(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 le(this.location.bucket,t);return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){var t=new le(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",[pt(),ft(!0)],arguments),this.Y("put"),new ge(this,this.authWrapper,this.location,this.mappings(),new de(t),e)},t.prototype.putString=function(t,e,n){void 0===e&&(e=ne.RAW),ct("putString",[ht(),ht(E,!0),ft(!0)],arguments),this.Y("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 de(r.data,!0),o)},t.prototype.delete=function(){ct("delete",[],arguments),this.Y("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.Y("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.Y("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.Y("getDownloadURL"),this.getMetadata().then(function(t){var e=t.downloadURLs[0];if(M(e))return e;throw _()})},t.prototype.Y=function(t){if(""===this.location.path)throw g(t)},t}(),Re=function(){function t(t){this.D=D(t)}return t.prototype.getPromise=function(){return this.D},t.prototype.cancel=function(t){void 0===t&&(t=!1)},t}(),Ee=function(){function t(){this.$={},this.tt=$t}return t.prototype.addRequest=function(t){function e(){delete r.$[n]}var n=this.tt;this.tt++,this.$[n]=t;var r=this;t.getPromise().then(e,e)},t.prototype.clear=function(){I(this.$,function(t,e){e&&e.cancel(!0)}),this.$={}},t}(),we=function(){function t(e,n,r,o,i){if(this.et=null,this.nt=!1,this.rt=e,null!==this.rt){var a=this.rt.options;M(a)&&(this.et=t.ot(a))}this.it=n,this.at=r,this.st=i,this.ut=o,this.ct=Qt,this.lt=Yt,this.ht=new Ee}return t.ot=function(t){var e=t.storageBucket||null;return null==e?null:le.makeFromBucketSpec(e).bucket},t.prototype.getAuthToken=function(){return null!==this.rt&&M(this.rt.INTERNAL)&&M(this.rt.INTERNAL.getToken)?this.rt.INTERNAL.getToken().then(function(t){return null!==t?t.accessToken:null},function(t){return null}):x(null)},t.prototype.bucket=function(){if(this.nt)throw m();return this.et},t.prototype.service=function(){return this.ut},t.prototype.makeStorageReference=function(t){return this.it(this,t)},t.prototype.makeRequest=function(t,e){if(this.nt)return new Re(m());var n=this.at(t,e,this.st);return this.ht.addRequest(n),n},t.prototype.deleteApp=function(){this.nt=!0,this.rt=null,this.ht.clear()},t.prototype.maxUploadRetryTime=function(){return this.lt},t.prototype.setMaxUploadRetryTime=function(t){this.lt=t},t.prototype.maxOperationRetryTime=function(){return this.ct},t.prototype.setMaxOperationRetryTime=function(t){this.ct=t},t}(),Ue=function(){function t(t,e,n,r,o,i,a,s,u,c,l){this.pt=null,this.ft=null,this.y=null,this.R=null,this.dt=!1,this._t=!1,this.vt=t,this.bt=e,this.mt=n,this.gt=r,this.yt=o.slice(),this.Rt=i.slice(),this.Et=a,this.wt=s,this.Ut=c,this.Tt=u,this.st=l;var h=this;this.D=P(function(t,e){h.y=t,h.R=e,h.M()})}return t.prototype.M=function(){function t(t,e){function r(t){var e=t.loaded,r=t.lengthComputable?t.total:-1;null!==n.Ut&&n.Ut(e,r)}if(e)return void t(!1,new Te(!1,null,!0));var o=n.st.createXhrIo();n.pt=o,null!==n.Ut&&o.addUploadProgressListener(r),o.send(n.vt,n.bt,n.gt,n.mt).then(function(e){null!==n.Ut&&e.removeUploadProgressListener(r),n.pt=null,e=e;var o=e.getErrorCode()===zt.NO_ERROR,i=e.getStatus();if(!o||n.At(i)){var a=e.getErrorCode()===zt.ABORT;return void t(!1,new Te(!1,null,a))}var s=yt(n.yt,i);t(!0,new Te(s,e))})}function e(t,e){var r=n.y,i=n.R,a=e.xhr;if(e.wasSuccessCode)try{var s=n.Et(a,a.getResponseText());W(s)?r(s):r()}catch(t){i(t)}else if(null!==a){var u=o();u.setServerResponseProp(a.getResponseText()),i(n.wt?n.wt(a,u):u)}else if(e.canceled){var u=n._t?m():l();i(u)}else{var u=c();i(u)}}var n=this;this.dt?e(!1,new Te(!1,null,!0)):this.ft=Wt(t,e,this.Tt)},t.prototype.getPromise=function(){return this.D},t.prototype.cancel=function(t){this.dt=!0,this._t=t||!1,null!==this.ft&&Bt(this.ft),null!==this.pt&&this.pt.abort()},t.prototype.At=function(t){var e=t>=500&&t<600,n=[408,429],r=yt(n,t),o=yt(this.Rt,t);return e||r||o},t}(),Te=function(){function t(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n}return t}(),Ae=function(){function t(t,e,n){function r(t,e){return new ye(t,e)}if(this.et=null,this.U=new we(t,r,qt,this,e),this.rt=t,null!=n)this.et=le.makeFromBucketSpec(n);else{var o=this.U.bucket();null!=o&&(this.et=new le(o,""))}this.Nt=new Ne(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",[ht(e,!0)],arguments),null==this.et)throw Error("No Storage Bucket defined in Firebase Options.");var n=new ye(this.U,this.et);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{le.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}}return ct("refFromURL",[ht(e,!1)],arguments),new ye(this.U,t)},Object.defineProperty(t.prototype,"maxUploadRetryTime",{get:function(){return this.U.maxUploadRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxUploadRetryTime=function(t){ct("setMaxUploadRetryTime",[dt()],arguments),this.U.setMaxUploadRetryTime(t)},Object.defineProperty(t.prototype,"maxOperationRetryTime",{get:function(){return this.U.maxOperationRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxOperationRetryTime=function(t){ct("setMaxOperationRetryTime",[dt()],arguments),this.U.setMaxOperationRetryTime(t)},Object.defineProperty(t.prototype,"app",{get:function(){return this.rt},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"INTERNAL",{get:function(){return this.Nt},enumerable:!0,configurable:!0}),t}(),Ne=function(){function t(t){this.ut=t}return t.prototype.delete=function(){return this.ut.U.deleteApp(),x(void 0)},t}();e.registerStorage=Ht;var Oe="storage";Ht(Xt.default)}},[122])}catch(t){throw Error("Cannot instantiate firebase-storage.js - be sure to load firebase-app.js first.")} //# sourceMappingURL=firebase.js.map