text: (window.webpackJsonp=window.webpackJsonp||[]).push([[2],[function(t,e,n){"use strict";t.exports=n(34)},function(t,e,n){"use strict";n.r(e),n.d(e,"__extends",function(){return i}),n.d(e,"__assign",function(){return o}),n.d(e,"__rest",function(){return a}),n.d(e,"__decorate",function(){return s}),n.d(e,"__param",function(){return u}),n.d(e,"__metadata",function(){return c}),n.d(e,"__awaiter",function(){return l}),n.d(e,"__generator",function(){return h}),n.d(e,"__exportStar",function(){return f}),n.d(e,"__values",function(){return p}),n.d(e,"__read",function(){return d}),n.d(e,"__spread",function(){return y}),n.d(e,"__await",function(){return m}),n.d(e,"__asyncGenerator",function(){return g}),n.d(e,"__asyncDelegator",function(){return v}),n.d(e,"__asyncValues",function(){return b}),n.d(e,"__makeTemplateObject",function(){return _}),n.d(e,"__importStar",function(){return w}),n.d(e,"__importDefault",function(){return E});var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t};function a(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&(n[r[i]]=t[r[i]])}return n}function s(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}function u(t,e){return function(n,r){e(n,r,t)}}function c(t,e){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(e){o(e)}}function s(t){try{u(r.throw(t))}catch(e){o(e)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function h(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(s){o=[6,s],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function f(t,e){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}function p(t){var e="function"===typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function d(t,e){var n="function"===typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(s){i={error:s}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function y(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(d(arguments[e]));return t}function m(t){return this instanceof m?(this.v=t,this):new m(t)}function g(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(t){i[t]&&(r[t]=function(e){return new Promise(function(n,r){o.push([t,e,n,r])>1||s(t,e)})})}function s(t,e){try{(n=i[t](e)).value instanceof m?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(r){l(o[0][3],r)}var n}function u(t){s("next",t)}function c(t){s("throw",t)}function l(t,e){t(e),o.shift(),o.length&&s(o[0][0],o[0][1])}}function v(t){var e,n;return e={},r("next"),r("throw",function(t){throw t}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(r,i){t[r]&&(e[r]=function(e){return(n=!n)?{value:m(t[r](e)),done:"return"===r}:i?i(e):e})}}function b(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator];return e?e.call(t):p(t)}function _(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function w(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function E(t){return t&&t.__esModule?t:{default:t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(15),i=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o="[DEFAULT]",a=[],s=function(){function t(t,e,n){this.firebase_=n,this.isDeleted_=!1,this.services_={},this.name_=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled||!1,this.options_=r.deepCopy(t),this.INTERNAL={getUid:function(){return null},getToken:function(){return Promise.resolve(null)},addAuthTokenListener:function(t){a.push(t),setTimeout(function(){return t(null)},0)},removeAuthTokenListener:function(t){a=a.filter(function(e){return e!==t})}}}return Object.defineProperty(t.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this._automaticDataCollectionEnabled},set:function(t){this.checkDestroyed_(),this._automaticDataCollectionEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),t.prototype.delete=function(){var t=this;return new Promise(function(e){t.checkDestroyed_(),e()}).then(function(){t.firebase_.INTERNAL.removeApp(t.name_);var e=[];return Object.keys(t.services_).forEach(function(n){Object.keys(t.services_[n]).forEach(function(r){e.push(t.services_[n][r])})}),Promise.all(e.map(function(t){return t.INTERNAL.delete()}))}).then(function(){t.isDeleted_=!0,t.services_={}})},t.prototype._getService=function(t,e){if(void 0===e&&(e=o),this.checkDestroyed_(),this.services_[t]||(this.services_[t]={}),!this.services_[t][e]){var n=e!==o?e:void 0,r=this.firebase_.INTERNAL.factories[t](this,this.extendApp.bind(this),n);this.services_[t][e]=r}return this.services_[t][e]},t.prototype.extendApp=function(t){var e=this;r.deepExtend(this,t),t.INTERNAL&&t.INTERNAL.addAuthTokenListener&&(a.forEach(function(t){e.INTERNAL.addAuthTokenListener(t)}),a=[])},t.prototype.checkDestroyed_=function(){this.isDeleted_&&u("app-deleted",{name:this.name_})},t}();function u(t,e){throw c.create(t,e)}s.prototype.name&&s.prototype.options||s.prototype.delete||console.log("dc");var c=new r.ErrorFactory("app","Firebase",{"no-app":"No Firebase App '{$name}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$name}","duplicate-app":"Firebase App named '{$name}' already exists","app-deleted":"Firebase App named '{$name}' already deleted","duplicate-service":"Firebase service named '{$name}' already registered","sa-not-supported":"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain","invalid-app-argument":"firebase.{$name}() takes either no argument or a Firebase App instance."}),l=function t(){var e={},n={},a={},c={__esModule:!0,initializeApp:function(t,n){if(void 0===n&&(n={}),"object"!==typeof n||null===n){var r=n;n={name:r}}var a=n;void 0===a.name&&(a.name=o);var l=a.name;"string"===typeof l&&l||u("bad-app-name",{name:l+""}),i(e,l)&&u("duplicate-app",{name:l});var h=new s(t,a,c);return e[l]=h,f(h,"create"),h},app:l,apps:null,Promise:Promise,SDK_VERSION:"5.5.9",INTERNAL:{registerService:function(t,e,i,o,f){n[t]&&u("duplicate-service",{name:t}),n[t]=e,o&&(a[t]=o,h().forEach(function(t){o("create",t)}));var p=function(e){return void 0===e&&(e=l()),"function"!==typeof e[t]&&u("invalid-app-argument",{name:t}),e[t]()};return void 0!==i&&r.deepExtend(p,i),c[t]=p,s.prototype[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this._getService.bind(this,t).apply(this,f?e:[])},p},createFirebaseNamespace:t,extendNamespace:function(t){r.deepExtend(c,t)},createSubscribe:r.createSubscribe,ErrorFactory:r.ErrorFactory,removeApp:function(t){f(e[t],"delete"),delete e[t]},factories:n,useAsService:p,Promise:Promise,deepExtend:r.deepExtend}};function l(t){return i(e,t=t||o)||u("no-app",{name:t}),e[t]}function h(){return Object.keys(e).map(function(t){return e[t]})}function f(t,e){Object.keys(n).forEach(function(n){var r=p(t,n);null!==r&&a[r]&&a[r](e,t)})}function p(t,e){if("serverAuth"===e)return null;var n=e;return t.options,n}return r.patchProperty(c,"default",c),Object.defineProperty(c,"apps",{get:h}),r.patchProperty(l,"App",s),c}();e.firebase=l,e.default=l},function(t,e,n){t.exports=n(39)()},function(t,e,n){"use strict";function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}n.d(e,"a",function(){return r})},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var r=function(){};t.exports=r},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.d(e,"a",function(){return r})},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}n.d(e,"a",function(){return r})},function(t,e,n){"use strict";function r(t){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return(i="function"===typeof Symbol&&"symbol"===r(Symbol.iterator)?function(t){return r(t)}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":r(t)})(t)}var o=n(4);function a(t,e){return!e||"object"!==i(e)&&"function"!==typeof e?Object(o.a)(t):e}n.d(e,"a",function(){return a})},function(t,e,n){"use strict";function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function i(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";t.exports=function(t,e,n,r,i,o,a,s){if(!t){var u;if(void 0===e)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,a,s],l=0;(u=new Error(e.replace(/%s/g,function(){return c[l++]}))).name="Invariant Violation"}throw u.framesToPop=1,u}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var r=n(20);function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),i.forEach(function(e){Object(r.a)(t,e,n[e])})}return t}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),i={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},o=function(t,e){if(!t)throw a(e)},a=function(t){return new Error("Firebase Database ("+i.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},s=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},u={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_: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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<t.length;i+=3){var o=t[i],a=i+1<t.length,s=a?t[i+1]:0,u=i+2<t.length,c=u?t[i+2]:0,l=o>>2,h=(3&o)<<4|s>>4,f=(15&s)<<2|c>>6,p=63&c;u||(p=64,a||(f=64)),r.push(n[l],n[h],n[f],n[p])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(s(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n<t.length;){var i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){var o=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){var a=((7&i)<<18|(63&(o=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(1023&a))}else{o=t[n++];var s=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<t.length;){var o=n[t.charAt(i++)],a=i<t.length?n[t.charAt(i)]:0,s=++i<t.length?n[t.charAt(i)]:64,u=++i<t.length?n[t.charAt(i)]:64;if(++i,null==o||null==a||null==s||null==u)throw Error();var c=o<<2|a>>4;if(r.push(c),64!=s){var l=a<<4&240|s>>2;if(r.push(l),64!=u){var h=s<<6&192|u;r.push(h)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},c=function(t){try{return u.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function l(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n in e)e.hasOwnProperty(n)&&(t[n]=l(t[n],e[n]));return t}var h=function(){function t(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}return t.prototype.wrapCallback=function(t){var e=this;return function(n,r){n?e.reject(n):e.resolve(r),"function"===typeof t&&(e.promise.catch(function(){}),1===t.length?t(n):t(n,r))}},t}(),f=function(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""},p="FirebaseError",d=Error.captureStackTrace;var y=function(){return function(t,e){if(this.code=t,this.message=e,d)d(this,m.prototype.create);else try{throw Error.apply(this,arguments)}catch(n){this.name=p,Object.defineProperty(this,"stack",{get:function(){return n.stack}})}}}();y.prototype=Object.create(Error.prototype),y.prototype.constructor=y,y.prototype.name=p;var m=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n,this.pattern=/\{\$([^}]+)}/g}return t.prototype.create=function(t,e){void 0===e&&(e={});var n,r=this.errors[t],i=this.service+"/"+t;n=void 0===r?"Error":r.replace(this.pattern,function(t,n){var r=e[n];return void 0!==r?r.toString():"<"+n+"?>"}),n=this.serviceName+": "+n+" ("+i+").";var o=new y(i,n);for(var a in e)e.hasOwnProperty(a)&&"_"!==a.slice(-1)&&(o[a]=e[a]);return o},t}();function g(t){return JSON.parse(t)}var v=function(t){var e={},n={},r={},i="";try{var o=t.split(".");e=g(c(o[0])||""),n=g(c(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(a){}return{header:e,claims:n,data:r,signature:i}},b=function(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])},_=function(t,e){return b(e,function(e,n){t[e]=n}),t},w=function(t,e,n){for(var r in t)if(e.call(n,t[r],r,t))return r},E=function(t){function e(){var e=t.call(this)||this;e.chain_=[],e.buf_=[],e.W_=[],e.pad_=[],e.inbuf_=0,e.total_=0,e.blockSize=64,e.pad_[0]=128;for(var n=1;n<e.blockSize;++n)e.pad_[n]=0;return e.reset(),e}return r.__extends(e,t),e.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},e.prototype.compress_=function(t,e){e||(e=0);var n=this.W_;if("string"===typeof t)for(var r=0;r<16;r++)n[r]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(r=0;r<16;r++)n[r]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(r=16;r<80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(i<<1|i>>>31)}var o,a,s=this.chain_[0],u=this.chain_[1],c=this.chain_[2],l=this.chain_[3],h=this.chain_[4];for(r=0;r<80;r++){r<40?r<20?(o=l^u&(c^l),a=1518500249):(o=u^c^l,a=1859775393):r<60?(o=u&c|l&(u|c),a=2400959708):(o=u^c^l,a=3395469782);i=(s<<5|s>>>27)+o+h+a+n[r]&4294967295;h=l,l=c,c=4294967295&(u<<30|u>>>2),u=s,s=i}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},e.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r<e;){if(0==o)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"===typeof t){for(;r<e;)if(i[o]=t.charCodeAt(r),++r,++o==this.blockSize){this.compress_(i),o=0;break}}else for(;r<e;)if(i[o]=t[r],++r,++o==this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=e}},e.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;n>=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},e}(function(){return function(){this.blockSize=-1}}());var T=function(){function t(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(function(){t(n)}).catch(function(t){n.error(t)})}return t.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},t.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},t.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},t.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(t,e){if("object"!==typeof t||null===t)return!1;for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i in t&&"function"===typeof t[i])return!0}return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n}).next&&(r.next=S),void 0===r.error&&(r.error=S),void 0===r.complete&&(r.complete=S);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(t){}}),this.observers.push(r),o},t.prototype.unsubscribeOne=function(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},t.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},t.prototype.sendOne=function(t,e){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[t])try{e(n.observers[t])}catch(r){"undefined"!==typeof console&&console.error&&console.error(r)}})},t.prototype.close=function(t){var e=this;this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(function(){e.observers=void 0,e.onNoObservers=void 0}))},t}();function S(){}function C(t,e,n){var r="";switch(e){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw new Error("errorPrefix called with argumentNumber > 4.  Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}e.assert=o,e.assertionError=a,e.base64=u,e.base64Decode=c,e.base64Encode=function(t){var e=s(t);return u.encodeByteArray(e,!0)},e.CONSTANTS=i,e.deepCopy=function(t){return l(void 0,t)},e.deepExtend=l,e.patchProperty=function(t,e,n){t[e]=n},e.Deferred=h,e.getUA=f,e.isMobileCordova=function(){return"undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(f())},e.isNodeSdk=function(){return!0===i.NODE_CLIENT||!0===i.NODE_ADMIN},e.isReactNative=function(){return"object"===typeof navigator&&"ReactNative"===navigator.product},e.ErrorFactory=m,e.FirebaseError=y,e.patchCapture=function(t){var e=d;return d=t,e},e.jsonEval=g,e.stringify=function(t){return JSON.stringify(t)},e.decode=v,e.isAdmin=function(t){var e=v(t).claims;return"object"===typeof e&&!0===e.admin},e.issuedAtTime=function(t){var e=v(t).claims;return"object"===typeof e&&e.hasOwnProperty("iat")?e.iat:null},e.isValidFormat=function(t){var e=v(t).claims;return!!e&&"object"===typeof e&&e.hasOwnProperty("iat")},e.isValidTimestamp=function(t){var e,n,r=v(t).claims,i=Math.floor((new Date).getTime()/1e3);return"object"===typeof r&&(r.hasOwnProperty("nbf")?e=r.nbf:r.hasOwnProperty("iat")&&(e=r.iat),n=r.hasOwnProperty("exp")?r.exp:e+86400),i&&e&&n&&i>=e&&i<=n},e.clone=function(t){return _({},t)},e.contains=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.every=function(t,e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&!e(n,t[n]))return!1;return!0},e.extend=_,e.findKey=w,e.findValue=function(t,e,n){var r=w(t,e,n);return r&&t[r]},e.forEach=b,e.getAnyKey=function(t){for(var e in t)return e},e.getCount=function(t){var e=0;for(var n in t)e++;return e},e.getValues=function(t){var e=[],n=0;for(var r in t)e[n++]=t[r];return e},e.isEmpty=function(t){for(var e in t)return!1;return!0},e.isNonNullObject=function(t){return"object"===typeof t&&null!==t},e.map=function(t,e,n){var r={};for(var i in t)r[i]=e.call(n,t[i],i,t);return r},e.safeGet=function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]},e.querystring=function(t){var e=[];return b(t,function(t,n){Array.isArray(n)?n.forEach(function(n){e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}),e.length?"&"+e.join("&"):""},e.querystringDecode=function(t){var e={};return t.replace(/^\?/,"").split("&").forEach(function(t){if(t){var n=t.split("=");e[n[0]]=n[1]}}),e},e.Sha1=E,e.async=function(t,e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];Promise.resolve(!0).then(function(){t.apply(void 0,n)}).catch(function(t){e&&e(t)})}},e.createSubscribe=function(t,e){var n=new T(t,e);return n.subscribe.bind(n)},e.errorPrefix=C,e.validateArgCount=function(t,e,n,r){var i;if(r<e?i="at least "+e:r>n&&(i=0===n?"none":"no more than "+n),i)throw new Error(t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")},e.validateCallback=function(t,e,n,r){if((!r||n)&&"function"!==typeof n)throw new Error(C(t,e,r)+"must be a valid function.")},e.validateContextObject=function(t,e,n,r){if((!r||n)&&("object"!==typeof n||null===n))throw new Error(C(t,e,r)+"must be a valid context object.")},e.validateNamespace=function(t,e,n,r){if((!r||n)&&"string"!==typeof n)throw new Error(C(t,e,r)+"must be a valid firebase namespace.")},e.stringLength=function(t){for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e++:r<2048?e+=2:r>=55296&&r<=56319?(e+=4,n++):e+=3}return e},e.stringToByteArray=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);if(i>=55296&&i<=56319){var a=i-55296;o(++r<t.length,"Surrogate pair missing trail surrogate."),i=65536+(a<<10)+(t.charCodeAt(r)-56320)}i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e}},function(t,e,n){"use strict";n(28);var r,i=(r=n(2))&&"object"===typeof r&&"default"in r?r.default:r;n(52),n(53),n(54),n(56),n(57),n(58),console.warn("\nIt looks like you're using the development build of the Firebase JS SDK.\nWhen deploying Firebase apps to production, it is advisable to only import\nthe individual SDK components you intend to use.\n\nFor the module builds, these are available in the following manner\n(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):\n\nCommonJS Modules:\nconst firebase = require('firebase/app');\nrequire('firebase/<PACKAGE>');\n\nES Modules:\nimport firebase from 'firebase/app';\nimport 'firebase/<PACKAGE>';\n\nTypescript:\nimport * as firebase from 'firebase/app';\nimport 'firebase/<PACKAGE>';\n"),t.exports=i},function(t,e,n){"use strict";var r=s(n(38)),i=s(n(45)),o=s(n(27)),a=s(n(24));function s(t){return t&&t.__esModule?t:{default:t}}t.exports={Transition:a.default,TransitionGroup:o.default,ReplaceTransition:i.default,CSSTransition:r.default}},function(t,e,n){t.exports=n(47)},function(t,e,n){"use strict";!function t(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}(),t.exports=n(35)},function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"a",function(){return r})},function(t,e,n){"use strict";var r=n(32),i=n.n(r),o={},a=0;e.a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];"string"===typeof e&&(e={path:e});var r=e,s=r.path,u=r.exact,c=void 0!==u&&u,l=r.strict,h=void 0!==l&&l,f=r.sensitive;if(null==s)return n;var p=function(t,e){var n=""+e.end+e.strict+e.sensitive,r=o[n]||(o[n]={});if(r[t])return r[t];var s=[],u={re:i()(t,s,e),keys:s};return a<1e4&&(r[t]=u,a++),u}(s,{end:c,strict:h,sensitive:void 0!==f&&f}),d=p.re,y=p.keys,m=d.exec(t);if(!m)return null;var g=m[0],v=m.slice(1),b=t===g;return c&&!b?null:{path:s,url:"/"===s&&""===g?"/":g,isExact:b,params:y.reduce(function(t,e,n){return t[e.name]=v[n],t},{})}}},function(t,e,n){"use strict";function r(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(c){return void n(c)}s.done?e(u):Promise.resolve(u).then(r,i)}function i(t){return function(){var e=this,n=arguments;return new Promise(function(i,o){var a=t.apply(e,n);function s(t){r(a,i,o,s,u,"next",t)}function u(t){r(a,i,o,s,u,"throw",t)}s(void 0)})}}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(t,e){for(var n,a,s=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var c in n=Object(arguments[u]))i.call(n,c)&&(s[c]=n[c]);if(r){a=r(n);for(var l=0;l<a.length;l++)o.call(n,a[l])&&(s[a[l]]=n[a[l]])}}return s}},function(t,e,n){"use strict";e.__esModule=!0,e.default=e.EXITING=e.ENTERED=e.ENTERING=e.EXITED=e.UNMOUNTED=void 0;var r=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(3)),i=s(n(0)),o=s(n(19)),a=n(25);n(26);function s(t){return t&&t.__esModule?t:{default:t}}var u="unmounted";e.UNMOUNTED=u;var c="exited";e.EXITED=c;var l="entering";e.ENTERING=l;var h="entered";e.ENTERED=h;e.EXITING="exiting";var f=function(t){var e,n;function r(e,n){var r;r=t.call(this,e,n)||this;var i,o=n.transitionGroup,a=o&&!o.isMounting?e.enter:e.appear;return r.appearStatus=null,e.in?a?(i=c,r.appearStatus=l):i=h:i=e.unmountOnExit||e.mountOnEnter?u:c,r.state={status:i},r.nextCallback=null,r}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var a=r.prototype;return a.getChildContext=function(){return{transitionGroup:null}},r.getDerivedStateFromProps=function(t,e){return t.in&&e.status===u?{status:c}:null},a.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},a.componentDidUpdate=function(t){var e=null;if(t!==this.props){var n=this.state.status;this.props.in?n!==l&&n!==h&&(e=l):n!==l&&n!==h||(e="exiting")}this.updateStatus(!1,e)},a.componentWillUnmount=function(){this.cancelNextCallback()},a.getTimeouts=function(){var t,e,n,r=this.props.timeout;return t=e=n=r,null!=r&&"number"!==typeof r&&(t=r.exit,e=r.enter,n=r.appear),{exit:t,enter:e,appear:n}},a.updateStatus=function(t,e){if(void 0===t&&(t=!1),null!==e){this.cancelNextCallback();var n=o.default.findDOMNode(this);e===l?this.performEnter(n,t):this.performExit(n)}else this.props.unmountOnExit&&this.state.status===c&&this.setState({status:u})},a.performEnter=function(t,e){var n=this,r=this.props.enter,i=this.context.transitionGroup?this.context.transitionGroup.isMounting:e,o=this.getTimeouts();e||r?(this.props.onEnter(t,i),this.safeSetState({status:l},function(){n.props.onEntering(t,i),n.onTransitionEnd(t,o.enter,function(){n.safeSetState({status:h},function(){n.props.onEntered(t,i)})})})):this.safeSetState({status:h},function(){n.props.onEntered(t)})},a.performExit=function(t){var e=this,n=this.props.exit,r=this.getTimeouts();n?(this.props.onExit(t),this.safeSetState({status:"exiting"},function(){e.props.onExiting(t),e.onTransitionEnd(t,r.exit,function(){e.safeSetState({status:c},function(){e.props.onExited(t)})})})):this.safeSetState({status:c},function(){e.props.onExited(t)})},a.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},a.safeSetState=function(t,e){e=this.setNextCallback(e),this.setState(t,e)},a.setNextCallback=function(t){var e=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,e.nextCallback=null,t(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},a.onTransitionEnd=function(t,e,n){this.setNextCallback(n),t?(this.props.addEndListener&&this.props.addEndListener(t,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)):setTimeout(this.nextCallback,0)},a.render=function(){var t=this.state.status;if(t===u)return null;var e=this.props,n=e.children,r=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(e,["children"]);if(delete r.in,delete r.mountOnEnter,delete r.unmountOnExit,delete r.appear,delete r.enter,delete r.exit,delete r.timeout,delete r.addEndListener,delete r.onEnter,delete r.onEntering,delete r.onEntered,delete r.onExit,delete r.onExiting,delete r.onExited,"function"===typeof n)return n(t,r);var o=i.default.Children.only(n);return i.default.cloneElement(o,r)},r}(i.default.Component);function p(){}f.contextTypes={transitionGroup:r.object},f.childContextTypes={transitionGroup:function(){}},f.propTypes={},f.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:p,onEntering:p,onEntered:p,onExit:p,onExiting:p,onExited:p},f.UNMOUNTED=0,f.EXITED=1,f.ENTERING=2,f.ENTERED=3,f.EXITING=4;var d=(0,a.polyfill)(f);e.default=d},function(t,e,n){"use strict";function r(){var t=this.constructor.getDerivedStateFromProps(this.props,this.state);null!==t&&void 0!==t&&this.setState(t)}function i(t){this.setState(function(e){var n=this.constructor.getDerivedStateFromProps(t,e);return null!==n&&void 0!==n?n:null}.bind(this))}function o(t,e){try{var n=this.props,r=this.state;this.props=t,this.state=e,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function a(t){var e=t.prototype;if(!e||!e.isReactComponent)throw new Error("Can only polyfill class components");if("function"!==typeof t.getDerivedStateFromProps&&"function"!==typeof e.getSnapshotBeforeUpdate)return t;var n=null,a=null,s=null;if("function"===typeof e.componentWillMount?n="componentWillMount":"function"===typeof e.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"===typeof e.componentWillReceiveProps?a="componentWillReceiveProps":"function"===typeof e.UNSAFE_componentWillReceiveProps&&(a="UNSAFE_componentWillReceiveProps"),"function"===typeof e.componentWillUpdate?s="componentWillUpdate":"function"===typeof e.UNSAFE_componentWillUpdate&&(s="UNSAFE_componentWillUpdate"),null!==n||null!==a||null!==s){var u=t.displayName||t.name,c="function"===typeof t.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+u+" uses "+c+" but also contains the following legacy lifecycles:"+(null!==n?"\n  "+n:"")+(null!==a?"\n  "+a:"")+(null!==s?"\n  "+s:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"===typeof t.getDerivedStateFromProps&&(e.componentWillMount=r,e.componentWillReceiveProps=i),"function"===typeof e.getSnapshotBeforeUpdate){if("function"!==typeof e.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");e.componentWillUpdate=o;var l=e.componentDidUpdate;e.componentDidUpdate=function(t,e,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;l.call(this,t,e,r)}}return t}n.r(e),n.d(e,"polyfill",function(){return a}),r.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0},function(t,e,n){"use strict";e.__esModule=!0,e.transitionTimeout=function(t){var e="transition"+t+"Timeout",n="transition"+t;return function(t){if(t[n]){if(null==t[e])return new Error(e+" wasn't supplied to CSSTransitionGroup: this can cause unreliable animations and won't be supported in a future version of React. See https://fb.me/react-animation-transition-group-timeout for more information.");if("number"!==typeof t[e])return new Error(e+" must be a number (in milliseconds)")}return null}},e.classNamesShape=e.timeoutsShape=void 0;var r,i=(r=n(3))&&r.__esModule?r:{default:r};var o=i.default.oneOfType([i.default.number,i.default.shape({enter:i.default.number,exit:i.default.number}).isRequired]);e.timeoutsShape=o;var a=i.default.oneOfType([i.default.string,i.default.shape({enter:i.default.string,exit:i.default.string,active:i.default.string}),i.default.shape({enter:i.default.string,enterDone:i.default.string,enterActive:i.default.string,exit:i.default.string,exitDone:i.default.string,exitActive:i.default.string})]);e.classNamesShape=a},function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;var r=s(n(3)),i=s(n(0)),o=n(25),a=n(46);function s(t){return t&&t.__esModule?t:{default:t}}function u(){return(u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var l=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},h=function(t){var e,n;function r(e,n){var r,i=(r=t.call(this,e,n)||this).handleExited.bind(c(c(r)));return r.state={handleExited:i,firstRender:!0},r}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var o=r.prototype;return o.getChildContext=function(){return{transitionGroup:{isMounting:!this.appeared}}},o.componentDidMount=function(){this.appeared=!0,this.mounted=!0},o.componentWillUnmount=function(){this.mounted=!1},r.getDerivedStateFromProps=function(t,e){var n=e.children,r=e.handleExited;return{children:e.firstRender?(0,a.getInitialChildMapping)(t,r):(0,a.getNextChildMapping)(t,n,r),firstRender:!1}},o.handleExited=function(t,e){var n=(0,a.getChildMapping)(this.props.children);t.key in n||(t.props.onExited&&t.props.onExited(e),this.mounted&&this.setState(function(e){var n=u({},e.children);return delete n[t.key],{children:n}}))},o.render=function(){var t=this.props,e=t.component,n=t.childFactory,r=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,["component","childFactory"]),o=l(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,null===e?o:i.default.createElement(e,r,o)},r}(i.default.Component);h.childContextTypes={transitionGroup:r.default.object.isRequired},h.propTypes={},h.defaultProps={component:"div",childFactory:function(t){return t}};var f=(0,o.polyfill)(h);e.default=f,t.exports=e.default},function(t,e,n){"use strict";n.r(e),function(t,e){n(51);var r=setTimeout;function i(){}function o(t){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!==typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function a(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,o._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(i){return void u(e.promise,i)}s(e.promise,r)}else(1===t._state?s:u)(e.promise,t._value)})):t._deferreds.push(e)}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"===typeof e||"function"===typeof e)){var n=e.then;if(e instanceof o)return t._state=3,t._value=e,void c(t);if("function"===typeof n)return void h((r=n,i=e,function(){r.apply(i,arguments)}),t)}t._state=1,t._value=e,c(t)}catch(a){u(t,a)}var r,i}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn(function(){t._handled||o._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"===typeof t?t:null,this.onRejected="function"===typeof e?e:null,this.promise=n}function h(t,e){var n=!1;try{t(function(t){n||(n=!0,s(e,t))},function(t){n||(n=!0,u(e,t))})}catch(r){if(n)return;n=!0,u(e,r)}}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(i);return a(this,new l(t,e,n)),n},o.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){return e.reject(n)})})},o.all=function(t){return new o(function(e,n){if(!t||"undefined"===typeof t.length)throw new TypeError("Promise.all accepts an array");var r=Array.prototype.slice.call(t);if(0===r.length)return e([]);var i=r.length;function o(t,a){try{if(a&&("object"===typeof a||"function"===typeof a)){var s=a.then;if("function"===typeof s)return void s.call(a,function(e){o(t,e)},n)}r[t]=a,0===--i&&e(r)}catch(u){n(u)}}for(var a=0;a<r.length;a++)o(a,r[a])})},o.resolve=function(t){return t&&"object"===typeof t&&t.constructor===o?t:new o(function(e){e(t)})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){for(var r=0,i=t.length;r<i;r++)t[r].then(e,n)})},o._immediateFn="function"===typeof t&&function(e){t(e)}||function(t){r(t,0)},o._unhandledRejectionFn=function(t){"undefined"!==typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var f=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof e)return e;throw new Error("unable to locate global object")}();function p(t,e){return t(e={exports:{}},e.exports),e.exports}f.Promise||(f.Promise=o);var d=p(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),y=p(function(t){var e=t.exports={version:"2.5.5"};"number"==typeof __e&&(__e=e)}),m=(y.version,function(t){return"object"===typeof t?null!==t:"function"===typeof t}),g=function(t){if(!m(t))throw TypeError(t+" is not an object!");return t},v=function(t){try{return!!t()}catch(e){return!0}},b=!v(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),_=d.document,w=m(_)&&m(_.createElement),E=function(t){return w?_.createElement(t):{}},T=!b&&!v(function(){return 7!=Object.defineProperty(E("div"),"a",{get:function(){return 7}}).a}),S=function(t,e){if(!m(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!m(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!m(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!m(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},C=Object.defineProperty,I={f:b?Object.defineProperty:function(t,e,n){if(g(t),e=S(e,!0),g(n),T)try{return C(t,e,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},N=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},k=b?function(t,e,n){return I.f(t,e,N(1,n))}:function(t,e,n){return t[e]=n,t},D={}.hasOwnProperty,A=function(t,e){return D.call(t,e)},O=0,R=Math.random(),P=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++O+R).toString(36))},x=p(function(t){var e=P("src"),n=Function.toString,r=(""+n).split("toString");y.inspectSource=function(t){return n.call(t)},(t.exports=function(t,n,i,o){var a="function"==typeof i;a&&(A(i,"name")||k(i,"name",n)),t[n]!==i&&(a&&(A(i,e)||k(i,e,t[n]?""+t[n]:r.join(String(n)))),t===d?t[n]=i:o?t[n]?t[n]=i:k(t,n,i):(delete t[n],k(t,n,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[e]||n.call(this)})}),L=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}},M=function t(e,n,r){var i,o,a,s,u=e&t.F,c=e&t.G,l=e&t.P,h=e&t.B,f=c?d:e&t.S?d[n]||(d[n]={}):(d[n]||{}).prototype,p=c?y:y[n]||(y[n]={}),m=p.prototype||(p.prototype={});for(i in c&&(r=n),r)a=((o=!u&&f&&void 0!==f[i])?f:r)[i],s=h&&o?L(a,d):l&&"function"==typeof a?L(Function.call,a):a,f&&x(f,i,a,e&t.U),p[i]!=a&&k(p,i,s),l&&m[i]!=a&&(m[i]=a)};d.core=y,M.F=1,M.G=2,M.S=4,M.P=8,M.B=16,M.W=32,M.U=64,M.R=128;var F=M,U={}.toString,j=function(t){return U.call(t).slice(8,-1)},V=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==j(t)?t.split(""):Object(t)},B=function(t){if(void 0==t)throw TypeError("Can't call method on  "+t);return t},q=function(t){return Object(B(t))},W=Math.ceil,K=Math.floor,Q=function(t){return isNaN(t=+t)?0:(t>0?K:W)(t)},H=Math.min,z=function(t){return t>0?H(Q(t),9007199254740991):0},G=Array.isArray||function(t){return"Array"==j(t)},Y=d["__core-js_shared__"]||(d["__core-js_shared__"]={}),X=function(t){return Y[t]||(Y[t]={})},J=p(function(t){var e=X("wks"),n=d.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:P)("Symbol."+t))}).store=e}),$=J("species"),Z=function(t,e){return new(function(t){var e;return G(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!G(e.prototype)||(e=void 0),m(e)&&null===(e=e[$])&&(e=void 0)),void 0===e?Array:e}(t))(e)},tt=function(t,e){var n=1==t,r=2==t,i=3==t,o=4==t,a=6==t,s=5==t||a,u=e||Z;return function(e,c,l){for(var h,f,p=q(e),d=V(p),y=L(c,l,3),m=z(d.length),g=0,v=n?u(e,m):r?u(e,0):void 0;m>g;g++)if((s||g in d)&&(f=y(h=d[g],g,p),t))if(n)v[g]=f;else if(f)switch(t){case 3:return!0;case 5:return h;case 6:return g;case 2:v.push(h)}else if(o)return!1;return a?-1:i||o?o:v}},et=J("unscopables"),nt=Array.prototype;void 0==nt[et]&&k(nt,et,{});var rt=function(t){nt[et][t]=!0},it=tt(5),ot=!0;"find"in[]&&Array(1).find(function(){ot=!1}),F(F.P+F.F*ot,"Array",{find:function(t){return it(this,t,arguments.length>1?arguments[1]:void 0)}}),rt("find");y.Array.find;var at=tt(6),st=!0;"findIndex"in[]&&Array(1).findIndex(function(){st=!1}),F(F.P+F.F*st,"Array",{findIndex:function(t){return at(this,t,arguments.length>1?arguments[1]:void 0)}}),rt("findIndex");y.Array.findIndex;var ut,ct=function(t){return V(B(t))},lt=Math.max,ht=Math.min,ft=X("keys"),pt=function(t){return ft[t]||(ft[t]=P(t))},dt=(ut=!1,function(t,e,n){var r,i=ct(t),o=z(i.length),a=function(t,e){return(t=Q(t))<0?lt(t+e,0):ht(t,e)}(n,o);if(ut&&e!=e){for(;o>a;)if((r=i[a++])!=r)return!0}else for(;o>a;a++)if((ut||a in i)&&i[a]===e)return ut||a||0;return!ut&&-1}),yt=pt("IE_PROTO"),mt=function(t,e){var n,r=ct(t),i=0,o=[];for(n in r)n!=yt&&A(r,n)&&o.push(n);for(;e.length>i;)A(r,n=e[i++])&&(~dt(o,n)||o.push(n));return o},gt="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),vt=Object.keys||function(t){return mt(t,gt)},bt={f:Object.getOwnPropertySymbols},_t={f:{}.propertyIsEnumerable},wt=Object.assign,Et=!wt||v(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=wt({},t)[n]||Object.keys(wt({},e)).join("")!=r})?function(t,e){for(var n=q(t),r=arguments.length,i=1,o=bt.f,a=_t.f;r>i;)for(var s,u=V(arguments[i++]),c=o?vt(u).concat(o(u)):vt(u),l=c.length,h=0;l>h;)a.call(u,s=c[h++])&&(n[s]=u[s]);return n}:wt;F(F.S+F.F,"Object",{assign:Et});y.Object.assign;var Tt=J("match"),St=function(t,e,n){if(function(t){var e;return m(t)&&(void 0!==(e=t[Tt])?!!e:"RegExp"==j(t))}(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(B(t))},Ct=J("match"),It="".startsWith;F(F.P+F.F*function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[Ct]=!1,!"/./"[t](e)}catch(r){}}return!0}("startsWith"),"String",{startsWith:function(t){var e=St(this,t,"startsWith"),n=z(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return It?It.call(e,r,n):e.slice(n,n+r.length)===r}});y.String.startsWith;F(F.P,"String",{repeat:function(t){var e=String(B(this)),n="",r=Q(t);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n}});y.String.repeat;var Nt=p(function(t){var e=P("meta"),n=I.f,r=0,i=Object.isExtensible||function(){return!0},o=!v(function(){return i(Object.preventExtensions({}))}),a=function(t){n(t,e,{value:{i:"O"+ ++r,w:{}}})},s=t.exports={KEY:e,NEED:!1,fastKey:function(t,n){if(!m(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!A(t,e)){if(!i(t))return"F";if(!n)return"E";a(t)}return t[e].i},getWeak:function(t,n){if(!A(t,e)){if(!i(t))return!0;if(!n)return!1;a(t)}return t[e].w},onFreeze:function(t){return o&&s.NEED&&i(t)&&!A(t,e)&&a(t),t}}}),kt=(Nt.KEY,Nt.NEED,Nt.fastKey,Nt.getWeak,Nt.onFreeze,I.f),Dt=J("toStringTag"),At=function(t,e,n){t&&!A(t=n?t:t.prototype,Dt)&&kt(t,Dt,{configurable:!0,value:e})},Ot={f:J},Rt=I.f,Pt=function(t){var e=y.Symbol||(y.Symbol=d.Symbol||{});"_"==t.charAt(0)||t in e||Rt(e,t,{value:Ot.f(t)})},xt=b?Object.defineProperties:function(t,e){g(t);for(var n,r=vt(e),i=r.length,o=0;i>o;)I.f(t,n=r[o++],e[n]);return t},Lt=d.document,Mt=Lt&&Lt.documentElement,Ft=pt("IE_PROTO"),Ut=function(){},jt=function(){var t,e=E("iframe"),n=gt.length;for(e.style.display="none",Mt.appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),jt=t.F;n--;)delete jt.prototype[gt[n]];return jt()},Vt=Object.create||function(t,e){var n;return null!==t?(Ut.prototype=g(t),n=new Ut,Ut.prototype=null,n[Ft]=t):n=jt(),void 0===e?n:xt(n,e)},Bt=gt.concat("length","prototype"),qt={f:Object.getOwnPropertyNames||function(t){return mt(t,Bt)}},Wt=qt.f,Kt={}.toString,Qt="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Ht={f:function(t){return Qt&&"[object Window]"==Kt.call(t)?function(t){try{return Wt(t)}catch(e){return Qt.slice()}}(t):Wt(ct(t))}},zt=Object.getOwnPropertyDescriptor,Gt={f:b?zt:function(t,e){if(t=ct(t),e=S(e,!0),T)try{return zt(t,e)}catch(n){}if(A(t,e))return N(!_t.f.call(t,e),t[e])}},Yt=Nt.KEY,Xt=Gt.f,Jt=I.f,$t=Ht.f,Zt=d.Symbol,te=d.JSON,ee=te&&te.stringify,ne=J("_hidden"),re=J("toPrimitive"),ie={}.propertyIsEnumerable,oe=X("symbol-registry"),ae=X("symbols"),se=X("op-symbols"),ue=Object.prototype,ce="function"==typeof Zt,le=d.QObject,he=!le||!le.prototype||!le.prototype.findChild,fe=b&&v(function(){return 7!=Vt(Jt({},"a",{get:function(){return Jt(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=Xt(ue,e);r&&delete ue[e],Jt(t,e,n),r&&t!==ue&&Jt(ue,e,r)}:Jt,pe=function(t){var e=ae[t]=Vt(Zt.prototype);return e._k=t,e},de=ce&&"symbol"==typeof Zt.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof Zt},ye=function(t,e,n){return t===ue&&ye(se,e,n),g(t),e=S(e,!0),g(n),A(ae,e)?(n.enumerable?(A(t,ne)&&t[ne][e]&&(t[ne][e]=!1),n=Vt(n,{enumerable:N(0,!1)})):(A(t,ne)||Jt(t,ne,N(1,{})),t[ne][e]=!0),fe(t,e,n)):Jt(t,e,n)},me=function(t,e){g(t);for(var n,r=function(t){var e=vt(t),n=bt.f;if(n)for(var r,i=n(t),o=_t.f,a=0;i.length>a;)o.call(t,r=i[a++])&&e.push(r);return e}(e=ct(e)),i=0,o=r.length;o>i;)ye(t,n=r[i++],e[n]);return t},ge=function(t){var e=ie.call(this,t=S(t,!0));return!(this===ue&&A(ae,t)&&!A(se,t))&&(!(e||!A(this,t)||!A(ae,t)||A(this,ne)&&this[ne][t])||e)},ve=function(t,e){if(t=ct(t),e=S(e,!0),t!==ue||!A(ae,e)||A(se,e)){var n=Xt(t,e);return!n||!A(ae,e)||A(t,ne)&&t[ne][e]||(n.enumerable=!0),n}},be=function(t){for(var e,n=$t(ct(t)),r=[],i=0;n.length>i;)A(ae,e=n[i++])||e==ne||e==Yt||r.push(e);return r},_e=function(t){for(var e,n=t===ue,r=$t(n?se:ct(t)),i=[],o=0;r.length>o;)!A(ae,e=r[o++])||n&&!A(ue,e)||i.push(ae[e]);return i};ce||(x((Zt=function(){if(this instanceof Zt)throw TypeError("Symbol is not a constructor!");var t=P(arguments.length>0?arguments[0]:void 0);return b&&he&&fe(ue,t,{configurable:!0,set:function e(n){this===ue&&e.call(se,n),A(this,ne)&&A(this[ne],t)&&(this[ne][t]=!1),fe(this,t,N(1,n))}}),pe(t)}).prototype,"toString",function(){return this._k}),Gt.f=ve,I.f=ye,qt.f=Ht.f=be,_t.f=ge,bt.f=_e,b&&x(ue,"propertyIsEnumerable",ge,!0),Ot.f=function(t){return pe(J(t))}),F(F.G+F.W+F.F*!ce,{Symbol:Zt});for(var we="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Ee=0;we.length>Ee;)J(we[Ee++]);for(var Te=vt(J.store),Se=0;Te.length>Se;)Pt(Te[Se++]);F(F.S+F.F*!ce,"Symbol",{for:function(t){return A(oe,t+="")?oe[t]:oe[t]=Zt(t)},keyFor:function(t){if(!de(t))throw TypeError(t+" is not a symbol!");for(var e in oe)if(oe[e]===t)return e},useSetter:function(){he=!0},useSimple:function(){he=!1}}),F(F.S+F.F*!ce,"Object",{create:function(t,e){return void 0===e?Vt(t):me(Vt(t),e)},defineProperty:ye,defineProperties:me,getOwnPropertyDescriptor:ve,getOwnPropertyNames:be,getOwnPropertySymbols:_e}),te&&F(F.S+F.F*(!ce||v(function(){var t=Zt();return"[null]"!=ee([t])||"{}"!=ee({a:t})||"{}"!=ee(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(m(e)||void 0!==t)&&!de(t))return G(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!de(e))return e}),r[1]=e,ee.apply(te,r)}}),Zt.prototype[re]||k(Zt.prototype,re,Zt.prototype.valueOf),At(Zt,"Symbol"),At(Math,"Math",!0),At(d.JSON,"JSON",!0);var Ce=J("toStringTag"),Ie="Arguments"==j(function(){return arguments}()),Ne={};Ne[J("toStringTag")]="z",Ne+""!="[object z]"&&x(Object.prototype,"toString",function(){return"[object "+function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(n){}}(e=Object(t),Ce))?n:Ie?j(e):"Object"==(r=j(e))&&"function"==typeof e.callee?"Arguments":r}(this)+"]"},!0),Pt("asyncIterator"),Pt("observable");y.Symbol;var ke={},De={};k(De,J("iterator"),function(){return this});var Ae,Oe=function(t,e,n){t.prototype=Vt(De,{next:N(1,n)}),At(t,e+" Iterator")},Re=pt("IE_PROTO"),Pe=Object.prototype,xe=Object.getPrototypeOf||function(t){return t=q(t),A(t,Re)?t[Re]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Pe:null},Le=J("iterator"),Me=!([].keys&&"next"in[].keys()),Fe=function(){return this},Ue=function(t,e,n,r,i,o,a){Oe(n,e,r);var s,u,c,l=function(t){if(!Me&&t in d)return d[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},h=e+" Iterator",f="values"==i,p=!1,d=t.prototype,y=d[Le]||d["@@iterator"]||i&&d[i],m=y||l(i),g=i?f?l("entries"):m:void 0,v="Array"==e&&d.entries||y;if(v&&(c=xe(v.call(new t)))!==Object.prototype&&c.next&&(At(c,h,!0),"function"!=typeof c[Le]&&k(c,Le,Fe)),f&&y&&"values"!==y.name&&(p=!0,m=function(){return y.call(this)}),(Me||p||!d[Le])&&k(d,Le,m),ke[e]=m,ke[h]=Fe,i)if(s={values:f?m:l("values"),keys:o?m:l("keys"),entries:g},a)for(u in s)u in d||x(d,u,s[u]);else F(F.P+F.F*(Me||p),e,s);return s},je=(Ae=!0,function(t,e){var n,r,i=String(B(t)),o=Q(e),a=i.length;return o<0||o>=a?Ae?"":void 0:(n=i.charCodeAt(o))<55296||n>56319||o+1===a||(r=i.charCodeAt(o+1))<56320||r>57343?Ae?i.charAt(o):n:Ae?i.slice(o,o+2):r-56320+(n-55296<<10)+65536});Ue(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=je(e,n),this._i+=t.length,{value:t,done:!1})});var Ve=function(t,e){return{value:e,done:!!t}},Be=Ue(Array,"Array",function(t,e){this._t=ct(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,Ve(1)):Ve(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");ke.Arguments=ke.Array,rt("keys"),rt("values"),rt("entries");for(var qe=J("iterator"),We=J("toStringTag"),Ke=ke.Array,Qe={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},He=vt(Qe),ze=0;ze<He.length;ze++){var Ge,Ye=He[ze],Xe=Qe[Ye],Je=d[Ye],$e=Je&&Je.prototype;if($e&&($e[qe]||k($e,qe,Ke),$e[We]||k($e,We,Ye),ke[Ye]=Ke,Xe))for(Ge in Be)$e[Ge]||x($e,Ge,Be[Ge],!0)}Ot.f("iterator")}.call(this,n(49).setImmediate,n(14))},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"===typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"===typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,h=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&p())}function p(){if(!l){var t=s(f);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function y(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||l||s(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";n.r(e),n.d(e,"setLogLevel",function(){return u}),n.d(e,"Logger",function(){return s}),n.d(e,"LogLevel",function(){return r});var r,i=[];!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(r||(r={}));var o=r.INFO,a=function(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(!(e<t.logLevel)){var o=(new Date).toISOString();switch(e){case r.DEBUG:case r.VERBOSE:console.log.apply(console,["["+o+"]  "+t.name+":"].concat(n));break;case r.INFO:console.info.apply(console,["["+o+"]  "+t.name+":"].concat(n));break;case r.WARN:console.warn.apply(console,["["+o+"]  "+t.name+":"].concat(n));break;case r.ERROR:console.error.apply(console,["["+o+"]  "+t.name+":"].concat(n));break;default:throw new Error("Attempted to log a message with an invalid logType (value: "+e+")")}}},s=function(){function t(t){this.name=t,this._logLevel=o,this._logHandler=a,i.push(this)}return Object.defineProperty(t.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in r))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!==typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!0,configurable:!0}),t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.DEBUG].concat(t))},t.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.VERBOSE].concat(t))},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.INFO].concat(t))},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.WARN].concat(t))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,r.ERROR].concat(t))},t}();function u(t){i.forEach(function(e){e.logLevel=t})}},function(t,e,n){t.exports=n(59)},function(t,e,n){var r=n(61);t.exports=p,t.exports.parse=o,t.exports.compile=function(t,e){return s(o(t,e))},t.exports.tokensToFunction=s,t.exports.tokensToRegExp=f;var i=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function o(t,e){for(var n,r=[],o=0,a=0,s="",l=e&&e.delimiter||"/";null!=(n=i.exec(t));){var h=n[0],f=n[1],p=n.index;if(s+=t.slice(a,p),a=p+h.length,f)s+=f[1];else{var d=t[a],y=n[2],m=n[3],g=n[4],v=n[5],b=n[6],_=n[7];s&&(r.push(s),s="");var w=null!=y&&null!=d&&d!==y,E="+"===b||"*"===b,T="?"===b||"*"===b,S=n[2]||l,C=g||v;r.push({name:m||o++,prefix:y||"",delimiter:S,optional:T,repeat:E,partial:w,asterisk:!!_,pattern:C?c(C):_?".*":"[^"+u(S)+"]+?"})}}return a<t.length&&(s+=t.substr(a)),s&&r.push(s),r}function a(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function s(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"===typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,i){for(var o="",s=n||{},u=(i||{}).pretty?a:encodeURIComponent,c=0;c<t.length;c++){var l=t[c];if("string"!==typeof l){var h,f=s[l.name];if(null==f){if(l.optional){l.partial&&(o+=l.prefix);continue}throw new TypeError('Expected "'+l.name+'" to be defined')}if(r(f)){if(!l.repeat)throw new TypeError('Expected "'+l.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(l.optional)continue;throw new TypeError('Expected "'+l.name+'" to not be empty')}for(var p=0;p<f.length;p++){if(h=u(f[p]),!e[c].test(h))throw new TypeError('Expected all "'+l.name+'" to match "'+l.pattern+'", but received `'+JSON.stringify(h)+"`");o+=(0===p?l.prefix:l.delimiter)+h}}else{if(h=l.asterisk?encodeURI(f).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()}):u(f),!e[c].test(h))throw new TypeError('Expected "'+l.name+'" to match "'+l.pattern+'", but received "'+h+'"');o+=l.prefix+h}}else o+=l}return o}}function u(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function c(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function l(t,e){return t.keys=e,t}function h(t){return t.sensitive?"":"i"}function f(t,e,n){r(e)||(n=e||n,e=[]);for(var i=(n=n||{}).strict,o=!1!==n.end,a="",s=0;s<t.length;s++){var c=t[s];if("string"===typeof c)a+=u(c);else{var f=u(c.prefix),p="(?:"+c.pattern+")";e.push(c),c.repeat&&(p+="(?:"+f+p+")*"),a+=p=c.optional?c.partial?f+"("+p+")?":"(?:"+f+"("+p+"))?":f+"("+p+")"}}var d=u(n.delimiter||"/"),y=a.slice(-d.length)===d;return i||(a=(y?a.slice(0,-d.length):a)+"(?:"+d+"(?=$))?"),a+=o?"$":i&&y?"":"(?="+d+"|$)",l(new RegExp("^"+a,h(n)),e)}function p(t,e,n){return r(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?function(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return l(t,e)}(t,e):r(t)?function(t,e,n){for(var r=[],i=0;i<t.length;i++)r.push(p(t[i],e,n).source);return l(new RegExp("(?:"+r.join("|")+")",h(n)),e)}(t,e,n):function(t,e,n){return f(o(t,n),e,n)}(t,e,n)}},,function(t,e,n){"use strict";var r=n(23),i="function"===typeof Symbol&&Symbol.for,o=i?Symbol.for("react.element"):60103,a=i?Symbol.for("react.portal"):60106,s=i?Symbol.for("react.fragment"):60107,u=i?Symbol.for("react.strict_mode"):60108,c=i?Symbol.for("react.profiler"):60114,l=i?Symbol.for("react.provider"):60109,h=i?Symbol.for("react.context"):60110,f=i?Symbol.for("react.concurrent_mode"):60111,p=i?Symbol.for("react.forward_ref"):60112,d=i?Symbol.for("react.suspense"):60113,y=i?Symbol.for("react.memo"):60115,m=i?Symbol.for("react.lazy"):60116,g="function"===typeof Symbol&&Symbol.iterator;function v(t){for(var e=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(t,e,n,r,i,o,a,s){if(!t){if(t=void 0,void 0===e)t=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,i,o,a,s],c=0;(t=Error(e.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw t.framesToPop=1,t}}(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_={};function w(t,e,n){this.props=t,this.context=e,this.refs=_,this.updater=n||b}function E(){}function T(t,e,n){this.props=t,this.context=e,this.refs=_,this.updater=n||b}w.prototype.isReactComponent={},w.prototype.setState=function(t,e){"object"!==typeof t&&"function"!==typeof t&&null!=t&&v("85"),this.updater.enqueueSetState(this,t,e,"setState")},w.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},E.prototype=w.prototype;var S=T.prototype=new E;S.constructor=T,r(S,w.prototype),S.isPureReactComponent=!0;var C={current:null,currentDispatcher:null},I=Object.prototype.hasOwnProperty,N={key:!0,ref:!0,__self:!0,__source:!0};function k(t,e,n){var r=void 0,i={},a=null,s=null;if(null!=e)for(r in void 0!==e.ref&&(s=e.ref),void 0!==e.key&&(a=""+e.key),e)I.call(e,r)&&!N.hasOwnProperty(r)&&(i[r]=e[r]);var u=arguments.length-2;if(1===u)i.children=n;else if(1<u){for(var c=Array(u),l=0;l<u;l++)c[l]=arguments[l+2];i.children=c}if(t&&t.defaultProps)for(r in u=t.defaultProps)void 0===i[r]&&(i[r]=u[r]);return{$$typeof:o,type:t,key:a,ref:s,props:i,_owner:C.current}}function D(t){return"object"===typeof t&&null!==t&&t.$$typeof===o}var A=/\/+/g,O=[];function R(t,e,n,r){if(O.length){var i=O.pop();return i.result=t,i.keyPrefix=e,i.func=n,i.context=r,i.count=0,i}return{result:t,keyPrefix:e,func:n,context:r,count:0}}function P(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>O.length&&O.push(t)}function x(t,e,n){return null==t?0:function t(e,n,r,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var u=!1;if(null===e)u=!0;else switch(s){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case o:case a:u=!0}}if(u)return r(i,e,""===n?"."+L(e,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(e))for(var c=0;c<e.length;c++){var l=n+L(s=e[c],c);u+=t(s,l,r,i)}else if(l=null===e||"object"!==typeof e?null:"function"===typeof(l=g&&e[g]||e["@@iterator"])?l:null,"function"===typeof l)for(e=l.call(e),c=0;!(s=e.next()).done;)u+=t(s=s.value,l=n+L(s,c++),r,i);else"object"===s&&v("31","[object Object]"===(r=""+e)?"object with keys {"+Object.keys(e).join(", ")+"}":r,"");return u}(t,"",e,n)}function L(t,e){return"object"===typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(t){return e[t]})}(t.key):e.toString(36)}function M(t,e){t.func.call(t.context,e,t.count++)}function F(t,e,n){var r=t.result,i=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?U(t,r,n,function(t){return t}):null!=t&&(D(t)&&(t=function(t,e){return{$$typeof:o,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}(t,i+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(A,"$&/")+"/")+n)),r.push(t))}function U(t,e,n,r,i){var o="";null!=n&&(o=(""+n).replace(A,"$&/")+"/"),x(t,F,e=R(e,o,r,i)),P(e)}var j={Children:{map:function(t,e,n){if(null==t)return t;var r=[];return U(t,r,null,e,n),r},forEach:function(t,e,n){if(null==t)return t;x(t,M,e=R(null,null,e,n)),P(e)},count:function(t){return x(t,function(){return null},null)},toArray:function(t){var e=[];return U(t,e,null,function(t){return t}),e},only:function(t){return D(t)||v("143"),t}},createRef:function(){return{current:null}},Component:w,PureComponent:T,createContext:function(t,e){return void 0===e&&(e=null),(t={$$typeof:h,_calculateChangedBits:e,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:l,_context:t},t.Consumer=t},forwardRef:function(t){return{$$typeof:p,render:t}},lazy:function(t){return{$$typeof:m,_ctor:t,_status:-1,_result:null}},memo:function(t,e){return{$$typeof:y,type:t,compare:void 0===e?null:e}},Fragment:s,StrictMode:u,Suspense:d,createElement:k,cloneElement:function(t,e,n){(null===t||void 0===t)&&v("267",t);var i=void 0,a=r({},t.props),s=t.key,u=t.ref,c=t._owner;if(null!=e){void 0!==e.ref&&(u=e.ref,c=C.current),void 0!==e.key&&(s=""+e.key);var l=void 0;for(i in t.type&&t.type.defaultProps&&(l=t.type.defaultProps),e)I.call(e,i)&&!N.hasOwnProperty(i)&&(a[i]=void 0===e[i]&&void 0!==l?l[i]:e[i])}if(1===(i=arguments.length-2))a.children=n;else if(1<i){l=Array(i);for(var h=0;h<i;h++)l[h]=arguments[h+2];a.children=l}return{$$typeof:o,type:t.type,key:s,ref:u,props:a,_owner:c}},createFactory:function(t){var e=k.bind(null,t);return e.type=t,e},isValidElement:D,version:"16.6.3",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:C,assign:r}};j.unstable_ConcurrentMode=f,j.unstable_Profiler=c;var V={default:j},B=V&&j||V;t.exports=B.default||B},function(t,e,n){"use strict";var r=n(0),i=n(23),o=n(36);function a(t){for(var e=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(t,e,n,r,i,o,a,s){if(!t){if(t=void 0,void 0===e)t=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,i,o,a,s],c=0;(t=Error(e.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw t.framesToPop=1,t}}(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}r||a("227");var s=!1,u=null,c=!1,l=null,h={onError:function(t){s=!0,u=t}};function f(t,e,n,r,i,o,a,c,l){s=!1,u=null,function(t,e,n,r,i,o,a,s,u){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(l){this.onError(l)}}.apply(h,arguments)}var p=null,d={};function y(){if(p)for(var t in d){var e=d[t],n=p.indexOf(t);if(-1<n||a("96",t),!g[n])for(var r in e.extractEvents||a("97",t),g[n]=e,n=e.eventTypes){var i=void 0,o=n[r],s=e,u=r;v.hasOwnProperty(u)&&a("99",u),v[u]=o;var c=o.phasedRegistrationNames;if(c){for(i in c)c.hasOwnProperty(i)&&m(c[i],s,u);i=!0}else o.registrationName?(m(o.registrationName,s,u),i=!0):i=!1;i||a("98",r,t)}}}function m(t,e,n){b[t]&&a("100",t),b[t]=e,_[t]=e.eventTypes[n].dependencies}var g=[],v={},b={},_={},w=null,E=null,T=null;function S(t,e,n){var r=t.type||"unknown-event";t.currentTarget=T(n),function(t,e,n,r,i,o,h,p,d){if(f.apply(this,arguments),s){if(s){var y=u;s=!1,u=null}else a("198"),y=void 0;c||(c=!0,l=y)}}(r,e,void 0,t),t.currentTarget=null}function C(t,e){return null==e&&a("30"),null==t?e:Array.isArray(t)?Array.isArray(e)?(t.push.apply(t,e),t):(t.push(e),t):Array.isArray(e)?[t].concat(e):[t,e]}function I(t,e,n){Array.isArray(t)?t.forEach(e,n):t&&e.call(n,t)}var N=null;function k(t){if(t){var e=t._dispatchListeners,n=t._dispatchInstances;if(Array.isArray(e))for(var r=0;r<e.length&&!t.isPropagationStopped();r++)S(t,e[r],n[r]);else e&&S(t,e,n);t._dispatchListeners=null,t._dispatchInstances=null,t.isPersistent()||t.constructor.release(t)}}var D={injectEventPluginOrder:function(t){p&&a("101"),p=Array.prototype.slice.call(t),y()},injectEventPluginsByName:function(t){var e,n=!1;for(e in t)if(t.hasOwnProperty(e)){var r=t[e];d.hasOwnProperty(e)&&d[e]===r||(d[e]&&a("102",e),d[e]=r,n=!0)}n&&y()}};function A(t,e){var n=t.stateNode;if(!n)return null;var r=w(n);if(!r)return null;n=r[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(r=!r.disabled)||(r=!("button"===(t=t.type)||"input"===t||"select"===t||"textarea"===t)),t=!r;break t;default:t=!1}return t?null:(n&&"function"!==typeof n&&a("231",e,typeof n),n)}function O(t){if(null!==t&&(N=C(N,t)),t=N,N=null,t&&(I(t,k),N&&a("95"),c))throw t=l,c=!1,l=null,t}var R=Math.random().toString(36).slice(2),P="__reactInternalInstance$"+R,x="__reactEventHandlers$"+R;function L(t){if(t[P])return t[P];for(;!t[P];){if(!t.parentNode)return null;t=t.parentNode}return 5===(t=t[P]).tag||6===t.tag?t:null}function M(t){return!(t=t[P])||5!==t.tag&&6!==t.tag?null:t}function F(t){if(5===t.tag||6===t.tag)return t.stateNode;a("33")}function U(t){return t[x]||null}function j(t){do{t=t.return}while(t&&5!==t.tag);return t||null}function V(t,e,n){(e=A(t,n.dispatchConfig.phasedRegistrationNames[e]))&&(n._dispatchListeners=C(n._dispatchListeners,e),n._dispatchInstances=C(n._dispatchInstances,t))}function B(t){if(t&&t.dispatchConfig.phasedRegistrationNames){for(var e=t._targetInst,n=[];e;)n.push(e),e=j(e);for(e=n.length;0<e--;)V(n[e],"captured",t);for(e=0;e<n.length;e++)V(n[e],"bubbled",t)}}function q(t,e,n){t&&n&&n.dispatchConfig.registrationName&&(e=A(t,n.dispatchConfig.registrationName))&&(n._dispatchListeners=C(n._dispatchListeners,e),n._dispatchInstances=C(n._dispatchInstances,t))}function W(t){t&&t.dispatchConfig.registrationName&&q(t._targetInst,null,t)}function K(t){I(t,B)}var Q=!("undefined"===typeof window||!window.document||!window.document.createElement);function H(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var z={animationend:H("Animation","AnimationEnd"),animationiteration:H("Animation","AnimationIteration"),animationstart:H("Animation","AnimationStart"),transitionend:H("Transition","TransitionEnd")},G={},Y={};function X(t){if(G[t])return G[t];if(!z[t])return t;var e,n=z[t];for(e in n)if(n.hasOwnProperty(e)&&e in Y)return G[t]=n[e];return t}Q&&(Y=document.createElement("div").style,"AnimationEvent"in window||(delete z.animationend.animation,delete z.animationiteration.animation,delete z.animationstart.animation),"TransitionEvent"in window||delete z.transitionend.transition);var J=X("animationend"),$=X("animationiteration"),Z=X("animationstart"),tt=X("transitionend"),et="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),nt=null,rt=null,it=null;function ot(){if(it)return it;var t,e,n=rt,r=n.length,i="value"in nt?nt.value:nt.textContent,o=i.length;for(t=0;t<r&&n[t]===i[t];t++);var a=r-t;for(e=1;e<=a&&n[r-e]===i[o-e];e++);return it=i.slice(t,1<e?1-e:void 0)}function at(){return!0}function st(){return!1}function ut(t,e,n,r){for(var i in this.dispatchConfig=t,this._targetInst=e,this.nativeEvent=n,t=this.constructor.Interface)t.hasOwnProperty(i)&&((e=t[i])?this[i]=e(n):"target"===i?this.target=r:this[i]=n[i]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?at:st,this.isPropagationStopped=st,this}function ct(t,e,n,r){if(this.eventPool.length){var i=this.eventPool.pop();return this.call(i,t,e,n,r),i}return new this(t,e,n,r)}function lt(t){t instanceof this||a("279"),t.destructor(),10>this.eventPool.length&&this.eventPool.push(t)}function ht(t){t.eventPool=[],t.getPooled=ct,t.release=lt}i(ut.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!==typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=at)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!==typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=at)},persist:function(){this.isPersistent=at},isPersistent:st,destructor:function(){var t,e=this.constructor.Interface;for(t in e)this[t]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=st,this._dispatchInstances=this._dispatchListeners=null}}),ut.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},ut.extend=function(t){function e(){}function n(){return r.apply(this,arguments)}var r=this;e.prototype=r.prototype;var o=new e;return i(o,n.prototype),n.prototype=o,n.prototype.constructor=n,n.Interface=i({},r.Interface,t),n.extend=r.extend,ht(n),n},ht(ut);var ft=ut.extend({data:null}),pt=ut.extend({data:null}),dt=[9,13,27,32],yt=Q&&"CompositionEvent"in window,mt=null;Q&&"documentMode"in document&&(mt=document.documentMode);var gt=Q&&"TextEvent"in window&&!mt,vt=Q&&(!yt||mt&&8<mt&&11>=mt),bt=String.fromCharCode(32),_t={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},wt=!1;function Et(t,e){switch(t){case"keyup":return-1!==dt.indexOf(e.keyCode);case"keydown":return 229!==e.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Tt(t){return"object"===typeof(t=t.detail)&&"data"in t?t.data:null}var St=!1;var Ct={eventTypes:_t,extractEvents:function(t,e,n,r){var i=void 0,o=void 0;if(yt)t:{switch(t){case"compositionstart":i=_t.compositionStart;break t;case"compositionend":i=_t.compositionEnd;break t;case"compositionupdate":i=_t.compositionUpdate;break t}i=void 0}else St?Et(t,n)&&(i=_t.compositionEnd):"keydown"===t&&229===n.keyCode&&(i=_t.compositionStart);return i?(vt&&"ko"!==n.locale&&(St||i!==_t.compositionStart?i===_t.compositionEnd&&St&&(o=ot()):(rt="value"in(nt=r)?nt.value:nt.textContent,St=!0)),i=ft.getPooled(i,e,n,r),o?i.data=o:null!==(o=Tt(n))&&(i.data=o),K(i),o=i):o=null,(t=gt?function(t,e){switch(t){case"compositionend":return Tt(e);case"keypress":return 32!==e.which?null:(wt=!0,bt);case"textInput":return(t=e.data)===bt&&wt?null:t;default:return null}}(t,n):function(t,e){if(St)return"compositionend"===t||!yt&&Et(t,e)?(t=ot(),it=rt=nt=null,St=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return vt&&"ko"!==e.locale?null:e.data;default:return null}}(t,n))?((e=pt.getPooled(_t.beforeInput,e,n,r)).data=t,K(e)):e=null,null===o?e:null===e?o:[o,e]}},It=null,Nt=null,kt=null;function Dt(t){if(t=E(t)){"function"!==typeof It&&a("280");var e=w(t.stateNode);It(t.stateNode,t.type,e)}}function At(t){Nt?kt?kt.push(t):kt=[t]:Nt=t}function Ot(){if(Nt){var t=Nt,e=kt;if(kt=Nt=null,Dt(t),e)for(t=0;t<e.length;t++)Dt(e[t])}}function Rt(t,e){return t(e)}function Pt(t,e,n){return t(e,n)}function xt(){}var Lt=!1;function Mt(t,e){if(Lt)return t(e);Lt=!0;try{return Rt(t,e)}finally{Lt=!1,(null!==Nt||null!==kt)&&(xt(),Ot())}}var Ft={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ut(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return"input"===e?!!Ft[t.type]:"textarea"===e}function jt(t){return(t=t.target||t.srcElement||window).correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}function Vt(t){if(!Q)return!1;var e=(t="on"+t)in document;return e||((e=document.createElement("div")).setAttribute(t,"return;"),e="function"===typeof e[t]),e}function Bt(t){var e=t.type;return(t=t.nodeName)&&"input"===t.toLowerCase()&&("checkbox"===e||"radio"===e)}function qt(t){t._valueTracker||(t._valueTracker=function(t){var e=Bt(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(t){r=""+t,o.call(this,t)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(t){r=""+t},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}(t))}function Wt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Bt(t)?t.checked?"true":"false":t.value),(t=r)!==n&&(e.setValue(t),!0)}var Kt=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Qt=/^(.*)[\\\/]/,Ht="function"===typeof Symbol&&Symbol.for,zt=Ht?Symbol.for("react.element"):60103,Gt=Ht?Symbol.for("react.portal"):60106,Yt=Ht?Symbol.for("react.fragment"):60107,Xt=Ht?Symbol.for("react.strict_mode"):60108,Jt=Ht?Symbol.for("react.profiler"):60114,$t=Ht?Symbol.for("react.provider"):60109,Zt=Ht?Symbol.for("react.context"):60110,te=Ht?Symbol.for("react.concurrent_mode"):60111,ee=Ht?Symbol.for("react.forward_ref"):60112,ne=Ht?Symbol.for("react.suspense"):60113,re=Ht?Symbol.for("react.memo"):60115,ie=Ht?Symbol.for("react.lazy"):60116,oe="function"===typeof Symbol&&Symbol.iterator;function ae(t){return null===t||"object"!==typeof t?null:"function"===typeof(t=oe&&t[oe]||t["@@iterator"])?t:null}function se(t){if(null==t)return null;if("function"===typeof t)return t.displayName||t.name||null;if("string"===typeof t)return t;switch(t){case te:return"ConcurrentMode";case Yt:return"Fragment";case Gt:return"Portal";case Jt:return"Profiler";case Xt:return"StrictMode";case ne:return"Suspense"}if("object"===typeof t)switch(t.$$typeof){case Zt:return"Context.Consumer";case $t:return"Context.Provider";case ee:var e=t.render;return e=e.displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case re:return se(t.type);case ie:if(t=1===t._status?t._result:null)return se(t)}return null}function ue(t){var e="";do{t:switch(t.tag){case 2:case 16:case 0:case 1:case 5:case 8:case 13:var n=t._debugOwner,r=t._debugSource,i=se(t.type),o=null;n&&(o=se(n.type)),n=i,i="",r?i=" (at "+r.fileName.replace(Qt,"")+":"+r.lineNumber+")":o&&(i=" (created by "+o+")"),o="\n    in "+(n||"Unknown")+i;break t;default:o=""}e+=o,t=t.return}while(t);return e}var ce=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,le=Object.prototype.hasOwnProperty,he={},fe={};function pe(t,e,n,r,i){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e}var de={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){de[t]=new pe(t,0,!1,t,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];de[e]=new pe(e,1,!1,t[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){de[t]=new pe(t,2,!1,t.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){de[t]=new pe(t,2,!1,t,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){de[t]=new pe(t,3,!1,t.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(t){de[t]=new pe(t,3,!0,t,null)}),["capture","download"].forEach(function(t){de[t]=new pe(t,4,!1,t,null)}),["cols","rows","size","span"].forEach(function(t){de[t]=new pe(t,6,!1,t,null)}),["rowSpan","start"].forEach(function(t){de[t]=new pe(t,5,!1,t.toLowerCase(),null)});var ye=/[\-:]([a-z])/g;function me(t){return t[1].toUpperCase()}function ge(t,e,n,r){var i=de.hasOwnProperty(e)?de[e]:null;(null!==i?0===i.type:!r&&(2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])))||(function(t,e,n,r){if(null===e||"undefined"===typeof e||function(t,e,n,r){if(null!==n&&0===n.type)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(t=t.toLowerCase().slice(0,5))&&"aria-"!==t);default:return!1}}(t,e,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!e;case 4:return!1===e;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}(e,n,i,r)&&(n=null),r||null===i?function(t){return!!le.call(fe,t)||!le.call(he,t)&&(ce.test(t)?fe[t]=!0:(he[t]=!0,!1))}(e)&&(null===n?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=null===n?3!==i.type&&"":n:(e=i.attributeName,r=i.attributeNamespace,null===n?t.removeAttribute(e):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}function ve(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}function be(t,e){var n=e.checked;return i({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:t._wrapperState.initialChecked})}function _e(t,e){var n=null==e.defaultValue?"":e.defaultValue,r=null!=e.checked?e.checked:e.defaultChecked;n=ve(null!=e.value?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}}function we(t,e){null!=(e=e.checked)&&ge(t,"checked",e,!1)}function Ee(t,e){we(t,e);var n=ve(e.value),r=e.type;if(null!=n)"number"===r?(0===n&&""===t.value||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if("submit"===r||"reset"===r)return void t.removeAttribute("value");e.hasOwnProperty("value")?Se(t,e.type,n):e.hasOwnProperty("defaultValue")&&Se(t,e.type,ve(e.defaultValue)),null==e.checked&&null!=e.defaultChecked&&(t.defaultChecked=!!e.defaultChecked)}function Te(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!("submit"!==r&&"reset"!==r||void 0!==e.value&&null!==e.value))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}""!==(n=t.name)&&(t.name=""),t.defaultChecked=!t.defaultChecked,t.defaultChecked=!!t._wrapperState.initialChecked,""!==n&&(t.name=n)}function Se(t,e,n){"number"===e&&t.ownerDocument.activeElement===t||(null==n?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(ye,me);de[e]=new pe(e,1,!1,t,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(ye,me);de[e]=new pe(e,1,!1,t,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(ye,me);de[e]=new pe(e,1,!1,t,"http://www.w3.org/XML/1998/namespace")}),de.tabIndex=new pe("tabIndex",1,!1,"tabindex",null);var Ce={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Ie(t,e,n){return(t=ut.getPooled(Ce.change,t,e,n)).type="change",At(n),K(t),t}var Ne=null,ke=null;function De(t){O(t)}function Ae(t){if(Wt(F(t)))return t}function Oe(t,e){if("change"===t)return e}var Re=!1;function Pe(){Ne&&(Ne.detachEvent("onpropertychange",xe),ke=Ne=null)}function xe(t){"value"===t.propertyName&&Ae(ke)&&Mt(De,t=Ie(ke,t,jt(t)))}function Le(t,e,n){"focus"===t?(Pe(),ke=n,(Ne=e).attachEvent("onpropertychange",xe)):"blur"===t&&Pe()}function Me(t){if("selectionchange"===t||"keyup"===t||"keydown"===t)return Ae(ke)}function Fe(t,e){if("click"===t)return Ae(e)}function Ue(t,e){if("input"===t||"change"===t)return Ae(e)}Q&&(Re=Vt("input")&&(!document.documentMode||9<document.documentMode));var je={eventTypes:Ce,_isInputEventSupported:Re,extractEvents:function(t,e,n,r){var i=e?F(e):window,o=void 0,a=void 0,s=i.nodeName&&i.nodeName.toLowerCase();if("select"===s||"input"===s&&"file"===i.type?o=Oe:Ut(i)?Re?o=Ue:(o=Me,a=Le):(s=i.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(o=Fe),o&&(o=o(t,e)))return Ie(o,n,r);a&&a(t,i,e),"blur"===t&&(t=i._wrapperState)&&t.controlled&&"number"===i.type&&Se(i,"number",i.value)}},Ve=ut.extend({view:null,detail:null}),Be={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qe(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):!!(t=Be[t])&&!!e[t]}function We(){return qe}var Ke=0,Qe=0,He=!1,ze=!1,Ge=Ve.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:We,button:null,buttons:null,relatedTarget:function(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)},movementX:function(t){if("movementX"in t)return t.movementX;var e=Ke;return Ke=t.screenX,He?"mousemove"===t.type?t.screenX-e:0:(He=!0,0)},movementY:function(t){if("movementY"in t)return t.movementY;var e=Qe;return Qe=t.screenY,ze?"mousemove"===t.type?t.screenY-e:0:(ze=!0,0)}}),Ye=Ge.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),Xe={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Je={eventTypes:Xe,extractEvents:function(t,e,n,r){var i="mouseover"===t||"pointerover"===t,o="mouseout"===t||"pointerout"===t;if(i&&(n.relatedTarget||n.fromElement)||!o&&!i)return null;if(i=r.window===r?r:(i=r.ownerDocument)?i.defaultView||i.parentWindow:window,o?(o=e,e=(e=n.relatedTarget||n.toElement)?L(e):null):o=null,o===e)return null;var a=void 0,s=void 0,u=void 0,c=void 0;"mouseout"===t||"mouseover"===t?(a=Ge,s=Xe.mouseLeave,u=Xe.mouseEnter,c="mouse"):"pointerout"!==t&&"pointerover"!==t||(a=Ye,s=Xe.pointerLeave,u=Xe.pointerEnter,c="pointer");var l=null==o?i:F(o);if(i=null==e?i:F(e),(t=a.getPooled(s,o,n,r)).type=c+"leave",t.target=l,t.relatedTarget=i,(n=a.getPooled(u,e,n,r)).type=c+"enter",n.target=i,n.relatedTarget=l,r=e,o&&r)t:{for(i=r,c=0,a=e=o;a;a=j(a))c++;for(a=0,u=i;u;u=j(u))a++;for(;0<c-a;)e=j(e),c--;for(;0<a-c;)i=j(i),a--;for(;c--;){if(e===i||e===i.alternate)break t;e=j(e),i=j(i)}e=null}else e=null;for(i=e,e=[];o&&o!==i&&(null===(c=o.alternate)||c!==i);)e.push(o),o=j(o);for(o=[];r&&r!==i&&(null===(c=r.alternate)||c!==i);)o.push(r),r=j(r);for(r=0;r<e.length;r++)q(e[r],"bubbled",t);for(r=o.length;0<r--;)q(o[r],"captured",n);return[t,n]}},$e=Object.prototype.hasOwnProperty;function Ze(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t&&e!==e}function tn(t,e){if(Ze(t,e))return!0;if("object"!==typeof t||null===t||"object"!==typeof e||null===e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!$e.call(e,n[r])||!Ze(t[n[r]],e[n[r]]))return!1;return!0}function en(t){var e=t;if(t.alternate)for(;e.return;)e=e.return;else{if(0!==(2&e.effectTag))return 1;for(;e.return;)if(0!==(2&(e=e.return).effectTag))return 1}return 3===e.tag?2:3}function nn(t){2!==en(t)&&a("188")}function rn(t){if(!(t=function(t){var e=t.alternate;if(!e)return 3===(e=en(t))&&a("188"),1===e?null:t;for(var n=t,r=e;;){var i=n.return,o=i?i.alternate:null;if(!i||!o)break;if(i.child===o.child){for(var s=i.child;s;){if(s===n)return nn(i),t;if(s===r)return nn(i),e;s=s.sibling}a("188")}if(n.return!==r.return)n=i,r=o;else{s=!1;for(var u=i.child;u;){if(u===n){s=!0,n=i,r=o;break}if(u===r){s=!0,r=i,n=o;break}u=u.sibling}if(!s){for(u=o.child;u;){if(u===n){s=!0,n=o,r=i;break}if(u===r){s=!0,r=o,n=i;break}u=u.sibling}s||a("189")}}n.alternate!==r&&a("190")}return 3!==n.tag&&a("188"),n.stateNode.current===n?t:e}(t)))return null;for(var e=t;;){if(5===e.tag||6===e.tag)return e;if(e.child)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}var on=ut.extend({animationName:null,elapsedTime:null,pseudoElement:null}),an=ut.extend({clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),sn=Ve.extend({relatedTarget:null});function un(t){var e=t.keyCode;return"charCode"in t?0===(t=t.charCode)&&13===e&&(t=13):t=e,10===t&&(t=13),32<=t||13===t?t:0}var cn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ln={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},hn=Ve.extend({key:function(t){if(t.key){var e=cn[t.key]||t.key;if("Unidentified"!==e)return e}return"keypress"===t.type?13===(t=un(t))?"Enter":String.fromCharCode(t):"keydown"===t.type||"keyup"===t.type?ln[t.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:We,charCode:function(t){return"keypress"===t.type?un(t):0},keyCode:function(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function(t){return"keypress"===t.type?un(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}}),fn=Ge.extend({dataTransfer:null}),pn=Ve.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:We}),dn=ut.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),yn=Ge.extend({deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null}),mn=[["abort","abort"],[J,"animationEnd"],[$,"animationIteration"],[Z,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"],["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[tt,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],gn={},vn={};function bn(t,e){var n=t[0],r="on"+((t=t[1])[0].toUpperCase()+t.slice(1));e={phasedRegistrationNames:{bubbled:r,captured:r+"Capture"},dependencies:[n],isInteractive:e},gn[t]=e,vn[n]=e}[["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["auxclick","auxClick"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"],["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(t){bn(t,!0)}),mn.forEach(function(t){bn(t,!1)});var _n={eventTypes:gn,isInteractiveTopLevelEventType:function(t){return void 0!==(t=vn[t])&&!0===t.isInteractive},extractEvents:function(t,e,n,r){var i=vn[t];if(!i)return null;switch(t){case"keypress":if(0===un(n))return null;case"keydown":case"keyup":t=hn;break;case"blur":case"focus":t=sn;break;case"click":if(2===n.button)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":t=Ge;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":t=fn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":t=pn;break;case J:case $:case Z:t=on;break;case tt:t=dn;break;case"scroll":t=Ve;break;case"wheel":t=yn;break;case"copy":case"cut":case"paste":t=an;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":t=Ye;break;default:t=ut}return K(e=t.getPooled(i,e,n,r)),e}},wn=_n.isInteractiveTopLevelEventType,En=[];function Tn(t){var e=t.targetInst,n=e;do{if(!n){t.ancestors.push(n);break}var r;for(r=n;r.return;)r=r.return;if(!(r=3!==r.tag?null:r.stateNode.containerInfo))break;t.ancestors.push(n),n=L(r)}while(n);for(n=0;n<t.ancestors.length;n++){e=t.ancestors[n];var i=jt(t.nativeEvent);r=t.topLevelType;for(var o=t.nativeEvent,a=null,s=0;s<g.length;s++){var u=g[s];u&&(u=u.extractEvents(r,e,o,i))&&(a=C(a,u))}O(a)}}var Sn=!0;function Cn(t,e){if(!e)return null;var n=(wn(t)?Nn:kn).bind(null,t);e.addEventListener(t,n,!1)}function In(t,e){if(!e)return null;var n=(wn(t)?Nn:kn).bind(null,t);e.addEventListener(t,n,!0)}function Nn(t,e){Pt(kn,t,e)}function kn(t,e){if(Sn){var n=jt(e);if(null===(n=L(n))||"number"!==typeof n.tag||2===en(n)||(n=null),En.length){var r=En.pop();r.topLevelType=t,r.nativeEvent=e,r.targetInst=n,t=r}else t={topLevelType:t,nativeEvent:e,targetInst:n,ancestors:[]};try{Mt(Tn,t)}finally{t.topLevelType=null,t.nativeEvent=null,t.targetInst=null,t.ancestors.length=0,10>En.length&&En.push(t)}}}var Dn={},An=0,On="_reactListenersID"+(""+Math.random()).slice(2);function Rn(t){return Object.prototype.hasOwnProperty.call(t,On)||(t[On]=An++,Dn[t[On]]={}),Dn[t[On]]}function Pn(t){if("undefined"===typeof(t=t||("undefined"!==typeof document?document:void 0)))return null;try{return t.activeElement||t.body}catch(e){return t.body}}function xn(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Ln(t,e){var n,r=xn(t);for(t=0;r;){if(3===r.nodeType){if(n=t+r.textContent.length,t<=e&&n>=e)return{node:r,offset:e-t};t=n}t:{for(;r;){if(r.nextSibling){r=r.nextSibling;break t}r=r.parentNode}r=void 0}r=xn(r)}}function Mn(){for(var t=window,e=Pn();e instanceof t.HTMLIFrameElement;){try{t=e.contentDocument.defaultView}catch(n){break}e=Pn(t.document)}return e}function Fn(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&("text"===t.type||"search"===t.type||"tel"===t.type||"url"===t.type||"password"===t.type)||"textarea"===e||"true"===t.contentEditable)}var Un=Q&&"documentMode"in document&&11>=document.documentMode,jn={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Vn=null,Bn=null,qn=null,Wn=!1;function Kn(t,e){var n=e.window===e?e.document:9===e.nodeType?e:e.ownerDocument;return Wn||null==Vn||Vn!==Pn(n)?null:("selectionStart"in(n=Vn)&&Fn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},qn&&tn(qn,n)?null:(qn=n,(t=ut.getPooled(jn.select,Bn,t,e)).type="select",t.target=Vn,K(t),t))}var Qn={eventTypes:jn,extractEvents:function(t,e,n,r){var i,o=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(i=!o)){t:{o=Rn(o),i=_.onSelect;for(var a=0;a<i.length;a++){var s=i[a];if(!o.hasOwnProperty(s)||!o[s]){o=!1;break t}}o=!0}i=!o}if(i)return null;switch(o=e?F(e):window,t){case"focus":(Ut(o)||"true"===o.contentEditable)&&(Vn=o,Bn=e,qn=null);break;case"blur":qn=Bn=Vn=null;break;case"mousedown":Wn=!0;break;case"contextmenu":case"mouseup":case"dragend":return Wn=!1,Kn(n,r);case"selectionchange":if(Un)break;case"keydown":case"keyup":return Kn(n,r)}return null}};function Hn(t,e){return t=i({children:void 0},e),(e=function(t){var e="";return r.Children.forEach(t,function(t){null!=t&&(e+=t)}),e}(e.children))&&(t.children=e),t}function zn(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+ve(n),e=null,i=0;i<t.length;i++){if(t[i].value===n)return t[i].selected=!0,void(r&&(t[i].defaultSelected=!0));null!==e||t[i].disabled||(e=t[i])}null!==e&&(e.selected=!0)}}function Gn(t,e){return null!=e.dangerouslySetInnerHTML&&a("91"),i({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Yn(t,e){var n=e.value;null==n&&(n=e.defaultValue,null!=(e=e.children)&&(null!=n&&a("92"),Array.isArray(e)&&(1>=e.length||a("93"),e=e[0]),n=e),null==n&&(n="")),t._wrapperState={initialValue:ve(n)}}function Xn(t,e){var n=ve(e.value),r=ve(e.defaultValue);null!=n&&((n=""+n)!==t.value&&(t.value=n),null==e.defaultValue&&t.defaultValue!==n&&(t.defaultValue=n)),null!=r&&(t.defaultValue=""+r)}function Jn(t){var e=t.textContent;e===t._wrapperState.initialValue&&(t.value=e)}D.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),w=U,E=M,T=F,D.injectEventPluginsByName({SimpleEventPlugin:_n,EnterLeaveEventPlugin:Je,ChangeEventPlugin:je,SelectEventPlugin:Qn,BeforeInputEventPlugin:Ct});var $n={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Zn(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function tr(t,e){return null==t||"http://www.w3.org/1999/xhtml"===t?Zn(e):"http://www.w3.org/2000/svg"===t&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":t}var er,nr=void 0,rr=(er=function(t,e){if(t.namespaceURI!==$n.svg||"innerHTML"in t)t.innerHTML=e;else{for((nr=nr||document.createElement("div")).innerHTML="<svg>"+e+"</svg>",e=nr.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,e,n,r){MSApp.execUnsafeLocalFunction(function(){return er(t,e)})}:er);function ir(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&3===n.nodeType)return void(n.nodeValue=e)}t.textContent=e}var or={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ar=["Webkit","ms","Moz","O"];function sr(t,e,n){return null==e||"boolean"===typeof e||""===e?"":n||"number"!==typeof e||0===e||or.hasOwnProperty(t)&&or[t]?(""+e).trim():e+"px"}function ur(t,e){for(var n in t=t.style,e)if(e.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=sr(n,e[n],r);"float"===n&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}Object.keys(or).forEach(function(t){ar.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),or[e]=or[t]})});var cr=i({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function lr(t,e){e&&(cr[t]&&(null!=e.children||null!=e.dangerouslySetInnerHTML)&&a("137",t,""),null!=e.dangerouslySetInnerHTML&&(null!=e.children&&a("60"),"object"===typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML||a("61")),null!=e.style&&"object"!==typeof e.style&&a("62",""))}function hr(t,e){if(-1===t.indexOf("-"))return"string"===typeof e.is;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function fr(t,e){var n=Rn(t=9===t.nodeType||11===t.nodeType?t:t.ownerDocument);e=_[e];for(var r=0;r<e.length;r++){var i=e[r];if(!n.hasOwnProperty(i)||!n[i]){switch(i){case"scroll":In("scroll",t);break;case"focus":case"blur":In("focus",t),In("blur",t),n.blur=!0,n.focus=!0;break;case"cancel":case"close":Vt(i)&&In(i,t);break;case"invalid":case"submit":case"reset":break;default:-1===et.indexOf(i)&&Cn(i,t)}n[i]=!0}}}function pr(){}var dr=null,yr=null;function mr(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function gr(t,e){return"textarea"===t||"option"===t||"noscript"===t||"string"===typeof e.children||"number"===typeof e.children||"object"===typeof e.dangerouslySetInnerHTML&&null!==e.dangerouslySetInnerHTML&&null!=e.dangerouslySetInnerHTML.__html}var vr="function"===typeof setTimeout?setTimeout:void 0,br="function"===typeof clearTimeout?clearTimeout:void 0;function _r(t){for(t=t.nextSibling;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t}function wr(t){for(t=t.firstChild;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t}new Set;var Er=[],Tr=-1;function Sr(t){0>Tr||(t.current=Er[Tr],Er[Tr]=null,Tr--)}function Cr(t,e){Er[++Tr]=t.current,t.current=e}var Ir={},Nr={current:Ir},kr={current:!1},Dr=Ir;function Ar(t,e){var n=t.type.contextTypes;if(!n)return Ir;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=e[i];return r&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Or(t){return null!==(t=t.childContextTypes)&&void 0!==t}function Rr(t){Sr(kr),Sr(Nr)}function Pr(t){Sr(kr),Sr(Nr)}function xr(t,e,n){Nr.current!==Ir&&a("168"),Cr(Nr,e),Cr(kr,n)}function Lr(t,e,n){var r=t.stateNode;if(t=e.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var o in r=r.getChildContext())o in t||a("108",se(e)||"Unknown",o);return i({},n,r)}function Mr(t){var e=t.stateNode;return e=e&&e.__reactInternalMemoizedMergedChildContext||Ir,Dr=Nr.current,Cr(Nr,e),Cr(kr,kr.current),!0}function Fr(t,e,n){var r=t.stateNode;r||a("169"),n?(e=Lr(t,e,Dr),r.__reactInternalMemoizedMergedChildContext=e,Sr(kr),Sr(Nr),Cr(Nr,e)):Sr(kr),Cr(kr,n)}var Ur=null,jr=null;function Vr(t){return function(e){try{return t(e)}catch(n){}}}function Br(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.firstContextDependency=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function qr(t,e,n,r){return new Br(t,e,n,r)}function Wr(t){return!(!(t=t.prototype)||!t.isReactComponent)}function Kr(t,e){var n=t.alternate;return null===n?((n=qr(t.tag,e,t.key,t.mode)).elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.effectTag=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childExpirationTime=t.childExpirationTime,n.expirationTime=t.expirationTime,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,n.firstContextDependency=t.firstContextDependency,n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Qr(t,e,n,r,i,o){var s=2;if(r=t,"function"===typeof t)Wr(t)&&(s=1);else if("string"===typeof t)s=5;else t:switch(t){case Yt:return Hr(n.children,i,o,e);case te:return zr(n,3|i,o,e);case Xt:return zr(n,2|i,o,e);case Jt:return(t=qr(12,n,e,4|i)).elementType=Jt,t.type=Jt,t.expirationTime=o,t;case ne:return(t=qr(13,n,e,i)).elementType=ne,t.type=ne,t.expirationTime=o,t;default:if("object"===typeof t&&null!==t)switch(t.$$typeof){case $t:s=10;break t;case Zt:s=9;break t;case ee:s=11;break t;case re:s=14;break t;case ie:s=16,r=null;break t}a("130",null==t?t:typeof t,"")}return(e=qr(s,n,e,i)).elementType=t,e.type=r,e.expirationTime=o,e}function Hr(t,e,n,r){return(t=qr(7,t,r,e)).expirationTime=n,t}function zr(t,e,n,r){return t=qr(8,t,r,e),e=0===(1&e)?Xt:te,t.elementType=e,t.type=e,t.expirationTime=n,t}function Gr(t,e,n){return(t=qr(6,t,null,e)).expirationTime=n,t}function Yr(t,e,n){return(e=qr(4,null!==t.children?t.children:[],t.key,e)).expirationTime=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Xr(t,e){t.didError=!1;var n=t.earliestPendingTime;0===n?t.earliestPendingTime=t.latestPendingTime=e:n<e?t.earliestPendingTime=e:t.latestPendingTime>e&&(t.latestPendingTime=e),Zr(e,t)}function Jr(t,e){t.didError=!1;var n=t.latestPingedTime;0!==n&&n>=e&&(t.latestPingedTime=0),n=t.earliestPendingTime;var r=t.latestPendingTime;n===e?t.earliestPendingTime=r===e?t.latestPendingTime=0:r:r===e&&(t.latestPendingTime=n),n=t.earliestSuspendedTime,r=t.latestSuspendedTime,0===n?t.earliestSuspendedTime=t.latestSuspendedTime=e:n<e?t.earliestSuspendedTime=e:r>e&&(t.latestSuspendedTime=e),Zr(e,t)}function $r(t,e){var n=t.earliestPendingTime;return n>e&&(e=n),(t=t.earliestSuspendedTime)>e&&(e=t),e}function Zr(t,e){var n=e.earliestSuspendedTime,r=e.latestSuspendedTime,i=e.earliestPendingTime,o=e.latestPingedTime;0===(i=0!==i?i:o)&&(0===t||r<t)&&(i=r),0!==(t=i)&&n>t&&(t=n),e.nextExpirationTimeToWorkOn=i,e.expirationTime=t}var ti=!1;function ei(t){return{baseState:t,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function ni(t){return{baseState:t.baseState,firstUpdate:t.firstUpdate,lastUpdate:t.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function ri(t){return{expirationTime:t,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function ii(t,e){null===t.lastUpdate?t.firstUpdate=t.lastUpdate=e:(t.lastUpdate.next=e,t.lastUpdate=e)}function oi(t,e){var n=t.alternate;if(null===n){var r=t.updateQueue,i=null;null===r&&(r=t.updateQueue=ei(t.memoizedState))}else r=t.updateQueue,i=n.updateQueue,null===r?null===i?(r=t.updateQueue=ei(t.memoizedState),i=n.updateQueue=ei(n.memoizedState)):r=t.updateQueue=ni(i):null===i&&(i=n.updateQueue=ni(r));null===i||r===i?ii(r,e):null===r.lastUpdate||null===i.lastUpdate?(ii(r,e),ii(i,e)):(ii(r,e),i.lastUpdate=e)}function ai(t,e){var n=t.updateQueue;null===(n=null===n?t.updateQueue=ei(t.memoizedState):si(t,n)).lastCapturedUpdate?n.firstCapturedUpdate=n.lastCapturedUpdate=e:(n.lastCapturedUpdate.next=e,n.lastCapturedUpdate=e)}function si(t,e){var n=t.alternate;return null!==n&&e===n.updateQueue&&(e=t.updateQueue=ni(e)),e}function ui(t,e,n,r,o,a){switch(n.tag){case 1:return"function"===typeof(t=n.payload)?t.call(a,r,o):t;case 3:t.effectTag=-2049&t.effectTag|64;case 0:if(null===(o="function"===typeof(t=n.payload)?t.call(a,r,o):t)||void 0===o)break;return i({},r,o);case 2:ti=!0}return r}function ci(t,e,n,r,i){ti=!1;for(var o=(e=si(t,e)).baseState,a=null,s=0,u=e.firstUpdate,c=o;null!==u;){var l=u.expirationTime;l<i?(null===a&&(a=u,o=c),s<l&&(s=l)):(c=ui(t,0,u,c,n,r),null!==u.callback&&(t.effectTag|=32,u.nextEffect=null,null===e.lastEffect?e.firstEffect=e.lastEffect=u:(e.lastEffect.nextEffect=u,e.lastEffect=u))),u=u.next}for(l=null,u=e.firstCapturedUpdate;null!==u;){var h=u.expirationTime;h<i?(null===l&&(l=u,null===a&&(o=c)),s<h&&(s=h)):(c=ui(t,0,u,c,n,r),null!==u.callback&&(t.effectTag|=32,u.nextEffect=null,null===e.lastCapturedEffect?e.firstCapturedEffect=e.lastCapturedEffect=u:(e.lastCapturedEffect.nextEffect=u,e.lastCapturedEffect=u))),u=u.next}null===a&&(e.lastUpdate=null),null===l?e.lastCapturedUpdate=null:t.effectTag|=32,null===a&&null===l&&(o=c),e.baseState=o,e.firstUpdate=a,e.firstCapturedUpdate=l,t.expirationTime=s,t.memoizedState=c}function li(t,e,n){null!==e.firstCapturedUpdate&&(null!==e.lastUpdate&&(e.lastUpdate.next=e.firstCapturedUpdate,e.lastUpdate=e.lastCapturedUpdate),e.firstCapturedUpdate=e.lastCapturedUpdate=null),hi(e.firstEffect,n),e.firstEffect=e.lastEffect=null,hi(e.firstCapturedEffect,n),e.firstCapturedEffect=e.lastCapturedEffect=null}function hi(t,e){for(;null!==t;){var n=t.callback;if(null!==n){t.callback=null;var r=e;"function"!==typeof n&&a("191",n),n.call(r)}t=t.nextEffect}}function fi(t,e){return{value:t,source:e,stack:ue(e)}}var pi={current:null},di=null,yi=null,mi=null;function gi(t,e){var n=t.type._context;Cr(pi,n._currentValue),n._currentValue=e}function vi(t){var e=pi.current;Sr(pi),t.type._context._currentValue=e}function bi(t){di=t,mi=yi=null,t.firstContextDependency=null}function _i(t,e){return mi!==t&&!1!==e&&0!==e&&("number"===typeof e&&1073741823!==e||(mi=t,e=1073741823),e={context:t,observedBits:e,next:null},null===yi?(null===di&&a("293"),di.firstContextDependency=yi=e):yi=yi.next=e),t._currentValue}var wi={},Ei={current:wi},Ti={current:wi},Si={current:wi};function Ci(t){return t===wi&&a("174"),t}function Ii(t,e){Cr(Si,e),Cr(Ti,t),Cr(Ei,wi);var n=e.nodeType;switch(n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:tr(null,"");break;default:e=tr(e=(n=8===n?e.parentNode:e).namespaceURI||null,n=n.tagName)}Sr(Ei),Cr(Ei,e)}function Ni(t){Sr(Ei),Sr(Ti),Sr(Si)}function ki(t){Ci(Si.current);var e=Ci(Ei.current),n=tr(e,t.type);e!==n&&(Cr(Ti,t),Cr(Ei,n))}function Di(t){Ti.current===t&&(Sr(Ei),Sr(Ti))}function Ai(t,e){if(t&&t.defaultProps)for(var n in e=i({},e),t=t.defaultProps)void 0===e[n]&&(e[n]=t[n]);return e}var Oi=Kt.ReactCurrentOwner,Ri=(new r.Component).refs;function Pi(t,e,n,r){n=null===(n=n(r,e=t.memoizedState))||void 0===n?e:i({},e,n),t.memoizedState=n,null!==(r=t.updateQueue)&&0===t.expirationTime&&(r.baseState=n)}var xi={isMounted:function(t){return!!(t=t._reactInternalFiber)&&2===en(t)},enqueueSetState:function(t,e,n){t=t._reactInternalFiber;var r=Sa(),i=ri(r=Xo(r,t));i.payload=e,void 0!==n&&null!==n&&(i.callback=n),Qo(),oi(t,i),Zo(t,r)},enqueueReplaceState:function(t,e,n){t=t._reactInternalFiber;var r=Sa(),i=ri(r=Xo(r,t));i.tag=1,i.payload=e,void 0!==n&&null!==n&&(i.callback=n),Qo(),oi(t,i),Zo(t,r)},enqueueForceUpdate:function(t,e){t=t._reactInternalFiber;var n=Sa(),r=ri(n=Xo(n,t));r.tag=2,void 0!==e&&null!==e&&(r.callback=e),Qo(),oi(t,r),Zo(t,n)}};function Li(t,e,n,r,i,o,a){return"function"===typeof(t=t.stateNode).shouldComponentUpdate?t.shouldComponentUpdate(r,o,a):!e.prototype||!e.prototype.isPureReactComponent||(!tn(n,r)||!tn(i,o))}function Mi(t,e,n){var r=!1,i=Ir,o=e.contextType;return"object"===typeof o&&null!==o?o=Oi.currentDispatcher.readContext(o):(i=Or(e)?Dr:Nr.current,o=(r=null!==(r=e.contextTypes)&&void 0!==r)?Ar(t,i):Ir),e=new e(n,o),t.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,e.updater=xi,t.stateNode=e,e._reactInternalFiber=t,r&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=o),e}function Fi(t,e,n,r){t=e.state,"function"===typeof e.componentWillReceiveProps&&e.componentWillReceiveProps(n,r),"function"===typeof e.UNSAFE_componentWillReceiveProps&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&xi.enqueueReplaceState(e,e.state,null)}function Ui(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs=Ri;var o=e.contextType;"object"===typeof o&&null!==o?i.context=Oi.currentDispatcher.readContext(o):(o=Or(e)?Dr:Nr.current,i.context=Ar(t,o)),null!==(o=t.updateQueue)&&(ci(t,o,n,i,r),i.state=t.memoizedState),"function"===typeof(o=e.getDerivedStateFromProps)&&(Pi(t,e,o,n),i.state=t.memoizedState),"function"===typeof e.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(e=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),e!==i.state&&xi.enqueueReplaceState(i,i.state,null),null!==(o=t.updateQueue)&&(ci(t,o,n,i,r),i.state=t.memoizedState)),"function"===typeof i.componentDidMount&&(t.effectTag|=4)}var ji=Array.isArray;function Vi(t,e,n){if(null!==(t=n.ref)&&"function"!==typeof t&&"object"!==typeof t){if(n._owner){n=n._owner;var r=void 0;n&&(1!==n.tag&&a("289"),r=n.stateNode),r||a("147",t);var i=""+t;return null!==e&&null!==e.ref&&"function"===typeof e.ref&&e.ref._stringRef===i?e.ref:((e=function(t){var e=r.refs;e===Ri&&(e=r.refs={}),null===t?delete e[i]:e[i]=t})._stringRef=i,e)}"string"!==typeof t&&a("284"),n._owner||a("290",t)}return t}function Bi(t,e){"textarea"!==t.type&&a("31","[object Object]"===Object.prototype.toString.call(e)?"object with keys {"+Object.keys(e).join(", ")+"}":e,"")}function qi(t){function e(e,n){if(t){var r=e.lastEffect;null!==r?(r.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!t)return null;for(;null!==r;)e(n,r),r=r.sibling;return null}function r(t,e){for(t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function i(t,e,n){return(t=Kr(t,e)).index=0,t.sibling=null,t}function o(e,n,r){return e.index=r,t?null!==(r=e.alternate)?(r=r.index)<n?(e.effectTag=2,n):r:(e.effectTag=2,n):n}function s(e){return t&&null===e.alternate&&(e.effectTag=2),e}function u(t,e,n,r){return null===e||6!==e.tag?((e=Gr(n,t.mode,r)).return=t,e):((e=i(e,n)).return=t,e)}function c(t,e,n,r){return null!==e&&e.elementType===n.type?((r=i(e,n.props)).ref=Vi(t,e,n),r.return=t,r):((r=Qr(n.type,n.key,n.props,null,t.mode,r)).ref=Vi(t,e,n),r.return=t,r)}function l(t,e,n,r){return null===e||4!==e.tag||e.stateNode.containerInfo!==n.containerInfo||e.stateNode.implementation!==n.implementation?((e=Yr(n,t.mode,r)).return=t,e):((e=i(e,n.children||[])).return=t,e)}function h(t,e,n,r,o){return null===e||7!==e.tag?((e=Hr(n,t.mode,r,o)).return=t,e):((e=i(e,n)).return=t,e)}function f(t,e,n){if("string"===typeof e||"number"===typeof e)return(e=Gr(""+e,t.mode,n)).return=t,e;if("object"===typeof e&&null!==e){switch(e.$$typeof){case zt:return(n=Qr(e.type,e.key,e.props,null,t.mode,n)).ref=Vi(t,null,e),n.return=t,n;case Gt:return(e=Yr(e,t.mode,n)).return=t,e}if(ji(e)||ae(e))return(e=Hr(e,t.mode,n,null)).return=t,e;Bi(t,e)}return null}function p(t,e,n,r){var i=null!==e?e.key:null;if("string"===typeof n||"number"===typeof n)return null!==i?null:u(t,e,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case zt:return n.key===i?n.type===Yt?h(t,e,n.props.children,r,i):c(t,e,n,r):null;case Gt:return n.key===i?l(t,e,n,r):null}if(ji(n)||ae(n))return null!==i?null:h(t,e,n,r,null);Bi(t,n)}return null}function d(t,e,n,r,i){if("string"===typeof r||"number"===typeof r)return u(e,t=t.get(n)||null,""+r,i);if("object"===typeof r&&null!==r){switch(r.$$typeof){case zt:return t=t.get(null===r.key?n:r.key)||null,r.type===Yt?h(e,t,r.props.children,i,r.key):c(e,t,r,i);case Gt:return l(e,t=t.get(null===r.key?n:r.key)||null,r,i)}if(ji(r)||ae(r))return h(e,t=t.get(n)||null,r,i,null);Bi(e,r)}return null}function y(i,a,s,u){for(var c=null,l=null,h=a,y=a=0,m=null;null!==h&&y<s.length;y++){h.index>y?(m=h,h=null):m=h.sibling;var g=p(i,h,s[y],u);if(null===g){null===h&&(h=m);break}t&&h&&null===g.alternate&&e(i,h),a=o(g,a,y),null===l?c=g:l.sibling=g,l=g,h=m}if(y===s.length)return n(i,h),c;if(null===h){for(;y<s.length;y++)(h=f(i,s[y],u))&&(a=o(h,a,y),null===l?c=h:l.sibling=h,l=h);return c}for(h=r(i,h);y<s.length;y++)(m=d(h,i,y,s[y],u))&&(t&&null!==m.alternate&&h.delete(null===m.key?y:m.key),a=o(m,a,y),null===l?c=m:l.sibling=m,l=m);return t&&h.forEach(function(t){return e(i,t)}),c}function m(i,s,u,c){var l=ae(u);"function"!==typeof l&&a("150"),null==(u=l.call(u))&&a("151");for(var h=l=null,y=s,m=s=0,g=null,v=u.next();null!==y&&!v.done;m++,v=u.next()){y.index>m?(g=y,y=null):g=y.sibling;var b=p(i,y,v.value,c);if(null===b){y||(y=g);break}t&&y&&null===b.alternate&&e(i,y),s=o(b,s,m),null===h?l=b:h.sibling=b,h=b,y=g}if(v.done)return n(i,y),l;if(null===y){for(;!v.done;m++,v=u.next())null!==(v=f(i,v.value,c))&&(s=o(v,s,m),null===h?l=v:h.sibling=v,h=v);return l}for(y=r(i,y);!v.done;m++,v=u.next())null!==(v=d(y,i,m,v.value,c))&&(t&&null!==v.alternate&&y.delete(null===v.key?m:v.key),s=o(v,s,m),null===h?l=v:h.sibling=v,h=v);return t&&y.forEach(function(t){return e(i,t)}),l}return function(t,r,o,u){var c="object"===typeof o&&null!==o&&o.type===Yt&&null===o.key;c&&(o=o.props.children);var l="object"===typeof o&&null!==o;if(l)switch(o.$$typeof){case zt:t:{for(l=o.key,c=r;null!==c;){if(c.key===l){if(7===c.tag?o.type===Yt:c.elementType===o.type){n(t,c.sibling),(r=i(c,o.type===Yt?o.props.children:o.props)).ref=Vi(t,c,o),r.return=t,t=r;break t}n(t,c);break}e(t,c),c=c.sibling}o.type===Yt?((r=Hr(o.props.children,t.mode,u,o.key)).return=t,t=r):((u=Qr(o.type,o.key,o.props,null,t.mode,u)).ref=Vi(t,r,o),u.return=t,t=u)}return s(t);case Gt:t:{for(c=o.key;null!==r;){if(r.key===c){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(t,r.sibling),(r=i(r,o.children||[])).return=t,t=r;break t}n(t,r);break}e(t,r),r=r.sibling}(r=Yr(o,t.mode,u)).return=t,t=r}return s(t)}if("string"===typeof o||"number"===typeof o)return o=""+o,null!==r&&6===r.tag?(n(t,r.sibling),(r=i(r,o)).return=t,t=r):(n(t,r),(r=Gr(o,t.mode,u)).return=t,t=r),s(t);if(ji(o))return y(t,r,o,u);if(ae(o))return m(t,r,o,u);if(l&&Bi(t,o),"undefined"===typeof o&&!c)switch(t.tag){case 1:case 0:a("152",(u=t.type).displayName||u.name||"Component")}return n(t,r)}}var Wi=qi(!0),Ki=qi(!1),Qi=null,Hi=null,zi=!1;function Gi(t,e){var n=qr(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=e,n.return=t,n.effectTag=8,null!==t.lastEffect?(t.lastEffect.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n}function Yi(t,e){switch(t.tag){case 5:var n=t.type;return null!==(e=1!==e.nodeType||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e)&&(t.stateNode=e,!0);case 6:return null!==(e=""===t.pendingProps||3!==e.nodeType?null:e)&&(t.stateNode=e,!0);default:return!1}}function Xi(t){if(zi){var e=Hi;if(e){var n=e;if(!Yi(t,e)){if(!(e=_r(n))||!Yi(t,e))return t.effectTag|=2,zi=!1,void(Qi=t);Gi(Qi,n)}Qi=t,Hi=wr(e)}else t.effectTag|=2,zi=!1,Qi=t}}function Ji(t){for(t=t.return;null!==t&&5!==t.tag&&3!==t.tag;)t=t.return;Qi=t}function $i(t){if(t!==Qi)return!1;if(!zi)return Ji(t),zi=!0,!1;var e=t.type;if(5!==t.tag||"head"!==e&&"body"!==e&&!gr(e,t.memoizedProps))for(e=Hi;e;)Gi(t,e),e=_r(e);return Ji(t),Hi=Qi?_r(t.stateNode):null,!0}function Zi(){Hi=Qi=null,zi=!1}var to=Kt.ReactCurrentOwner;function eo(t,e,n,r){e.child=null===t?Ki(e,null,n,r):Wi(e,t.child,n,r)}function no(t,e,n,r,i){n=n.render;var o=e.ref;return bi(e),r=n(r,o),e.effectTag|=1,eo(t,e,r,i),e.child}function ro(t,e,n,r,i,o){if(null===t){var a=n.type;return"function"!==typeof a||Wr(a)||void 0!==a.defaultProps||null!==n.compare?((t=Qr(n.type,null,r,null,e.mode,o)).ref=e.ref,t.return=e,e.child=t):(e.tag=15,e.type=a,io(t,e,a,r,i,o))}return a=t.child,i<o&&(i=a.memoizedProps,(n=null!==(n=n.compare)?n:tn)(i,r)&&t.ref===e.ref)?ho(t,e,o):(e.effectTag|=1,(t=Kr(a,r)).ref=e.ref,t.return=e,e.child=t)}function io(t,e,n,r,i,o){return null!==t&&i<o&&tn(t.memoizedProps,r)&&t.ref===e.ref?ho(t,e,o):ao(t,e,n,r,o)}function oo(t,e){var n=e.ref;(null===t&&null!==n||null!==t&&t.ref!==n)&&(e.effectTag|=128)}function ao(t,e,n,r,i){var o=Or(n)?Dr:Nr.current;return o=Ar(e,o),bi(e),n=n(r,o),e.effectTag|=1,eo(t,e,n,i),e.child}function so(t,e,n,r,i){if(Or(n)){var o=!0;Mr(e)}else o=!1;if(bi(e),null===e.stateNode)null!==t&&(t.alternate=null,e.alternate=null,e.effectTag|=2),Mi(e,n,r),Ui(e,n,r,i),r=!0;else if(null===t){var a=e.stateNode,s=e.memoizedProps;a.props=s;var u=a.context,c=n.contextType;"object"===typeof c&&null!==c?c=Oi.currentDispatcher.readContext(c):c=Ar(e,c=Or(n)?Dr:Nr.current);var l=n.getDerivedStateFromProps,h="function"===typeof l||"function"===typeof a.getSnapshotBeforeUpdate;h||"function"!==typeof a.UNSAFE_componentWillReceiveProps&&"function"!==typeof a.componentWillReceiveProps||(s!==r||u!==c)&&Fi(e,a,r,c),ti=!1;var f=e.memoizedState;u=a.state=f;var p=e.updateQueue;null!==p&&(ci(e,p,r,a,i),u=e.memoizedState),s!==r||f!==u||kr.current||ti?("function"===typeof l&&(Pi(e,n,l,r),u=e.memoizedState),(s=ti||Li(e,n,s,r,f,u,c))?(h||"function"!==typeof a.UNSAFE_componentWillMount&&"function"!==typeof a.componentWillMount||("function"===typeof a.componentWillMount&&a.componentWillMount(),"function"===typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"===typeof a.componentDidMount&&(e.effectTag|=4)):("function"===typeof a.componentDidMount&&(e.effectTag|=4),e.memoizedProps=r,e.memoizedState=u),a.props=r,a.state=u,a.context=c,r=s):("function"===typeof a.componentDidMount&&(e.effectTag|=4),r=!1)}else a=e.stateNode,s=e.memoizedProps,a.props=e.type===e.elementType?s:Ai(e.type,s),u=a.context,"object"===typeof(c=n.contextType)&&null!==c?c=Oi.currentDispatcher.readContext(c):c=Ar(e,c=Or(n)?Dr:Nr.current),(h="function"===typeof(l=n.getDerivedStateFromProps)||"function"===typeof a.getSnapshotBeforeUpdate)||"function"!==typeof a.UNSAFE_componentWillReceiveProps&&"function"!==typeof a.componentWillReceiveProps||(s!==r||u!==c)&&Fi(e,a,r,c),ti=!1,u=e.memoizedState,f=a.state=u,null!==(p=e.updateQueue)&&(ci(e,p,r,a,i),f=e.memoizedState),s!==r||u!==f||kr.current||ti?("function"===typeof l&&(Pi(e,n,l,r),f=e.memoizedState),(l=ti||Li(e,n,s,r,u,f,c))?(h||"function"!==typeof a.UNSAFE_componentWillUpdate&&"function"!==typeof a.componentWillUpdate||("function"===typeof a.componentWillUpdate&&a.componentWillUpdate(r,f,c),"function"===typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,f,c)),"function"===typeof a.componentDidUpdate&&(e.effectTag|=4),"function"===typeof a.getSnapshotBeforeUpdate&&(e.effectTag|=256)):("function"!==typeof a.componentDidUpdate||s===t.memoizedProps&&u===t.memoizedState||(e.effectTag|=4),"function"!==typeof a.getSnapshotBeforeUpdate||s===t.memoizedProps&&u===t.memoizedState||(e.effectTag|=256),e.memoizedProps=r,e.memoizedState=f),a.props=r,a.state=f,a.context=c,r=l):("function"!==typeof a.componentDidUpdate||s===t.memoizedProps&&u===t.memoizedState||(e.effectTag|=4),"function"!==typeof a.getSnapshotBeforeUpdate||s===t.memoizedProps&&u===t.memoizedState||(e.effectTag|=256),r=!1);return uo(t,e,n,r,o,i)}function uo(t,e,n,r,i,o){oo(t,e);var a=0!==(64&e.effectTag);if(!r&&!a)return i&&Fr(e,n,!1),ho(t,e,o);r=e.stateNode,to.current=e;var s=a&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return e.effectTag|=1,null!==t&&a?(e.child=Wi(e,t.child,null,o),e.child=Wi(e,null,s,o)):eo(t,e,s,o),e.memoizedState=r.state,i&&Fr(e,n,!0),e.child}function co(t){var e=t.stateNode;e.pendingContext?xr(0,e.pendingContext,e.pendingContext!==e.context):e.context&&xr(0,e.context,!1),Ii(t,e.containerInfo)}function lo(t,e,n){var r=e.mode,i=e.pendingProps,o=e.memoizedState;if(0===(64&e.effectTag)){o=null;var a=!1}else o={timedOutAt:null!==o?o.timedOutAt:0},a=!0,e.effectTag&=-65;return null===t?a?(a=i.fallback,i=Hr(null,r,0,null),0===(1&e.mode)&&(i.child=null!==e.memoizedState?e.child.child:e.child),r=Hr(a,r,n,null),i.sibling=r,(n=i).return=r.return=e):n=r=Ki(e,null,i.children,n):null!==t.memoizedState?(t=(r=t.child).sibling,a?(n=i.fallback,i=Kr(r,r.pendingProps),0===(1&e.mode)&&((a=null!==e.memoizedState?e.child.child:e.child)!==r.child&&(i.child=a)),r=i.sibling=Kr(t,n,t.expirationTime),n=i,i.childExpirationTime=0,n.return=r.return=e):n=r=Wi(e,r.child,i.children,n)):(t=t.child,a?(a=i.fallback,(i=Hr(null,r,0,null)).child=t,0===(1&e.mode)&&(i.child=null!==e.memoizedState?e.child.child:e.child),(r=i.sibling=Hr(a,r,n,null)).effectTag|=2,n=i,i.childExpirationTime=0,n.return=r.return=e):r=n=Wi(e,t,i.children,n)),e.memoizedState=o,e.child=n,r}function ho(t,e,n){if(null!==t&&(e.firstContextDependency=t.firstContextDependency),e.childExpirationTime<n)return null;if(null!==t&&e.child!==t.child&&a("153"),null!==e.child){for(n=Kr(t=e.child,t.pendingProps,t.expirationTime),e.child=n,n.return=e;null!==t.sibling;)t=t.sibling,(n=n.sibling=Kr(t,t.pendingProps,t.expirationTime)).return=e;n.sibling=null}return e.child}function fo(t,e,n){var r=e.expirationTime;if(null!==t&&t.memoizedProps===e.pendingProps&&!kr.current&&r<n){switch(e.tag){case 3:co(e),Zi();break;case 5:ki(e);break;case 1:Or(e.type)&&Mr(e);break;case 4:Ii(e,e.stateNode.containerInfo);break;case 10:gi(e,e.memoizedProps.value);break;case 13:if(null!==e.memoizedState)return 0!==(r=e.child.childExpirationTime)&&r>=n?lo(t,e,n):null!==(e=ho(t,e,n))?e.sibling:null}return ho(t,e,n)}switch(e.expirationTime=0,e.tag){case 2:r=e.elementType,null!==t&&(t.alternate=null,e.alternate=null,e.effectTag|=2),t=e.pendingProps;var i=Ar(e,Nr.current);if(bi(e),i=r(t,i),e.effectTag|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof){if(e.tag=1,Or(r)){var o=!0;Mr(e)}else o=!1;e.memoizedState=null!==i.state&&void 0!==i.state?i.state:null;var s=r.getDerivedStateFromProps;"function"===typeof s&&Pi(e,r,s,t),i.updater=xi,e.stateNode=i,i._reactInternalFiber=e,Ui(e,r,t,n),e=uo(null,e,r,!0,o,n)}else e.tag=0,eo(null,e,i,n),e=e.child;return e;case 16:switch(i=e.elementType,null!==t&&(t.alternate=null,e.alternate=null,e.effectTag|=2),o=e.pendingProps,t=function(t){var e=t._result;switch(t._status){case 1:return e;case 2:case 0:throw e;default:throw t._status=0,(e=(e=t._ctor)()).then(function(e){0===t._status&&(e=e.default,t._status=1,t._result=e)},function(e){0===t._status&&(t._status=2,t._result=e)}),t._result=e,e}}(i),e.type=t,i=e.tag=function(t){if("function"===typeof t)return Wr(t)?1:0;if(void 0!==t&&null!==t){if((t=t.$$typeof)===ee)return 11;if(t===re)return 14}return 2}(t),o=Ai(t,o),s=void 0,i){case 0:s=ao(null,e,t,o,n);break;case 1:s=so(null,e,t,o,n);break;case 11:s=no(null,e,t,o,n);break;case 14:s=ro(null,e,t,Ai(t.type,o),r,n);break;default:a("283",t)}return s;case 0:return r=e.type,i=e.pendingProps,ao(t,e,r,i=e.elementType===r?i:Ai(r,i),n);case 1:return r=e.type,i=e.pendingProps,so(t,e,r,i=e.elementType===r?i:Ai(r,i),n);case 3:return co(e),null===(r=e.updateQueue)&&a("282"),i=null!==(i=e.memoizedState)?i.element:null,ci(e,r,e.pendingProps,null,n),(r=e.memoizedState.element)===i?(Zi(),e=ho(t,e,n)):(i=e.stateNode,(i=(null===t||null===t.child)&&i.hydrate)&&(Hi=wr(e.stateNode.containerInfo),Qi=e,i=zi=!0),i?(e.effectTag|=2,e.child=Ki(e,null,r,n)):(eo(t,e,r,n),Zi()),e=e.child),e;case 5:return ki(e),null===t&&Xi(e),r=e.type,i=e.pendingProps,o=null!==t?t.memoizedProps:null,s=i.children,gr(r,i)?s=null:null!==o&&gr(r,o)&&(e.effectTag|=16),oo(t,e),1!==n&&1&e.mode&&i.hidden?(e.expirationTime=1,e=null):(eo(t,e,s,n),e=e.child),e;case 6:return null===t&&Xi(e),null;case 13:return lo(t,e,n);case 4:return Ii(e,e.stateNode.containerInfo),r=e.pendingProps,null===t?e.child=Wi(e,null,r,n):eo(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,no(t,e,r,i=e.elementType===r?i:Ai(r,i),n);case 7:return eo(t,e,e.pendingProps,n),e.child;case 8:case 12:return eo(t,e,e.pendingProps.children,n),e.child;case 10:t:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,gi(e,o=i.value),null!==s){var u=s.value;if(0===(o=u===o&&(0!==u||1/u===1/o)||u!==u&&o!==o?0:0|("function"===typeof r._calculateChangedBits?r._calculateChangedBits(u,o):1073741823))){if(s.children===i.children&&!kr.current){e=ho(t,e,n);break t}}else for(null!==(s=e.child)&&(s.return=e);null!==s;){if(null!==(u=s.firstContextDependency))do{if(u.context===r&&0!==(u.observedBits&o)){if(1===s.tag){var c=ri(n);c.tag=2,oi(s,c)}s.expirationTime<n&&(s.expirationTime=n),null!==(c=s.alternate)&&c.expirationTime<n&&(c.expirationTime=n);for(var l=s.return;null!==l;){if(c=l.alternate,l.childExpirationTime<n)l.childExpirationTime=n,null!==c&&c.childExpirationTime<n&&(c.childExpirationTime=n);else{if(!(null!==c&&c.childExpirationTime<n))break;c.childExpirationTime=n}l=l.return}}c=s.child,u=u.next}while(null!==u);else c=10===s.tag&&s.type===e.type?null:s.child;if(null!==c)c.return=s;else for(c=s;null!==c;){if(c===e){c=null;break}if(null!==(s=c.sibling)){s.return=c.return,c=s;break}c=c.return}s=c}}eo(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=(o=e.pendingProps).children,bi(e),r=r(i=_i(i,o.unstable_observedBits)),e.effectTag|=1,eo(t,e,r,n),e.child;case 14:return ro(t,e,i=e.type,o=Ai(i.type,e.pendingProps),r,n);case 15:return io(t,e,e.type,e.pendingProps,r,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Ai(r,i),null!==t&&(t.alternate=null,e.alternate=null,e.effectTag|=2),e.tag=1,Or(r)?(t=!0,Mr(e)):t=!1,bi(e),Mi(e,r,i),Ui(e,r,i,n),uo(null,e,r,!0,t,n);default:a("156")}}function po(t){t.effectTag|=4}var yo=void 0,mo=void 0,go=void 0,vo=void 0;function bo(t,e){var n=e.source,r=e.stack;null===r&&null!==n&&(r=ue(n)),null!==n&&se(n.type),e=e.value,null!==t&&1===t.tag&&se(t.type);try{console.error(e)}catch(i){setTimeout(function(){throw i})}}function _o(t){var e=t.ref;if(null!==e)if("function"===typeof e)try{e(null)}catch(n){Yo(t,n)}else e.current=null}function wo(t){switch("function"===typeof jr&&jr(t),t.tag){case 0:case 11:case 14:case 15:var e=t.updateQueue;if(null!==e&&null!==(e=e.lastEffect)){var n=e=e.next;do{var r=n.destroy;if(null!==r){var i=t;try{r()}catch(o){Yo(i,o)}}n=n.next}while(n!==e)}break;case 1:if(_o(t),"function"===typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(o){Yo(t,o)}break;case 5:_o(t);break;case 4:So(t)}}function Eo(t){return 5===t.tag||3===t.tag||4===t.tag}function To(t){t:{for(var e=t.return;null!==e;){if(Eo(e)){var n=e;break t}e=e.return}a("160"),n=void 0}var r=e=void 0;switch(n.tag){case 5:e=n.stateNode,r=!1;break;case 3:case 4:e=n.stateNode.containerInfo,r=!0;break;default:a("161")}16&n.effectTag&&(ir(e,""),n.effectTag&=-17);t:e:for(n=t;;){for(;null===n.sibling;){if(null===n.return||Eo(n.return)){n=null;break t}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag;){if(2&n.effectTag)continue e;if(null===n.child||4===n.tag)continue e;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break t}}for(var i=t;;){if(5===i.tag||6===i.tag)if(n)if(r){var o=e,s=i.stateNode,u=n;8===o.nodeType?o.parentNode.insertBefore(s,u):o.insertBefore(s,u)}else e.insertBefore(i.stateNode,n);else r?(s=e,u=i.stateNode,8===s.nodeType?(o=s.parentNode).insertBefore(u,s):(o=s).appendChild(u),null!==(s=s._reactRootContainer)&&void 0!==s||null!==o.onclick||(o.onclick=pr)):e.appendChild(i.stateNode);else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;i=i.return}i.sibling.return=i.return,i=i.sibling}}function So(t){for(var e=t,n=!1,r=void 0,i=void 0;;){if(!n){n=e.return;t:for(;;){switch(null===n&&a("160"),n.tag){case 5:r=n.stateNode,i=!1;break t;case 3:case 4:r=n.stateNode.containerInfo,i=!0;break t}n=n.return}n=!0}if(5===e.tag||6===e.tag){t:for(var o=e,s=o;;)if(wo(s),null!==s.child&&4!==s.tag)s.child.return=s,s=s.child;else{if(s===o)break;for(;null===s.sibling;){if(null===s.return||s.return===o)break t;s=s.return}s.sibling.return=s.return,s=s.sibling}i?(o=r,s=e.stateNode,8===o.nodeType?o.parentNode.removeChild(s):o.removeChild(s)):r.removeChild(e.stateNode)}else if(4===e.tag?(r=e.stateNode.containerInfo,i=!0):wo(e),null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return;4===(e=e.return).tag&&(n=!1)}e.sibling.return=e.return,e=e.sibling}}function Co(t,e){switch(e.tag){case 0:case 11:case 14:case 15:case 1:break;case 5:var n=e.stateNode;if(null!=n){var r=e.memoizedProps,i=null!==t?t.memoizedProps:r;t=e.type;var o=e.updateQueue;if(e.updateQueue=null,null!==o){for(n[x]=r,"input"===t&&"radio"===r.type&&null!=r.name&&we(n,r),hr(t,i),e=hr(t,r),i=0;i<o.length;i+=2){var s=o[i],u=o[i+1];"style"===s?ur(n,u):"dangerouslySetInnerHTML"===s?rr(n,u):"children"===s?ir(n,u):ge(n,s,u,e)}switch(t){case"input":Ee(n,r);break;case"textarea":Xn(n,r);break;case"select":e=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(t=r.value)?zn(n,!!r.multiple,t,!1):e!==!!r.multiple&&(null!=r.defaultValue?zn(n,!!r.multiple,r.defaultValue,!0):zn(n,!!r.multiple,r.multiple?[]:"",!1))}}}break;case 6:null===e.stateNode&&a("162"),e.stateNode.nodeValue=e.memoizedProps;break;case 3:case 12:break;case 13:if(t=e,null===(n=e.memoizedState)?r=!1:(r=!0,t=e.child,0===n.timedOutAt&&(n.timedOutAt=Sa())),null!==t)t:for(e=n=t;;){if(5===e.tag)t=e.stateNode,r?t.style.display="none":(t=e.stateNode,o=void 0!==(o=e.memoizedProps.style)&&null!==o&&o.hasOwnProperty("display")?o.display:null,t.style.display=sr("display",o));else if(6===e.tag)e.stateNode.nodeValue=r?"":e.memoizedProps;else{if(13===e.tag&&null!==e.memoizedState){(t=e.child.sibling).return=e,e=t;continue}if(null!==e.child){e.child.return=e,e=e.child;continue}}if(e===n)break t;for(;null===e.sibling;){if(null===e.return||e.return===n)break t;e=e.return}e.sibling.return=e.return,e=e.sibling}break;case 17:break;default:a("163")}}function Io(t,e,n){(n=ri(n)).tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){xa(r),bo(t,e)},n}function No(t,e,n){(n=ri(n)).tag=3;var r=t.type.getDerivedStateFromError;if("function"===typeof r){var i=e.value;n.payload=function(){return r(i)}}var o=t.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(n.callback=function(){"function"!==typeof r&&(null===Wo?Wo=new Set([this]):Wo.add(this));var n=e.value,i=e.stack;bo(t,e),this.componentDidCatch(n,{componentStack:null!==i?i:""})}),n}function ko(t){switch(t.tag){case 1:Or(t.type)&&Rr();var e=t.effectTag;return 2048&e?(t.effectTag=-2049&e|64,t):null;case 3:return Ni(),Pr(),0!==(64&(e=t.effectTag))&&a("285"),t.effectTag=-2049&e|64,t;case 5:return Di(t),null;case 13:return 2048&(e=t.effectTag)?(t.effectTag=-2049&e|64,t):null;case 4:return Ni(),null;case 10:return vi(t),null;default:return null}}yo=function(t,e){for(var n=e.child;null!==n;){if(5===n.tag||6===n.tag)t.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},mo=function(){},go=function(t,e,n,r,o){var a=t.memoizedProps;if(a!==r){var s=e.stateNode;switch(Ci(Ei.current),t=null,n){case"input":a=be(s,a),r=be(s,r),t=[];break;case"option":a=Hn(s,a),r=Hn(s,r),t=[];break;case"select":a=i({},a,{value:void 0}),r=i({},r,{value:void 0}),t=[];break;case"textarea":a=Gn(s,a),r=Gn(s,r),t=[];break;default:"function"!==typeof a.onClick&&"function"===typeof r.onClick&&(s.onclick=pr)}lr(n,r),s=n=void 0;var u=null;for(n in a)if(!r.hasOwnProperty(n)&&a.hasOwnProperty(n)&&null!=a[n])if("style"===n){var c=a[n];for(s in c)c.hasOwnProperty(s)&&(u||(u={}),u[s]="")}else"dangerouslySetInnerHTML"!==n&&"children"!==n&&"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(b.hasOwnProperty(n)?t||(t=[]):(t=t||[]).push(n,null));for(n in r){var l=r[n];if(c=null!=a?a[n]:void 0,r.hasOwnProperty(n)&&l!==c&&(null!=l||null!=c))if("style"===n)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(u||(u={}),u[s]="");for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(u||(u={}),u[s]=l[s])}else u||(t||(t=[]),t.push(n,u)),u=l;else"dangerouslySetInnerHTML"===n?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(t=t||[]).push(n,""+l)):"children"===n?c===l||"string"!==typeof l&&"number"!==typeof l||(t=t||[]).push(n,""+l):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&(b.hasOwnProperty(n)?(null!=l&&fr(o,n),t||c===l||(t=[])):(t=t||[]).push(n,l))}u&&(t=t||[]).push("style",u),o=t,(e.updateQueue=o)&&po(e)}},vo=function(t,e,n,r){n!==r&&po(e)};var Do={readContext:_i},Ao=Kt.ReactCurrentOwner,Oo=1073741822,Ro=0,Po=!1,xo=null,Lo=null,Mo=0,Fo=-1,Uo=!1,jo=null,Vo=!1,Bo=null,qo=null,Wo=null;function Ko(){if(null!==xo)for(var t=xo.return;null!==t;){var e=t;switch(e.tag){case 1:var n=e.type.childContextTypes;null!==n&&void 0!==n&&Rr();break;case 3:Ni(),Pr();break;case 5:Di(e);break;case 4:Ni();break;case 10:vi(e)}t=t.return}Lo=null,Mo=0,Fo=-1,Uo=!1,xo=null}function Qo(){null!==qo&&(o.unstable_cancelCallback(Bo),qo())}function Ho(t){for(;;){var e=t.alternate,n=t.return,r=t.sibling;if(0===(1024&t.effectTag)){xo=t;t:{var o=e,s=Mo,u=(e=t).pendingProps;switch(e.tag){case 2:case 16:break;case 15:case 0:break;case 1:Or(e.type)&&Rr();break;case 3:Ni(),Pr(),(u=e.stateNode).pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),null!==o&&null!==o.child||($i(e),e.effectTag&=-3),mo(e);break;case 5:Di(e);var c=Ci(Si.current);if(s=e.type,null!==o&&null!=e.stateNode)go(o,e,s,u,c),o.ref!==e.ref&&(e.effectTag|=128);else if(u){var l=Ci(Ei.current);if($i(e)){o=(u=e).stateNode;var h=u.type,f=u.memoizedProps,p=c;switch(o[P]=u,o[x]=f,s=void 0,c=h){case"iframe":case"object":Cn("load",o);break;case"video":case"audio":for(h=0;h<et.length;h++)Cn(et[h],o);break;case"source":Cn("error",o);break;case"img":case"image":case"link":Cn("error",o),Cn("load",o);break;case"form":Cn("reset",o),Cn("submit",o);break;case"details":Cn("toggle",o);break;case"input":_e(o,f),Cn("invalid",o),fr(p,"onChange");break;case"select":o._wrapperState={wasMultiple:!!f.multiple},Cn("invalid",o),fr(p,"onChange");break;case"textarea":Yn(o,f),Cn("invalid",o),fr(p,"onChange")}for(s in lr(c,f),h=null,f)f.hasOwnProperty(s)&&(l=f[s],"children"===s?"string"===typeof l?o.textContent!==l&&(h=["children",l]):"number"===typeof l&&o.textContent!==""+l&&(h=["children",""+l]):b.hasOwnProperty(s)&&null!=l&&fr(p,s));switch(c){case"input":qt(o),Te(o,f,!0);break;case"textarea":qt(o),Jn(o);break;case"select":case"option":break;default:"function"===typeof f.onClick&&(o.onclick=pr)}s=h,u.updateQueue=s,(u=null!==s)&&po(e)}else{f=e,o=s,p=u,h=9===c.nodeType?c:c.ownerDocument,l===$n.html&&(l=Zn(o)),l===$n.html?"script"===o?((o=h.createElement("div")).innerHTML="<script><\/script>",h=o.removeChild(o.firstChild)):"string"===typeof p.is?h=h.createElement(o,{is:p.is}):(h=h.createElement(o),"select"===o&&p.multiple&&(h.multiple=!0)):h=h.createElementNS(l,o),(o=h)[P]=f,o[x]=u,yo(o,e,!1,!1),p=o;var d=c,y=hr(h=s,f=u);switch(h){case"iframe":case"object":Cn("load",p),c=f;break;case"video":case"audio":for(c=0;c<et.length;c++)Cn(et[c],p);c=f;break;case"source":Cn("error",p),c=f;break;case"img":case"image":case"link":Cn("error",p),Cn("load",p),c=f;break;case"form":Cn("reset",p),Cn("submit",p),c=f;break;case"details":Cn("toggle",p),c=f;break;case"input":_e(p,f),c=be(p,f),Cn("invalid",p),fr(d,"onChange");break;case"option":c=Hn(p,f);break;case"select":p._wrapperState={wasMultiple:!!f.multiple},c=i({},f,{value:void 0}),Cn("invalid",p),fr(d,"onChange");break;case"textarea":Yn(p,f),c=Gn(p,f),Cn("invalid",p),fr(d,"onChange");break;default:c=f}lr(h,c),l=void 0;var m=h,g=p,v=c;for(l in v)if(v.hasOwnProperty(l)){var _=v[l];"style"===l?ur(g,_):"dangerouslySetInnerHTML"===l?null!=(_=_?_.__html:void 0)&&rr(g,_):"children"===l?"string"===typeof _?("textarea"!==m||""!==_)&&ir(g,_):"number"===typeof _&&ir(g,""+_):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(b.hasOwnProperty(l)?null!=_&&fr(d,l):null!=_&&ge(g,l,_,y))}switch(h){case"input":qt(p),Te(p,f,!1);break;case"textarea":qt(p),Jn(p);break;case"option":null!=f.value&&p.setAttribute("value",""+ve(f.value));break;case"select":(c=p).multiple=!!f.multiple,null!=(p=f.value)?zn(c,!!f.multiple,p,!1):null!=f.defaultValue&&zn(c,!!f.multiple,f.defaultValue,!0);break;default:"function"===typeof c.onClick&&(p.onclick=pr)}(u=mr(s,u))&&po(e),e.stateNode=o}null!==e.ref&&(e.effectTag|=128)}else null===e.stateNode&&a("166");break;case 6:o&&null!=e.stateNode?vo(o,e,o.memoizedProps,u):("string"!==typeof u&&(null===e.stateNode&&a("166")),o=Ci(Si.current),Ci(Ei.current),$i(e)?(s=(u=e).stateNode,o=u.memoizedProps,s[P]=u,(u=s.nodeValue!==o)&&po(e)):(s=e,(u=(9===o.nodeType?o:o.ownerDocument).createTextNode(u))[P]=e,s.stateNode=u));break;case 11:break;case 13:if(u=e.memoizedState,0!==(64&e.effectTag)){e.expirationTime=s,xo=e;break t}u=null!==u,s=null!==o&&null!==o.memoizedState,null!==o&&!u&&s&&(null!==(o=o.child.sibling)&&(null!==(c=e.firstEffect)?(e.firstEffect=o,o.nextEffect=c):(e.firstEffect=e.lastEffect=o,o.nextEffect=null),o.effectTag=8)),(u!==s||0===(1&e.effectTag)&&u)&&(e.effectTag|=4);break;case 7:case 8:case 12:break;case 4:Ni(),mo(e);break;case 10:vi(e);break;case 9:case 14:break;case 17:Or(e.type)&&Rr();break;default:a("156")}xo=null}if(e=t,1===Mo||1!==e.childExpirationTime){for(u=0,s=e.child;null!==s;)(o=s.expirationTime)>u&&(u=o),(c=s.childExpirationTime)>u&&(u=c),s=s.sibling;e.childExpirationTime=u}if(null!==xo)return xo;null!==n&&0===(1024&n.effectTag)&&(null===n.firstEffect&&(n.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=t.firstEffect),n.lastEffect=t.lastEffect),1<t.effectTag&&(null!==n.lastEffect?n.lastEffect.nextEffect=t:n.firstEffect=t,n.lastEffect=t))}else{if(null!==(t=ko(t)))return t.effectTag&=1023,t;null!==n&&(n.firstEffect=n.lastEffect=null,n.effectTag|=1024)}if(null!==r)return r;if(null===n)break;t=n}return null}function zo(t){var e=fo(t.alternate,t,Mo);return t.memoizedProps=t.pendingProps,null===e&&(e=Ho(t)),Ao.current=null,e}function Go(t,e){Po&&a("243"),Qo(),Po=!0,Ao.currentDispatcher=Do;var n=t.nextExpirationTimeToWorkOn;n===Mo&&t===Lo&&null!==xo||(Ko(),Mo=n,xo=Kr((Lo=t).current,null),t.pendingCommitExpirationTime=0);for(var r=!1;;){try{if(e)for(;null!==xo&&!ka();)xo=zo(xo);else for(;null!==xo;)xo=zo(xo)}catch(y){if(mi=yi=di=null,null===xo)r=!0,xa(y);else{null===xo&&a("271");var i=xo,o=i.return;if(null!==o){t:{var s=t,u=o,c=i,l=y;if(o=Mo,c.effectTag|=1024,c.firstEffect=c.lastEffect=null,null!==l&&"object"===typeof l&&"function"===typeof l.then){var h=l;l=u;var f=-1,p=-1;do{if(13===l.tag){var d=l.alternate;if(null!==d&&null!==(d=d.memoizedState)){p=10*(1073741822-d.timedOutAt);break}"number"===typeof(d=l.pendingProps.maxDuration)&&(0>=d?f=0:(-1===f||d<f)&&(f=d))}l=l.return}while(null!==l);l=u;do{if((d=13===l.tag)&&(d=void 0!==l.memoizedProps.fallback&&null===l.memoizedState),d){if(u=Jo.bind(null,s,l,c,0===(1&l.mode)?1073741823:o),h.then(u,u),0===(1&l.mode)){l.effectTag|=64,c.effectTag&=-1957,1===c.tag&&null===c.alternate&&(c.tag=17),c.expirationTime=o;break t}-1===f?s=1073741823:(-1===p&&(p=10*(1073741822-$r(s,o))-5e3),s=p+f),0<=s&&Fo<s&&(Fo=s),l.effectTag|=2048,l.expirationTime=o;break t}l=l.return}while(null!==l);l=Error((se(c.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."+ue(c))}Uo=!0,l=fi(l,c),s=u;do{switch(s.tag){case 3:c=l,s.effectTag|=2048,s.expirationTime=o,ai(s,o=Io(s,c,o));break t;case 1:if(c=l,u=s.type,h=s.stateNode,0===(64&s.effectTag)&&("function"===typeof u.getDerivedStateFromError||null!==h&&"function"===typeof h.componentDidCatch&&(null===Wo||!Wo.has(h)))){s.effectTag|=2048,s.expirationTime=o,ai(s,o=No(s,c,o));break t}}s=s.return}while(null!==s)}xo=Ho(i);continue}r=!0,xa(y)}}break}if(Po=!1,mi=yi=di=Ao.currentDispatcher=null,r)Lo=null,t.finishedWork=null;else if(null!==xo)t.finishedWork=null;else{if(null===(r=t.current.alternate)&&a("281"),Lo=null,Uo){if(i=t.latestPendingTime,o=t.latestSuspendedTime,s=t.latestPingedTime,0!==i&&i<n||0!==o&&o<n||0!==s&&s<n)return Jr(t,n),void Ta(t,r,n,t.expirationTime,-1);if(!t.didError&&e)return t.didError=!0,n=t.nextExpirationTimeToWorkOn=n,e=t.expirationTime=1073741823,void Ta(t,r,n,e,-1)}e&&-1!==Fo?(Jr(t,n),(e=10*(1073741822-$r(t,n)))<Fo&&(Fo=e),e=10*(1073741822-Sa()),e=Fo-e,Ta(t,r,n,t.expirationTime,0>e?0:e)):(t.pendingCommitExpirationTime=n,t.finishedWork=r)}}function Yo(t,e){for(var n=t.return;null!==n;){switch(n.tag){case 1:var r=n.stateNode;if("function"===typeof n.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===Wo||!Wo.has(r)))return oi(n,t=No(n,t=fi(e,t),1073741823)),void Zo(n,1073741823);break;case 3:return oi(n,t=Io(n,t=fi(e,t),1073741823)),void Zo(n,1073741823)}n=n.return}3===t.tag&&(oi(t,n=Io(t,n=fi(e,t),1073741823)),Zo(t,1073741823))}function Xo(t,e){return 0!==Ro?t=Ro:Po?t=Vo?1073741823:Mo:1&e.mode?(t=pa?1073741822-10*(1+((1073741822-t+15)/10|0)):1073741822-25*(1+((1073741822-t+500)/25|0)),null!==Lo&&t===Mo&&--t):t=1073741823,pa&&(0===ua||t<ua)&&(ua=t),t}function Jo(t,e,n,r){var i=t.earliestSuspendedTime,o=t.latestSuspendedTime;if(0!==i&&r<=i&&r>=o){o=i=r,t.didError=!1;var a=t.latestPingedTime;(0===a||a>o)&&(t.latestPingedTime=o),Zr(o,t)}else Xr(t,i=Xo(i=Sa(),e));0!==(1&e.mode)&&t===Lo&&Mo===r&&(Lo=null),$o(e,i),0===(1&e.mode)&&($o(n,i),1===n.tag&&null!==n.stateNode&&((e=ri(i)).tag=2,oi(n,e))),0!==(n=t.expirationTime)&&Ca(t,n)}function $o(t,e){t.expirationTime<e&&(t.expirationTime=e);var n=t.alternate;null!==n&&n.expirationTime<e&&(n.expirationTime=e);var r=t.return,i=null;if(null===r&&3===t.tag)i=t.stateNode;else for(;null!==r;){if(n=r.alternate,r.childExpirationTime<e&&(r.childExpirationTime=e),null!==n&&n.childExpirationTime<e&&(n.childExpirationTime=e),null===r.return&&3===r.tag){i=r.stateNode;break}r=r.return}return i}function Zo(t,e){null!==(t=$o(t,e))&&(!Po&&0!==Mo&&e>Mo&&Ko(),Xr(t,e),Po&&!Vo&&Lo===t||Ca(t,t.expirationTime),ba>va&&(ba=0,a("185")))}function ta(t,e,n,r,i){var o=Ro;Ro=1073741823;try{return t(e,n,r,i)}finally{Ro=o}}var ea=null,na=null,ra=0,ia=void 0,oa=!1,aa=null,sa=0,ua=0,ca=!1,la=null,ha=!1,fa=!1,pa=!1,da=null,ya=o.unstable_now(),ma=1073741822-(ya/10|0),ga=ma,va=50,ba=0,_a=null;function wa(){ma=1073741822-((o.unstable_now()-ya)/10|0)}function Ea(t,e){if(0!==ra){if(e<ra)return;null!==ia&&o.unstable_cancelCallback(ia)}ra=e,t=o.unstable_now()-ya,ia=o.unstable_scheduleCallback(Da,{timeout:10*(1073741822-e)-t})}function Ta(t,e,n,r,i){t.expirationTime=r,0!==i||ka()?0<i&&(t.timeoutHandle=vr(function(t,e,n){t.pendingCommitExpirationTime=n,t.finishedWork=e,wa(),ga=ma,Oa(t,n)}.bind(null,t,e,n),i)):(t.pendingCommitExpirationTime=n,t.finishedWork=e)}function Sa(){return oa?ga:(Ia(),0!==sa&&1!==sa||(wa(),ga=ma),ga)}function Ca(t,e){null===t.nextScheduledRoot?(t.expirationTime=e,null===na?(ea=na=t,t.nextScheduledRoot=t):(na=na.nextScheduledRoot=t).nextScheduledRoot=ea):e>t.expirationTime&&(t.expirationTime=e),oa||(ha?fa&&(aa=t,sa=1073741823,Ra(t,1073741823,!1)):1073741823===e?Aa(1073741823,!1):Ea(t,e))}function Ia(){var t=0,e=null;if(null!==na)for(var n=na,r=ea;null!==r;){var i=r.expirationTime;if(0===i){if((null===n||null===na)&&a("244"),r===r.nextScheduledRoot){ea=na=r.nextScheduledRoot=null;break}if(r===ea)ea=i=r.nextScheduledRoot,na.nextScheduledRoot=i,r.nextScheduledRoot=null;else{if(r===na){(na=n).nextScheduledRoot=ea,r.nextScheduledRoot=null;break}n.nextScheduledRoot=r.nextScheduledRoot,r.nextScheduledRoot=null}r=n.nextScheduledRoot}else{if(i>t&&(t=i,e=r),r===na)break;if(1073741823===t)break;n=r,r=r.nextScheduledRoot}}aa=e,sa=t}var Na=!1;function ka(){return!!Na||!!o.unstable_shouldYield()&&(Na=!0)}function Da(){try{if(!ka()&&null!==ea){wa();var t=ea;do{var e=t.expirationTime;0!==e&&ma<=e&&(t.nextExpirationTimeToWorkOn=ma),t=t.nextScheduledRoot}while(t!==ea)}Aa(0,!0)}finally{Na=!1}}function Aa(t,e){if(Ia(),e)for(wa(),ga=ma;null!==aa&&0!==sa&&t<=sa&&!(Na&&ma>sa);)Ra(aa,sa,ma>sa),Ia(),wa(),ga=ma;else for(;null!==aa&&0!==sa&&t<=sa;)Ra(aa,sa,!1),Ia();if(e&&(ra=0,ia=null),0!==sa&&Ea(aa,sa),ba=0,_a=null,null!==da)for(t=da,da=null,e=0;e<t.length;e++){var n=t[e];try{n._onComplete()}catch(r){ca||(ca=!0,la=r)}}if(ca)throw t=la,la=null,ca=!1,t}function Oa(t,e){oa&&a("253"),aa=t,sa=e,Ra(t,e,!1),Aa(1073741823,!1)}function Ra(t,e,n){if(oa&&a("245"),oa=!0,n){var r=t.finishedWork;null!==r?Pa(t,r,e):(t.finishedWork=null,-1!==(r=t.timeoutHandle)&&(t.timeoutHandle=-1,br(r)),Go(t,n),null!==(r=t.finishedWork)&&(ka()?t.finishedWork=r:Pa(t,r,e)))}else null!==(r=t.finishedWork)?Pa(t,r,e):(t.finishedWork=null,-1!==(r=t.timeoutHandle)&&(t.timeoutHandle=-1,br(r)),Go(t,n),null!==(r=t.finishedWork)&&Pa(t,r,e));oa=!1}function Pa(t,e,n){var r=t.firstBatch;if(null!==r&&r._expirationTime>=n&&(null===da?da=[r]:da.push(r),r._defer))return t.finishedWork=e,void(t.expirationTime=0);t.finishedWork=null,t===_a?ba++:(_a=t,ba=0),Vo=Po=!0,t.current===e&&a("177"),0===(n=t.pendingCommitExpirationTime)&&a("261"),t.pendingCommitExpirationTime=0,r=e.expirationTime;var i=e.childExpirationTime;if(r=i>r?i:r,t.didError=!1,0===r?(t.earliestPendingTime=0,t.latestPendingTime=0,t.earliestSuspendedTime=0,t.latestSuspendedTime=0,t.latestPingedTime=0):(0!==(i=t.latestPendingTime)&&(i>r?t.earliestPendingTime=t.latestPendingTime=0:t.earliestPendingTime>r&&(t.earliestPendingTime=t.latestPendingTime)),0===(i=t.earliestSuspendedTime)?Xr(t,r):r<t.latestSuspendedTime?(t.earliestSuspendedTime=0,t.latestSuspendedTime=0,t.latestPingedTime=0,Xr(t,r)):r>i&&Xr(t,r)),Zr(0,t),Ao.current=null,1<e.effectTag?null!==e.lastEffect?(e.lastEffect.nextEffect=e,r=e.firstEffect):r=e:r=e.firstEffect,dr=Sn,Fn(i=Mn())){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else t:{var s=(o=(o=i.ownerDocument)&&o.defaultView||window).getSelection&&o.getSelection();if(s&&0!==s.rangeCount){o=s.anchorNode;var u=s.anchorOffset,c=s.focusNode;s=s.focusOffset;try{o.nodeType,c.nodeType}catch(M){o=null;break t}var l=0,h=-1,f=-1,p=0,d=0,y=i,m=null;e:for(;;){for(var g;y!==o||0!==u&&3!==y.nodeType||(h=l+u),y!==c||0!==s&&3!==y.nodeType||(f=l+s),3===y.nodeType&&(l+=y.nodeValue.length),null!==(g=y.firstChild);)m=y,y=g;for(;;){if(y===i)break e;if(m===o&&++p===u&&(h=l),m===c&&++d===s&&(f=l),null!==(g=y.nextSibling))break;m=(y=m).parentNode}y=g}o=-1===h||-1===f?null:{start:h,end:f}}else o=null}o=o||{start:0,end:0}}else o=null;for(yr={focusedElem:i,selectionRange:o},Sn=!1,jo=r;null!==jo;){i=!1,o=void 0;try{for(;null!==jo;){if(256&jo.effectTag)t:{var v=jo.alternate;switch((u=jo).tag){case 0:case 11:case 15:break t;case 1:if(256&u.effectTag&&null!==v){var b=v.memoizedProps,_=v.memoizedState,w=u.stateNode,E=w.getSnapshotBeforeUpdate(u.elementType===u.type?b:Ai(u.type,b),_);w.__reactInternalSnapshotBeforeUpdate=E}break t;case 3:case 5:case 6:case 4:case 17:break t;default:a("163")}}jo=jo.nextEffect}}catch(M){i=!0,o=M}i&&(null===jo&&a("178"),Yo(jo,o),null!==jo&&(jo=jo.nextEffect))}for(jo=r;null!==jo;){v=!1,b=void 0;try{for(;null!==jo;){var T=jo.effectTag;if(16&T&&ir(jo.stateNode,""),128&T){var S=jo.alternate;if(null!==S){var C=S.ref;null!==C&&("function"===typeof C?C(null):C.current=null)}}switch(14&T){case 2:To(jo),jo.effectTag&=-3;break;case 6:To(jo),jo.effectTag&=-3,Co(jo.alternate,jo);break;case 4:Co(jo.alternate,jo);break;case 8:So(_=jo),_.return=null,_.child=null,_.alternate&&(_.alternate.child=null,_.alternate.return=null)}jo=jo.nextEffect}}catch(M){v=!0,b=M}v&&(null===jo&&a("178"),Yo(jo,b),null!==jo&&(jo=jo.nextEffect))}if(C=yr,S=Mn(),T=C.focusedElem,b=C.selectionRange,S!==T&&T&&T.ownerDocument&&function t(e,n){return!(!e||!n)&&(e===n||(!e||3!==e.nodeType)&&(n&&3===n.nodeType?t(e,n.parentNode):"contains"in e?e.contains(n):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(n))))}(T.ownerDocument.documentElement,T)){null!==b&&Fn(T)&&(S=b.start,void 0===(C=b.end)&&(C=S),"selectionStart"in T?(T.selectionStart=S,T.selectionEnd=Math.min(C,T.value.length)):(C=(S=T.ownerDocument||document)&&S.defaultView||window).getSelection&&(C=C.getSelection(),_=T.textContent.length,v=Math.min(b.start,_),b=void 0===b.end?v:Math.min(b.end,_),!C.extend&&v>b&&(_=b,b=v,v=_),_=Ln(T,v),w=Ln(T,b),_&&w&&(1!==C.rangeCount||C.anchorNode!==_.node||C.anchorOffset!==_.offset||C.focusNode!==w.node||C.focusOffset!==w.offset)&&((S=S.createRange()).setStart(_.node,_.offset),C.removeAllRanges(),v>b?(C.addRange(S),C.extend(w.node,w.offset)):(S.setEnd(w.node,w.offset),C.addRange(S))))),S=[];for(C=T;C=C.parentNode;)1===C.nodeType&&S.push({element:C,left:C.scrollLeft,top:C.scrollTop});for("function"===typeof T.focus&&T.focus(),T=0;T<S.length;T++)(C=S[T]).element.scrollLeft=C.left,C.element.scrollTop=C.top}for(yr=null,Sn=!!dr,dr=null,t.current=e,jo=r;null!==jo;){r=!1,T=void 0;try{for(S=n;null!==jo;){var I=jo.effectTag;if(36&I){var N=jo.alternate;switch(v=S,(C=jo).tag){case 0:case 11:case 15:break;case 1:var k=C.stateNode;if(4&C.effectTag)if(null===N)k.componentDidMount();else{var D=C.elementType===C.type?N.memoizedProps:Ai(C.type,N.memoizedProps);k.componentDidUpdate(D,N.memoizedState,k.__reactInternalSnapshotBeforeUpdate)}var A=C.updateQueue;null!==A&&li(0,A,k);break;case 3:var O=C.updateQueue;if(null!==O){if(b=null,null!==C.child)switch(C.child.tag){case 5:b=C.child.stateNode;break;case 1:b=C.child.stateNode}li(0,O,b)}break;case 5:var R=C.stateNode;null===N&&4&C.effectTag&&mr(C.type,C.memoizedProps)&&R.focus();break;case 6:case 4:case 12:case 13:case 17:break;default:a("163")}}if(128&I){var P=jo.ref;if(null!==P){var x=jo.stateNode;switch(jo.tag){case 5:var L=x;break;default:L=x}"function"===typeof P?P(L):P.current=L}}jo=jo.nextEffect}}catch(M){r=!0,T=M}r&&(null===jo&&a("178"),Yo(jo,T),null!==jo&&(jo=jo.nextEffect))}Po=Vo=!1,"function"===typeof Ur&&Ur(e.stateNode),I=e.expirationTime,0===(e=(e=e.childExpirationTime)>I?e:I)&&(Wo=null),t.expirationTime=e,t.finishedWork=null}function xa(t){null===aa&&a("246"),aa.expirationTime=0,ca||(ca=!0,la=t)}function La(t,e){var n=ha;ha=!0;try{return t(e)}finally{(ha=n)||oa||Aa(1073741823,!1)}}function Ma(t,e){if(ha&&!fa){fa=!0;try{return t(e)}finally{fa=!1}}return t(e)}function Fa(t,e,n){if(pa)return t(e,n);ha||oa||0===ua||(Aa(ua,!1),ua=0);var r=pa,i=ha;ha=pa=!0;try{return t(e,n)}finally{pa=r,(ha=i)||oa||Aa(1073741823,!1)}}function Ua(t,e,n,r,i){var o=e.current;t:if(n){e:{2===en(n=n._reactInternalFiber)&&1===n.tag||a("170");var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Or(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(null!==s);a("171"),s=void 0}if(1===n.tag){var u=n.type;if(Or(u)){n=Lr(n,u,s);break t}}n=s}else n=Ir;return null===e.context?e.context=n:e.pendingContext=n,e=i,(i=ri(r)).payload={element:t},null!==(e=void 0===e?null:e)&&(i.callback=e),Qo(),oi(o,i),Zo(o,r),r}function ja(t,e,n,r){var i=e.current;return Ua(t,e,n,i=Xo(Sa(),i),r)}function Va(t){if(!(t=t.current).child)return null;switch(t.child.tag){case 5:default:return t.child.stateNode}}function Ba(t){var e=1073741822-25*(1+((1073741822-Sa()+500)/25|0));e>=Oo&&(e=Oo-1),this._expirationTime=Oo=e,this._root=t,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function qa(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function Wa(t,e,n){t={current:e=qr(3,null,null,e?3:0),containerInfo:t,pendingChildren:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:n,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null},this._internalRoot=e.stateNode=t}function Ka(t){return!(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType&&(8!==t.nodeType||" react-mount-point-unstable "!==t.nodeValue))}function Qa(t,e,n,r,i){Ka(n)||a("200");var o=n._reactRootContainer;if(o){if("function"===typeof i){var s=i;i=function(){var t=Va(o._internalRoot);s.call(t)}}null!=t?o.legacy_renderSubtreeIntoContainer(t,e,i):o.render(e,i)}else{if(o=n._reactRootContainer=function(t,e){if(e||(e=!(!(e=t?9===t.nodeType?t.documentElement:t.firstChild:null)||1!==e.nodeType||!e.hasAttribute("data-reactroot"))),!e)for(var n;n=t.lastChild;)t.removeChild(n);return new Wa(t,!1,e)}(n,r),"function"===typeof i){var u=i;i=function(){var t=Va(o._internalRoot);u.call(t)}}Ma(function(){null!=t?o.legacy_renderSubtreeIntoContainer(t,e,i):o.render(e,i)})}return Va(o._internalRoot)}function Ha(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return Ka(e)||a("200"),function(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Gt,key:null==r?null:""+r,children:t,containerInfo:e,implementation:n}}(t,e,null,n)}It=function(t,e,n){switch(e){case"input":if(Ee(t,n),e=n.name,"radio"===n.type&&null!=e){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=U(r);i||a("90"),Wt(r),Ee(r,i)}}}break;case"textarea":Xn(t,n);break;case"select":null!=(e=n.value)&&zn(t,!!n.multiple,e,!1)}},Ba.prototype.render=function(t){this._defer||a("250"),this._hasChildren=!0,this._children=t;var e=this._root._internalRoot,n=this._expirationTime,r=new qa;return Ua(t,e,null,n,r._onCommit),r},Ba.prototype.then=function(t){if(this._didComplete)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},Ba.prototype.commit=function(){var t=this._root._internalRoot,e=t.firstBatch;if(this._defer&&null!==e||a("251"),this._hasChildren){var n=this._expirationTime;if(e!==this){this._hasChildren&&(n=this._expirationTime=e._expirationTime,this.render(this._children));for(var r=null,i=e;i!==this;)r=i,i=i._next;null===r&&a("251"),r._next=i._next,this._next=e,t.firstBatch=this}this._defer=!1,Oa(t,n),e=this._next,this._next=null,null!==(e=t.firstBatch=e)&&e._hasChildren&&e.render(e._children)}else this._next=null,this._defer=!1},Ba.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++)(0,t[e])()}},qa.prototype.then=function(t){if(this._didCommit)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},qa.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++){var n=t[e];"function"!==typeof n&&a("191",n),n()}}},Wa.prototype.render=function(t,e){var n=this._internalRoot,r=new qa;return null!==(e=void 0===e?null:e)&&r.then(e),ja(t,n,null,r._onCommit),r},Wa.prototype.unmount=function(t){var e=this._internalRoot,n=new qa;return null!==(t=void 0===t?null:t)&&n.then(t),ja(null,e,null,n._onCommit),n},Wa.prototype.legacy_renderSubtreeIntoContainer=function(t,e,n){var r=this._internalRoot,i=new qa;return null!==(n=void 0===n?null:n)&&i.then(n),ja(e,r,t,i._onCommit),i},Wa.prototype.createBatch=function(){var t=new Ba(this),e=t._expirationTime,n=this._internalRoot,r=n.firstBatch;if(null===r)n.firstBatch=t,t._next=null;else{for(n=null;null!==r&&r._expirationTime>=e;)n=r,r=r._next;t._next=r,null!==n&&(n._next=t)}return t},Rt=La,Pt=Fa,xt=function(){oa||0===ua||(Aa(ua,!1),ua=0)};var za={createPortal:Ha,findDOMNode:function(t){if(null==t)return null;if(1===t.nodeType)return t;var e=t._reactInternalFiber;return void 0===e&&("function"===typeof t.render?a("188"):a("268",Object.keys(t))),t=null===(t=rn(e))?null:t.stateNode},hydrate:function(t,e,n){return Qa(null,t,e,!0,n)},render:function(t,e,n){return Qa(null,t,e,!1,n)},unstable_renderSubtreeIntoContainer:function(t,e,n,r){return(null==t||void 0===t._reactInternalFiber)&&a("38"),Qa(t,e,n,!1,r)},unmountComponentAtNode:function(t){return Ka(t)||a("40"),!!t._reactRootContainer&&(Ma(function(){Qa(null,null,t,!1,function(){t._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return Ha.apply(void 0,arguments)},unstable_batchedUpdates:La,unstable_interactiveUpdates:Fa,flushSync:function(t,e){oa&&a("187");var n=ha;ha=!0;try{return ta(t,e)}finally{ha=n,Aa(1073741823,!1)}},unstable_flushControlled:function(t){var e=ha;ha=!0;try{ta(t)}finally{(ha=e)||oa||Aa(1073741823,!1)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[M,F,U,D.injectEventPluginsByName,v,K,function(t){I(t,W)},At,Ot,kn,O]},unstable_createRoot:function(t,e){return Ka(t)||a("299","unstable_createRoot"),new Wa(t,!0,null!=e&&!0===e.hydrate)}};!function(t){var e=t.findFiberByHostInstance;(function(t){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var e=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e.isDisabled||!e.supportsFiber)return!0;try{var n=e.inject(t);Ur=Vr(function(t){return e.onCommitFiberRoot(n,t)}),jr=Vr(function(t){return e.onCommitFiberUnmount(n,t)})}catch(r){}})(i({},t,{findHostInstanceByFiber:function(t){return null===(t=rn(t))?null:t.stateNode},findFiberByHostInstance:function(t){return e?e(t):null}}))}({findFiberByHostInstance:L,bundleType:0,version:"16.6.3",rendererPackageName:"react-dom"});var Ga={default:za},Ya=Ga&&za||Ga;t.exports=Ya.default||Ya},function(t,e,n){"use strict";t.exports=n(37)},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n=null,r=!1,i=3,o=-1,a=-1,s=!1,u=!1;function c(){if(!s){var t=n.expirationTime;u?T():u=!0,E(f,t)}}function l(){var t=n,e=n.next;if(n===e)n=null;else{var r=n.previous;n=r.next=e,e.previous=r}t.next=t.previous=null,r=t.callback,e=t.expirationTime,t=t.priorityLevel;var o=i,s=a;i=t,a=e;try{var u=r()}finally{i=o,a=s}if("function"===typeof u)if(u={callback:u,priorityLevel:t,expirationTime:e,next:null,previous:null},null===n)n=u.next=u.previous=u;else{r=null,t=n;do{if(t.expirationTime>=e){r=t;break}t=t.next}while(t!==n);null===r?r=n:r===n&&(n=u,c()),(e=r.previous).next=r.previous=u,u.next=r,u.previous=e}}function h(){if(-1===o&&null!==n&&1===n.priorityLevel){s=!0;try{do{l()}while(null!==n&&1===n.priorityLevel)}finally{s=!1,null!==n?c():u=!1}}}function f(t){s=!0;var i=r;r=t;try{if(t)for(;null!==n;){var o=e.unstable_now();if(!(n.expirationTime<=o))break;do{l()}while(null!==n&&n.expirationTime<=o)}else if(null!==n)do{l()}while(null!==n&&!S())}finally{s=!1,r=i,null!==n?c():u=!1,h()}}var p,d,y=Date,m="function"===typeof setTimeout?setTimeout:void 0,g="function"===typeof clearTimeout?clearTimeout:void 0,v="function"===typeof requestAnimationFrame?requestAnimationFrame:void 0,b="function"===typeof cancelAnimationFrame?cancelAnimationFrame:void 0;function _(t){p=v(function(e){g(d),t(e)}),d=m(function(){b(p),t(e.unstable_now())},100)}if("object"===typeof performance&&"function"===typeof performance.now){var w=performance;e.unstable_now=function(){return w.now()}}else e.unstable_now=function(){return y.now()};var E,T,S,C=null;if("undefined"!==typeof window?C=window:"undefined"!==typeof t&&(C=t),C&&C._schedMock){var I=C._schedMock;E=I[0],T=I[1],S=I[2],e.unstable_now=I[3]}else if("undefined"===typeof window||"function"!==typeof MessageChannel){var N=null,k=function(t){if(null!==N)try{N(t)}finally{N=null}};E=function(t){null!==N?setTimeout(E,0,t):(N=t,setTimeout(k,0,!1))},T=function(){N=null},S=function(){return!1}}else{"undefined"!==typeof console&&("function"!==typeof v&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!==typeof b&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var D=null,A=!1,O=-1,R=!1,P=!1,x=0,L=33,M=33;S=function(){return x<=e.unstable_now()};var F=new MessageChannel,U=F.port2;F.port1.onmessage=function(){A=!1;var t=D,n=O;D=null,O=-1;var r=e.unstable_now(),i=!1;if(0>=x-r){if(!(-1!==n&&n<=r))return R||(R=!0,_(j)),D=t,void(O=n);i=!0}if(null!==t){P=!0;try{t(i)}finally{P=!1}}};var j=function t(e){if(null!==D){_(t);var n=e-x+M;n<M&&L<M?(8>n&&(n=8),M=n<L?L:n):L=n,x=e+M,A||(A=!0,U.postMessage(void 0))}else R=!1};E=function(t,e){D=t,O=e,P||0>e?U.postMessage(void 0):R||(R=!0,_(j))},T=function(){D=null,A=!1,O=-1}}e.unstable_ImmediatePriority=1,e.unstable_UserBlockingPriority=2,e.unstable_NormalPriority=3,e.unstable_IdlePriority=5,e.unstable_LowPriority=4,e.unstable_runWithPriority=function(t,n){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var r=i,a=o;i=t,o=e.unstable_now();try{return n()}finally{i=r,o=a,h()}},e.unstable_scheduleCallback=function(t,r){var a=-1!==o?o:e.unstable_now();if("object"===typeof r&&null!==r&&"number"===typeof r.timeout)r=a+r.timeout;else switch(i){case 1:r=a+-1;break;case 2:r=a+250;break;case 5:r=a+1073741823;break;case 4:r=a+1e4;break;default:r=a+5e3}if(t={callback:t,priorityLevel:i,expirationTime:r,next:null,previous:null},null===n)n=t.next=t.previous=t,c();else{a=null;var s=n;do{if(s.expirationTime>r){a=s;break}s=s.next}while(s!==n);null===a?a=n:a===n&&(n=t,c()),(r=a.previous).next=a.previous=t,t.next=a,t.previous=r}return t},e.unstable_cancelCallback=function(t){var e=t.next;if(null!==e){if(e===t)n=null;else{t===n&&(n=e);var r=t.previous;r.next=e,e.previous=r}t.next=t.previous=null}},e.unstable_wrapCallback=function(t){var n=i;return function(){var r=i,a=o;i=n,o=e.unstable_now();try{return t.apply(this,arguments)}finally{i=r,o=a,h()}}},e.unstable_getCurrentPriorityLevel=function(){return i},e.unstable_shouldYield=function(){return!r&&(null!==n&&n.expirationTime<a||S())}}).call(this,n(14))},function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;!function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}e.default=t}(n(3));var r=s(n(41)),i=s(n(44)),o=s(n(0)),a=s(n(24));n(26);function s(t){return t&&t.__esModule?t:{default:t}}function u(){return(u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var c=function(t,e){return t&&e&&e.split(" ").forEach(function(e){return(0,r.default)(t,e)})},l=function(t,e){return t&&e&&e.split(" ").forEach(function(e){return(0,i.default)(t,e)})},h=function(t){var e,n;function r(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=t.call.apply(t,[this].concat(r))||this).onEnter=function(t,n){var r=e.getClassNames(n?"appear":"enter").className;e.removeClasses(t,"exit"),c(t,r),e.props.onEnter&&e.props.onEnter(t)},e.onEntering=function(t,n){var r=e.getClassNames(n?"appear":"enter").activeClassName;e.reflowAndAddClass(t,r),e.props.onEntering&&e.props.onEntering(t)},e.onEntered=function(t,n){var r=e.getClassNames("enter").doneClassName;e.removeClasses(t,n?"appear":"enter"),c(t,r),e.props.onEntered&&e.props.onEntered(t)},e.onExit=function(t){var n=e.getClassNames("exit").className;e.removeClasses(t,"appear"),e.removeClasses(t,"enter"),c(t,n),e.props.onExit&&e.props.onExit(t)},e.onExiting=function(t){var n=e.getClassNames("exit").activeClassName;e.reflowAndAddClass(t,n),e.props.onExiting&&e.props.onExiting(t)},e.onExited=function(t){var n=e.getClassNames("exit").doneClassName;e.removeClasses(t,"exit"),c(t,n),e.props.onExited&&e.props.onExited(t)},e.getClassNames=function(t){var n=e.props.classNames,r="string"!==typeof n?n[t]:n+"-"+t;return{className:r,activeClassName:"string"!==typeof n?n[t+"Active"]:r+"-active",doneClassName:"string"!==typeof n?n[t+"Done"]:r+"-done"}},e}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var i=r.prototype;return i.removeClasses=function(t,e){var n=this.getClassNames(e),r=n.className,i=n.activeClassName,o=n.doneClassName;r&&l(t,r),i&&l(t,i),o&&l(t,o)},i.reflowAndAddClass=function(t,e){e&&(t&&t.scrollTop,c(t,e))},i.render=function(){var t=u({},this.props);return delete t.classNames,o.default.createElement(a.default,u({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},r}(o.default.Component);h.propTypes={};var f=h;e.default=f,t.exports=e.default},function(t,e,n){"use strict";var r=n(40);function i(){}t.exports=function(){function t(t,e,n,i,o,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e};return n.checkPropTypes=i,n.PropTypes=n,n}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){"use strict";var r=n(42);e.__esModule=!0,e.default=function(t,e){t.classList?t.classList.add(e):(0,i.default)(t,e)||("string"===typeof t.className?t.className=t.className+" "+e:t.setAttribute("class",(t.className&&t.className.baseVal||"")+" "+e))};var i=r(n(43));t.exports=e.default},function(t,e){t.exports=function(t){return t&&t.__esModule?t:{default:t}}},function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){return t.classList?!!e&&t.classList.contains(e):-1!==(" "+(t.className.baseVal||t.className)+" ").indexOf(" "+e+" ")},t.exports=e.default},function(t,e,n){"use strict";function r(t,e){return t.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}t.exports=function(t,e){t.classList?t.classList.remove(e):"string"===typeof t.className?t.className=r(t.className,e):t.setAttribute("class",r(t.className&&t.className.baseVal||"",e))}},function(t,e,n){"use strict";e.__esModule=!0,e.default=void 0;a(n(3));var r=a(n(0)),i=n(19),o=a(n(27));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(t){var e,n;function a(){for(var e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=t.call.apply(t,[this].concat(r))||this).handleEnter=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onEnter",0,n)},e.handleEntering=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onEntering",0,n)},e.handleEntered=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onEntered",0,n)},e.handleExit=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onExit",1,n)},e.handleExiting=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onExiting",1,n)},e.handleExited=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onExited",1,n)},e}n=t,(e=a).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n;var s=a.prototype;return s.handleLifecycle=function(t,e,n){var o,a=this.props.children,s=r.default.Children.toArray(a)[e];s.props[t]&&(o=s.props)[t].apply(o,n),this.props[t]&&this.props[t]((0,i.findDOMNode)(this))},s.render=function(){var t=this.props,e=t.children,n=t.in,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,["children","in"]),a=r.default.Children.toArray(e),s=a[0],u=a[1];return delete i.onEnter,delete i.onEntering,delete i.onEntered,delete i.onExit,delete i.onExiting,delete i.onExited,r.default.createElement(o.default,i,n?r.default.cloneElement(s,{key:"first",onEnter:this.handleEnter,onEntering:this.handleEntering,onEntered:this.handleEntered}):r.default.cloneElement(u,{key:"second",onEnter:this.handleExit,onEntering:this.handleExiting,onEntered:this.handleExited}))},a}(r.default.Component);s.propTypes={};var u=s;e.default=u,t.exports=e.default},function(t,e,n){"use strict";e.__esModule=!0,e.getChildMapping=i,e.mergeChildMappings=o,e.getInitialChildMapping=function(t,e){return i(t.children,function(n){return(0,r.cloneElement)(n,{onExited:e.bind(null,n),in:!0,appear:a(n,"appear",t),enter:a(n,"enter",t),exit:a(n,"exit",t)})})},e.getNextChildMapping=function(t,e,n){var s=i(t.children),u=o(e,s);return Object.keys(u).forEach(function(i){var o=u[i];if((0,r.isValidElement)(o)){var c=i in e,l=i in s,h=e[i],f=(0,r.isValidElement)(h)&&!h.props.in;!l||c&&!f?l||!c||f?l&&c&&(0,r.isValidElement)(h)&&(u[i]=(0,r.cloneElement)(o,{onExited:n.bind(null,o),in:h.props.in,exit:a(o,"exit",t),enter:a(o,"enter",t)})):u[i]=(0,r.cloneElement)(o,{in:!1}):u[i]=(0,r.cloneElement)(o,{onExited:n.bind(null,o),in:!0,exit:a(o,"exit",t),enter:a(o,"enter",t)})}}),u};var r=n(0);function i(t,e){var n=Object.create(null);return t&&r.Children.map(t,function(t){return t}).forEach(function(t){n[t.key]=function(t){return e&&(0,r.isValidElement)(t)?e(t):t}(t)}),n}function o(t,e){function n(n){return n in e?e[n]:t[n]}t=t||{},e=e||{};var r,i=Object.create(null),o=[];for(var a in t)a in e?o.length&&(i[a]=o,o=[]):o.push(a);var s={};for(var u in e){if(i[u])for(r=0;r<i[u].length;r++){var c=i[u][r];s[i[u][r]]=n(c)}s[u]=n(u)}for(r=0;r<o.length;r++)s[o[r]]=n(o[r]);return s}function a(t,e,n){return null!=n[e]?n[e]:t.props[e]}},function(t,e,n){var r=function(){return this||"object"===typeof self&&self}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(48),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(a){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";var n,r=Object.prototype,i=r.hasOwnProperty,o="function"===typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag",c="object"===typeof t,l=e.regeneratorRuntime;if(l)c&&(t.exports=l);else{(l=e.regeneratorRuntime=c?t.exports:{}).wrap=_;var h="suspendedStart",f="suspendedYield",p="executing",d="completed",y={},m={};m[a]=function(){return this};var g=Object.getPrototypeOf,v=g&&g(g(O([])));v&&v!==r&&i.call(v,a)&&(m=v);var b=S.prototype=E.prototype=Object.create(m);T.prototype=b.constructor=S,S.constructor=T,S[u]=T.displayName="GeneratorFunction",l.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===T||"GeneratorFunction"===(e.displayName||e.name))},l.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,u in t||(t[u]="GeneratorFunction")),t.prototype=Object.create(b),t},l.awrap=function(t){return{__await:t}},C(I.prototype),I.prototype[s]=function(){return this},l.AsyncIterator=I,l.async=function(t,e,n,r){var i=new I(_(t,e,n,r));return l.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},C(b),b[u]="Generator",b[a]=function(){return this},b.toString=function(){return"[object Generator]"},l.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},l.values=O,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(D),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return s.type="throw",s.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),D(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;D(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),y}}}function _(t,e,n,r){var i=e&&e.prototype instanceof E?e:E,o=Object.create(i.prototype),a=new A(r||[]);return o._invoke=function(t,e,n){var r=h;return function(i,o){if(r===p)throw new Error("Generator is already running");if(r===d){if("throw"===i)throw o;return R()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=N(a,n);if(s){if(s===y)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var u=w(t,e,n);if("normal"===u.type){if(r=n.done?d:f,u.arg===y)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=d,n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function w(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(r){return{type:"throw",arg:r}}}function E(){}function T(){}function S(){}function C(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function I(t){var e;this._invoke=function(n,r){function o(){return new Promise(function(e,o){!function e(n,r,o,a){var s=w(t[n],t,r);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"===typeof c&&i.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,o,a)},function(t){e("throw",t,o,a)}):Promise.resolve(c).then(function(t){u.value=t,o(u)},function(t){return e("throw",t,o,a)})}a(s.arg)}(n,r,e,o)})}return e=e?e.then(o,o):o()}}function N(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,N(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=w(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,y;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,y):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function O(t){if(t){var e=t[a];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=n,e.done=!0,e};return o.next=o}}return{next:R}}function R(){return{value:n,done:!0}}}(function(){return this||"object"===typeof self&&self}()||Function("return this")())},function(t,e,n){(function(t){var r="undefined"!==typeof t&&t||"undefined"!==typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(50),e.setImmediate="undefined"!==typeof self&&self.setImmediate||"undefined"!==typeof t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!==typeof self&&self.clearImmediate||"undefined"!==typeof t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(14))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i=1,o={},a=!1,s=t.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(t);u=u&&u.setTimeout?u:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick(function(){l(t)})}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"===typeof n.data&&0===n.data.indexOf(e)&&l(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),r=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){l(t.data)},r=function(e){t.port2.postMessage(e)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var t=s.documentElement;r=function(e){var n=s.createElement("script");n.onreadystatechange=function(){l(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():r=function(t){setTimeout(l,0,t)},u.setImmediate=function(t){"function"!==typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var a={callback:t,args:e};return o[i]=a,r(i),i++},u.clearImmediate=c}function c(t){delete o[t]}function l(t){if(a)setTimeout(l,0,t);else{var e=o[t];if(e){a=!0;try{!function(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}(e)}finally{c(t),a=!1}}}}}("undefined"===typeof self?"undefined"===typeof t?this:t:self)}).call(this,n(14),n(29))},function(t,e){!function(t){"use strict";if(!t.fetch){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=function(t){return t&&DataView.prototype.isPrototypeOf(t)},i=ArrayBuffer.isView||function(t){return t&&n.indexOf(Object.prototype.toString.call(t))>-1};l.prototype.append=function(t,e){t=s(t),e=u(e);var n=this.map[t];this.map[t]=n?n+","+e:e},l.prototype.delete=function(t){delete this.map[s(t)]},l.prototype.get=function(t){return t=s(t),this.has(t)?this.map[t]:null},l.prototype.has=function(t){return this.map.hasOwnProperty(s(t))},l.prototype.set=function(t,e){this.map[s(t)]=u(e)},l.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},l.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),c(t)},l.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),c(t)},l.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),c(t)},e.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var o=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},y.call(m.prototype),y.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var a=[301,302,303,307,308];b.redirect=function(t,e){if(-1===a.indexOf(e))throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},t.Headers=l,t.Request=m,t.Response=b,t.fetch=function(t,n){return new Promise(function(r,i){var o=new m(t,n),a=new XMLHttpRequest;a.onload=function(){var t={status:a.status,statusText:a.statusText,headers:v(a.getAllResponseHeaders()||"")};t.url="responseURL"in a?a.responseURL:t.headers.get("X-Request-URL");var e="response"in a?a.response:a.responseText;r(new b(e,t))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&e.blob&&(a.responseType="blob"),o.headers.forEach(function(t,e){a.setRequestHeader(e,t)}),a.send("undefined"===typeof o._bodyInit?null:o._bodyInit)})},t.fetch.polyfill=!0}function s(t){if("string"!==typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function u(t){return"string"!==typeof t&&(t=String(t)),t}function c(t){var n={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return e.iterable&&(n[Symbol.iterator]=function(){return n}),n}function l(t){this.map={},t instanceof l?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function p(t){var e=new FileReader,n=f(e);return e.readAsArrayBuffer(t),n}function d(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"===typeof t)this._bodyText=t;else if(e.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(e.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(e.arrayBuffer&&e.blob&&r(t))this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!i(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=d(t)}else this._bodyText="";this.headers.get("content-type")||("string"===typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return function(t){var e=new FileReader,n=f(e);return e.readAsText(t),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}function m(t,e){var n=(e=e||{}).body;if(t instanceof m){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new l(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new l(e.headers)),this.method=function(t){var e=t.toUpperCase();return o.indexOf(e)>-1?e:t}(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function g(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}}),e}function v(t){var e=new l;return t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}}),e}function b(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new l(e.headers),this.url=e.url||"",this._initBody(t)}}("undefined"!==typeof self?self:this)},function(t,e,n){"use strict";n.r(e),function(t){var e=n(2),r=n.n(e);(function(){var t,e=e||{},n=this;function i(t){return"string"==typeof t}function o(t){return"boolean"==typeof t}function a(){}function s(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&&"undefined"!=typeof t.splice&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||"undefined"!=typeof t.call&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&"undefined"==typeof t.call)return"object";return e}function u(t){return null===t}function c(t){return"array"==s(t)}function l(t){var e=s(t);return"array"==e||"object"==e&&"number"==typeof t.length}function h(t){return"function"==s(t)}function f(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var p="closure_uid_"+(1e9*Math.random()>>>0),d=0;function y(t,e,n){return t.call.apply(t.bind,arguments)}function m(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function g(t,e,n){return(g=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?y:m).apply(null,arguments)}function v(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}var b=Date.now||function(){return+new Date};function _(t,e){function n(){}n.prototype=e.prototype,t.ob=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.ed=function(t,n,r){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.prototype[n].apply(t,i)}}function w(t){t.prototype.then=t.prototype.then,t.prototype.$goog_Thenable=!0}function E(t){if(!t)return!1;try{return!!t.$goog_Thenable}catch(e){return!1}}function T(t){if(Error.captureStackTrace)Error.captureStackTrace(this,T);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))}function S(t,e){for(var n="",r=(t=t.split("%s")).length-1,i=0;i<r;i++)n+=t[i]+(i<e.length?e[i]:"%s");T.call(this,n+t[r])}function C(t,e){throw new S("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function I(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function N(t,e){t.f(e),100>t.b&&(t.b++,e.next=t.a,t.a=e)}function k(){this.b=this.a=null}_(T,Error),T.prototype.name="CustomError",_(S,T),S.prototype.name="AssertionError",I.prototype.get=function(){if(0<this.b){this.b--;var t=this.a;this.a=t.next,t.next=null}else t=this.c();return t};var D=new I(function(){return new O},function(t){t.reset()});function A(){var t=pt,e=null;return t.a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e}function O(){this.next=this.b=this.a=null}k.prototype.add=function(t,e){var n=D.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},O.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},O.prototype.reset=function(){this.next=this.b=this.a=null};var R=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(i(t))return i(e)&&1==e.length?t.indexOf(e,0):-1;for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},P=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,o=i(t)?t.split(""):t,a=0;a<r;a++)a in o&&e.call(n,o[a],a,t)};var x=Array.prototype.map?function(t,e){return Array.prototype.map.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=Array(n),o=i(t)?t.split(""):t,a=0;a<n;a++)a in o&&(r[a]=e.call(void 0,o[a],a,t));return r},L=Array.prototype.some?function(t,e){return Array.prototype.some.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=i(t)?t.split(""):t,o=0;o<n;o++)if(o in r&&e.call(void 0,r[o],o,t))return!0;return!1};function M(t,e){return 0<=R(t,e)}function F(t,e){var n;return(n=0<=(e=R(t,e)))&&Array.prototype.splice.call(t,e,1),n}function U(t,e){!function(t,e){var n=t.length,r=i(t)?t.split(""):t;for(--n;0<=n;--n)n in r&&e.call(void 0,r[n],n,t)}(t,function(n,r){e.call(void 0,n,r,t)&&1==Array.prototype.splice.call(t,r,1).length&&0})}function j(t){return Array.prototype.concat.apply([],arguments)}function V(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function B(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1<n.length;)r+=n.shift()+i.shift();return r+n.join("%s")}var q=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function W(t){return J.test(t)?(-1!=t.indexOf("&")&&(t=t.replace(Q,"&amp;")),-1!=t.indexOf("<")&&(t=t.replace(H,"&lt;")),-1!=t.indexOf(">")&&(t=t.replace(z,"&gt;")),-1!=t.indexOf('"')&&(t=t.replace(G,"&quot;")),-1!=t.indexOf("'")&&(t=t.replace(Y,"&#39;")),-1!=t.indexOf("\0")&&(t=t.replace(X,"&#0;")),t):t}var K,Q=/&/g,H=/</g,z=/>/g,G=/"/g,Y=/'/g,X=/\x00/g,J=/[\x00&<>"']/;function $(t,e){return-1!=t.indexOf(e)}function Z(t,e){return t<e?-1:t>e?1:0}t:{var tt=n.navigator;if(tt){var et=tt.userAgent;if(et){K=et;break t}}K=""}function nt(t){return $(K,t)}function rt(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function it(t){for(var e in t)return!1;return!0}function ot(t){var e,n={};for(e in t)n[e]=t[e];return n}var at,st,ut="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function ct(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var o=0;o<ut.length;o++)n=ut[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function lt(t){n.setTimeout(function(){throw t},0)}function ht(t,e){st||function(){if(n.Promise&&n.Promise.resolve){var t=n.Promise.resolve(void 0);st=function(){t.then(dt)}}else st=function(){var t=dt;!h(n.setImmediate)||n.Window&&n.Window.prototype&&!nt("Edge")&&n.Window.prototype.setImmediate==n.setImmediate?(at||(at=function(){var t=n.MessageChannel;if("undefined"===typeof t&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!nt("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",t.src="",document.documentElement.appendChild(t);var e=t.contentWindow;t=e.document,t.open(),t.write(""),t.close();var n="callImmediate"+Math.random(),r="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=g(function(t){"*"!=r&&t.origin!=r||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,r)}}}),"undefined"!==typeof t&&!nt("Trident")&&!nt("MSIE")){var e=new t,r={},i=r;return e.port1.onmessage=function(){if(void 0!==r.next){var t=(r=r.next).wb;r.wb=null,t()}},function(t){i.next={wb:t},i=i.next,e.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){n.setTimeout(t,0)}}()),at(t)):n.setImmediate(t)}}(),ft||(st(),ft=!0),pt.add(t,e)}var ft=!1,pt=new k;function dt(){for(var t;t=A();){try{t.a.call(t.b)}catch(e){lt(e)}N(D,t)}ft=!1}function yt(t,e){if(this.a=mt,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=a)try{var n=this;t.call(e,function(t){kt(n,gt,t)},function(t){if(!(t instanceof Lt))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(e){}kt(n,vt,t)})}catch(r){kt(this,vt,r)}}var mt=0,gt=2,vt=3;function bt(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}bt.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var _t=new I(function(){return new bt},function(t){t.reset()});function wt(t,e,n){var r=_t.get();return r.g=t,r.b=e,r.f=n,r}function Et(t){if(t instanceof yt)return t;var e=new yt(a);return kt(e,gt,t),e}function Tt(t){return new yt(function(e,n){n(t)})}function St(t,e,n){Dt(t,e,n,null)||ht(v(e,t))}function Ct(t){return new yt(function(e){var n=t.length,r=[];if(n)for(var i=function(t,i,o){n--,r[t]=i?{Db:!0,value:o}:{Db:!1,reason:o},0==n&&e(r)},o=0;o<t.length;o++)St(t[o],v(i,o,!0),v(i,o,!1));else e(r)})}function It(t,e){t.b||t.a!=gt&&t.a!=vt||At(t),t.f?t.f.next=e:t.b=e,t.f=e}function Nt(t,e,n,r){var i=wt(null,null,null);return i.a=new yt(function(t,o){i.g=e?function(n){try{var i=e.call(r,n);t(i)}catch(a){o(a)}}:t,i.b=n?function(e){try{var i=n.call(r,e);void 0===i&&e instanceof Lt?o(e):t(i)}catch(a){o(a)}}:o}),i.a.c=t,It(t,i),i.a}function kt(t,e,n){t.a==mt&&(t===n&&(e=vt,n=new TypeError("Promise cannot resolve to itself")),t.a=1,Dt(n,t.Nc,t.Oc,t)||(t.i=n,t.a=e,t.c=null,At(t),e!=vt||n instanceof Lt||function(t,e){t.g=!0,ht(function(){t.g&&xt.call(null,e)})}(t,n)))}function Dt(t,e,n,r){if(t instanceof yt)return It(t,wt(e||a,n||null,r)),!0;if(E(t))return t.then(e,n,r),!0;if(f(t))try{var i=t.then;if(h(i))return function(t,e,n,r,i){function o(t){a||(a=!0,r.call(i,t))}var a=!1;try{e.call(t,function(t){a||(a=!0,n.call(i,t))},o)}catch(s){o(s)}}(t,i,e,n,r),!0}catch(o){return n.call(r,o),!0}return!1}function At(t){t.h||(t.h=!0,ht(t.Yb,t))}function Ot(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function Rt(t,e,n,r){if(n==vt&&e.b&&!e.c)for(;t&&t.g;t=t.c)t.g=!1;if(e.a)e.a.c=null,Pt(e,n,r);else try{e.c?e.g.call(e.f):Pt(e,n,r)}catch(i){xt.call(null,i)}N(_t,e)}function Pt(t,e,n){e==gt?t.g.call(t.f,n):t.b&&t.b.call(t.f,n)}yt.prototype.then=function(t,e,n){return Nt(this,h(t)?t:null,h(e)?e:null,n)},w(yt),(t=yt.prototype).ia=function(t,e){return(t=wt(t,t,e)).c=!0,It(this,t),this},t.s=function(t,e){return Nt(this,null,t,e)},t.cancel=function(t){this.a==mt&&ht(function(){!function t(e,n){if(e.a==mt)if(e.c){var r=e.c;if(r.b){for(var i=0,o=null,a=null,s=r.b;s&&(s.c||(i++,s.a==e&&(o=s),!(o&&1<i)));s=s.next)o||(a=s);o&&(r.a==mt&&1==i?t(r,n):(a?((i=a).next==r.f&&(r.f=i),i.next=i.next.next):Ot(r),Rt(r,o,vt,n)))}e.c=null}else kt(e,vt,n)}(this,new Lt(t))},this)},t.Nc=function(t){this.a=mt,kt(this,gt,t)},t.Oc=function(t){this.a=mt,kt(this,vt,t)},t.Yb=function(){for(var t;t=Ot(this);)Rt(this,t,this.a,this.i);this.h=!1};var xt=lt;function Lt(t){T.call(this,t)}function Mt(){0!=Ft&&(Ut[this[p]||(this[p]=++d)]=this),this.qa=this.qa,this.ja=this.ja}_(Lt,T),Lt.prototype.name="cancel";var Ft=0,Ut={};function jt(t){if(!t.qa&&(t.qa=!0,t.va(),0!=Ft)){var e=t[p]||(t[p]=++d);if(0!=Ft&&t.ja&&0<t.ja.length)throw Error(t+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete Ut[e]}}function Vt(t){return Vt[" "](t),t}Mt.prototype.qa=!1,Mt.prototype.va=function(){if(this.ja)for(;this.ja.length;)this.ja.shift()()},Vt[" "]=a;var Bt,qt=nt("Opera"),Wt=nt("Trident")||nt("MSIE"),Kt=nt("Edge"),Qt=Kt||Wt,Ht=nt("Gecko")&&!($(K.toLowerCase(),"webkit")&&!nt("Edge"))&&!(nt("Trident")||nt("MSIE"))&&!nt("Edge"),zt=$(K.toLowerCase(),"webkit")&&!nt("Edge");function Gt(){var t=n.document;return t?t.documentMode:void 0}t:{var Yt="",Xt=function(){var t=K;return Ht?/rv:([^\);]+)(\)|;)/.exec(t):Kt?/Edge\/([\d\.]+)/.exec(t):Wt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):zt?/WebKit\/(\S+)/.exec(t):qt?/(?:Version)[ \/]?(\S+)/.exec(t):void 0}();if(Xt&&(Yt=Xt?Xt[1]:""),Wt){var Jt=Gt();if(null!=Jt&&Jt>parseFloat(Yt)){Bt=String(Jt);break t}}Bt=Yt}var $t,Zt={};function te(t){return function(t,e){var n=Zt;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,function(){for(var e=0,n=q(String(Bt)).split("."),r=q(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o<i;o++){var a=n[o]||"",s=r[o]||"";do{if(a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==a[0].length&&0==s[0].length)break;e=Z(0==a[1].length?0:parseInt(a[1],10),0==s[1].length?0:parseInt(s[1],10))||Z(0==a[2].length,0==s[2].length)||Z(a[2],s[2]),a=a[3],s=s[3]}while(0==e)}return 0<=e})}var ee=n.document;$t=ee&&Wt?Gt()||("CSS1Compat"==ee.compatMode?parseInt(Bt,10):5):void 0;var ne=Object.freeze||function(t){return t},re=!Wt||9<=Number($t),ie=Wt&&!te("9"),oe=function(){if(!n.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});return n.addEventListener("test",a,e),n.removeEventListener("test",a,e),t}();function ae(t,e){this.type=t,this.b=this.target=e,this.Kb=!0}function se(t,e){if(ae.call(this,t?t.type:""),this.relatedTarget=this.b=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.a=null,t){var n=this.type=t.type,r=t.changedTouches?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.b=e,e=t.relatedTarget){if(Ht){t:{try{Vt(e.nodeName);var o=!0;break t}catch(a){}o=!1}o||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,null===r?(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0):(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=i(t.pointerType)?t.pointerType:ue[t.pointerType]||"",this.a=t,t.defaultPrevented&&this.preventDefault()}}ae.prototype.preventDefault=function(){this.Kb=!1},_(se,ae);var ue=ne({2:"touch",3:"pen",4:"mouse"});se.prototype.preventDefault=function(){se.ob.preventDefault.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,ie)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(e){}},se.prototype.f=function(){return this.a};var ce="closure_listenable_"+(1e6*Math.random()|0),le=0;function he(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.La=i,this.key=++le,this.oa=this.Ia=!1}function fe(t){t.oa=!0,t.listener=null,t.proxy=null,t.src=null,t.La=null}function pe(t){this.src=t,this.a={},this.b=0}function de(t,e){var n=e.type;n in t.a&&F(t.a[n],e)&&(fe(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function ye(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.oa&&o.listener==e&&o.capture==!!n&&o.La==r)return i}return-1}pe.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var a=ye(t,e,r,i);return-1<a?(e=t[a],n||(e.Ia=!1)):((e=new he(e,this.src,o,!!r,i)).Ia=n,t.push(e)),e};var me="closure_lm_"+(1e6*Math.random()|0),ge={};function ve(t,e,n,r,i){if(r&&r.once)_e(t,e,n,r,i);else if(c(e))for(var o=0;o<e.length;o++)ve(t,e[o],n,r,i);else n=De(n),t&&t[ce]?Oe(t,e,n,f(r)?!!r.capture:!!r,i):be(t,e,n,!1,r,i)}function be(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var a=f(i)?!!i.capture:!!i,s=Ne(t);if(s||(t[me]=s=new pe(t)),!(n=s.add(e,n,r,a,o)).proxy){if(r=function(){var t=Ie,e=re?function(n){return t.call(e.src,e.listener,n)}:function(n){if(!(n=t.call(e.src,e.listener,n)))return n};return e}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)oe||(i=a),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Te(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}0}}function _e(t,e,n,r,i){if(c(e))for(var o=0;o<e.length;o++)_e(t,e[o],n,r,i);else n=De(n),t&&t[ce]?Re(t,e,n,f(r)?!!r.capture:!!r,i):be(t,e,n,!0,r,i)}function we(t,e,n,r,i){if(c(e))for(var o=0;o<e.length;o++)we(t,e[o],n,r,i);else r=f(r)?!!r.capture:!!r,n=De(n),t&&t[ce]?(t=t.l,(e=String(e).toString())in t.a&&(-1<(n=ye(o=t.a[e],n,r,i))&&(fe(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--)))):t&&(t=Ne(t))&&(e=t.a[e.toString()],t=-1,e&&(t=ye(e,n,r,i)),(n=-1<t?e[t]:null)&&Ee(n))}function Ee(t){if("number"!=typeof t&&t&&!t.oa){var e=t.src;if(e&&e[ce])de(e.l,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Te(n),r):e.addListener&&e.removeListener&&e.removeListener(r),0,(n=Ne(e))?(de(n,t),0==n.b&&(n.src=null,e[me]=null)):fe(t)}}}function Te(t){return t in ge?ge[t]:ge[t]="on"+t}function Se(t,e,n,r){var i=!0;if((t=Ne(t))&&(e=t.a[e.toString()]))for(e=e.concat(),t=0;t<e.length;t++){var o=e[t];o&&o.capture==n&&!o.oa&&(o=Ce(o,r),i=i&&!1!==o)}return i}function Ce(t,e){var n=t.listener,r=t.La||t.src;return t.Ia&&Ee(t),n.call(r,e)}function Ie(t,e){if(t.oa)return!0;if(!re){if(!e)t:{e=["window","event"];for(var r=n,i=0;i<e.length;i++)if(null==(r=r[e[i]])){e=null;break t}e=r}if(e=new se(i=e,this),r=!0,!(0>i.keyCode||void 0!=i.returnValue)){t:{var o=!1;if(0==i.keyCode)try{i.keyCode=-1;break t}catch(s){o=!0}(o||void 0==i.returnValue)&&(i.returnValue=!0)}for(i=[],o=e.b;o;o=o.parentNode)i.push(o);for(t=t.type,o=i.length-1;0<=o;o--){e.b=i[o];var a=Se(i[o],t,!0,e);r=r&&a}for(o=0;o<i.length;o++)e.b=i[o],a=Se(i[o],t,!1,e),r=r&&a}return r}return Ce(t,new se(e,this))}function Ne(t){return(t=t[me])instanceof pe?t:null}var ke="__closure_events_fn_"+(1e9*Math.random()>>>0);function De(t){return h(t)?t:(t[ke]||(t[ke]=function(e){return t.handleEvent(e)}),t[ke])}function Ae(){Mt.call(this),this.l=new pe(this),this.Rb=this,this.Va=null}function Oe(t,e,n,r,i){t.l.add(String(e),n,!1,r,i)}function Re(t,e,n,r,i){t.l.add(String(e),n,!0,r,i)}function Pe(t,e,n,r){if(!(e=t.l.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var a=e[o];if(a&&!a.oa&&a.capture==n){var s=a.listener,u=a.La||a.src;a.Ia&&de(t.l,a),i=!1!==s.call(u,r)&&i}}return i&&0!=r.Kb}function xe(t,e,r){if(h(t))r&&(t=g(t,r));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=g(t.handleEvent,t)}return 2147483647<Number(e)?-1:n.setTimeout(t,e||0)}function Le(t){var e=null;return new yt(function(n,r){-1==(e=xe(function(){n(void 0)},t))&&r(Error("Failed to schedule timer."))}).s(function(t){throw n.clearTimeout(e),t})}function Me(t){if(t.S&&"function"==typeof t.S)return t.S();if(i(t))return t.split("");if(l(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}function Fe(t){if(t.U&&"function"==typeof t.U)return t.U();if(!t.S||"function"!=typeof t.S){if(l(t)||i(t)){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}function Ue(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof Ue)for(n=t.U(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function je(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Ve(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)Ve(i,r=t.a[e])||(t.a[n++]=r,i[r]=1),e++;t.a.length=n}}function Ve(t,e){return Object.prototype.hasOwnProperty.call(t,e)}_(Ae,Mt),Ae.prototype[ce]=!0,Ae.prototype.addEventListener=function(t,e,n,r){ve(this,t,e,n,r)},Ae.prototype.removeEventListener=function(t,e,n,r){we(this,t,e,n,r)},Ae.prototype.dispatchEvent=function(t){var e,n=this.Va;if(n)for(e=[];n;n=n.Va)e.push(n);n=this.Rb;var r=t.type||t;if(i(t))t=new ae(t,n);else if(t instanceof ae)t.target=t.target||n;else{var o=t;ct(t=new ae(r,n),o)}if(o=!0,e)for(var a=e.length-1;0<=a;a--){var s=t.b=e[a];o=Pe(s,r,!0,t)&&o}if(o=Pe(s=t.b=n,r,!0,t)&&o,o=Pe(s,r,!1,t)&&o,e)for(a=0;a<e.length;a++)o=Pe(s=t.b=e[a],r,!1,t)&&o;return o},Ae.prototype.va=function(){if(Ae.ob.va.call(this),this.l){var t,e=this.l;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)0,fe(n[r]);delete e.a[t],e.b--}}this.Va=null},(t=Ue.prototype).S=function(){je(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.U=function(){return je(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return Ve(this.b,t)?this.b[t]:e},t.set=function(t,e){Ve(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},t.forEach=function(t,e){for(var n=this.U(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Be=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function qe(t,e){if(this.b=this.l=this.c="",this.i=null,this.h=this.g="",this.f=!1,t instanceof qe){this.f=void 0!==e?e:t.f,We(this,t.c),this.l=t.l,this.b=t.b,Ke(this,t.i),this.g=t.g,e=t.a;var n=new on;n.c=e.c,e.a&&(n.a=new Ue(e.a),n.b=e.b),Qe(this,n),this.h=t.h}else t&&(n=String(t).match(Be))?(this.f=!!e,We(this,n[1]||"",!0),this.l=Xe(n[2]||""),this.b=Xe(n[3]||"",!0),Ke(this,n[4]),this.g=Xe(n[5]||"",!0),Qe(this,n[6]||"",!0),this.h=Xe(n[7]||"")):(this.f=!!e,this.a=new on(null,this.f))}function We(t,e,n){t.c=n?Xe(e,!0):e,t.c&&(t.c=t.c.replace(/:$/,""))}function Ke(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.i=e}else t.i=null}function Qe(t,e,n){e instanceof on?(t.a=e,function(t,e){e&&!t.f&&(an(t),t.c=null,t.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(un(this,e),ln(this,n,t))},t)),t.f=e}(t.a,t.f)):(n||(e=Je(e,nn)),t.a=new on(e,t.f))}function He(t,e,n){t.a.set(e,n)}function ze(t,e){return t.a.get(e)}function Ge(t){return t instanceof qe?new qe(t):new qe(t,void 0)}function Ye(t,e){var n=new qe(null,void 0);return We(n,"https"),t&&(n.b=t),e&&(n.g=e),n}function Xe(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Je(t,e,n){return i(t)?(t=encodeURI(t).replace(e,$e),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function $e(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}qe.prototype.toString=function(){var t=[],e=this.c;e&&t.push(Je(e,Ze,!0),":");var n=this.b;return(n||"file"==e)&&(t.push("//"),(e=this.l)&&t.push(Je(e,Ze,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.i)&&t.push(":",String(n))),(n=this.g)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(Je(n,"/"==n.charAt(0)?en:tn,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.h)&&t.push("#",Je(n,rn)),t.join("")};var Ze=/[#\/\?@]/g,tn=/[#\?:]/g,en=/[#\?]/g,nn=/[#\?@]/g,rn=/#/g;function on(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function an(t){t.a||(t.a=new Ue,t.b=0,t.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.c,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function sn(t){var e=Fe(t);if("undefined"==typeof e)throw Error("Keys are undefined");var n=new on(null,void 0);t=Me(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];c(o)?ln(n,i,o):n.add(i,o)}return n}function un(t,e){an(t),e=hn(t,e),Ve(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Ve((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&je(t)))}function cn(t,e){return an(t),e=hn(t,e),Ve(t.a.b,e)}function ln(t,e,n){un(t,e),0<n.length&&(t.c=null,t.a.set(hn(t,e),V(n)),t.b+=n.length)}function hn(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}(t=on.prototype).add=function(t,e){an(this),this.c=null,t=hn(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},t.clear=function(){this.a=this.c=null,this.b=0},t.forEach=function(t,e){an(this),this.a.forEach(function(n,r){P(n,function(n){t.call(e,n,r,this)},this)},this)},t.U=function(){an(this);for(var t=this.a.S(),e=this.a.U(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},t.S=function(t){an(this);var e=[];if(i(t))cn(this,t)&&(e=j(e,this.a.get(hn(this,t))));else{t=this.a.S();for(var n=0;n<t.length;n++)e=j(e,t[n])}return e},t.set=function(t,e){return an(this),this.c=null,cn(this,t=hn(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},t.get=function(t,e){return 0<(t=t?this.S(t):[]).length?String(t[0]):e},t.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.U(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.S(r);for(var o=0;o<r.length;o++){var a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),t.push(a)}}return this.c=t.join("&")};var fn=!Wt||9<=Number($t);function pn(){this.a="",this.b=yn}function dn(t){return t instanceof pn&&t.constructor===pn&&t.b===yn?t.a:(C("expected object of type Const, got '"+t+"'"),"type_error:Const")}pn.prototype.na=!0,pn.prototype.ma=function(){return this.a},pn.prototype.toString=function(){return"Const{"+this.a+"}"};var yn={};function mn(t){var e=new pn;return e.a=t,e}function gn(){this.a="",this.b=En}function vn(t){return t instanceof gn&&t.constructor===gn&&t.b===En?t.a:(C("expected object of type TrustedResourceUrl, got '"+t+"' of type "+s(t)),"type_error:TrustedResourceUrl")}function bn(t,e){var n=dn(t);if(!wn.test(n))throw Error("Invalid TrustedResourceUrl format: "+n);return function(t){var e=new gn;return e.a=t,e}(t=n.replace(_n,function(t,r){if(!Object.prototype.hasOwnProperty.call(e,r))throw Error('Found marker, "'+r+'", in format string, "'+n+'", but no valid label mapping found in args: '+JSON.stringify(e));return(t=e[r])instanceof pn?dn(t):encodeURIComponent(String(t))}))}mn(""),gn.prototype.na=!0,gn.prototype.ma=function(){return this.a},gn.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var _n=/%{(\w+)}/g,wn=/^(?:https:)?\/\/[0-9a-z.:[\]-]+\/|^\/[^\/\\]|^about:blank#/i,En={};function Tn(){this.a="",this.b=Nn}function Sn(t){return t instanceof Tn&&t.constructor===Tn&&t.b===Nn?t.a:(C("expected object of type SafeUrl, got '"+t+"' of type "+s(t)),"type_error:SafeUrl")}Tn.prototype.na=!0,Tn.prototype.ma=function(){return this.a},Tn.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Cn=/^(?:(?:https?|mailto|ftp):|[^:\/?#]*(?:[\/?#]|$))/i;function In(t){return t instanceof Tn?t:(t=t.na?t.ma():String(t),Cn.test(t)||(t="about:invalid#zClosurez"),kn(t))}var Nn={};function kn(t){var e=new Tn;return e.a=t,e}function Dn(){this.a="",this.b=An}kn("about:blank"),Dn.prototype.na=!0,Dn.prototype.ma=function(){return this.a},Dn.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var An={};function On(t){var e=new Dn;return e.a=t,e}function Rn(t){var e=document;return i(t)?e.getElementById(t):t}function Pn(t,e){rt(e,function(e,n){e&&e.na&&(e=e.ma()),"style"==n?t.style.cssText=e:"class"==n?t.className=e:"for"==n?t.htmlFor=e:xn.hasOwnProperty(n)?t.setAttribute(xn[n],e):0==n.lastIndexOf("aria-",0)||0==n.lastIndexOf("data-",0)?t.setAttribute(n,e):t[n]=e})}On("<!DOCTYPE html>"),On(""),On("<br>");var xn={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"};function Ln(t,e,n){var r=arguments,o=document,a=String(r[0]),s=r[1];if(!fn&&s&&(s.name||s.type)){if(a=["<",a],s.name&&a.push(' name="',W(s.name),'"'),s.type){a.push(' type="',W(s.type),'"');var u={};ct(u,s),delete u.type,s=u}a.push(">"),a=a.join("")}return a=o.createElement(a),s&&(i(s)?a.className=s:c(s)?a.className=s.join(" "):Pn(a,s)),2<r.length&&function(t,e,n){function r(n){n&&e.appendChild(i(n)?t.createTextNode(n):n)}for(var o=2;o<n.length;o++){var a=n[o];!l(a)||f(a)&&0<a.nodeType?r(a):P(Mn(a)?V(a):a,r)}}(o,a,r),a}function Mn(t){if(t&&"number"==typeof t.length){if(f(t))return"function"==typeof t.item||"string"==typeof t.item;if(h(t))return"function"==typeof t.item}return!1}function Fn(t){var e=[];return function t(e,n,r){if(null==n)r.push("null");else{if("object"==typeof n){if(c(n)){var i=n;n=i.length,r.push("[");for(var o="",a=0;a<n;a++)r.push(o),t(e,i[a],r),o=",";return void r.push("]")}if(!(n instanceof String||n instanceof Number||n instanceof Boolean)){for(i in r.push("{"),o="",n)Object.prototype.hasOwnProperty.call(n,i)&&("function"!=typeof(a=n[i])&&(r.push(o),Bn(i,r),r.push(":"),t(e,a,r),o=","));return void r.push("}")}n=n.valueOf()}switch(typeof n){case"string":Bn(n,r);break;case"number":r.push(isFinite(n)&&!isNaN(n)?String(n):"null");break;case"boolean":r.push(String(n));break;case"function":r.push("null");break;default:throw Error("Unknown type: "+typeof n)}}}(new Un,t,e),e.join("")}function Un(){}var jn={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Vn=/\uffff/.test("\uffff")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function Bn(t,e){e.push('"',t.replace(Vn,function(t){var e=jn[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),jn[t]=e),e}),'"')}function qn(){var t=ar();return Wt&&!!$t&&11==$t||/Edge\/\d+/.test(t)}function Wn(){return n.window&&n.window.location.href||self&&self.location&&self.location.href||""}function Kn(t,e){e=e||n.window;var r="about:blank";t&&(r=Sn(In(t))),e.location.href=r}function Qn(t){return!!((t=(t||ar()).toLowerCase()).match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function Hn(t){t=t||n.window;try{t.close()}catch(e){}}function zn(t,e,n){var r=Math.floor(1e9*Math.random()).toString();e=e||500,n=n||600;var i=(window.screen.availHeight-n)/2,o=(window.screen.availWidth-e)/2;for(a in e={width:e,height:n,top:0<i?i:0,left:0<o?o:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1},n=ar().toLowerCase(),r&&(e.target=r,$(n,"crios/")&&(e.target="_blank")),rr(ar())==er&&(t=t||"http://localhost",e.scrollbars=!0),n=t||"",(t=e)||(t={}),r=window,e=n instanceof Tn?n:In("undefined"!=typeof n.href?n.href:String(n)),n=t.target||n.target,i=[],t)switch(a){case"width":case"height":case"top":case"left":i.push(a+"="+t[a]);break;case"target":case"noopener":case"noreferrer":break;default:i.push(a+"="+(t[a]?1:0))}var a=i.join(",");if((nt("iPhone")&&!nt("iPod")&&!nt("iPad")||nt("iPad")||nt("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(a=r.document.createElement("A"),e instanceof Tn||e instanceof Tn||(e=e.na?e.ma():String(e),Cn.test(e)||(e="about:invalid#zClosurez"),e=kn(e)),a.href=Sn(e),a.setAttribute("target",n),t.noreferrer&&a.setAttribute("rel","noreferrer"),(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,r,1),a.dispatchEvent(t),a={}):t.noreferrer?(a=r.open("",n,a),t=Sn(e),a&&(Qt&&$(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),a.opener=null,mn("b/12014412, meta tag with sanitized URL"),t=On(t='<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+W(t)+'">'),a.document.write(function(t){return t instanceof Dn&&t.constructor===Dn&&t.b===An?t.a:(C("expected object of type SafeHtml, got '"+t+"' of type "+s(t)),"type_error:SafeHtml")}(t)),a.document.close())):(a=r.open(Sn(e),n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(u){}return a}var Gn=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;function Yn(){var t=null;return new yt(function(e){"complete"==n.document.readyState?e():(t=function(){e()},_e(window,"load",t))}).s(function(e){throw we(window,"load",t),e})}function Xn(t){return t=t||ar(),!("file:"!==hr()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function Jn(){var t=n.window;try{return!(!t||t==t.top)}catch(e){return!1}}function $n(){return"object"!==typeof n.window&&"function"===typeof n.importScripts}function Zn(){return r.a.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":r.a.INTERNAL.hasOwnProperty("node")?"Node":$n()?"Worker":"Browser"}function tr(){var t=Zn();return"ReactNative"===t||"Node"===t}var er="Firefox",nr="Chrome";function rr(t){var e=t.toLowerCase();return $(e,"opera/")||$(e,"opr/")||$(e,"opios/")?"Opera":$(e,"iemobile")?"IEMobile":$(e,"msie")||$(e,"trident/")?"IE":$(e,"edge/")?"Edge":$(e,"firefox/")?er:$(e,"silk/")?"Silk":$(e,"blackberry")?"Blackberry":$(e,"webos")?"Webos":!$(e,"safari/")||$(e,"chrome/")||$(e,"crios/")||$(e,"android")?!$(e,"chrome/")&&!$(e,"crios/")||$(e,"edge/")?$(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":nr:"Safari"}var ir={Uc:"FirebaseCore-web",Wc:"FirebaseUI-web"};function or(t,e){e=e||[];var n,r=[],i={};for(n in ir)i[ir[n]]=!0;for(n=0;n<e.length;n++)"undefined"!==typeof i[e[n]]&&(delete i[e[n]],r.push(e[n]));return r.sort(),(e=r).length||(e=["FirebaseCore-web"]),"Browser"===(r=Zn())?r=rr(i=ar()):"Worker"===r&&(r=rr(i=ar())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function ar(){return n.navigator&&n.navigator.userAgent||""}function sr(t,e){t=t.split("."),e=e||n;for(var r=0;r<t.length&&"object"==typeof e&&null!=e;r++)e=e[t[r]];return r!=t.length&&(e=void 0),e}function ur(){try{var t=n.localStorage,e=mr();if(t)return t.setItem(e,"1"),t.removeItem(e),!qn()||!!n.indexedDB}catch(r){return $n()&&!!n.indexedDB}return!1}function cr(){return(lr()||"chrome-extension:"===hr()||Xn())&&!tr()&&ur()&&!$n()}function lr(){return"http:"===hr()||"https:"===hr()}function hr(){return n.location&&n.location.protocol||null}function fr(t){return!Qn(t=t||ar())&&rr(t)!=er}function pr(t){return"undefined"===typeof t?null:Fn(t)}function dr(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&null!==t[e]&&void 0!==t[e]&&(n[e]=t[e]);return n}function yr(t){if(null!==t)return JSON.parse(t)}function mr(t){return t||Math.floor(1e9*Math.random()).toString()}function gr(t){return"Safari"!=rr(t=t||ar())&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function vr(){var t=n.___jsl;if(t&&t.H)for(var e in t.H)if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=t.H[e].L.concat(),t.CP)for(var r=0;r<t.CP.length;r++)t.CP[r]=null}function br(t,e){if(t>e)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=ar(),e=Zn(),this.b=Qn(t)||"ReactNative"===e}function _r(){var t=n.document;return!t||"undefined"===typeof t.visibilityState||"visible"==t.visibilityState}function wr(t){try{var e=new Date(parseInt(t,10));if(!isNaN(e.getTime())&&!/[^0-9]/.test(t))return e.toUTCString()}catch(n){}return null}function Er(){return!(!sr("fireauth.oauthhelper",n)&&!sr("fireauth.iframe",n))}br.prototype.get=function(){var t=n.navigator;return!t||"boolean"!==typeof t.onLine||!lr()&&"chrome-extension:"!==hr()&&"undefined"===typeof t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Tr,Sr={};function Cr(t){Sr[t]||(Sr[t]=!0,"undefined"!==typeof console&&"function"===typeof console.warn&&console.warn(t))}try{var Ir={};Object.defineProperty(Ir,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Ir,"abcd",{configurable:!0,enumerable:!0,value:2}),Tr=2==Ir.abcd}catch(wo){Tr=!1}function Nr(t,e,n){Tr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function kr(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&Nr(t,n,e[n])}function Dr(t){var e={};return kr(e,t),e}function Ar(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)Nr(e,n,Ar(t[n]));return e}function Or(t){var e={},n=t[Pr],r=t[xr];if(!(t=t[Lr])||t!=Rr&&!n)throw Error("Invalid provider user info!");e[Fr]=r||null,e[Mr]=n||null,Nr(this,jr,t),Nr(this,Ur,Ar(e))}var Rr="EMAIL_SIGNIN",Pr="email",xr="newEmail",Lr="requestType",Mr="email",Fr="fromEmail",Ur="data",jr="operation";function Vr(t,e){this.code=qr+t,this.message=e||Wr[t]||""}function Br(t){var e=t&&t.code;return e?new Vr(e.substring(qr.length),t.message):null}_(Vr,Error),Vr.prototype.C=function(){return{code:this.code,message:this.message}},Vr.prototype.toJSON=function(){return this.C()};var qr="auth/",Wr={"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-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","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-provider-id":"The specified provider ID is invalid.","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-or-invalid-nonce":"The OIDC ID token requires a valid unhashed nonce.","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.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","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.","rejected-credential":"The request contains malformed or mismatching credentials.",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."};function Kr(t){var e=t[Yr];if("undefined"===typeof e)throw new Vr("missing-continue-uri");if("string"!==typeof e||"string"===typeof e&&!e.length)throw new Vr("invalid-continue-uri");this.h=e,this.b=this.a=null,this.g=!1;var n=t[Qr];if(n&&"object"===typeof n){e=n[$r];var r=n[Xr];if(n=n[Jr],"string"===typeof e&&e.length){if(this.a=e,"undefined"!==typeof r&&"boolean"!==typeof r)throw new Vr("argument-error",Xr+" property must be a boolean when specified.");if(this.g=!!r,"undefined"!==typeof n&&("string"!==typeof n||"string"===typeof n&&!n.length))throw new Vr("argument-error",Jr+" property must be a non empty string when specified.");this.b=n||null}else{if("undefined"!==typeof e)throw new Vr("argument-error",$r+" property must be a non empty string when specified.");if("undefined"!==typeof r||"undefined"!==typeof n)throw new Vr("missing-android-pkg-name")}}else if("undefined"!==typeof n)throw new Vr("argument-error",Qr+" property must be a non null object when specified.");if(this.f=null,(e=t[Gr])&&"object"===typeof e){if("string"===typeof(e=e[Zr])&&e.length)this.f=e;else if("undefined"!==typeof e)throw new Vr("argument-error",Zr+" property must be a non empty string when specified.")}else if("undefined"!==typeof e)throw new Vr("argument-error",Gr+" property must be a non null object when specified.");if("undefined"!==typeof(e=t[zr])&&"boolean"!==typeof e)throw new Vr("argument-error",zr+" property must be a boolean when specified.");if(this.c=!!e,"undefined"!==typeof(t=t[Hr])&&("string"!==typeof t||"string"===typeof t&&!t.length))throw new Vr("argument-error",Hr+" property must be a non empty string when specified.");this.i=t||null}var Qr="android",Hr="dynamicLinkDomain",zr="handleCodeInApp",Gr="iOS",Yr="url",Xr="installApp",Jr="minimumVersion",$r="packageName",Zr="bundleId";function ti(t){var e={};for(var n in e.continueUrl=t.h,e.canHandleCodeInApp=t.c,(e.androidPackageName=t.a)&&(e.androidMinimumVersion=t.b,e.androidInstallApp=t.g),e.iOSBundleId=t.f,e.dynamicLinkDomain=t.i,e)null===e[n]&&delete e[n];return e}var ei=null,ni=null;function ri(t){var e="";return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=ni[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}!function(){if(!ei){ei={},ni={};for(var t=0;65>t;t++)ei[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t),ni[ei[t]]=t,62<=t&&(ni["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(t)]=t)}}();for(var r=0;;){var i=n(-1),o=n(0),a=n(64),s=n(64);if(64===s&&-1===i)break;e(i<<2|o>>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}}(t,function(t){e+=String.fromCharCode(t)}),e}function ii(t){this.c=t.sub,b(),this.a=t.provider_id||t.firebase&&t.firebase.sign_in_provider||null,this.b=!!t.is_anonymous||"anonymous"==this.a}function oi(t){return(t=ai(t))&&t.sub&&t.iss&&t.aud&&t.exp?new ii(t):null}function ai(t){if(!t)return null;if(3!=(t=t.split(".")).length)return null;for(var e=(4-(t=t[1]).length%4)%4,n=0;n<e;n++)t+=".";try{return JSON.parse(ri(t))}catch(r){}return null}ii.prototype.f=function(){return this.b};var si,ui={$c:{ab:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",ib:"https://securetoken.googleapis.com/v1/token",id:"p"},bd:{ab:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",ib:"https://staging-securetoken.sandbox.googleapis.com/v1/token",id:"s"},cd:{ab:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",ib:"https://test-securetoken.sandbox.googleapis.com/v1/token",id:"t"}};function ci(t){for(var e in ui)if(ui[e].id===t)return{firebaseEndpoint:(t=ui[e]).ab,secureTokenEndpoint:t.ib};return null}si=ci("__EID__")?"__EID__":void 0;var li="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),hi=["client_id","response_type","scope","redirect_uri","state"],fi={Vc:{Ma:"locale",Ba:500,Aa:600,Na:"facebook.com",hb:hi},Xc:{Ma:null,Ba:500,Aa:620,Na:"github.com",hb:hi},Yc:{Ma:"hl",Ba:515,Aa:680,Na:"google.com",hb:hi},dd:{Ma:"lang",Ba:485,Aa:705,Na:"twitter.com",hb:li}};function pi(t){for(var e in fi)if(fi[e].Na==t)return fi[e];return null}function di(t){var e={};e["facebook.com"]=bi,e["google.com"]=wi,e["github.com"]=_i,e["twitter.com"]=Ei;var n=t&&t[mi];try{if(n)return e[n]?new e[n](t):new vi(t);if("undefined"!==typeof t[yi])return new gi(t)}catch(r){}return null}var yi="idToken",mi="providerId";function gi(t){var e=t[mi];if(!e&&t[yi]){var n=oi(t[yi]);n&&n.a&&(e=n.a)}if(!e)throw Error("Invalid additional user info!");"anonymous"!=e&&"custom"!=e||(e=null),n=!1,"undefined"!==typeof t.isNewUser?n=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(n=!0),Nr(this,"providerId",e),Nr(this,"isNewUser",n)}function vi(t){gi.call(this,t),Nr(this,"profile",Ar((t=yr(t.rawUserInfo||"{}"))||{}))}function bi(t){if(vi.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function _i(t){if(vi.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");Nr(this,"username",this.profile&&this.profile.login||null)}function wi(t){if(vi.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function Ei(t){if(vi.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");Nr(this,"username",t.screenName||null)}function Ti(t){this.a=Ge(t)}function Si(t){var e=Ge(t),n=ze(e,"link"),r=ze(Ge(n),"link");return e=ze(e,"deep_link_id"),ze(Ge(e),"link")||e||r||n||t}function Ci(t,e){return t.then(function(t){if(t[ca]){var n=oi(t[ca]);if(!n||e!=n.c)throw new Vr("user-mismatch");return t}throw new Vr("user-mismatch")}).s(function(t){throw t&&t.code&&t.code==qr+"user-not-found"?new Vr("user-mismatch"):t})}function Ii(t,e){if(!e)throw new Vr("internal-error","failed to construct a credential");this.a=e,Nr(this,"providerId",t),Nr(this,"signInMethod",t)}function Ni(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function ki(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&Nr(this,"idToken",e.idToken),e.accessToken&&Nr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&Nr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new Vr("internal-error","failed to construct a credential");Nr(this,"accessToken",e.oauthToken),Nr(this,"secret",e.oauthTokenSecret)}Nr(this,"providerId",t),Nr(this,"signInMethod",n)}function Di(t){var e={};return t.idToken&&(e.id_token=t.idToken),t.accessToken&&(e.access_token=t.accessToken),t.secret&&(e.oauth_token_secret=t.secret),e.providerId=t.providerId,t.nonce&&!t.a&&(e.nonce=t.nonce),e={postBody:sn(e).toString(),requestUri:"http://localhost"},t.a&&(delete e.postBody,e.pendingToken=t.a),e}function Ai(t,e){this.Dc=e||[],kr(this,{providerId:t,isOAuthProvider:!0}),this.yb={},this.cb=(pi(t)||{}).Ma||null,this.$a=null}function Oi(t){if("string"!==typeof t||0!=t.indexOf("saml."))throw new Vr("argument-error",'SAML provider IDs must be prefixed with "saml."');Ai.call(this,t,[])}function Ri(t){Ai.call(this,t,hi),this.a=[]}function Pi(){Ri.call(this,"facebook.com")}function xi(t){if(!t)throw new Vr("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return f(t)&&(e=t.accessToken),(new Pi).credential(null,e)}function Li(){Ri.call(this,"github.com")}function Mi(t){if(!t)throw new Vr("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return f(t)&&(e=t.accessToken),(new Li).credential(null,e)}function Fi(){Ri.call(this,"google.com"),this.ua("profile")}function Ui(t,e){var n=t;return f(t)&&(n=t.idToken,e=t.accessToken),(new Fi).credential(n,e)}function ji(){Ai.call(this,"twitter.com",li)}function Vi(t,e){var n=t;if(f(n)||(n={oauthToken:t,oauthTokenSecret:e}),!n.oauthToken||!n.oauthTokenSecret)throw new Vr("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new ki("twitter.com",n,"twitter.com")}function Bi(t,e,n){this.a=t,this.c=e,Nr(this,"providerId","password"),Nr(this,"signInMethod",n===qi.EMAIL_LINK_SIGN_IN_METHOD?qi.EMAIL_LINK_SIGN_IN_METHOD:qi.EMAIL_PASSWORD_SIGN_IN_METHOD)}function qi(){kr(this,{providerId:"password",isOAuthProvider:!1})}function Wi(t,e){if(!(e=Ki(e)))throw new Vr("argument-error","Invalid email link!");return new Bi(t,e,qi.EMAIL_LINK_SIGN_IN_METHOD)}function Ki(t){var e=ze((t=new Ti(t=Si(t))).a,"oobCode")||null;return"signIn"===(ze(t.a,"mode")||null)&&e?e:null}function Qi(t){if(!(t.Ta&&t.Sa||t.Fa&&t.$))throw new Vr("internal-error");this.a=t,Nr(this,"providerId","phone"),Nr(this,"signInMethod","phone")}function Hi(t){return t.a.Fa&&t.a.$?{temporaryProof:t.a.Fa,phoneNumber:t.a.$}:{sessionInfo:t.a.Ta,code:t.a.Sa}}function zi(t){try{this.a=t||r.a.auth()}catch(e){throw new Vr("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}kr(this,{providerId:"phone",isOAuthProvider:!1})}function Gi(t,e){if(!t)throw new Vr("missing-verification-id");if(!e)throw new Vr("missing-verification-code");return new Qi({Ta:t,Sa:e})}function Yi(t){if(t.temporaryProof&&t.phoneNumber)return new Qi({Fa:t.temporaryProof,$:t.phoneNumber});var e=t&&t.providerId;if(!e||"password"===e)return null;var n=t&&t.oauthAccessToken,r=t&&t.oauthTokenSecret,i=t&&t.nonce,o=t&&t.oauthIdToken,a=t&&t.pendingToken;try{switch(e){case"google.com":return Ui(o,n);case"facebook.com":return xi(n);case"github.com":return Mi(n);case"twitter.com":return Vi(n,r);default:return n||r||o||a?a?0==e.indexOf("saml.")?new Ii(e,a):new ki(e,{pendingToken:a,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new Ri(e).credential(o,n,i):null}}catch(s){return null}}function Xi(t){if(!t.isOAuthProvider)throw new Vr("invalid-oauth-provider")}function Ji(t,e,n,r,i,o){if(this.b=t,this.c=e||null,this.f=n||null,this.g=r||null,this.h=o||null,this.a=i||null,!this.f&&!this.a)throw new Vr("invalid-auth-event");if(this.f&&this.a)throw new Vr("invalid-auth-event");if(this.f&&!this.g)throw new Vr("invalid-auth-event")}function $i(t){return(t=t||{}).type?new Ji(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&Br(t.error),t.postBody):null}function Zi(){this.b=null,this.a=[]}_(vi,gi),_(bi,vi),_(_i,vi),_(wi,vi),_(Ei,vi),Ii.prototype.la=function(t){return Na(t,Ni(this))},Ii.prototype.b=function(t,e){var n=Ni(this);return n.idToken=e,ka(t,n)},Ii.prototype.f=function(t,e){return Ci(Da(t,Ni(this)),e)},Ii.prototype.C=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},ki.prototype.la=function(t){return Na(t,Di(this))},ki.prototype.b=function(t,e){var n=Di(this);return n.idToken=e,ka(t,n)},ki.prototype.f=function(t,e){return Ci(Da(t,Di(this)),e)},ki.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),this.nonce&&(t.nonce=this.nonce),this.a&&(t.pendingToken=this.a),t},Ai.prototype.Da=function(t){return this.yb=ot(t),this},_(Oi,Ai),_(Ri,Ai),Ri.prototype.ua=function(t){return M(this.a,t)||this.a.push(t),this},Ri.prototype.Eb=function(){return V(this.a)},Ri.prototype.credential=function(t,e,n){if(!t&&!e)throw new Vr("argument-error","credential failed: must provide the ID token and/or the access token.");return new ki(this.providerId,{idToken:t||null,accessToken:e||null,nonce:n||null},this.providerId)},_(Pi,Ri),Nr(Pi,"PROVIDER_ID","facebook.com"),Nr(Pi,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),_(Li,Ri),Nr(Li,"PROVIDER_ID","github.com"),Nr(Li,"GITHUB_SIGN_IN_METHOD","github.com"),_(Fi,Ri),Nr(Fi,"PROVIDER_ID","google.com"),Nr(Fi,"GOOGLE_SIGN_IN_METHOD","google.com"),_(ji,Ai),Nr(ji,"PROVIDER_ID","twitter.com"),Nr(ji,"TWITTER_SIGN_IN_METHOD","twitter.com"),Bi.prototype.la=function(t){return this.signInMethod==qi.EMAIL_LINK_SIGN_IN_METHOD?is(t,Fa,{email:this.a,oobCode:this.c}):is(t,ts,{email:this.a,password:this.c})},Bi.prototype.b=function(t,e){return this.signInMethod==qi.EMAIL_LINK_SIGN_IN_METHOD?is(t,Ua,{idToken:e,email:this.a,oobCode:this.c}):is(t,Ga,{idToken:e,email:this.a,password:this.c})},Bi.prototype.f=function(t,e){return Ci(this.la(t),e)},Bi.prototype.C=function(){return{email:this.a,password:this.c,signInMethod:this.signInMethod}},kr(qi,{PROVIDER_ID:"password"}),kr(qi,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),kr(qi,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),Qi.prototype.la=function(t){return t.Ua(Hi(this))},Qi.prototype.b=function(t,e){var n=Hi(this);return n.idToken=e,is(t,ns,n)},Qi.prototype.f=function(t,e){var n=Hi(this);return n.operation="REAUTH",Ci(t=is(t,rs,n),e)},Qi.prototype.C=function(){var t={providerId:"phone"};return this.a.Ta&&(t.verificationId=this.a.Ta),this.a.Sa&&(t.verificationCode=this.a.Sa),this.a.Fa&&(t.temporaryProof=this.a.Fa),this.a.$&&(t.phoneNumber=this.a.$),t},zi.prototype.Ua=function(t,e){var n=this.a.b;return Et(e.verify()).then(function(r){if(!i(r))throw new Vr("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(e.type){case"recaptcha":return function(t,e){return is(t,Ha,e)}(n,{phoneNumber:t,recaptchaToken:r}).then(function(t){return"function"===typeof e.reset&&e.reset(),t},function(t){throw"function"===typeof e.reset&&e.reset(),t});default:throw new Vr("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})},kr(zi,{PROVIDER_ID:"phone"}),kr(zi,{PHONE_SIGN_IN_METHOD:"phone"}),Ji.prototype.C=function(){return{type:this.b,eventId:this.c,urlResponse:this.f,sessionId:this.g,postBody:this.h,error:this.a&&this.a.C()}};var to=null;function eo(t){var e="unauthorized-domain",n=void 0,r=Ge(t);t=r.b,"chrome-extension"==(r=r.c)?n=B("This chrome extension ID (chrome-extension://%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):"http"==r||"https"==r?n=B("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",Vr.call(this,e,n)}function no(t,e,n){Vr.call(this,t,n),(t=e||{}).zb&&Nr(this,"email",t.zb),t.$&&Nr(this,"phoneNumber",t.$),t.credential&&Nr(this,"credential",t.credential)}function ro(t){if(t.code){var e=t.code||"";0==e.indexOf(qr)&&(e=e.substring(qr.length));var n={credential:Yi(t)};if(t.email)n.zb=t.email;else if(t.phoneNumber)n.$=t.phoneNumber;else if(!n.credential)return new Vr(e,t.message||void 0);return new no(e,n,t.message)}return null}Zi.prototype.subscribe=function(t){var e=this;this.a.push(t),this.b||(this.b=function(t){for(var n=0;n<e.a.length;n++)e.a[n](t)},"function"===typeof(t=sr("universalLinks.subscribe",n))&&t(null,this.b))},Zi.prototype.unsubscribe=function(t){U(this.a,function(e){return e==t})},_(eo,Vr),_(no,Vr),no.prototype.C=function(){var t={code:this.code,message:this.message};this.email&&(t.email=this.email),this.phoneNumber&&(t.phoneNumber=this.phoneNumber);var e=this.credential&&this.credential.C();return e&&ct(t,e),t},no.prototype.toJSON=function(){return this.C()};var io,oo=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;function ao(){}function so(t){return t.c||(t.c=t.b())}function uo(){}function co(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<e.length;n++){var r=e[n];try{return new ActiveXObject(r),t.f=r}catch(i){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return t.f}function lo(){}function ho(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseText="",this.status=-1,this.statusText="",this.a.onload=g(this.ec,this),this.a.onerror=g(this.Fb,this),this.a.onprogress=g(this.fc,this),this.a.ontimeout=g(this.ic,this)}function fo(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function po(t,e,n){this.reset(t,e,n,void 0,void 0)}ao.prototype.c=null,_(uo,ao),uo.prototype.a=function(){var t=co(this);return t?new ActiveXObject(t):new XMLHttpRequest},uo.prototype.b=function(){var t={};return co(this)&&(t[0]=!0,t[1]=!0),t},io=new uo,_(lo,ao),lo.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new ho;throw Error("Unsupported browser")},lo.prototype.b=function(){return{}},(t=ho.prototype).open=function(t,e,n){if(null!=n&&!n)throw Error("Only async requests are supported.");this.a.open(t,e)},t.send=function(t){if(t){if("string"!=typeof t)throw Error("Only string data is supported");this.a.send(t)}else this.a.send()},t.abort=function(){this.a.abort()},t.setRequestHeader=function(){},t.getResponseHeader=function(t){return"content-type"==t.toLowerCase()?this.a.contentType:""},t.ec=function(){this.status=200,this.responseText=this.a.responseText,fo(this,4)},t.Fb=function(){this.status=500,this.responseText="",fo(this,4)},t.ic=function(){this.Fb()},t.fc=function(){this.status=200,fo(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},po.prototype.a=null;function yo(t){this.f=t,this.b=this.c=this.a=null}function mo(t,e){this.name=t,this.value=e}po.prototype.reset=function(t,e,n,r,i){"number"==typeof i||0,r||b(),delete this.a},mo.prototype.toString=function(){return this.name};var go=new mo("SEVERE",1e3),vo=new mo("WARNING",900),bo=new mo("CONFIG",700),_o=new mo("FINE",500);yo.prototype.log=function(t,e,n){if(t.value>=function t(e){return e.c?e.c:e.a?t(e.a):(C("Root logger has no level set."),null)}(this).value)for(h(e)&&(e=e()),t=new po(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var wo,Eo={},To=null;function So(t){var e;if(To||(To=new yo(""),Eo[""]=To,To.c=bo),!(e=Eo[t])){e=new yo(t);var n=t.lastIndexOf("."),r=t.substr(n+1);(n=So(t.substr(0,n))).b||(n.b={}),n.b[r]=e,e.a=n,Eo[t]=e}return e}function Co(t,e){t&&t.log(_o,e,void 0)}function Io(t){this.f=t}function No(t){Ae.call(this),this.i=t,this.readyState=ko,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=So("goog.net.FetchXmlHttp")}_(Io,ao),Io.prototype.a=function(){return new No(this.f)},Io.prototype.b=(wo={},function(){return wo}),_(No,Ae);var ko=0;function Do(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function Ao(t){Ae.call(this),this.headers=new Ue,this.D=t||null,this.c=!1,this.w=this.a=null,this.h=this.N=this.m="",this.f=this.I=this.i=this.G=!1,this.g=0,this.u=null,this.o=Oo,this.v=this.O=!1}(t=No.prototype).open=function(t,e){if(this.readyState!=ko)throw this.abort(),Error("Error reopening a connection");this.h=t,this.c=e,this.readyState=1,Do(this)},t.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.hc.bind(this),this.Gb.bind(this))},t.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,Do(this)),this.readyState=ko},t.hc=function(t){this.a&&(this.b||(this.b=t.headers,this.readyState=2,Do(this)),this.a&&(this.readyState=3,Do(this),this.a&&t.text().then(this.gc.bind(this,t),this.Gb.bind(this))))},t.gc=function(t,e){this.a&&(this.status=t.status,this.statusText=t.statusText,this.responseText=e,this.readyState=4,Do(this))},t.Gb=function(t){var e=this.f;e&&e.log(vo,"Failed to fetch url "+this.c,t instanceof Error?t:Error(t)),this.a&&(this.readyState=4,Do(this))},t.setRequestHeader=function(t,e){this.g.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.f)&&t.log(vo,"Attempting to get response header but no headers have been received for url: "+this.c,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.f;return t&&t.log(vo,"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")},_(Ao,Ae);var Oo="";Ao.prototype.b=So("goog.net.XhrIo");var Ro=/^https?$/i,Po=["POST","PUT"];function xo(t,e,r,o,a){if(t.a)throw Error("[goog.net.XhrIo] Object is active with another request="+t.m+"; newUri="+e);r=r?r.toUpperCase():"GET",t.m=e,t.h="",t.N=r,t.G=!1,t.c=!0,t.a=t.D?t.D.a():io.a(),t.w=t.D?so(t.D):so(io),t.a.onreadystatechange=g(t.Jb,t);try{Co(t.b,Wo(t,"Opening Xhr")),t.I=!0,t.a.open(r,String(e),!0),t.I=!1}catch(u){return Co(t.b,Wo(t,"Error opening Xhr: "+u.message)),void Mo(t,u)}e=o||"";var s=new Ue(t.headers);a&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(l(t)||i(t))P(t,e,void 0);else for(var n=Fe(t),r=Me(t),o=r.length,a=0;a<o;a++)e.call(void 0,r[a],n&&n[a],t)}(a,function(t,e){s.set(e,t)}),a=function(t){t:{for(var e=Lo,n=t.length,r=i(t)?t.split(""):t,o=0;o<n;o++)if(o in r&&e.call(void 0,r[o],o,t)){e=o;break t}e=-1}return 0>e?null:i(t)?t.charAt(e):t[e]}(s.U()),o=n.FormData&&e instanceof n.FormData,!M(Po,r)||a||o||s.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),s.forEach(function(t,e){this.a.setRequestHeader(e,t)},t),t.o&&(t.a.responseType=t.o),"withCredentials"in t.a&&t.a.withCredentials!==t.O&&(t.a.withCredentials=t.O);try{Vo(t),0<t.g&&(t.v=function(t){return Wt&&te(9)&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(t.a),Co(t.b,Wo(t,"Will abort after "+t.g+"ms if incomplete, xhr2 "+t.v)),t.v?(t.a.timeout=t.g,t.a.ontimeout=g(t.Ga,t)):t.u=xe(t.Ga,t.g,t)),Co(t.b,Wo(t,"Sending request")),t.i=!0,t.a.send(e),t.i=!1}catch(u){Co(t.b,Wo(t,"Send error: "+u.message)),Mo(t,u)}}function Lo(t){return"content-type"==t.toLowerCase()}function Mo(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,Fo(t),jo(t)}function Fo(t){t.G||(t.G=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function Uo(t){if(t.c&&"undefined"!=typeof e)if(t.w[1]&&4==Bo(t)&&2==qo(t))Co(t.b,Wo(t,"Local request error detected and ignored"));else if(t.i&&4==Bo(t))xe(t.Jb,0,t);else if(t.dispatchEvent("readystatechange"),4==Bo(t)){Co(t.b,Wo(t,"Request complete")),t.c=!1;try{var r,i=qo(t);t:switch(i){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var o=!0;break t;default:o=!1}if(!(r=o)){var a;if(a=0===i){var s=String(t.m).match(Be)[1]||null;if(!s&&n.self&&n.self.location){var u=n.self.location.protocol;s=u.substr(0,u.length-1)}a=!Ro.test(s?s.toLowerCase():"")}r=a}if(r)t.dispatchEvent("complete"),t.dispatchEvent("success");else{try{var c=2<Bo(t)?t.a.statusText:""}catch(l){Co(t.b,"Can not get status: "+l.message),c=""}t.h=c+" ["+qo(t)+"]",Fo(t)}}finally{jo(t)}}}function jo(t,e){if(t.a){Vo(t);var n=t.a,r=t.w[0]?a:null;t.a=null,t.w=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(i){(t=t.b)&&t.log(go,"Problem encountered resetting onreadystatechange: "+i.message,void 0)}}}function Vo(t){t.a&&t.v&&(t.a.ontimeout=null),t.u&&(n.clearTimeout(t.u),t.u=null)}function Bo(t){return t.a?t.a.readyState:0}function qo(t){try{return 2<Bo(t)?t.a.status:-1}catch(e){return-1}}function Wo(t,e){return e+" ["+t.N+" "+t.m+" "+qo(t)+"]"}function Ko(t,e){this.g=[],this.v=t,this.u=e||null,this.f=this.a=!1,this.c=void 0,this.m=this.w=this.i=!1,this.h=0,this.b=null,this.l=0}function Qo(t,e,n){t.a=!0,t.c=n,t.f=!e,Yo(t)}function Ho(t){if(t.a){if(!t.m)throw new Xo(t);t.m=!1}}function zo(t,e,n,r){t.g.push([e,n,r]),t.a&&Yo(t)}function Go(t){return L(t.g,function(t){return h(t[1])})}function Yo(t){if(t.h&&t.a&&Go(t)){var e=t.h,r=Zo[e];r&&(n.clearTimeout(r.a),delete Zo[e]),t.h=0}t.b&&(t.b.l--,delete t.b),e=t.c;for(var i=r=!1;t.g.length&&!t.i;){var o=t.g.shift(),a=o[0],s=o[1];if(o=o[2],a=t.f?s:a)try{var u=a.call(o||t.u,e);void 0!==u&&(t.f=t.f&&(u==e||u instanceof Error),t.c=e=u),(E(e)||"function"===typeof n.Promise&&e instanceof n.Promise)&&(i=!0,t.i=!0)}catch(c){e=c,t.f=!0,Go(t)||(r=!0)}}t.c=e,i&&(u=g(t.o,t,!0),i=g(t.o,t,!1),e instanceof Ko?(zo(e,u,i),e.w=!0):e.then(u,i)),r&&(e=new $o(e),Zo[e.a]=e,t.h=e.a)}function Xo(){T.call(this)}function Jo(){T.call(this)}function $o(t){this.a=n.setTimeout(g(this.c,this),0),this.b=t}(t=Ao.prototype).Ga=function(){"undefined"!=typeof e&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",Co(this.b,Wo(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(Co(this.b,Wo(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),jo(this))},t.va=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),jo(this,!0)),Ao.ob.va.call(this)},t.Jb=function(){this.qa||(this.I||this.i||this.f?Uo(this):this.wc())},t.wc=function(){Uo(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.o){case Oo: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(go,"Response type "+this.o+" is not supported on this browser",void 0),null}catch(e){return Co(this.b,"Can not get response: "+e.message),null}},Ko.prototype.cancel=function(t){if(this.a)this.c instanceof Ko&&this.c.cancel();else{if(this.b){var e=this.b;delete this.b,t?e.cancel(t):(e.l--,0>=e.l&&e.cancel())}this.v?this.v.call(this.u,this):this.m=!0,this.a||(t=new Jo(this),Ho(this),Qo(this,!1,t))}},Ko.prototype.o=function(t,e){this.i=!1,Qo(this,t,e)},Ko.prototype.D=function(){Ho(this),Qo(this,!0,null)},Ko.prototype.then=function(t,e,n){var r,i,o=new yt(function(t,e){r=t,i=e});return zo(this,r,function(t){t instanceof Jo?o.cancel():i(t)}),o.then(t,e,n)},w(Ko),_(Xo,T),Xo.prototype.message="Deferred has already fired",Xo.prototype.name="AlreadyCalledError",_(Jo,T),Jo.prototype.message="Deferred was canceled",Jo.prototype.name="CanceledError",$o.prototype.c=function(){throw delete Zo[this.a],this.b};var Zo={};function ta(t){var e={},n=e.document||document,r=vn(t),i=document.createElement("SCRIPT"),o={Lb:i,Ga:void 0},a=new Ko(ea,o),s=null,u=null!=e.timeout?e.timeout:5e3;return 0<u&&(s=window.setTimeout(function(){na(i,!0);var t=new oa(ia,"Timeout reached for loading script "+r);Ho(a),Qo(a,!1,t)},u),o.Ga=s),i.onload=i.onreadystatechange=function(){i.readyState&&"loaded"!=i.readyState&&"complete"!=i.readyState||(na(i,e.fd||!1,s),a.D())},i.onerror=function(){na(i,!0,s);var t=new oa(ra,"Error while loading script "+r);Ho(a),Qo(a,!1,t)},ct(o=e.attributes||{},{type:"text/javascript",charset:"UTF-8"}),Pn(i,o),i.src=vn(t),function(t){var e;return(e=(t||document).getElementsByTagName("HEAD"))&&0!=e.length?e[0]:t.documentElement}(n).appendChild(i),a}function ea(){if(this&&this.Lb){var t=this.Lb;t&&"SCRIPT"==t.tagName&&na(t,!0,this.Ga)}}function na(t,e,r){null!=r&&n.clearTimeout(r),t.onload=a,t.onerror=a,t.onreadystatechange=a,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var ra=0,ia=1;function oa(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),T.call(this,n),this.code=t}function aa(t){this.f=t}function sa(t,e,i){if(this.b=t,t=e||{},this.i=t.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.l=t.secureTokenTimeout||la,this.f=ot(t.secureTokenHeaders||ha),this.g=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.h=t.firebaseTimeout||fa,this.a=ot(t.firebaseHeaders||pa),i&&(this.a["X-Client-Version"]=i,this.f["X-Client-Version"]=i),i="Node"==Zn(),!(i=n.XMLHttpRequest||i&&r.a.INTERNAL.node&&r.a.INTERNAL.node.XMLHttpRequest)&&!$n())throw new Vr("internal-error","The XMLHttpRequest compatibility library was not found.");this.c=void 0,$n()?this.c=new Io(self):tr()?this.c=new aa(i):this.c=new lo}_(oa,T),_(aa,ao),aa.prototype.a=function(){return new this.f},aa.prototype.b=function(){return{}};var ua,ca="idToken",la=new br(3e4,6e4),ha={"Content-Type":"application/x-www-form-urlencoded"},fa=new br(3e4,6e4),pa={"Content-Type":"application/json"};function da(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function ya(t,e){e?(t.a["X-Client-Version"]=e,t.f["X-Client-Version"]=e):(delete t.a["X-Client-Version"],delete t.f["X-Client-Version"])}function ma(t,e,r,i,o,a,s){(function(){var t=ar();return!((t=rr(t)!=nr?null:(t=t.match(/\sChrome\/(\d+)/i))&&2==t.length?parseInt(t[1],10):null)&&30>t)&&(!Wt||!$t||9<$t)})()||$n()?t=g(t.o,t):(ua||(ua=new yt(function(t,e){!function(t,e){if(((window.gapi||{}).client||{}).request)t();else{n[va]=function(){((window.gapi||{}).client||{}).request?t():e(Error("CORS_UNSUPPORTED"))};var r=bn(ga,{onload:va});!function(t,e){zo(t,null,e,void 0)}(ta(r),function(){e(Error("CORS_UNSUPPORTED"))})}}(t,e)})),t=g(t.m,t)),t(e,r,i,o,a,s)}sa.prototype.o=function(t,e,r,i,o,a){if($n()&&("undefined"===typeof n.fetch||"undefined"===typeof n.Headers||"undefined"===typeof n.Request))throw new Vr("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var s=new Ao(this.c);if(a){s.g=Math.max(0,a);var u=setTimeout(function(){s.dispatchEvent("timeout")},a)}Oe(s,"complete",function(){u&&clearTimeout(u);var t=null;try{t=JSON.parse(function(t){try{return t.a?t.a.responseText:""}catch(e){return Co(t.b,"Can not get responseText: "+e.message),""}}(this))||null}catch(n){t=null}e&&e(t)}),Re(s,"ready",function(){u&&clearTimeout(u),jt(this)}),Re(s,"timeout",function(){u&&clearTimeout(u),jt(this),e&&e(null)}),xo(s,t,r,i,o)};var ga=mn("https://apis.google.com/js/client.js?onload=%{onload}"),va="__fcb"+Math.floor(1e6*Math.random()).toString();function ba(t){if(!oo.test(t.email))throw new Vr("invalid-email")}function _a(t){"email"in t&&ba(t)}function wa(t){if(!t[ca])throw new Vr("internal-error")}function Ea(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new Vr("internal-error")}else{if(!t.sessionInfo)throw new Vr("missing-verification-id");if(!t.code)throw new Vr("missing-verification-code")}}sa.prototype.m=function(t,e,n,r,i){var o=this;ua.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:r,headers:i,authType:"none",callback:function(t){window.gapi.auth.setToken(a),e&&e(t)}})}).s(function(t){e&&e({error:{message:t&&t.message||"CORS_UNSUPPORTED"}})})},sa.prototype.Qa=function(){return is(this,Ya,{})},sa.prototype.pb=function(t,e){return is(this,za,{idToken:t,email:e})},sa.prototype.qb=function(t,e){return is(this,Ga,{idToken:t,password:e})};var Ta={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function Sa(t){if(!t.requestUri||!t.sessionId&&!t.postBody&&!t.pendingToken)throw new Vr("internal-error")}function Ca(t,e){return e.oauthIdToken&&e.providerId&&0==e.providerId.indexOf("oidc.")&&!e.pendingToken&&(t.sessionId?e.nonce=t.sessionId:t.postBody&&(cn(t=new on(t.postBody),"nonce")&&(e.nonce=t.get("nonce")))),e}function Ia(t){var e=null;if(t.needConfirmation?(t.code="account-exists-with-different-credential",e=ro(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=ro(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=ro(t)):t.errorMessage&&(e=os(t.errorMessage)),e)throw e;if(!t[ca])throw new Vr("internal-error")}function Na(t,e){return e.returnIdpCredential=!0,is(t,Xa,e)}function ka(t,e){return e.returnIdpCredential=!0,is(t,$a,e)}function Da(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,is(t,Ja,e)}function Aa(t){if(!t.oobCode)throw new Vr("invalid-action-code")}(t=sa.prototype).rb=function(t,e){var n={idToken:t},r=[];return rt(Ta,function(t,i){var o=e[i];null===o?r.push(t):i in e&&(n[i]=o)}),r.length&&(n.deleteAttribute=r),is(this,za,n)},t.kb=function(t,e){return ct(t={requestType:"PASSWORD_RESET",email:t},e),is(this,qa,t)},t.lb=function(t,e){return ct(t={requestType:"EMAIL_SIGNIN",email:t},e),is(this,Va,t)},t.jb=function(t,e){return ct(t={requestType:"VERIFY_EMAIL",idToken:t},e),is(this,Ba,t)},t.Ua=function(t){return is(this,es,t)},t.Za=function(t,e){return is(this,Qa,{oobCode:t,newPassword:e})},t.Ja=function(t){return is(this,Ra,{oobCode:t})},t.Wa=function(t){return is(this,Oa,{oobCode:t})};var Oa={endpoint:"setAccountInfo",B:Aa,da:"email"},Ra={endpoint:"resetPassword",B:Aa,J:function(t){var e=t.requestType;if(!e||!t.email&&"EMAIL_SIGNIN"!=e)throw new Vr("internal-error")}},Pa={endpoint:"signupNewUser",B:function(t){if(ba(t),!t.password)throw new Vr("weak-password")},J:wa,R:!0},xa={endpoint:"createAuthUri"},La={endpoint:"deleteAccount",T:["idToken"]},Ma={endpoint:"setAccountInfo",T:["idToken","deleteProvider"],B:function(t){if(!c(t.deleteProvider))throw new Vr("internal-error")}},Fa={endpoint:"emailLinkSignin",T:["email","oobCode"],B:ba,J:wa,R:!0},Ua={endpoint:"emailLinkSignin",T:["idToken","email","oobCode"],B:ba,J:wa,R:!0},ja={endpoint:"getAccountInfo"},Va={endpoint:"getOobConfirmationCode",T:["requestType"],B:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new Vr("internal-error");ba(t)},da:"email"},Ba={endpoint:"getOobConfirmationCode",T:["idToken","requestType"],B:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new Vr("internal-error")},da:"email"},qa={endpoint:"getOobConfirmationCode",T:["requestType"],B:function(t){if("PASSWORD_RESET"!=t.requestType)throw new Vr("internal-error");ba(t)},da:"email"},Wa={ub:!0,endpoint:"getProjectConfig",Ib:"GET"},Ka={ub:!0,endpoint:"getRecaptchaParam",Ib:"GET",J:function(t){if(!t.recaptchaSiteKey)throw new Vr("internal-error")}},Qa={endpoint:"resetPassword",B:Aa,da:"email"},Ha={endpoint:"sendVerificationCode",T:["phoneNumber","recaptchaToken"],da:"sessionInfo"},za={endpoint:"setAccountInfo",T:["idToken"],B:_a,R:!0},Ga={endpoint:"setAccountInfo",T:["idToken"],B:function(t){if(_a(t),!t.password)throw new Vr("weak-password")},J:wa,R:!0},Ya={endpoint:"signupNewUser",J:wa,R:!0},Xa={endpoint:"verifyAssertion",B:Sa,Oa:Ca,J:Ia,R:!0},Ja={endpoint:"verifyAssertion",B:Sa,Oa:Ca,J:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new Vr("user-not-found");if(t.errorMessage)throw os(t.errorMessage);if(!t[ca])throw new Vr("internal-error")},R:!0},$a={endpoint:"verifyAssertion",B:function(t){if(Sa(t),!t.idToken)throw new Vr("internal-error")},Oa:Ca,J:Ia,R:!0},Za={endpoint:"verifyCustomToken",B:function(t){if(!t.token)throw new Vr("invalid-custom-token")},J:wa,R:!0},ts={endpoint:"verifyPassword",B:function(t){if(ba(t),!t.password)throw new Vr("wrong-password")},J:wa,R:!0},es={endpoint:"verifyPhoneNumber",B:Ea,J:wa},ns={endpoint:"verifyPhoneNumber",B:function(t){if(!t.idToken)throw new Vr("internal-error");Ea(t)},J:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",ro(t);wa(t)}},rs={Xb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",B:Ea,J:wa};function is(t,e,n){if(!function(t,e){if(!e||!e.length)return!0;if(!t)return!1;for(var n=0;n<e.length;n++){var r=t[e[n]];if(void 0===r||null===r||""===r)return!1}return!0}(n,e.T))return Tt(new Vr("internal-error"));var r,i=e.Ib||"POST";return Et(n).then(e.B).then(function(){return e.R&&(n.returnSecureToken=!0),function(t,e,n,r,i,o){var a=Ge(t.g+e);He(a,"key",t.b),o&&He(a,"cb",b().toString());var s="GET"==n;if(s)for(var u in r)r.hasOwnProperty(u)&&He(a,u,r[u]);return new yt(function(e,o){ma(t,a.toString(),function(t){t?t.error?o(as(t,i||{})):e(t):o(new Vr("network-request-failed"))},n,s?void 0:Fn(dr(r)),t.a,t.h.get())})}(t,e.endpoint,i,n,e.Xb,e.ub||!1)}).then(function(t){return r=t,e.Oa?e.Oa(n,r):r}).then(e.J).then(function(){if(!e.da)return r;if(!(e.da in r))throw new Vr("internal-error");return r[e.da]})}function os(t){return as({error:{errors:[{message:t}],code:400,message:t}})}function as(t,e){var n=(t.error&&t.error.errors&&t.error.errors[0]||{}).reason||"",r={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(n=r[n]?new Vr(r[n]):null)return n;for(var i in n=t.error&&t.error.message||"",ct(r={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_OR_INVALID_NONCE:"missing-or-invalid-nonce",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",INVALID_PROVIDER_ID:"invalid-provider-id",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",REJECTED_CREDENTIAL:"rejected-credential",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_DYNAMIC_LINK_DOMAIN:"invalid-dynamic-link-domain",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash"},e||{}),e=(e=n.match(/^[^\s]+\s*:\s*(.*)$/))&&1<e.length?e[1]:void 0,r)if(0===n.indexOf(i))return new Vr(r[i],e);return!e&&t&&(e=pr(t)),new Vr("internal-error",e)}function ss(t){this.b=t,this.a=null,this.fb=function(t){return(hs||(hs=new yt(function(t,e){function r(){vr(),sr("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){vr(),e(Error("Network Error"))},timeout:cs.get()})}if(sr("gapi.iframes.Iframe"))t();else if(sr("gapi.load"))r();else{var i="__iframefcb"+Math.floor(1e6*Math.random()).toString();n[i]=function(){sr("gapi.load")?r():e(Error("Network Error"))},Et(ta(i=bn(us,{onload:i}))).s(function(){e(Error("Network Error"))})}}).s(function(t){throw hs=null,t}))).then(function(){return new yt(function(e,n){sr("gapi.iframes.getContext")().open({where:document.body,url:t.b,messageHandlersFilter:sr("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(r){function i(){clearTimeout(o),e()}t.a=r,t.a.restyle({setHideOnLeave:!1});var o=setTimeout(function(){n(Error("Network Error"))},ls.get());r.ping(i).then(i,function(){n(Error("Network Error"))})})})})}(this)}var us=mn("https://apis.google.com/js/api.js?onload=%{onload}"),cs=new br(3e4,6e4),ls=new br(5e3,15e3),hs=null;function fs(t,e,n){this.i=t,this.g=e,this.h=n,this.f=null,this.a=Ye(this.i,"/__/auth/iframe"),He(this.a,"apiKey",this.g),He(this.a,"appName",this.h),this.b=null,this.c=[]}function ps(t,e,n,r,i){this.o=t,this.m=e,this.c=n,this.l=r,this.h=this.g=this.i=null,this.a=i,this.f=null}function ds(t){try{return r.a.app(t).auth().ya()}catch(e){return[]}}function ys(t,e,n,r,i){this.m=t,this.f=e,this.b=n,this.c=r||null,this.h=i||null,this.o=this.u=this.v=null,this.g=[],this.l=this.a=null}function ms(t){var e=Wn();return function(t){return is(t,Wa,{}).then(function(t){return t.authorizedDomains||[]})}(t).then(function(t){t:{var n=Ge(e),r=n.c;n=n.b;for(var i=0;i<t.length;i++){var o=t[i],a=n,s=r;if(0==o.indexOf("chrome-extension://")?a=Ge(o).b==a&&"chrome-extension"==s:"http"!=s&&"https"!=s?a=!1:Gn.test(o)?a=a==o:(o=o.split(".").join("\\."),a=new RegExp("^(.+\\."+o+"|"+o+")$","i").test(a)),a){t=!0;break t}}t=!1}if(!t)throw new eo(Wn())})}function gs(t){return t.l?t.l:(t.l=Yn().then(function(){if(!t.u){var e=t.c,n=t.h,r=ds(t.b),i=new fs(t.m,t.f,t.b);i.f=e,i.b=n,i.c=V(r||[]),t.u=i.toString()}t.i=new ss(t.u),function(t){if(!t.i)throw Error("IfcHandler must be initialized!");!function(t,e){t.fb.then(function(){t.a.register("authEvent",e,sr("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}(t.i,function(e){var n={};if(e&&e.authEvent){var r=!1;for(e=$i(e.authEvent),n=0;n<t.g.length;n++)r=t.g[n](e)||r;return(n={}).status=r?"ACK":"ERROR",Et(n)}return n.status="ERROR",Et(n)})}(t)}),t.l)}function vs(t){return t.o||(t.v=t.c?or(t.c,ds(t.b)):null,t.o=new sa(t.f,ci(t.h),t.v)),t.o}function bs(t,e,n,r,i,o,a,s,u,c){return(t=new ps(t,e,n,r,i)).i=o,t.g=a,t.h=s,t.b=ot(u||null),t.f=c,t.toString()}function _s(t){if(this.a=t||r.a.INTERNAL.reactNative&&r.a.INTERNAL.reactNative.AsyncStorage,!this.a)throw new Vr("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function ws(t){this.b=t,this.a={},this.c=g(this.f,this)}fs.prototype.toString=function(){return this.f?He(this.a,"v",this.f):un(this.a.a,"v"),this.b?He(this.a,"eid",this.b):un(this.a.a,"eid"),this.c.length?He(this.a,"fw",this.c.join(",")):un(this.a.a,"fw"),this.a.toString()},ps.prototype.toString=function(){var t=Ye(this.o,"/__/auth/handler");if(He(t,"apiKey",this.m),He(t,"appName",this.c),He(t,"authType",this.l),this.a.isOAuthProvider){var e=this.a;try{var n=r.a.app(this.c).auth().ea()}catch(u){n=null}for(var i in e.$a=n,He(t,"providerId",this.a.providerId),n=dr((e=this.a).yb))n[i]=n[i].toString();i=e.Dc,n=ot(n);for(var o=0;o<i.length;o++){var a=i[o];a in n&&delete n[a]}e.cb&&e.$a&&!n[e.cb]&&(n[e.cb]=e.$a),it(n)||He(t,"customParameters",pr(n))}if("function"===typeof this.a.Eb&&((e=this.a.Eb()).length&&He(t,"scopes",e.join(","))),this.i?He(t,"redirectUrl",this.i):un(t.a,"redirectUrl"),this.g?He(t,"eventId",this.g):un(t.a,"eventId"),this.h?He(t,"v",this.h):un(t.a,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!ze(t,s)&&He(t,s,this.b[s]);return this.f?He(t,"eid",this.f):un(t.a,"eid"),(s=ds(this.c)).length&&He(t,"fw",s.join(",")),t.toString()},(t=ys.prototype).Ea=function(t,e,n){var r=new Vr("popup-closed-by-user"),i=new Vr("web-storage-unsupported"),o=this,a=!1;return this.ga().then(function(){(function(t){var e={type:"webStorageSupport"};return gs(t).then(function(){return function(t,e){return t.fb.then(function(){return new yt(function(n){t.a.send(e.type,e,n,sr("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})})}(t.i,e)}).then(function(t){if(t&&t.length&&"undefined"!==typeof t[0].webStorageSupport)return t[0].webStorageSupport;throw Error()})})(o).then(function(n){n||(t&&Hn(t),e(i),a=!0)})}).s(function(){}).then(function(){if(!a)return function(t){return new yt(function(e){return function n(){Le(2e3).then(function(){if(t&&!t.closed)return n();e()})}()})}(t)}).then(function(){if(!a)return Le(n).then(function(){e(r)})})},t.Mb=function(){var t=ar();return!fr(t)&&!gr(t)},t.Hb=function(){return!1},t.Cb=function(t,e,n,r,i,o,a){if(!t)return Tt(new Vr("popup-blocked"));if(a&&!fr())return this.ga().s(function(e){Hn(t),i(e)}),r(),Et();this.a||(this.a=ms(vs(this)));var s=this;return this.a.then(function(){var e=s.ga().s(function(e){throw Hn(t),i(e),e});return r(),e}).then(function(){(Xi(n),a)||Kn(bs(s.m,s.f,s.b,e,n,null,o,s.c,void 0,s.h),t)}).s(function(t){throw"auth/network-request-failed"==t.code&&(s.a=null),t})},t.Ca=function(t,e,n){this.a||(this.a=ms(vs(this)));var r=this;return this.a.then(function(){Xi(e),Kn(bs(r.m,r.f,r.b,t,e,Wn(),n,r.c,void 0,r.h))}).s(function(t){throw"auth/network-request-failed"==t.code&&(r.a=null),t})},t.ga=function(){var t=this;return gs(this).then(function(){return t.i.fb}).s(function(){throw t.a=null,new Vr("network-request-failed")})},t.Qb=function(){return!0},t.wa=function(t){this.g.push(t)},t.Ka=function(t){U(this.g,function(e){return e==t})},(t=_s.prototype).get=function(t){return Et(this.a.getItem(t)).then(function(t){return t&&yr(t)})},t.set=function(t,e){return Et(this.a.setItem(t,pr(e)))},t.P=function(t){return Et(this.a.removeItem(t))},t.Y=function(){},t.ca=function(){};var Es,Ts=[];function Ss(t){this.a=t}function Cs(t){this.c=t,this.b=!1,this.a=[]}function Is(t,e,n,r){var i,o,a,s,u=n||{},c=null;if(t.b)return Tt(Error("connection_unavailable"));var l=r?800:50,h="undefined"!==typeof MessageChannel?new MessageChannel:null;return new yt(function(n,r){h?(i=Math.floor(Math.random()*Math.pow(10,20)).toString(),h.port1.start(),a=setTimeout(function(){r(Error("unsupported_event"))},l),c={messageChannel:h,onMessage:o=function(t){t.data.eventId===i&&("ack"===t.data.status?(clearTimeout(a),s=setTimeout(function(){r(Error("timeout"))},3e3)):"done"===t.data.status?(clearTimeout(s),"undefined"!==typeof t.data.response?n(t.data.response):r(Error("unknown_error"))):(clearTimeout(a),clearTimeout(s),r(Error("invalid_response"))))}},t.a.push(c),h.port1.addEventListener("message",o),t.c.postMessage({eventType:e,eventId:i,data:u},[h.port2])):r(Error("connection_unavailable"))}).then(function(e){return Ns(t,c),e}).s(function(e){throw Ns(t,c),e})}function Ns(t,e){if(e){var n=e.messageChannel,r=e.onMessage;n&&(n.port1.removeEventListener("message",r),n.port1.close()),U(t.a,function(t){return t==e})}}function ks(){if(!Os())throw new Vr("web-storage-unsupported");this.c={},this.a=[],this.b=0,this.m=n.indexedDB,this.type="indexedDB",this.g=this.l=this.f=this.i=null,this.u=!1,this.h=null;var t=this;$n()&&self?(this.l=function(){var t=$n()?self:null;if(P(Ts,function(n){n.b==t&&(e=n)}),!e){var e=new ws(t);Ts.push(e)}return e}(),this.l.subscribe("keyChanged",function(e,n){return Ms(t).then(function(e){return 0<e.length&&P(t.a,function(t){t(e)}),{keyProcessed:M(e,n.key)}})}),this.l.subscribe("ping",function(){return Et(["keyChanged"])})):function(){var t=n.navigator;return t&&t.serviceWorker?Et().then(function(){return t.serviceWorker.ready}).then(function(t){return t.active||null}).s(function(){return null}):Et(null)}().then(function(e){(t.h=e)&&(t.g=new Cs(new Ss(e)),Is(t.g,"ping",null,!0).then(function(e){e[0].fulfilled&&M(e[0].value,"keyChanged")&&(t.u=!0)}).s(function(){}))})}function Ds(t){return new yt(function(e,n){var r=t.m.open("firebaseLocalStorageDb",1);r.onerror=function(t){try{t.preventDefault()}catch(e){}n(Error(t.target.error))},r.onupgradeneeded=function(t){t=t.target.result;try{t.createObjectStore("firebaseLocalStorage",{keyPath:"fbase_key"})}catch(e){n(e)}},r.onsuccess=function(r){(r=r.target.result).objectStoreNames.contains("firebaseLocalStorage")?e(r):function(t){return new yt(function(e,n){var r=t.m.deleteDatabase("firebaseLocalStorageDb");r.onsuccess=function(){e()},r.onerror=function(t){n(Error(t.target.error))}})}(t).then(function(){return Ds(t)}).then(function(t){e(t)}).s(function(t){n(t)})}})}function As(t){return t.o||(t.o=Ds(t)),t.o}function Os(){try{return!!n.indexedDB}catch(wo){return!1}}function Rs(t){return t.objectStore("firebaseLocalStorage")}function Ps(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function xs(t){return new yt(function(e,n){t.onsuccess=function(t){t&&t.target?e(t.target.result):e()},t.onerror=function(t){n(t.target.error)}})}function Ls(t,e){return t.g&&t.h&&function(){var t=n.navigator;return t&&t.serviceWorker&&t.serviceWorker.controller||null}()===t.h?Is(t.g,"keyChanged",{key:e},t.u).then(function(){}).s(function(){}):Et()}function Ms(t){return As(t).then(function(t){var e=Rs(Ps(t,!1));return e.getAll?xs(e.getAll()):new yt(function(t,n){var r=[],i=e.openCursor();i.onsuccess=function(e){(e=e.target.result)?(r.push(e.value),e.continue()):t(r)},i.onerror=function(t){n(t.target.error)}})}).then(function(e){var n={},r=[];if(0==t.b){for(r=0;r<e.length;r++)n[e[r].fbase_key]=e[r].value;r=function t(e,n){var r,i=[];for(r in e)r in n?typeof e[r]!=typeof n[r]?i.push(r):"object"==typeof e[r]&&null!=e[r]&&null!=n[r]?0<t(e[r],n[r]).length&&i.push(r):e[r]!==n[r]&&i.push(r):i.push(r);for(r in n)r in e||i.push(r);return i}(t.c,n),t.c=n}return r})}function Fs(t){t.i&&t.i.cancel("STOP_EVENT"),t.f&&(clearTimeout(t.f),t.f=null)}function Us(t){var e=this,n=null;this.a=[],this.type="indexedDB",this.c=t,this.b=Et().then(function(){if(Os()){var t=mr(),r="__sak"+t;return Es||(Es=new ks),(n=Es).set(r,t).then(function(){return n.get(r)}).then(function(e){if(e!==t)throw Error("indexedDB not supported!");return n.P(r)}).then(function(){return n}).s(function(){return e.c})}return e.c}).then(function(t){return e.type=t.type,t.Y(function(t){P(e.a,function(e){e(t)})}),t})}function js(){this.a={},this.type="inMemory"}function Vs(){if(!function(){var t="Node"==Zn();if(!(t=Bs()||t&&r.a.INTERNAL.node&&r.a.INTERNAL.node.localStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(e){return!1}}()){if("Node"==Zn())throw new Vr("internal-error","The LocalStorage compatibility library was not found.");throw new Vr("web-storage-unsupported")}this.a=Bs()||r.a.INTERNAL.node.localStorage,this.type="localStorage"}function Bs(){try{var t=n.localStorage,e=mr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(r){return null}}function qs(){this.type="nullStorage"}function Ws(){if(!function(){var t="Node"==Zn();if(!(t=Ks()||t&&r.a.INTERNAL.node&&r.a.INTERNAL.node.sessionStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(e){return!1}}()){if("Node"==Zn())throw new Vr("internal-error","The SessionStorage compatibility library was not found.");throw new Vr("web-storage-unsupported")}this.a=Ks()||r.a.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function Ks(){try{var t=n.sessionStorage,e=mr();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(r){return null}}function Qs(){var t={};t.Browser=Gs,t.Node=Ys,t.ReactNative=Xs,t.Worker=Js,this.a=t[Zn()]}ws.prototype.f=function(t){var e=t.data.eventType,n=t.data.eventId,r=this.a[e];if(r&&0<r.length){t.ports[0].postMessage({status:"ack",eventId:n,eventType:e,response:null});var i=[];P(r,function(e){i.push(Et().then(function(){return e(t.origin,t.data.data)}))}),Ct(i).then(function(r){var i=[];P(r,function(t){i.push({fulfilled:t.Db,value:t.value,reason:t.reason?t.reason.message:void 0})}),P(i,function(t){for(var e in t)"undefined"===typeof t[e]&&delete t[e]}),t.ports[0].postMessage({status:"done",eventId:n,eventType:e,response:i})})}},ws.prototype.subscribe=function(t,e){it(this.a)&&this.b.addEventListener("message",this.c),"undefined"===typeof this.a[t]&&(this.a[t]=[]),this.a[t].push(e)},ws.prototype.unsubscribe=function(t,e){"undefined"!==typeof this.a[t]&&e?(U(this.a[t],function(t){return t==e}),0==this.a[t].length&&delete this.a[t]):e||delete this.a[t],it(this.a)&&this.b.removeEventListener("message",this.c)},Ss.prototype.postMessage=function(t,e){this.a.postMessage(t,e)},Cs.prototype.close=function(){for(;0<this.a.length;)Ns(this,this.a[0]);this.b=!0},(t=ks.prototype).set=function(t,e){var n,r=!1,i=this;return As(this).then(function(e){return xs((e=Rs(Ps(n=e,!0))).get(t))}).then(function(o){var a=Rs(Ps(n,!0));return o?(o.value=e,xs(a.put(o))):(i.b++,r=!0,(o={}).fbase_key=t,o.value=e,xs(a.add(o)))}).then(function(){return i.c[t]=e,Ls(i,t)}).ia(function(){r&&i.b--})},t.get=function(t){return As(this).then(function(e){return xs(Rs(Ps(e,!1)).get(t))}).then(function(t){return t&&t.value})},t.P=function(t){var e=!1,n=this;return As(this).then(function(r){return e=!0,n.b++,xs(Rs(Ps(r,!0)).delete(t))}).then(function(){return delete n.c[t],Ls(n,t)}).ia(function(){e&&n.b--})},t.Y=function(t){0==this.a.length&&function(t){Fs(t),function e(){t.f=setTimeout(function(){t.i=Ms(t).then(function(e){0<e.length&&P(t.a,function(t){t(e)})}).then(function(){e()}).s(function(t){"STOP_EVENT"!=t.message&&e()})},800)}()}(this),this.a.push(t)},t.ca=function(t){U(this.a,function(e){return e==t}),0==this.a.length&&Fs(this)},(t=Us.prototype).get=function(t){return this.b.then(function(e){return e.get(t)})},t.set=function(t,e){return this.b.then(function(n){return n.set(t,e)})},t.P=function(t){return this.b.then(function(e){return e.P(t)})},t.Y=function(t){this.a.push(t)},t.ca=function(t){U(this.a,function(e){return e==t})},(t=js.prototype).get=function(t){return Et(this.a[t])},t.set=function(t,e){return this.a[t]=e,Et()},t.P=function(t){return delete this.a[t],Et()},t.Y=function(){},t.ca=function(){},(t=Vs.prototype).get=function(t){var e=this;return Et().then(function(){return yr(e.a.getItem(t))})},t.set=function(t,e){var n=this;return Et().then(function(){var r=pr(e);null===r?n.P(t):n.a.setItem(t,r)})},t.P=function(t){var e=this;return Et().then(function(){e.a.removeItem(t)})},t.Y=function(t){n.window&&ve(n.window,"storage",t)},t.ca=function(t){n.window&&we(n.window,"storage",t)},(t=qs.prototype).get=function(){return Et(null)},t.set=function(){return Et()},t.P=function(){return Et()},t.Y=function(){},t.ca=function(){},(t=Ws.prototype).get=function(t){var e=this;return Et().then(function(){return yr(e.a.getItem(t))})},t.set=function(t,e){var n=this;return Et().then(function(){var r=pr(e);null===r?n.P(t):n.a.setItem(t,r)})},t.P=function(t){var e=this;return Et().then(function(){e.a.removeItem(t)})},t.Y=function(){},t.ca=function(){};var Hs,zs,Gs={A:Vs,Ra:Ws},Ys={A:Vs,Ra:Ws},Xs={A:_s,Ra:qs},Js={A:Vs,Ra:qs},$s={Zc:"local",NONE:"none",ad:"session"};function Zs(){var t=!(gr(ar())||!Jn()),e=fr(),r=ur();this.o=t,this.h=e,this.l=r,this.a={},Hs||(Hs=new Qs),t=Hs;try{this.g=!qn()&&Er()||!n.indexedDB?new t.a.A:new Us($n()?new js:new t.a.A)}catch(i){this.g=new js,this.h=!0}try{this.i=new t.a.Ra}catch(i){this.i=new js}this.m=new js,this.f=g(this.Pb,this),this.b={}}function tu(){return zs||(zs=new Zs),zs}function eu(t,e){switch(e){case"session":return t.i;case"none":return t.m;default:return t.g}}function nu(t,e){return"firebase:"+t.name+(e?":"+e:"")}function ru(t,e,n){return n=nu(e,n),"local"==e.A&&(t.b[n]=null),eu(t,e.A).P(n)}function iu(t){t.c&&(clearInterval(t.c),t.c=null)}function ou(t){this.a=t,this.b=tu()}(t=Zs.prototype).get=function(t,e){return eu(this,t.A).get(nu(t,e))},t.set=function(t,e,n){var r=nu(t,n),i=this,o=eu(this,t.A);return o.set(r,e).then(function(){return o.get(r)}).then(function(e){"local"==t.A&&(i.b[r]=e)})},t.addListener=function(t,e,r){t=nu(t,e),this.l&&(this.b[t]=n.localStorage.getItem(t)),it(this.a)&&(eu(this,"local").Y(this.f),this.h||(qn()||!Er())&&n.indexedDB||!this.l||function(t){iu(t),t.c=setInterval(function(){for(var e in t.a){var r=n.localStorage.getItem(e),i=t.b[e];r!=i&&(t.b[e]=r,r=new se({type:"storage",key:e,target:window,oldValue:i,newValue:r,a:!0}),t.Pb(r))}},1e3)}(this)),this.a[t]||(this.a[t]=[]),this.a[t].push(r)},t.removeListener=function(t,e,n){t=nu(t,e),this.a[t]&&(U(this.a[t],function(t){return t==n}),0==this.a[t].length&&delete this.a[t]),it(this.a)&&(eu(this,"local").ca(this.f),iu(this))},t.Pb=function(t){if(t&&t.f){var e=t.a.key;if(null==e)for(var r in this.a){var i=this.b[r];"undefined"===typeof i&&(i=null);var o=n.localStorage.getItem(r);o!==i&&(this.b[r]=o,this.Xa(r))}else if(0==e.indexOf("firebase:")&&this.a[e]){if("undefined"!==typeof t.a.a?eu(this,"local").ca(this.f):iu(this),this.o)if(r=n.localStorage.getItem(e),(i=t.a.newValue)!==r)null!==i?n.localStorage.setItem(e,i):n.localStorage.removeItem(e);else if(this.b[e]===i&&"undefined"===typeof t.a.a)return;var a=this;r=function(){"undefined"===typeof t.a.a&&a.b[e]===n.localStorage.getItem(e)||(a.b[e]=n.localStorage.getItem(e),a.Xa(e))},Wt&&$t&&10==$t&&n.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(r,10):r()}}else P(t,g(this.Xa,this))},t.Xa=function(t){this.a[t]&&P(this.a[t],function(t){t()})};var au,su={name:"authEvent",A:"local"};function uu(){this.a=tu()}function cu(t,e){this.b=lu,this.f=n.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=t,this.h=e,this.l=n.Int32Array?new Int32Array(64):Array(64),void 0!==au||(au=n.Int32Array?new Int32Array(gu):gu),this.reset()}_(cu,function(){this.b=-1});for(var lu=64,hu=lu-1,fu=[],pu=0;pu<hu;pu++)fu[pu]=0;var du=j(128,fu);function yu(t){for(var e=t.f,n=t.l,r=0,i=0;i<e.length;)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3],i=4*r;for(e=16;64>e;e++){i=0|n[e-15],r=0|n[e-2];var o=(0|n[e-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,a=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+a|0}r=0|t.a[0],i=0|t.a[1];var s=0|t.a[2],u=0|t.a[3],c=0|t.a[4],l=0|t.a[5],h=0|t.a[6];for(o=0|t.a[7],e=0;64>e;e++){var f=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&s^i&s)|0;a=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((a=(a=c&l^~c&h)+(0|au[e])|0)+(0|n[e])|0)|0,o=h,h=l,l=c,c=u+a|0,u=s,s=i,i=r,r=a+f|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|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]+l|0,t.a[6]=t.a[6]+h|0,t.a[7]=t.a[7]+o|0}function mu(t,e,n){void 0===n&&(n=e.length);var r=0,o=t.c;if(i(e))for(;r<n;)t.f[o++]=e.charCodeAt(r++),o==t.b&&(yu(t),o=0);else{if(!l(e))throw Error("message must be string or array");for(;r<n;){var a=e[r++];if(!("number"==typeof a&&0<=a&&255>=a&&a==(0|a)))throw Error("message must be a byte array");t.f[o++]=a,o==t.b&&(yu(t),o=0)}}t.c=o,t.g+=n}cu.prototype.reset=function(){this.g=this.c=0,this.a=n.Int32Array?new Int32Array(this.h):V(this.h)};var gu=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function vu(){cu.call(this,8,bu)}_(vu,cu);var bu=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function _u(t,e,n,r,i){this.m=t,this.i=e,this.l=n,this.o=r||null,this.u=i||null,this.h=e+":"+n,this.v=new uu,this.g=new ou(this.h),this.f=null,this.b=[],this.a=this.c=null}function wu(t){return new Vr("invalid-cordova-configuration",t)}function Eu(t){var e=new vu;mu(e,t),t=[];var n=8*e.g;56>e.c?mu(e,du,56-e.c):mu(e,du,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(yu(e),r=n=0;r<e.i;r++)for(var i=24;0<=i;i-=8)t[n++]=e.a[r]>>i&255;return function(t){return x(t,function(t){return 1<(t=t.toString(16)).length?t:"0"+t}).join("")}(t)}function Tu(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(r){}}function Su(t){return t.f||(t.f=t.ga().then(function(){return new yt(function(e){t.wa(function n(r){return e(r),t.Ka(n),!1}),function(t){function e(e){i=!0,o&&o.cancel(),Cu(t).then(function(n){var i=r;if(n&&e&&e.url){var o=null;-1!=(i=Si(e.url)).indexOf("/__/auth/callback")&&(o=(o="object"===typeof(o=yr(ze(o=Ge(i),"firebaseError")||null))?Br(o):null)?new Ji(n.b,n.c,null,null,o):new Ji(n.b,n.c,i,n.g)),i=o||r}Tu(t,i)})}var r=new Ji("unknown",null,null,null,new Vr("no-auth-event")),i=!1,o=Le(500).then(function(){return Cu(t).then(function(){i||Tu(t,r)})}),a=n.handleOpenURL;n.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(sr("BuildInfo.packageName",n).toLowerCase()+"://")&&e({url:t}),"function"===typeof a)try{a(t)}catch(r){console.error(r)}},to||(to=new Zi),to.subscribe(e)}(t)})})),t.f}function Cu(t){var e=null;return function(t){return t.b.get(su,t.a).then(function(t){return $i(t)})}(t.g).then(function(n){return e=n,ru((n=t.g).b,su,n.a)}).then(function(){return e})}function Iu(t){this.a=t,this.b=tu()}(t=_u.prototype).ga=function(){return this.za?this.za:this.za=(Xn(void 0)?Yn().then(function(){return new yt(function(t,e){var r=n.document,i=setTimeout(function(){e(Error("Cordova framework is not ready."))},1e3);r.addEventListener("deviceready",function(){clearTimeout(i),t()},!1)})}):Tt(Error("Cordova must run in an Android or iOS file scheme."))).then(function(){if("function"!==typeof sr("universalLinks.subscribe",n))throw wu("cordova-universal-links-plugin-fix is not installed");if("undefined"===typeof sr("BuildInfo.packageName",n))throw wu("cordova-plugin-buildinfo is not installed");if("function"!==typeof sr("cordova.plugins.browsertab.openUrl",n))throw wu("cordova-plugin-browsertab is not installed");if("function"!==typeof sr("cordova.InAppBrowser.open",n))throw wu("cordova-plugin-inappbrowser is not installed")},function(){throw new Vr("cordova-not-ready")})},t.Ea=function(t,e){return e(new Vr("operation-not-supported-in-this-environment")),Et()},t.Cb=function(){return Tt(new Vr("operation-not-supported-in-this-environment"))},t.Qb=function(){return!1},t.Mb=function(){return!0},t.Hb=function(){return!0},t.Ca=function(t,e,r){if(this.c)return Tt(new Vr("redirect-operation-pending"));var i=this,o=n.document,a=null,s=null,u=null,c=null;return this.c=Et().then(function(){return Xi(e),Su(i)}).then(function(){return function(t,e,r,i){var o=function(){for(var t=20,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}(),a=new Ji(e,i,null,o,new Vr("no-auth-event")),s=sr("BuildInfo.packageName",n);if("string"!==typeof s)throw new Vr("invalid-cordova-configuration");var u=sr("BuildInfo.displayName",n),c={};if(ar().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=s;else{if(!ar().toLowerCase().match(/android/))return Tt(new Vr("operation-not-supported-in-this-environment"));c.apn=s}u&&(c.appDisplayName=u),o=Eu(o),c.sessionId=o;var l=bs(t.m,t.i,t.l,e,r,null,i,t.o,c,t.u);return t.ga().then(function(){var e=t.h;return t.v.a.set(su,a.C(),e)}).then(function(){var e=sr("cordova.plugins.browsertab.isAvailable",n);if("function"!==typeof e)throw new Vr("invalid-cordova-configuration");var r=null;e(function(e){if(e){if("function"!==typeof(r=sr("cordova.plugins.browsertab.openUrl",n)))throw new Vr("invalid-cordova-configuration");r(l)}else{if("function"!==typeof(r=sr("cordova.InAppBrowser.open",n)))throw new Vr("invalid-cordova-configuration");e=!(!(e=ar()).match(/(iPad|iPhone|iPod).*OS 7_\d/i)&&!e.match(/(iPad|iPhone|iPod).*OS 8_\d/i)),t.a=r(l,e?"_blank":"_system","location=yes")}})})}(i,t,e,r)}).then(function(){return new yt(function(t,e){s=function(){var e=sr("cordova.plugins.browsertab.close",n);return t(),"function"===typeof e&&e(),i.a&&"function"===typeof i.a.close&&(i.a.close(),i.a=null),!1},i.wa(s),u=function(){a||(a=Le(2e3).then(function(){e(new Vr("redirect-cancelled-by-user"))}))},c=function(){_r()&&u()},o.addEventListener("resume",u,!1),ar().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",c,!1)}).s(function(t){return Cu(i).then(function(){throw t})})}).ia(function(){u&&o.removeEventListener("resume",u,!1),c&&o.removeEventListener("visibilitychange",c,!1),a&&a.cancel(),s&&i.Ka(s),i.c=null})},t.wa=function(t){this.b.push(t),Su(this).s(function(e){"auth/invalid-cordova-configuration"===e.code&&(e=new Ji("unknown",null,null,null,new Vr("no-auth-event")),t(e))})},t.Ka=function(t){U(this.b,function(e){return e==t})};var Nu={name:"pendingRedirect",A:"session"};function ku(t){return ru(t.b,Nu,t.a)}function Du(t,e,n){this.u=t,this.l=e,this.m=n,this.h=[],this.f=!1,this.i=g(this.bb,this),this.b=new ju,this.o=new Wu,this.g=new Iu(this.l+":"+this.m),this.c={},this.c.unknown=this.b,this.c.signInViaRedirect=this.b,this.c.linkViaRedirect=this.b,this.c.reauthViaRedirect=this.b,this.c.signInViaPopup=this.o,this.c.linkViaPopup=this.o,this.c.reauthViaPopup=this.o,this.a=Au(this.u,this.l,this.m,si)}function Au(t,e,n,i){var o=r.a.SDK_VERSION||null;return Xn()?new _u(t,e,n,o,i):new ys(t,e,n,o,i)}function Ou(t){t.f||(t.f=!0,t.a.wa(t.i));var e=t.a;return t.a.ga().s(function(n){throw t.a==e&&t.reset(),n})}function Ru(t){t.a.Mb()&&Ou(t).s(function(e){var n=new Ji("unknown",null,null,null,new Vr("operation-not-supported-in-this-environment"));Mu(e)&&t.bb(n)}),t.a.Hb()||Vu(t.b)}(t=Du.prototype).reset=function(){this.f=!1,this.a.Ka(this.i),this.a=Au(this.u,this.l,this.m)},t.Ya=function(){this.b.Ya()},t.subscribe=function(t){if(M(this.h,t)||this.h.push(t),!this.f){var e=this;(function(t){return t.b.get(Nu,t.a).then(function(t){return"pending"==t})})(this.g).then(function(t){t?ku(e.g).then(function(){Ou(e).s(function(t){var n=new Ji("unknown",null,null,null,new Vr("operation-not-supported-in-this-environment"));Mu(t)&&e.bb(n)})}):Ru(e)}).s(function(){Ru(e)})}},t.unsubscribe=function(t){U(this.h,function(e){return e==t})},t.bb=function(t){if(!t)throw new Vr("invalid-auth-event");for(var e=!1,n=0;n<this.h.length;n++){var r=this.h[n];if(r.vb(t.b,t.c)){(e=this.c[t.b])&&e.h(t,r),e=!0;break}}return Vu(this.b),e};var Pu=new br(2e3,1e4),xu=new br(3e4,6e4);function Lu(t,e,n,r,i,o){return t.a.Cb(e,n,r,function(){t.f||(t.f=!0,t.a.wa(t.i))},function(){t.reset()},i,o)}function Mu(t){return!(!t||"auth/cordova-not-ready"!=t.code)}Du.prototype.fa=function(){return this.b.fa()},Du.prototype.Ca=function(t,e,n){var r,i=this;return function(t){return t.b.set(Nu,"pending",t.a)}(this.g).then(function(){return i.a.Ca(t,e,n).s(function(t){if(Mu(t))throw new Vr("operation-not-supported-in-this-environment");return r=t,ku(i.g).then(function(){throw r})}).then(function(){return i.a.Qb()?new yt(function(){}):ku(i.g).then(function(){return i.fa()}).then(function(){}).s(function(){})})})},Du.prototype.Ea=function(t,e,n,r){return this.a.Ea(n,function(n){t.ha(e,null,n,r)},Pu.get())};var Fu={};function Uu(t,e,n){var r=e+":"+n;return Fu[r]||(Fu[r]=new Du(t,e,n)),Fu[r]}function ju(){this.b=null,this.f=[],this.c=[],this.a=null,this.i=this.g=!1}function Vu(t){t.g||(t.g=!0,qu(t,!1,null,null))}function Bu(t,e){if(t.b=function(){return Et(e)},t.f.length)for(var n=0;n<t.f.length;n++)t.f[n](e)}function qu(t,e,n,r){e?r?function(t,e){if(t.b=function(){return Tt(e)},t.c.length)for(var n=0;n<t.c.length;n++)t.c[n](e)}(t,r):Bu(t,n):Bu(t,{user:null}),t.f=[],t.c=[]}function Wu(){}function Ku(){this.sb=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.sb},set:function(t){this.sb=t},enumerable:!1})}function Qu(t,e){this.a=e,Nr(this,"verificationId",t)}function Hu(t,e,n,r){return new zi(t).Ua(e,n).then(function(t){return new Qu(t,r)})}function zu(t){var e=ai(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new Vr("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");kr(this,{token:t,expirationTime:wr(1e3*e.exp),authTime:wr(1e3*e.auth_time),issuedAtTime:wr(1e3*e.iat),signInProvider:e.firebase&&e.firebase.sign_in_provider?e.firebase.sign_in_provider:null,claims:e})}function Gu(t,e,n){if(this.h=t,this.i=e,this.g=n,this.c=3e4,this.f=96e4,this.b=null,this.a=this.c,this.f<this.c)throw Error("Proactive refresh lower bound greater than upper bound!")}function Yu(t){this.f=t,this.b=this.a=null,this.c=0}function Xu(t,e){var n=e[ca],r=e.refreshToken;e=Ju(e.expiresIn),t.b=n,t.c=e,t.a=r}function Ju(t){return b()+1e3*parseInt(t,10)}function $u(t,e){return function(t,e){return new yt(function(n,r){"refresh_token"==e.grant_type&&e.refresh_token||"authorization_code"==e.grant_type&&e.code?ma(t,t.i+"?key="+encodeURIComponent(t.b),function(t){t?t.error?r(as(t)):t.access_token&&t.refresh_token?n(t):r(new Vr("internal-error")):r(new Vr("network-request-failed"))},"POST",sn(e).toString(),t.f,t.l.get()):r(new Vr("internal-error"))})}(t.f,e).then(function(e){return t.b=e.access_token,t.c=Ju(e.expires_in),t.a=e.refresh_token,{accessToken:t.b,expirationTime:t.c,refreshToken:t.a}}).s(function(e){throw"auth/user-token-expired"==e.code&&(t.a=null),e})}function Zu(t,e){this.a=t||null,this.b=e||null,kr(this,{lastSignInTime:wr(e||null),creationTime:wr(t||null)})}function tc(t,e,n,r,i,o){kr(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function ec(t,e){for(var n in ae.call(this,t),e)this[n]=e[n]}function nc(t,e,n){this.G=[],this.m=t.apiKey,this.o=t.appName,this.u=t.authDomain||null,t=r.a.SDK_VERSION?or(r.a.SDK_VERSION):null,this.b=new sa(this.m,ci(si),t),this.h=new Yu(this.b),cc(this,e[ca]),Xu(this.h,e),Nr(this,"refreshToken",this.h.a),fc(this,n||{}),Ae.call(this),this.I=!1,this.u&&cr()&&(this.a=Uu(this.u,this.m,this.o)),this.N=[],this.i=null,this.w=function(t){return new Gu(function(){return t.F(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var e=t.h.c-b()-3e5;return 0<e?e:0})}(this),this.V=g(this.Ha,this);var i=this;this.ka=null,this.ta=function(t){i.pa(t.g)},this.X=null,this.O=[],this.sa=function(t){ic(i,t.c)},this.W=null}function rc(t,e){t.X&&we(t.X,"languageCodeChanged",t.ta),(t.X=e)&&ve(e,"languageCodeChanged",t.ta)}function ic(t,e){t.O=e,ya(t.b,r.a.SDK_VERSION?or(r.a.SDK_VERSION,t.O):null)}function oc(t,e){t.W&&we(t.W,"frameworkChanged",t.sa),(t.W=e)&&ve(e,"frameworkChanged",t.sa)}function ac(t){try{return r.a.app(t.o).auth()}catch(e){throw new Vr("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+t.o+"'!")}}function sc(t){t.D||t.w.b||(t.w.start(),we(t,"tokenChanged",t.V),ve(t,"tokenChanged",t.V))}function uc(t){we(t,"tokenChanged",t.V),t.w.stop()}function cc(t,e){t.ra=e,Nr(t,"_lat",e)}function lc(t){for(var e=[],n=0;n<t.N.length;n++)e.push(t.N[n](t));return Ct(e).then(function(){return t})}function hc(t){t.a&&!t.I&&(t.I=!0,t.a.subscribe(t))}function fc(t,e){kr(t,{uid:e.uid,displayName:e.displayName||null,photoURL:e.photoURL||null,email:e.email||null,emailVerified:e.emailVerified||!1,phoneNumber:e.phoneNumber||null,isAnonymous:e.isAnonymous||!1,metadata:new Zu(e.createdAt,e.lastLoginAt),providerData:[]})}function pc(){}function dc(t){return Et().then(function(){if(t.D)throw new Vr("app-deleted")})}function yc(t){return x(t.providerData,function(t){return t.providerId})}function mc(t,e){e&&(gc(t,e.providerId),t.providerData.push(e))}function gc(t,e){U(t.providerData,function(t){return t.providerId==e})}function vc(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&Nr(t,e,n)}function bc(t,e){t!=e&&(kr(t,{uid:e.uid,displayName:e.displayName,photoURL:e.photoURL,email:e.email,emailVerified:e.emailVerified,phoneNumber:e.phoneNumber,isAnonymous:e.isAnonymous,providerData:[]}),e.metadata?Nr(t,"metadata",function(t){return new Zu(t.a,t.b)}(e.metadata)):Nr(t,"metadata",new Zu),P(e.providerData,function(e){mc(t,e)}),function(t,e){t.b=e.b,t.a=e.a,t.c=e.c}(t.h,e.h),Nr(t,"refreshToken",t.h.a))}function _c(t){return t.F().then(function(e){var n=t.isAnonymous;return function(t,e){return is(t.b,ja,{idToken:e}).then(g(t.xc,t))}(t,e).then(function(){return n||vc(t,"isAnonymous",!1),e})})}function wc(t,e){e[ca]&&t.ra!=e[ca]&&(Xu(t.h,e),t.dispatchEvent(new ec("tokenChanged")),cc(t,e[ca]),vc(t,"refreshToken",t.h.a))}function Ec(t,e){return _c(t).then(function(){if(M(yc(t),e))return lc(t).then(function(){throw new Vr("provider-already-linked")})})}function Tc(t,e,n){return Dr({user:t,credential:Yi(e),additionalUserInfo:e=di(e),operationType:n})}function Sc(t,e){return wc(t,e),t.reload().then(function(){return t})}function Cc(t,e,n,i,o){if(!cr())return Tt(new Vr("operation-not-supported-in-this-environment"));if(t.i&&!o)return Tt(t.i);var a=pi(n.providerId),s=mr(t.uid+":::"),u=null;(!fr()||Jn())&&t.u&&n.isOAuthProvider&&(u=bs(t.u,t.m,t.o,e,n,null,s,r.a.SDK_VERSION||null));var c=zn(u,a&&a.Ba,a&&a.Aa);return i=i().then(function(){if(Nc(t),!o)return t.F().then(function(){})}).then(function(){return Lu(t.a,c,e,n,s,!!u)}).then(function(){return new yt(function(n,r){t.ha(e,null,new Vr("cancelled-popup-request"),t.g||null),t.f=n,t.v=r,t.g=s,t.c=t.a.Ea(t,e,c,s)})}).then(function(t){return c&&Hn(c),t?Dr(t):null}).s(function(t){throw c&&Hn(c),t}),kc(t,i,o)}function Ic(t,e,n,r,i){if(!cr())return Tt(new Vr("operation-not-supported-in-this-environment"));if(t.i&&!i)return Tt(t.i);var o=null,a=mr(t.uid+":::");return r=r().then(function(){if(Nc(t),!i)return t.F().then(function(){})}).then(function(){return t.aa=a,lc(t)}).then(function(e){return t.ba&&(e=(e=t.ba).b.set(Oc,t.C(),e.a)),e}).then(function(){return t.a.Ca(e,n,a)}).s(function(e){if(o=e,t.ba)return Rc(t.ba);throw o}).then(function(){if(o)throw o}),kc(t,r,i)}function Nc(t){if(!t.a||!t.I){if(t.a&&!t.I)throw new Vr("internal-error");throw new Vr("auth-domain-config-required")}}function kc(t,e,n){var r=function(t,e,n){return t.i&&!n?(e.cancel(),Tt(t.i)):e.s(function(e){throw!e||"auth/user-disabled"!=e.code&&"auth/user-token-expired"!=e.code||(t.i||t.dispatchEvent(new ec("userInvalidated")),t.i=e),e})}(t,e,n);return t.G.push(r),r.ia(function(){F(t.G,r)}),r}function Dc(t){if(!t.apiKey)return null;var e={apiKey:t.apiKey,authDomain:t.authDomain,appName:t.appName},n={};if(!(t.stsTokenManager&&t.stsTokenManager.accessToken&&t.stsTokenManager.expirationTime))return null;n[ca]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null,n.expiresIn=(t.stsTokenManager.expirationTime-b())/1e3;var r=new nc(e,n,t);return t.providerData&&P(t.providerData,function(t){t&&mc(r,Dr(t))}),t.redirectEventId&&(r.aa=t.redirectEventId),r}function Ac(t){this.a=t,this.b=tu()}ju.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},ju.prototype.h=function(t,e){if(t){this.reset(),this.g=!0;var n=t.b,r=t.c,i=t.a&&"auth/web-storage-unsupported"==t.a.code,o=t.a&&"auth/operation-not-supported-in-this-environment"==t.a.code;this.i=!(!i&&!o),"unknown"!=n||i||o?t.a?(qu(this,!0,null,t.a),Et()):e.xa(n,r)?function(t,e,n){n=n.xa(e.b,e.c);var r=e.f,i=e.g,o=e.h,a=!!e.b.match(/Redirect$/);n(r,i,o).then(function(e){qu(t,a,e,null)}).s(function(e){qu(t,a,null,e)})}(this,t,e):Tt(new Vr("invalid-auth-event")):(qu(this,!1,null,null),Et())}else Tt(new Vr("invalid-auth-event"))},ju.prototype.Ya=function(){this.g&&!this.i&&qu(this,!1,null,null)},ju.prototype.fa=function(){var t=this;return new yt(function(e,n){t.b?t.b().then(e,n):(t.f.push(e),t.c.push(n),function(t){var e=new Vr("timeout");t.a&&t.a.cancel(),t.a=Le(xu.get()).then(function(){t.b||(t.g=!0,qu(t,!0,null,e))})}(t))})},Wu.prototype.h=function(t,e){if(t){var n=t.b,r=t.c;t.a?(e.ha(t.b,null,t.a,t.c),Et()):e.xa(n,r)?function(t,e){var n=t.c,r=t.b;e.xa(r,n)(t.f,t.g,t.h).then(function(t){e.ha(r,t,null,n)}).s(function(t){e.ha(r,null,t,n)})}(t,e):Tt(new Vr("invalid-auth-event"))}else Tt(new Vr("invalid-auth-event"))},Qu.prototype.confirm=function(t){return t=Gi(this.verificationId,t),this.a(t)},Gu.prototype.start=function(){this.a=this.c,function t(e,r){e.stop();e.b=Le(function(t,e){return e?(t.a=t.c,t.g()):(e=t.a,t.a*=2,t.a>t.f&&(t.a=t.f),e)}(e,r)).then(function(){return function(){var t=n.document,e=null;return _r()||!t?Et():new yt(function(n){e=function(){_r()&&(t.removeEventListener("visibilitychange",e,!1),n())},t.addEventListener("visibilitychange",e,!1)}).s(function(n){throw t.removeEventListener("visibilitychange",e,!1),n})}()}).then(function(){return e.h()}).then(function(){t(e,!0)}).s(function(n){e.i(n)&&t(e,!1)})}(this,!0)},Gu.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},Yu.prototype.C=function(){return{apiKey:this.f.b,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}},Yu.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?Tt(new Vr("user-token-expired")):t||!this.b||b()>this.c-3e4?this.a?$u(this,{grant_type:"refresh_token",refresh_token:this.a}):Et(null):Et({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},Zu.prototype.C=function(){return{lastLoginAt:this.b,createdAt:this.a}},_(ec,ae),_(nc,Ae),nc.prototype.pa=function(t){this.ka=t,da(this.b,t)},nc.prototype.ea=function(){return this.ka},nc.prototype.ya=function(){return V(this.O)},nc.prototype.Ha=function(){this.w.b&&(this.w.stop(),this.w.start())},Nr(nc.prototype,"providerId","firebase"),(t=nc.prototype).reload=function(){var t=this;return kc(this,dc(this).then(function(){return _c(t).then(function(){return lc(t)}).then(pc)}))},t.dc=function(t){return this.F(t).then(function(t){return new zu(t)})},t.F=function(t){var e=this;return kc(this,dc(this).then(function(){return e.h.getToken(t)}).then(function(t){if(!t)throw new Vr("internal-error");return t.accessToken!=e.ra&&(cc(e,t.accessToken),e.dispatchEvent(new ec("tokenChanged"))),vc(e,"refreshToken",t.refreshToken),t.accessToken}))},t.xc=function(t){if(!(t=t.users)||!t.length)throw new Vr("internal-error");fc(this,{uid:(t=t[0]).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=function(t){return(t=t.providerUserInfo)&&t.length?x(t,function(t){return new tc(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[]}(t),n=0;n<e.length;n++)mc(this,e[n]);vc(this,"isAnonymous",!(this.email&&t.passwordHash)&&!(this.providerData&&this.providerData.length))},t.gb=function(t){var e=this,n=null;return kc(this,t.f(this.b,this.uid).then(function(t){return wc(e,t),n=Tc(e,t,"reauthenticate"),e.i=null,e.reload()}).then(function(){return n}),!0)},t.yc=function(t){return Cr("firebase.User.prototype.reauthenticateWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential instead."),this.gb(t).then(function(){})},t.eb=function(t){var e=this,n=null;return kc(this,Ec(this,t.providerId).then(function(){return e.F()}).then(function(n){return t.b(e.b,n)}).then(function(t){return n=Tc(e,t,"link"),Sc(e,t)}).then(function(){return n}))},t.pc=function(t){return Cr("firebase.User.prototype.linkWithCredential is deprecated. Please use firebase.User.prototype.linkAndRetrieveDataWithCredential instead."),this.eb(t).then(function(t){return t.user})},t.qc=function(t,e){var n=this;return kc(this,Ec(this,"phone").then(function(){return Hu(ac(n),t,e,g(n.eb,n))}))},t.zc=function(t,e){var n=this;return kc(this,Et().then(function(){return Hu(ac(n),t,e,g(n.gb,n))}),!0)},t.pb=function(t){var e=this;return kc(this,this.F().then(function(n){return e.b.pb(n,t)}).then(function(t){return wc(e,t),e.reload()}))},t.Rc=function(t){var e=this;return kc(this,this.F().then(function(n){return t.b(e.b,n)}).then(function(t){return wc(e,t),e.reload()}))},t.qb=function(t){var e=this;return kc(this,this.F().then(function(n){return e.b.qb(n,t)}).then(function(t){return wc(e,t),e.reload()}))},t.rb=function(t){if(void 0===t.displayName&&void 0===t.photoURL)return dc(this);var e=this;return kc(this,this.F().then(function(n){return e.b.rb(n,{displayName:t.displayName,photoUrl:t.photoURL})}).then(function(t){return wc(e,t),vc(e,"displayName",t.displayName||null),vc(e,"photoURL",t.photoUrl||null),P(e.providerData,function(t){"password"===t.providerId&&(Nr(t,"displayName",e.displayName),Nr(t,"photoURL",e.photoURL))}),lc(e)}).then(pc))},t.Pc=function(t){var e=this;return kc(this,_c(this).then(function(n){return M(yc(e),t)?function(t,e,n){return is(t,Ma,{idToken:e,deleteProvider:n})}(e.b,n,[t]).then(function(t){var n={};return P(t.providerUserInfo||[],function(t){n[t.providerId]=!0}),P(yc(e),function(t){n[t]||gc(e,t)}),n[zi.PROVIDER_ID]||Nr(e,"phoneNumber",null),lc(e)}):lc(e).then(function(){throw new Vr("no-such-provider")})}))},t.delete=function(){var t=this;return kc(this,this.F().then(function(e){return is(t.b,La,{idToken:e})}).then(function(){t.dispatchEvent(new ec("userDeleted"))})).then(function(){for(var e=0;e<t.G.length;e++)t.G[e].cancel("app-deleted");rc(t,null),oc(t,null),t.G=[],t.D=!0,uc(t),Nr(t,"refreshToken",null),t.a&&t.a.unsubscribe(t)})},t.vb=function(t,e){return!!("linkViaPopup"==t&&(this.g||null)==e&&this.f||"reauthViaPopup"==t&&(this.g||null)==e&&this.f||"linkViaRedirect"==t&&(this.aa||null)==e||"reauthViaRedirect"==t&&(this.aa||null)==e)},t.ha=function(t,e,n,r){"linkViaPopup"!=t&&"reauthViaPopup"!=t||r!=(this.g||null)||(n&&this.v?this.v(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.v)},t.xa=function(t,e){return"linkViaPopup"==t&&e==(this.g||null)?g(this.Ab,this):"reauthViaPopup"==t&&e==(this.g||null)?g(this.Bb,this):"linkViaRedirect"==t&&(this.aa||null)==e?g(this.Ab,this):"reauthViaRedirect"==t&&(this.aa||null)==e?g(this.Bb,this):null},t.rc=function(t){var e=this;return Cc(this,"linkViaPopup",t,function(){return Ec(e,t.providerId).then(function(){return lc(e)})},!1)},t.Ac=function(t){return Cc(this,"reauthViaPopup",t,function(){return Et()},!0)},t.sc=function(t){var e=this;return Ic(this,"linkViaRedirect",t,function(){return Ec(e,t.providerId)},!1)},t.Bc=function(t){return Ic(this,"reauthViaRedirect",t,function(){return Et()},!0)},t.Ab=function(t,e,n){var r=this;this.c&&(this.c.cancel(),this.c=null);var i=null;return kc(this,this.F().then(function(i){return ka(r.b,{requestUri:t,postBody:n,sessionId:e,idToken:i})}).then(function(t){return i=Tc(r,t,"link"),Sc(r,t)}).then(function(){return i}))},t.Bb=function(t,e,n){var r=this;this.c&&(this.c.cancel(),this.c=null);var i=null;return kc(this,Et().then(function(){return Ci(Da(r.b,{requestUri:t,sessionId:e,postBody:n}),r.uid)}).then(function(t){return i=Tc(r,t,"reauthenticate"),wc(r,t),r.i=null,r.reload()}).then(function(){return i}),!0)},t.jb=function(t){var e=this,n=null;return kc(this,this.F().then(function(e){return n=e,"undefined"===typeof t||it(t)?{}:ti(new Kr(t))}).then(function(t){return e.b.jb(n,t)}).then(function(t){if(e.email!=t)return e.reload()}).then(function(){}))},t.toJSON=function(){return this.C()},t.C=function(){var t={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,providerData:[],apiKey:this.m,appName:this.o,authDomain:this.u,stsTokenManager:this.h.C(),redirectEventId:this.aa||null};return this.metadata&&ct(t,this.metadata.C()),P(this.providerData,function(e){t.providerData.push(function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(e))}),t};var Oc={name:"redirectUser",A:"session"};function Rc(t){return ru(t.b,Oc,t.a)}function Pc(t){this.a=t,this.b=tu(),this.c=null,this.f=function(t){var e=Mc("local"),r=Mc("session"),i=Mc("none");return function(t,e,r){var i=nu(e,r),o=eu(t,e.A);return t.get(e,r).then(function(a){var s=null;try{s=yr(n.localStorage.getItem(i))}catch(u){}if(s&&!a)return n.localStorage.removeItem(i),t.set(e,s,r);s&&a&&"localStorage"!=o.type&&n.localStorage.removeItem(i)})}(t.b,e,t.a).then(function(){return t.b.get(r,t.a)}).then(function(n){return n?r:t.b.get(i,t.a).then(function(n){return n?i:t.b.get(e,t.a).then(function(n){return n?e:t.b.get(Lc,t.a).then(function(t){return t?Mc(t):e})})})}).then(function(e){return t.c=e,xc(t,e.A)}).s(function(){t.c||(t.c=e)})}(this),this.b.addListener(Mc("local"),this.a,g(this.g,this))}function xc(t,e){var n,r=[];for(n in $s)$s[n]!==e&&r.push(ru(t.b,Mc($s[n]),t.a));return r.push(ru(t.b,Lc,t.a)),function(t){return new yt(function(e,n){var r=t.length,i=[];if(r)for(var o=function(t,n){r--,i[t]=n,0==r&&e(i)},a=function(t){n(t)},s=0;s<t.length;s++)St(t[s],v(o,s),a);else e(i)})}(r)}Pc.prototype.g=function(){var t=this,e=Mc("local");Vc(this,function(){return Et().then(function(){return t.c&&"local"!=t.c.A?t.b.get(e,t.a):null}).then(function(n){if(n)return xc(t,"local").then(function(){t.c=e})})})};var Lc={name:"persistence",A:"session"};function Mc(t){return{name:"authUser",A:t}}function Fc(t,e){return Vc(t,function(){return t.b.set(t.c,e.C(),t.a)})}function Uc(t){return Vc(t,function(){return ru(t.b,t.c,t.a)})}function jc(t,e){return Vc(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),Dc(t||{})})})}function Vc(t,e){return t.f=t.f.then(e,e),t.f}function Bc(t){if(this.m=!1,Nr(this,"settings",new Ku),Nr(this,"app",t),!Gc(this).options||!Gc(this).options.apiKey)throw new Vr("invalid-api-key");t=r.a.SDK_VERSION?or(r.a.SDK_VERSION):null,this.b=new sa(Gc(this).options&&Gc(this).options.apiKey,ci(si),t),this.N=[],this.o=[],this.I=[],this.Tb=r.a.INTERNAL.createSubscribe(g(this.mc,this)),this.O=void 0,this.Ub=r.a.INTERNAL.createSubscribe(g(this.nc,this)),Hc(this,null),this.h=new Pc(Gc(this).options.apiKey+":"+Gc(this).name),this.w=new Ac(Gc(this).options.apiKey+":"+Gc(this).name),this.V=$c(this,function(t){var e=Gc(t).options.authDomain,n=function(t){var e=function(t,e){return t.b.get(Oc,t.a).then(function(t){return t&&e&&(t.authDomain=e),Dc(t||{})})}(t.w,Gc(t).options.authDomain).then(function(e){return(t.D=e)&&(e.ba=t.w),Rc(t.w)});return $c(t,e)}(t).then(function(){return jc(t.h,e)}).then(function(e){return e?(e.ba=t.w,t.D&&(t.D.aa||null)==(e.aa||null)?e:e.reload().then(function(){return Fc(t.h,e).then(function(){return e})}).s(function(n){return"auth/network-request-failed"==n.code?e:Uc(t.h)})):null}).then(function(e){Hc(t,e||null)});return $c(t,n)}(this)),this.i=$c(this,function(t){return t.V.then(function(){return t.fa()}).s(function(){}).then(function(){if(!t.m)return t.ka()}).s(function(){}).then(function(){if(!t.m){t.X=!0;var e=t.h;e.b.addListener(Mc("local"),e.a,t.ka)}})}(this)),this.X=!1,this.ka=g(this.Mc,this),this.Ha=g(this.Z,this),this.ra=g(this.bc,this),this.sa=g(this.jc,this),this.ta=g(this.kc,this),function(t){var e=Gc(t).options.authDomain,n=Gc(t).options.apiKey;e&&cr()&&(t.Sb=t.V.then(function(){if(!t.m){if(t.a=Uu(e,n,Gc(t).name),t.a.subscribe(t),Yc(t)&&hc(Yc(t)),t.D){hc(t.D);var r=t.D;r.pa(t.ea()),rc(r,t),ic(r=t.D,t.G),oc(r,t),t.D=null}return t.a}}))}(this),this.INTERNAL={},this.INTERNAL.delete=g(this.delete,this),this.INTERNAL.logFramework=g(this.tc,this),this.u=0,Ae.call(this),function(t){Object.defineProperty(t,"lc",{get:function(){return this.ea()},set:function(t){this.pa(t)},enumerable:!1}),t.W=null}(this),this.G=[]}function qc(t){ae.call(this,"languageCodeChanged"),this.g=t}function Wc(t){ae.call(this,"frameworkChanged"),this.c=t}function Kc(t){return t.Sb||Tt(new Vr("auth-domain-config-required"))}function Qc(t,e){var n={};return n.apiKey=Gc(t).options.apiKey,n.authDomain=Gc(t).options.authDomain,n.appName=Gc(t).name,t.V.then(function(){return function(t,e,n,r){var i=new nc(t,e);return n&&(i.ba=n),r&&ic(i,r),i.reload().then(function(){return i})}(n,e,t.w,t.ya())}).then(function(e){return Yc(t)&&e.uid==Yc(t).uid?(bc(Yc(t),e),t.Z(e)):(Hc(t,e),hc(e),t.Z(e))}).then(function(){Jc(t)})}function Hc(t,e){Yc(t)&&(function(t,e){U(t.N,function(t){return t==e})}(Yc(t),t.Ha),we(Yc(t),"tokenChanged",t.ra),we(Yc(t),"userDeleted",t.sa),we(Yc(t),"userInvalidated",t.ta),uc(Yc(t))),e&&(e.N.push(t.Ha),ve(e,"tokenChanged",t.ra),ve(e,"userDeleted",t.sa),ve(e,"userInvalidated",t.ta),0<t.u&&sc(e)),Nr(t,"currentUser",e),e&&(e.pa(t.ea()),rc(e,t),ic(e,t.G),oc(e,t))}function zc(t,e){var n=null,r=null;return $c(t,e.then(function(e){return n=Yi(e),r=di(e),Qc(t,e)}).then(function(){return Dr({user:Yc(t),credential:n,additionalUserInfo:r,operationType:"signIn"})}))}function Gc(t){return t.app}function Yc(t){return t.currentUser}function Xc(t){return Yc(t)&&Yc(t)._lat||null}function Jc(t){if(t.X){for(var e=0;e<t.o.length;e++)t.o[e]&&t.o[e](Xc(t));if(t.O!==t.getUid()&&t.I.length)for(t.O=t.getUid(),e=0;e<t.I.length;e++)t.I[e]&&t.I[e](Xc(t))}}function $c(t,e){return t.N.push(e),e.ia(function(){F(t.N,e)}),e}function Zc(){}function tl(){this.a={},this.b=1e12}Pc.prototype.mb=function(t){var e=null,n=this;return function(t){var e=new Vr("invalid-persistence-type"),n=new Vr("unsupported-persistence-type");t:{for(r in $s)if($s[r]==t){var r=!0;break t}r=!1}if(!r||"string"!==typeof t)throw e;switch(Zn()){case"ReactNative":if("session"===t)throw n;break;case"Node":if("none"!==t)throw n;break;default:if(!ur()&&"none"!==t)throw n}}(t),Vc(this,function(){return t!=n.c.A?n.b.get(n.c,n.a).then(function(r){return e=r,xc(n,t)}).then(function(){if(n.c=Mc(t),e)return n.b.set(n.c,e,n.a)}):Et()})},_(Bc,Ae),_(qc,ae),_(Wc,ae),(t=Bc.prototype).mb=function(t){return $c(this,t=this.h.mb(t))},t.pa=function(t){this.W===t||this.m||(this.W=t,da(this.b,this.W),this.dispatchEvent(new qc(this.ea())))},t.ea=function(){return this.W},t.Sc=function(){var t=n.navigator;this.pa(t&&(t.languages&&t.languages[0]||t.language||t.userLanguage)||null)},t.tc=function(t){this.G.push(t),ya(this.b,r.a.SDK_VERSION?or(r.a.SDK_VERSION,this.G):null),this.dispatchEvent(new Wc(this.G))},t.ya=function(){return V(this.G)},t.toJSON=function(){return{apiKey:Gc(this).options.apiKey,authDomain:Gc(this).options.authDomain,appName:Gc(this).name,currentUser:Yc(this)&&Yc(this).C()}},t.vb=function(t,e){switch(t){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==e&&!!this.f;default:return!1}},t.ha=function(t,e,n,r){"signInViaPopup"==t&&this.g==r&&(n&&this.v?this.v(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.v)},t.xa=function(t,e){return"signInViaRedirect"==t||"signInViaPopup"==t&&this.g==e&&this.f?g(this.ac,this):null},t.ac=function(t,e,n){var r=this;t={requestUri:t,postBody:n,sessionId:e},this.c&&(this.c.cancel(),this.c=null);var i=null,o=null,a=Na(r.b,t).then(function(t){return i=Yi(t),o=di(t),t});return $c(this,t=r.V.then(function(){return a}).then(function(t){return Qc(r,t)}).then(function(){return Dr({user:Yc(r),credential:i,additionalUserInfo:o,operationType:"signIn"})}))},t.Kc=function(t){if(!cr())return Tt(new Vr("operation-not-supported-in-this-environment"));var e=this,n=pi(t.providerId),i=mr(),o=null;(!fr()||Jn())&&Gc(this).options.authDomain&&t.isOAuthProvider&&(o=bs(Gc(this).options.authDomain,Gc(this).options.apiKey,Gc(this).name,"signInViaPopup",t,null,i,r.a.SDK_VERSION||null));var a=zn(o,n&&n.Ba,n&&n.Aa);return $c(this,n=Kc(this).then(function(e){return Lu(e,a,"signInViaPopup",t,i,!!o)}).then(function(){return new yt(function(t,n){e.ha("signInViaPopup",null,new Vr("cancelled-popup-request"),e.g),e.f=t,e.v=n,e.g=i,e.c=e.a.Ea(e,"signInViaPopup",a,i)})}).then(function(t){return a&&Hn(a),t?Dr(t):null}).s(function(t){throw a&&Hn(a),t}))},t.Lc=function(t){if(!cr())return Tt(new Vr("operation-not-supported-in-this-environment"));var e=this;return $c(this,Kc(this).then(function(){return Vc(t=e.h,function(){return t.b.set(Lc,t.c.A,t.a)});var t}).then(function(){return e.a.Ca("signInViaRedirect",t)}))},t.fa=function(){if(!cr())return Tt(new Vr("operation-not-supported-in-this-environment"));var t=this;return $c(this,Kc(this).then(function(){return t.a.fa()}).then(function(t){return t?Dr(t):null}))},t.Qc=function(t){if(!t)return Tt(new Vr("null-user"));var e=this,n={};n.apiKey=Gc(this).options.apiKey,n.authDomain=Gc(this).options.authDomain,n.appName=Gc(this).name;var r=function(t,e,n,r){e=e||{apiKey:t.m,authDomain:t.u,appName:t.o};var i=t.h,o={};return o[ca]=i.b,o.refreshToken=i.a,o.expiresIn=(i.c-b())/1e3,e=new nc(e,o),n&&(e.ba=n),r&&ic(e,r),bc(e,t),e}(t,n,e.w,e.ya());return $c(this,this.i.then(function(){if(Gc(e).options.apiKey!=t.m)return r.reload()}).then(function(){return Yc(e)&&t.uid==Yc(e).uid?(bc(Yc(e),t),e.Z(t)):(Hc(e,r),hc(r),e.Z(r))}).then(function(){Jc(e)}))},t.nb=function(){var t=this;return $c(this,this.i.then(function(){return Yc(t)?(Hc(t,null),Uc(t.h).then(function(){Jc(t)})):Et()}))},t.Mc=function(){var t=this;return jc(this.h,Gc(this).options.authDomain).then(function(e){if(!t.m){var n;if(n=Yc(t)&&e){n=Yc(t).uid;var r=e.uid;n=void 0!==n&&null!==n&&""!==n&&void 0!==r&&null!==r&&""!==r&&n==r}if(n)return bc(Yc(t),e),Yc(t).F();(Yc(t)||e)&&(Hc(t,e),e&&(hc(e),e.ba=t.w),t.a&&t.a.subscribe(t),Jc(t))}})},t.Z=function(t){return Fc(this.h,t)},t.bc=function(){Jc(this),this.Z(Yc(this))},t.jc=function(){this.nb()},t.kc=function(){this.nb()},t.mc=function(t){var e=this;this.addAuthTokenListener(function(){t.next(Yc(e))})},t.nc=function(t){var e=this;!function(t,e){t.I.push(e),$c(t,t.i.then(function(){!t.m&&M(t.I,e)&&t.O!==t.getUid()&&(t.O=t.getUid(),e(Xc(t)))}))}(this,function(){t.next(Yc(e))})},t.vc=function(t,e,n){var i=this;return this.X&&r.a.Promise.resolve().then(function(){h(t)?t(Yc(i)):h(t.next)&&t.next(Yc(i))}),this.Tb(t,e,n)},t.uc=function(t,e,n){var i=this;return this.X&&r.a.Promise.resolve().then(function(){i.O=i.getUid(),h(t)?t(Yc(i)):h(t.next)&&t.next(Yc(i))}),this.Ub(t,e,n)},t.cc=function(t){var e=this;return $c(this,this.i.then(function(){return Yc(e)?Yc(e).F(t).then(function(t){return{accessToken:t}}):null}))},t.Nb=function(t){var e=this;return this.i.then(function(){return zc(e,is(e.b,Za,{token:t}))}).then(function(t){var n=t.user;return vc(n,"isAnonymous",!1),e.Z(n),t})},t.Ec=function(t){return Cr("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCustomToken is deprecated. Please use firebase.auth.Auth.prototype.signInWithCustomToken instead."),this.Nb(t)},t.Fc=function(t,e){return Cr("firebase.auth.Auth.prototype.signInAndRetrieveDataWithEmailAndPassword is deprecated. Please use firebase.auth.Auth.prototype.signInWithEmailAndPassword instead."),this.Ob(t,e)},t.Ob=function(t,e){var n=this;return this.i.then(function(){return zc(n,is(n.b,ts,{email:t,password:e}))})},t.xb=function(t,e){var n=this;return this.i.then(function(){return zc(n,is(n.b,Pa,{email:t,password:e}))})},t.Wb=function(t,e){return Cr("firebase.auth.Auth.prototype.createUserAndRetrieveDataWithEmailAndPassword is deprecated. Please use firebase.auth.Auth.prototype.createUserWithEmailAndPassword instead."),this.xb(t,e)},t.Hc=function(t){return Cr("firebase.auth.Auth.prototype.signInWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential instead."),this.Pa(t).then(function(t){return t.user})},t.Pa=function(t){var e=this;return this.i.then(function(){return zc(e,t.la(e.b))})},t.Qa=function(){var t=this;return this.i.then(function(){var e=Yc(t);if(e&&e.isAnonymous){var n=Dr({providerId:null,isNewUser:!1});return Dr({user:e,credential:null,additionalUserInfo:n,operationType:"signIn"})}return zc(t,t.b.Qa()).then(function(e){var n=e.user;return vc(n,"isAnonymous",!0),t.Z(n),e})})},t.Gc=function(){return Cr("firebase.auth.Auth.prototype.signInAnonymouslyAndRetrieveData is deprecated. Please use firebase.auth.Auth.prototype.signInAnonymously instead."),this.Qa()},t.getUid=function(){return Yc(this)&&Yc(this).uid||null},t.Vb=function(t){this.addAuthTokenListener(t),this.u++,0<this.u&&Yc(this)&&sc(Yc(this))},t.Cc=function(t){var e=this;P(this.o,function(n){n==t&&e.u--}),0>this.u&&(this.u=0),0==this.u&&Yc(this)&&uc(Yc(this)),this.removeAuthTokenListener(t)},t.addAuthTokenListener=function(t){var e=this;this.o.push(t),$c(this,this.i.then(function(){e.m||M(e.o,t)&&t(Xc(e))}))},t.removeAuthTokenListener=function(t){U(this.o,function(e){return e==t})},t.delete=function(){this.m=!0;for(var t=0;t<this.N.length;t++)this.N[t].cancel("app-deleted");return this.N=[],this.h&&(t=this.h).b.removeListener(Mc("local"),t.a,this.ka),this.a&&(this.a.unsubscribe(this),this.a.Ya()),r.a.Promise.resolve()},t.Zb=function(t){return Cr("firebase.auth.Auth.prototype.fetchProvidersForEmail is deprecated. Please use firebase.auth.Auth.prototype.fetchSignInMethodsForEmail instead."),$c(this,function(t,e){return is(t,xa,{identifier:e,continueUri:lr()?Wn():"http://localhost"}).then(function(t){return t.allProviders||[]})}(this.b,t))},t.$b=function(t){return $c(this,function(t,e){return is(t,xa,{identifier:e,continueUri:lr()?Wn():"http://localhost"}).then(function(t){return t.signinMethods||[]})}(this.b,t))},t.oc=function(t){return!!Ki(t)},t.lb=function(t,e){var n=this;return $c(this,Et().then(function(){var t=new Kr(e);if(!t.c)throw new Vr("argument-error",zr+" must be true when sending sign in link to email");return ti(t)}).then(function(e){return n.b.lb(t,e)}).then(function(){}))},t.Tc=function(t){return this.Ja(t).then(function(t){return t.data.email})},t.Za=function(t,e){return $c(this,this.b.Za(t,e).then(function(){}))},t.Ja=function(t){return $c(this,this.b.Ja(t).then(function(t){return new Or(t)}))},t.Wa=function(t){return $c(this,this.b.Wa(t).then(function(){}))},t.kb=function(t,e){var n=this;return $c(this,Et().then(function(){return"undefined"===typeof e||it(e)?{}:ti(new Kr(e))}).then(function(e){return n.b.kb(t,e)}).then(function(){}))},t.Jc=function(t,e){return $c(this,Hu(this,t,e,g(this.Pa,this)))},t.Ic=function(t,e){var n=this;return $c(this,Et().then(function(){var r=Wi(t,e||Wn());return n.Pa(r)}))},Zc.prototype.render=function(){},Zc.prototype.reset=function(){},Zc.prototype.getResponse=function(){},Zc.prototype.execute=function(){};var el=null;function nl(t,e){return(e=rl(e))&&t.a[e]||null}function rl(t){return(t="undefined"===typeof t?1e12:t)?t.toString():null}function il(t,e){this.g=!1,this.c=e,this.a=this.b=null,this.h="invisible"!==this.c.size,this.f=Rn(t);var n=this;this.i=function(){n.execute()},this.h?this.execute():ve(this.f,"click",this.i)}function ol(t){if(t.g)throw Error("reCAPTCHA mock was already deleted!")}function al(){}tl.prototype.render=function(t,e){return this.a[this.b.toString()]=new il(t,e),this.b++},tl.prototype.reset=function(t){var e=nl(this,t);t=rl(t),e&&t&&(e.delete(),delete this.a[t])},tl.prototype.getResponse=function(t){return(t=nl(this,t))?t.getResponse():null},tl.prototype.execute=function(t){(t=nl(this,t))&&t.execute()},il.prototype.getResponse=function(){return ol(this),this.b},il.prototype.execute=function(){ol(this);var t=this;this.a||(this.a=setTimeout(function(){t.b=function(){for(var t=50,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}();var e=t.c.callback,n=t.c["expired-callback"];if(e)try{e(t.b)}catch(r){}t.a=setTimeout(function(){if(t.a=null,t.b=null,n)try{n()}catch(r){}t.h&&t.execute()},6e4)},500))},il.prototype.delete=function(){ol(this),this.g=!0,clearTimeout(this.a),this.a=null,we(this.f,"click",this.i)},al.prototype.g=function(){return el||(el=new tl),Et(el)},al.prototype.c=function(){};var sl=null;function ul(){this.b=n.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var cl=mn("https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),ll=new br(3e4,6e4);ul.prototype.g=function(t){var e=this;return new yt(function(r,i){var o=setTimeout(function(){i(new Vr("network-request-failed"))},ll.get());!n.grecaptcha||t!==e.f&&!e.b?(n[e.a]=function(){if(n.grecaptcha){e.f=t;var a=n.grecaptcha.render;n.grecaptcha.render=function(t,n){return t=a(t,n),e.b++,t},clearTimeout(o),r(n.grecaptcha)}else clearTimeout(o),i(new Vr("internal-error"));delete n[e.a]},Et(ta(bn(cl,{onload:e.a,hl:t||""}))).s(function(){clearTimeout(o),i(new Vr("internal-error","Unable to load external reCAPTCHA dependencies!"))})):(clearTimeout(o),r(n.grecaptcha))})},ul.prototype.c=function(){this.b--};var hl=null;function fl(t,e,r,i,o,a,s){if(Nr(this,"type","recaptcha"),this.c=this.f=null,this.D=!1,this.m=e,this.g=null,s?(sl||(sl=new al),s=sl):(hl||(hl=new ul),s=hl),this.o=s,this.a=r||{theme:"light",type:"image"},this.h=[],this.a[yl])throw new Vr("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[ml],!n.document)throw new Vr("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!Rn(e)||!this.i&&Rn(e).hasChildNodes())throw new Vr("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.u=new sa(t,a||null,o||null),this.v=i||function(){return null};var u=this;this.l=[];var c=this.a[pl];this.a[pl]=function(t){if(gl(u,t),"function"===typeof c)c(t);else if("string"===typeof c){var e=sr(c,n);"function"===typeof e&&e(t)}};var l=this.a[dl];this.a[dl]=function(){if(gl(u,null),"function"===typeof l)l();else if("string"===typeof l){var t=sr(l,n);"function"===typeof t&&t()}}}var pl="callback",dl="expired-callback",yl="sitekey",ml="size";function gl(t,e){for(var n=0;n<t.l.length;n++)try{t.l[n](e)}catch(r){}}function vl(t,e){return t.h.push(e),e.ia(function(){F(t.h,e)}),e}function bl(t){if(t.D)throw new Vr("internal-error","RecaptchaVerifier instance has been destroyed.")}function _l(t,e,n){var i=!1;try{this.b=n||r.a.app()}catch(s){throw new Vr("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new Vr("invalid-api-key");n=this.b.options.apiKey;var o=this,a=null;try{a=this.b.auth().ya()}catch(s){}try{i=this.b.auth().settings.appVerificationDisabledForTesting}catch(s){}a=r.a.SDK_VERSION?or(r.a.SDK_VERSION,a):null,fl.call(this,n,t,e,function(){try{var t=o.b.auth().ea()}catch(e){t=null}return t},a,ci(si),i)}function wl(t,e,n,r){t:{n=Array.prototype.slice.call(n);for(var i=0,o=!1,a=0;a<e.length;a++)if(e[a].optional)o=!0;else{if(o)throw new Vr("internal-error","Argument validator encountered a required argument after an optional argument.");i++}if(o=e.length,n.length<i||o<n.length)r="Expected "+(i==o?1==i?"1 argument":i+" arguments":i+"-"+o+" arguments")+" but got "+n.length+".";else{for(i=0;i<n.length;i++)if(o=e[i].optional&&void 0===n[i],!e[i].M(n[i])&&!o){if(e=e[i],0>i||i>=El.length)throw new Vr("internal-error","Argument validator received an unsupported number of arguments.");n=El[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.K+".";break t}r=null}}if(r)throw new Vr("argument-error",t+" failed: "+r)}(t=fl.prototype).za=function(){var t=this;return this.f?this.f:this.f=vl(this,Et().then(function(){if(lr()&&!$n())return Yn();throw new Vr("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return t.o.g(t.v())}).then(function(e){return t.g=e,is(t.u,Ka,{})}).then(function(e){t.a[yl]=e.recaptchaSiteKey}).s(function(e){throw t.f=null,e}))},t.render=function(){bl(this);var t=this;return vl(this,this.za().then(function(){if(null===t.c){var e=t.m;if(!t.i){var n=Rn(e);e=Ln("DIV"),n.appendChild(e)}t.c=t.g.render(e,t.a)}return t.c}))},t.verify=function(){bl(this);var t=this;return vl(this,this.render().then(function(e){return new yt(function(n){var r=t.g.getResponse(e);if(r)n(r);else{t.l.push(function e(r){r&&(function(t,e){U(t.l,function(t){return t==e})}(t,e),n(r))}),t.i&&t.g.execute(t.c)}})}))},t.reset=function(){bl(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){bl(this),this.D=!0,this.o.c();for(var t=0;t<this.h.length;t++)this.h[t].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.i){t=Rn(this.m);for(var e;e=t.firstChild;)t.removeChild(e)}},_(_l,fl);var El="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Tl(t,e){return{name:t||"",K:"a valid string",optional:!!e,M:i}}function Sl(t,e){return{name:t||"",K:"a boolean",optional:!!e,M:o}}function Cl(t,e){return{name:t||"",K:"a valid object",optional:!!e,M:f}}function Il(t,e){return{name:t||"",K:"a function",optional:!!e,M:h}}function Nl(t,e){return{name:t||"",K:"null",optional:!!e,M:u}}function kl(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.la||!n)}}}function Dl(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(t){return!!(t&&i(t.type)&&h(t.verify))}}}function Al(t,e,n,r){return{name:n||"",K:t.K+" or "+e.K,optional:!!r,M:function(n){return t.M(n)||e.M(n)}}}function Ol(t,e){for(var n in e){var r=e[n].name;t[r]=xl(r,t[n],e[n].j)}}function Rl(t,e){for(var n in e){var r=e[n].name;r!==n&&Object.defineProperty(t,r,{get:v(function(t){return this[t]},n),set:v(function(t,e,n,r){wl(t,[n],[r],!0),this[e]=r},r,n,e[n].tb),enumerable:!0})}}function Pl(t,e,n,r){t[e]=xl(e,n,r)}function xl(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return wl(o,n,t),e.apply(this,t)}if(!n)return e;var i,o=function(t){return(t=t.split("."))[t.length-1]}(t);for(i in e)r[i]=e[i];for(i in e.prototype)r.prototype[i]=e.prototype[i];return r}Ol(Bc.prototype,{Wa:{name:"applyActionCode",j:[Tl("code")]},Ja:{name:"checkActionCode",j:[Tl("code")]},Za:{name:"confirmPasswordReset",j:[Tl("code"),Tl("newPassword")]},xb:{name:"createUserWithEmailAndPassword",j:[Tl("email"),Tl("password")]},Wb:{name:"createUserAndRetrieveDataWithEmailAndPassword",j:[Tl("email"),Tl("password")]},Zb:{name:"fetchProvidersForEmail",j:[Tl("email")]},$b:{name:"fetchSignInMethodsForEmail",j:[Tl("email")]},fa:{name:"getRedirectResult",j:[]},oc:{name:"isSignInWithEmailLink",j:[Tl("emailLink")]},uc:{name:"onAuthStateChanged",j:[Al(Cl(),Il(),"nextOrObserver"),Il("opt_error",!0),Il("opt_completed",!0)]},vc:{name:"onIdTokenChanged",j:[Al(Cl(),Il(),"nextOrObserver"),Il("opt_error",!0),Il("opt_completed",!0)]},kb:{name:"sendPasswordResetEmail",j:[Tl("email"),Al(Cl("opt_actionCodeSettings",!0),Nl(null,!0),"opt_actionCodeSettings",!0)]},lb:{name:"sendSignInLinkToEmail",j:[Tl("email"),Cl("actionCodeSettings")]},mb:{name:"setPersistence",j:[Tl("persistence")]},Pa:{name:"signInAndRetrieveDataWithCredential",j:[kl()]},Qa:{name:"signInAnonymously",j:[]},Gc:{name:"signInAnonymouslyAndRetrieveData",j:[]},Hc:{name:"signInWithCredential",j:[kl()]},Nb:{name:"signInWithCustomToken",j:[Tl("token")]},Ec:{name:"signInAndRetrieveDataWithCustomToken",j:[Tl("token")]},Ob:{name:"signInWithEmailAndPassword",j:[Tl("email"),Tl("password")]},Ic:{name:"signInWithEmailLink",j:[Tl("email"),Tl("emailLink",!0)]},Fc:{name:"signInAndRetrieveDataWithEmailAndPassword",j:[Tl("email"),Tl("password")]},Jc:{name:"signInWithPhoneNumber",j:[Tl("phoneNumber"),Dl()]},Kc:{name:"signInWithPopup",j:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},Lc:{name:"signInWithRedirect",j:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},Qc:{name:"updateCurrentUser",j:[Al({name:"user",K:"an instance of Firebase User",optional:!1,M:function(t){return!!(t&&t instanceof nc)}},Nl(),"user")]},nb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Tl(null,!0)]},Sc:{name:"useDeviceLanguage",j:[]},Tc:{name:"verifyPasswordResetCode",j:[Tl("code")]}}),Rl(Bc.prototype,{lc:{name:"languageCode",tb:Al(Tl(),Nl(),"languageCode")}}),Bc.Persistence=$s,Bc.Persistence.LOCAL="local",Bc.Persistence.SESSION="session",Bc.Persistence.NONE="none",Ol(nc.prototype,{delete:{name:"delete",j:[]},dc:{name:"getIdTokenResult",j:[Sl("opt_forceRefresh",!0)]},F:{name:"getIdToken",j:[Sl("opt_forceRefresh",!0)]},eb:{name:"linkAndRetrieveDataWithCredential",j:[kl()]},pc:{name:"linkWithCredential",j:[kl()]},qc:{name:"linkWithPhoneNumber",j:[Tl("phoneNumber"),Dl()]},rc:{name:"linkWithPopup",j:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},sc:{name:"linkWithRedirect",j:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},gb:{name:"reauthenticateAndRetrieveDataWithCredential",j:[kl()]},yc:{name:"reauthenticateWithCredential",j:[kl()]},zc:{name:"reauthenticateWithPhoneNumber",j:[Tl("phoneNumber"),Dl()]},Ac:{name:"reauthenticateWithPopup",j:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},Bc:{name:"reauthenticateWithRedirect",j:[{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}]},reload:{name:"reload",j:[]},jb:{name:"sendEmailVerification",j:[Al(Cl("opt_actionCodeSettings",!0),Nl(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Tl(null,!0)]},Pc:{name:"unlink",j:[Tl("provider")]},pb:{name:"updateEmail",j:[Tl("email")]},qb:{name:"updatePassword",j:[Tl("password")]},Rc:{name:"updatePhoneNumber",j:[kl("phone")]},rb:{name:"updateProfile",j:[Cl("profile")]}}),Ol(tl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Ol(Zc.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Ol(yt.prototype,{ia:{name:"finally"},s:{name:"catch"},then:{name:"then"}}),Rl(Ku.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",tb:Sl("appVerificationDisabledForTesting")}}),Ol(Qu.prototype,{confirm:{name:"confirm",j:[Tl("verificationCode")]}}),Pl(qi,"credential",function(t,e){return new Bi(t,e)},[Tl("email"),Tl("password")]),Ol(Pi.prototype,{ua:{name:"addScope",j:[Tl("scope")]},Da:{name:"setCustomParameters",j:[Cl("customOAuthParameters")]}}),Pl(Pi,"credential",xi,[Al(Tl(),Cl(),"token")]),Pl(qi,"credentialWithLink",Wi,[Tl("email"),Tl("emailLink")]),Ol(Li.prototype,{ua:{name:"addScope",j:[Tl("scope")]},Da:{name:"setCustomParameters",j:[Cl("customOAuthParameters")]}}),Pl(Li,"credential",Mi,[Al(Tl(),Cl(),"token")]),Ol(Fi.prototype,{ua:{name:"addScope",j:[Tl("scope")]},Da:{name:"setCustomParameters",j:[Cl("customOAuthParameters")]}}),Pl(Fi,"credential",Ui,[Al(Tl(),Al(Cl(),Nl()),"idToken"),Al(Tl(),Nl(),"accessToken",!0)]),Ol(ji.prototype,{Da:{name:"setCustomParameters",j:[Cl("customOAuthParameters")]}}),Pl(ji,"credential",Vi,[Al(Tl(),Cl(),"token"),Tl("secret",!0)]),Ol(Ri.prototype,{ua:{name:"addScope",j:[Tl("scope")]},credential:{name:"credential",j:[Al(Tl(),Nl(),"idToken",!0),Al(Tl(),Nl(),"accessToken",!0),Al(Tl(),Nl(),"nonce",!0)]},Da:{name:"setCustomParameters",j:[Cl("customOAuthParameters")]}}),Pl(zi,"credential",Gi,[Tl("verificationId"),Tl("verificationCode")]),Ol(zi.prototype,{Ua:{name:"verifyPhoneNumber",j:[Tl("phoneNumber"),Dl()]}}),Ol(Vr.prototype,{toJSON:{name:"toJSON",j:[Tl(null,!0)]}}),Ol(no.prototype,{toJSON:{name:"toJSON",j:[Tl(null,!0)]}}),Ol(eo.prototype,{toJSON:{name:"toJSON",j:[Tl(null,!0)]}}),Ol(_l.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),function(){if("undefined"===typeof r.a||!r.a.INTERNAL||!r.a.INTERNAL.registerService)throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");var t={Auth:Bc,Error:Vr};Pl(t,"EmailAuthProvider",qi,[]),Pl(t,"FacebookAuthProvider",Pi,[]),Pl(t,"GithubAuthProvider",Li,[]),Pl(t,"GoogleAuthProvider",Fi,[]),Pl(t,"TwitterAuthProvider",ji,[]),Pl(t,"OAuthProvider",Ri,[Tl("providerId")]),Pl(t,"SAMLAuthProvider",Oi,[Tl("providerId")]),Pl(t,"PhoneAuthProvider",zi,[{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(t){return!!(t&&t instanceof Bc)}}]),Pl(t,"RecaptchaVerifier",_l,[Al(Tl(),{name:"",K:"an HTML element",optional:!1,M:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),Cl("recaptchaParameters",!0),{name:"app",K:"an instance of Firebase App",optional:!0,M:function(t){return!!(t&&t instanceof r.a.app.App)}}]),r.a.INTERNAL.registerService("auth",function(t,e){return e({INTERNAL:{getUid:g((t=new Bc(t)).getUid,t),getToken:g(t.cc,t),addAuthTokenListener:g(t.Vb,t),removeAuthTokenListener:g(t.Cc,t)}}),t},t,function(t,e){if("create"===t)try{e.auth()}catch(n){}}),r.a.INTERNAL.extendNamespace({User:nc})}()}).apply("undefined"!==typeof t?t:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})}.call(this,n(14))},function(t,e,n){"use strict";(function(r){Object.defineProperty(e,"__esModule",{value:!0});var i,o=n(15),a=n(30),s=n(1),u=(i=n(2))&&"object"===typeof i&&"default"in i?i.default:i,c=function(){function t(t){this.domStorage_=t,this.prefix_="firebase:"}return t.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),o.stringify(e))},t.prototype.get=function(t){var e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:o.jsonEval(e)},t.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},t.prototype.prefixedName_=function(t){return this.prefix_+t},t.prototype.toString=function(){return this.domStorage_.toString()},t}(),l=function(){function t(){this.cache_={},this.isInMemoryStorage=!0}return t.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},t.prototype.get=function(t){return o.contains(this.cache_,t)?this.cache_[t]:null},t.prototype.remove=function(t){delete this.cache_[t]},t}(),h=function(t){try{if("undefined"!==typeof window&&"undefined"!==typeof window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new c(e)}}catch(n){}return new l},f=h("localStorage"),p=h("sessionStorage"),d=new a.Logger("@firebase/database"),y=function(){var t=1;return function(){return t++}}(),m=function(t){var e=o.stringToByteArray(t),n=new o.Sha1;n.update(e);var r=n.digest();return o.base64.encodeByteArray(r)},g=function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r="",i=0;i<e.length;i++)Array.isArray(e[i])||e[i]&&"object"===typeof e[i]&&"number"===typeof e[i].length?r+=t.apply(null,e[i]):"object"===typeof e[i]?r+=o.stringify(e[i]):r+=e[i],r+=" ";return r},v=null,b=!0,_=function(t,e){o.assert(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(d.logLevel=a.LogLevel.VERBOSE,v=d.log.bind(d),e&&p.set("logging_enabled",!0)):"function"===typeof t?v=t:(v=null,p.remove("logging_enabled"))},w=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!0===b&&(b=!1,null===v&&!0===p.get("logging_enabled")&&_(!0)),v){var n=g.apply(null,t);v(n)}},E=function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];w.apply(void 0,[t].concat(e))}},T=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+g.apply(void 0,t);d.error(n)},S=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+g.apply(void 0,t);throw d.error(n),new Error(n)},C=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+g.apply(void 0,t);d.warn(n)},I=function(t){return"number"===typeof t&&(t!=t||t==Number.POSITIVE_INFINITY||t==Number.NEGATIVE_INFINITY)},N="[MIN_NAME]",k="[MAX_NAME]",D=function(t,e){if(t===e)return 0;if(t===N||e===k)return-1;if(e===N||t===k)return 1;var n=F(t),r=F(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null!==r?1:t<e?-1:1},A=function(t,e){return t===e?0:t<e?-1:1},O=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+o.stringify(e))},R=function t(e){if("object"!==typeof e||null===e)return o.stringify(e);var n=[];for(var r in e)n.push(r);n.sort();for(var i="{",a=0;a<n.length;a++)0!==a&&(i+=","),i+=o.stringify(n[a]),i+=":",i+=t(e[n[a]]);return i+="}"},P=function(t,e){var n=t.length;if(n<=e)return[t];for(var r=[],i=0;i<n;i+=e)i+e>n?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r},x=function(t,e){if(Array.isArray(t))for(var n=0;n<t.length;++n)e(n,t[n]);else o.forEach(t,function(t,n){return e(n,t)})},L=function(t){o.assert(!I(t),"Invalid JSON number");var e,n,r,i,a,s,u;for(0===t?(n=0,r=0,e=1/t===-1/0?1:0):(e=t<0,(t=Math.abs(t))>=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,r=Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,r=Math.round(t/Math.pow(2,-1074)))),s=[],a=52;a;a-=1)s.push(r%2?1:0),r=Math.floor(r/2);for(a=11;a;a-=1)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse(),u=s.join("");var c="";for(a=0;a<64;a+=8){var l=parseInt(u.substr(a,8),2).toString(16);1===l.length&&(l="0"+l),c+=l}return c.toLowerCase()},M=new RegExp("^-?\\d{1,10}$"),F=function(t){if(M.test(t)){var e=Number(t);if(e>=-2147483648&&e<=2147483647)return e}return null},U=function(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw C("Exception was thrown by user callback.",t),e},Math.floor(0))}},j=function(){return("object"===typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},V=function(t,e){var n=setTimeout(t,e);return"object"===typeof n&&n.unref&&n.unref(),n},B=function(){function t(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r<this.pieces_.length;r++)this.pieces_[r].length>0&&(this.pieces_[n]=this.pieces_[r],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}return Object.defineProperty(t,"Empty",{get:function(){return new t("")},enumerable:!0,configurable:!0}),t.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},t.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},t.prototype.popFront=function(){var e=this.pieceNum_;return e<this.pieces_.length&&e++,new t(this.pieces_,e)},t.prototype.getBack=function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},t.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},t.prototype.toUrlEncodedString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+encodeURIComponent(String(this.pieces_[e])));return t||"/"},t.prototype.slice=function(t){return void 0===t&&(t=0),this.pieces_.slice(this.pieceNum_+t)},t.prototype.parent=function(){if(this.pieceNum_>=this.pieces_.length)return null;for(var e=[],n=this.pieceNum_;n<this.pieces_.length-1;n++)e.push(this.pieces_[n]);return new t(e,0)},t.prototype.child=function(e){for(var n=[],r=this.pieceNum_;r<this.pieces_.length;r++)n.push(this.pieces_[r]);if(e instanceof t)for(r=e.pieceNum_;r<e.pieces_.length;r++)n.push(e.pieces_[r]);else{var i=e.split("/");for(r=0;r<i.length;r++)i[r].length>0&&n.push(i[r])}return new t(n,0)},t.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},t.relativePath=function(e,n){var r=e.getFront(),i=n.getFront();if(null===r)return n;if(r===i)return t.relativePath(e.popFront(),n.popFront());throw new Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+e+")")},t.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;i<n.length&&i<r.length;i++){var o=D(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1},t.prototype.equals=function(t){if(this.getLength()!==t.getLength())return!1;for(var e=this.pieceNum_,n=t.pieceNum_;e<=this.pieces_.length;e++,n++)if(this.pieces_[e]!==t.pieces_[n])return!1;return!0},t.prototype.contains=function(t){var e=this.pieceNum_,n=t.pieceNum_;if(this.getLength()>t.getLength())return!1;for(;e<this.pieces_.length;){if(this.pieces_[e]!==t.pieces_[n])return!1;++e,++n}return!0},t}(),q=function(){function t(t,e){this.errorPrefix_=e,this.parts_=t.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=o.stringLength(this.parts_[n]);this.checkValid_()}return Object.defineProperty(t,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!0,configurable:!0}),t.prototype.push=function(t){this.parts_.length>0&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=o.stringLength(t),this.checkValid_()},t.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=o.stringLength(t),this.parts_.length>0&&(this.byteLength_-=1)},t.prototype.checkValid_=function(){if(this.byteLength_>t.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+t.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>t.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+t.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},t.prototype.toErrorString=function(){return 0==this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},t}(),W="long_polling",K=function(){function t(t,e,n,r,i){void 0===i&&(i=""),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=f.get("host:"+t)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()},t.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},t.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},t.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},t.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&f.set("host:"+this.host,this.internalHost))},t.prototype.connectionURL=function(t,e){var n;if(o.assert("string"===typeof t,"typeof type must == string"),o.assert("object"===typeof e,"typeof params must == object"),"websocket"===t)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==W)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return o.forEach(e,function(t,e){r.push(t+"="+e)}),n+r.join("&")},t.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},t.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},t}();var Q,H,z=function(t){var e=G(t),n=e.subdomain;"firebase"===e.domain&&S(e.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),n&&"undefined"!=n||"localhost"===e.domain||S("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),e.secure||"undefined"!==typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&C("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new K(e.host,e.secure,n,r),path:new B(e.pathString)}},G=function(t){var e="",n="",r="",i="",o=!0,a="https",s=443;if("string"===typeof t){var u=t.indexOf("//");u>=0&&(a=t.substring(0,u-1),t=t.substring(u+2));var c=t.indexOf("/");-1===c&&(c=t.length);var l=t.indexOf("?");-1===l&&(l=t.length),e=t.substring(0,Math.min(c,l)),c<l&&(i=function(t){for(var e="",n=t.split("/"),r=0;r<n.length;r++)if(n[r].length>0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(o){}e+="/"+i}return e}(t.substring(c,l)));var h=function(t){var e={};"?"===t.charAt(0)&&(t=t.substring(1));for(var n=0,r=t.split("&");n<r.length;n++){var i=r[n];if(0!==i.length){var o=i.split("=");2===o.length?e[decodeURIComponent(o[0])]=decodeURIComponent(o[1]):C("Invalid query segment '"+i+"' in query '"+t+"'")}}return e}(t.substring(Math.min(t.length,l)));(u=e.indexOf(":"))>=0?(o="https"===a||"wss"===a,s=parseInt(e.substring(u+1),10)):u=t.length;var f=e.split(".");3===f.length?(n=f[1],r=f[0].toLowerCase()):2===f.length?n=f[0]:"localhost"===f[0].slice(0,u).toLowerCase()&&(n="localhost"),""===r&&"ns"in h&&(r=h.ns)}return{host:e,port:s,domain:n,subdomain:r,secure:o,scheme:a,pathString:i}},Y=/[\[\].#$\/\u0000-\u001F\u007F]/,X=/[\[\].#$\u0000-\u001F\u007F]/,J=function(t){return"string"===typeof t&&0!==t.length&&!Y.test(t)},$=function(t){return"string"===typeof t&&0!==t.length&&!X.test(t)},Z=function(t){return null===t||"string"===typeof t||"number"===typeof t&&!I(t)||t&&"object"===typeof t&&o.contains(t,".sv")},tt=function(t,e,n,r,i){i&&void 0===n||et(o.errorPrefix(t,e,i),n,r)},et=function t(e,n,r){var i=r instanceof B?new q(r,e):r;if(void 0===n)throw new Error(e+"contains undefined "+i.toErrorString());if("function"===typeof n)throw new Error(e+"contains a function "+i.toErrorString()+" with contents = "+n.toString());if(I(n))throw new Error(e+"contains "+n.toString()+" "+i.toErrorString());if("string"===typeof n&&n.length>10485760/3&&o.stringLength(n)>10485760)throw new Error(e+"contains a string greater than 10485760 utf8 bytes "+i.toErrorString()+" ('"+n.substring(0,50)+"...')");if(n&&"object"===typeof n){var a=!1,s=!1;if(o.forEach(n,function(n,r){if(".value"===n)a=!0;else if(".priority"!==n&&".sv"!==n&&(s=!0,!J(n)))throw new Error(e+" contains an invalid key ("+n+") "+i.toErrorString()+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');i.push(n),t(e,r,i),i.pop()}),a&&s)throw new Error(e+' contains ".value" child '+i.toErrorString()+" in addition to actual children.")}},nt=function(t,e,n,r,i){if(!i||void 0!==n){var a=o.errorPrefix(t,e,i);if(!n||"object"!==typeof n||Array.isArray(n))throw new Error(a+" must be an object containing the children to replace.");var s=[];o.forEach(n,function(t,e){var n=new B(t);if(et(a,e,r.child(n)),".priority"===n.getBack()&&!Z(e))throw new Error(a+"contains an invalid value for '"+n.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(n)}),function(t,e){var n,r;for(n=0;n<e.length;n++)for(var i=(r=e[n]).slice(),o=0;o<i.length;o++)if(".priority"===i[o]&&o===i.length-1);else if(!J(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+r.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');e.sort(B.comparePaths);var a=null;for(n=0;n<e.length;n++){if(r=e[n],null!==a&&a.contains(r))throw new Error(t+"contains a path "+a.toString()+" that is ancestor of another path "+r.toString());a=r}}(a,s)}},rt=function(t,e,n,r){if(!r||void 0!==n){if(I(n))throw new Error(o.errorPrefix(t,e,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!Z(n))throw new Error(o.errorPrefix(t,e,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},it=function(t,e,n,r){if(!r||void 0!==n)switch(n){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error(o.errorPrefix(t,e,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}},ot=function(t,e,n,r){if((!r||void 0!==n)&&!J(n))throw new Error(o.errorPrefix(t,e,r)+'was an invalid key = "'+n+'".  Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')},at=function(t,e,n,r){if((!r||void 0!==n)&&!$(n))throw new Error(o.errorPrefix(t,e,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},st=function(t,e){if(".info"===e.getFront())throw new Error(t+" failed = Can't modify data under /.info/")},ut=function(t,e,n){var r=n.path.toString();if("string"!==typeof n.repoInfo.host||0===n.repoInfo.host.length||!J(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==r.length&&!function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),$(t)}(r))throw new Error(o.errorPrefix(t,e,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')},ct=function(){function t(t,e){this.repo_=t,this.path_=e}return t.prototype.cancel=function(t){o.validateArgCount("OnDisconnect.cancel",0,1,arguments.length),o.validateCallback("OnDisconnect.cancel",1,t,!0);var e=new o.Deferred;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},t.prototype.remove=function(t){o.validateArgCount("OnDisconnect.remove",0,1,arguments.length),st("OnDisconnect.remove",this.path_),o.validateCallback("OnDisconnect.remove",1,t,!0);var e=new o.Deferred;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},t.prototype.set=function(t,e){o.validateArgCount("OnDisconnect.set",1,2,arguments.length),st("OnDisconnect.set",this.path_),tt("OnDisconnect.set",1,t,this.path_,!1),o.validateCallback("OnDisconnect.set",2,e,!0);var n=new o.Deferred;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},t.prototype.setWithPriority=function(t,e,n){o.validateArgCount("OnDisconnect.setWithPriority",2,3,arguments.length),st("OnDisconnect.setWithPriority",this.path_),tt("OnDisconnect.setWithPriority",1,t,this.path_,!1),rt("OnDisconnect.setWithPriority",2,e,!1),o.validateCallback("OnDisconnect.setWithPriority",3,n,!0);var r=new o.Deferred;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},t.prototype.update=function(t,e){if(o.validateArgCount("OnDisconnect.update",1,2,arguments.length),st("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,C("Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}nt("OnDisconnect.update",1,t,this.path_,!1),o.validateCallback("OnDisconnect.update",2,e,!0);var i=new o.Deferred;return this.repo_.onDisconnectUpdate(this.path_,t,i.wrapCallback(e)),i.promise},t}(),lt=function(){function t(t,e){this.committed=t,this.snapshot=e}return t.prototype.toJSON=function(){return o.validateArgCount("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},t}(),ht=function(){var t="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",e=0,n=[];return function(r){var i,a=r===e;e=r;var s=new Array(8);for(i=7;i>=0;i--)s[i]=t.charAt(r%64),r=Math.floor(r/64);o.assert(0===r,"Cannot push at time == 0");var u=s.join("");if(a){for(i=11;i>=0&&63===n[i];i--)n[i]=0;n[i]++}else for(i=0;i<12;i++)n[i]=Math.floor(64*Math.random());for(i=0;i<12;i++)u+=t.charAt(n[i]);return o.assert(20===u.length,"nextPushId: Length should be 20."),u}}(),ft=function(){function t(t,e){this.name=t,this.node=e}return t.Wrap=function(e,n){return new t(e,n)},t}(),pt=function(){function t(){}return t.prototype.getCompare=function(){return this.compare.bind(this)},t.prototype.indexedValueChanged=function(t,e){var n=new ft(N,t),r=new ft(N,e);return 0!==this.compare(n,r)},t.prototype.minPost=function(){return ft.MIN},t}(),dt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s.__extends(e,t),Object.defineProperty(e,"__EMPTY_NODE",{get:function(){return Q},set:function(t){Q=t},enumerable:!0,configurable:!0}),e.prototype.compare=function(t,e){return D(t.name,e.name)},e.prototype.isDefinedOn=function(t){throw o.assertionError("KeyIndex.isDefinedOn not expected to be called.")},e.prototype.indexedValueChanged=function(t,e){return!1},e.prototype.minPost=function(){return ft.MIN},e.prototype.maxPost=function(){return new ft(k,Q)},e.prototype.makePost=function(t,e){return o.assert("string"===typeof t,"KeyIndex indexValue must always be a string."),new ft(t,Q)},e.prototype.toString=function(){return".key"},e}(pt),yt=new dt;var mt,gt,vt,bt=function(t){return"number"===typeof t?"number:"+L(t):"string:"+t},_t=function(t){if(t.isLeafNode()){var e=t.val();o.assert("string"===typeof e||"number"===typeof e||"object"===typeof e&&o.contains(e,".sv"),"Priority must be a string or number.")}else o.assert(t===H||t.isEmpty(),"priority of unexpected type.");o.assert(t===H||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},wt=function(){function t(e,n){void 0===n&&(n=t.__childrenNodeConstructor.EMPTY_NODE),this.value_=e,this.priorityNode_=n,this.lazyHash_=null,o.assert(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),_t(this.priorityNode_)}return Object.defineProperty(t,"__childrenNodeConstructor",{get:function(){return mt},set:function(t){mt=t},enumerable:!0,configurable:!0}),t.prototype.isLeafNode=function(){return!0},t.prototype.getPriority=function(){return this.priorityNode_},t.prototype.updatePriority=function(e){return new t(this.value_,e)},t.prototype.getImmediateChild=function(e){return".priority"===e?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.getChild=function(e){return e.isEmpty()?this:".priority"===e.getFront()?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.hasChild=function(){return!1},t.prototype.getPredecessorChildName=function(t,e){return null},t.prototype.updateImmediateChild=function(e,n){return".priority"===e?this.updatePriority(n):n.isEmpty()&&".priority"!==e?this:t.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.priorityNode_)},t.prototype.updateChild=function(e,n){var r=e.getFront();return null===r?n:n.isEmpty()&&".priority"!==r?this:(o.assert(".priority"!==r||1===e.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(r,t.__childrenNodeConstructor.EMPTY_NODE.updateChild(e.popFront(),n)))},t.prototype.isEmpty=function(){return!1},t.prototype.numChildren=function(){return 0},t.prototype.forEachChild=function(t,e){return!1},t.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},t.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.priorityNode_.isEmpty()||(t+="priority:"+bt(this.priorityNode_.val())+":");var e=typeof this.value_;t+=e+":",t+="number"===e?L(this.value_):this.value_,this.lazyHash_=m(t)}return this.lazyHash_},t.prototype.getValue=function(){return this.value_},t.prototype.compareTo=function(e){return e===t.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof t.__childrenNodeConstructor?-1:(o.assert(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))},t.prototype.compareToLeafNode_=function(e){var n=typeof e.value_,r=typeof this.value_,i=t.VALUE_TYPE_ORDER.indexOf(n),a=t.VALUE_TYPE_ORDER.indexOf(r);return o.assert(i>=0,"Unknown leaf type: "+n),o.assert(a>=0,"Unknown leaf type: "+r),i===a?"object"===r?0:this.value_<e.value_?-1:this.value_===e.value_?0:1:a-i},t.prototype.withIndex=function(){return this},t.prototype.isIndexed=function(){return!0},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode()){var e=t;return this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}return!1},t.VALUE_TYPE_ORDER=["object","boolean","number","string"],t}();var Et,Tt,St=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),i=n.compareTo(r);return 0===i?D(t.name,e.name):i},e.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},e.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},e.prototype.minPost=function(){return ft.MIN},e.prototype.maxPost=function(){return new ft(k,new wt("[PRIORITY-POST]",vt))},e.prototype.makePost=function(t,e){var n=gt(t);return new ft(e,new wt("[PRIORITY-POST]",n))},e.prototype.toString=function(){return".priority"},e}(pt)),Ct=function(){function t(t,e,n,r,i){void 0===i&&(i=null),this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];for(var o=1;!t.isEmpty();)if(t=t,o=e?n(t.key,e):1,r&&(o*=-1),o<0)t=this.isReverse_?t.left:t.right;else{if(0===o){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}return t.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var t,e=this.nodeStack_.pop();if(t=this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value},this.isReverse_)for(e=e.left;!e.isEmpty();)this.nodeStack_.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack_.push(e),e=e.left;return t},t.prototype.hasNext=function(){return this.nodeStack_.length>0},t.prototype.peek=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}},t}(),It=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:kt.EMPTY_NODE,this.right=null!=o?o:kt.EMPTY_NODE}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.count=function(){return this.left.count()+1+this.right.count()},t.prototype.isEmpty=function(){return!1},t.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},t.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},t.prototype.minKey=function(){return this.min_().key},t.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},t.prototype.insert=function(t,e,n){var r,i;return(i=(r=n(t,(i=this).key))<0?i.copy(null,null,null,i.left.insert(t,e,n),null):0===r?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n))).fixUp_()},t.prototype.removeMin_=function(){if(this.left.isEmpty())return kt.EMPTY_NODE;var t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),(t=t.copy(null,null,null,t.left.removeMin_(),null)).fixUp_()},t.prototype.remove=function(t,e){var n,r;if(e(t,(n=this).key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return kt.EMPTY_NODE;r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()},t.prototype.isRed_=function(){return this.color},t.prototype.fixUp_=function(){var t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t},t.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t.right.left.isRed_()&&(t=(t=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_()),t},t.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=(t=t.rotateRight_()).colorFlip_()),t},t.prototype.rotateLeft_=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.rotateRight_=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.colorFlip_=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},t.prototype.check_=function(){var t;if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");if((t=this.left.check_())!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)},t.RED=!0,t.BLACK=!1,t}(),Nt=function(){function t(){}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new It(t,e,null)},t.prototype.remove=function(t,e){return this},t.prototype.count=function(){return 0},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(t){return!1},t.prototype.reverseTraversal=function(t){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.check_=function(){return 0},t.prototype.isRed_=function(){return!1},t}(),kt=function(){function t(e,n){void 0===n&&(n=t.EMPTY_NODE),this.comparator_=e,this.root_=n}return t.prototype.insert=function(e,n){return new t(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,It.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,It.BLACK,null,null))},t.prototype.get=function(t){for(var e,n=this.root_;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key)))return n.value;e<0?n=n.left:e>0&&(n=n.right)}return null},t.prototype.getPredecessorKey=function(t){for(var e,n=this.root_,r=null;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:e>0&&(r=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key.  What gives?")},t.prototype.isEmpty=function(){return this.root_.isEmpty()},t.prototype.count=function(){return this.root_.count()},t.prototype.minKey=function(){return this.root_.minKey()},t.prototype.maxKey=function(){return this.root_.maxKey()},t.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},t.prototype.getIterator=function(t){return new Ct(this.root_,null,this.comparator_,!1,t)},t.prototype.getIteratorFrom=function(t,e){return new Ct(this.root_,t,this.comparator_,!1,e)},t.prototype.getReverseIteratorFrom=function(t,e){return new Ct(this.root_,t,this.comparator_,!0,e)},t.prototype.getReverseIterator=function(t){return new Ct(this.root_,null,this.comparator_,!0,t)},t.EMPTY_NODE=new Nt,t}(),Dt=Math.log(2),At=function(){function t(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/Dt,10)),this.current_=this.count-1;var n,r=(n=this.count,parseInt(Array(n+1).join("1"),2));this.bits_=t+1&r}return t.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},t}(),Ot=function(t,e,n,r){t.sort(e);var i=function(e){for(var r=null,i=null,o=t.length,a=function(e,r){var i=o-e,a=o;o-=e;var u=function e(r,i){var o,a,s=i-r;if(0==s)return null;if(1==s)return o=t[r],a=n?n(o):o,new It(a,o.node,It.BLACK,null,null);var u=parseInt(s/2,10)+r,c=e(r,u),l=e(u+1,i);return o=t[u],a=n?n(o):o,new It(a,o.node,It.BLACK,c,l)}(i+1,a),c=t[i],l=n?n(c):c;s(new It(l,c.node,r,null,u))},s=function(t){r?(r.left=t,r=t):(i=t,r=t)},u=0;u<e.count;++u){var c=e.nextBitIsOne(),l=Math.pow(2,e.count-(u+1));c?a(l,It.BLACK):(a(l,It.BLACK),a(l,It.RED))}return i}(new At(t.length));return new kt(r||e,i)},Rt={},Pt=function(){function t(t,e){this.indexes_=t,this.indexSet_=e}return Object.defineProperty(t,"Default",{get:function(){return o.assert(Rt&&St,"ChildrenNode.ts has not been loaded"),Et=Et||new t({".priority":Rt},{".priority":St})},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var e=o.safeGet(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e===Rt?null:e},t.prototype.hasIndex=function(t){return o.contains(this.indexSet_,t.toString())},t.prototype.addIndex=function(e,n){o.assert(e!==yt,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var r,i=[],a=!1,s=n.getIterator(ft.Wrap),u=s.getNext();u;)a=a||e.isDefinedOn(u.node),i.push(u),u=s.getNext();r=a?Ot(i,e.getCompare()):Rt;var c=e.toString(),l=o.clone(this.indexSet_);l[c]=e;var h=o.clone(this.indexes_);return h[c]=r,new t(h,l)},t.prototype.addToIndexes=function(e,n){var r=this;return new t(o.map(this.indexes_,function(t,i){var a=o.safeGet(r.indexSet_,i);if(o.assert(a,"Missing index implementation for "+i),t===Rt){if(a.isDefinedOn(e.node)){for(var s=[],u=n.getIterator(ft.Wrap),c=u.getNext();c;)c.name!=e.name&&s.push(c),c=u.getNext();return s.push(e),Ot(s,a.getCompare())}return Rt}var l=n.get(e.name),h=t;return l&&(h=h.remove(new ft(e.name,l))),h.insert(e,e.node)}),this.indexSet_)},t.prototype.removeFromIndexes=function(e,n){return new t(o.map(this.indexes_,function(t){if(t===Rt)return t;var r=n.get(e.name);return r?t.remove(new ft(e.name,r)):t}),this.indexSet_)},t}();function xt(t,e){return D(t.name,e.name)}function Lt(t,e){return D(t,e)}var Mt=function(){function t(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&_t(this.priorityNode_),this.children_.isEmpty()&&o.assert(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}return Object.defineProperty(t,"EMPTY_NODE",{get:function(){return Tt||(Tt=new t(new kt(Lt),null,Pt.Default))},enumerable:!0,configurable:!0}),t.prototype.isLeafNode=function(){return!1},t.prototype.getPriority=function(){return this.priorityNode_||Tt},t.prototype.updatePriority=function(e){return this.children_.isEmpty()?this:new t(this.children_,e,this.indexMap_)},t.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();var e=this.children_.get(t);return null===e?Tt:e},t.prototype.getChild=function(t){var e=t.getFront();return null===e?this:this.getImmediateChild(e).getChild(t.popFront())},t.prototype.hasChild=function(t){return null!==this.children_.get(t)},t.prototype.updateImmediateChild=function(e,n){if(o.assert(n,"We should always be passing snapshot nodes"),".priority"===e)return this.updatePriority(n);var r,i=new ft(e,n),a=void 0,s=void 0;return n.isEmpty()?(a=this.children_.remove(e),s=this.indexMap_.removeFromIndexes(i,this.children_)):(a=this.children_.insert(e,n),s=this.indexMap_.addToIndexes(i,this.children_)),r=a.isEmpty()?Tt:this.priorityNode_,new t(a,r,s)},t.prototype.updateChild=function(t,e){var n=t.getFront();if(null===n)return e;o.assert(".priority"!==t.getFront()||1===t.getLength(),".priority must be the last token in a path");var r=this.getImmediateChild(n).updateChild(t.popFront(),e);return this.updateImmediateChild(n,r)},t.prototype.isEmpty=function(){return this.children_.isEmpty()},t.prototype.numChildren=function(){return this.children_.count()},t.prototype.val=function(e){if(this.isEmpty())return null;var n={},r=0,i=0,o=!0;if(this.forEachChild(St,function(a,s){n[a]=s.val(e),r++,o&&t.INTEGER_REGEXP_.test(a)?i=Math.max(i,Number(a)):o=!1}),!e&&o&&i<2*r){var a=[];for(var s in n)a[s]=n[s];return a}return e&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n},t.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.getPriority().isEmpty()||(t+="priority:"+bt(this.getPriority().val())+":"),this.forEachChild(St,function(e,n){var r=n.hash();""!==r&&(t+=":"+e+":"+r)}),this.lazyHash_=""===t?"":m(t)}return this.lazyHash_},t.prototype.getPredecessorChildName=function(t,e,n){var r=this.resolveIndex_(n);if(r){var i=r.getPredecessorKey(new ft(t,e));return i?i.name:null}return this.children_.getPredecessorKey(t)},t.prototype.getFirstChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.minKey();return n&&n.name}return this.children_.minKey()},t.prototype.getFirstChild=function(t){var e=this.getFirstChildName(t);return e?new ft(e,this.children_.get(e)):null},t.prototype.getLastChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.maxKey();return n&&n.name}return this.children_.maxKey()},t.prototype.getLastChild=function(t){var e=this.getLastChildName(t);return e?new ft(e,this.children_.get(e)):null},t.prototype.forEachChild=function(t,e){var n=this.resolveIndex_(t);return n?n.inorderTraversal(function(t){return e(t.name,t.node)}):this.children_.inorderTraversal(e)},t.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},t.prototype.getIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,function(t){return t});for(var r=this.children_.getIteratorFrom(t.name,ft.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},t.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},t.prototype.getReverseIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,function(t){return t});for(var r=this.children_.getReverseIteratorFrom(t.name,ft.Wrap),i=r.peek();null!=i&&e.compare(i,t)>0;)r.getNext(),i=r.peek();return r},t.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Ft?-1:0},t.prototype.withIndex=function(e){if(e===yt||this.indexMap_.hasIndex(e))return this;var n=this.indexMap_.addIndex(e,this.children_);return new t(this.children_,this.priorityNode_,n)},t.prototype.isIndexed=function(t){return t===yt||this.indexMap_.hasIndex(t)},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;var e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()===e.children_.count()){for(var n=this.getIterator(St),r=e.getIterator(St),i=n.getNext(),o=r.getNext();i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1}return!1},t.prototype.resolveIndex_=function(t){return t===yt?null:this.indexMap_.get(t.toString())},t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t}(),Ft=new(function(t){function e(){return t.call(this,new kt(Lt),Mt.EMPTY_NODE,Pt.Default)||this}return s.__extends(e,t),e.prototype.compareTo=function(t){return t===this?0:1},e.prototype.equals=function(t){return t===this},e.prototype.getPriority=function(){return this},e.prototype.getImmediateChild=function(t){return Mt.EMPTY_NODE},e.prototype.isEmpty=function(){return!1},e}(Mt));Object.defineProperties(ft,{MIN:{value:new ft(N,Mt.EMPTY_NODE)},MAX:{value:new ft(k,Ft)}}),dt.__EMPTY_NODE=Mt.EMPTY_NODE,wt.__childrenNodeConstructor=Mt,H=Ft,function(t){vt=t}(Ft);var Ut=!0;function jt(t,e){if(void 0===e&&(e=null),null===t)return Mt.EMPTY_NODE;if("object"===typeof t&&".priority"in t&&(e=t[".priority"]),o.assert(null===e||"string"===typeof e||"number"===typeof e||"object"===typeof e&&".sv"in e,"Invalid priority type found: "+typeof e),"object"===typeof t&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!==typeof t||".sv"in t)return new wt(t,jt(e));if(t instanceof Array||!Ut){var n=Mt.EMPTY_NODE,r=t;return o.forEach(r,function(t,e){if(o.contains(r,t)&&"."!==t.substring(0,1)){var i=jt(e);!i.isLeafNode()&&i.isEmpty()||(n=n.updateImmediateChild(t,i))}}),n.updatePriority(jt(e))}var i=[],a=!1,s=t;if(o.forEach(s,function(t,e){if("string"!==typeof t||"."!==t.substring(0,1)){var n=jt(s[t]);n.isEmpty()||(a=a||!n.getPriority().isEmpty(),i.push(new ft(t,n)))}}),0==i.length)return Mt.EMPTY_NODE;var u=Ot(i,xt,function(t){return t.name},Lt);if(a){var c=Ot(i,St.getCompare());return new Mt(u,jt(e),new Pt({".priority":c},{".priority":St}))}return new Mt(u,jt(e),Pt.Default)}!function(t){gt=t}(jt);var Vt,Bt,qt=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?D(t.name,e.name):n},e.prototype.isDefinedOn=function(t){return!0},e.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},e.prototype.minPost=function(){return ft.MIN},e.prototype.maxPost=function(){return ft.MAX},e.prototype.makePost=function(t,e){var n=jt(t);return new ft(e,n)},e.prototype.toString=function(){return".value"},e}(pt)),Wt=function(t){function e(e){var n=t.call(this)||this;return n.indexPath_=e,o.assert(!e.isEmpty()&&".priority"!==e.getFront(),"Can't create PathIndex with empty path or .priority key"),n}return s.__extends(e,t),e.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},e.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},e.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),i=n.compareTo(r);return 0===i?D(t.name,e.name):i},e.prototype.makePost=function(t,e){var n=jt(t),r=Mt.EMPTY_NODE.updateChild(this.indexPath_,n);return new ft(e,r)},e.prototype.maxPost=function(){var t=Mt.EMPTY_NODE.updateChild(this.indexPath_,Ft);return new ft(k,t)},e.prototype.toString=function(){return this.indexPath_.slice().join("/")},e}(pt),Kt=function(){function t(t,e,n){this.node_=t,this.ref_=e,this.index_=n}return t.prototype.val=function(){return o.validateArgCount("DataSnapshot.val",0,0,arguments.length),this.node_.val()},t.prototype.exportVal=function(){return o.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},t.prototype.toJSON=function(){return o.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},t.prototype.exists=function(){return o.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},t.prototype.child=function(e){o.validateArgCount("DataSnapshot.child",0,1,arguments.length),e=String(e),at("DataSnapshot.child",1,e,!1);var n=new B(e),r=this.ref_.child(n);return new t(this.node_.getChild(n),r,St)},t.prototype.hasChild=function(t){o.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),at("DataSnapshot.hasChild",1,t,!1);var e=new B(t);return!this.node_.getChild(e).isEmpty()},t.prototype.getPriority=function(){return o.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},t.prototype.forEach=function(e){var n=this;return o.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),o.validateCallback("DataSnapshot.forEach",1,e,!1),!this.node_.isLeafNode()&&!!this.node_.forEachChild(this.index_,function(r,i){return e(new t(i,n.ref_.child(r),St))})},t.prototype.hasChildren=function(){return o.validateArgCount("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(t.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!0,configurable:!0}),t.prototype.numChildren=function(){return o.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},t.prototype.getRef=function(){return o.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),Qt=function(){function t(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}return t.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},t.prototype.getEventType=function(){return this.eventType},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+o.stringify(this.snapshot.exportVal())},t}(),Ht=function(){function t(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}return t.prototype.getPath=function(){return this.path},t.prototype.getEventType=function(){return"cancel"},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.path.toString()+":cancel"},t}(),zt=function(){function t(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){return"value"===t},t.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new Qt("value",this,new Kt(t.snapshotNode,e.getRef(),n))},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){o.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callback_;return function(){r.call(e,t.snapshot)}},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new Ht(this,t,e):null},t.prototype.matches=function(e){return e instanceof t&&(!e.callback_||!this.callback_||e.callback_===this.callback_&&e.context_===this.context_)},t.prototype.hasAnyCallback=function(){return null!==this.callback_},t}(),Gt=function(){function t(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,o.contains(this.callbacks_,e)},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new Ht(this,t,e):null},t.prototype.createEvent=function(t,e){o.assert(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new Qt(t.type,this,new Kt(t.snapshotNode,n,r),t.prevName)},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){o.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callbacks_[t.eventType];return function(){r.call(e,t.snapshot,t.prevName)}},t.prototype.matches=function(e){if(e instanceof t){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var n=o.getCount(e.callbacks_);if(n===o.getCount(this.callbacks_)){if(1===n){var r=o.getAnyKey(e.callbacks_),i=o.getAnyKey(this.callbacks_);return i===r&&(!e.callbacks_[r]||!this.callbacks_[i]||e.callbacks_[r]===this.callbacks_[i])}return o.every(this.callbacks_,function(t,n){return e.callbacks_[t]===n})}}}return!1},t.prototype.hasAnyCallback=function(){return null!==this.callbacks_},t}(),Yt=function(){function t(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return o.assert(Vt,"Reference.ts has not been loaded"),Vt},set:function(t){Vt=t},enumerable:!0,configurable:!0}),t.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===yt){var r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!=N)throw new Error(r);if("string"!==typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!=k)throw new Error(r);if("string"!==typeof n)throw new Error(i)}}else if(t.getIndex()===St){if(null!=e&&!Z(e)||null!=n&&!Z(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(o.assert(t.getIndex()instanceof Wt||t.getIndex()===qt,"unknown index type."),null!=e&&"object"===typeof e||null!=n&&"object"===typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},t.validateLimit_=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},t.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},t.prototype.getQueryParams=function(){return this.queryParams_},t.prototype.getRef=function(){return o.validateArgCount("Query.ref",0,0,arguments.length),new t.__referenceConstructor(this.repo,this.path)},t.prototype.on=function(e,n,r,i){o.validateArgCount("Query.on",2,4,arguments.length),it("Query.on",1,e,!1),o.validateCallback("Query.on",2,n,!1);var a=t.getCancelAndContextArgs_("Query.on",r,i);if("value"===e)this.onValueEvent(n,a.cancel,a.context);else{var s={};s[e]=n,this.onChildEvent(s,a.cancel,a.context)}return n},t.prototype.onValueEvent=function(t,e,n){var r=new zt(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},t.prototype.onChildEvent=function(t,e,n){var r=new Gt(t,e,n);this.repo.addEventCallbackForQuery(this,r)},t.prototype.off=function(t,e,n){o.validateArgCount("Query.off",0,3,arguments.length),it("Query.off",1,t,!0),o.validateCallback("Query.off",2,e,!0),o.validateContextObject("Query.off",3,n,!0);var r=null,i=null;"value"===t?r=new zt(e||null,null,n||null):t&&(e&&((i={})[t]=e),r=new Gt(i,null,n||null));this.repo.removeEventCallbackForQuery(this,r)},t.prototype.once=function(e,n,r,i){var a=this;o.validateArgCount("Query.once",1,4,arguments.length),it("Query.once",1,e,!1),o.validateCallback("Query.once",2,n,!0);var s=t.getCancelAndContextArgs_("Query.once",r,i),u=!0,c=new o.Deferred;c.promise.catch(function(){});var l=function t(r){u&&(u=!1,a.off(e,t),n&&n.bind(s.context)(r),c.resolve(r))};return this.on(e,l,function(t){a.off(e,l),s.cancel&&s.cancel.bind(s.context)(t),c.reject(t)}),c.promise},t.prototype.limitToFirst=function(e){if(o.validateArgCount("Query.limitToFirst",1,1,arguments.length),"number"!==typeof e||Math.floor(e)!==e||e<=0)throw new Error("Query.limitToFirst: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.queryParams_.limitToFirst(e),this.orderByCalled_)},t.prototype.limitToLast=function(e){if(o.validateArgCount("Query.limitToLast",1,1,arguments.length),"number"!==typeof e||Math.floor(e)!==e||e<=0)throw new Error("Query.limitToLast: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.queryParams_.limitToLast(e),this.orderByCalled_)},t.prototype.orderByChild=function(e){if(o.validateArgCount("Query.orderByChild",1,1,arguments.length),"$key"===e)throw new Error('Query.orderByChild: "$key" is invalid.  Use Query.orderByKey() instead.');if("$priority"===e)throw new Error('Query.orderByChild: "$priority" is invalid.  Use Query.orderByPriority() instead.');if("$value"===e)throw new Error('Query.orderByChild: "$value" is invalid.  Use Query.orderByValue() instead.');at("Query.orderByChild",1,e,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var n=new B(e);if(n.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path.  Use Query.orderByValue() instead.");var r=new Wt(n),i=this.queryParams_.orderBy(r);return t.validateQueryEndpoints_(i),new t(this.repo,this.path,i,!0)},t.prototype.orderByKey=function(){o.validateArgCount("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var e=this.queryParams_.orderBy(yt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByPriority=function(){o.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var e=this.queryParams_.orderBy(St);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByValue=function(){o.validateArgCount("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var e=this.queryParams_.orderBy(qt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.startAt=function(e,n){void 0===e&&(e=null),o.validateArgCount("Query.startAt",0,2,arguments.length),tt("Query.startAt",1,e,this.path,!0),ot("Query.startAt",2,n,!0);var r=this.queryParams_.startAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===e&&(e=null,n=null),new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.endAt=function(e,n){void 0===e&&(e=null),o.validateArgCount("Query.endAt",0,2,arguments.length),tt("Query.endAt",1,e,this.path,!0),ot("Query.endAt",2,n,!0);var r=this.queryParams_.endAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.equalTo=function(t,e){if(o.validateArgCount("Query.equalTo",1,2,arguments.length),tt("Query.equalTo",1,t,this.path,!1),ot("Query.equalTo",2,e,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(t,e).endAt(t,e)},t.prototype.toString=function(){return o.validateArgCount("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},t.prototype.toJSON=function(){return o.validateArgCount("Query.toJSON",0,1,arguments.length),this.toString()},t.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},t.prototype.queryIdentifier=function(){var t=this.queryObject(),e=R(t);return"{}"===e?"default":e},t.prototype.isEqual=function(e){if(o.validateArgCount("Query.isEqual",1,1,arguments.length),!(e instanceof t)){throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.")}var n=this.repo===e.repo,r=this.path.equals(e.path),i=this.queryIdentifier()===e.queryIdentifier();return n&&r&&i},t.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,o.validateCallback(t,3,r.cancel,!0),r.context=n,o.validateContextObject(t,4,r.context,!0);else if(e)if("object"===typeof e&&null!==e)r.context=e;else{if("function"!==typeof e)throw new Error(o.errorPrefix(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),Xt=function(){function t(){this.set={}}return t.prototype.add=function(t,e){this.set[t]=null===e||e},t.prototype.contains=function(t){return o.contains(this.set,t)},t.prototype.get=function(t){return this.contains(t)?this.set[t]:void 0},t.prototype.remove=function(t){delete this.set[t]},t.prototype.clear=function(){this.set={}},t.prototype.isEmpty=function(){return o.isEmpty(this.set)},t.prototype.count=function(){return o.getCount(this.set)},t.prototype.each=function(t){o.forEach(this.set,function(e,n){return t(e,n)})},t.prototype.keys=function(){var t=[];return o.forEach(this.set,function(e){t.push(e)}),t},t}(),Jt=function(){function t(){this.value_=null,this.children_=null}return t.prototype.find=function(t){if(null!=this.value_)return this.value_.getChild(t);if(t.isEmpty()||null==this.children_)return null;var e=t.getFront();return t=t.popFront(),this.children_.contains(e)?this.children_.get(e).find(t):null},t.prototype.remember=function(e,n){if(e.isEmpty())this.value_=n,this.children_=null;else if(null!==this.value_)this.value_=this.value_.updateChild(e,n);else{null==this.children_&&(this.children_=new Xt);var r=e.getFront();this.children_.contains(r)||this.children_.add(r,new t);var i=this.children_.get(r);e=e.popFront(),i.remember(e,n)}},t.prototype.forget=function(t){if(t.isEmpty())return this.value_=null,this.children_=null,!0;if(null!==this.value_){if(this.value_.isLeafNode())return!1;var e=this.value_;this.value_=null;var n=this;return e.forEachChild(St,function(t,e){n.remember(new B(t),e)}),this.forget(t)}if(null!==this.children_){var r=t.getFront();if(t=t.popFront(),this.children_.contains(r))this.children_.get(r).forget(t)&&this.children_.remove(r);return!!this.children_.isEmpty()&&(this.children_=null,!0)}return!0},t.prototype.forEachTree=function(t,e){null!==this.value_?e(t,this.value_):this.forEachChild(function(n,r){var i=new B(t.toString()+"/"+n);r.forEachTree(i,e)})},t.prototype.forEachChild=function(t){null!==this.children_&&this.children_.each(function(e,n){t(e,n)})},t}(),$t=function(t,e){return t&&"object"===typeof t?(o.assert(".sv"in t,"Unexpected leaf node or priority contents"),e[t[".sv"]]):t},Zt=function t(e,n){var r,i=e.getPriority().val(),o=$t(i,n);if(e.isLeafNode()){var a=e,s=$t(a.getValue(),n);return s!==a.getValue()||o!==a.getPriority().val()?new wt(s,jt(o)):e}var u=e;return r=u,o!==u.getPriority().val()&&(r=r.updatePriority(new wt(o))),u.forEachChild(St,function(e,i){var o=t(i,n);o!==i&&(r=r.updateImmediateChild(e,o))}),r};!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(Bt||(Bt={}));var te,ee,ne=function(){function t(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,o.assert(!r||e,"Tagged queries must be from server.")}return t.User=new t(!0,!1,null,!1),t.Server=new t(!1,!0,null,!1),t.forServerTaggedQuery=function(e){return new t(!1,!0,e,!0)},t}(),re=function(){function t(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=Bt.ACK_USER_WRITE,this.source=ne.User}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return o.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var n=this.affectedTree.subtree(new B(e));return new t(B.Empty,n,this.revert)}return o.assert(this.path.getFront()===e,"operationForChild called for unrelated child."),new t(this.path.popFront(),this.affectedTree,this.revert)},t}(),ie=function(){return te||(te=new kt(A)),te},oe=function(){function t(t,e){void 0===e&&(e=ie()),this.value=t,this.children=e}return t.fromObject=function(e){var n=t.Empty;return o.forEach(e,function(t,e){n=n.set(new B(t),e)}),n},t.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},t.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:B.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null!==r){var i=r.findRootMostMatchingPathAndValue(t.popFront(),e);return null!=i?{path:new B(n).child(i.path),value:i.value}:null}return null},t.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},t.prototype.subtree=function(e){if(e.isEmpty())return this;var n=e.getFront(),r=this.children.get(n);return null!==r?r.subtree(e.popFront()):t.Empty},t.prototype.set=function(e,n){if(e.isEmpty())return new t(n,this.children);var r=e.getFront(),i=(this.children.get(r)||t.Empty).set(e.popFront(),n),o=this.children.insert(r,i);return new t(this.value,o)},t.prototype.remove=function(e){if(e.isEmpty())return this.children.isEmpty()?t.Empty:new t(null,this.children);var n=e.getFront(),r=this.children.get(n);if(r){var i=r.remove(e.popFront()),o=void 0;return o=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&o.isEmpty()?t.Empty:new t(this.value,o)}return this},t.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),n=this.children.get(e);return n?n.get(t.popFront()):null},t.prototype.setTree=function(e,n){if(e.isEmpty())return n;var r=e.getFront(),i=(this.children.get(r)||t.Empty).setTree(e.popFront(),n),o=void 0;return o=i.isEmpty()?this.children.remove(r):this.children.insert(r,i),new t(this.value,o)},t.prototype.fold=function(t){return this.fold_(B.Empty,t)},t.prototype.fold_=function(t,e){var n={};return this.children.inorderTraversal(function(r,i){n[r]=i.fold_(t.child(r),e)}),e(t,this.value,n)},t.prototype.findOnPath=function(t,e){return this.findOnPath_(t,B.Empty,e)},t.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),o=this.children.get(i);return o?o.findOnPath_(t.popFront(),e.child(i),n):null},t.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,B.Empty,e)},t.prototype.foreachOnPath_=function(e,n,r){if(e.isEmpty())return this;this.value&&r(n,this.value);var i=e.getFront(),o=this.children.get(i);return o?o.foreachOnPath_(e.popFront(),n.child(i),r):t.Empty},t.prototype.foreach=function(t){this.foreach_(B.Empty,t)},t.prototype.foreach_=function(t,e){this.children.inorderTraversal(function(n,r){r.foreach_(t.child(n),e)}),this.value&&e(t,this.value)},t.prototype.foreachChild=function(t){this.children.inorderTraversal(function(e,n){n.value&&t(e,n.value)})},t.Empty=new t(null),t}(),ae=function(){function t(t,e){this.source=t,this.path=e,this.type=Bt.LISTEN_COMPLETE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,B.Empty):new t(this.source,this.path.popFront())},t}(),se=function(){function t(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=Bt.OVERWRITE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,B.Empty,this.snap.getImmediateChild(e)):new t(this.source,this.path.popFront(),this.snap)},t}(),ue=function(){function t(t,e,n){this.source=t,this.path=e,this.children=n,this.type=Bt.MERGE}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){var n=this.children.subtree(new B(e));return n.isEmpty()?null:n.value?new se(this.source,B.Empty,n.value):new t(this.source,B.Empty,n)}return o.assert(this.path.getFront()===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,this.path.popFront(),this.children)},t.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},t}(),ce=function(){function t(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}return t.prototype.isFullyInitialized=function(){return this.fullyInitialized_},t.prototype.isFiltered=function(){return this.filtered_},t.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var e=t.getFront();return this.isCompleteForChild(e)},t.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},t.prototype.getNode=function(){return this.node_},t}(),le=function(){function t(t,e){this.eventCache_=t,this.serverCache_=e}return t.prototype.updateEventSnap=function(e,n,r){return new t(new ce(e,n,r),this.serverCache_)},t.prototype.updateServerSnap=function(e,n,r){return new t(this.eventCache_,new ce(e,n,r))},t.prototype.getEventCache=function(){return this.eventCache_},t.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},t.prototype.getServerCache=function(){return this.serverCache_},t.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},t.Empty=new t(new ce(Mt.EMPTY_NODE,!1,!1),new ce(Mt.EMPTY_NODE,!1,!1)),t}(),he=function(){function t(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}return t.valueChange=function(e){return new t(t.VALUE,e)},t.childAddedChange=function(e,n){return new t(t.CHILD_ADDED,n,e)},t.childRemovedChange=function(e,n){return new t(t.CHILD_REMOVED,n,e)},t.childChangedChange=function(e,n,r){return new t(t.CHILD_CHANGED,n,e,r)},t.childMovedChange=function(e,n){return new t(t.CHILD_MOVED,n,e)},t.CHILD_ADDED="child_added",t.CHILD_REMOVED="child_removed",t.CHILD_CHANGED="child_changed",t.CHILD_MOVED="child_moved",t.VALUE="value",t}(),fe=function(){function t(t){this.index_=t}return t.prototype.updateChild=function(t,e,n,r,i,a){o.assert(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var s=t.getImmediateChild(e);return s.getChild(r).equals(n.getChild(r))&&s.isEmpty()==n.isEmpty()?t:(null!=a&&(n.isEmpty()?t.hasChild(e)?a.trackChildChange(he.childRemovedChange(e,s)):o.assert(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?a.trackChildChange(he.childAddedChange(e,n)):a.trackChildChange(he.childChangedChange(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},t.prototype.updateFullNode=function(t,e,n){return null!=n&&(t.isLeafNode()||t.forEachChild(St,function(t,r){e.hasChild(t)||n.trackChildChange(he.childRemovedChange(t,r))}),e.isLeafNode()||e.forEachChild(St,function(e,r){if(t.hasChild(e)){var i=t.getImmediateChild(e);i.equals(r)||n.trackChildChange(he.childChangedChange(e,r,i))}else n.trackChildChange(he.childAddedChange(e,r))})),e.withIndex(this.index_)},t.prototype.updatePriority=function(t,e){return t.isEmpty()?Mt.EMPTY_NODE:t.updatePriority(e)},t.prototype.filtersNodes=function(){return!1},t.prototype.getIndexedFilter=function(){return this},t.prototype.getIndex=function(){return this.index_},t}(),pe=function(){function t(){this.changeMap_={}}return t.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;o.assert(e==he.CHILD_ADDED||e==he.CHILD_CHANGED||e==he.CHILD_REMOVED,"Only child changes supported for tracking"),o.assert(".priority"!==n,"Only non-priority child changes can be tracked.");var r=o.safeGet(this.changeMap_,n);if(r){var i=r.type;if(e==he.CHILD_ADDED&&i==he.CHILD_REMOVED)this.changeMap_[n]=he.childChangedChange(n,t.snapshotNode,r.snapshotNode);else if(e==he.CHILD_REMOVED&&i==he.CHILD_ADDED)delete this.changeMap_[n];else if(e==he.CHILD_REMOVED&&i==he.CHILD_CHANGED)this.changeMap_[n]=he.childRemovedChange(n,r.oldSnap);else if(e==he.CHILD_CHANGED&&i==he.CHILD_ADDED)this.changeMap_[n]=he.childAddedChange(n,t.snapshotNode);else{if(e!=he.CHILD_CHANGED||i!=he.CHILD_CHANGED)throw o.assertionError("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap_[n]=he.childChangedChange(n,t.snapshotNode,r.oldSnap)}}else this.changeMap_[n]=t},t.prototype.getChanges=function(){return o.getValues(this.changeMap_)},t}(),de=new(function(){function t(){}return t.prototype.getCompleteChild=function(t){return null},t.prototype.getChildAfterChild=function(t,e,n){return null},t}()),ye=function(){function t(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}return t.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.optCompleteServerCache_?new ce(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,n)},t.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),i=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===i.length?null:i[0]},t}(),me=function(){return function(t,e){this.viewCache=t,this.changes=e}}(),ge=function(){function t(t){this.filter_=t}return t.prototype.assertIndexed=function(t){o.assert(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),o.assert(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},t.prototype.applyOperation=function(e,n,r,i){var a,s,u=new pe;if(n.type===Bt.OVERWRITE){var c=n;c.source.fromUser?a=this.applyUserOverwrite_(e,c.path,c.snap,r,i,u):(o.assert(c.source.fromServer,"Unknown source."),s=c.source.tagged||e.getServerCache().isFiltered()&&!c.path.isEmpty(),a=this.applyServerOverwrite_(e,c.path,c.snap,r,i,s,u))}else if(n.type===Bt.MERGE){var l=n;l.source.fromUser?a=this.applyUserMerge_(e,l.path,l.children,r,i,u):(o.assert(l.source.fromServer,"Unknown source."),s=l.source.tagged||e.getServerCache().isFiltered(),a=this.applyServerMerge_(e,l.path,l.children,r,i,s,u))}else if(n.type===Bt.ACK_USER_WRITE){var h=n;a=h.revert?this.revertUserWrite_(e,h.path,r,i,u):this.ackUserWrite_(e,h.path,h.affectedTree,r,i,u)}else{if(n.type!==Bt.LISTEN_COMPLETE)throw o.assertionError("Unknown operation type: "+n.type);a=this.listenComplete_(e,n.path,r,u)}var f=u.getChanges();return t.maybeAddValueEvent_(e,a,f),new me(a,f)},t.maybeAddValueEvent_=function(t,e,n){var r=e.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=t.getCompleteEventSnap();(n.length>0||!t.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(he.valueChange(e.getCompleteEventSnap()))}},t.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var a=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s=void 0,u=void 0;if(e.isEmpty())if(o.assert(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var c=t.getCompleteServerSnap(),l=c instanceof Mt?c:Mt.EMPTY_NODE,h=n.calcCompleteEventChildren(l);s=this.filter_.updateFullNode(t.getEventCache().getNode(),h,i)}else{var f=n.calcCompleteEventCache(t.getCompleteServerSnap());s=this.filter_.updateFullNode(t.getEventCache().getNode(),f,i)}else{var p=e.getFront();if(".priority"==p){o.assert(1==e.getLength(),"Can't have a priority with additional path components");var d=a.getNode();u=t.getServerCache().getNode();var y=n.calcEventCacheAfterServerOverwrite(e,d,u);s=null!=y?this.filter_.updatePriority(d,y):a.getNode()}else{var m=e.popFront(),g=void 0;if(a.isCompleteForChild(p)){u=t.getServerCache().getNode();var v=n.calcEventCacheAfterServerOverwrite(e,a.getNode(),u);g=null!=v?a.getNode().getImmediateChild(p).updateChild(m,v):a.getNode().getImmediateChild(p)}else g=n.calcCompleteChild(p,t.getServerCache());s=null!=g?this.filter_.updateChild(a.getNode(),p,g,m,r,i):a.getNode()}}return t.updateEventSnap(s,a.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},t.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,a){var s,u=t.getServerCache(),c=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())s=c.updateFullNode(u.getNode(),n,null);else if(c.filtersNodes()&&!u.isFiltered()){var l=u.getNode().updateChild(e,n);s=c.updateFullNode(u.getNode(),l,null)}else{var h=e.getFront();if(!u.isCompleteForPath(e)&&e.getLength()>1)return t;var f=e.popFront(),p=u.getNode().getImmediateChild(h).updateChild(f,n);s=".priority"==h?c.updatePriority(u.getNode(),p):c.updateChild(u.getNode(),h,p,f,de,null)}var d=t.updateServerSnap(s,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),y=new ye(r,d,i);return this.generateEventCacheAfterServerEvent_(d,e,r,y,a)},t.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var a,s,u=t.getEventCache(),c=new ye(r,t,i);if(e.isEmpty())s=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),a=t.updateEventSnap(s,!0,this.filter_.filtersNodes());else{var l=e.getFront();if(".priority"===l)s=this.filter_.updatePriority(t.getEventCache().getNode(),n),a=t.updateEventSnap(s,u.isFullyInitialized(),u.isFiltered());else{var h=e.popFront(),f=u.getNode().getImmediateChild(l),p=void 0;if(h.isEmpty())p=n;else{var d=c.getCompleteChild(l);p=null!=d?".priority"===h.getBack()&&d.getChild(h.parent()).isEmpty()?d:d.updateChild(h,n):Mt.EMPTY_NODE}if(f.equals(p))a=t;else{var y=this.filter_.updateChild(u.getNode(),l,p,h,c,o);a=t.updateEventSnap(y,u.isFullyInitialized(),this.filter_.filtersNodes())}}}return a},t.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},t.prototype.applyUserMerge_=function(e,n,r,i,o,a){var s=this,u=e;return r.foreach(function(r,c){var l=n.child(r);t.cacheHasChild_(e,l.getFront())&&(u=s.applyUserOverwrite_(u,l,c,i,o,a))}),r.foreach(function(r,c){var l=n.child(r);t.cacheHasChild_(e,l.getFront())||(u=s.applyUserOverwrite_(u,l,c,i,o,a))}),u},t.prototype.applyMerge_=function(t,e){return e.foreach(function(e,n){t=t.updateChild(e,n)}),t},t.prototype.applyServerMerge_=function(t,e,n,r,i,o,a){var s=this;if(t.getServerCache().getNode().isEmpty()&&!t.getServerCache().isFullyInitialized())return t;var u,c=t;u=e.isEmpty()?n:oe.Empty.setTree(e,n);var l=t.getServerCache().getNode();return u.children.inorderTraversal(function(e,n){if(l.hasChild(e)){var u=t.getServerCache().getNode().getImmediateChild(e),h=s.applyMerge_(u,n);c=s.applyServerOverwrite_(c,new B(e),h,r,i,o,a)}}),u.children.inorderTraversal(function(e,n){var u=!t.getServerCache().isCompleteForChild(e)&&null==n.value;if(!l.hasChild(e)&&!u){var h=t.getServerCache().getNode().getImmediateChild(e),f=s.applyMerge_(h,n);c=s.applyServerOverwrite_(c,new B(e),f,r,i,o,a)}}),c},t.prototype.ackUserWrite_=function(t,e,n,r,i,o){if(null!=r.shadowingWrite(e))return t;var a=t.getServerCache().isFiltered(),s=t.getServerCache();if(null!=n.value){if(e.isEmpty()&&s.isFullyInitialized()||s.isCompleteForPath(e))return this.applyServerOverwrite_(t,e,s.getNode().getChild(e),r,i,a,o);if(e.isEmpty()){var u=oe.Empty;return s.getNode().forEachChild(yt,function(t,e){u=u.set(new B(t),e)}),this.applyServerMerge_(t,e,u,r,i,a,o)}return t}var c=oe.Empty;return n.foreach(function(t,n){var r=e.child(t);s.isCompleteForPath(r)&&(c=c.set(t,s.getNode().getChild(r)))}),this.applyServerMerge_(t,e,c,r,i,a,o)},t.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),o=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(o,e,n,de,r)},t.prototype.revertUserWrite_=function(t,e,n,r,i){var a;if(null!=n.shadowingWrite(e))return t;var s=new ye(n,t,r),u=t.getEventCache().getNode(),c=void 0;if(e.isEmpty()||".priority"===e.getFront()){var l=void 0;if(t.getServerCache().isFullyInitialized())l=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var h=t.getServerCache().getNode();o.assert(h instanceof Mt,"serverChildren would be complete if leaf node"),l=n.calcCompleteEventChildren(h)}l=l,c=this.filter_.updateFullNode(u,l,i)}else{var f=e.getFront(),p=n.calcCompleteChild(f,t.getServerCache());null==p&&t.getServerCache().isCompleteForChild(f)&&(p=u.getImmediateChild(f)),(c=null!=p?this.filter_.updateChild(u,f,p,e.popFront(),s,i):t.getEventCache().getNode().hasChild(f)?this.filter_.updateChild(u,f,Mt.EMPTY_NODE,e.popFront(),s,i):u).isEmpty()&&t.getServerCache().isFullyInitialized()&&(a=n.calcCompleteEventCache(t.getCompleteServerSnap())).isLeafNode()&&(c=this.filter_.updateFullNode(c,a,i))}return a=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(B.Empty),t.updateEventSnap(c,a,this.filter_.filtersNodes())},t}(),ve=function(){function t(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}return t.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach(function(t){t.type===he.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(he.childMovedChange(t.childName,t.snapshotNode))}),this.generateEventsForType_(i,he.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,he.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,he.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,he.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,he.VALUE,t,n,e),i},t.prototype.generateEventsForType_=function(t,e,n,r,i){var o=this,a=n.filter(function(t){return t.type===e});a.sort(this.compareChanges_.bind(this)),a.forEach(function(e){var n=o.materializeSingleChange_(e,i);r.forEach(function(r){r.respondsTo(e.type)&&t.push(r.createEvent(n,o.query_))})})},t.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type?t:(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_),t)},t.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw o.assertionError("Should only compare child_ events.");var n=new ft(t.childName,t.snapshotNode),r=new ft(e.childName,e.snapshotNode);return this.index_.compare(n,r)},t}(),be=function(){function t(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new fe(n.getIndex()),i=n.getNodeFilter();this.processor_=new ge(i);var o=e.getServerCache(),a=e.getEventCache(),s=r.updateFullNode(Mt.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(Mt.EMPTY_NODE,a.getNode(),null),c=new ce(s,o.isFullyInitialized(),r.filtersNodes()),l=new ce(u,a.isFullyInitialized(),i.filtersNodes());this.viewCache_=new le(l,c),this.eventGenerator_=new ve(this.query_)}return t.prototype.getQuery=function(){return this.query_},t.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},t.prototype.getCompleteServerCache=function(t){var e=this.viewCache_.getCompleteServerSnap();return e&&(this.query_.getQueryParams().loadsAllData()||!t.isEmpty()&&!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},t.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},t.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},t.prototype.removeEventRegistration=function(t,e){var n=[];if(e){o.assert(null==t,"A cancel should cancel all event registrations.");var r=this.query_.path;this.eventRegistrations_.forEach(function(t){e=e;var i=t.createCancelEvent(e,r);i&&n.push(i)})}if(t){for(var i=[],a=0;a<this.eventRegistrations_.length;++a){var s=this.eventRegistrations_[a];if(s.matches(t)){if(t.hasAnyCallback()){i=i.concat(this.eventRegistrations_.slice(a+1));break}}else i.push(s)}this.eventRegistrations_=i}else this.eventRegistrations_=[];return n},t.prototype.applyOperation=function(t,e,n){t.type===Bt.MERGE&&null!==t.source.queryId&&(o.assert(this.viewCache_.getCompleteServerSnap(),"We should always have a full cache before handling merges"),o.assert(this.viewCache_.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var r=this.viewCache_,i=this.processor_.applyOperation(r,t,e,n);return this.processor_.assertIndexed(i.viewCache),o.assert(i.viewCache.getServerCache().isFullyInitialized()||!r.getServerCache().isFullyInitialized(),"Once a server snap is complete, it should never go back"),this.viewCache_=i.viewCache,this.generateEventsForChanges_(i.changes,i.viewCache.getEventCache().getNode(),null)},t.prototype.getInitialEvents=function(t){var e=this.viewCache_.getEventCache(),n=[];e.getNode().isLeafNode()||e.getNode().forEachChild(St,function(t,e){n.push(he.childAddedChange(t,e))});return e.isFullyInitialized()&&n.push(he.valueChange(e.getNode())),this.generateEventsForChanges_(n,e.getNode(),t)},t.prototype.generateEventsForChanges_=function(t,e,n){var r=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(t,e,r)},t}(),_e=function(){function t(){this.views_={}}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return o.assert(ee,"Reference.ts has not been loaded"),ee},set:function(t){o.assert(!ee,"__referenceConstructor has already been defined"),ee=t},enumerable:!0,configurable:!0}),t.prototype.isEmpty=function(){return o.isEmpty(this.views_)},t.prototype.applyOperation=function(t,e,n){var r=t.source.queryId;if(null!==r){var i=o.safeGet(this.views_,r);return o.assert(null!=i,"SyncTree gave us an op for an invalid query."),i.applyOperation(t,e,n)}var a=[];return o.forEach(this.views_,function(r,i){a=a.concat(i.applyOperation(t,e,n))}),a},t.prototype.addEventRegistration=function(t,e,n,r,i){var a=t.queryIdentifier(),s=o.safeGet(this.views_,a);if(!s){var u=n.calcCompleteEventCache(i?r:null),c=!1;u?c=!0:r instanceof Mt?(u=n.calcCompleteEventChildren(r),c=!1):(u=Mt.EMPTY_NODE,c=!1);var l=new le(new ce(u,c,!1),new ce(r,i,!1));s=new be(t,l),this.views_[a]=s}return s.addEventRegistration(e),s.getInitialEvents(e)},t.prototype.removeEventRegistration=function(e,n,r){var i=e.queryIdentifier(),a=[],s=[],u=this.hasCompleteView();if("default"===i){var c=this;o.forEach(this.views_,function(t,e){s=s.concat(e.removeEventRegistration(n,r)),e.isEmpty()&&(delete c.views_[t],e.getQuery().getQueryParams().loadsAllData()||a.push(e.getQuery()))})}else{var l=o.safeGet(this.views_,i);l&&(s=s.concat(l.removeEventRegistration(n,r)),l.isEmpty()&&(delete this.views_[i],l.getQuery().getQueryParams().loadsAllData()||a.push(l.getQuery())))}return u&&!this.hasCompleteView()&&a.push(new t.__referenceConstructor(e.repo,e.path)),{removed:a,events:s}},t.prototype.getQueryViews=function(){var t=this;return Object.keys(this.views_).map(function(e){return t.views_[e]}).filter(function(t){return!t.getQuery().getQueryParams().loadsAllData()})},t.prototype.getCompleteServerCache=function(t){var e=null;return o.forEach(this.views_,function(n,r){e=e||r.getCompleteServerCache(t)}),e},t.prototype.viewForQuery=function(t){if(t.getQueryParams().loadsAllData())return this.getCompleteView();var e=t.queryIdentifier();return o.safeGet(this.views_,e)},t.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},t.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},t.prototype.getCompleteView=function(){return o.findValue(this.views_,function(t){return t.getQuery().getQueryParams().loadsAllData()})||null},t}(),we=function(){function t(t){this.writeTree_=t}return t.prototype.addWrite=function(e,n){if(e.isEmpty())return new t(new oe(n));var r=this.writeTree_.findRootMostValueAndPath(e);if(null!=r){var i=r.path,o=r.value,a=B.relativePath(i,e);return o=o.updateChild(a,n),new t(this.writeTree_.set(i,o))}var s=new oe(n);return new t(this.writeTree_.setTree(e,s))},t.prototype.addWrites=function(t,e){var n=this;return o.forEach(e,function(e,r){n=n.addWrite(t.child(e),r)}),n},t.prototype.removeWrite=function(e){return e.isEmpty()?t.Empty:new t(this.writeTree_.setTree(e,oe.Empty))},t.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},t.prototype.getCompleteNode=function(t){var e=this.writeTree_.findRootMostValueAndPath(t);return null!=e?this.writeTree_.get(e.path).getChild(B.relativePath(e.path,t)):null},t.prototype.getCompleteChildren=function(){var t=[],e=this.writeTree_.value;return null!=e?e.isLeafNode()||e.forEachChild(St,function(e,n){t.push(new ft(e,n))}):this.writeTree_.children.inorderTraversal(function(e,n){null!=n.value&&t.push(new ft(e,n.value))}),t},t.prototype.childCompoundWrite=function(e){if(e.isEmpty())return this;var n=this.getCompleteNode(e);return new t(null!=n?new oe(n):this.writeTree_.subtree(e))},t.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},t.prototype.apply=function(e){return t.applySubtreeWrite_(B.Empty,this.writeTree_,e)},t.Empty=new t(new oe(null)),t.applySubtreeWrite_=function(e,n,r){if(null!=n.value)return r.updateChild(e,n.value);var i=null;return n.children.inorderTraversal(function(n,a){".priority"===n?(o.assert(null!==a.value,"Priority writes must always be leaf nodes"),i=a.value):r=t.applySubtreeWrite_(e.child(n),a,r)}),r.getChild(e).isEmpty()||null===i||(r=r.updateChild(e.child(".priority"),i)),r},t}(),Ee=function(){function t(){this.visibleWrites_=we.Empty,this.allWrites_=[],this.lastWriteId_=-1}return t.prototype.childWrites=function(t){return new Te(t,this)},t.prototype.addOverwrite=function(t,e,n,r){o.assert(n>this.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},t.prototype.addMerge=function(t,e,n){o.assert(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:t,children:e,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(t,e),this.lastWriteId_=n},t.prototype.getWrite=function(t){for(var e=0;e<this.allWrites_.length;e++){var n=this.allWrites_[e];if(n.writeId===t)return n}return null},t.prototype.removeWrite=function(t){var e=this,n=this.allWrites_.findIndex(function(e){return e.writeId===t});o.assert(n>=0,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[n];this.allWrites_.splice(n,1);for(var i=r.visible,a=!1,s=this.allWrites_.length-1;i&&s>=0;){var u=this.allWrites_[s];u.visible&&(s>=n&&this.recordContainsPath_(u,r.path)?i=!1:r.path.contains(u.path)&&(a=!0)),s--}if(i){if(a)return this.resetTree_(),!0;if(r.snap)this.visibleWrites_=this.visibleWrites_.removeWrite(r.path);else{var c=r.children;o.forEach(c,function(t){e.visibleWrites_=e.visibleWrites_.removeWrite(r.path.child(t))})}return!0}return!1},t.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcCompleteEventCache=function(e,n,r,i){if(r||i){var o=this.visibleWrites_.childCompoundWrite(e);if(!i&&o.isEmpty())return n;if(i||null!=n||o.hasCompleteWrite(B.Empty)){var a=t.layerTree_(this.allWrites_,function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))},e);c=n||Mt.EMPTY_NODE;return a.apply(c)}return null}var s=this.visibleWrites_.getCompleteNode(e);if(null!=s)return s;var u=this.visibleWrites_.childCompoundWrite(e);if(u.isEmpty())return n;if(null!=n||u.hasCompleteWrite(B.Empty)){var c=n||Mt.EMPTY_NODE;return u.apply(c)}return null},t.prototype.calcCompleteEventChildren=function(t,e){var n=Mt.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(St,function(t,e){n=n.updateImmediateChild(t,e)}),n;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(St,function(t,e){var r=i.childCompoundWrite(new B(t)).apply(e);n=n.updateImmediateChild(t,r)}),i.getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n}return this.visibleWrites_.childCompoundWrite(t).getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){o.assert(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=t.child(e);if(this.visibleWrites_.hasCompleteWrite(i))return null;var a=this.visibleWrites_.childCompoundWrite(i);return a.isEmpty()?r.getChild(e):a.apply(r.getChild(e))},t.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),i=this.visibleWrites_.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(e)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):null},t.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var a,s=this.visibleWrites_.childCompoundWrite(t),u=s.getCompleteNode(B.Empty);if(null!=u)a=u;else{if(null==e)return[];a=s.apply(e)}if((a=a.withIndex(o)).isEmpty()||a.isLeafNode())return[];for(var c=[],l=o.getCompare(),h=i?a.getReverseIteratorFrom(n,o):a.getIteratorFrom(n,o),f=h.getNext();f&&c.length<r;)0!==l(f,n)&&c.push(f),f=h.getNext();return c},t.prototype.recordContainsPath_=function(t,e){return t.snap?t.path.contains(e):!!o.findKey(t.children,function(n,r){return t.path.child(r).contains(e)})},t.prototype.resetTree_=function(){this.visibleWrites_=t.layerTree_(this.allWrites_,t.DefaultFilter_,B.Empty),this.allWrites_.length>0?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},t.DefaultFilter_=function(t){return t.visible},t.layerTree_=function(t,e,n){for(var r=we.Empty,i=0;i<t.length;++i){var a=t[i];if(e(a)){var s=a.path,u=void 0;if(a.snap)n.contains(s)?(u=B.relativePath(n,s),r=r.addWrite(u,a.snap)):s.contains(n)&&(u=B.relativePath(s,n),r=r.addWrite(B.Empty,a.snap.getChild(u)));else{if(!a.children)throw o.assertionError("WriteRecord should have .snap or .children");if(n.contains(s))u=B.relativePath(n,s),r=r.addWrites(u,a.children);else if(s.contains(n))if((u=B.relativePath(s,n)).isEmpty())r=r.addWrites(B.Empty,a.children);else{var c=o.safeGet(a.children,u.getFront());if(c){var l=c.getChild(u.popFront());r=r.addWrite(B.Empty,l)}}}}}return r},t}(),Te=function(){function t(t,e){this.treePath_=t,this.writeTree_=e}return t.prototype.calcCompleteEventCache=function(t,e,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,t,e,n)},t.prototype.calcCompleteEventChildren=function(t){return this.writeTree_.calcCompleteEventChildren(this.treePath_,t)},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,t,e,n)},t.prototype.shadowingWrite=function(t){return this.writeTree_.shadowingWrite(this.treePath_.child(t))},t.prototype.calcIndexedSlice=function(t,e,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,t,e,n,r,i)},t.prototype.calcCompleteChild=function(t,e){return this.writeTree_.calcCompleteChild(this.treePath_,t,e)},t.prototype.child=function(e){return new t(this.treePath_.child(e),this.writeTree_)},t}(),Se=function(){function t(t){this.listenProvider_=t,this.syncPointTree_=oe.Empty,this.pendingWriteTree_=new Ee,this.tagToQueryMap_={},this.queryToTagMap_={}}return t.prototype.applyUserOverwrite=function(t,e,n,r){return this.pendingWriteTree_.addOverwrite(t,e,n,r),r?this.applyOperationToSyncPoints_(new se(ne.User,t,e)):[]},t.prototype.applyUserMerge=function(t,e,n){this.pendingWriteTree_.addMerge(t,e,n);var r=oe.fromObject(e);return this.applyOperationToSyncPoints_(new ue(ne.User,t,r))},t.prototype.ackUserWrite=function(t,e){void 0===e&&(e=!1);var n=this.pendingWriteTree_.getWrite(t);if(this.pendingWriteTree_.removeWrite(t)){var r=oe.Empty;return null!=n.snap?r=r.set(B.Empty,!0):o.forEach(n.children,function(t,e){r=r.set(new B(t),e)}),this.applyOperationToSyncPoints_(new re(n.path,r,e))}return[]},t.prototype.applyServerOverwrite=function(t,e){return this.applyOperationToSyncPoints_(new se(ne.Server,t,e))},t.prototype.applyServerMerge=function(t,e){var n=oe.fromObject(e);return this.applyOperationToSyncPoints_(new ue(ne.Server,t,n))},t.prototype.applyListenComplete=function(t){return this.applyOperationToSyncPoints_(new ae(ne.Server,t))},t.prototype.applyTaggedQueryOverwrite=function(e,n,r){var i=this.queryKeyForTag_(r);if(null!=i){var o=t.parseQueryKey_(i),a=o.path,s=o.queryId,u=B.relativePath(a,e),c=new se(ne.forServerTaggedQuery(s),u,n);return this.applyTaggedOperation_(a,c)}return[]},t.prototype.applyTaggedQueryMerge=function(e,n,r){var i=this.queryKeyForTag_(r);if(i){var o=t.parseQueryKey_(i),a=o.path,s=o.queryId,u=B.relativePath(a,e),c=oe.fromObject(n),l=new ue(ne.forServerTaggedQuery(s),u,c);return this.applyTaggedOperation_(a,l)}return[]},t.prototype.applyTaggedListenComplete=function(e,n){var r=this.queryKeyForTag_(n);if(r){var i=t.parseQueryKey_(r),o=i.path,a=i.queryId,s=B.relativePath(o,e),u=new ae(ne.forServerTaggedQuery(a),s);return this.applyTaggedOperation_(o,u)}return[]},t.prototype.addEventRegistration=function(e,n){var r=e.path,i=null,a=!1;this.syncPointTree_.foreachOnPath(r,function(t,e){var n=B.relativePath(t,r);i=i||e.getCompleteServerCache(n),a=a||e.hasCompleteView()});var s,u=this.syncPointTree_.get(r);(u?(a=a||u.hasCompleteView(),i=i||u.getCompleteServerCache(B.Empty)):(u=new _e,this.syncPointTree_=this.syncPointTree_.set(r,u)),null!=i)?s=!0:(s=!1,i=Mt.EMPTY_NODE,this.syncPointTree_.subtree(r).foreachChild(function(t,e){var n=e.getCompleteServerCache(B.Empty);n&&(i=i.updateImmediateChild(t,n))}));var c=u.viewExistsForQuery(e);if(!c&&!e.getQueryParams().loadsAllData()){var l=t.makeQueryKey_(e);o.assert(!(l in this.queryToTagMap_),"View does not exist, but we have a tag");var h=t.getNextQueryTag_();this.queryToTagMap_[l]=h,this.tagToQueryMap_["_"+h]=l}var f=this.pendingWriteTree_.childWrites(r),p=u.addEventRegistration(e,n,f,i,s);if(!c&&!a){var d=u.viewForQuery(e);p=p.concat(this.setupListener_(e,d))}return p},t.prototype.removeEventRegistration=function(e,n,r){var i=this,o=e.path,a=this.syncPointTree_.get(o),s=[];if(a&&("default"===e.queryIdentifier()||a.viewExistsForQuery(e))){var u=a.removeEventRegistration(e,n,r);a.isEmpty()&&(this.syncPointTree_=this.syncPointTree_.remove(o));var c=u.removed;s=u.events;var l=-1!==c.findIndex(function(t){return t.getQueryParams().loadsAllData()}),h=this.syncPointTree_.findOnPath(o,function(t,e){return e.hasCompleteView()});if(l&&!h){var f=this.syncPointTree_.subtree(o);if(!f.isEmpty())for(var p=this.collectDistinctViewsForSubTree_(f),d=0;d<p.length;++d){var y=p[d],m=y.getQuery(),g=this.createListenerForView_(y);this.listenProvider_.startListening(t.queryForListening_(m),this.tagForQuery_(m),g.hashFn,g.onComplete)}}if(!h&&c.length>0&&!r)if(l){this.listenProvider_.stopListening(t.queryForListening_(e),null)}else c.forEach(function(e){var n=i.queryToTagMap_[t.makeQueryKey_(e)];i.listenProvider_.stopListening(t.queryForListening_(e),n)});this.removeTags_(c)}return s},t.prototype.calcCompleteEventCache=function(t,e){var n=this.pendingWriteTree_,r=this.syncPointTree_.findOnPath(t,function(e,n){var r=B.relativePath(e,t),i=n.getCompleteServerCache(r);if(i)return i});return n.calcCompleteEventCache(t,r,e,!0)},t.prototype.collectDistinctViewsForSubTree_=function(t){return t.fold(function(t,e,n){if(e&&e.hasCompleteView())return[e.getCompleteView()];var r=[];return e&&(r=e.getQueryViews()),o.forEach(n,function(t,e){r=r.concat(e)}),r})},t.prototype.removeTags_=function(e){for(var n=0;n<e.length;++n){var r=e[n];if(!r.getQueryParams().loadsAllData()){var i=t.makeQueryKey_(r),o=this.queryToTagMap_[i];delete this.queryToTagMap_[i],delete this.tagToQueryMap_["_"+o]}}},t.queryForListening_=function(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t},t.prototype.setupListener_=function(e,n){var r=e.path,i=this.tagForQuery_(e),a=this.createListenerForView_(n),s=this.listenProvider_.startListening(t.queryForListening_(e),i,a.hashFn,a.onComplete),u=this.syncPointTree_.subtree(r);if(i)o.assert(!u.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var c=u.fold(function(t,e,n){if(!t.isEmpty()&&e&&e.hasCompleteView())return[e.getCompleteView().getQuery()];var r=[];return e&&(r=r.concat(e.getQueryViews().map(function(t){return t.getQuery()}))),o.forEach(n,function(t,e){r=r.concat(e)}),r}),l=0;l<c.length;++l){var h=c[l];this.listenProvider_.stopListening(t.queryForListening_(h),this.tagForQuery_(h))}return s},t.prototype.createListenerForView_=function(t){var e=this,n=t.getQuery(),r=this.tagForQuery_(n);return{hashFn:function(){return(t.getServerCache()||Mt.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return r?e.applyTaggedListenComplete(n.path,r):e.applyListenComplete(n.path);var i=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==t?n="Client doesn't have permission to access the desired data.":"unavailable"==t&&(n="The service is unavailable");var r=new Error(t+" at "+e.path.toString()+": "+n);return r.code=t.toUpperCase(),r}(t,n);return e.removeEventRegistration(n,null,i)}}},t.makeQueryKey_=function(t){return t.path.toString()+"$"+t.queryIdentifier()},t.parseQueryKey_=function(t){var e=t.indexOf("$");return o.assert(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new B(t.substr(0,e))}},t.prototype.queryKeyForTag_=function(t){return this.tagToQueryMap_["_"+t]},t.prototype.tagForQuery_=function(e){var n=t.makeQueryKey_(e);return o.safeGet(this.queryToTagMap_,n)},t.getNextQueryTag_=function(){return t.nextQueryTag_++},t.prototype.applyTaggedOperation_=function(t,e){var n=this.syncPointTree_.get(t);o.assert(n,"Missing sync point for query tag that we're tracking");var r=this.pendingWriteTree_.childWrites(t);return n.applyOperation(e,r,null)},t.prototype.applyOperationToSyncPoints_=function(t){return this.applyOperationHelper_(t,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(B.Empty))},t.prototype.applyOperationHelper_=function(t,e,n,r){if(t.path.isEmpty())return this.applyOperationDescendantsHelper_(t,e,n,r);var i=e.get(B.Empty);null==n&&null!=i&&(n=i.getCompleteServerCache(B.Empty));var o=[],a=t.path.getFront(),s=t.operationForChild(a),u=e.children.get(a);if(u&&s){var c=n?n.getImmediateChild(a):null,l=r.child(a);o=o.concat(this.applyOperationHelper_(s,u,c,l))}return i&&(o=o.concat(i.applyOperation(t,r,n))),o},t.prototype.applyOperationDescendantsHelper_=function(t,e,n,r){var i=this,o=e.get(B.Empty);null==n&&null!=o&&(n=o.getCompleteServerCache(B.Empty));var a=[];return e.children.inorderTraversal(function(e,o){var s=n?n.getImmediateChild(e):null,u=r.child(e),c=t.operationForChild(e);c&&(a=a.concat(i.applyOperationDescendantsHelper_(c,o,s,u)))}),o&&(a=a.concat(o.applyOperation(t,r,n))),a},t.nextQueryTag_=1,t}(),Ce=function(){function t(){this.rootNode_=Mt.EMPTY_NODE}return t.prototype.getNode=function(t){return this.rootNode_.getChild(t)},t.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},t}(),Ie=function(){function t(t){this.app_=t}return t.prototype.getToken=function(t){return this.app_.INTERNAL.getToken(t).then(null,function(t){return t&&"auth/token-not-initialized"===t.code?(w("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(t)})},t.prototype.addTokenChangeListener=function(t){this.app_.INTERNAL.addAuthTokenListener(t)},t.prototype.removeTokenChangeListener=function(t){this.app_.INTERNAL.removeAuthTokenListener(t)},t.prototype.notifyForInvalidToken=function(){var t='Provided authentication credentials for the app named "'+this.app_.name+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.app_.options?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.app_.options?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',C(t)},t}(),Ne=function(){function t(){this.counters_={}}return t.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),o.contains(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},t.prototype.get=function(){return o.deepCopy(this.counters_)},t}(),ke=function(){function t(){}return t.getCollection=function(t){var e=t.toString();return this.collections_[e]||(this.collections_[e]=new Ne),this.collections_[e]},t.getOrCreateReporter=function(t,e){var n=t.toString();return this.reporters_[n]||(this.reporters_[n]=e()),this.reporters_[n]},t.collections_={},t.reporters_={},t}(),De=function(){function t(t){this.collection_=t,this.last_=null}return t.prototype.get=function(){var t=this.collection_.get(),e=o.clone(t);return this.last_&&o.forEach(this.last_,function(t,n){e[t]=e[t]-n}),this.last_=t,e},t}(),Ae=1e4,Oe=3e4,Re=function(){function t(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new De(t);var n=Ae+(Oe-Ae)*Math.random();V(this.reportStats_.bind(this),Math.floor(n))}return t.prototype.includeStat=function(t){this.statsToReport_[t]=!0},t.prototype.reportStats_=function(){var t=this,e=this.statsListener_.get(),n={},r=!1;o.forEach(e,function(e,i){i>0&&o.contains(t.statsToReport_,e)&&(n[e]=i,r=!0)}),r&&this.server_.reportStats(n),V(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},t}(),Pe=function(){function t(){this.eventLists_=[],this.recursionDepth_=0}return t.prototype.queueEvents=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n],i=r.getPath();null===e||i.equals(e.getPath())||(this.eventLists_.push(e),e=null),null===e&&(e=new xe(i)),e.add(r)}e&&this.eventLists_.push(e)},t.prototype.raiseEventsAtPath=function(t,e){this.queueEvents(e),this.raiseQueuedEventsMatchingPredicate_(function(e){return e.equals(t)})},t.prototype.raiseEventsForChangedPath=function(t,e){this.queueEvents(e),this.raiseQueuedEventsMatchingPredicate_(function(e){return e.contains(t)||t.contains(e)})},t.prototype.raiseQueuedEventsMatchingPredicate_=function(t){this.recursionDepth_++;for(var e=!0,n=0;n<this.eventLists_.length;n++){var r=this.eventLists_[n];if(r)t(r.getPath())?(this.eventLists_[n].raise(),this.eventLists_[n]=null):e=!1}e&&(this.eventLists_=[]),this.recursionDepth_--},t}(),xe=function(){function t(t){this.path_=t,this.events_=[]}return t.prototype.add=function(t){this.events_.push(t)},t.prototype.raise=function(){for(var t=0;t<this.events_.length;t++){var e=this.events_[t];if(null!==e){this.events_[t]=null;var n=e.getEventRunner();v&&w("event: "+e.toString()),U(n)}}},t.prototype.getPath=function(){return this.path_},t}(),Le=function(){function t(t){this.allowedEvents_=t,this.listeners_={},o.assert(Array.isArray(t)&&t.length>0,"Requires a non-empty array")}return t.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(Array.isArray(this.listeners_[t]))for(var r=this.listeners_[t].slice(),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},t.prototype.on=function(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});var r=this.getInitialEvent(t);r&&e.apply(n,r)},t.prototype.off=function(t,e,n){this.validateEventType_(t);for(var r=this.listeners_[t]||[],i=0;i<r.length;i++)if(r[i].callback===e&&(!n||n===r[i].context))return void r.splice(i,1)},t.prototype.validateEventType_=function(t){o.assert(this.allowedEvents_.find(function(e){return e===t}),"Unknown event: "+t)},t}(),Me=function(t){function e(){var e,n,r=t.call(this,["visible"])||this;return"undefined"!==typeof document&&"undefined"!==typeof document.addEventListener&&("undefined"!==typeof document.hidden?(n="visibilitychange",e="hidden"):"undefined"!==typeof document.mozHidden?(n="mozvisibilitychange",e="mozHidden"):"undefined"!==typeof document.msHidden?(n="msvisibilitychange",e="msHidden"):"undefined"!==typeof document.webkitHidden&&(n="webkitvisibilitychange",e="webkitHidden")),r.visible_=!0,n&&document.addEventListener(n,function(){var t=!document[e];t!==r.visible_&&(r.visible_=t,r.trigger("visible",t))},!1),r}return s.__extends(e,t),e.getInstance=function(){return new e},e.prototype.getInitialEvent=function(t){return o.assert("visible"===t,"Unknown event type: "+t),[this.visible_]},e}(Le),Fe=function(t){function e(){var e=t.call(this,["online"])||this;return e.online_=!0,"undefined"===typeof window||"undefined"===typeof window.addEventListener||o.isMobileCordova()||(window.addEventListener("online",function(){e.online_||(e.online_=!0,e.trigger("online",!0))},!1),window.addEventListener("offline",function(){e.online_&&(e.online_=!1,e.trigger("online",!1))},!1)),e}return s.__extends(e,t),e.getInstance=function(){return new e},e.prototype.getInitialEvent=function(t){return o.assert("online"===t,"Unknown event type: "+t),[this.online_]},e.prototype.currentlyOnline=function(){return this.online_},e}(Le),Ue=function(){function t(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}return t.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},t.prototype.handleResponse=function(t,e){var n=this;this.pendingResponses[t]=e;for(var r=function(){var t=i.pendingResponses[i.currentResponseNum];delete i.pendingResponses[i.currentResponseNum];for(var e=function(e){t[e]&&U(function(){n.onMessage_(t[e])})},r=0;r<t.length;++r)e(r);if(i.currentResponseNum===i.closeAfterResponse)return i.onClose&&(i.onClose(),i.onClose=null),"break";i.currentResponseNum++},i=this;this.pendingResponses[this.currentResponseNum];){if("break"===r())break}},t}(),je="pLPCommand",Ve="pRTLPCB",Be=function(){function t(t,e,n,r){this.connId=t,this.repoInfo=e,this.transportSessionId=n,this.lastSessionId=r,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=E(t),this.stats_=ke.getCollection(e),this.urlFn=function(t){return e.connectionURL(W,t)}}return t.prototype.open=function(t,e){var n=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new Ue(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){n.log_("Timed out trying to connect."),n.onClosed_(),n.connectTimeoutTimer_=null},Math.floor(3e4)),function(t){if(o.isNodeSdk()||"complete"===document.readyState)t();else{var e=!1,n=function n(){document.body?e||(e=!0,t()):setTimeout(n,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}}(function(){if(!n.isClosed_){n.scriptTagHolder=new qe(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[0],i=t[1],o=t[2];if(n.incrementIncomingBytes_(t),n.scriptTagHolder)if(n.connectTimeoutTimer_&&(clearTimeout(n.connectTimeoutTimer_),n.connectTimeoutTimer_=null),n.everConnected_=!0,"start"==r)n.id=i,n.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);i?(n.scriptTagHolder.sendNewPolls=!1,n.myPacketOrderer.closeAfter(i,function(){n.onClosed_()})):n.onClosed_()}},function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[0],i=t[1];n.incrementIncomingBytes_(t),n.myPacketOrderer.handleResponse(r,i)},function(){n.onClosed_()},n.urlFn);var t={start:"t"};t.ser=Math.floor(1e8*Math.random()),n.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=n.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",n.transportSessionId&&(t.s=n.transportSessionId),n.lastSessionId&&(t.ls=n.lastSessionId),!o.isNodeSdk()&&"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(t.r="f");var e=n.urlFn(t);n.log_("Connecting via long-poll to "+e),n.scriptTagHolder.addTag(e,function(){})}})},t.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},t.forceAllow=function(){t.forceAllow_=!0},t.forceDisallow=function(){t.forceDisallow_=!0},t.isAvailable=function(){return t.forceAllow_||!t.forceDisallow_&&"undefined"!==typeof document&&null!=document.createElement&&!("object"===typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&!("object"===typeof Windows&&"object"===typeof Windows.UI)&&!o.isNodeSdk()},t.prototype.markConnectionHealthy=function(){},t.prototype.shutdown_=function(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)},t.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},t.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},t.prototype.send=function(t){var e=o.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);for(var n=o.base64Encode(e),r=P(n,1840),i=0;i<r.length;i++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,r.length,r[i]),this.curSegmentNum++},t.prototype.addDisconnectPingFrame=function(t,e){if(!o.isNodeSdk()){this.myDisconnFrame=document.createElement("iframe");var n={dframe:"t"};n.id=t,n.pw=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}},t.prototype.incrementIncomingBytes_=function(t){var e=o.stringify(t).length;this.bytesReceived+=e,this.stats_.incrementCounter("bytes_received",e)},t}(),qe=function(){function t(e,n,r,i){if(this.onDisconnect=r,this.urlFn=i,this.outstandingRequests=new Xt,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,o.isNodeSdk())this.commandCB=e,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=y(),window[je+this.uniqueCallbackIdentifier]=e,window[Ve+this.uniqueCallbackIdentifier]=n,this.myIFrame=t.createIFrame_();var a="";if(this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length))a='<script>document.domain="'+document.domain+'";<\/script>';var s="<html><body>"+a+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(u){w("frame writing exception"),u.stack&&w(u.stack),w(u)}}}return t.createIFrame_=function(){var t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||w("No IE domain setting required")}catch(n){var e=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+e+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t},t.prototype.close=function(){var e=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==e.myIFrame&&(document.body.removeChild(e.myIFrame),e.myIFrame=null)},Math.floor(0))),o.isNodeSdk()&&this.myID){var n={disconn:"t"};n.id=this.myID,n.pw=this.myPW;var r=this.urlFn(n);t.nodeRestRequest(r)}var i=this.onDisconnect;i&&(this.onDisconnect=null,i())},t.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},t.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;for(var e=this.urlFn(t),n="",r=0;this.pendingSegs.length>0;){if(!(this.pendingSegs[0].d.length+30+n.length<=1870))break;var i=this.pendingSegs.shift();n=n+"&seg"+r+"="+i.seg+"&ts"+r+"="+i.ts+"&d"+r+"="+i.d,r++}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1},t.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},t.prototype.addLongPollTag_=function(t,e){var n=this;this.outstandingRequests.add(e,1);var r=function(){n.outstandingRequests.remove(e),n.newRequest_()},i=setTimeout(r,Math.floor(25e3));this.addTag(t,function(){clearTimeout(i),r()})},t.prototype.addTag=function(t,e){var n=this;o.isNodeSdk()?this.doNodeLongPoll(t,e):setTimeout(function(){try{if(!n.sendNewPolls)return;var r=n.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=t,r.onload=r.onreadystatechange=function(){var t=r.readyState;t&&"loaded"!==t&&"complete"!==t||(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),e())},r.onerror=function(){w("Long-poll script failed to load: "+t),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(r)}catch(i){}},Math.floor(1))},t}(),We=null;"undefined"!==typeof MozWebSocket?We=MozWebSocket:"undefined"!==typeof WebSocket&&(We=WebSocket);var Ke=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.log_=E(this.connId),this.stats_=ke.getCollection(n),this.connURL=t.connectionURL_(n,r,i)}return t.connectionURL_=function(t,e,n){var r={v:"5"};return!o.isNodeSdk()&&"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL("websocket",r)},t.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,f.set("previous_websocket_failure",!0);try{if(o.isNodeSdk()){var i=o.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",a={headers:{"User-Agent":"Firebase/5/"+u.SDK_VERSION+"/"+r.platform+"/"+i}},s=Object({NODE_ENV:"production",PUBLIC_URL:""}),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 We(this.connURL,[],a)}else this.mySock=new We(this.connURL)}catch(h){this.log_("Error instantiating WebSocket.");var l=h.message||h.data;return l&&this.log_(l),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error.  Closing connection.");var e=t.message||t.data;e&&n.log_(e),n.onClosed_()}},t.prototype.start=function(){},t.forceDisallow=function(){t.forceDisallow_=!0},t.isAvailable=function(){var e=!1;if("undefined"!==typeof navigator&&navigator.userAgent){var n=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);n&&n.length>1&&parseFloat(n[1])<4.4&&(e=!0)}return!e&&null!==We&&!t.forceDisallow_},t.previouslyFailed=function(){return f.isInMemoryStorage||!0===f.get("previous_websocket_failure")},t.prototype.markConnectionHealthy=function(){f.remove("previous_websocket_failure")},t.prototype.appendFrame_=function(t){if(this.frames.push(t),this.frames.length==this.totalFrames){var e=this.frames.join("");this.frames=null;var n=o.jsonEval(e);this.onMessage(n)}},t.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},t.prototype.extractFrameCount_=function(t){if(o.assert(null===this.frames,"We already have a frame buffer"),t.length<=6){var e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t},t.prototype.handleIncomingFrame=function(t){if(null!==this.mySock){var e=t.data;if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{var n=this.extractFrameCount_(e);null!==n&&this.appendFrame_(n)}}},t.prototype.send=function(t){this.resetKeepAlive();var e=o.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);var n=P(e,16384);n.length>1&&this.sendString_(String(n.length));for(var r=0;r<n.length;r++)this.sendString_(n[r])},t.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},t.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},t.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},t.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},t.prototype.sendString_=function(t){try{this.mySock.send(t)}catch(e){this.log_("Exception thrown from WebSocket.send():",e.message||e.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}},t.responsesRequiredToBeHealthy=2,t.healthyTimeout=3e4,t}(),Qe=function(){function t(t){this.initTransports_(t)}return Object.defineProperty(t,"ALL_TRANSPORTS",{get:function(){return[Be,Ke]},enumerable:!0,configurable:!0}),t.prototype.initTransports_=function(e){var n=Ke&&Ke.isAvailable(),r=n&&!Ke.previouslyFailed();if(e.webSocketOnly&&(n||C("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),r=!0),r)this.transports_=[Ke];else{var i=this.transports_=[];x(t.ALL_TRANSPORTS,function(t,e){e&&e.isAvailable()&&i.push(e)})}},t.prototype.initialTransport=function(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")},t.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},t}(),He=function(){function t(t,e,n,r,i,o,a){this.id=t,this.repoInfo_=e,this.onMessage_=n,this.onReady_=r,this.onDisconnect_=i,this.onKill_=o,this.lastSessionId=a,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=E("c:"+this.id+":"),this.transportManager_=new Qe(e),this.log_("Connection created"),this.start_()}return t.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,void 0,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(function(){t.conn_&&t.conn_.open(n,r)},Math.floor(0));var i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=V(function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&&t.conn_.bytesReceived>102400?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes.  Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&&t.conn_.bytesSent>10240?t.log_("Connection exceeded healthy timeout but has sent "+t.conn_.bytesSent+" bytes.  Leaving connection alive."):(t.log_("Closing unhealthy connection after timeout."),t.close()))},Math.floor(i)))},t.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},t.prototype.disconnReceiver_=function(t){var e=this;return function(n){t===e.conn_?e.onConnectionLost_(n):t===e.secondaryConn_?(e.log_("Secondary connection lost."),e.onSecondaryConnectionLost_()):e.log_("closing an old connection")}},t.prototype.connReceiver_=function(t){var e=this;return function(n){2!=e.state_&&(t===e.rx_?e.onPrimaryMessageReceived_(n):t===e.secondaryConn_?e.onSecondaryMessageReceived_(n):e.log_("message on old connection"))}},t.prototype.sendRequest=function(t){var e={t:"d",d:t};this.sendData_(e)},t.prototype.tryCleanupConnection=function(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)},t.prototype.onSecondaryControl_=function(t){if("t"in t){var e=t.t;"a"===e?this.upgradeIfSecondaryHealthy_():"r"===e?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===e&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},t.prototype.onSecondaryMessageReceived_=function(t){var e=O("t",t),n=O("d",t);if("c"==e)this.onSecondaryControl_(n);else{if("d"!=e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}},t.prototype.upgradeIfSecondaryHealthy_=function(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))},t.prototype.proceedWithUpgrade_=function(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()},t.prototype.onPrimaryMessageReceived_=function(t){var e=O("t",t),n=O("d",t);"c"==e?this.onControl_(n):"d"==e&&this.onDataMessage_(n)},t.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},t.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},t.prototype.onControl_=function(t){var e=O("t",t);if("d"in t){var n=t.d;if("h"===e)this.onHandshake_(n);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var r=0;r<this.pendingDataMessages.length;++r)this.onDataMessage_(this.pendingDataMessages[r]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(n):"r"===e?this.onReset_(n):"e"===e?T("Server Error: "+n):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):T("Unknown control packet command: "+e)}},t.prototype.onHandshake_=function(t){var e=t.ts,n=t.v,r=t.h;this.sessionId=t.s,this.repoInfo_.updateHost(r),0==this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&&C("Protocol version mismatch detected"),this.tryStartUpgrade_())},t.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},t.prototype.startUpgrade_=function(t){var e=this;this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),V(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},t.prototype.onReset_=function(t){this.log_("Reset packet received.  New host: "+t),this.repoInfo_.updateHost(t),1===this.state_?this.close():(this.closeConnections_(),this.start_())},t.prototype.onConnectionEstablished_=function(t,e){var n=this;this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):V(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},t.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},t.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},t.prototype.onConnectionLost_=function(t){this.conn_=null,t||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(f.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},t.prototype.onConnectionShutdown_=function(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()},t.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},t.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},t.prototype.closeConnections_=function(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)},t}(),ze=function(){function t(){}return t.prototype.put=function(t,e,n,r){},t.prototype.merge=function(t,e,n,r){},t.prototype.refreshAuthToken=function(t){},t.prototype.onDisconnectPut=function(t,e,n){},t.prototype.onDisconnectMerge=function(t,e,n){},t.prototype.onDisconnectCancel=function(t,e){},t.prototype.reportStats=function(t){},t}(),Ge=1e3,Ye=3e5,Xe=function(t){function e(n,r,i,a,s,u){var c=t.call(this)||this;if(c.repoInfo_=n,c.onDataUpdate_=r,c.onConnectStatus_=i,c.onServerInfoUpdate_=a,c.authTokenProvider_=s,c.authOverride_=u,c.id=e.nextPersistentConnectionId_++,c.log_=E("p:"+c.id+":"),c.interruptReasons_={},c.listens_={},c.outstandingPuts_=[],c.outstandingPutCount_=0,c.onDisconnectRequestQueue_=[],c.connected_=!1,c.reconnectDelay_=Ge,c.maxReconnectDelay_=Ye,c.securityDebugCallback_=null,c.lastSessionId=null,c.establishConnectionTimer_=null,c.visible_=!1,c.requestCBHash_={},c.requestNumber_=0,c.realtime_=null,c.authToken_=null,c.forceTokenRefresh_=!1,c.invalidAuthTokenCount_=0,c.firstConnection_=!0,c.lastConnectionAttemptTime_=null,c.lastConnectionEstablishedTime_=null,u&&!o.isNodeSdk())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return c.scheduleConnect_(0),Me.getInstance().on("visible",c.onVisible_,c),-1===n.host.indexOf("fblocal")&&Fe.getInstance().on("online",c.onOnline_,c),c}return s.__extends(e,t),e.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,i={r:r,a:t,b:e};this.log_(o.stringify(i)),o.assert(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)},e.prototype.listen=function(t,e,n,r){var i=t.queryIdentifier(),a=t.path.toString();this.log_("Listen called for "+a+" "+i),this.listens_[a]=this.listens_[a]||{},o.assert(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),o.assert(!this.listens_[a][i],"listen() called twice for same path/queryId.");var s={onComplete:r,hashFn:e,query:t,tag:n};this.listens_[a][i]=s,this.connected_&&this.sendListen_(s)},e.prototype.sendListen_=function(t){var n=this,r=t.query,i=r.path.toString(),o=r.queryIdentifier();this.log_("Listen on "+i+" for "+o);var a={p:i};t.tag&&(a.q=r.queryObject(),a.t=t.tag),a.h=t.hashFn(),this.sendRequest("q",a,function(a){var s=a.d,u=a.s;e.warnOnListenWarnings_(s,r),(n.listens_[i]&&n.listens_[i][o])===t&&(n.log_("listen response",a),"ok"!==u&&n.removeListen_(i,o),t.onComplete&&t.onComplete(u,s))})},e.warnOnListenWarnings_=function(t,e){if(t&&"object"===typeof t&&o.contains(t,"w")){var n=o.safeGet(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){var r='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',i=e.path.toString();C("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+r+" at "+i+" to your security rules for better performance.")}}},e.prototype.refreshAuthToken=function(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},function(){}),this.reduceReconnectDelayIfAdminCredential_(t)},e.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&&40===t.length||o.isAdmin(t))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},e.prototype.tryAuth=function(){var t=this;if(this.connected_&&this.authToken_){var e=this.authToken_,n=o.isValidFormat(e)?"auth":"gauth",r={cred:e};null===this.authOverride_?r.noauth=!0:"object"===typeof this.authOverride_&&(r.authvar=this.authOverride_),this.sendRequest(n,r,function(n){var r=n.s,i=n.d||"error";t.authToken_===e&&("ok"===r?t.invalidAuthTokenCount_=0:t.onAuthRevoked_(r,i))})}},e.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),o.assert(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,t.queryObject(),e)},e.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);var i={p:t};r&&(i.q=n,i.t=r),this.sendRequest("n",i)},e.prototype.onDisconnectPut=function(t,e,n){this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})},e.prototype.onDisconnectMerge=function(t,e,n){this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})},e.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},e.prototype.sendOnDisconnect_=function(t,e,n,r){var i={p:e,d:n};this.log_("onDisconnect "+t,i),this.sendRequest(t,i,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})},e.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},e.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},e.prototype.putInternal=function(t,e,n,r,i){var o={p:e,d:n};void 0!==i&&(o.h=i),this.outstandingPuts_.push({action:t,request:o,onComplete:r}),this.outstandingPutCount_++;var a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+e)},e.prototype.sendPut_=function(t){var e=this,n=this.outstandingPuts_[t].action,r=this.outstandingPuts_[t].request,i=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(n,r,function(r){e.log_(n+" response",r),delete e.outstandingPuts_[t],e.outstandingPutCount_--,0===e.outstandingPutCount_&&(e.outstandingPuts_=[]),i&&i(r.s,r.d)})},e.prototype.reportStats=function(t){var e=this;if(this.connected_){var n={c:t};this.log_("reportStats",n),this.sendRequest("s",n,function(t){if("ok"!==t.s){var n=t.d;e.log_("reportStats","Error sending stats: "+n)}})}},e.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+o.stringify(t));var e=t.r,n=this.requestCBHash_[e];n&&(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}},e.prototype.onDataPush_=function(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):T("Unrecognized action received from server: "+o.stringify(t)+"\nAre you using the latest client?")},e.prototype.onReady_=function(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)},e.prototype.scheduleConnect_=function(t){var e=this;o.assert(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(function(){e.establishConnectionTimer_=null,e.establishConnection_()},Math.floor(t))},e.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=Ge,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},e.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Ge,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())},e.prototype.onRealtimeDisconnect_=function(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){if(this.visible_){if(this.lastConnectionEstablishedTime_){(new Date).getTime()-this.lastConnectionEstablishedTime_>3e4&&(this.reconnectDelay_=Ge),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();var t=(new Date).getTime()-this.lastConnectionAttemptTime_,e=Math.max(0,this.reconnectDelay_-t);e=Math.random()*e,this.log_("Trying to reconnect in "+e+"ms"),this.scheduleConnect_(e),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},e.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var t=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+e.nextConnectionId_++,a=this,s=this.lastSessionId,u=!1,c=null,l=function(){c?c.close():(u=!0,r())};this.realtime_={close:l,sendRequest:function(t){o.assert(c,"sendRequest call when we're not connected not allowed."),c.sendRequest(t)}};var h=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(h).then(function(e){u?w("getToken() completed but was canceled"):(w("getToken() completed. Creating connection."),a.authToken_=e&&e.accessToken,c=new He(i,a.repoInfo_,t,n,r,function(t){C(t+" ("+a.repoInfo_.toString()+")"),a.interrupt("server_kill")},s))}).then(null,function(t){a.log_("Failed to get token: "+t),u||(o.CONSTANTS.NODE_ADMIN&&C(t),l())})}},e.prototype.interrupt=function(t){w("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},e.prototype.resume=function(t){w("Resuming connection for reason: "+t),delete this.interruptReasons_[t],o.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=Ge,this.realtime_||this.scheduleConnect_(0))},e.prototype.handleTimestamp_=function(t){var e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})},e.prototype.cancelSentTransactions_=function(){for(var t=0;t<this.outstandingPuts_.length;t++){var e=this.outstandingPuts_[t];e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])},e.prototype.onListenRevoked_=function(t,e){var n;n=e?e.map(function(t){return R(t)}).join("$"):"default";var r=this.removeListen_(t,n);r&&r.onComplete&&r.onComplete("permission_denied")},e.prototype.removeListen_=function(t,e){var n,r=new B(t).toString();return void 0!==this.listens_[r]?(n=this.listens_[r][e],delete this.listens_[r][e],0===o.getCount(this.listens_[r])&&delete this.listens_[r]):n=void 0,n},e.prototype.onAuthRevoked_=function(t,e){w("Auth token revoked: "+t+"/"+e),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},e.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},e.prototype.restoreState_=function(){var t=this;this.tryAuth(),o.forEach(this.listens_,function(e,n){o.forEach(n,function(e,n){t.sendListen_(n)})});for(var e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){var n=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(n.action,n.pathString,n.data,n.onComplete)}},e.prototype.sendConnectStats_=function(){var t={},e="js";o.CONSTANTS.NODE_ADMIN?e="admin_node":o.CONSTANTS.NODE_CLIENT&&(e="node"),t["sdk."+e+"."+u.SDK_VERSION.replace(/\./g,"-")]=1,o.isMobileCordova()?t["framework.cordova"]=1:o.isReactNative()&&(t["framework.reactnative"]=1),this.reportStats(t)},e.prototype.shouldReconnect_=function(){var t=Fe.getInstance().currentlyOnline();return o.isEmpty(this.interruptReasons_)&&t},e.nextPersistentConnectionId_=0,e.nextConnectionId_=0,e}(ze),Je=function(t){function e(e,n,r){var i=t.call(this)||this;return i.repoInfo_=e,i.onDataUpdate_=n,i.authTokenProvider_=r,i.log_=E("p:rest:"),i.listens_={},i}return s.__extends(e,t),e.prototype.reportStats=function(t){throw new Error("Method not implemented.")},e.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(o.assert(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},e.prototype.listen=function(t,n,r,i){var a=this,s=t.path.toString();this.log_("Listen called for "+s+" "+t.queryIdentifier());var u=e.getListenId_(t,r),c={};this.listens_[u]=c;var l=t.getQueryParams().toRestQueryStringParameters();this.restRequest_(s+".json",l,function(t,e){var n=e;(404===t&&(n=null,t=null),null===t&&a.onDataUpdate_(s,n,!1,r),o.safeGet(a.listens_,u)===c)&&i(t?401==t?"permission_denied":"rest_error:"+t:"ok",null)})},e.prototype.unlisten=function(t,n){var r=e.getListenId_(t,n);delete this.listens_[r]},e.prototype.refreshAuthToken=function(t){},e.prototype.restRequest_=function(t,e,n){var r=this;void 0===e&&(e={}),e.format="export",this.authTokenProvider_.getToken(!1).then(function(i){var a=i&&i.accessToken;a&&(e.auth=a);var s=(r.repoInfo_.secure?"https://":"http://")+r.repoInfo_.host+t+"?"+o.querystring(e);r.log_("Sending REST request for "+s);var u=new XMLHttpRequest;u.onreadystatechange=function(){if(n&&4===u.readyState){r.log_("REST Response for "+s+" received. status:",u.status,"response:",u.responseText);var t=null;if(u.status>=200&&u.status<300){try{t=o.jsonEval(u.responseText)}catch(e){C("Failed to parse JSON response for "+s+": "+u.responseText)}n(null,t)}else 401!==u.status&&404!==u.status&&C("Got unsuccessful REST response for "+s+" Status: "+u.status),n(u.status);n=null}},u.open("GET",s,!0),u.send()})},e}(ze),$e=function(){function t(t,e,n){var r=this;this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Pe,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new Jt,this.persistentConnection_=null;var i=new Ie(n);if(this.stats_=ke.getCollection(t),e||j())this.server_=new Je(this.repoInfo_,this.onDataUpdate_.bind(this),i),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var a=n.options.databaseAuthVariableOverride;if("undefined"!==typeof a&&null!==a){if("object"!==typeof a)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{o.stringify(a)}catch(s){throw new Error("Invalid authOverride provided: "+s)}}this.persistentConnection_=new Xe(this.repoInfo_,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),i,a),this.server_=this.persistentConnection_}i.addTokenChangeListener(function(t){r.server_.refreshAuthToken(t)}),this.statsReporter_=ke.getOrCreateReporter(t,function(){return new Re(r.stats_,r.server_)}),this.transactions_init_(),this.infoData_=new Ce,this.infoSyncTree_=new Se({startListening:function(t,e,n,i){var o=[],a=r.infoData_.getNode(t.path);return a.isEmpty()||(o=r.infoSyncTree_.applyServerOverwrite(t.path,a),setTimeout(function(){i("ok")},0)),o},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new Se({startListening:function(t,e,n,i){return r.server_.listen(t,n,e,function(e,n){var o=i(e,n);r.eventQueue_.raiseEventsForChangedPath(t.path,o)}),[]},stopListening:function(t,e){r.server_.unlisten(t,e)}})}return t.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},t.prototype.name=function(){return this.repoInfo_.namespace},t.prototype.serverTime=function(){var t=this.infoData_.getNode(new B(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},t.prototype.generateServerValues=function(){return(t=(t={timestamp:this.serverTime()})||{}).timestamp=t.timestamp||(new Date).getTime(),t;var t},t.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new B(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var a=[];if(r)if(n){var s=o.map(e,function(t){return jt(t)});a=this.serverSyncTree_.applyTaggedQueryMerge(i,s,r)}else{var u=jt(e);a=this.serverSyncTree_.applyTaggedQueryOverwrite(i,u,r)}else if(n){var c=o.map(e,function(t){return jt(t)});a=this.serverSyncTree_.applyServerMerge(i,c)}else{var l=jt(e);a=this.serverSyncTree_.applyServerOverwrite(i,l)}var h=i;a.length>0&&(h=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(h,a)},t.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},t.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},t.prototype.onServerInfoUpdate_=function(t){var e=this;x(t,function(t,n){e.updateInfo_(n,t)})},t.prototype.updateInfo_=function(t,e){var n=new B("/.info/"+t),r=jt(e);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},t.prototype.getNextWriteId_=function(){return this.nextWriteId_++},t.prototype.setWithPriority=function(t,e,n,r){var i=this;this.log_("set",{path:t.toString(),value:e,priority:n});var o=this.generateServerValues(),a=jt(e,n),s=Zt(a,o),u=this.getNextWriteId_(),c=this.serverSyncTree_.applyUserOverwrite(t,s,u,!0);this.eventQueue_.queueEvents(c),this.server_.put(t.toString(),a.val(!0),function(e,n){var o="ok"===e;o||C("set at "+t+" failed: "+e);var a=i.serverSyncTree_.ackUserWrite(u,!o);i.eventQueue_.raiseEventsForChangedPath(t,a),i.callOnCompleteCallback(r,e,n)});var l=this.abortTransactions_(t);this.rerunTransactions_(l),this.eventQueue_.raiseEventsForChangedPath(l,[])},t.prototype.update=function(t,e,n){var r=this;this.log_("update",{path:t.toString(),value:e});var i=!0,a=this.generateServerValues(),s={};if(o.forEach(e,function(t,e){i=!1;var n=jt(e);s[t]=Zt(n,a)}),i)w("update() called with empty data.  Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var u=this.getNextWriteId_(),c=this.serverSyncTree_.applyUserMerge(t,s,u);this.eventQueue_.queueEvents(c),this.server_.merge(t.toString(),e,function(e,i){var o="ok"===e;o||C("update at "+t+" failed: "+e);var a=r.serverSyncTree_.ackUserWrite(u,!o),s=a.length>0?r.rerunTransactions_(t):t;r.eventQueue_.raiseEventsForChangedPath(s,a),r.callOnCompleteCallback(n,e,i)}),o.forEach(e,function(e){var n=r.abortTransactions_(t.child(e));r.rerunTransactions_(n)}),this.eventQueue_.raiseEventsForChangedPath(t,[])}},t.prototype.runOnDisconnectEvents_=function(){var t=this;this.log_("onDisconnectEvents");var e=this.generateServerValues(),n=function(t,e){var n=new Jt;return t.forEachTree(new B(""),function(t,r){n.remember(t,Zt(r,e))}),n}(this.onDisconnect_,e),r=[];n.forEachTree(B.Empty,function(e,n){r=r.concat(t.serverSyncTree_.applyServerOverwrite(e,n));var i=t.abortTransactions_(e);t.rerunTransactions_(i)}),this.onDisconnect_=new Jt,this.eventQueue_.raiseEventsForChangedPath(B.Empty,r)},t.prototype.onDisconnectCancel=function(t,e){var n=this;this.server_.onDisconnectCancel(t.toString(),function(r,i){"ok"===r&&n.onDisconnect_.forget(t),n.callOnCompleteCallback(e,r,i)})},t.prototype.onDisconnectSet=function(t,e,n){var r=this,i=jt(e);this.server_.onDisconnectPut(t.toString(),i.val(!0),function(e,o){"ok"===e&&r.onDisconnect_.remember(t,i),r.callOnCompleteCallback(n,e,o)})},t.prototype.onDisconnectSetWithPriority=function(t,e,n,r){var i=this,o=jt(e,n);this.server_.onDisconnectPut(t.toString(),o.val(!0),function(e,n){"ok"===e&&i.onDisconnect_.remember(t,o),i.callOnCompleteCallback(r,e,n)})},t.prototype.onDisconnectUpdate=function(t,e,n){var r=this;if(o.isEmpty(e))return w("onDisconnect().update() called with empty data.  Don't do anything."),void this.callOnCompleteCallback(n,"ok");this.server_.onDisconnectMerge(t.toString(),e,function(i,a){"ok"===i&&o.forEach(e,function(e,n){var i=jt(n);r.onDisconnect_.remember(t.child(e),i)}),r.callOnCompleteCallback(n,i,a)})},t.prototype.addEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.addEventRegistration(t,e):this.serverSyncTree_.addEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.removeEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.removeEventRegistration(t,e):this.serverSyncTree_.removeEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt("repo_interrupt")},t.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume("repo_interrupt")},t.prototype.stats=function(t){if(void 0===t&&(t=!1),"undefined"!==typeof console){var e;t?(this.statsListener_||(this.statsListener_=new De(this.stats_)),e=this.statsListener_.get()):e=this.stats_.get();var n=Object.keys(e).reduce(function(t,e){return Math.max(e.length,t)},0);o.forEach(e,function(t,e){for(var r=t.length;r<n+2;r++)t+=" ";console.log(t+e)})}},t.prototype.statsIncrementCounter=function(t){this.stats_.incrementCounter(t),this.statsReporter_.includeStat(t)},t.prototype.log_=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="";this.persistentConnection_&&(n=this.persistentConnection_.id+":"),w.apply(void 0,[n].concat(t))},t.prototype.callOnCompleteCallback=function(t,e,n){t&&U(function(){if("ok"==e)t(null);else{var r=(e||"error").toUpperCase(),i=r;n&&(i+=": "+n);var o=new Error(i);o.code=r,t(o)}})},Object.defineProperty(t.prototype,"database",{get:function(){return this.__database||(this.__database=new cn(this))},enumerable:!0,configurable:!0}),t}(),Ze=function(){function t(e){this.indexedFilter_=new fe(e.getIndex()),this.index_=e.getIndex(),this.startPost_=t.getStartPost_(e),this.endPost_=t.getEndPost_(e)}return t.prototype.getStartPost=function(){return this.startPost_},t.prototype.getEndPost=function(){return this.endPost_},t.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},t.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new ft(e,n))||(n=Mt.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},t.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=Mt.EMPTY_NODE);var r=e.withIndex(this.index_);r=r.updatePriority(Mt.EMPTY_NODE);var i=this;return e.forEachChild(St,function(t,e){i.matches(new ft(t,e))||(r=r.updateImmediateChild(t,Mt.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},t.prototype.updatePriority=function(t,e){return t},t.prototype.filtersNodes=function(){return!0},t.prototype.getIndexedFilter=function(){return this.indexedFilter_},t.prototype.getIndex=function(){return this.index_},t.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},t.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},t}(),tn=function(){function t(t){this.rangedFilter_=new Ze(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}return t.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new ft(e,n))||(n=Mt.EMPTY_NODE),t.getImmediateChild(e).equals(n)?t:t.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,e,n,r,i,o):this.fullLimitUpdateChild_(t,e,n,i,o)},t.prototype.updateFullNode=function(t,e,n){var r;if(e.isLeafNode()||e.isEmpty())r=Mt.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){r=Mt.EMPTY_NODE.withIndex(this.index_);var i=void 0;i=this.reverse_?e.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):e.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);for(var o=0;i.hasNext()&&o<this.limit_;){var a=i.getNext();if(!(this.reverse_?this.index_.compare(this.rangedFilter_.getStartPost(),a)<=0:this.index_.compare(a,this.rangedFilter_.getEndPost())<=0))break;r=r.updateImmediateChild(a.name,a.node),o++}}else{r=(r=e.withIndex(this.index_)).updatePriority(Mt.EMPTY_NODE);var s=void 0,u=void 0,c=void 0;i=void 0;if(this.reverse_){i=r.getReverseIterator(this.index_),s=this.rangedFilter_.getEndPost(),u=this.rangedFilter_.getStartPost();var l=this.index_.getCompare();c=function(t,e){return l(e,t)}}else i=r.getIterator(this.index_),s=this.rangedFilter_.getStartPost(),u=this.rangedFilter_.getEndPost(),c=this.index_.getCompare();o=0;for(var h=!1;i.hasNext();){a=i.getNext();!h&&c(s,a)<=0&&(h=!0),h&&o<this.limit_&&c(a,u)<=0?o++:r=r.updateImmediateChild(a.name,Mt.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},t.prototype.updatePriority=function(t,e){return t},t.prototype.filtersNodes=function(){return!0},t.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},t.prototype.getIndex=function(){return this.index_},t.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var a;if(this.reverse_){var s=this.index_.getCompare();a=function(t,e){return s(e,t)}}else a=this.index_.getCompare();var u=t;o.assert(u.numChildren()==this.limit_,"");var c=new ft(e,n),l=this.reverse_?u.getFirstChild(this.index_):u.getLastChild(this.index_),h=this.rangedFilter_.matches(c);if(u.hasChild(e)){for(var f=u.getImmediateChild(e),p=r.getChildAfterChild(this.index_,l,this.reverse_);null!=p&&(p.name==e||u.hasChild(p.name));)p=r.getChildAfterChild(this.index_,p,this.reverse_);var d=null==p?1:a(p,c);if(h&&!n.isEmpty()&&d>=0)return null!=i&&i.trackChildChange(he.childChangedChange(e,n,f)),u.updateImmediateChild(e,n);null!=i&&i.trackChildChange(he.childRemovedChange(e,f));var y=u.updateImmediateChild(e,Mt.EMPTY_NODE);return null!=p&&this.rangedFilter_.matches(p)?(null!=i&&i.trackChildChange(he.childAddedChange(p.name,p.node)),y.updateImmediateChild(p.name,p.node)):y}return n.isEmpty()?t:h&&a(l,c)>=0?(null!=i&&(i.trackChildChange(he.childRemovedChange(l.name,l.node)),i.trackChildChange(he.childAddedChange(e,n))),u.updateImmediateChild(e,n).updateImmediateChild(l.name,Mt.EMPTY_NODE)):t},t}(),en=function(){function t(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=St}return t.prototype.hasStart=function(){return this.startSet_},t.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},t.prototype.getIndexStartValue=function(){return o.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},t.prototype.getIndexStartName=function(){return o.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:N},t.prototype.hasEnd=function(){return this.endSet_},t.prototype.getIndexEndValue=function(){return o.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},t.prototype.getIndexEndName=function(){return o.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:k},t.prototype.hasLimit=function(){return this.limitSet_},t.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},t.prototype.getLimit=function(){return o.assert(this.limitSet_,"Only valid if limit has been set"),this.limit_},t.prototype.getIndex=function(){return this.index_},t.prototype.copy_=function(){var e=new t;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e},t.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},t.prototype.limitToFirst=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,n},t.prototype.limitToLast=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,n},t.prototype.startAt=function(t,e){var n=this.copy_();return n.startSet_=!0,void 0===t&&(t=null),n.indexStartValue_=t,null!=e?(n.startNameSet_=!0,n.indexStartName_=e):(n.startNameSet_=!1,n.indexStartName_=""),n},t.prototype.endAt=function(t,e){var n=this.copy_();return n.endSet_=!0,void 0===t&&(t=null),n.indexEndValue_=t,void 0!==e?(n.endNameSet_=!0,n.indexEndName_=e):(n.endNameSet_=!1,n.indexEndName_=""),n},t.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},t.prototype.getQueryObject=function(){var e=t.WIRE_PROTOCOL_CONSTANTS_,n={};if(this.startSet_&&(n[e.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(n[e.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(n[e.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(n[e.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){n[e.LIMIT]=this.limit_;var r=this.viewFrom_;""===r&&(r=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),n[e.VIEW_FROM]=r}return this.index_!==St&&(n[e.INDEX]=this.index_.toString()),n},t.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},t.prototype.isDefault=function(){return this.loadsAllData()&&this.index_==St},t.prototype.getNodeFilter=function(){return this.loadsAllData()?new fe(this.getIndex()):this.hasLimit()?new tn(this):new Ze(this)},t.prototype.toRestQueryStringParameters=function(){var e,n=t.REST_QUERY_CONSTANTS_,r={};return this.isDefault()?r:(this.index_===St?e=n.PRIORITY_INDEX:this.index_===qt?e=n.VALUE_INDEX:this.index_===yt?e=n.KEY_INDEX:(o.assert(this.index_ instanceof Wt,"Unrecognized index type!"),e=this.index_.toString()),r[n.ORDER_BY]=o.stringify(e),this.startSet_&&(r[n.START_AT]=o.stringify(this.indexStartValue_),this.startNameSet_&&(r[n.START_AT]+=","+o.stringify(this.indexStartName_))),this.endSet_&&(r[n.END_AT]=o.stringify(this.indexEndValue_),this.endNameSet_&&(r[n.END_AT]+=","+o.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?r[n.LIMIT_TO_FIRST]=this.limit_:r[n.LIMIT_TO_LAST]=this.limit_),r)},t.WIRE_PROTOCOL_CONSTANTS_={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},t.REST_QUERY_CONSTANTS_={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},t.DEFAULT=new t,t}(),nn=function(t){function e(e,n){if(!(e instanceof $e))throw new Error("new Reference() no longer supported - use app.database().");return t.call(this,e,n,en.DEFAULT,!1)||this}return s.__extends(e,t),e.prototype.getKey=function(){return o.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},e.prototype.child=function(t){return o.validateArgCount("Reference.child",1,1,arguments.length),"number"===typeof t?t=String(t):t instanceof B||(null===this.path.getFront()?function(t,e,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),at(t,e,n,r)}("Reference.child",1,t,!1):at("Reference.child",1,t,!1)),new e(this.repo,this.path.child(t))},e.prototype.getParent=function(){o.validateArgCount("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new e(this.repo,t)},e.prototype.getRoot=function(){o.validateArgCount("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},e.prototype.databaseProp=function(){return this.repo.database},e.prototype.set=function(t,e){o.validateArgCount("Reference.set",1,2,arguments.length),st("Reference.set",this.path),tt("Reference.set",1,t,this.path,!1),o.validateCallback("Reference.set",2,e,!0);var n=new o.Deferred;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},e.prototype.update=function(t,e){if(o.validateArgCount("Reference.update",1,2,arguments.length),st("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,C("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}nt("Reference.update",1,t,this.path,!1),o.validateCallback("Reference.update",2,e,!0);var i=new o.Deferred;return this.repo.update(this.path,t,i.wrapCallback(e)),i.promise},e.prototype.setWithPriority=function(t,e,n){if(o.validateArgCount("Reference.setWithPriority",2,3,arguments.length),st("Reference.setWithPriority",this.path),tt("Reference.setWithPriority",1,t,this.path,!1),rt("Reference.setWithPriority",2,e,!1),o.validateCallback("Reference.setWithPriority",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.setWithPriority failed: "+this.getKey()+" is a read-only object.";var r=new o.Deferred;return this.repo.setWithPriority(this.path,t,e,r.wrapCallback(n)),r.promise},e.prototype.remove=function(t){return o.validateArgCount("Reference.remove",0,1,arguments.length),st("Reference.remove",this.path),o.validateCallback("Reference.remove",1,t,!0),this.set(null,t)},e.prototype.transaction=function(t,e,n){if(o.validateArgCount("Reference.transaction",1,3,arguments.length),st("Reference.transaction",this.path),o.validateCallback("Reference.transaction",1,t,!1),o.validateCallback("Reference.transaction",2,e,!0),function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!==typeof n)throw new Error(o.errorPrefix(t,e,r)+"must be a boolean.")}("Reference.transaction",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.transaction failed: "+this.getKey()+" is a read-only object.";void 0===n&&(n=!0);var r=new o.Deferred;"function"===typeof e&&r.promise.catch(function(){});return this.repo.startTransaction(this.path,t,function(t,n,i){t?r.reject(t):r.resolve(new lt(n,i)),"function"===typeof e&&e(t,n,i)},n),r.promise},e.prototype.setPriority=function(t,e){o.validateArgCount("Reference.setPriority",1,2,arguments.length),st("Reference.setPriority",this.path),rt("Reference.setPriority",1,t,!1),o.validateCallback("Reference.setPriority",2,e,!0);var n=new o.Deferred;return this.repo.setWithPriority(this.path.child(".priority"),t,null,n.wrapCallback(e)),n.promise},e.prototype.push=function(t,e){o.validateArgCount("Reference.push",0,2,arguments.length),st("Reference.push",this.path),tt("Reference.push",1,t,this.path,!0),o.validateCallback("Reference.push",2,e,!0);var n,r=this.repo.serverTime(),i=ht(r),a=this.child(i),s=this.child(i);return n=null!=t?a.set(t,e).then(function(){return s}):Promise.resolve(s),a.then=n.then.bind(n),a.catch=n.then.bind(n,void 0),"function"===typeof e&&n.catch(function(){}),a},e.prototype.onDisconnect=function(){return st("Reference.onDisconnect",this.path),new ct(this.repo,this.path)},Object.defineProperty(e.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){return this.getKey()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.getParent()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this.getRoot()},enumerable:!0,configurable:!0}),e}(Yt);Yt.__referenceConstructor=nn,_e.__referenceConstructor=nn;var rn,on=function(){return function(){this.children={},this.childCount=0,this.value=null}}(),an=function(){function t(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n=new on),this.name_=t,this.parent_=e,this.node_=n}return t.prototype.subTree=function(e){for(var n,r=e instanceof B?e:new B(e),i=this;null!==(n=r.getFront());){i=new t(n,i,o.safeGet(i.node_.children,n)||new on),r=r.popFront()}return i},t.prototype.getValue=function(){return this.node_.value},t.prototype.setValue=function(t){o.assert("undefined"!==typeof t,"Cannot set value to undefined"),this.node_.value=t,this.updateParents_()},t.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},t.prototype.hasChildren=function(){return this.node_.childCount>0},t.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},t.prototype.forEachChild=function(e){var n=this;o.forEach(this.node_.children,function(r,i){e(new t(r,n,i))})},t.prototype.forEachDescendant=function(t,e,n){e&&!n&&t(this),this.forEachChild(function(e){e.forEachDescendant(t,!0,n)}),e&&n&&t(this)},t.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},t.prototype.forEachImmediateDescendantWithValue=function(t){this.forEachChild(function(e){null!==e.getValue()?t(e):e.forEachImmediateDescendantWithValue(t)})},t.prototype.path=function(){return new B(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},t.prototype.name=function(){return this.name_},t.prototype.parent=function(){return this.parent_},t.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},t.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=o.contains(this.node_.children,t);n&&r?(delete this.node_.children[t],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[t]=e.node_,this.node_.childCount++,this.updateParents_())},t}();!function(t){t[t.RUN=0]="RUN",t[t.SENT=1]="SENT",t[t.COMPLETED=2]="COMPLETED",t[t.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",t[t.NEEDS_ABORT=4]="NEEDS_ABORT"}(rn||(rn={})),$e.MAX_TRANSACTION_RETRIES_=25,$e.prototype.transactions_init_=function(){this.transactionQueueTree_=new an},$e.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);var i=function(){},a=new nn(this,t);a.on("value",i);var s={path:t,update:e,onComplete:n,status:null,order:y(),applyLocally:r,retryCount:0,unwatcher:function(){a.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},u=this.getLatestState_(t);s.currentInputSnapshot=u;var c=s.update(u.val());if(void 0===c){if(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete){var l=new Kt(s.currentInputSnapshot,new nn(this,s.path),St);s.onComplete(null,!1,l)}}else{et("transaction failed: Data returned ",c,s.path),s.status=rn.RUN;var h=this.transactionQueueTree_.subTree(t),f=h.getValue()||[];f.push(s),h.setValue(f);var p=void 0;if("object"===typeof c&&null!==c&&o.contains(c,".priority"))p=o.safeGet(c,".priority"),o.assert(Z(p),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.");else p=(this.serverSyncTree_.calcCompleteEventCache(t)||Mt.EMPTY_NODE).getPriority().val();p=p;var d=this.generateServerValues(),m=jt(c,p),g=Zt(m,d);s.currentOutputSnapshotRaw=m,s.currentOutputSnapshotResolved=g,s.currentWriteId=this.getNextWriteId_();var v=this.serverSyncTree_.applyUserOverwrite(t,g,s.currentWriteId,s.applyLocally);this.eventQueue_.raiseEventsForChangedPath(t,v),this.sendReadyTransactions_()}},$e.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||Mt.EMPTY_NODE},$e.prototype.sendReadyTransactions_=function(t){var e=this;if(void 0===t&&(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()){var n=this.buildTransactionQueue_(t);o.assert(n.length>0,"Sending zero length transaction queue"),n.every(function(t){return t.status===rn.RUN})&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild(function(t){e.sendReadyTransactions_(t)})},$e.prototype.sendTransactionQueue_=function(t,e){for(var n=this,r=e.map(function(t){return t.currentWriteId}),i=this.getLatestState_(t,r),a=i,s=i.hash(),u=0;u<e.length;u++){var c=e[u];o.assert(c.status===rn.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),c.status=rn.SENT,c.retryCount++;var l=B.relativePath(t,c.path);a=a.updateChild(l,c.currentOutputSnapshotRaw)}var h=a.val(!0),f=t;this.server_.put(f.toString(),h,function(r){n.log_("transaction put response",{path:f.toString(),status:r});var i=[];if("ok"===r){for(var o=[],a=0;a<e.length;a++){if(e[a].status=rn.COMPLETED,i=i.concat(n.serverSyncTree_.ackUserWrite(e[a].currentWriteId)),e[a].onComplete){var s=e[a].currentOutputSnapshotResolved,u=new nn(n,e[a].path),c=new Kt(s,u,St);o.push(e[a].onComplete.bind(null,null,!0,c))}e[a].unwatcher()}n.pruneCompletedTransactionsBelowNode_(n.transactionQueueTree_.subTree(t)),n.sendReadyTransactions_(),n.eventQueue_.raiseEventsForChangedPath(t,i);for(a=0;a<o.length;a++)U(o[a])}else{if("datastale"===r)for(a=0;a<e.length;a++)e[a].status===rn.SENT_NEEDS_ABORT?e[a].status=rn.NEEDS_ABORT:e[a].status=rn.RUN;else{C("transaction at "+f.toString()+" failed: "+r);for(a=0;a<e.length;a++)e[a].status=rn.NEEDS_ABORT,e[a].abortReason=r}n.rerunTransactions_(t)}},s)},$e.prototype.rerunTransactions_=function(t){var e=this.getAncestorTransactionNode_(t),n=e.path(),r=this.buildTransactionQueue_(e);return this.rerunTransactionQueue_(r,n),n},$e.prototype.rerunTransactionQueue_=function(t,e){if(0!==t.length){for(var n,r=[],i=[],a=t.filter(function(t){return t.status===rn.RUN}).map(function(t){return t.currentWriteId}),s=0;s<t.length;s++){var u=t[s],c=B.relativePath(e,u.path),l=!1,h=void 0;if(o.assert(null!==c,"rerunTransactionsUnderNode_: relativePath should not be null."),u.status===rn.NEEDS_ABORT)l=!0,h=u.abortReason,i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else if(u.status===rn.RUN)if(u.retryCount>=$e.MAX_TRANSACTION_RETRIES_)l=!0,h="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else{var f=this.getLatestState_(u.path,a);u.currentInputSnapshot=f;var p=t[s].update(f.val());if(void 0!==p){et("transaction failed: Data returned ",p,u.path);var d=jt(p);"object"===typeof p&&null!=p&&o.contains(p,".priority")||(d=d.updatePriority(f.getPriority()));var y=u.currentWriteId,m=this.generateServerValues(),g=Zt(d,m);u.currentOutputSnapshotRaw=d,u.currentOutputSnapshotResolved=g,u.currentWriteId=this.getNextWriteId_(),a.splice(a.indexOf(y),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(u.path,g,u.currentWriteId,u.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(y,!0))}else l=!0,h="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,i),i=[],l&&(t[s].status=rn.COMPLETED,n=t[s].unwatcher,setTimeout(n,Math.floor(0)),t[s].onComplete))if("nodata"===h){var v=new nn(this,t[s].path),b=t[s].currentInputSnapshot,_=new Kt(b,v,St);r.push(t[s].onComplete.bind(null,null,!1,_))}else r.push(t[s].onComplete.bind(null,new Error(h),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(s=0;s<r.length;s++)U(r[s]);this.sendReadyTransactions_()}},$e.prototype.getAncestorTransactionNode_=function(t){for(var e,n=this.transactionQueueTree_;null!==(e=t.getFront())&&null===n.getValue();)n=n.subTree(e),t=t.popFront();return n},$e.prototype.buildTransactionQueue_=function(t){var e=[];return this.aggregateTransactionQueuesForNode_(t,e),e.sort(function(t,e){return t.order-e.order}),e},$e.prototype.aggregateTransactionQueuesForNode_=function(t,e){var n=this,r=t.getValue();if(null!==r)for(var i=0;i<r.length;i++)e.push(r[i]);t.forEachChild(function(t){n.aggregateTransactionQueuesForNode_(t,e)})},$e.prototype.pruneCompletedTransactionsBelowNode_=function(t){var e=this,n=t.getValue();if(n){for(var r=0,i=0;i<n.length;i++)n[i].status!==rn.COMPLETED&&(n[r]=n[i],r++);n.length=r,t.setValue(n.length>0?n:null)}t.forEachChild(function(t){e.pruneCompletedTransactionsBelowNode_(t)})},$e.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),r=this.transactionQueueTree_.subTree(t);return r.forEachAncestor(function(t){e.abortTransactionsOnNode_(t)}),this.abortTransactionsOnNode_(r),r.forEachDescendant(function(t){e.abortTransactionsOnNode_(t)}),n},$e.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,a=0;a<e.length;a++)if(e[a].status===rn.SENT_NEEDS_ABORT);else if(e[a].status===rn.SENT)o.assert(i===a-1,"All SENT items should be at beginning of queue."),i=a,e[a].status=rn.SENT_NEEDS_ABORT,e[a].abortReason="set";else if(o.assert(e[a].status===rn.RUN,"Unexpected transaction status in abort"),e[a].unwatcher(),r=r.concat(this.serverSyncTree_.ackUserWrite(e[a].currentWriteId,!0)),e[a].onComplete){n.push(e[a].onComplete.bind(null,new Error("set"),!1,null))}-1===i?t.setValue(null):e.length=i+1,this.eventQueue_.raiseEventsForChangedPath(t.path(),r);for(a=0;a<n.length;a++)U(n[a])}};var sn,un=function(){function t(){this.repos_={},this.useRestClient_=!1}return t.getInstance=function(){return sn||(sn=new t),sn},t.prototype.interrupt=function(){for(var t in this.repos_)for(var e in this.repos_[t])this.repos_[t][e].interrupt()},t.prototype.resume=function(){for(var t in this.repos_)for(var e in this.repos_[t])this.repos_[t][e].resume()},t.prototype.databaseFromApp=function(t,e){var n=e||t.options.databaseURL;void 0===n&&S("Can't determine Firebase Database URL.  Be sure to include databaseURL option when calling firebase.initializeApp().");var r=z(n),i=r.repoInfo;return ut("Invalid Firebase Database URL",1,r),r.path.isEmpty()||S("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(i,t).database},t.prototype.deleteRepo=function(t){var e=o.safeGet(this.repos_,t.app.name);e&&o.safeGet(e,t.repoInfo_.toURLString())===t||S("Database "+t.app.name+"("+t.repoInfo_+") has already been deleted."),t.interrupt(),delete e[t.repoInfo_.toURLString()]},t.prototype.createRepo=function(t,e){var n=o.safeGet(this.repos_,e.name);n||(n={},this.repos_[e.name]=n);var r=o.safeGet(n,t.toURLString());return r&&S("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),r=new $e(t,this.useRestClient_,e),n[t.toURLString()]=r,r},t.prototype.forceRestClient=function(t){this.useRestClient_=t},t}(),cn=function(){function t(t){this.repo_=t,t instanceof $e||S("Don't call new Database() directly - please use firebase.database()."),this.root_=new nn(t,B.Empty),this.INTERNAL=new ln(this)}return Object.defineProperty(t.prototype,"app",{get:function(){return this.repo_.app},enumerable:!0,configurable:!0}),t.prototype.ref=function(t){return this.checkDeleted_("ref"),o.validateArgCount("database.ref",0,1,arguments.length),t instanceof nn?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},t.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),o.validateArgCount(e,1,1,arguments.length);var n=z(t);ut(e,1,n);var r=n.repoInfo;return r.host!==this.repo_.repoInfo_.host&&S(e+": Host name does not match the current database: (found "+r.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},t.prototype.checkDeleted_=function(t){null===this.repo_&&S("Cannot call "+t+" on a deleted database.")},t.prototype.goOffline=function(){o.validateArgCount("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},t.prototype.goOnline=function(){o.validateArgCount("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},t.ServerValue={TIMESTAMP:{".sv":"timestamp"}},t}(),ln=function(){function t(t){this.database=t}return t.prototype.delete=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){return this.database.checkDeleted_("delete"),un.getInstance().deleteRepo(this.database.repo_),this.database.repo_=null,this.database.root_=null,this.database.INTERNAL=null,this.database=null,[2]})})},t}(),hn=Object.freeze({forceLongPolling:function(){Ke.forceDisallow(),Be.forceAllow()},forceWebSockets:function(){Be.forceDisallow()},isWebSocketsAvailable:function(){return Ke.isAvailable()},setSecurityDebugCallback:function(t,e){t.repo.persistentConnection_.securityDebugCallback_=e},stats:function(t,e){t.repo.stats(e)},statsIncrementCounter:function(t,e){t.repo.statsIncrementCounter(e)},dataUpdateCount:function(t){return t.repo.dataUpdateCount},interceptServerData:function(t,e){return t.repo.interceptServerData_(e)}}),fn=Xe;Xe.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},Xe.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var pn=He,dn=K,yn=Object.freeze({DataConnection:fn,RealTimeConnection:pn,hijackHash:function(t){var e=Xe.prototype.put;return Xe.prototype.put=function(n,r,i,o){void 0!==o&&(o=t()),e.call(this,n,r,i,o)},function(){Xe.prototype.put=e}},ConnectionTarget:dn,queryIdentifier:function(t){return t.queryIdentifier()},listens:function(t){return t.repo.persistentConnection_.listens_},forceRestClient:function(t){un.getInstance().forceRestClient(t)}}),mn=cn.ServerValue;function gn(e){var n=e.INTERNAL.registerService("database",function(t,e,n){return un.getInstance().databaseFromApp(t,n)},{Reference:nn,Query:Yt,Database:cn,enableLogging:_,INTERNAL:hn,ServerValue:mn,TEST_ACCESS:yn},null,!0);o.isNodeSdk()&&(t.exports=n)}gn(u),e.registerDatabase=gn,e.Database=cn,e.Query=Yt,e.Reference=nn,e.enableLogging=_,e.ServerValue=mn,e.DataSnapshot=Kt,e.OnDisconnect=ct}).call(this,n(29))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i,o=(r=n(2))&&"object"===typeof r&&"default"in r?r.default:r,a=n(30),s=n(1),u=n(55),c=o.SDK_VERSION,l=new a.Logger("@firebase/firestore");function h(){return l.logLevel===a.LogLevel.DEBUG?i.DEBUG:l.logLevel===a.LogLevel.SILENT?i.SILENT:i.ERROR}function f(t){switch(t){case i.DEBUG:l.logLevel=a.LogLevel.DEBUG;break;case i.ERROR:l.logLevel=a.LogLevel.ERROR;break;case i.SILENT:l.logLevel=a.LogLevel.SILENT;break;default:l.error("Firestore ("+c+"): Invalid value passed to `setLogLevel`")}}function p(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(l.logLevel<=a.LogLevel.DEBUG){var i=n.map(y);l.debug.apply(l,["Firestore ("+c+") ["+t+"]: "+e].concat(i))}}function d(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(l.logLevel<=a.LogLevel.ERROR){var r=e.map(y);l.error.apply(l,["Firestore ("+c+"): "+t].concat(r))}}function y(t){if("string"===typeof t)return t;var e=v.getPlatform();try{return e.formatJSON(t)}catch(n){return t}}function m(t){var e="FIRESTORE ("+c+") INTERNAL ASSERTION FAILED: "+t;throw d(e),new Error(e)}function g(t,e){t||m(e)}!function(t){t[t.DEBUG=0]="DEBUG",t[t.ERROR=1]="ERROR",t[t.SILENT=2]="SILENT"}(i||(i={}));var v=function(){function t(){}return t.setPlatform=function(e){t.platform&&m("Platform already defined"),t.platform=e},t.getPlatform=function(){return t.platform||m("Platform not set"),t.platform},t}();function b(){return v.getPlatform().emptyByteString}var _={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},w=function(t){function e(e,n){var r=t.call(this,n)||this;return r.code=e,r.message=n,r.name="FirebaseError",r.toString=function(){return r.name+": [code="+r.code+"]: "+r.message},r}return s.__extends(e,t),e}(Error);function E(t,e){function n(){var t="This constructor is private.";throw e&&(t+=" ",t+=e),new w(_.INVALID_ARGUMENT,t)}for(var r in n.prototype=t.prototype,t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function S(t,e){return void 0!==t?t:e}function C(t,e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Number(n);isNaN(r)||e(r,t[n])}}function I(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function N(t){for(var e in g(null!=t&&"object"===typeof t,"isEmpty() expects object parameter."),t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function k(t,e,n){if(e.length!==n)throw new w(_.INVALID_ARGUMENT,"Function "+t+"() requires "+K(n,"argument")+", but was called with "+K(e.length,"argument")+".")}function D(t,e,n){if(e.length<n)throw new w(_.INVALID_ARGUMENT,"Function "+t+"() requires at least "+K(n,"argument")+", but was called with "+K(e.length,"argument")+".")}function A(t,e,n,r){if(e.length<n||e.length>r)throw new w(_.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+K(e.length,"argument")+".")}function O(t,e,n,r){F(t,e,W(n)+" argument",r)}function R(t,e,n,r){void 0!==r&&O(t,e,n,r)}function P(t,e,n,r){F(t,e,n+" option",r)}function x(t,e,n,r){void 0!==r&&P(t,e,n,r)}function L(t,e,n,r,i){void 0!==r&&function(t,e,n,r,i){if(!(r instanceof Array))throw new w(_.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+j(r));for(var o=0;o<r.length;++o)if(!i(r[o]))throw new w(_.INVALID_ARGUMENT,"Function "+t+"() requires all "+e+" elements to be "+n+", but the value at index "+o+" was: "+j(r[o]))}(t,e,n,r,i)}function M(t,e,n,r,i){void 0!==r&&function(t,e,n,r,i){for(var o=[],a=0,s=i;a<s.length;a++){var u=s[a];if(u===r)return;o.push(j(u))}var c=j(r);throw new w(_.INVALID_ARGUMENT,"Invalid value "+c+" provided to function "+t+'() for option "'+n+'". Acceptable values: '+o.join(", "))}(t,0,n,r,i)}function F(t,e,n,r){if(!("object"===e?U(r):"non-empty string"===e?"string"===typeof r&&""!==r:typeof r===e)){var i=j(r);throw new w(_.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" to be of type "+e+", but it was: "+i)}}function U(t){return"object"===typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function j(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"===typeof t)return t.length>20&&(t=t.substring(0,20)+"..."),JSON.stringify(t);if("number"===typeof t||"boolean"===typeof t)return""+t;if("object"===typeof t){if(t instanceof Array)return"an array";var e=function(t){if(t.constructor){var e=/function\s+([^\s(]+)\s*\(/.exec(t.constructor.toString());if(e&&e.length>1)return e[1]}return null}(t);return e?"a custom "+e+" object":"an object"}return"function"===typeof t?"a function":m("Unknown wrong type: "+typeof t)}function V(t,e,n){if(void 0===n)throw new w(_.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+W(e)+" argument, but it was undefined.")}function B(t,e,n){I(e,function(e,r){if(n.indexOf(e)<0)throw new w(_.INVALID_ARGUMENT,"Unknown option '"+e+"' passed to function "+t+"(). Available options: "+n.join(", "))})}function q(t,e,n,r){var i=j(r);return new w(_.INVALID_ARGUMENT,"Function "+t+"() requires its "+W(n)+" argument to be a "+e+", but it was: "+i)}function W(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function K(t,e){return t+" "+e+(1===t?"":"s")}var Q=function(){function t(){}return t.newId=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="",n=0;n<20;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return g(20===e.length,"Invalid auto ID: "+e),e},t}();function H(t,e){return t<e?-1:t>e?1:0}function z(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].isEqual(e[n]))return!1;return!0}function G(){if("undefined"===typeof Uint8Array)throw new w(_.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function Y(){if(!v.getPlatform().base64Available)throw new w(_.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var X,J,$=function(){function t(t){Y(),this._binaryString=t}return t.fromBase64String=function(e){k("Blob.fromBase64String",arguments,1),O("Blob.fromBase64String","string",1,e),Y();try{return new t(v.getPlatform().atob(e))}catch(n){throw new w(_.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+n)}},t.fromUint8Array=function(e){if(k("Blob.fromUint8Array",arguments,1),G(),!(e instanceof Uint8Array))throw q("Blob.fromUint8Array","Uint8Array",1,e);return new t(Array.prototype.map.call(e,function(t){return String.fromCharCode(t)}).join(""))},t.prototype.toBase64=function(){return k("Blob.toBase64",arguments,0),Y(),v.getPlatform().btoa(this._binaryString)},t.prototype.toUint8Array=function(){k("Blob.toUint8Array",arguments,0),G();for(var t=new Uint8Array(this._binaryString.length),e=0;e<this._binaryString.length;e++)t[e]=this._binaryString.charCodeAt(e);return t},t.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},t.prototype.isEqual=function(t){return this._binaryString===t._binaryString},t.prototype._compareTo=function(t){return H(this._binaryString,t._binaryString)},t}(),Z=E($,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),tt=function(){function t(t,e){if(k("GeoPoint",arguments,2),O("GeoPoint","number",1,t),O("GeoPoint","number",2,e),!isFinite(t)||t<-90||t>90)throw new w(_.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new w(_.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}return Object.defineProperty(t.prototype,"latitude",{get:function(){return this._lat},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"longitude",{get:function(){return this._long},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(t){return this._lat===t._lat&&this._long===t._long},t.prototype._compareTo=function(t){return H(this._lat,t._lat)||H(this._long,t._long)},t}(),et=function(){function t(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new w(_.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new w(_.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new w(_.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new w(_.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return t.now=function(){return t.fromMillis(Date.now())},t.fromDate=function(e){return t.fromMillis(e.getTime())},t.fromMillis=function(e){var n=Math.floor(e/1e3);return new t(n,1e6*(e-1e3*n))},t.prototype.toDate=function(){return new Date(this.toMillis())},t.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},t.prototype._compareTo=function(t){return this.seconds===t.seconds?H(this.nanoseconds,t.nanoseconds):H(this.seconds,t.seconds)},t.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},t.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},t}(),nt=function(){return function(t,e,n,r){this.databaseId=t,this.persistenceKey=e,this.host=n,this.ssl=r}}(),rt="(default)",it=function(){function t(t,e){this.projectId=t,this.database=e||rt}return Object.defineProperty(t.prototype,"isDefaultDatabase",{get:function(){return this.database===rt},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(e){return e instanceof t&&e.projectId===this.projectId&&e.database===this.database},t.prototype.compareTo=function(t){return H(this.projectId,t.projectId)||H(this.database,t.database)},t}(),ot=function(){function t(t,e,n){this.init(t,e,n)}return t.prototype.init=function(t,e,n){void 0===e?e=0:e>t.length&&m("offset "+e+" out of range "+t.length),void 0===n?n=t.length-e:n>t.length-e&&m("length "+n+" out of range "+(t.length-e)),this.segments=t,this.offset=e,this.len=n},t.prototype.construct=function(t,e,n){var r=Object.create(Object.getPrototypeOf(this));return r.init(t,e,n),r},Object.defineProperty(t.prototype,"length",{get:function(){return this.len},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(e){return 0===t.comparator(this,e)},t.prototype.child=function(e){var n=this.segments.slice(this.offset,this.limit());return e instanceof t?e.forEach(function(t){n.push(t)}):"string"===typeof e?n.push(e):m("Unknown parameter type for Path.child(): "+e),this.construct(n)},t.prototype.limit=function(){return this.offset+this.length},t.prototype.popFirst=function(t){return t=void 0===t?1:t,g(this.length>=t,"Can't call popFirst() with less segments"),this.construct(this.segments,this.offset+t,this.length-t)},t.prototype.popLast=function(){return g(!this.isEmpty(),"Can't call popLast() on empty path"),this.construct(this.segments,this.offset,this.length-1)},t.prototype.firstSegment=function(){return g(!this.isEmpty(),"Can't call firstSegment() on empty path"),this.segments[this.offset]},t.prototype.lastSegment=function(){return g(!this.isEmpty(),"Can't call lastSegment() on empty path"),this.segments[this.limit()-1]},t.prototype.get=function(t){return g(t<this.length,"Index out of range"),this.segments[this.offset+t]},t.prototype.isEmpty=function(){return 0===this.length},t.prototype.isPrefixOf=function(t){if(t.length<this.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},t.prototype.isImmediateParentOf=function(t){if(this.length+1!==t.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},t.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},t.prototype.toArray=function(){return this.segments.slice(this.offset,this.limit())},t.comparator=function(t,e){for(var n=Math.min(t.length,e.length),r=0;r<n;r++){var i=t.get(r),o=e.get(r);if(i<o)return-1;if(i>o)return 1}return t.length<e.length?-1:t.length>e.length?1:0},t}(),at=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s.__extends(e,t),e.prototype.canonicalString=function(){return this.toArray().join("/")},e.prototype.toString=function(){return this.canonicalString()},e.fromString=function(t){if(t.indexOf("//")>=0)throw new w(_.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new e(t.split("/").filter(function(t){return t.length>0}))},e.EMPTY_PATH=new e([]),e}(ot),st=/^[_a-zA-Z][_a-zA-Z0-9]*$/,ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s.__extends(e,t),e.isValidIdentifier=function(t){return st.test(t)},e.prototype.canonicalString=function(){return this.toArray().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),e.isValidIdentifier(t)||(t="`"+t+"`"),t}).join(".")},e.prototype.toString=function(){return this.canonicalString()},e.prototype.isKeyField=function(){return 1===this.length&&"__name__"===this.get(0)},e.keyField=function(){return new e(["__name__"])},e.fromServerFormat=function(t){for(var n=[],r="",i=0,o=function(){if(0===r.length)throw new w(_.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");n.push(r),r=""},a=!1;i<t.length;){var s=t[i];if("\\"===s){if(i+1===t.length)throw new w(_.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var u=t[i+1];if("\\"!==u&&"."!==u&&"`"!==u)throw new w(_.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);r+=u,i+=2}else"`"===s?(a=!a,i++):"."!==s||a?(r+=s,i++):(o(),i++)}if(o(),a)throw new w(_.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)},e.EMPTY_PATH=new e([]),e}(ot),ct=function(){function t(e){this.path=e,g(t.isDocumentKey(e),"Invalid DocumentKey with an odd number of segments: "+e.toArray().join("/"))}return t.prototype.isEqual=function(t){return null!==t&&0===at.comparator(this.path,t.path)},t.prototype.toString=function(){return this.path.toString()},t.comparator=function(t,e){return at.comparator(t.path,e.path)},t.isDocumentKey=function(t){return t.length%2===0},t.fromSegments=function(e){return new t(new at(e.slice()))},t.fromPathString=function(e){return new t(at.fromString(e))},t.EMPTY=new t(new at([])),t}(),lt=function(){function t(t,e){this.key=t,this.version=e}return t.compareByKey=function(t,e){return ct.comparator(t.key,e.key)},t}(),ht=function(t){function e(e,n,r,i){var o=t.call(this,e,n)||this;return o.data=r,o.hasLocalMutations=!!i.hasLocalMutations,o.hasCommittedMutations=!!i.hasCommittedMutations,o}return s.__extends(e,t),e.prototype.field=function(t){return this.data.field(t)},e.prototype.fieldValue=function(t){var e=this.field(t);return e?e.value():void 0},e.prototype.value=function(){return this.data.value()},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.data.isEqual(t.data)&&this.hasLocalMutations===t.hasLocalMutations&&this.hasCommittedMutations===t.hasCommittedMutations},e.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.data.toString()+", {hasLocalMutations: "+this.hasLocalMutations+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return this.hasLocalMutations||this.hasCommittedMutations},enumerable:!0,configurable:!0}),e.compareByField=function(t,e,n){var r=e.field(t),i=n.field(t);return void 0!==r&&void 0!==i?r.compareTo(i):m("Trying to compare documents on fields that don't exist")},e}(lt),ft=function(t){function e(e,n,r){var i=t.call(this,e,n)||this;return i.hasCommittedMutations=!(!r||!r.hasCommittedMutations),i}return s.__extends(e,t),e.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!0,configurable:!0}),e.prototype.isEqual=function(t){return t instanceof e&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},e}(lt),pt=function(t){function e(e,n){return t.call(this,e,n)||this}return s.__extends(e,t),e.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.isEqual=function(t){return t instanceof e&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},e}(lt),dt=function(){function t(t,e){this.comparator=t,this.root=e||mt.EMPTY}return t.prototype.insert=function(e,n){return new t(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,mt.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.comparator,this.root.remove(e,this.comparator).copy(null,null,mt.BLACK,null,null))},t.prototype.get=function(t){for(var e=this.root;!e.isEmpty();){var n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null},t.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.isEmpty();){var r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1},t.prototype.isEmpty=function(){return this.root.isEmpty()},Object.defineProperty(t.prototype,"size",{get:function(){return this.root.size},enumerable:!0,configurable:!0}),t.prototype.minKey=function(){return this.root.minKey()},t.prototype.maxKey=function(){return this.root.maxKey()},t.prototype.inorderTraversal=function(t){return this.root.inorderTraversal(t)},t.prototype.forEach=function(t){this.inorderTraversal(function(e,n){return t(e,n),!1})},t.prototype.reverseTraversal=function(t){return this.root.reverseTraversal(t)},t.prototype.getIterator=function(){return new yt(this.root,null,this.comparator,!1)},t.prototype.getIteratorFrom=function(t){return new yt(this.root,t,this.comparator,!1)},t.prototype.getReverseIterator=function(){return new yt(this.root,null,this.comparator,!0)},t.prototype.getReverseIteratorFrom=function(t){return new yt(this.root,t,this.comparator,!0)},t}(),yt=function(){function t(t,e,n,r){this.isReverse=r,this.nodeStack=[];for(var i=1;!t.isEmpty();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}return t.prototype.getNext=function(){g(this.nodeStack.length>0,"getNext() called on iterator when hasNext() is false.");var t=this.nodeStack.pop(),e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e},t.prototype.hasNext=function(){return this.nodeStack.length>0},t.prototype.peek=function(){if(0===this.nodeStack.length)return null;var t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}},t}(),mt=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:t.EMPTY,this.right=null!=o?o:t.EMPTY,this.size=this.left.size+1+this.right.size}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.isEmpty=function(){return!1},t.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},t.prototype.min=function(){return this.left.isEmpty()?this:this.left.min()},t.prototype.minKey=function(){return this.min().key},t.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},t.prototype.insert=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n))).fixUp()},t.prototype.removeMin=function(){if(this.left.isEmpty())return t.EMPTY;var e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),(e=e.copy(null,null,null,e.left.removeMin(),null)).fixUp()},t.prototype.remove=function(e,n){var r,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===n(e,i.key)){if(i.right.isEmpty())return t.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.fixUp()},t.prototype.isRed=function(){return this.color},t.prototype.fixUp=function(){var t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t},t.prototype.moveRedLeft=function(){var t=this.colorFlip();return t.right.left.isRed()&&(t=(t=(t=t.copy(null,null,null,null,t.right.rotateRight())).rotateLeft()).colorFlip()),t},t.prototype.moveRedRight=function(){var t=this.colorFlip();return t.left.left.isRed()&&(t=(t=t.rotateRight()).colorFlip()),t},t.prototype.rotateLeft=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.rotateRight=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.colorFlip=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.checkMaxDepth=function(){var t=this.check();return Math.pow(2,t)<=this.size+1},t.prototype.check=function(){if(this.isRed()&&this.left.isRed())throw m("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed())throw m("Right child of ("+this.key+","+this.value+") is red");var t=this.left.check();if(t!==this.right.check())throw m("Black depths differ");return t+(this.isRed()?0:1)},t.EMPTY=null,t.RED=!0,t.BLACK=!1,t}(),gt=function(){function t(){this.size=0}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new mt(t,e)},t.prototype.remove=function(t,e){return this},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(t){return!1},t.prototype.reverseTraversal=function(t){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.isRed=function(){return!1},t.prototype.checkMaxDepth=function(){return!0},t.prototype.check=function(){return 0},t}();mt.EMPTY=new gt,function(t){t[t.NullValue=0]="NullValue",t[t.BooleanValue=1]="BooleanValue",t[t.NumberValue=2]="NumberValue",t[t.TimestampValue=3]="TimestampValue",t[t.StringValue=4]="StringValue",t[t.BlobValue=5]="BlobValue",t[t.RefValue=6]="RefValue",t[t.GeoPointValue=7]="GeoPointValue",t[t.ArrayValue=8]="ArrayValue",t[t.ObjectValue=9]="ObjectValue"}(X||(X={})),function(t){t[t.Default=0]="Default",t[t.Estimate=1]="Estimate",t[t.Previous=2]="Previous"}(J||(J={}));var vt=function(){function t(t,e){this.serverTimestampBehavior=t,this.timestampsInSnapshots=e}return t.fromSnapshotOptions=function(e,n){switch(e.serverTimestamps){case"estimate":return new t(J.Estimate,n);case"previous":return new t(J.Previous,n);case"none":case void 0:return new t(J.Default,n);default:return m("fromSnapshotOptions() called with invalid options.")}},t}(),bt=function(){function t(){}return t.prototype.toString=function(){var t=this.value();return null===t?"null":t.toString()},t.prototype.defaultCompareTo=function(t){return g(this.typeOrder!==t.typeOrder,"Default compareTo should not be used for values of same type."),H(this.typeOrder,t.typeOrder)},t}(),_t=function(t){function e(){var e=t.call(this)||this;return e.typeOrder=X.NullValue,e.internalValue=null,e}return s.__extends(e,t),e.prototype.value=function(t){return null},e.prototype.isEqual=function(t){return t instanceof e},e.prototype.compareTo=function(t){return t instanceof e?0:this.defaultCompareTo(t)},e.INSTANCE=new e,e}(bt),wt=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=X.BooleanValue,n}return s.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue===t.internalValue},e.prototype.compareTo=function(t){return t instanceof e?H(this,t):this.defaultCompareTo(t)},e.of=function(t){return t?e.TRUE:e.FALSE},e.TRUE=new e(!0),e.FALSE=new e(!1),e}(bt),Et=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=X.NumberValue,n}return s.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.compareTo=function(t){return t instanceof e?(n=this.internalValue,r=t.internalValue,n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1):this.defaultCompareTo(t);var n,r},e}(bt);function Tt(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e}var St=function(t){function e(e){return t.call(this,e)||this}return s.__extends(e,t),e.prototype.isEqual=function(t){return t instanceof e&&Tt(this.internalValue,t.internalValue)},e}(Et),Ct=function(t){function e(e){var n=t.call(this,e)||this;return n.internalValue=e,n}return s.__extends(e,t),e.prototype.isEqual=function(t){return t instanceof e&&Tt(this.internalValue,t.internalValue)},e.NAN=new e(NaN),e.POSITIVE_INFINITY=new e(1/0),e.NEGATIVE_INFINITY=new e(-1/0),e}(Et),It=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=X.StringValue,n}return s.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue===t.internalValue},e.prototype.compareTo=function(t){return t instanceof e?H(this.internalValue,t.internalValue):this.defaultCompareTo(t)},e}(bt),Nt=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=X.TimestampValue,n}return s.__extends(e,t),e.prototype.value=function(t){return t&&t.timestampsInSnapshots?this.internalValue:this.internalValue.toDate()},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue.isEqual(t.internalValue)},e.prototype.compareTo=function(t){return t instanceof e?this.internalValue._compareTo(t.internalValue):t instanceof kt?-1:this.defaultCompareTo(t)},e}(bt),kt=function(t){function e(e,n){var r=t.call(this)||this;return r.localWriteTime=e,r.previousValue=n,r.typeOrder=X.TimestampValue,r}return s.__extends(e,t),e.prototype.value=function(t){return t&&t.serverTimestampBehavior===J.Estimate?new Nt(this.localWriteTime).value(t):t&&t.serverTimestampBehavior===J.Previous&&this.previousValue?this.previousValue.value(t):null},e.prototype.isEqual=function(t){return t instanceof e&&this.localWriteTime.isEqual(t.localWriteTime)},e.prototype.compareTo=function(t){return t instanceof e?this.localWriteTime._compareTo(t.localWriteTime):t instanceof Nt?1:this.defaultCompareTo(t)},e.prototype.toString=function(){return"<ServerTimestamp localTime="+this.localWriteTime.toString()+">"},e}(bt),Dt=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=X.BlobValue,n}return s.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue.isEqual(t.internalValue)},e.prototype.compareTo=function(t){return t instanceof e?this.internalValue._compareTo(t.internalValue):this.defaultCompareTo(t)},e}(bt),At=function(t){function e(e,n){var r=t.call(this)||this;return r.databaseId=e,r.key=n,r.typeOrder=X.RefValue,r}return s.__extends(e,t),e.prototype.value=function(t){return this.key},e.prototype.isEqual=function(t){return t instanceof e&&(this.key.isEqual(t.key)&&this.databaseId.isEqual(t.databaseId))},e.prototype.compareTo=function(t){if(t instanceof e){var n=this.databaseId.compareTo(t.databaseId);return 0!==n?n:ct.comparator(this.key,t.key)}return this.defaultCompareTo(t)},e}(bt),Ot=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=X.GeoPointValue,n}return s.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue.isEqual(t.internalValue)},e.prototype.compareTo=function(t){return t instanceof e?this.internalValue._compareTo(t.internalValue):this.defaultCompareTo(t)},e}(bt),Rt=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=X.ObjectValue,n}return s.__extends(e,t),e.prototype.value=function(t){var e={};return this.internalValue.inorderTraversal(function(n,r){e[n]=r.value(t)}),e},e.prototype.forEach=function(t){this.internalValue.inorderTraversal(t)},e.prototype.isEqual=function(t){if(t instanceof e){for(var n=this.internalValue.getIterator(),r=t.internalValue.getIterator();n.hasNext()&&r.hasNext();){var i=n.getNext(),o=r.getNext();if(i.key!==o.key||!i.value.isEqual(o.value))return!1}return!n.hasNext()&&!r.hasNext()}return!1},e.prototype.compareTo=function(t){if(t instanceof e){for(var n=this.internalValue.getIterator(),r=t.internalValue.getIterator();n.hasNext()&&r.hasNext();){var i=n.getNext(),o=r.getNext(),a=H(i.key,o.key)||i.value.compareTo(o.value);if(a)return a}return H(n.hasNext(),r.hasNext())}return this.defaultCompareTo(t)},e.prototype.set=function(t,n){if(g(!t.isEmpty(),"Cannot set field for empty path on ObjectValue"),1===t.length)return this.setChild(t.firstSegment(),n);var r=this.child(t.firstSegment());r instanceof e||(r=e.EMPTY);var i=r.set(t.popFirst(),n);return this.setChild(t.firstSegment(),i)},e.prototype.delete=function(t){if(g(!t.isEmpty(),"Cannot delete field for empty path on ObjectValue"),1===t.length)return new e(this.internalValue.remove(t.firstSegment()));var n=this.child(t.firstSegment());if(n instanceof e){var r=n.delete(t.popFirst());return new e(this.internalValue.insert(t.firstSegment(),r))}return this},e.prototype.contains=function(t){return void 0!==this.field(t)},e.prototype.field=function(t){g(!t.isEmpty(),"Can't get field of empty path");var n=this;return t.forEach(function(t){n=n instanceof e&&n.internalValue.get(t)||void 0}),n},e.prototype.toString=function(){return JSON.stringify(this.value())},e.prototype.child=function(t){return this.internalValue.get(t)||void 0},e.prototype.setChild=function(t,n){return new e(this.internalValue.insert(t,n))},e.EMPTY=new e(new dt(H)),e}(bt),Pt=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=X.ArrayValue,n}return s.__extends(e,t),e.prototype.value=function(t){return this.internalValue.map(function(e){return e.value(t)})},e.prototype.forEach=function(t){this.internalValue.forEach(t)},e.prototype.isEqual=function(t){if(t instanceof e){if(this.internalValue.length!==t.internalValue.length)return!1;for(var n=0;n<this.internalValue.length;n++)if(!this.internalValue[n].isEqual(t.internalValue[n]))return!1;return!0}return!1},e.prototype.compareTo=function(t){if(t instanceof e){for(var n=Math.min(this.internalValue.length,t.internalValue.length),r=0;r<n;r++){var i=this.internalValue[r].compareTo(t.internalValue[r]);if(i)return i}return H(this.internalValue.length,t.internalValue.length)}return this.defaultCompareTo(t)},e.prototype.toString=function(){return JSON.stringify(this.value())},e}(bt),xt=Number,Lt=xt.MIN_SAFE_INTEGER||-(Math.pow(2,53)-1),Mt=xt.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Ft=xt.isInteger||function(t){return"number"===typeof t&&isFinite(t)&&Math.floor(t)===t};function Ut(t){return null===t||void 0===t}function jt(t){return Ft(t)&&t<=Mt&&t>=Lt}var Vt,Bt=function(){function t(t,e,n,r,i,o){void 0===e&&(e=[]),void 0===n&&(n=[]),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=null),this.path=t,this.explicitOrderBy=e,this.filters=n,this.limit=r,this.startAt=i,this.endAt=o,this.memoizedCanonicalId=null,this.memoizedOrderBy=null,this.startAt&&this.assertValidBound(this.startAt),this.endAt&&this.assertValidBound(this.endAt)}return t.atPath=function(e){return new t(e)},Object.defineProperty(t.prototype,"orderBy",{get:function(){if(null===this.memoizedOrderBy){var t=this.getInequalityFilterField(),e=this.getFirstOrderByField();if(null!==t&&null===e)t.isKeyField()?this.memoizedOrderBy=[Xt]:this.memoizedOrderBy=[new Yt(t),Xt];else{g(null===t||null!==e&&t.isEqual(e),"First orderBy should match inequality field."),this.memoizedOrderBy=[];for(var n=!1,r=0,i=this.explicitOrderBy;r<i.length;r++){var o=i[r];this.memoizedOrderBy.push(o),o.field.isKeyField()&&(n=!0)}if(!n){var a=this.explicitOrderBy.length>0?this.explicitOrderBy[this.explicitOrderBy.length-1].dir:zt.ASCENDING;this.memoizedOrderBy.push(a===zt.ASCENDING?Xt:Jt)}}}return this.memoizedOrderBy},enumerable:!0,configurable:!0}),t.prototype.addFilter=function(e){g(null==this.getInequalityFilterField()||!(e instanceof Kt)||!e.isInequality()||e.field.isEqual(this.getInequalityFilterField()),"Query must only have one inequality field."),g(!ct.isDocumentKey(this.path),"No filtering allowed for document query");var n=this.filters.concat([e]);return new t(this.path,this.explicitOrderBy.slice(),n,this.limit,this.startAt,this.endAt)},t.prototype.addOrderBy=function(e){g(!ct.isDocumentKey(this.path),"No ordering allowed for document query"),g(!this.startAt&&!this.endAt,"Bounds must be set after orderBy");var n=this.explicitOrderBy.concat([e]);return new t(this.path,n,this.filters.slice(),this.limit,this.startAt,this.endAt)},t.prototype.withLimit=function(e){return new t(this.path,this.explicitOrderBy.slice(),this.filters.slice(),e,this.startAt,this.endAt)},t.prototype.withStartAt=function(e){return new t(this.path,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,e,this.endAt)},t.prototype.withEndAt=function(e){return new t(this.path,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,this.startAt,e)},t.prototype.canonicalId=function(){if(null===this.memoizedCanonicalId){var t=this.path.canonicalString();t+="|f:";for(var e=0,n=this.filters;e<n.length;e++){t+=n[e].canonicalId(),t+=","}t+="|ob:";for(var r=0,i=this.orderBy;r<i.length;r++){t+=i[r].canonicalId(),t+=","}Ut(this.limit)||(t+="|l:",t+=this.limit),this.startAt&&(t+="|lb:",t+=this.startAt.canonicalId()),this.endAt&&(t+="|ub:",t+=this.endAt.canonicalId()),this.memoizedCanonicalId=t}return this.memoizedCanonicalId},t.prototype.toString=function(){var t="Query("+this.path.canonicalString();return this.filters.length>0&&(t+=", filters: ["+this.filters.join(", ")+"]"),Ut(this.limit)||(t+=", limit: "+this.limit),this.explicitOrderBy.length>0&&(t+=", orderBy: ["+this.explicitOrderBy.join(", ")+"]"),this.startAt&&(t+=", startAt: "+this.startAt.canonicalId()),this.endAt&&(t+=", endAt: "+this.endAt.canonicalId()),t+")"},t.prototype.isEqual=function(t){if(this.limit!==t.limit)return!1;if(this.orderBy.length!==t.orderBy.length)return!1;for(var e=0;e<this.orderBy.length;e++)if(!this.orderBy[e].isEqual(t.orderBy[e]))return!1;if(this.filters.length!==t.filters.length)return!1;for(e=0;e<this.filters.length;e++)if(!this.filters[e].isEqual(t.filters[e]))return!1;return!!this.path.isEqual(t.path)&&(!(null!==this.startAt?!this.startAt.isEqual(t.startAt):null!==t.startAt)&&(null!==this.endAt?this.endAt.isEqual(t.endAt):null===t.endAt))},t.prototype.docComparator=function(t,e){for(var n=!1,r=0,i=this.orderBy;r<i.length;r++){var o=i[r],a=o.compare(t,e);if(0!==a)return a;n=n||o.field.isKeyField()}return g(n,"orderBy used that doesn't compare on key field"),0},t.prototype.matches=function(t){return this.matchesAncestor(t)&&this.matchesOrderBy(t)&&this.matchesFilters(t)&&this.matchesBounds(t)},t.prototype.hasLimit=function(){return!Ut(this.limit)},t.prototype.getFirstOrderByField=function(){return this.explicitOrderBy.length>0?this.explicitOrderBy[0].field:null},t.prototype.getInequalityFilterField=function(){for(var t=0,e=this.filters;t<e.length;t++){var n=e[t];if(n instanceof Kt&&n.isInequality())return n.field}return null},t.prototype.hasArrayContainsFilter=function(){return void 0!==this.filters.find(function(t){return t instanceof Kt&&t.op===Wt.ARRAY_CONTAINS})},t.prototype.isDocumentQuery=function(){return ct.isDocumentKey(this.path)&&0===this.filters.length},t.prototype.matchesAncestor=function(t){var e=t.key.path;return ct.isDocumentKey(this.path)?this.path.isEqual(e):this.path.isPrefixOf(e)&&this.path.length===e.length-1},t.prototype.matchesOrderBy=function(t){for(var e=0,n=this.explicitOrderBy;e<n.length;e++){var r=n[e];if(!r.field.isKeyField()&&void 0===t.field(r.field))return!1}return!0},t.prototype.matchesFilters=function(t){for(var e=0,n=this.filters;e<n.length;e++){if(!n[e].matches(t))return!1}return!0},t.prototype.matchesBounds=function(t){return!(this.startAt&&!this.startAt.sortsBeforeDocument(this.orderBy,t))&&(!this.endAt||!this.endAt.sortsBeforeDocument(this.orderBy,t))},t.prototype.assertValidBound=function(t){g(t.position.length<=this.orderBy.length,"Bound is longer than orderBy")},t}(),qt=function(){function t(){}return t.create=function(t,e,n){if(n.isEqual(_t.INSTANCE)){if(e!==Wt.EQUAL)throw new w(_.INVALID_ARGUMENT,"Invalid query. You can only perform equals comparisons on null.");return new Qt(t)}if(n.isEqual(Ct.NAN)){if(e!==Wt.EQUAL)throw new w(_.INVALID_ARGUMENT,"Invalid query. You can only perform equals comparisons on NaN.");return new Ht(t)}return new Kt(t,e,n)},t}(),Wt=function(){function t(t){this.name=t}return t.fromString=function(e){switch(e){case"<":return t.LESS_THAN;case"<=":return t.LESS_THAN_OR_EQUAL;case"==":return t.EQUAL;case">=":return t.GREATER_THAN_OR_EQUAL;case">":return t.GREATER_THAN;case"array-contains":return t.ARRAY_CONTAINS;default:return m("Unknown relation: "+e)}},t.prototype.toString=function(){return this.name},t.prototype.isEqual=function(t){return this.name===t.name},t.LESS_THAN=new t("<"),t.LESS_THAN_OR_EQUAL=new t("<="),t.EQUAL=new t("=="),t.GREATER_THAN=new t(">"),t.GREATER_THAN_OR_EQUAL=new t(">="),t.ARRAY_CONTAINS=new t("array-contains"),t}(),Kt=function(t){function e(e,n,r){var i=t.call(this)||this;return i.field=e,i.op=n,i.value=r,i}return s.__extends(e,t),e.prototype.matches=function(t){if(this.field.isKeyField()){g(this.value instanceof At,"Comparing on key, but filter value not a RefValue"),g(this.op!==Wt.ARRAY_CONTAINS,"array-contains queries don't make sense on document keys.");var e=this.value,n=ct.comparator(t.key,e.key);return this.matchesComparison(n)}var r=t.field(this.field);return void 0!==r&&this.matchesValue(r)},e.prototype.matchesValue=function(t){var e=this;return this.op===Wt.ARRAY_CONTAINS?t instanceof Pt&&void 0!==t.internalValue.find(function(t){return t.isEqual(e.value)}):this.value.typeOrder===t.typeOrder&&this.matchesComparison(t.compareTo(this.value))},e.prototype.matchesComparison=function(t){switch(this.op){case Wt.LESS_THAN:return t<0;case Wt.LESS_THAN_OR_EQUAL:return t<=0;case Wt.EQUAL:return 0===t;case Wt.GREATER_THAN:return t>0;case Wt.GREATER_THAN_OR_EQUAL:return t>=0;default:return m("Unknown relation op"+this.op)}},e.prototype.isInequality=function(){return this.op!==Wt.EQUAL&&this.op!==Wt.ARRAY_CONTAINS},e.prototype.canonicalId=function(){return this.field.canonicalString()+this.op.toString()+this.value.toString()},e.prototype.isEqual=function(t){return t instanceof e&&(this.op.isEqual(t.op)&&this.field.isEqual(t.field)&&this.value.isEqual(t.value))},e.prototype.toString=function(){return this.field.canonicalString()+" "+this.op+" "+this.value.value()},e}(qt),Qt=function(t){function e(e){var n=t.call(this)||this;return n.field=e,n}return s.__extends(e,t),e.prototype.matches=function(t){var e=t.field(this.field);return void 0!==e&&null===e.value()},e.prototype.canonicalId=function(){return this.field.canonicalString()+" IS null"},e.prototype.toString=function(){return this.field.canonicalString()+" IS null"},e.prototype.isEqual=function(t){return t instanceof e&&this.field.isEqual(t.field)},e}(qt),Ht=function(t){function e(e){var n=t.call(this)||this;return n.field=e,n}return s.__extends(e,t),e.prototype.matches=function(t){var e=t.field(this.field),n=e&&e.value();return"number"===typeof n&&isNaN(n)},e.prototype.canonicalId=function(){return this.field.canonicalString()+" IS NaN"},e.prototype.toString=function(){return this.field.canonicalString()+" IS NaN"},e.prototype.isEqual=function(t){return t instanceof e&&this.field.isEqual(t.field)},e}(qt),zt=function(){function t(t){this.name=t}return t.prototype.toString=function(){return this.name},t.ASCENDING=new t("asc"),t.DESCENDING=new t("desc"),t}(),Gt=function(){function t(t,e){this.position=t,this.before=e}return t.prototype.canonicalId=function(){for(var t=this.before?"b:":"a:",e=0,n=this.position;e<n.length;e++){t+=n[e].toString()}return t},t.prototype.sortsBeforeDocument=function(t,e){g(this.position.length<=t.length,"Bound has more components than query's orderBy");for(var n=0,r=0;r<this.position.length;r++){var i=t[r],o=this.position[r];if(i.field.isKeyField())g(o instanceof At,"Bound has a non-key value where the key path is being used."),n=ct.comparator(o.key,e.key);else{var a=e.field(i.field);g(void 0!==a,"Field should exist since document matched the orderBy already."),n=o.compareTo(a)}if(i.dir===zt.DESCENDING&&(n*=-1),0!==n)break}return this.before?n<=0:n<0},t.prototype.isEqual=function(t){if(null===t)return!1;if(this.before!==t.before||this.position.length!==t.position.length)return!1;for(var e=0;e<this.position.length;e++){var n=this.position[e],r=t.position[e];return n.isEqual(r)}return!0},t}(),Yt=function(){function t(t,e){this.field=t,void 0===e&&(e=zt.ASCENDING),this.dir=e,this.isKeyOrderBy=t.isKeyField()}return t.prototype.compare=function(t,e){var n=this.isKeyOrderBy?ht.compareByKey(t,e):ht.compareByField(this.field,t,e);switch(this.dir){case zt.ASCENDING:return n;case zt.DESCENDING:return-1*n;default:return m("Unknown direction: "+this.dir)}},t.prototype.canonicalId=function(){return this.field.canonicalString()+this.dir.toString()},t.prototype.toString=function(){return this.field.canonicalString()+" ("+this.dir+")"},t.prototype.isEqual=function(t){return this.dir===t.dir&&this.field.isEqual(t.field)},t}(),Xt=new Yt(ut.keyField(),zt.ASCENDING),Jt=new Yt(ut.keyField(),zt.DESCENDING),$t=function(){function t(t){this.timestamp=t}return t.fromMicroseconds=function(e){var n=Math.floor(e/1e6);return new t(new et(n,e%1e6*1e3))},t.fromTimestamp=function(e){return new t(e)},t.forDeletedDoc=function(){return t.MIN},t.prototype.compareTo=function(t){return this.timestamp._compareTo(t.timestamp)},t.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},t.prototype.toMicroseconds=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},t.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},t.prototype.toTimestamp=function(){return this.timestamp},t.MIN=new t(new et(0,0)),t}();!function(t){t[t.Listen=0]="Listen",t[t.ExistenceFilterMismatch=1]="ExistenceFilterMismatch",t[t.LimboResolution=2]="LimboResolution"}(Vt||(Vt={}));var Zt,te=function(){function t(t,e,n,r,i,o){void 0===i&&(i=$t.MIN),void 0===o&&(o=b()),this.query=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.resumeToken=o}return t.prototype.copy=function(e){return new t(this.query,this.targetId,this.purpose,void 0===e.sequenceNumber?this.sequenceNumber:e.sequenceNumber,void 0===e.snapshotVersion?this.snapshotVersion:e.snapshotVersion,void 0===e.resumeToken?this.resumeToken:e.resumeToken)},t.prototype.isEqual=function(t){return this.targetId===t.targetId&&this.purpose===t.purpose&&this.sequenceNumber===t.sequenceNumber&&this.snapshotVersion.isEqual(t.snapshotVersion)&&this.resumeToken===t.resumeToken&&this.query.isEqual(t.query)},t}(),ee=function(){function t(t){this.comparator=t,this.data=new dt(this.comparator)}return t.fromMapKeys=function(e){var n=new t(e.comparator);return e.forEach(function(t){n=n.add(t)}),n},t.prototype.has=function(t){return null!==this.data.get(t)},t.prototype.first=function(){return this.data.minKey()},t.prototype.last=function(){return this.data.maxKey()},Object.defineProperty(t.prototype,"size",{get:function(){return this.data.size},enumerable:!0,configurable:!0}),t.prototype.indexOf=function(t){return this.data.indexOf(t)},t.prototype.forEach=function(t){this.data.inorderTraversal(function(e,n){return t(e),!1})},t.prototype.forEachInRange=function(t,e){for(var n=this.data.getIteratorFrom(t[0]);n.hasNext();){var r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}},t.prototype.forEachWhile=function(t,e){var n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();){if(!t(n.getNext().key))return}},t.prototype.firstAfterOrEqual=function(t){var e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null},t.prototype.add=function(t){return this.copy(this.data.remove(t).insert(t,!0))},t.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},t.prototype.isEmpty=function(){return this.data.isEmpty()},t.prototype.unionWith=function(t){var e=this;return t.forEach(function(t){e=e.add(t)}),e},t.prototype.isEqual=function(e){if(!(e instanceof t))return!1;if(this.size!==e.size)return!1;for(var n=this.data.getIterator(),r=e.data.getIterator();n.hasNext();){var i=n.getNext().key,o=r.getNext().key;if(0!==this.comparator(i,o))return!1}return!0},t.prototype.toArray=function(){var t=[];return this.forEach(function(e){t.push(e)}),t},t.prototype.toString=function(){var t=[];return this.forEach(function(e){return t.push(e)}),"SortedSet("+t.toString()+")"},t.prototype.copy=function(e){var n=new t(this.comparator);return n.data=e,n},t}(),ne=function(){function t(t){this.fields=t}return t.fromArray=function(e){var n=new ee(ut.comparator);return e.forEach(function(t){return n=n.add(t)}),new t(n)},t.prototype.covers=function(t){var e=!1;return this.fields.forEach(function(n){n.isPrefixOf(t)&&(e=!0)}),e},t.prototype.isEqual=function(t){return this.fields.isEqual(t.fields)},t}(),re=function(){function t(t,e){this.field=t,this.transform=e}return t.prototype.isEqual=function(t){return this.field.isEqual(t.field)&&this.transform.isEqual(t.transform)},t}(),ie=function(){return function(t,e){this.version=t,this.transformResults=e}}();!function(t){t[t.Set=0]="Set",t[t.Patch=1]="Patch",t[t.Transform=2]="Transform",t[t.Delete=3]="Delete"}(Zt||(Zt={}));var oe=function(){function t(t,e){this.updateTime=t,this.exists=e,g(void 0===t||void 0===e,'Precondition can specify "exists" or "updateTime" but not both')}return t.exists=function(e){return new t(void 0,e)},t.updateTime=function(e){return new t(e)},Object.defineProperty(t.prototype,"isNone",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!0,configurable:!0}),t.prototype.isValidFor=function(t){return void 0!==this.updateTime?t instanceof ht&&t.version.isEqual(this.updateTime):void 0!==this.exists?this.exists===t instanceof ht:(g(this.isNone,"Precondition should be empty"),!0)},t.prototype.isEqual=function(t){return e=this.updateTime,n=t.updateTime,(null!==e&&void 0!==e?!(!n||!e.isEqual(n)):e===n)&&this.exists===t.exists;var e,n},t.NONE=new t,t}(),ae=function(){function t(){}return t.prototype.verifyKeyMatches=function(t){null!=t&&g(t.key.isEqual(this.key),"Can only apply a mutation to a document with the same key")},t.getPostMutationVersion=function(t){return t instanceof ht?t.version:$t.MIN},t}(),se=function(t){function e(e,n,r){var i=t.call(this)||this;return i.key=e,i.value=n,i.precondition=r,i.type=Zt.Set,i}return s.__extends(e,t),e.prototype.applyToRemoteDocument=function(t,e){this.verifyKeyMatches(t),g(null==e.transformResults,"Transform results received by SetMutation.");var n=e.version;return new ht(this.key,n,this.value,{hasCommittedMutations:!0})},e.prototype.applyToLocalView=function(t,e,n){if(this.verifyKeyMatches(t),!this.precondition.isValidFor(t))return t;var r=ae.getPostMutationVersion(t);return new ht(this.key,r,this.value,{hasLocalMutations:!0})},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.value.isEqual(t.value)&&this.precondition.isEqual(t.precondition)},e}(ae),ue=function(t){function e(e,n,r,i){var o=t.call(this)||this;return o.key=e,o.data=n,o.fieldMask=r,o.precondition=i,o.type=Zt.Patch,o}return s.__extends(e,t),e.prototype.applyToRemoteDocument=function(t,e){if(this.verifyKeyMatches(t),g(null==e.transformResults,"Transform results received by PatchMutation."),!this.precondition.isValidFor(t))return new pt(this.key,e.version);var n=this.patchDocument(t);return new ht(this.key,e.version,n,{hasCommittedMutations:!0})},e.prototype.applyToLocalView=function(t,e,n){if(this.verifyKeyMatches(t),!this.precondition.isValidFor(t))return t;var r=ae.getPostMutationVersion(t),i=this.patchDocument(t);return new ht(this.key,r,i,{hasLocalMutations:!0})},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.fieldMask.isEqual(t.fieldMask)&&this.precondition.isEqual(t.precondition)},e.prototype.patchDocument=function(t){var e;return e=t instanceof ht?t.data:Rt.EMPTY,this.patchObject(e)},e.prototype.patchObject=function(t){var e=this;return this.fieldMask.fields.forEach(function(n){if(!n.isEmpty()){var r=e.data.field(n);t=void 0!==r?t.set(n,r):t.delete(n)}}),t},e}(ae),ce=function(t){function e(e,n){var r=t.call(this)||this;return r.key=e,r.fieldTransforms=n,r.type=Zt.Transform,r.precondition=oe.exists(!0),r}return s.__extends(e,t),e.prototype.applyToRemoteDocument=function(t,e){if(this.verifyKeyMatches(t),g(null!=e.transformResults,"Transform results missing for TransformMutation."),!this.precondition.isValidFor(t))return new pt(this.key,e.version);var n=this.requireDocument(t),r=this.serverTransformResults(t,e.transformResults),i=e.version,o=this.transformObject(n.data,r);return new ht(this.key,i,o,{hasCommittedMutations:!0})},e.prototype.applyToLocalView=function(t,e,n){if(this.verifyKeyMatches(t),!this.precondition.isValidFor(t))return t;var r=this.requireDocument(t),i=this.localTransformResults(n,e),o=this.transformObject(r.data,i);return new ht(this.key,r.version,o,{hasLocalMutations:!0})},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&z(this.fieldTransforms,t.fieldTransforms)&&this.precondition.isEqual(t.precondition)},e.prototype.requireDocument=function(t){g(t instanceof ht,"Unknown MaybeDocument type "+t);var e=t;return g(e.key.isEqual(this.key),"Can only transform a document with the same key"),e},e.prototype.serverTransformResults=function(t,e){var n=[];g(this.fieldTransforms.length===e.length,"server transform result count ("+e.length+") should match field transform count ("+this.fieldTransforms.length+")");for(var r=0;r<e.length;r++){var i=this.fieldTransforms[r],o=i.transform,a=null;t instanceof ht&&(a=t.field(i.field)||null),n.push(o.applyToRemoteDocument(a,e[r]))}return n},e.prototype.localTransformResults=function(t,e){for(var n=[],r=0,i=this.fieldTransforms;r<i.length;r++){var o=i[r],a=o.transform,s=null;e instanceof ht&&(s=e.field(o.field)||null),n.push(a.applyToLocalView(s,t))}return n},e.prototype.transformObject=function(t,e){g(e.length===this.fieldTransforms.length,"TransformResults length mismatch.");for(var n=0;n<this.fieldTransforms.length;n++){var r=this.fieldTransforms[n].field;t=t.set(r,e[n])}return t},e}(ae),le=function(t){function e(e,n){var r=t.call(this)||this;return r.key=e,r.precondition=n,r.type=Zt.Delete,r}return s.__extends(e,t),e.prototype.applyToRemoteDocument=function(t,e){return this.verifyKeyMatches(t),g(null==e.transformResults,"Transform results received by DeleteMutation."),new ft(this.key,e.version,{hasCommittedMutations:!0})},e.prototype.applyToLocalView=function(t,e,n){return this.verifyKeyMatches(t),this.precondition.isValidFor(t)?(t&&g(t.key.isEqual(this.key),"Can only apply mutation to document with same key"),new ft(this.key,$t.forDeletedDoc())):t},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.precondition.isEqual(t.precondition)},e}(ae),he=function(){function t(){}return t.prototype.applyToLocalView=function(t,e){return new kt(e,t)},t.prototype.applyToRemoteDocument=function(t,e){return e},t.prototype.isEqual=function(e){return e instanceof t},t.instance=new t,t}(),fe=function(){function t(t){this.elements=t}return t.prototype.applyToLocalView=function(t,e){return this.apply(t)},t.prototype.applyToRemoteDocument=function(t,e){return this.apply(t)},t.prototype.apply=function(t){for(var e=de(t),n=function(t){e.find(function(e){return e.isEqual(t)})||e.push(t)},r=0,i=this.elements;r<i.length;r++){n(i[r])}return new Pt(e)},t.prototype.isEqual=function(e){return e instanceof t&&z(e.elements,this.elements)},t}(),pe=function(){function t(t){this.elements=t}return t.prototype.applyToLocalView=function(t,e){return this.apply(t)},t.prototype.applyToRemoteDocument=function(t,e){return this.apply(t)},t.prototype.apply=function(t){for(var e=de(t),n=function(t){e=e.filter(function(e){return!e.isEqual(t)})},r=0,i=this.elements;r<i.length;r++){n(i[r])}return new Pt(e)},t.prototype.isEqual=function(e){return e instanceof t&&z(e.elements,this.elements)},t}();function de(t){return t instanceof Pt?t.internalValue.slice():[]}var ye,me=function(){function t(t){this.count=t}return t.prototype.isEqual=function(t){return t&&t.count===this.count},t}();function ge(t){switch(t){case _.OK:return m("Treated status OK as error");case _.CANCELLED:case _.UNKNOWN:case _.DEADLINE_EXCEEDED:case _.RESOURCE_EXHAUSTED:case _.INTERNAL:case _.UNAVAILABLE:case _.UNAUTHENTICATED:return!1;case _.INVALID_ARGUMENT:case _.NOT_FOUND:case _.ALREADY_EXISTS:case _.PERMISSION_DENIED:case _.FAILED_PRECONDITION:case _.ABORTED:case _.OUT_OF_RANGE:case _.UNIMPLEMENTED:case _.DATA_LOSS:return!0;default:return m("Unknown status code: "+t)}}function ve(t){if(void 0===t)return d("GRPC error has no .code"),_.UNKNOWN;switch(t){case ye.OK:return _.OK;case ye.CANCELLED:return _.CANCELLED;case ye.UNKNOWN:return _.UNKNOWN;case ye.DEADLINE_EXCEEDED:return _.DEADLINE_EXCEEDED;case ye.RESOURCE_EXHAUSTED:return _.RESOURCE_EXHAUSTED;case ye.INTERNAL:return _.INTERNAL;case ye.UNAVAILABLE:return _.UNAVAILABLE;case ye.UNAUTHENTICATED:return _.UNAUTHENTICATED;case ye.INVALID_ARGUMENT:return _.INVALID_ARGUMENT;case ye.NOT_FOUND:return _.NOT_FOUND;case ye.ALREADY_EXISTS:return _.ALREADY_EXISTS;case ye.PERMISSION_DENIED:return _.PERMISSION_DENIED;case ye.FAILED_PRECONDITION:return _.FAILED_PRECONDITION;case ye.ABORTED:return _.ABORTED;case ye.OUT_OF_RANGE:return _.OUT_OF_RANGE;case ye.UNIMPLEMENTED:return _.UNIMPLEMENTED;case ye.DATA_LOSS:return _.DATA_LOSS;default:return m("Unknown status code: "+t)}}function be(t){if(void 0===t)return ye.OK;switch(t){case _.OK:return ye.OK;case _.CANCELLED:return ye.CANCELLED;case _.UNKNOWN:return ye.UNKNOWN;case _.DEADLINE_EXCEEDED:return ye.DEADLINE_EXCEEDED;case _.RESOURCE_EXHAUSTED:return ye.RESOURCE_EXHAUSTED;case _.INTERNAL:return ye.INTERNAL;case _.UNAVAILABLE:return ye.UNAVAILABLE;case _.UNAUTHENTICATED:return ye.UNAUTHENTICATED;case _.INVALID_ARGUMENT:return ye.INVALID_ARGUMENT;case _.NOT_FOUND:return ye.NOT_FOUND;case _.ALREADY_EXISTS:return ye.ALREADY_EXISTS;case _.PERMISSION_DENIED:return ye.PERMISSION_DENIED;case _.FAILED_PRECONDITION:return ye.FAILED_PRECONDITION;case _.ABORTED:return ye.ABORTED;case _.OUT_OF_RANGE:return ye.OUT_OF_RANGE;case _.UNIMPLEMENTED:return ye.UNIMPLEMENTED;case _.DATA_LOSS:return ye.DATA_LOSS;default:return m("Unknown status code: "+t)}}!function(t){t[t.OK=0]="OK",t[t.CANCELLED=1]="CANCELLED",t[t.UNKNOWN=2]="UNKNOWN",t[t.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",t[t.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",t[t.NOT_FOUND=5]="NOT_FOUND",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.PERMISSION_DENIED=7]="PERMISSION_DENIED",t[t.UNAUTHENTICATED=16]="UNAUTHENTICATED",t[t.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",t[t.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",t[t.ABORTED=10]="ABORTED",t[t.OUT_OF_RANGE=11]="OUT_OF_RANGE",t[t.UNIMPLEMENTED=12]="UNIMPLEMENTED",t[t.INTERNAL=13]="INTERNAL",t[t.UNAVAILABLE=14]="UNAVAILABLE",t[t.DATA_LOSS=15]="DATA_LOSS"}(ye||(ye={}));var _e=new dt(ct.comparator);function we(){return _e}var Ee=new dt(ct.comparator);function Te(){return Ee}var Se=new dt(ct.comparator);function Ce(){return Se}var Ie=new ee(ct.comparator);function Ne(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=Ie,r=0,i=t;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var ke=new ee(H);function De(){return ke}var Ae,Oe,Re=function(){function t(t){this.comparator=t?function(e,n){return t(e,n)||ct.comparator(e.key,n.key)}:function(t,e){return ct.comparator(t.key,e.key)},this.keyedMap=Te(),this.sortedSet=new dt(this.comparator)}return t.emptySet=function(e){return new t(e.comparator)},t.prototype.has=function(t){return null!=this.keyedMap.get(t)},t.prototype.get=function(t){return this.keyedMap.get(t)},t.prototype.first=function(){return this.sortedSet.minKey()},t.prototype.last=function(){return this.sortedSet.maxKey()},t.prototype.isEmpty=function(){return this.sortedSet.isEmpty()},t.prototype.indexOf=function(t){var e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1},Object.defineProperty(t.prototype,"size",{get:function(){return this.sortedSet.size},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t){this.sortedSet.inorderTraversal(function(e,n){return t(e),!1})},t.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))},t.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this},t.prototype.isEqual=function(e){if(!(e instanceof t))return!1;if(this.size!==e.size)return!1;for(var n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();n.hasNext();){var i=n.getNext().key,o=r.getNext().key;if(!i.isEqual(o))return!1}return!0},t.prototype.toString=function(){var t=[];return this.forEach(function(e){t.push(e.toString())}),0===t.length?"DocumentSet ()":"DocumentSet (\n  "+t.join("  \n")+"\n)"},t.prototype.copy=function(e,n){var r=new t;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r},t}();!function(t){t[t.Added=0]="Added",t[t.Removed=1]="Removed",t[t.Modified=2]="Modified",t[t.Metadata=3]="Metadata"}(Ae||(Ae={})),function(t){t[t.Local=0]="Local",t[t.Synced=1]="Synced"}(Oe||(Oe={}));var Pe,xe=function(){function t(){this.changeMap=new dt(ct.comparator)}return t.prototype.track=function(t){var e=t.doc.key,n=this.changeMap.get(e);n?t.type!==Ae.Added&&n.type===Ae.Metadata?this.changeMap=this.changeMap.insert(e,t):t.type===Ae.Metadata&&n.type!==Ae.Removed?this.changeMap=this.changeMap.insert(e,{type:n.type,doc:t.doc}):t.type===Ae.Modified&&n.type===Ae.Modified?this.changeMap=this.changeMap.insert(e,{type:Ae.Modified,doc:t.doc}):t.type===Ae.Modified&&n.type===Ae.Added?this.changeMap=this.changeMap.insert(e,{type:Ae.Added,doc:t.doc}):t.type===Ae.Removed&&n.type===Ae.Added?this.changeMap=this.changeMap.remove(e):t.type===Ae.Removed&&n.type===Ae.Modified?this.changeMap=this.changeMap.insert(e,{type:Ae.Removed,doc:n.doc}):t.type===Ae.Added&&n.type===Ae.Removed?this.changeMap=this.changeMap.insert(e,{type:Ae.Modified,doc:t.doc}):m("unsupported combination of changes: "+JSON.stringify(t)+" after "+JSON.stringify(n)):this.changeMap=this.changeMap.insert(e,t)},t.prototype.getChanges=function(){var t=[];return this.changeMap.inorderTraversal(function(e,n){t.push(n)}),t},t}(),Le=function(){function t(t,e,n,r,i,o,a,s){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=s}return t.fromInitialDocuments=function(e,n,r,i){var o=[];return n.forEach(function(t){o.push({type:Ae.Added,doc:t})}),new t(e,n,Re.emptySet(n),o,r,i,!0,!1)},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return!this.mutatedKeys.isEmpty()},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(t){if(this.fromCache!==t.fromCache||this.syncStateChanged!==t.syncStateChanged||!this.mutatedKeys.isEqual(t.mutatedKeys)||!this.query.isEqual(t.query)||!this.docs.isEqual(t.docs)||!this.oldDocs.isEqual(t.oldDocs))return!1;var e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(var r=0;r<e.length;r++)if(e[r].type!==n[r].type||!e[r].doc.isEqual(n[r].doc))return!1;return!0},t}(),Me=function(){function t(t,e,n,r,i){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}return t.createSynthesizedRemoteEventForCurrentChange=function(e,n){var r,i=((r={})[e]=Fe.createSynthesizedTargetChangeForCurrentChange(e,n),r);return new t($t.MIN,i,De(),we(),Ne())},t}(),Fe=function(){function t(t,e,n,r,i){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}return t.createSynthesizedTargetChangeForCurrentChange=function(e,n){return new t(b(),n,Ne(),Ne(),Ne())},t}(),Ue=function(){return function(t,e,n,r){this.updatedTargetIds=t,this.removedTargetIds=e,this.key=n,this.newDoc=r}}(),je=function(){return function(t,e){this.targetId=t,this.existenceFilter=e}}();!function(t){t[t.NoChange=0]="NoChange",t[t.Added=1]="Added",t[t.Removed=2]="Removed",t[t.Current=3]="Current",t[t.Reset=4]="Reset"}(Pe||(Pe={}));var Ve=function(){return function(t,e,n,r){void 0===n&&(n=b()),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}(),Be=function(){function t(){this.pendingResponses=0,this.documentChanges=Ke(),this._resumeToken=b(),this._current=!1,this._hasPendingChanges=!0}return Object.defineProperty(t.prototype,"current",{get:function(){return this._current},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"resumeToken",{get:function(){return this._resumeToken},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPending",{get:function(){return 0!==this.pendingResponses},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasPendingChanges",{get:function(){return this._hasPendingChanges},enumerable:!0,configurable:!0}),t.prototype.updateResumeToken=function(t){t.length>0&&(this._hasPendingChanges=!0,this._resumeToken=t)},t.prototype.toTargetChange=function(){var t=Ne(),e=Ne(),n=Ne();return this.documentChanges.forEach(function(r,i){switch(i){case Ae.Added:t=t.add(r);break;case Ae.Modified:e=e.add(r);break;case Ae.Removed:n=n.add(r);break;default:m("Encountered invalid change type: "+i)}}),new Fe(this._resumeToken,this._current,t,e,n)},t.prototype.clearPendingChanges=function(){this._hasPendingChanges=!1,this.documentChanges=Ke()},t.prototype.addDocumentChange=function(t,e){this._hasPendingChanges=!0,this.documentChanges=this.documentChanges.insert(t,e)},t.prototype.removeDocumentChange=function(t){this._hasPendingChanges=!0,this.documentChanges=this.documentChanges.remove(t)},t.prototype.recordPendingTargetRequest=function(){this.pendingResponses+=1},t.prototype.recordTargetResponse=function(){this.pendingResponses-=1},t.prototype.markCurrent=function(){this._hasPendingChanges=!0,this._current=!0},t}(),qe=function(){function t(t){this.metadataProvider=t,this.targetStates={},this.pendingDocumentUpdates=we(),this.pendingDocumentTargetMapping=We(),this.pendingTargetResets=new ee(H)}return t.prototype.handleDocumentChange=function(t){for(var e=0,n=t.updatedTargetIds;e<n.length;e++){var r=n[e];t.newDoc instanceof ht?this.addDocumentToTarget(r,t.newDoc):t.newDoc instanceof ft&&this.removeDocumentFromTarget(r,t.key,t.newDoc)}for(var i=0,o=t.removedTargetIds;i<o.length;i++){r=o[i];this.removeDocumentFromTarget(r,t.key,t.newDoc)}},t.prototype.handleTargetChange=function(t){var e=this;this.forEachTarget(t,function(n){var r=e.ensureTargetState(n);switch(t.state){case Pe.NoChange:e.isActiveTarget(n)&&r.updateResumeToken(t.resumeToken);break;case Pe.Added:r.recordTargetResponse(),r.isPending||r.clearPendingChanges(),r.updateResumeToken(t.resumeToken);break;case Pe.Removed:r.recordTargetResponse(),r.isPending||e.removeTarget(n),g(!t.cause,"WatchChangeAggregator does not handle errored targets");break;case Pe.Current:e.isActiveTarget(n)&&(r.markCurrent(),r.updateResumeToken(t.resumeToken));break;case Pe.Reset:e.isActiveTarget(n)&&(e.resetTarget(n),r.updateResumeToken(t.resumeToken));break;default:m("Unknown target watch change state: "+t.state)}})},t.prototype.forEachTarget=function(t,e){t.targetIds.length>0?t.targetIds.forEach(e):C(this.targetStates,e)},t.prototype.handleExistenceFilter=function(t){var e=t.targetId,n=t.existenceFilter.count,r=this.queryDataForActiveTarget(e);if(r){var i=r.query;if(i.isDocumentQuery())if(0===n){var o=new ct(i.path);this.removeDocumentFromTarget(e,o,new ft(o,$t.forDeletedDoc()))}else g(1===n,"Single document existence filter with count: "+n);else this.getCurrentDocumentCountForTarget(e)!==n&&(this.resetTarget(e),this.pendingTargetResets=this.pendingTargetResets.add(e))}},t.prototype.createRemoteEvent=function(t){var e=this,n={};C(this.targetStates,function(r,i){var o=e.queryDataForActiveTarget(r);if(o){if(i.current&&o.query.isDocumentQuery()){var a=new ct(o.query.path);null!==e.pendingDocumentUpdates.get(a)||e.targetContainsDocument(r,a)||e.removeDocumentFromTarget(r,a,new ft(a,t))}i.hasPendingChanges&&(n[r]=i.toTargetChange(),i.clearPendingChanges())}});var r=Ne();this.pendingDocumentTargetMapping.forEach(function(t,n){var i=!0;n.forEachWhile(function(t){var n=e.queryDataForActiveTarget(t);return!n||n.purpose===Vt.LimboResolution||(i=!1,!1)}),i&&(r=r.add(t))});var i=new Me(t,n,this.pendingTargetResets,this.pendingDocumentUpdates,r);return this.pendingDocumentUpdates=we(),this.pendingDocumentTargetMapping=We(),this.pendingTargetResets=new ee(H),i},t.prototype.addDocumentToTarget=function(t,e){if(this.isActiveTarget(t)){var n=this.targetContainsDocument(t,e.key)?Ae.Modified:Ae.Added;this.ensureTargetState(t).addDocumentChange(e.key,n),this.pendingDocumentUpdates=this.pendingDocumentUpdates.insert(e.key,e),this.pendingDocumentTargetMapping=this.pendingDocumentTargetMapping.insert(e.key,this.ensureDocumentTargetMapping(e.key).add(t))}},t.prototype.removeDocumentFromTarget=function(t,e,n){if(this.isActiveTarget(t)){var r=this.ensureTargetState(t);this.targetContainsDocument(t,e)?r.addDocumentChange(e,Ae.Removed):r.removeDocumentChange(e),this.pendingDocumentTargetMapping=this.pendingDocumentTargetMapping.insert(e,this.ensureDocumentTargetMapping(e).delete(t)),n&&(this.pendingDocumentUpdates=this.pendingDocumentUpdates.insert(e,n))}},t.prototype.removeTarget=function(t){delete this.targetStates[t]},t.prototype.getCurrentDocumentCountForTarget=function(t){var e=this.ensureTargetState(t).toTargetChange();return this.metadataProvider.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size},t.prototype.recordPendingTargetRequest=function(t){this.ensureTargetState(t).recordPendingTargetRequest()},t.prototype.ensureTargetState=function(t){return this.targetStates[t]||(this.targetStates[t]=new Be),this.targetStates[t]},t.prototype.ensureDocumentTargetMapping=function(t){var e=this.pendingDocumentTargetMapping.get(t);return e||(e=new ee(H),this.pendingDocumentTargetMapping=this.pendingDocumentTargetMapping.insert(t,e)),e},t.prototype.isActiveTarget=function(t){return null!==this.queryDataForActiveTarget(t)},t.prototype.queryDataForActiveTarget=function(t){var e=this.targetStates[t];return e&&e.isPending?null:this.metadataProvider.getQueryDataForTarget(t)},t.prototype.resetTarget=function(t){var e=this;g(!this.targetStates[t].isPending,"Should only reset active targets"),this.targetStates[t]=new Be,this.metadataProvider.getRemoteKeysForTarget(t).forEach(function(n){e.removeDocumentFromTarget(t,n,null)})},t.prototype.targetContainsDocument=function(t,e){return this.metadataProvider.getRemoteKeysForTarget(t).has(e)},t}();function We(){return new dt(ct.comparator)}function Ke(){return new dt(ct.comparator)}var Qe=function(){var t={};return t[zt.ASCENDING.name]="ASCENDING",t[zt.DESCENDING.name]="DESCENDING",t}(),He=function(){var t={};return t[Wt.LESS_THAN.name]="LESS_THAN",t[Wt.LESS_THAN_OR_EQUAL.name]="LESS_THAN_OR_EQUAL",t[Wt.GREATER_THAN.name]="GREATER_THAN",t[Wt.GREATER_THAN_OR_EQUAL.name]="GREATER_THAN_OR_EQUAL",t[Wt.EQUAL.name]="EQUAL",t[Wt.ARRAY_CONTAINS.name]="ARRAY_CONTAINS",t}(),ze=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Ge(t,e){g(!Ut(t),e+" is missing")}function Ye(t){return"number"===typeof t?t:"string"===typeof t?Number(t):m("can't parse "+t)}var Xe=function(){function t(t,e){this.databaseId=t,this.options=e}return t.prototype.emptyByteString=function(){return this.options.useProto3Json?"":new Uint8Array(0)},t.prototype.unsafeCastProtoByteString=function(t){return t},t.prototype.fromRpcStatus=function(t){var e=void 0===t.code?_.UNKNOWN:ve(t.code);return new w(e,t.message||"")},t.prototype.toInt32Value=function(t){return Ut(t)?void 0:{value:t}},t.prototype.fromInt32Value=function(t){var e;return Ut(e="object"===typeof t?t.value:t)?null:e},t.prototype.toTimestamp=function(t){return{seconds:t.seconds,nanos:t.nanoseconds}},t.prototype.fromTimestamp=function(t){if("string"===typeof t)return this.fromIso8601String(t);g(!!t,"Cannot deserialize null or undefined timestamp.");var e=Ye(t.seconds||"0"),n=t.nanos||0;return new et(e,n)},t.prototype.fromIso8601String=function(t){var e=0,n=ze.exec(t);if(g(!!n,"invalid timestamp: "+t),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),e=Number(r)}var i=new Date(t),o=Math.floor(i.getTime()/1e3);return new et(o,e)},t.prototype.toBytes=function(t){return this.options.useProto3Json?t.toBase64():this.unsafeCastProtoByteString(t.toUint8Array())},t.prototype.fromBlob=function(t){return"string"===typeof t?(g(this.options.useProto3Json,"Expected bytes to be passed in as Uint8Array, but got a string instead."),$.fromBase64String(t)):(g(!this.options.useProto3Json,"Expected bytes to be passed in as string, but got something else instead."),$.fromUint8Array(t))},t.prototype.toVersion=function(t){return this.toTimestamp(t.toTimestamp())},t.prototype.fromVersion=function(t){return g(!!t,"Trying to deserialize version that isn't set"),$t.fromTimestamp(this.fromTimestamp(t))},t.prototype.toResourceName=function(t,e){return this.fullyQualifiedPrefixPath(t).child("documents").child(e).canonicalString()},t.prototype.fromResourceName=function(t){var e=at.fromString(t);return g(this.isValidResourceName(e),"Tried to deserialize invalid key "+e.toString()),e},t.prototype.toName=function(t){return this.toResourceName(this.databaseId,t.path)},t.prototype.fromName=function(t){var e=this.fromResourceName(t);return g(e.get(1)===this.databaseId.projectId,"Tried to deserialize key from different project: "+e.get(1)+" vs "+this.databaseId.projectId),g(!e.get(3)&&!this.databaseId.database||e.get(3)===this.databaseId.database,"Tried to deserialize key from different database: "+e.get(3)+" vs "+this.databaseId.database),new ct(this.extractLocalPathFromResourceName(e))},t.prototype.toQueryPath=function(t){return 0===t.length?this.encodedDatabaseId:this.toResourceName(this.databaseId,t)},t.prototype.fromQueryPath=function(t){var e=this.fromResourceName(t);return 4===e.length?at.EMPTY_PATH:this.extractLocalPathFromResourceName(e)},Object.defineProperty(t.prototype,"encodedDatabaseId",{get:function(){return new at(["projects",this.databaseId.projectId,"databases",this.databaseId.database]).canonicalString()},enumerable:!0,configurable:!0}),t.prototype.fullyQualifiedPrefixPath=function(t){return new at(["projects",t.projectId,"databases",t.database])},t.prototype.extractLocalPathFromResourceName=function(t){return g(t.length>4&&"documents"===t.get(4),"tried to deserialize invalid key "+t.toString()),t.popFirst(5)},t.prototype.isValidResourceName=function(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)},t.prototype.toValue=function(t){if(t instanceof _t)return{nullValue:"NULL_VALUE"};if(t instanceof wt)return{booleanValue:t.value()};if(t instanceof St)return{integerValue:""+t.value()};if(t instanceof Ct){var e=t.value();if(this.options.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:t.value()}}return t instanceof It?{stringValue:t.value()}:t instanceof Rt?{mapValue:this.toMapValue(t)}:t instanceof Pt?{arrayValue:this.toArrayValue(t)}:t instanceof Nt?{timestampValue:this.toTimestamp(t.internalValue)}:t instanceof Ot?{geoPointValue:{latitude:t.value().latitude,longitude:t.value().longitude}}:t instanceof Dt?{bytesValue:this.toBytes(t.value())}:t instanceof At?{referenceValue:this.toResourceName(t.databaseId,t.key.path)}:m("Unknown FieldValue "+JSON.stringify(t))},t.prototype.fromValue=function(t){var e=this,n=t.value_type;if(Je(t,n,"nullValue"))return _t.INSTANCE;if(Je(t,n,"booleanValue"))return wt.of(t.booleanValue);if(Je(t,n,"integerValue"))return new St(Ye(t.integerValue));if(Je(t,n,"doubleValue")){if(this.options.useProto3Json){if("NaN"===t.doubleValue)return Ct.NAN;if("Infinity"===t.doubleValue)return Ct.POSITIVE_INFINITY;if("-Infinity"===t.doubleValue)return Ct.NEGATIVE_INFINITY}return new Ct(t.doubleValue)}if(Je(t,n,"stringValue"))return new It(t.stringValue);if(Je(t,n,"mapValue"))return this.fromFields(t.mapValue.fields||{});if(Je(t,n,"arrayValue")){Ge(t.arrayValue,"arrayValue");var r=t.arrayValue.values||[];return new Pt(r.map(function(t){return e.fromValue(t)}))}if(Je(t,n,"timestampValue"))return Ge(t.timestampValue,"timestampValue"),new Nt(this.fromTimestamp(t.timestampValue));if(Je(t,n,"geoPointValue")){Ge(t.geoPointValue,"geoPointValue");var i=t.geoPointValue.latitude||0,o=t.geoPointValue.longitude||0;return new Ot(new tt(i,o))}if(Je(t,n,"bytesValue")){Ge(t.bytesValue,"bytesValue");var a=this.fromBlob(t.bytesValue);return new Dt(a)}if(Je(t,n,"referenceValue")){Ge(t.referenceValue,"referenceValue");var s=this.fromResourceName(t.referenceValue),u=new it(s.get(1),s.get(3)),c=new ct(this.extractLocalPathFromResourceName(s));return new At(u,c)}return m("Unknown Value proto "+JSON.stringify(t))},t.prototype.toMutationDocument=function(t,e){return{name:this.toName(t),fields:this.toFields(e)}},t.prototype.toDocument=function(t){return g(!t.hasLocalMutations,"Can't serialize documents with mutations."),{name:this.toName(t.key),fields:this.toFields(t.data),updateTime:this.toTimestamp(t.version.toTimestamp())}},t.prototype.fromDocument=function(t,e){return new ht(this.fromName(t.name),this.fromVersion(t.updateTime),this.fromFields(t.fields||{}),{hasCommittedMutations:!!e})},t.prototype.toFields=function(t){var e=this,n={};return t.forEach(function(t,r){n[t]=e.toValue(r)}),n},t.prototype.fromFields=function(t){var e=this,n=t,r=Rt.EMPTY;return I(n,function(t,n){r=r.set(new ut([t]),e.fromValue(n))}),r},t.prototype.toMapValue=function(t){return{fields:this.toFields(t)}},t.prototype.toArrayValue=function(t){var e=this,n=[];return t.forEach(function(t){n.push(e.toValue(t))}),{values:n}},t.prototype.fromFound=function(t){g(!!t.found,"Tried to deserialize a found document from a missing document."),Ge(t.found.name,"doc.found.name"),Ge(t.found.updateTime,"doc.found.updateTime");var e=this.fromName(t.found.name),n=this.fromVersion(t.found.updateTime),r=this.fromFields(t.found.fields||{});return new ht(e,n,r,{})},t.prototype.fromMissing=function(t){g(!!t.missing,"Tried to deserialize a missing document from a found document."),g(!!t.readTime,"Tried to deserialize a missing document without a read time.");var e=this.fromName(t.missing),n=this.fromVersion(t.readTime);return new ft(e,n)},t.prototype.fromMaybeDocument=function(t){var e=t.result;return Je(t,e,"found")?this.fromFound(t):Je(t,e,"missing")?this.fromMissing(t):m("invalid batch get response: "+JSON.stringify(t))},t.prototype.toWatchTargetChangeState=function(t){switch(t){case Pe.Added:return"ADD";case Pe.Current:return"CURRENT";case Pe.NoChange:return"NO_CHANGE";case Pe.Removed:return"REMOVE";case Pe.Reset:return"RESET";default:return m("Unknown WatchTargetChangeState: "+t)}},t.prototype.toTestWatchChange=function(t){if(t instanceof je)return{filter:{count:t.existenceFilter.count,targetId:t.targetId}};if(t instanceof Ue){if(t.newDoc instanceof ht){var e=t.newDoc;return{documentChange:{document:{name:this.toName(e.key),fields:this.toFields(e.data),updateTime:this.toVersion(e.version)},targetIds:t.updatedTargetIds,removedTargetIds:t.removedTargetIds}}}if(t.newDoc instanceof ft){e=t.newDoc;return{documentDelete:{document:this.toName(e.key),readTime:this.toVersion(e.version),removedTargetIds:t.removedTargetIds}}}if(null===t.newDoc)return{documentRemove:{document:this.toName(t.key),removedTargetIds:t.removedTargetIds}}}if(t instanceof Ve){var n=void 0;return t.cause&&(n={code:be(t.cause.code),message:t.cause.message}),{targetChange:{targetChangeType:this.toWatchTargetChangeState(t.state),targetIds:t.targetIds,resumeToken:this.unsafeCastProtoByteString(t.resumeToken),cause:n}}}return m("Unrecognized watch change: "+JSON.stringify(t))},t.prototype.fromWatchChange=function(t){var e,n=t.response_type;if(Je(t,n,"targetChange")){Ge(t.targetChange,"targetChange");var r=this.fromWatchTargetChangeState(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],o=t.targetChange.resumeToken||this.emptyByteString(),a=t.targetChange.cause,s=a&&this.fromRpcStatus(a);e=new Ve(r,i,o,s||null)}else if(Je(t,n,"documentChange")){Ge(t.documentChange,"documentChange"),Ge(t.documentChange.document,"documentChange.name"),Ge(t.documentChange.document.name,"documentChange.document.name"),Ge(t.documentChange.document.updateTime,"documentChange.document.updateTime");var u=t.documentChange,c=this.fromName(u.document.name),l=this.fromVersion(u.document.updateTime),h=this.fromFields(u.document.fields||{}),f=new ht(c,l,h,{}),p=u.targetIds||[],d=u.removedTargetIds||[];e=new Ue(p,d,f.key,f)}else if(Je(t,n,"documentDelete")){Ge(t.documentDelete,"documentDelete"),Ge(t.documentDelete.document,"documentDelete.document");var y=t.documentDelete;c=this.fromName(y.document),l=y.readTime?this.fromVersion(y.readTime):$t.forDeletedDoc(),f=new ft(c,l),d=y.removedTargetIds||[];e=new Ue([],d,f.key,f)}else if(Je(t,n,"documentRemove")){Ge(t.documentRemove,"documentRemove"),Ge(t.documentRemove.document,"documentRemove");var g=t.documentRemove;c=this.fromName(g.document),d=g.removedTargetIds||[];e=new Ue([],d,c,null)}else{if(!Je(t,n,"filter"))return m("Unknown change type "+JSON.stringify(t));Ge(t.filter,"filter"),Ge(t.filter.targetId,"filter.targetId");var v=t.filter,b=v.count||0,_=new me(b),w=v.targetId;e=new je(w,_)}return e},t.prototype.fromWatchTargetChangeState=function(t){return"NO_CHANGE"===t?Pe.NoChange:"ADD"===t?Pe.Added:"REMOVE"===t?Pe.Removed:"CURRENT"===t?Pe.Current:"RESET"===t?Pe.Reset:m("Got unexpected TargetChange.state: "+t)},t.prototype.versionFromListenResponse=function(t){if(!Je(t,t.response_type,"targetChange"))return $t.MIN;var e=t.targetChange;return e.targetIds&&e.targetIds.length?$t.MIN:e.readTime?this.fromVersion(e.readTime):$t.MIN},t.prototype.toMutation=function(t){var e,n=this;if(t instanceof se)e={update:this.toMutationDocument(t.key,t.value)};else if(t instanceof le)e={delete:this.toName(t.key)};else if(t instanceof ue)e={update:this.toMutationDocument(t.key,t.data),updateMask:this.toDocumentMask(t.fieldMask)};else{if(!(t instanceof ce))return m("Unknown mutation type "+t.type);e={transform:{document:this.toName(t.key),fieldTransforms:t.fieldTransforms.map(function(t){return n.toFieldTransform(t)})}}}return t.precondition.isNone||(e.currentDocument=this.toPrecondition(t.precondition)),e},t.prototype.fromMutation=function(t){var e=this,n=t.currentDocument?this.fromPrecondition(t.currentDocument):oe.NONE;if(t.update){Ge(t.update.name,"name");var r=this.fromName(t.update.name),i=this.fromFields(t.update.fields||{});if(t.updateMask){var o=this.fromDocumentMask(t.updateMask);return new ue(r,i,o,n)}return new se(r,i,n)}if(t.delete){r=this.fromName(t.delete);return new le(r,n)}if(t.transform){r=this.fromName(t.transform.document);var a=t.transform.fieldTransforms.map(function(t){return e.fromFieldTransform(t)});return g(!0===n.exists,'Transforms only support precondition "exists == true"'),new ce(r,a)}return m("unknown mutation proto: "+JSON.stringify(t))},t.prototype.toPrecondition=function(t){return g(!t.isNone,"Can't serialize an empty precondition"),void 0!==t.updateTime?{updateTime:this.toVersion(t.updateTime)}:void 0!==t.exists?{exists:t.exists}:m("Unknown precondition")},t.prototype.fromPrecondition=function(t){return void 0!==t.updateTime?oe.updateTime(this.fromVersion(t.updateTime)):void 0!==t.exists?oe.exists(t.exists):oe.NONE},t.prototype.fromWriteResult=function(t,e){var n=this,r=t.updateTime?this.fromVersion(t.updateTime):this.fromVersion(e),i=null;return t.transformResults&&t.transformResults.length>0&&(i=t.transformResults.map(function(t){return n.fromValue(t)})),new ie(r,i)},t.prototype.fromWriteResults=function(t,e){var n=this;return t&&t.length>0?(g(void 0!==e,"Received a write result without a commit time"),t.map(function(t){return n.fromWriteResult(t,e)})):[]},t.prototype.toFieldTransform=function(t){var e=this,n=t.transform;if(n instanceof he)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof fe)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements.map(function(t){return e.toValue(t)})}};if(n instanceof pe)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements.map(function(t){return e.toValue(t)})}};throw m("Unknown transform: "+t.transform)},t.prototype.fromFieldTransform=function(t){var e=this,n=t.transform_type,r=null;if(Je(t,n,"setToServerValue"))g("REQUEST_TIME"===t.setToServerValue,"Unknown server value transform proto: "+JSON.stringify(t)),r=he.instance;else if(Je(t,n,"appendMissingElements")){var i=t.appendMissingElements.values||[];r=new fe(i.map(function(t){return e.fromValue(t)}))}else if(Je(t,n,"removeAllFromArray")){i=t.removeAllFromArray.values||[];r=new pe(i.map(function(t){return e.fromValue(t)}))}else m("Unknown transform proto: "+JSON.stringify(t));var o=ut.fromServerFormat(t.fieldPath);return new re(o,r)},t.prototype.toDocumentsTarget=function(t){return{documents:[this.toQueryPath(t.path)]}},t.prototype.fromDocumentsTarget=function(t){var e=t.documents.length;g(1===e,"DocumentsTarget contained other than 1 document: "+e);var n=t.documents[0];return Bt.atPath(this.fromQueryPath(n))},t.prototype.toQueryTarget=function(t){var e={structuredQuery:{}};if(t.path.isEmpty())e.parent=this.toQueryPath(at.EMPTY_PATH);else{var n=t.path;g(n.length%2!==0,"Document queries with filters are not supported."),e.parent=this.toQueryPath(n.popLast()),e.structuredQuery.from=[{collectionId:n.lastSegment()}]}var r=this.toFilter(t.filters);r&&(e.structuredQuery.where=r);var i=this.toOrder(t.orderBy);i&&(e.structuredQuery.orderBy=i);var o=this.toInt32Value(t.limit);return void 0!==o&&(e.structuredQuery.limit=o),t.startAt&&(e.structuredQuery.startAt=this.toCursor(t.startAt)),t.endAt&&(e.structuredQuery.endAt=this.toCursor(t.endAt)),e},t.prototype.fromQueryTarget=function(t){var e=this.fromQueryPath(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0;if(r>0){g(1===r,"StructuredQuery.from with more than one collection is not supported.");var i=n.from[0];e=e.child(i.collectionId)}var o=[];n.where&&(o=this.fromFilter(n.where));var a=[];n.orderBy&&(a=this.fromOrder(n.orderBy));var s=null;n.limit&&(s=this.fromInt32Value(n.limit));var u=null;n.startAt&&(u=this.fromCursor(n.startAt));var c=null;return n.endAt&&(c=this.fromCursor(n.endAt)),new Bt(e,a,o,s,u,c)},t.prototype.toListenRequestLabels=function(t){var e=this.toLabel(t.purpose);return null==e?null:{"goog-listen-tags":e}},t.prototype.toLabel=function(t){switch(t){case Vt.Listen:return null;case Vt.ExistenceFilterMismatch:return"existence-filter-mismatch";case Vt.LimboResolution:return"limbo-document";default:return m("Unrecognized query purpose: "+t)}},t.prototype.toTarget=function(t){var e,n=t.query;return(e=n.isDocumentQuery()?{documents:this.toDocumentsTarget(n)}:{query:this.toQueryTarget(n)}).targetId=t.targetId,t.resumeToken.length>0&&(e.resumeToken=this.unsafeCastProtoByteString(t.resumeToken)),e},t.prototype.toFilter=function(t){var e=this;if(0!==t.length){var n=t.map(function(t){return t instanceof Kt?e.toRelationFilter(t):e.toUnaryFilter(t)});return 1===n.length?n[0]:{compositeFilter:{op:"AND",filters:n}}}},t.prototype.fromFilter=function(t){var e=this;return t?void 0!==t.unaryFilter?[this.fromUnaryFilter(t)]:void 0!==t.fieldFilter?[this.fromRelationFilter(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e.fromFilter(t)}).reduce(function(t,e){return t.concat(e)}):m("Unknown filter: "+JSON.stringify(t)):[]},t.prototype.toOrder=function(t){var e=this;if(0!==t.length)return t.map(function(t){return e.toPropertyOrder(t)})},t.prototype.fromOrder=function(t){var e=this;return t.map(function(t){return e.fromPropertyOrder(t)})},t.prototype.toCursor=function(t){var e=this;return{before:t.before,values:t.position.map(function(t){return e.toValue(t)})}},t.prototype.fromCursor=function(t){var e=this,n=!!t.before,r=t.values.map(function(t){return e.fromValue(t)});return new Gt(r,n)},t.prototype.toDirection=function(t){return Qe[t.name]},t.prototype.fromDirection=function(t){switch(t){case"ASCENDING":return zt.ASCENDING;case"DESCENDING":return zt.DESCENDING;default:return}},t.prototype.toOperatorName=function(t){return He[t.name]},t.prototype.fromOperatorName=function(t){switch(t){case"EQUAL":return Wt.EQUAL;case"GREATER_THAN":return Wt.GREATER_THAN;case"GREATER_THAN_OR_EQUAL":return Wt.GREATER_THAN_OR_EQUAL;case"LESS_THAN":return Wt.LESS_THAN;case"LESS_THAN_OR_EQUAL":return Wt.LESS_THAN_OR_EQUAL;case"ARRAY_CONTAINS":return Wt.ARRAY_CONTAINS;case"OPERATOR_UNSPECIFIED":return m("Unspecified relation");default:return m("Unknown relation")}},t.prototype.toFieldPathReference=function(t){return{fieldPath:t.canonicalString()}},t.prototype.fromFieldPathReference=function(t){return ut.fromServerFormat(t.fieldPath)},t.prototype.toPropertyOrder=function(t){return{field:this.toFieldPathReference(t.field),direction:this.toDirection(t.dir)}},t.prototype.fromPropertyOrder=function(t){return new Yt(this.fromFieldPathReference(t.field),this.fromDirection(t.direction))},t.prototype.toRelationFilter=function(t){return t instanceof Kt?{fieldFilter:{field:this.toFieldPathReference(t.field),op:this.toOperatorName(t.op),value:this.toValue(t.value)}}:m("Unrecognized filter: "+JSON.stringify(t))},t.prototype.fromRelationFilter=function(t){return new Kt(this.fromFieldPathReference(t.fieldFilter.field),this.fromOperatorName(t.fieldFilter.op),this.fromValue(t.fieldFilter.value))},t.prototype.toUnaryFilter=function(t){return t instanceof Ht?{unaryFilter:{field:this.toFieldPathReference(t.field),op:"IS_NAN"}}:t instanceof Qt?{unaryFilter:{field:this.toFieldPathReference(t.field),op:"IS_NULL"}}:m("Unrecognized filter: "+JSON.stringify(t))},t.prototype.fromUnaryFilter=function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=this.fromFieldPathReference(t.unaryFilter.field);return new Ht(e);case"IS_NULL":var n=this.fromFieldPathReference(t.unaryFilter.field);return new Qt(n);case"OPERATOR_UNSPECIFIED":return m("Unspecified filter");default:return m("Unknown filter")}},t.prototype.toDocumentMask=function(t){var e=[];return t.fields.forEach(function(t){return e.push(t.canonicalString())}),{fieldPaths:e}},t.prototype.fromDocumentMask=function(t){var e=(t.fieldPaths||[]).map(function(t){return ut.fromServerFormat(t)});return ne.fromArray(e)},t}();function Je(t,e,n){return e===n||!e&&n in t}var $e="FirebaseError",Ze=Error.captureStackTrace,tn=function(){return function(t,e){if(this.code=t,this.message=e,Ze)Ze(this,en.prototype.create);else try{throw Error.apply(this,arguments)}catch(n){this.name=$e,Object.defineProperty(this,"stack",{get:function(){return n.stack}})}}}();tn.prototype=Object.create(Error.prototype),tn.prototype.constructor=tn,tn.prototype.name=$e;var en=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n,this.pattern=/\{\$([^}]+)}/g}return t.prototype.create=function(t,e){void 0===e&&(e={});var n,r=this.errors[t],i=this.service+"/"+t;n=void 0===r?"Error":r.replace(this.pattern,function(t,n){var r=e[n];return void 0!==r?r.toString():"<"+n+"?>"}),n=this.serviceName+": "+n+" ("+i+").";var o=new tn(i,n);for(var a in e)e.hasOwnProperty(a)&&"_"!==a.slice(-1)&&(o[a]=e[a]);return o},t}(),nn=(function(t){function e(){var e=t.call(this)||this;e.chain_=[],e.buf_=[],e.W_=[],e.pad_=[],e.inbuf_=0,e.total_=0,e.blockSize=64,e.pad_[0]=128;for(var n=1;n<e.blockSize;++n)e.pad_[n]=0;return e.reset(),e}s.__extends(e,t),e.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},e.prototype.compress_=function(t,e){e||(e=0);var n=this.W_;if("string"===typeof t)for(var r=0;r<16;r++)n[r]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(r=0;r<16;r++)n[r]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(r=16;r<80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(i<<1|i>>>31)}var o,a,s=this.chain_[0],u=this.chain_[1],c=this.chain_[2],l=this.chain_[3],h=this.chain_[4];for(r=0;r<80;r++){r<40?r<20?(o=l^u&(c^l),a=1518500249):(o=u^c^l,a=1859775393):r<60?(o=u&c|l&(u|c),a=2400959708):(o=u^c^l,a=3395469782);i=(s<<5|s>>>27)+o+h+a+n[r]&4294967295;h=l,l=c,c=4294967295&(u<<30|u>>>2),u=s,s=i}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},e.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r<e;){if(0==o)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"===typeof t){for(;r<e;)if(i[o]=t.charCodeAt(r),++r,++o==this.blockSize){this.compress_(i),o=0;break}}else for(;r<e;)if(i[o]=t[r],++r,++o==this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=e}},e.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;n>=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t}}(function(){return function(){this.blockSize=-1}}()),function(){function t(t){this.sendFn=t.sendFn,this.closeFn=t.closeFn}return t.prototype.onOpen=function(t){g(!this.wrappedOnOpen,"Called onOpen on stream twice!"),this.wrappedOnOpen=t},t.prototype.onClose=function(t){g(!this.wrappedOnClose,"Called onClose on stream twice!"),this.wrappedOnClose=t},t.prototype.onMessage=function(t){g(!this.wrappedOnMessage,"Called onMessage on stream twice!"),this.wrappedOnMessage=t},t.prototype.close=function(){this.closeFn()},t.prototype.send=function(t){this.sendFn(t)},t.prototype.callOnOpen=function(){g(void 0!==this.wrappedOnOpen,"Cannot call onOpen because no callback was set"),this.wrappedOnOpen()},t.prototype.callOnClose=function(t){g(void 0!==this.wrappedOnClose,"Cannot call onClose because no callback was set"),this.wrappedOnClose(t)},t.prototype.callOnMessage=function(t){g(void 0!==this.wrappedOnMessage,"Cannot call onMessage because no callback was set"),this.wrappedOnMessage(t)},t}()),rn="Connection",on={BatchGetDocuments:"batchGet",Commit:"commit"},an="gl-js/ fire/"+c,sn=function(){function t(t){this.databaseId=t.databaseId,this.pool=new u.XhrIoPool;var e=t.ssl?"https":"http";this.baseUrl=e+"://"+t.host}return t.prototype.modifyHeadersForRequest=function(t,e){if(e)for(var n in e.authHeaders)e.authHeaders.hasOwnProperty(n)&&(t[n]=e.authHeaders[n]);t["X-Goog-Api-Client"]=an},t.prototype.invokeRPC=function(t,e,n){var r=this,i=this.makeUrl(t);return new Promise(function(o,a){r.pool.getObject(function(s){s.listenOnce(u.EventType.COMPLETE,function(){try{switch(s.getLastErrorCode()){case u.ErrorCode.NO_ERROR:var e=s.getResponseJson();p(rn,"XHR received:",JSON.stringify(e)),o(e);break;case u.ErrorCode.TIMEOUT:p(rn,'RPC "'+t+'" timed out'),a(new w(_.DEADLINE_EXCEEDED,"Request time out"));break;case u.ErrorCode.HTTP_ERROR:var n=s.getStatus();p(rn,'RPC "'+t+'" failed with status:',n,"response text:",s.getResponseText()),n>0?a(new w(function(t){switch(t){case 200:return _.OK;case 400:return _.INVALID_ARGUMENT;case 401:return _.UNAUTHENTICATED;case 403:return _.PERMISSION_DENIED;case 404:return _.NOT_FOUND;case 409:return _.ABORTED;case 416:return _.OUT_OF_RANGE;case 429:return _.RESOURCE_EXHAUSTED;case 499:return _.CANCELLED;case 500:return _.UNKNOWN;case 501:return _.UNIMPLEMENTED;case 503:return _.UNAVAILABLE;case 504:return _.DEADLINE_EXCEEDED;default:return t>=200&&t<300?_.OK:t>=400&&t<500?_.FAILED_PRECONDITION:t>=500&&t<600?_.INTERNAL:_.UNKNOWN}}(n),"Server responded with status "+s.getStatusText())):(p(rn,'RPC "'+t+'" failed'),a(new w(_.UNAVAILABLE,"Connection failed.")));break;default:m('RPC "'+t+'" failed with unanticipated webchannel error '+s.getLastErrorCode()+": "+s.getLastError()+", giving up.")}}finally{p(rn,'RPC "'+t+'" completed.'),r.pool.releaseObject(s)}});var c=JSON.stringify(e);p(rn,"XHR sending: ",i+" "+c);var l={"Content-Type":"text/plain"};r.modifyHeadersForRequest(l,n),s.send(i,"POST",c,l,15)})})},t.prototype.invokeStreamingRPC=function(t,e,n){return this.invokeRPC(t,e,n)},t.prototype.openStream=function(t,e){var n=[this.baseUrl,"/","google.firestore.v1beta1.Firestore","/",t,"/channel"],r=u.createWebChannelTransport(),i={backgroundChannelTest:!0,httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database},sendRawJson:!0,supportsCrossDomainXhr:!0};this.modifyHeadersForRequest(i.initMessageHeaders,e),"object"===typeof navigator&&"ReactNative"===navigator.product||(i.httpHeadersOverwriteParam="$httpHeaders");var o=n.join("");p(rn,"Creating WebChannel: "+o+" "+i);var a=r.createWebChannel(o,i),s=!1,c=!1,l=new nn({sendFn:function(t){c?p(rn,"Not sending because WebChannel is closed:",t):(s||(p(rn,"Opening WebChannel transport."),a.open(),s=!0),p(rn,"WebChannel sending:",t),a.send(t))},closeFn:function(){return a.close()}}),h=function(t,e){a.listen(t,function(t){try{e(t)}catch(n){setTimeout(function(){throw n},0)}})};return h(u.WebChannel.EventType.OPEN,function(){c||p(rn,"WebChannel transport opened.")}),h(u.WebChannel.EventType.CLOSE,function(){c||(c=!0,p(rn,"WebChannel transport closed"),l.callOnClose())}),h(u.WebChannel.EventType.ERROR,function(t){c||(c=!0,p(rn,"WebChannel transport errored:",t),l.callOnClose(new w(_.UNAVAILABLE,"The operation could not be completed")))}),h(u.WebChannel.EventType.MESSAGE,function(t){if(!c){var e=t.data[0];g(!!e,"Got a webchannel message without data.");var n=e.error||e[0]&&e[0].error;if(n){p(rn,"WebChannel received error:",n);var r=n.status,i=function(t){var e=ye[t];if(void 0!==e)return ve(e)}(r),o=n.message;void 0===i&&(i=_.INTERNAL,o="Unknown error status: "+r+" with message "+n.message),c=!0,l.callOnClose(new w(i,o)),a.close()}else p(rn,"WebChannel received:",e),l.callOnMessage(e)}}),setTimeout(function(){l.callOnOpen()},0),l},t.prototype.makeUrl=function(t){var e=on[t];g(void 0!==e,"Unknown REST mapping for: "+t);var n=[this.baseUrl,"/","v1beta1"];return n.push("/projects/"),n.push(this.databaseId.projectId),n.push("/databases/"),n.push(this.databaseId.database),n.push("/documents"),n.push(":"),n.push(e),n.join("")},t}(),un=function(){function t(){this.emptyByteString="",this.base64Available="undefined"!==typeof atob}return Object.defineProperty(t.prototype,"document",{get:function(){return"undefined"!==typeof document?document:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return"undefined"!==typeof window?window:null},enumerable:!0,configurable:!0}),t.prototype.loadConnection=function(t){return Promise.resolve(new sn(t))},t.prototype.newSerializer=function(t){return new Xe(t,{useProto3Json:!0})},t.prototype.formatJSON=function(t){return JSON.stringify(t)},t.prototype.atob=function(t){return atob(t)},t.prototype.btoa=function(t){return btoa(t)},t}();v.setPlatform(new un);var cn,ln=function(){function t(t,e){var n=this;this.previousValue=t,e&&(e.sequenceNumberHandler=function(t){return n.setPreviousValue(t)},this.writeNewSequenceNumber=function(t){return e.writeSequenceNumber(t)})}return t.prototype.setPreviousValue=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},t.prototype.next=function(){var t=++this.previousValue;return this.writeNewSequenceNumber&&this.writeNewSequenceNumber(t),t},t.INVALID=-1,t}(),hn=function(){return function(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}}();!function(t){t.All="all",t.ListenStreamIdle="listen_stream_idle",t.ListenStreamConnectionBackoff="listen_stream_connection_backoff",t.WriteStreamIdle="write_stream_idle",t.WriteStreamConnectionBackoff="write_stream_connection_backoff",t.OnlineStateTimeout="online_state_timeout",t.ClientMetadataRefresh="client_metadata_refresh",t.LruGarbageCollection="lru_garbage_collection"}(cn||(cn={}));var fn=function(){function t(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new hn,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.catch=this.deferred.promise.catch.bind(this.deferred.promise),this.deferred.promise.catch(function(t){})}return t.createAndSchedule=function(e,n,r,i,o){var a=new t(e,n,Date.now()+r,i,o);return a.start(r),a},t.prototype.start=function(t){var e=this;this.timerHandle=setTimeout(function(){return e.handleDelayElapsed()},t)},t.prototype.skipDelay=function(){return this.handleDelayElapsed()},t.prototype.cancel=function(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new w(_.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},t.prototype.handleDelayElapsed=function(){var t=this;this.asyncQueue.enqueueAndForget(function(){return null!==t.timerHandle?(t.clearTimeout(),t.op().then(function(e){return t.deferred.resolve(e)})):Promise.resolve()})},t.prototype.clearTimeout=function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)},t}(),pn=function(){function t(){this.tail=Promise.resolve(),this.delayedOperations=[],this.operationInProgress=!1}return t.prototype.enqueueAndForget=function(t){this.enqueue(t)},t.prototype.enqueue=function(t){var e=this;this.verifyNotFailed();var n=this.tail.then(function(){return e.operationInProgress=!0,t().catch(function(t){e.failure=t,e.operationInProgress=!1;var n=t.stack||t.message||"";throw d("INTERNAL UNHANDLED ERROR: ",n),n.indexOf("Firestore Test Simulated Error")<0&&setTimeout(function(){throw t},0),t}).then(function(t){return e.operationInProgress=!1,t})});return this.tail=n,n},t.prototype.enqueueAfterDelay=function(t,e,n){var r=this;this.verifyNotFailed(),g(e>=0,"Attempted to schedule an operation with a negative delay of "+e),g(!this.containsDelayedOperation(t),"Attempted to schedule multiple operations with timer id "+t+".");var i=fn.createAndSchedule(this,t,e,n,function(t){return r.removeDelayedOperation(t)});return this.delayedOperations.push(i),i},t.prototype.verifyNotFailed=function(){this.failure&&m("AsyncQueue is already failed: "+(this.failure.stack||this.failure.message))},t.prototype.verifyOperationInProgress=function(){g(this.operationInProgress,"verifyOpInProgress() called when no op in progress on this queue.")},t.prototype.drain=function(){return this.enqueue(function(){return Promise.resolve()})},t.prototype.containsDelayedOperation=function(t){for(var e=0,n=this.delayedOperations;e<n.length;e++){if(n[e].timerId===t)return!0}return!1},t.prototype.runDelayedOperationsEarly=function(t){var e=this;return this.drain().then(function(){g(t===cn.All||e.containsDelayedOperation(t),"Attempted to drain to missing operation "+t),e.delayedOperations.sort(function(t,e){return t.targetTimeMs-e.targetTimeMs});for(var n=0,r=e.delayedOperations;n<r.length;n++){var i=r[n];if(i.skipDelay(),t!==cn.All&&i.timerId===t)break}return e.drain()})},t.prototype.removeDelayedOperation=function(t){var e=this.delayedOperations.indexOf(t);g(e>=0,"Delayed operation not found."),this.delayedOperations.splice(e,1)},t}(),dn="\x01",yn="\x01",mn="\x10",gn="\x11";function vn(t){for(var e="",n=0;n<t.length;n++)e.length>0&&(e=_n(e)),e=bn(t.get(n),e);return _n(e)}function bn(t,e){for(var n=e,r=t.length,i=0;i<r;i++){var o=t.charAt(i);switch(o){case"\0":n+=dn+mn;break;case dn:n+=dn+gn;break;default:n+=o}}return n}function _n(t){return t+dn+yn}function wn(t){var e=t.length;if(g(e>=2,"Invalid path "+t),2===e)return g(t.charAt(0)===dn&&t.charAt(1)===yn,"Non-empty path "+t+" had length 2"),at.EMPTY_PATH;for(var n=e-2,r=[],i="",o=0;o<e;){var a=t.indexOf(dn,o);switch((a<0||a>n)&&m('Invalid encoded resource path: "'+t+'"'),t.charAt(a+1)){case yn:var s=t.substring(o,a),u=void 0;0===i.length?u=s:(u=i+=s,i=""),r.push(u);break;case mn:i+=t.substring(o,a),i+="\0";break;case gn:i+=t.substring(o,a+1);break;default:m('Invalid encoded resource path: "'+t+'"')}o=a+2}return new at(r)}var En,Tn=-1,Sn=function(){function t(t,e,n){this.batchId=t,this.localWriteTime=e,this.mutations=n,g(n.length>0,"Cannot create an empty mutation batch")}return t.prototype.applyToRemoteDocument=function(t,e,n){e&&g(e.key.isEqual(t),"applyToRemoteDocument: key "+t+" should match maybeDoc key\n        "+e.key);var r=n.mutationResults;g(r.length===this.mutations.length,"Mismatch between mutations length\n      ("+this.mutations.length+") and mutation results length\n      ("+r.length+").");for(var i=0;i<this.mutations.length;i++){var o=this.mutations[i];if(o.key.isEqual(t)){var a=r[i];e=o.applyToRemoteDocument(e,a)}}return e},t.prototype.applyToLocalView=function(t,e){e&&g(e.key.isEqual(t),"applyToLocalDocument: key "+t+" should match maybeDoc key\n        "+e.key);for(var n=e,r=0;r<this.mutations.length;r++){var i=this.mutations[r];i.key.isEqual(t)&&(e=i.applyToLocalView(e,n,this.localWriteTime))}return e},t.prototype.keys=function(){for(var t=Ne(),e=0,n=this.mutations;e<n.length;e++){var r=n[e];t=t.add(r.key)}return t},t.prototype.isEqual=function(t){return this.batchId===t.batchId&&z(this.mutations,t.mutations)},t}(),Cn=function(){function t(t,e,n,r,i){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.streamToken=r,this.docVersions=i}return t.from=function(e,n,r,i){g(e.mutations.length===r.length,"Mutations sent "+e.mutations.length+" must equal results received "+r.length);for(var o=Ce(),a=e.mutations,s=0;s<a.length;s++)o=o.insert(a[s].key,r[s].version);return new t(e,n,r,i,o)},t}(),In=1;!function(t){t[t.QueryCache=0]="QueryCache",t[t.SyncEngine=1]="SyncEngine"}(En||(En={}));var Nn=function(){function t(t,e){this.generatorId=t,g((t&In)===t,"Generator ID "+t+" contains more than "+In+" reserved bits"),this.seek(void 0!==e?e:this.generatorId)}return t.prototype.next=function(){var t=this.nextId;return this.nextId+=1<<In,t},t.prototype.after=function(t){return this.seek(t+(1<<In)),this.next()},t.prototype.seek=function(t){g((t&In)===this.generatorId,"Cannot supply target ID from different generator ID"),this.nextId=t},t.forQueryCache=function(){return new t(En.QueryCache,2)},t.forSyncEngine=function(){return new t(En.SyncEngine)},t}(),kn=function(){function t(t){var e=this;this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(function(t){e.isDone=!0,e.result=t,e.nextCallback&&e.nextCallback(t)},function(t){e.isDone=!0,e.error=t,e.catchCallback&&e.catchCallback(t)})}return t.prototype.catch=function(t){return this.next(void 0,t)},t.prototype.next=function(e,n){var r=this;return this.callbackAttached&&m("Called next() or catch() twice for PersistencePromise"),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new t(function(t,i){r.nextCallback=function(n){r.wrapSuccess(e,n).next(t,i)},r.catchCallback=function(e){r.wrapFailure(n,e).next(t,i)}})},t.prototype.toPromise=function(){var t=this;return new Promise(function(e,n){t.next(e,n)})},t.prototype.wrapUserFunction=function(e){try{var n=e();return n instanceof t?n:t.resolve(n)}catch(r){return t.reject(r)}},t.prototype.wrapSuccess=function(e,n){return e?this.wrapUserFunction(function(){return e(n)}):t.resolve(n)},t.prototype.wrapFailure=function(e,n){return e?this.wrapUserFunction(function(){return e(n)}):t.reject(n)},t.resolve=function(e){return new t(function(t,n){t(e)})},t.reject=function(e){return new t(function(t,n){n(e)})},t.waitFor=function(e){return new t(function(t,n){var r=0,i=0,o=!1;e.forEach(function(e){++r,e.next(function(){++i,o&&i===r&&t()},function(t){return n(t)})}),o=!0,i===r&&t()})},t.or=function(e){for(var n=t.resolve(!1),r=function(e){n=n.next(function(n){return n?t.resolve(n):e()})},i=0,o=e;i<o.length;i++){r(o[i])}return n},t.forEach=function(t,e){var n=this,r=[];return t.forEach(function(t,i){r.push(e.call(n,t,i))}),this.waitFor(r)},t}(),Dn=function(){function t(t){this.db=t}return t.openOrCreate=function(e,n,r){return g(t.isAvailable(),"IndexedDB not supported in current environment."),p("SimpleDb","Opening database:",e),new kn(function(i,o){var a=window.indexedDB.open(e,n);a.onsuccess=function(e){var n=e.target.result;i(new t(n))},a.onblocked=function(){o(new w(_.FAILED_PRECONDITION,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},a.onerror=function(t){o(t.target.error)},a.onupgradeneeded=function(t){p("SimpleDb",'Database "'+e+'" requires upgrade from version:',t.oldVersion);var n=t.target.result,i=new On(a.transaction);r.createOrUpgrade(n,i,t.oldVersion,Yn).next(function(){p("SimpleDb","Database upgrade to version "+Yn+" complete")})}}).toPromise()},t.delete=function(t){return p("SimpleDb","Removing database:",t),Pn(window.indexedDB.deleteDatabase(t)).toPromise()},t.isAvailable=function(){if("undefined"===typeof window||null==window.indexedDB)return!1;if(void 0===window.navigator)return"YES"===Object({NODE_ENV:"production",PUBLIC_URL:""}).USE_MOCK_PERSISTENCE;var t=window.navigator.userAgent;return!(t.indexOf("MSIE ")>0||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0)},t.getStore=function(t,e){return t.store(e)},t.prototype.runTransaction=function(t,e,n){var r=On.open(this.db,t,e),i=n(r).catch(function(t){r.abort(t)}).toPromise();return r.completionPromise.then(function(){return i})},t.prototype.close=function(){this.db.close()},t}(),An=function(){function t(t){this.dbCursor=t,this.shouldStop=!1,this.nextKey=null}return Object.defineProperty(t.prototype,"isDone",{get:function(){return this.shouldStop},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"skipToKey",{get:function(){return this.nextKey},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cursor",{set:function(t){this.dbCursor=t},enumerable:!0,configurable:!0}),t.prototype.done=function(){this.shouldStop=!0},t.prototype.skip=function(t){this.nextKey=t},t.prototype.delete=function(){return Pn(this.dbCursor.delete())},t}(),On=function(){function t(t){var e=this;this.transaction=t,this.aborted=!1,this.completionDeferred=new hn,this.transaction.oncomplete=function(){e.completionDeferred.resolve()},this.transaction.onabort=function(){t.error?e.completionDeferred.reject(t.error):e.completionDeferred.resolve()},this.transaction.onerror=function(t){e.completionDeferred.reject(t.target.error)}}return t.open=function(e,n,r){return new t(e.transaction(r,n))},Object.defineProperty(t.prototype,"completionPromise",{get:function(){return this.completionDeferred.promise},enumerable:!0,configurable:!0}),t.prototype.abort=function(t){t&&this.completionDeferred.reject(t),this.aborted||(p("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},t.prototype.store=function(t){var e=this.transaction.objectStore(t);return g(!!e,"Object store not part of transaction: "+t),new Rn(e)},t}(),Rn=function(){function t(t){this.store=t}return t.prototype.put=function(t,e){var n;return void 0!==e?(p("SimpleDb","PUT",this.store.name,t,e),n=this.store.put(e,t)):(p("SimpleDb","PUT",this.store.name,"<auto-key>",t),n=this.store.put(t)),Pn(n)},t.prototype.add=function(t){return p("SimpleDb","ADD",this.store.name,t,t),Pn(this.store.add(t))},t.prototype.get=function(t){var e=this;return Pn(this.store.get(t)).next(function(n){return void 0===n&&(n=null),p("SimpleDb","GET",e.store.name,t,n),n})},t.prototype.delete=function(t){return p("SimpleDb","DELETE",this.store.name,t),Pn(this.store.delete(t))},t.prototype.count=function(){return p("SimpleDb","COUNT",this.store.name),Pn(this.store.count())},t.prototype.loadAll=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.iterateCursor(n,function(t,e){r.push(e)}).next(function(){return r})},t.prototype.deleteAll=function(t,e){p("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.keysOnly=!1;var r=this.cursor(n);return this.iterateCursor(r,function(t,e,n){return n.delete()})},t.prototype.iterate=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.iterateCursor(r,e)},t.prototype.iterateSerial=function(t){var e=this.cursor({});return new kn(function(n,r){e.onerror=function(t){r(t.target.error)},e.onsuccess=function(e){var r=e.target.result;r?t(r.primaryKey,r.value).next(function(t){t?r.continue():n()}):n()}})},t.prototype.iterateCursor=function(t,e){var n=[];return new kn(function(r,i){t.onerror=function(t){i(t.target.error)},t.onsuccess=function(t){var i=t.target.result;if(i){var o=new An(i),a=e(i.primaryKey,i.value,o);if(a instanceof kn){var s=a.catch(function(t){return o.done(),kn.reject(t)});n.push(s)}o.isDone?r():null===o.skipToKey?i.continue():i.continue(o.skipToKey)}else r()}}).next(function(){return kn.waitFor(n)})},t.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"===typeof t?n=t:(g(void 0===e,"3rd argument must not be defined if 2nd is a range."),e=t)),{index:n,range:e}},t.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.keysOnly?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},t}();function Pn(t){return new kn(function(e,n){t.onsuccess=function(t){var n=t.target.result;e(n)},t.onerror=function(t){n(t.target.error)}})}var xn=function(){function t(t,e){this.referenceDelegate=t,this.serializer=e,this.targetIdGenerator=Nn.forQueryCache()}return t.prototype.allocateTargetId=function(t){var e=this;return this.retrieveMetadata(t).next(function(n){return n.highestTargetId=e.targetIdGenerator.after(n.highestTargetId),e.saveMetadata(t,n).next(function(){return n.highestTargetId})})},t.prototype.getLastRemoteSnapshotVersion=function(t){return this.retrieveMetadata(t).next(function(t){return $t.fromTimestamp(new et(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},t.prototype.getHighestSequenceNumber=function(t){return Fn(t.simpleDbTransaction)},t.prototype.setTargetsMetadata=function(t,e,n){var r=this;return this.retrieveMetadata(t).next(function(i){return i.highestListenSequenceNumber=e,n&&(i.lastRemoteSnapshotVersion=n.toTimestamp()),e>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=e),r.saveMetadata(t,i)})},t.prototype.addQueryData=function(t,e){var n=this;return this.saveQueryData(t,e).next(function(){return n.retrieveMetadata(t).next(function(r){return r.targetCount+=1,n.updateMetadataFromQueryData(e,r),n.saveMetadata(t,r)})})},t.prototype.updateQueryData=function(t,e){return this.saveQueryData(t,e)},t.prototype.removeQueryData=function(t,e){var n=this;return this.removeMatchingKeysForTargetId(t,e.targetId).next(function(){return Ln(t).delete(e.targetId)}).next(function(){return n.retrieveMetadata(t)}).next(function(e){return g(e.targetCount>0,"Removing from an empty query cache"),e.targetCount-=1,n.saveMetadata(t,e)})},t.prototype.removeTargets=function(t,e,n){var r=this,i=0,o=[];return Ln(t).iterate(function(a,s){var u=r.serializer.fromDbTarget(s);u.sequenceNumber<=e&&void 0===n[u.targetId]&&(i++,o.push(r.removeQueryData(t,u)))}).next(function(){return kn.waitFor(o)}).next(function(){return i})},t.prototype.forEachTarget=function(t,e){var n=this;return Ln(t).iterate(function(t,r){var i=n.serializer.fromDbTarget(r);e(i)})},t.prototype.retrieveMetadata=function(t){return Mn(t.simpleDbTransaction)},t.prototype.saveMetadata=function(t,e){return(n=t,Pr.getStore(n,ur.store)).put(ur.key,e);var n},t.prototype.saveQueryData=function(t,e){return Ln(t).put(this.serializer.toDbTarget(e))},t.prototype.updateMetadataFromQueryData=function(t,e){var n=!1;return t.targetId>e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},t.prototype.getQueryCount=function(t){return this.retrieveMetadata(t).next(function(t){return t.targetCount})},t.prototype.getQueryData=function(t,e){var n=this,r=e.canonicalId(),i=IDBKeyRange.bound([r,Number.NEGATIVE_INFINITY],[r,Number.POSITIVE_INFINITY]),o=null;return Ln(t).iterate({range:i,index:ar.queryTargetsIndexName},function(t,r,i){var a=n.serializer.fromDbTarget(r);e.isEqual(a.query)&&(o=a,i.done())}).next(function(){return o})},t.prototype.addMatchingKeys=function(t,e,n){var r=this,i=[],o=Un(t);return e.forEach(function(e){var a=vn(e.path);i.push(o.put(new sr(n,a))),i.push(r.referenceDelegate.addReference(t,e))}),kn.waitFor(i)},t.prototype.removeMatchingKeys=function(t,e,n){var r=this,i=Un(t);return kn.forEach(e,function(e){var o=vn(e.path);return kn.waitFor([i.delete([n,o]),r.referenceDelegate.removeReference(t,e)])})},t.prototype.removeMatchingKeysForTargetId=function(t,e){var n=Un(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},t.prototype.getMatchingKeysForTargetId=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=Un(t),i=Ne();return r.iterate({range:n,keysOnly:!0},function(t,e,n){var r=wn(t[1]),o=new ct(r);i=i.add(o)}).next(function(){return i})},t.prototype.containsKey=function(t,e){var n,r=vn(e.path),i=IDBKeyRange.bound([r],[(n=r,n+"\0")],!1,!0),o=0;return Un(t).iterate({index:sr.documentTargetsIndex,keysOnly:!0,range:i},function(t,e,n){var r=t[0];t[1];0!==r&&(o++,n.done())}).next(function(){return o>0})},t.prototype.getQueryDataForTarget=function(t,e){var n=this;return Ln(t).get(e).next(function(t){return t?n.serializer.fromDbTarget(t):null})},t}();function Ln(t){return Pr.getStore(t,ar.store)}function Mn(t){return Dn.getStore(t,ur.store).get(ur.key).next(function(t){return g(null!==t,"Missing metadata row."),t})}function Fn(t){return Mn(t).next(function(t){return t.highestListenSequenceNumber})}function Un(t){return Pr.getStore(t,sr.store)}var jn=function(){function t(t){this.mapKeyFn=t,this.inner={}}return t.prototype.get=function(t){var e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(var r=0,i=n;r<i.length;r++){var o=i[r],a=o[0],s=o[1];if(a.isEqual(t))return s}},t.prototype.has=function(t){return void 0!==this.get(t)},t.prototype.set=function(t,e){var n=this.mapKeyFn(t),r=this.inner[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(r[i][0].isEqual(t))return void(r[i]=[t,e]);r.push([t,e])}else this.inner[n]=[[t,e]]},t.prototype.delete=function(t){var e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(n[r][0].isEqual(t))return 1===n.length?delete this.inner[e]:n.splice(r,1),!0;return!1},t.prototype.forEach=function(t){I(this.inner,function(e,n){for(var r=0,i=n;r<i.length;r++){var o=i[r],a=o[0],s=o[1];t(a,s)}})},t.prototype.isEmpty=function(){return N(this.inner)},t}(),Vn=function(){function t(){this.changes=we(),this.documentSizes=new jn(function(t){return t.toString()})}return t.prototype.addEntry=function(t){var e=this.assertChanges();this.changes=e.insert(t.key,t)},t.prototype.getEntry=function(t,e){var n=this,r=this.assertChanges().get(e);return r?kn.resolve(r):this.getFromCache(t,e).next(function(t){return null===t?(n.documentSizes.set(e,0),null):(n.documentSizes.set(e,t.size),t.maybeDocument)})},t.prototype.apply=function(t){var e=this.applyChanges(t);return this.changes=null,e},t.prototype.assertChanges=function(){return g(null!==this.changes,"Changes have already been applied."),this.changes},t}(),Bn="The remote document changelog no longer contains all changes for all local query views. It may be necessary to rebuild these views.",qn=function(){function t(t,e){this.serializer=t,this.keepDocumentChangeLog=e,this._lastProcessedDocumentChangeId=0}return Object.defineProperty(t.prototype,"lastProcessedDocumentChangeId",{get:function(){return this._lastProcessedDocumentChangeId},enumerable:!0,configurable:!0}),t.prototype.start=function(t){var e=Dn.getStore(t,lr.store);return this.synchronizeLastDocumentChangeId(e)},t.prototype.addEntries=function(t,e,n){var r=[];if(e.length>0){for(var i=Qn(t),o=Ne(),a=0,s=e;a<s.length;a++){var u=s[a],c=u.key,l=u.doc;r.push(i.put(zn(c),l)),o=o.add(c)}this.keepDocumentChangeLog&&r.push(Hn(t).put({changes:this.serializer.toDbResourcePaths(o)})),r.push(this.updateSize(t,n))}return kn.waitFor(r)},t.prototype.removeEntry=function(t,e){var n=Qn(t),r=zn(e);return n.get(r).next(function(t){return t?n.delete(r).next(function(){return Gn(t)}):kn.resolve(0)})},t.prototype.getEntry=function(t,e){var n=this;return Qn(t).get(zn(e)).next(function(t){return t?n.serializer.fromDbRemoteDocument(t):null})},t.prototype.getSizedEntry=function(t,e){var n=this;return Qn(t).get(zn(e)).next(function(t){return t?{maybeDocument:n.serializer.fromDbRemoteDocument(t),size:Gn(t)}:null})},t.prototype.getDocumentsMatchingQuery=function(t,e){var n=this,r=Te(),i=e.path.toArray(),o=IDBKeyRange.lowerBound(i);return Qn(t).iterate({range:o},function(t,i,o){var a=n.serializer.fromDbRemoteDocument(i);e.path.isPrefixOf(a.key.path)?a instanceof ht&&e.matches(a)&&(r=r.insert(a.key,a)):o.done()}).next(function(){return r})},t.prototype.getNewDocumentChanges=function(t){var e=this;g(this.keepDocumentChangeLog,"Can only call getNewDocumentChanges() when document change log is enabled");var n=Ne(),r=we(),i=IDBKeyRange.lowerBound(this._lastProcessedDocumentChangeId+1),o=!0,a=Hn(t);return a.iterate({range:i},function(t,r){if(o&&(o=!1,e._lastProcessedDocumentChangeId+1!==r.id))return e.synchronizeLastDocumentChangeId(a).next(function(){return kn.reject(new w(_.DATA_LOSS,Bn))});n=n.unionWith(e.serializer.fromDbResourcePaths(r.changes)),e._lastProcessedDocumentChangeId=r.id}).next(function(){var i=[];return n.forEach(function(n){i.push(e.getEntry(t,n).next(function(t){var e=t||new ft(n,$t.forDeletedDoc());r=r.insert(n,e)}))}),kn.waitFor(i)}).next(function(){return r})},t.prototype.removeDocumentChangesThroughChangeId=function(t,e){var n=IDBKeyRange.upperBound(e);return Hn(t).delete(n)},t.prototype.synchronizeLastDocumentChangeId=function(t){var e=this;return this._lastProcessedDocumentChangeId=0,t.iterate({keysOnly:!0,reverse:!0},function(t,n,r){e._lastProcessedDocumentChangeId=t,r.done()})},t.prototype.newChangeBuffer=function(){return new Kn(this)},t.prototype.getSize=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},t.prototype.getMetadata=function(t){return Wn(t).get(or.key).next(function(t){return g(!!t,"Missing document cache metadata"),t})},t.prototype.setMetadata=function(t,e){return Wn(t).put(or.key,e)},t.prototype.updateSize=function(t,e){var n=this;return this.getMetadata(t).next(function(r){return r.byteSize+=e,n.setMetadata(t,r)})},t}();function Wn(t){return Pr.getStore(t,or.store)}var Kn=function(t){function e(e){var n=t.call(this)||this;return n.documentCache=e,n}return s.__extends(e,t),e.prototype.applyChanges=function(t){var e=this,n=this.assertChanges(),r=0,i=[];return n.forEach(function(t,n){var o=e.documentCache.serializer.toDbRemoteDocument(n),a=e.documentSizes.get(t);g(void 0!==a,"Attempting to change document "+t.toString()+" without having read it first");var s=Gn(o);r+=s-a,i.push({key:t,doc:o})}),this.documentCache.addEntries(t,i,r)},e.prototype.getFromCache=function(t,e){return this.documentCache.getSizedEntry(t,e)},e}(Vn);function Qn(t){return Pr.getStore(t,ir.store)}function Hn(t){return Pr.getStore(t,lr.store)}function zn(t){return t.path.toArray()}function Gn(t){var e;if(t.document)e=t.document;else if(t.unknownDocument)e=t.unknownDocument;else{if(!t.noDocument)throw m("Unknown remote document type");e=t.noDocument}return JSON.stringify(e).length}var Yn=7,Xn=function(){function t(t){this.serializer=t}return t.prototype.createOrUpgrade=function(t,e,n,r){var i=this;g(n<r&&n>=0&&r<=Yn,"Unexpected schema upgrade from v"+n+" to v{toVersion}."),n<1&&r>=1&&(function(t){t.createObjectStore($n.store)}(t),function(t){t.createObjectStore(Zn.store,{keyPath:Zn.keyPath}),t.createObjectStore(tr.store,{keyPath:tr.keyPath,autoIncrement:!0}).createIndex(tr.userMutationsIndex,tr.userMutationsKeyPath,{unique:!0}),t.createObjectStore(er.store)}(t),cr(t),function(t){t.createObjectStore(ir.store)}(t));var o=kn.resolve();return n<3&&r>=3&&(0!==n&&(!function(t){t.deleteObjectStore(sr.store),t.deleteObjectStore(ar.store),t.deleteObjectStore(ur.store)}(t),cr(t)),o=o.next(function(){return function(t){var e=t.store(ur.store),n=new ur(0,0,$t.MIN.toTimestamp(),0);return e.put(ur.key,n)}(e)})),n<4&&r>=4&&(0!==n&&(o=o.next(function(){return function(t,e){return e.store(tr.store).loadAll().next(function(n){t.deleteObjectStore(tr.store);var r=t.createObjectStore(tr.store,{keyPath:tr.keyPath,autoIncrement:!0});r.createIndex(tr.userMutationsIndex,tr.userMutationsKeyPath,{unique:!0});var i=e.store(tr.store),o=n.map(function(t){return i.put(t)});return kn.waitFor(o)})}(t,e)})),o=o.next(function(){!function(t){t.createObjectStore(hr.store,{keyPath:hr.keyPath})}(t),function(t){t.createObjectStore(lr.store,{keyPath:"id",autoIncrement:!0})}(t)})),n<5&&r>=5&&(o=o.next(function(){return i.removeAcknowledgedMutations(e)})),n<6&&r>=6&&(o=o.next(function(){return function(t){t.createObjectStore(or.store)}(t),i.addDocumentGlobal(e)})),n<7&&r>=7&&(o=o.next(function(){return i.ensureSequenceNumbers(e)})),o},t.prototype.addDocumentGlobal=function(t){var e=0;return t.store(ir.store).iterate(function(t,n){e+=Gn(n)}).next(function(){var n=new or(e);return t.store(or.store).put(or.key,n)})},t.prototype.removeAcknowledgedMutations=function(t){var e=this,n=t.store(Zn.store),r=t.store(tr.store);return n.loadAll().next(function(n){return kn.forEach(n,function(n){var i=IDBKeyRange.bound([n.userId,Tn],[n.userId,n.lastAcknowledgedBatchId]);return r.loadAll(tr.userMutationsIndex,i).next(function(r){return kn.forEach(r,function(r){g(r.userId===n.userId,"Cannot process batch "+r.batchId+" from unexpected user");var i=e.serializer.fromDbMutationBatch(r);return yr(t,n.userId,i).next(function(){})})})})})},t.prototype.ensureSequenceNumbers=function(t){var e=t.store(sr.store),n=t.store(ir.store);return Fn(t).next(function(t){var r=[];return n.iterate(function(n,i){var o=new at(n),a=function(t){return[0,vn(t)]}(o);r.push(e.get(a).next(function(n){return n?kn.resolve():function(n){return e.put(new sr(0,vn(n),t))}(o)}))}).next(function(){return kn.waitFor(r)})})},t}();var Jn=function(){return function(t,e){this.seconds=t,this.nanoseconds=e}}(),$n=function(){function t(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n}return t.store="owner",t.key="owner",t}();var Zn=function(){function t(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n}return t.store="mutationQueues",t.keyPath="userId",t}(),tr=function(){function t(t,e,n,r){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.mutations=r}return t.store="mutations",t.keyPath="batchId",t.userMutationsIndex="userMutationsIndex",t.userMutationsKeyPath=["userId","batchId"],t}();var er=function(){function t(){}return t.prefixForUser=function(t){return[t]},t.prefixForPath=function(t,e){return[t,vn(e)]},t.key=function(t,e,n){return[t,vn(e),n]},t.store="documentMutations",t.PLACEHOLDER=new t,t}();var nr=function(){return function(t,e){this.path=t,this.readTime=e}}(),rr=function(){return function(t,e){this.path=t,this.version=e}}(),ir=function(){function t(t,e,n,r){this.unknownDocument=t,this.noDocument=e,this.document=n,this.hasCommittedMutations=r}return t.store="remoteDocuments",t}(),or=function(){function t(t){this.byteSize=t}return t.store="remoteDocumentGlobal",t.key="remoteDocumentGlobalKey",t}();var ar=function(){function t(t,e,n,r,i,o){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.query=o}return t.store="targets",t.keyPath="targetId",t.queryTargetsIndexName="queryTargetsIndex",t.queryTargetsKeyPath=["canonicalId","targetId"],t}(),sr=function(){function t(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n,g(0===t===(void 0!==n),"A target-document row must either have targetId == 0 and a defined sequence number, or a non-zero targetId and no sequence number")}return t.store="targetDocuments",t.keyPath=["targetId","path"],t.documentTargetsIndex="documentTargetsIndex",t.documentTargetsKeyPath=["path","targetId"],t}(),ur=function(){function t(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r}return t.key="targetGlobalKey",t.store="targetGlobal",t}();function cr(t){t.createObjectStore(sr.store,{keyPath:sr.keyPath}).createIndex(sr.documentTargetsIndex,sr.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(ar.store,{keyPath:ar.keyPath}).createIndex(ar.queryTargetsIndexName,ar.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(ur.store)}var lr=function(){function t(t){this.changes=t}return t.store="remoteDocumentChanges",t.keyPath="id",t}();var hr=function(){function t(t,e,n,r,i){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r,this.lastProcessedDocumentChangeId=i}return t.store="clientMetadata",t.keyPath="clientId",t}();var fr=[Zn.store,tr.store,er.store,ir.store,ar.store,$n.store,ur.store,sr.store].concat([hr.store,lr.store]).concat([or.store]),pr=function(){function t(t,e,n){this.userId=t,this.serializer=e,this.referenceDelegate=n,this.documentKeysByBatchId={}}return t.forUser=function(e,n,r){return g(""!==e.uid,"UserID must not be an empty string."),new t(e.isAuthenticated()?e.uid:"",n,r)},t.prototype.checkEmpty=function(t){var e=!0,n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return gr(t).iterate({index:tr.userMutationsIndex,range:n},function(t,n,r){e=!1,r.done()}).next(function(){return e})},t.prototype.acknowledgeBatch=function(t,e,n){return this.getMutationQueueMetadata(t).next(function(r){var i=e.batchId;return g(i>r.lastAcknowledgedBatchId,"Mutation batchIDs must be acknowledged in order"),r.lastAcknowledgedBatchId=i,r.lastStreamToken=mr(n),br(t).put(r)})},t.prototype.getLastStreamToken=function(t){return this.getMutationQueueMetadata(t).next(function(t){return t.lastStreamToken})},t.prototype.setLastStreamToken=function(t,e){return this.getMutationQueueMetadata(t).next(function(n){return n.lastStreamToken=mr(e),br(t).put(n)})},t.prototype.addMutationBatch=function(t,e,n){var r=this,i=vr(t),o=gr(t);return o.add({}).next(function(t){g("number"===typeof t,"Auto-generated key is not a number");var a=new Sn(t,e,n),s=r.serializer.toDbMutationBatch(r.userId,a);r.documentKeysByBatchId[t]=a.keys();for(var u=[],c=0,l=n;c<l.length;c++){var h=l[c],f=er.key(r.userId,h.key.path,t);u.push(o.put(s)),u.push(i.put(f,er.PLACEHOLDER))}return kn.waitFor(u).next(function(){return a})})},t.prototype.lookupMutationBatch=function(t,e){var n=this;return gr(t).get(e).next(function(t){return t?(g(t.userId===n.userId,"Unexpected user '"+t.userId+"' for mutation batch "+e),n.serializer.fromDbMutationBatch(t)):null})},t.prototype.lookupMutationKeys=function(t,e){var n=this;return this.documentKeysByBatchId[e]?kn.resolve(this.documentKeysByBatchId[e]):this.lookupMutationBatch(t,e).next(function(t){if(t){var r=t.keys();return n.documentKeysByBatchId[e]=r,r}return null})},t.prototype.getNextMutationBatchAfterBatchId=function(t,e){var n=this;return this.getMutationQueueMetadata(t).next(function(r){var i=Math.max(e,r.lastAcknowledgedBatchId)+1,o=IDBKeyRange.lowerBound([n.userId,i]),a=null;return gr(t).iterate({index:tr.userMutationsIndex,range:o},function(t,e,r){e.userId===n.userId&&(g(e.batchId>=i,"Should have found mutation after "+i),a=n.serializer.fromDbMutationBatch(e)),r.done()}).next(function(){return a})})},t.prototype.getAllMutationBatches=function(t){var e=this,n=IDBKeyRange.bound([this.userId,Tn],[this.userId,Number.POSITIVE_INFINITY]);return gr(t).loadAll(tr.userMutationsIndex,n).next(function(t){return t.map(function(t){return e.serializer.fromDbMutationBatch(t)})})},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=er.prefixForPath(this.userId,e.path),i=IDBKeyRange.lowerBound(r),o=[];return vr(t).iterate({range:i},function(r,i,a){var s=r[0],u=r[1],c=r[2],l=wn(u);if(s===n.userId&&e.path.isEqual(l))return gr(t).get(c).next(function(t){if(!t)throw m("Dangling document-mutation reference found: "+r+" which points to "+c);g(t.userId===n.userId,"Unexpected user '"+t.userId+"' for mutation batch "+c),o.push(n.serializer.fromDbMutationBatch(t))});a.done()}).next(function(){return o})},t.prototype.getAllMutationBatchesAffectingDocumentKeys=function(t,e){var n=this,r=new ee(H),i=[];return e.forEach(function(e){var o=er.prefixForPath(n.userId,e.path),a=IDBKeyRange.lowerBound(o),s=vr(t).iterate({range:a},function(t,i,o){var a=t[0],s=t[1],u=t[2],c=wn(s);a===n.userId&&e.path.isEqual(c)?r=r.add(u):o.done()});i.push(s)}),kn.waitFor(i).next(function(){return n.lookupMutationBatches(t,r)})},t.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=this;g(!e.isDocumentQuery(),"Document queries shouldn't go down this path");var r=e.path,i=r.length+1,o=er.prefixForPath(this.userId,r),a=IDBKeyRange.lowerBound(o),s=new ee(H);return vr(t).iterate({range:a},function(t,e,o){var a=t[0],u=t[1],c=t[2],l=wn(u);a===n.userId&&r.isPrefixOf(l)?l.length===i&&(s=s.add(c)):o.done()}).next(function(){return n.lookupMutationBatches(t,s)})},t.prototype.lookupMutationBatches=function(t,e){var n=this,r=[],i=[];return e.forEach(function(e){i.push(gr(t).get(e).next(function(t){if(null===t)throw m("Dangling document-mutation reference found, which points to "+e);g(t.userId===n.userId,"Unexpected user '"+t.userId+"' for mutation batch "+e),r.push(n.serializer.fromDbMutationBatch(t))}))}),kn.waitFor(i).next(function(){return r})},t.prototype.removeMutationBatch=function(t,e){var n=this;return yr(t.simpleDbTransaction,this.userId,e).next(function(r){return n.removeCachedMutationKeys(e.batchId),kn.forEach(r,function(e){return n.referenceDelegate.removeMutationReference(t,e)})})},t.prototype.removeCachedMutationKeys=function(t){delete this.documentKeysByBatchId[t]},t.prototype.performConsistencyCheck=function(t){var e=this;return this.checkEmpty(t).next(function(n){if(!n)return kn.resolve();var r=IDBKeyRange.lowerBound(er.prefixForUser(e.userId)),i=[];return vr(t).iterate({range:r},function(t,n,r){if(t[0]===e.userId){var o=wn(t[1]);i.push(o)}else r.done()}).next(function(){g(0===i.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+i.map(function(t){return t.canonicalString()}))})})},t.prototype.containsKey=function(t,e){return dr(t,this.userId,e)},t.prototype.getMutationQueueMetadata=function(t){var e=this;return br(t).get(this.userId).next(function(t){return t||new Zn(e.userId,Tn,"")})},t}();function dr(t,e,n){var r=er.prefixForPath(e,n.path),i=r[1],o=IDBKeyRange.lowerBound(r),a=!1;return vr(t).iterate({range:o,keysOnly:!0},function(t,n,r){var o=t[0],s=t[1];t[2];o===e&&s===i&&(a=!0),r.done()}).next(function(){return a})}function yr(t,e,n){var r=t.store(tr.store),i=t.store(er.store),o=[],a=IDBKeyRange.only(n.batchId),s=0,u=r.iterate({range:a},function(t,e,n){return s++,n.delete()});o.push(u.next(function(){g(1===s,"Dangling document-mutation reference found: Missing batch "+n.batchId)}));for(var c=[],l=0,h=n.mutations;l<h.length;l++){var f=h[l],p=er.key(e,f.key.path,n.batchId);o.push(i.delete(p)),c.push(f.key)}return kn.waitFor(o).next(function(){return c})}function mr(t){return t instanceof Uint8Array?(g("YES"===Object({NODE_ENV:"production",PUBLIC_URL:""}).USE_MOCK_PERSISTENCE,"Persisting non-string stream tokens is only supported with mock persistence."),t.toString()):t}function gr(t){return Pr.getStore(t,tr.store)}function vr(t){return Pr.getStore(t,er.store)}function br(t){return Pr.getStore(t,Zn.store)}var _r=function(){function t(t){this.remoteSerializer=t}return t.prototype.fromDbRemoteDocument=function(t){if(t.document)return this.remoteSerializer.fromDocument(t.document,!!t.hasCommittedMutations);if(t.noDocument){var e=ct.fromSegments(t.noDocument.path),n=this.fromDbTimestamp(t.noDocument.readTime);return new ft(e,n,{hasCommittedMutations:!!t.hasCommittedMutations})}if(t.unknownDocument){e=ct.fromSegments(t.unknownDocument.path),n=this.fromDbTimestamp(t.unknownDocument.version);return new pt(e,n)}return m("Unexpected DbRemoteDocument")},t.prototype.toDbRemoteDocument=function(t){if(t instanceof ht){var e=this.remoteSerializer.toDocument(t),n=t.hasCommittedMutations;return new ir(null,null,e,n)}if(t instanceof ft){var r=t.key.path.toArray(),i=this.toDbTimestamp(t.version);n=t.hasCommittedMutations;return new ir(null,new nr(r,i),null,n)}if(t instanceof pt){r=t.key.path.toArray(),i=this.toDbTimestamp(t.version);return new ir(new rr(r,i),null,null,!0)}return m("Unexpected MaybeDocumment")},t.prototype.toDbTimestamp=function(t){var e=t.toTimestamp();return new Jn(e.seconds,e.nanoseconds)},t.prototype.fromDbTimestamp=function(t){var e=new et(t.seconds,t.nanoseconds);return $t.fromTimestamp(e)},t.prototype.toDbMutationBatch=function(t,e){var n=this,r=e.mutations.map(function(t){return n.remoteSerializer.toMutation(t)});return new tr(t,e.batchId,e.localWriteTime.toMillis(),r)},t.prototype.fromDbMutationBatch=function(t){var e=this,n=t.mutations.map(function(t){return e.remoteSerializer.fromMutation(t)}),r=et.fromMillis(t.localWriteTimeMs);return new Sn(t.batchId,r,n)},t.prototype.toDbResourcePaths=function(t){var e=[];return t.forEach(function(t){e.push(vn(t.path))}),e},t.prototype.fromDbResourcePaths=function(t){for(var e=Ne(),n=0,r=t;n<r.length;n++){var i=r[n];e=e.add(new ct(wn(i)))}return e},t.prototype.fromDbTarget=function(t){var e,n=this.fromDbTimestamp(t.readTime);return e=void 0!==t.query.documents?this.remoteSerializer.fromDocumentsTarget(t.query):this.remoteSerializer.fromQueryTarget(t.query),new te(e,t.targetId,Vt.Listen,t.lastListenSequenceNumber,n,t.resumeToken)},t.prototype.toDbTarget=function(t){g(Vt.Listen===t.purpose,"Only queries with purpose "+Vt.Listen+" may be stored, got "+t.purpose);var e,n,r=this.toDbTimestamp(t.snapshotVersion);return e=t.query.isDocumentQuery()?this.remoteSerializer.toDocumentsTarget(t.query):this.remoteSerializer.toQueryTarget(t.query),t.resumeToken instanceof Uint8Array?(g("YES"===Object({NODE_ENV:"production",PUBLIC_URL:""}).USE_MOCK_PERSISTENCE,"Persisting non-string stream tokens is only supported with mock persistence ."),n=t.resumeToken.toString()):n=t.resumeToken,new ar(t.targetId,t.query.canonicalId(),r,n,t.sequenceNumber,e)},t}();function wr(t,e){var n=t[0],r=t[1],i=e[0],o=e[1],a=H(n,i);return 0===a?H(r,o):a}var Er=function(){function t(t){this.maxElements=t,this.buffer=new ee(wr),this.previousIndex=0}return t.prototype.nextIndex=function(){return++this.previousIndex},t.prototype.addElement=function(t){var e=[t,this.nextIndex()];if(this.buffer.size<this.maxElements)this.buffer=this.buffer.add(e);else{var n=this.buffer.last();wr(e,n)<0&&(this.buffer=this.buffer.delete(n).add(e))}},Object.defineProperty(t.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!0,configurable:!0}),t}(),Tr={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Sr=function(){function t(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}return t.withCacheSize=function(e){return new t(e,t.DEFAULT_COLLECTION_PERCENTILE,t.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)},t.COLLECTION_DISABLED=-1,t.MINIMUM_CACHE_SIZE_BYTES=1048576,t.DEFAULT_CACHE_SIZE_BYTES=41943040,t.DEFAULT_COLLECTION_PERCENTILE=10,t.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,t.DEFAULT=new t(t.DEFAULT_CACHE_SIZE_BYTES,t.DEFAULT_COLLECTION_PERCENTILE,t.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),t.DISABLED=new t(t.COLLECTION_DISABLED,0,0),t}(),Cr=function(){function t(t,e,n){this.garbageCollector=t,this.asyncQueue=e,this.localStore=n,this.gcTask=null}return t.prototype.start=function(){g(null===this.gcTask,"Cannot start an already started LruScheduler"),this.garbageCollector.params.cacheSizeCollectionThreshold!==mo&&this.scheduleGC()},t.prototype.stop=function(){this.gcTask&&(this.gcTask.cancel(),this.gcTask=null)},t.prototype.scheduleGC=function(){var t=this;g(null===this.gcTask,"Cannot schedule GC while a task is pending");var e=this.hasRun?3e5:6e4;p("LruGarbageCollector","Garbage collection scheduled in "+e+"ms"),this.gcTask=this.asyncQueue.enqueueAfterDelay(cn.LruGarbageCollection,e,function(){return t.gcTask=null,t.hasRun=!0,t.localStore.collectGarbage(t.garbageCollector).then(function(){return t.scheduleGC()})})},t}(),Ir=function(){function t(t,e){this.delegate=t,this.params=e}return t.prototype.calculateTargetCount=function(t,e){return this.delegate.getSequenceNumberCount(t).next(function(t){return Math.floor(e/100*t)})},t.prototype.nthSequenceNumber=function(t,e){var n=this;if(0===e)return kn.resolve(ln.INVALID);var r=new Er(e);return this.delegate.forEachTarget(t,function(t){return r.addElement(t.sequenceNumber)}).next(function(){return n.delegate.forEachOrphanedDocumentSequenceNumber(t,function(t){return r.addElement(t)})}).next(function(){return r.maxValue})},t.prototype.removeTargets=function(t,e,n){return this.delegate.removeTargets(t,e,n)},t.prototype.removeOrphanedDocuments=function(t,e){return this.delegate.removeOrphanedDocuments(t,e)},t.prototype.collect=function(t,e){var n=this;return this.params.cacheSizeCollectionThreshold===Sr.COLLECTION_DISABLED?(p("LruGarbageCollector","Garbage collection skipped; disabled"),kn.resolve(Tr)):this.getCacheSize(t).next(function(r){return r<n.params.cacheSizeCollectionThreshold?(p("LruGarbageCollector","Garbage collection skipped; Cache size "+r+" is lower than threshold "+n.params.cacheSizeCollectionThreshold),Tr):n.runGarbageCollection(t,e)})},t.prototype.getCacheSize=function(t){return this.delegate.getCacheSize(t)},t.prototype.runGarbageCollection=function(t,e){var n,r,o,a,s,u,c,l,f=this;return a=Date.now(),this.calculateTargetCount(t,this.params.percentileToCollect).next(function(e){return e>f.params.maximumSequenceNumbersToCollect?(p("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+f.params.maximumSequenceNumbersToCollect+" from "+e),r=f.params.maximumSequenceNumbersToCollect):r=e,s=Date.now(),f.nthSequenceNumber(t,r)}).next(function(r){return n=r,u=Date.now(),f.removeTargets(t,n,e)}).next(function(e){return o=e,c=Date.now(),f.removeOrphanedDocuments(t,n)}).next(function(t){(l=Date.now(),h()<=i.DEBUG)&&p("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-a)+"ms\n\tDetermined least recently used "+r+" in "+(u-s)+"ms\n\tRemoved "+o+" targets in "+(c-u)+"ms\n\tRemoved "+t+" documents in "+(l-c)+"ms\nTotal Duration: "+(l-a)+"ms");return kn.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:o,documentsRemoved:t})})},t}(),Nr=function(){return function(){}}(),kr="IndexedDbPersistence",Dr="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Ar="Another tab has exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `experimentalTabSynchronization:true` in all tabs.",Or="This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.",Rr=function(t){function e(e,n){var r=t.call(this)||this;return r.simpleDbTransaction=e,r.currentSequenceNumber=n,r}return s.__extends(e,t),e}(Nr),Pr=function(){function t(e,n,r,i,o,a,s){if(this.persistenceKey=e,this.clientId=n,this.queue=i,this.multiClientParams=s,this._started=!1,this.isPrimary=!1,this.networkEnabled=!0,this.inForeground=!1,this.lastGarbageCollectionTime=Number.NEGATIVE_INFINITY,this.primaryStateListener=function(t){return Promise.resolve()},!t.isAvailable())throw new w(_.UNIMPLEMENTED,Or);if(this.referenceDelegate=new Fr(this,a),this.dbName=e+t.MAIN_DATABASE,this.serializer=new _r(o),this.document=r.document,this.allowTabSynchronization=void 0!==s,this.queryCache=new xn(this.referenceDelegate,this.serializer),this.remoteDocumentCache=new qn(this.serializer,this.allowTabSynchronization),!r.window||!r.window.localStorage)throw new w(_.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");this.window=r.window,this.webStorage=this.window.localStorage}return t.getStore=function(t,e){if(t instanceof Rr)return Dn.getStore(t.simpleDbTransaction,e);throw m("IndexedDbPersistence must use instances of IndexedDbTransaction")},t.createIndexedDbPersistence=function(e,n,r,i,o,a){return s.__awaiter(this,void 0,void 0,function(){var u;return s.__generator(this,function(s){switch(s.label){case 0:return[4,(u=new t(e,n,r,i,o,a)).start()];case 1:return s.sent(),[2,u]}})})},t.createMultiClientIndexedDbPersistence=function(e,n,r,i,o,a,u){return s.__awaiter(this,void 0,void 0,function(){var c;return s.__generator(this,function(s){switch(s.label){case 0:return[4,(c=new t(e,n,r,i,o,a,u)).start()];case 1:return s.sent(),[2,c]}})})},t.prototype.start=function(){var t=this;return g(!this.started,"IndexedDbPersistence double-started!"),g(null!==this.window,"Expected 'window' to be defined"),Dn.openOrCreate(this.dbName,Yn,new Xn(this.serializer)).then(function(e){t.simpleDb=e}).then(function(){return t.startRemoteDocumentCache()}).then(function(){return t.attachVisibilityHandler(),t.attachWindowUnloadHook(),t.updateClientMetadataAndTryBecomePrimary().then(function(){return t.scheduleClientMetadataAndPrimaryLeaseRefreshes()})}).then(function(){return t.simpleDb.runTransaction("readonly",[ur.store],function(e){return Fn(e).next(function(e){var n=t.multiClientParams?t.multiClientParams.sequenceNumberSyncer:void 0;t.listenSequence=new ln(e,n)})})}).then(function(){t._started=!0}).catch(function(e){return t.simpleDb&&t.simpleDb.close(),Promise.reject(e)})},t.prototype.startRemoteDocumentCache=function(){var t=this;return this.simpleDb.runTransaction("readonly",fr,function(e){return t.remoteDocumentCache.start(e)})},t.prototype.setPrimaryStateListener=function(t){var e=this;return this.primaryStateListener=function(n){return s.__awaiter(e,void 0,void 0,function(){return s.__generator(this,function(e){return this.started?[2,t(n)]:[2]})})},t(this.isPrimary)},t.prototype.setNetworkEnabled=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.queue.enqueueAndForget(function(){return s.__awaiter(e,void 0,void 0,function(){return s.__generator(this,function(t){switch(t.label){case 0:return this.started?[4,this.updateClientMetadataAndTryBecomePrimary()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},t.prototype.updateClientMetadataAndTryBecomePrimary=function(){var t=this;return this.simpleDb.runTransaction("readwrite",fr,function(e){return Mr(e).put(new hr(t.clientId,Date.now(),t.networkEnabled,t.inForeground,t.remoteDocumentCache.lastProcessedDocumentChangeId)).next(function(){if(t.isPrimary)return t.verifyPrimaryLease(e).next(function(e){e||(t.isPrimary=!1,t.queue.enqueueAndForget(function(){return t.primaryStateListener(!1)}))})}).next(function(){return t.canActAsPrimary(e)}).next(function(n){var r=t.isPrimary;return t.isPrimary=n,r!==t.isPrimary&&t.queue.enqueueAndForget(function(){return t.primaryStateListener(t.isPrimary)}),r&&!t.isPrimary?t.releasePrimaryLeaseIfHeld(e):t.isPrimary?t.acquireOrExtendPrimaryLease(e):void 0})})},t.prototype.verifyPrimaryLease=function(t){var e=this;return Lr(t).get($n.key).next(function(t){return kn.resolve(e.isLocalClient(t))})},t.prototype.removeClientMetadata=function(t){return Mr(t).delete(this.clientId)},t.prototype.maybeGarbageCollectMultiClientState=function(){return s.__awaiter(this,void 0,void 0,function(){var e,n,r=this;return s.__generator(this,function(i){switch(i.label){case 0:return!this.isPrimary||this.isWithinAge(this.lastGarbageCollectionTime,18e5)?[3,2]:(this.lastGarbageCollectionTime=Date.now(),n=[],[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(i){var o=t.getStore(i,hr.store);return o.loadAll().next(function(t){e=r.filterActiveClients(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)})}).next(function(){return kn.forEach(n,function(t){return o.delete(t.clientId)})}).next(function(){if((e=e.filter(function(t){return t.clientId!==r.clientId})).length>0){var t=e.map(function(t){return t.lastProcessedDocumentChangeId||0}),n=Math.min.apply(Math,t);return r.remoteDocumentCache.removeDocumentChangesThroughChangeId(i,n)}})})]);case 1:i.sent(),n.forEach(function(t){r.window.localStorage.removeItem(r.zombiedClientLocalStorageKey(t.clientId))}),i.label=2;case 2:return[2]}})})},t.prototype.scheduleClientMetadataAndPrimaryLeaseRefreshes=function(){var t=this;this.clientMetadataRefresher=this.queue.enqueueAfterDelay(cn.ClientMetadataRefresh,4e3,function(){return t.updateClientMetadataAndTryBecomePrimary().then(function(){return t.maybeGarbageCollectMultiClientState()}).then(function(){return t.scheduleClientMetadataAndPrimaryLeaseRefreshes()})})},t.prototype.isLocalClient=function(t){return!!t&&t.ownerId===this.clientId},t.prototype.canActAsPrimary=function(t){var e=this;return Lr(t).get($n.key).next(function(n){if(null!==n&&e.isWithinAge(n.leaseTimestampMs,5e3)&&!e.isClientZombied(n.ownerId)){if(e.isLocalClient(n)&&e.networkEnabled)return!0;if(!e.isLocalClient(n)){if(!n.allowTabSynchronization)throw new w(_.FAILED_PRECONDITION,Ar);return!1}}return!(!e.networkEnabled||!e.inForeground)||Mr(t).loadAll().next(function(t){return void 0===e.filterActiveClients(t,5e3).find(function(t){if(e.clientId!==t.clientId){var n=!e.networkEnabled&&t.networkEnabled,r=!e.inForeground&&t.inForeground,i=e.networkEnabled===t.networkEnabled;if(n||r&&i)return!0}return!1})})}).next(function(t){return e.isPrimary!==t&&p(kr,"Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},t.prototype.shutdown=function(t){return s.__awaiter(this,void 0,void 0,function(){var e=this;return s.__generator(this,function(n){switch(n.label){case 0:return this._started=!1,this.markClientZombied(),this.clientMetadataRefresher&&this.clientMetadataRefresher.cancel(),this.detachVisibilityHandler(),this.detachWindowUnloadHook(),[4,this.simpleDb.runTransaction("readwrite",[$n.store,hr.store],function(t){return e.releasePrimaryLeaseIfHeld(t).next(function(){return e.removeClientMetadata(t)})})];case 1:return n.sent(),this.simpleDb.close(),this.removeClientZombiedEntry(),t?[4,Dn.delete(this.dbName)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.filterActiveClients=function(t,e){var n=this;return t.filter(function(t){return n.isWithinAge(t.updateTimeMs,e)&&!n.isClientZombied(t.clientId)})},t.prototype.getActiveClients=function(){var t=this;return this.simpleDb.runTransaction("readonly",[hr.store],function(e){return Mr(e).loadAll().next(function(e){return t.filterActiveClients(e,18e5).map(function(t){return t.clientId})})})},Object.defineProperty(t.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),t.prototype.getMutationQueue=function(t){return g(this.started,"Cannot initialize MutationQueue before persistence is started."),pr.forUser(t,this.serializer,this.referenceDelegate)},t.prototype.getQueryCache=function(){return g(this.started,"Cannot initialize QueryCache before persistence is started."),this.queryCache},t.prototype.getRemoteDocumentCache=function(){return g(this.started,"Cannot initialize RemoteDocumentCache before persistence is started."),this.remoteDocumentCache},t.prototype.runTransaction=function(t,e,n){var r=this;return p(kr,"Starting transaction:",t),this.simpleDb.runTransaction("readonly"===e?"readonly":"readwrite",fr,function(i){return"readwrite-primary"===e?r.verifyPrimaryLease(i).next(function(e){if(!e)throw d("Failed to obtain primary lease for action '"+t+"'."),r.isPrimary=!1,r.queue.enqueueAndForget(function(){return r.primaryStateListener(!1)}),new w(_.FAILED_PRECONDITION,Dr);return n(new Rr(i,r.listenSequence.next()))}).next(function(t){return r.acquireOrExtendPrimaryLease(i).next(function(){return t})}):r.verifyAllowTabSynchronization(i).next(function(){return n(new Rr(i,r.listenSequence.next()))})})},t.prototype.verifyAllowTabSynchronization=function(t){var e=this;return Lr(t).get($n.key).next(function(t){if(null!==t&&e.isWithinAge(t.leaseTimestampMs,5e3)&&!e.isClientZombied(t.ownerId)&&!e.isLocalClient(t)&&!t.allowTabSynchronization)throw new w(_.FAILED_PRECONDITION,Ar)})},t.prototype.acquireOrExtendPrimaryLease=function(t){var e=new $n(this.clientId,this.allowTabSynchronization,Date.now());return Lr(t).put($n.key,e)},t.isAvailable=function(){return Dn.isAvailable()},t.buildStoragePrefix=function(t){var e=t.databaseId.projectId;return t.databaseId.isDefaultDatabase||(e+="."+t.databaseId.database),"firestore/"+t.persistenceKey+"/"+e+"/"},t.prototype.releasePrimaryLeaseIfHeld=function(t){var e=this,n=Lr(t);return n.get($n.key).next(function(t){return e.isLocalClient(t)?(p(kr,"Releasing primary lease."),n.delete($n.key)):kn.resolve()})},t.prototype.isWithinAge=function(t,e){var n=Date.now();return!(t<n-e)&&(!(t>n)||(d("Detected an update time that is in the future: "+t+" > "+n),!1))},t.prototype.attachVisibilityHandler=function(){var t=this;null!==this.document&&"function"===typeof this.document.addEventListener&&(this.documentVisibilityHandler=function(){t.queue.enqueueAndForget(function(){return t.inForeground="visible"===t.document.visibilityState,t.updateClientMetadataAndTryBecomePrimary()})},this.document.addEventListener("visibilitychange",this.documentVisibilityHandler),this.inForeground="visible"===this.document.visibilityState)},t.prototype.detachVisibilityHandler=function(){this.documentVisibilityHandler&&(g(null!==this.document&&"function"===typeof this.document.addEventListener,"Expected 'document.addEventListener' to be a function"),this.document.removeEventListener("visibilitychange",this.documentVisibilityHandler),this.documentVisibilityHandler=null)},t.prototype.attachWindowUnloadHook=function(){var t=this;"function"===typeof this.window.addEventListener&&(this.windowUnloadHandler=function(){t.markClientZombied(),t.queue.enqueueAndForget(function(){return t.shutdown()})},this.window.addEventListener("unload",this.windowUnloadHandler))},t.prototype.detachWindowUnloadHook=function(){this.windowUnloadHandler&&(g("function"===typeof this.window.removeEventListener,"Expected 'window.removeEventListener' to be a function"),this.window.removeEventListener("unload",this.windowUnloadHandler),this.windowUnloadHandler=null)},t.prototype.isClientZombied=function(t){try{var e=null!==this.webStorage.getItem(this.zombiedClientLocalStorageKey(t));return p(kr,"Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(n){return d(kr,"Failed to get zombied client id.",n),!1}},t.prototype.markClientZombied=function(){try{this.webStorage.setItem(this.zombiedClientLocalStorageKey(this.clientId),String(Date.now()))}catch(t){d("Failed to set zombie client id.",t)}},t.prototype.removeClientZombiedEntry=function(){try{this.webStorage.removeItem(this.zombiedClientLocalStorageKey(this.clientId))}catch(t){}},t.prototype.zombiedClientLocalStorageKey=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},t.MAIN_DATABASE="main",t}();function xr(t){return t.code===_.FAILED_PRECONDITION&&t.message===Dr}function Lr(t){return t.store($n.store)}function Mr(t){return t.store(hr.store)}var Fr=function(){function t(t,e){this.db=t,this.garbageCollector=new Ir(this,e)}return t.prototype.getSequenceNumberCount=function(t){var e=this.orphanedDocmentCount(t);return this.db.getQueryCache().getQueryCount(t).next(function(t){return e.next(function(e){return t+e})})},t.prototype.orphanedDocmentCount=function(t){var e=0;return this.forEachOrphanedDocumentSequenceNumber(t,function(t){e++}).next(function(){return e})},t.prototype.forEachTarget=function(t,e){return this.db.getQueryCache().forEachTarget(t,e)},t.prototype.forEachOrphanedDocumentSequenceNumber=function(t,e){return this.forEachOrphanedDocument(t,function(t,n){return e(n)})},t.prototype.setInMemoryPins=function(t){this.inMemoryPins=t},t.prototype.addReference=function(t,e){return Ur(t,e)},t.prototype.removeReference=function(t,e){return Ur(t,e)},t.prototype.removeTargets=function(t,e,n){return this.db.getQueryCache().removeTargets(t,e,n)},t.prototype.removeMutationReference=function(t,e){return Ur(t,e)},t.prototype.isPinned=function(t,e){return this.inMemoryPins.containsKey(e)?kn.resolve(!0):function(t,e){var n=!1;return br(t).iterateSerial(function(r){return dr(t,r,e).next(function(t){return t&&(n=!0),kn.resolve(!t)})}).next(function(){return n})}(t,e)},t.prototype.removeOrphanedDocuments=function(t,e){var n=this,r=0,i=0,o=[];return this.forEachOrphanedDocument(t,function(a,s){if(s<=e){var u=n.isPinned(t,a).next(function(e){if(!e)return r++,n.removeOrphanedDocument(t,a).next(function(t){i+=t})});o.push(u)}}).next(function(){return kn.waitFor(o)}).next(function(){return n.db.getRemoteDocumentCache().updateSize(t,-i)}).next(function(){return r})},t.prototype.removeOrphanedDocument=function(t,e){var n,r=0,i=this.db.getRemoteDocumentCache();return kn.waitFor([Un(t).delete((n=e,[0,vn(n.path)])),i.removeEntry(t,e).next(function(t){r+=t})]).next(function(){return r})},t.prototype.removeTarget=function(t,e){var n=e.copy({sequenceNumber:t.currentSequenceNumber});return this.db.getQueryCache().updateQueryData(t,n)},t.prototype.updateLimboDocument=function(t,e){return Ur(t,e)},t.prototype.forEachOrphanedDocument=function(t,e){var n,r=Un(t),i=ln.INVALID;return r.iterate({index:sr.documentTargetsIndex},function(t,r){var o=t[0],a=(t[1],r.path),s=r.sequenceNumber;0===o?(i!==ln.INVALID&&e(new ct(wn(n)),i),i=s,n=a):i=ln.INVALID}).next(function(){i!==ln.INVALID&&e(new ct(wn(n)),i)})},t.prototype.getCacheSize=function(t){return this.db.getRemoteDocumentCache().getSize(t)},t}();function Ur(t,e){return Un(t).put(function(t,e){return new sr(0,vn(t.path),e)}(e,t.currentSequenceNumber))}var jr=function(){function t(t,e){this.remoteDocumentCache=t,this.mutationQueue=e}return t.prototype.getDocument=function(t,e){var n=this;return this.mutationQueue.getAllMutationBatchesAffectingDocumentKey(t,e).next(function(r){return n.getDocumentInternal(t,e,r)})},t.prototype.getDocumentInternal=function(t,e,n){return this.remoteDocumentCache.getEntry(t,e).next(function(t){for(var r=0,i=n;r<i.length;r++){t=i[r].applyToLocalView(e,t)}return t})},t.prototype.getDocuments=function(t,e){var n=this;return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next(function(r){var i=[],o=we();return e.forEach(function(e){i.push(n.getDocumentInternal(t,e,r).next(function(t){t||(t=new ft(e,$t.forDeletedDoc())),o=o.insert(e,t)}))}),kn.waitFor(i).next(function(){return o})})},t.prototype.getDocumentsMatchingQuery=function(t,e){return ct.isDocumentKey(e.path)?this.getDocumentsMatchingDocumentQuery(t,e.path):this.getDocumentsMatchingCollectionQuery(t,e)},t.prototype.getDocumentsMatchingDocumentQuery=function(t,e){return this.getDocument(t,new ct(e)).next(function(t){var e=Te();return t instanceof ht&&(e=e.insert(t.key,t)),e})},t.prototype.getDocumentsMatchingCollectionQuery=function(t,e){var n,r=this;return this.remoteDocumentCache.getDocumentsMatchingQuery(t,e).next(function(i){return n=i,r.mutationQueue.getAllMutationBatchesAffectingQuery(t,e)}).next(function(t){for(var r=0,i=t;r<i.length;r++)for(var o=i[r],a=0,s=o.mutations;a<s.length;a++){var u=s[a],c=u.key;if(e.path.isImmediateParentOf(c.path)){var l=n.get(c),h=u.applyToLocalView(l,l,o.localWriteTime);n=h instanceof ht?n.insert(c,h):n.remove(c)}}}).next(function(){return n.forEach(function(t,r){e.matches(r)||(n=n.remove(t))}),n})},t}(),Vr=function(){function t(){this.refsByKey=new ee(Br.compareByKey),this.refsByTarget=new ee(Br.compareByTargetId)}return t.prototype.isEmpty=function(){return this.refsByKey.isEmpty()},t.prototype.addReference=function(t,e){var n=new Br(t,e);this.refsByKey=this.refsByKey.add(n),this.refsByTarget=this.refsByTarget.add(n)},t.prototype.addReferences=function(t,e){var n=this;t.forEach(function(t){return n.addReference(t,e)})},t.prototype.removeReference=function(t,e){this.removeRef(new Br(t,e))},t.prototype.removeReferences=function(t,e){var n=this;t.forEach(function(t){return n.removeReference(t,e)})},t.prototype.removeReferencesForId=function(t){var e=this,n=ct.EMPTY,r=new Br(n,t),i=new Br(n,t+1),o=[];return this.refsByTarget.forEachInRange([r,i],function(t){e.removeRef(t),o.push(t.key)}),o},t.prototype.removeAllReferences=function(){var t=this;this.refsByKey.forEach(function(e){return t.removeRef(e)})},t.prototype.removeRef=function(t){this.refsByKey=this.refsByKey.delete(t),this.refsByTarget=this.refsByTarget.delete(t)},t.prototype.referencesForId=function(t){var e=ct.EMPTY,n=new Br(e,t),r=new Br(e,t+1),i=Ne();return this.refsByTarget.forEachInRange([n,r],function(t){i=i.add(t.key)}),i},t.prototype.containsKey=function(t){var e=new Br(t,0),n=this.refsByKey.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)},t}(),Br=function(){function t(t,e){this.key=t,this.targetOrBatchId=e}return t.compareByKey=function(t,e){return ct.comparator(t.key,e.key)||H(t.targetOrBatchId,e.targetOrBatchId)},t.compareByTargetId=function(t,e){return H(t.targetOrBatchId,e.targetOrBatchId)||ct.comparator(t.key,e.key)},t}(),qr=function(){function t(t,e){this.persistence=t,this.localViewReferences=new Vr,this.queryDataByTarget={},g(t.started,"LocalStore was passed an unstarted persistence implementation"),this.persistence.referenceDelegate.setInMemoryPins(this.localViewReferences),this.mutationQueue=t.getMutationQueue(e),this.remoteDocuments=t.getRemoteDocumentCache(),this.queryCache=t.getQueryCache(),this.localDocuments=new jr(this.remoteDocuments,this.mutationQueue)}return t.prototype.handleUserChange=function(t){var e=this;return this.persistence.runTransaction("Handle user change","readonly",function(n){var r;return e.mutationQueue.getAllMutationBatches(n).next(function(i){return r=i,e.mutationQueue=e.persistence.getMutationQueue(t),e.localDocuments=new jr(e.remoteDocuments,e.mutationQueue),e.mutationQueue.getAllMutationBatches(n)}).next(function(t){for(var i=[],o=[],a=Ne(),s=0,u=r;s<u.length;s++){var c=u[s];i.push(c.batchId);for(var l=0,h=c.mutations;l<h.length;l++){var f=h[l];a=a.add(f.key)}}for(var p=0,d=t;p<d.length;p++){c=d[p];o.push(c.batchId);for(var y=0,m=c.mutations;y<m.length;y++){f=m[y];a=a.add(f.key)}}return e.localDocuments.getDocuments(n,a).next(function(t){return{affectedDocuments:t,removedBatchIds:i,addedBatchIds:o}})})})},t.prototype.localWrite=function(t){var e=this;return this.persistence.runTransaction("Locally write mutations","readwrite",function(n){var r,i=et.now();return e.mutationQueue.addMutationBatch(n,i,t).next(function(t){var i=(r=t).keys();return e.localDocuments.getDocuments(n,i)}).next(function(t){return{batchId:r.batchId,changes:t}})})},t.prototype.lookupMutationDocuments=function(t){var e=this;return this.persistence.runTransaction("Lookup mutation documents","readonly",function(n){return e.mutationQueue.lookupMutationKeys(n,t).next(function(t){return t?e.localDocuments.getDocuments(n,t):kn.resolve(null)})})},t.prototype.acknowledgeBatch=function(t){var e=this;return this.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(n){var r=t.batch.keys(),i=e.remoteDocuments.newChangeBuffer();return e.mutationQueue.acknowledgeBatch(n,t.batch,t.streamToken).next(function(){return e.applyWriteToRemoteDocuments(n,t,i)}).next(function(){return i.apply(n)}).next(function(){return e.mutationQueue.performConsistencyCheck(n)}).next(function(){return e.localDocuments.getDocuments(n,r)})})},t.prototype.rejectBatch=function(t){var e=this;return this.persistence.runTransaction("Reject batch","readwrite-primary",function(n){var r;return e.mutationQueue.lookupMutationBatch(n,t).next(function(t){return g(null!==t,"Attempt to reject nonexistent batch!"),r=t.keys(),e.mutationQueue.removeMutationBatch(n,t)}).next(function(){return e.mutationQueue.performConsistencyCheck(n)}).next(function(){return e.localDocuments.getDocuments(n,r)})})},t.prototype.getLastStreamToken=function(){var t=this;return this.persistence.runTransaction("Get last stream token","readonly",function(e){return t.mutationQueue.getLastStreamToken(e)})},t.prototype.setLastStreamToken=function(t){var e=this;return this.persistence.runTransaction("Set last stream token","readwrite-primary",function(n){return e.mutationQueue.setLastStreamToken(n,t)})},t.prototype.getLastRemoteSnapshotVersion=function(){var t=this;return this.persistence.runTransaction("Get last remote snapshot version","readonly",function(e){return t.queryCache.getLastRemoteSnapshotVersion(e)})},t.prototype.applyRemoteEvent=function(e){var n=this,r=this.remoteDocuments.newChangeBuffer();return this.persistence.runTransaction("Apply remote event","readwrite-primary",function(i){var o=[],a=Ne();C(e.targetChanges,function(r,s){var u=n.queryDataByTarget[r];if(u){s.addedDocuments.forEach(function(t){a=a.add(t)}),s.modifiedDocuments.forEach(function(t){a=a.add(t)}),o.push(n.queryCache.removeMatchingKeys(i,s.removedDocuments,r).next(function(){return n.queryCache.addMatchingKeys(i,s.addedDocuments,r)}));var c=s.resumeToken;if(c.length>0){var l=u;u=u.copy({resumeToken:c,snapshotVersion:e.snapshotVersion}),n.queryDataByTarget[r]=u,t.shouldPersistQueryData(l,u,s)&&o.push(n.queryCache.updateQueryData(i,u))}}});var s=Ne();e.documentUpdates.forEach(function(t,u){s=s.add(t),o.push(r.getEntry(i,t).next(function(e){null==e||u.version.isEqual($t.MIN)||a.has(u.key)&&!e.hasPendingWrites||u.version.compareTo(e.version)>=0?r.addEntry(u):p("LocalStore","Ignoring outdated watch update for ",t,". Current version:",e.version," Watch version:",u.version)})),e.resolvedLimboDocuments.has(t)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(i,t))});var u=e.snapshotVersion;if(!u.isEqual($t.MIN)){var c=n.queryCache.getLastRemoteSnapshotVersion(i).next(function(t){return g(u.compareTo(t)>=0,"Watch stream reverted to previous snapshot?? "+u+" < "+t),n.queryCache.setTargetsMetadata(i,i.currentSequenceNumber,u)});o.push(c)}return kn.waitFor(o).next(function(){return r.apply(i)}).next(function(){return n.localDocuments.getDocuments(i,s)})})},t.shouldPersistQueryData=function(t,e,n){return 0!==e.resumeToken.length&&(0===t.resumeToken.length||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=this.RESUME_TOKEN_MAX_AGE_MICROS||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0))},t.prototype.notifyLocalViewChanges=function(t){var e=this;return this.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(n){return kn.forEach(t,function(t){return e.localViewReferences.addReferences(t.addedKeys,t.targetId),e.localViewReferences.removeReferences(t.removedKeys,t.targetId),kn.forEach(t.removedKeys,function(t){return e.persistence.referenceDelegate.removeReference(n,t)})})})},t.prototype.nextMutationBatch=function(t){var e=this;return this.persistence.runTransaction("Get next mutation batch","readonly",function(n){return void 0===t&&(t=Tn),e.mutationQueue.getNextMutationBatchAfterBatchId(n,t)})},t.prototype.readDocument=function(t){var e=this;return this.persistence.runTransaction("read document","readonly",function(n){return e.localDocuments.getDocument(n,t)})},t.prototype.allocateQuery=function(t){var e=this;return this.persistence.runTransaction("Allocate query","readwrite",function(n){var r;return e.queryCache.getQueryData(n,t).next(function(i){return i?(r=i,kn.resolve()):e.queryCache.allocateTargetId(n).next(function(i){return r=new te(t,i,Vt.Listen,n.currentSequenceNumber),e.queryCache.addQueryData(n,r)})}).next(function(){return g(!e.queryDataByTarget[r.targetId],"Tried to allocate an already allocated query: "+t),e.queryDataByTarget[r.targetId]=r,r})})},t.prototype.releaseQuery=function(t,e){var n=this,r=e?"readwrite":"readwrite-primary";return this.persistence.runTransaction("Release query",r,function(r){return n.queryCache.getQueryData(r,t).next(function(i){g(null!=i,"Tried to release nonexistent query: "+t);var o=i.targetId,a=n.queryDataByTarget[o],s=n.localViewReferences.removeReferencesForId(o);return delete n.queryDataByTarget[o],e?kn.resolve():kn.forEach(s,function(t){return n.persistence.referenceDelegate.removeReference(r,t)}).next(function(){return n.persistence.referenceDelegate.removeTarget(r,a)})})})},t.prototype.executeQuery=function(t){var e=this;return this.persistence.runTransaction("Execute query","readonly",function(n){return e.localDocuments.getDocumentsMatchingQuery(n,t)})},t.prototype.remoteDocumentKeys=function(t){var e=this;return this.persistence.runTransaction("Remote document keys","readonly",function(n){return e.queryCache.getMatchingKeysForTargetId(n,t)})},t.prototype.getActiveClients=function(){return this.persistence.getActiveClients()},t.prototype.removeCachedMutationBatchMetadata=function(t){this.mutationQueue.removeCachedMutationKeys(t)},t.prototype.setNetworkEnabled=function(t){this.persistence.setNetworkEnabled(t)},t.prototype.applyWriteToRemoteDocuments=function(t,e,n){var r=this,i=e.batch,o=i.keys(),a=kn.resolve();return o.forEach(function(r){a=a.next(function(){return n.getEntry(t,r)}).next(function(t){var o=t,a=e.docVersions.get(r);g(null!==a,"ackVersions should contain every doc in the write."),(!o||o.version.compareTo(a)<0)&&((o=i.applyToRemoteDocument(r,o,e))?n.addEntry(o):g(!t,"Mutation batch "+i+" applied to document "+t+" resulted in null"))})}),a.next(function(){return r.mutationQueue.removeMutationBatch(t,i)})},t.prototype.collectGarbage=function(t){var e=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(n){return t.collect(n,e.queryDataByTarget)})},t.prototype.getQueryForTarget=function(t){var e=this;return this.queryDataByTarget[t]?Promise.resolve(this.queryDataByTarget[t].query):this.persistence.runTransaction("Get query data","readonly",function(n){return e.queryCache.getQueryDataForTarget(n,t).next(function(t){return t?t.query:null})})},t.prototype.getNewDocumentChanges=function(){var t=this;return this.persistence.runTransaction("Get new document changes","readonly",function(e){return t.remoteDocuments.getNewDocumentChanges(e)})},t.RESUME_TOKEN_MAX_AGE_MICROS=3e8,t}(),Wr=function(){function t(t){this.referenceDelegate=t,this.mutationQueue=[],this.nextBatchId=1,this.highestAcknowledgedBatchId=Tn,this.lastStreamToken=b(),this.batchesByDocumentKey=new ee(Br.compareByKey)}return t.prototype.checkEmpty=function(t){return kn.resolve(0===this.mutationQueue.length)},t.prototype.acknowledgeBatch=function(t,e,n){var r=e.batchId;g(r>this.highestAcknowledgedBatchId,"Mutation batchIDs must be acknowledged in order");var i=this.indexOfExistingBatchId(r,"acknowledged");g(0===i,"Can only acknowledge the first batch in the mutation queue");var o=this.mutationQueue[i];return g(r===o.batchId,"Queue ordering failure: expected batch "+r+", got batch "+o.batchId),this.highestAcknowledgedBatchId=r,this.lastStreamToken=n,kn.resolve()},t.prototype.getLastStreamToken=function(t){return kn.resolve(this.lastStreamToken)},t.prototype.setLastStreamToken=function(t,e){return this.lastStreamToken=e,kn.resolve()},t.prototype.addMutationBatch=function(t,e,n){g(0!==n.length,"Mutation batches should not be empty");var r=this.nextBatchId;(this.nextBatchId++,this.mutationQueue.length>0)&&g(this.mutationQueue[this.mutationQueue.length-1].batchId<r,"Mutation batchIDs must be monotonically increasing order");var i=new Sn(r,e,n);this.mutationQueue.push(i);for(var o=0,a=n;o<a.length;o++){var s=a[o];this.batchesByDocumentKey=this.batchesByDocumentKey.add(new Br(s.key,r))}return kn.resolve(i)},t.prototype.lookupMutationBatch=function(t,e){return kn.resolve(this.findMutationBatch(e))},t.prototype.lookupMutationKeys=function(t,e){var n=this.findMutationBatch(e);return g(null!=n,"Failed to find local mutation batch."),kn.resolve(n.keys())},t.prototype.getNextMutationBatchAfterBatchId=function(t,e){var n=Math.max(e,this.highestAcknowledgedBatchId)+1,r=this.indexOfBatchId(n),i=r<0?0:r;return kn.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)},t.prototype.getAllMutationBatches=function(t){return kn.resolve(this.mutationQueue.slice())},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=new Br(e,0),i=new Br(e,Number.POSITIVE_INFINITY),o=[];return this.batchesByDocumentKey.forEachInRange([r,i],function(t){g(e.isEqual(t.key),"Should only iterate over a single key's batches");var r=n.findMutationBatch(t.targetOrBatchId);g(null!==r,"Batches in the index must exist in the main table"),o.push(r)}),kn.resolve(o)},t.prototype.getAllMutationBatchesAffectingDocumentKeys=function(t,e){var n=this,r=new ee(H);return e.forEach(function(t){var e=new Br(t,0),i=new Br(t,Number.POSITIVE_INFINITY);n.batchesByDocumentKey.forEachInRange([e,i],function(e){g(t.isEqual(e.key),"For each key, should only iterate over a single key's batches"),r=r.add(e.targetOrBatchId)})}),kn.resolve(this.findMutationBatches(r))},t.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=e.path,r=n.length+1,i=n;ct.isDocumentKey(i)||(i=i.child(""));var o=new Br(new ct(i),0),a=new ee(H);return this.batchesByDocumentKey.forEachWhile(function(t){var e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(a=a.add(t.targetOrBatchId)),!0)},o),kn.resolve(this.findMutationBatches(a))},t.prototype.findMutationBatches=function(t){var e=this,n=[];return t.forEach(function(t){var r=e.findMutationBatch(t);null!==r&&n.push(r)}),n},t.prototype.removeMutationBatch=function(t,e){var n=this;g(0===this.indexOfExistingBatchId(e.batchId,"removed"),"Can only remove the first entry of the mutation queue"),this.mutationQueue.shift();var r=this.batchesByDocumentKey;return kn.forEach(e.mutations,function(i){var o=new Br(i.key,e.batchId);return r=r.delete(o),n.referenceDelegate.removeMutationReference(t,i.key)}).next(function(){n.batchesByDocumentKey=r})},t.prototype.removeCachedMutationKeys=function(t){},t.prototype.containsKey=function(t,e){var n=new Br(e,0),r=this.batchesByDocumentKey.firstAfterOrEqual(n);return kn.resolve(e.isEqual(r&&r.key))},t.prototype.performConsistencyCheck=function(t){return 0===this.mutationQueue.length&&g(this.batchesByDocumentKey.isEmpty(),"Document leak -- detected dangling mutation references when queue is empty."),kn.resolve()},t.prototype.indexOfExistingBatchId=function(t,e){var n=this.indexOfBatchId(t);return g(n>=0&&n<this.mutationQueue.length,"Batches must exist to be "+e),n},t.prototype.indexOfBatchId=function(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId},t.prototype.findMutationBatch=function(t){var e=this.indexOfBatchId(t);if(e<0||e>=this.mutationQueue.length)return null;var n=this.mutationQueue[e];return g(n.batchId===t,"If found batch must match"),n},t}(),Kr=function(){function t(t){this.persistence=t,this.queries=new jn(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=$t.MIN,this.highestTargetId=0,this.highestSequenceNumber=0,this.references=new Vr,this.targetCount=0,this.targetIdGenerator=Nn.forQueryCache()}return t.prototype.getTargetCount=function(t){return kn.resolve(this.targetCount)},t.prototype.forEachTarget=function(t,e){return this.queries.forEach(function(t,n){return e(n)}),kn.resolve()},t.prototype.getLastRemoteSnapshotVersion=function(t){return kn.resolve(this.lastRemoteSnapshotVersion)},t.prototype.getHighestSequenceNumber=function(t){return kn.resolve(this.highestSequenceNumber)},t.prototype.allocateTargetId=function(t){var e=this.targetIdGenerator.after(this.highestTargetId);return this.highestTargetId=e,kn.resolve(e)},t.prototype.setTargetsMetadata=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.highestSequenceNumber&&(this.highestSequenceNumber=e),kn.resolve()},t.prototype.saveQueryData=function(t){this.queries.set(t.query,t);var e=t.targetId;e>this.highestTargetId&&(this.highestTargetId=e),t.sequenceNumber>this.highestSequenceNumber&&(this.highestSequenceNumber=t.sequenceNumber)},t.prototype.addQueryData=function(t,e){return g(!this.queries.has(e.query),"Adding a query that already exists"),this.saveQueryData(e),this.targetCount+=1,kn.resolve()},t.prototype.updateQueryData=function(t,e){return g(this.queries.has(e.query),"Updating a non-existent query"),this.saveQueryData(e),kn.resolve()},t.prototype.removeQueryData=function(t,e){return g(this.targetCount>0,"Removing a target from an empty cache"),g(this.queries.has(e.query),"Removing a non-existent target from the cache"),this.queries.delete(e.query),this.references.removeReferencesForId(e.targetId),this.targetCount-=1,kn.resolve()},t.prototype.removeTargets=function(t,e,n){var r=this,i=0,o=[];return this.queries.forEach(function(a,s){s.sequenceNumber<=e&&!n[s.targetId]&&(r.queries.delete(a),o.push(r.removeMatchingKeysForTargetId(t,s.targetId)),i++)}),kn.waitFor(o).next(function(){return i})},t.prototype.getQueryCount=function(t){return kn.resolve(this.targetCount)},t.prototype.getQueryData=function(t,e){var n=this.queries.get(e)||null;return kn.resolve(n)},t.prototype.getQueryDataForTarget=function(t,e){return m("Not yet implemented.")},t.prototype.addMatchingKeys=function(t,e,n){this.references.addReferences(e,n);var r=this.persistence.referenceDelegate,i=[];return r&&e.forEach(function(e){i.push(r.addReference(t,e))}),kn.waitFor(i)},t.prototype.removeMatchingKeys=function(t,e,n){this.references.removeReferences(e,n);var r=this.persistence.referenceDelegate,i=[];return r&&e.forEach(function(e){i.push(r.removeReference(t,e))}),kn.waitFor(i)},t.prototype.removeMatchingKeysForTargetId=function(t,e){return this.references.removeReferencesForId(e),kn.resolve()},t.prototype.getMatchingKeysForTargetId=function(t,e){var n=this.references.referencesForId(e);return kn.resolve(n)},t.prototype.containsKey=function(t,e){return kn.resolve(this.references.containsKey(e))},t}();var Qr,Hr=function(){function t(t){this.sizer=t,this.docs=new dt(ct.comparator),this.newDocumentChanges=Ne(),this.size=0}return t.prototype.addEntries=function(t,e,n){for(var r=0,i=e;r<i.length;r++){var o=i[r],a=o.maybeDocument.key;this.docs=this.docs.insert(a,o),this.newDocumentChanges=this.newDocumentChanges.add(a)}return this.size+=n,kn.resolve()},t.prototype.removeEntry=function(t,e){var n=this.docs.get(e);return n?(this.docs=this.docs.remove(e),this.size-=n.size,kn.resolve(n.size)):kn.resolve(0)},t.prototype.getEntry=function(t,e){var n=this.docs.get(e);return kn.resolve(n?n.maybeDocument:null)},t.prototype.getSizedEntry=function(t,e){return kn.resolve(this.docs.get(e))},t.prototype.getDocumentsMatchingQuery=function(t,e){for(var n=Te(),r=new ct(e.path.child("")),i=this.docs.getIteratorFrom(r);i.hasNext();){var o=i.getNext(),a=o.key,s=o.value.maybeDocument;if(!e.path.isPrefixOf(a.path))break;s instanceof ht&&e.matches(s)&&(n=n.insert(s.key,s))}return kn.resolve(n)},t.prototype.forEachDocumentKey=function(t,e){return kn.forEach(this.docs,function(t){return e(t)})},t.prototype.getNewDocumentChanges=function(t){var e=this,n=we();return this.newDocumentChanges.forEach(function(t){var r=e.docs.get(t),i=r?r.maybeDocument:new ft(t,$t.forDeletedDoc());n=n.insert(t,i)}),this.newDocumentChanges=Ne(),kn.resolve(n)},t.prototype.newChangeBuffer=function(){return new zr(this.sizer,this)},t.prototype.getSize=function(t){return kn.resolve(this.size)},t}(),zr=function(t){function e(e,n){var r=t.call(this)||this;return r.sizer=e,r.documentCache=n,r}return s.__extends(e,t),e.prototype.applyChanges=function(t){var e=this,n=this.assertChanges(),r=0,i=[];return n.forEach(function(t,n){var o=e.documentSizes.get(t);g(void 0!==o,"Attempting to change document "+t.toString()+" without having read it first");var a=e.sizer(n);r+=a-o,i.push({maybeDocument:n,size:a})}),this.documentCache.addEntries(t,i,r)},e.prototype.getFromCache=function(t,e){return this.documentCache.getSizedEntry(t,e)},e}(Vn),Gr=function(){function t(t,e){var n=this;this.clientId=t,this.mutationQueues={},this.listenSequence=new ln(0),this._started=!1,this._started=!0,this.referenceDelegate=e(this),this.queryCache=new Kr(this);this.remoteDocumentCache=new Hr(function(t){return n.referenceDelegate.documentSize(t)})}return t.createLruPersistence=function(e,n,r){return new t(e,function(t){return new Jr(t,new _r(n),r)})},t.createEagerPersistence=function(e){return new t(e,function(t){return new Xr(t)})},t.prototype.shutdown=function(t){return this._started=!1,Promise.resolve()},Object.defineProperty(t.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),t.prototype.getActiveClients=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){return[2,[this.clientId]]})})},t.prototype.setPrimaryStateListener=function(t){return t(!0)},t.prototype.setNetworkEnabled=function(t){},t.prototype.getMutationQueue=function(t){var e=this.mutationQueues[t.toKey()];return e||(e=new Wr(this.referenceDelegate),this.mutationQueues[t.toKey()]=e),e},t.prototype.getQueryCache=function(){return this.queryCache},t.prototype.getRemoteDocumentCache=function(){return this.remoteDocumentCache},t.prototype.runTransaction=function(t,e,n){var r=this;p("MemoryPersistence","Starting transaction:",t);var i=new Yr(this.listenSequence.next());return this.referenceDelegate.onTransactionStarted(),n(i).next(function(t){return r.referenceDelegate.onTransactionCommitted(i).next(function(){return t})}).toPromise()},t.prototype.mutationQueuesContainKey=function(t,e){return kn.or(function(t){var e=[];return I(t,function(t,n){return e.push(n)}),e}(this.mutationQueues).map(function(n){return function(){return n.containsKey(t,e)}}))},t}(),Yr=function(){return function(t){this.currentSequenceNumber=t}}(),Xr=function(){function t(t){this.persistence=t}return t.prototype.setInMemoryPins=function(t){this.inMemoryPins=t},t.prototype.addReference=function(t,e){return this.orphanedDocuments.delete(e),kn.resolve()},t.prototype.removeReference=function(t,e){return this.orphanedDocuments.add(e),kn.resolve()},t.prototype.removeMutationReference=function(t,e){return this.orphanedDocuments.add(e),kn.resolve()},t.prototype.removeTarget=function(t,e){var n=this,r=this.persistence.getQueryCache();return r.getMatchingKeysForTargetId(t,e.targetId).next(function(t){t.forEach(function(t){return n.orphanedDocuments.add(t)})}).next(function(){return r.removeQueryData(t,e)})},t.prototype.onTransactionStarted=function(){this.orphanedDocuments=new Set},t.prototype.onTransactionCommitted=function(t){var e=this,n=this.persistence.getRemoteDocumentCache();return kn.forEach(this.orphanedDocuments,function(r){return e.isReferenced(t,r).next(function(e){return e?kn.resolve():n.removeEntry(t,r).next(function(){})})})},t.prototype.updateLimboDocument=function(t,e){var n=this;return this.isReferenced(t,e).next(function(t){t?n.orphanedDocuments.delete(e):n.orphanedDocuments.add(e)})},t.prototype.documentSize=function(t){return 0},t.prototype.isReferenced=function(t,e){var n=this;return kn.or([function(){return n.persistence.getQueryCache().containsKey(t,e)},function(){return n.persistence.mutationQueuesContainKey(t,e)},function(){return kn.resolve(n.inMemoryPins.containsKey(e))}])},t}(),Jr=function(){function t(t,e,n){this.persistence=t,this.serializer=e,this.orphanedSequenceNumbers=new jn(function(t){return vn(t.path)}),this.garbageCollector=new Ir(this,n)}return t.prototype.onTransactionStarted=function(){},t.prototype.onTransactionCommitted=function(t){return kn.resolve()},t.prototype.forEachTarget=function(t,e){return this.persistence.getQueryCache().forEachTarget(t,e)},t.prototype.getSequenceNumberCount=function(t){var e=this.orphanedDocumentCount(t);return this.persistence.getQueryCache().getTargetCount(t).next(function(t){return e.next(function(e){return t+e})})},t.prototype.orphanedDocumentCount=function(t){var e=0;return this.forEachOrphanedDocumentSequenceNumber(t,function(t){e++}).next(function(){return e})},t.prototype.forEachOrphanedDocumentSequenceNumber=function(t,e){var n=this;return kn.forEach(this.orphanedSequenceNumbers,function(r,i){return n.isPinned(t,r,i).next(function(t){return t?kn.resolve():e(i)})})},t.prototype.setInMemoryPins=function(t){this.inMemoryPins=t},t.prototype.removeTargets=function(t,e,n){return this.persistence.getQueryCache().removeTargets(t,e,n)},t.prototype.removeOrphanedDocuments=function(t,e){var n=this,r=0,i=this.persistence.getRemoteDocumentCache();return i.forEachDocumentKey(t,function(o){return n.isPinned(t,o,e).next(function(e){return e?kn.resolve():(r++,i.removeEntry(t,o).next())})}).next(function(){return r})},t.prototype.removeMutationReference=function(t,e){return this.orphanedSequenceNumbers.set(e,t.currentSequenceNumber),kn.resolve()},t.prototype.removeTarget=function(t,e){var n=e.copy({sequenceNumber:t.currentSequenceNumber});return this.persistence.getQueryCache().updateQueryData(t,n)},t.prototype.addReference=function(t,e){return this.orphanedSequenceNumbers.set(e,t.currentSequenceNumber),kn.resolve()},t.prototype.removeReference=function(t,e){return this.orphanedSequenceNumbers.set(e,t.currentSequenceNumber),kn.resolve()},t.prototype.updateLimboDocument=function(t,e){return this.orphanedSequenceNumbers.set(e,t.currentSequenceNumber),kn.resolve()},t.prototype.documentSize=function(t){var e,n=this.serializer.toDbRemoteDocument(t);if(n.document)e=n.document;else if(n.unknownDocument)e=n.unknownDocument;else{if(!n.noDocument)throw m("Unknown remote document type");e=n.noDocument}return JSON.stringify(e).length},t.prototype.isPinned=function(t,e,n){var r=this;return kn.or([function(){return r.persistence.mutationQueuesContainKey(t,e)},function(){return kn.resolve(r.inMemoryPins.containsKey(e))},function(){return r.persistence.getQueryCache().containsKey(t,e)},function(){var t=r.orphanedSequenceNumbers.get(e);return kn.resolve(void 0!==t&&t>n)}])},t.prototype.getCacheSize=function(t){return this.persistence.getRemoteDocumentCache().getSize(t)},t}(),$r=function(){function t(t,e,n,r,i){this.queue=t,this.timerId=e,this.initialDelayMs=n,this.backoffFactor=r,this.maxDelayMs=i,this.timerPromise=null,this.lastAttemptTime=Date.now(),this.reset()}return t.prototype.reset=function(){this.currentBaseMs=0},t.prototype.resetToMax=function(){this.currentBaseMs=this.maxDelayMs},t.prototype.backoffAndRun=function(t){var e=this;this.cancel();var n=Math.floor(this.currentBaseMs+this.jitterDelayMs()),r=Math.max(0,Date.now()-this.lastAttemptTime),i=Math.max(0,n-r);this.currentBaseMs>0&&p("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.currentBaseMs+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.timerPromise=this.queue.enqueueAfterDelay(this.timerId,i,function(){return e.lastAttemptTime=Date.now(),t()}),this.currentBaseMs*=this.backoffFactor,this.currentBaseMs<this.initialDelayMs&&(this.currentBaseMs=this.initialDelayMs),this.currentBaseMs>this.maxDelayMs&&(this.currentBaseMs=this.maxDelayMs)},t.prototype.cancel=function(){null!==this.timerPromise&&(this.timerPromise.cancel(),this.timerPromise=null)},t.prototype.jitterDelayMs=function(){return(Math.random()-.5)*this.currentBaseMs},t}();!function(t){t[t.Initial=0]="Initial",t[t.Starting=1]="Starting",t[t.Open=2]="Open",t[t.Error=3]="Error",t[t.Backoff=4]="Backoff"}(Qr||(Qr={}));var Zr,ti,ei=1e3,ni=6e4,ri=1.5,ii=function(){function t(t,e,n,r,i,o){this.queue=t,this.idleTimerId=n,this.connection=r,this.credentialsProvider=i,this.listener=o,this.state=Qr.Initial,this.closeCount=0,this.idleTimer=null,this.stream=null,this.backoff=new $r(t,e,ei,ri,ni)}return t.prototype.isStarted=function(){return this.state===Qr.Starting||this.state===Qr.Open||this.state===Qr.Backoff},t.prototype.isOpen=function(){return this.state===Qr.Open},t.prototype.start=function(){this.state!==Qr.Error?(g(this.state===Qr.Initial,"Already started"),this.auth()):this.performBackoff()},t.prototype.stop=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){switch(t.label){case 0:return this.isStarted()?[4,this.close(Qr.Initial)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},t.prototype.inhibitBackoff=function(){g(!this.isStarted(),"Can only inhibit backoff in a stopped state"),this.state=Qr.Initial,this.backoff.reset()},t.prototype.markIdle=function(){var t=this;this.isOpen()&&null===this.idleTimer&&(this.idleTimer=this.queue.enqueueAfterDelay(this.idleTimerId,6e4,function(){return t.handleIdleCloseTimer()}))},t.prototype.sendRequest=function(t){this.cancelIdleCheck(),this.stream.send(t)},t.prototype.handleIdleCloseTimer=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){return this.isOpen()?[2,this.close(Qr.Initial)]:[2]})})},t.prototype.cancelIdleCheck=function(){this.idleTimer&&(this.idleTimer.cancel(),this.idleTimer=null)},t.prototype.close=function(t,e){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(n){switch(n.label){case 0:return g(this.isStarted(),"Only started streams should be closed."),g(t===Qr.Error||Ut(e),"Can't provide an error when not in an error state."),this.cancelIdleCheck(),this.backoff.cancel(),this.closeCount++,t!==Qr.Error?this.backoff.reset():e&&e.code===_.RESOURCE_EXHAUSTED?(d(e.toString()),d("Using maximum backoff delay to prevent overloading the backend."),this.backoff.resetToMax()):e&&e.code===_.UNAUTHENTICATED&&this.credentialsProvider.invalidateToken(),null!==this.stream&&(this.tearDown(),this.stream.close(),this.stream=null),this.state=t,[4,this.listener.onClose(e)];case 1:return n.sent(),[2]}})})},t.prototype.tearDown=function(){},t.prototype.auth=function(){var t=this;g(this.state===Qr.Initial,"Must be in initial state to auth"),this.state=Qr.Starting;var e=this.getCloseGuardedDispatcher(this.closeCount),n=this.closeCount;this.credentialsProvider.getToken().then(function(e){t.closeCount===n&&t.startStream(e)},function(n){e(function(){var e=new w(_.UNKNOWN,"Fetching auth token failed: "+n.message);return t.handleStreamClose(e)})})},t.prototype.startStream=function(t){var e=this;g(this.state===Qr.Starting,"Trying to start stream in a non-starting state");var n=this.getCloseGuardedDispatcher(this.closeCount);this.stream=this.startRpc(t),this.stream.onOpen(function(){n(function(){return g(e.state===Qr.Starting,"Expected stream to be in state Starting, but was "+e.state),e.state=Qr.Open,e.listener.onOpen()})}),this.stream.onClose(function(t){n(function(){return e.handleStreamClose(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},t.prototype.performBackoff=function(){var t=this;g(this.state===Qr.Error,"Should only perform backoff when in Error state"),this.state=Qr.Backoff,this.backoff.backoffAndRun(function(){return s.__awaiter(t,void 0,void 0,function(){return s.__generator(this,function(t){return g(this.state===Qr.Backoff,"Backoff elapsed but state is now: "+this.state),this.state=Qr.Initial,this.start(),g(this.isStarted(),"PersistentStream should have started"),[2]})})})},t.prototype.handleStreamClose=function(t){return g(this.isStarted(),"Can't handle server close on non-started stream"),p("PersistentStream","close with error: "+t),this.stream=null,this.close(Qr.Error,t)},t.prototype.getCloseGuardedDispatcher=function(t){var e=this;return function(n){e.queue.enqueueAndForget(function(){return e.closeCount===t?n():(p("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},t}(),oi=function(t){function e(e,n,r,i,o){var a=t.call(this,e,cn.ListenStreamConnectionBackoff,cn.ListenStreamIdle,n,r,o)||this;return a.serializer=i,a}return s.__extends(e,t),e.prototype.startRpc=function(t){return this.connection.openStream("Listen",t)},e.prototype.onMessage=function(t){this.backoff.reset();var e=this.serializer.fromWatchChange(t),n=this.serializer.versionFromListenResponse(t);return this.listener.onWatchChange(e,n)},e.prototype.watch=function(t){var e={};e.database=this.serializer.encodedDatabaseId,e.addTarget=this.serializer.toTarget(t);var n=this.serializer.toListenRequestLabels(t);n&&(e.labels=n),this.sendRequest(e)},e.prototype.unwatch=function(t){var e={};e.database=this.serializer.encodedDatabaseId,e.removeTarget=t,this.sendRequest(e)},e}(ii),ai=function(t){function e(e,n,r,i,o){var a=t.call(this,e,cn.WriteStreamConnectionBackoff,cn.WriteStreamIdle,n,r,o)||this;return a.serializer=i,a.handshakeComplete_=!1,a}return s.__extends(e,t),Object.defineProperty(e.prototype,"handshakeComplete",{get:function(){return this.handshakeComplete_},enumerable:!0,configurable:!0}),e.prototype.start=function(){this.handshakeComplete_=!1,t.prototype.start.call(this)},e.prototype.tearDown=function(){this.handshakeComplete_&&this.writeMutations([])},e.prototype.startRpc=function(t){return this.connection.openStream("Write",t)},e.prototype.onMessage=function(t){if(g(!!t.streamToken,"Got a write response without a stream token"),this.lastStreamToken=t.streamToken,this.handshakeComplete_){this.backoff.reset();var e=this.serializer.fromWriteResults(t.writeResults,t.commitTime),n=this.serializer.fromVersion(t.commitTime);return this.listener.onMutationResult(n,e)}return g(!t.writeResults||0===t.writeResults.length,"Got mutation results for handshake"),this.handshakeComplete_=!0,this.listener.onHandshakeComplete()},e.prototype.writeHandshake=function(){g(this.isOpen(),"Writing handshake requires an opened stream"),g(!this.handshakeComplete_,"Handshake already completed");var t={};t.database=this.serializer.encodedDatabaseId,this.sendRequest(t)},e.prototype.writeMutations=function(t){var e=this;g(this.isOpen(),"Writing mutations requires an opened stream"),g(this.handshakeComplete_,"Handshake must be complete before writing mutations"),g(this.lastStreamToken.length>0,"Trying to write mutation without a token");var n={streamToken:this.lastStreamToken,writes:t.map(function(t){return e.serializer.toMutation(t)})};this.sendRequest(n)},e}(ii),si=function(){function t(t,e,n,r){this.queue=t,this.connection=e,this.credentials=n,this.serializer=r}return t.prototype.newPersistentWriteStream=function(t){return new ai(this.queue,this.connection,this.credentials,this.serializer,t)},t.prototype.newPersistentWatchStream=function(t){return new oi(this.queue,this.connection,this.credentials,this.serializer,t)},t.prototype.commit=function(t){var e=this,n={database:this.serializer.encodedDatabaseId,writes:t.map(function(t){return e.serializer.toMutation(t)})};return this.invokeRPC("Commit",n).then(function(t){return e.serializer.fromWriteResults(t.writeResults,t.commitTime)})},t.prototype.lookup=function(t){var e=this,n={database:this.serializer.encodedDatabaseId,documents:t.map(function(t){return e.serializer.toName(t)})};return this.invokeStreamingRPC("BatchGetDocuments",n).then(function(n){var r=we();n.forEach(function(t){var n=e.serializer.fromMaybeDocument(t);r=r.insert(n.key,n)});var i=[];return t.forEach(function(t){var e=r.get(t);g(!!e,"Missing entity in write response for "+t),i.push(e)}),i})},t.prototype.invokeRPC=function(t,e){var n=this;return this.credentials.getToken().then(function(r){return n.connection.invokeRPC(t,e,r)}).catch(function(t){throw t.code===_.UNAUTHENTICATED&&n.credentials.invalidateToken(),t})},t.prototype.invokeStreamingRPC=function(t,e){var n=this;return this.credentials.getToken().then(function(r){return n.connection.invokeStreamingRPC(t,e,r)}).catch(function(t){throw t.code===_.UNAUTHENTICATED&&n.credentials.invalidateToken(),t})},t}(),ui=function(){function t(t){this.datastore=t,this.readVersions=Ce(),this.mutations=[],this.committed=!1}return t.prototype.recordVersion=function(t){var e;if(t instanceof ht)e=t.version;else{if(!(t instanceof ft))throw m("Document in a transaction was a "+t.constructor.name);e=$t.forDeletedDoc()}var n=this.readVersions.get(t.key);if(null!==n){if(!e.isEqual(n))throw new w(_.ABORTED,"Document version changed between two reads.")}else this.readVersions=this.readVersions.insert(t.key,e)},t.prototype.lookup=function(t){var e=this;return this.committed?Promise.reject("Transaction has already completed."):this.mutations.length>0?Promise.reject("Transactions lookups are invalid after writes."):this.datastore.lookup(t).then(function(t){return t.forEach(function(t){t instanceof ft||t instanceof ht?e.recordVersion(t):m("Document in a transaction was a "+t.constructor.name)}),t})},t.prototype.write=function(t){if(this.committed)throw new w(_.FAILED_PRECONDITION,"Transaction has already completed.");this.mutations=this.mutations.concat(t)},t.prototype.precondition=function(t){var e=this.readVersions.get(t);return e?oe.updateTime(e):oe.NONE},t.prototype.preconditionForUpdate=function(t){var e=this.readVersions.get(t);if(e&&e.isEqual($t.forDeletedDoc()))throw new w(_.FAILED_PRECONDITION,"Can't update a document that doesn't exist.");return e?oe.updateTime(e):oe.exists(!0)},t.prototype.set=function(t,e){this.write(e.toMutations(t,this.precondition(t)))},t.prototype.update=function(t,e){this.write(e.toMutations(t,this.preconditionForUpdate(t)))},t.prototype.delete=function(t){this.write([new le(t,this.precondition(t))]),this.readVersions=this.readVersions.insert(t,$t.forDeletedDoc())},t.prototype.commit=function(){var t=this,e=this.readVersions;return this.mutations.forEach(function(t){e=e.remove(t.key)}),e.isEmpty()?this.datastore.commit(this.mutations).then(function(){t.committed=!0}):Promise.reject(Error("Every document read in a transaction must also be written."))},t}();!function(t){t[t.Unknown=0]="Unknown",t[t.Online=1]="Online",t[t.Offline=2]="Offline"}(Zr||(Zr={})),function(t){t[t.RemoteStore=0]="RemoteStore",t[t.SharedClientState=1]="SharedClientState"}(ti||(ti={}));var ci=function(){function t(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state=Zr.Unknown,this.watchStreamFailures=0,this.onlineStateTimer=null,this.shouldWarnClientIsOffline=!0}return t.prototype.handleWatchStreamStart=function(){var t=this;0===this.watchStreamFailures&&(this.setAndBroadcast(Zr.Unknown),g(null===this.onlineStateTimer,"onlineStateTimer shouldn't be started yet"),this.onlineStateTimer=this.asyncQueue.enqueueAfterDelay(cn.OnlineStateTimeout,1e4,function(){return t.onlineStateTimer=null,g(t.state===Zr.Unknown,"Timer should be canceled if we transitioned to a different state."),t.logClientOfflineWarningIfNecessary("Backend didn't respond within 10 seconds."),t.setAndBroadcast(Zr.Offline),Promise.resolve()}))},t.prototype.handleWatchStreamFailure=function(t){this.state===Zr.Online?(this.setAndBroadcast(Zr.Unknown),g(0===this.watchStreamFailures,"watchStreamFailures must be 0"),g(null===this.onlineStateTimer,"onlineStateTimer must be null")):(this.watchStreamFailures++,this.watchStreamFailures>=1&&(this.clearOnlineStateTimer(),this.logClientOfflineWarningIfNecessary("Connection failed 1 times. Most recent error: "+t.toString()),this.setAndBroadcast(Zr.Offline)))},t.prototype.set=function(t){this.clearOnlineStateTimer(),this.watchStreamFailures=0,t===Zr.Online&&(this.shouldWarnClientIsOffline=!1),this.setAndBroadcast(t)},t.prototype.setAndBroadcast=function(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))},t.prototype.logClientOfflineWarningIfNecessary=function(t){var e="Could not reach Cloud Firestore backend. "+t+"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.";this.shouldWarnClientIsOffline?(d(e),this.shouldWarnClientIsOffline=!1):p("OnlineStateTracker",e)},t.prototype.clearOnlineStateTimer=function(){null!==this.onlineStateTimer&&(this.onlineStateTimer.cancel(),this.onlineStateTimer=null)},t}(),li=function(){function t(t,e,n,r){this.localStore=t,this.datastore=e,this.writePipeline=[],this.listenTargets={},this.watchChangeAggregator=null,this.networkEnabled=!1,this.isPrimary=!1,this.onlineStateTracker=new ci(n,r),this.watchStream=this.datastore.newPersistentWatchStream({onOpen:this.onWatchStreamOpen.bind(this),onClose:this.onWatchStreamClose.bind(this),onWatchChange:this.onWatchStreamChange.bind(this)}),this.writeStream=this.datastore.newPersistentWriteStream({onOpen:this.onWriteStreamOpen.bind(this),onClose:this.onWriteStreamClose.bind(this),onHandshakeComplete:this.onWriteHandshakeComplete.bind(this),onMutationResult:this.onMutationResult.bind(this)})}return t.prototype.start=function(){return this.enableNetwork()},t.prototype.enableNetwork=function(){return s.__awaiter(this,void 0,void 0,function(){var t;return s.__generator(this,function(e){switch(e.label){case 0:return this.networkEnabled=!0,this.canUseNetwork()?(t=this.writeStream,[4,this.localStore.getLastStreamToken()]):[3,3];case 1:return t.lastStreamToken=e.sent(),this.shouldStartWatchStream()?this.startWatchStream():this.onlineStateTracker.set(Zr.Unknown),[4,this.fillWritePipeline()];case 2:e.sent(),e.label=3;case 3:return[2]}})})},t.prototype.disableNetwork=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){switch(t.label){case 0:return this.networkEnabled=!1,[4,this.disableNetworkInternal()];case 1:return t.sent(),this.onlineStateTracker.set(Zr.Offline),[2]}})})},t.prototype.disableNetworkInternal=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){switch(t.label){case 0:return[4,this.writeStream.stop()];case 1:return t.sent(),[4,this.watchStream.stop()];case 2:return t.sent(),this.writePipeline.length>0&&(p("RemoteStore","Stopping write stream with "+this.writePipeline.length+" pending writes"),this.writePipeline=[]),this.cleanUpWatchStreamState(),[2]}})})},t.prototype.shutdown=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){switch(t.label){case 0:return p("RemoteStore","RemoteStore shutting down."),this.networkEnabled=!1,[4,this.disableNetworkInternal()];case 1:return t.sent(),this.onlineStateTracker.set(Zr.Unknown),[2]}})})},t.prototype.listen=function(t){g(!T(this.listenTargets,t.targetId),"listen called with duplicate targetId!"),this.listenTargets[t.targetId]=t,this.shouldStartWatchStream()?this.startWatchStream():this.watchStream.isOpen()&&this.sendWatchRequest(t)},t.prototype.unlisten=function(t){g(T(this.listenTargets,t),"unlisten called without assigned target ID!"),delete this.listenTargets[t],this.watchStream.isOpen()&&this.sendUnwatchRequest(t),N(this.listenTargets)&&(this.watchStream.isOpen()?this.watchStream.markIdle():this.canUseNetwork()&&this.onlineStateTracker.set(Zr.Unknown))},t.prototype.getQueryDataForTarget=function(t){return this.listenTargets[t]||null},t.prototype.getRemoteKeysForTarget=function(t){return this.syncEngine.getRemoteKeysForTarget(t)},t.prototype.sendWatchRequest=function(t){this.watchChangeAggregator.recordPendingTargetRequest(t.targetId),this.watchStream.watch(t)},t.prototype.sendUnwatchRequest=function(t){this.watchChangeAggregator.recordPendingTargetRequest(t),this.watchStream.unwatch(t)},t.prototype.startWatchStream=function(){g(this.shouldStartWatchStream(),"startWatchStream() called when shouldStartWatchStream() is false."),this.watchChangeAggregator=new qe(this),this.watchStream.start(),this.onlineStateTracker.handleWatchStreamStart()},t.prototype.shouldStartWatchStream=function(){return this.canUseNetwork()&&!this.watchStream.isStarted()&&!N(this.listenTargets)},t.prototype.canUseNetwork=function(){return this.isPrimary&&this.networkEnabled},t.prototype.cleanUpWatchStreamState=function(){this.watchChangeAggregator=null},t.prototype.onWatchStreamOpen=function(){return s.__awaiter(this,void 0,void 0,function(){var t=this;return s.__generator(this,function(e){return C(this.listenTargets,function(e,n){t.sendWatchRequest(n)}),[2]})})},t.prototype.onWatchStreamClose=function(t){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(e){return void 0===t&&g(!this.shouldStartWatchStream(),"Watch stream was stopped gracefully while still needed."),this.cleanUpWatchStreamState(),this.shouldStartWatchStream()?(this.onlineStateTracker.handleWatchStreamFailure(t),this.startWatchStream()):this.onlineStateTracker.set(Zr.Unknown),[2]})})},t.prototype.onWatchStreamChange=function(t,e){return s.__awaiter(this,void 0,void 0,function(){var n;return s.__generator(this,function(r){switch(r.label){case 0:return this.onlineStateTracker.set(Zr.Online),t instanceof Ve&&t.state===Pe.Removed&&t.cause?[2,this.handleTargetError(t)]:(t instanceof Ue?this.watchChangeAggregator.handleDocumentChange(t):t instanceof je?this.watchChangeAggregator.handleExistenceFilter(t):(g(t instanceof Ve,"Expected watchChange to be an instance of WatchTargetChange"),this.watchChangeAggregator.handleTargetChange(t)),e.isEqual($t.MIN)?[3,3]:[4,this.localStore.getLastRemoteSnapshotVersion()]);case 1:return n=r.sent(),e.compareTo(n)>=0?[4,this.raiseWatchSnapshot(e)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}})})},t.prototype.raiseWatchSnapshot=function(t){var e=this;g(!t.isEqual($t.MIN),"Can't raise event for unknown SnapshotVersion");var n=this.watchChangeAggregator.createRemoteEvent(t);return C(n.targetChanges,function(n,r){if(r.resumeToken.length>0){var i=e.listenTargets[n];i&&(e.listenTargets[n]=i.copy({resumeToken:r.resumeToken,snapshotVersion:t}))}}),n.targetMismatches.forEach(function(t){var n=e.listenTargets[t];if(n){e.listenTargets[t]=n.copy({resumeToken:b()}),e.sendUnwatchRequest(t);var r=new te(n.query,t,Vt.ExistenceFilterMismatch,n.sequenceNumber);e.sendWatchRequest(r)}}),this.syncEngine.applyRemoteEvent(n)},t.prototype.handleTargetError=function(t){var e=this;g(!!t.cause,"Handling target error without a cause");var n=t.cause,r=Promise.resolve();return t.targetIds.forEach(function(t){r=r.then(function(){return s.__awaiter(e,void 0,void 0,function(){return s.__generator(this,function(e){return T(this.listenTargets,t)?(delete this.listenTargets[t],this.watchChangeAggregator.removeTarget(t),[2,this.syncEngine.rejectListen(t,n)]):[2]})})})}),r},t.prototype.fillWritePipeline=function(){return s.__awaiter(this,void 0,void 0,function(){var t,e;return s.__generator(this,function(n){switch(n.label){case 0:return this.canAddToWritePipeline()?(t=this.writePipeline.length>0?this.writePipeline[this.writePipeline.length-1].batchId:Tn,[4,this.localStore.nextMutationBatch(t)]):[3,4];case 1:return null!==(e=n.sent())?[3,2]:(0===this.writePipeline.length&&this.writeStream.markIdle(),[3,4]);case 2:return this.addToWritePipeline(e),[4,this.fillWritePipeline()];case 3:n.sent(),n.label=4;case 4:return this.shouldStartWriteStream()&&this.startWriteStream(),[2]}})})},t.prototype.canAddToWritePipeline=function(){return this.canUseNetwork()&&this.writePipeline.length<10},t.prototype.outstandingWrites=function(){return this.writePipeline.length},t.prototype.addToWritePipeline=function(t){g(this.canAddToWritePipeline(),"addToWritePipeline called when pipeline is full"),this.writePipeline.push(t),this.writeStream.isOpen()&&this.writeStream.handshakeComplete&&this.writeStream.writeMutations(t.mutations)},t.prototype.shouldStartWriteStream=function(){return this.canUseNetwork()&&!this.writeStream.isStarted()&&this.writePipeline.length>0},t.prototype.startWriteStream=function(){g(this.shouldStartWriteStream(),"startWriteStream() called when shouldStartWriteStream() is false."),this.writeStream.start()},t.prototype.onWriteStreamOpen=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){return this.writeStream.writeHandshake(),[2]})})},t.prototype.onWriteHandshakeComplete=function(){var t=this;return this.localStore.setLastStreamToken(this.writeStream.lastStreamToken).then(function(){for(var e=0,n=t.writePipeline;e<n.length;e++){var r=n[e];t.writeStream.writeMutations(r.mutations)}}).catch(function(e){return t.ignoreIfPrimaryLeaseLoss(e)})},t.prototype.ignoreIfPrimaryLeaseLoss=function(t){if(!xr(t))throw t;p("RemoteStore","Unexpectedly lost primary lease")},t.prototype.onMutationResult=function(t,e){var n=this;g(this.writePipeline.length>0,"Got result for empty write pipeline");var r=this.writePipeline.shift(),i=Cn.from(r,t,e,this.writeStream.lastStreamToken);return this.syncEngine.applySuccessfulWrite(i).then(function(){return n.fillWritePipeline()})},t.prototype.onWriteStreamClose=function(t){return s.__awaiter(this,void 0,void 0,function(){var e=this;return s.__generator(this,function(n){return void 0===t&&g(!this.shouldStartWriteStream(),"Write stream was stopped gracefully while still needed."),t&&this.writePipeline.length>0?(void 0,[2,(this.writeStream.handshakeComplete?this.handleWriteError(t):this.handleHandshakeError(t)).then(function(){e.shouldStartWriteStream()&&e.startWriteStream()})]):[2]})})},t.prototype.handleHandshakeError=function(t){return s.__awaiter(this,void 0,void 0,function(){var e=this;return s.__generator(this,function(n){return ge(t.code)||t.code===_.ABORTED?(p("RemoteStore","RemoteStore error before completed handshake; resetting stream token: ",this.writeStream.lastStreamToken),this.writeStream.lastStreamToken=b(),[2,this.localStore.setLastStreamToken(b()).catch(function(t){return e.ignoreIfPrimaryLeaseLoss(t)})]):[2]})})},t.prototype.handleWriteError=function(t){return s.__awaiter(this,void 0,void 0,function(){var e,n=this;return s.__generator(this,function(r){return ge(t.code)?(e=this.writePipeline.shift(),this.writeStream.inhibitBackoff(),[2,this.syncEngine.rejectFailedWrite(e.batchId,t).then(function(){return n.fillWritePipeline()})]):[2]})})},t.prototype.createTransaction=function(){return new ui(this.datastore)},t.prototype.handleCredentialChange=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){switch(t.label){case 0:return this.canUseNetwork()?(p("RemoteStore","RemoteStore restarting streams for new credential"),this.networkEnabled=!1,[4,this.disableNetworkInternal()]):[3,3];case 1:return t.sent(),this.onlineStateTracker.set(Zr.Unknown),[4,this.enableNetwork()];case 2:t.sent(),t.label=3;case 3:return[2]}})})},t.prototype.applyPrimaryState=function(t){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(e){switch(e.label){case 0:return this.isPrimary=t,t&&this.networkEnabled?[4,this.enableNetwork()]:[3,2];case 1:return e.sent(),[3,4];case 2:return t?[3,4]:[4,this.disableNetworkInternal()];case 3:e.sent(),this.onlineStateTracker.set(Zr.Unknown),e.label=4;case 4:return[2]}})})},t}(),hi=function(){return function(){this.listeners=[]}}(),fi=function(){function t(t){this.syncEngine=t,this.queries=new jn(function(t){return t.canonicalId()}),this.onlineState=Zr.Unknown,this.syncEngine.subscribe(this)}return t.prototype.listen=function(t){var e=t.query,n=!1,r=this.queries.get(e);return r||(n=!0,r=new hi,this.queries.set(e,r)),r.listeners.push(t),t.applyOnlineStateChange(this.onlineState),r.viewSnap&&t.onViewSnapshot(r.viewSnap),n?this.syncEngine.listen(e).then(function(t){return r.targetId=t,t}):Promise.resolve(r.targetId)},t.prototype.unlisten=function(t){return s.__awaiter(this,void 0,void 0,function(){var e,n,r,i;return s.__generator(this,function(o){return e=t.query,n=!1,(r=this.queries.get(e))&&(i=r.listeners.indexOf(t))>=0&&(r.listeners.splice(i,1),n=0===r.listeners.length),n?(this.queries.delete(e),[2,this.syncEngine.unlisten(e)]):[2]})})},t.prototype.onWatchChange=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e],i=r.query,o=this.queries.get(i);if(o){for(var a=0,s=o.listeners;a<s.length;a++){s[a].onViewSnapshot(r)}o.viewSnap=r}}},t.prototype.onWatchError=function(t,e){var n=this.queries.get(t);if(n)for(var r=0,i=n.listeners;r<i.length;r++){i[r].onError(e)}this.queries.delete(t)},t.prototype.onOnlineStateChange=function(t){this.onlineState=t,this.queries.forEach(function(e,n){for(var r=0,i=n.listeners;r<i.length;r++){i[r].applyOnlineStateChange(t)}})},t}(),pi=function(){function t(t,e,n){this.query=t,this.queryObserver=e,this.raisedInitialEvent=!1,this.onlineState=Zr.Unknown,this.options=n||{}}return t.prototype.onViewSnapshot=function(t){if(g(t.docChanges.length>0||t.syncStateChanged,"We got a new snapshot with no changes?"),!this.options.includeMetadataChanges){for(var e=[],n=0,r=t.docChanges;n<r.length;n++){var i=r[n];i.type!==Ae.Metadata&&e.push(i)}t=new Le(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0)}this.raisedInitialEvent?this.shouldRaiseEvent(t)&&this.queryObserver.next(t):this.shouldRaiseInitialEvent(t,this.onlineState)&&this.raiseInitialEvent(t),this.snap=t},t.prototype.onError=function(t){this.queryObserver.error(t)},t.prototype.applyOnlineStateChange=function(t){this.onlineState=t,this.snap&&!this.raisedInitialEvent&&this.shouldRaiseInitialEvent(this.snap,t)&&this.raiseInitialEvent(this.snap)},t.prototype.shouldRaiseInitialEvent=function(t,e){if(g(!this.raisedInitialEvent,"Determining whether to raise first event but already had first event"),!t.fromCache)return!0;var n=e!==Zr.Offline;return this.options.waitForSyncWhenOnline&&n?(g(t.fromCache,"Waiting for sync, but snapshot is not from cache"),!1):!t.docs.isEmpty()||e===Zr.Offline},t.prototype.shouldRaiseEvent=function(t){if(t.docChanges.length>0)return!0;var e=this.snap&&this.snap.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges},t.prototype.raiseInitialEvent=function(t){g(!this.raisedInitialEvent,"Trying to raise initial events for second time"),t=Le.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache),this.raisedInitialEvent=!0,this.queryObserver.next(t)},t}(),di=function(){function t(t,e,n){this.targetId=t,this.addedKeys=e,this.removedKeys=n}return t.fromSnapshot=function(e,n){for(var r=Ne(),i=Ne(),o=0,a=n.docChanges;o<a.length;o++){var s=a[o];switch(s.type){case Ae.Added:r=r.add(s.doc.key);break;case Ae.Removed:i=i.add(s.doc.key)}}return new t(e,r,i)},t}(),yi=function(){return function(t){this.key=t}}(),mi=function(){return function(t){this.key=t}}(),gi=function(){function t(t,e){this.query=t,this._syncedDocuments=e,this.syncState=null,this.current=!1,this.limboDocuments=Ne(),this.mutatedKeys=Ne(),this.documentSet=new Re(t.docComparator.bind(t))}return Object.defineProperty(t.prototype,"syncedDocuments",{get:function(){return this._syncedDocuments},enumerable:!0,configurable:!0}),t.prototype.computeDocChanges=function(t,e){var n=this,r=e?e.changeSet:new xe,i=e?e.documentSet:this.documentSet,o=e?e.mutatedKeys:this.mutatedKeys,a=i,s=!1,u=this.query.hasLimit()&&i.size===this.query.limit?i.last():null;if(t.inorderTraversal(function(t,e){var c=i.get(t),l=e instanceof ht?e:null;l&&(g(t.isEqual(l.key),"Mismatching keys found in document changes: "+t+" != "+l.key),l=n.query.matches(l)?l:null);var h=!!c&&n.mutatedKeys.has(c.key),f=!!l&&(l.hasLocalMutations||n.mutatedKeys.has(l.key)&&l.hasCommittedMutations),p=!1;c&&l?c.data.isEqual(l.data)?h!==f&&(r.track({type:Ae.Metadata,doc:l}),p=!0):n.shouldWaitForSyncedDocument(c,l)||(r.track({type:Ae.Modified,doc:l}),p=!0,u&&n.query.docComparator(l,u)>0&&(s=!0)):!c&&l?(r.track({type:Ae.Added,doc:l}),p=!0):c&&!l&&(r.track({type:Ae.Removed,doc:c}),p=!0,u&&(s=!0));p&&(l?(a=a.add(l),o=f?o.add(t):o.delete(t)):(a=a.delete(t),o=o.delete(t)))}),this.query.hasLimit())for(;a.size>this.query.limit;){var c=a.last();a=a.delete(c.key),o=o.delete(c.key),r.track({type:Ae.Removed,doc:c})}return g(!s||!e,"View was refilled using docs that themselves needed refilling."),{documentSet:a,changeSet:r,needsRefill:s,mutatedKeys:o}},t.prototype.shouldWaitForSyncedDocument=function(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations},t.prototype.applyChanges=function(t,e,n){var r=this;g(!t.needsRefill,"Cannot apply changes that need a refill");var i=this.documentSet;this.documentSet=t.documentSet,this.mutatedKeys=t.mutatedKeys;var o=t.changeSet.getChanges();o.sort(function(t,e){return function(t,e){var n=function(t){switch(t){case Ae.Added:return 1;case Ae.Modified:case Ae.Metadata:return 2;case Ae.Removed:return 0;default:return m("Unknown ChangeType: "+t)}};return n(t)-n(e)}(t.type,e.type)||r.query.docComparator(t.doc,e.doc)}),this.applyTargetChange(n);var a=e?this.updateLimboDocuments():[],s=0===this.limboDocuments.size&&this.current?Oe.Synced:Oe.Local,u=s!==this.syncState;return this.syncState=s,0!==o.length||u?{snapshot:new Le(this.query,t.documentSet,i,o,t.mutatedKeys,s===Oe.Local,u,!1),limboChanges:a}:{limboChanges:a}},t.prototype.applyOnlineStateChange=function(t){return this.current&&t===Zr.Offline?(this.current=!1,this.applyChanges({documentSet:this.documentSet,changeSet:new xe,mutatedKeys:this.mutatedKeys,needsRefill:!1},!1)):{limboChanges:[]}},t.prototype.shouldBeInLimbo=function(t){return!this._syncedDocuments.has(t)&&(!!this.documentSet.has(t)&&!this.documentSet.get(t).hasLocalMutations)},t.prototype.applyTargetChange=function(t){var e=this;t&&(t.addedDocuments.forEach(function(t){return e._syncedDocuments=e._syncedDocuments.add(t)}),t.modifiedDocuments.forEach(function(t){return g(e._syncedDocuments.has(t),"Modified document "+t+" not found in view.")}),t.removedDocuments.forEach(function(t){return e._syncedDocuments=e._syncedDocuments.delete(t)}),this.current=t.current)},t.prototype.updateLimboDocuments=function(){var t=this;if(!this.current)return[];var e=this.limboDocuments;this.limboDocuments=Ne(),this.documentSet.forEach(function(e){t.shouldBeInLimbo(e.key)&&(t.limboDocuments=t.limboDocuments.add(e.key))});var n=[];return e.forEach(function(e){t.limboDocuments.has(e)||n.push(new mi(e))}),this.limboDocuments.forEach(function(t){e.has(t)||n.push(new yi(t))}),n},t.prototype.synchronizeWithPersistedState=function(t,e){this._syncedDocuments=e,this.limboDocuments=Ne();var n=this.computeDocChanges(t);return this.applyChanges(n,!0)},t.prototype.computeInitialSnapshot=function(){return Le.fromInitialDocuments(this.query,this.documentSet,this.mutatedKeys,this.syncState===Oe.Local)},t}();var vi=function(){return function(t,e,n){this.query=t,this.targetId=e,this.view=n}}(),bi=function(){return function(t){this.key=t}}(),_i=function(){function t(t,e,n,r){this.localStore=t,this.remoteStore=e,this.sharedClientState=n,this.currentUser=r,this.syncEngineListener=null,this.queryViewsByQuery=new jn(function(t){return t.canonicalId()}),this.queryViewsByTarget={},this.limboTargetsByKey=new dt(ct.comparator),this.limboResolutionsByTarget={},this.limboDocumentRefs=new Vr,this.mutationUserCallbacks={},this.limboTargetIdGenerator=Nn.forSyncEngine(),this.isPrimary=void 0,this.onlineState=Zr.Unknown}return Object.defineProperty(t.prototype,"isPrimaryClient",{get:function(){return!0===this.isPrimary},enumerable:!0,configurable:!0}),t.prototype.subscribe=function(t){g(null!==t,"SyncEngine listener cannot be null"),g(null===this.syncEngineListener,"SyncEngine already has a subscriber."),this.syncEngineListener=t},t.prototype.listen=function(t){return s.__awaiter(this,void 0,void 0,function(){var e,n,r,i,o;return s.__generator(this,function(a){switch(a.label){case 0:return this.assertSubscribed("listen()"),(r=this.queryViewsByQuery.get(t))?(e=r.targetId,this.sharedClientState.addLocalQueryTarget(e),n=r.view.computeInitialSnapshot(),[3,4]):[3,1];case 1:return[4,this.localStore.allocateQuery(t)];case 2:return i=a.sent(),o=this.sharedClientState.addLocalQueryTarget(i.targetId),e=i.targetId,[4,this.initializeViewAndComputeSnapshot(i,"current"===o)];case 3:n=a.sent(),this.isPrimary&&this.remoteStore.listen(i),a.label=4;case 4:return this.syncEngineListener.onWatchChange([n]),[2,e]}})})},t.prototype.initializeViewAndComputeSnapshot=function(t,e){var n=this,r=t.query;return this.localStore.executeQuery(r).then(function(i){return n.localStore.remoteDocumentKeys(t.targetId).then(function(o){var a=new gi(r,o),s=a.computeDocChanges(i),u=Fe.createSynthesizedTargetChangeForCurrentChange(t.targetId,e&&n.onlineState!==Zr.Offline),c=a.applyChanges(s,!0===n.isPrimary,u);g(0===c.limboChanges.length,"View returned limbo docs before target ack from the server."),g(!!c.snapshot,"applyChanges for new view should always return a snapshot");var l=new vi(r,t.targetId,a);return n.queryViewsByQuery.set(r,l),n.queryViewsByTarget[t.targetId]=l,c.snapshot})})},t.prototype.synchronizeViewAndComputeSnapshot=function(t){var e=this;return this.localStore.executeQuery(t.query).then(function(n){return e.localStore.remoteDocumentKeys(t.targetId).then(function(r){return s.__awaiter(e,void 0,void 0,function(){var e;return s.__generator(this,function(i){return e=t.view.synchronizeWithPersistedState(n,r),this.isPrimary&&this.updateTrackedLimbos(t.targetId,e.limboChanges),[2,e]})})})})},t.prototype.unlisten=function(t){return s.__awaiter(this,void 0,void 0,function(){var e,n=this;return s.__generator(this,function(r){switch(r.label){case 0:return this.assertSubscribed("unlisten()"),g(!!(e=this.queryViewsByQuery.get(t)),"Trying to unlisten on query not found:"+t),this.isPrimary?(this.sharedClientState.removeLocalQueryTarget(e.targetId),this.sharedClientState.isActiveQueryTarget(e.targetId)?[3,2]:[4,this.localStore.releaseQuery(t,!1).then(function(){n.sharedClientState.clearQueryState(e.targetId),n.remoteStore.unlisten(e.targetId),n.removeAndCleanupQuery(e)}).catch(function(t){return n.ignoreIfPrimaryLeaseLoss(t)})]):[3,3];case 1:r.sent(),r.label=2;case 2:return[3,5];case 3:return this.removeAndCleanupQuery(e),[4,this.localStore.releaseQuery(t,!0)];case 4:r.sent(),r.label=5;case 5:return[2]}})})},t.prototype.write=function(t,e){var n=this;return this.assertSubscribed("write()"),this.localStore.localWrite(t).then(function(t){return n.sharedClientState.addPendingMutation(t.batchId),n.addMutationCallback(t.batchId,e),n.emitNewSnapsAndNotifyLocalStore(t.changes)}).then(function(){return n.remoteStore.fillWritePipeline()})},t.prototype.wrapUpdateFunctionError=function(t){return t},t.prototype.runTransaction=function(t,e){var n=this;void 0===e&&(e=5),g(e>=0,"Got negative number of retries for transaction.");var r=this.remoteStore.createTransaction();return function(){try{var e=t(r);return!Ut(e)&&e.catch&&e.then?e.catch(function(t){return Promise.reject(n.wrapUpdateFunctionError(t))}):Promise.reject(Error("Transaction callback must return a Promise"))}catch(i){return Promise.reject(n.wrapUpdateFunctionError(i))}}().then(function(i){return r.commit().then(function(){return i}).catch(function(r){return 0===e?Promise.reject(r):n.runTransaction(t,e-1)})})},t.prototype.applyRemoteEvent=function(t){var e=this;return this.assertSubscribed("applyRemoteEvent()"),this.localStore.applyRemoteEvent(t).then(function(n){return I(t.targetChanges,function(t,n){var r=e.limboResolutionsByTarget[t];r&&(g(n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size<=1,"Limbo resolution for single document contains multiple changes."),n.addedDocuments.size>0?r.receivedDocument=!0:n.modifiedDocuments.size>0?g(r.receivedDocument,"Received change for limbo target document without add."):n.removedDocuments.size>0&&(g(r.receivedDocument,"Received remove for limbo target document without add."),r.receivedDocument=!1))}),e.emitNewSnapsAndNotifyLocalStore(n,t)}).catch(function(t){return e.ignoreIfPrimaryLeaseLoss(t)})},t.prototype.applyOnlineStateChange=function(t,e){if(this.isPrimary&&e===ti.RemoteStore||!this.isPrimary&&e===ti.SharedClientState){var n=[];this.queryViewsByQuery.forEach(function(e,r){var i=r.view.applyOnlineStateChange(t);g(0===i.limboChanges.length,"OnlineState should not affect limbo documents."),i.snapshot&&n.push(i.snapshot)}),this.syncEngineListener.onOnlineStateChange(t),this.syncEngineListener.onWatchChange(n),this.onlineState=t,this.isPrimary&&this.sharedClientState.setOnlineState(t)}},t.prototype.rejectListen=function(t,e){return s.__awaiter(this,void 0,void 0,function(){var n,r,i,o,a,u,c=this;return s.__generator(this,function(s){switch(s.label){case 0:return this.assertSubscribed("rejectListens()"),this.sharedClientState.updateQueryState(t,"rejected",e),n=this.limboResolutionsByTarget[t],(r=n&&n.key)?(this.limboTargetsByKey=this.limboTargetsByKey.remove(r),delete this.limboResolutionsByTarget[t],i=(i=new dt(ct.comparator)).insert(r,new ft(r,$t.forDeletedDoc())),o=Ne().add(r),a=new Me($t.MIN,{},new ee(H),i,o),[2,this.applyRemoteEvent(a)]):[3,1];case 1:return g(!!(u=this.queryViewsByTarget[t]),"Unknown targetId: "+t),[4,this.localStore.releaseQuery(u.query,!1).then(function(){return c.removeAndCleanupQuery(u)}).catch(function(t){return c.ignoreIfPrimaryLeaseLoss(t)})];case 2:s.sent(),this.syncEngineListener.onWatchError(u.query,e),s.label=3;case 3:return[2]}})})},t.prototype.applyBatchState=function(t,e,n){return s.__awaiter(this,void 0,void 0,function(){var r;return s.__generator(this,function(i){switch(i.label){case 0:return this.assertSubscribed("applyBatchState()"),[4,this.localStore.lookupMutationDocuments(t)];case 1:return null===(r=i.sent())?(p("SyncEngine","Cannot apply mutation batch with id: "+t),[2]):"pending"!==e?[3,3]:[4,this.remoteStore.fillWritePipeline()];case 2:return i.sent(),[3,4];case 3:"acknowledged"===e||"rejected"===e?(this.processUserCallback(t,n||null),this.localStore.removeCachedMutationBatchMetadata(t)):m("Unknown batchState: "+e),i.label=4;case 4:return[4,this.emitNewSnapsAndNotifyLocalStore(r)];case 5:return i.sent(),[2]}})})},t.prototype.applySuccessfulWrite=function(t){var e=this;this.assertSubscribed("applySuccessfulWrite()");var n=t.batch.batchId;return this.processUserCallback(n,null),this.localStore.acknowledgeBatch(t).then(function(t){return e.sharedClientState.updateMutationState(n,"acknowledged"),e.emitNewSnapsAndNotifyLocalStore(t)}).catch(function(t){return e.ignoreIfPrimaryLeaseLoss(t)})},t.prototype.rejectFailedWrite=function(t,e){var n=this;return this.assertSubscribed("rejectFailedWrite()"),this.processUserCallback(t,e),this.localStore.rejectBatch(t).then(function(r){return n.sharedClientState.updateMutationState(t,"rejected",e),n.emitNewSnapsAndNotifyLocalStore(r)}).catch(function(t){return n.ignoreIfPrimaryLeaseLoss(t)})},t.prototype.addMutationCallback=function(t,e){var n=this.mutationUserCallbacks[this.currentUser.toKey()];n||(n=new dt(H)),n=n.insert(t,e),this.mutationUserCallbacks[this.currentUser.toKey()]=n},t.prototype.processUserCallback=function(t,e){var n=this.mutationUserCallbacks[this.currentUser.toKey()];if(n){var r=n.get(t);r&&(g(t===n.minKey(),"Mutation callbacks processed out-of-order?"),e?r.reject(e):r.resolve(),n=n.remove(t)),this.mutationUserCallbacks[this.currentUser.toKey()]=n}},t.prototype.removeAndCleanupQuery=function(t){var e=this;if(this.sharedClientState.removeLocalQueryTarget(t.targetId),this.queryViewsByQuery.delete(t.query),delete this.queryViewsByTarget[t.targetId],this.isPrimary){var n=this.limboDocumentRefs.referencesForId(t.targetId);this.limboDocumentRefs.removeReferencesForId(t.targetId),n.forEach(function(t){e.limboDocumentRefs.containsKey(t)||e.removeLimboTarget(t)})}},t.prototype.removeLimboTarget=function(t){var e=this.limboTargetsByKey.get(t);null!==e&&(this.remoteStore.unlisten(e),this.limboTargetsByKey=this.limboTargetsByKey.remove(t),delete this.limboResolutionsByTarget[e])},t.prototype.updateTrackedLimbos=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i instanceof yi)this.limboDocumentRefs.addReference(i.key,t),this.trackLimboChange(i);else if(i instanceof mi){p("SyncEngine","Document no longer in limbo: "+i.key),this.limboDocumentRefs.removeReference(i.key,t),this.limboDocumentRefs.containsKey(i.key)||this.removeLimboTarget(i.key)}else m("Unknown limbo change: "+JSON.stringify(i))}},t.prototype.trackLimboChange=function(t){var e=t.key;if(!this.limboTargetsByKey.get(e)){p("SyncEngine","New document in limbo: "+e);var n=this.limboTargetIdGenerator.next(),r=Bt.atPath(e.path);this.limboResolutionsByTarget[n]=new bi(e),this.remoteStore.listen(new te(r,n,Vt.LimboResolution,ln.INVALID)),this.limboTargetsByKey=this.limboTargetsByKey.insert(e,n)}},t.prototype.currentLimboDocs=function(){return this.limboTargetsByKey},t.prototype.emitNewSnapsAndNotifyLocalStore=function(t,e){return s.__awaiter(this,void 0,void 0,function(){var n,r,i,o=this;return s.__generator(this,function(a){switch(a.label){case 0:return n=[],r=[],i=[],this.queryViewsByQuery.forEach(function(a,s){i.push(Promise.resolve().then(function(){var e=s.view.computeDocChanges(t);return e.needsRefill?o.localStore.executeQuery(s.query).then(function(t){return s.view.computeDocChanges(t,e)}):e}).then(function(t){var i=e&&e.targetChanges[s.targetId],a=s.view.applyChanges(t,!0===o.isPrimary,i);if(o.updateTrackedLimbos(s.targetId,a.limboChanges),a.snapshot){o.isPrimary&&o.sharedClientState.updateQueryState(s.targetId,a.snapshot.fromCache?"not-current":"current"),n.push(a.snapshot);var u=di.fromSnapshot(s.targetId,a.snapshot);r.push(u)}}))}),[4,Promise.all(i)];case 1:return a.sent(),this.syncEngineListener.onWatchChange(n),[4,this.localStore.notifyLocalViewChanges(r)];case 2:return a.sent(),[2]}})})},t.prototype.ignoreIfPrimaryLeaseLoss=function(t){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(e){if(!xr(t))throw t;return p("SyncEngine","Unexpectedly lost primary lease"),[2]})})},t.prototype.assertSubscribed=function(t){g(null!==this.syncEngineListener,"Trying to call "+t+" before calling subscribe().")},t.prototype.handleCredentialChange=function(t){return s.__awaiter(this,void 0,void 0,function(){var e,n;return s.__generator(this,function(r){switch(r.label){case 0:return e=!this.currentUser.isEqual(t),this.currentUser=t,e?[4,this.localStore.handleUserChange(t)]:[3,3];case 1:return n=r.sent(),this.sharedClientState.handleUserChange(t,n.removedBatchIds,n.addedBatchIds),[4,this.emitNewSnapsAndNotifyLocalStore(n.affectedDocuments)];case 2:r.sent(),r.label=3;case 3:return[4,this.remoteStore.handleCredentialChange()];case 4:return r.sent(),[2]}})})},t.prototype.applyPrimaryState=function(t){return s.__awaiter(this,void 0,void 0,function(){var e,n,r,i,o,a,u,c=this;return s.__generator(this,function(s){switch(s.label){case 0:return!0!==t||!0===this.isPrimary?[3,3]:(this.isPrimary=!0,[4,this.remoteStore.applyPrimaryState(!0)]);case 1:return s.sent(),e=this.sharedClientState.getAllActiveQueryTargets(),[4,this.synchronizeQueryViewsAndRaiseSnapshots(e.toArray())];case 2:for(n=s.sent(),r=0,i=n;r<i.length;r++)o=i[r],this.remoteStore.listen(o);return[3,7];case 3:return!1!==t||!1===this.isPrimary?[3,7]:(this.isPrimary=!1,a=[],u=Promise.resolve(),C(this.queryViewsByTarget,function(t,e){c.sharedClientState.isLocalQueryTarget(t)?a.push(t):u=u.then(function(){return c.unlisten(e.query)}),c.remoteStore.unlisten(e.targetId)}),[4,u]);case 4:return s.sent(),[4,this.synchronizeQueryViewsAndRaiseSnapshots(a)];case 5:return s.sent(),this.resetLimboDocuments(),[4,this.remoteStore.applyPrimaryState(!1)];case 6:s.sent(),s.label=7;case 7:return[2]}})})},t.prototype.resetLimboDocuments=function(){var t=this;C(this.limboResolutionsByTarget,function(e){t.remoteStore.unlisten(e)}),this.limboDocumentRefs.removeAllReferences(),this.limboResolutionsByTarget=[],this.limboTargetsByKey=new dt(ct.comparator)},t.prototype.synchronizeQueryViewsAndRaiseSnapshots=function(t){for(var e=this,n=Promise.resolve(),r=[],i=[],o=function(t){n=n.then(function(){return s.__awaiter(e,void 0,void 0,function(){var e,n,o,a;return s.__generator(this,function(s){switch(s.label){case 0:return(n=this.queryViewsByTarget[t])?[4,this.localStore.releaseQuery(n.query,!0)]:[3,4];case 1:return s.sent(),[4,this.localStore.allocateQuery(n.query)];case 2:return e=s.sent(),[4,this.synchronizeViewAndComputeSnapshot(n)];case 3:return(o=s.sent()).snapshot&&i.push(o.snapshot),[3,8];case 4:return g(!0===this.isPrimary,"A secondary tab should never have an active query without an active view."),[4,this.localStore.getQueryForTarget(t)];case 5:return g(!!(a=s.sent()),"Query data for target "+t+" not found"),[4,this.localStore.allocateQuery(a)];case 6:return e=s.sent(),[4,this.initializeViewAndComputeSnapshot(e,!1)];case 7:s.sent(),s.label=8;case 8:return r.push(e),[2]}})})})},a=0,u=t;a<u.length;a++){o(u[a])}return n.then(function(){return e.syncEngineListener.onWatchChange(i),r})},t.prototype.getActiveClients=function(){return this.localStore.getActiveClients()},t.prototype.applyTargetState=function(t,e,n){return s.__awaiter(this,void 0,void 0,function(){var r,i=this;return s.__generator(this,function(o){switch(o.label){case 0:if(this.isPrimary)return p("SyncEngine","Ignoring unexpected query state notification."),[2];if(!this.queryViewsByTarget[t])return[3,5];switch(e){case"current":case"not-current":return[3,1];case"rejected":return[3,2]}return[3,4];case 1:return[2,this.localStore.getNewDocumentChanges().then(function(n){return s.__awaiter(i,void 0,void 0,function(){var r;return s.__generator(this,function(i){switch(i.label){case 0:return r=Me.createSynthesizedRemoteEventForCurrentChange(t,"current"===e),[4,this.emitNewSnapsAndNotifyLocalStore(n,r)];case 1:return i.sent(),[2]}})})},function(t){return s.__awaiter(i,void 0,void 0,function(){var e;return s.__generator(this,function(n){switch(n.label){case 0:return function(t){return t.code===_.DATA_LOSS&&t.message===Bn}(t)?(e=[],C(this.queryViewsByTarget,function(t){return e.push(t)}),[4,this.synchronizeQueryViewsAndRaiseSnapshots(e)]):[3,2];case 1:return n.sent(),[3,3];case 2:throw t;case 3:return[2]}})})})];case 2:return r=this.queryViewsByTarget[t],this.removeAndCleanupQuery(r),[4,this.localStore.releaseQuery(r.query,!0)];case 3:return o.sent(),this.syncEngineListener.onWatchError(r.query,n),[3,5];case 4:m("Unexpected target state: "+e),o.label=5;case 5:return[2]}})})},t.prototype.applyActiveTargetsChange=function(t,e){return s.__awaiter(this,void 0,void 0,function(){var n,r,i,o,a,u,c,l,h,f=this;return s.__generator(this,function(p){switch(p.label){case 0:if(!this.isPrimary)return[2];n=0,r=t,p.label=1;case 1:return n<r.length?(h=r[n],g(!this.queryViewsByTarget[h],"Trying to add an already active target"),[4,this.localStore.getQueryForTarget(h)]):[3,6];case 2:return g(!!(i=p.sent()),"Query data for active target "+h+" not found"),[4,this.localStore.allocateQuery(i)];case 3:return o=p.sent(),[4,this.initializeViewAndComputeSnapshot(o,!1)];case 4:p.sent(),this.remoteStore.listen(o),p.label=5;case 5:return n++,[3,1];case 6:a=function(t){var e;return s.__generator(this,function(n){switch(n.label){case 0:return(e=u.queryViewsByTarget[t])?[4,u.localStore.releaseQuery(e.query,!1).then(function(){f.remoteStore.unlisten(t),f.removeAndCleanupQuery(e)}).catch(function(t){return f.ignoreIfPrimaryLeaseLoss(t)})]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}})},u=this,c=0,l=e,p.label=7;case 7:return c<l.length?(h=l[c],[5,a(h)]):[3,10];case 8:p.sent(),p.label=9;case 9:return c++,[3,7];case 10:return[2]}})})},t.prototype.enableNetwork=function(){return this.localStore.setNetworkEnabled(!0),this.remoteStore.enableNetwork()},t.prototype.disableNetwork=function(){return this.localStore.setNetworkEnabled(!1),this.remoteStore.disableNetwork()},t.prototype.getRemoteKeysForTarget=function(t){var e=this.limboResolutionsByTarget[t];return e&&e.receivedDocument?Ne().add(e.key):this.queryViewsByTarget[t]?this.queryViewsByTarget[t].view.syncedDocuments:Ne()},t}(),wi=function(){function t(t){this.uid=t}return t.prototype.isAuthenticated=function(){return null!=this.uid},t.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},t.prototype.isEqual=function(t){return t.uid===this.uid},t.UNAUTHENTICATED=new t(null),t.GOOGLE_CREDENTIALS=new t("google-credentials-uid"),t.FIRST_PARTY=new t("first-party-uid"),t}(),Ei="SharedClientState",Ti="firestore_clients",Si="firestore_mutations",Ci="firestore_targets",Ii="firestore_online_state",Ni="firestore_sequence_number",ki=function(){function t(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r,g(void 0!==r===("rejected"===n),"MutationMetadata must contain an error iff state is 'rejected'")}return t.fromWebStorageEntry=function(e,n,r){var i=JSON.parse(r),o="object"===typeof i&&-1!==["pending","acknowledged","rejected"].indexOf(i.state)&&(void 0===i.error||"object"===typeof i.error),a=void 0;return o&&i.error&&(o="string"===typeof i.error.message&&"string"===typeof i.error.code)&&(a=new w(i.error.code,i.error.message)),o?new t(e,n,i.state,a):(d(Ei,"Failed to parse mutation state for ID '"+n+"': "+r),null)},t.prototype.toWebStorageJSON=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},t}(),Di=function(){function t(t,e,n){this.targetId=t,this.state=e,this.error=n,g(void 0!==n===("rejected"===e),"QueryTargetMetadata must contain an error iff state is 'rejected'")}return t.fromWebStorageEntry=function(e,n){var r=JSON.parse(n),i="object"===typeof r&&-1!==["not-current","current","rejected"].indexOf(r.state)&&(void 0===r.error||"object"===typeof r.error),o=void 0;return i&&r.error&&(i="string"===typeof r.error.message&&"string"===typeof r.error.code)&&(o=new w(r.error.code,r.error.message)),i?new t(e,r.state,o):(d(Ei,"Failed to parse target state for ID '"+e+"': "+n),null)},t.prototype.toWebStorageJSON=function(){var t={state:this.state,updateTimeMs:Date.now()};return this.error&&(t.error={code:this.error.code,message:this.error.message}),JSON.stringify(t)},t}(),Ai=function(){function t(t,e){this.clientId=t,this.activeTargetIds=e}return t.fromWebStorageEntry=function(e,n){for(var r=JSON.parse(n),i="object"===typeof r&&r.activeTargetIds instanceof Array,o=De(),a=0;i&&a<r.activeTargetIds.length;++a)i=jt(r.activeTargetIds[a]),o=o.add(r.activeTargetIds[a]);return i?new t(e,o):(d(Ei,"Failed to parse client data for instance '"+e+"': "+n),null)},t}(),Oi=function(){function t(t,e){this.clientId=t,this.onlineState=e}return t.fromWebStorageEntry=function(e){var n=JSON.parse(e);return"object"===typeof n&&void 0!==Zr[n.onlineState]&&"string"===typeof n.clientId?new t(n.clientId,Zr[n.onlineState]):(d(Ei,"Failed to parse online state: "+e),null)},t}(),Ri=function(){function t(){this.activeTargetIds=De()}return t.prototype.addQueryTarget=function(t){g(!this.activeTargetIds.has(t),"Target with ID '"+t+"' already active."),this.activeTargetIds=this.activeTargetIds.add(t)},t.prototype.removeQueryTarget=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},t.prototype.toWebStorageJSON=function(){var t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)},t}(),Pi=function(){function t(e,n,r,i,o){if(this.queue=e,this.platform=n,this.persistenceKey=r,this.localClientId=i,this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null,this.activeClients={},this.storageListener=this.handleWebStorageEvent.bind(this),this.started=!1,this.earlyEvents=[],!t.isAvailable(this.platform))throw new w(_.UNIMPLEMENTED,"LocalStorage is not available on this platform.");var a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.platform.window.localStorage,this.currentUser=o,this.localClientStorageKey=this.toWebStorageClientStateKey(this.localClientId),this.sequenceNumberKey=Ni+"_"+r,this.activeClients[this.localClientId]=new Ri,this.clientStateKeyRe=new RegExp("^"+Ti+"_"+a+"_([^_]*)$"),this.mutationBatchKeyRe=new RegExp("^"+Si+"_"+a+"_(\\d+)(?:_(.*))?$"),this.queryTargetKeyRe=new RegExp("^"+Ci+"_"+a+"_(\\d+)$"),this.onlineStateKey=Ii+"_"+r,this.platform.window.addEventListener("storage",this.storageListener)}return t.isAvailable=function(t){return!(!t.window||null==t.window.localStorage)},t.prototype.start=function(){return s.__awaiter(this,void 0,void 0,function(){var t,e,n,r,i,o,a,u,c,l,h,f=this;return s.__generator(this,function(s){switch(s.label){case 0:return g(!this.started,"WebStorageSharedClientState already started"),g(null!==this.syncEngine,"syncEngine property must be set before calling start()"),g(null!==this.onlineStateHandler,"onlineStateHandler property must be set before calling start()"),[4,this.syncEngine.getActiveClients()];case 1:for(t=s.sent(),e=0,n=t;e<n.length;e++)(r=n[e])!==this.localClientId&&(i=this.getItem(this.toWebStorageClientStateKey(r)))&&(o=Ai.fromWebStorageEntry(r,i))&&(this.activeClients[o.clientId]=o);for(this.persistClientState(),(a=this.storage.getItem(this.onlineStateKey))&&(u=this.fromWebStorageOnlineState(a))&&this.handleOnlineStateEvent(u),c=0,l=this.earlyEvents;c<l.length;c++)h=l[c],this.handleWebStorageEvent(h);return this.earlyEvents=[],this.platform.window.addEventListener("unload",function(){return f.shutdown()}),this.started=!0,[2]}})})},t.prototype.writeSequenceNumber=function(t){this.setItem(this.sequenceNumberKey,JSON.stringify(t))},t.prototype.getAllActiveQueryTargets=function(){var t=De();return I(this.activeClients,function(e,n){t=t.unionWith(n.activeTargetIds)}),t},t.prototype.isActiveQueryTarget=function(t){for(var e in this.activeClients)if(this.activeClients.hasOwnProperty(e)&&this.activeClients[e].activeTargetIds.has(t))return!0;return!1},t.prototype.addPendingMutation=function(t){this.persistMutationState(t,"pending")},t.prototype.updateMutationState=function(t,e,n){this.persistMutationState(t,e,n),this.removeMutationState(t)},t.prototype.addLocalQueryTarget=function(t){var e="not-current";if(this.isActiveQueryTarget(t)){var n=this.storage.getItem(this.toWebStorageQueryTargetMetadataKey(t));if(n){var r=Di.fromWebStorageEntry(t,n);r&&(e=r.state)}}return this.localClientState.addQueryTarget(t),this.persistClientState(),e},t.prototype.removeLocalQueryTarget=function(t){this.localClientState.removeQueryTarget(t),this.persistClientState()},t.prototype.isLocalQueryTarget=function(t){return this.localClientState.activeTargetIds.has(t)},t.prototype.clearQueryState=function(t){this.removeItem(this.toWebStorageQueryTargetMetadataKey(t))},t.prototype.updateQueryState=function(t,e,n){this.persistQueryTargetState(t,e,n)},t.prototype.handleUserChange=function(t,e,n){var r=this;e.forEach(function(t){r.removeMutationState(t)}),this.currentUser=t,n.forEach(function(t){r.addPendingMutation(t)})},t.prototype.setOnlineState=function(t){this.persistOnlineState(t)},t.prototype.shutdown=function(){this.started&&(this.platform.window.removeEventListener("storage",this.storageListener),this.removeItem(this.localClientStorageKey),this.started=!1)},t.prototype.getItem=function(t){var e=this.storage.getItem(t);return p(Ei,"READ",t,e),e},t.prototype.setItem=function(t,e){p(Ei,"SET",t,e),this.storage.setItem(t,e)},t.prototype.removeItem=function(t){p(Ei,"REMOVE",t),this.storage.removeItem(t)},t.prototype.handleWebStorageEvent=function(t){var e=this;if(t.storageArea===this.storage){if(p(Ei,"EVENT",t.key,t.newValue),t.key===this.localClientStorageKey)return void d("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.queue.enqueueAndForget(function(){return s.__awaiter(e,void 0,void 0,function(){var e,n,r,i,o,a;return s.__generator(this,function(s){if(!this.started)return this.earlyEvents.push(t),[2];if(null===t.key)return[2];if(this.clientStateKeyRe.test(t.key)){if(null==t.newValue)return n=this.fromWebStorageClientStateKey(t.key),[2,this.handleClientStateEvent(n,null)];if(e=this.fromWebStorageClientState(t.key,t.newValue))return[2,this.handleClientStateEvent(e.clientId,e)]}else if(this.mutationBatchKeyRe.test(t.key)){if(null!==t.newValue&&(r=this.fromWebStorageMutationMetadata(t.key,t.newValue)))return[2,this.handleMutationBatchEvent(r)]}else if(this.queryTargetKeyRe.test(t.key)){if(null!==t.newValue&&(i=this.fromWebStorageQueryTargetMetadata(t.key,t.newValue)))return[2,this.handleQueryTargetEvent(i)]}else if(t.key===this.onlineStateKey){if(null!==t.newValue&&(o=this.fromWebStorageOnlineState(t.newValue)))return[2,this.handleOnlineStateEvent(o)]}else t.key===this.sequenceNumberKey&&(g(!!this.sequenceNumberHandler,"Missing sequenceNumberHandler"),(a=function(t){var e=ln.INVALID;if(null!=t)try{var n=JSON.parse(t);g("number"===typeof n,"Found non-numeric sequence number"),e=n}catch(r){d(Ei,"Failed to read sequence number from WebStorage",r)}return e}(t.newValue))!==ln.INVALID&&this.sequenceNumberHandler(a));return[2]})})})}},Object.defineProperty(t.prototype,"localClientState",{get:function(){return this.activeClients[this.localClientId]},enumerable:!0,configurable:!0}),t.prototype.persistClientState=function(){this.setItem(this.localClientStorageKey,this.localClientState.toWebStorageJSON())},t.prototype.persistMutationState=function(t,e,n){var r=new ki(this.currentUser,t,e,n),i=this.toWebStorageMutationBatchKey(t);this.setItem(i,r.toWebStorageJSON())},t.prototype.removeMutationState=function(t){var e=this.toWebStorageMutationBatchKey(t);this.removeItem(e)},t.prototype.persistOnlineState=function(t){var e={clientId:this.localClientId,onlineState:Zr[t]};this.storage.setItem(this.onlineStateKey,JSON.stringify(e))},t.prototype.persistQueryTargetState=function(t,e,n){var r=this.toWebStorageQueryTargetMetadataKey(t),i=new Di(t,e,n);this.setItem(r,i.toWebStorageJSON())},t.prototype.toWebStorageClientStateKey=function(t){return g(-1===t.indexOf("_"),"Client key cannot contain '_', but was '"+t+"'"),Ti+"_"+this.persistenceKey+"_"+t},t.prototype.toWebStorageQueryTargetMetadataKey=function(t){return Ci+"_"+this.persistenceKey+"_"+t},t.prototype.toWebStorageMutationBatchKey=function(t){var e=Si+"_"+this.persistenceKey+"_"+t;return this.currentUser.isAuthenticated()&&(e+="_"+this.currentUser.uid),e},t.prototype.fromWebStorageClientStateKey=function(t){var e=this.clientStateKeyRe.exec(t);return e?e[1]:null},t.prototype.fromWebStorageClientState=function(t,e){var n=this.fromWebStorageClientStateKey(t);return g(null!==n,"Cannot parse client state key '"+t+"'"),Ai.fromWebStorageEntry(n,e)},t.prototype.fromWebStorageMutationMetadata=function(t,e){var n=this.mutationBatchKeyRe.exec(t);g(null!==n,"Cannot parse mutation batch key '"+t+"'");var r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return ki.fromWebStorageEntry(new wi(i),r,e)},t.prototype.fromWebStorageQueryTargetMetadata=function(t,e){var n=this.queryTargetKeyRe.exec(t);g(null!==n,"Cannot parse query target key '"+t+"'");var r=Number(n[1]);return Di.fromWebStorageEntry(r,e)},t.prototype.fromWebStorageOnlineState=function(t){return Oi.fromWebStorageEntry(t)},t.prototype.handleMutationBatchEvent=function(t){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(e){return t.user.uid!==this.currentUser.uid?(p(Ei,"Ignoring mutation for non-active user "+t.user.uid),[2]):[2,this.syncEngine.applyBatchState(t.batchId,t.state,t.error)]})})},t.prototype.handleQueryTargetEvent=function(t){return this.syncEngine.applyTargetState(t.targetId,t.state,t.error)},t.prototype.handleClientStateEvent=function(t,e){var n=this,r=this.getAllActiveQueryTargets();e?this.activeClients[t]=e:delete this.activeClients[t];var i=this.getAllActiveQueryTargets(),o=[],a=[];return i.forEach(function(t){return s.__awaiter(n,void 0,void 0,function(){return s.__generator(this,function(e){return r.has(t)||o.push(t),[2]})})}),r.forEach(function(t){return s.__awaiter(n,void 0,void 0,function(){return s.__generator(this,function(e){return i.has(t)||a.push(t),[2]})})}),this.syncEngine.applyActiveTargetsChange(o,a)},t.prototype.handleOnlineStateEvent=function(t){this.activeClients[t.clientId]&&this.onlineStateHandler(t.onlineState)},t}();var xi=function(){function t(){this.localState=new Ri,this.queryState={},this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null}return t.prototype.addPendingMutation=function(t){},t.prototype.updateMutationState=function(t,e,n){},t.prototype.addLocalQueryTarget=function(t){return this.localState.addQueryTarget(t),this.queryState[t]||"not-current"},t.prototype.updateQueryState=function(t,e,n){this.queryState[t]=e},t.prototype.removeLocalQueryTarget=function(t){this.localState.removeQueryTarget(t)},t.prototype.isLocalQueryTarget=function(t){return this.localState.activeTargetIds.has(t)},t.prototype.clearQueryState=function(t){delete this.queryState[t]},t.prototype.getAllActiveQueryTargets=function(){return this.localState.activeTargetIds},t.prototype.isActiveQueryTarget=function(t){return this.localState.activeTargetIds.has(t)},t.prototype.start=function(){return this.localState=new Ri,Promise.resolve()},t.prototype.handleUserChange=function(t,e,n){},t.prototype.setOnlineState=function(t){},t.prototype.shutdown=function(){},t.prototype.writeSequenceNumber=function(t){},t}(),Li=function(){function t(t,e){this.cacheSizeBytes=t,this.experimentalTabSynchronization=e}return t.prototype.lruParams=function(){return Sr.withCacheSize(this.cacheSizeBytes)},t}(),Mi=function(){return function(){}}(),Fi=function(){function t(t,e,n,r){this.platform=t,this.databaseInfo=e,this.credentials=n,this.asyncQueue=r,this.clientId=Q.newId()}return t.prototype.start=function(t){var e=this,n=new hn,r=new hn,i=!1;return this.credentials.setChangeListener(function(o){i?e.asyncQueue.enqueueAndForget(function(){return e.handleCredentialChange(o)}):(i=!0,e.initializePersistence(t,r,o).then(function(t){return e.initializeRest(o,t)}).then(n.resolve,n.reject))}),this.asyncQueue.enqueueAndForget(function(){return n.promise}),r.promise},t.prototype.enableNetwork=function(){var t=this;return this.asyncQueue.enqueue(function(){return t.syncEngine.enableNetwork()})},t.prototype.initializePersistence=function(t,e,n){var r=this;return t instanceof Li?this.startIndexedDbPersistence(n,t).then(function(t){return e.resolve(),t}).catch(function(t){if(e.reject(t),!r.canFallback(t))throw t;return console.warn("Error enabling offline storage. Falling back to storage disabled: "+t),r.startMemoryPersistence()}):(e.resolve(),this.startMemoryPersistence())},t.prototype.canFallback=function(t){return t instanceof w?t.code===_.FAILED_PRECONDITION||t.code===_.UNIMPLEMENTED:!("undefined"!==typeof DOMException&&t instanceof DOMException)||(22===t.code||20===t.code)},t.prototype.startIndexedDbPersistence=function(t,e){var n=this,r=Pr.buildStoragePrefix(this.databaseInfo),i=new Xe(this.databaseInfo.databaseId,{useProto3Json:!0});return Promise.resolve().then(function(){return s.__awaiter(n,void 0,void 0,function(){var n,o;return s.__generator(this,function(a){switch(a.label){case 0:if(e.experimentalTabSynchronization&&!Pi.isAvailable(this.platform))throw new w(_.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");return o=e.lruParams(),e.experimentalTabSynchronization?(this.sharedClientState=new Pi(this.asyncQueue,this.platform,r,this.clientId,t),[4,Pr.createMultiClientIndexedDbPersistence(r,this.clientId,this.platform,this.asyncQueue,i,o,{sequenceNumberSyncer:this.sharedClientState})]):[3,2];case 1:return n=a.sent(),[3,4];case 2:return this.sharedClientState=new xi,[4,Pr.createIndexedDbPersistence(r,this.clientId,this.platform,this.asyncQueue,i,o)];case 3:n=a.sent(),a.label=4;case 4:return this.persistence=n,[2,n.referenceDelegate.garbageCollector]}})})})},t.prototype.startMemoryPersistence=function(){return this.persistence=Gr.createEagerPersistence(this.clientId),this.sharedClientState=new xi,Promise.resolve(null)},t.prototype.initializeRest=function(t,e){var n=this;return p("FirestoreClient","Initializing. user=",t.uid),this.platform.loadConnection(this.databaseInfo).then(function(r){return s.__awaiter(n,void 0,void 0,function(){var n,i,o,a,u=this;return s.__generator(this,function(s){switch(s.label){case 0:return this.localStore=new qr(this.persistence,t),e&&(this.lruScheduler=new Cr(e,this.asyncQueue,this.localStore),this.lruScheduler.start()),n=this.platform.newSerializer(this.databaseInfo.databaseId),i=new si(this.asyncQueue,r,this.credentials,n),o=function(t){return u.syncEngine.applyOnlineStateChange(t,ti.RemoteStore)},a=function(t){return u.syncEngine.applyOnlineStateChange(t,ti.SharedClientState)},this.remoteStore=new li(this.localStore,i,this.asyncQueue,o),this.syncEngine=new _i(this.localStore,this.remoteStore,this.sharedClientState,t),this.sharedClientState.onlineStateHandler=a,this.remoteStore.syncEngine=this.syncEngine,this.sharedClientState.syncEngine=this.syncEngine,this.eventMgr=new fi(this.syncEngine),[4,this.sharedClientState.start()];case 1:return s.sent(),[4,this.remoteStore.start()];case 2:return s.sent(),[4,this.persistence.setPrimaryStateListener(function(t){return u.syncEngine.applyPrimaryState(t)})];case 3:return s.sent(),[2]}})})})},t.prototype.handleCredentialChange=function(t){return this.asyncQueue.verifyOperationInProgress(),p("FirestoreClient","Credential Changed. Current user: "+t.uid),this.syncEngine.handleCredentialChange(t)},t.prototype.disableNetwork=function(){var t=this;return this.asyncQueue.enqueue(function(){return t.syncEngine.disableNetwork()})},t.prototype.shutdown=function(t){var e=this;return this.asyncQueue.enqueue(function(){return s.__awaiter(e,void 0,void 0,function(){return s.__generator(this,function(e){switch(e.label){case 0:return this.lruScheduler&&this.lruScheduler.stop(),[4,this.remoteStore.shutdown()];case 1:return e.sent(),[4,this.sharedClientState.shutdown()];case 2:return e.sent(),[4,this.persistence.shutdown(t&&t.purgePersistenceWithDataLoss)];case 3:return e.sent(),this.credentials.removeChangeListener(),[2]}})})})},t.prototype.listen=function(t,e,n){var r=this,i=new pi(t,e,n);return this.asyncQueue.enqueueAndForget(function(){return r.eventMgr.listen(i)}),i},t.prototype.unlisten=function(t){var e=this;this.asyncQueue.enqueueAndForget(function(){return e.eventMgr.unlisten(t)})},t.prototype.getDocumentFromLocalCache=function(t){var e=this;return this.asyncQueue.enqueue(function(){return e.localStore.readDocument(t)}).then(function(t){if(t instanceof ht)return t;if(t instanceof ft)return null;throw new w(_.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")})},t.prototype.getDocumentsFromLocalCache=function(t){var e=this;return this.asyncQueue.enqueue(function(){return e.localStore.executeQuery(t)}).then(function(e){var n=Ne(),r=new gi(t,n),i=r.computeDocChanges(e);return r.applyChanges(i,!1).snapshot})},t.prototype.write=function(t){var e=this,n=new hn;return this.asyncQueue.enqueueAndForget(function(){return e.syncEngine.write(t,n)}),n.promise},t.prototype.databaseId=function(){return this.databaseInfo.databaseId},t.prototype.transaction=function(t){var e=this;return this.asyncQueue.enqueue(function(){return s.__awaiter(e,void 0,void 0,function(){return s.__generator(this,function(t){return[2]})})}).then(function(){return e.syncEngine.runTransaction(t)})},t}(),Ui=function(){function t(t){this.observer=t,this.muted=!1}return t.prototype.next=function(t){this.scheduleEvent(this.observer.next,t)},t.prototype.error=function(t){this.scheduleEvent(this.observer.error,t)},t.prototype.mute=function(){this.muted=!0},t.prototype.scheduleEvent=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},t}(),ji=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t,e,n,r){if(!(e instanceof Array)||e.length<r)throw new w(_.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" argument to be an array with at least "+K(r,"element")+".")}("FieldPath",t,"fieldNames",1);for(var n=0;n<t.length;++n)if(O("FieldPath","string",n,t[n]),0===t[n].length)throw new w(_.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ut(t)}return t.documentId=function(){return t._DOCUMENT_ID},t.prototype.isEqual=function(e){if(!(e instanceof t))throw q("isEqual","FieldPath",1,e);return this._internalPath.isEqual(e._internalPath)},t._DOCUMENT_ID=new t(ut.keyField().canonicalString()),t}(),Vi=new RegExp("[~\\*/\\[\\]]");var Bi=function(){return function(t,e){this.user=e,this.type="OAuth",this.authHeaders={Authorization:"Bearer "+t}}}(),qi=function(){function t(){this.changeListener=null}return t.prototype.getToken=function(){return Promise.resolve(null)},t.prototype.invalidateToken=function(){},t.prototype.setChangeListener=function(t){g(!this.changeListener,"Can only call setChangeListener() once."),this.changeListener=t,t(wi.UNAUTHENTICATED)},t.prototype.removeChangeListener=function(){g(null!==this.changeListener,"removeChangeListener() when no listener registered"),this.changeListener=null},t}(),Wi=function(){function t(t){var e=this;this.app=t,this.tokenListener=null,this.tokenCounter=0,this.changeListener=null,this.forceRefresh=!1,this.tokenListener=function(){e.tokenCounter++,e.currentUser=e.getUser(),e.changeListener&&e.changeListener(e.currentUser)},this.tokenCounter=0,this.app.INTERNAL.addAuthTokenListener(this.tokenListener)}return t.prototype.getToken=function(){var t=this;g(null!=this.tokenListener,"getToken cannot be called after listener removed.");var e=this.tokenCounter,n=this.forceRefresh;return this.forceRefresh=!1,this.app.INTERNAL.getToken(n).then(function(n){if(t.tokenCounter!==e)throw new w(_.ABORTED,"getToken aborted due to token change.");return n?(g("string"===typeof n.accessToken,"Invalid tokenData returned from getToken():"+n),new Bi(n.accessToken,t.currentUser)):null})},t.prototype.invalidateToken=function(){this.forceRefresh=!0},t.prototype.setChangeListener=function(t){g(!this.changeListener,"Can only call setChangeListener() once."),this.changeListener=t,this.currentUser&&t(this.currentUser)},t.prototype.removeChangeListener=function(){g(null!=this.tokenListener,"removeChangeListener() called twice"),g(null!==this.changeListener,"removeChangeListener() called when no listener registered"),this.app.INTERNAL.removeAuthTokenListener(this.tokenListener),this.tokenListener=null,this.changeListener=null},t.prototype.getUser=function(){var t=this.app.INTERNAL.getUid();return g(null===t||"string"===typeof t,"Received invalid UID: "+t),new wi(t)},t}(),Ki=function(){function t(t,e){this.gapi=t,this.sessionIndex=e,this.type="FirstParty",this.user=wi.FIRST_PARTY,g(this.gapi&&this.gapi.auth&&this.gapi.auth.getAuthHeaderValueForFirstParty,"unexpected gapi interface")}return Object.defineProperty(t.prototype,"authHeaders",{get:function(){return{Authorization:this.gapi.auth.getAuthHeaderValueForFirstParty([]),"X-Goog-AuthUser":this.sessionIndex}},enumerable:!0,configurable:!0}),t}(),Qi=function(){function t(t,e){this.gapi=t,this.sessionIndex=e,g(this.gapi&&this.gapi.auth&&this.gapi.auth.getAuthHeaderValueForFirstParty,"unexpected gapi interface")}return t.prototype.getToken=function(){return Promise.resolve(new Ki(this.gapi,this.sessionIndex))},t.prototype.setChangeListener=function(t){t(wi.FIRST_PARTY)},t.prototype.removeChangeListener=function(){},t.prototype.invalidateToken=function(){},t}();function Hi(t){return function(t,e){if("object"!==typeof t||null===t)return!1;for(var n=t,r=0,i=e;r<i.length;r++){var o=i[r];if(o in n&&"function"===typeof n[o])return!0}return!1}(t,["next","error","complete"])}var zi,Gi=function(){function t(t){this._methodName=t}return t.delete=function(){return Yi.instance},t.serverTimestamp=function(){return Xi.instance},t.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return D("FieldValue.arrayUnion",arguments,1),new Ji(t)},t.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return D("FieldValue.arrayRemove",arguments,1),new $i(t)},t.prototype.isEqual=function(t){return this===t},t}(),Yi=function(t){function e(){return t.call(this,"FieldValue.delete")||this}return s.__extends(e,t),e.instance=new e,e}(Gi),Xi=function(t){function e(){return t.call(this,"FieldValue.serverTimestamp")||this}return s.__extends(e,t),e.instance=new e,e}(Gi),Ji=function(t){function e(e){var n=t.call(this,"FieldValue.arrayUnion")||this;return n._elements=e,n}return s.__extends(e,t),e}(Gi),$i=function(t){function e(e){var n=t.call(this,"FieldValue.arrayRemove")||this;return n._elements=e,n}return s.__extends(e,t),e}(Gi),Zi=E(Gi,"Use FieldValue.<field>() instead."),to=/^__.*__$/,eo=function(){function t(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}return t.prototype.toMutations=function(t,e){var n=[];return null!==this.fieldMask?n.push(new ue(t,this.data,this.fieldMask,e)):n.push(new se(t,this.data,e)),this.fieldTransforms.length>0&&n.push(new ce(t,this.fieldTransforms)),n},t}(),no=function(){function t(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}return t.prototype.toMutations=function(t,e){var n=[new ue(t,this.data,this.fieldMask,e)];return this.fieldTransforms.length>0&&n.push(new ce(t,this.fieldTransforms)),n},t}();function ro(t){switch(t){case zi.Set:case zi.MergeSet:case zi.Update:return!0;case zi.Argument:return!1;default:throw m("Unexpected case for UserDataSource: "+t)}}!function(t){t[t.Set=0]="Set",t[t.Update=1]="Update",t[t.MergeSet=2]="MergeSet",t[t.Argument=3]="Argument"}(zi||(zi={}));var io=function(){function t(t,e,n,r,i,o){this.dataSource=t,this.methodName=e,this.path=n,this.arrayElement=r,void 0===i&&this.validatePath(),this.arrayElement=void 0!==r&&r,this.fieldTransforms=i||[],this.fieldMask=o||[]}return t.prototype.childContextForField=function(e){var n=null==this.path?null:this.path.child(e),r=new t(this.dataSource,this.methodName,n,!1,this.fieldTransforms,this.fieldMask);return r.validatePathSegment(e),r},t.prototype.childContextForFieldPath=function(e){var n=null==this.path?null:this.path.child(e),r=new t(this.dataSource,this.methodName,n,!1,this.fieldTransforms,this.fieldMask);return r.validatePath(),r},t.prototype.childContextForArray=function(e){return new t(this.dataSource,this.methodName,null,!0,this.fieldTransforms,this.fieldMask)},t.prototype.createError=function(t){var e=null===this.path||this.path.isEmpty()?"":" (found in field "+this.path.toString()+")";return new w(_.INVALID_ARGUMENT,"Function "+this.methodName+"() called with invalid data. "+t+e)},t.prototype.contains=function(t){return void 0!==this.fieldMask.find(function(e){return t.isPrefixOf(e)})||void 0!==this.fieldTransforms.find(function(e){return t.isPrefixOf(e.field)})},t.prototype.validatePath=function(){if(null!==this.path)for(var t=0;t<this.path.length;t++)this.validatePathSegment(this.path.get(t))},t.prototype.validatePathSegment=function(t){if(ro(this.dataSource)&&to.test(t))throw this.createError("Document fields cannot begin and end with __")},t}(),oo=function(){return function(t,e){this.databaseId=t,this.key=e}}(),ao=function(){function t(t){this.preConverter=t}return t.prototype.parseSetData=function(t,e){var n=new io(zi.Set,t,ut.EMPTY_PATH);uo("Data must be an object, but it was:",n,e);var r=this.parseData(e,n);return new eo(r,null,n.fieldTransforms)},t.prototype.parseMergeData=function(t,e,n){var r=new io(zi.MergeSet,t,ut.EMPTY_PATH);uo("Data must be an object, but it was:",r,e);var i,o,a=this.parseData(e,r);if(n){for(var s=[],u=0,c=n;u<c.length;u++){var l=c[u],h=void 0;if(l instanceof ji)h=l._internalPath;else{if("string"!==typeof l)throw m("Expected stringOrFieldPath to be a string or a FieldPath");h=lo(t,l)}if(!r.contains(h))throw new w(_.INVALID_ARGUMENT,"Field '"+h+"' is specified in your field mask but missing from your input data.");s.push(h)}i=ne.fromArray(s),o=r.fieldTransforms.filter(function(t){return i.covers(t.field)})}else i=ne.fromArray(r.fieldMask),o=r.fieldTransforms;return new eo(a,i,o)},t.prototype.parseUpdateData=function(t,e){var n=this,r=new io(zi.Update,t,ut.EMPTY_PATH);uo("Data must be an object, but it was:",r,e);var i=[],o=Rt.EMPTY;I(e,function(e,a){var s=lo(t,e),u=r.childContextForFieldPath(s);if((a=n.runPreConverter(a,u))instanceof Yi)i.push(s);else{var c=n.parseData(a,u);null!=c&&(i.push(s),o=o.set(s,c))}});var a=ne.fromArray(i);return new no(o,a,r.fieldTransforms)},t.prototype.parseUpdateVarargs=function(t,e,n,r){var i=new io(zi.Update,t,ut.EMPTY_PATH),o=[co(t,e)],a=[n];if(r.length%2!==0)throw new w(_.INVALID_ARGUMENT,"Function "+t+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var s=0;s<r.length;s+=2)o.push(co(t,r[s])),a.push(r[s+1]);var u=[],c=Rt.EMPTY;for(s=0;s<o.length;++s){var l=o[s],h=i.childContextForFieldPath(l),f=this.runPreConverter(a[s],h);if(f instanceof Yi)u.push(l);else{var p=this.parseData(f,h);null!=p&&(u.push(l),c=c.set(l,p))}}var d=ne.fromArray(u);return new no(c,d,i.fieldTransforms)},t.prototype.parseQueryValue=function(t,e){var n=new io(zi.Argument,t,ut.EMPTY_PATH),r=this.parseData(e,n);return g(null!=r,"Parsed data should not be null."),g(0===n.fieldTransforms.length,"Field transforms should have been disallowed."),r},t.prototype.runPreConverter=function(t,e){try{return this.preConverter(t)}catch(r){var n=ho(r);throw e.createError(n)}},t.prototype.parseData=function(t,e){if(so(t=this.runPreConverter(t,e)))return uo("Unsupported field value:",e,t),this.parseObject(t,e);if(t instanceof Gi)return this.parseSentinelFieldValue(t,e),null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.arrayElement)throw e.createError("Nested arrays are not supported");return this.parseArray(t,e)}return this.parseScalarValue(t,e)},t.prototype.parseObject=function(t,e){var n=this,r=new dt(H);return N(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):I(t,function(t,i){var o=n.parseData(i,e.childContextForField(t));null!=o&&(r=r.insert(t,o))}),new Rt(r)},t.prototype.parseArray=function(t,e){for(var n=[],r=0,i=0,o=t;i<o.length;i++){var a=o[i],s=this.parseData(a,e.childContextForArray(r));null==s&&(s=_t.INSTANCE),n.push(s),r++}return new Pt(n)},t.prototype.parseSentinelFieldValue=function(t,e){if(!ro(e.dataSource))throw e.createError(t._methodName+"() can only be used with update() and set()");if(null===e.path)throw e.createError(t._methodName+"() is not currently supported inside arrays");if(t instanceof Yi){if(e.dataSource!==zi.MergeSet)throw e.dataSource===zi.Update?(g(e.path.length>0,"FieldValue.delete() at the top level should have already been handled."),e.createError("FieldValue.delete() can only appear at the top level of your update data")):e.createError("FieldValue.delete() cannot be used with set() unless you pass {merge:true}");e.fieldMask.push(e.path)}else if(t instanceof Xi)e.fieldTransforms.push(new re(e.path,he.instance));else if(t instanceof Ji){var n=this.parseArrayTransformElements(t._methodName,t._elements),r=new fe(n);e.fieldTransforms.push(new re(e.path,r))}else if(t instanceof $i){n=this.parseArrayTransformElements(t._methodName,t._elements);var i=new pe(n);e.fieldTransforms.push(new re(e.path,i))}else m("Unknown FieldValue type: "+t)},t.prototype.parseScalarValue=function(t,e){if(null===t)return _t.INSTANCE;if("number"===typeof t)return jt(t)?new St(t):new Ct(t);if("boolean"===typeof t)return wt.of(t);if("string"===typeof t)return new It(t);if(t instanceof Date)return new Nt(et.fromDate(t));if(t instanceof et)return new Nt(new et(t.seconds,1e3*Math.floor(t.nanoseconds/1e3)));if(t instanceof tt)return new Ot(t);if(t instanceof $)return new Dt(t);if(t instanceof oo)return new At(t.databaseId,t.key);throw e.createError("Unsupported field value: "+j(t))},t.prototype.parseArrayTransformElements=function(t,e){var n=this;return e.map(function(e,r){var i=new io(zi.Argument,t,ut.EMPTY_PATH);return n.parseData(e,i.childContextForArray(r))})},t}();function so(t){return"object"===typeof t&&null!==t&&!(t instanceof Array)&&!(t instanceof Date)&&!(t instanceof et)&&!(t instanceof tt)&&!(t instanceof $)&&!(t instanceof oo)&&!(t instanceof Gi)}function uo(t,e,n){if(!so(n)||!U(n)){var r=j(n);throw"an object"===r?e.createError(t+" a custom object"):e.createError(t+" "+r)}}function co(t,e){if(e instanceof ji)return e._internalPath;if("string"===typeof e)return lo(t,e);throw new w(_.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. Field path arguments must be of type string or FieldPath.")}function lo(t,e){try{return function(t){if(t.search(Vi)>=0)throw new w(_.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(ji.bind.apply(ji,[void 0].concat(t.split("."))))}catch(e){throw new w(_.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e)._internalPath}catch(r){var n=ho(r);throw new w(_.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. "+n)}}function ho(t){return t instanceof Error?t.message:t.toString()}var fo="firestore.googleapis.com",po=!0,yo=!1,mo=Sr.COLLECTION_DISABLED,go=function(){function t(t){if(void 0===t.host){if(void 0!==t.ssl)throw new w(_.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=fo,this.ssl=po}else P("settings","non-empty string","host",t.host),this.host=t.host,x("settings","boolean","ssl",t.ssl),this.ssl=S(t.ssl,po);if(B("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes"]),x("settings","object","credentials",t.credentials),this.credentials=t.credentials,x("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),this.timestampsInSnapshots=S(t.timestampsInSnapshots,yo),x("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=Sr.DEFAULT_CACHE_SIZE_BYTES;else{if(t.cacheSizeBytes!==mo&&t.cacheSizeBytes<Sr.MINIMUM_CACHE_SIZE_BYTES)throw new w(_.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+Sr.MINIMUM_CACHE_SIZE_BYTES);this.cacheSizeBytes=t.cacheSizeBytes}}return t.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.timestampsInSnapshots===t.timestampsInSnapshots&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes},t}(),vo=function(){return function(){}}(),bo=function(){function t(e){var n=this;this._queue=new pn,this.INTERNAL={delete:function(t){return s.__awaiter(n,void 0,void 0,function(){return s.__generator(this,function(e){return this._firestoreClient?[2,this._firestoreClient.shutdown(t)]:[2]})})}};var r=new vo;if("object"===typeof e.options){var i=e;r.firebaseApp=i,r.databaseId=t.databaseIdFromApp(i),r.persistenceKey=r.firebaseApp.name,r.credentials=new Wi(i)}else{var o=e;if(!o.projectId)throw new w(_.INVALID_ARGUMENT,"Must provide projectId");r.databaseId=new it(o.projectId,o.database),r.persistenceKey="[DEFAULT]",r.credentials=new qi}r.settings=new go({}),this._config=r,this._databaseId=r.databaseId}return t.prototype.settings=function(t){if(k("Firestore.settings",arguments,1),O("Firestore.settings","object",1,t),T(t,"persistence"))throw new w(_.INVALID_ARGUMENT,'"persistence" is now specified with a separate call to firestore.enablePersistence().');var e=new go(t);if(this._firestoreClient&&!this._config.settings.isEqual(e))throw new w(_.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");this._config.settings=e,void 0!==e.credentials&&(this._config.credentials=function(t){if(!t)return new qi;switch(t.type){case"gapi":return new Qi(t.client,t.sessionIndex||"0");case"provider":return t.client;default:throw new w(_.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))},t.prototype.enableNetwork=function(){return this.ensureClientConfigured(),this._firestoreClient.enableNetwork()},t.prototype.disableNetwork=function(){return this.ensureClientConfigured(),this._firestoreClient.disableNetwork()},t.prototype.enablePersistence=function(t){if(this._firestoreClient)throw new w(_.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");return this.configureClient(new Li(this._config.settings.cacheSizeBytes,void 0!==t&&S(t.experimentalTabSynchronization,!1)))},t.prototype.ensureClientConfigured=function(){return this._firestoreClient||this.configureClient(new Mi),this._firestoreClient},t.prototype.configureClient=function(t){var e=this;g(!!this._config.settings.host,"FirestoreSettings.host cannot be falsey"),this._config.settings.timestampsInSnapshots||d("\nThe behavior for Date objects stored in Firestore is going to change\nAND YOUR APP MAY BREAK.\nTo hide this warning and ensure your app does not break, you need to add the\nfollowing code to your app before calling any other Cloud Firestore methods:\n\n  const firestore = firebase.firestore();\n  const settings = {/* your settings... */ timestampsInSnapshots: true};\n  firestore.settings(settings);\n\nWith this change, timestamps stored in Cloud Firestore will be read back as\nFirebase Timestamp objects instead of as system Date objects. So you will also\nneed to update code expecting a Date to instead expect a Timestamp. For example:\n\n  // Old:\n  const date = snapshot.get('created_at');\n  // New:\n  const timestamp = snapshot.get('created_at');\n  const date = timestamp.toDate();\n\nPlease audit all existing usages of Date when you enable the new behavior. In a\nfuture release, the behavior will change to the new behavior, so if you do not\nfollow these steps, YOUR APP MAY BREAK."),g(!this._firestoreClient,"configureClient() called multiple times");var n=new nt(this._config.databaseId,this._config.persistenceKey,this._config.settings.host,this._config.settings.ssl);return this._dataConverter=new ao(function(t){if(t instanceof Eo){var n=e._config.databaseId,r=t.firestore._config.databaseId;if(!r.isEqual(n))throw new w(_.INVALID_ARGUMENT,"Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return new oo(e._config.databaseId,t._key)}return t}),this._firestoreClient=new Fi(v.getPlatform(),n,this._config.credentials,this._queue),this._firestoreClient.start(t)},t.databaseIdFromApp=function(t){var e=t.options;if(!T(e,"projectId"))throw new w(_.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var n=e.projectId;if(!n||"string"!==typeof n)throw new w(_.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new it(n)},Object.defineProperty(t.prototype,"app",{get:function(){if(!this._config.firebaseApp)throw new w(_.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._config.firebaseApp},enumerable:!0,configurable:!0}),t.prototype.collection=function(t){if(k("Firestore.collection",arguments,1),O("Firestore.collection","non-empty string",1,t),!t)throw new w(_.INVALID_ARGUMENT,"Must provide a non-empty collection path to collection()");return this.ensureClientConfigured(),new ko(at.fromString(t),this)},t.prototype.doc=function(t){if(k("Firestore.doc",arguments,1),O("Firestore.doc","non-empty string",1,t),!t)throw new w(_.INVALID_ARGUMENT,"Must provide a non-empty document path to doc()");return this.ensureClientConfigured(),Eo.forPath(at.fromString(t),this)},t.prototype.runTransaction=function(t){var e=this;return k("Firestore.runTransaction",arguments,1),O("Firestore.runTransaction","function",1,t),this.ensureClientConfigured().transaction(function(n){return t(new _o(e,n))})},t.prototype.batch=function(){return this.ensureClientConfigured(),new wo(this)},Object.defineProperty(t,"logLevel",{get:function(){switch(h()){case i.DEBUG:return"debug";case i.ERROR:return"error";case i.SILENT:return"silent";default:return m("Unknown log level: "+h())}},enumerable:!0,configurable:!0}),t.setLogLevel=function(t){switch(k("Firestore.setLogLevel",arguments,1),O("Firestore.setLogLevel","non-empty string",1,t),t){case"debug":f(i.DEBUG);break;case"error":f(i.ERROR);break;case"silent":f(i.SILENT);break;default:throw new w(_.INVALID_ARGUMENT,"Invalid log level: "+t)}},t.prototype._areTimestampsInSnapshotsEnabled=function(){return this._config.settings.timestampsInSnapshots},t}(),_o=function(){function t(t,e){this._firestore=t,this._transaction=e}return t.prototype.get=function(t){var e=this;k("Transaction.get",arguments,1);var n=Ro("Transaction.get",t,this._firestore);return this._transaction.lookup([n._key]).then(function(t){if(!t||1!==t.length)return m("Mismatch in docs returned from document lookup.");var r=t[0];if(r instanceof ft)return new So(e._firestore,n._key,null,!1,!1);if(r instanceof ht)return new So(e._firestore,n._key,r,!1,!1);throw m("BatchGetDocumentsRequest returned unexpected document type: "+r.constructor.name)})},t.prototype.set=function(t,e,n){A("Transaction.set",arguments,2,3);var r=Ro("Transaction.set",t,this._firestore),i=(n=Do("Transaction.set",n)).merge||n.mergeFields?this._firestore._dataConverter.parseMergeData("Transaction.set",e,n.mergeFields):this._firestore._dataConverter.parseSetData("Transaction.set",e);return this._transaction.set(r._key,i),this},t.prototype.update=function(t,e,n){for(var r,i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return"string"===typeof e||e instanceof ji?(D("Transaction.update",arguments,3),r=Ro("Transaction.update",t,this._firestore),i=this._firestore._dataConverter.parseUpdateVarargs("Transaction.update",e,n,o)):(k("Transaction.update",arguments,2),r=Ro("Transaction.update",t,this._firestore),i=this._firestore._dataConverter.parseUpdateData("Transaction.update",e)),this._transaction.update(r._key,i),this},t.prototype.delete=function(t){k("Transaction.delete",arguments,1);var e=Ro("Transaction.delete",t,this._firestore);return this._transaction.delete(e._key),this},t}(),wo=function(){function t(t){this._firestore=t,this._mutations=[],this._committed=!1}return t.prototype.set=function(t,e,n){A("WriteBatch.set",arguments,2,3),this.verifyNotCommitted();var r=Ro("WriteBatch.set",t,this._firestore),i=(n=Do("WriteBatch.set",n)).merge||n.mergeFields?this._firestore._dataConverter.parseMergeData("WriteBatch.set",e,n.mergeFields):this._firestore._dataConverter.parseSetData("WriteBatch.set",e);return this._mutations=this._mutations.concat(i.toMutations(r._key,oe.NONE)),this},t.prototype.update=function(t,e,n){for(var r,i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return this.verifyNotCommitted(),"string"===typeof e||e instanceof ji?(D("WriteBatch.update",arguments,3),r=Ro("WriteBatch.update",t,this._firestore),i=this._firestore._dataConverter.parseUpdateVarargs("WriteBatch.update",e,n,o)):(k("WriteBatch.update",arguments,2),r=Ro("WriteBatch.update",t,this._firestore),i=this._firestore._dataConverter.parseUpdateData("WriteBatch.update",e)),this._mutations=this._mutations.concat(i.toMutations(r._key,oe.exists(!0))),this},t.prototype.delete=function(t){k("WriteBatch.delete",arguments,1),this.verifyNotCommitted();var e=Ro("WriteBatch.delete",t,this._firestore);return this._mutations=this._mutations.concat(new le(e._key,oe.NONE)),this},t.prototype.commit=function(){return s.__awaiter(this,void 0,void 0,function(){return s.__generator(this,function(t){return this.verifyNotCommitted(),this._committed=!0,this._mutations.length>0?[2,this._firestore.ensureClientConfigured().write(this._mutations)]:[2]})})},t.prototype.verifyNotCommitted=function(){if(this._committed)throw new w(_.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},t}(),Eo=function(){function t(t,e){this._key=t,this.firestore=e,this._firestoreClient=this.firestore.ensureClientConfigured()}return t.forPath=function(e,n){if(e.length%2!==0)throw new w(_.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+e.canonicalString()+" has "+e.length);return new t(new ct(e),n)},Object.defineProperty(t.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return new ko(this._key.path.popLast(),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this._key.path.canonicalString()},enumerable:!0,configurable:!0}),t.prototype.collection=function(t){if(k("DocumentReference.collection",arguments,1),O("DocumentReference.collection","non-empty string",1,t),!t)throw new w(_.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=at.fromString(t);return new ko(this._key.path.child(e),this.firestore)},t.prototype.isEqual=function(e){if(!(e instanceof t))throw q("isEqual","DocumentReference",1,e);return this.firestore===e.firestore&&this._key.isEqual(e._key)},t.prototype.set=function(t,e){A("DocumentReference.set",arguments,1,2);var n=(e=Do("DocumentReference.set",e)).merge||e.mergeFields?this.firestore._dataConverter.parseMergeData("DocumentReference.set",t,e.mergeFields):this.firestore._dataConverter.parseSetData("DocumentReference.set",t);return this._firestoreClient.write(n.toMutations(this._key,oe.NONE))},t.prototype.update=function(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return"string"===typeof t||t instanceof ji?(D("DocumentReference.update",arguments,2),n=this.firestore._dataConverter.parseUpdateVarargs("DocumentReference.update",t,e,r)):(k("DocumentReference.update",arguments,1),n=this.firestore._dataConverter.parseUpdateData("DocumentReference.update",t)),this._firestoreClient.write(n.toMutations(this._key,oe.exists(!0)))},t.prototype.delete=function(){return k("DocumentReference.delete",arguments,0),this._firestoreClient.write([new le(this._key,oe.NONE)])},t.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];A("DocumentReference.onSnapshot",arguments,1,4);var n,r={includeMetadataChanges:!1},i=0;"object"!==typeof t[i]||Hi(t[i])||(B("DocumentReference.onSnapshot",r=t[i],["includeMetadataChanges"]),x("DocumentReference.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++);var o={includeMetadataChanges:r.includeMetadataChanges};return Hi(t[i])?n=t[i]:(O("DocumentReference.onSnapshot","function",i,t[i]),R("DocumentReference.onSnapshot","function",i+1,t[i+1]),R("DocumentReference.onSnapshot","function",i+2,t[i+2]),n={next:t[i],error:t[i+1],complete:t[i+2]}),this.onSnapshotInternal(o,n)},t.prototype.onSnapshotInternal=function(t,e){var n=this,r=function(t){console.error("Uncaught Error in onSnapshot:",t)};e.error&&(r=e.error.bind(e));var i=new Ui({next:function(t){if(e.next){g(t.docs.size<=1,"Too many documents returned on a document query");var r=t.docs.get(n._key);e.next(new So(n.firestore,n._key,r,t.fromCache,t.hasPendingWrites))}},error:r}),o=this._firestoreClient.listen(Bt.atPath(this._key.path),i,t);return function(){i.mute(),n._firestoreClient.unlisten(o)}},t.prototype.get=function(t){var e=this;return A("DocumentReference.get",arguments,0,1),Oo("DocumentReference.get",t),new Promise(function(n,r){t&&"cache"===t.source?e.firestore.ensureClientConfigured().getDocumentFromLocalCache(e._key).then(function(t){n(new So(e.firestore,e._key,t,!0,t instanceof ht&&t.hasLocalMutations))},r):e.getViaSnapshotListener(n,r,t)})},t.prototype.getViaSnapshotListener=function(t,e,n){var r=this.onSnapshotInternal({includeMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(i){r(),!i.exists&&i.metadata.fromCache?e(new w(_.UNAVAILABLE,"Failed to get document because the client is offline.")):i.exists&&i.metadata.fromCache&&n&&"server"===n.source?e(new w(_.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):t(i)},error:e})},t}(),To=function(){function t(t,e){this.hasPendingWrites=t,this.fromCache=e}return t.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},t}(),So=function(){function t(t,e,n,r,i){this._firestore=t,this._key=e,this._document=n,this._fromCache=r,this._hasPendingWrites=i}return t.prototype.data=function(t){return A("DocumentSnapshot.data",arguments,0,1),t=Ao("DocumentSnapshot.data",t),this._document?this.convertObject(this._document.data,vt.fromSnapshotOptions(t,this._firestore._areTimestampsInSnapshotsEnabled())):void 0},t.prototype.get=function(t,e){if(A("DocumentSnapshot.get",arguments,1,2),e=Ao("DocumentSnapshot.get",e),this._document){var n=this._document.data.field(co("DocumentSnapshot.get",t));if(void 0!==n)return this.convertValue(n,vt.fromSnapshotOptions(e,this._firestore._areTimestampsInSnapshotsEnabled()))}},Object.defineProperty(t.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ref",{get:function(){return new Eo(this._key,this._firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"exists",{get:function(){return null!==this._document},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"metadata",{get:function(){return new To(this._hasPendingWrites,this._fromCache)},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(e){if(!(e instanceof t))throw q("isEqual","DocumentSnapshot",1,e);return this._firestore===e._firestore&&this._fromCache===e._fromCache&&this._key.isEqual(e._key)&&(null===this._document?null===e._document:this._document.isEqual(e._document))},t.prototype.convertObject=function(t,e){var n=this,r={};return t.forEach(function(t,i){r[t]=n.convertValue(i,e)}),r},t.prototype.convertValue=function(t,e){if(t instanceof Rt)return this.convertObject(t,e);if(t instanceof Pt)return this.convertArray(t,e);if(t instanceof At){var n=t.value(e),r=this._firestore.ensureClientConfigured().databaseId();return t.databaseId.isEqual(r)||d("Document "+this._key.path+" contains a document reference within a different database ("+t.databaseId.projectId+"/"+t.databaseId.database+") which is not supported. It will be treated as a reference in the current database ("+r.projectId+"/"+r.database+") instead."),new Eo(n,this._firestore)}return t.value(e)},t.prototype.convertArray=function(t,e){var n=this;return t.internalValue.map(function(t){return n.convertValue(t,e)})},t}(),Co=function(t){function e(e,n,r,i,o){return t.call(this,e,n,r,i,o)||this}return s.__extends(e,t),e.prototype.data=function(e){var n=t.prototype.data.call(this,e);return g("object"===typeof n,"Document in a QueryDocumentSnapshot should exist"),n},e}(So),Io=function(){function t(t,e){this._query=t,this.firestore=e}return t.prototype.where=function(e,n,r){var i;k("Query.where",arguments,3),O("Query.where","non-empty string",2,n),V("Query.where",3,r);var o=co("Query.where",e),a=Wt.fromString(n);if(o.isKeyField()){if(a===Wt.ARRAY_CONTAINS)throw new w(_.INVALID_ARGUMENT,"Invalid Query. You can't perform array-contains queries on FieldPath.documentId() since document IDs are not arrays.");if("string"===typeof r){if(-1!==r.indexOf("/"))throw new w(_.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it contains a slash.");if(""===r)throw new w(_.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it was an empty string.");var s=this._query.path.child(new at([r]));g(s.length%2===0,"Path should be a document key"),i=new At(this.firestore._databaseId,new ct(s))}else{if(!(r instanceof Eo))throw new w(_.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a string or a DocumentReference if the first parameter is FieldPath.documentId(), but it was: "+j(r)+".");var u=r;i=new At(this.firestore._databaseId,u._key)}}else i=this.firestore._dataConverter.parseQueryValue("Query.where",r);var c=qt.create(o,a,i);return this.validateNewFilter(c),new t(this._query.addFilter(c),this.firestore)},t.prototype.orderBy=function(e,n){var r;if(A("Query.orderBy",arguments,1,2),R("Query.orderBy","non-empty string",2,n),void 0===n||"asc"===n)r=zt.ASCENDING;else{if("desc"!==n)throw new w(_.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+n+"', expected 'asc' or 'desc'.");r=zt.DESCENDING}if(null!==this._query.startAt)throw new w(_.INVALID_ARGUMENT,"Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");if(null!==this._query.endAt)throw new w(_.INVALID_ARGUMENT,"Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");var i=co("Query.orderBy",e),o=new Yt(i,r);return this.validateNewOrderBy(o),new t(this._query.addOrderBy(o),this.firestore)},t.prototype.limit=function(e){if(k("Query.limit",arguments,1),O("Query.limit","number",1,e),e<=0)throw new w(_.INVALID_ARGUMENT,"Invalid Query. Query limit ("+e+") is invalid. Limit must be positive.");return new t(this._query.withLimit(e),this.firestore)},t.prototype.startAt=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];D("Query.startAt",arguments,1);var i=this.boundFromDocOrFields("Query.startAt",e,n,!0);return new t(this._query.withStartAt(i),this.firestore)},t.prototype.startAfter=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];D("Query.startAfter",arguments,1);var i=this.boundFromDocOrFields("Query.startAfter",e,n,!1);return new t(this._query.withStartAt(i),this.firestore)},t.prototype.endBefore=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];D("Query.endBefore",arguments,1);var i=this.boundFromDocOrFields("Query.endBefore",e,n,!0);return new t(this._query.withEndAt(i),this.firestore)},t.prototype.endAt=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];D("Query.endAt",arguments,1);var i=this.boundFromDocOrFields("Query.endAt",e,n,!1);return new t(this._query.withEndAt(i),this.firestore)},t.prototype.isEqual=function(e){if(!(e instanceof t))throw q("isEqual","Query",1,e);return this.firestore===e.firestore&&this._query.isEqual(e._query)},t.prototype.boundFromDocOrFields=function(t,e,n,r){if(V(t,1,e),e instanceof So){if(n.length>0)throw new w(_.INVALID_ARGUMENT,"Too many arguments provided to "+t+"().");var i=e;if(!i.exists)throw new w(_.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+t+"().");return this.boundFromDocument(t,i._document,r)}var o=[e].concat(n);return this.boundFromFields(t,o,r)},t.prototype.boundFromDocument=function(t,e,n){for(var r=[],i=0,o=this._query.orderBy;i<o.length;i++){var a=o[i];if(a.field.isKeyField())r.push(new At(this.firestore._databaseId,e.key));else{var s=e.field(a.field);if(void 0===s){var u=a.field.canonicalString();throw new w(_.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+u+"' (used as the orderBy) does not exist.")}r.push(s)}}return new Gt(r,n)},t.prototype.boundFromFields=function(t,e,n){var r=this._query.explicitOrderBy;if(e.length>r.length)throw new w(_.INVALID_ARGUMENT,"Too many arguments provided to "+t+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var i=[],o=0;o<e.length;o++){var a=e[o];if(r[o].field.isKeyField()){if("string"!==typeof a)throw new w(_.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+t+"(), but got a "+typeof a);if(-1!==a.indexOf("/"))throw new w(_.INVALID_ARGUMENT,"Invalid query. Document ID '"+a+"' contains a slash in "+t+"()");var s=new ct(this._query.path.child(a));i.push(new At(this.firestore._databaseId,s))}else{var u=this.firestore._dataConverter.parseQueryValue(t,a);i.push(u)}}return new Gt(i,n)},t.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];A("Query.onSnapshot",arguments,1,4);var n,r={},i=0;return"object"!==typeof t[i]||Hi(t[i])||(B("Query.onSnapshot",r=t[i],["includeMetadataChanges"]),x("Query.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++),Hi(t[i])?n=t[i]:(O("Query.onSnapshot","function",i,t[i]),R("Query.onSnapshot","function",i+1,t[i+1]),R("Query.onSnapshot","function",i+2,t[i+2]),n={next:t[i],error:t[i+1],complete:t[i+2]}),this.onSnapshotInternal(r,n)},t.prototype.onSnapshotInternal=function(t,e){var n=this,r=function(t){console.error("Uncaught Error in onSnapshot:",t)};e.error&&(r=e.error.bind(e));var i=new Ui({next:function(t){e.next&&e.next(new No(n.firestore,n._query,t))},error:r}),o=this.firestore.ensureClientConfigured(),a=o.listen(this._query,i,t);return function(){i.mute(),o.unlisten(a)}},t.prototype.get=function(t){var e=this;return A("Query.get",arguments,0,1),Oo("Query.get",t),new Promise(function(n,r){t&&"cache"===t.source?e.firestore.ensureClientConfigured().getDocumentsFromLocalCache(e._query).then(function(t){n(new No(e.firestore,e._query,t))},r):e.getViaSnapshotListener(n,r,t)})},t.prototype.getViaSnapshotListener=function(t,e,n){var r=this.onSnapshotInternal({includeMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(i){r(),i.metadata.fromCache&&n&&"server"===n.source?e(new w(_.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):t(i)},error:e})},t.prototype.validateNewFilter=function(t){if(t instanceof Kt)if(t.isInequality()){var e=this._query.getInequalityFilterField();if(null!==e&&!e.isEqual(t.field))throw new w(_.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+e.toString()+"' and '"+t.field.toString()+"'");var n=this._query.getFirstOrderByField();null!==n&&this.validateOrderByAndInequalityMatch(t.field,n)}else if(t.op===Wt.ARRAY_CONTAINS&&this._query.hasArrayContainsFilter())throw new w(_.INVALID_ARGUMENT,"Invalid query. Queries only support a single array-contains filter.")},t.prototype.validateNewOrderBy=function(t){if(null===this._query.getFirstOrderByField()){var e=this._query.getInequalityFilterField();null!==e&&this.validateOrderByAndInequalityMatch(e,t.field)}},t.prototype.validateOrderByAndInequalityMatch=function(t,e){if(!e.isEqual(t))throw new w(_.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+t.toString()+"' and so you must also use '"+t.toString()+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+e.toString()+"' instead.")},t}(),No=function(){function t(t,e,n){this._firestore=t,this._originalQuery=e,this._snapshot=n,this._cachedChanges=null,this._cachedChangesIncludeMetadataChanges=null,this.metadata=new To(n.hasPendingWrites,n.fromCache)}return Object.defineProperty(t.prototype,"docs",{get:function(){var t=[];return this.forEach(function(e){return t.push(e)}),t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this._snapshot.docs.isEmpty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._snapshot.docs.size},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t,e){var n=this;A("QuerySnapshot.forEach",arguments,1,2),O("QuerySnapshot.forEach","function",1,t),this._snapshot.docs.forEach(function(r){t.call(e,n.convertToDocumentImpl(r))})},Object.defineProperty(t.prototype,"query",{get:function(){return new Io(this._originalQuery,this._firestore)},enumerable:!0,configurable:!0}),t.prototype.docChanges=function(t){t&&(B("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),x("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this._snapshot.excludesMetadataChanges)throw new w(_.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e,n){if(n.oldDocs.isEmpty()){var r,i=0;return n.docChanges.map(function(e){var o=new Co(t,e.doc.key,e.doc,n.fromCache,n.mutatedKeys.has(e.doc.key));return g(e.type===Ae.Added,"Invalid event type for first snapshot"),g(!r||n.query.docComparator(r,e.doc)<0,"Got added events in wrong order"),r=e.doc,{type:"added",doc:o,oldIndex:-1,newIndex:i++}})}var o=n.oldDocs;return n.docChanges.filter(function(t){return e||t.type!==Ae.Metadata}).map(function(e){var r=new Co(t,e.doc.key,e.doc,n.fromCache,n.mutatedKeys.has(e.doc.key)),i=-1,a=-1;return e.type!==Ae.Added&&(g((i=o.indexOf(e.doc.key))>=0,"Index for document not found"),o=o.delete(e.doc.key)),e.type!==Ae.Removed&&(o=o.add(e.doc),a=o.indexOf(e.doc.key)),{type:Po(e.type),doc:r,oldIndex:i,newIndex:a}})}(this._firestore,e,this._snapshot),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges},t.prototype.isEqual=function(e){if(!(e instanceof t))throw q("isEqual","QuerySnapshot",1,e);return this._firestore===e._firestore&&this._originalQuery.isEqual(e._originalQuery)&&this._snapshot.isEqual(e._snapshot)},t.prototype.convertToDocumentImpl=function(t){return new Co(this._firestore,t.key,t,this.metadata.fromCache,this._snapshot.mutatedKeys.has(t.key))},t}();["length","forEach","map"].concat("undefined"!==typeof Symbol?[Symbol.iterator]:[]).forEach(function(t){try{Object.defineProperty(No.prototype.docChanges,t,{get:function(){return function(){throw new w(_.INVALID_ARGUMENT,'QuerySnapshot.docChanges has been changed from a property into a method, so usages like "querySnapshot.docChanges" should become "querySnapshot.docChanges()"')}()}})}catch(e){}});var ko=function(t){function e(e,n){var r=t.call(this,Bt.atPath(e),n)||this;if(e.length%2!==1)throw new w(_.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+e.canonicalString()+" has "+e.length);return r}return s.__extends(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this._query.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){var t=this._query.path.popLast();return t.isEmpty()?null:new Eo(new ct(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._query.path.canonicalString()},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if(A("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=Q.newId()),O("CollectionReference.doc","non-empty string",1,t),""===t)throw new w(_.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=at.fromString(t);return Eo.forPath(this._query.path.child(e),this.firestore)},e.prototype.add=function(t){k("CollectionReference.add",arguments,1),O("CollectionReference.add","object",1,t);var e=this.doc();return e.set(t).then(function(){return e})},e}(Io);function Do(t,e){if(void 0===e)return{merge:!1};if(B(t,e,["merge","mergeFields"]),x(t,"boolean","merge",e.merge),L(t,"mergeFields","a string or a FieldPath",e.mergeFields,function(t){return"string"===typeof t||t instanceof ji}),void 0!==e.mergeFields&&void 0!==e.merge)throw new w(_.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function Ao(t,e){return void 0===e?{}:(B(t,e,["serverTimestamps"]),M(t,0,"serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function Oo(t,e){R(t,"object",1,e),e&&(B(t,e,["source"]),M(t,0,"source",e.source,["default","server","cache"]))}function Ro(t,e,n){if(e instanceof Eo){if(e.firestore!==n)throw new w(_.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw q(t,"DocumentReference",1,e)}function Po(t){switch(t){case Ae.Added:return"added";case Ae.Modified:case Ae.Metadata:return"modified";case Ae.Removed:return"removed";default:return m("Unknown change type: "+t)}}var xo=E(bo,"Use firebase.firestore() instead."),Lo=E(_o,"Use firebase.firestore().runTransaction() instead."),Mo=E(wo,"Use firebase.firestore().batch() instead."),Fo=E(Eo,"Use firebase.firestore().doc() instead."),Uo=E(So),jo=E(Co),Vo=E(Io),Bo=E(No),qo=E(ko,"Use firebase.firestore().collection() instead."),Wo={Firestore:xo,GeoPoint:tt,Timestamp:et,Blob:Z,Transaction:Lo,WriteBatch:Mo,DocumentReference:Fo,DocumentSnapshot:Uo,Query:Vo,QueryDocumentSnapshot:jo,QuerySnapshot:Bo,CollectionReference:qo,FieldPath:ji,FieldValue:Zi,setLogLevel:bo.setLogLevel,CACHE_SIZE_UNLIMITED:mo};function Ko(t){t.INTERNAL.registerService("firestore",function(t){return new bo(t)},function(t){g(t&&"object"===typeof t,"shallowCopy() expects object parameter.");var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}(Wo))}function Qo(t){Ko(t)}Qo(o),e.registerFirestore=Qo},function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"createWebChannelTransport",function(){return Rn}),n.d(e,"ErrorCode",function(){return Pn}),n.d(e,"EventType",function(){return xn}),n.d(e,"WebChannel",function(){return Ln}),n.d(e,"XhrIoPool",function(){return Mn});var r,i="undefined"!==typeof window?window:"undefined"!==typeof t?t:"undefined"!==typeof self?self:{},o=o||{},a=i;function s(t){return"string"==typeof t}function u(t,e){t=t.split("."),e=e||a;for(var n=0;n<t.length;n++)if(null==(e=e[t[n]]))return null;return e}function c(){}function l(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&&"undefined"!=typeof t.splice&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||"undefined"!=typeof t.call&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&"undefined"==typeof t.call)return"object";return e}function h(t){return"array"==l(t)}function f(t){var e=l(t);return"array"==e||"object"==e&&"number"==typeof t.length}function p(t){return"function"==l(t)}function d(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var y="closure_uid_"+(1e9*Math.random()>>>0),m=0;function g(t,e,n){return t.call.apply(t.bind,arguments)}function v(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function b(t,e,n){return(b=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?g:v).apply(null,arguments)}function _(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}var w=Date.now||function(){return+new Date};function E(t,e){function n(){}n.prototype=e.prototype,t.L=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.mh=function(t,n,r){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.prototype[n].apply(t,i)}}function T(t){if(Error.captureStackTrace)Error.captureStackTrace(this,T);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))}function S(t,e){for(var n="",r=(t=t.split("%s")).length-1,i=0;i<r;i++)n+=t[i]+(i<e.length?e[i]:"%s");T.call(this,n+t[r])}function C(){0!=I&&(N[this[y]||(this[y]=++m)]=this),this.Ka=this.Ka,this.Qa=this.Qa}E(T,Error),T.prototype.name="CustomError",E(S,T),S.prototype.name="AssertionError";var I=0,N={};C.prototype.Ka=!1,C.prototype.bb=function(){if(!this.Ka&&(this.Ka=!0,this.F(),0!=I)){var t=this[y]||(this[y]=++m);if(0!=I&&this.Qa&&0<this.Qa.length)throw Error(this+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete N[t]}},C.prototype.F=function(){if(this.Qa)for(;this.Qa.length;)this.Qa.shift()()};var k=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(s(t))return s(e)&&1==e.length?t.indexOf(e,0):-1;for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},D=Array.prototype.lastIndexOf?function(t,e){return Array.prototype.lastIndexOf.call(t,e,t.length-1)}:function(t,e){var n=t.length-1;if(0>n&&(n=Math.max(0,t.length+n)),s(t))return s(e)&&1==e.length?t.lastIndexOf(e,n):-1;for(;0<=n;n--)if(n in t&&t[n]===e)return n;return-1},A=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i=s(t)?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)},O=Array.prototype.some?function(t,e){return Array.prototype.some.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=s(t)?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t))return!0;return!1};function R(t){if(!h(t))for(var e=t.length-1;0<=e;e--)delete t[e];t.length=0}function P(t,e){var n;return(n=0<=(e=k(t,e)))&&Array.prototype.splice.call(t,e,1),n}function x(t){return Array.prototype.concat.apply([],arguments)}function L(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function M(t){return/^[\s\xa0]*$/.test(t)}var F,U=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function j(t,e){return t<e?-1:t>e?1:0}t:{var V=a.navigator;if(V){var B=V.userAgent;if(B){F=B;break t}}F=""}function q(t){return-1!=F.indexOf(t)}function W(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function K(t){var e,n=[],r=0;for(e in t)n[r++]=t[e];return n}function Q(t){var e,n=[],r=0;for(e in t)n[r++]=e;return n}function H(t){var e,n={};for(e in t)n[e]=t[e];return n}var z="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function G(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var o=0;o<z.length;o++)n=z[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Y(t){return Y[" "](t),t}Y[" "]=c;var X,J=q("Opera"),$=q("Trident")||q("MSIE"),Z=q("Edge"),tt=Z||$,et=q("Gecko")&&!(-1!=F.toLowerCase().indexOf("webkit")&&!q("Edge"))&&!(q("Trident")||q("MSIE"))&&!q("Edge"),nt=-1!=F.toLowerCase().indexOf("webkit")&&!q("Edge");function rt(){var t=a.document;return t?t.documentMode:void 0}t:{var it="",ot=function(){var t=F;return et?/rv:([^\);]+)(\)|;)/.exec(t):Z?/Edge\/([\d\.]+)/.exec(t):$?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):nt?/WebKit\/(\S+)/.exec(t):J?/(?:Version)[ \/]?(\S+)/.exec(t):void 0}();if(ot&&(it=ot?ot[1]:""),$){var at=rt();if(null!=at&&at>parseFloat(it)){X=String(at);break t}}X=it}var st,ut={};function ct(t){return function(t,e){var n=ut;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,function(){for(var e=0,n=U(String(X)).split("."),r=U(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o<i;o++){var a=n[o]||"",s=r[o]||"";do{if(a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==a[0].length&&0==s[0].length)break;e=j(0==a[1].length?0:parseInt(a[1],10),0==s[1].length?0:parseInt(s[1],10))||j(0==a[2].length,0==s[2].length)||j(a[2],s[2]),a=a[3],s=s[3]}while(0==e)}return 0<=e})}var lt=a.document;st=lt&&$?rt()||("CSS1Compat"==lt.compatMode?parseInt(X,10):5):void 0;var ht=Object.freeze||function(t){return t},ft=!$||9<=Number(st),pt=$&&!ct("9"),dt=function(){if(!a.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{a.addEventListener("test",c,e),a.removeEventListener("test",c,e)}catch(n){}return t}();function yt(t,e){this.type=t,this.currentTarget=this.target=e,this.defaultPrevented=this.Ea=!1,this.Be=!0}function mt(t,e){yt.call(this,t?t.type:""),this.relatedTarget=this.currentTarget=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0,this.key="",this.charCode=this.keyCode=0,this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.fb=null,t&&this.Kf(t,e)}yt.prototype.stopPropagation=function(){this.Ea=!0},yt.prototype.preventDefault=function(){this.defaultPrevented=!0,this.Be=!1},E(mt,yt);var gt=ht({2:"touch",3:"pen",4:"mouse"});mt.prototype.Kf=function(t,e){var n=this.type=t.type,r=t.changedTouches?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.currentTarget=e,e=t.relatedTarget){if(et){t:{try{Y(e.nodeName);var i=!0;break t}catch(o){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,null===r?(this.offsetX=nt||void 0!==t.offsetX?t.offsetX:t.layerX,this.offsetY=nt||void 0!==t.offsetY?t.offsetY:t.layerY,this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0):(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0),this.button=t.button,this.keyCode=t.keyCode||0,this.key=t.key||"",this.charCode=t.charCode||("keypress"==n?t.keyCode:0),this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=s(t.pointerType)?t.pointerType:gt[t.pointerType]||"",this.state=t.state,this.fb=t,t.defaultPrevented&&this.preventDefault()},mt.prototype.stopPropagation=function(){mt.L.stopPropagation.call(this),this.fb.stopPropagation?this.fb.stopPropagation():this.fb.cancelBubble=!0},mt.prototype.preventDefault=function(){mt.L.preventDefault.call(this);var t=this.fb;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,pt)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(e){}};var vt="closure_listenable_"+(1e6*Math.random()|0);function bt(t){return!(!t||!t[vt])}var _t=0;function wt(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.Ob=i,this.key=++_t,this.Sa=this.Eb=!1}function Et(t){this.src=t,this.J={},this.xb=0}function Tt(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.Sa&&o.listener==e&&o.capture==!!n&&o.Ob==r)return i}return-1}wt.prototype.Vb=function(){this.Sa=!0,this.Ob=this.src=this.proxy=this.listener=null},(r=Et.prototype).add=function(t,e,n,r,i){var o=t.toString();(t=this.J[o])||(t=this.J[o]=[],this.xb++);var a=Tt(t,e,r,i);return-1<a?(e=t[a],n||(e.Eb=!1)):((e=new wt(e,this.src,o,!!r,i)).Eb=n,t.push(e)),e},r.remove=function(t,e,n,r){if(!((t=t.toString())in this.J))return!1;var i=this.J[t];return-1<(e=Tt(i,e,n,r))&&(i[e].Vb(),Array.prototype.splice.call(i,e,1),0==i.length&&(delete this.J[t],this.xb--),!0)},r.ye=function(t){var e=t.type;e in this.J&&P(this.J[e],t)&&(t.Vb(),0==this.J[e].length&&(delete this.J[e],this.xb--))},r.pb=function(t){var e;for(e in t=t&&t.toString(),this.J)if(!t||e==t){for(var n=this.J[e],r=0;r<n.length;r++)n[r].Vb();delete this.J[e],this.xb--}},r.jb=function(t,e,n,r){var i=-1;return(t=this.J[t.toString()])&&(i=Tt(t,e,n,r)),-1<i?t[i]:null};var St="closure_lm_"+(1e6*Math.random()|0),Ct={};function It(t,e,n,r,i){if(r&&r.once)return kt(t,e,n,r,i);if(h(e)){for(var o=0;o<e.length;o++)It(t,e[o],n,r,i);return null}return n=Mt(n),bt(t)?t.nb(e,n,d(r)?!!r.capture:!!r,i):Nt(t,e,n,!1,r,i)}function Nt(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var a=d(i)?!!i.capture:!!i,s=xt(t);if(s||(t[St]=s=new Et(t)),(n=s.add(e,n,r,a,o)).proxy)return n;if(r=function(){var t=Pt,e=ft?function(n){return t.call(e.src,e.listener,n)}:function(n){if(!(n=t.call(e.src,e.listener,n)))return n};return e}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)dt||(i=a),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(At(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function kt(t,e,n,r,i){if(h(e)){for(var o=0;o<e.length;o++)kt(t,e[o],n,r,i);return null}return n=Mt(n),bt(t)?t.Oc(e,n,d(r)?!!r.capture:!!r,i):Nt(t,e,n,!0,r,i)}function Dt(t){if("number"!=typeof t&&t&&!t.Sa){var e=t.src;if(bt(e))e.Le(t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(At(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=xt(e))?(n.ye(t),0==n.xb&&(n.src=null,e[St]=null)):t.Vb()}}}function At(t){return t in Ct?Ct[t]:Ct[t]="on"+t}function Ot(t,e,n,r){var i=!0;if((t=xt(t))&&(e=t.J[e.toString()]))for(e=e.concat(),t=0;t<e.length;t++){var o=e[t];o&&o.capture==n&&!o.Sa&&(o=Rt(o,r),i=i&&!1!==o)}return i}function Rt(t,e){var n=t.listener,r=t.Ob||t.src;return t.Eb&&Dt(t),n.call(r,e)}function Pt(t,e){if(t.Sa)return!0;if(!ft){var n=e||u("window.event");e=new mt(n,this);var r=!0;if(!(0>n.keyCode||void 0!=n.returnValue)){t:{var i=!1;if(0==n.keyCode)try{n.keyCode=-1;break t}catch(a){i=!0}(i||void 0==n.returnValue)&&(n.returnValue=!0)}for(n=[],i=e.currentTarget;i;i=i.parentNode)n.push(i);for(t=t.type,i=n.length-1;!e.Ea&&0<=i;i--){e.currentTarget=n[i];var o=Ot(n[i],t,!0,e);r=r&&o}for(i=0;!e.Ea&&i<n.length;i++)e.currentTarget=n[i],o=Ot(n[i],t,!1,e),r=r&&o}return r}return Rt(t,new mt(e,this))}function xt(t){return(t=t[St])instanceof Et?t:null}var Lt="__closure_events_fn_"+(1e9*Math.random()>>>0);function Mt(t){return p(t)?t:(t[Lt]||(t[Lt]=function(e){return t.handleEvent(e)}),t[Lt])}function Ft(){C.call(this),this.ka=new Et(this),this.Pe=this,this.Uc=null}E(Ft,C),Ft.prototype[vt]=!0,(r=Ft.prototype).addEventListener=function(t,e,n,r){It(this,t,e,n,r)},r.removeEventListener=function(t,e,n,r){!function t(e,n,r,i,o){if(h(n))for(var a=0;a<n.length;a++)t(e,n[a],r,i,o);else i=d(i)?!!i.capture:!!i,r=Mt(r),bt(e)?e.ed(n,r,i,o):e&&(e=xt(e))&&(n=e.jb(n,r,i,o))&&Dt(n)}(this,t,e,n,r)},r.dispatchEvent=function(t){var e,n=this.Uc;if(n)for(e=[];n;n=n.Uc)e.push(n);n=this.Pe;var r=t.type||t;if(s(t))t=new yt(t,n);else if(t instanceof yt)t.target=t.target||n;else{var i=t;G(t=new yt(r,n),i)}if(i=!0,e)for(var o=e.length-1;!t.Ea&&0<=o;o--){var a=t.currentTarget=e[o];i=a.Lb(r,!0,t)&&i}if(t.Ea||(i=(a=t.currentTarget=n).Lb(r,!0,t)&&i,t.Ea||(i=a.Lb(r,!1,t)&&i)),e)for(o=0;!t.Ea&&o<e.length;o++)i=(a=t.currentTarget=e[o]).Lb(r,!1,t)&&i;return i},r.F=function(){Ft.L.F.call(this),this.pg(),this.Uc=null},r.nb=function(t,e,n,r){return this.ka.add(String(t),e,!1,n,r)},r.Oc=function(t,e,n,r){return this.ka.add(String(t),e,!0,n,r)},r.ed=function(t,e,n,r){this.ka.remove(String(t),e,n,r)},r.Le=function(t){this.ka.ye(t)},r.pg=function(){this.ka&&this.ka.pb(void 0)},r.Lb=function(t,e,n){if(!(t=this.ka.J[String(t)]))return!0;t=t.concat();for(var r=!0,i=0;i<t.length;++i){var o=t[i];if(o&&!o.Sa&&o.capture==e){var a=o.listener,s=o.Ob||o.src;o.Eb&&this.Le(o),r=!1!==a.call(s,n)&&r}}return r&&0!=n.Be},r.jb=function(t,e,n,r){return this.ka.jb(String(t),e,n,r)};var Ut=a.JSON.stringify;function jt(t,e){this.Sf=100,this.ef=t,this.ug=e,this.Zb=0,this.Pb=null}function Vt(){this.lc=this.Va=null}jt.prototype.get=function(){if(0<this.Zb){this.Zb--;var t=this.Pb;this.Pb=t.next,t.next=null}else t=this.ef();return t},jt.prototype.put=function(t){this.ug(t),this.Zb<this.Sf&&(this.Zb++,t.next=this.Pb,this.Pb=t)};var Bt,qt,Wt=new jt(function(){return new Kt},function(t){t.reset()});function Kt(){this.next=this.scope=this.Gc=null}function Qt(t){a.setTimeout(function(){throw t},0)}function Ht(){if(a.Promise&&a.Promise.resolve){var t=a.Promise.resolve(void 0);qt=function(){t.then(Yt)}}else qt=function(){var t=Yt;!p(a.setImmediate)||a.Window&&a.Window.prototype&&!q("Edge")&&a.Window.prototype.setImmediate==a.setImmediate?(Bt||(Bt=function(){var t=a.MessageChannel;if("undefined"===typeof t&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!q("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",t.src="",document.documentElement.appendChild(t);var e=t.contentWindow;t=e.document,t.open(),t.write(""),t.close();var n="callImmediate"+Math.random(),r="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=b(function(t){"*"!=r&&t.origin!=r||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,r)}}}),"undefined"!==typeof t&&!q("Trident")&&!q("MSIE")){var e=new t,n={},r=n;return e.port1.onmessage=function(){if(void 0!==n.next){var t=(n=n.next).rd;n.rd=null,t()}},function(t){r.next={rd:t},r=r.next,e.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){a.setTimeout(t,0)}}()),Bt(t)):a.setImmediate(t)}}Vt.prototype.add=function(t,e){var n=this.Af();n.set(t,e),this.lc?this.lc.next=n:this.Va=n,this.lc=n},Vt.prototype.remove=function(){var t=null;return this.Va&&(t=this.Va,this.Va=this.Va.next,this.Va||(this.lc=null),t.next=null),t},Vt.prototype.wg=function(t){Wt.put(t)},Vt.prototype.Af=function(){return Wt.get()},Kt.prototype.set=function(t,e){this.Gc=t,this.scope=e,this.next=null},Kt.prototype.reset=function(){this.next=this.scope=this.Gc=null};var zt=!1,Gt=new Vt;function Yt(){for(var t;t=Gt.remove();){try{t.Gc.call(t.scope)}catch(e){Qt(e)}Gt.wg(t)}zt=!1}function Xt(t,e){Ft.call(this),this.Na=t||1,this.wb=e||a,this.nd=b(this.Rg,this),this.ie=w()}function Jt(t,e,n){if(p(t))n&&(t=b(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=b(t.handleEvent,t)}return 2147483647<Number(e)?-1:a.setTimeout(t,e||0)}function $t(t,e,n){C.call(this),this.Uf=null!=n?b(t,n):t,this.Na=e,this.Xe=b(this.fg,this),this.qc=[]}function Zt(t){C.call(this),this.i=t,this.o={}}E(Xt,Ft),(r=Xt.prototype).enabled=!1,r.B=null,r.setInterval=function(t){this.Na=t,this.B&&this.enabled?(this.stop(),this.start()):this.B&&this.stop()},r.Rg=function(){if(this.enabled){var t=w()-this.ie;0<t&&t<.8*this.Na?this.B=this.wb.setTimeout(this.nd,this.Na-t):(this.B&&(this.wb.clearTimeout(this.B),this.B=null),this.ff(),this.enabled&&(this.stop(),this.start()))}},r.ff=function(){this.dispatchEvent("tick")},r.start=function(){this.enabled=!0,this.B||(this.B=this.wb.setTimeout(this.nd,this.Na),this.ie=w())},r.stop=function(){this.enabled=!1,this.B&&(this.wb.clearTimeout(this.B),this.B=null)},r.F=function(){Xt.L.F.call(this),this.stop(),delete this.wb},E($t,C),(r=$t.prototype).Ta=!1,r.ob=0,r.B=null,r.mf=function(t){this.qc=arguments,this.B||this.ob?this.Ta=!0:this.Cc()},r.stop=function(){this.B&&(a.clearTimeout(this.B),this.B=null,this.Ta=!1,this.qc=[])},r.pause=function(){this.ob++},r.resume=function(){this.ob--,this.ob||!this.Ta||this.B||(this.Ta=!1,this.Cc())},r.F=function(){$t.L.F.call(this),this.stop()},r.fg=function(){this.B=null,this.Ta&&!this.ob&&(this.Ta=!1,this.Cc())},r.Cc=function(){this.B=Jt(this.Xe,this.Na),this.Uf.apply(null,this.qc)},E(Zt,C);var te=[];function ee(t,e,n){this.reset(t,e,n,void 0,void 0)}function ne(t){this.pe=t,this.Zd=this.uc=this.mb=this.$b=null}function re(t,e){this.name=t,this.value=e}(r=Zt.prototype).nb=function(t,e,n,r){return this.Tf(t,e,n,r)},r.Tf=function(t,e,n,r){h(e)||(e&&(te[0]=e.toString()),e=te);for(var i=0;i<e.length;i++){var o=It(t,e[i],n||this.handleEvent,r||!1,this.i||this);if(!o)break;this.o[o.key]=o}return this},r.Oc=function(t,e,n,r){return this.je(t,e,n,r)},r.je=function(t,e,n,r,i){if(h(e))for(var o=0;o<e.length;o++)this.je(t,e[o],n,r,i);else{if(!(t=kt(t,e,n||this.handleEvent,r,i||this.i||this)))return this;this.o[t.key]=t}return this},r.ed=function(t,e,n,r,i){if(h(e))for(var o=0;o<e.length;o++)this.ed(t,e[o],n,r,i);else n=n||this.handleEvent,r=d(r)?!!r.capture:!!r,i=i||this.i||this,n=Mt(n),r=!!r,(e=bt(t)?t.jb(e,n,r,i):t&&(t=xt(t))?t.jb(e,n,r,i):null)&&(Dt(e),delete this.o[e.key])},r.pb=function(){W(this.o,function(t,e){this.o.hasOwnProperty(e)&&Dt(t)},this),this.o={}},r.F=function(){Zt.L.F.call(this),this.pb()},r.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},ee.prototype.Md=null,ee.prototype.reset=function(t,e,n,r,i){this.mb=t,delete this.Md},ee.prototype.Bg=function(t){this.Md=t},ee.prototype.Ge=function(t){this.mb=t},re.prototype.toString=function(){return this.name};var ie=new re("SEVERE",1e3),oe=new re("WARNING",900),ae=new re("INFO",800),se=new re("CONFIG",700),ue=new re("FINE",500);(r=ne.prototype).getName=function(){return this.pe},r.getParent=function(){return this.$b},r.pf=function(){return this.uc||(this.uc={}),this.uc},r.Ge=function(t){this.mb=t},r.Qd=function(){return this.mb?this.mb:this.$b?this.$b.Qd():(function(t,e){throw new S("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}("Root logger has no level set."),null)},r.Pf=function(t){return t.value>=this.Qd().value},r.log=function(t,e,n){this.Pf(t)&&(p(e)&&(e=e()),this.gf(this.uf(t,e,n)))},r.uf=function(t,e,n){return t=new ee(t,String(e),this.pe),n&&t.Bg(n),t},r.ca=function(t,e){this.log(ie,t,e)},r.T=function(t,e){this.log(oe,t,e)},r.info=function(t,e){this.log(ae,t,e)},r.lf=function(t){this.log(ue,t,void 0)},r.gf=function(t){for(var e=this;e;)e.We(t),e=e.getParent()},r.We=function(t){if(this.Zd)for(var e,n=0;e=this.Zd[n];n++)e(t)},r.Fg=function(t){this.$b=t},r.Qe=function(t,e){this.pf()[t]=e};var ce={},le=null;function he(t){var e;if(le||(le=new ne(""),ce[""]=le,le.Ge(se)),!(e=ce[t])){e=new ne(t);var n=t.lastIndexOf("."),r=t.substr(n+1);(n=he(t.substr(0,n))).Qe(r,e),e.Fg(n),ce[t]=e}return e}function fe(t,e){t&&t.info(e,void 0)}function pe(t,e){t&&t.lf(e)}function de(){this.s=he("goog.labs.net.webChannel.WebChannelDebug"),this.Wc=!0}(r=de.prototype).Id=function(){this.Wc=!1},r.Tg=function(t,e,n,r,i){var o=this;this.info(function(){return"XMLHTTP REQ ("+n+") [attempt "+r+"]: "+t+"\n"+e+"\n"+o.Xf(i)})},r.Ug=function(t,e,n,r,i,o){this.info(function(){return"XMLHTTP RESP ("+n+") [ attempt "+r+"]: "+t+"\n"+e+"\n"+i+" "+o})},r.Wa=function(t,e,n){var r=this;this.info(function(){return"XMLHTTP TEXT ("+t+"): "+r.ng(e)+(n?" "+n:"")})},r.Sg=function(t){this.info(function(){return"TIMEOUT: "+t})},r.debug=function(t){pe(this.s,t)},r.cb=function(t,e){var n=this.s;n&&n.ca(e||"Exception",t)},r.info=function(t){fe(this.s,t)},r.T=function(t){var e=this.s;e&&e.T(t,void 0)},r.ca=function(t){var e=this.s;e&&e.ca(t,void 0)},r.ng=function(t){if(!this.Wc)return t;if(!t)return null;try{var e=JSON.parse(t);if(e)for(var n=0;n<e.length;n++)h(e[n])&&this.Wf(e[n]);return Ut(e)}catch(r){return this.debug("Exception parsing expected JS array - probably was not JS"),t}},r.Wf=function(t){if(!(2>t.length||(t=t[1],!h(t)||1>t.length))){var e=t[0];if("noop"!=e&&"stop"!=e&&"close"!=e)for(e=1;e<t.length;e++)t[e]=""}},r.Xf=function(t){if(!this.Wc)return t;if(!t)return null;var e="";t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].split("=");if(1<r.length){var i=r[0];r=r[1];var o=i.split("_");e=2<=o.length&&"type"==o[1]?e+(i+"=")+r+"&":e+(i+"=redacted&")}}return e};var ye=new Ft;function me(t){yt.call(this,"serverreachability",t)}function ge(t){ye.dispatchEvent(new me(ye,t))}function ve(t,e){yt.call(this,"statevent",t),this.stat=e}function be(t){ye.dispatchEvent(new ve(ye,t))}function _e(t,e,n){yt.call(this,"timingevent",t),this.size=e,this.rtt=n}function we(t,e){if(!p(t))throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){t()},e)}E(me,yt),E(ve,yt),E(_e,yt);var Ee={NO_ERROR:0,Vg:1,bh:2,ah:3,Yg:4,$g:5,dh:6,Ne:7,TIMEOUT:8,gh:9},Te={Xg:"complete",kh:"success",Oe:"error",Ne:"abort",ih:"ready",jh:"readystatechange",TIMEOUT:"timeout",eh:"incrementaldata",hh:"progress",Zg:"downloadprogress",lh:"uploadprogress"};function Se(){}function Ce(){}Se.prototype.pd=null,Se.prototype.Vd=function(){return this.pd||(this.pd=this.Mf())};var Ie,Ne={OPEN:"a",Wg:"b",Oe:"c",fh:"d"};function ke(){yt.call(this,"d")}function De(){yt.call(this,"c")}function Ae(){}function Oe(t,e,n,r,i){this.b=t,this.a=e,this.ra=n,this.R=r,this.Xc=i||1,this.Fc=new Zt(this),this.Ua=Re,t=tt?125:void 0,this.Vc=new Xt(t),this.A=null,this.S=!1,this.Da=this.pa=this.ua=this.ic=this.qb=this.hd=this.Ga=null,this.ba=[],this.h=null,this.Bb=0,this.I=this.Fa=null,this.w=-1,this.Za=!1,this.Ra=0,this.ac=null,this.lb=this.Ed=this.yc=!1}E(ke,yt),E(De,yt),E(Ae,Se),Ae.prototype.Dd=function(){var t=this.Wd();return t?new ActiveXObject(t):new XMLHttpRequest},Ae.prototype.Mf=function(){var t={};return this.Wd()&&(t[0]=!0,t[1]=!0),t},Ae.prototype.Wd=function(){if(!this.be&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var t=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],e=0;e<t.length;e++){var n=t[e];try{return new ActiveXObject(n),this.be=n}catch(r){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return this.be},Ie=new Ae;var Re=45e3;var Pe={},xe={};function Le(t){if(t.H&&"function"==typeof t.H)return t.H();if(s(t))return t.split("");if(f(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}return K(t)}function Me(t,e,n){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,n);else if(f(t)||s(t))A(t,e,n);else{if(t.W&&"function"==typeof t.W)var r=t.W();else if(t.H&&"function"==typeof t.H)r=void 0;else if(f(t)||s(t)){r=[];for(var i=t.length,o=0;o<i;o++)r.push(o)}else r=Q(t);o=(i=Le(t)).length;for(var a=0;a<o;a++)e.call(n,i[a],r&&r[a],t)}}function Fe(t,e){this.D={},this.o=[],this.j=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else t&&this.addAll(t)}function Ue(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(r=Oe.prototype).ga=function(t){this.A=t},r.setTimeout=function(t){this.Ua=t},r.He=function(t){this.Ra=t},r.Gg=function(t){this.ba=t},r.la=function(){return this.ba},r.kd=function(t,e){this.ic=1,this.ua=t.clone().Ub(),this.Da=e,this.yc=!0,this.Ce(null)},r.jd=function(t,e,n){this.ic=1,this.ua=t.clone().Ub(),this.Da=null,this.yc=e,this.Ce(n)},r.Ce=function(t){this.qb=w(),this.eb(),this.pa=this.ua.clone(),this.pa.dc("t",this.Xc),this.Bb=0,this.h=this.b.Jb(this.b.fc()?t:null),0<this.Ra&&(this.ac=new $t(b(this.Me,this,this.h),this.Ra)),this.Fc.nb(this.h,"readystatechange",this.mg),t=this.A?H(this.A):{},this.Da?(this.Fa||(this.Fa="POST"),t["Content-Type"]="application/x-www-form-urlencoded",this.h.send(this.pa,this.Fa,this.Da,t)):(this.Fa="GET",this.h.send(this.pa,this.Fa,null,t)),ge(1),this.a.Tg(this.Fa,this.pa,this.R,this.Xc,this.Da)},r.mg=function(t){t=t.target;var e=this.ac;e&&3==t.ma()?(this.a.debug("Throttling readystatechange."),e.mf()):this.Me(t)},r.Me=function(t){try{t==this.h?this.hg():this.a.T("Called back with an unexpected xmlhttp")}catch(n){if(this.a.debug("Failed call to OnXmlHttpReadyStateChanged_"),this.h&&this.h.ya()){var e=this;this.a.cb(n,function(){return"ResponseText: "+e.h.ya()})}else this.a.cb(n,"No response text")}},r.hg=function(){var t=this.h.ma(),e=this.h.Ud(),n=this.h.za();if(!(3>t||3==t&&!tt&&!this.h.ya())){this.Za||4!=t||7==e||ge(8==e||0>=n?3:2),this.Fb();var r=this.h.za();if(this.w=r,!(e=this.h.ya())){var i=this;this.a.debug(function(){return"No response text for uri "+i.pa+" status "+r})}if(this.S=200==r,this.a.Ug(this.Fa,this.pa,this.R,this.Xc,t,r),this.S){if(this.Ig()){if(!(n=this.sf()))return this.S=!1,this.I=3,be(12),this.a.T("XMLHTTP Missing X_HTTP_INITIAL_RESPONSE ("+this.R+")"),this.Ia(),void this.Kb();this.a.Wa(this.R,n,"Initial handshake response via X-HTTP-Initial-Response"),this.lb=!0,this.Yc(n)}this.yc?(this.Fd(t,e),tt&&this.S&&3==t&&this.Ng()):(this.a.Wa(this.R,e,null),this.Yc(e)),4==t&&this.Ia(),this.S&&!this.Za&&(4==t?this.b.Tc(this):(this.S=!1,this.eb()))}else 400==r&&0<e.indexOf("Unknown SID")?(this.I=3,be(12),this.a.T("XMLHTTP Unknown SID ("+this.R+")")):(this.I=0,be(13),this.a.T("XMLHTTP Bad status "+r+" ("+this.R+")")),this.Ia(),this.Kb()}},r.Ig=function(){return this.Ed&&!this.lb},r.sf=function(){if(this.h){var t=this.h.kb("X-HTTP-Initial-Response");if(t&&!M(t))return t}return null},r.Ag=function(){this.Ed=!0},r.Fd=function(t,e){for(var n=!0;!this.Za&&this.Bb<e.length;){var r=this.vf(e);if(r==xe){4==t&&(this.I=4,be(14),n=!1),this.a.Wa(this.R,null,"[Incomplete Response]");break}if(r==Pe){this.I=4,be(15),this.a.Wa(this.R,e,"[Invalid Chunk]"),n=!1;break}this.a.Wa(this.R,r,null),this.Yc(r)}4==t&&0==e.length&&(this.I=1,be(16),n=!1),this.S=this.S&&n,n||(this.a.Wa(this.R,e,"[Invalid Chunked Response]"),this.Ia(),this.Kb())},r.kg=function(){if(this.h){var t=this.h.ma(),e=this.h.ya();this.Bb<e.length&&(this.Fb(),this.Fd(t,e),this.S&&4!=t&&this.eb())}},r.Ng=function(){this.Fc.nb(this.Vc,"tick",this.kg),this.Vc.start()},r.vf=function(t){var e=this.Bb,n=t.indexOf("\n",e);return-1==n?xe:(e=Number(t.substring(e,n)),isNaN(e)?Pe:(n+=1)+e>t.length?xe:(t=t.substr(n,e),this.Bb=n+e,t))},r.yg=function(t){this.ic=2,this.ua=t.clone().Ub(),t=!1,a.navigator&&a.navigator.sendBeacon&&(t=a.navigator.sendBeacon(this.ua.toString(),"")),!t&&a.Image&&((new Image).src=this.ua,t=!0),t||(this.h=this.b.Jb(null),this.h.send(this.ua)),this.qb=w(),this.eb()},r.cancel=function(){this.Za=!0,this.Ia()},r.tg=function(t){t&&this.setTimeout(t),this.Ga&&(this.Fb(),this.eb())},r.eb=function(){this.hd=w()+this.Ua,this.Ke(this.Ua)},r.Ke=function(t){if(null!=this.Ga)throw Error("WatchDog timer not null");this.Ga=we(b(this.gg,this),t)},r.Fb=function(){this.Ga&&(a.clearTimeout(this.Ga),this.Ga=null)},r.gg=function(){this.Ga=null;var t=w();0<=t-this.hd?this.Df():(this.a.T("WatchDog timer called too early"),this.Ke(this.hd-t))},r.Df=function(){this.S&&this.a.ca("Received watchdog timeout even though request loaded successfully"),this.a.Sg(this.pa),2!=this.ic&&(ge(3),be(17)),this.Ia(),this.I=2,this.Kb()},r.Kb=function(){this.b.de()||this.Za||this.b.Tc(this)},r.Ia=function(){this.Fb();var t=this.ac;t&&"function"==typeof t.bb&&t.bb(),this.ac=null,this.Vc.stop(),this.Fc.pb(),this.h&&(t=this.h,this.h=null,t.abort(),t.bb())},r.Hc=function(){return this.I},r.Yc=function(t){try{this.b.ue(this,t),ge(4)}catch(e){this.a.cb(e,"Error in httprequest callback")}},(r=Fe.prototype).C=function(){return this.j},r.H=function(){this.wc();for(var t=[],e=0;e<this.o.length;e++)t.push(this.D[this.o[e]]);return t},r.W=function(){return this.wc(),this.o.concat()},r.va=function(t){return Ue(this.D,t)},r.X=function(){return 0==this.j},r.clear=function(){this.D={},this.j=this.o.length=0},r.remove=function(t){return!!Ue(this.D,t)&&(delete this.D[t],this.j--,this.o.length>2*this.j&&this.wc(),!0)},r.wc=function(){if(this.j!=this.o.length){for(var t=0,e=0;t<this.o.length;){var n=this.o[t];Ue(this.D,n)&&(this.o[e++]=n),t++}this.o.length=e}if(this.j!=this.o.length){var r={};for(e=t=0;t<this.o.length;)Ue(r,n=this.o[t])||(this.o[e++]=n,r[n]=1),t++;this.o.length=e}},r.get=function(t,e){return Ue(this.D,t)?this.D[t]:e},r.set=function(t,e){Ue(this.D,t)||(this.j++,this.o.push(t)),this.D[t]=e},r.addAll=function(t){if(t instanceof Fe)for(var e=t.W(),n=0;n<e.length;n++)this.set(e[n],t.get(e[n]));else for(e in t)this.set(e,t[e])},r.forEach=function(t,e){for(var n=this.W(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}},r.clone=function(){return new Fe(this)};var je=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Ve(t,e){var n;this.xa=this.zb=this.qa="",this.Ca=null,this.ib=this.K="",this.O=this.Qf=!1,t instanceof Ve?(this.O=void 0!==e?e:t.O,this.tb(t.qa),this.cd(t.zb),this.rb(t.xa),this.sb(t.Ca),this.ec(t.K),this.bd(t.P.clone()),this.$c(t.ib)):t&&(n=String(t).match(je))?(this.O=!!e,this.tb(n[1]||"",!0),this.cd(n[2]||"",!0),this.rb(n[3]||"",!0),this.sb(n[4]),this.ec(n[5]||"",!0),this.bd(n[6]||"",!0),this.$c(n[7]||"",!0)):(this.O=!!e,this.P=new Ye(null,this.O))}function Be(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function qe(t,e,n){return s(t)?(t=encodeURI(t).replace(e,We),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function We(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}(r=Ve.prototype).toString=function(){var t=[],e=this.qa;e&&t.push(qe(e,Ke,!0),":");var n=this.xa;return(n||"file"==e)&&(t.push("//"),(e=this.zb)&&t.push(qe(e,Ke,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.Ca)&&t.push(":",String(n))),(n=this.K)&&(this.Ic()&&"/"!=n.charAt(0)&&t.push("/"),t.push(qe(n,"/"==n.charAt(0)?He:Qe,!0))),(n=this.Rd())&&t.push("?",n),(n=this.ib)&&t.push("#",qe(n,Ge)),t.join("")},r.resolve=function(t){var e=this.clone(),n=t.Hf();n?e.tb(t.qa):n=t.If(),n?e.cd(t.zb):n=t.Ic(),n?e.rb(t.xa):n=t.Ff();var r=t.K;if(n)e.sb(t.Ca);else if(n=t.ae()){if("/"!=r.charAt(0))if(this.Ic()&&!this.ae())r="/"+r;else{var i=e.K.lastIndexOf("/");-1!=i&&(r=e.K.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(-1!=i.indexOf("./")||-1!=i.indexOf("/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],a=0;a<i.length;){var s=i[a++];"."==s?r&&a==i.length&&o.push(""):".."==s?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),r&&a==i.length&&o.push("")):(o.push(s),r=!0)}r=o.join("/")}else r=i}return n?e.ec(r):n=t.Gf(),n?e.bd(t.P.clone()):n=t.Ef(),n&&e.$c(t.ib),e},r.clone=function(){return new Ve(this)},r.tb=function(t,e){this.U(),(this.qa=e?Be(t,!0):t)&&(this.qa=this.qa.replace(/:$/,""))},r.Hf=function(){return!!this.qa},r.cd=function(t,e){this.U(),this.zb=e?Be(t):t},r.If=function(){return!!this.zb},r.rb=function(t,e){this.U(),this.xa=e?Be(t,!0):t},r.Ic=function(){return!!this.xa},r.sb=function(t){if(this.U(),t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);this.Ca=t}else this.Ca=null},r.Ff=function(){return null!=this.Ca},r.ec=function(t,e){this.U(),this.K=e?Be(t,!0):t},r.ae=function(){return!!this.K},r.Gf=function(){return""!==this.P.toString()},r.bd=function(t,e){this.U(),t instanceof Ye?(this.P=t,this.P.ad(this.O)):(e||(t=qe(t,ze)),this.P=new Ye(t,this.O))},r.Rd=function(){return this.P.toString()},r.getQuery=function(){return this.Rd()},r.l=function(t,e){this.U(),this.P.set(t,e)},r.dc=function(t,e){this.U(),h(e)||(e=[String(e)]),this.P.Ie(t,e)},r.$c=function(t,e){this.U(),this.ib=e?Be(t):t},r.Ef=function(){return!!this.ib},r.Ub=function(){return this.U(),this.l("zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^w()).toString(36)),this},r.removeParameter=function(t){return this.U(),this.P.remove(t),this},r.U=function(){if(this.Qf)throw Error("Tried to modify a read-only Uri")},r.ad=function(t){this.O=t,this.P&&this.P.ad(t)};var Ke=/[#\/\?@]/g,Qe=/[#\?:]/g,He=/[#\?]/g,ze=/[#\?@]/g,Ge=/#/g;function Ye(t,e){this.j=this.m=null,this.ja=t||null,this.O=!!e}function Xe(t,e){this.b=t,this.a=e,this.f=this.A=null,this.bc=!1,this.K=null,this.w=-1,this.Ad=this.na=null}function Je(){this.od=this.$d=null}function $e(t){this.D=new Fe,t&&this.addAll(t)}function Ze(t){var e=typeof t;return"object"==e&&t||"function"==e?"o"+(t[y]||(t[y]=++m)):e.substr(0,1)+t}function tn(t,e){this.Pc=t,this.map=e,this.context=null}function en(t){this.me=t||nn,a.PerformanceNavigationTiming?t=0<(t=a.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(a.vc&&a.vc.ke&&a.vc.ke()&&a.vc.ke().nh),this.Xb=t?this.me:1,this.v=null,1<this.Xb&&(this.v=new $e),this.f=null,this.ba=[]}(r=Ye.prototype).$=function(){if(!this.m&&(this.m=new Fe,this.j=0,this.ja)){var t=this;!function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(this.ja,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})}},r.C=function(){return this.$(),this.j},r.add=function(t,e){this.$(),this.Oa(),t=this.Ma(t);var n=this.m.get(t);return n||this.m.set(t,n=[]),n.push(e),this.j+=1,this},r.remove=function(t){return this.$(),t=this.Ma(t),!!this.m.va(t)&&(this.Oa(),this.j-=this.m.get(t).length,this.m.remove(t))},r.clear=function(){this.Oa(),this.m=null,this.j=0},r.X=function(){return this.$(),0==this.j},r.va=function(t){return this.$(),t=this.Ma(t),this.m.va(t)},r.forEach=function(t,e){this.$(),this.m.forEach(function(n,r){A(n,function(n){t.call(e,n,r,this)},this)},this)},r.W=function(){this.$();for(var t=this.m.H(),e=this.m.W(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},r.H=function(t){this.$();var e=[];if(s(t))this.va(t)&&(e=x(e,this.m.get(this.Ma(t))));else{t=this.m.H();for(var n=0;n<t.length;n++)e=x(e,t[n])}return e},r.set=function(t,e){return this.$(),this.Oa(),t=this.Ma(t),this.va(t)&&(this.j-=this.m.get(t).length),this.m.set(t,[e]),this.j+=1,this},r.get=function(t,e){return t&&0<(t=this.H(t)).length?String(t[0]):e},r.Ie=function(t,e){this.remove(t),0<e.length&&(this.Oa(),this.m.set(this.Ma(t),L(e)),this.j+=e.length)},r.toString=function(){if(this.ja)return this.ja;if(!this.m)return"";for(var t=[],e=this.m.W(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.H(r);for(var o=0;o<r.length;o++){var a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),t.push(a)}}return this.ja=t.join("&")},r.Oa=function(){this.ja=null},r.clone=function(){var t=new Ye;return t.ja=this.ja,this.m&&(t.m=this.m.clone(),t.j=this.j),t},r.Ma=function(t){return t=String(t),this.O&&(t=t.toLowerCase()),t},r.ad=function(t){t&&!this.O&&(this.$(),this.Oa(),this.m.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(this.remove(e),this.Ie(n,t))},this)),this.O=t},r.extend=function(t){for(var e=0;e<arguments.length;e++)Me(arguments[e],function(t,e){this.add(e,t)},this)},E(function(){},function(){}),(r=Xe.prototype).g=null,r.ga=function(t){this.A=t},r.connect=function(t){this.K=t,t=this.b.Sd(this.K),be(3);var e=this.b.Ib.$d;null!=e?(this.na=this.b.$a(e[0]),this.g=1,this.xd()):(t.dc("MODE","init"),!this.b.ta&&this.b.aa&&t.dc("X-HTTP-Session-Id",this.b.aa),this.f=new Oe(this,this.a,void 0,void 0,void 0),this.f.ga(this.A),this.f.jd(t,!1,null),this.g=0)},r.xd=function(){this.a.debug("TestConnection: starting stage 2");var t=this.b.Ib.od;if(null!=t)this.a.debug(function(){return"Buffered"}),be(4),t?(be(10),this.b.ub(this,!1)):(be(11),this.b.ub(this,!0));else{this.f=new Oe(this,this.a,void 0,void 0,void 0),this.f.ga(this.A);var e=this.b.Pd(this.na,this.K);be(4),e.dc("TYPE","xmlhttp");var n=this.b.aa,r=this.b.Kc;n&&r&&e.l(n,r),this.f.jd(e,!1,this.na)}},r.Jb=function(t){return this.b.Jb(t)},r.abort=function(){this.f&&(this.f.cancel(),this.f=null),this.w=-1},r.de=function(){return!1},r.ue=function(t,e){if(this.w=t.w,0==this.g)if(this.a.debug("TestConnection: Got data for stage 1"),this.pc(t),e){try{var n=this.b.kc.zc(e)}catch(r){return this.a.cb(r),void this.b.dd(this)}this.na=this.b.$a(n[0])}else this.a.debug("TestConnection: Null responseText"),this.b.dd(this);else 1==this.g&&(this.bc?be(6):"11111"==e?(be(5),this.bc=!0,this.Ze()&&(this.w=200,this.f.cancel(),this.a.debug("Test connection succeeded; using streaming connection"),be(11),this.b.ub(this,!0))):(be(7),this.bc=!1))},r.Tc=function(){this.w=this.f.w,this.f.S?0==this.g?(this.g=1,this.a.debug("TestConnection: request complete for initial check"),this.xd()):1==this.g&&(this.a.debug("TestConnection: request complete for stage 2"),this.bc?(this.a.debug("Test connection succeeded; using streaming connection"),be(11),this.b.ub(this,!0)):(this.a.debug("Test connection failed; not using streaming"),be(10),this.b.ub(this,!1))):(this.a.debug("TestConnection: request failed, in state "+this.g),0==this.g?be(8):1==this.g&&be(9),this.b.dd(this))},r.pc=function(t){if(!this.b.ta&&(t=t.h)){var e=t.kb("X-Client-Wire-Protocol");this.Ad=e||null,this.b.aa&&((t=t.kb("X-HTTP-Session-Id"))?this.b.Fe(t):this.a.T("Missing X_HTTP_SESSION_ID in the handshake response"))}},r.fc=function(){return this.b.fc()},r.Ba=function(){return this.b.Ba()},r.Ze=function(){return!$||10<=Number(st)},(r=$e.prototype).C=function(){return this.D.C()},r.add=function(t){this.D.set(Ze(t),t)},r.addAll=function(t){for(var e=(t=Le(t)).length,n=0;n<e;n++)this.add(t[n])},r.pb=function(t){for(var e=(t=Le(t)).length,n=0;n<e;n++)this.remove(t[n])},r.remove=function(t){return this.D.remove(Ze(t))},r.clear=function(){this.D.clear()},r.X=function(){return this.D.X()},r.contains=function(t){return this.D.va(Ze(t))},r.H=function(){return this.D.H()},r.clone=function(){return new $e(this)};var nn=10;function rn(){this.xg=this.rg=void 0}function on(){this.jg=new rn}function an(t,e,n,r,i){try{t.debug(n),e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(o){t.cb(o)}}(r=en.prototype).ld=function(t){this.v||-1==t.indexOf("spdy")&&-1==t.indexOf("quic")&&-1==t.indexOf("h2")||(this.Xb=this.me,this.v=new $e,this.f&&(this.oc(this.f),this.f=null))},r.ee=function(){return!!this.f||!!this.v&&this.v.C()>=this.Xb},r.xf=function(){return this.f?1:this.v?this.v.C():0},r.Jc=function(t){return this.f?this.f==t:!!this.v&&this.v.contains(t)},r.oc=function(t){this.v?this.v.add(t):this.f=t},r.ze=function(t){this.f&&this.f==t?this.f=null:this.v&&this.v.contains(t)&&this.v.remove(t)},r.cancel=function(){this.ba=this.la(),this.f?(this.f.cancel(),this.f=null):this.v&&!this.v.X()&&(A(this.v.H(),function(t){t.cancel()}),this.v.clear())},r.la=function(){if(null!=this.f)return this.ba.concat(this.f.la());if(null!=this.v&&!this.v.X()){var t=this.ba;return A(this.v.H(),function(e){t=t.concat(e.la())}),t}return L(this.ba)},r.Re=function(t){this.ba=this.ba.concat(t)},r.$e=function(){this.ba.length=0},rn.prototype.stringify=function(t){return a.JSON.stringify(t,this.rg)},rn.prototype.parse=function(t){return a.JSON.parse(t,this.xg)},on.prototype.hf=function(t,e,n){var r=n||"";try{Me(t,function(t,n){var i=t;d(t)&&(i=Ut(t)),e.push(r+n+"="+encodeURIComponent(i))})}catch(i){throw e.push(r+"type="+encodeURIComponent("_badmap")),i}},on.prototype.jf=function(t,e,n){for(var r=-1;;){var i=["count="+e];-1==r?0<e?(r=t[0].Pc,i.push("ofs="+r)):r=0:i.push("ofs="+r);for(var o=!0,a=0;a<e;a++){var s=t[a].Pc,u=t[a].map;if(0>(s-=r))r=Math.max(0,t[a].Pc-100),o=!1;else try{this.hf(u,i,"req"+s+"_")}catch(c){n&&n(u)}}if(o)return i.join("&")}},on.prototype.zc=function(t){return this.jg.parse(t)};var sn=a.JSON.parse;function un(t){Ft.call(this),this.headers=new Fe,this.Xa=t||null,this.ha=!1,this.mc=this.c=null,this.ge=this.Tb="",this.Pa=0,this.I="",this.Aa=this.Lc=this.Qb=this.Ec=!1,this.vb=0,this.hc=null,this.Ae=cn,this.jc=this.lg=this.Ab=!1}E(un,Ft);var cn="";un.prototype.s=he("goog.net.XhrIo");var ln=/^https?$/i,hn=["POST","PUT"];function fn(t){return"content-type"==t.toLowerCase()}function pn(t,e){return{type:e,lengthComputable:t.lengthComputable,loaded:t.loaded,total:t.total}}function dn(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}if(r)return t;if(n=function(t){var e="";return W(t,function(t,n){e+=n,e+=":",e+=t,e+="\r\n"}),e}(n),s(t)){if(e=encodeURIComponent(String(e)),e+=n=null!=n?"="+encodeURIComponent(String(n)):""){if(0>(n=t.indexOf("#"))&&(n=t.length),0>(r=t.indexOf("?"))||r>n){r=n;var i=""}else i=t.substring(r+1,n);n=(t=[t.substr(0,r),i,t.substr(n)])[1],t[1]=e?n?n+"&"+e:e:n,t=t[0]+(t[1]?"?"+t[1]:"")+t[2]}return t}return t.l(e,n),t}function yn(t){this.Bd=22,this.De=0,this.M=[],this.a=new de,this.Ib=new Je,this.na=this.md=this.hb=this.K=this.u=this.Kc=this.aa=this.gb=this.N=this.Rb=this.A=null,this.Te=!0,this.ag=this.Yb=0,this.kf=!!u("internalChannelParams.failFast",t),this.fd=this.Ja=this.wa=this.ia=this.ea=this.i=null,this.Se=!0,this.w=this.he=this.Sb=-1,this.rc=this.Ha=this.La=0,this.Ve=u("internalChannelParams.baseRetryDelayMs",t)||5e3,this.vg=u("internalChannelParams.retryDelaySeedMs",t)||1e4,this.nf=u("internalChannelParams.forwardChannelMaxRetries",t)||2,this.Od=u("internalChannelParams.forwardChannelRequestTimeoutMs",t)||2e4,this.Xa=t&&t.oh||void 0,this.Db=void 0,this.Ra=0,this.gc=t&&t.supportsCrossDomainXhr||!1,this.ra="",this.G=new en(t&&t.concurrentRequestLimit),this.kc=new on,this.ta=!t||void 0===t.backgroundChannelTest||t.backgroundChannelTest,(this.Nd=t&&t.fastHandshake||!1)&&!this.ta&&(this.a.T("Force backgroundChannelTest when fastHandshake is enabled."),this.ta=!0),t&&t.Id&&this.a.Id()}function mn(){}function gn(){if($&&!(10<=Number(st)))throw Error("Environmental error: no available transport.")}function vn(t,e){Ft.call(this),this.b=new yn(e),this.yb=t,this.Qg=e&&e.testUrl?e.testUrl:function(t){for(var e=arguments[0],n=1;n<arguments.length;n++){var r,i=arguments[n];0==i.lastIndexOf("/",0)?e=i:((r=""==e)||(r=0<=(r=e.length-1)&&e.indexOf("/",r)==r),e=r?e+i:e+"/"+i)}return e}(this.yb,"test"),this.s=he("goog.labs.net.webChannel.WebChannelBaseTransport"),this.Rc=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.b.ga(t),t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.zd&&(t?t["X-WebChannel-Client-Profile"]=e.zd:t={"X-WebChannel-Client-Profile":e.zd}),this.b.Eg(t),(t=e&&e.httpHeadersOverwriteParam)&&!M(t)&&this.b.Cg(t),this.Og=e&&e.supportsCrossDomainXhr||!1,this.zg=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!M(e)&&(this.b.Dg(e),null!==(t=this.Rc)&&e in t&&(e in(t=this.Rc)&&delete t[e],(t=this.s)&&t.T("Ignore httpSessionIdParam also specified with messageUrlParams: "+e,void 0))),this.vd=new wn(this)}function bn(t){ke.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.ne=t)&&(t=this.ne,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function _n(t){De.call(this),this.status=1,this.errorCode=t}function wn(t){this.b=t}(r=un.prototype).Je=function(t){this.Ab=t},r.send=function(t,e,n,r){if(this.c)throw Error("[goog.net.XhrIo] Object is active with another request="+this.Tb+"; newUri="+t);e=e?e.toUpperCase():"GET",this.Tb=t,this.I="",this.Pa=0,this.ge=e,this.Ec=!1,this.ha=!0,this.c=this.df(),this.mc=this.Xa?this.Xa.Vd():Ie.Vd(),this.c.onreadystatechange=b(this.te,this),this.lg&&"onprogress"in this.c&&(this.c.onprogress=b(function(t){this.re(t,!0)},this),this.c.upload&&(this.c.upload.onprogress=b(this.re,this)));try{pe(this.s,this.da("Opening Xhr")),this.Lc=!0,this.c.open(e,String(t),!0),this.Lc=!1}catch(o){return pe(this.s,this.da("Error opening Xhr: "+o.message)),void this.Ld(o)}t=n||"";var i=this.headers.clone();r&&Me(r,function(t,e){i.set(e,t)}),r=function(t){t:{for(var e=fn,n=t.length,r=s(t)?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return 0>e?null:s(t)?t.charAt(e):t[e]}(i.W()),n=a.FormData&&t instanceof a.FormData,!(0<=k(hn,e))||r||n||i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i.forEach(function(t,e){this.c.setRequestHeader(e,t)},this),this.Ae&&(this.c.responseType=this.Ae),"withCredentials"in this.c&&this.c.withCredentials!==this.Ab&&(this.c.withCredentials=this.Ab);try{this.yd(),0<this.vb&&(this.jc=function(t){return $&&ct(9)&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.c),pe(this.s,this.da("Will abort after "+this.vb+"ms if incomplete, xhr2 "+this.jc)),this.jc?(this.c.timeout=this.vb,this.c.ontimeout=b(this.Ua,this)):this.hc=Jt(this.Ua,this.vb,this)),pe(this.s,this.da("Sending request")),this.Qb=!0,this.c.send(t),this.Qb=!1}catch(o){pe(this.s,this.da("Send error: "+o.message)),this.Ld(o)}},r.df=function(){return this.Xa?this.Xa.Dd():Ie.Dd()},r.Ua=function(){"undefined"!=typeof o&&this.c&&(this.I="Timed out after "+this.vb+"ms, aborting",this.Pa=8,pe(this.s,this.da(this.I)),this.dispatchEvent("timeout"),this.abort(8))},r.Ld=function(t){this.ha=!1,this.c&&(this.Aa=!0,this.c.abort(),this.Aa=!1),this.I=t,this.Pa=5,this.Jd(),this.Gb()},r.Jd=function(){this.Ec||(this.Ec=!0,this.dispatchEvent("complete"),this.dispatchEvent("error"))},r.abort=function(t){this.c&&this.ha&&(pe(this.s,this.da("Aborting")),this.ha=!1,this.Aa=!0,this.c.abort(),this.Aa=!1,this.Pa=t||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),this.Gb())},r.F=function(){this.c&&(this.ha&&(this.ha=!1,this.Aa=!0,this.c.abort(),this.Aa=!1),this.Gb(!0)),un.L.F.call(this)},r.te=function(){this.Ka||(this.Lc||this.Qb||this.Aa?this.se():this.eg())},r.eg=function(){this.se()},r.se=function(){if(this.ha&&"undefined"!=typeof o)if(this.mc[1]&&4==this.ma()&&2==this.za())pe(this.s,this.da("Local request error detected and ignored"));else if(this.Qb&&4==this.ma())Jt(this.te,0,this);else if(this.dispatchEvent("readystatechange"),this.Mc()){pe(this.s,this.da("Request complete")),this.ha=!1;try{this.Rf()?(this.dispatchEvent("complete"),this.dispatchEvent("success")):(this.Pa=6,this.I=this.Yd()+" ["+this.za()+"]",this.Jd())}finally{this.Gb()}}},r.re=function(t,e){this.dispatchEvent(pn(t,"progress")),this.dispatchEvent(pn(t,e?"downloadprogress":"uploadprogress"))},r.Gb=function(t){if(this.c){this.yd();var e=this.c,n=this.mc[0]?c:null;this.mc=this.c=null,t||this.dispatchEvent("ready");try{e.onreadystatechange=n}catch(r){(t=this.s)&&t.ca("Problem encountered resetting onreadystatechange: "+r.message,void 0)}}},r.yd=function(){this.c&&this.jc&&(this.c.ontimeout=null),this.hc&&(a.clearTimeout(this.hc),this.hc=null)},r.Ba=function(){return!!this.c},r.Mc=function(){return 4==this.ma()},r.Rf=function(){var t=this.za();t:switch(t){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break t;default:e=!1}return e||0===t&&!this.Of()},r.Of=function(){var t=String(this.Tb).match(je)[1]||null;return!t&&a.self&&a.self.location&&(t=(t=a.self.location.protocol).substr(0,t.length-1)),ln.test(t?t.toLowerCase():"")},r.ma=function(){return this.c?this.c.readyState:0},r.za=function(){try{return 2<this.ma()?this.c.status:-1}catch(t){return-1}},r.Yd=function(){try{return 2<this.ma()?this.c.statusText:""}catch(t){return pe(this.s,"Can not get status: "+t.message),""}},r.ya=function(){try{return this.c?this.c.responseText:""}catch(t){return pe(this.s,"Can not get responseText: "+t.message),""}},r.yf=function(t){if(this.c){var e=this.c.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),sn(e)}},r.getResponseHeader=function(t){if(this.c&&this.Mc())return null===(t=this.c.getResponseHeader(t))?void 0:t},r.getAllResponseHeaders=function(){return this.c&&this.Mc()&&this.c.getAllResponseHeaders()||""},r.kb=function(t){return this.c?this.c.getResponseHeader(t):null},r.Ud=function(){return this.Pa},r.Hc=function(){return s(this.I)?this.I:String(this.I)},r.da=function(t){return t+" ["+this.ge+" "+this.Tb+" "+this.za()+"]"},(r=yn.prototype).tc=8,r.g=1,r.connect=function(t,e,n,r,i){this.a.debug("connect()"),be(0),this.K=e,this.gb=n||{},r&&void 0!==i&&(this.gb.OSID=r,this.gb.OAID=i),this.ta&&(this.a.debug("connect() bypassed channel-test."),this.Ib.$d=[],this.Ib.od=!1),this.bf(t)},r.disconnect=function(){if(this.a.debug("disconnect()"),this.qd(),3==this.g){var t=this.Yb++,e=this.hb.clone();e.l("SID",this.ra),e.l("RID",t),e.l("TYPE","terminate"),this.Ya(e),new Oe(this,this.a,this.ra,t,void 0).yg(e)}this.qe()},r.bf=function(t){this.a.debug("connectTest_()"),this.Ja=new Xe(this,this.a),null===this.N&&this.Ja.ga(this.A);var e=t;this.N&&this.A&&(e=dn(t,this.N,this.A)),this.Ja.connect(e)},r.af=function(){this.a.debug("connectChannel_()"),this.hb=this.Sd(this.K),this.Dc()},r.qd=function(){this.Ja&&(this.Ja.abort(),this.Ja=null),this.u&&(this.u.cancel(),this.u=null),this.ia&&(a.clearTimeout(this.ia),this.ia=null),this.Hb(),this.G.cancel(),this.ea&&(a.clearTimeout(this.ea),this.ea=null)},r.ga=function(t){this.A=t},r.Eg=function(t){this.Rb=t},r.Cg=function(t){this.N=t},r.Dg=function(t){this.aa=t},r.Fe=function(t){this.Kc=t},r.He=function(t){this.Ra=t},r.Hg=function(){this.gc=!0},r.Ee=function(t){this.i=t},r.Nf=function(){return!this.fd},r.Zc=function(t){1e3==this.M.length&&this.a.ca(function(){return"Already have 1000 queued maps upon queueing "+Ut(t)}),this.M.push(new tn(this.ag++,t)),3==this.g&&this.Dc()},r.qf=function(){return this.kf?0:this.nf},r.de=function(){return 0==this.g},r.getState=function(){return this.g},r.Dc=function(){this.G.ee()||this.ea||(this.ea=we(b(this.we,this),0),this.La=0)},r.Yf=function(t){return this.G.xf()>=this.G.Xb-(this.ea?1:0)?(this.a.ca("Unexpected retry request is scheduled."),!1):this.ea?(this.a.debug("Use the retry request that is already scheduled."),this.M=t.la().concat(this.M),!0):!(1==this.g||2==this.g||this.La>=this.qf())&&(this.a.debug("Going to retry POST"),this.ea=we(b(this.we,this,t),this.Xd(this.La)),this.La++,!0)},r.we=function(t){this.ea=null,this.Mg(t)},r.Mg=function(t){this.a.debug("startForwardChannel_"),1==this.g?t?this.a.ca("Not supposed to retry the open"):(this.ig(),this.g=2):3==this.g&&(t?this.le(t):0==this.M.length?this.a.debug("startForwardChannel_ returned: nothing to send"):this.G.ee()?this.a.ca("startForwardChannel_ returned: connection already in progress"):(this.le(),this.a.debug("startForwardChannel_ finished, sent request")))},r.ig=function(){this.a.debug("open_()"),this.Yb=Math.floor(1e5*Math.random());var t=this.Yb++,e=new Oe(this,this.a,"",t,void 0),n=this.A;this.Rb&&(n?G(n=H(n),this.Rb):n=this.Rb),null===this.N&&e.ga(n);var r=this.Hd(e),i=this.hb.clone();i.l("RID",t),0<this.Bd&&i.l("CVER",this.Bd),this.ta&&this.aa&&i.l("X-HTTP-Session-Id",this.aa),this.Ya(i),this.N&&n&&dn(i,this.N,n),this.G.oc(e),this.Nd?(i.l("$req",r),i.l("SID","null"),e.Ag(),e.kd(i,null)):e.kd(i,r)},r.le=function(t){var e=t?t.R:this.Yb++,n=this.hb.clone();n.l("SID",this.ra),n.l("RID",e),n.l("AID",this.Sb),this.Ya(n),this.N&&this.A&&dn(n,this.N,this.A),e=new Oe(this,this.a,this.ra,e,this.La+1),null===this.N&&e.ga(this.A),t&&this.sg(t),t=this.Hd(e),e.setTimeout(Math.round(.5*this.Od)+Math.round(.5*this.Od*Math.random())),this.G.oc(e),e.kd(n,t)},r.Ya=function(t){this.i&&Me({},function(e,n){t.l(n,e)})},r.Hd=function(t){var e=Math.min(this.M.length,1e3),n=this.i?b(this.i.Ue,this.i,this):null;return n=this.kc.jf(this.M,e,n),t.Gg(this.M.splice(0,e)),n},r.sg=function(t){this.M=t.la().concat(this.M)},r.Kd=function(){if(!this.u&&!this.ia){this.rc=1;var t=this.ve;qt||Ht(),zt||(qt(),zt=!0),Gt.add(t,this),this.Ha=0}},r.Qc=function(){return this.u||this.ia?(this.a.ca("Request already in progress"),!1):!(3<=this.Ha)&&(this.a.debug("Going to retry GET"),this.rc++,this.ia=we(b(this.ve,this),this.Xd(this.Ha)),this.Ha++,!0)},r.ve=function(){this.ia=null,this.Kg()},r.Kg=function(){this.a.debug("Creating new HttpRequest"),this.u=new Oe(this,this.a,this.ra,"rpc",this.rc),null===this.N&&this.u.ga(this.A),this.u.He(this.Ra);var t=this.md.clone();t.l("RID","rpc"),t.l("SID",this.ra),t.l("CI",this.fd?"0":"1"),t.l("AID",this.Sb),this.Ya(t),t.l("TYPE","xmlhttp"),this.N&&this.A&&dn(t,this.N,this.A),this.Db&&this.u.setTimeout(this.Db),this.u.jd(t,!0,this.na),this.a.debug("New Request created")},r.ub=function(t,e){this.a.debug("Test Connection Finished");var n=t.Ad;n&&this.G.ld(n),this.fd=this.Se&&e,this.w=t.w,this.af()},r.dd=function(t){this.a.debug("Test Connection Failed"),this.w=t.w,this.sa(2)},r.ue=function(t,e){if(0!=this.g&&(this.u==t||this.G.Jc(t)))if(this.w=t.w,!t.lb&&this.G.Jc(t)&&3==this.g){try{var n=this.kc.zc(e)}catch(r){n=null}h(n)&&3==n.length?this.Cf(n,t):(this.a.debug("Bad POST response data returned"),this.sa(11))}else(t.lb||this.u==t)&&this.Hb(),M(e)||(n=this.kc.zc(e),this.dg(n,t))},r.Cf=function(t,e){0==t[0]?this.Bf(e):(this.he=t[1],0<(e=this.he-this.Sb)&&(t=t[2],this.a.debug(t+" bytes (in "+e+" arrays) are outstanding on the BackChannel"),this.Jg(t)&&!this.wa&&(this.wa=we(b(this.bg,this),6e3))))},r.Bf=function(t){if(this.a.debug("Server claims our backchannel is missing."),this.ia)this.a.debug("But we are currently starting the request.");else{if(this.u){if(!(this.u.qb+3e3<t.qb))return;this.Hb(),this.u.cancel(),this.u=null}else this.a.T("We do not have a BackChannel established");this.Qc(),be(18)}},r.Jg=function(t){return 37500>t&&!this.Nf()&&0==this.Ha},r.$a=function(t){return this.Te?this.i?this.i.$a(t):t:null},r.bg=function(){null!=this.wa&&(this.wa=null,this.u.cancel(),this.u=null,this.Qc(),be(19))},r.Hb=function(){null!=this.wa&&(a.clearTimeout(this.wa),this.wa=null)},r.Tc=function(t){this.a.debug("Request complete");var e=null;if(this.u==t){this.Hb(),this.u=null;var n=2}else{if(!this.G.Jc(t))return;e=t.la(),this.G.ze(t),n=1}if(this.w=t.w,0!=this.g)if(t.S)1==n?(function(t,e,n){ye.dispatchEvent(new _e(ye,t,e,n))}(t.Da?t.Da.length:0,w()-t.qb,this.La),this.Dc()):this.Kd();else{var r=t.Hc();if(3==r||0==r&&0<this.w)this.a.debug("Not retrying due to error type");else{var i=this;if(this.a.debug(function(){return"Maybe retrying, last error: "+function(t,e){switch(t){case 0:return"Non-200 return code ("+e+")";case 1:return"XMLHTTP failure (no data)";case 2:return"HttpConnection timeout";default:return"Unknown error"}}(r,i.w)}),1==n&&this.Yf(t)||2==n&&this.Qc())return;this.a.debug("Exceeded max number of retries")}switch(e&&0<e.length&&this.G.Re(e),this.a.debug("Error: HTTP request failed"),r){case 1:this.sa(5);break;case 4:this.sa(10);break;case 3:this.sa(6);break;default:this.sa(2)}}},r.Xd=function(t){var e=this.Ve+Math.floor(Math.random()*this.vg);return this.Ba()||(this.a.debug("Inactive channel"),e*=2),e*t},r.pc=function(t){if(this.ta&&(t=t.h)){var e=t.kb("X-Client-Wire-Protocol");e&&this.G.ld(e),this.aa&&((t=t.kb("X-HTTP-Session-Id"))?(this.Fe(t),this.hb.l(this.aa,t)):this.a.T("Missing X_HTTP_SESSION_ID in the handshake response"))}},r.dg=function(t,e){for(var n=this.i&&this.i.sc?[]:null,r=0;r<t.length;r++){var i=t[r];if(this.Sb=i[0],i=i[1],2==this.g)if("c"==i[0]){this.ra=i[1],this.na=this.$a(i[2]);var o=i[3];null!=o&&(this.tc=o,this.a.info("VER="+this.tc)),null!=(o=i[4])&&(this.De=o,this.a.info("SVER="+this.De)),null!=(i=i[5])&&"number"==typeof i&&0<i&&(this.Db=i*=1.5,this.a.info("backChannelRequestTimeoutMs_="+i)),this.pc(e),this.g=3,this.i&&this.i.wd(),this.Lg(e)}else"stop"!=i[0]&&"close"!=i[0]||this.sa(7);else 3==this.g&&("stop"==i[0]||"close"==i[0]?(n&&0!=n.length&&(this.i.sc(this,n),n.length=0),"stop"==i[0]?this.sa(7):this.disconnect()):"noop"!=i[0]&&(n?n.push(i):this.i&&this.i.ud(i)),this.Ha=0)}n&&0!=n.length&&this.i.sc(this,n)},r.Lg=function(t){this.md=this.Pd(this.na,this.K),t.lb?(this.a.debug("Upgrade the handshake request to a backchannel."),this.G.ze(t),t.tg(this.Db),this.u=t):this.Kd()},r.sa=function(t){if(this.a.info("Error code "+t),2==t){var e=null;this.i&&(e=null);var n=b(this.Pg,this);e||(e=new Ve("//www.google.com/images/cleardot.gif"),a.location&&"http"==a.location.protocol||e.tb("https"),e.Ub()),function(t,e){var n=new de;n.debug("TestLoadImage: loading "+t);var r=new Image;r.onload=_(an,n,r,"TestLoadImage: loaded",!0,e),r.onerror=_(an,n,r,"TestLoadImage: error",!1,e),r.onabort=_(an,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=_(an,n,r,"TestLoadImage: timeout",!1,e),a.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}(e.toString(),n)}else be(2);this.cg(t)},r.Pg=function(t){t?(this.a.info("Successfully pinged google.com"),be(2)):(this.a.info("Failed to ping google.com"),be(1))},r.cg=function(t){this.a.debug("HttpChannel: error - "+t),this.g=0,this.i&&this.i.td(t),this.qe(),this.qd()},r.qe=function(){if(this.g=0,this.w=-1,this.i){var t=this.G.la();if(0!=t.length||0!=this.M.length){var e=this;this.a.debug(function(){return"Number of undelivered maps, pending: "+t.length+", outgoing: "+e.M.length}),this.G.$e(),L(this.M),this.M.length=0}this.i.sd()}},r.Sd=function(t){return t=this.Cd(null,t),this.a.debug("GetForwardChannelUri: "+t),t},r.Pd=function(t,e){return t=this.Cd(this.fc()?t:null,e),this.a.debug("GetBackChannelUri: "+t),t},r.Cd=function(t,e){var n=function(t){return t instanceof Ve?t.clone():new Ve(t,void 0)}(e);if(""!=n.xa)t&&n.rb(t+"."+n.xa),n.sb(n.Ca);else{var r=a.location;n=function(t,e,n,r){var i=new Ve(null,void 0);return t&&i.tb(t),e&&i.rb(e),n&&i.sb(n),r&&i.ec(r),i}(r.protocol,t?t+"."+r.hostname:r.hostname,+r.port,e)}return this.gb&&W(this.gb,function(t,e){n.l(e,t)}),t=this.aa,e=this.Kc,t&&e&&n.l(t,e),n.l("VER",this.tc),this.Ya(n),n},r.Jb=function(t){if(t&&!this.gc)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new un(this.Xa)).Je(this.gc),t},r.Ba=function(){return!!this.i&&this.i.Ba()},r.fc=function(){return this.gc},(r=mn.prototype).sc=null,r.wd=function(){},r.ud=function(){},r.td=function(){},r.sd=function(){},r.Ba=function(){return!0},r.Ue=function(){},r.$a=function(t){return t},gn.prototype.cf=function(t,e){return new vn(t,e)},E(vn,Ft),(r=vn.prototype).addEventListener=function(t,e,n,r){vn.L.addEventListener.call(this,t,e,n,r)},r.removeEventListener=function(t,e,n,r){vn.L.removeEventListener.call(this,t,e,n,r)},r.open=function(){this.b.Ee(this.vd),this.Og&&this.b.Hg(),this.b.connect(this.Qg,this.yb,this.Rc||void 0)},r.close=function(){this.b.disconnect()},r.send=function(t){if(s(t)){var e={};e.__data__=t,this.b.Zc(e)}else this.zg?((e={}).__data__=Ut(t),this.b.Zc(e)):this.b.Zc(t)},r.F=function(){this.b.Ee(null),delete this.vd,this.b.disconnect(),delete this.b,vn.L.F.call(this)},E(bn,ke),E(_n,De),E(wn,mn),wn.prototype.wd=function(){fe(this.b.s,"WebChannel opened on "+this.b.yb),this.b.dispatchEvent("a")},wn.prototype.ud=function(t){this.b.dispatchEvent(new bn(t))},wn.prototype.td=function(t){fe(this.b.s,"WebChannel aborted on "+this.b.yb+" due to channel error: "+t),this.b.dispatchEvent(new _n(t))},wn.prototype.sd=function(){fe(this.b.s,"WebChannel closed on "+this.b.yb),this.b.dispatchEvent("b")};var En=_(function(t,e){function n(){}n.prototype=t.prototype;var r=new n;return t.apply(r,Array.prototype.slice.call(arguments,1)),r},gn);function Tn(){this.V=[],this.Z=[]}function Sn(t,e){if(C.call(this),this.oe=t||0,this.Wb=e||10,this.oe>this.Wb)throw Error(Cn);this.fa=new Tn,this.oa=new $e,this.Ac=0,this.Nc=null,this.Cb()}(r=Tn.prototype).Vf=function(){0==this.V.length&&(this.V=this.Z,this.V.reverse(),this.Z=[])},r.enqueue=function(t){this.Z.push(t)},r.ab=function(){return this.Vf(),this.V.pop()},r.C=function(){return this.V.length+this.Z.length},r.X=function(){return 0==this.V.length&&0==this.Z.length},r.clear=function(){this.V=[],this.Z=[]},r.contains=function(t){return 0<=k(this.V,t)||0<=k(this.Z,t)},r.remove=function(t){var e=this.V,n=D(e,t);return 0<=n?(Array.prototype.splice.call(e,n,1),e=!0):e=!1,e||P(this.Z,t)},r.H=function(){for(var t=[],e=this.V.length-1;0<=e;--e)t.push(this.V[e]);var n=this.Z.length;for(e=0;e<n;++e)t.push(this.Z[e]);return t},E(Sn,C);var Cn="[goog.structs.Pool] Min can not be greater than max";function In(t,e){this.fe=t,this.gd=e}function Nn(t){this.Y=[],t&&this.Lf(t)}function kn(){Nn.call(this)}function Dn(t,e){this.Gd=void 0,this.cc=new kn,Sn.call(this,t,e)}function An(t,e,n,r){this.Jf=t,this.Ab=!!r,Dn.call(this,e,n)}(r=Sn.prototype).Mb=function(){var t=w();if(!(null!=this.Nc&&t-this.Nc<this.Ac)){var e=this.qg();return e&&(this.Nc=t,this.oa.add(e)),e}},r.og=function(t){return!!this.oa.remove(t)&&(this.nc(t),!0)},r.qg=function(){for(var t;0<this.Td()&&(t=this.fa.ab(),!this.Sc(t));)this.Cb();return!t&&this.C()<this.Wb&&(t=this.xc()),t},r.nc=function(t){this.oa.remove(t),this.Sc(t)&&this.C()<this.Wb?this.fa.enqueue(t):this.Bc(t)},r.Cb=function(){for(var t=this.fa;this.C()<this.oe;)t.enqueue(this.xc());for(;this.C()>this.Wb&&0<this.Td();)this.Bc(t.ab())},r.xc=function(){return{}},r.Bc=function(t){if("function"==typeof t.bb)t.bb();else for(var e in t)t[e]=null},r.Sc=function(t){return"function"!=typeof t.Ye||t.Ye()},r.contains=function(t){return this.fa.contains(t)||this.oa.contains(t)},r.C=function(){return this.fa.C()+this.oa.C()},r.rf=function(){return this.oa.C()},r.Td=function(){return this.fa.C()},r.X=function(){return this.fa.X()&&this.oa.X()},r.F=function(){if(Sn.L.F.call(this),0<this.rf())throw Error("[goog.structs.Pool] Objects not released");delete this.oa;for(var t=this.fa;!t.X();)this.Bc(t.ab());delete this.fa},In.prototype.getKey=function(){return this.fe},In.prototype.clone=function(){return new In(this.fe,this.gd)},(r=Nn.prototype).ce=function(t,e){var n=this.Y;n.push(new In(t,e)),this.$f(n.length-1)},r.Lf=function(t){if(t instanceof Nn){var e=t.W();if(t=t.H(),0>=this.C()){for(var n=this.Y,r=0;r<e.length;r++)n.push(new In(e[r],t[r]));return}}else e=Q(t),t=K(t);for(r=0;r<e.length;r++)this.ce(e[r],t[r])},r.remove=function(){var t=this.Y,e=t.length,n=t[0];if(!(0>=e))return 1==e?R(t):(t[0]=t.pop(),this.Zf()),n.gd},r.Zf=function(){for(var t=0,e=this.Y,n=e.length,r=e[t];t<n>>1;){var i=this.tf(t),o=this.zf(t);if(i=o<n&&e[o].getKey()<e[i].getKey()?o:i,e[i].getKey()>r.getKey())break;e[t]=e[i],t=i}e[t]=r},r.$f=function(t){for(var e=this.Y,n=e[t];0<t;){var r=this.wf(t);if(!(e[r].getKey()>n.getKey()))break;e[t]=e[r],t=r}e[t]=n},r.tf=function(t){return 2*t+1},r.zf=function(t){return 2*t+2},r.wf=function(t){return t-1>>1},r.H=function(){for(var t=this.Y,e=[],n=t.length,r=0;r<n;r++)e.push(t[r].gd);return e},r.W=function(){for(var t=this.Y,e=[],n=t.length,r=0;r<n;r++)e.push(t[r].getKey());return e},r.va=function(t){return O(this.Y,function(e){return e.getKey()==t})},r.clone=function(){return new Nn(this)},r.C=function(){return this.Y.length},r.X=function(){return 0==this.Y.length},r.clear=function(){R(this.Y)},E(kn,Nn),kn.prototype.enqueue=function(t,e){this.ce(t,e)},kn.prototype.ab=function(){return this.remove()},E(Dn,Sn),(r=Dn.prototype).Mb=function(t,e){if(!t)return(t=Dn.L.Mb.call(this))&&this.Ac&&(this.Gd=a.setTimeout(b(this.Nb,this),this.Ac)),t;this.cc.enqueue(void 0!==e?e:100,t),this.Nb()},r.Nb=function(){for(var t=this.cc;0<t.C();){var e=this.Mb();if(!e)break;t.ab().apply(this,[e])}},r.nc=function(t){Dn.L.nc.call(this,t),this.Nb()},r.Cb=function(){Dn.L.Cb.call(this),this.Nb()},r.F=function(){Dn.L.F.call(this),a.clearTimeout(this.Gd),this.cc.clear(),this.cc=null},E(An,Dn),An.prototype.xc=function(){var t=new un,e=this.Jf;return e&&e.forEach(function(e,n){t.headers.set(n,e)}),this.Ab&&t.Je(!0),t},An.prototype.Sc=function(t){return!t.Ka&&!t.Ba()},gn.prototype.createWebChannel=gn.prototype.cf,vn.prototype.send=vn.prototype.send,vn.prototype.open=vn.prototype.open,vn.prototype.close=vn.prototype.close,Ee.NO_ERROR=0,Ee.TIMEOUT=8,Ee.HTTP_ERROR=6,Te.COMPLETE="complete",Ce.EventType=Ne,Ne.OPEN="a",Ne.CLOSE="b",Ne.ERROR="c",Ne.MESSAGE="d",Ft.prototype.listen=Ft.prototype.nb,An.prototype.getObject=An.prototype.Mb,An.prototype.releaseObject=An.prototype.og,un.prototype.listenOnce=un.prototype.Oc,un.prototype.getLastError=un.prototype.Hc,un.prototype.getLastErrorCode=un.prototype.Ud,un.prototype.getStatus=un.prototype.za,un.prototype.getStatusText=un.prototype.Yd,un.prototype.getResponseJson=un.prototype.yf,un.prototype.getResponseText=un.prototype.ya,un.prototype.getResponseText=un.prototype.ya,un.prototype.send=un.prototype.send;var On={createWebChannelTransport:En,ErrorCode:Ee,EventType:Te,WebChannel:Ce,XhrIoPool:An},Rn=On.createWebChannelTransport,Pn=On.ErrorCode,xn=On.EventType,Ln=On.WebChannel,Mn=On.XhrIoPool;e.default=On}.call(this,n(14))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(1),o=(r=n(2))&&"object"===typeof r&&"default"in r?r.default:r,a={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},s=function(t){function e(n,r,i){var o=t.call(this,r)||this;return Object.setPrototypeOf(o,e.prototype),o.code=n,o.details=i,o}return i.__extends(e,t),e}(Error);var u=function(){function t(t){this.app=t}return t.prototype.getAuthToken=function(){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.app.INTERNAL.getToken()];case 1:return(t=e.sent())?[2,t.accessToken]:[2,void 0];case 2:return e.sent(),[2,void 0];case 3:return[2]}})})},t.prototype.getInstanceIdToken=function(){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.app.messaging?[4,this.app.messaging().getToken()]:[2,void 0];case 1:return(t=e.sent())?[2,t]:[2,void 0];case 2:return e.sent(),[2,void 0];case 3:return[2]}})})},t.prototype.getContext=function(){return i.__awaiter(this,void 0,void 0,function(){var t,e;return i.__generator(this,function(n){switch(n.label){case 0:return[4,this.getAuthToken()];case 1:return t=n.sent(),[4,this.getInstanceIdToken()];case 2:return e=n.sent(),[2,{authToken:t,instanceIdToken:e}]}})})},t}();function c(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}var l=function(){function t(){}return t.prototype.encode=function(t){var e=this;if(null===t||void 0===t)return null;if(t instanceof Number&&(t=t.valueOf()),"number"===typeof t&&isFinite(t))return t;if(!0===t||!1===t)return t;if("[object String]"===Object.prototype.toString.call(t))return t;if(Array.isArray(t))return t.map(function(t){return e.encode(t)});if("function"===typeof t||"object"===typeof t)return c(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},t.prototype.decode=function(t){var e=this;if(null===t)return t;if(t["@type"])switch(t["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":var n=parseFloat(t.value);if(isNaN(n))throw new Error("Data cannot be decoded from JSON: "+t);return n;default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(function(t){return e.decode(t)}):"function"===typeof t||"object"===typeof t?c(t,function(t){return e.decode(t)}):t},t}(),h=function(){function t(t,e){void 0===e&&(e="us-central1"),this.app_=t,this.region_=e,this.serializer=new l,this.emulatorOrigin=null,this.contextProvider=new u(t)}return Object.defineProperty(t.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),t.prototype._url=function(t){var e=this.app_.options.projectId,n=this.region_;return null!==this.emulatorOrigin?this.emulatorOrigin+"/"+e+"/"+n+"/"+t:"https://"+n+"-"+e+".cloudfunctions.net/"+t},t.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},t.prototype.httpsCallable=function(t){var e=this;return function(n){return e.call(t,n)}},t.prototype.postJSON=function(t,e,n){return i.__awaiter(this,void 0,void 0,function(){var r,o;return i.__generator(this,function(i){switch(i.label){case 0:n.append("Content-Type","application/json"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,fetch(t,{method:"POST",body:JSON.stringify(e),headers:n})];case 2:return r=i.sent(),[3,4];case 3:return i.sent(),[2,{status:0,json:null}];case 4:o=null,i.label=5;case 5:return i.trys.push([5,7,,8]),[4,r.json()];case 6:return o=i.sent(),[3,8];case 7:return i.sent(),[3,8];case 8:return[2,{status:r.status,json:o}]}})})},t.prototype.call=function(t,e){return i.__awaiter(this,void 0,void 0,function(){var n,r,o,u,c,l,h;return i.__generator(this,function(i){switch(i.label){case 0:return n=this._url(t),e=this.serializer.encode(e),r={data:e},o=new Headers,[4,this.contextProvider.getContext()];case 1:return(u=i.sent()).authToken&&o.append("Authorization","Bearer "+u.authToken),u.instanceIdToken&&o.append("Firebase-Instance-ID-Token",u.instanceIdToken),[4,this.postJSON(n,r,o)];case 2:if(c=i.sent(),l=function(t,e,n){var r=function(t){if(t>=200&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}(t),i=r,o=void 0;try{var u=e.error;if(u){var c=u.status;if("string"===typeof c){if(!a[c])return new s("internal","internal");r=a[c]}i=c;var l=u.message;"string"===typeof l&&(i=l),void 0!==(o=u.details)&&(o=n.decode(o))}}catch(h){}return"ok"===r?null:new s(r,i,o)}(c.status,c.json,this.serializer))throw l;if(!c.json)throw new s("internal","Response is not valid JSON object.");if("undefined"===typeof(h=c.json.data)&&(h=c.json.result),"undefined"===typeof h)throw new s("internal","Response is missing data field.");return[2,{data:this.serializer.decode(h)}]}})})},t}(),f="functions";function p(t,e,n){return new h(t,n)}function d(t){var e={Functions:h};t.INTERNAL.registerService(f,p,e,void 0,!0)}d(o),e.registerFunctions=d},function(t,e,n){"use strict";n.r(e),n.d(e,"registerMessaging",function(){return P}),n.d(e,"isSupported",function(){return x});var r,i,o,a=n(15),s=n(1),u=n(2),c=n.n(u),l={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"},h=((r={})[l.AVAILABLE_IN_WINDOW]="This method is available in a Window context.",r[l.AVAILABLE_IN_SW]="This method is available in a service worker context.",r[l.SHOULD_BE_INHERITED]="This method should be overriden by extended classes.",r[l.BAD_SENDER_ID]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",r[l.PERMISSION_DEFAULT]="The required permissions were not granted and dismissed instead.",r[l.PERMISSION_BLOCKED]="The required permissions were not granted and blocked instead.",r[l.UNSUPPORTED_BROWSER]="This browser doesn't support the API's required to use the firebase SDK.",r[l.NOTIFICATIONS_BLOCKED]="Notifications have been blocked.",r[l.FAILED_DEFAULT_REGISTRATION]="We are unable to register the default service worker. {$browserErrorMessage}",r[l.SW_REGISTRATION_EXPECTED]="A service worker registration was the expected input.",r[l.GET_SUBSCRIPTION_FAILED]="There was an error when trying to get any existing Push Subscriptions.",r[l.INVALID_SAVED_TOKEN]="Unable to access details of the saved token.",r[l.SW_REG_REDUNDANT]="The service worker being used for push was made redundant.",r[l.TOKEN_SUBSCRIBE_FAILED]="A problem occured while subscribing the user to FCM: {$message}",r[l.TOKEN_SUBSCRIBE_NO_TOKEN]="FCM returned no token when subscribing the user to push.",r[l.TOKEN_SUBSCRIBE_NO_PUSH_SET]="FCM returned an invalid response when getting an FCM token.",r[l.TOKEN_UNSUBSCRIBE_FAILED]="A problem occured while unsubscribing the user from FCM: {$message}",r[l.TOKEN_UPDATE_FAILED]="A problem occured while updating the user from FCM: {$message}",r[l.TOKEN_UPDATE_NO_TOKEN]="FCM returned no token when updating the user to push.",r[l.USE_SW_BEFORE_GET_TOKEN]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",r[l.INVALID_DELETE_TOKEN]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",r[l.DELETE_TOKEN_NOT_FOUND]="The deletion attempt for token could not be performed as the token was not found.",r[l.DELETE_SCOPE_NOT_FOUND]="The deletion attempt for service worker scope could not be performed as the scope was not found.",r[l.BG_HANDLER_FUNCTION_EXPECTED]="The input to setBackgroundMessageHandler() must be a function.",r[l.NO_WINDOW_CLIENT_TO_MSG]="An attempt was made to message a non-existant window client.",r[l.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}",r[l.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.",r[l.FAILED_TO_DELETE_TOKEN]="Unable to delete the currently saved token.",r[l.NO_SW_IN_REG]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",r[l.INCORRECT_GCM_SENDER_ID]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",r[l.BAD_SCOPE]="The service worker scope must be a string with at least one character.",r[l.BAD_VAPID_KEY]="The public VAPID key is not a Uint8Array with 65 bytes.",r[l.BAD_SUBSCRIPTION]="The subscription must be a valid PushSubscription.",r[l.BAD_TOKEN]="The FCM Token used for storage / lookup was not a valid token string.",r[l.BAD_PUSH_SET]="The FCM push set used for storage / lookup was not not a valid push set string.",r[l.FAILED_DELETE_VAPID_KEY]="The VAPID key could not be deleted.",r[l.INVALID_PUBLIC_VAPID_KEY]="The public VAPID key must be a string.",r[l.PUBLIC_KEY_DECRYPTION_FAILED]="The public VAPID key did not equal 65 bytes when decrypted.",r),f=new a.ErrorFactory("messaging","Messaging",h),p=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]),d="https://fcm.googleapis.com";function y(t,e){if(null==t||null==e)return!1;if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(var n=new DataView(t),r=new DataView(e),i=0;i<t.byteLength;i++)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0}function m(t){return function(t){var e=new Uint8Array(t);return btoa(String.fromCharCode.apply(null,e))}(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}!function(t){t.TYPE_OF_MSG="firebase-messaging-msg-type",t.DATA="firebase-messaging-msg-data"}(i||(i={})),function(t){t.PUSH_MSG_RECEIVED="push-msg-received",t.NOTIFICATION_CLICKED="notification-clicked"}(o||(o={}));var g=function(){function t(){}return t.prototype.getToken=function(t,e,n){return Object(s.__awaiter)(this,void 0,void 0,function(){var r,i,o,a,u,c,h,g;return Object(s.__generator)(this,function(s){switch(s.label){case 0:r=m(e.getKey("p256dh")),i=m(e.getKey("auth")),o="authorized_entity="+t+"&endpoint="+e.endpoint+"&encryption_key="+r+"&encryption_auth="+i,y(n.buffer,p.buffer)||(a=m(n),o+="&application_pub_key="+a),(u=new Headers).append("Content-Type","application/x-www-form-urlencoded"),c={method:"POST",headers:u,body:o},s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(d+"/fcm/connect/subscribe",c)];case 2:return[4,s.sent().json()];case 3:return h=s.sent(),[3,5];case 4:throw s.sent(),f.create(l.TOKEN_SUBSCRIBE_FAILED);case 5:if(h.error)throw g=h.error.message,f.create(l.TOKEN_SUBSCRIBE_FAILED,{message:g});if(!h.token)throw f.create(l.TOKEN_SUBSCRIBE_NO_TOKEN);if(!h.pushSet)throw f.create(l.TOKEN_SUBSCRIBE_NO_PUSH_SET);return[2,{token:h.token,pushSet:h.pushSet}]}})})},t.prototype.updateToken=function(t,e,n,r,i){return Object(s.__awaiter)(this,void 0,void 0,function(){var o,a,u,c,h,g,v,b;return Object(s.__generator)(this,function(s){switch(s.label){case 0:o=m(r.getKey("p256dh")),a=m(r.getKey("auth")),u="push_set="+n+"&token="+e+"&authorized_entity="+t+"&endpoint="+r.endpoint+"&encryption_key="+o+"&encryption_auth="+a,y(i.buffer,p.buffer)||(c=m(i),u+="&application_pub_key="+c),(h=new Headers).append("Content-Type","application/x-www-form-urlencoded"),g={method:"POST",headers:h,body:u},s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(d+"/fcm/connect/subscribe",g)];case 2:return[4,s.sent().json()];case 3:return v=s.sent(),[3,5];case 4:throw s.sent(),f.create(l.TOKEN_UPDATE_FAILED);case 5:if(v.error)throw b=v.error.message,f.create(l.TOKEN_UPDATE_FAILED,{message:b});if(!v.token)throw f.create(l.TOKEN_UPDATE_NO_TOKEN);return[2,v.token]}})})},t.prototype.deleteToken=function(t,e,n){return Object(s.__awaiter)(this,void 0,void 0,function(){var r,i,o,a,u;return Object(s.__generator)(this,function(s){switch(s.label){case 0:r="authorized_entity="+t+"&token="+e+"&pushSet="+n,(i=new Headers).append("Content-Type","application/x-www-form-urlencoded"),o={method:"POST",headers:i,body:r},s.label=1;case 1:return s.trys.push([1,4,,5]),[4,fetch(d+"/fcm/connect/unsubscribe",o)];case 2:return[4,s.sent().json()];case 3:if((a=s.sent()).error)throw u=a.error.message,f.create(l.TOKEN_UNSUBSCRIBE_FAILED,{message:u});return[3,5];case 4:throw s.sent(),f.create(l.TOKEN_UNSUBSCRIBE_FAILED);case 5:return[2]}})})},t}();function v(t){for(var e=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(e),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}var b="undefined",_="fcm_token_object_Store";function w(){var t=indexedDB.open(b);t.onerror=function(t){},t.onsuccess=function(e){!function(t){if(t.objectStoreNames.contains(_)){var e=t.transaction(_).objectStore(_),n=new g,r=e.openCursor();r.onerror=function(t){console.warn("Unable to cleanup old IDB.",t)},r.onsuccess=function(){var e=r.result;if(e){var i=e.value;n.deleteToken(i.fcmSenderId,i.fcmToken,i.fcmPushSet),e.continue()}else t.close(),indexedDB.deleteDatabase(b)}}}(t.result)}}var E=function(){function t(){this.dbPromise=null}return t.prototype.get=function(t){return this.createTransaction(function(e){return e.get(t)})},t.prototype.getIndex=function(t,e){return this.createTransaction(function(n){return n.index(t).get(e)})},t.prototype.put=function(t){return this.createTransaction(function(e){return e.put(t)},"readwrite")},t.prototype.delete=function(t){return this.createTransaction(function(e){return e.delete(t)},"readwrite")},t.prototype.closeDatabase=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){switch(t.label){case 0:return this.dbPromise?[4,this.dbPromise]:[3,2];case 1:t.sent().close(),this.dbPromise=null,t.label=2;case 2:return[2]}})})},t.prototype.createTransaction=function(t,e){return void 0===e&&(e="readonly"),Object(s.__awaiter)(this,void 0,void 0,function(){var n,r,i,o;return Object(s.__generator)(this,function(a){switch(a.label){case 0:return[4,this.getDb()];case 1:return n=a.sent(),r=n.transaction(this.objectStoreName,e),i=r.objectStore(this.objectStoreName),[4,T(t(i))];case 2:return o=a.sent(),[2,new Promise(function(t,e){r.oncomplete=function(){t(o)},r.onerror=function(){e(r.error)}})]}})})},t.prototype.getDb=function(){var t=this;return this.dbPromise||(this.dbPromise=new Promise(function(e,n){var r=indexedDB.open(t.dbName,t.dbVersion);r.onsuccess=function(){e(r.result)},r.onerror=function(){t.dbPromise=null,n(r.error)},r.onupgradeneeded=function(e){return t.onDbUpgrade(r,e)}})),this.dbPromise},t}();function T(t){return new Promise(function(e,n){t.onsuccess=function(){e(t.result)},t.onerror=function(){n(t.error)}})}var S=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dbName="fcm_token_details_db",e.dbVersion=3,e.objectStoreName="fcm_token_object_Store",e}return Object(s.__extends)(e,t),e.prototype.onDbUpgrade=function(t,e){var n=t.result;switch(e.oldVersion){case 0:(r=n.createObjectStore(this.objectStoreName,{keyPath:"swScope"})).createIndex("fcmSenderId","fcmSenderId",{unique:!1}),r.createIndex("fcmToken","fcmToken",{unique:!0});case 1:w();case 2:var r,i=(r=t.transaction.objectStore(this.objectStoreName)).openCursor();i.onsuccess=function(){var t=i.result;if(t){var e=t.value,n=Object(s.__assign)({},e);e.createTime||(n.createTime=Date.now()),"string"===typeof e.vapidKey&&(n.vapidKey=v(e.vapidKey)),"string"===typeof e.auth&&(n.auth=v(e.auth).buffer),"string"===typeof e.auth&&(n.p256dh=v(e.p256dh).buffer),t.update(n),t.continue()}}}},e.prototype.getTokenDetailsFromToken=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(e){if(!t)throw f.create(l.BAD_TOKEN);return C({fcmToken:t}),[2,this.getIndex("fcmToken",t)]})})},e.prototype.getTokenDetailsFromSWScope=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(e){if(!t)throw f.create(l.BAD_SCOPE);return C({swScope:t}),[2,this.get(t)]})})},e.prototype.saveTokenDetails=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(e){if(!t.swScope)throw f.create(l.BAD_SCOPE);if(!t.vapidKey)throw f.create(l.BAD_VAPID_KEY);if(!t.endpoint||!t.auth||!t.p256dh)throw f.create(l.BAD_SUBSCRIPTION);if(!t.fcmSenderId)throw f.create(l.BAD_SENDER_ID);if(!t.fcmToken)throw f.create(l.BAD_TOKEN);if(!t.fcmPushSet)throw f.create(l.BAD_PUSH_SET);return C(t),[2,this.put(t)]})})},e.prototype.deleteToken=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:return"string"!==typeof t||0===t.length?[2,Promise.reject(f.create(l.INVALID_DELETE_TOKEN))]:[4,this.getTokenDetailsFromToken(t)];case 1:if(!(e=n.sent()))throw f.create(l.DELETE_TOKEN_NOT_FOUND);return[4,this.delete(e.swScope)];case 2:return n.sent(),[2,e]}})})},e}(E);function C(t){if(t.fcmToken&&("string"!==typeof t.fcmToken||0===t.fcmToken.length))throw f.create(l.BAD_TOKEN);if(t.swScope&&("string"!==typeof t.swScope||0===t.swScope.length))throw f.create(l.BAD_SCOPE);if(t.vapidKey&&(!(t.vapidKey instanceof Uint8Array)||65!==t.vapidKey.length))throw f.create(l.BAD_VAPID_KEY);if(t.endpoint&&("string"!==typeof t.endpoint||0===t.endpoint.length))throw f.create(l.BAD_SUBSCRIPTION);if(t.auth&&!(t.auth instanceof ArrayBuffer))throw f.create(l.BAD_SUBSCRIPTION);if(t.p256dh&&!(t.p256dh instanceof ArrayBuffer))throw f.create(l.BAD_SUBSCRIPTION);if(t.fcmSenderId&&("string"!==typeof t.fcmSenderId||0===t.fcmSenderId.length))throw f.create(l.BAD_SENDER_ID);if(t.fcmPushSet&&("string"!==typeof t.fcmPushSet||0===t.fcmPushSet.length))throw f.create(l.BAD_PUSH_SET)}var I=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dbName="fcm_vapid_details_db",e.dbVersion=1,e.objectStoreName="fcm_vapid_object_Store",e}return Object(s.__extends)(e,t),e.prototype.onDbUpgrade=function(t){t.result.createObjectStore(this.objectStoreName,{keyPath:"swScope"})},e.prototype.getVapidFromSWScope=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:if("string"!==typeof t||0===t.length)throw f.create(l.BAD_SCOPE);return[4,this.get(t)];case 1:return[2,(e=n.sent())?e.vapidKey:void 0]}})})},e.prototype.saveVapidDetails=function(t,e){return Object(s.__awaiter)(this,void 0,void 0,function(){var n;return Object(s.__generator)(this,function(r){if("string"!==typeof t||0===t.length)throw f.create(l.BAD_SCOPE);if(null===e||65!==e.length)throw f.create(l.BAD_VAPID_KEY);return n={swScope:t,vapidKey:e},[2,this.put(n)]})})},e.prototype.deleteVapidDetails=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getVapidFromSWScope(t)];case 1:if(!(e=n.sent()))throw f.create(l.DELETE_SCOPE_NOT_FOUND);return[4,this.delete(t)];case 2:return n.sent(),[2,e]}})})},e}(E),N="messagingSenderId",k=function(){function t(t){var e=this;if(!t.options[N]||"string"!==typeof t.options[N])throw f.create(l.BAD_SENDER_ID);this.messagingSenderId=t.options[N],this.tokenDetailsModel=new S,this.vapidDetailsModel=new I,this.iidModel=new g,this.app=t,this.INTERNAL={delete:function(){return e.delete()}}}return t.prototype.getToken=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){var t,e,n,r,i;return Object(s.__generator)(this,function(o){switch(o.label){case 0:if("denied"===(t=this.getNotificationPermission_()))throw f.create(l.NOTIFICATIONS_BLOCKED);return"granted"!==t?[2,null]:[4,this.getSWRegistration_()];case 1:return e=o.sent(),[4,this.getPublicVapidKey_()];case 2:return n=o.sent(),[4,this.getPushSubscription(e,n)];case 3:return r=o.sent(),[4,this.tokenDetailsModel.getTokenDetailsFromSWScope(e.scope)];case 4:return(i=o.sent())?[2,this.manageExistingToken(e,r,n,i)]:[2,this.getNewToken(e,r,n)]}})})},t.prototype.manageExistingToken=function(t,e,n,r){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(i){switch(i.label){case 0:return function(t,e,n){if(!n.vapidKey||!y(e.buffer,n.vapidKey.buffer))return!1;var r=t.endpoint===n.endpoint,i=y(t.getKey("auth"),n.auth),o=y(t.getKey("p256dh"),n.p256dh);return r&&i&&o}(e,n,r)?Date.now()<r.createTime+6048e5?[2,r.fcmToken]:[2,this.updateToken(t,e,n,r)]:[4,this.deleteTokenFromDB(r.fcmToken)];case 1:return i.sent(),[2,this.getNewToken(t,e,n)]}})})},t.prototype.updateToken=function(t,e,n,r){return Object(s.__awaiter)(this,void 0,void 0,function(){var i,o,a;return Object(s.__generator)(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,6]),[4,this.iidModel.updateToken(this.messagingSenderId,r.fcmToken,r.fcmPushSet,e,n)];case 1:return i=s.sent(),o={swScope:t.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:i,fcmPushSet:r.fcmPushSet,createTime:Date.now(),endpoint:e.endpoint,auth:e.getKey("auth"),p256dh:e.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(o)];case 2:return s.sent(),[4,this.vapidDetailsModel.saveVapidDetails(t.scope,n)];case 3:return s.sent(),[2,i];case 4:return a=s.sent(),[4,this.deleteToken(r.fcmToken)];case 5:throw s.sent(),a;case 6:return[2]}})})},t.prototype.getNewToken=function(t,e,n){return Object(s.__awaiter)(this,void 0,void 0,function(){var r,i;return Object(s.__generator)(this,function(o){switch(o.label){case 0:return[4,this.iidModel.getToken(this.messagingSenderId,e,n)];case 1:return r=o.sent(),i={swScope:t.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:r.token,fcmPushSet:r.pushSet,createTime:Date.now(),endpoint:e.endpoint,auth:e.getKey("auth"),p256dh:e.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(i)];case 2:return o.sent(),[4,this.vapidDetailsModel.saveVapidDetails(t.scope,n)];case 3:return o.sent(),[2,r.token]}})})},t.prototype.deleteToken=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n;return Object(s.__generator)(this,function(r){switch(r.label){case 0:return[4,this.deleteTokenFromDB(t)];case 1:return r.sent(),[4,this.getSWRegistration_()];case 2:return(e=r.sent())?[4,e.pushManager.getSubscription()]:[3,4];case 3:if(n=r.sent())return[2,n.unsubscribe()];r.label=4;case 4:return[2,!0]}})})},t.prototype.deleteTokenFromDB=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:return[4,this.tokenDetailsModel.deleteToken(t)];case 1:return e=n.sent(),[4,this.iidModel.deleteToken(e.fcmSenderId,e.fcmToken,e.fcmPushSet)];case 2:return n.sent(),[2]}})})},t.prototype.getPushSubscription=function(t,e){return t.pushManager.getSubscription().then(function(n){return n||t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e})})},t.prototype.requestPermission=function(){throw f.create(l.AVAILABLE_IN_WINDOW)},t.prototype.useServiceWorker=function(t){throw f.create(l.AVAILABLE_IN_WINDOW)},t.prototype.usePublicVapidKey=function(t){throw f.create(l.AVAILABLE_IN_WINDOW)},t.prototype.onMessage=function(t,e,n){throw f.create(l.AVAILABLE_IN_WINDOW)},t.prototype.onTokenRefresh=function(t,e,n){throw f.create(l.AVAILABLE_IN_WINDOW)},t.prototype.setBackgroundMessageHandler=function(t){throw f.create(l.AVAILABLE_IN_SW)},t.prototype.delete=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.tokenDetailsModel.closeDatabase(),this.vapidDetailsModel.closeDatabase()])];case 1:return t.sent(),[2]}})})},t.prototype.getNotificationPermission_=function(){return Notification.permission},t.prototype.getTokenDetailsModel=function(){return this.tokenDetailsModel},t.prototype.getVapidDetailsModel=function(){return this.vapidDetailsModel},t.prototype.getIidModel=function(){return this.iidModel},t}();var D=function(t){function e(e){var n=t.call(this,e)||this;return n.bgMessageHandler=null,self.addEventListener("push",function(t){n.onPush(t)}),self.addEventListener("pushsubscriptionchange",function(t){n.onSubChange(t)}),self.addEventListener("notificationclick",function(t){n.onNotificationClick(t)}),n}return Object(s.__extends)(e,t),e.prototype.onPush=function(t){t.waitUntil(this.onPush_(t))},e.prototype.onSubChange=function(t){t.waitUntil(this.onSubChange_(t))},e.prototype.onNotificationClick=function(t){t.waitUntil(this.onNotificationClick_(t))},e.prototype.onPush_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n,r,i,o,a;return Object(s.__generator)(this,function(s){switch(s.label){case 0:if(!t.data)return[2];try{e=t.data.json()}catch(u){return[2]}return[4,this.hasVisibleClients_()];case 1:return s.sent()?[2,this.sendMessageToWindowClients_(e)]:(n=this.getNotificationData_(e))?(r=n.title||"",[4,this.getSWRegistration_()]):[3,3];case 2:return i=s.sent(),o=n.actions,a=Notification.maxActions,o&&a&&o.length>a&&console.warn("This browser only supports "+a+" actions.The remaining actions will not be displayed."),[2,i.showNotification(r,n)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(e)]:[3,5];case 4:return s.sent(),[2];case 5:return[2]}})})},e.prototype.onSubChange_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var t,e,n,r;return Object(s.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return t=i.sent(),[3,3];case 2:throw e=i.sent(),f.create(l.UNABLE_TO_RESUBSCRIBE,{message:e});case 3:return i.trys.push([3,5,,8]),[4,t.pushManager.getSubscription()];case 4:return i.sent(),[3,8];case 5:return n=i.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(t.scope)];case 6:if(!(r=i.sent()))throw n;return[4,this.deleteToken(r.fcmToken)];case 7:throw i.sent(),n;case 8:return[2]}})})},e.prototype.onNotificationClick_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n,r,i;return Object(s.__generator)(this,function(a){switch(a.label){case 0:return t.notification&&t.notification.data&&t.notification.data.FCM_MSG?t.action?[2]:(t.stopImmediatePropagation(),t.notification.close(),(e=t.notification.data.FCM_MSG).notification&&(n=e.fcmOptions&&e.fcmOptions.link||e.notification.click_action)?[4,this.getWindowClient_(n)]:[2]):[2];case 1:return(r=a.sent())?[3,3]:[4,self.clients.openWindow(n)];case 2:return r=a.sent(),[3,5];case 3:return[4,r.focus()];case 4:r=a.sent(),a.label=5;case 5:return r?(delete e.notification,delete e.fcmOptions,i=O(o.NOTIFICATION_CLICKED,e),[2,this.attemptToMessageClient_(r,i)]):[2]}})})},e.prototype.getNotificationData_=function(t){if(t&&"object"===typeof t.notification){var e,n=Object(s.__assign)({},t.notification);return n.data=Object(s.__assign)({},t.notification.data,((e={}).FCM_MSG=t,e)),n}},e.prototype.setBackgroundMessageHandler=function(t){if(!t||"function"!==typeof t)throw f.create(l.BG_HANDLER_FUNCTION_EXPECTED);this.bgMessageHandler=t},e.prototype.getWindowClient_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n,r,i;return Object(s.__generator)(this,function(o){switch(o.label){case 0:return e=new URL(t,self.location.href).href,[4,A()];case 1:for(n=o.sent(),r=null,i=0;i<n.length;i++)if(new URL(n[i].url,self.location.href).href===e){r=n[i];break}return[2,r]}})})},e.prototype.attemptToMessageClient_=function(t,e){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(n){if(!t)throw f.create(l.NO_WINDOW_CLIENT_TO_MSG);return t.postMessage(e),[2]})})},e.prototype.hasVisibleClients_=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){switch(t.label){case 0:return[4,A()];case 1:return[2,t.sent().some(function(t){return"visible"===t.visibilityState})]}})})},e.prototype.sendMessageToWindowClients_=function(t){return Object(s.__awaiter)(this,void 0,void 0,function(){var e,n,r=this;return Object(s.__generator)(this,function(i){switch(i.label){case 0:return[4,A()];case 1:return e=i.sent(),n=O(o.PUSH_MSG_RECEIVED,t),[4,Promise.all(e.map(function(t){return r.attemptToMessageClient_(t,n)}))];case 2:return i.sent(),[2]}})})},e.prototype.getSWRegistration_=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){return[2,self.registration]})})},e.prototype.getPublicVapidKey_=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){var t,e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getSWRegistration_()];case 1:if(!(t=n.sent()))throw f.create(l.SW_REGISTRATION_EXPECTED);return[4,this.getVapidDetailsModel().getVapidFromSWScope(t.scope)];case 2:return null==(e=n.sent())?[2,p]:[2,e]}})})},e}(k);function A(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function O(t,e){return(n={})[i.TYPE_OF_MSG]=t,n[i.DATA]=e,n;var n}var R=function(t){function e(e){var n=t.call(this,e)||this;return n.registrationToUse=null,n.publicVapidKeyToUse=null,n.manifestCheckPromise=null,n.messageObserver=null,n.tokenRefreshObserver=null,n.onMessageInternal=Object(a.createSubscribe)(function(t){n.messageObserver=t}),n.onTokenRefreshInternal=Object(a.createSubscribe)(function(t){n.tokenRefreshObserver=t}),n.setupSWMessageListener_(),n}return Object(s.__extends)(e,t),e.prototype.getToken=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(e){switch(e.label){case 0:return this.manifestCheckPromise||(this.manifestCheckPromise=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){var t,e;return Object(s.__generator)(this,function(n){switch(n.label){case 0:if(!(t=document.querySelector('link[rel="manifest"]')))return[2];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,fetch(t.href)];case 2:return[4,n.sent().json()];case 3:return e=n.sent(),[3,5];case 4:return n.sent(),[2];case 5:if(!e||!e.gcm_sender_id)return[2];if("103953800507"!==e.gcm_sender_id)throw f.create(l.INCORRECT_GCM_SENDER_ID);return[2]}})})}()),[4,this.manifestCheckPromise];case 1:return e.sent(),[2,t.prototype.getToken.call(this)]}})})},e.prototype.requestPermission=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){var t;return Object(s.__generator)(this,function(e){switch(e.label){case 0:return"granted"===this.getNotificationPermission_()?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(t=e.sent()))return[2];throw"denied"===t?f.create(l.PERMISSION_BLOCKED):f.create(l.PERMISSION_DEFAULT)}})})},e.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw f.create(l.SW_REGISTRATION_EXPECTED);if(null!=this.registrationToUse)throw f.create(l.USE_SW_BEFORE_GET_TOKEN);this.registrationToUse=t},e.prototype.usePublicVapidKey=function(t){if("string"!==typeof t)throw f.create(l.INVALID_PUBLIC_VAPID_KEY);if(null!=this.publicVapidKeyToUse)throw f.create(l.USE_PUBLIC_KEY_BEFORE_GET_TOKEN);var e=v(t);if(65!==e.length)throw f.create(l.PUBLIC_KEY_DECRYPTION_FAILED);this.publicVapidKeyToUse=e},e.prototype.onMessage=function(t,e,n){return"function"===typeof t?this.onMessageInternal(t,e,n):this.onMessageInternal(t)},e.prototype.onTokenRefresh=function(t,e,n){return"function"===typeof t?this.onTokenRefreshInternal(t,e,n):this.onTokenRefreshInternal(t)},e.prototype.waitForRegistrationToActivate_=function(t){var e=t.installing||t.waiting||t.active;return new Promise(function(n,r){if(e)if("activated"!==e.state)if("redundant"!==e.state){e.addEventListener("statechange",function i(){if("activated"===e.state)n(t);else{if("redundant"!==e.state)return;r(f.create(l.SW_REG_REDUNDANT))}e.removeEventListener("statechange",i)})}else r(f.create(l.SW_REG_REDUNDANT));else n(t);else r(f.create(l.NO_SW_IN_REG))})},e.prototype.getSWRegistration_=function(){var t=this;return this.registrationToUse?this.waitForRegistrationToActivate_(this.registrationToUse):(this.registrationToUse=null,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}).catch(function(t){throw f.create(l.FAILED_DEFAULT_REGISTRATION,{browserErrorMessage:t.message})}).then(function(e){return t.waitForRegistrationToActivate_(e).then(function(){return t.registrationToUse=e,e.update(),e})}))},e.prototype.getPublicVapidKey_=function(){return Object(s.__awaiter)(this,void 0,void 0,function(){return Object(s.__generator)(this,function(t){return this.publicVapidKeyToUse?[2,this.publicVapidKeyToUse]:[2,p]})})},e.prototype.setupSWMessageListener_=function(){var t=this;navigator.serviceWorker.addEventListener("message",function(e){if(e.data&&e.data[i.TYPE_OF_MSG]){var n=e.data;switch(n[i.TYPE_OF_MSG]){case o.PUSH_MSG_RECEIVED:case o.NOTIFICATION_CLICKED:var r=n[i.DATA];t.messageObserver&&t.messageObserver.next(r)}}},!1)},e}(k);function P(t){var e={isSupported:x};t.INTERNAL.registerService("messaging",function(t){if(!x())throw f.create(l.UNSUPPORTED_BROWSER);return self&&"ServiceWorkerGlobalScope"in self?new D(t):new R(t)},e)}function x(){return self&&"ServiceWorkerGlobalScope"in self?"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}P(c.a)},function(t,e,n){"use strict";n.r(e),n.d(e,"registerStorage",function(){return zt});var r=n(2),i=n.n(r),o="https://firebasestorage.googleapis.com",a="https://firebasestorage.googleapis.com",s="/v0",u="/v0",c=12e4,l=6e4,h=-9007199254740991,f=function(){function t(t,e){this.code_=d(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}return t.prototype.codeProp=function(){return this.code},t.prototype.codeEquals=function(t){return d(t)===this.codeProp()},t.prototype.serverResponseProp=function(){return this.serverResponse_},t.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(t.prototype,"name",{get:function(){return this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"code",{get:function(){return this.code_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"message",{get:function(){return this.message_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!0,configurable:!0}),t}(),p={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"};function d(t){return"storage/"+t}function y(){return new f(p.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function m(){return new f(p.CANCELED,"User canceled the upload/download.")}function g(){return new f(p.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function v(t,e,n){return new f(p.INVALID_ARGUMENT,"Invalid argument in `"+e+"` at index "+t+": "+n)}function b(){return new f(p.APP_DELETED,"The Firebase app was deleted.")}function _(t,e){return new f(p.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function w(t){throw new f(p.INTERNAL_ERROR,"Internal error: "+t)}var E={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function T(t){switch(t){case E.RAW:case E.BASE64:case E.BASE64URL:case E.DATA_URL:return;default:throw"Expected one of the event types: ["+E.RAW+", "+E.BASE64+", "+E.BASE64URL+", "+E.DATA_URL+"]."}}var S=function(){return function(t,e){this.data=t,this.contentType=e||null}}();function C(t,e){switch(t){case E.RAW:return new S(I(e));case E.BASE64:case E.BASE64URL:return new S(N(t,e));case E.DATA_URL:return new S(function(t){var e=new k(t);return e.base64?N(E.BASE64,e.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(n){throw _(E.DATA_URL,"Malformed data URL.")}return I(e)}(e.rest)}(e),function(t){return new k(t).contentType}(e))}throw y()}function I(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|63&r);else if(55296==(64512&r))if(n<t.length-1&&56320==(64512&t.charCodeAt(n+1)))r=65536|(1023&r)<<10|1023&t.charCodeAt(++n),e.push(240|r>>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 N(t,e){switch(t){case E.BASE64:var n=-1!==e.indexOf("-"),r=-1!==e.indexOf("_");if(n||r)throw _(t,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case E.BASE64URL:var i=-1!==e.indexOf("+"),o=-1!==e.indexOf("/");if(i||o)throw _(t,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/")}var a;try{a=atob(e)}catch(c){throw _(t,"Invalid character found")}for(var s=new Uint8Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);return s}var k=function(){return function(t){this.base64=!1,this.contentType=null;var e=t.match(/^data:([^,]+)?,/);if(null===e)throw _(E.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n=e[1]||null;null!=n&&(this.base64=(r=n,i=";base64",r.length>=i.length&&r.substring(r.length-i.length)===i),this.contentType=this.base64?n.substring(0,n.length-";base64".length):n),this.rest=t.substring(t.indexOf(",")+1);var r,i}}();var D,A={STATE_CHANGED:"state_changed"},O={RUNNING:"running",PAUSING:"pausing",PAUSED:"paused",SUCCESS:"success",CANCELING:"canceling",CANCELED:"canceled",ERROR:"error"},R={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function P(t){switch(t){case O.RUNNING:case O.PAUSING:case O.CANCELING:return R.RUNNING;case O.PAUSED:return R.PAUSED;case O.SUCCESS:return R.SUCCESS;case O.CANCELED:return R.CANCELED;case O.ERROR:default:return R.ERROR}}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function L(t,e){for(var n in t)x(t,n)&&e(n,t[n])}function M(t){if(null==t)return{};var e={};return L(t,function(t,n){e[t]=n}),e}function F(t){return new Promise(t)}function U(t){return Promise.resolve(t)}function j(t){return null!=t}function V(t){return void 0!==t}function B(t){return"function"===typeof t}function q(t){return"object"===typeof t}function W(t){return q(t)&&null!==t}function K(t){return"string"===typeof t||t instanceof String}function Q(t){return H()&&t instanceof Blob}function H(){return"undefined"!==typeof Blob}!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(D||(D={}));var z=function(){function t(){var t=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=D.NO_ERROR,this.sendPromise_=F(function(e,n){t.xhr_.addEventListener("abort",function(n){t.errorCode_=D.ABORT,e(t)}),t.xhr_.addEventListener("error",function(n){t.errorCode_=D.NETWORK_ERROR,e(t)}),t.xhr_.addEventListener("load",function(n){e(t)})})}return t.prototype.send=function(t,e,n,r){var i=this;if(this.sent_)throw w("cannot .send() more than once");(this.sent_=!0,this.xhr_.open(e,t,!0),j(r))&&L(r,function(t,e){i.xhr_.setRequestHeader(t,e.toString())});return j(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},t.prototype.getErrorCode=function(){if(!this.sent_)throw w("cannot .getErrorCode() before sending");return this.errorCode_},t.prototype.getStatus=function(){if(!this.sent_)throw w("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},t.prototype.getResponseText=function(){if(!this.sent_)throw w("cannot .getResponseText() before sending");return this.xhr_.responseText},t.prototype.abort=function(){this.xhr_.abort()},t.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},t.prototype.addUploadProgressListener=function(t){j(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},t.prototype.removeUploadProgressListener=function(t){j(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},t}(),G=function(){function t(){}return t.prototype.createXhrIo=function(){return new z},t}();function Y(t){var e,n;try{e=JSON.parse(t)}catch(r){return null}return q(n=e)&&!Array.isArray(n)?e:null}var X=function(){function t(t,e){this.bucket=t,this.path_=e}return Object.defineProperty(t.prototype,"path",{get:function(){return this.path_},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,r;try{n=t.makeFromUrl(e)}catch(i){return new t(e,"")}if(""===n.path)return n;throw r=e,new f(p.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+r+"'.")},t.makeFromUrl=function(e){var n=null;for(var r=[{regex:new RegExp("^gs://([A-Za-z0-9.\\-_]+)(/(.*))?$","i"),indices:{bucket:1,path:3},postModify:function(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}},{regex:new RegExp("^https?://firebasestorage\\.googleapis\\.com/v[A-Za-z0-9_]+/b/([A-Za-z0-9.\\-_]+)/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:function(t){t.path_=decodeURIComponent(t.path)}}],i=0;i<r.length;i++){var o=r[i],a=o.regex.exec(e);if(a){var s=a[o.indices.bucket],u=a[o.indices.path];u||(u=""),n=new t(s,u),o.postModify(n);break}}if(null==n)throw function(t){return new f(p.INVALID_URL,"Invalid URL '"+t+"'.")}(e);return n},t}();function J(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function $(t){return o+s+t}function Z(t){return o+u+t}function tt(t){var e=encodeURIComponent,n="?";return L(t,function(t,r){var i=e(t)+"="+e(r);n=n+i+"&"}),n=n.slice(0,-1)}function et(t,e){return e}var nt=function(){return function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||et}}(),rt=null;function it(){if(rt)return rt;var t=[];t.push(new nt("bucket")),t.push(new nt("generation")),t.push(new nt("metageneration")),t.push(new nt("name","fullPath",!0));var e=new nt("name");e.xform=function(t,e){return function(t){return!K(t)||t.length<2?t:J(t=t)}(e)},t.push(e);var n=new nt("size");return n.xform=function(t,e){return j(e)?+e:e},t.push(n),t.push(new nt("timeCreated")),t.push(new nt("updated")),t.push(new nt("md5Hash",null,!0)),t.push(new nt("cacheControl",null,!0)),t.push(new nt("contentDisposition",null,!0)),t.push(new nt("contentEncoding",null,!0)),t.push(new nt("contentLanguage",null,!0)),t.push(new nt("contentType",null,!0)),t.push(new nt("metadata","customMetadata",!0)),rt=t}function ot(t,e,n){for(var r={type:"file"},i=n.length,o=0;o<i;o++){var a=n[o];r[a.local]=a.xform(r,e[a.server])}return function(t,e){Object.defineProperty(t,"ref",{get:function(){var n=t.bucket,r=t.fullPath,i=new X(n,r);return e.makeStorageReference(i)}})}(r,t),r}function at(t,e,n){var r=Y(e);return null===r?null:ot(t,r,n)}function st(t,e){var n=Y(e);if(null===n)return null;if(!K(n.downloadTokens))return null;var r=n.downloadTokens;if(0===r.length)return null;var i=encodeURIComponent;return r.split(",").map(function(e){var n=t.bucket,r=t.fullPath;return function(t){return a+s+t}("/b/"+i(n)+"/o/"+i(r))+tt({alt:"media",token:e})})[0]}function ut(t,e){for(var n={},r=e.length,i=0;i<r;i++){var o=e[i];o.writable&&(n[o.server]=t[o.local])}return JSON.stringify(n)}function ct(t){if(!(t&&q(t)))throw"Expected Metadata object.";for(var e in t){var n=t[e];if("customMetadata"===e){if(!q(n))throw"Expected object for 'customMetadata' mapping."}else if(W(n))throw"Mapping for '"+e+"' cannot be an object."}}function lt(t,e,n){for(var r=e.length,i=e.length,o=0;o<e.length;o++)if(e[o].optional){r=o;break}if(!(r<=n.length&&n.length<=i))throw function(t,e,n,r){var i,o;return t===e?(i=t,o=1===t?"argument":"arguments"):(i="between "+t+" and "+e,o="arguments"),new f(p.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+n+"`: Expected "+i+" "+o+", received "+r+".")}(r,i,t,n.length);for(o=0;o<n.length;o++)try{e[o].validator(n[o])}catch(a){throw a instanceof Error?v(o,t,a.message):v(o,t,a)}}var ht=function(){return function(t,e){var n=this;this.validator=function(e){n.optional&&!V(e)||t(e)},this.optional=!!e}}();function ft(t,e){function n(t){if(!K(t))throw"Expected string."}var r,i,o;return t?(i=n,o=t,r=function(t){i(t),o(t)}):r=n,new ht(r,e)}function pt(){return new ht(function(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||H()&&t instanceof Blob))throw"Expected Blob or File."})}function dt(t){return new ht(ct,t)}function yt(){return new ht(function(t){if(!(function(t){return"number"===typeof t||t instanceof Number}(t)&&t>=0))throw"Expected a number 0 or greater."})}function mt(t,e){return new ht(function(e){if(!(null===e||j(e)&&e instanceof Object))throw"Expected an Object.";void 0!==t&&null!==t&&t(e)},e)}function gt(t){return new ht(function(t){if(null!==t&&!B(t))throw"Expected a Function."},t)}function vt(){return"undefined"!==typeof BlobBuilder?BlobBuilder:"undefined"!==typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}var bt=function(){function t(t,e){var n=0,r="";Q(t)?(this.data_=t,n=t.size,r=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=r}return t.prototype.size=function(){return this.size_},t.prototype.type=function(){return this.type_},t.prototype.slice=function(e,n){if(Q(this.data_)){var r=this.data_,i=(a=e,s=n,(o=r).webkitSlice?o.webkitSlice(a,s):o.mozSlice?o.mozSlice(a,s):o.slice?o.slice(a,s):null);return null===i?null:new t(i)}var o,a,s;return new t(new Uint8Array(this.data_.buffer,e,n-e),!0)},t.getBlob=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(H()){var r=e.map(function(e){return e instanceof t?e.data_:e});return new t(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=vt();if(void 0!==n){for(var r=new n,i=0;i<t.length;i++)r.append(t[i]);return r.getBlob()}if(H())return new Blob(t);throw Error("This browser doesn't seem to support creating Blobs")}.apply(null,r))}var i=e.map(function(t){return K(t)?C(E.RAW,t).data:t.data_}),o=0;i.forEach(function(t){o+=t.byteLength});var a=new Uint8Array(o),s=0;return i.forEach(function(t){for(var e=0;e<t.length;e++)a[s++]=t[e]}),new t(a,!0)},t.prototype.uploadData=function(){return this.data_},t}();function _t(t,e){return-1!==t.indexOf(e)}var wt=function(){return function(t,e,n,r){this.url=t,this.method=e,this.handler=n,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}();function Et(t){if(!t)throw y()}function Tt(t,e){return function(n,r){var i=at(t,r,e);return Et(null!==i),i}}function St(t){return function(e,n){var r,i,o;return 401===e.getStatus()?r=new f(p.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===e.getStatus()?(o=t.bucket,r=new f(p.QUOTA_EXCEEDED,"Quota for bucket '"+o+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===e.getStatus()?(i=t.path,r=new f(p.UNAUTHORIZED,"User does not have permission to access '"+i+"'.")):r=n,r.setServerResponseProp(n.serverResponseProp()),r}}function Ct(t){var e=St(t);return function(n,r){var i,o=e(n,r);return 404===n.getStatus()&&(i=t.path,o=new f(p.OBJECT_NOT_FOUND,"Object '"+i+"' does not exist.")),o.setServerResponseProp(r.serverResponseProp()),o}}function It(t,e,n){var r=$(e.fullServerUrl()),i=t.maxOperationRetryTime(),o=new wt(r,"GET",Tt(t,n),i);return o.errorHandler=Ct(e),o}function Nt(t,e,n){var r=$(e.fullServerUrl()),i=t.maxOperationRetryTime(),o=new wt(r,"GET",function(t,e){return function(n,r){var i=at(t,r,e);return Et(null!==i),st(i,r)}}(t,n),i);return o.errorHandler=Ct(e),o}function kt(t,e,n){var r=M(n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=function(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}(null,e)),r}var Dt=function(){return function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null}}();function At(t,e){var n;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(r){Et(!1)}return Et(_t(e||["active"],n)),n}function Ot(t,e,n,r,i,o,a,s){var u=new Dt(0,0);if(a?(u.current=a.current,u.total=a.total):(u.current=0,u.total=r.size()),r.size()!==u.total)throw new f(p.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.");var c=u.total-u.current,l=c;i>0&&(l=Math.min(l,i));var h=u.current,d=h+l,y={"X-Goog-Upload-Command":l===c?"upload, finalize":"upload","X-Goog-Upload-Offset":u.current},m=r.slice(h,d);if(null===m)throw g();var v=e.maxUploadRetryTime(),b=new wt(n,"POST",function(t,n){var i,a=At(t,["active","final"]),s=u.current+l,c=r.size();return i="final"===a?Tt(e,o)(t,n):null,new Dt(s,c,"final"===a,i)},v);return b.headers=y,b.body=m.uploadData(),b.progressCallback=s||null,b.errorHandler=St(t),b}var Rt=function(){return function(t,e,n){if(B(t)||j(e)||j(n))this.next=t,this.error=e||null,this.complete=n||null;else{var r=t;this.next=r.next||null,this.error=r.error||null,this.complete=r.complete||null}}}(),Pt=function(){return function(t,e,n,r,i,o){this.bytesTransferred=t,this.totalBytes=e,this.state=n,this.metadata=r,this.task=i,this.ref=o}}();function xt(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];U(!0).then(function(){t.apply(null,e)})}}var Lt=function(){function t(t,e,n,r,i,o){void 0===o&&(o=null);var a=this;this.transferred_=0,this.needToFetchStatus_=!1,this.needToFetchMetadata_=!1,this.observers_=[],this.error_=null,this.uploadUrl_=null,this.request_=null,this.chunkMultiplier_=1,this.resolve_=null,this.reject_=null,this.ref_=t,this.authWrapper_=e,this.location_=n,this.blob_=i,this.metadata_=o,this.mappings_=r,this.resumable_=this.shouldDoResumable_(this.blob_),this.state_=O.RUNNING,this.errorHandler_=function(t){a.request_=null,a.chunkMultiplier_=1,t.codeEquals(p.CANCELED)?(a.needToFetchStatus_=!0,a.completeTransitions_()):(a.error_=t,a.transition_(O.ERROR))},this.metadataErrorHandler_=function(t){a.request_=null,t.codeEquals(p.CANCELED)?a.completeTransitions_():(a.error_=t,a.transition_(O.ERROR))},this.promise_=F(function(t,e){a.resolve_=t,a.reject_=e,a.start_()}),this.promise_.then(null,function(){})}return t.prototype.makeProgressCallback_=function(){var t=this,e=this.transferred_;return function(n,r){t.updateProgress_(e+n)}},t.prototype.shouldDoResumable_=function(t){return t.size()>262144},t.prototype.start_=function(){this.state_===O.RUNNING&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},t.prototype.resolveToken_=function(t){var e=this;this.authWrapper_.getAuthToken().then(function(n){switch(e.state_){case O.RUNNING:t(n);break;case O.CANCELING:e.transition_(O.CANCELED);break;case O.PAUSING:e.transition_(O.PAUSED)}})},t.prototype.createResumable_=function(){var t=this;this.resolveToken_(function(e){var n=function(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a=kt(e,r,i),s={name:a.fullPath},u=Z(o),c={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":r.size(),"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},l=ut(a,n),h=t.maxUploadRetryTime(),f=new wt(u,"POST",function(t,e){var n;At(t);try{n=t.getResponseHeader("X-Goog-Upload-URL")}catch(r){Et(!1)}return Et(K(n)),n},h);return f.urlParams=s,f.headers=c,f.body=l,f.errorHandler=St(e),f}(t.authWrapper_,t.location_,t.mappings_,t.blob_,t.metadata_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.uploadUrl_=e,t.needToFetchStatus_=!1,t.completeTransitions_()},t.errorHandler_)})},t.prototype.fetchStatus_=function(){var t=this,e=this.uploadUrl_;this.resolveToken_(function(n){var r=function(t,e,n,r){var i=t.maxUploadRetryTime(),o=new wt(n,"POST",function(t,e){var n,i=At(t,["active","final"]);try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(a){Et(!1)}var o=parseInt(n,10);return Et(!isNaN(o)),new Dt(o,r.size(),"final"===i)},i);return o.headers={"X-Goog-Upload-Command":"query"},o.errorHandler=St(e),o}(t.authWrapper_,t.location_,e,t.blob_),i=t.authWrapper_.makeRequest(r,n);t.request_=i,i.getPromise().then(function(e){e=e,t.request_=null,t.updateProgress_(e.current),t.needToFetchStatus_=!1,e.finalized&&(t.needToFetchMetadata_=!0),t.completeTransitions_()},t.errorHandler_)})},t.prototype.continueUpload_=function(){var t=this,e=262144*this.chunkMultiplier_,n=new Dt(this.transferred_,this.blob_.size()),r=this.uploadUrl_;this.resolveToken_(function(i){var o;try{o=Ot(t.location_,t.authWrapper_,r,t.blob_,e,t.mappings_,n,t.makeProgressCallback_())}catch(s){return t.error_=s,void t.transition_(O.ERROR)}var a=t.authWrapper_.makeRequest(o,i);t.request_=a,a.getPromise().then(function(e){t.increaseMultiplier_(),t.request_=null,t.updateProgress_(e.current),e.finalized?(t.metadata_=e.metadata,t.transition_(O.SUCCESS)):t.completeTransitions_()},t.errorHandler_)})},t.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},t.prototype.fetchMetadata_=function(){var t=this;this.resolveToken_(function(e){var n=It(t.authWrapper_,t.location_,t.mappings_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.metadata_=e,t.transition_(O.SUCCESS)},t.metadataErrorHandler_)})},t.prototype.oneShotUpload_=function(){var t=this;this.resolveToken_(function(e){var n=function(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},s=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();a["Content-Type"]="multipart/related; boundary="+s;var u=kt(e,r,i),c="--"+s+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+ut(u,n)+"\r\n--"+s+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",l="\r\n--"+s+"--",h=bt.getBlob(c,r,l);if(null===h)throw g();var f={name:u.fullPath},p=Z(o),d=t.maxUploadRetryTime(),y=new wt(p,"POST",Tt(t,n),d);return y.urlParams=f,y.headers=a,y.body=h.uploadData(),y.errorHandler=St(e),y}(t.authWrapper_,t.location_,t.mappings_,t.blob_,t.metadata_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.metadata_=e,t.updateProgress_(t.blob_.size()),t.transition_(O.SUCCESS)},t.errorHandler_)})},t.prototype.updateProgress_=function(t){var e=this.transferred_;this.transferred_=t,this.transferred_!==e&&this.notifyObservers_()},t.prototype.transition_=function(t){if(this.state_!==t)switch(t){case O.CANCELING:case O.PAUSING:this.state_=t,null!==this.request_&&this.request_.cancel();break;case O.RUNNING:var e=this.state_===O.PAUSED;this.state_=t,e&&(this.notifyObservers_(),this.start_());break;case O.PAUSED:this.state_=t,this.notifyObservers_();break;case O.CANCELED:this.error_=m(),this.state_=t,this.notifyObservers_();break;case O.ERROR:case O.SUCCESS:this.state_=t,this.notifyObservers_()}},t.prototype.completeTransitions_=function(){switch(this.state_){case O.PAUSING:this.transition_(O.PAUSED);break;case O.CANCELING:this.transition_(O.CANCELED);break;case O.RUNNING:this.start_()}},Object.defineProperty(t.prototype,"snapshot",{get:function(){var t=P(this.state_);return new Pt(this.transferred_,this.blob_.size(),t,this.metadata_,this,this.ref_)},enumerable:!0,configurable:!0}),t.prototype.on=function(t,e,n,r){void 0===e&&(e=void 0),void 0===n&&(n=void 0),void 0===r&&(r=void 0);var i="Expected a function or an Object with one of `next`, `error`, `complete` properties.",o=gt(!0).validator,a=mt(null,!0).validator;function s(t){try{return void o(t)}catch(e){}try{if(a(t),!(V(t.next)||V(t.error)||V(t.complete)))throw"";return}catch(e){throw i}}lt("on",[ft(function(e){if(t!==A.STATE_CHANGED)throw"Expected one of the event types: ["+A.STATE_CHANGED+"]."}),mt(s,!0),gt(!0),gt(!0)],arguments);var u=this;function c(t){return function(e,n,i){null!==t&&lt("on",t,arguments);var o=new Rt(e,n,r);return u.addObserver_(o),function(){u.removeObserver_(o)}}}var l=[mt(function(t){if(null===t)throw i;s(t)}),gt(!0),gt(!0)];return!(V(e)||V(n)||V(r))?c(l):c(null)(e,n,r)},t.prototype.then=function(t,e){return this.promise_.then(t,e)},t.prototype.catch=function(t){return this.then(null,t)},t.prototype.addObserver_=function(t){this.observers_.push(t),this.notifyObserver_(t)},t.prototype.removeObserver_=function(t){!function(t,e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}(this.observers_,t)},t.prototype.notifyObservers_=function(){var t,e=this;this.finishPromise_(),(t=this.observers_,Array.prototype.slice.call(t)).forEach(function(t){e.notifyObserver_(t)})},t.prototype.finishPromise_=function(){if(null!==this.resolve_){var t=!0;switch(P(this.state_)){case R.SUCCESS:xt(this.resolve_.bind(null,this.snapshot))();break;case R.CANCELED:case R.ERROR:xt(this.reject_.bind(null,this.error_))();break;default:t=!1}t&&(this.resolve_=null,this.reject_=null)}},t.prototype.notifyObserver_=function(t){switch(P(this.state_)){case R.RUNNING:case R.PAUSED:null!==t.next&&xt(t.next.bind(t,this.snapshot))();break;case R.SUCCESS:null!==t.complete&&xt(t.complete.bind(t))();break;case R.CANCELED:case R.ERROR:null!==t.error&&xt(t.error.bind(t,this.error_))();break;default:null!==t.error&&xt(t.error.bind(t,this.error_))()}},t.prototype.resume=function(){lt("resume",[],arguments);var t=this.state_===O.PAUSED||this.state_===O.PAUSING;return t&&this.transition_(O.RUNNING),t},t.prototype.pause=function(){lt("pause",[],arguments);var t=this.state_===O.RUNNING;return t&&this.transition_(O.PAUSING),t},t.prototype.cancel=function(){lt("cancel",[],arguments);var t=this.state_===O.RUNNING||this.state_===O.PAUSING;return t&&this.transition_(O.CANCELING),t},t}(),Mt=function(){function t(t,e){this.authWrapper=t,this.location=e instanceof X?e:X.makeFromUrl(e)}return t.prototype.toString=function(){return lt("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 it()},t.prototype.child=function(t){lt("child",[ft()],arguments);var e=function(t,e){var n=e.split("/").filter(function(t){return t.length>0}).join("/");return 0===t.length?n:t+"/"+n}(this.location.path,t),n=new X(this.location.bucket,e);return this.newRef(this.authWrapper,n)},Object.defineProperty(t.prototype,"parent",{get:function(){var t=function(t){if(0==t.length)return null;var e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}(this.location.path);if(null===t)return null;var e=new X(this.location.bucket,t);return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){var t=new X(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),lt("put",[pt(),dt(!0)],arguments),this.throwIfRoot_("put"),new Lt(this,this.authWrapper,this.location,this.mappings(),new bt(t),e)},t.prototype.putString=function(t,e,n){void 0===e&&(e=E.RAW),lt("putString",[ft(),ft(T,!0),dt(!0)],arguments),this.throwIfRoot_("putString");var r=C(e,t),i=M(n);return!j(i.contentType)&&j(r.contentType)&&(i.contentType=r.contentType),new Lt(this,this.authWrapper,this.location,this.mappings(),new bt(r.data,!0),i)},t.prototype.delete=function(){lt("delete",[],arguments),this.throwIfRoot_("delete");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=function(t,e){var n=$(e.fullServerUrl()),r=t.maxOperationRetryTime(),i=new wt(n,"DELETE",function(t,e){},r);return i.successCodes=[200,204],i.errorHandler=Ct(e),i}(t.authWrapper,t.location);return t.authWrapper.makeRequest(n,e).getPromise()})},t.prototype.getMetadata=function(){lt("getMetadata",[],arguments),this.throwIfRoot_("getMetadata");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=It(t.authWrapper,t.location,t.mappings());return t.authWrapper.makeRequest(n,e).getPromise()})},t.prototype.updateMetadata=function(t){lt("updateMetadata",[dt()],arguments),this.throwIfRoot_("updateMetadata");var e=this;return this.authWrapper.getAuthToken().then(function(n){var r=function(t,e,n,r){var i=$(e.fullServerUrl()),o=ut(n,r),a=t.maxOperationRetryTime(),s=new wt(i,"PATCH",Tt(t,r),a);return s.headers={"Content-Type":"application/json; charset=utf-8"},s.body=o,s.errorHandler=Ct(e),s}(e.authWrapper,e.location,t,e.mappings());return e.authWrapper.makeRequest(r,n).getPromise()})},t.prototype.getDownloadURL=function(){lt("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL");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().then(function(t){if(null===t)throw new f(p.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return t})})},t.prototype.throwIfRoot_=function(t){if(""===this.location.path)throw function(t){return new f(p.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(t)},t}(),Ft=function(){function t(t){this.promise_=function(t){return Promise.reject(t)}(t)}return t.prototype.getPromise=function(){return this.promise_},t.prototype.cancel=function(t){void 0===t&&(t=!1)},t}(),Ut=function(){function t(){this.map_={},this.id_=h}return t.prototype.addRequest=function(t){var e=this.id_;this.id_++,this.map_[e]=t;var n=this;function r(){delete n.map_[e]}t.getPromise().then(r,r)},t.prototype.clear=function(){L(this.map_,function(t,e){e&&e.cancel(!0)}),this.map_={}},t}(),jt=function(){function t(e,n,r,i,o){if(this.bucket_=null,this.deleted_=!1,this.app_=e,null!==this.app_){var a=this.app_.options;j(a)&&(this.bucket_=t.extractBucket_(a))}this.storageRefMaker_=n,this.requestMaker_=r,this.pool_=o,this.service_=i,this.maxOperationRetryTime_=c,this.maxUploadRetryTime_=l,this.requestMap_=new Ut}return t.extractBucket_=function(t){var e=t.storageBucket||null;return null==e?null:X.makeFromBucketSpec(e).bucket},t.prototype.getAuthToken=function(){return null!==this.app_&&j(this.app_.INTERNAL)&&j(this.app_.INTERNAL.getToken)?this.app_.INTERNAL.getToken().then(function(t){return null!==t?t.accessToken:null},function(t){return null}):U(null)},t.prototype.bucket=function(){if(this.deleted_)throw b();return this.bucket_},t.prototype.service=function(){return this.service_},t.prototype.makeStorageReference=function(t){return this.storageRefMaker_(this,t)},t.prototype.makeRequest=function(t,e){if(this.deleted_)return new Ft(b());var n=this.requestMaker_(t,e,this.pool_);return this.requestMap_.addRequest(n),n},t.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requestMap_.clear()},t.prototype.maxUploadRetryTime=function(){return this.maxUploadRetryTime_},t.prototype.setMaxUploadRetryTime=function(t){this.maxUploadRetryTime_=t},t.prototype.maxOperationRetryTime=function(){return this.maxOperationRetryTime_},t.prototype.setMaxOperationRetryTime=function(t){this.maxOperationRetryTime_=t},t}();var Vt=function(){function t(t,e,n,r,i,o,a,s,u,c,l){this.pendingXhr_=null,this.backoffId_=null,this.resolve_=null,this.reject_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=t,this.method_=e,this.headers_=n,this.body_=r,this.successCodes_=i.slice(),this.additionalRetryCodes_=o.slice(),this.callback_=a,this.errorCallback_=s,this.progressCallback_=c,this.timeout_=u,this.pool_=l;var h=this;this.promise_=F(function(t,e){h.resolve_=t,h.reject_=e,h.start_()})}return t.prototype.start_=function(){var t=this;function e(e,n){var r,i=t.resolve_,o=t.reject_,a=n.xhr;if(n.wasSuccessCode)try{var s=t.callback_(a,a.getResponseText());V(s)?i(s):i()}catch(u){o(u)}else null!==a?((r=y()).setServerResponseProp(a.getResponseText()),t.errorCallback_?o(t.errorCallback_(a,r)):o(r)):n.canceled?o(r=t.appDelete_?b():m()):o(r=new f(p.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again."))}this.canceled_?e(0,new Bt(!1,null,!0)):this.backoffId_=function(t,e,n){var r=1,i=null,o=!1,a=0;function s(){return 2===a}var u=!1;function c(){u||(u=!0,e.apply(null,arguments))}function l(e){i=setTimeout(function(){i=null,t(h,s())},e)}function h(t){for(var e,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];u||(t?c.apply(null,arguments):s()||o?c.apply(null,arguments):(r<64&&(r*=2),1===a?(a=2,e=0):e=1e3*(r+Math.random()),l(e)))}var f=!1;function p(t){f||(f=!0,u||(null!==i?(t||(a=2),clearTimeout(i),l(0)):t||(a=1)))}return l(0),setTimeout(function(){o=!0,p(!0)},n),p}(function(e,n){if(n)e(!1,new Bt(!1,null,!0));else{var r=t.pool_.createXhrIo();t.pendingXhr_=r,null!==t.progressCallback_&&r.addUploadProgressListener(i),r.send(t.url_,t.method_,t.body_,t.headers_).then(function(n){null!==t.progressCallback_&&n.removeUploadProgressListener(i),t.pendingXhr_=null;var r=(n=n).getErrorCode()===D.NO_ERROR,o=n.getStatus();if(r&&!t.isRetryStatusCode_(o)){var a=_t(t.successCodes_,o);e(!0,new Bt(a,n))}else{var s=n.getErrorCode()===D.ABORT;e(!1,new Bt(!1,null,s))}})}function i(e){var n=e.loaded,r=e.lengthComputable?e.total:-1;null!==t.progressCallback_&&t.progressCallback_(n,r)}},e,this.timeout_)},t.prototype.getPromise=function(){return this.promise_},t.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingXhr_&&this.pendingXhr_.abort()},t.prototype.isRetryStatusCode_=function(t){var e=t>=500&&t<600,n=_t([408,429],t),r=_t(this.additionalRetryCodes_,t);return e||n||r},t}(),Bt=function(){return function(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n}}();function qt(t,e,n){var r=tt(t.urlParams),o=t.url+r,a=M(t.headers);return function(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}(a,e),function(t){var e="undefined"!==typeof i.a?i.a.SDK_VERSION:"AppManager";t["X-Firebase-Storage-Version"]="webjs/"+e}(a),new Vt(o,t.method,a,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,n)}var Wt=function(){function t(t,e,n){if(this.bucket_=null,this.authWrapper_=new jt(t,function(t,e){return new Mt(t,e)},qt,this,e),this.app_=t,null!=n)this.bucket_=X.makeFromBucketSpec(n);else{var r=this.authWrapper_.bucket();null!=r&&(this.bucket_=new X(r,""))}this.internals_=new Kt(this)}return t.prototype.ref=function(t){if(lt("ref",[ft(function(t){if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."},!0)],arguments),null==this.bucket_)throw new Error("No Storage Bucket defined in Firebase Options.");var e=new Mt(this.authWrapper_,this.bucket_);return null!=t?e.child(t):e},t.prototype.refFromURL=function(t){return lt("refFromURL",[ft(function(t){if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{X.makeFromUrl(t)}catch(e){throw"Expected valid full URL but got an invalid one."}},!1)],arguments),new Mt(this.authWrapper_,t)},Object.defineProperty(t.prototype,"maxUploadRetryTime",{get:function(){return this.authWrapper_.maxUploadRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxUploadRetryTime=function(t){lt("setMaxUploadRetryTime",[yt()],arguments),this.authWrapper_.setMaxUploadRetryTime(t)},Object.defineProperty(t.prototype,"maxOperationRetryTime",{get:function(){return this.authWrapper_.maxOperationRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxOperationRetryTime=function(t){lt("setMaxOperationRetryTime",[yt()],arguments),this.authWrapper_.setMaxOperationRetryTime(t)},Object.defineProperty(t.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!0,configurable:!0}),t}(),Kt=function(){function t(t){this.service_=t}return t.prototype.delete=function(){return this.service_.authWrapper_.deleteApp(),U(void 0)},t}(),Qt="storage";function Ht(t,e,n){return new Wt(t,new G,n)}function zt(t){var e={TaskState:R,TaskEvent:A,StringFormat:E,Storage:Wt,Reference:Mt};t.INTERNAL.registerService(Qt,Ht,e,void 0,!0)}zt(i.a)},function(t,e,n){var r;r=function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";n(2);var r=n(5),i=T(n(6)),o=T(n(7)),a=T(n(8)),s=T(n(9)),u=T(n(10)),c=T(n(11)),l=T(n(12)),h=T(n(13)),f=T(n(3)),p=T(n(14)),d=T(n(15)),y=T(n(4)),m=T(n(16)),g=T(n(17)),v=T(n(18)),b=T(n(19)),_=T(n(20)),w=T(n(21)),E=T(n(22));function T(t){return t&&t.__esModule?t:{default:t}}t.exports=function(){return{createClass:function(t){return(0,r._validateDatabase)(t),function(t){return function(){var e=new Map,n=new Map,r=new WeakMap;if("function"===typeof t.ref)var T={initializedApp:t.app,timestamp:i.default.database.ServerValue.TIMESTAMP,listenTo:function(i,o){return c.default.call(this,i,o,"listenTo",{db:t,refs:e,listeners:n,syncs:r})},bindToState:function(r,i){return c.default.call(this,r,i,"bindToState",{db:t,refs:e,listeners:n})},syncState:function(i,o){return u.default.call(this,i,o,{db:t,refs:e,listeners:n,syncs:r})},fetch:function(e,n){return(0,a.default)(e,n,t)},post:function(e,n){return(0,s.default)(e,n,t)},update:function(e,n){return(0,l.default)(e,n,{db:t})},push:function(e,n){return(0,o.default)(e,n,t)},removeBinding:function(t){(0,f.default)(t,{refs:e,listeners:n,syncs:r})},remove:function(e,n){return(0,p.default)(e,t,n)},reset:function(){return(0,h.default)({refs:e,listeners:n,syncs:r})}};else T={initializedApp:t.app,timestamp:i.default.firestore.FieldValue.serverTimestamp(),bindDoc:function(r,i){return m.default.call(this,r,i,"bindDoc",{db:t,refs:e,listeners:n})},bindCollection:function(r,i){return m.default.call(this,r,i,"bindCollection",{db:t,refs:e,listeners:n})},syncDoc:function(i,o){return d.default.call(this,i,o,{db:t,refs:e,listeners:n,syncs:r})},listenToDoc:function(r,i){return m.default.call(this,r,i,"listenToDoc",{db:t,refs:e,listeners:n})},listenToCollection:function(r,i){return m.default.call(this,r,i,"listenToCollection",{db:t,refs:e,listeners:n})},addToCollection:function(e,n,r){return b.default.call(this,e,n,t,r)},updateDoc:function(e,n,r){return w.default.call(this,e,n,t)},get:function(e,n){return g.default.call(this,e,n,t)},removeDoc:function(e){return(0,v.default)(e,t)},removeFromCollection:function(e,n){return(0,_.default)(e,t,n)},removeBinding:function(t){(0,y.default)(t,{refs:e,listeners:n,syncs:r})},reset:function(){return(0,E.default)({refs:e,listeners:n,syncs:r})}};return T}()}(t)}}}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e._fsCreateRef=e._fsSetUnmountHandler=e._setData=e._handleError=e._createNestedObject=e._setUnmountHandler=e._addFirestoreListener=e._addListener=e._fsUpdateSyncState=e._updateSyncState=e._firebaseRefsMixin=e._addSync=e._hasOwnNestedProperty=e._getSegmentCount=e._getNestedObject=e._isNestedPath=e._isObject=e._isValid=e._toArray=e._fsPrepareData=e._prepareData=e._throwError=e._setState=e._returnRef=e._addFirestoreQuery=e._addQueries=e._createHash=void 0;var r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=a(n(3)),o=a(n(4));function a(t){return t&&t.__esModule?t:{default:t}}function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var u=function(t){return"[object Object]"===Object.prototype.toString.call(t)},c=function(t){var e=[];return t.forEach(function(t){var n=t.val();u(n)&&(n.key=t.key),e.push(n)}),e},l=function(t){return"string"===typeof t||"number"===typeof t||"boolean"===typeof t||"object"===("undefined"===typeof t?"undefined":r(t))},h=function(t){return t.split(".").length>1},f=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.split("."),i=void 0!==e&&r.pop(),o=n,a=!0,s=!1,u=void 0;try{for(var c,l=r[Symbol.iterator]();!(a=(c=l.next()).done);a=!0){var h=c.value;n=n[h]=n[h]||{}}}catch(f){s=!0,u=f}finally{try{!a&&l.return&&l.return()}finally{if(s)throw u}}return i&&(n[i]=e),o},p=function(t,e){if(!1!==h(e)){var n=e.split("."),i=!0,o=!1,a=void 0;try{for(var s,u=n[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var c=s.value;if(!t||"object"!==("undefined"===typeof t?"undefined":r(t)))return;t=t[c]}}catch(l){o=!0,a=l}finally{try{!i&&u.return&&u.return()}finally{if(o)throw a}}return t}},d=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.defaultValue,r=e.asArray,i=t.val();return null===i&&l(n)?n:!0===r?c(t):null===i?{}:i},y=function(t){this.setState(t)},m=function(t,e){var n={limitToFirst:!0,limitToLast:!0,orderByChild:!0,startAt:!0,endAt:!0,equalTo:!0};for(var r in e)e.hasOwnProperty(r)&&(t=n[r]?t[r](e[r]):t[r]());return t},g=function(t,e){return e?e(t):t},v=function(t,e){e&&"function"===typeof t&&t(e)},b=function(t,e,n,r){Array.isArray(e)&&r&&(e.reduce(function(t,e){return t||u(e)&&e.hasOwnProperty("key")},!1)&&(e=e.reduce(function(t,e){return t[e.key]=e,t},{})));t.set(e,n)},_=function(t){return t.match(/^\//)?t.split("/").slice(1).length:t.split("/").length},w=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r={};if(!n){var i={};return t.exists?(e.withRefs&&(r.ref=t.ref),e.withIds&&(r.id=t.id),i=t.data()):i={},e.state?s({},e.state,Object.assign({},i,r)):Object.assign({},i,r)}var o=[];return t.empty||t.forEach(function(t){e.withRefs&&(r.ref=t.ref),e.withIds&&(r.id=t.id),o.push(Object.assign({},t.data(),r))}),e.state?s({},e.state,o):o};e._createHash=function(t,e){for(var n=0,r=t+e+Math.random(),i=0;i<r.length;i++)n=(n<<5)-n+r.charCodeAt(i),n&=n;return n},e._addQueries=m,e._addFirestoreQuery=g,e._returnRef=function(t,e,n,r){return{endpoint:t,method:e,id:n,context:r}},e._setState=y,e._throwError=function(t,e){var n=new Error("REBASE: "+t);throw n.code=e,n},e._prepareData=d,e._fsPrepareData=w,e._toArray=c,e._isValid=l,e._isObject=u,e._isNestedPath=h,e._getNestedObject=p,e._getSegmentCount=_,e._hasOwnNestedProperty=function(t,e){return void 0!==p(t,e)},e._addSync=function(t,e,n){var r=n.get(t)||[];r.push(e),n.set(t,r)},e._firebaseRefsMixin=function(t,e,n){n.set(t,e)},e._updateSyncState=function t(e,n,r,i){if(u(i))for(var o in i)".sv"!==o?t(e.child(o),n,r,i[o]):b(e,i,v.bind(null,n),r);else b(e,i,v.bind(null,n),r)},e._fsUpdateSyncState=function(t,e){t.set(e)},e._addListener=function(t,e,n,r,i){r=m(r,n.queries);var o="function"===typeof n.onFailure?n.onFailure.bind(n.context):null;i.set(t,r.on("value",function(t){var r=d(t,n);if("listenTo"===e)n.then.call(n.context,r);else{var i=s({},n.state,r);if(h(n.state)){var o=n.state.split(".")[0],a=s({},o,n.context.state[o]);i=f(n.state,r,a)}"syncState"===e?(n.reactSetState.call(n.context,i),n.then&&!1===n.then.called&&(n.then.call(n.context),n.then.called=!0)):"bindToState"===e&&(y.call(n.context,i),n.then&&!1===n.then.called&&(n.then.call(n.context),n.then.called=!0))}},o))},e._addFirestoreListener=function(t,e,n,r,i){r=g(r,n.query);var o="function"===typeof n.onFailure?n.onFailure.bind(n.context):void 0;i.set(t,r.onSnapshot(function(t){if(e.match(/^listenTo/)){if("listenToDoc"===e){var r=w(t,n);return n.then.call(n.context,r)}if("listenToCollection"===e){var i=w(t,n,!0);return n.then.call(n.context,i)}}else{if("syncDoc"===e){var o=w(t,n);n.reactSetState.call(n.context,function(t){return Object.assign(t,o)})}else if("bindDoc"===e){var a=w(t,n);y.call(n.context,function(t){return Object.assign(t,a)})}else if("bindCollection"===e){var s=w(t,n,!0);y.call(n.context,function(t){return Object.assign(t,s)})}n.then&&!1===n.then.called&&(n.then.call(n.context),n.then.called=!0)}},o))},e._setUnmountHandler=function(t,e,n,r,o){if("function"===typeof t.componentWillUnmount)var a=t.componentWillUnmount;t.componentWillUnmount=function(){(0,i.default)({context:t,id:e},{refs:n,listeners:r,syncs:o}),a&&a.call(t)}},e._createNestedObject=f,e._handleError=v,e._setData=b,e._fsSetUnmountHandler=function(t,e,n,r,i){if("function"===typeof t.componentWillUnmount)var a=t.componentWillUnmount;t.componentWillUnmount=function(){(0,o.default)({context:t,id:e},{refs:n,listeners:r,syncs:i}),a&&a.call(t)}},e._fsCreateRef=function(t,e){return"object"===("undefined"===typeof t?"undefined":r(t))?t:_(t)%2===0?e.doc(t):e.collection(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){var n=t.id,r=t.context,i=e.refs,o=e.listeners,a=e.syncs,s=i.get(n),u=o.get(n);if("undefined"!==typeof s&&(s.off("value",u),i.delete(n),o.delete(n),a)){var c=a.get(r);if(c&&c.length>0){var l=c.findIndex(function(t,e){return t.id===n});-1!==l&&(c.splice(l,1),a.set(r,c))}}};n(2)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){var n=t.id,r=t.context,i=e.refs,o=e.listeners,a=e.syncs,s=o.get(n);if("function"===typeof s&&(s(),i.delete(n),o.delete(n),a)){var u=a.get(r);if(u&&u.length>0){var c=u.findIndex(function(t,e){return t.id===n});-1!==c&&(u.splice(c,1),a.set(r,u))}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e._validateCollectionPath=e._validateDocumentPath=e._validateEndpoint=e._validateDatabase=e.optionValidators=void 0;var r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=n(2),o={notObject:function(t){(0,i._isObject)(t)||(0,i._throwError)("The options argument must be an object. Instead, got "+t,"INVALID_OPTIONS")},context:function(t){this.notObject(t),t.context&&(0,i._isObject)(t.context)||this.makeError("context","object",t.context)},state:function(t){this.notObject(t),t.state&&"string"===typeof t.state||this.makeError("state","string",t.state)},then:function(t){this.notObject(t),"undefined"!==typeof t.then&&"function"===typeof t.then||this.makeError("then","function",t.then)},data:function(t){this.notObject(t),"undefined"===typeof t.data&&this.makeError("data","ANY",t.data)},query:function(t){this.notObject(t);var e=["limitToFirst","limitToLast","orderByChild","orderByValue","orderByKey","orderByPriority","startAt","endAt","equalTo"],n=t.queries;for(var r in n)n.hasOwnProperty(r)&&-1===e.indexOf(r)&&(0,i._throwError)("The query field must contain valid Firebase queries.  Expected one of ["+e.join(", ")+"]. Instead, got "+r,"INVALID_OPTIONS")},defaultValue:function(t){this.notObject(t),t.hasOwnProperty("defaultValue")&&((0,i._isValid)(t.defaultValue)||(0,i._throwError)("The typeof defaultValue must be one of string, number, boolean, object.","INVALID_OPTIONS"))},makeError:function(t,e,n){(0,i._throwError)("The options argument must contain a "+t+" property of type "+e+". Instead, got "+n,"INVALID_OPTIONS")}};e.optionValidators=o,e._validateDatabase=function(t){var e;"object"===("undefined"===typeof t?"undefined":r(t))&&(t.ref||t.collection)||(e="Rebase.createClass failed. Expected an initialized firebase or firestore database object."),"undefined"!==typeof e&&(0,i._throwError)(e,"INVALID_CONFIG")},e._validateEndpoint=function(t){if("object"!==("undefined"===typeof t?"undefined":r(t))||!t.hasOwnProperty("firestore")){var e,n="The Firebase endpoint you are trying to listen to";"string"!==typeof t?e=n+" must be a string. Instead, got "+t:0===t.length?e=n+" must be a non-empty string. Instead, got "+t:t.length>768?e=n+" is too long to be stored in Firebase. It must be less than 768 characters.":/^$|[\[\]\#\$]|.{1}[\.]/.test(t)&&(e=n+' in invalid. Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]".'),"undefined"!==typeof e&&(0,i._throwError)(e,"INVALID_ENDPOINT")}},e._validateDocumentPath=function(t){"object"===("undefined"===typeof t?"undefined":r(t))&&t.hasOwnProperty("firestore")||("string"!==typeof t&&(0,i._throwError)("Invalid document path or reference.","INVALID_ENDPOINT"),(0,i._getSegmentCount)(t)%2!==0&&(0,i._throwError)("Invalid document path or reference.","INVALID_ENDPOINT"))},e._validateCollectionPath=function(t){if("object"!==("undefined"===typeof t?"undefined":r(t))||!t.hasOwnProperty("firestore")){var e="Invalid collection path or reference.";"string"!==typeof t&&(0,i._throwError)(e,"INVALID_ENDPOINT"),(0,i._getSegmentCount)(t)%2===0&&(0,i._throwError)(e,"INVALID_ENDPOINT")}}},function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){(0,r._validateEndpoint)(t),r.optionValidators.data(e);var i,o=n.ref(t);i=e.then?o.push(e.data,e.then):o.push(e.data);return i};var r=n(5)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){(0,r._validateEndpoint)(t),r.optionValidators.defaultValue(e),e.queries&&r.optionValidators.query(e);var o=n.ref(t);return(o=(0,i._addQueries)(o,e.queries)).once("value").then(function(t){var n=(0,i._prepareData)(t,e);return e.then&&e.then.call(e.context,n),n}).catch(function(t){if(!e.onFailure||"function"!==typeof e.onFailure)throw t;e.onFailure.call(e.context,t)})};var r=n(5),i=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){(0,r._validateEndpoint)(t),r.optionValidators.data(e);var i=n.ref(t);return e.then?i.set(e.data,e.then):i.set(e.data)};var r=n(5)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e,n,o){(0,r._validateEndpoint)(e);r.optionValidators.context(n);r.optionValidators.state(n);r.optionValidators.defaultValue(n);n.queries&&r.optionValidators.query(n);n.then&&(n.then.called=!1);n.onFailure=n.onFailure?n.onFailure.bind(n.context):null;n.keepKeys=n.keepKeys&&n.asArray;!0!==t.called&&(t.reactSetState=n.context.setState,t.called=!0);n.reactSetState=t.reactSetState;var a=o.db.ref(e);var s=(0,i._createHash)(e,"syncState");(0,i._firebaseRefsMixin)(s,a,o.refs);(0,i._addListener)(s,"syncState",n,a,o.listeners);(0,i._setUnmountHandler)(n.context,s,o.refs,o.listeners,o.syncs);var u={id:s,updateFirebase:i._updateSyncState.bind(null,a,n.onFailure,n.keepKeys),stateKey:n.state};(0,i._addSync)(n.context,u,o.syncs);n.context.setState=function(e,r){if("function"===typeof e)return t.reactSetState.call(n.context,e,function(){return r&&r.call(n.context),n.context.setState.call(n.context,n.context.state)});if("function"===typeof r)return t.reactSetState.call(n.context,e,function(){return r(),n.context.setState.call(n.context,e)});var a=o.syncs.get(this);if(!a||0===a.length)return t.reactSetState.call(this,e,r);var s=a.map(function(t){return{key:t.stateKey,update:t.updateFirebase,nested:(0,i._isNestedPath)(t.stateKey)}});s.forEach(function(t){if(!0===t.nested){if((0,i._hasOwnNestedProperty)(e,t.key)){var n=(0,i._getNestedObject)(e,t.key);t.update(n)}}else e.hasOwnProperty(t.key)&&t.update(e[t.key])});var u=Object.keys(e);u.forEach(function(i){var o=!s.find(function(t){var e=t.key;return!0===t.nested&&(e=t.key.split(".")[0]),e===i});if(o){var a={};a[i]=e[i],t.reactSetState.call(n.context,a,r)}})};return(0,i._returnRef)(e,"syncState",s,n.context)};var r=n(5),i=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n,o){(0,r._validateEndpoint)(t),r.optionValidators.context(e),r.optionValidators.defaultValue(e),"listenTo"===n&&r.optionValidators.then(e),"bindToState"===n&&r.optionValidators.state(e),e.queries&&r.optionValidators.query(e),e.then&&(e.then.called=!1);var a=(0,i._createHash)(t,n),s=o.db.ref(t);return(0,i._firebaseRefsMixin)(a,s,o.refs),(0,i._addListener)(a,n,e,s,o.listeners),(0,i._setUnmountHandler)(e.context,a,o.refs,o.listeners,o.syncs),(0,i._returnRef)(t,n,a,e.context)};var r=n(5),i=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){(0,r._validateEndpoint)(t),r.optionValidators.data(e);var i=n.db.ref(t);return e.then?i.update(e.data,e.then):i.update(e.data)};var r=n(5)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return t.refs.forEach(function(e,n){e.off("value",t.listeners.get(n))}),t.listeners=new Map,t.refs=new Map,t.syncs=new WeakMap,null}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){return e.ref().child(t).remove(n)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e,n,o){(0,r._validateDocumentPath)(e);r.optionValidators.context(n);r.optionValidators.state(n);n.then&&(n.then.called=!1);!0!==t.called&&(t.reactSetState=n.context.setState,t.called=!0);n.reactSetState=t.reactSetState;var a=(0,i._createHash)(e,"syncDoc");var s=(0,i._fsCreateRef)(e,o.db);(0,i._firebaseRefsMixin)(a,s,o.refs);(0,i._addFirestoreListener)(a,"syncDoc",n,s,o.listeners);(0,i._fsSetUnmountHandler)(n.context,a,o.refs,o.listeners,o.syncs);var u={id:a,updateFirebase:i._fsUpdateSyncState.bind(null,s),stateKey:n.state};(0,i._addSync)(n.context,u,o.syncs);n.context.setState=function(e,r){if("function"===typeof e)return t.reactSetState.call(n.context,e,function(){return r&&r.call(n.context),n.context.setState.call(n.context,n.context.state)});if("function"===typeof r)return t.reactSetState.call(n.context,e,function(){return r(),n.context.setState.call(n.context,e)});var i=o.syncs.get(this);if(!i||0===i.length)return t.reactSetState.call(this,e,r);var a=i.map(function(t){return{key:t.stateKey,update:t.updateFirebase}});a.forEach(function(t){e[t.key]&&t.update(e[t.key])});var s=Object.keys(e);s.forEach(function(i){var o=!a.find(function(t){return t.key===i});if(o){var s={};s[i]=e[i],t.reactSetState.call(n.context,function(t){return Object.assign(t,s)},r)}})};return(0,i._returnRef)(e,"syncDoc",a,n.context)};var r=n(5),i=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n,o){r.optionValidators.context(e),e.then&&(e.then.called=!1),"bindDoc"===n&&(0,r._validateDocumentPath)(t);"bindCollection"===n&&(r.optionValidators.state(e),(0,r._validateCollectionPath)(t));"listenToDoc"===n&&((0,r._validateDocumentPath)(t),r.optionValidators.then(e));"listenToCollection"===n&&((0,r._validateCollectionPath)(t),r.optionValidators.then(e));var a=(0,i._fsCreateRef)(t,o.db),s=(0,i._createHash)(t,n);return(0,i._firebaseRefsMixin)(s,a,o.refs),(0,i._addFirestoreListener)(s,n,e,a,o.listeners),(0,i._fsSetUnmountHandler)(e.context,s,o.refs,o.listeners,o.syncs),(0,i._returnRef)(t,n,s,e.context)};var r=n(5),i=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];(0,i._validateEndpoint)(t);var o=(0,r._fsCreateRef)(t,n),a=!!o.add;return(o=(0,r._addFirestoreQuery)(o,e.query)).get().then(function(t){return a&&!t.empty||!a&&t.exists?(0,r._fsPrepareData)(t,e,a):Promise.reject(new Error("No Result"))})};var r=n(2),i=n(5)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){return(0,r._fsCreateRef)(t,e).delete()};var r=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n,o){(0,r._validateCollectionPath)(t);var a=(0,i._fsCreateRef)(t,n);if(o)return a.doc(o).set(e);return a.add(e)};var r=n(5),i=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,r._validateCollectionPath)(t);var o=(0,i._fsCreateRef)(t,e);return(o=(0,i._addFirestoreQuery)(o,n.query)).get().then(function(t){if(!t.empty){var n=e.batch();return t.forEach(function(t){n.delete(t.ref)}),n.commit()}})};var r=n(5),i=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,n){return(0,r._validateDocumentPath)(t),(0,i._fsCreateRef)(t,n).update(e)};var r=n(5),i=n(2)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return t.listeners.forEach(function(t,e){t()}),t.listeners=new Map,t.refs=new Map,t.syncs=new WeakMap,null}}])},t.exports=r(n(60))},function(t,e,n){"use strict";n(28);var r,i=(r=n(2))&&"object"===typeof r&&"default"in r?r.default:r;t.exports=i},function(t,e){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},,,,function(t,e,n){"use strict";var r=n(6),i=n.n(r),o=n(0),a=n.n(o),s=n(3),u=n.n(s),c=n(5),l=n.n(c),h=n(12),f=n.n(h);function p(t){return"/"===t.charAt(0)}function d(t,e){for(var n=e,r=n+1,i=t.length;r<i;n+=1,r+=1)t[n]=t[r];t.pop()}var y=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=t&&t.split("/")||[],r=e&&e.split("/")||[],i=t&&p(t),o=e&&p(e),a=i||o;if(t&&p(t)?r=n:n.length&&(r.pop(),r=r.concat(n)),!r.length)return"/";var s=void 0;if(r.length){var u=r[r.length-1];s="."===u||".."===u||""===u}else s=!1;for(var c=0,l=r.length;l>=0;l--){var h=r[l];"."===h?d(r,l):".."===h?(d(r,l),c++):c&&(d(r,l),c--)}if(!a)for(;c--;c)r.unshift("..");!a||""===r[0]||r[0]&&p(r[0])||r.unshift("");var f=r.join("/");return s&&"/"!==f.substr(-1)&&(f+="/"),f};"function"===typeof Symbol&&Symbol.iterator;var m=function(t){return"/"===t.charAt(0)?t:"/"+t},g=function(t,e){return new RegExp("^"+e+"(\\/|\\?|#|$)","i").test(t)},v=function(t,e){return g(t,e)?t.substr(e.length):t},b=function(t){return"/"===t.charAt(t.length-1)?t.slice(0,-1):t},_=function(t){var e=t.pathname,n=t.search,r=t.hash,i=e||"/";return n&&"?"!==n&&(i+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(i+="#"===r.charAt(0)?r:"#"+r),i},w=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},E=function(t,e,n,r){var i=void 0;"string"===typeof t?(i=function(t){var e=t||"/",n="",r="",i=e.indexOf("#");-1!==i&&(r=e.substr(i),e=e.substr(0,i));var o=e.indexOf("?");return-1!==o&&(n=e.substr(o),e=e.substr(0,o)),{pathname:e,search:"?"===n?"":n,hash:"#"===r?"":r}}(t)).state=e:(void 0===(i=w({},t)).pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==e&&void 0===i.state&&(i.state=e));try{i.pathname=decodeURI(i.pathname)}catch(o){throw o instanceof URIError?new URIError('Pathname "'+i.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):o}return n&&(i.key=n),r?i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=y(i.pathname,r.pathname)):i.pathname=r.pathname:i.pathname||(i.pathname="/"),i},T=function(){var t=null,e=[];return{setPrompt:function(e){return l()(null==t,"A history supports only one prompt at a time"),t=e,function(){t===e&&(t=null)}},confirmTransitionTo:function(e,n,r,i){if(null!=t){var o="function"===typeof t?t(e,n):t;"string"===typeof o?"function"===typeof r?r(o,i):(l()(!1,"A history needs a getUserConfirmation function in order to use a prompt message"),i(!0)):i(!1!==o)}else i(!0)},appendListener:function(t){var n=!0,r=function(){n&&t.apply(void 0,arguments)};return e.push(r),function(){n=!1,e=e.filter(function(t){return t!==r})}},notifyListeners:function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];e.forEach(function(t){return t.apply(void 0,n)})}}},S=!("undefined"===typeof window||!window.document||!window.document.createElement),C=function(t,e,n){return t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},I=function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent("on"+e,n)},N=function(t,e){return e(window.confirm(t))},k="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},A=function(){try{return window.history.state||{}}catch(t){return{}}},O=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f()(S,"Browser history needs a DOM");var e=window.history,n=function(){var t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history}(),r=!(-1===window.navigator.userAgent.indexOf("Trident")),i=t.forceRefresh,o=void 0!==i&&i,a=t.getUserConfirmation,s=void 0===a?N:a,u=t.keyLength,c=void 0===u?6:u,h=t.basename?b(m(t.basename)):"",p=function(t){var e=t||{},n=e.key,r=e.state,i=window.location,o=i.pathname+i.search+i.hash;return l()(!h||g(o,h),'You are attempting to use a basename on a page whose URL path does not begin with the basename. Expected path "'+o+'" to begin with "'+h+'".'),h&&(o=v(o,h)),E(o,r,n)},d=function(){return Math.random().toString(36).substr(2,c)},y=T(),w=function(t){D(W,t),W.length=e.length,y.notifyListeners(W.location,W.action)},O=function(t){(function(t){return void 0===t.state&&-1===navigator.userAgent.indexOf("CriOS")})(t)||x(p(t.state))},R=function(){x(p(A()))},P=!1,x=function(t){P?(P=!1,w()):y.confirmTransitionTo(t,"POP",s,function(e){e?w({action:"POP",location:t}):L(t)})},L=function(t){var e=W.location,n=F.indexOf(e.key);-1===n&&(n=0);var r=F.indexOf(t.key);-1===r&&(r=0);var i=n-r;i&&(P=!0,j(i))},M=p(A()),F=[M.key],U=function(t){return h+_(t)},j=function(t){e.go(t)},V=0,B=function(t){1===(V+=t)?(C(window,"popstate",O),r&&C(window,"hashchange",R)):0===V&&(I(window,"popstate",O),r&&I(window,"hashchange",R))},q=!1,W={length:e.length,action:"POP",location:M,createHref:U,push:function(t,r){l()(!("object"===("undefined"===typeof t?"undefined":k(t))&&void 0!==t.state&&void 0!==r),"You should avoid providing a 2nd state argument to push when the 1st argument is a location-like object that already has state; it is ignored");var i=E(t,r,d(),W.location);y.confirmTransitionTo(i,"PUSH",s,function(t){if(t){var r=U(i),a=i.key,s=i.state;if(n)if(e.pushState({key:a,state:s},null,r),o)window.location.href=r;else{var u=F.indexOf(W.location.key),c=F.slice(0,-1===u?0:u+1);c.push(i.key),F=c,w({action:"PUSH",location:i})}else l()(void 0===s,"Browser history cannot push state in browsers that do not support HTML5 history"),window.location.href=r}})},replace:function(t,r){l()(!("object"===("undefined"===typeof t?"undefined":k(t))&&void 0!==t.state&&void 0!==r),"You should avoid providing a 2nd state argument to replace when the 1st argument is a location-like object that already has state; it is ignored");var i=E(t,r,d(),W.location);y.confirmTransitionTo(i,"REPLACE",s,function(t){if(t){var r=U(i),a=i.key,s=i.state;if(n)if(e.replaceState({key:a,state:s},null,r),o)window.location.replace(r);else{var u=F.indexOf(W.location.key);-1!==u&&(F[u]=i.key),w({action:"REPLACE",location:i})}else l()(void 0===s,"Browser history cannot replace state in browsers that do not support HTML5 history"),window.location.replace(r)}})},go:j,goBack:function(){return j(-1)},goForward:function(){return j(1)},block:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=y.setPrompt(t);return q||(B(1),q=!0),function(){return q&&(q=!1,B(-1)),e()}},listen:function(t){var e=y.appendListener(t);return B(1),function(){B(-1),e()}}};return W},R=(Object.assign,"function"===typeof Symbol&&Symbol.iterator,Object.assign,Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t});function P(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?t:e}var x=function(t){function e(){var n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=r=P(this,t.call.apply(t,[this].concat(o))),r.state={match:r.computeMatch(r.props.history.location.pathname)},P(r,n)}return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getChildContext=function(){return{router:R({},this.context.router,{history:this.props.history,route:{location:this.props.history.location,match:this.state.match}})}},e.prototype.computeMatch=function(t){return{path:"/",url:"/",params:{},isExact:"/"===t}},e.prototype.componentWillMount=function(){var t=this,e=this.props,n=e.children,r=e.history;f()(null==n||1===a.a.Children.count(n),"A <Router> may have only one child element"),this.unlisten=r.listen(function(){t.setState({match:t.computeMatch(r.location.pathname)})})},e.prototype.componentWillReceiveProps=function(t){i()(this.props.history===t.history,"You cannot change <Router history>")},e.prototype.componentWillUnmount=function(){this.unlisten()},e.prototype.render=function(){var t=this.props.children;return t?a.a.Children.only(t):null},e}(a.a.Component);x.propTypes={history:u.a.object.isRequired,children:u.a.node},x.contextTypes={router:u.a.object},x.childContextTypes={router:u.a.object.isRequired};var L=x;function M(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?t:e}var F=function(t){function e(){var n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=r=M(this,t.call.apply(t,[this].concat(o))),r.history=O(r.props),M(r,n)}return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentWillMount=function(){i()(!this.props.history,"<BrowserRouter> ignores the history prop. To use a custom history, use `import { Router }` instead of `import { BrowserRouter as Router }`.")},e.prototype.render=function(){return a.a.createElement(L,{history:this.history,children:this.props.children})},e}(a.a.Component);F.propTypes={basename:u.a.string,forceRefresh:u.a.bool,getUserConfirmation:u.a.func,keyLength:u.a.number,children:u.a.node};e.a=F},function(t,e,n){"use strict";var r=n(6),i=n.n(r),o=n(12),a=n.n(o),s=n(0),u=n.n(s),c=n(3),l=n.n(c),h=n(21),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};function p(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?t:e}var d=function(t){return 0===u.a.Children.count(t)},y=function(t){function e(){var n,r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var i=arguments.length,o=Array(i),a=0;a<i;a++)o[a]=arguments[a];return n=r=p(this,t.call.apply(t,[this].concat(o))),r.state={match:r.computeMatch(r.props,r.context.router)},p(r,n)}return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getChildContext=function(){return{router:f({},this.context.router,{route:{location:this.props.location||this.context.router.route.location,match:this.state.match}})}},e.prototype.computeMatch=function(t,e){var n=t.computedMatch,r=t.location,i=t.path,o=t.strict,s=t.exact,u=t.sensitive;if(n)return n;a()(e,"You should not use <Route> or withRouter() outside a <Router>");var c=e.route,l=(r||c.location).pathname;return Object(h.a)(l,{path:i,strict:o,exact:s,sensitive:u},c.match)},e.prototype.componentWillMount=function(){i()(!(this.props.component&&this.props.render),"You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored"),i()(!(this.props.component&&this.props.children&&!d(this.props.children)),"You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored"),i()(!(this.props.render&&this.props.children&&!d(this.props.children)),"You should not use <Route render> and <Route children> in the same route; <Route children> will be ignored")},e.prototype.componentWillReceiveProps=function(t,e){i()(!(t.location&&!this.props.location),'<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),i()(!(!t.location&&this.props.location),'<Route> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'),this.setState({match:this.computeMatch(t,e.router)})},e.prototype.render=function(){var t=this.state.match,e=this.props,n=e.children,r=e.component,i=e.render,o=this.context.router,a=o.history,s=o.route,c=o.staticContext,l={match:t,location:this.props.location||s.location,history:a,staticContext:c};return r?t?u.a.createElement(r,l):null:i?t?i(l):null:"function"===typeof n?n(l):n&&!d(n)?u.a.Children.only(n):null},e}(u.a.Component);y.propTypes={computedMatch:l.a.object,path:l.a.string,exact:l.a.bool,strict:l.a.bool,sensitive:l.a.bool,component:l.a.func,render:l.a.func,children:l.a.oneOfType([l.a.func,l.a.node]),location:l.a.object},y.contextTypes={router:l.a.shape({history:l.a.object.isRequired,route:l.a.object.isRequired,staticContext:l.a.object})},y.childContextTypes={router:l.a.object.isRequired};var m=y;e.a=m},function(t,e,n){"use strict";var r=n(0),i=n.n(r),o=n(3),a=n.n(o),s=n(6),u=n.n(s),c=n(12),l=n.n(c),h=n(21);var f=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentWillMount=function(){l()(this.context.router,"You should not use <Switch> outside a <Router>")},e.prototype.componentWillReceiveProps=function(t){u()(!(t.location&&!this.props.location),'<Switch> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'),u()(!(!t.location&&this.props.location),'<Switch> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.')},e.prototype.render=function(){var t=this.context.router.route,e=this.props.children,n=this.props.location||t.location,r=void 0,o=void 0;return i.a.Children.forEach(e,function(e){if(null==r&&i.a.isValidElement(e)){var a=e.props,s=a.path,u=a.exact,c=a.strict,l=a.sensitive,f=a.from,p=s||f;o=e,r=Object(h.a)(n.pathname,{path:p,exact:u,strict:c,sensitive:l},t.match)}}),r?i.a.cloneElement(o,{location:n,computedMatch:r}):null},e}(i.a.Component);f.contextTypes={router:a.a.shape({route:a.a.object.isRequired}).isRequired},f.propTypes={children:a.a.node,location:a.a.object};var p=f;e.a=p}]]);
  //# sourceMappingURL=2.941fd8bf.chunk.js.map