PageSourceSearch

https://postmormon.org/static/js/2.1ba09ef0.chunk.js

js postmormon.org collected 2026-10-02 13:31:14 UTC 962,615 bytes, 2 lines download raw bytes

1(window.webpackJsonppomo=window.webpackJsonppomo||[]).push([[2],[function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return a})),n.d(t,"__decorate",(function(){return s})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return h})),n.d(t,"__exportStar",(function(){return f})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return d})),n.d(t,"__spread",(function(){return m})),n.d(t,"__spreadArrays",(function(){return y})),n.d(t,"__await",(function(){return g})),n.d(t,"__asyncGenerator",(function(){return v})),n.d(t,"__asyncDelegator",(function(){return b})),n.d(t,"__asyncValues",(function(){return _})),n.d(t,"__makeTemplateObject",(function(){return w})),n.d(t,"__importStar",(function(){return E})),n.d(t,"__importDefault",(function(){return T}));var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function u(e,t){return function(n,r){t(n,r,e)}}function c(e,t){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(t){o(t)}}function s(e){try{u(r.throw(e))}catch(t){o(t)}}function u(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function h(e,t){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=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&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=t.call(e,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(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function p(e){var t="function"===typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function d(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >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 m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(d(arguments[t]));return e}function y(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function g(e){return this instanceof g?(this.v=e,this):new g(e)}function v(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||s(e,t)}))})}function s(e,t){try{(n=i[e](t)).value instanceof g?Promise.resolve(n.value.v).then(u,c):l(o[0][2],n)}catch(r){l(o[0][3],r)}var n}function u(e){s("next",e)}function c(e){s("throw",e)}function l(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function b(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:g(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function w(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}
1function E(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function T(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(0),o=n(3),a=n(4),s=((r={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",r["bad-app-name"]="Illegal App name: '{$appName}",r["duplicate-app"]="Firebase App named '{$appName}' already exists",r["app-deleted"]="Firebase App named '{$appName}' already deleted",r["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",r),u=new o.ErrorFactory("app","Firebase",s),c="[DEFAULT]",l=[],h=function(){function e(e,t,n){this.firebase_=n,this.isDeleted_=!1,this.services_={},this.name_=t.name,this.automaticDataCollectionEnabled_=t.automaticDataCollectionEnabled||!1,this.options_=o.deepCopy(e),this.INTERNAL={getUid:function(){return null},getToken:function(){return Promise.resolve(null)},addAuthTokenListener:function(e){l.push(e),setTimeout((function(){return e(null)}),0)},removeAuthTokenListener:function(e){l=l.filter((function(t){return t!==e}))}}}return Object.defineProperty(e.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(e){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),e.prototype.delete=function(){var e=this;return new Promise((function(t){e.checkDestroyed_(),t()})).then((function(){e.firebase_.INTERNAL.removeApp(e.name_);for(var t=[],n=0,r=Object.keys(e.services_);n<r.length;n++)for(var i=r[n],o=0,a=Object.keys(e.services_[i]);o<a.length;o++){var s=a[o];t.push(e.services_[i][s])}return Promise.all(t.filter((function(e){return"INTERNAL"in e})).map((function(e){return e.INTERNAL.delete()})))})).then((function(){e.isDeleted_=!0,e.services_={}}))},e.prototype._getService=function(e,t){if(void 0===t&&(t=c),this.checkDestroyed_(),this.services_[e]||(this.services_[e]={}),!this.services_[e][t]){var n=t!==c?t:void 0,r=this.firebase_.INTERNAL.factories[e](this,this.extendApp.bind(this),n);this.services_[e][t]=r}return this.services_[e][t]},e.prototype._removeServiceInstance=function(e,t){void 0===t&&(t=c),this.services_[e]&&this.services_[e][t]&&delete this.services_[e][t]},e.prototype.extendApp=function(e){var t=this;o.deepExtend(this,e),e.INTERNAL&&e.INTERNAL.addAuthTokenListener&&(l.forEach((function(e){t.INTERNAL.addAuthTokenListener(e)})),l=[])},e.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw u.create("app-deleted",{appName:this.name_})},e}();h.prototype.name&&h.prototype.options||h.prototype.delete||console.log("dc");var f="6.6.0",p=new a.Logger("@firebase/app");if(o.isBrowser()&&void 0!==self.firebase){p.warn("\n    Warning: Firebase is already defined in the global scope. Please make sure\n    Firebase library is only loaded once.\n  ");var d=self.firebase.SDK_VERSION;d&&d.indexOf("LITE")>=0&&p.warn("\n    Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n    You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n    ")}var m=function e(){var t=function(e){var t={},n={},r={},i={__esModule:!0,initializeApp:function(n,r){void 0===r&&(r={});if("object"!==typeof r||null===r){r={name:r}}var a=r;void 0===a.name&&(a.name=c);var s=a.name;if("string"!==typeof s||!s)throw u.create("bad-app-name",{appName:String(s)});if(o.contains(t,s))throw u.create("duplicate-app",{appName:s});var h=new e(n,a,i);return t[s]=h,l(h,"create"),h},app:a,apps:null,SDK_VERSION:f,INTERNAL:{registerService:function(t,c,l,h,f){void 0===f&&(f=!1);if(n[t])return p.debug("There were multiple attempts to register service "+t+"."),i[t];
1n[t]=c,h&&(r[t]=h,s().forEach((function(e){h("create",e)})));function d(e){if(void 0===e&&(e=a()),"function"!==typeof e[t])throw u.create("invalid-app-argument",{appName:t});return e[t]()}void 0!==l&&o.deepExtend(d,l);return i[t]=d,e.prototype[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=this._getService.bind(this,t);return r.apply(this,f?e:[])},d},removeApp:function(e){l(t[e],"delete"),delete t[e]},factories:n,useAsService:h}};function a(e){if(e=e||c,!o.contains(t,e))throw u.create("no-app",{appName:e});return t[e]}function s(){return Object.keys(t).map((function(e){return t[e]}))}function l(e,t){for(var i=0,o=Object.keys(n);i<o.length;i++){var a=h(e,o[i]);if(null===a)return;r[a]&&r[a](t,e)}}function h(e,t){return"serverAuth"===t?null:t}return i.default=i,Object.defineProperty(i,"apps",{get:s}),a.App=e,i}(h);return t.INTERNAL=i.__assign({},t.INTERNAL,{createFirebaseNamespace:e,extendNamespace:function(e){o.deepExtend(t,e)},createSubscribe:o.createSubscribe,ErrorFactory:o.ErrorFactory,deepExtend:o.deepExtend}),t}(),y=m.initializeApp;m.initializeApp=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o.isNode()&&p.warn('\n      Warning: This is a browser-targeted Firebase bundle but it appears it is being\n      run in a Node environment.  If running in a Node environment, make sure you\n      are using the bundle specified by the "main" field in package.json.\n      \n      If you are using Webpack, you can specify "main" as the first item in\n      "resolve.mainFields":\n      https://webpack.js.org/configuration/resolve/#resolvemainfields\n      \n      If using Rollup, use the rollup-plugin-node-resolve plugin and specify "main"\n      as the first item in "mainFields", e.g. [\'main\', \'module\'].\n      https://github.com/rollup/rollup-plugin-node-resolve\n      '),y.apply(void 0,e)};var g=m;t.default=g,t.firebase=g},function(e,t,n){"use strict";e.exports=n(11)},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},o=function(e,t){if(!e)throw a(t)},a=function(e){return new Error("Firebase Database ("+i.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)},s=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296===(64512&i)&&r+1<e.length&&56320===(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},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(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<e.length;i+=3){var o=e[i],a=i+1<e.length,s=a?e[i+1]:0,u=i+2<e.length,c=u?e[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(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(s(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n<e.length;){var i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){var o=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){var a=((7&i)<<18|(63&(o=e[n++]))<<12|(63&(s=e[n++]))<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(a>>10)),t[r++]=String.fromCharCode(56320+(1023&a))}else{o=e[n++];var s=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<e.length;){var o=n[e.charAt(i++)],a=i<e.length?n[e.charAt(i)]:0,s=++i<e.length?n[e.charAt(i)]:64,u=++i<e.length?n[e.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 e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},c=function(e){try{return u.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};function l(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var n in t)t.hasOwnProperty(n)&&(e[n]=l(e[n],t[n]));return e}var h=function(){function e(){var e=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))}return e.prototype.wrapCallback=function(e){var t=this;return function(n,r){n?t.reject(n):t.resolve(r),"function"===typeof e&&(t.promise.catch((function(){})),1===e.length?e(n):e(n,r))}},e}();function f(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""}var p="FirebaseError",d=function(e){function t(n,r){var i=e.call(this,r)||this;
1return i.code=n,i.name=p,Object.setPrototypeOf(i,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(i,m.prototype.create),i}return r.__extends(t,e),t}(Error),m=function(){function e(e,t,n){this.service=e,this.serviceName=t,this.errors=n}return e.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=t[0]||{},i=this.service+"/"+e,o=this.errors[e],a=o?y(o,r):"Error",s=this.serviceName+": "+a+" ("+i+").",u=new d(i,s),c=0,l=Object.keys(r);c<l.length;c++){var h=l[c];"_"!==h.slice(-1)&&(h in u&&console.warn('Overwriting FirebaseError base field "'+h+'" can cause unexpected behavior.'),u[h]=r[h])}return u},e}();function y(e,t){return e.replace(g,(function(e,n){var r=t[n];return null!=r?r.toString():"<"+n+"?>"}))}var g=/\{\$([^}]+)}/g;function v(e){return JSON.parse(e)}var b=function(e){var t={},n={},r={},i="";try{var o=e.split(".");t=v(c(o[0])||""),n=v(c(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(a){}return{header:t,claims:n,data:r,signature:i}};var _=function(){function e(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(var e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}return 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(e,t){t||(t=0);var n=this.W_;if("string"===typeof e)for(var r=0;r<16;r++)n[r]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(r=0;r<16;r++)n[r]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=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(e,t){if(null!=e){void 0===t&&(t=e.length);for(var n=t-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r<t;){if(0===o)for(;r<=n;)this.compress_(e,r),r+=this.blockSize;if("string"===typeof e){for(;r<t;)if(i[o]=e.charCodeAt(r),++r,++o===this.blockSize){this.compress_(i),o=0;break}}else for(;r<t;)if(i[o]=e[r],++r,++o===this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=t}},e.prototype.digest=function(){var e=[],t=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&t,t/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)e[r]=this.chain_[n]>>i&255,++r;return e},e}();var w=function(){function e(e,t){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((function(){e(n)})).catch((function(e){n.error(e)}))}return e.prototype.next=function(e){this.forEachObserver((function(t){t.next(e)}))},e.prototype.error=function(e){this.forEachObserver((function(t){t.error(e)})),this.close(e)},e.prototype.complete=function(){this.forEachObserver((function(e){e.complete()})),this.close()},e.prototype.subscribe=function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!==typeof e||null===e)return!1;for(var n=0,r=t;n<r.length;n++){var i=r[n];if(i in e&&"function"===typeof e[i])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n}).next&&(r.next=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);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(e){}})),this.observers.push(r),o},e.prototype.unsubscribeOne=function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},e.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},e.prototype.sendOne=function(e,t){var n=this;this.task.then((function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(r){"undefined"!==typeof console&&console.error&&console.error(r)}}))},e.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((function(){t.observers=void 0,t.onNoObservers=void 0})))},e}();function E(){}function T(e,t,n){var r="";switch(t){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=e+" failed: ";return i+=r+" argument "}t.CONSTANTS=i,t.Deferred=h,t.ErrorFactory=m,t.FirebaseError=d,t.Sha1=_,t.assert=o,t.assertionError=a,t.async=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];Promise.resolve(!0).then((function(){e.apply(void 0,n)})).catch((function(e){t&&t(e)}))}},t.base64=u,t.base64Decode=c,t.base64Encode=function(e){var t=s(e);return u.encodeByteArray(t,!0)},t.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.createSubscribe=function(e,t){var n=new w(e,t);return n.subscribe.bind(n)},t.decode=b,t.deepCopy=function(e){return l(void 0,e)},t.deepExtend=l,t.errorPrefix=T,t.getUA=f,t.isAdmin=function(e){var t=b(e).claims;return"object"===typeof t&&!0===t.admin},t.isBrowser=function(){return"object"===typeof self&&self.self===self},t.isEmpty=function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},t.isMobileCordova=function(){return"undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(f())},t.isNode=function(){try{return"[object process]"===Object.prototype.toString.call(e.process)}catch(t){return!1}},t.isNodeSdk=function(){return!0===i.NODE_CLIENT||!0===i.NODE_ADMIN},t.isReactNative=function(){return"object"===typeof navigator&&"ReactNative"===navigator.product},t.isValidFormat=function(e){var t=b(e).claims;return!!t&&"object"===typeof t&&t.hasOwnProperty("iat")},t.isValidTimestamp=function(e){var t=b(e).claims,n=Math.floor((new Date).getTime()/1e3),r=0,i=0;return"object"===typeof t&&(t.hasOwnProperty("nbf")?r=t.nbf:t.hasOwnProperty("iat")&&(r=t.iat),i=t.hasOwnProperty("exp")?t.exp:r+86400),!!n&&!!r&&!!i&&n>=r&&n<=i},t.issuedAtTime=function(e){var t=b(e).claims;return"object"===typeof t&&t.hasOwnProperty("iat")?t.iat:null},t.jsonEval=v,t.map=function(e,t,n){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=t.call(n,e[i],i,e));return r},t.querystring=function(e){for(var t=[],n=function(e,n){Array.isArray(n)?n.forEac
1h((function(n){t.push(encodeURIComponent(e)+"="+encodeURIComponent(n))})):t.push(encodeURIComponent(e)+"="+encodeURIComponent(n))},r=0,i=Object.entries(e);r<i.length;r++){var o=i[r];n(o[0],o[1])}return t.length?"&"+t.join("&"):""},t.querystringDecode=function(e){var t={};return e.replace(/^\?/,"").split("&").forEach((function(e){if(e){var n=e.split("=");t[n[0]]=n[1]}})),t},t.safeGet=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0},t.stringLength=function(e){for(var t=0,n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t++:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3}return t},t.stringToByteArray=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);if(i>=55296&&i<=56319){var a=i-55296;o(++r<e.length,"Surrogate pair missing trail surrogate."),i=65536+(a<<10)+(e.charCodeAt(r)-56320)}i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):i<65536?(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},t.stringify=function(e){return JSON.stringify(e)},t.validateArgCount=function(e,t,n,r){var i;if(r<t?i="at least "+t:r>n&&(i=0===n?"none":"no more than "+n),i)throw new Error(e+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")},t.validateCallback=function(e,t,n,r){if((!r||n)&&"function"!==typeof n)throw new Error(T(e,t,r)+"must be a valid function.")},t.validateContextObject=function(e,t,n,r){if((!r||n)&&("object"!==typeof n||null===n))throw new Error(T(e,t,r)+"must be a valid context object.")},t.validateNamespace=function(e,t,n,r){if((!r||n)&&"string"!==typeof n)throw new Error(T(e,t,r)+"must be a valid firebase namespace.")}}).call(this,n(5))},function(e,t,n){"use strict";n.r(t),n.d(t,"LogLevel",(function(){return r})),n.d(t,"Logger",(function(){return s})),n.d(t,"setLogLevel",(function(){return u}));var r,i=[];!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(r||(r={}));var o=r.INFO,a=function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];if(!(t<e.logLevel)){var o=(new Date).toISOString();switch(t){case r.DEBUG:case r.VERBOSE:console.log.apply(console,["["+o+"]  "+e.name+":"].concat(n));break;case r.INFO:console.info.apply(console,["["+o+"]  "+e.name+":"].concat(n));break;case r.WARN:console.warn.apply(console,["["+o+"]  "+e.name+":"].concat(n));break;case r.ERROR:console.error.apply(console,["["+o+"]  "+e.name+":"].concat(n));break;default:throw new Error("Attempted to log a message with an invalid logType (value: "+t+")")}}},s=function(){function e(e){this.name=e,this._logLevel=o,this._logHandler=a,i.push(this)}return Object.defineProperty(e.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in r))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"logHandler",{get:function(){return this._logHandler},set:function(e){if("function"!==typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e},enumerable:!0,configurable:!0}),e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,[this,r.DEBUG].concat(e))},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,[this,r.VERBOSE].concat(e))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,[this,r.INFO].concat(e))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,[this,r.WARN].concat(e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._logHandler.apply(this,[this,r.ERROR].concat(e))},e}();function u(e){i.forEach((function(t){t.logLevel=e}))}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;
1if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,t){for(var n,s,u=a(e),c=1;c<arguments.length;c++){for(var l in n=Object(arguments[c]))i.call(n,l)&&(u[l]=n[l]);if(r){s=r(n);for(var h=0;h<s.length;h++)o.call(n,s[h])&&(u[s[h]]=n[s[h]])}}return u}},function(e,t,n){"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE){0;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}}(),e.exports=n(12)},function(e,t,n){"use strict";var r,i=(r=n(1))&&"object"===typeof r&&"default"in r?r.default:r;n(16),n(17),n(19),n(21),n(22),n(23),n(24),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"),e.exports=i},function(e,t,n){!function(e){"use strict";function t(e){return Array.prototype.slice.call(e)}function n(e){return new Promise((function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function r(e,t,r){var i,o=new Promise((function(o,a){n(i=e[t].apply(e,r)).then(o,a)}));return o.request=i,o}function i(e,t,n){var i=r(e,t,n);return i.then((function(e){if(e)return new l(e,i.request)}))}function o(e,t,n){n.forEach((function(n){Object.defineProperty(e.prototype,n,{get:function(){return this[t][n]},set:function(e){this[t][n]=e}})}))}function a(e,t,n,i){i.forEach((function(i){i in n.prototype&&(e.prototype[i]=function(){return r(this[t],i,arguments)})}))}function s(e,t,n,r){r.forEach((function(r){r in n.prototype&&(e.prototype[r]=function(){return this[t][r].apply(this[t],arguments)})}))}function u(e,t,n,r){r.forEach((function(r){r in n.prototype&&(e.prototype[r]=function(){return i(this[t],r,arguments)})}))}function c(e){this._index=e}function l(e,t){this._cursor=e,this._request=t}function h(e){this._store=e}function f(e){this._tx=e,this.complete=new Promise((function(t,n){e.oncomplete=function(){t()},e.onerror=function(){n(e.error)},e.onabort=function(){n(e.error)}}))}function p(e,t,n){this._db=e,this.oldVersion=t,this.transaction=new f(n)}function d(e){this._db=e}o(c,"_index",["name","keyPath","multiEntry","unique"]),a(c,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),u(c,"_index",IDBIndex,["openCursor","o
1penKeyCursor"]),o(l,"_cursor",["direction","key","primaryKey","value"]),a(l,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach((function(e){e in IDBCursor.prototype&&(l.prototype[e]=function(){var t=this,r=arguments;return Promise.resolve().then((function(){return t._cursor[e].apply(t._cursor,r),n(t._request).then((function(e){if(e)return new l(e,t._request)}))}))})})),h.prototype.createIndex=function(){return new c(this._store.createIndex.apply(this._store,arguments))},h.prototype.index=function(){return new c(this._store.index.apply(this._store,arguments))},o(h,"_store",["name","keyPath","indexNames","autoIncrement"]),a(h,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),u(h,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),s(h,"_store",IDBObjectStore,["deleteIndex"]),f.prototype.objectStore=function(){return new h(this._tx.objectStore.apply(this._tx,arguments))},o(f,"_tx",["objectStoreNames","mode"]),s(f,"_tx",IDBTransaction,["abort"]),p.prototype.createObjectStore=function(){return new h(this._db.createObjectStore.apply(this._db,arguments))},o(p,"_db",["name","version","objectStoreNames"]),s(p,"_db",IDBDatabase,["deleteObjectStore","close"]),d.prototype.transaction=function(){return new f(this._db.transaction.apply(this._db,arguments))},o(d,"_db",["name","version","objectStoreNames"]),s(d,"_db",IDBDatabase,["close"]),["openCursor","o
1penKeyCursor"].forEach((function(e){[h,c].forEach((function(n){e in n.prototype&&(n.prototype[e.replace("open","iterate")]=function(){var n=t(arguments),r=n[n.length-1],i=this._store||this._index,o=i[e].apply(i,n.slice(0,-1));o.onsuccess=function(){r(o.result)}})}))})),[c,h].forEach((function(e){e.prototype.getAll||(e.prototype.getAll=function(e,t){var n=this,r=[];return new Promise((function(i){n.iterateCursor(e,(function(e){e?(r.push(e.value),void 0===t||r.length!=t?e.continue():i(r)):i(r)}))}))})})),e.openDb=function(e,t,n){var i=r(indexedDB,"open",[e,t]),o=i.request;return o&&(o.onupgradeneeded=function(e){n&&n(new p(o.result,e.oldVersion,o.transaction))}),i.then((function(e){return new d(e)}))},e.deleteDb=function(e){return r(indexedDB,"deleteDatabase",[e])},Object.defineProperty(e,"__esModule",{value:!0})}(t)},,function(e,t,n){"use strict";var r=n(6),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.forward_ref"):60112,p=i?Symbol.for("react.suspense"):60113,d=i?Symbol.for("react.suspense_list"):60120,m=i?Symbol.for("react.memo"):60115,y=i?Symbol.for("react.lazy"):60116;i&&Symbol.for("react.fundamental"),i&&Symbol.for("react.responder");var g="function"===typeof Symbol&&Symbol.iterator;function v(e){for(var t=e.message,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r]);return e.message="Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_={};function w(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||b}function E(){}function T(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||b}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw v(Error(85));this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"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},I={suspense:null},k={current:null},N=Object.prototype.hasOwnProperty,A={key:!0,ref:!0,__self:!0,__source:!0};function D(e,t,n){var r=void 0,i={},a=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(a=""+t.key),t)N.call(t,r)&&!A.hasOwnProperty(r)&&(i[r]=t[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(e&&e.defaultProps)for(r in u=e.defaultProps)void 0===i[r]&&(i[r]=u[r]);return{$$typeof:o,type:e,key:a,ref:s,props:i,_owner:k.current}}function R(e){return"object"===typeof e&&null!==e&&e.$$typeof===o}var O=/\/+/g,P=[];function x(e,t,n,r){if(P.length){var i=P.pop();return i.result=e,i.keyPrefix=t,i.func=n,i.context=r,i.count=0,i}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function M(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>P.length&&P.push(e)}function L(e,t,n){return null==e?0:function e(t,n,r,i){var s=typeof t;"undefined"!==s&&"boolean"!==s||(t=null);var u=!1;if(null===t)u=!0;else switch(s){case"string":case"number":u=!0;break;case"object":switch(t.$$typeof){case o:case a:u=!0}}if(u)return r(i,t,""===n?"."+F(t,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(t))for(var c=0;c<t.length;c++){var l=n+F(s=t[c],c);u+=e(s,l,r,i)}else if(null===t||"object"!==typeof t?l=null:l="function"===typeof(l=g&&t[g]||t["@@iterator"])?l:null,"function"===typeof l)for(t=l.call(t),c=0;!(s=t.next()).done;)u+=e(s=s.value,l=n+F(s,c++),r,i);else if("object"===s)throw r=""+t,v(Error(31),"[object Object]"===r?"object with keys {"+Object.keys(t).join(", ")+"}":r,"");return u}
1(e,"",t,n)}function F(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function U(e,t){e.func.call(e.context,t,e.count++)}function q(e,t,n){var r=e.result,i=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?V(e,r,n,(function(e){return e})):null!=e&&(R(e)&&(e=function(e,t){return{$$typeof:o,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,i+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(O,"$&/")+"/")+n)),r.push(e))}function V(e,t,n,r,i){var o="";null!=n&&(o=(""+n).replace(O,"$&/")+"/"),L(e,q,t=x(t,o,r,i)),M(t)}function j(){var e=C.current;if(null===e)throw v(Error(321));return e}var B={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return V(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;L(e,U,t=x(null,null,t,n)),M(t)},count:function(e){return L(e,(function(){return null}),null)},toArray:function(e){var t=[];return V(e,t,null,(function(e){return e})),t},only:function(e){if(!R(e))throw v(Error(143));return e}},createRef:function(){return{current:null}},Component:w,PureComponent:T,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:h,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:l,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:f,render:e}},lazy:function(e){return{$$typeof:y,_ctor:e,_status:-1,_result:null}},memo:function(e,t){return{$$typeof:m,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return j().useCallback(e,t)},useContext:function(e,t){return j().useContext(e,t)},useEffect:function(e,t){return j().useEffect(e,t)},useImperativeHandle:function(e,t,n){return j().useImperativeHandle(e,t,n)},useDebugValue:function(){},useLayoutEffect:function(e,t){return j().useLayoutEffect(e,t)},useMemo:function(e,t){return j().useMemo(e,t)},useReducer:function(e,t,n){return j().useReducer(e,t,n)},useRef:function(e){return j().useRef(e)},useState:function(e){return j().useState(e)},Fragment:s,Profiler:c,StrictMode:u,Suspense:p,unstable_SuspenseList:d,createElement:D,cloneElement:function(e,t,n){if(null===e||void 0===e)throw v(Error(267),e);var i=void 0,a=r({},e.props),s=e.key,u=e.ref,c=e._owner;if(null!=t){void 0!==t.ref&&(u=t.ref,c=k.current),void 0!==t.key&&(s=""+t.key);var l=void 0;for(i in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)N.call(t,i)&&!A.hasOwnProperty(i)&&(a[i]=void 0===t[i]&&void 0!==l?l[i]:t[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:e.type,key:s,ref:u,props:a,_owner:c}},createFactory:function(e){var t=D.bind(null,e);return t.type=e,t},isValidElement:R,version:"16.9.0",unstable_withSuspenseConfig:function(e,t){var n=I.suspense;I.suspense=void 0===t?null:t;try{e()}finally{I.suspense=n}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:C,ReactCurrentBatchConfig:I,ReactCurrentOwner:k,IsSomeRendererActing:{current:!1},assign:r}},W={default:B},Q=W&&B||W;e.exports=Q.default||Q},function(e,t,n){"use strict";var r=n(2),i=n(6),o=n(13);function a(e){for(var t=e.message,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r]);return e.message="Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e}if(!r)throw a(Error(227));var s=null,u={};function c(){if(s)for(var e in u){var t=u[e],n=s.indexOf(e);if(!(-1<n))throw a(Error(96),e);if(!h[n]){if(!t.extractEvents)throw a(Error(97),e);for(var r in h[n]=t,n=t.eventTypes){var i=void 0,o=n[r],c=t,p=r;if(f.hasOwnProperty(p))throw a(Error(99),p);f[p]=o;var d=o.phasedRegistrationNames;if(d){for(i in d)d.hasOwnProperty(i)&&l(d[i],c,p);i=!0}else o.registrationName?(l(o.registrationName,c,p),i=!0):i=!1;if(!i)throw a(Error(98),r,e)}}}}function l(e,t,n){if(p[e])throw a(Error(100),e);p[e]=t,d[e]=t.eventTypes[n].dependencies}var h=[],f={},p={},d={};function m(e,t,n,r,i,o,a,s,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(l){this.onError(l)}}var y=!1,g=null,v=!1,b=null,_={onError:function(e){y=!0,g=e}};function w(e,t,n,r,i,o,a,s,u){y=!1,g=null,m.apply(_,arguments)}var E=null,T=null,S=null;
1function C(e,t,n){var r=e.type||"unknown-event";e.currentTarget=S(n),function(e,t,n,r,i,o,s,u,c){if(w.apply(this,arguments),y){if(!y)throw a(Error(198));var l=g;y=!1,g=null,v||(v=!0,b=l)}}(r,t,void 0,e),e.currentTarget=null}function I(e,t){if(null==t)throw a(Error(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function k(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var N=null;function A(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;r<t.length&&!e.isPropagationStopped();r++)C(e,t[r],n[r]);else t&&C(e,t,n);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function D(e){if(null!==e&&(N=I(N,e)),e=N,N=null,e){if(k(e,A),N)throw a(Error(95));if(v)throw e=b,v=!1,b=null,e}}var R={injectEventPluginOrder:function(e){if(s)throw a(Error(101));s=Array.prototype.slice.call(e),c()},injectEventPluginsByName:function(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var r=e[t];if(!u.hasOwnProperty(t)||u[t]!==r){if(u[t])throw a(Error(102),t);u[t]=r,n=!0}}n&&c()}};function O(e,t){var n=e.stateNode;if(!n)return null;var r=E(n);if(!r)return null;n=r[t];e:switch(t){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"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!==typeof n)throw a(Error(231),t,typeof n);return n}var P=Math.random().toString(36).slice(2),x="__reactInternalInstance$"+P,M="__reactEventHandlers$"+P;function L(e){if(e[x])return e[x];for(;!e[x];){if(!e.parentNode)return null;e=e.parentNode}return 5===(e=e[x]).tag||6===e.tag?e:null}function F(e){return!(e=e[x])||5!==e.tag&&6!==e.tag?null:e}function U(e){if(5===e.tag||6===e.tag)return e.stateNode;throw a(Error(33))}function q(e){return e[M]||null}function V(e){do{e=e.return}while(e&&5!==e.tag);return e||null}
vendor: 4,140 bytes, line 1
1function j(e,t,n){(t=O(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=I(n._dispatchListeners,t),n._dispatchInstances=I(n._dispatchInstances,e))}function B(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=V(t);for(t=n.length;0<t--;)j(n[t],"captured",e);for(t=0;t<n.length;t++)j(n[t],"bubbled",e)}}function W(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=O(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=I(n._dispatchListeners,t),n._dispatchInstances=I(n._dispatchInstances,e))}function Q(e){e&&e.dispatchConfig.registrationName&&W(e._targetInst,null,e)}function K(e){k(e,B)}var z=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement);function H(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var G={animationend:H("Animation","AnimationEnd"),animationiteration:H("Animation","AnimationIteration"),animationstart:H("Animation","AnimationStart"),transitionend:H("Transition","TransitionEnd")},Y={},X={};function J(e){if(Y[e])return Y[e];if(!G[e])return e;var t,n=G[e];for(t in n)if(n.hasOwnProperty(t)&&t in X)return Y[e]=n[t];return e}z&&(X=document.createElement("div").style,"AnimationEvent"in window||(delete G.animationend.animation,delete G.animationiteration.animation,delete G.animationstart.animation),"TransitionEvent"in window||delete G.transitionend.transition);var $=J("animationend"),Z=J("animationiteration"),ee=J("animationstart"),te=J("transitionend"),ne="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),re=null,ie=null,oe=null;function ae(){if(oe)return oe;var e,t,n=ie,r=n.length,i="value"in re?re.value:re.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===i[o-t];t++);return oe=i.slice(e,1<t?1-t:void 0)}function se(){return!0}function ue(){return!1}function ce(e,t,n,r){for(var i in this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface)e.hasOwnProperty(i)&&((t=e[i])?this[i]=t(n):"target"===i?this.target=r:this[i]=n[i]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?se:ue,this.isPropagationStopped=ue,this}function le(e,t,n,r){if(this.eventPool.length){var i=this.eventPool.pop();return this.call(i,e,t,n,r),i}return new this(e,t,n,r)}function he(e){if(!(e instanceof this))throw a(Error(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function fe(e){e.eventPool=[],e.getPooled=le,e.release=he}i(ce.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=se)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=se)},persist:function(){this.isPersistent=se},isPersistent:ue,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=ue,this._dispatchInstances=this._dispatchListeners=null}}),ce.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},ce.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var o=new t;return i(o,n.prototype),n.prototype=o,n.prototype.constructor=n,n.Interface=i({},r.Interface,e),n.extend=r.extend,fe(n),n},fe(ce);var pe=ce.extend({data:null}),de=ce.extend({data:null}),me=[9,13,27,32],ye=z&&"CompositionEvent"in window,ge=null;z&&"documentMode"in document&&(ge=document.documentMode);var ve=z&&"TextEvent"in window&&!ge,be=z&&(!ye||ge&&8<ge&&11>
vendor: 7,157 bytes, line 1
1=ge),_e=String.fromCharCode(32),we={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(" ")}},Ee=!1;function Te(e,t){switch(e){case"keyup":return-1!==me.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Se(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Ce=!1;var Ie={eventTypes:we,extractEvents:function(e,t,n,r){var i=void 0,o=void 0;if(ye)e:{switch(e){case"compositionstart":i=we.compositionStart;break e;case"compositionend":i=we.compositionEnd;break e;case"compositionupdate":i=we.compositionUpdate;break e}i=void 0}else Ce?Te(e,n)&&(i=we.compositionEnd):"keydown"===e&&229===n.keyCode&&(i=we.compositionStart);return i?(be&&"ko"!==n.locale&&(Ce||i!==we.compositionStart?i===we.compositionEnd&&Ce&&(o=ae()):(ie="value"in(re=r)?re.value:re.textContent,Ce=!0)),i=pe.getPooled(i,t,n,r),o?i.data=o:null!==(o=Se(n))&&(i.data=o),K(i),o=i):o=null,(e=ve?function(e,t){switch(e){case"compositionend":return Se(t);case"keypress":return 32!==t.which?null:(Ee=!0,_e);case"textInput":return(e=t.data)===_e&&Ee?null:e;default:return null}}(e,n):function(e,t){if(Ce)return"compositionend"===e||!ye&&Te(e,t)?(e=ae(),oe=ie=re=null,Ce=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return be&&"ko"!==t.locale?null:t.data;default:return null}}(e,n))?((t=de.getPooled(we.beforeInput,t,n,r)).data=e,K(t)):t=null,null===o?t:null===t?o:[o,t]}},ke=null,Ne=null,Ae=null;function De(e){if(e=T(e)){if("function"!==typeof ke)throw a(Error(280));var t=E(e.stateNode);ke(e.stateNode,e.type,t)}}function Re(e){Ne?Ae?Ae.push(e):Ae=[e]:Ne=e}function Oe(){if(Ne){var e=Ne,t=Ae;if(Ae=Ne=null,De(e),t)for(e=0;e<t.length;e++)De(t[e])}}function Pe(e,t){return e(t)}function xe(e,t,n,r){return e(t,n,r)}function Me(){}var Le=Pe,Fe=!1;function Ue(){null===Ne&&null===Ae||(Me(),Oe())}var qe={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 Ve(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!qe[e.type]:"textarea"===t}function je(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function Be(e){if(!z)return!1;var t=(e="on"+e)in document;return t||((t=document.createElement("div")).setAttribute(e,"return;"),t="function"===typeof t[e]),t}function We(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Qe(e){e._valueTracker||(e._valueTracker=function(e){var t=We(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Ke(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=We(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}var ze=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;ze.hasOwnProperty("ReactCurrentDispatcher")||(ze.ReactCurrentDispatcher={current:null}),ze.hasOwnProperty("ReactCurrentBatchConfig")||(ze.ReactCurrentBatchConfig={suspense:null});var He=/^(.*)[\\\/]/,Ge="function"===typeof Symbol&&Symbol.for,Ye=Ge?Symbol.for("react.element"):60103,Xe=Ge?Symbol.for("react.portal"):60106,Je=Ge?Symbol.for("react.fragment"):60107,$e=Ge?Symbol.for("react.strict_mode"):60108,Ze=Ge?Symbol.for("react.profiler"):60114,et=Ge?Symbol.for("react.provider"):60109,tt=Ge?Symbol.for("react.context"):60110,nt=Ge?Symbol.for("react.concurrent_mode"):60111,rt=Ge?Symbol.for("react.forward_ref"):60112,it=Ge?Symbol.for("react.suspense"):60113,ot=Ge?Symbol.for("react.suspense_list"):60120,at=Ge?Symbol.for("react.memo"):60115,st=Ge?Symbol.for("react.lazy"):60116;Ge&&Symbol.for("react.fundamental"),Ge&&Symbol.for("react.responder");var ut="function"===typeof Symbol&&Symbol.iterator;function ct(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=ut&&e[ut]||e["@@iterator"])?e:null}function lt(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case Je:return"Fragment";case Xe:return"Portal";case Ze:return"Profiler";case $e:return"StrictMode";case it:return"Suspense";case ot:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case tt:return"Context.Consumer";case et:return"Context.Provider";case rt:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case at:return lt(e.type);case st:if(e=1===e._status?e._result:null)return lt(e)}return null}function ht(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var n="";break e;default:var r=e._debugOwner,i=e._debugSource,o=lt(e.type);n=null,r&&(n=lt(r.type)),r=o,o="",i?o=" (at "+i.fileName.replace(He,"")+":"+i.lineNumber+")":n&&(o=" (created by "+n+")"),n="\n    in "+(r||"Unknown")+o}t+=n,e=e.return}while(e);return t}var ft=/^[: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]*$/,pt=Object.prototype.hasOwnProperty,dt={},mt={};function yt(e,t,n,r,i,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o}var gt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){gt[e]=new yt(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];gt[t]=new yt(t,1,!1,e[1],null,!1)}
vendor: 4,428 bytes, line 1
1)),["contentEditable","draggable","spellCheck","value"].forEach((function(e){gt[e]=new yt(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){gt[e]=new yt(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){gt[e]=new yt(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){gt[e]=new yt(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){gt[e]=new yt(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){gt[e]=new yt(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){gt[e]=new yt(e,5,!1,e.toLowerCase(),null,!1)}));var vt=/[\-:]([a-z])/g;function bt(e){return e[1].toUpperCase()}function _t(e,t,n,r){var i=gt.hasOwnProperty(t)?gt[t]:null;(null!==i?0===i.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null===t||"undefined"===typeof t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,i,r)&&(n=null),r||null===i?function(e){return!!pt.call(mt,e)||!pt.call(dt,e)&&(ft.test(e)?mt[e]=!0:(dt[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}function wt(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function Et(e,t){var n=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function Tt(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=wt(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function St(e,t){null!=(t=t.checked)&&_t(e,"checked",t,!1)}function Ct(e,t){St(e,t);var n=wt(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?kt(e,t.type,n):t.hasOwnProperty("defaultValue")&&kt(e,t.type,wt(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function It(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function kt(e,t,n){"number"===t&&e.ownerDocument.activeElement===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.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
1-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(e){var t=e.replace(vt,bt);gt[t]=new yt(t,1,!1,e,null,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(vt,bt);gt[t]=new yt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(vt,bt);gt[t]=new yt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)})),["tabIndex","crossOrigin"].forEach((function(e){gt[e]=new yt(e,1,!1,e.toLowerCase(),null,!1)})),gt.xlinkHref=new yt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach((function(e){gt[e]=new yt(e,1,!1,e.toLowerCase(),null,!0)}));var Nt={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function At(e,t,n){return(e=ce.getPooled(Nt.change,e,t,n)).type="change",Re(n),K(e),e}var Dt=null,Rt=null;function Ot(e){D(e)}function Pt(e){if(Ke(U(e)))return e}function xt(e,t){if("change"===e)return t}var Mt=!1;function Lt(){Dt&&(Dt.detachEvent("onpropertychange",Ft),Rt=Dt=null)}function Ft(e){if("value"===e.propertyName&&Pt(Rt))if(e=At(Rt,e,je(e)),Fe)D(e);else{Fe=!0;try{Pe(Ot,e)}finally{Fe=!1,Ue()}}}function Ut(e,t,n){"focus"===e?(Lt(),Rt=n,(Dt=t).attachEvent("onpropertychange",Ft)):"blur"===e&&Lt()}function qt(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Pt(Rt)}function Vt(e,t){if("click"===e)return Pt(t)}function jt(e,t){if("input"===e||"change"===e)return Pt(t)}z&&(Mt=Be("input")&&(!document.documentMode||9<document.documentMode));var Bt={eventTypes:Nt,_isInputEventSupported:Mt,extractEvents:function(e,t,n,r){var i=t?U(t):window,o=void 0,a=void 0,s=i.nodeName&&i.nodeName.toLowerCase();if("select"===s||"input"===s&&"file"===i.type?o=xt:Ve(i)?Mt?o=jt:(o=qt,a=Ut):(s=i.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(o=Vt),o&&(o=o(e,t)))return At(o,n,r);a&&a(e,i,t),"blur"===e&&(e=i._wrapperState)&&e.controlled&&"number"===i.type&&kt(i,"number",i.value)}},Wt=ce.extend({view:null,detail:null}),Qt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kt(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Qt[e])&&!!t[e]}function zt(){return Kt}var Ht=0,Gt=0,Yt=!1,Xt=!1,Jt=Wt.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:zt,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=Ht;return Ht=e.screenX,Yt?"mousemove"===e.type?e.screenX-t:0:(Yt=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=Gt;return Gt=e.screenY,Xt?"mousemove"===e.type?e.screenY-t:0:(Xt=!0,0)}}),$t=Jt.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),Zt={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},en={eventTypes:Zt,extractEvents:function(e,t,n,r){var i="mouseover"===e||"pointerover"===e,o="mouseout"===e||"pointerout"===e;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=t,t=(t=n.relatedTarget||n.toElement)?L(t):null):o=null,o===t)return null;var a=void 0,s=void 0,u=void 0,c=void 0;"mouseout"===e||"mouseover"===e?(a=Jt,s=Zt.mouseLeave,u=Zt.mouseEnter,c="mouse"):"pointerout"!==e&&"pointerover"!==e||(a=$t,s=Zt.pointerLeave,u=Zt.pointerEnter,c="pointer");var l=null==o?i:U(o);if(i=null==t?i:U(t),(e=a.getPooled(s,o,n,r)).type=c+"leave",e.target=l,e.relatedTarget=i,(n=a.getPooled(u,t,n,r)).type=c+"enter",n.target=i,n.relatedTarget=l,r=t,o&&r)e:{for(i=r,c=0,a=t=o;a;a=V(a))c++;for(a=0,u=i;u;u=V(u))a++;for(;0<c-a;)t=V(t),c--;for(;0<a-c;)i=V(i),a--;for(;c--;){if(t===i||t===i.alternate)break e;t=V(t),i=V(i)}t=null}else t=null;for(i=t,t=[];o&&o!==i&&(null===(c=o.alternate)||c!==i);)t.push(o),o=V(o);for(o=[];r&&r!==i&&(null===(c=r.alternate)||c!==i);)o.push(r),r=V(r);for(r=0;r<t.length;r++)W(t[r],"bubbled",e);for(r=o.length;0<r--;)W(o[r],"captured",n);return[e,n]}};function tn(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t}var nn=Object.prototype.hasOwnProperty;function rn(e,t){if(tn(e,t))return!0;
1if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!nn.call(t,n[r])||!tn(e[n[r]],t[n[r]]))return!1;return!0}function on(e,t){return{responder:e,props:t}}function an(e){var t=e;if(e.alternate)for(;t.return;)t=t.return;else{if(0!==(2&t.effectTag))return 1;for(;t.return;)if(0!==(2&(t=t.return).effectTag))return 1}return 3===t.tag?2:3}function sn(e){if(2!==an(e))throw a(Error(188))}function un(e){if(!(e=function(e){var t=e.alternate;if(!t){if(3===(t=an(e)))throw a(Error(188));return 1===t?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return sn(i),e;if(o===r)return sn(i),t;o=o.sibling}throw a(Error(188))}if(n.return!==r.return)n=i,r=o;else{for(var s=!1,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}if(!s)throw a(Error(189))}}if(n.alternate!==r)throw a(Error(190))}if(3!==n.tag)throw a(Error(188));return n.stateNode.current===n?e:t}(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}new Map,new Map,new Set,new Map;var cn=ce.extend({animationName:null,elapsedTime:null,pseudoElement:null}),ln=ce.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),hn=Wt.extend({relatedTarget:null});function fn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}for(var pn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dn={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"},mn=Wt.extend({key:function(e){if(e.key){var t=pn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=fn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?dn[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:zt,charCode:function(e){return"keypress"===e.type?fn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?fn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),yn=Jt.extend({dataTransfer:null}),gn=Wt.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:zt}),vn=ce.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),bn=Jt.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),_n=[["blur","blur",0],["cancel","cancel",0],["click","click",0],["close","close",0],["contextmenu","contextMenu",0],["copy","copy",0],["cut","cut",0],["auxclick","auxClick",0],["dblclick","doubleClick",0],["dragend","dragEnd",0],["dragstart","dragStart",0],["drop","drop",0],["focus","focus",0],["input","input",0],["invalid","invalid",0],["keydown","keyDown",0],["keypress","keyPress",0],["keyup","keyUp",0],["mousedown","mouseDown",0],["mouseup","mouseUp",0],["paste","paste",0],["pause","pause",0],["play","play",0],["pointercancel","pointerCancel",0],["pointerdown","pointerDown",0],["pointerup","pointerUp",0],["ratechange","rateChange",0],["reset","reset",0],["seeked","seeked",0],["submit","submit",0],["touchcancel","touchCancel",0],["touchend","touchEnd",0],["touchstart","touchStart",0],["volumechange","volumeChange",0],["drag","drag",1],["dragenter","dragEnter",1],["dragexit","dragExit",1],["dragleave","dragLeave",1],["dragover","dragOver",1],["mousemove","mouseMove",1],["mouseout","mouseOut",1],["mouseover","mouseOver",1],["pointermove","pointerMove",1],["pointerout","pointerOut",1],["pointerover","pointerOver",1],["scroll","scroll",1],["toggle","toggle",1],["touchmove","touchMove",1],["wheel","wheel",1],["abort","abort",2],[$,"animationEnd",2],[Z,"animationIteration",2],[ee,"animationStart",2],["canplay","canPlay",2],["canplaythrough","canPlayThrough",2],["durationchange","durationChange",2],["emptied","emptied",2],["encrypted","encrypted",2],["ended","ended",2],["error","error",2],["gotpointercapture","gotPointerCapture",2],["load","load",2],["loadeddata","loadedData",2],["loadedmetadata","loadedMetadata",2],["loadstart","loadStart",2],["lostpointercapture","lostPointerCapture",2],["playing","playing",2],["progress","progress",2],["seeking","seeking",2],["stalled","stalled",2],["suspend","suspend",2],["timeupdate","timeUpdate",2],[te,"transitionEnd",2],["waiting","waiting",2]],wn={},En={},Tn=0;Tn<_n.length;Tn++){var Sn=_n[Tn],Cn=Sn[0],In=Sn[1],kn=Sn[2],Nn="on"+(In[0].toUpperCase()+In.slice(1)),An={phasedReg
1istrationNames:{bubbled:Nn,captured:Nn+"Capture"},dependencies:[Cn],eventPriority:kn};wn[In]=An,En[Cn]=An}var Dn={eventTypes:wn,getEventPriority:function(e){return void 0!==(e=En[e])?e.eventPriority:2},extractEvents:function(e,t,n,r){var i=En[e];if(!i)return null;switch(e){case"keypress":if(0===fn(n))return null;case"keydown":case"keyup":e=mn;break;case"blur":case"focus":e=hn;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":e=Jt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=yn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=gn;break;case $:case Z:case ee:e=cn;break;case te:e=vn;break;case"scroll":e=Wt;break;case"wheel":e=bn;break;case"copy":case"cut":case"paste":e=ln;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=$t;break;default:e=ce}return K(t=e.getPooled(i,t,n,r)),t}},Rn=Dn.getEventPriority,On=[];function Pn(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r;for(r=n;r.return;)r=r.return;if(!(r=3!==r.tag?null:r.stateNode.containerInfo))break;e.ancestors.push(n),n=L(r)}while(n);for(n=0;n<e.ancestors.length;n++){t=e.ancestors[n];var i=je(e.nativeEvent);r=e.topLevelType;for(var o=e.nativeEvent,a=null,s=0;s<h.length;s++){var u=h[s];u&&(u=u.extractEvents(r,t,o,i))&&(a=I(a,u))}D(a)}}var xn=!0;function Mn(e,t){Ln(t,e,!1)}function Ln(e,t,n){switch(Rn(t)){case 0:var r=Fn.bind(null,t,1);break;case 1:r=Un.bind(null,t,1);break;default:r=qn.bind(null,t,1)}n?e.addEventListener(t,r,!0):e.addEventListener(t,r,!1)}function Fn(e,t,n){Fe||Me();var r=qn,i=Fe;Fe=!0;try{xe(r,e,t,n)}finally{(Fe=i)||Ue()}}function Un(e,t,n){qn(e,t,n)}function qn(e,t,n){if(xn){if(null===(t=L(t=je(n)))||"number"!==typeof t.tag||2===an(t)||(t=null),On.length){var r=On.pop();r.topLevelType=e,r.nativeEvent=n,r.targetInst=t,e=r}else e={topLevelType:e,nativeEvent:n,targetInst:t,ancestors:[]};try{if(n=e,Fe)Pn(n);else{Fe=!0;try{Le(Pn,n,void 0)}finally{Fe=!1,Ue()}}}finally{e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>On.length&&On.push(e)}}}var Vn=new("function"===typeof WeakMap?WeakMap:Map);function jn(e){var t=Vn.get(e);return void 0===t&&(t=new Set,Vn.set(e,t)),t}function Bn(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Wn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Qn(e,t){var n,r=Wn(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Wn(r)}}function Kn(){for(var e=window,t=Bn();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Bn((e=t.contentWindow).document)}return t}function zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var Hn=z&&"documentMode"in document&&11>=document.documentMode,Gn={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Yn=null,Xn=null,Jn=null,$n=!1;function Zn(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return $n||null==Yn||Yn!==Bn(n)?null:("selectionStart"in(n=Yn)&&zn(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},Jn&&rn(Jn,n)?null:(Jn=n,(e=ce.getPooled(Gn.select,Xn,e,t)).type="select",e.target=Yn,K(e),e))}var er={eventTypes:Gn,extractEvents:function(e,t,n,r){var i,o=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(i=!o)){e:{o=jn(o),i=d.onSelect;for(var a=0;a<i.length;a++)if(!o.has(i[a])){o=!1;break e}o=!0}i=!o}if(i)return null;switch(o=t?U(t):window,e){case"focus":(Ve(o)||"true"===o.contentEditable)&&(Yn=o,Xn=t,Jn=null);break;case"blur":Jn=Xn=Yn=null;break;case"mousedown":$n=!0;break;case"contextmenu":case"mouseup":case"dragend":return $n=!1,Zn(n,r);case"selectionchange":if(Hn)break;case"keydown":case"keyup":return Zn(n,r)}return null}};function tr(e,t){return e=i({children:void 0},t),(t=function(e){var t="";
1return r.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function nr(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+wt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function rr(e,t){if(null!=t.dangerouslySetInnerHTML)throw a(Error(91));return i({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ir(e,t){var n=t.value;if(null==n){if(n=t.defaultValue,null!=(t=t.children)){if(null!=n)throw a(Error(92));if(Array.isArray(t)){if(!(1>=t.length))throw a(Error(93));t=t[0]}n=t}null==n&&(n="")}e._wrapperState={initialValue:wt(n)}}function or(e,t){var n=wt(t.value),r=wt(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ar(e){var t=e.textContent;t===e._wrapperState.initialValue&&(e.value=t)}R.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),E=q,T=F,S=U,R.injectEventPluginsByName({SimpleEventPlugin:Dn,EnterLeaveEventPlugin:en,ChangeEventPlugin:Bt,SelectEventPlugin:er,BeforeInputEventPlugin:Ie});var sr={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function ur(e){switch(e){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 cr(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?ur(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var lr=void 0,hr=function(e){return"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction((function(){return e(t,n)}))}:e}((function(e,t){if(e.namespaceURI!==sr.svg||"innerHTML"in e)e.innerHTML=t;else{for((lr=lr||document.createElement("div")).innerHTML="<svg>"+t+"</svg>",t=lr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}));function fr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var pr={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},dr=["Webkit","ms","Moz","O"];function mr(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||pr.hasOwnProperty(e)&&pr[e]?(""+t).trim():t+"px"}function yr(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=mr(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(pr).forEach((function(e){dr.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pr[t]=pr[e]}))}));var gr=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 vr(e,t){if(t){if(gr[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw a(Error(137),e,"");if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw a(Error(60));if(!("object"===typeof t.dangerouslySetInnerHTML&&"__html"in t.dangerouslySetInnerHTML))throw a(Error(61))}if(null!=t.style&&"object"!==typeof t.style)throw a(Error(62),"")}}function br(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){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 _r(e,t){var n=jn(e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument);t=d[t];for(var r=0;r<t.length;r++){var i=t[r];
1if(!n.has(i)){switch(i){case"scroll":Ln(e,"scroll",!0);break;case"focus":case"blur":Ln(e,"focus",!0),Ln(e,"blur",!0),n.add("blur"),n.add("focus");break;case"cancel":case"close":Be(i)&&Ln(e,i,!0);break;case"invalid":case"submit":case"reset":break;default:-1===ne.indexOf(i)&&Mn(i,e)}n.add(i)}}}function wr(){}var Er=null,Tr=null;function Sr(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Cr(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Ir="function"===typeof setTimeout?setTimeout:void 0,kr="function"===typeof clearTimeout?clearTimeout:void 0;function Nr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}new Set;var Ar=[],Dr=-1;function Rr(e){0>Dr||(e.current=Ar[Dr],Ar[Dr]=null,Dr--)}function Or(e,t){Ar[++Dr]=e.current,e.current=t}var Pr={},xr={current:Pr},Mr={current:!1},Lr=Pr;function Fr(e,t){var n=e.type.contextTypes;if(!n)return Pr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ur(e){return null!==(e=e.childContextTypes)&&void 0!==e}function qr(e){Rr(Mr),Rr(xr)}function Vr(e){Rr(Mr),Rr(xr)}function jr(e,t,n){if(xr.current!==Pr)throw a(Error(168));Or(xr,t),Or(Mr,n)}function Br(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in e))throw a(Error(108),lt(t)||"Unknown",o);return i({},n,r)}function Wr(e){var t=e.stateNode;return t=t&&t.__reactInternalMemoizedMergedChildContext||Pr,Lr=xr.current,Or(xr,t),Or(Mr,Mr.current),!0}function Qr(e,t,n){var r=e.stateNode;if(!r)throw a(Error(169));n?(t=Br(e,t,Lr),r.__reactInternalMemoizedMergedChildContext=t,Rr(Mr),Rr(xr),Or(xr,t)):Rr(Mr),Or(Mr,n)}var Kr=o.unstable_runWithPriority,zr=o.unstable_scheduleCallback,Hr=o.unstable_cancelCallback,Gr=o.unstable_shouldYield,Yr=o.unstable_requestPaint,Xr=o.unstable_now,Jr=o.unstable_getCurrentPriorityLevel,$r=o.unstable_ImmediatePriority,Zr=o.unstable_UserBlockingPriority,ei=o.unstable_NormalPriority,ti=o.unstable_LowPriority,ni=o.unstable_IdlePriority,ri={},ii=void 0!==Yr?Yr:function(){},oi=null,ai=null,si=!1,ui=Xr(),ci=1e4>ui?Xr:function(){return Xr()-ui};function li(){switch(Jr()){case $r:return 99;case Zr:return 98;case ei:return 97;case ti:return 96;case ni:return 95;default:throw a(Error(332))}}function hi(e){switch(e){case 99:return $r;case 98:return Zr;case 97:return ei;case 96:return ti;case 95:return ni;default:throw a(Error(332))}}function fi(e,t){return e=hi(e),Kr(e,t)}function pi(e,t,n){return e=hi(e),zr(e,t,n)}function di(e){return null===oi?(oi=[e],ai=zr($r,yi)):oi.push(e),ri}function mi(){null!==ai&&Hr(ai),yi()}function yi(){if(!si&&null!==oi){si=!0;var e=0;try{var t=oi;fi(99,(function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}})),oi=null}catch(n){throw null!==oi&&(oi=oi.slice(e+1)),zr($r,mi),n}finally{si=!1}}}function gi(e,t){return 1073741823===t?99:1===t?95:0>=(e=10*(1073741821-t)-10*(1073741821-e))?99:250>=e?98:5250>=e?97:95}function vi(e,t){if(e&&e.defaultProps)for(var n in t=i({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}var bi={current:null},_i=null,wi=null,Ei=null;function Ti(){Ei=wi=_i=null}function Si(e,t){var n=e.type._context;Or(bi,n._currentValue),n._currentValue=t}function Ci(e){var t=bi.current;Rr(bi),e.type._context._currentValue=t}function Ii(e,t){for(;null!==e;){var n=e.alternate;if(e.childExpirationTime<t)e.childExpirationTime=t,null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t);else{if(!(null!==n&&n.childExpirationTime<t))break;n.childExpirationTime=t}e=e.return}}function ki(e,t){_i=e,Ei=wi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(e.expirationTime>=t&&(ha=!0),e.firstContext=null)}function Ni(e,t){if(Ei!==e&&!1!==t&&0!==t)if("number"===typeof t&&1073741823!==t||(Ei=e,t=1073741823),t={context:e,observedBits:t,next:null},null===wi){if(null===_i)throw a(Error(308));wi=t,_i.dependencies={expirationTime:0,firstContext:t,responders:null}}else wi=wi.next=t;return e._currentValue}var Ai=!1;function Di(e){return{baseState:e,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Ri(e){return{baseState:e.baseState,firstUpdate:e.firstUpdate,lastUpdate:e.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Oi(e,t){return{expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function Pi(e,t){null===e.lastUpdate?e.firstUpdate=e.lastUpdate=t:(e.lastUpdate.next=t,e.lastUpdate=t)}function xi(e,t){var n=e.alternate;if(null===n){var r=e.updateQueue,i=null;null===r&&(r=e.updateQueue=Di(e.memoizedState))}else r=e.updateQueue,i=n.updateQueue,null===r?null===i?(r=e.updateQueue=Di(e.memoizedState),i=n.updateQueue=Di(n.memoizedState)):r=e.updateQueue=Ri(i):null===i&&(i=n.updateQueue=Ri(r));null===i||r===i?Pi(r,t):null===r.lastUpdate||null===i.lastUpdate?(Pi(r,t),Pi(i,t)):(Pi(r,t),i.lastUpdate=t)}function Mi(e,t){var n=e.updateQueue;null===(n=null===n?e.updateQueue=Di(e.memoizedState):Li(e,n)).lastCapturedUpdate?n.firstCapturedUpdate=n.lastCapturedUpdate=t:(n.lastCapturedUpdate.next=t,n.lastCapturedUpdate=t)}function Li(e,t){var n=e.alternate;return null!==n&&t===n.updateQueue&&(t=e.updateQueue=Ri(t)),t}function Fi(e,t,n,r,o,a){switch(n.tag){case 1:return"function"===typeof(e=n.payload)?e.call(a,r,o):e;case 3:e.effectTag=-2049&e.effectTag|64;case 0:if(null===(o="function"===typeof(e=n.payload)?e.call(a,r,o):e)||void 0===o)break;return i({},r,o);case 2:Ai=!0}return r}function Ui(e,t,n,r,i){Ai=!1;for(var o=(t=Li(e,t)).baseState,a=null,s=0,u=t.firstUpdate,c=o;null!==u;){var l=u.expirationTime;l<i?(null===a&&(a=u,o=c),s<l&&(s=l)):(Bs(l,u.suspenseConfig),c=Fi(e,0,u,c,n,r),null!==u.callback&&(e.effectTag|=32,u.nextEffect=null,null===t.lastEffect?t.firstEffect=t.lastEffect=u:(t.lastEffect.nextEffect=u,t.lastEffect=u))),u=u.next}for(l=null,u=t.firstCapturedUpdate;null!==u;){var h=u.expirationTime;h<i?(null===l&&(l=u,null===a&&(o=c)),s<h&&(s=h)):(c=Fi(e,0,u,c,n,r),null!==u.callback&&(e.effectTag|=32,u.nextEffect=null,null===t.lastCapturedEffect?t.firstCapturedEffect=t.lastCapturedEffect=u:(t.lastCapturedEffect.nextEffect=u,t.last
vendor: 6,370 bytes, line 1
1CapturedEffect=u))),u=u.next}null===a&&(t.lastUpdate=null),null===l?t.lastCapturedUpdate=null:e.effectTag|=32,null===a&&null===l&&(o=c),t.baseState=o,t.firstUpdate=a,t.firstCapturedUpdate=l,e.expirationTime=s,e.memoizedState=c}function qi(e,t,n){null!==t.firstCapturedUpdate&&(null!==t.lastUpdate&&(t.lastUpdate.next=t.firstCapturedUpdate,t.lastUpdate=t.lastCapturedUpdate),t.firstCapturedUpdate=t.lastCapturedUpdate=null),Vi(t.firstEffect,n),t.firstEffect=t.lastEffect=null,Vi(t.firstCapturedEffect,n),t.firstCapturedEffect=t.lastCapturedEffect=null}function Vi(e,t){for(;null!==e;){var n=e.callback;if(null!==n){e.callback=null;var r=t;if("function"!==typeof n)throw a(Error(191),n);n.call(r)}e=e.nextEffect}}var ji=ze.ReactCurrentBatchConfig,Bi=(new r.Component).refs;function Wi(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:i({},t,n),e.memoizedState=n,null!==(r=e.updateQueue)&&0===e.expirationTime&&(r.baseState=n)}var Qi={isMounted:function(e){return!!(e=e._reactInternalFiber)&&2===an(e)},enqueueSetState:function(e,t,n){e=e._reactInternalFiber;var r=As(),i=ji.suspense;(i=Oi(r=Ds(r,e,i),i)).payload=t,void 0!==n&&null!==n&&(i.callback=n),xi(e,i),Os(e,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternalFiber;var r=As(),i=ji.suspense;(i=Oi(r=Ds(r,e,i),i)).tag=1,i.payload=t,void 0!==n&&null!==n&&(i.callback=n),xi(e,i),Os(e,r)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var n=As(),r=ji.suspense;(r=Oi(n=Ds(n,e,r),r)).tag=2,void 0!==t&&null!==t&&(r.callback=t),xi(e,r),Os(e,n)}};function Ki(e,t,n,r,i,o,a){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!rn(n,r)||!rn(i,o))}function zi(e,t,n){var r=!1,i=Pr,o=t.contextType;return"object"===typeof o&&null!==o?o=Ni(o):(i=Ur(t)?Lr:xr.current,o=(r=null!==(r=t.contextTypes)&&void 0!==r)?Fr(e,i):Pr),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=Qi,e.stateNode=t,t._reactInternalFiber=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function Hi(e,t,n,r){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Qi.enqueueReplaceState(t,t.state,null)}function Gi(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs=Bi;var o=t.contextType;"object"===typeof o&&null!==o?i.context=Ni(o):(o=Ur(t)?Lr:xr.current,i.context=Fr(e,o)),null!==(o=e.updateQueue)&&(Ui(e,o,n,i,r),i.state=e.memoizedState),"function"===typeof(o=t.getDerivedStateFromProps)&&(Wi(e,t,o,n),i.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(t=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&Qi.enqueueReplaceState(i,i.state,null),null!==(o=e.updateQueue)&&(Ui(e,o,n,i,r),i.state=e.memoizedState)),"function"===typeof i.componentDidMount&&(e.effectTag|=4)}var Yi=Array.isArray;function Xi(e,t,n){if(null!==(e=n.ref)&&"function"!==typeof e&&"object"!==typeof e){if(n._owner){n=n._owner;var r=void 0;if(n){if(1!==n.tag)throw a(Error(309));r=n.stateNode}if(!r)throw a(Error(147),e);var i=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===i?t.ref:((t=function(e){var t=r.refs;t===Bi&&(t=r.refs={}),null===e?delete t[i]:t[i]=e})._stringRef=i,t)}if("string"!==typeof e)throw a(Error(284));if(!n._owner)throw a(Error(290),e)}return e}function Ji(e,t){if("textarea"!==e.type)throw a(Error(31),"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t,"")}function $i(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t,n){return(e=ou(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.effectTag=2,n):r:(t.effectTag=2,n):n}function s(t){return e&&null===t.alternate&&(t.effectTag=2),t}function u(e,t,n,r){return null===t||6!==t.tag?((t=uu(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function c(e,t,n,r){return null!==t&&t.elementType===n.type?((r=i(t,n.props)).ref=Xi(e,t,n),r.return=e,r):((r=au(n.type,n.key,n.props,null,e.mode,r)).ref=Xi(e,t,n),r.return=e,r)}function l(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=cu(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function h(e,t,n,r,o){return null===t||7!==t.tag?((t=su(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function f(e,t,n){if("string"===typeof t||"number"===typeof t)return(t=uu(""+t,e.mode,n)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case Ye:return(n=au(t.type,t.key,t.props,null,e.mode,n)).ref=Xi(e,null,t),n.return=e,n;case Xe:return(t=cu(t,e.mode,n)).return=e,t}if(Yi(t)||ct(t))return(t=su(t,e.mode,n,null)).return=e,t;Ji(e,t)}return null}function p(e,t,n,r){var i=null!==t?t.key:null;if("string"===typeof n||"number"===typeof n)return null!==i?null:u(e,t,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case Ye:return n.key===i?n.type===Je?h(e,t,n.props.children,r,i):c(e,t,n,r):null;case Xe:return n.key===i?l(e,t,n,r):null}if(Yi(n)||ct(n))return null!==i?null:h(e,t,n,r,null);Ji(e,n)}return null}function d(e,t,n,r,i){if("string"===typeof r||"number"===typeof r)return u(t,e=e.get(n)||null,""+r,i);if("object"===typeof r&&null!==r){switch(r.$$typeof){case Ye:return e=e.get(null===r.key?n:r.key)||null,r.type===Je?h(t,e,r.props.children,i,r.key):c(t,e,r,i);case Xe:return l(t,e=e.get(null===r.key?n:r.key)||null,r,i)}if(Yi(r)||ct(r))return h(t,e=e.get(n)||null,r,i,null);Ji(t,r)}return null}function m(i,a,s,u){for(var c=null,l=null,h=a,m=a=0,y=null;null!==h&&m<s.length;m++){h.index>m?(y=h,h=null):y=h.sibling;var g=p(i,h,s[m],u);
1if(null===g){null===h&&(h=y);break}e&&h&&null===g.alternate&&t(i,h),a=o(g,a,m),null===l?c=g:l.sibling=g,l=g,h=y}if(m===s.length)return n(i,h),c;if(null===h){for(;m<s.length;m++)null!==(h=f(i,s[m],u))&&(a=o(h,a,m),null===l?c=h:l.sibling=h,l=h);return c}for(h=r(i,h);m<s.length;m++)null!==(y=d(h,i,m,s[m],u))&&(e&&null!==y.alternate&&h.delete(null===y.key?m:y.key),a=o(y,a,m),null===l?c=y:l.sibling=y,l=y);return e&&h.forEach((function(e){return t(i,e)})),c}function y(i,s,u,c){var l=ct(u);if("function"!==typeof l)throw a(Error(150));if(null==(u=l.call(u)))throw a(Error(151));for(var h=l=null,m=s,y=s=0,g=null,v=u.next();null!==m&&!v.done;y++,v=u.next()){m.index>y?(g=m,m=null):g=m.sibling;var b=p(i,m,v.value,c);if(null===b){null===m&&(m=g);break}e&&m&&null===b.alternate&&t(i,m),s=o(b,s,y),null===h?l=b:h.sibling=b,h=b,m=g}if(v.done)return n(i,m),l;if(null===m){for(;!v.done;y++,v=u.next())null!==(v=f(i,v.value,c))&&(s=o(v,s,y),null===h?l=v:h.sibling=v,h=v);return l}for(m=r(i,m);!v.done;y++,v=u.next())null!==(v=d(m,i,y,v.value,c))&&(e&&null!==v.alternate&&m.delete(null===v.key?y:v.key),s=o(v,s,y),null===h?l=v:h.sibling=v,h=v);return e&&m.forEach((function(e){return t(i,e)})),l}return function(e,r,o,u){var c="object"===typeof o&&null!==o&&o.type===Je&&null===o.key;c&&(o=o.props.children);var l="object"===typeof o&&null!==o;if(l)switch(o.$$typeof){case Ye:e:{for(l=o.key,c=r;null!==c;){if(c.key===l){if(7===c.tag?o.type===Je:c.elementType===o.type){n(e,c.sibling),(r=i(c,o.type===Je?o.props.children:o.props)).ref=Xi(e,c,o),r.return=e,e=r;break e}n(e,c);break}t(e,c),c=c.sibling}o.type===Je?((r=su(o.props.children,e.mode,u,o.key)).return=e,e=r):((u=au(o.type,o.key,o.props,null,e.mode,u)).ref=Xi(e,r,o),u.return=e,e=u)}return s(e);case Xe:e:{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(e,r.sibling),(r=i(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=cu(o,e.mode,u)).return=e,e=r}return s(e)}if("string"===typeof o||"number"===typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,o)).return=e,e=r):(n(e,r),(r=uu(o,e.mode,u)).return=e,e=r),s(e);
1if(Yi(o))return m(e,r,o,u);if(ct(o))return y(e,r,o,u);if(l&&Ji(e,o),"undefined"===typeof o&&!c)switch(e.tag){case 1:case 0:throw e=e.type,a(Error(152),e.displayName||e.name||"Component")}return n(e,r)}}var Zi=$i(!0),eo=$i(!1),to={},no={current:to},ro={current:to},io={current:to};function oo(e){if(e===to)throw a(Error(174));return e}function ao(e,t){Or(io,t),Or(ro,e),Or(no,to);var n=t.nodeType;switch(n){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:cr(null,"");break;default:t=cr(t=(n=8===n?t.parentNode:t).namespaceURI||null,n=n.tagName)}Rr(no),Or(no,t)}function so(e){Rr(no),Rr(ro),Rr(io)}function uo(e){oo(io.current);var t=oo(no.current),n=cr(t,e.type);t!==n&&(Or(ro,e),Or(no,n))}function co(e){ro.current===e&&(Rr(no),Rr(ro))}var lo=1,ho=1,fo=2,po={current:0};function mo(e){for(var t=e;null!==t;){if(13===t.tag){if(null!==t.memoizedState)return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var yo=0,go=2,vo=4,bo=8,_o=16,wo=32,Eo=64,To=128,So=ze.ReactCurrentDispatcher,Co=0,Io=null,ko=null,No=null,Ao=null,Do=null,Ro=null,Oo=0,Po=null,xo=0,Mo=!1,Lo=null,Fo=0;function Uo(){throw a(Error(321))}function qo(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!tn(e[n],t[n]))return!1;return!0}function Vo(e,t,n,r,i,o){if(Co=o,Io=t,No=null!==e?e.memoizedState:null,So.current=null===No?Zo:ea,t=n(r,i),Mo){do{Mo=!1,Fo+=1,No=null!==e?e.memoizedState:null,Ro=Ao,Po=Do=ko=null,So.current=ea,t=n(r,i)}while(Mo);Lo=null,Fo=0}if(So.current=$o,(e=Io).memoizedState=Ao,e.expirationTime=Oo,e.updateQueue=Po,e.effectTag|=xo,e=null!==ko&&null!==ko.next,Co=0,Ro=Do=Ao=No=ko=Io=null,Oo=0,Po=null,xo=0,e)throw a(Error(300));return t}function jo(){So.current=$o,Co=0,Ro=Do=Ao=No=ko=Io=null,Oo=0,Po=null,xo=0,Mo=!1,Lo=null,Fo=0}function Bo(){var e={memoizedState:null,baseState:null,queue:null,baseUpdate:null,next:null};return null===Do?Ao=Do=e:Do=Do.next=e,Do}function Wo(){if(null!==Ro)Ro=(Do=Ro).next,No=null!==(ko=No)?ko.next:null;else{if(null===No)throw a(Error(310));var e={memoizedState:(ko=No).memoizedState,baseState:ko.baseState,queue:ko.queue,baseUpdate:ko.baseUpdate,next:null};Do=null===Do?Ao=e:Do.next=e,No=ko.next}return Do}function Qo(e,t){return"function"===typeof t?t(e):t}function Ko(e){var t=Wo(),n=t.queue;if(null===n)throw a(Error(311));if(n.lastRenderedReducer=e,0<Fo){var r=n.dispatch;if(null!==Lo){var i=Lo.get(n);if(void 0!==i){Lo.delete(n);var o=t.memoizedState;do{o=e(o,i.action),i=i.next}while(null!==i);return tn(o,t.memoizedState)||(ha=!0),t.memoizedState=o,t.baseUpdate===n.last&&(t.baseState=o),n.lastRenderedState=o,[o,r]}}return[t.memoizedState,r]}r=n.last;var s=t.baseUpdate;if(o=t.baseState,null!==s?(null!==r&&(r.next=null),r=s.next):r=null!==r?r.next:null,null!==r){var u=i=null,c=r,l=!1;do{var h=c.expirationTime;h<Co?(l||(l=!0,u=s,i=o),h>Oo&&(Oo=h)):(Bs(h,c.suspenseConfig),o=c.eagerReducer===e?c.eagerState:e(o,c.action)),s=c,c=c.next}while(null!==c&&c!==r);l||(u=s,i=o),tn(o,t.memoizedState)||(ha=!0),t.memoizedState=o,t.baseUpdate=u,t.baseState=i,n.lastRenderedState=o}return[t.memoizedState,n.dispatch]}function zo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===Po?(Po={lastEffect:null}).lastEffect=e.next=e:null===(t=Po.lastEffect)?Po.lastEffect=e.next=e:(n=t.next,t.next=e,e.next=n,Po.lastEffect=e),e}function Ho(e,t,n,r){var i=Bo();xo|=e,i.memoizedState=zo(t,n,void 0,void 0===r?null:r)}function Go(e,t,n,r){var i=Wo();r=void 0===r?null:r;var o=void 0;if(null!==ko){var a=ko.memoizedState;if(o=a.destroy,null!==r&&qo(r,a.deps))return void zo(yo,n,o,r)}xo|=e,i.memoizedState=zo(t,n,o,r)}function Yo(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Xo(){}function Jo(e,t,n){if(!(25>Fo))throw a(Error(301));var r=e.alternate;if(e===Io||null!==r&&r===Io)if(Mo=!0,e={expirationTime:Co,suspenseConfig:null,action:n,eagerReducer:null,eagerState:null,next:null},null===Lo&&(Lo=new Map),void 0===(n=Lo.get(t)))Lo.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}else{var i=As(),o=ji.suspense;o={expirationTime:i=Ds(i,e,o),suspenseConfig:o,action:n,eagerReducer:null,eagerState:null,next:null};var s=t.last;if(null===s)o.next=o;else{var u=s.next;null!==u&&(o.next=u),s.next=o}if(t.last=o,0===e.expirationTime&&(null===r||0===r.expirationTime)&&null!==(r=t.lastRenderedReducer))try{var c=t.lastRenderedState,l=r(c,n);if(o.eagerReducer=r,o.eagerState=l,tn(l,c))return}catch(h){}Os(e,i)}}var $o={readContext:Ni,useCallback:Uo,useContext:Uo,useEffect:Uo,useImperativeHandle:Uo,useLayoutEffect:Uo,useMemo:Uo,useReducer:Uo,useRef
1:Uo,useState:Uo,useDebugValue:Uo,useResponder:Uo},Zo={readContext:Ni,useCallback:function(e,t){return Bo().memoizedState=[e,void 0===t?null:t],e},useContext:Ni,useEffect:function(e,t){return Ho(516,To|Eo,e,t)},useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Ho(4,vo|wo,Yo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ho(4,vo|wo,e,t)},useMemo:function(e,t){var n=Bo();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Bo();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={last:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Jo.bind(null,Io,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Bo().memoizedState=e},useState:function(e){var t=Bo();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={last:null,dispatch:null,lastRenderedReducer:Qo,lastRenderedState:e}).dispatch=Jo.bind(null,Io,e),[t.memoizedState,e]},useDebugValue:Xo,useResponder:on},ea={readContext:Ni,useCallback:function(e,t){var n=Wo();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&qo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)},useContext:Ni,useEffect:function(e,t){return Go(516,To|Eo,e,t)},useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Go(4,vo|wo,Yo.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Go(4,vo|wo,e,t)},useMemo:function(e,t){var n=Wo();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&qo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)},useReducer:Ko,useRef:function(){return Wo().memoizedState},useState:function(e){return Ko(Qo)},useDebugValue:Xo,useResponder:on},ta=null,na=null,ra=!1;function ia(e,t){var n=ru(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function oa(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);case 13:default:return!1}}function aa(e){if(ra){var t=na;if(t){var n=t;if(!oa(e,t)){if(!(t=Nr(n.nextSibling))||!oa(e,t))return e.effectTag|=2,ra=!1,void(ta=e);ia(ta,n)}ta=e,na=Nr(t.firstChild)}else e.effectTag|=2,ra=!1,ta=e}}function sa(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&18!==e.tag;)e=e.return;ta=e}function ua(e){if(e!==ta)return!1;if(!ra)return sa(e),ra=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Cr(t,e.memoizedProps))for(t=na;t;)ia(e,t),t=Nr(t.nextSibling);return sa(e),na=ta?Nr(e.stateNode.nextSibling):null,!0}function ca(){na=ta=null,ra=!1}var la=ze.ReactCurrentOwner,ha=!1;function fa(e,t,n,r){t.child=null===e?eo(t,null,n,r):Zi(t,e.child,n,r)}function pa(e,t,n,r,i){n=n.render;var o=t.ref;return ki(t,i),r=Vo(e,t,n,r,o,i),null===e||ha?(t.effectTag|=1,fa(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=i&&(e.expirationTime=0),Ca(e,t,i))}function da(e,t,n,r,i,o){if(null===e){var a=n.type;return"function"!==typeof a||iu(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=au(n.type,null,r,null,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,ma(e,t,a,r,i,o))}return a=e.child,i<o&&(i=a.memoizedProps,(n=null!==(n=n.compare)?n:rn)(i,r)&&e.ref===t.ref)?Ca(e,t,o):(t.effectTag|=1,(e=ou(a,r)).ref=t.ref,e.return=t,t.child=e)}function ma(e,t,n,r,i,o){return null!==e&&rn(e.memoizedProps,r)&&e.ref===t.ref&&(ha=!1,i<o)?Ca(e,t,o):ga(e,t,n,r,o)}function ya(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.effectTag|=128)}function ga(e,t,n,r,i){var o=Ur(n)?Lr:xr.current;return o=Fr(t,o),ki(t,i),n=Vo(e,t,n,r,o,i),null===e||ha?(t.effectTag|=1,fa(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=i&&(e.expirationTime=0),Ca(e,t,i))}function va(e,t,n,r,i){if(Ur(n)){var o=!0;Wr(t)}else o=!1;if(ki(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),zi(t,n,r),Gi(t,n,r,i),r=!0;else if(null===e){var a=t.stateNode,s=t.memoizedProps;a.props=s;var u=a.context,c=n.contextType;"object"===typeof c&&null!==c?c=Ni(c):c=Fr(t,c=Ur(n)?Lr:xr.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)&&Hi(t,a,r,c),Ai=!1;var f=t.memoizedState;u=a.state=f;var p=t.updateQueue;null!==p&&(Ui(t,p,r,a,i),u=t.memoizedState),s!==r||f!==u||Mr.current||Ai?("function"===typeof l&&(Wi(t,n,l,r),u=t.memoizedState),(s=Ai||Ki(t,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&&(t.effectTag|=4)):("function"===typeof a.componentDidMount&&(t.effectTag|=4),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=c,r=s):("function"===typeof a.componentDidMount&&(t.effectTag|=4),r=!1)}else a=t.stateNode,s=t.memoizedProps,a.props=t.type===t.elementType?s:vi(t.type,s),u=a.context,"object"===typeof(c=n.contextType)&&null!==c?c=Ni(c):c=Fr(t,c=Ur(n)?Lr:xr.current),(h="function"===typeof(l=n.getDerivedStateFromProps)||"function"===typeof a.getSnapshotBeforeUpdate)||"function"!==typeof a.UNSAFE_componentWillReceiveProps&&"function"!==typeof a.componentWillReceiveProps||(s!==r||u!==c)&&Hi(t,a,r,c),Ai=!1,u=t.memoizedState,f=a.state=u,null!==(p=t.updateQueue)&&(Ui(t,p,r,a,i),f=t.memoizedState),s!==r||u!==f||Mr.current||Ai?("function"===typeof l&&(Wi(t,n,l,r),f=t.memoizedState),(l=Ai||Ki(t,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&&(t.effectTag|=4),"function"===typeof a.getSnapshotBeforeUpdate&&(t.effectTag|=256)):("function"!==typeof a.componentDidUpdate||s===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=4),"function"!==typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=256),t.memoizedProps=r,t.memoizedState=f),a.props=r,a.state=f,a.context=c,r=l):("function"!==typeof a.componentDidUpdate||s===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=4),"function"!==typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=256),r=!1);return ba(e,t,n,r,o,i)}function ba(e,t,n,r,i,o){ya(e,t);var a=0!==(64&t.effectTag);if(!r&&!a)return i&&Qr(t,n,!1),Ca(e,t,o);r=t.stateNode,la.current=t;var s=a&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return t.effectTag|=1,null!==e&&a?(t.child=Zi(t,e.child,null,o),t.child=Zi(t,null,s,o)):fa(e,t,s,o),t.memoizedState=r.state,i&&Qr(t,n,!0),t.child}function _a(e){var t=e.stateNode;t.pendingContext?jr(0,t.pendingContext,t.pendingContext!==t.context):t.context&&jr(0,t.context,!1),ao(e,t.containerInfo)}var wa={};function Ea(e,t,n){var r,i=t.mode,o=t.pendingProps,a=po.current,s=null,u=!1;if((r=0!==(64&t.effectTag))||(r=0!==(a&fo)&&(null===e||null!==e.memoizedState)),r?(s=wa,u=!0,t.effectTag&=-65):null!==e&&null===e.memoizedState||void 0===o.fallback||!0===o.unstable_avoidThisFallback||(a|=ho),Or(po,a&=lo),null===e)if(u){if(o=o.fallback,(e=su(null,i,0,null)).return=t,0===(2&t.mode))for(u=null!==t.memoizedState?t.child.child:t.child,e.child=u;null!==u;)u.return=e,u=u.sibling;(n=su(o,i,n,null)).return=t,e.sibling=n,i=e}else i=n=eo(t,null,o.children,n);else{if(null!==e.memoizedState)if(i=(a=e.child).sibling,u){if(o=o.fallback,(n=ou(a,a.pendingProps)).return=t,0===(2&t.mode)&&(u=null!==t.memoizedState?t.child.child:t.child)!==a.child)for(n.child=u;null!==u;)u.return=n,u=u.sibling;(o=ou(i,o,i.expirationTime)).return=t,n.sibling=o,i=n,n.childExpirationTime=0,n=o}else i=n=Zi(t,a.child,o.children,n);else if(a=e.child,u){if(u=o.fallback,(o=su(null,i,0,null)).return=t,o.child=a,null!==a&&(a.return=o),0===(2&t.mode))for(a=null!==t.memoizedState?t.child.child:t.child,o.child=a;null!==a;)a.return=o,a=a.sibling;(n=su(u,i,n,null)).return=t,o.sibling=n,n.effectTag|=2,i=o,o.childExpirationTime=0}else n=i=Zi(t,a,o.children,n);t.stateNode=e.stateNode}return t.memoizedState=s,t.child=i,n}function Ta(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,last:r,tail:n,tailExpiration:0,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.last=r,o.tail=n,o.tailExpiration=0,o.tailMode=i)}function Sa(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(fa(e,t,r.children,n),0!==((r=po.current)&fo))r=r&lo|fo,t.effectTag|=64;else{if(null!==e&&0!==(64&e.effectTag))e:for(e=t.child;null!==e;){if(13===e.tag){if(null!==e.memoizedState){e.expirationTime<n&&(e.expirationTime=n);var a=e.alternate;null!==a&&a.expirationTime<n&&(a.expirationTime=n),Ii(e.return,n)}}else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=lo}if(Or(po,r),0===(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(r=n.alternate)&&null===mo(r)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ta(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(r=i.alternate)&&null===mo(r)){t.child=i;break}r=i.sibling,i.sibling=n,n=i,i=r}Ta(t,!0,n,null,o);break;case"together":Ta(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ca(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),t.childExpirationTime<n)return null;if(null!==e&&t.child!==e.child)throw a(Error(153));if(null!==t.child){for(n=ou(e=t.child,e.pendingProps,e.expirationTime),t.child=n,n.return=t;null!==e.sibling;
1)e=e.sibling,(n=n.sibling=ou(e,e.pendingProps,e.expirationTime)).return=t;n.sibling=null}return t.child}function Ia(e){e.effectTag|=4}var ka=void 0,Na=void 0,Aa=void 0,Da=void 0;function Ra(e,t){switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Oa(e){switch(e.tag){case 1:Ur(e.type)&&qr();var t=e.effectTag;return 2048&t?(e.effectTag=-2049&t|64,e):null;case 3:if(so(),Vr(),0!==(64&(t=e.effectTag)))throw a(Error(285));return e.effectTag=-2049&t|64,e;case 5:return co(e),null;case 13:return Rr(po),2048&(t=e.effectTag)?(e.effectTag=-2049&t|64,e):null;case 18:return null;case 19:return Rr(po),null;case 4:return so(),null;case 10:return Ci(e),null;default:return null}}function Pa(e,t){return{value:e,source:t,stack:ht(t)}}ka=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(20===n.tag)e.appendChild(n.stateNode.instance);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Na=function(){},Aa=function(e,t,n,r,o){var a=e.memoizedProps;if(a!==r){var s=t.stateNode;switch(oo(no.current),e=null,n){case"input":a=Et(s,a),r=Et(s,r),e=[];break;case"option":a=tr(s,a),r=tr(s,r),e=[];break;case"select":a=i({},a,{value:void 0}),r=i({},r,{value:void 0}),e=[];break;case"textarea":a=rr(s,a),r=rr(s,r),e=[];break;default:"function"!==typeof a.onClick&&"function"===typeof r.onClick&&(s.onclick=wr)}vr(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&&(p.hasOwnProperty(n)?e||(e=[]):(e=e||[]).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||(e||(e=[]),e.push(n,u)),u=l;else"dangerouslySetInnerHTML"===n?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(e=e||[]).push(n,""+l)):"children"===n?c===l||"string"!==typeof l&&"number"!==typeof l||(e=e||[]).push(n,""+l):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&(p.hasOwnProperty(n)?(null!=l&&_r(o,n),e||c===l||(e=[])):(e=e||[]).push(n,l))}u&&(e=e||[]).push("style",u),o=e,(t.updateQueue=o)&&Ia(t)}},Da=function(e,t,n,r){n!==r&&Ia(t)};var xa="function"===typeof WeakSet?WeakSet:Set;function Ma(e,t){var n=t.source,r=t.stack;null===r&&null!==n&&(r=ht(n)),null!==n&&lt(n.type),t=t.value,null!==e&&1===e.tag&&lt(e.type);try{console.error(t)}catch(i){setTimeout((function(){throw i}))}}function La(e){var t=e.ref;if(null!==t)if("function"===typeof t)try{t(null)}catch(n){Xs(e,n)}else t.current=null}function Fa(e,t,n){if(null!==(n=null!==(n=n.updateQueue)?n.lastEffect:null)){var r=n=n.next;do{if((r.tag&e)!==yo){var i=r.destroy;r.destroy=void 0,void 0!==i&&i()}(r.tag&t)!==yo&&(i=r.create,r.destroy=i()),r=r.next}while(r!==n)}}function Ua(e,t){switch("function"===typeof tu&&tu(e),e.tag){case 0:case 11:case 14:case 15:var n=e.updateQueue;if(null!==n&&null!==(n=n.lastEffect)){var r=n.next;fi(97<t?97:t,(function(){var t=r;do{var n=t.destroy;if(void 0!==n){var i=e;try{n()}catch(o){Xs(i,o)}}t=t.next}while(t!==r)}))}break;case 1:La(e),"function"===typeof(t=e.stateNode).componentWillUnmount&&function(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(n){Xs(e,n)}}(e,t);break;case 5:La(e);break;case 4:Ba(e,t)}}function qa(e,t){for(var n=e;;)if(Ua(n,t),null!==n.child&&4!==n.tag)n.child.return=n,n=n.child;else{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}}function Va(e){return 5===e.tag||3===e.tag||4===e.tag}function ja(e){e:{for(var t=e.return;null!==t;){if(Va(t)){var n=t;break e}t=t.return}throw a(Error(160))}switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw a(Error(161))}16&n.effectTag&&(fr(t,""),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||Va(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}for(var i=e;;){var o=5===i.tag||6===i.tag;if(o||20===i.tag){var s=o?i.stateNode:i.stateNode.instance;if(n)if(r){var u=s;s=n,8===(o=t).nodeType?o.parentNode.insertBefore(u,s):o.insertBefore(u,s)}else t.insertBefore(s,n);else r?(8===(u=t).nodeType?(o=u.parentNode).insertBefore(s,u):(o=u).appendChild(s),null!==(u=u._reactRootContainer)&&void 0!==u||null!==o.onclick||(o.onclick=wr)):t.appendChild(s)}else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===e)break;for(;null===i.sibling;){if(null===i.return||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}}function Ba(e,t){for(var n=e,r=!1,i=void 0,o=void 0;;){if(!r){r=n.return;e:for(;;){if(null===r)throw a(Error(160));switch(i=r.stateNode,r.tag){case 5:o=!1;break e;case 3:case 4:i=i.containerInfo,o=!0;break e}r=r.return}r=!0}if(5===n.tag||6===n.tag)if(qa(n,t),o){var s=i,u=n.stateNode;8===s.nodeType?s.parentNode.removeChild(u):s.removeChild(u)}else i.removeChild(n.stateNode);else if(20===n.tag)u=n.stateNode.instance,qa(n,t),o?8===(s=i).nodeType?s.parentNode.removeChild(u):s.removeChild(u):i.removeChild(u);else if(4===n.tag){if(null!==n.child){i=n.stateNode.containerInfo,o=!0,n.child.return=n,n=n.child;continue}}else if(Ua(n,t),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;4===(n=n.return).tag&&(r=!1)}n.sibling.return=n.return,n=n.sibling}}function Wa(e,t){switch(t.tag){case 0:case 11:case 14:case 15:Fa(vo,bo,t);break;case 1:break;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps,i=null!==e?e.memoizedProps:r;e=t.type;var o=t.updateQueue;
1if(t.updateQueue=null,null!==o){for(n[M]=r,"input"===e&&"radio"===r.type&&null!=r.name&&St(n,r),br(e,i),t=br(e,r),i=0;i<o.length;i+=2){var s=o[i],u=o[i+1];"style"===s?yr(n,u):"dangerouslySetInnerHTML"===s?hr(n,u):"children"===s?fr(n,u):_t(n,s,u,t)}switch(e){case"input":Ct(n,r);break;case"textarea":or(n,r);break;case"select":t=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(e=r.value)?nr(n,!!r.multiple,e,!1):t!==!!r.multiple&&(null!=r.defaultValue?nr(n,!!r.multiple,r.defaultValue,!0):nr(n,!!r.multiple,r.multiple?[]:"",!1))}}}break;case 6:if(null===t.stateNode)throw a(Error(162));t.stateNode.nodeValue=t.memoizedProps;break;case 3:case 12:break;case 13:if(n=t,null===t.memoizedState?r=!1:(r=!0,n=t.child,ms=ci()),null!==n)e:for(e=n;;){if(5===e.tag)o=e.stateNode,r?"function"===typeof(o=o.style).setProperty?o.setProperty("display","none","important"):o.display="none":(o=e.stateNode,i=void 0!==(i=e.memoizedProps.style)&&null!==i&&i.hasOwnProperty("display")?i.display:null,o.style.display=mr("display",i));else if(6===e.tag)e.stateNode.nodeValue=r?"":e.memoizedProps;else{if(13===e.tag&&null!==e.memoizedState){(o=e.child.sibling).return=e,e=o;continue}if(null!==e.child){e.child.return=e,e=e.child;continue}}if(e===n)break e;for(;null===e.sibling;){if(null===e.return||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}Qa(t);break;case 19:Qa(t);break;case 17:case 20:break;default:throw a(Error(163))}}function Qa(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new xa),t.forEach((function(t){var r=$s.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}var Ka="function"===typeof WeakMap?WeakMap:Map;function za(e,t,n){(n=Oi(n,null)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){vs||(vs=!0,bs=r),Ma(e,t)},n}function Ha(e,t,n){(n=Oi(n,null)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var i=t.value;n.payload=function(){return Ma(e,t),r(i)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(n.callback=function(){"function"!==typeof r&&(null===_s?_s=new Set([this]):_s.add(this),Ma(e,t));var n=t.stack;this.componentDidCatch(t.value,{componentStack:null!==n?n:""})}),n}var Ga=Math.ceil,Ya=ze.ReactCurrentDispatcher,Xa=ze.ReactCurrentOwner,Ja=0,$a=8,Za=16,es=32,ts=0,ns=1,rs=2,is=3,os=4,as=Ja,ss=null,us=null,cs=0,ls=ts,hs=1073741823,fs=1073741823,ps=null,ds=!1,ms=0,ys=500,gs=null,vs=!1,bs=null,_s=null,ws=!1,Es=null,Ts=90,Ss=0,Cs=null,Is=0,ks=null,Ns=0;function As(){return(as&(Za|es))!==Ja?1073741821-(ci()/10|0):0!==Ns?Ns:Ns=1073741821-(ci()/10|0)}function Ds(e,t,n){if(0===(2&(t=t.mode)))return 1073741823;var r=li();if(0===(4&t))return 99===r?1073741823:1073741822;if((as&Za)!==Ja)return cs;if(null!==n)e=1073741821-25*(1+((1073741821-e+(0|n.timeoutMs||5e3)/10)/25|0));else switch(r){case 99:e=1073741823;break;case 98:e=1073741821-10*(1+((1073741821-e+15)/10|0));break;case 97:case 96:e=1073741821-25*(1+((1073741821-e+500)/25|0));break;case 95:e=1;break;default:throw a(Error(326))}return null!==ss&&e===cs&&--e,e}var Rs=0;function Os(e,t){if(50<Is)throw Is=0,ks=null,a(Error(185));if(null!==(e=Ps(e,t))){e.pingTime=0;var n=li();if(1073741823===t)if((as&$a)!==Ja&&(as&(Za|es))===Ja)for(var r=js(e,1073741823,!0);null!==r;)r=r(!0);else xs(e,99,1073741823),as===Ja&&mi();else xs(e,n,t);(4&as)===Ja||98!==n&&99!==n||(null===Cs?Cs=new Map([[e,t]]):(void 0===(n=Cs.get(e))||n>t)&&Cs.set(e,t))}}function Ps(e,t){e.expirationTime<t&&(e.expirationTime=t);var n=e.alternate;null!==n&&n.expirationTime<t&&(n.expirationTime=t);var r=e.return,i=null;if(null===r&&3===e.tag)i=e.stateNode;else for(;null!==r;){if(n=r.alternate,r.childExpirationTime<t&&(r.childExpirationTime=t),null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t),null===r.return&&3===r.tag){i=r.stateNode;break}r=r.return}return null!==i&&(t>i.firstPendingTime&&(i.firstPendingTime=t),0===(e=i.lastPendingTime)||t<e)&&(i.lastPendingTime=t),i}function xs(e,t,n){if(e.callbackExpirationTime<n){var r=e.callbackNode;null!==r&&r!==ri&&Hr(r),e.callbackExpirationTime=n,1073741823===n?e.callbackNode=di(Ms.bind(null,e,js.bind(null,e,n))):(r=null,1!==n&&(r={timeout:10*(1073741821-n)-ci()}),e.callbackNode=pi(t,Ms.bind(null,e,js.bind(null,e,n)),r))}}function Ms(e,t,n){var r=e.callbackNode,i=null;try{return null!==(i=t(n))?Ms.bind(null,e,i):null}finally{null===i&&r===e.callbackNode&&(e.callbackNode=null,e.callbackExpirationTime=0)}}function Ls(){(as&(1|Za|es))===Ja&&(function(){if(null!==Cs){var e=Cs;Cs=null,e.forEach((function(e,t){di(js.bind(null,t,e))})),mi()}}(),Hs())}function Fs(e,t){var n=as;as|=1;try{return e(t)}finally{(as=n)===Ja&&mi()}}function Us(e,t,n,r){var i=as;as|=4;try{return fi(98,e.bind(null,t,n,r))}finally{(as=i)===Ja&&mi()}}function qs(e,t){var n=as;as&=-2,as|=$a;try{return e(t)}finally{(as=n)===Ja&&mi()}}function Vs(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,kr(n)),null!==us)for(n=us.return;null!==n;){var r=n;switch(r.tag){case 1:var i=r.type.childContextTypes;null!==i&&void 0!==i&&qr();break;case 3:so(),Vr();break;case 5:co(r);break;case 4:so();break;case 13:case 19:Rr(po);break;case 10:Ci(r)}n=n.return}ss=e,us=ou(e.current,null),cs=t,ls=ts,fs=hs=1073741823,ps=null,ds=!1}function js(e,t,n){if((as&(Za|es))!==Ja)throw a(Error(327));if(e.firstPendingTime<t)return null;if(n&&e.finishedExpirationTime===t)return Ks.bind(null,e);if(Hs(),e!==ss||t!==cs)Vs(e,t);else if(ls===is)if(ds)Vs(e,t);else{var r=e.lastPendingTime;if(r<t)return js.bind(null,e,r)}if(null!==us){r=as,as|=Za;
1var i=Ya.current;if(null===i&&(i=$o),Ya.current=$o,n){if(1073741823!==t){var o=As();if(o<t)return as=r,Ti(),Ya.current=i,js.bind(null,e,o)}}else Ns=0;for(;;)try{if(n)for(;null!==us;)us=Ws(us);else for(;null!==us&&!Gr();)us=Ws(us);break}catch(m){if(Ti(),jo(),null===(o=us)||null===o.return)throw Vs(e,t),as=r,m;e:{var s=e,u=o.return,c=o,l=m,h=cs;if(c.effectTag|=1024,c.firstEffect=c.lastEffect=null,null!==l&&"object"===typeof l&&"function"===typeof l.then){var f=l,p=0!==(po.current&ho);l=u;do{var d;if((d=13===l.tag)&&(null!==l.memoizedState?d=!1:d=void 0!==(d=l.memoizedProps).fallback&&(!0!==d.unstable_avoidThisFallback||!p)),d){if(null===(u=l.updateQueue)?((u=new Set).add(f),l.updateQueue=u):u.add(f),0===(2&l.mode)){l.effectTag|=64,c.effectTag&=-1957,1===c.tag&&(null===c.alternate?c.tag=17:((h=Oi(1073741823,null)).tag=2,xi(c,h))),c.expirationTime=1073741823;break e}c=s,s=h,null===(p=c.pingCache)?(p=c.pingCache=new Ka,u=new Set,p.set(f,u)):void 0===(u=p.get(f))&&(u=new Set,p.set(f,u)),u.has(s)||(u.add(s),c=Js.bind(null,c,f,s),f.then(c,c)),l.effectTag|=2048,l.expirationTime=h;break e}l=l.return}while(null!==l);l=Error((lt(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."+ht(c))}ls!==os&&(ls=ns),l=Pa(l,c),c=u;do{switch(c.tag){case 3:c.effectTag|=2048,c.expirationTime=h,Mi(c,h=za(c,l,h));break e;case 1:if(f=l,s=c.type,u=c.stateNode,0===(64&c.effectTag)&&("function"===typeof s.getDerivedStateFromError||null!==u&&"function"===typeof u.componentDidCatch&&(null===_s||!_s.has(u)))){c.effectTag|=2048,c.expirationTime=h,Mi(c,h=Ha(c,f,h));break e}}c=c.return}while(null!==c)}us=Qs(o)}if(as=r,Ti(),Ya.current=i,null!==us)return js.bind(null,e,t)}if(e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,function(e,t){var n=e.firstBatch;return!!(null!==n&&n._defer&&n._expirationTime>=t)&&(pi(97,(function(){return n._onComplete(),null})),!0)}(e,t))return null;switch(ss=null,ls){case ts:throw a(Error(328));case ns:return(r=e.lastPendingTime)<t?js.bind(null,e,r):n?Ks.bind(null,e):(Vs(e,t),di(js.bind(null,e,t)),null);case rs:return 1073741823===hs&&!n&&10<(n=ms+ys-ci())?ds?(Vs(e,t),js.bind(null,e,t)):(r=e.lastPendingTime)<t?js.bind(null,e,r):(e.timeoutHandle=Ir(Ks.bind(null,e),n),null):Ks.bind(null,e);case is:if(!n){if(ds)return Vs(e,t),js.bind(null,e,t);if((n=e.lastPendingTime)<t)return js.bind(null,e,n);if(1073741823!==fs?n=10*(1073741821-fs)-ci():1073741823===hs?n=0:(n=10*(1073741821-hs)-5e3,0>(n=(r=ci())-n)&&(n=0),(t=10*(1073741821-t)-r)<(n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Ga(n/1960))-n)&&(n=t)),10<n)return e.timeoutHandle=Ir(Ks.bind(null,e),n),null}return Ks.bind(null,e);case os:return!n&&1073741823!==hs&&null!==ps&&(r=hs,0>=(t=0|(i=ps).busyMinDurationMs)?t=0:(n=0|i.busyDelayMs,t=(r=ci()-(10*(1073741821-r)-(0|i.timeoutMs||5e3)))<=n?0:n+t-r),10<t)?(e.timeoutHandle=Ir(Ks.bind(null,e),t),null):Ks.bind(null,e);default:throw a(Error(329))}}function Bs(e,t){e<hs&&1<e&&(hs=e),null!==t&&e<fs&&1<e&&(fs=e,ps=t)}function Ws(e){var t=Zs(e.alternate,e,cs);return e.memoizedProps=e.pendingProps,null===t&&(t=Qs(e)),Xa.current=null,t}function Qs(e){us=e;do{var t=us.alternate;if(e=us.return,0===(1024&us.effectTag)){e:{var n=t,r=cs,o=(t=us).pendingProps;switch(t.tag){case 2:case 16:break;case 15:case 0:break;case 1:Ur(t.type)&&qr();break;case 3:so(),Vr(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==n&&null!==n.child||(ua(t),t.effectTag&=-3),Na(t);break;case 5:co(t),r=oo(io.current);var s=t.type;if(null!==n&&null!=t.stateNode)Aa(n,t,s,o,r),n.ref!==t.ref&&(t.effectTag|=128);else if(o){var u=oo(no.current);if(ua(t)){o=void 0,s=(n=t).stateNode;var c=n.type,l=n.memoizedProps;switch(s[x]=n,s[M]=l,c){case"iframe":case"object":case"embed":Mn("load",s);break;case"video":case"audio":for(var h=0;h<ne.length;h++)Mn(ne[h],s);break;case"source":Mn("error",s);break;case"img":case"image":case"link":Mn("error",s),Mn("load",s);break;
1case"form":Mn("reset",s),Mn("submit",s);break;case"details":Mn("toggle",s);break;case"input":Tt(s,l),Mn("invalid",s),_r(r,"onChange");break;case"select":s._wrapperState={wasMultiple:!!l.multiple},Mn("invalid",s),_r(r,"onChange");break;case"textarea":ir(s,l),Mn("invalid",s),_r(r,"onChange")}for(o in vr(c,l),h=null,l)l.hasOwnProperty(o)&&(u=l[o],"children"===o?"string"===typeof u?s.textContent!==u&&(h=["children",u]):"number"===typeof u&&s.textContent!==""+u&&(h=["children",""+u]):p.hasOwnProperty(o)&&null!=u&&_r(r,o));switch(c){case"input":Qe(s),It(s,l,!0);break;case"textarea":Qe(s),ar(s);break;case"select":case"option":break;default:"function"===typeof l.onClick&&(s.onclick=wr)}r=h,n.updateQueue=r,null!==r&&Ia(t)}else{l=s,n=o,c=t,h=9===r.nodeType?r:r.ownerDocument,u===sr.html&&(u=ur(l)),u===sr.html?"script"===l?((l=h.createElement("div")).innerHTML="<script><\/script>",h=l.removeChild(l.firstChild)):"string"===typeof n.is?h=h.createElement(l,{is:n.is}):(h=h.createElement(l),"select"===l&&(l=h,n.multiple?l.multiple=!0:n.size&&(l.size=n.size))):h=h.createElementNS(u,l),(l=h)[x]=c,l[M]=n,ka(n=l,t,!1,!1),c=n;var f=r,d=br(s,o);switch(s){case"iframe":case"object":case"embed":Mn("load",c),r=o;break;case"video":case"audio":for(r=0;r<ne.length;r++)Mn(ne[r],c);r=o;break;case"source":Mn("error",c),r=o;break;case"img":case"image":case"link":Mn("error",c),Mn("load",c),r=o;break;case"form":Mn("reset",c),Mn("submit",c),r=o;break;case"details":Mn("toggle",c),r=o;break;case"input":Tt(c,o),r=Et(c,o),Mn("invalid",c),_r(f,"onChange");break;case"option":r=tr(c,o);break;case"select":c._wrapperState={wasMultiple:!!o.multiple},r=i({},o,{value:void 0}),Mn("invalid",c),_r(f,"onChange");break;case"textarea":ir(c,o),r=rr(c,o),Mn("invalid",c),_r(f,"onChange");break;default:r=o}vr(s,r),l=void 0,h=s,u=c;var m=r;for(l in m)if(m.hasOwnProperty(l)){var y=m[l];"style"===l?yr(u,y):"dangerouslySetInnerHTML"===l?null!=(y=y?y.__html:void 0)&&hr(u,y):"children"===l?"string"===typeof y?("textarea"!==h||""!==y)&&fr(u,y):"number"===typeof y&&fr(u,""+y):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(p.hasOwnProperty(l)?null!=y&&_r(f,l):null!=y&&_t(u,l,y,d))}switch(s){case"input":Qe(c),It(c,o,!1);break;case"textarea":Qe(c),ar(c);break;case"option":null!=o.value&&c.setAttribute("value",""+wt(o.value));break;case"select":r=c,c=o,r.multiple=!!c.multiple,null!=(l=c.value)?nr(r,!!c.multiple,l,!1):null!=c.defaultValue&&nr(r,!!c.multiple,c.defaultValue,!0);break;default:"function"===typeof r.onClick&&(c.onclick=wr)}Sr(s,o)&&Ia(t),t.stateNode=n}null!==t.ref&&(t.effectTag|=128)}else if(null===t.stateNode)throw a(Error(166));break;case 6:if(n&&null!=t.stateNode)Da(n,t,n.memoizedProps,o);else{if("string"!==typeof o&&null===t.stateNode)throw a(Error(166));n=oo(io.current),oo(no.current),ua(t)?(r=t.stateNode,n=t.memoizedProps,r[x]=t,r.nodeValue!==n&&Ia(t)):(r=t,(n=(9===n.nodeType?n:n.ownerDocument).createTextNode(o))[x]=t,r.stateNode=n)}break;case 11:break;case 13:if(Rr(po),o=t.memoizedState,0!==(64&t.effectTag)){t.expirationTime=r;break e}r=null!==o,o=!1,null===n?ua(t):(o=null!==(s=n.memoizedState),r||null===s||null!==(s=n.child.sibling)&&(null!==(c=t.firstEffect)?(t.firstEffect=s,s.nextEffect=c):(t.firstEffect=t.lastEffect=s,s.nextEffect=null),s.effectTag=8)),r&&!o&&0!==(2&t.mode)&&(null===n&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!==(po.current&ho)?ls===ts&&(ls=rs):ls!==ts&&ls!==rs||(ls=is)),(r||o)&&(t.effectTag|=4);break;case 7:case 8:case 12:break;case 4:so(),Na(t);break;case 10:Ci(t);break;case 9:case 14:break;case 17:Ur(t.type)&&qr();break;case 18:break;case 19:if(Rr(po),null===(o=t.memoizedState))break;if(s=0!==(64&t.effectTag),null===(c=o.rendering)){if(s)Ra(o,!1);else if(ls!==ts||null!==n&&0!==(64&n.effectTag))for(n=t.child;null!==n;){if(null!==(c=mo(n))){for(t.effectTag|=64,Ra(o,!1),null!==(n=c.updateQueue)&&(t.updateQueue=n,t.effectTag|=4),t.firstEffect=t.lastEffect=null,n=t.child;null!==n;)s=r,(o=n).effectTag&=2,o.nextEffect=null,o.firstEffect=null,o.lastEffect=null,null===(c=o.alternate)?(o.childExpirationTime=0,o.expirationTime=s,o.child=null,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null):(o.childExpirationTime=c.childExpirationTime,o.expirationTime=c.expirationTime,o.child=c.child,o.memoizedProps=c.memoizedProps,o.memoizedState=c.memoizedState,o.updateQueue=c.updateQueue,s=c.dependencies,o.dependencies=null===s?null:{expirationTime:s.expirationTime,firstContext:s.firstContext,responders:s.responders}),n=n.sibling;Or(po,po.current&lo|fo),t=t.child;break e}n=n.sibling}}else{if(!s)if(null!==(n=mo(c))){if(t.effectTag|=64,s=!0,Ra(o,!0),null===o.tail&&"hidden"===o.tailMode){null!==(r=n.updateQueue)&&(t.updateQueue=r,t.effectTag|=4),null!==(t=t.lastEffect=o.lastEffect)&&(t.nextEffect=null);break}}else ci()>o.tailExpiration&&1<r&&(t.effectTag|=64,s=!0,Ra(o,!1),t.expirationTime=t.childExpirationTime=r-1);o.isBackwards?(c.sibling=t.child,t.child=c):(null!==(r=o.last)?r.sibling=c:t.child=c,o.last=c)}if(null!==o.tail){0===o.tailExpiration&&(o.tailExpiration=ci()+500),r=o.tail,o.rendering=r,o.tail=r.sibling,o.lastEffect=t.lastEffect,r.sibling=null,n=po.current,Or(po,n=s?n&lo|fo:n&lo),t=r;break e}break;case 20:break;default:throw a(Error(156))}t=null}if(r=us,1===cs||1!==r.childExpirationTime){for(n=0,o=r.child;null!==o;)(s=o.expirationTime)>n&&(n=s),(c=o.childExpirationTime)>n&&(n=c),o=o.sibling;r.childExpirationTime=n}if(null!==t)return t;null!==e&&0===(1024&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=us.firstEffect),null!==us.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=us.firstEffect),e.lastEffect=us.lastEffect),1<us.effectTag&&(null!==e.lastEffect?e.lastEffect.nextEffect=us:e.f
1irstEffect=us,e.lastEffect=us))}else{if(null!==(t=Oa(us)))return t.effectTag&=1023,t;null!==e&&(e.firstEffect=e.lastEffect=null,e.effectTag|=1024)}if(null!==(t=us.sibling))return t;us=e}while(null!==us);return ls===ts&&(ls=os),null}function Ks(e){var t=li();return fi(99,zs.bind(null,e,t)),null!==Es&&pi(97,(function(){return Hs(),null})),null}function zs(e,t){if(Hs(),(as&(Za|es))!==Ja)throw a(Error(327));var n=e.finishedWork,r=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw a(Error(177));e.callbackNode=null,e.callbackExpirationTime=0;var i=n.expirationTime,o=n.childExpirationTime;if(i=o>i?o:i,e.firstPendingTime=i,i<e.lastPendingTime&&(e.lastPendingTime=i),e===ss&&(us=ss=null,cs=0),1<n.effectTag?null!==n.lastEffect?(n.lastEffect.nextEffect=n,i=n.firstEffect):i=n:i=n.firstEffect,null!==i){o=as,as|=es,Xa.current=null,Er=xn;var s=Kn();if(zn(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{var c=(u=(u=s.ownerDocument)&&u.defaultView||window).getSelection&&u.getSelection();if(c&&0!==c.rangeCount){u=c.anchorNode;var l=c.anchorOffset,h=c.focusNode;c=c.focusOffset;try{u.nodeType,h.nodeType}catch(q){u=null;break e}var f=0,p=-1,d=-1,m=0,y=0,g=s,v=null;t:for(;;){for(var b;g!==u||0!==l&&3!==g.nodeType||(p=f+l),g!==h||0!==c&&3!==g.nodeType||(d=f+c),3===g.nodeType&&(f+=g.nodeValue.length),null!==(b=g.firstChild);)v=g,g=b;for(;;){if(g===s)break t;if(v===u&&++m===l&&(p=f),v===h&&++y===c&&(d=f),null!==(b=g.nextSibling))break;v=(g=v).parentNode}g=b}u=-1===p||-1===d?null:{start:p,end:d}}else u=null}u=u||{start:0,end:0}}else u=null;Tr={focusedElem:s,selectionRange:u},xn=!1,gs=i;do{try{for(;null!==gs;){if(0!==(256&gs.effectTag)){var _=gs.alternate;switch((s=gs).tag){case 0:case 11:case 15:Fa(go,yo,s);break;case 1:if(256&s.effectTag&&null!==_){var w=_.memoizedProps,E=_.memoizedState,T=s.stateNode,S=T.getSnapshotBeforeUpdate(s.elementType===s.type?w:vi(s.type,w),E);T.__reactInternalSnapshotBeforeUpdate=S}break;case 3:case 5:case 6:case 4:case 17:break;default:throw a(Error(163))}}gs=gs.nextEffect}}catch(q){if(null===gs)throw a(Error(330));Xs(gs,q),gs=gs.nextEffect}}while(null!==gs);gs=i;do{try{for(_=t;null!==gs;){var C=gs.effectTag;if(16&C&&fr(gs.stateNode,""),128&C){var I=gs.alternate;if(null!==I){var k=I.ref;null!==k&&("function"===typeof k?k(null):k.current=null)}}switch(14&C){case 2:ja(gs),gs.effectTag&=-3;break;case 6:ja(gs),gs.effectTag&=-3,Wa(gs.alternate,gs);break;case 4:Wa(gs.alternate,gs);break;case 8:Ba(w=gs,_),w.return=null,w.child=null,w.memoizedState=null,w.updateQueue=null,w.dependencies=null;var N=w.alternate;null!==N&&(N.return=null,N.child=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null)}gs=gs.nextEffect}}catch(q){if(null===gs)throw a(Error(330));Xs(gs,q),gs=gs.nextEffect}}while(null!==gs);if(k=Tr,I=Kn(),C=k.focusedElem,_=k.selectionRange,I!==C&&C&&C.ownerDocument&&function e(t,n){return!(!t||!n)&&(t===n||(!t||3!==t.nodeType)&&(n&&3===n.nodeType?e(t,n.parentNode):"contains"in t?t.contains(n):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(n))))}(C.ownerDocument.documentElement,C)){null!==_&&zn(C)&&(I=_.start,void 0===(k=_.end)&&(k=I),"selectionStart"in C?(C.selectionStart=I,C.selectionEnd=Math.min(k,C.value.length)):(k=(I=C.ownerDocument||document)&&I.defaultView||window).getSelection&&(k=k.getSelection(),w=C.textContent.length,N=Math.min(_.start,w),_=void 0===_.end?N:Math.min(_.end,w),!k.extend&&N>_&&(w=_,_=N,N=w),w=Qn(C,N),E=Qn(C,_),w&&E&&(1!==k.rangeCount||k.anchorNode!==w.node||k.anchorOffset!==w.offset||k.focusNode!==E.node||k.focusOffset!==E.offset)&&((I=I.createRange()).setStart(w.node,w.offset),k.removeAllRanges(),N>_?(k.addRange(I),k.extend(E.node,E.offset)):(I.setEnd(E.node,E.offset),k.addRange(I))))),I=[];for(k=C;k=k.parentNode;)1===k.nodeType&&I.push({element:k,left:k.scrollLeft,top:k.scrollTop});for("function"===typeof C.focus&&C.focus(),C=0;C<I.length;C++)(k=I[C]).element.scrollLeft=k.left,k.element.scrollTop=k.top}Tr=null,xn=!!Er,Er=null,e.current=n,gs=i;do{try{for(C=r;null!==gs;){var A=gs.effectTag;if(36&A){var D=gs.alternate;switch(k=C,(I=gs).tag){case 0:case 11:case 15:Fa(_o,wo,I);break;case 1:var R=I.stateNode;if(4&I.effectTag)if(null===D)R.componentDidMount();else{var O=I.elementType===I.type?D.memoizedProps:vi(I.type,D.memoizedProps);R.componentDidUpdate(O,D.memoizedState,R.__reactInternalSnapshotBeforeUpdate)}var P=I.updateQueue;null!==P&&qi(0,P,R);break;case 3:var x=I.updateQueue;
1if(null!==x){if(N=null,null!==I.child)switch(I.child.tag){case 5:N=I.child.stateNode;break;case 1:N=I.child.stateNode}qi(0,x,N)}break;case 5:var M=I.stateNode;null===D&&4&I.effectTag&&(k=M,Sr(I.type,I.memoizedProps)&&k.focus());break;case 6:case 4:case 12:break;case 13:case 19:case 17:case 20:break;default:throw a(Error(163))}}if(128&A){var L=gs.ref;if(null!==L){var F=gs.stateNode;switch(gs.tag){case 5:var U=F;break;default:U=F}"function"===typeof L?L(U):L.current=U}}512&A&&(ws=!0),gs=gs.nextEffect}}catch(q){if(null===gs)throw a(Error(330));Xs(gs,q),gs=gs.nextEffect}}while(null!==gs);gs=null,ii(),as=o}else e.current=n;if(ws)ws=!1,Es=e,Ss=r,Ts=t;else for(gs=i;null!==gs;)t=gs.nextEffect,gs.nextEffect=null,gs=t;if(0!==(t=e.firstPendingTime)?xs(e,A=gi(A=As(),t),t):_s=null,"function"===typeof eu&&eu(n.stateNode,r),1073741823===t?e===ks?Is++:(Is=0,ks=e):Is=0,vs)throw vs=!1,e=bs,bs=null,e;return(as&$a)!==Ja?null:(mi(),null)}function Hs(){if(null===Es)return!1;var e=Es,t=Ss,n=Ts;return Es=null,Ss=0,Ts=90,fi(97<n?97:n,Gs.bind(null,e,t))}function Gs(e){if((as&(Za|es))!==Ja)throw a(Error(331));var t=as;for(as|=es,e=e.current.firstEffect;null!==e;){try{var n=e;if(0!==(512&n.effectTag))switch(n.tag){case 0:case 11:case 15:Fa(To,yo,n),Fa(yo,Eo,n)}}catch(r){if(null===e)throw a(Error(330));Xs(e,r)}n=e.nextEffect,e.nextEffect=null,e=n}return as=t,mi(),!0}function Ys(e,t,n){xi(e,t=za(e,t=Pa(n,t),1073741823)),null!==(e=Ps(e,1073741823))&&xs(e,99,1073741823)}function Xs(e,t){if(3===e.tag)Ys(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){Ys(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"===typeof n.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===_s||!_s.has(r))){xi(n,e=Ha(n,e=Pa(t,e),1073741823)),null!==(n=Ps(n,1073741823))&&xs(n,99,1073741823);break}}n=n.return}}function Js(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),ss===e&&cs===n?ls===is||ls===rs&&1073741823===hs&&ci()-ms<ys?Vs(e,cs):ds=!0:e.lastPendingTime<n||(0!==(t=e.pingTime)&&t<n||(e.pingTime=n,e.finishedExpirationTime===n&&(e.finishedExpirationTime=0,e.finishedWork=null),xs(e,t=gi(t=As(),n),n)))}function $s(e,t){var n=e.stateNode;null!==n&&n.delete(t),n=gi(n=As(),t=Ds(n,e,null)),null!==(e=Ps(e,t))&&xs(e,n,t)}var Zs=void 0;Zs=function(e,t,n){var r=t.expirationTime;if(null!==e){var i=t.pendingProps;if(e.memoizedProps!==i||Mr.current)ha=!0;else if(r<n){switch(ha=!1,t.tag){case 3:_a(t),ca();break;case 5:if(uo(t),4&t.mode&&1!==n&&i.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:Ur(t.type)&&Wr(t);break;case 4:ao(t,t.stateNode.containerInfo);break;case 10:Si(t,t.memoizedProps.value);break;case 13:if(null!==t.memoizedState)return 0!==(r=t.child.childExpirationTime)&&r>=n?Ea(e,t,n):(Or(po,po.current&lo),null!==(t=Ca(e,t,n))?t.sibling:null);Or(po,po.current&lo);break;case 19:if(r=t.childExpirationTime>=n,0!==(64&e.effectTag)){if(r)return Sa(e,t,n);t.effectTag|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null),Or(po,po.current),!r)return null}return Ca(e,t,n)}}else ha=!1;switch(t.expirationTime=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=Fr(t,xr.current),ki(t,n),i=Vo(null,t,r,e,i,n),t.effectTag|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof){if(t.tag=1,jo(),Ur(r)){var o=!0;Wr(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null;var s=r.getDerivedStateFromProps;"function"===typeof s&&Wi(t,r,s,e),i.updater=Qi,t.stateNode=i,i._reactInternalFiber=t,Gi(t,r,e,n),t=ba(null,t,r,!0,o,n)}else t.tag=0,fa(null,t,i,n),t=t.child;return t;case 16:switch(i=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=function(e){var t=e._result;switch(e._status){case 1:return t;case 2:case 0:throw t;default:switch(e._status=0,(t=(t=e._ctor)()).then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)})),e._status){case 1:return e._result;case 2:throw e._result}throw e._result=t,t}}(i),t.type=i,o=t.tag=function(e){if("function"===typeof e)return iu(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===rt)return 11;if(e===at)return 14}return 2}(i),e=vi(i,e),o){case 0:t=ga(null,t,i,e,n);break;case 1:t=va(null,t,i,e,n);break;case 11:t=pa(null,t,i,e,n);break;case 14:t=da(null,t,i,vi(i.type,e),r,n);break;default:throw a(Error(306),i,"")}return t;case 0:return r=t.type,i=t.pendingProps,ga(e,t,r,i=t.elementType===r?i:vi(r,i),n);case 1:return r=t.type,i=t.pendingProps,va(e,t,r,i=t.elementType===r?i:vi(r,i),n);case 3:if(_a(t),null===(r=t.updateQueue))throw a(Error(282));return i=null!==(i=t.memoizedState)?i.element:null,Ui(t,r,t.pendingProps,null,
1n),(r=t.memoizedState.element)===i?(ca(),t=Ca(e,t,n)):(i=t.stateNode,(i=(null===e||null===e.child)&&i.hydrate)&&(na=Nr(t.stateNode.containerInfo.firstChild),ta=t,i=ra=!0),i?(t.effectTag|=2,t.child=eo(t,null,r,n)):(fa(e,t,r,n),ca()),t=t.child),t;case 5:return uo(t),null===e&&aa(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,s=i.children,Cr(r,i)?s=null:null!==o&&Cr(r,o)&&(t.effectTag|=16),ya(e,t),4&t.mode&&1!==n&&i.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(fa(e,t,s,n),t=t.child),t;case 6:return null===e&&aa(t),null;case 13:return Ea(e,t,n);case 4:return ao(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Zi(t,null,r,n):fa(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,pa(e,t,r,i=t.elementType===r?i:vi(r,i),n);case 7:return fa(e,t,t.pendingProps,n),t.child;case 8:case 12:return fa(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,Si(t,o=i.value),null!==s){var u=s.value;if(0===(o=tn(u,o)?0:0|("function"===typeof r._calculateChangedBits?r._calculateChangedBits(u,o):1073741823))){if(s.children===i.children&&!Mr.current){t=Ca(e,t,n);break e}}else for(null!==(u=t.child)&&(u.return=t);null!==u;){var c=u.dependencies;if(null!==c){s=u.child;for(var l=c.firstContext;null!==l;){if(l.context===r&&0!==(l.observedBits&o)){1===u.tag&&((l=Oi(n,null)).tag=2,xi(u,l)),u.expirationTime<n&&(u.expirationTime=n),null!==(l=u.alternate)&&l.expirationTime<n&&(l.expirationTime=n),Ii(u.return,n),c.expirationTime<n&&(c.expirationTime=n);break}l=l.next}}else s=10===u.tag&&u.type===t.type?null:u.child;if(null!==s)s.return=u;else for(s=u;null!==s;){if(s===t){s=null;break}if(null!==(u=s.sibling)){u.return=s.return,s=u;break}s=s.return}u=s}}fa(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=(o=t.pendingProps).children,ki(t,n),r=r(i=Ni(i,o.unstable_observedBits)),t.effectTag|=1,fa(e,t,r,n),t.child;case 14:return o=vi(i=t.type,t.pendingProps),da(e,t,i,o=vi(i.type,o),r,n);case 15:return ma(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:vi(r,i),null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,Ur(r)?(e=!0,Wr(t)):e=!1,ki(t,n),zi(t,r,i),Gi(t,r,i,n),ba(null,t,r,!0,e,n);case 19:return Sa(e,t,n)}throw a(Error(156))};var eu=null,tu=null;function nu(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=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 ru(e,t,n,r){return new nu(e,t,n,r)}function iu(e){return!(!(e=e.prototype)||!e.isReactComponent)}function ou(e,t){var n=e.alternate;return null===n?((n=ru(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.effectTag=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childExpirationTime=e.childExpirationTime,n.expirationTime=e.expirationTime,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{expirationTime:t.expirationTime,firstContext:t.firstContext,responders:t.responders},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function au(e,t,n,r,i,o){var s=2;if(r=e,"function"===typeof e)iu(e)&&(s=1);else if("string"===typeof e)s=5;else e:switch(e){case Je:return su(n.children,i,o,t);case nt:s=8,i|=7;break;case $e:s=8,i|=1;break;case Ze:return(e=ru(12,n,t,8|i)).elementType=Ze,e.type=Ze,e.expirationTime=o,e;case it:return(e=ru(13,n,t,i)).type=it,e.elementType=it,e.expirationTime=o,e;case ot:return(e=ru(19,n,t,i)).elementType=ot,e.expirationTime=o,e;default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case et:s=10;break e;case tt:s=9;break e;case rt:s=11;break e;case at:s=14;break e;case st:s=16,r=null;break e}throw a(Error(130),null==e?e:typeof e,"")}return(t=ru(s,n,t,i)).elementType=e,t.type=r,t.expirationTime=o,t}function su(e,t,n,r){return(e=ru(7,e,r,t)).expirationTime=n,e}function uu(e,t,n){return(e=ru(6,e,null,t)).expirationTime=n,e}function cu(e,t,n){return(t=ru(4,null!==e.children?e.children:[],e.key,t)).expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lu(e,t,n){this.tag=t,this.current=null,this.containerInfo=e,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=this.firstBatch=null,this.pingTime=this.lastPendingTime=this.firstPendingTime=this.callbackExpirationTime=0}function hu(e,t,n){return e=new lu(e,t,n),t=ru(3,null,null,2===t?7:1===t?3:0),e.current=t,t.stateNode=e}function fu(e,t,n,r,i,o){var s=t.current;e:if(n){t:{if(2!==an(n=n._reactInternalFiber)||1!==n.tag)throw a(Error(170));var u=n;do{switch(u.tag){case 3:u=u.stateNode.context;break t;case 1:if(Ur(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break t}}u=u.return}while(null!==u);throw a(Error(171))}if(1===n.tag){var c=n.type;if(Ur(c)){n=Br(n,c,u);break e}}n=u}else n=Pr;return null===t.context?t.context=n:t.pendingContext=n,t=o,(i=Oi(r,i)).payload={element:e},null!==(t=void 0===t?null:t)&&(i.callback=t),xi(s,i),Os(s,r),r}function pu(e,t,n,r){var i=t.current,o=As(),a=ji.suspense;return fu(e,t,n,i=Ds(o,i,a),a,r)}function du(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 5:default:return e.child.stateNode}}function mu(e){var t=1073741821-25*(1+((1073741821-As()+500)/25|0));t<=Rs&&--t,this._expirationTime=Rs=t,this._root=e,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function yu(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function gu(e,t,n){this._internalRoot=hu(e,t,n)}function vu(e,t){this._internalRoot=hu(e,2,t)}function bu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function _u(e,t,n,r,i){var o=n._reactRootContainer,a=void 0;if(o){if(a=o._internalRoot,"function"===typeof i){var s=i;i=function(){var e=du(a);s.call(e)}}pu(t,a,e,i)}else{if(o=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new gu(e,0,t)}(n,r),a=o._internalRoot,"function"===typeof i){var u=i;i=function(){var e=du(a);u.call(e)}}qs((function(){pu(t,a,e,i)}))}return du(a)}function wu(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!bu(t))throw a(Error(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Xe,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)}ke=function(e,t,n){switch(t){case"input":if(Ct(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=q(r);if(!i)throw a(Error(90));Ke(r),Ct(r,i)}}}break;case"textarea":or(e,n);break;case"select":null!=(t=n.value)&&nr(e,!!n.multiple,t,!1)}},mu.prototype.render=function(e){if(!this._defer)throw a(Error(250));this._hasChildren=!0,this._children=e;var t=this._root._internalRoot,n=this._expirationTime,r=new yu;return fu(e,t,null,n,null,r._onCommit),r},mu.prototype.then=function(e){if(this._didComplete)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},mu.prototype.commit=function(){var e=this._root._internalRoot,t=e.firstBatch;if(!this._defer||null===t)throw a(Error(251));if(this._hasChildren){var n=this._expirationTime;if(t!==this){this._hasChildren&&(n=this._expirationTime=t._expirationTime,this.render(this._children));for(var r=null,i=t;i!==this;)r=i,i=i._next;if(null===r)throw a(Error(251));r._next=i._next,this._next=t,e.firstBatch=this}if(this._defer=!1,t=n,(as&(Za|es))!==Ja)throw a(Error(253));di(js.bind(null,e,t)),mi(),t=this._next,this._next=null,null!==(t=e.firstBatch=t)&&t._hasChildren&&t.render(t._children)}else this._next=null,this._defer=!1},mu.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var e=this._callbacks;
1if(null!==e)for(var t=0;t<e.length;t++)(0,e[t])()}},yu.prototype.then=function(e){if(this._didCommit)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},yu.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++){var n=e[t];if("function"!==typeof n)throw a(Error(191),n);n()}}},vu.prototype.render=gu.prototype.render=function(e,t){var n=this._internalRoot,r=new yu;return null!==(t=void 0===t?null:t)&&r.then(t),pu(e,n,null,r._onCommit),r},vu.prototype.unmount=gu.prototype.unmount=function(e){var t=this._internalRoot,n=new yu;return null!==(e=void 0===e?null:e)&&n.then(e),pu(null,t,null,n._onCommit),n},vu.prototype.createBatch=function(){var e=new mu(this),t=e._expirationTime,n=this._internalRoot,r=n.firstBatch;if(null===r)n.firstBatch=e,e._next=null;else{for(n=null;null!==r&&r._expirationTime>=t;)n=r,r=r._next;e._next=r,null!==n&&(n._next=e)}return e},Pe=Fs,xe=Us,Me=Ls,Le=function(e,t){var n=as;as|=2;try{return e(t)}finally{(as=n)===Ja&&mi()}};var Eu={createPortal:wu,findDOMNode:function(e){if(null==e)e=null;else if(1!==e.nodeType){var t=e._reactInternalFiber;if(void 0===t){if("function"===typeof e.render)throw a(Error(188));throw a(Error(268),Object.keys(e))}e=null===(e=un(t))?null:e.stateNode}return e},hydrate:function(e,t,n){if(!bu(t))throw a(Error(200));return _u(null,e,t,!0,n)},render:function(e,t,n){if(!bu(t))throw a(Error(200));return _u(null,e,t,!1,n)},unstable_renderSubtreeIntoContainer:function(e,t,n,r){if(!bu(n))throw a(Error(200));if(null==e||void 0===e._reactInternalFiber)throw a(Error(38));return _u(e,t,n,!1,r)},unmountComponentAtNode:function(e){if(!bu(e))throw a(Error(40));return!!e._reactRootContainer&&(qs((function(){_u(null,null,e,!1,(function(){e._reactRootContainer=null}))})),!0)},unstable_createPortal:function(){return wu.apply(void 0,arguments)},unstable_batchedUpdates:Fs,unstable_interactiveUpdates:function(e,t,n,r){return Ls(),Us(e,t,n,r)},unstable_discreteUpdates:Us,unstable_flushDiscreteUpdates:Ls,flushSync:function(e,t){if((as&(Za|es))!==Ja)throw a(Error(187));var n=as;as|=1;try{return fi(99,e.bind(null,t))}finally{as=n,mi()}},unstable_createRoot:function(e,t){if(!bu(e))throw a(Error(299),"unstable_createRoot");return new vu(e,null!=t&&!0===t.hydrate)},unstable_createSyncRoot:function(e,t){if(!bu(e))throw a(Error(299),"unstable_createRoot");return new gu(e,1,null!=t&&!0===t.hydrate)},unstable_flushControlled:function(e){var t=as;as|=1;try{fi(99,e)}finally{(as=t)===Ja&&mi()}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[F,U,q,R.injectEventPluginsByName,f,K,function(e){k(e,Q)},Re,Oe,qn,D,Hs,{current:!1}]}};!function(e){var t=e.findFiberByHostInstance;(function(e){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);eu=function(e){try{t.onCommitFiberRoot(n,e,void 0,64===(64&e.current.effectTag))}catch(r){}},tu=function(e){try{t.onCommitFiberUnmount(n,e)}catch(r){}}}catch(r){}})(i({},e,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ze.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=un(e))?null:e.stateNode},findFiberByHostInstance:function(e){return t?t(e):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))}({findFiberByHostInstance:L,bundleType:0,version:"16.9.0",rendererPackageName:"react-dom"});var Tu={default:Eu},Su=Tu&&Eu||Tu;e.exports=Su.default||Su},function(e,t,n){"use strict";e.exports=n(14)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=void 0,i=void 0,o=void 0,a=void 0,s=void 0;if(t.unstable_now=void 0,t.unstable_forceFrameRate=void 0,"undefined"===typeof window||"function"!==typeof MessageChannel){var u=null,c=null,l=function e(){if(null!==u)try{var n=t.unstable_now();u(!0,n),u=null}catch(r){throw setTimeout(e,0),r}};t.unstable_now=function(){return Date.now()},r=function(e){null!==u?setTimeout(r,0,e):(u=e,setTimeout(l,0))},i=function(e,t){c=setTimeout(e,t)},o=function(){clearTimeout(c)},a=function(){return!1},s=t.unstable_forceFrameRate=function(){}}else{var h=window.performance,f=window.Date,p=window.setTimeout,d=window.clearTimeout,m=window.requestAnimationFrame,y=window.cancelAnimationFrame;"undefined"!==typeof console&&("function"!==typeof m&&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 y&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")),t.unstable_now="object"===typeof h&&"function"===typeof h.now?function(){return h.now()}:function(){return f.now()};var g=!1,v=null,b=-1,_=-1,w=33.33,E=-1,T=-1,S=0,C=!1;a=function(){return t.unstable_now()>=S},s=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):0<e?(w=Math.floor(1e3/e),C=!0):(w=33.33,C=!1)};var I=function(){if(null!==v){var e=t.unstable_now(),n=0<S-e;try{v(n,e)||(v=null)}catch(r){throw N.postMessage(null),r}}},k=new MessageChannel,N=k.port2;k.port1.onmessage=I;r=function(e){v=e,g||(g=!0,m((function(e){!function e(n){if(null===v)T=E=-1,g=!1;else{g=!0,m((function(t){d(b),e(t)}));if(b=p((function e(){S=t.unstable_now()+w/2,I(),b=p(e,3*w)}),3*w),-1!==E&&.1<n-E){var r=n-E;!C&&-1!==T&&r<w&&T<w&&(8.33>(w=r<T?T:r)&&(w=8.33)),T=r}E=n,S=n+w,N.postMessage(null)}}(e)})))},i=function(e,n){_=p((function(){e(t.unstable_now())}),n)},o=function(){d(_),_=-1}}var A=null,D=null,R=null,O=3,P=!1,x=!1,M=!1;function L(e,t){var n=e.next;if(n===e)A=null;else{e===A&&(A=n);var r=e.previous;r.next=n,n.previous=r}e.next=e.previous=null,n=e.callback,r=O;var i=R;O=e.priorityLevel,R=e;try{var o=e.expirationTime<=t;switch(O){case 1:var a=n(o);break;case 2:case 3:case 4:a=n(o);break;case 5:a=n(o)}}catch(s){throw s}finally{O=r,R=i}if("function"===typeof a)if(t=e.expirationTime,e.callback=a,null===A)A=e.next=e.previous=e;else{a=null,o=A;do{if(t<=o.expirationTime){a=o;break}o=o.next}while(o!==A);null===a?a=A:a===A&&(A=e),(t=a.previous).next=a.previous=e,e.next=a,e.previous=t}}function F(e){if(null!==D&&D.startTime<=e)do{var t=D,n=t.next;if(t===n)D=null;else{D=n;var r=t.previous;r.next=n,n.previous=r}t.next=t.previous=null,j(t,t.expirationTime)}while(null!==D&&D.startTime<=e)}function U(e){M=!1,F(e),x||(null!==A?(x=!0,r(q)):null!==D&&i(U,D.startTime-e))}function q(e,n){x=!1,M&&(M=!1,o()),F(n),P=!0;try{if(e){if(null!==A)do{L(A,n),F(n=t.unstable_now())}while(null!==A&&!a())}else for(;null!==A&&A.expirationTime<=n;)L(A,n),F(n=t.unstable_now());return null!==A||(null!==D&&i(U,D.startTime-n),!1)}finally{P=!1}}function V(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}function j(e,t){if(null===A)A=e.next=e.previous=e;else{var n=null,r=A;do{if(t<r.expirationTime){n=r;break}r=r.next}
1while(r!==A);null===n?n=A:n===A&&(A=e),(t=n.previous).next=n.previous=e,e.next=n,e.previous=t}}var B=s;t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=O;O=e;try{return t()}finally{O=n}},t.unstable_next=function(e){switch(O){case 1:case 2:case 3:var t=3;break;default:t=O}var n=O;O=t;try{return e()}finally{O=n}},t.unstable_scheduleCallback=function(e,n,a){var s=t.unstable_now();if("object"===typeof a&&null!==a){var u=a.delay;u="number"===typeof u&&0<u?s+u:s,a="number"===typeof a.timeout?a.timeout:V(e)}else a=V(e),u=s;if(e={callback:n,priorityLevel:e,startTime:u,expirationTime:a=u+a,next:null,previous:null},u>s){if(a=u,null===D)D=e.next=e.previous=e;else{n=null;var c=D;do{if(a<c.startTime){n=c;break}c=c.next}while(c!==D);null===n?n=D:n===D&&(D=e),(a=n.previous).next=n.previous=e,e.next=n,e.previous=a}null===A&&D===e&&(M?o():M=!0,i(U,u-s))}else j(e,a),x||P||(x=!0,r(q));return e},t.unstable_cancelCallback=function(e){var t=e.next;if(null!==t){if(e===t)e===A?A=null:e===D&&(D=null);else{e===A?A=t:e===D&&(D=t);var n=e.previous;n.next=t,t.previous=n}e.next=e.previous=null}},t.unstable_wrapCallback=function(e){var t=O;return function(){var n=O;O=t;try{return e.apply(this,arguments)}finally{O=n}}},t.unstable_getCurrentPriorityLevel=function(){return O},t.unstable_shouldYield=function(){var e=t.unstable_now();return F(e),null!==R&&null!==A&&A.startTime<=e&&A.expirationTime<R.expirationTime||a()},t.unstable_requestPaint=B,t.unstable_continueExecution=function(){x||P||(x=!0,r(q))},t.unstable_pauseExecution=function(){},t.unstable_getFirstCallbackNode=function(){return A}},,function(e,t,n){"use strict";n.r(t),function(e){var t=n(1),r=n.n(t);(function(){var t,n="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){e!=Array.prototype&&e!=Object.prototype&&(e[t]=n.value)},i="undefined"!=typeof window&&window===this?this:"undefined"!=typeof e&&null!=e?e:this;function o(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}function a(e){var t="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return t?t.call(e):{next:o(e)}}!function(e,t){if(t){var r=i;e=e.split(".");for(var o=0;o<e.length-1;o++){var a=e[o];a in r||(r[a]={}),r=r[a]}(t=t(o=r[e=e[e.length-1]]))!=o&&null!=t&&n(r,e,{configurable:!0,writable:!0,value:t})}}("Promise",(function(e){function t(e){this.b=0,this.c=void 0,this.a=[];var t=this.f();try{e(t.resolve,t.reject)}catch(n){t.reject(n)}}function n(){this.a=null}function r(e){return e instanceof t?e:new t((function(t){t(e)}))}if(e)return e;n.prototype.b=function(e){if(null==this.a){this.a=[];var t=this;this.c((function(){t.g()}))}this.a.push(e)};var o=i.setTimeout;n.prototype.c=function(e){o(e,0)},n.prototype.g=function(){for(;this.a&&this.a.length;){var e=this.a;this.a=[];for(var t=0;t<e.length;++t){var n=e[t];e[t]=null;try{n()}catch(r){this.f(r)}}}this.a=null},n.prototype.f=function(e){this.c((function(){throw e}))},t.prototype.f=function(){function e(e){return function(r){n||(n=!0,e.call(t,r))}}var t=this,n=!1;return{resolve:e(this.m),reject:e(this.g)}},t.prototype.m=function(e){if(e===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof t)this.o(e);else{e:switch(typeof e){case"object":var n=null!=e;break e;case"function":n=!0;break e;default:n=!1}n?this.u(e):this.h(e)}},t.prototype.u=function(e){var t=void 0;try{t=e.then}catch(n){return void this.g(n)}"function"==typeof t?this.v(t,e):this.h(e)},t.prototype.g=function(e){this.i(2,e)},t.prototype.h=function(e){this.i(1,e)},t.prototype.i=function(e,t){if(0!=this.b)throw Error("Cannot settle("+e+", "+t+"): Promise already settled in state"+this.b);this.b=e,this.c=t,this.l()},t.prototype.l=function(){if(null!=this.a){for(var e=0;e<this.a.length;++e)s.b(this.a[e]);this.a=null}};var s=new n;return t.prototype.o=function(e){var t=this.f();e.Ja(t.resolve,t.reject)},t.prototype.v=function(e,t){var n=this.f();try{e.call(t,n.resolve,n.reject)}catch(r){n.reject(r)}},t.prototype.then=function(e,n){function r(e,t){return"function"==typeof e?function(t){try{i(e(t))}catch(n){o(n)}}:t}var i,o,a=new t((function(e,t){i=e,o=t}));return this.Ja(r(e,i),r(n,o)),a},t.prototype.catch=function(e){return this.then(void 0,e)},t.prototype.Ja=function(e,t){function n(){switch(r.b){case 1:e(r.c);break;case 2:t(r.c);break;default:throw Error("Unexpected state: "+r.b)}}var r=this;null==this.a?s.b(n):this.a.push(n)},t.resolve=r,t.reject=function(e){return new t((function(t,n){n(e)}))},t.race=function(e){return new t((function(t,n){for(var i=a(e),o=i.next();!o.done;o=i.next())r(o.value).Ja(t,n)}))},t.all=function(e){var n=a(e),i=n.next();return i.done?r([]):new t((function(e,t){function o(t){return function(n){a[t]=n,0==--s&&e(a)}}var a=[],s=0;do{a.push(void 0),s++,r(i.value).Ja(o(a.length-1),t),i=n.next()}while(!i.done)}))},t}));var s=s||{},u=this||self;function c(e){return"string"==typeof e}function l(e){return"boolean"==typeof e}var h=/^[\w+\/_-]+[=]{0,2}$/,f=null;function p(){}function d(e){var t=typeof e;if("object"==t){if(!e)return"null";if(e instanceof Array)return"array";if(e instanceof Object)return t;var n=Object.prototype.toString.call(e);
1if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof e.length&&"undefined"!=typeof e.splice&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||"undefined"!=typeof e.call&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("call"))return"function"}else if("function"==t&&"undefined"==typeof e.call)return"object";return t}function m(e){return null===e}function y(e){return"array"==d(e)}function g(e){var t=d(e);return"array"==t||"object"==t&&"number"==typeof e.length}function v(e){return"function"==d(e)}function b(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var _="closure_uid_"+(1e9*Math.random()>>>0),w=0;function E(e,t,n){return e.call.apply(e.bind,arguments)}function T(e,t,n){if(!e)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),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function S(e,t,n){return(S=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?E:T).apply(null,arguments)}function C(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}var I=Date.now||function(){return+new Date};function k(e,t){function n(){}n.prototype=t.prototype,e.qb=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.fd=function(e,n,r){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return t.prototype[n].apply(e,i)}}function N(e){if(!e)return!1;try{return!!e.$goog_Thenable}catch(t){return!1}}function A(e){if(Error.captureStackTrace)Error.captureStackTrace(this,A);else{var t=Error().stack;t&&(this.stack=t)}e&&(this.message=String(e))}function D(e,t){for(var n="",r=(e=e.split("%s")).length-1,i=0;i<r;i++)n+=e[i]+(i<t.length?t[i]:"%s");A.call(this,n+e[r])}function R(e,t){throw new D("Failure"+(e?": "+e:""),Array.prototype.slice.call(arguments,1))}function O(e,t){this.c=e,this.f=t,this.b=0,this.a=null}function P(e,t){e.f(t),100>e.b&&(e.b++,t.next=e.a,e.a=t)}function x(){this.b=this.a=null}k(A,Error),A.prototype.name="CustomError",k(D,A),D.prototype.name="AssertionError",O.prototype.get=function(){if(0<this.b){this.b--;var e=this.a;this.a=e.next,e.next=null}else e=this.c();return e};var M=new O((function(){return new F}),(function(e){e.reset()}));function L(){var e=Qe,t=null;return e.a&&(t=e.a,e.a=e.a.next,e.a||(e.b=null),t.next=null),t}function F(){this.next=this.b=this.a=null}function U(e,t){e:{try{var n=e&&e.ownerDocument,r=n&&(n.defaultView||n.parentWindow);if((r=r||u).Element&&r.Location){var i=r;break e}}catch(a){}i=null}if(i&&"undefined"!=typeof i[t]&&(!e||!(e instanceof i[t])&&(e instanceof i.Location||e instanceof i.Element))){if(b(e))try{var o=e.constructor.displayName||e.constructor.name||Object.prototype.toString.call(e)}catch(a){o="<object could not be stringified>"}else o=void 0===e?"undefined":null===e?"null":typeof e;R("Argument is not a %s (or a non-Element, non-Location mock); got: %s",t,o)}}x.prototype.add=function(e,t){var n=M.get();n.set(e,t),this.b?this.b.next=n:this.a=n,this.b=n},F.prototype.set=function(e,t){this.a=e,this.b=t,this.next=null},F.prototype.reset=function(){this.next=this.b=this.a=null};var q=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if(c(e))return c(t)&&1==t.length?e.indexOf(t,0):-1;for(var n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return-1},V=Array.prototype.forEach?function(e,t,n){Array.prototype.forEach.call(e,t,n)}:function(e,t,n){for(var r=e.length,i=c(e)?e.split(""):e,o=0;o<r;o++)o in i&&t.call(n,i[o],o,e)};var j=Array.prototype.map?function(e,t){return Array.prototype.map.call(e,t,void 0)}:function(e,t){for(var n=e.length,r=Array(n),i=c(e)?e.split(""):e,o=0;o<n;o++)o in i&&(r[o]=t.call(void 0,i[o],o,e));return r},B=Array.prototype.some?function(e,t){return Array.prototype.some.call(e,t,void 0)}:function(e,t){for(var n=e.length,r=c(e)?e.split(""):e,i=0;i<n;i++)if(i in r&&t.call(void 0,r[i],i,e))return!0;return!1};function W(e,t){return 0<=q(e,t)}function Q(e,t){var n;return(n=0<=(t=q(e,t)))&&Array.prototype.splice.call(e,t,1),n}function K(e,t){!function(e,t){for(var n=c(e)?e.split(""):e,r=e.length-1;0<=r;--r)r in n&&t.call(void 0,n[r],r,e)}(e,(function(n,r){t.call(void 0,n,r,e)&&1==Array.prototype.splice.call(e,r,1).length&&0}))}function z(e){return Array.prototype.concat.apply([],arguments)}function H(e){var t=e.length;if(0<t){for(var n=Array(t),r=0;r<t;r++)n[r]=e[r];return n}return[]}function G(e,t){for(var n in e)t.call(void 0,e[n],n,e)}function Y(e){for(var t in e)return!1;return!0}function X(e){var t,n={};for(t in e)n[t]=e[t];return n}var J="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
1ing toString valueOf".split(" ");function $(e,t){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])e[n]=r[n];for(var o=0;o<J.length;o++)n=J[o],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function Z(e,t){this.a=e===ne&&t||"",this.b=te}function ee(e){return e instanceof Z&&e.constructor===Z&&e.b===te?e.a:(R("expected object of type Const, got '"+e+"'"),"type_error:Const")}Z.prototype.qa=!0,Z.prototype.pa=function(){return this.a},Z.prototype.toString=function(){return"Const{"+this.a+"}"};var te={},ne={},re=new Z(ne,"");function ie(){this.a="",this.b=ce}function oe(e){return e instanceof ie&&e.constructor===ie&&e.b===ce?e.a:(R("expected object of type TrustedResourceUrl, got '"+e+"' of type "+d(e)),"type_error:TrustedResourceUrl")}function ae(e,t){var n=ee(e);if(!ue.test(n))throw Error("Invalid TrustedResourceUrl format: "+n);return le(e=n.replace(se,(function(e,r){if(!Object.prototype.hasOwnProperty.call(t,r))throw Error('Found marker, "'+r+'", in format string, "'+n+'", but no valid label mapping found in args: '+JSON.stringify(t));return(e=t[r])instanceof Z?ee(e):encodeURIComponent(String(e))})))}ie.prototype.qa=!0,ie.prototype.pa=function(){return this.a.toString()},ie.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var se=/%{(\w+)}/g,ue=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^\/\\]|[^:\/\\%]+\/|[^:\/\\%]*[?#]|about:blank#)/i,ce={};function le(e){var t=new ie;return t.a=e,t}var he=String.prototype.trim?function(e){return e.trim()}:function(e){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(e)[1]},fe=/&/g,pe=/</g,de=/>/g,me=/"/g,ye=/'/g,ge=/\x00/g,ve=/[\x00&<>"']/;function be(e,t){return-1!=e.indexOf(t)}function _e(e,t){return e<t?-1:e>t?1:0}function we(){this.a="",this.b=Ie}function Ee(e){return e instanceof we&&e.constructor===we&&e.b===Ie?e.a:(R("expected object of type SafeUrl, got '"+e+"' of type "+d(e)),"type_error:SafeUrl")}we.prototype.qa=!0,we.prototype.pa=function(){return this.a.toString()},we.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Te=/^(?:(?:https?|mailto|ftp):|[^:\/?#]*(?:[\/?#]|$))/i;function Se(e){return e instanceof we?e:(e="object"==typeof e&&e.qa?e.pa():String(e),Te.test(e)||(e="about:invalid#zClosurez"),ke(e))}var Ce,Ie={};function ke(e){var t=new we;return t.a=e,t}ke("about:blank");e:{var Ne=u.navigator;if(Ne){var Ae=Ne.userAgent;if(Ae){Ce=Ae;break e}}Ce=""}function De(e){return be(Ce,e)}function Re(){this.a="",this.b=Pe}function Oe(e){return e instanceof Re&&e.constructor===Re&&e.b===Pe?e.a:(R("expected object of type SafeHtml, got '"+e+"' of type "+d(e)),"type_error:SafeHtml")}Re.prototype.qa=!0,Re.prototype.pa=function(){return this.a.toString()},Re.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Pe={};function xe(e){var t=new Re;return t.a=e,t}xe("<!DOCTYPE html>");var Me,Le,Fe=xe("");function Ue(e,t){for(var n=e.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")}function qe(e){return ve.test(e)&&(-1!=e.indexOf("&")&&(e=e.replace(fe,"&amp;")),-1!=e.indexOf("<")&&(e=e.replace(pe,"&lt;")),-1!=e.indexOf(">")&&(e=e.replace(de,"&gt;")),-1!=e.indexOf('"')&&(e=e.replace(me,"&quot;")),-1!=e.indexOf("'")&&(e=e.replace(ye,"&#39;")),-1!=e.indexOf("\0")&&(e=e.replace(ge,"&#0;"))),e}function Ve(e){u.setTimeout((function(){throw e}),0)}function je(){var e=u.MessageChannel;if("undefined"===typeof e&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!De("Presto")&&(e=function(){var e=document.createElement("IFRAME");e.style.display="none",function(e){var t=le(ee(re));U(e,"HTMLIFrameElement"),e.src=oe(t).toString()}(e),document.documentElement.appendChild(e);var t=e.contentWindow;(e=t.document).open(),e.write(Oe(Fe)),e.close();var n="callImmediate"+Math.random(),r="file:"==t.location.protocol?"*":t.location.protocol+"//"+t.location.host;e=S((function(e){"*"!=r&&e.origin!=r||e.data!=n||this.port1.onmessage()}),this),t.addEventListener("message",e,!1),this.port1={},this.port2={postMessage:function(){t.postMessage(n,r)}}}),"undefined"!==typeof e&&!De("Trident")&&!De("MSIE")){var t=new e,n={},r=n;return t.port1.onmessage=function(){if(void 0!==n.next){var e=(n=n.next).yb;n.yb=null,e()}},function(e){r.next={yb:e},r=r.next,t.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(e){var t=document.createElement("SCRIPT");t.onreadystatechange=function(){t.onreadystatechange=null,t.parentNode.removeChild(t),t=null,e(),e=null},document.documentElement.appendChild(t)}:function(e){u.setTimeout(e,0)}}function Be(e,t){Le||function(){if(u.Promise&&u.Promise.resolve){var e=u.Promise.resolve(void 0);Le=function(){e.then(Ke)}}else Le=function(){var e=Ke;!v(u.setImmediate)||u.Window&&u.Window.prototype&&!De("Edge")&&u.Window.prototype.setImmediate==u.setImmediate?(Me||(Me=je()),Me(e)):u.setImmediate(e)}}(),We||(Le(),We=!0),Qe.add(e,t)}xe("<br>");var We=!1,Qe=new x;function Ke(){for(var e;e=L();){try{e.a.call(e.b)}catch(t){Ve(t)}P(M,e)}We=!1}function ze(e,t){if(this.a=He,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,e!=p)try{var n=this;e.call(t,(function(e){ot(n,Ge,e)}),(function(e){if(!(e instanceof ft))try{if(e instanceof Error)throw e;throw Error("Promise rejected.")}catch(t){}ot(n,Ye,e)}))}catch(r){ot(this,Ye,r)}}
1var He=0,Ge=2,Ye=3;function Xe(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}Xe.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var Je=new O((function(){return new Xe}),(function(e){e.reset()}));function $e(e,t,n){var r=Je.get();return r.g=e,r.b=t,r.f=n,r}function Ze(e){if(e instanceof ze)return e;var t=new ze(p);return ot(t,Ge,e),t}function et(e){return new ze((function(t,n){n(e)}))}function tt(e,t,n){at(e,t,n,null)||Be(C(t,e))}function nt(e){return new ze((function(t){var n=e.length,r=[];if(n)for(var i=function(e,i,o){n--,r[e]=i?{Gb:!0,value:o}:{Gb:!1,reason:o},0==n&&t(r)},o=0;o<e.length;o++)tt(e[o],C(i,o,!0),C(i,o,!1));else t(r)}))}function rt(e,t){e.b||e.a!=Ge&&e.a!=Ye||st(e),e.f?e.f.next=t:e.b=t,e.f=t}function it(e,t,n,r){var i=$e(null,null,null);return i.a=new ze((function(e,o){i.g=t?function(n){try{var i=t.call(r,n);e(i)}catch(a){o(a)}}:e,i.b=n?function(t){try{var i=n.call(r,t);void 0===i&&t instanceof ft?o(t):e(i)}catch(a){o(a)}}:o})),i.a.c=e,rt(e,i),i.a}function ot(e,t,n){e.a==He&&(e===n&&(t=Ye,n=new TypeError("Promise cannot resolve to itself")),e.a=1,at(n,e.Oc,e.Pc,e)||(e.i=n,e.a=t,e.c=null,st(e),t!=Ye||n instanceof ft||function(e,t){e.g=!0,Be((function(){e.g&&ht.call(null,t)}))}(e,n)))}function at(e,t,n,r){if(e instanceof ze)return rt(e,$e(t||p,n||null,r)),!0;if(N(e))return e.then(t,n,r),!0;if(b(e))try{var i=e.then;if(v(i))return function(e,t,n,r,i){function o(e){a||(a=!0,r.call(i,e))}var a=!1;try{t.call(e,(function(e){a||(a=!0,n.call(i,e))}),o)}catch(s){o(s)}}(e,i,t,n,r),!0}catch(o){return n.call(r,o),!0}return!1}function st(e){e.h||(e.h=!0,Be(e.Zb,e))}function ut(e){var t=null;return e.b&&(t=e.b,e.b=t.next,t.next=null),e.b||(e.f=null),t}function ct(e,t,n,r){if(n==Ye&&t.b&&!t.c)for(;e&&e.g;e=e.c)e.g=!1;if(t.a)t.a.c=null,lt(t,n,r);else try{t.c?t.g.call(t.f):lt(t,n,r)}catch(i){ht.call(null,i)}P(Je,t)}function lt(e,t,n){t==Ge?e.g.call(e.f,n):e.b&&e.b.call(e.f,n)}ze.prototype.then=function(e,t,n){return it(this,v(e)?e:null,v(t)?t:null,n)},ze.prototype.$goog_Thenable=!0,(t=ze.prototype).ka=function(e,t){return(e=$e(e,e,t)).c=!0,rt(this,e),this},t.s=function(e,t){return it(this,null,e,t)},t.cancel=function(e){this.a==He&&Be((function(){!function e(t,n){if(t.a==He)if(t.c){var r=t.c;if(r.b){for(var i=0,o=null,a=null,s=r.b;s&&(s.c||(i++,s.a==t&&(o=s),!(o&&1<i)));s=s.next)o||(a=s);o&&(r.a==He&&1==i?e(r,n):(a?((i=a).next==r.f&&(r.f=i),i.next=i.next.next):ut(r),ct(r,o,Ye,n)))}t.c=null}else ot(t,Ye,n)}(this,new ft(e))}),this)},t.Oc=function(e){this.a=He,ot(this,Ge,e)},t.Pc=function(e){this.a=He,ot(this,Ye,e)},t.Zb=function(){for(var e;e=ut(this);)ct(this,e,this.a,this.i);this.h=!1};var ht=Ve;function ft(e){A.call(this,e)}function pt(){0!=dt&&(mt[this[_]||(this[_]=++w)]=this),this.ta=this.ta,this.la=this.la}k(ft,A),ft.prototype.name="cancel";var dt=0,mt={};function yt(e){if(!e.ta&&(e.ta=!0,e.xa(),0!=dt)){var t=e[_]||(e[_]=++w);if(0!=dt&&e.la&&0<e.la.length)throw Error(e+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete mt[t]}}function gt(e){return gt[" "](e),e}pt.prototype.ta=!1,pt.prototype.xa=function(){if(this.la)for(;this.la.length;)this.la.shift()()},gt[" "]=p;var vt,bt=De("Opera"),_t=De("Trident")||De("MSIE"),wt=De("Edge"),Et=wt||_t,Tt=De("Gecko")&&!(be(Ce.toLowerCase(),"webkit")&&!De("Edge"))&&!(De("Trident")||De("MSIE"))&&!De("Edge"),St=be(Ce.toLowerCase(),"webkit")&&!De("Edge");function Ct(){var e=u.document;return e?e.documentMode:void 0}e:{var It="",kt=function(){var e=Ce;return Tt?/rv:([^\);]+)(\)|;)/.exec(e):wt?/Edge\/([\d\.]+)/.exec(e):_t?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):St?/WebKit\/(\S+)/.exec(e):bt?/(?:Version)[ \/]?(\S+)/.exec(e):void 0}();if(kt&&(It=kt?kt[1]:""),_t){var Nt=Ct();if(null!=Nt&&Nt>parseFloat(It)){vt=String(Nt);break e}}vt=It}var At,Dt={};function Rt(e){return function(e,t){var n=Dt;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(){for(var t=0,n=he(String(vt)).split("."),r=he(String(e)).split("."),i=Math.max(n.length,r.length),o=0;0==t&&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;t=_e(0==a[1].length?0:parseInt(a[1],10),0==s[1].length?0:parseInt(s[1],10))||_e(0==a[2].length,0==s[2].length)||_e(a[2],s[2]),a=a[3],s=s[3]}while(0==t)}return 0<=t}))}At=u.document&&_t?Ct():void 0;var Ot=Object.freeze||function(e){return e},Pt=!_t||9<=Number(At),xt=_t&&!Rt("9"),Mt=function(){if(!u.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{u.addEventListener("test",p,t),u.removeEventListener("test",p,t)}catch(n){}return e}();function Lt(e,t){this.type=e,this.b=this.target=t,this.Mb=!0}function Ft(e,t){if(Lt.call(this,e?e.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,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.b=t,t=e.relatedTarget){if(Tt){e:{try{gt(t.
1nodeName);var i=!0;break e}catch(o){}i=!1}i||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(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.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=c(e.pointerType)?e.pointerType:Ut[e.pointerType]||"",this.a=e,e.defaultPrevented&&this.preventDefault()}}Lt.prototype.preventDefault=function(){this.Mb=!1},k(Ft,Lt);var Ut=Ot({2:"touch",3:"pen",4:"mouse"});Ft.prototype.preventDefault=function(){Ft.qb.preventDefault.call(this);var e=this.a;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,xt)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch(t){}},Ft.prototype.f=function(){return this.a};var qt="closure_listenable_"+(1e6*Math.random()|0),Vt=0;function jt(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.Na=i,this.key=++Vt,this.ra=this.Ia=!1}function Bt(e){e.ra=!0,e.listener=null,e.proxy=null,e.src=null,e.Na=null}function Wt(e){this.src=e,this.a={},this.b=0}function Qt(e,t){var n=t.type;n in e.a&&Q(e.a[n],t)&&(Bt(t),0==e.a[n].length&&(delete e.a[n],e.b--))}function Kt(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i];if(!o.ra&&o.listener==t&&o.capture==!!n&&o.Na==r)return i}return-1}Wt.prototype.add=function(e,t,n,r,i){var o=e.toString();(e=this.a[o])||(e=this.a[o]=[],this.b++);var a=Kt(e,t,r,i);return-1<a?(t=e[a],n||(t.Ia=!1)):((t=new jt(t,this.src,o,!!r,i)).Ia=n,e.push(t)),t};var zt="closure_lm_"+(1e6*Math.random()|0),Ht={};function Gt(e,t,n,r,i){if(r&&r.once)Xt(e,t,n,r,i);else if(y(t))for(var o=0;o<t.length;o++)Gt(e,t[o],n,r,i);else n=an(n),e&&e[qt]?un(e,t,n,b(r)?!!r.capture:!!r,i):Yt(e,t,n,!1,r,i)}function Yt(e,t,n,r,i,o){if(!t)throw Error("Invalid event type");var a=b(i)?!!i.capture:!!i,s=rn(e);if(s||(e[zt]=s=new Wt(e)),!(n=s.add(t,n,r,a,o)).proxy){if(r=function(){var e=nn,t=Pt?function(n){return e.call(t.src,t.listener,n)}:function(n){if(!(n=e.call(t.src,t.listener,n)))return n};return t}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)Mt||(i=a),void 0===i&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(Zt(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}0}}function Xt(e,t,n,r,i){if(y(t))for(var o=0;o<t.length;o++)Xt(e,t[o],n,r,i);else n=an(n),e&&e[qt]?cn(e,t,n,b(r)?!!r.capture:!!r,i):Yt(e,t,n,!0,r,i)}function Jt(e,t,n,r,i){if(y(t))for(var o=0;o<t.length;o++)Jt(e,t[o],n,r,i);else r=b(r)?!!r.capture:!!r,n=an(n),e&&e[qt]?(e=e.u,(t=String(t).toString())in e.a&&(-1<(n=Kt(o=e.a[t],n,r,i))&&(Bt(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete e.a[t],e.b--)))):e&&(e=rn(e))&&(t=e.a[t.toString()],e=-1,t&&(e=Kt(t,n,r,i)),(n=-1<e?t[e]:null)&&$t(n))}function $t(e){if("number"!=typeof e&&e&&!e.ra){var t=e.src;if(t&&t[qt])Qt(t.u,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(Zt(n),r):t.addListener&&t.removeListener&&t.removeListener(r),0,(n=rn(t))?(Qt(n,e),0==n.b&&(n.src=null,t[zt]=null)):Bt(e)}}}function Zt(e){return e in Ht?Ht[e]:Ht[e]="on"+e}function en(e,t,n,r){var i=!0;if((e=rn(e))&&(t=e.a[t.toString()]))for(t=t.concat(),e=0;e<t.length;e++){var o=t[e];o&&o.capture==n&&!o.ra&&(o=tn(o,r),i=i&&!1!==o)}return i}function tn(e,t){var n=e.listener,r=e.Na||e.src;return e.Ia&&$t(e),n.call(r,t)}function nn(e,t){if(e.ra)return!0;if(!Pt){if(!t)e:{t=["window","event"];for(var n=u,r=0;r<t.length;r++)if(null==(n=n[t[r]])){t=null;break e}t=n}if(t=new Ft(r=t,this),n=!0,!(0>r.keyCode||void 0!=r.returnValue)){e:{var i=!1;if(0==r.keyCode)try{r.keyCode=-1;break e}catch(a){i=!0}(i||void 0==r.returnValue)&&(r.returnValue=!0)}for(r=[],i=t.b;i;i=i.parentNode)r.push(i);for(e=e.type,i=r.length-1;0<=i;i--){t.b=r[i];var o=en(r[i],e,!0,t);n=n&&o}for(i=0;i<r.length;i++)t.b=r[i],o=en(r[i],e,!1,t),n=n&&o}return n}return tn(e,new Ft(t,this))}function rn(e){return(e=e[zt])instanceof Wt?e:null}var on="__closure_events_fn_"+(1e9*Math.random()>>>0);function an(e){return v(e)?e:(e[on]||(e[on]=function(t){return e.handleEvent(t)}),e[on])}function sn(){pt.call(this),this.u=new Wt(this),this.Sb=this,this.Wa=null}function un(e,t,n,r,i){e.u.add(String(t),n,!1,r,i)}function cn(e,t,n,r,i){e.u.add(String(t),n,!0,r,i)}function ln(e,t,n,r){if(!(t=e.u.a[String(t)]))return!0;t=t.concat();for(var i=!0,o=0;o<t.length;++o){var a=t[o];if(a&&!a.ra&&a.capture==n){var s=a.listener,u=a.Na||a.src;a.Ia&&Qt(e.u,a),i=!1!==s.call(u,r)&&i}}return i&&0!=r.Mb}function hn(e,t,n){if(v(e))n&&(e=S(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=S(e.handleEvent,e)}return 2147483647<Number(t)?-1:u.setTimeout(e,t||0)}function fn(e){var t=null;return new ze((function(n,r){-1==(t=hn((function(){n(void 0)}),e))&&r(Error("Failed to schedule timer."))})).s((function(e){throw u.clearTimeout(t),e}))}function pn(e){if(e.U&&"function"==typeof e.U)return e.U();if(c(e))return e.split("");
1if(g(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}function dn(e){if(e.X&&"function"==typeof e.X)return e.X();if(!e.U||"function"!=typeof e.U){if(g(e)||c(e)){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(var r in t=[],n=0,e)t[n++]=r;return t}}function mn(e,t){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(e)if(e instanceof mn)for(n=e.X(),r=0;r<n.length;r++)this.set(n[r],e.get(n[r]));else for(r in e)this.set(r,e[r])}function yn(e){if(e.c!=e.a.length){for(var t=0,n=0;t<e.a.length;){var r=e.a[t];gn(e.b,r)&&(e.a[n++]=r),t++}e.a.length=n}if(e.c!=e.a.length){var i={};for(n=t=0;t<e.a.length;)gn(i,r=e.a[t])||(e.a[n++]=r,i[r]=1),t++;e.a.length=n}}function gn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}k(sn,pt),sn.prototype[qt]=!0,sn.prototype.addEventListener=function(e,t,n,r){Gt(this,e,t,n,r)},sn.prototype.removeEventListener=function(e,t,n,r){Jt(this,e,t,n,r)},sn.prototype.dispatchEvent=function(e){var t,n=this.Wa;if(n)for(t=[];n;n=n.Wa)t.push(n);n=this.Sb;var r=e.type||e;if(c(e))e=new Lt(e,n);else if(e instanceof Lt)e.target=e.target||n;else{var i=e;$(e=new Lt(r,n),i)}if(i=!0,t)for(var o=t.length-1;0<=o;o--){var a=e.b=t[o];i=ln(a,r,!0,e)&&i}if(i=ln(a=e.b=n,r,!0,e)&&i,i=ln(a,r,!1,e)&&i,t)for(o=0;o<t.length;o++)i=ln(a=e.b=t[o],r,!1,e)&&i;return i},sn.prototype.xa=function(){if(sn.qb.xa.call(this),this.u){var e,t=this.u;for(e in t.a){for(var n=t.a[e],r=0;r<n.length;r++)0,Bt(n[r]);delete t.a[e],t.b--}}this.Wa=null},(t=mn.prototype).U=function(){yn(this);for(var e=[],t=0;t<this.a.length;t++)e.push(this.b[this.a[t]]);return e},t.X=function(){return yn(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(e,t){return gn(this.b,e)?this.b[e]:t},t.set=function(e,t){gn(this.b,e)||(this.c++,this.a.push(e)),this.b[e]=t},t.forEach=function(e,t){for(var n=this.X(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);e.call(t,o,i,this)}};var vn=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function bn(e,t){var n;this.b=this.i=this.f="",this.l=null,this.g=this.c="",this.h=!1,e instanceof bn?(this.h=void 0!==t?t:e.h,_n(this,e.f),this.i=e.i,this.b=e.b,wn(this,e.l),this.c=e.c,En(this,jn(e.a)),this.g=e.g):e&&(n=String(e).match(vn))?(this.h=!!t,_n(this,n[1]||"",!0),this.i=kn(n[2]||""),this.b=kn(n[3]||"",!0),wn(this,n[4]),this.c=kn(n[5]||"",!0),En(this,n[6]||"",!0),this.g=kn(n[7]||"")):(this.h=!!t,this.a=new Mn(null,this.h))}function _n(e,t,n){e.f=n?kn(t,!0):t,e.f&&(e.f=e.f.replace(/:$/,""))}function wn(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.l=t}else e.l=null}function En(e,t,n){t instanceof Mn?(e.a=t,function(e,t){t&&!e.f&&(Ln(e),e.c=null,e.a.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(Un(this,t),Vn(this,n,e))}),e)),e.f=t}(e.a,e.h)):(n||(t=Nn(t,Pn)),e.a=new Mn(t,e.h))}function Tn(e,t,n){e.a.set(t,n)}function Sn(e,t){return e.a.get(t)}function Cn(e){return e instanceof bn?new bn(e):new bn(e,void 0)}function In(e,t){var n=new bn(null,void 0);return _n(n,"https"),e&&(n.b=e),t&&(n.c=t),n}function kn(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function Nn(e,t,n){return c(e)?(e=encodeURI(e).replace(t,An),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function An(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}bn.prototype.toString=function(){var e=[],t=this.f;t&&e.push(Nn(t,Dn,!0),":");var n=this.b;return(n||"file"==t)&&(e.push("//"),(t=this.i)&&e.push(Nn(t,Dn,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.l)&&e.push(":",String(n))),(n=this.c)&&(this.b&&"/"!=n.charAt(0)&&e.push("/"),e.push(Nn(n,"/"==n.charAt(0)?On:Rn,!0))),(n=this.a.toString())&&e.push("?",n),(n=this.g)&&e.push("#",Nn(n,xn)),e.join("")},bn.prototype.resolve=function(e){var t=new bn(this),n=!!e.f;n?_n(t,e.f):n=!!e.i,n?t.i=e.i:n=!!e.b,n?t.b=e.b:n=null!=e.l;var r=e.c;if(n)wn(t,e.l);else if(n=!!e.c){if("/"!=r.charAt(0))if(this.b&&!this.c)r="/"+r;else{var i=t.c.lastIndexOf("/");-1!=i&&(r=t.c.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(be(i,"./")||be(i,"/.")){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?t.c=r:n=""!==e.a.toString(),n?En(t,jn(e.a)):n=!!e.g,n&&(t.g=e.g),t};var Dn=/[#\/\?@]/g,Rn=/[#\?:]/g,On=/[#\?]/g,Pn=/[#\?@]/g,xn=/#/g;function Mn(e,t){this.b=this.a=null,this.c=e||null,this.f=!!t}function Ln(e){e.a||(e.a=new mn,e.b=0,e.c&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),i=null;if(0<=r){var o=e[n].substring(0,r);i=e[n].substring(r+1)}else o=e[n];t(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.c,(function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)})))}function Fn(e){var t=dn(e);
1if("undefined"==typeof t)throw Error("Keys are undefined");var n=new Mn(null,void 0);e=pn(e);for(var r=0;r<t.length;r++){var i=t[r],o=e[r];y(o)?Vn(n,i,o):n.add(i,o)}return n}function Un(e,t){Ln(e),t=Bn(e,t),gn(e.a.b,t)&&(e.c=null,e.b-=e.a.get(t).length,gn((e=e.a).b,t)&&(delete e.b[t],e.c--,e.a.length>2*e.c&&yn(e)))}function qn(e,t){return Ln(e),t=Bn(e,t),gn(e.a.b,t)}function Vn(e,t,n){Un(e,t),0<n.length&&(e.c=null,e.a.set(Bn(e,t),H(n)),e.b+=n.length)}function jn(e){var t=new Mn;return t.c=e.c,e.a&&(t.a=new mn(e.a),t.b=e.b),t}function Bn(e,t){return t=String(t),e.f&&(t=t.toLowerCase()),t}(t=Mn.prototype).add=function(e,t){Ln(this),this.c=null,e=Bn(this,e);var n=this.a.get(e);return n||this.a.set(e,n=[]),n.push(t),this.b+=1,this},t.clear=function(){this.a=this.c=null,this.b=0},t.forEach=function(e,t){Ln(this),this.a.forEach((function(n,r){V(n,(function(n){e.call(t,n,r,this)}),this)}),this)},t.X=function(){Ln(this);for(var e=this.a.U(),t=this.a.X(),n=[],r=0;r<t.length;r++)for(var i=e[r],o=0;o<i.length;o++)n.push(t[r]);return n},t.U=function(e){Ln(this);var t=[];if(c(e))qn(this,e)&&(t=z(t,this.a.get(Bn(this,e))));else{e=this.a.U();for(var n=0;n<e.length;n++)t=z(t,e[n])}return t},t.set=function(e,t){return Ln(this),this.c=null,qn(this,e=Bn(this,e))&&(this.b-=this.a.get(e).length),this.a.set(e,[t]),this.b+=1,this},t.get=function(e,t){return e&&0<(e=this.U(e)).length?String(e[0]):t},t.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var e=[],t=this.a.X(),n=0;n<t.length;n++){var r=t[n],i=encodeURIComponent(String(r));r=this.U(r);for(var o=0;o<r.length;o++){var a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),e.push(a)}}return this.c=e.join("&")};var Wn=!_t||9<=Number(At);function Qn(e){var t=document;return c(e)?t.getElementById(e):e}function Kn(e,t){G(t,(function(t,n){t&&"object"==typeof t&&t.qa&&(t=t.pa()),"style"==n?e.style.cssText=t:"class"==n?e.className=t:"for"==n?e.htmlFor=t:zn.hasOwnProperty(n)?e.setAttribute(zn[n],t):0==n.lastIndexOf("aria-",0)||0==n.lastIndexOf("data-",0)?e.setAttribute(n,t):e[n]=t}))}var zn={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 Hn(e,t,n){var r=arguments,i=document,o=String(r[0]),a=r[1];if(!Wn&&a&&(a.name||a.type)){if(o=["<",o],a.name&&o.push(' name="',qe(a.name),'"'),a.type){o.push(' type="',qe(a.type),'"');var s={};$(s,a),delete s.type,a=s}o.push(">"),o=o.join("")}return o=i.createElement(o),a&&(c(a)?o.className=a:y(a)?o.className=a.join(" "):Kn(o,a)),2<r.length&&function(e,t,n){function r(n){n&&t.appendChild(c(n)?e.createTextNode(n):n)}for(var i=2;i<n.length;i++){var o=n[i];!g(o)||b(o)&&0<o.nodeType?r(o):V(Gn(o)?H(o):o,r)}}(i,o,r),o}function Gn(e){if(e&&"number"==typeof e.length){if(b(e))return"function"==typeof e.item||"string"==typeof e.item;if(v(e))return"function"==typeof e.item}return!1}function Yn(e){var t=[];return function e(t,n,r){if(null==n)r.push("null");else{if("object"==typeof n){if(y(n)){var i=n;n=i.length,r.push("[");for(var o="",a=0;a<n;a++)r.push(o),e(t,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),Zn(i,r),r.push(":"),e(t,a,r),o=","));return void r.push("}")}n=n.valueOf()}switch(typeof n){case"string":Zn(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 Xn,e,t),t.join("")}function Xn(){}var Jn={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},$n=/\uffff/.test("\uffff")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function Zn(e,t){t.push('"',e.replace($n,(function(e){var t=Jn[e];return t||(t="\\u"+(65536|e.charCodeAt(0)).toString(16).substr(1),Jn[e]=t),t})),'"')}function er(){var e=br();return _t&&!!At&&11==At||/Edge\/\d+/.test(e)}function tr(){return u.window&&u.window.location.href||self&&self.location&&self.location.href||""}function nr(e,t){t=t||u.window;var n="about:blank";e&&(n=Ee(Se(e)).toString()),t.location.href=n}function rr(e){return!!((e=(e||br()).toLowerCase()).match(/android/)||e.match(/webos/)||e.match(/iphone|ipad|ipod/)||e.match(/blackberry/)||e.match(/windows phone/)||e.match(/iemobile/))}function ir(e){e=e||u.window;try{e.close()}catch(t){}}function or(e,t,n){var r=Math.floor(1e9*Math.random()).toString();t=t||500,n=n||600;
1var i=(window.screen.availHeight-n)/2,o=(window.screen.availWidth-t)/2;for(a in t={width:t,height:n,top:0<i?i:0,left:0<o?o:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1},n=br().toLowerCase(),r&&(t.target=r,be(n,"crios/")&&(t.target="_blank")),yr(br())==dr&&(e=e||"http://localhost",t.scrollbars=!0),n=e||"",(e=t)||(e={}),r=window,t=n instanceof we?n:Se("undefined"!=typeof n.href?n.href:String(n)),n=e.target||n.target,i=[],e)switch(a){case"width":case"height":case"top":case"left":i.push(a+"="+e[a]);break;case"target":case"noopener":case"noreferrer":break;default:i.push(a+"="+(e[a]?1:0))}var a=i.join(",");if((De("iPhone")&&!De("iPod")&&!De("iPad")||De("iPad")||De("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(U(a=r.document.createElement("A"),"HTMLAnchorElement"),t instanceof we||t instanceof we||(t="object"==typeof t&&t.qa?t.pa():String(t),Te.test(t)||(t="about:invalid#zClosurez"),t=ke(t)),a.href=Ee(t),a.setAttribute("target",n),e.noreferrer&&a.setAttribute("rel","noreferrer"),(e=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,r,1),a.dispatchEvent(e),a={}):e.noreferrer?(a=r.open("",n,a),e=Ee(t).toString(),a&&(Et&&be(e,";")&&(e="'"+e.replace(/'/g,"%27")+"'"),a.opener=null,e=xe('<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+qe(e)+'">'),a.document.write(Oe(e)),a.document.close())):(a=r.open(Ee(t).toString(),n,a))&&e.noopener&&(a.opener=null),a)try{a.focus()}catch(s){}return a}var ar=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,sr=/^[^@]+@[^@]+$/;function ur(){var e=null;return new ze((function(t){"complete"==u.document.readyState?t():(e=function(){t()},Xt(window,"load",e))})).s((function(t){throw Jt(window,"load",e),t}))}function cr(e){return e=e||br(),!("file:"!==Sr()||!e.toLowerCase().match(/iphone|ipad|ipod|android/))}function lr(){var e=u.window;try{return!(!e||e==e.top)}catch(t){return!1}}function hr(){return"undefined"!==typeof u.WorkerGlobalScope&&"function"===typeof u.importScripts}function fr(){return r.a.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":r.a.INTERNAL.hasOwnProperty("node")?"Node":hr()?"Worker":"Browser"}function pr(){var e=fr();return"ReactNative"===e||"Node"===e}var dr="Firefox",mr="Chrome";function yr(e){var t=e.toLowerCase();return be(t,"opera/")||be(t,"opr/")||be(t,"opios/")?"Opera":be(t,"iemobile")?"IEMobile":be(t,"msie")||be(t,"trident/")?"IE":be(t,"edge/")?"Edge":be(t,"firefox/")?dr:be(t,"silk/")?"Silk":be(t,"blackberry")?"Blackberry":be(t,"webos")?"Webos":!be(t,"safari/")||be(t,"chrome/")||be(t,"crios/")||be(t,"android")?!be(t,"chrome/")&&!be(t,"crios/")||be(t,"edge/")?be(t,"android")?"Android":(e=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==e.length?e[1]:"Other":mr:"Safari"}var gr={Vc:"FirebaseCore-web",Xc:"FirebaseUI-web"};function vr(e,t){t=t||[];var n,r=[],i={};for(n in gr)i[gr[n]]=!0;for(n=0;n<t.length;n++)"undefined"!==typeof i[t[n]]&&(delete i[t[n]],r.push(t[n]));return r.sort(),(t=r).length||(t=["FirebaseCore-web"]),"Browser"===(r=fr())?r=yr(i=br()):"Worker"===r&&(r=yr(i=br())+"-"+r),r+"/JsCore/"+e+"/"+t.join(",")}function br(){return u.navigator&&u.navigator.userAgent||""}function _r(e,t){e=e.split("."),t=t||u;for(var n=0;n<e.length&&"object"==typeof t&&null!=t;n++)t=t[e[n]];return n!=e.length&&(t=void 0),t}function wr(){try{var e=u.localStorage,t=Ar();if(e)return e.setItem(t,"1"),e.removeItem(t),!er()||!!u.indexedDB}catch(n){return hr()&&!!u.indexedDB}return!1}function Er(){return(Tr()||"chrome-extension:"===Sr()||cr())&&!pr()&&wr()&&!hr()}function Tr(){return"http:"===Sr()||"https:"===Sr()}function Sr(){return u.location&&u.location.protocol||null}function Cr(e){return!rr(e=e||br())&&yr(e)!=dr}function Ir(e){return"undefined"===typeof e?null:Yn(e)}function kr(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&null!==e[t]&&void 0!==e[t]&&(n[t]=e[t]);return n}function Nr(e){if(null!==e)return JSON.parse(e)}function Ar(e){return e||Math.floor(1e9*Math.random()).toString()}function Dr(e){return"Safari"!=yr(e=e||br())&&!e.toLowerCase().match(/iphone|ipad|ipod/)}function Rr(){var e=u.___jsl;if(e&&e.H)for(var t in e.H)if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=e.H[t].L.concat(),e.CP)for(var n=0;n<e.CP.length;n++)e.CP[n]=null}function Or(e,t){if(e>
1t)throw Error("Short delay should be less than long delay!");this.a=e,this.c=t,e=br(),t=fr(),this.b=rr(e)||"ReactNative"===t}function Pr(){var e=u.document;return!e||"undefined"===typeof e.visibilityState||"visible"==e.visibilityState}function xr(e){try{var t=new Date(parseInt(e,10));if(!isNaN(t.getTime())&&!/[^0-9]/.test(e))return t.toUTCString()}catch(n){}return null}function Mr(){return!(!_r("fireauth.oauthhelper",u)&&!_r("fireauth.iframe",u))}Or.prototype.get=function(){var e=u.navigator;return!e||"boolean"!==typeof e.onLine||!Tr()&&"chrome-extension:"!==Sr()&&"undefined"===typeof e.connection||e.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Lr,Fr={};function Ur(e){Fr[e]||(Fr[e]=!0,"undefined"!==typeof console&&"function"===typeof console.warn&&console.warn(e))}try{var qr={};Object.defineProperty(qr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(qr,"abcd",{configurable:!0,enumerable:!0,value:2}),Lr=2==qr.abcd}catch(zo){Lr=!1}function Vr(e,t,n){Lr?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n}):e[t]=n}function jr(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&Vr(e,n,t[n])}function Br(e){var t={};return jr(t,e),t}function Wr(e){var t=e;if("object"==typeof e&&null!=e)for(var n in t="length"in e?[]:{},e)Vr(t,n,Wr(e[n]));return t}function Qr(e){var t={},n=e[zr],r=e[Hr];if(!(e=e[Gr])||e!=Kr&&!n)throw Error("Invalid provider user info!");t[Xr]=r||null,t[Yr]=n||null,Vr(this,$r,e),Vr(this,Jr,Wr(t))}var Kr="EMAIL_SIGNIN",zr="email",Hr="newEmail",Gr="requestType",Yr="email",Xr="fromEmail",Jr="data",$r="operation";function Zr(e,t){this.code=ti+e,this.message=t||ni[e]||""}function ei(e){var t=e&&e.code;return t?new Zr(t.substring(ti.length),e.message):null}k(Zr,Error),Zr.prototype.A=function(){return{code:this.code,message:this.message}},Zr.prototype.toJSON=function(){return this.A()};var ti="auth/",ni={"admin-restricted-operation":"This operation is restricted to administrators only.","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.","invali
1d-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-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-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invali
1d-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.","invalid-tenant-id":"The Auth instance's tenant ID 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.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",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.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","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 ri(e){var t=Sn(e=Cn(e),ii)||null,n=Sn(e,oi)||null,r=Sn(e,ui)||null;if(r=r&&li[r]||null,!t||!n||!r)throw new Zr("argument-error",ii+", "+oi+"and "+ui+" are required in a valid action code URL.");jr(this,{apiKey:t,operation:r,code:n,continueUrl:Sn(e,ai)||null,languageCode:Sn(e,si)||null,tenantId:Sn(e,ci)||null})}var ii="apiKey",oi="oobCode",ai="continueUrl",si="languageCode",ui="mode",ci="tenantId",li={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",signIn:Kr,verifyEmail:"VERIFY_EMAIL"};function hi(e){try{return new ri(e)}catch(t){return null}}function fi(e){var t=e[gi];if("undefined"===typeof t)throw new Zr("missing-continue-uri");if("string"!==typeof t||"string"===typeof t&&!t.length)throw new Zr("invalid-continue-uri");this.h=t,this.b=this.a=null,this.g=!1;var n=e[pi];if(n&&"object"===typeof n){t=n[_i];var r=n[vi];if(n=n[bi],"string"===typeof t&&t.length){if(this.a=t,"undefined"!==typeof r&&"boolean"!==typeof r)throw new Zr("argument-error",vi+" property must be a boolean when specified.");if(this.g=!!r,"undefined"!==typeof n&&("string"!==typeof n||"string"===typeof n&&!n.length))throw new Zr("argument-error",bi+" property must be a non empty string when specified.");this.b=n||null}else{if("undefined"!==typeof t)throw new Zr("argument-error",_i+" property must be a non empty string when specified.");if("undefined"!==typeof r||"undefined"!==typeof n)throw new Zr("missing-android-pkg-name")}}else if("undefined"!==typeof n)throw new Zr("argument-error",pi+" property must be a non null object when specified.");if(this.f=null,(t=e[yi])&&"object"===typeof t){if("string"===typeof(t=t[wi])&&t.length)this.f=t;else if("undefined"!==typeof t)throw new Zr("argument-error",wi+" property must be a non empty string when specified.")}else if("undefined"!==typeof t)throw new Zr("argument-error",yi+" property must be a non null object when specified.");if("undefined"!==typeof(t=e[mi])&&"boolean"!==typeof t)throw new Zr("argument-error",mi+" property must be a boolean when specified.");if(this.c=!!t,"undefined"!==typeof(e=e[di])&&("string"!==typeof e||"string"===typeof e&&!e.length))throw new Zr("argument-error",di+" property must be a non empty string when specified.");this.i=e||null}var pi="android",di="dynamicLinkDomain",mi="handleCodeInApp",yi="iOS",gi="url",vi="installApp",bi="minimumVersion",_i="packageName",wi="bundleId";function Ei(e){var t={};for(var n in t.continueUrl=e.h,t.canHandleCodeInApp=e.c,(t.androidPackageName=e.a)&&(t.androidMinimumVersion=e.b,t.androidInstallApp=e.g),t.iOSBundleId=e.f,t.dynamicLinkDomain=e.i,t)null===t[n]&&delete t[n];return t}var Ti=null,Si=null;function Ci(e){var t="";return function(e,t){function n(t){for(;r<e.length;){var n=e.charAt(r++),i=Si[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return t}!function(){if(!Ti){Ti={},Si={};for(var e=0;65>e;e++)Ti[e]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
1+/=".charAt(e),Si[Ti[e]]=e,62<=e&&(Si["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(e)]=e)}}();for(var r=0;;){var i=n(-1),o=n(0),a=n(64),s=n(64);if(64===s&&-1===i)break;t(i<<2|o>>4),64!=a&&(t(o<<4&240|a>>2),64!=s&&t(a<<6&192|s))}}(e,(function(e){t+=String.fromCharCode(e)})),t}function Ii(e){this.f=e.sub,I(),this.a=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null,this.c=e.firebase&&e.firebase.tenant||null,this.b=!!e.is_anonymous||"anonymous"==this.a}function ki(e){return(e=Ni(e))&&e.sub&&e.iss&&e.aud&&e.exp?new Ii(e):null}function Ni(e){if(!e)return null;if(3!=(e=e.split(".")).length)return null;for(var t=(4-(e=e[1]).length%4)%4,n=0;n<t;n++)e+=".";try{return JSON.parse(Ci(e))}catch(r){}return null}Ii.prototype.R=function(){return this.c},Ii.prototype.g=function(){return this.b};var Ai,Di={ad:{bb:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",ib:"https://securetoken.googleapis.com/v1/token",id:"p"},cd:{bb:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",ib:"https://staging-securetoken.sandbox.googleapis.com/v1/token",id:"s"},dd:{bb:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",ib:"https://test-securetoken.sandbox.googleapis.com/v1/token",id:"t"}};function Ri(e){for(var t in Di)if(Di[t].id===e)return{firebaseEndpoint:(e=Di[t]).bb,secureTokenEndpoint:e.ib};return null}Ai=Ri("__EID__")?"__EID__":void 0;var Oi="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),Pi=["client_id","response_type","scope","redirect_uri","state"],xi={Wc:{Oa:"locale",Da:500,Ca:600,Pa:"facebook.com",hb:Pi},Yc:{Oa:null,Da:500,Ca:620,Pa:"github.com",hb:Pi},Zc:{Oa:"hl",Da:515,Ca:680,Pa:"google.com",hb:Pi},ed:{Oa:"lang",Da:485,Ca:705,Pa:"twitter.com",hb:Oi}};function Mi(e){for(var t in xi)if(xi[t].Pa==e)return xi[t];return null}function Li(e){var t={};t["facebook.com"]=ji,t["google.com"]=Wi,t["github.com"]=Bi,t["twitter.com"]=Qi;var n=e&&e[Ui];try{if(n)return t[n]?new t[n](e):new Vi(e);if("undefined"!==typeof e[Fi])return new qi(e)}catch(r){}return null}var Fi="idToken",Ui="providerId";function qi(e){var t=e[Ui];if(!t&&e[Fi]){var n=ki(e[Fi]);n&&n.a&&(t=n.a)}if(!t)throw Error("Invalid additional user info!");"anonymous"!=t&&"custom"!=t||(t=null),n=!1,"undefined"!==typeof e.isNewUser?n=!!e.isNewUser:"identitytoolkit#SignupNewUserResponse"===e.kind&&(n=!0),Vr(this,"providerId",t),Vr(this,"isNewUser",n)}function Vi(e){qi.call(this,e),Vr(this,"profile",Wr((e=Nr(e.rawUserInfo||"{}"))||{}))}function ji(e){if(Vi.call(this,e),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function Bi(e){if(Vi.call(this,e),"github.com"!=this.providerId)throw Error("Invalid provider ID!");Vr(this,"username",this.profile&&this.profile.login||null)}function Wi(e){if(Vi.call(this,e),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function Qi(e){if(Vi.call(this,e),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");Vr(this,"username",e.screenName||null)}function Ki(e){var t=Cn(e),n=Sn(t,"link"),r=Sn(Cn(n),"link");return t=Sn(t,"deep_link_id"),Sn(Cn(t),"link")||t||r||n||e}function zi(){}function Hi(e,t){return e.then((function(e){if(e[La]){var n=ki(e[La]);if(!n||t!=n.f)throw new Zr("user-mismatch");return e}throw new Zr("user-mismatch")})).s((function(e){throw e&&e.code&&e.code==ti+"user-not-found"?new Zr("user-mismatch"):e}))}function Gi(e,t){if(!t)throw new Zr("internal-error","failed to construct a credential");this.a=t,Vr(this,"providerId",e),Vr(this,"signInMethod",e)}function Yi(e){return{pendingToken:e.a,requestUri:"http://localhost"}}function Xi(e){if(e&&e.providerId&&e.signInMethod&&0==e.providerId.indexOf("saml.")&&e.pendingToken)try{return new Gi(e.providerId,e.pendingToken)}catch(t){}return null}function Ji(e,t,n){if(this.a=null,t.idToken||t.accessToken)t.idToken&&Vr(this,"idToken",t.idToken),t.accessToken&&Vr(this,"accessToken",t.accessToken),t.nonce&&!t.pendingToken&&Vr(this,"nonce",t.nonce),t.pendingToken&&(this.a=t.pendingToken);else{if(!t.oauthToken||!t.oauthTokenSecret)throw new Zr("internal-error","failed to construct a credential");Vr(this,"accessToken",t.oauthToken),Vr(this,"secret",t.oauthTokenSecret)}Vr(this,"providerId",e),Vr(this,"signInMethod",n)}function $i(e){var t={};return e.idToken&&(t.id_token=e.idToken),e.accessToken&&(t.access_token=e.accessToken),e.secret&&(t.oauth_token_secret=e.secret),t.providerId=e.providerId,e.nonce&&!e.a&&(t.nonce=e.nonce),t={postBody:Fn(t).toString(),requestUri:"http://localhost"},e.a&&(delete t.postBody,t.pendingToken=e.a),t}function Zi(e){if(e&&e.providerId&&e.signInMethod){var t={idToken:e.oauthIdToken,accessToken:e.oauthTokenSecret?null:e.oauthAccessToken,oauthTokenSecret:e.oauthTokenSecret,oauthToken:e.oauthTokenSecret&&e.oauthAccessToken,nonce:e.nonce,pendingToken:e.pendingToken};try{return new Ji(e.providerId,t,e.signInMethod)}catch(n){}}return null}function eo(e,t){this.Fc=t||[],jr(this,{providerId:e,isOAuthProvider:!0}),this.zb={},this.cb=(Mi(e)||{}).Oa||null,this.ab=null}function to(e){if("string"!==typeof e||0!=e.indexOf("saml."))throw new Zr("argument-error",'SAML provider IDs must be prefixed with "saml."');eo.call(this,e,[])}function no(e){eo.call(this,e,Pi),this.a=[]}function ro(){no.call(this,"facebook.com")}function io(e){if(!e)throw new Zr("argument-error","credential failed: expected 1 argument (the OAuth access token).");var t=e;return b(e)&&(t=e.accessToken),(new ro).credential({accessToken:t})}function oo(){no.call(this,"github.com")}function ao(e){if(!e)throw new Zr("argument-error","credential failed: expected 1 argument (the OAuth access token).");var t=e;return b(e)&&(t=e.accessToken),(new oo).credential({accessToken:t})}function so(){no.call(this,"google.com"),this.wa("profile")}function uo(e,t){var n=e;return b(e)&&(n=e.idToken,t=e.accessToken),(new so).credential({idToken:n,accessToken:t})}function co(){eo.call(this,"twitter.com",Oi)}function lo(e,t){var n=e;if(b(n)||(n={oauthToken:e,oauthTokenSecret:t}),!n.oauthToken||!n.oauthTokenSecret)throw new Zr("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new Ji("twitter.com",n,"twitter.com")}
1function ho(e,t,n){this.a=e,this.c=t,Vr(this,"providerId","password"),Vr(this,"signInMethod",n===po.EMAIL_LINK_SIGN_IN_METHOD?po.EMAIL_LINK_SIGN_IN_METHOD:po.EMAIL_PASSWORD_SIGN_IN_METHOD)}function fo(e){return e&&e.email&&e.password?new ho(e.email,e.password,e.signInMethod):null}function po(){jr(this,{providerId:"password",isOAuthProvider:!1})}function mo(e,t){if(!(t=yo(t)))throw new Zr("argument-error","Invalid email link!");return new ho(e,t.code,po.EMAIL_LINK_SIGN_IN_METHOD)}function yo(e){return(e=hi(e=Ki(e)))&&e.operation===Kr?e:null}function go(e){if(!(e.Ua&&e.Ta||e.Fa&&e.ba))throw new Zr("internal-error");this.a=e,Vr(this,"providerId","phone"),Vr(this,"signInMethod","phone")}function vo(e){if(e&&"phone"===e.providerId&&(e.verificationId&&e.verificationCode||e.temporaryProof&&e.phoneNumber)){var t={};return V(["verificationId","verificationCode","temporaryProof","phoneNumber"],(function(n){e[n]&&(t[n]=e[n])})),new go(t)}return null}function bo(e){return e.a.Fa&&e.a.ba?{temporaryProof:e.a.Fa,phoneNumber:e.a.ba}:{sessionInfo:e.a.Ua,code:e.a.Ta}}function _o(e){try{this.a=e||r.a.auth()}catch(t){throw new Zr("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().")}jr(this,{providerId:"phone",isOAuthProvider:!1})}function wo(e,t){if(!e)throw new Zr("missing-verification-id");if(!t)throw new Zr("missing-verification-code");return new go({Ua:e,Ta:t})}function Eo(e){if(e.temporaryProof&&e.phoneNumber)return new go({Fa:e.temporaryProof,ba:e.phoneNumber});var t=e&&e.providerId;if(!t||"password"===t)return null;var n=e&&e.oauthAccessToken,r=e&&e.oauthTokenSecret,i=e&&e.nonce,o=e&&e.oauthIdToken,a=e&&e.pendingToken;try{switch(t){case"google.com":return uo(o,n);case"facebook.com":return io(n);case"github.com":return ao(n);case"twitter.com":return lo(n,r);default:return n||r||o||a?a?0==t.indexOf("saml.")?new Gi(t,a):new Ji(t,{pendingToken:a,idToken:e.oauthIdToken,accessToken:e.oauthAccessToken},t):new no(t).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(s){return null}}function To(e){if(!e.isOAuthProvider)throw new Zr("invalid-oauth-provider")}function So(e,t,n,r,i,o,a){if(this.c=e,this.b=t||null,this.g=n||null,this.f=r||null,this.i=o||null,this.h=a||null,this.a=i||null,!this.g&&!this.a)throw new Zr("invalid-auth-event");if(this.g&&this.a)throw new Zr("invalid-auth-event");if(this.g&&!this.f)throw new Zr("invalid-auth-event")}function Co(e){return(e=e||{}).type?new So(e.type,e.eventId,e.urlResponse,e.sessionId,e.error&&ei(e.error),e.postBody,e.tenantId):null}function Io(){this.b=null,this.a=[]}k(Vi,qi),k(ji,Vi),k(Bi,Vi),k(Wi,Vi),k(Qi,Vi),Gi.prototype.na=function(e){return es(e,Yi(this))},Gi.prototype.b=function(e,t){var n=Yi(this);return n.idToken=t,ts(e,n)},Gi.prototype.f=function(e,t){return Hi(ns(e,Yi(this)),t)},Gi.prototype.A=function(){return{providerId:this.providerId,sign
1InMethod:this.signInMethod,pendingToken:this.a}},Ji.prototype.na=function(e){return es(e,$i(this))},Ji.prototype.b=function(e,t){var n=$i(this);return n.idToken=t,ts(e,n)},Ji.prototype.f=function(e,t){return Hi(ns(e,$i(this)),t)},Ji.prototype.A=function(){var e={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(e.oauthIdToken=this.idToken),this.accessToken&&(e.oauthAccessToken=this.accessToken),this.secret&&(e.oauthTokenSecret=this.secret),this.nonce&&(e.nonce=this.nonce),this.a&&(e.pendingToken=this.a),e},eo.prototype.Ea=function(e){return this.zb=X(e),this},k(to,eo),k(no,eo),no.prototype.wa=function(e){return W(this.a,e)||this.a.push(e),this},no.prototype.Hb=function(){return H(this.a)},no.prototype.credential=function(e,t){var n;if(!(n=b(e)?{idToken:e.idToken||null,accessToken:e.accessToken||null,nonce:e.rawNonce||null}:{idToken:e||null,accessToken:t||null}).idToken&&!n.accessToken)throw new Zr("argument-error","credential failed: must provide the ID token and/or the access token.");return new Ji(this.providerId,n,this.providerId)},k(ro,no),Vr(ro,"PROVIDER_ID","facebook.com"),Vr(ro,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),k(oo,no),Vr(oo,"PROVIDER_ID","github.com"),Vr(oo,"GITHUB_SIGN_IN_METHOD","github.com"),k(so,no),Vr(so,"PROVIDER_ID","google.com"),Vr(so,"GOOGLE_SIGN_IN_METHOD","google.com"),k(co,eo),Vr(co,"PROVIDER_ID","twitter.com"),Vr(co,"TWITTER_SIGN_IN_METHOD","twitter.com"),ho.prototype.na=function(e){return this.signInMethod==po.EMAIL_LINK_SIGN_IN_METHOD?Rs(e,ls,{email:this.a,oobCode:this.c}):Rs(e,ks,{email:this.a,password:this.c})},ho.prototype.b=function(e,t){return this.signInMethod==po.EMAIL_LINK_SIGN_IN_METHOD?Rs(e,hs,{idToken:t,email:this.a,oobCode:this.c}):Rs(e,ws,{idToken:t,email:this.a,password:this.c})},ho.prototype.f=function(e,t){return Hi(this.na(e),t)},ho.prototype.A=function(){return{email:this.a,password:this.c,signInMethod:this.signInMethod}},jr(po,{PROVIDER_ID:"password"}),jr(po,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),jr(po,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),go.prototype.na=function(e){return e.Va(bo(this))},go.prototype.b=function(e,t){var n=bo(this);return n.idToken=t,Rs(e,As,n)},go.prototype.f=function(e,t){var n=bo(this);return n.operation="REAUTH",Hi(e=Rs(e,Ds,n),t)},go.prototype.A=function(){var e={providerId:"phone"};return this.a.Ua&&(e.verificationId=this.a.Ua),this.a.Ta&&(e.verificationCode=this.a.Ta),this.a.Fa&&(e.temporaryProof=this.a.Fa),this.a.ba&&(e.phoneNumber=this.a.ba),e},_o.prototype.Va=function(e,t){var n=this.a.b;return Ze(t.verify()).then((function(r){if(!c(r))throw new Zr("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(t.type){case"recaptcha":return function(e,t){return Rs(e,bs,t)}(n,{phoneNumber:e,recaptchaToken:r}).then((function(e){return"function"===typeof t.reset&&t.reset(),e}),(function(e){throw"function"===typeof t.reset&&t.reset(),e}));default:throw new Zr("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}}))},jr(_o,{PROVIDER_ID:"phone"}),jr(_o,{PHONE_SIGN_IN_METHOD:"phone"}),So.prototype.getUid=function(){var e=[];return e.push(this.c),this.b&&e.push(this.b),this.f&&e.push(this.f),this.h&&e.push(this.h),e.join("-")},So.prototype.R=function(){return this.h},So.prototype.A=function(){return{type:this.c,eventId:this.b,urlResponse:this.g,sessionId:this.f,postBody:this.i,tenantId:this.h,error:this.a&&this.a.A()}};var ko,No=null;function Ao(e){var t="unauthorized-domain",n=void 0,r=Cn(e);e=r.b,"chrome-extension"==(r=r.f)?n=Ue("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.",e):"http"==r||"https"==r?n=Ue("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.",e):t="operation-not-supported-in-this-environment",Zr.call(this,t,n)}
1function Do(e,t,n){Zr.call(this,e,n),(e=t||{}).Ab&&Vr(this,"email",e.Ab),e.ba&&Vr(this,"phoneNumber",e.ba),e.credential&&Vr(this,"credential",e.credential),e.Qb&&Vr(this,"tenantId",e.Qb)}function Ro(e){if(e.code){var t=e.code||"";0==t.indexOf(ti)&&(t=t.substring(ti.length));var n={credential:Eo(e),Qb:e.tenantId};if(e.email)n.Ab=e.email;else if(e.phoneNumber)n.ba=e.phoneNumber;else if(!n.credential)return new Zr(t,e.message||void 0);return new Do(t,n,e.message)}return null}function Oo(){}function Po(e){return e.c||(e.c=e.b())}function xo(){}function Mo(e){if(!e.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var t=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n<t.length;n++){var r=t[n];try{return new ActiveXObject(r),e.f=r}catch(i){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return e.f}function Lo(){}function Fo(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseType=this.responseText=this.response="",this.status=-1,this.statusText="",this.a.onload=S(this.fc,this),this.a.onerror=S(this.Ib,this),this.a.onprogress=S(this.gc,this),this.a.ontimeout=S(this.kc,this)}function Uo(e,t){e.readyState=t,e.onreadystatechange&&e.onreadystatechange()}function qo(e,t,n){this.reset(e,t,n,void 0,void 0)}k(Ao,Zr),k(Do,Zr),Do.prototype.A=function(){var e={code:this.code,message:this.message};this.email&&(e.email=this.email),this.phoneNumber&&(e.phoneNumber=this.phoneNumber),this.tenantId&&(e.tenantId=this.tenantId);var t=this.credential&&this.credential.A();return t&&$(e,t),e},Do.prototype.toJSON=function(){return this.A()},Oo.prototype.c=null,k(xo,Oo),xo.prototype.a=function(){var e=Mo(this);return e?new ActiveXObject(e):new XMLHttpRequest},xo.prototype.b=function(){var e={};return Mo(this)&&(e[0]=!0,e[1]=!0),e},ko=new xo,k(Lo,Oo),Lo.prototype.a=function(){var e=new XMLHttpRequest;if("withCredentials"in e)return e;if("undefined"!=typeof XDomainRequest)return new Fo;throw Error("Unsupported browser")},Lo.prototype.b=function(){return{}},(t=Fo.prototype).open=function(e,t,n){if(null!=n&&!n)throw Error("Only async requests are supported.");this.a.open(e,t)},t.send=function(e){if(e){if("string"!=typeof e)throw Error("Only string data is supported");this.a.send(e)}else this.a.send()},t.abort=function(){this.a.abort()},t.setRequestHeader=function(){},t.getResponseHeader=function(e){return"content-type"==e.toLowerCase()?this.a.contentType:""},t.fc=function(){this.status=200,this.response=this.responseText=this.a.responseText,Uo(this,4)},t.Ib=function(){this.status=500,this.response=this.responseText="",Uo(this,4)},t.kc=function(){this.Ib()},t.gc=function(){this.status=200,Uo(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},qo.prototype.a=null;function Vo(e){this.f=e,this.b=this.c=this.a=null}function jo(e,t){this.name=e,this.value=t}qo.prototype.reset=function(e,t,n,r,i){"number"==typeof i||0,r||I(),delete this.a},jo.prototype.toString=function(){return this.name};var Bo=new jo("SEVERE",1e3),Wo=new jo("WARNING",900),Qo=new jo("CONFIG",700),Ko=new jo("FINE",500);Vo.prototype.log=function(e,t,n){if(e.value>=function e(t){return t.c?t.c:t.a?e(t.a):(R("Root logger has no level set."),null)}(this).value)for(v(t)&&(t=t()),e=new qo(e,String(t),this.f),n&&(e.a=n),n=this;n;)n=n.a};var zo,Ho={},Go=null;function Yo(e){var t;if(Go||(Go=new Vo(""),Ho[""]=Go,Go.c=Qo),!(t=Ho[e])){t=new Vo(e);var n=e.lastIndexOf("."),r=e.substr(n+1);(n=Yo(e.substr(0,n))).b||(n.b={}),n.b[r]=t,t.a=n,Ho[e]=t}return t}function Xo(e,t){e&&e.log(Ko,t,void 0)}function Jo(e){this.f=e}function $o(e){sn.call(this),this.o=e,this.readyState=Zo,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.i=new Headers,this.b=null,this.m="GET",this.g="",this.a=!1,this.h=Yo("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}k(Jo,Oo),Jo.prototype.a=function(){return new $o(this.f)},Jo.prototype.b=(zo={},function(){return zo}),k($o,sn);var Zo=0;function ea(e){e.c.read().then(e.ec.bind(e)).catch(e.Ma.bind(e))}function ta(e,t){t&&e.f&&(e.status=e.f.status,e.statusText=e.f.statusText),e.readyState=4,e.f=null,e.c=null,e.l=null,na(e)}function na(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function ra(e){sn.call(this),this.headers=new mn,this.B=e||null,this.c=!1,this.w=this.a=null,this.h=this.O=this.l="",this.f=this.J=this.i=this.I=!1,this.g=0,this.o=null,this.m=ia,this.v=this.P=!1}(t=$o.prototype).open=function(e,t){if(this.readyState!=Zo)throw this.abort(),Error("Error reopening a connection");this.m=e,this.g=t,this.readyState=1,na(this)},t.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var t={headers:this.i,method:this.m,credentials:void 0,cache:void 0};
1e&&(t.body=e),this.o.fetch(new Request(this.g,t)).then(this.jc.bind(this),this.Ma.bind(this))},t.abort=function(){this.response=this.responseText="",this.i=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,ta(this,!1)),this.readyState=Zo},t.jc=function(e){this.a&&(this.f=e,this.b||(this.b=e.headers,this.readyState=2,na(this)),this.a&&(this.readyState=3,na(this),this.a&&("arraybuffer"===this.responseType?e.arrayBuffer().then(this.hc.bind(this),this.Ma.bind(this)):"undefined"!==typeof u.ReadableStream&&"body"in e?(this.response=this.responseText="",this.c=e.body.getReader(),this.l=new TextDecoder,ea(this)):e.text().then(this.ic.bind(this),this.Ma.bind(this)))))},t.ec=function(e){if(this.a){var t=this.l.decode(e.value?e.value:new Uint8Array(0),{stream:!e.done});t&&(this.response=this.responseText+=t),e.done?ta(this,!0):na(this),3==this.readyState&&ea(this)}},t.ic=function(e){this.a&&(this.response=this.responseText=e,ta(this,!0))},t.hc=function(e){this.a&&(this.response=e,ta(this,!0))},t.Ma=function(e){var t=this.h;t&&t.log(Wo,"Failed to fetch url "+this.g,e instanceof Error?e:Error(e)),this.a&&ta(this,!0)},t.setRequestHeader=function(e,t){this.i.append(e,t)},t.getResponseHeader=function(e){return this.b?this.b.get(e.toLowerCase())||"":((e=this.h)&&e.log(Wo,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var e=this.h;return e&&e.log(Wo,"Attempting to get all response headers but no headers have been received for url: "+this.g,void 0),""}e=[];for(var t=this.b.entries(),n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},k(ra,sn);var ia="";ra.prototype.b=Yo("goog.net.XhrIo");var oa=/^https?$/i,aa=["POST","PUT"];function sa(e,t,n,r,i){if(e.a)throw Error("[goog.net.XhrIo] Object is active with another request="+e.l+"; newUri="+t);n=n?n.toUpperCase():"GET",e.l=t,e.h="",e.O=n,e.I=!1,e.c=!0,e.a=e.B?e.B.a():ko.a(),e.w=e.B?Po(e.B):Po(ko),e.a.onreadystatechange=S(e.Lb,e);try{Xo(e.b,ya(e,"Opening Xhr")),e.J=!0,e.a.open(n,String(t),!0),e.J=!1}catch(a){return Xo(e.b,ya(e,"Error opening Xhr: "+a.message)),void ca(e,a)}t=r||"";var o=new mn(e.headers);i&&function(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(g(e)||c(e))V(e,t,void 0);else for(var n=dn(e),r=pn(e),i=r.length,o=0;o<i;o++)t.call(void 0,r[o],n&&n[o],e)}(i,(function(e,t){o.set(t,e)})),i=function(e){e:{for(var t=ua,n=e.length,r=c(e)?e.split(""):e,i=0;i<n;i++)if(i in r&&t.call(void 0,r[i],i,e)){t=i;break e}t=-1}return 0>t?null:c(e)?e.charAt(t):e[t]}(o.X()),r=u.FormData&&t instanceof u.FormData,!W(aa,n)||i||r||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach((function(e,t){this.a.setRequestHeader(t,e)}),e),e.m&&(e.a.responseType=e.m),"withCredentials"in e.a&&e.a.withCredentials!==e.P&&(e.a.withCredentials=e.P);try{pa(e),0<e.g&&(e.v=function(e){return _t&&Rt(9)&&"number"==typeof e.timeout&&void 0!==e.ontimeout}(e.a),Xo(e.b,ya(e,"Will abort after "+e.g+"ms if incomplete, xhr2 "+e.v)),e.v?(e.a.timeout=e.g,e.a.ontimeout=S(e.Ga,e)):e.o=hn(e.Ga,e.g,e)),Xo(e.b,ya(e,"Sending request")),e.i=!0,e.a.send(t),e.i=!1}catch(a){Xo(e.b,ya(e,"Send error: "+a.message)),ca(e,a)}}function ua(e){return"content-type"==e.toLowerCase()}function ca(e,t){e.c=!1,e.a&&(e.f=!0,e.a.abort(),e.f=!1),e.h=t,la(e),fa(e)}function la(e){e.I||(e.I=!0,e.dispatchEvent("complete"),e.dispatchEvent("error"))}function ha(e){if(e.c&&"undefined"!=typeof s)if(e.w[1]&&4==da(e)&&2==ma(e))Xo(e.b,ya(e,"Local request error detected and ignored"));else if(e.i&&4==da(e))hn(e.Lb,0,e);else if(e.dispatchEvent("readystatechange"),4==da(e)){Xo(e.b,ya(e,"Request complete")),e.c=!1;try{var t,n=ma(e);e:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break e;default:r=!1}if(!(t=r)){var i;if(i=0===n){var o=String(e.l).match(vn)[1]||null;if(!o&&u.self&&u.self.location){var a=u.self.location.protocol;o=a.substr(0,a.length-1)}i=!oa.test(o?o.toLowerCase():"")}t=i}if(t)e.dispatchEvent("complete"),e.dispatchEvent("success");else{try{var c=2<da(e)?e.a.statusText:""}catch(l){Xo(e.b,"Can not get status: "+l.message),c=""}e.h=c+" ["+ma(e)+"]",la(e)}}finally{fa(e)}}}function fa(e,t){if(e.a){pa(e);var n=e.a,r=e.w[0]?p:null;e.a=null,e.w=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(i){(e=e.b)&&e.log(Bo,"Problem encountered resetting onreadystatechange: "+i.message,void 0)}}}function pa(e){e.a&&e.v&&(e.a.ontimeout=null),e.o&&(u.clearTimeout(e.o),e.o=null)}function da(e){return e.a?e.a.readyState:0}function ma(e){try{return 2<da(e)?e.a.status:-1}catch(t){return-1}}function ya(e,t){return t+" ["+e.O+" "+e.l+" "+ma(e)+"]"}function ga(e){var t=Na;this.g=[],this.v=t,this.o=e||null,this.f=this.a=!1,this.c=void 0,this.u=this.w=this.i=!1,this.h=0,this.b=null,this.l=0}function va(e,t,n){e.a=!0,e.c=n,e.f=!t,Ea(e)}function ba(e){if(e.a){if(!e.u)throw new Ta(e);e.u=!1}}function _a(e,t,n,r){e.g.push([t,n,r]),e.a&&Ea(e)}function wa(e){return B(e.g,(function(e){return v(e[1])}))}function Ea(e){if(e.h&&e.a&&wa(e)){var t=e.h,n=Ia[t];
1n&&(u.clearTimeout(n.a),delete Ia[t]),e.h=0}e.b&&(e.b.l--,delete e.b),t=e.c;for(var r=n=!1;e.g.length&&!e.i;){var i=e.g.shift(),o=i[0],a=i[1];if(i=i[2],o=e.f?a:o)try{var s=o.call(i||e.o,t);void 0!==s&&(e.f=e.f&&(s==t||s instanceof Error),e.c=t=s),(N(t)||"function"===typeof u.Promise&&t instanceof u.Promise)&&(r=!0,e.i=!0)}catch(c){t=c,e.f=!0,wa(e)||(n=!0)}}e.c=t,r&&(s=S(e.m,e,!0),r=S(e.m,e,!1),t instanceof ga?(_a(t,s,r),t.w=!0):t.then(s,r)),n&&(t=new Ca(t),Ia[t.a]=t,e.h=t.a)}function Ta(){A.call(this)}function Sa(){A.call(this)}function Ca(e){this.a=u.setTimeout(S(this.c,this),0),this.b=e}(t=ra.prototype).Ga=function(){"undefined"!=typeof s&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",Xo(this.b,ya(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(Xo(this.b,ya(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),fa(this))},t.xa=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),fa(this,!0)),ra.qb.xa.call(this)},t.Lb=function(){this.ta||(this.J||this.i||this.f?ha(this):this.yc())},t.yc=function(){ha(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case ia:case"text":return this.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in this.a)return this.a.mozResponseArrayBuffer}var e=this.b;return e&&e.log(Bo,"Response type "+this.m+" is not supported on this browser",void 0),null}catch(t){return Xo(this.b,"Can not get response: "+t.message),null}},ga.prototype.cancel=function(e){if(this.a)this.c instanceof ga&&this.c.cancel();else{if(this.b){var t=this.b;delete this.b,e?t.cancel(e):(t.l--,0>=t.l&&t.cancel())}this.v?this.v.call(this.o,this):this.u=!0,this.a||(e=new Sa(this),ba(this),va(this,!1,e))}},ga.prototype.m=function(e,t){this.i=!1,va(this,e,t)},ga.prototype.then=function(e,t,n){var r,i,o=new ze((function(e,t){r=e,i=t}));return _a(this,r,(function(e){e instanceof Sa?o.cancel():i(e)})),o.then(e,t,n)},ga.prototype.$goog_Thenable=!0,k(Ta,A),Ta.prototype.message="Deferred has already fired",Ta.prototype.name="AlreadyCalledError",k(Sa,A),Sa.prototype.message="Deferred was canceled",Sa.prototype.name="CanceledError",Ca.prototype.c=function(){throw delete Ia[this.a],this.b};var Ia={};function ka(e){var t={},n=t.document||document,r=oe(e).toString(),i=document.createElement("SCRIPT"),o={Nb:i,Ga:void 0},a=new ga(o),s=null,c=null!=t.timeout?t.timeout:5e3;return 0<c&&(s=window.setTimeout((function(){Aa(i,!0);var e=new Oa(Ra,"Timeout reached for loading script "+r);ba(a),va(a,!1,e)}),c),o.Ga=s),i.onload=i.onreadystatechange=function(){i.readyState&&"loaded"!=i.readyState&&"complete"!=i.readyState||(Aa(i,t.gd||!1,s),ba(a),va(a,!0,null))},i.onerror=function(){Aa(i,!0,s);var e=new Oa(Da,"Error while loading script "+r);ba(a),va(a,!1,e)},$(o=t.attributes||{},{type:"text/javascript",charset:"UTF-8"}),Kn(i,o),function(e,t){U(e,"HTMLScriptElement"),e.src=oe(t),null===f&&(f=(t=(t=u.document).querySelector&&t.querySelector("script[nonce]"))&&(t=t.nonce||t.getAttribute("nonce"))&&h.test(t)?t:""),(t=f)&&e.setAttribute("nonce",t)}(i,e),function(e){var t;return(t=(e||document).getElementsByTagName("HEAD"))&&0!=t.length?t[0]:e.documentElement}(n).appendChild(i),a}function Na(){if(this&&this.Nb){var e=this.Nb;e&&"SCRIPT"==e.tagName&&Aa(e,!0,this.Ga)}}function Aa(e,t,n){null!=n&&u.clearTimeout(n),e.onload=p,e.onerror=p,e.onreadystatechange=p,t&&window.setTimeout((function(){e&&e.parentNode&&e.parentNode.removeChild(e)}),0)}var Da=0,Ra=1;function Oa(e,t){var n="Jsloader error (code #"+e+")";t&&(n+=": "+t),A.call(this,n),this.code=e}function Pa(e){this.f=e}function xa(e,t,n){if(this.c=e,e=t||{},this.l=e.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.u=e.secureTokenTimeout||Fa,this.g=X(e.secureTokenHeaders||Ua),this.h=e.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.i=e.firebaseTimeout||qa,this.a=X(e.firebaseHeaders||Va),n&&(this.a["X-Client-Version"]=n,this.g["X-Client-Version"]=n),n="Node"==fr(),!(n=u.XMLHttpRequest||n&&r.a.INTERNAL.node&&r.a.INTERNAL.node.XMLHttpRequest)&&!hr())throw new Zr("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0,hr()?this.f=new Jo(self):pr()?this.f=new Pa(n):this.f=new Lo,this.b=null}k(Oa,A),k(Pa,Oo),Pa.prototype.a=function(){return new this.f},Pa.prototype.b=function(){return{}};var Ma,La="idToken",Fa=new Or(3e4,6e4),Ua={"Content-Type":"application/x-www-form-urlencoded"},qa=new Or(3e4,6e4),Va={"Content-Type":"application/json"};function ja(e,t){t?e.a["X-Firebase-Locale"]=t:delete e.a["X-Firebase-Locale"]}function Ba(e,t){t?(e.a["X-Client-Version"]=t,e.g["X-Client-Version"]=t):(delete e.a["X-Client-Version"],delete e.g["X-Client-Version"])}function Wa(e,t,n,r,i,o,a){(function(){var e=br();return!((e=yr(e)!=mr?null:(e=e.match(/\sChrome\/(\d+)/i))&&2==e.length?parseInt(e[1],10):null)&&30>e)&&(!_t||!At||9<At)})()||hr()?e=S(e.o,e):(Ma||(Ma=new ze((function(e,t){!function(e,t){if(((window.gapi||{}).client||{}).request)e();else{u[Ka]=function(){((window.gapi||{}).client||{}).request?e():t(Error("CORS_UNSUPPORTED"))},function(e,t){_a(e,null,t,void 0)}(ka(ae(Qa,{onload:Ka})),(function(){t(Error("CORS_UNSUPPORTED"))}))}}(e,t)}))),e=S(e.m,e)),e(t,n,r,i,o,a)}xa.prototype.R=function(){return this.b},xa.prototype.o=function(e,t,n,r,i,o){if(hr()&&("undefined"===typeof u.fetch||"undefined"===typeof u.Headers||"undefined"===typeof u.Request))throw new Zr("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to supp
1ort HTTP requests from a Worker environment.");var a=new ra(this.f);if(o){a.g=Math.max(0,o);var s=setTimeout((function(){a.dispatchEvent("timeout")}),o)}un(a,"complete",(function(){s&&clearTimeout(s);var e=null;try{e=JSON.parse(function(e){try{return e.a?e.a.responseText:""}catch(t){return Xo(e.b,"Can not get responseText: "+t.message),""}}(this))||null}catch(n){e=null}t&&t(e)})),cn(a,"ready",(function(){s&&clearTimeout(s),yt(this)})),cn(a,"timeout",(function(){s&&clearTimeout(s),yt(this),t&&t(null)})),sa(a,e,n,r,i)};var Qa=new Z(ne,"https://apis.google.com/js/client.js?onload=%{onload}"),Ka="__fcb"+Math.floor(1e6*Math.random()).toString();function za(e){if(!c(e=e.email)||!sr.test(e))throw new Zr("invalid-email")}function Ha(e){"email"in e&&za(e)}function Ga(e){if(!e[La])throw new Zr("internal-error")}function Ya(e){if(e.phoneNumber||e.temporaryProof){if(!e.phoneNumber||!e.temporaryProof)throw new Zr("internal-error")}else{if(!e.sessionInfo)throw new Zr("missing-verification-id");if(!e.code)throw new Zr("missing-verification-code")}}xa.prototype.m=function(e,t,n,r,i){var o=this;Ma.then((function(){window.gapi.client.setApiKey(o.c);var a=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:e,method:n,body:r,headers:i,authType:"none",callback:function(e){window.gapi.auth.setToken(a),t&&t(e)}})})).s((function(e){t&&t({error:{message:e&&e.message||"CORS_UNSUPPORTED"}})}))},xa.prototype.ob=function(){return Rs(this,Es,{})},xa.prototype.rb=function(e,t){return Rs(this,_s,{idToken:e,email:t})},xa.prototype.sb=function(e,t){return Rs(this,ws,{idToken:e,password:t})};var Xa={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function Ja(e){if(!e.requestUri||!e.sessionId&&!e.postBody&&!e.pendingToken)throw new Zr("internal-error")}function $a(e,t){return t.oauthIdToken&&t.providerId&&0==t.providerId.indexOf("oidc.")&&!t.pendingToken&&(e.sessionId?t.nonce=e.sessionId:e.postBody&&(qn(e=new Mn(e.postBody),"nonce")&&(t.nonce=e.get("nonce")))),t}function Za(e){var t=null;if(e.needConfirmation?(e.code="account-exists-with-different-credential",t=Ro(e)):"FEDERATED_USER_ID_ALREADY_LINKED"==e.errorMessage?(e.code="credential-already-in-use",t=Ro(e)):"EMAIL_EXISTS"==e.errorMessage?(e.code="email-already-in-use",t=Ro(e)):e.errorMessage&&(t=Os(e.errorMessage)),t)throw t;if(!e[La])throw new Zr("internal-error")}function es(e,t){return t.returnIdpCredential=!0,Rs(e,Ts,t)}function ts(e,t){return t.returnIdpCredential=!0,Rs(e,Cs,t)}function ns(e,t){return t.returnIdpCredential=!0,t.autoCreate=!1,Rs(e,Ss,t)}function rs(e){if(!e.oobCode)throw new Zr("invalid-action-code")}(t=xa.prototype).tb=function(e,t){var n={idToken:e},r=[];return G(Xa,(function(e,i){var o=t[i];null===o?r.push(e):i in t&&(n[i]=o)})),r.length&&(n.deleteAttribute=r),Rs(this,_s,n)},t.kb=function(e,t){return $(e={requestType:"PASSWORD_RESET",email:e},t),Rs(this,ms,e)},t.lb=function(e,t){return $(e={requestType:"EMAIL_SIGNIN",email:e},t),Rs(this,ps,e)},t.jb=function(e,t){return $(e={requestType:"VERIFY_EMAIL",idToken:e},t),Rs(this,ds,e)},t.Va=function(e){return Rs(this,Ns,e)},t.$a=function(e,t){return Rs(this,vs,{oobCode:e,newPassword:t})},t.Ka=function(e){return Rs(this,os,{oobCode:e})},t.Xa=function(e){return Rs(this,is,{oobCode:e})};var is={endpoint:"setAccountInfo",D:rs,fa:"email",F:!0},os={endpoint:"resetPassword",D:rs,K:function(e){var t=e.requestType;if(!t||!e.email&&"EMAIL_SIGNIN"!=t)throw new Zr("internal-error")},F:!0},as={endpoint:"signupNewUser",D:function(e){if(za(e),!e.password)throw new Zr("weak-password")},K:Ga,T:!0,F:!0},ss={endpoint:"createAuthUri",F:!0},us={endpoint:"deleteAccount",V:["idToken"]},cs={endpoint:"setAccountInfo",V:["idToken","deleteProvider"],D:function(e){if(!y(e.deleteProvider))throw new Zr("internal-error")}},ls={endpoint:"emailLinkSignin",V:["email","oobCode"],D:za,K:Ga,T:!0,F:!0},hs={endpoint:"emailLinkSignin",V:["idToken","email","oobCode"],D:za,K:Ga,T:!0},fs={endpoint:"getAccountInfo"},ps={endpoint:"getOobConfirmationCode",V:["requestType"],D:function(e){if("EMAIL_SIGNIN"!=e.requestType)throw new Zr("internal-error");za(e)},fa:"email",F:!0},ds={endpoint:"getOobConfirmationCode",V:["idToken","requestType"],D:function(e){if("VERIFY_EMAIL"!=e.requestType)throw new Zr("internal-error")},fa:"email",F:!0},ms={endpoint:"getOobConfirmationCode",V:["requestType"],D:function(e){if("PASSWORD_RESET"!=e.requestType)throw new Zr("internal-error");za(e)},fa:"email",F:!0},ys={wb:!0,endpoint:"getProjectConfig",Kb:"GET"},gs={wb:!0,endpoint:"getRecaptchaParam",Kb:"GET",K:function(e){if(!e.recaptchaSiteKey)throw new Zr("internal-error")}},vs={endpoint:"resetPassword",D:rs,fa:"email",F:!0},bs={endpoint:"sendVerificationCode",V:["phoneNumber","recaptchaToken"],fa:"sessionInfo",F:!0},_s={endpoint:"setAccountInfo",V:["idToken"],D:Ha,T:!0},ws={endpoint:"setAccountInfo",V:["idToken"],D:function(e){if(Ha(e),!e.password)throw new Zr("weak-
1password")},K:Ga,T:!0},Es={endpoint:"signupNewUser",K:Ga,T:!0,F:!0},Ts={endpoint:"verifyAssertion",D:Ja,Qa:$a,K:Za,T:!0,F:!0},Ss={endpoint:"verifyAssertion",D:Ja,Qa:$a,K:function(e){if(e.errorMessage&&"USER_NOT_FOUND"==e.errorMessage)throw new Zr("user-not-found");if(e.errorMessage)throw Os(e.errorMessage);if(!e[La])throw new Zr("internal-error")},T:!0,F:!0},Cs={endpoint:"verifyAssertion",D:function(e){if(Ja(e),!e.idToken)throw new Zr("internal-error")},Qa:$a,K:Za,T:!0},Is={endpoint:"verifyCustomToken",D:function(e){if(!e.token)throw new Zr("invalid-custom-token")},K:Ga,T:!0,F:!0},ks={endpoint:"verifyPassword",D:function(e){if(za(e),!e.password)throw new Zr("wrong-password")},K:Ga,T:!0,F:!0},Ns={endpoint:"verifyPhoneNumber",D:Ya,K:Ga,F:!0},As={endpoint:"verifyPhoneNumber",D:function(e){if(!e.idToken)throw new Zr("internal-error");Ya(e)},K:function(e){if(e.temporaryProof)throw e.code="credential-already-in-use",Ro(e);Ga(e)}},Ds={Yb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",D:Ya,K:Ga,F:!0};function Rs(e,t,n){if(!function(e,t){if(!t||!t.length)return!0;if(!e)return!1;for(var n=0;n<t.length;n++){var r=e[t[n]];if(void 0===r||null===r||""===r)return!1}return!0}(n,t.V))return et(new Zr("internal-error"));var r,i=t.Kb||"POST";return Ze(n).then(t.D).then((function(){return t.T&&(n.returnSecureToken=!0),t.F&&e.b&&"undefined"===typeof n.tenantId&&(n.tenantId=e.b),function(e,t,n,r,i,o){var a=Cn(e.h+t);Tn(a,"key",e.c),o&&Tn(a,"cb",I().toString());var s="GET"==n;if(s)for(var u in r)r.hasOwnProperty(u)&&Tn(a,u,r[u]);return new ze((function(t,o){Wa(e,a.toString(),(function(e){e?e.error?o(Ps(e,i||{})):t(e):o(new Zr("network-request-failed"))}),n,s?void 0:Yn(kr(r)),e.a,e.i.get())}))}(e,t.endpoint,i,n,t.Yb,t.wb||!1)})).then((function(e){return r=e,t.Qa?t.Qa(n,r):r})).then(t.K).then((function(){if(!t.fa)return r;if(!(t.fa in r))throw new Zr("internal-error");return r[t.fa]}))}function Os(e){return Ps({error:{errors:[{message:e}],code:400,message:e}})}function Ps(e,t){var n=(e.error&&e.error.errors&&e.error.errors[0]||{}).reason||"",r={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(n=r[n]?new Zr(r[n]):null)return n;for(var i in n=e.error&&e.error.message||"",$(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_
1NONCE:"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",UNSUPPORTED_TENANT_OPERATION:"unsupported-tenant-operation",INVALID_TENANT_ID:"invalid-tenant-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation"},t||{}),t=(t=n.match(/^[^\s]+\s*:\s*(.*)$/))&&1<t.length?t[1]:void 0,r)if(0===n.indexOf(i))return new Zr(r[i],t);return!t&&e&&(t=Ir(e)),new Zr("internal-error",t)}function xs(e){this.b=e,this.a=null,this.fb=function(e){return(Us||(Us=new ze((function(e,t){function n(){Rr(),_r("gapi.load")("gapi.iframes",{callback:e,ontimeout:function(){Rr(),t(Error("Network Error"))},timeout:Ls.get()})}if(_r("gapi.iframes.Iframe"))e();else if(_r("gapi.load"))n();else{var r="__iframefcb"+Math.floor(1e6*Math.random()).toString();u[r]=function(){_r("gapi.load")?n():t(Error("Network Error"))},Ze(ka(r=ae(Ms,{onload:r}))).s((function(){t(Error("Network Error"))}))}})).s((function(e){throw Us=null,e})))).then((function(){return new ze((function(t,n){_r("gapi.iframes.getContext")().open({where:document.body,url:e.b,messageHandlersFilter:_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},(function(r){function i(){clearTimeout(o),t()}e.a=r,e.a.restyle({setHideOnLeave:!1});var o=setTimeout((function(){n(Error("Network Error"))}),Fs.get());r.ping(i).then(i,(function(){n(Error("Network Error"))}))}))}))}))}(this)}var Ms=new Z(ne,"https://apis.google.com/js/api.js?onload=%{onload}"),Ls=new Or(3e4,6e4),Fs=new Or(5e3,15e3),Us=null;function qs(e,t,n){this.i=e,this.g=t,this.h=n,this.f=null,this.a=In(this.i,"/__/auth/iframe"),Tn(this.a,"apiKey",this.g),Tn(this.a,"appName",this.h),this.b=null,this.c=[]}function Vs(e,t,n,r,i){this.o=e,this.m=t,this.c=n,this.u=r,this.i=this.g=this.l=null,this.a=i,this.h=this.f=null}function js(e){try{return r.a.app(e).auth().Aa()}catch(t){return[]}}function Bs(e,t,n,r,i){this.u=e,this.f=t,this.b=n,this.c=r||null,this.h=i||null,this.m=this.o=this.v=null,this.g=[],this.l=this.a=null}function Ws(e){var t=tr();return function(e){return Rs(e,ys,{}).then((function(e){return e.authorizedDomains||[]}))}(e).then((function(e){e:{var n=Cn(t),r=n.f;n=n.b;for(var i=0;i<e.length;i++){var o=e[i],a=n,s=r;if(0==o.indexOf("chrome-extension://")?a=Cn(o).b==a&&"chrome-extension"==s:"http"!=s&&"https"!=s?a=!1:ar.test(o)?a=a==o:(o=o.split(".").join("\\."),a=new RegExp("^(.+\\."+o+"|"+o+")$","i").test(a)),a){e=!0;break e}}e=!1}if(!e)throw new Ao(tr())}))}function Qs(e){return e.l?e.l:(e.l=ur().then((function(){if(!e.o){var t=e.c,n=e.h,r=js(e.b),i=new qs(e.u,e.f,e.b);i.f=t,i.b=n,i.c=H(r||[]),e.o=i.toString()}e.i=new xs(e.o),function(e){if(!e.i)throw Error("IfcHandler must be initialized!");!function(e,t){e.fb.then((function(){e.a.register("authEvent",t,_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))}))}(e.i,(function(t){var n={};if(t&&t.authEvent){var r=!1;for(t=Co(t.authEvent),n=0;n<e.g.length;n++)r=e.g[n](t)||r;return(n={}).status=r?"ACK":"ERROR",Ze(n)}return n.status="ERROR",Ze(n)}))}(e)})),e.l)}function Ks(e){return e.m||(e.v=e.c?vr(e.c,js(e.b)):null,e.m=new xa(e.f,Ri(e.h),e.v)),e.m}function zs(e,t,n,r,i,o,a,s,u,c,l){return(e=new Vs(e,t,n,r,i)).l=o,e.g=a,e.i=s,e.b=X(u||null),e.f=c,e.nb(l).toString()}function Hs(e){if(this.a=e||r.a.INTERNAL.reactNative&&r.a.INTERNAL.reactNative.AsyncStorage,!this.a)throw new Zr("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function Gs(e){this.b=e,this.a={},this.f=S(this.c,this)}qs.prototype.toString=function(){return this.f?Tn(this.a,"v",this.f):Un(this.a.a,"v"),this.b?Tn(this.a,"eid",this.b):Un(this.a.a,"eid"),this.c.length?Tn(this.a,"fw",this.c.join(",")):Un(this.a.a,"fw"),this.a.toString()},Vs.prototype.nb=function(e){return this.h=e,this},Vs.prototype.toString=function(){var e=In(this.o,"/__/auth/handler");if(Tn(e,"apiKey",this.m),Tn(e,"appName",this.c),Tn(e,"authType",this.u),this.a.isOAuthProvider){var t=this.a;try{var n=r.a.app(this.c).auth().ha()}catch(u){n=null}for(var i in t.ab=n,Tn(e,"providerId",this.a.providerId),n=kr((t=this.a).zb))n[i]=n[i].toString();i=t.Fc,n=X(n);for(var o=0;o<i.length;o++){var a=i[o];a in n&&delete n[a]}t.cb&&t.ab&&!n[t.cb]&&(n[t.cb]=t.ab),Y(n)||Tn(e,"customParameters",Ir(n))}if("function"===typeof this.a.Hb&&((t=this.a.Hb()).length&&Tn(e,"scopes",t.join(","))),this.l?Tn(e,"redirectUrl",this.l):Un(e.a,"redirectUrl"),this.g?Tn(e,"eventId",this.g):Un(e.a,"eventId"),this.i?Tn(e,"v",this.i):Un(e.a,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!Sn(e,s)&&Tn(e,s,this.b[s]);return this.h?Tn(e,"tid",this.h):Un(e.a,"tid"),this.f?Tn(e,"eid",this.f):Un(e.a,"eid"),(s=js(this.c)).length&&Tn(e,"fw",s.join(",")),e.toString()},(t=Bs.prototype).Fb=function(e,t,n){var r=new Zr("popup-closed-by-user"),i=new Zr("web-storage-unsupported"),o=this,a=!1;return this.ia().then((function(){(function(e){var t={type:"webStorageSupport"};return Qs(e).then((function(){return function(e,t){return e.fb.then((function(){return new ze((function(n){e.a.send(t.type,t,n,_r("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))}))}))}(e.i,t)})).then((function(e){if(e&&e.length&&"undefined"!==typeof e[0].webStorageSupport)return e[0].webStorageSupport;throw Error()}))})(o).then((function(n){n||(e&&ir(e),t(i),a=!0)}))})).s((function(){})).then((function(){if(!a)return function(e){return new ze((function(t){return function n(){fn(2e3).then((function(){if(e&&!e.closed)return n();t()}))}()}))}(e)})).then((function(){if(!a)return fn(n).then((function(){t(r)}))}))},t.Ob=function(){var e=br();return!Cr(e)&&!Dr(e)},t.Jb=function(){return!1}
1,t.Db=function(e,t,n,r,i,o,a,s){if(!e)return et(new Zr("popup-blocked"));if(a&&!Cr())return this.ia().s((function(t){ir(e),i(t)})),r(),Ze();this.a||(this.a=Ws(Ks(this)));var u=this;return this.a.then((function(){var t=u.ia().s((function(t){throw ir(e),i(t),t}));return r(),t})).then((function(){(To(n),a)||nr(zs(u.u,u.f,u.b,t,n,null,o,u.c,void 0,u.h,s),e)})).s((function(e){throw"auth/network-request-failed"==e.code&&(u.a=null),e}))},t.Eb=function(e,t,n,r){this.a||(this.a=Ws(Ks(this)));var i=this;return this.a.then((function(){To(t),nr(zs(i.u,i.f,i.b,e,t,tr(),n,i.c,void 0,i.h,r))})).s((function(e){throw"auth/network-request-failed"==e.code&&(i.a=null),e}))},t.ia=function(){var e=this;return Qs(this).then((function(){return e.i.fb})).s((function(){throw e.a=null,new Zr("network-request-failed")}))},t.Rb=function(){return!0},t.ya=function(e){this.g.push(e)},t.La=function(e){K(this.g,(function(t){return t==e}))},(t=Hs.prototype).get=function(e){return Ze(this.a.getItem(e)).then((function(e){return e&&Nr(e)}))},t.set=function(e,t){return Ze(this.a.setItem(e,Ir(t)))},t.S=function(e){return Ze(this.a.removeItem(e))},t.$=function(){},t.ea=function(){};var Ys,Xs=[];function Js(e,t,n){Y(e.a)&&e.b.addEventListener("message",e.f),"undefined"===typeof e.a[t]&&(e.a[t]=[]),e.a[t].push(n)}function $s(e){this.a=e}function Zs(e){this.c=e,this.b=!1,this.a=[]}function eu(e,t,n,r){var i,o,a,s,u=n||{},c=null;if(e.b)return et(Error("connection_unavailable"));var l=r?800:50,h="undefined"!==typeof MessageChannel?new MessageChannel:null;return new ze((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(e){e.data.eventId===i&&("ack"===e.data.status?(clearTimeout(a),s=setTimeout((function(){r(Error("timeout"))}),3e3)):"done"===e.data.status?(clearTimeout(s),"undefined"!==typeof e.data.response?n(e.data.response):r(Error("unknown_error"))):(clearTimeout(a),clearTimeout(s),r(Error("invalid_response"))))}},e.a.push(c),h.port1.addEventListener("message",o),e.c.postMessage({eventType:t,eventId:i,data:u},[h.port2])):r(Error("connection_unavailable"))})).then((function(t){return tu(e,c),t})).s((function(t){throw tu(e,c),t}))}function tu(e,t){if(t){var n=t.messageChannel,r=t.onMessage;n&&(n.port1.removeEventListener("message",r),n.port1.close()),K(e.a,(function(e){return e==t}))}}function nu(){if(!ou())throw new Zr("web-storage-unsupported");this.c={},this.a=[],this.b=0,this.u=u.indexedDB,this.type="indexedDB",this.g=this.l=this.f=this.i=null,this.o=!1,this.h=null;var e=this;hr()&&self?(this.l=function(){var e=hr()?self:null;if(V(Xs,(function(n){n.b==e&&(t=n)})),!t){var t=new Gs(e);Xs.push(t)}return t}(),Js(this.l,"keyChanged",(function(t,n){return lu(e).then((function(t){return 0<t.length&&V(e.a,(function(e){e(t)})),{keyProcessed:W(t,n.key)}}))})),Js(this.l,"ping",(function(){return Ze(["keyChanged"])}))):function(){var e=u.navigator;return e&&e.serviceWorker?Ze().then((function(){return e.serviceWorker.ready})).then((function(e){return e.active||null})).s((function(){return null})):Ze(null)}().then((function(t){(e.h=t)&&(e.g=new Zs(new $s(t)),eu(e.g,"ping",null,!0).then((function(t){t[0].fulfilled&&W(t[0].value,"keyChanged")&&(e.o=!0)})).s((function(){})))}))}function ru(e){return new ze((function(t,n){var r=e.u.open("firebaseLocalStorageDb",1);r.onerror=function(e){try{e.preventDefault()}catch(t){}n(Error(e.target.error))},r.onupgradeneeded=function(e){e=e.target.result;try{e.createObjectStore("firebaseLocalStorage",{keyPath:"fbase_key"})}catch(t){n(t)}},r.onsuccess=function(r){(r=r.target.result).objectStoreNames.contains("firebaseLocalStorage")?t(r):function(e){return new ze((function(t,n){var r=e.u.deleteDatabase("firebaseLocalStorageDb");r.onsuccess=function(){t()},r.onerror=function(e){n(Error(e.target.error))}}))}(e).then((function(){return ru(e)})).then((function(e){t(e)})).s((function(e){n(e)}))}}))}function iu(e){return e.m||(e.m=ru(e)),e.m}function ou(){try{return!!u.indexedDB}catch(zo){return!1}}function au(e){return e.objectStore("firebaseLocalStorage")}function su(e,t){return e.transaction(["firebaseLocalStorage"],t?"readwrite":"readonly")}function uu(e){return new ze((function(t,n){e.onsuccess=function(e){e&&e.target?t(e.target.result):t()},e.onerror=function(e){n(e.target.error)}}))}function cu(e,t){return e.g&&e.h&&function(){var e=u.navigator;return e&&e.serviceWorker&&e.serviceWorker.controller||null}()===e.h?eu(e.g,"keyChanged",{key:t},e.o).then((function(){})).s((function(){})):Ze()}function lu(e){return iu(e).then((function(e){var t=au(su(e,!1));return t.getAll?uu(t.getAll()):new ze((function(e,n){var r=[],i=t.openCursor();i.onsuccess=function(t){(t=t.target.result)?(r.push(t.value),t.continue()):e(r)},i.onerror=function(e){n(e.target.error)}}))})).then((function(t){var n={},r=[];if(0==e.b){for(r=0;r<t.length;r++)n[t[r].fbase_key]=t[r].value;r=function e(t,n){var r,i=[];for(r in t)r in n?typeof t[r]!=typeof n[r]?i.push(r):"object"==typeof t[r]&&null!=t[r]&&null!=n[r]?0<e(t[r],n[r]).length&&i.push(r):t[r]!==n[r]&&i.push(r):i.push(r);for(r in n)r in t||i.push(r);return i}(e.c,n),e.c=n}return r}))}function hu(e){e.i&&e.i.cancel("STOP_EVENT"),e.f&&(clearTimeout(e.f),e.f=null)}function fu(e){var t=this,n=null;this.a=[],this.type="indexedDB",this.c=e,this.b=Ze().then((function(){if(ou()){var e=Ar(),r="__sak"+e;return Ys||(Ys=new nu),(n=Ys).set(r,e).then((function(){return n.get(r)})).then((function(t){if(t!==e)throw Error("indexedDB not supported!");return n.S(r)})).then((function(){return n})).s((function(){return t.c}))}return t.c})).then((function(e){return t.type=e.type,e.$((function(e){V(t.a,(function(t){t(e)}))})),e}))}function pu(){this.a={},this.type="inMemory"}function du(){if(!function(){var e="Node"==fr();if(!(e=mu()||e&&r.a.INTERNAL.node&&r.a.INTERNAL.node.localStorage))return!1;try{return e.setItem("__sak","1"),e.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==fr())throw new Zr("internal-error","The LocalStorage compatibility library was not found.");throw new Zr("web-storage-unsupported")}this.a=mu()||r.a.INTERNAL.node.localStorage,this.type="localStorage"}function mu(){try{var e=u.localStorage,t=Ar();return e&&(e.setItem(t,"1"),e.removeItem(t)),e}catch(n){return null}}function yu(){this.type="nullStorage"}function gu(){if(!function(){var e="Node"==fr();if(!(e=vu()||e&&r.a.INTERNAL.node&&r.a.INTERNAL.node.sessionStorage))return!1;try{return e.setItem("__sak","1"),e.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==fr())throw new Zr("internal-error","The SessionStorage compatibility library was not found.");throw new Zr("web-storage-unsupported")}this.a=vu()||r.a.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function vu(){try{var e=u.sessionStorage,t=Ar();return e&&(e.setItem(t,"1"),e.removeItem(t)),e}catch(n){return null}}function bu(){var e={};e.Browser=Eu,e.Node=Tu,e.ReactNative=Su,e.Worker=Cu,this.a=e[fr()]}Gs.prototype.c=function(e){var t=e.data.eventType,n=e.data.eventId,r=this.a[t];if(r&&0<r.length){e.ports[0].postMessage({status:"ack",eventId:n,eventType:t,response:null});var i=[];V(r,(function(t){i.push(Ze().then((function(){return t(e.origin,e.data.data)})))})),nt(i).then((function(r){var i=[];V(r,(function(e){i.push({fulfilled:e.Gb,value:e.value,reason:e.reason?e.reason.message:void 0})})),V(i,(function(e){for(var t in e)"undefined"===typeof e[t]&&delete e[t]})),e.ports[0].postMessage({status:"done",eventId:n,eventType:t,response:i})}))}},$s.prototype.postMessage=function(e,t){this.a.postMessage(e,t)},Zs.prototype.close=function(){for(;0<this.a.length;)tu(this,this.a[0]);this.b=!0},(t=nu.prototype).set=function(e,t){var n,r=!1,i=this;return iu(this).then((function(t){return uu((t=au(su(n=t,!0))).get(e))})).then((function(o){var a=au(su(n,!0));
1return o?(o.value=t,uu(a.put(o))):(i.b++,r=!0,(o={}).fbase_key=e,o.value=t,uu(a.add(o)))})).then((function(){return i.c[e]=t,cu(i,e)})).ka((function(){r&&i.b--}))},t.get=function(e){return iu(this).then((function(t){return uu(au(su(t,!1)).get(e))})).then((function(e){return e&&e.value}))},t.S=function(e){var t=!1,n=this;return iu(this).then((function(r){return t=!0,n.b++,uu(au(su(r,!0)).delete(e))})).then((function(){return delete n.c[e],cu(n,e)})).ka((function(){t&&n.b--}))},t.$=function(e){0==this.a.length&&function(e){hu(e),function t(){e.f=setTimeout((function(){e.i=lu(e).then((function(t){0<t.length&&V(e.a,(function(e){e(t)}))})).then((function(){t()})).s((function(e){"STOP_EVENT"!=e.message&&t()}))}),800)}()}(this),this.a.push(e)},t.ea=function(e){K(this.a,(function(t){return t==e})),0==this.a.length&&hu(this)},(t=fu.prototype).get=function(e){return this.b.then((function(t){return t.get(e)}))},t.set=function(e,t){return this.b.then((function(n){return n.set(e,t)}))},t.S=function(e){return this.b.then((function(t){return t.S(e)}))},t.$=function(e){this.a.push(e)},t.ea=function(e){K(this.a,(function(t){return t==e}))},(t=pu.prototype).get=function(e){return Ze(this.a[e])},t.set=function(e,t){return this.a[e]=t,Ze()},t.S=function(e){return delete this.a[e],Ze()},t.$=function(){},t.ea=function(){},(t=du.prototype).get=function(e){var t=this;return Ze().then((function(){return Nr(t.a.getItem(e))}))},t.set=function(e,t){var n=this;return Ze().then((function(){var r=Ir(t);null===r?n.S(e):n.a.setItem(e,r)}))},t.S=function(e){var t=this;return Ze().then((function(){t.a.removeItem(e)}))},t.$=function(e){u.window&&Gt(u.window,"storage",e)},t.ea=function(e){u.window&&Jt(u.window,"storage",e)},(t=yu.prototype).get=function(){return Ze(null)},t.set=function(){return Ze()},t.S=function(){return Ze()},t.$=function(){},t.ea=function(){},(t=gu.prototype).get=function(e){var t=this;return Ze().then((function(){return Nr(t.a.getItem(e))}))},t.set=function(e,t){var n=this;return Ze().then((function(){var r=Ir(t);null===r?n.S(e):n.a.setItem(e,r)}))},t.S=function(e){var t=this;return Ze().then((function(){t.a.removeItem(e)}))},t.$=function(){},t.ea=function(){};var _u,wu,Eu={C:du,Sa:gu},Tu={C:du,Sa:gu},Su={C:Hs,Sa:yu},Cu={C:du,Sa:yu},Iu={$c:"local",NONE:"none",bd:"session"};function ku(){var e=!(Dr(br())||!lr()),t=Cr(),n=wr();this.m=e,this.h=t,this.l=n,this.a={},_u||(_u=new bu),e=_u;try{this.g=!er()&&Mr()||!u.indexedDB?new e.a.C:new fu(hr()?new pu:new e.a.C)}catch(r){this.g=new pu,this.h=!0}try{this.i=new e.a.Sa}catch(r){this.i=new pu}this.u=new pu,this.f=S(this.Pb,this),this.b={}}function Nu(){return wu||(wu=new ku),wu}function Au(e,t){switch(t){case"session":return e.i;case"none":return e.u;default:return e.g}}function Du(e,t){return"firebase:"+e.name+(t?":"+t:"")}function Ru(e,t,n){return n=Du(t,n),"local"==t.C&&(e.b[n]=null),Au(e,t.C).S(n)}function Ou(e){e.c&&(clearInterval(e.c),e.c=null)}function Pu(e){this.a=e,this.b=Nu()}(t=ku.prototype).get=function(e,t){return Au(this,e.C).get(Du(e,t))},t.set=function(e,t,n){var r=Du(e,n),i=this,o=Au(this,e.C);return o.set(r,t).then((function(){return o.get(r)})).then((function(t){"local"==e.C&&(i.b[r]=t)}))},t.addListener=function(e,t,n){e=Du(e,t),this.l&&(this.b[e]=u.localStorage.getItem(e)),Y(this.a)&&(Au(this,"local").$(this.f),this.h||(er()||!Mr())&&u.indexedDB||!this.l||function(e){Ou(e),e.c=setInterval((function(){for(var t in e.a){var n=u.localStorage.getItem(t),r=e.b[t];n!=r&&(e.b[t]=n,n=new Ft({type:"storage",key:t,target:window,oldValue:r,newValue:n,a:!0}),e.Pb(n))}}),1e3)}(this)),this.a[e]||(this.a[e]=[]),this.a[e].push(n)},t.removeListener=function(e,t,n){e=Du(e,t),this.a[e]&&(K(this.a[e],(function(e){return e==n})),0==this.a[e].length&&delete this.a[e]),Y(this.a)&&(Au(this,"local").ea(this.f),Ou(this))},t.Pb=function(e){if(e&&e.f){var t=e.a.key;if(null==t)for(var n in this.a){var r=this.b[n];"undefined"===typeof r&&(r=null);var i=u.localStorage.getItem(n);i!==r&&(this.b[n]=i,this.Za(n))}else if(0==t.indexOf("firebase:")&&this.a[t]){if("undefined"!==typeof e.a.a?Au(this,"local").ea(this.f):Ou(this),this.m)if(n=u.localStorage.getItem(t),(r=e.a.newValue)!==n)null!==r?u.localStorage.setItem(t,r):u.localStorage.removeItem(t);else if(this.b[t]===r&&"undefined"===typeof e.a.a)return;var o=this;n=function(){"undefined"===typeof e.a.a&&o.b[t]===u.localStorage.getItem(t)||(o.b[t]=u.localStorage.getItem(t),o.Za(t))},_t&&At&&10==At&&u.localStorage.getItem(t)!==e.a.newValue&&e.a.newValue!==e.a.oldValue?setTimeout(n,10):n()}}else V(e,S(this.Za,this))},t.Za=function(e){this.a[e]&&V(this.a[e],(function(e){e()}
1))};var xu,Mu={name:"authEvent",C:"local"};function Lu(){this.a=Nu()}function Fu(e,t){this.b=Uu,this.f=u.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=e,this.h=t,this.l=u.Int32Array?new Int32Array(64):Array(64),void 0!==xu||(xu=u.Int32Array?new Int32Array(Ku):Ku),this.reset()}k(Fu,(function(){this.b=-1}));for(var Uu=64,qu=Uu-1,Vu=[],ju=0;ju<qu;ju++)Vu[ju]=0;var Bu=z(128,Vu);function Wu(e){for(var t=e.f,n=e.l,r=0,i=0;i<t.length;)n[r++]=t[i]<<24|t[i+1]<<16|t[i+2]<<8|t[i+3],i=4*r;for(t=16;64>t;t++){i=0|n[t-15],r=0|n[t-2];var o=(0|n[t-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,a=(0|n[t-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[t]=o+a|0}r=0|e.a[0],i=0|e.a[1];var s=0|e.a[2],u=0|e.a[3],c=0|e.a[4],l=0|e.a[5],h=0|e.a[6];for(o=0|e.a[7],t=0;64>t;t++){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|xu[t])|0)+(0|n[t])|0)|0,o=h,h=l,l=c,c=u+a|0,u=s,s=i,i=r,r=a+f|0}e.a[0]=e.a[0]+r|0,e.a[1]=e.a[1]+i|0,e.a[2]=e.a[2]+s|0,e.a[3]=e.a[3]+u|0,e.a[4]=e.a[4]+c|0,e.a[5]=e.a[5]+l|0,e.a[6]=e.a[6]+h|0,e.a[7]=e.a[7]+o|0}function Qu(e,t,n){void 0===n&&(n=t.length);var r=0,i=e.c;if(c(t))for(;r<n;)e.f[i++]=t.charCodeAt(r++),i==e.b&&(Wu(e),i=0);else{if(!g(t))throw Error("message must be string or array");for(;r<n;){var o=t[r++];if(!("number"==typeof o&&0<=o&&255>=o&&o==(0|o)))throw Error("message must be a byte array");e.f[i++]=o,i==e.b&&(Wu(e),i=0)}}e.c=i,e.g+=n}Fu.prototype.reset=function(){this.g=this.c=0,this.a=u.Int32Array?new Int32Array(this.h):H(this.h)};var Ku=[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 zu(){Fu.call(this,8,Hu)}k(zu,Fu);var Hu=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function Gu(e,t,n,r,i){this.u=e,this.i=t,this.l=n,this.m=r||null,this.o=i||null,this.h=t+":"+n,this.v=new Lu,this.g=new Pu(this.h),this.f=null,this.b=[],this.a=this.c=null}function Yu(e){return new Zr("invalid-cordova-configuration",e)}function Xu(e){var t=new zu;Qu(t,e),e=[];var n=8*t.g;56>t.c?Qu(t,Bu,56-t.c):Qu(t,Bu,t.b-(t.c-56));for(var r=63;56<=r;r--)t.f[r]=255&n,n/=256;for(Wu(t),r=n=0;r<t.i;r++)for(var i=24;0<=i;i-=8)e[n++]=t.a[r]>>i&255;return function(e){return j(e,(function(e){return 1<(e=e.toString(16)).length?e:"0"+e})).join("")}(e)}function Ju(e,t){for(var n=0;n<e.b.length;n++)try{e.b[n](t)}catch(r){}}function $u(e){return e.f||(e.f=e.ia().then((function(){return new ze((function(t){e.ya((function n(r){return t(r),e.La(n),!1})),function(e){function t(t){r=!0,i&&i.cancel(),Zu(e).then((function(r){var i=n;if(r&&t&&t.url){var o=null;-1!=(i=Ki(t.url)).indexOf("/__/auth/callback")&&(o=(o="object"===typeof(o=Nr(Sn(o=Cn(i),"firebaseError")||null))?ei(o):null)?new So(r.c,r.b,null,null,o,null,r.R()):new So(r.c,r.b,i,r.f,null,null,r.R())),i=o||n}Ju(e,i)}))}var n=new So("unknown",null,null,null,new Zr("no-auth-event")),r=!1,i=fn(500).then((function(){return Zu(e).then((function(){r||Ju(e,n)}))})),o=u.handleOpenURL;u.handleOpenURL=function(e){if(0==e.toLowerCase().indexOf(_r("BuildInfo.packageName",u).toLowerCase()+"://")&&t({url:e}),"function"===typeof o)try{o(e)}catch(n){console.error(n)}},No||(No=new Io),function(e){var t=No;t.a.push(e),t.b||(t.b=function(e){for(var n=0;n<t.a.length;n++)t.a[n](e)},"function"===typeof(e=_r("universalLinks.subscribe",u))&&e(null,t.b))}(t)}(e)}))}))),e.f}function Zu(e){var t=null;return function(e){return e.b.get(Mu,e.a).then((function(e){return Co(e)}))}(e.g).then((function(n){return t=n,Ru((n=e.g).b,Mu,n.a)})).then((function(){return t}))}function ec(e){this.a=e,this.b=Nu()}(t=Gu.prototype).ia=function(){return this.Ba?this.Ba:this.Ba=(cr(void 0)?ur().then((function(){return new ze((function(e,t){var n=u.document,r=setTimeout((function(){t(Error("Cordova framework is not ready."))}),1e3);n.addEventListener("deviceready",(function(){clearTimeout(r),e()}),!1)}))})):et(Error("Cordova must run in an Android or iOS file scheme."))).then((function(){if("function"!==typeof _r("universalLinks.subscribe",u))throw Yu("cordova-universal-links-plugin-fix is not installed");if("undefined"===typeof _r("BuildInfo.packageName",u))throw Yu("cordova-plugin-buildinfo is not installed");if("function"!==typeof _r("cordova.plugins.browsertab.openUrl",u))throw Yu("cordova-plugin-browsertab is not installed");if("function"!==typeof _r("cordova.InAppBrowser.open",u))throw Yu("cordova-plugin-inappbrowser is not installed")}),(function(){throw new Zr("cordova-not-ready")}))},t.Fb=function(e,t){return t(new Zr("operation-not-supported-in-this-environment")),Ze()},t.Db=function(){return et(new Zr("operation-not-supported-in-this-environment"))},t.Rb=function(){return!1},t.Ob=function(){return!0},t.Jb=function(){return!0},t.Eb=function(e,t,n,r){if(this.c)return et(new Zr("redirect-operation-pending"));var i=this,o=u.document,a=null,s=null,c=null,l=null;return this.c=Ze().then((function(){return To(t),$u(i)})).then((function(){return function(e,t,n,r,i){var o=function(){for(var e=20,t=[];0<e;)t.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),e--;return t.join("")}(),a=new So(t,r,null,o,new Zr("no-auth-event"),null,i),s=_r("BuildInfo.packageName",u);if("string"!==typeof s)throw new Zr("invalid-cordova-configuration");var c=_r("BuildInfo.displayName",u),l={};if(br().toLowerCase().match(/iphone|ipad|ipod/))l.ibi=s;else{if(!br().toLowerCase().match(/android/))return et(new Zr("operation-not-supported-in-this-environment"));l.apn=s}c&&(l.appDisplayName=c),o=Xu(o),l.sessionId=o;var h=zs(e.u,e.i,e.l,t,n,null,r,e.m,l,e.o,i);return e.ia().then((function(){var t=e.h;return e.v.a.set(Mu,a.A(),t)})).then((function(){var t=_r("cordova.plugins.browsertab.isAvailable",u);if("function"!==typeof t)throw new Zr("invalid-cordova-configuration");var n=null;t((function(t){if(t){if("function"!==typeof(n=_r("cordova.plugins.browsertab.openUrl",u)))throw new Zr("invalid-cordova-configuration");n(h)}else{if("function"!==typeof(n=_r("cordova.InAppBrowser.open",u)))throw new Zr("invalid-cordova-configuration");t=br(),e.a=n(h,t.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||t.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}}))}))}(i,e,t,n,r)})).then((function(){return new ze((function(e,t){s=function(){var t=_r("cordova.plugins.browsertab.close",u);return e(),"function"===typeof t&&t(),i.a&&"function"===typeof i.a.close&&(i.a.close(),i.a=null),!1},i.ya(s),c=function(){a||(a=fn(2e3).then((function(){t(new Zr("redirect-cancelled-by-user"))})))},l=function(){Pr()&&c()},o.addEventListener("resume",c,!1),br().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",l,!1)})).s((function(e){return Zu(i).then((function(){throw e}))}))})).ka((function(){c&&o.removeEventListener("resume",c,!1),l&&o.removeEventListener("visibilitychange",l,!1),a&&a.cancel(),s&&i.La(s),i.c=null}))},t.ya=function(e){this.b.push(e),$u(this).s((function(t){"auth/invalid-cordova-configuration"===t.code&&(t=new So("unknown",null,null,null,new Zr("no-auth-event")),e(t))}))},t.La=function(e){K(this.b,(function(t){return t==e}))};var tc={name:"pendingRedirect",C:"session"};function nc(e){return Ru(e.b,tc,e.a)}
1function rc(e,t,n){this.i={},this.v=0,this.B=e,this.u=t,this.m=n,this.h=[],this.f=!1,this.l=S(this.o,this),this.b=new gc,this.w=new Ec,this.g=new ec(this.u+":"+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.w,this.c.linkViaPopup=this.w,this.c.reauthViaPopup=this.w,this.a=ic(this.B,this.u,this.m,Ai)}function ic(e,t,n,i){var o=r.a.SDK_VERSION||null;return cr()?new Gu(e,t,n,o,i):new Bs(e,t,n,o,i)}function oc(e){e.f||(e.f=!0,e.a.ya(e.l));var t=e.a;return e.a.ia().s((function(n){throw e.a==t&&e.reset(),n}))}function ac(e){e.a.Ob()&&oc(e).s((function(t){var n=new So("unknown",null,null,null,new Zr("operation-not-supported-in-this-environment"));fc(t)&&e.o(n)})),e.a.Jb()||vc(e.b)}function sc(e,t){W(e.h,t)||e.h.push(t),e.f||function(e){return e.b.get(tc,e.a).then((function(e){return"pending"==e}))}(e.g).then((function(t){t?nc(e.g).then((function(){oc(e).s((function(t){var n=new So("unknown",null,null,null,new Zr("operation-not-supported-in-this-environment"));fc(t)&&e.o(n)}))})):ac(e)})).s((function(){ac(e)}))}function uc(e,t){K(e.h,(function(e){return e==t}))}rc.prototype.reset=function(){this.f=!1,this.a.La(this.l),this.a=ic(this.B,this.u,this.m),this.i={}},rc.prototype.o=function(e){if(!e)throw new Zr("invalid-auth-event");if(6e5<=I()-this.v&&(this.i={},this.v=0),e&&e.getUid()&&this.i.hasOwnProperty(e.getUid()))return!1;for(var t=!1,n=0;n<this.h.length;n++){var r=this.h[n];if(r.xb(e.c,e.b)){(t=this.c[e.c])&&(t.h(e,r),e&&(e.f||e.b)&&(this.i[e.getUid()]=!0,this.v=I())),t=!0;break}}return vc(this.b),t};var cc=new Or(2e3,1e4),lc=new Or(3e4,6e4);function hc(e,t,n,r,i,o,a){return e.a.Db(t,n,r,(function(){e.f||(e.f=!0,e.a.ya(e.l))}),(function(){e.reset()}),i,o,a)}function fc(e){return!(!e||"auth/cordova-not-ready"!=e.code)}function pc(e,t,n,r,i){var o;return function(e){return e.b.set(tc,"pending",e.a)}(e.g).then((function(){return e.a.Eb(t,n,r,i).s((function(t){if(fc(t))throw new Zr("operation-not-supported-in-this-environment");return o=t,nc(e.g).then((function(){throw o}))})).then((function(){return e.a.Rb()?new ze((function(){})):nc(e.g).then((function(){return e.oa()})).then((function(){})).s((function(){}))}))}))}function dc(e,t,n,r,i){return e.a.Fb(r,(function(e){t.ja(n,null,e,i)}),cc.get())}rc.prototype.oa=function(){return this.b.oa()};var mc={};function yc(e,t,n){var r=t+":"+n;
1return mc[r]||(mc[r]=new rc(e,t,n)),mc[r]}function gc(){this.b=null,this.f=[],this.c=[],this.a=null,this.i=this.g=!1}function vc(e){e.g||(e.g=!0,wc(e,!1,null,null))}function bc(e){e.g&&!e.i&&wc(e,!1,null,null)}function _c(e,t){if(e.b=function(){return Ze(t)},e.f.length)for(var n=0;n<e.f.length;n++)e.f[n](t)}function wc(e,t,n,r){t?r?function(e,t){if(e.b=function(){return et(t)},e.c.length)for(var n=0;n<e.c.length;n++)e.c[n](t)}(e,r):_c(e,n):_c(e,{user:null}),e.f=[],e.c=[]}function Ec(){}function Tc(){this.vb=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.vb},set:function(e){this.vb=e},enumerable:!1})}function Sc(e,t){this.a=t,Vr(this,"verificationId",e)}function Cc(e,t,n,r){return new _o(e).Va(t,n).then((function(e){return new Sc(e,r)}))}function Ic(e){var t=Ni(e);if(!(t&&t.exp&&t.auth_time&&t.iat))throw new Zr("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");jr(this,{token:e,expirationTime:xr(1e3*t.exp),authTime:xr(1e3*t.auth_time),issuedAtTime:xr(1e3*t.iat),signInProvider:t.firebase&&t.firebase.sign_in_provider?t.firebase.sign_in_provider:null,claims:t})}function kc(e,t,n){if(this.h=e,this.i=t,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 Nc(e){this.f=e,this.b=this.a=null,this.c=0}function Ac(e,t){var n=t[La],r=t.refreshToken;t=Dc(t.expiresIn),e.b=n,e.c=t,e.a=r}function Dc(e){return I()+1e3*parseInt(e,10)}function Rc(e,t){return function(e,t){return new ze((function(n,r){"refresh_token"==t.grant_type&&t.refresh_token||"authorization_code"==t.grant_type&&t.code?Wa(e,e.l+"?key="+encodeURIComponent(e.c),(function(e){e?e.error?r(Ps(e)):e.access_token&&e.refresh_token?n(e):r(new Zr("internal-error")):r(new Zr("network-request-failed"))}),"POST",Fn(t).toString(),e.g,e.u.get()):r(new Zr("internal-error"))}))}(e.f,t).then((function(t){return e.b=t.access_token,e.c=Dc(t.expires_in),e.a=t.refresh_token,{accessToken:e.b,expirationTime:e.c,refreshToken:e.a}})).s((function(t){throw"auth/user-token-expired"==t.code&&(e.a=null),t}))}function Oc(e,t){this.a=e||null,this.b=t||null,jr(this,{lastSignInTime:xr(t||null),creationTime:xr(e||null)})}function Pc(e,t,n,r,i,o){jr(this,{uid:e,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:t})}function xc(e,t){for(var n in Lt.call(this,e),t)this[n]=t[n]}function Mc(e,t,n){this.I=[],this.l=e.apiKey,this.m=e.appName,this.o=e.authDomain||null,e=r.a.SDK_VERSION?vr(r.a.SDK_VERSION):null,this.a=new xa(this.l,Ri(Ai),e),this.b=new Nc(this.a),Bc(this,t[La]),Ac(this.b,t),Vr(this,"refreshToken",this.b.a),Kc(this,n||{}),sn.call(this),this.J=!1,this.o&&Er()&&(this.i=yc(this.o,this.l,this.m)),this.O=[],this.h=null,this.w=function(e){return new kc((function(){return e.G(!0)}),(function(e){return!(!e||"auth/network-request-failed"!=e.code)}),(function(){var t=e.b.c-I()-3e5;return 0<t?t:0}))}(this),this.W=S(this.Ha,this);var i=this;this.ga=null,this.va=function(e){i.sa(e.g)},this.Z=null,this.P=[],this.ua=function(e){Fc(i,e.c)},this.Y=null}function Lc(e,t){e.Z&&Jt(e.Z,"languageCodeChanged",e.va),(e.Z=t)&&Gt(t,"languageCodeChanged",e.va)}function Fc(e,t){e.P=t,Ba(e.a,r.a.SDK_VERSION?vr(r.a.SDK_VERSION,e.P):null)}function Uc(e,t){e.Y&&Jt(e.Y,"frameworkChanged",e.ua),(e.Y=t)&&Gt(t,"frameworkChanged",e.ua)}function qc(e){try{return r.a.app(e.m).auth()}catch(t){throw new Zr("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+e.m+"'!")}}function Vc(e){e.B||e.w.b||(e.w.start(),Jt(e,"tokenChanged",e.W),Gt(e,"tokenChanged",e.W))}function jc(e){Jt(e,"tokenChanged",e.W),e.w.stop()}function Bc(e,t){e.ma=t,Vr(e,"_lat",t)}function Wc(e){for(var t=[],n=0;n<e.O.length;n++)t.push(e.O[n](e));return nt(t).then((function(){return e}))}function Qc(e){e.i&&!e.J&&(e.J=!0,sc(e.i,e))}function Kc(e,t){jr(e,{uid:t.uid,displayName:t.displayName||null,photoURL:t.photoURL||null,email:t.email||null,emailVerified:t.emailVerified||!1,phoneNumber:t.phoneNumber||null,isAnonymous:t.isAnonymous||!1,tenantId:t.tenantId||null,metadata:new Oc(t.createdAt,t.lastLoginAt),providerData:[]}),e.a.b=e.tenantId}function zc(){}function Hc(e){return Ze().then((function(){if(e.B)throw new Zr("app-deleted")}))}function Gc(e){return j(e.providerData,(function(e){return e.providerId}))}function Yc(e,t){t&&(Xc(e,t.providerId),e.providerData.push(t))}function Xc(e,t){K(e.providerData,(function(e){return e.providerId==t}))}
1function Jc(e,t,n){("uid"!=t||n)&&e.hasOwnProperty(t)&&Vr(e,t,n)}function $c(e,t){e!=t&&(jr(e,{uid:t.uid,displayName:t.displayName,photoURL:t.photoURL,email:t.email,emailVerified:t.emailVerified,phoneNumber:t.phoneNumber,isAnonymous:t.isAnonymous,tenantId:t.tenantId,providerData:[]}),t.metadata?Vr(e,"metadata",function(e){return new Oc(e.a,e.b)}(t.metadata)):Vr(e,"metadata",new Oc),V(t.providerData,(function(t){Yc(e,t)})),function(e,t){e.b=t.b,e.a=t.a,e.c=t.c}(e.b,t.b),Vr(e,"refreshToken",e.b.a))}function Zc(e){return e.G().then((function(t){var n=e.isAnonymous;return function(e,t){return Rs(e.a,fs,{idToken:t}).then(S(e.zc,e))}(e,t).then((function(){return n||Jc(e,"isAnonymous",!1),t}))}))}function el(e,t){t[La]&&e.ma!=t[La]&&(Ac(e.b,t),e.dispatchEvent(new xc("tokenChanged")),Bc(e,t[La]),Jc(e,"refreshToken",e.b.a))}function tl(e,t){return Zc(e).then((function(){if(W(Gc(e),t))return Wc(e).then((function(){throw new Zr("provider-already-linked")}))}))}function nl(e,t,n){return Br({user:e,credential:Eo(t),additionalUserInfo:t=Li(t),operationType:n})}function rl(e,t){return el(e,t),e.reload().then((function(){return e}))}function il(e,t,n,i,o){if(!Er())return et(new Zr("operation-not-supported-in-this-environment"));if(e.h&&!o)return et(e.h);var a=Mi(n.providerId),s=Ar(e.uid+":::"),u=null;(!Cr()||lr())&&e.o&&n.isOAuthProvider&&(u=zs(e.o,e.l,e.m,t,n,null,s,r.a.SDK_VERSION||null,null,null,e.tenantId));var c=or(u,a&&a.Da,a&&a.Ca);return i=i().then((function(){if(al(e),!o)return e.G().then((function(){}))})).then((function(){return hc(e.i,c,t,n,s,!!u,e.tenantId)})).then((function(){return new ze((function(n,r){e.ja(t,null,new Zr("cancelled-popup-request"),e.g||null),e.f=n,e.v=r,e.g=s,e.c=dc(e.i,e,t,c,s)}))})).then((function(e){return c&&ir(c),e?Br(e):null})).s((function(e){throw c&&ir(c),e})),sl(e,i,o)}function ol(e,t,n,r,i){if(!Er())return et(new Zr("operation-not-supported-in-this-environment"));if(e.h&&!i)return et(e.h);var o=null,a=Ar(e.uid+":::");return r=r().then((function(){if(al(e),!i)return e.G().then((function(){}))})).then((function(){return e.ca=a,Wc(e)})).then((function(t){return e.da&&(t=(t=e.da).b.set(ll,e.A(),t.a)),t})).then((function(){return pc(e.i,t,n,a,e.tenantId)})).s((function(t){if(o=t,e.da)return hl(e.da);throw o})).then((function(){if(o)throw o})),sl(e,r,i)}function al(e){if(!e.i||!e.J){if(e.i&&!e.J)throw new Zr("internal-error");throw new Zr("auth-domain-config-required")}}function sl(e,t,n){var r=function(e,t,n){return e.h&&!n?(t.cancel(),et(e.h)):t.s((function(t){throw!t||"auth/user-disabled"!=t.code&&"auth/user-token-expired"!=t.code||(e.h||e.dispatchEvent(new xc("userInvalidated")),e.h=t),t}))}(e,t,n);return e.I.push(r),r.ka((function(){Q(e.I,r)})),r}function ul(e){if(!e.apiKey)return null;var t={apiKey:e.apiKey,authDomain:e.authDomain,appName:e.appName},n={};if(!(e.stsTokenManager&&e.stsTokenManager.accessToken&&e.stsTokenManager.expirationTime))return null;n[La]=e.stsTokenManager.accessToken,n.refreshToken=e.stsTokenManager.refreshToken||null,n.expiresIn=(e.stsTokenManager.expirationTime-I())/1e3;var r=new Mc(t,n,e);return e.providerData&&V(e.providerData,(function(e){e&&Yc(r,Br(e))})),e.redirectEventId&&(r.ca=e.redirectEventId),r}function cl(e){this.a=e,this.b=Nu()}gc.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},gc.prototype.h=function(e,t){if(e){this.reset(),this.g=!0;var n=e.c,r=e.b,i=e.a&&"auth/web-storage-unsupported"==e.a.code,o=e.a&&"auth/operation-not-supported-in-this-environment"==e.a.code;this.i=!(!i&&!o),"unknown"!=n||i||o?e.a?(wc(this,!0,null,e.a),Ze()):t.za(n,r)?function(e,t,n){n=n.za(t.c,t.b);var r=t.g,i=t.f,o=t.i,a=t.R(),s=!!t.c.match(/Redirect$/);n(r,i,a,o).then((function(t){wc(e,s,t,null)})).s((function(t){wc(e,s,null,t)}))}(this,e,t):et(new Zr("invalid-auth-event")):(wc(this,!1,null,null),Ze())}else et(new Zr("invalid-auth-event"))},gc.prototype.oa=function(){var e=this;return new ze((function(t,n){e.b?e.b().then(t,n):(e.f.push(t),e.c.push(n),function(e){var t=new Zr("timeout");e.a&&e.a.cancel(),e.a=fn(lc.get()).then((function(){e.b||(e.g=!0,wc(e,!0,null,t))}))}(e))}))},Ec.prototype.h=function(e,t){if(e){var n=e.c,r=e.b;e.a?(t.ja(e.c,null,e.a,e.b),Ze()):t.za(n,r)?function(e,t){var n=e.b,r=e.c;t.za(r,n)(e.g,e.f,e.R(),e.i).then((function(e){t.ja(r,e,null,n)})).s((function(e){t.ja(r,null,e,n)}
1))}(e,t):et(new Zr("invalid-auth-event"))}else et(new Zr("invalid-auth-event"))},Sc.prototype.confirm=function(e){return e=wo(this.verificationId,e),this.a(e)},kc.prototype.start=function(){this.a=this.c,function e(t,n){t.stop();t.b=fn(function(e,t){return t?(e.a=e.c,e.g()):(t=e.a,e.a*=2,e.a>e.f&&(e.a=e.f),t)}(t,n)).then((function(){return function(){var e=u.document,t=null;return Pr()||!e?Ze():new ze((function(n){t=function(){Pr()&&(e.removeEventListener("visibilitychange",t,!1),n())},e.addEventListener("visibilitychange",t,!1)})).s((function(n){throw e.removeEventListener("visibilitychange",t,!1),n}))}()})).then((function(){return t.h()})).then((function(){e(t,!0)})).s((function(n){t.i(n)&&e(t,!1)}))}(this,!0)},kc.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},Nc.prototype.A=function(){return{apiKey:this.f.c,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}},Nc.prototype.getToken=function(e){return e=!!e,this.b&&!this.a?et(new Zr("user-token-expired")):e||!this.b||I()>this.c-3e4?this.a?Rc(this,{grant_type:"refresh_token",refresh_token:this.a}):Ze(null):Ze({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},Oc.prototype.A=function(){return{lastLoginAt:this.b,createdAt:this.a}},k(xc,Lt),k(Mc,sn),Mc.prototype.sa=function(e){this.ga=e,ja(this.a,e)},Mc.prototype.ha=function(){return this.ga},Mc.prototype.Aa=function(){return H(this.P)},Mc.prototype.Ha=function(){this.w.b&&(this.w.stop(),this.w.start())},Vr(Mc.prototype,"providerId","firebase"),(t=Mc.prototype).reload=function(){var e=this;return sl(this,Hc(this).then((function(){return Zc(e).then((function(){return Wc(e)})).then(zc)})))},t.dc=function(e){return this.G(e).then((function(e){return new Ic(e)}))},t.G=function(e){var t=this;return sl(this,Hc(this).then((function(){return t.b.getToken(e)})).then((function(e){if(!e)throw new Zr("internal-error");return e.accessToken!=t.ma&&(Bc(t,e.accessToken),t.dispatchEvent(new xc("tokenChanged"))),Jc(t,"refreshToken",e.refreshToken),e.accessToken})))},t.zc=function(e){if(!(e=e.users)||!e.length)throw new Zr("internal-error");Kc(this,{uid:(e=e[0]).localId,displayName:e.displayName,photoURL:e.photoUrl,email:e.email,emailVerified:!!e.emailVerified,phoneNumber:e.phoneNumber,lastLoginAt:e.lastLoginAt,createdAt:e.createdAt,tenantId:e.tenantId});for(var t=function(e){return(e=e.providerUserInfo)&&e.length?j(e,(function(e){return new Pc(e.rawId,e.providerId,e.email,e.displayName,e.photoUrl,e.phoneNumber)})):[]}(e),n=0;n<t.length;n++)Yc(this,t[n]);Jc(this,"isAnonymous",!(this.email&&e.passwordHash)&&!(this.providerData&&this.providerData.length))},t.Ac=function(e){return Ur("firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateWithCredential instead."),this.gb(e)},t.gb=function(e){var t=this,n=null;return sl(this,e.f(this.a,this.uid).then((function(e){return el(t,e),n=nl(t,e,"reauthenticate"),t.h=null,t.reload()})).then((function(){return n})),!0)},t.rc=function(e){return Ur("firebase.User.prototype.linkAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.linkWithCredential instead."),this.eb(e)},t.eb=function(e){var t=this,n=null;return sl(this,tl(this,e.providerId).then((function(){return t.G()})).then((function(n){return e.b(t.a,n)})).then((function(e){return n=nl(t,e,"link"),rl(t,e)})).then((function(){return n})))},t.sc=function(e,t){var n=this;return sl(this,tl(this,"phone").then((function(){return Cc(qc(n),e,t,S(n.eb,n))})))},t.Bc=function(e,t){var n=this;return sl(this,Ze().then((function(){return Cc(qc(n),e,t,S(n.gb,n))})),!0)},t.rb=function(e){var t=this;return sl(this,this.G().then((function(n){return t.a.rb(n,e)})).then((function(e){return el(t,e),t.reload()})))},t.Sc=function(e){var t=this;return sl(this,this.G().then((function(n){return e.b(t.a,n)})).then((function(e){return el(t,e),t.reload()})))},t.sb=function(e){var t=this;return sl(this,this.G().then((function(n){return t.a.sb(n,e)})).then((function(e){return el(t,e),t.reload()})))},t.tb=function(e){if(void 0===e.displayName&&void 0===e.photoURL)return Hc(this);var t=this;return sl(this,this.G().then((function(n){return t.a.tb(n,{displayName:e.displayName,photoUrl:e.photoURL})}
1)).then((function(e){return el(t,e),Jc(t,"displayName",e.displayName||null),Jc(t,"photoURL",e.photoUrl||null),V(t.providerData,(function(e){"password"===e.providerId&&(Vr(e,"displayName",t.displayName),Vr(e,"photoURL",t.photoURL))})),Wc(t)})).then(zc))},t.Qc=function(e){var t=this;return sl(this,Zc(this).then((function(n){return W(Gc(t),e)?function(e,t,n){return Rs(e,cs,{idToken:t,deleteProvider:n})}(t.a,n,[e]).then((function(e){var n={};return V(e.providerUserInfo||[],(function(e){n[e.providerId]=!0})),V(Gc(t),(function(e){n[e]||Xc(t,e)})),n[_o.PROVIDER_ID]||Vr(t,"phoneNumber",null),Wc(t)})):Wc(t).then((function(){throw new Zr("no-such-provider")}))})))},t.delete=function(){var e=this;return sl(this,this.G().then((function(t){return Rs(e.a,us,{idToken:t})})).then((function(){e.dispatchEvent(new xc("userDeleted"))}))).then((function(){for(var t=0;t<e.I.length;t++)e.I[t].cancel("app-deleted");Lc(e,null),Uc(e,null),e.I=[],e.B=!0,jc(e),Vr(e,"refreshToken",null),e.i&&uc(e.i,e)}))},t.xb=function(e,t){return!!("linkViaPopup"==e&&(this.g||null)==t&&this.f||"reauthViaPopup"==e&&(this.g||null)==t&&this.f||"linkViaRedirect"==e&&(this.ca||null)==t||"reauthViaRedirect"==e&&(this.ca||null)==t)},t.ja=function(e,t,n,r){"linkViaPopup"!=e&&"reauthViaPopup"!=e||r!=(this.g||null)||(n&&this.v?this.v(n):t&&!n&&this.f&&this.f(t),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.v)},t.za=function(e,t){return"linkViaPopup"==e&&t==(this.g||null)?S(this.Bb,this):"reauthViaPopup"==e&&t==(this.g||null)?S(this.Cb,this):"linkViaRedirect"==e&&(this.ca||null)==t?S(this.Bb,this):"reauthViaRedirect"==e&&(this.ca||null)==t?S(this.Cb,this):null},t.tc=function(e){var t=this;return il(this,"linkViaPopup",e,(function(){return tl(t,e.providerId).then((function(){return Wc(t)}))}),!1)},t.Cc=function(e){return il(this,"reauthViaPopup",e,(function(){return Ze()}),!0)},t.uc=function(e){var t=this;return ol(this,"linkViaRedirect",e,(function(){return tl(t,e.providerId)}),!1)},t.Dc=function(e){return ol(this,"reauthViaRedirect",e,(function(){return Ze()}),!0)},t.Bb=function(e,t,n,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return sl(this,this.G().then((function(n){return ts(i.a,{requestUri:e,postBody:r,sessionId:t,idToken:n})})).then((function(e){return o=nl(i,e,"link"),rl(i,e)})).then((function(){return o})))},t.Cb=function(e,t,n,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return sl(this,Ze().then((function(){return Hi(ns(i.a,{requestUri:e,sessionId:t,postBody:r,tenantId:n}),i.uid)})).then((function(e){return o=nl(i,e,"reauthenticate"),el(i,e),i.h=null,i.reload()})).then((function(){return o})),!0)},t.jb=function(e){var t=this,n=null;return sl(this,this.G().then((function(t){return n=t,"undefined"===typeof e||Y(e)?{}:Ei(new fi(e))})).then((function(e){return t.a.jb(n,e)})).then((function(e){if(t.email!=e)return t.reload()})).then((function(){})))},t.toJSON=function(){return this.A()},t.A=function(){var e={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,tenantId:this.tenantId,providerData:[],apiKey:this.l,appName:this.m,authDomain:this.o,stsTokenManager:this.b.A(),redirectEventId:this.ca||null};return this.metadata&&$(e,this.metadata.A()),V(this.providerData,(function(t){e.providerData.push(function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}(t))})),e};var ll={name:"redirectUser",C:"session"};function hl(e){return Ru(e.b,ll,e.a)}function fl(e){this.a=e,this.b=Nu(),this.c=null,this.f=function(e){var t=ml("local"),n=ml("session"),r=ml("none");return function(e,t,n){var r=Du(t,n),i=Au(e,t.C);return e.get(t,n).then((function(o){var a=null;try{a=Nr(u.localStorage.getItem(r))}catch(s){}if(a&&!o)return u.localStorage.removeItem(r),e.set(t,a,n);a&&o&&"localStorage"!=i.type&&u.localStorage.removeItem(r)}))}(e.b,t,e.a).then((function(){return e.b.get(n,e.a)})).then((function(i){return i?n:e.b.get(r,e.a).then((function(n){return n?r:e.b.get(t,e.a).then((function(n){return n?t:e.b.get(dl,e.a).then((function(e){return e?ml(e):t}))}))}))})).then((function(t){return e.c=t,pl(e,t.C)})).s((function(){e.c||(e.c=t)}))}(this),this.b.addListener(ml("local"),this.a,S(this.g,this))}function pl(e,t){var n,r=[];for(n in Iu)Iu[n]!==t&&r.push(Ru(e.b,ml(Iu[n]),e.a));return r.push(Ru(e.b,dl,e.a)),function(e){return new ze((function(t,n){var r=e.length,i=[];if(r)for(var o=function(e,n){r--,i[e]=n,0==r&&t(i)},a=function(e){n(e)},s=0;s<e.length;s++)tt(e[s],C(o,s),a);else t(i)}))}(r)}fl.prototype.g=function(){var e=this,t=ml("local");bl(this,(function(){return Ze().then((function(){return e.c&&"local"!=e.c.C?e.b.get(t,e.a):null})).then((function(n){if(n)return pl(e,"local").then((function(){e.c=t}))}))}))};var dl={name:"persistence",C:"session"};function ml(e){return{name:"authUser",C:e}}function yl(e,t){return bl(e,(function(){return e.b.set(e.c,t.A(),e.a)}))}function gl(e){return bl(e,(function(){return Ru(e.b,e.c,e.a)}))}function vl(e,t){return bl(e,(function(){return e.b.get(e.c,e.a).then((function(e){return e&&t&&(e.authDomain=t),ul(e||{})}))}))}function bl(e,t){return e.f=e.f.then(t,t),e.f}function _l(e){if(this.l=!1,Vr(this,"settings",new Tc),Vr(this,"app",e),!Nl(this).options||!Nl(this).options.apiKey)throw new Zr("invalid-api-key");e=r.a.SDK_VERSION?vr(r.a.SDK_VERSION):null,this.b=new xa(Nl(this).options&&Nl(this).options.apiKey,Ri(Ai),e),this.O=[],this.m=[],this.J=[],this.Ub=r.a.INTERNAL.createSubscribe(S(this.oc,this)),this.W=void 0,this.Vb=r.a.INTERNAL.createSubscribe(S(this.pc,this)),Il(this,null),this.h=new fl(Nl(this).options.apiKey+":"+Nl(this).name),this.w=new cl(Nl(this).options.apiKey+":"+Nl(this).name),this.Y=Ol(this,function(e){var t=Nl(e).options.authDomain,n=function(e){var t=function(e,t){return e.b.get(ll,e.a).then((function(e){return e&&t&&(e.authDomain=t),ul(e||{})}))}(e.w,Nl(e).options.authDomain).then((function(t){return(e.B=t)&&(t.da=e.w
1),hl(e.w)}));return Ol(e,t)}(e).then((function(){return vl(e.h,t)})).then((function(t){return t?(t.da=e.w,e.B&&(e.B.ca||null)==(t.ca||null)?t:t.reload().then((function(){return yl(e.h,t).then((function(){return t}))})).s((function(n){return"auth/network-request-failed"==n.code?t:gl(e.h)}))):null})).then((function(t){Il(e,t||null)}));return Ol(e,n)}(this)),this.i=Ol(this,function(e){return e.Y.then((function(){return Sl(e)})).s((function(){})).then((function(){if(!e.l)return e.ma()})).s((function(){})).then((function(){if(!e.l){e.ga=!0;var t=e.h;t.b.addListener(ml("local"),t.a,e.ma)}}))}(this)),this.ga=!1,this.ma=S(this.Nc,this),this.ub=S(this.aa,this),this.ua=S(this.bc,this),this.va=S(this.mc,this),this.Ha=S(this.nc,this),this.a=null,function(e){var t=Nl(e).options.authDomain,n=Nl(e).options.apiKey;t&&Er()&&(e.Tb=e.Y.then((function(){if(!e.l){if(e.a=yc(t,n,Nl(e).name),sc(e.a,e),Al(e)&&Qc(Al(e)),e.B){Qc(e.B);var r=e.B;r.sa(e.ha()),Lc(r,e),Fc(r=e.B,e.I),Uc(r,e),e.B=null}return e.a}})))}(this),this.INTERNAL={},this.INTERNAL.delete=S(this.delete,this),this.INTERNAL.logFramework=S(this.vc,this),this.o=0,sn.call(this),function(e){Object.defineProperty(e,"lc",{get:function(){return this.ha()},set:function(e){this.sa(e)},enumerable:!1}),e.Z=null,Object.defineProperty(e,"ti",{get:function(){return this.R()},set:function(e){this.nb(e)},enumerable:!1}),e.P=null}(this),this.I=[]}function wl(e){Lt.call(this,"languageCodeChanged"),this.g=e}function El(e){Lt.call(this,"frameworkChanged"),this.c=e}function Tl(e){return e.Tb||et(new Zr("auth-domain-config-required"))}function Sl(e){if(!Er())return et(new Zr("operation-not-supported-in-this-environment"));var t=Tl(e).then((function(){return e.a.oa()})).then((function(e){return e?Br(e):null}));return Ol(e,t)}function Cl(e,t){var n={};return n.apiKey=Nl(e).options.apiKey,n.authDomain=Nl(e).options.authDomain,n.appName=Nl(e).name,e.Y.then((function(){return function(e,t,n,r){var i=new Mc(e,t);return n&&(i.da=n),r&&Fc(i,r),i.reload().then((function(){return i}))}(n,t,e.w,e.Aa())})).then((function(t){return Al(e)&&t.uid==Al(e).uid?($c(Al(e),t),e.aa(t)):(Il(e,t),Qc(t),e.aa(t))})).then((function(){Rl(e)}))}function Il(e,t){Al(e)&&(function(e,t){K(e.O,(function(e){return e==t}))}(Al(e),e.ub),Jt(Al(e),"tokenChanged",e.ua),Jt(Al(e),"userDeleted",e.va),Jt(Al(e),"userInvalidated",e.Ha),jc(Al(e))),t&&(t.O.push(e.ub),Gt(t,"tokenChanged",e.ua),Gt(t,"userDeleted",e.va),Gt(t,"userInvalidated",e.Ha),0<e.o&&Vc(t)),Vr(e,"currentUser",t),t&&(t.sa(e.ha()),Lc(t,e),Fc(t,e.I),Uc(t,e))}function kl(e,t){var n=null,r=null;return Ol(e,t.then((function(t){return n=Eo(t),r=Li(t),Cl(e,t)})).then((function(){return Br({user:Al(e),credential:n,additionalUserInfo:r,operationType:"signIn"})})))}function Nl(e){return e.app}function Al(e){return e.currentUser}function Dl(e){return Al(e)&&Al(e)._lat||null}function Rl(e){if(e.ga){for(var t=0;t<e.m.length;t++)e.m[t]&&e.m[t](Dl(e));if(e.W!==e.getUid()&&e.J.length)for(e.W=e.getUid(),t=0;t<e.J.length;t++)e.J[t]&&e.J[t](Dl(e))}}function Ol(e,t){return e.O.push(t),t.ka((function(){Q(e.O,t)})),t}function Pl(){}function xl(){this.a={},this.b=1e12}fl.prototype.mb=function(e){var t=null,n=this;return function(e){var t=new Zr("invalid-persistence-type"),n=new Zr("unsupported-persistence-type");e:{for(r in Iu)if(Iu[r]==e){var r=!0;break e}r=!1}if(!r||"string"!==typeof e)throw t;switch(fr()){case"ReactNative":if("session"===e)throw n;break;case"Node":if("none"!==e)throw n;break;default:if(!wr()&&"none"!==e)throw n}}(e),bl(this,(function(){return e!=n.c.C?n.b.get(n.c,n.a).then((function(r){return t=r,pl(n,e)})).then((function(){if(n.c=ml(e),t)return n.b.set(n.c,t,n.a)})):Ze()}))},k(_l,sn),k(wl,Lt),k(El,Lt),(t=_l.prototype).mb=function(e){return Ol(this,e=this.h.mb(e))},t.sa=function(e){this.Z===e||this.l||(this.Z=e,ja(this.b,this.Z),this.dispatchEvent(new wl(this.ha())))},t.ha=function(){return this.Z},t.Tc=function(){var e=u.navigator;this.sa(e&&(e.languages&&e.languages[0]||e.language||e.userLanguage)||null)},t.vc=function(e){this.I.push(e),Ba(this.b,r.a.SDK_VERSION?vr(r.a.SDK_VERSION,this.I):null),this.dispatchEvent(new El(this.I))},t.Aa=function(){return H(this.I)},t.nb=function(e){this.P===e||this.l||(this.P=e,this.b.b=this.P)},t.R=function(){return this.P},t.toJSON=function(){return{apiKey:Nl(this).options.apiKey,authDomain:Nl(this).options.authDomain,appName:Nl(this).name,currentUser:Al(this)&&Al(this).A()}},t.xb=function(e,t){switch(e){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==t&&!!this.f;default:return!1}},t.ja=function(e,t,n,r){"signInViaPopup"==e&&this.g==r&&(n&&this.v?this.v(n):t&&!n&&this.f&&this.f(t),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.v)},t.za=function(e,t){return"signInViaRedirect"==e||"signInViaPopup"==e&&this.g==t&&this.f?S(this.ac,this):null},t.ac=function(e,t,n,r){var i=this;e={requestUri:e,postBody:r,sessionId:t,tenantId:n},this.c&&(this.c.cancel(),this.c=null);var o=null,a=null,s=es(i.b,e).then((function(e){return o=Eo(e),a=Li(e),e}));return Ol(this,e=i.Y.then((function(){return s})).then((function(e){return Cl(i,e)})).then((function(){return Br({user:Al(i),credential:o,additionalUserInfo:a,operationType:"signIn"})})))},t.Lc=function(e){if(!Er())return et(new Zr("operation-not-supported-in-this-environment"));var t=this,n=Mi(e.providerId),i=Ar(),o=null;(!Cr()||lr())&&Nl(this).options.authDomain&&e.isOAuthProvider&&(o=zs(Nl(this).options.authDomain,Nl(this).options.apiKey,Nl(this).name,"signInViaPopup",e,null,i,r.a.SDK_VERSION||null,null,null,this.R()));var a=or(o,n&&n.Da,n&&n.Ca);return Ol(this,n=Tl(this).then((function(n){return hc(n,a,"signInViaPopup",e,i,!!o,t.R())})).then((function(){return new ze((function(e,n){t.ja("signInViaPopup",null,new Zr("cancelled-popup-request"),t.g),t.f=e,t.v=n,t.g=i,t.c=dc(t.a,t,"signInViaPopup",a,i)}))})).then((function(e){return a&&ir(a),e?Br(e):null})).s((function(e){throw a&&ir(a),e})))},t.Mc=function(e){if(!Er())return et(new Zr("operation-not-supported-in-this-environment"));var t=this;return Ol(this,Tl(this).then((function(){return function(e){return bl(e,(function(){return e.b.set(dl,e.c.C,e.a)}))}(t.h)})).then((function(){return pc(t.a,"signInViaRedirect",e,void 0,t.R())})))},t.oa=function(){var e=this;return Sl(this).then((function(t){return e.a&&bc(e.a.b),t})).s((function(t){throw e.a&&bc(e.a.b),t}))},t.Rc=function(e){if(!e)return et(new Zr("null-user"));if(this.P!=e.tenantId)return et(new Zr("tenant-id-mismatch"));var t=this,n={};n.apiKey=Nl(this).options.apiKey,n.authDomain=Nl(this).options.authDomain,n.appName=Nl(this).name;var r=function(e,t,n,r){t=t||{apiKey:e.l,authDomain:e.o,appName:e.m};var i=e.b,o={};return o[La]=i.b,o.refreshToken=i.a,o.expiresIn=(i.c-I())/1e3,t=new Mc(t,o),n&&(t.da=n),r&&Fc(t,r),$c(t,e),t}(e,n,t.w,t.Aa());return Ol(this,this.i.then((function(){if(Nl(t).options.apiKey!=e.l)return r.reload()})).then((function(){return Al(t)&&e.uid==Al(t).uid?($c(Al(t),e),t.aa(e)):(Il(t,r),Qc(r),t.aa(r))})).then((function(){Rl(t)})))},t.pb=function(){var e=this;return Ol(this,this.i.then((function(){return e.a&&bc(e.a.b),Al(e)?(Il(e,null),gl(e.h).then((function(){Rl(e)}))):Ze()})))},t.Nc=function(){var e=this;return vl(this.h,Nl(this).options.authDomain).then((function(t){if(!e.l){var n;if(n=Al(e)&&t){n=Al(e).uid;var r=t.uid;n=void 0!==n&&null!==n&&""!==n&&void 0!==r&&null!==r&&""!==r&&n==r}if(n)return $c(Al(e),t),Al(e).G();(Al(e)||t)&&(Il(e,t),t&&(Qc(t),t.da=e.w),e.a&&sc(e.a,e),Rl(e))}}))},t.aa=function(e){return yl(this.h,e)},t.bc=function(){Rl(this),this.aa(Al(this))},t.mc=function(){this.pb()},t.nc=function(){this.pb()},t.oc=function(e){var t=this;this.addAuthTokenListener((function(){e.next(Al(t))}))},t.pc=function(e){var t=this;!function(e,t){e.J.push(t),Ol(e,e.i.then((function(){!e.l&&W(e.J,t)&&e.W!==e.getUid()&&(e.W=e.getUid(),t(Dl(e)))})))}(this,(function(){e.next(Al(t))}))},t.xc=function(e,t,n){var r=this;return this.ga&&Promise.resolve().then((function(){v(e)?e(Al(r)):v(e.next)&&e.next(Al(r))})),this.Ub(e,t,n)},t.wc=function(e,t,n){var r=this;return this.ga&&Promise.resolve().then((function(){r.W=r.getUid(),v(e)?e(Al(r)):v(e.next)&&e.next(Al(r))})),this.Vb(e,t,n)},t.cc=function(e){var t=this;return Ol(this,this.i.then((function(){return Al(t)?Al(t).G(e).then((function(e){return{accessToken:e}})):null})))},t.Hc=function(e){var t=this;return this.i.then((function(){return kl(t,Rs(t.b,Is,{token:e}))})).then((function(e){var n=e.user;return Jc(n,"isAnonymous",!1),t.aa(n),e}))},t.Ic=function(e,t){var n=this;return this.i.then((function(){return kl(n,Rs(n.b,ks,{email:e,password:t}))}))},t.Xb=function(e,t){var n=this;return this.i.then((function(){return kl(n,Rs(n.b,as,{email:e,password:t}))}))},t.Ra=function(e){var t=this;return this.i.then((function(){return kl(t,e.na(t.b))}))},t.Gc=function(e){return Ur("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInWithCredential instead."),this.Ra(e)},t.ob=function(){var e=this;return this.i.then((function(){var t=Al(e);
1if(t&&t.isAnonymous){var n=Br({providerId:null,isNewUser:!1});return Br({user:t,credential:null,additionalUserInfo:n,operationType:"signIn"})}return kl(e,e.b.ob()).then((function(t){var n=t.user;return Jc(n,"isAnonymous",!0),e.aa(n),t}))}))},t.getUid=function(){return Al(this)&&Al(this).uid||null},t.Wb=function(e){this.addAuthTokenListener(e),this.o++,0<this.o&&Al(this)&&Vc(Al(this))},t.Ec=function(e){var t=this;V(this.m,(function(n){n==e&&t.o--})),0>this.o&&(this.o=0),0==this.o&&Al(this)&&jc(Al(this)),this.removeAuthTokenListener(e)},t.addAuthTokenListener=function(e){var t=this;this.m.push(e),Ol(this,this.i.then((function(){t.l||W(t.m,e)&&e(Dl(t))})))},t.removeAuthTokenListener=function(e){K(this.m,(function(t){return t==e}))},t.delete=function(){this.l=!0;for(var e=0;e<this.O.length;e++)this.O[e].cancel("app-deleted");return this.O=[],this.h&&(e=this.h).b.removeListener(ml("local"),e.a,this.ma),this.a&&(uc(this.a,this),bc(this.a.b)),Promise.resolve()},t.$b=function(e){return Ol(this,function(e,t){return Rs(e,ss,{identifier:t,continueUri:Tr()?tr():"http://localhost"}).then((function(e){return e.signinMethods||[]}))}(this.b,e))},t.qc=function(e){return!!yo(e)},t.lb=function(e,t){var n=this;return Ol(this,Ze().then((function(){var e=new fi(t);if(!e.c)throw new Zr("argument-error",mi+" must be true when sending sign in link to email");return Ei(e)})).then((function(t){return n.b.lb(e,t)})).then((function(){})))},t.Uc=function(e){return this.Ka(e).then((function(e){return e.data.email}))},t.$a=function(e,t){return Ol(this,this.b.$a(e,t).then((function(){})))},t.Ka=function(e){return Ol(this,this.b.Ka(e).then((function(e){return new Qr(e)})))},t.Xa=function(e){return Ol(this,this.b.Xa(e).then((function(){})))},t.kb=function(e,t){var n=this;return Ol(this,Ze().then((function(){return"undefined"===typeof t||Y(t)?{}:Ei(new fi(t))})).then((function(t){return n.b.kb(e,t)})).then((function(){})))},t.Kc=function(e,t){return Ol(this,Cc(this,e,t,S(this.Ra,this)))},t.Jc=function(e,t){var n=this;return Ol(this,Ze().then((function(){var r=t||tr(),i=mo(e,r);if(!(r=yo(r)))throw new Zr("argument-error","Invalid email link!");if(r.tenantId!==n.R())throw new Zr("tenant-id-mismatch");return n.Ra(i)})))},Pl.prototype.render=function(){},Pl.prototype.reset=function(){},Pl.prototype.getResponse=function(){},Pl.prototype.execute=function(){};var Ml=null;function Ll(e,t){return(t=Fl(t))&&e.a[t]||null}function Fl(e){return(e="undefined"===typeof e?1e12:e)?e.toString():null}function Ul(e,t){this.g=!1,this.c=t,this.a=this.b=null,this.h="invisible"!==this.c.size,this.f=Qn(e);var n=this;this.i=function(){n.execute()},this.h?this.execute():Gt(this.f,"click",this.i)}function ql(e){if(e.g)throw Error("reCAPTCHA mock was already deleted!")}function Vl(){}xl.prototype.render=function(e,t){return this.a[this.b.toString()]=new Ul(e,t),this.b++},xl.prototype.reset=function(e){var t=Ll(this,e);e=Fl(e),t&&e&&(t.delete(),delete this.a[e])},xl.prototype.getResponse=function(e){return(e=Ll(this,e))?e.getResponse():null},xl.prototype.execute=function(e){(e=Ll(this,e))&&e.execute()},Ul.prototype.getResponse=function(){return ql(this),this.b},Ul.prototype.execute=function(){ql(this);var e=this;this.a||(this.a=setTimeout((function(){e.b=function(){for(var e=50,t=[];0<e;)t.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),e--;return t.join("")}();var t=e.c.callback,n=e.c["expired-callback"];if(t)try{t(e.b)}catch(r){}e.a=setTimeout((function(){if(e.a=null,e.b=null,n)try{n()}catch(r){}e.h&&e.execute()}),6e4)}),500))},Ul.prototype.delete=function(){ql(this),this.g=!0,clearTimeout(this.a),this.a=null,Jt(this.f,"click",this.i)},Vl.prototype.g=function(){return Ml||(Ml=new xl),Ze(Ml)},Vl.prototype.c=function(){};var jl=null;function Bl(){this.b=u.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var Wl=new Z(ne,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),Ql=new Or(3e4,6e4);Bl.prototype.g=function(e){var t=this;return new ze((function(n,r){var i=setTimeout((function(){r(new Zr("network-request-failed"))}),Ql.get());!u.grecaptcha||e!==t.f&&!t.b?(u[t.a]=function(){if(u.grecaptcha){t.f=e;var o=u.grecaptcha.render;u.grecaptcha.render=function(e,n){return e=o(e,n),t.b++,e},clearTimeout(i),n(u.grecaptcha)}else clearTimeout(i),r(new Zr("internal-error"));delete u[t.a]},Ze(ka(ae(Wl,{onload:t.a,hl:e||""}))).s((function(){clearTimeout(i),r(new Zr("internal-error","Unable to load external reCAPTCHA dependencies!"))}))):(clearTimeout(i),n(u.grecaptcha))}))},Bl.prototype.c=function(){this.b--};var Kl=null;function zl(e,t,n,r,i,o,a){if(Vr(this,"type","recaptcha"),this.c=this.f=null,this.B=!1,this.u=t,this.g=null,a?(jl||(jl=new Vl),a=jl):(Kl||(Kl=new Bl),a=Kl),this.m=a,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[Yl])throw new Zr("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[Xl],!u.document)throw new Zr("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!Qn(t)||!this.i&&Qn(t).hasChildNodes())throw new Zr("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.o=new xa(e,o||null,i||null),this.v=r||function(){return null};var s=this;this.l=[];var c=this.a[Hl];this.a[Hl]=function(e){if(Jl(s,e),"function"===typeof c)c(e);else if("string"===typeof c){var t=_r(c,u);"function"===typeof t&&t(e)}};var l=this.a[Gl];this.a[Gl]=function(){if(Jl(s,null),"function"===typeof l)l();else if("string"===typeof l){var e=_r(l,u);"function"===typeof e&&e()}}}var Hl="callback",Gl="expired-callback",Yl="sitekey",Xl="size";function Jl(e,t){for(var n=0;n<e.l.length;n++)try{e.l[n](t)}catch(r){}}function $l(e,t){return e.h.push(t),t.ka((function(){Q(e.h,t)})),t}function Zl(e){if(e.B)throw new Zr("internal-error","RecaptchaVerifier instance has been destroyed.")}function eh(e,t,n){var i=!1;try{this.b=n||r.a.app()}catch(s){throw new Zr("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new Zr("invalid-api-key");n=this.b.options.apiKey;var o=this,a=null;try{a=this.b.auth().Aa()}catch(s){}try{i=this.b.auth().settings.appVerificationDisabledForTesting}catch(s){}a=r.a.SDK_VERSION?vr(r.a.SDK_VERSION,a):null,zl.call(this,n,e,t,(function(){try{var e=o.b.auth().ha()}catch(t){e=null}return e}),a,Ri(Ai),i)}function th(e,t,n,r){e:{n=Array.prototype.slice.call(n);for(var i=0,o=!1,a=0;a<t.length;a++)if(t[a].optional)o=!0;else{if(o)throw new Zr("internal-error","Argument validator encountered a required argument after an optional argument.");i++}if(o=t.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=t[i].optional&&void 0===n[i],!t[i].N(n[i])&&!o){if(t=t[i],0>i||i>=nh.length)throw new Zr("internal-error","Argument validator received an unsupported number of arguments.");n=nh[i],r=(r?"":n+" argument ")+(t.name?'"'+t.name+'" ':"")+"must be "+t.M+".";break e}r=null}}if(r)throw new Zr("argument-error",e+" failed: "+r)}(t=zl.prototype).Ba=function(){var e=this;return this.f?this.f:this.f=$l(this,Ze().then((function(){if(Tr()&&!hr())return ur();throw new Zr("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")})).then((function(){return e.m.g(e.v())})).then((function(t){return e.g=t,Rs(e.o,gs,{})})).then((function(t){e.a[Yl]=t.recaptchaSiteKey})).s((function(t){throw e.f=null,t})))},t.render=function(){Zl(this);var e=this;
1return $l(this,this.Ba().then((function(){if(null===e.c){var t=e.u;if(!e.i){var n=Qn(t);t=Hn("DIV"),n.appendChild(t)}e.c=e.g.render(t,e.a)}return e.c})))},t.verify=function(){Zl(this);var e=this;return $l(this,this.render().then((function(t){return new ze((function(n){var r=e.g.getResponse(t);if(r)n(r);else{e.l.push((function t(r){r&&(function(e,t){K(e.l,(function(e){return e==t}))}(e,t),n(r))})),e.i&&e.g.execute(e.c)}}))})))},t.reset=function(){Zl(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){Zl(this),this.B=!0,this.m.c();for(var e=0;e<this.h.length;e++)this.h[e].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.i){e=Qn(this.u);for(var t;t=e.firstChild;)e.removeChild(t)}},k(eh,zl);var nh="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function rh(e,t){return{name:e||"",M:"a valid string",optional:!!t,N:c}}function ih(e,t){return{name:e||"",M:"a boolean",optional:!!t,N:l}}function oh(e,t){return{name:e||"",M:"a valid object",optional:!!t,N:b}}function ah(e,t){return{name:e||"",M:"a function",optional:!!t,N:v}}function sh(e,t){return{name:e||"",M:"null",optional:!!t,N:m}}function uh(e){return{name:e?e+"Credential":"credential",M:e?"a valid "+e+" credential":"a valid credential",optional:!1,N:function(t){if(!t)return!1;var n=!e||t.providerId===e;return!(!t.na||!n)}}}function ch(){return{name:"applicationVerifier",M:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,N:function(e){return!!(e&&c(e.type)&&v(e.verify))}}}function lh(e,t,n,r){return{name:n||"",M:e.M+" or "+t.M,optional:!!r,N:function(n){return e.N(n)||t.N(n)}}}function hh(e,t){for(var n in t){var r=t[n].name;e[r]=dh(r,e[n],t[n].j)}}function fh(e,t){for(var n in t){var r=t[n].name;r!==n&&Object.defineProperty(e,r,{get:C((function(e){return this[e]}),n),set:C((function(e,t,n,r){th(e,[n],[r],!0),this[t]=r}),r,n,t[n].Ya),enumerable:!0})}}function ph(e,t,n,r){e[t]=dh(t,n,r)}function dh(e,t,n){function r(){var e=Array.prototype.slice.call(arguments);return th(o,n,e),t.apply(this,e)}if(!n)return t;var i,o=function(e){return(e=e.split("."))[e.length-1]}(e);for(i in t)r[i]=t[i];for(i in t.prototype)r.prototype[i]=t.prototype[i];return r}hh(_l.prototype,{Xa:{name:"applyActionCode",j:[rh("code")]},Ka:{name:"checkActionCode",j:[rh("code")]},$a:{name:"confirmPasswordReset",j:[rh("code"),rh("newPassword")]},Xb:{name:"createUserWithEmailAndPassword",j:[rh("email"),rh("password")]},$b:{name:"fetchSignInMethodsForEmail",j:[rh("email")]},oa:{name:"getRedirectResult",j:[]},qc:{name:"isSignInWithEmailLink",j:[rh("emailLink")]},wc:{name:"onAuthStateChanged",j:[lh(oh(),ah(),"nextOrObserver"),ah("opt_error",!0),ah("opt_completed",!0)]},xc:{name:"onIdTokenChanged",j:[lh(oh(),ah(),"nextOrObserver"),ah("opt_error",!0),ah("opt_completed",!0)]},kb:{name:"sendPasswordResetEmail",j:[rh("email"),lh(oh("opt_actionCodeSettings",!0),sh(null,!0),"opt_actionCodeSettings",!0)]},lb:{name:"sendSignInLinkToEmail",j:[rh("email"),oh("actionCodeSettings")]},mb:{name:"setPersistence",j:[rh("persistence")]},Gc:{name:"signInAndRetrieveDataWithCredential",j:[uh()]},ob:{name:"signInAnonymously",j:[]},Ra:{name:"signInWithCredential",j:[uh()]},Hc:{name:"signInWithCustomToken",j:[rh("token")]},Ic:{name:"signInWithEmailAndPassword",j:[rh("email"),rh("password")]},Jc:{name:"signInWithEmailLink",j:[rh("email"),rh("emailLink",!0)]},Kc:{name:"signInWithPhoneNumber",j:[rh("phoneNumber"),ch()]},Lc:{name:"signInWithPopup",j:[{name:"authProvider",M:"a valid Auth provider",optional:!1,N:function(e){return!!(e&&e.providerId&&e.hasOwnProperty&&e.hasOwnProperty("isOAuthProvider"))}}]},Mc:{name:"signInWithRedirect",j:[{name:"authProvider",M:"a valid Auth provider",optional:!1,N:function(e){return!!(e&&e.providerId&&e.hasOwnProperty&&e.hasOwnProperty("isOAuthProvider"))}}]},Rc:{name:"updateCurrentUser",j:[lh({name:"user",M:"an instance of Firebase User",optional:!1,N:function(e){return!!(e&&e instanceof Mc)}},sh(),"user")]},pb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[rh(null,!0)]},Tc:{name:"useDeviceLanguage",j:[]},Uc:{name:"verifyPasswordResetCode",j:[rh("code")]}}),fh(_l.prototype,{lc:{name:"languageCode",Ya:lh(rh(),sh(),"languageCode")},ti:{name:"tenantId",Ya:lh(rh(),sh(),"tenantId")}}),_l.Persistence=Iu,_l.Persistence.LOCAL="local",_l.Persistence.SESSION="session",_l.Persistence.NONE="none",hh(Mc.prototype,{delete:{name:"delete",j:[]},dc:{name:"getIdTokenResult",j:[ih("opt_forceRefresh",!0)]},G:{name:"getIdToken",j:[ih("opt_forceRefresh",!0)]},rc:{name:"linkAndRetrieveDataWithCredential",j:[uh()]},eb:{name:"linkWithCredential",j:[uh()]},sc:{name:"linkWithPhoneNumber",j:[rh("phoneNumber"),ch()]},tc:{name:"linkWithPopup",j:[{name:"authProvider",M:"a valid Auth provider",optional:!1,N:function(e){return!!(e&&e.providerId&&e.hasOwnProperty&&e.hasOwnProperty("isOAuthProvider"))}}]},uc:{name:"linkWithRedirect",j:[{name:"authProvider",M:"a valid Auth provider",optional:!1,N:function(e){return!!(e&&e.providerId&&e.hasOwnProperty&&e.hasOwnProperty("isOAuthProvider"))}}]},Ac:{name:"reauthenticateAndRetrieveDataWithCredential",j:[uh()]},gb:{name:"reauthenticateWithCredential",j:[uh()]},Bc:{name:"reauthenticateWithPhoneNumber",j:[rh("phoneNumber"),ch()]},Cc:{name:"reauthenticateWithPopup",j:[{name:"authProvider",M:"a valid Auth provider",optional:!1,N:function(e){return!!(e&&e.providerId&&e.hasOwnProperty&&e.hasOwnProperty("isOAuthProvider"))}}]},Dc:{name:"reauthenticateWithRedirect",j:[{name:"authProvider",M:"a valid Auth provider",optional:!1,N:function(e){return!!(e&&e.providerId&&e.hasOwnProperty&&e.hasOwnProperty("isOAuthProvider"))}}]},reload:{name:"reload",j:[]},jb:{name:"sendEmailVerification",j:[lh(oh("opt_actionCodeSettings",!0),sh(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[rh(null,!0)]},Qc:{name:"unlink",j:[rh("provider")]}
1,rb:{name:"updateEmail",j:[rh("email")]},sb:{name:"updatePassword",j:[rh("password")]},Sc:{name:"updatePhoneNumber",j:[uh("phone")]},tb:{name:"updateProfile",j:[oh("profile")]}}),hh(xl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),hh(Pl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),hh(ze.prototype,{ka:{name:"finally"},s:{name:"catch"},then:{name:"then"}}),fh(Tc.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",Ya:ih("appVerificationDisabledForTesting")}}),hh(Sc.prototype,{confirm:{name:"confirm",j:[rh("verificationCode")]}}),ph(zi,"fromJSON",(function(e){e=c(e)?JSON.parse(e):e;for(var t,n=[Zi,fo,vo,Xi],r=0;r<n.length;r++)if(t=n[r](e))return t;return null}),[lh(rh(),oh(),"json")]),ph(po,"credential",(function(e,t){return new ho(e,t)}),[rh("email"),rh("password")]),hh(ho.prototype,{A:{name:"toJSON",j:[rh(null,!0)]}}),hh(ro.prototype,{wa:{name:"addScope",j:[rh("scope")]},Ea:{name:"setCustomParameters",j:[oh("customOAuthParameters")]}}),ph(ro,"credential",io,[lh(rh(),oh(),"token")]),ph(po,"credentialWithLink",mo,[rh("email"),rh("emailLink")]),hh(oo.prototype,{wa:{name:"addScope",j:[rh("scope")]},Ea:{name:"setCustomParameters",j:[oh("customOAuthParameters")]}}),ph(oo,"credential",ao,[lh(rh(),oh(),"token")]),hh(so.prototype,{wa:{name:"addScope",j:[rh("scope")]},Ea:{name:"setCustomParameters",j:[oh("customOAuthParameters")]}}),ph(so,"credential",uo,[lh(rh(),lh(oh(),sh()),"idToken"),lh(rh(),sh(),"accessToken",!0)]),hh(co.prototype,{Ea:{name:"setCustomParameters",j:[oh("customOAuthParameters")]}}),ph(co,"credential",lo,[lh(rh(),oh(),"token"),rh("secret",!0)]),hh(no.prototype,{wa:{name:"addScope",j:[rh("scope")]},credential:{name:"credential",j:[lh(rh(),lh(oh(),sh()),"optionsOrIdToken"),lh(rh(),sh(),"accessToken",!0)]},Ea:{name:"setCustomParameters",j:[oh("customOAuthParameters")]}}),hh(Ji.prototype,{A:{name:"toJSON",j:[rh(null,!0)]}}),hh(Gi.prototype,{A:{name:"toJSON",j:[rh(null,!0)]}}),ph(_o,"credential",wo,[rh("verificationId"),rh("verificationCode")]),hh(_o.prototype,{Va:{name:"verifyPhoneNumber",j:[rh("phoneNumber"),ch()]}}),hh(go.prototype,{A:{name:"toJSON",j:[rh(null,!0)]}}),hh(Zr.prototype,{toJSON:{name:"toJSON",j:[rh(null,!0)]}}),hh(Do.prototype,{toJSON:{name:"toJSON",j:[rh(null,!0)]}}),hh(Ao.prototype,{toJSON:{name:"toJSON",j:[rh(null,!0)]}}),hh(eh.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),ph(ri,"parseLink",hi,[rh("link")]),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 e={ActionCodeInfo:{Operation:{EMAIL_SIGNIN:Kr,PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"}},Auth:_l,AuthCredential:zi,Error:Zr};ph(e,"EmailAuthProvider",po,[]),ph(e,"FacebookAuthProvider",ro,[]),ph(e,"GithubAuthProvider",oo,[]),ph(e,"GoogleAuthProvider",so,[]),ph(e,"TwitterAuthProvider",co,[]),ph(e,"OAuthProvider",no,[rh("providerId")]),ph(e,"SAMLAuthProvider",to,[rh("providerId")]),ph(e,"PhoneAuthProvider",_o,[{name:"auth",M:"an instance of Firebase Auth",optional:!0,N:function(e){return!!(e&&e instanceof _l)}}]),ph(e,"RecaptchaVerifier",eh,[lh(rh(),{name:"",M:"an HTML element",optional:!1,N:function(e){return!!(e&&e instanceof Element)}},"recaptchaContainer"),oh("recaptchaParameters",!0),{name:"app",M:"an instance of Firebase App",optional:!0,N:function(e){return!!(e&&e instanceof r.a.app.App)}}]),ph(e,"ActionCodeURL",ri,[]),r.a.INTERNAL.registerService("auth",(function(e,t){return t({INTERNAL:{getUid:S((e=new _l(e)).getUid,e),getToken:S(e.cc,e),addAuthTokenListener:S(e.Wb,e),removeAuthTokenListener:S(e.Ec,e)}}),e}),e,(function(e,t){if("create"===e)try{t.auth()}catch(n){}})),r.a.INTERNAL.extendNamespace({User:Mc})}()}).apply("undefined"!==typeof e?e:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})}.call(this,n(5))},function(e,t,n){"use strict";
1(function(r){Object.defineProperty(t,"__esModule",{value:!0});var i,o=(i=n(1))&&"object"===typeof i&&"default"in i?i.default:i,a=n(0),s=n(3),u=n(4),c=function(){function e(e){this.domStorage_=e,this.prefix_="firebase:"}return e.prototype.set=function(e,t){null==t?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),s.stringify(t))},e.prototype.get=function(e){var t=this.domStorage_.getItem(this.prefixedName_(e));return null==t?null:s.jsonEval(t)},e.prototype.remove=function(e){this.domStorage_.removeItem(this.prefixedName_(e))},e.prototype.prefixedName_=function(e){return this.prefix_+e},e.prototype.toString=function(){return this.domStorage_.toString()},e}(),l=function(){function e(){this.cache_={},this.isInMemoryStorage=!0}return e.prototype.set=function(e,t){null==t?delete this.cache_[e]:this.cache_[e]=t},e.prototype.get=function(e){return s.contains(this.cache_,e)?this.cache_[e]:null},e.prototype.remove=function(e){delete this.cache_[e]},e}(),h=function(e){try{if("undefined"!==typeof window&&"undefined"!==typeof window[e]){var t=window[e];return t.setItem("firebase:sentinel","cache"),t.removeItem("firebase:sentinel"),new c(t)}}catch(n){}return new l},f=h("localStorage"),p=h("sessionStorage"),d=new u.Logger("@firebase/database"),m="FIREBASE_DATABASE_EMULATOR_HOST",y=function(){var e=1;return function(){return e++}}(),g=function(e){var t=s.stringToByteArray(e),n=new s.Sha1;n.update(t);var r=n.digest();return s.base64.encodeByteArray(r)},v=function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r="",i=0;i<t.length;i++)Array.isArray(t[i])||t[i]&&"object"===typeof t[i]&&"number"===typeof t[i].length?r+=e.apply(null,t[i]):"object"===typeof t[i]?r+=s.stringify(t[i]):r+=t[i],r+=" ";return r},b=null,_=!0,w=function(e,t){s.assert(!t||!0===e||!1===e,"Can't turn on custom loggers persistently."),!0===e?(d.logLevel=u.LogLevel.VERBOSE,b=d.log.bind(d),t&&p.set("logging_enabled",!0)):"function"===typeof e?b=e:(b=null,p.remove("logging_enabled"))},E=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!0===_&&(_=!1,null===b&&!0===p.get("logging_enabled")&&w(!0)),b){var n=v.apply(null,e);b(n)}},T=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];E.apply(void 0,a.__spread([e],t))}},S=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n="FIREBASE INTERNAL ERROR: "+v.apply(void 0,a.__spread(e));d.error(n)},C=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n="FIREBASE FATAL ERROR: "+v.apply(void 0,a.__spread(e));throw d.error(n),new Error(n)},I=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n="FIREBASE WARNING: "+v.apply(void 0,a.__spread(e));d.warn(n)},k=function(e){return"number"===typeof e&&(e!=e||e==Number.POSITIVE_INFINITY||e==Number.NEGATIVE_INFINITY)},N="[MIN_NAME]",A="[MAX_NAME]",D=function(e,t){if(e===t)return 0;if(e===N||t===A)return-1;if(t===N||e===A)return 1;var n=U(e),r=U(t);return null!==n?null!==r?n-r==0?e.length-t.length:n-r:-1:null!==r?1:e<t?-1:1},R=function(e,t){return e===t?0:e<t?-1:1},O=function(e,t){if(t&&e in t)return t[e];throw new Error("Missing required key ("+e+") in object: "+s.stringify(t))},P=function e(t){if("object"!==typeof t||null===t)return s.stringify(t);var n=[];for(var r in t)n.push(r);n.sort();for(var i="{",o=0;o<n.length;o++)0!==o&&(i+=","),i+=s.stringify(n[o]),i+=":",i+=e(t[n[o]]);return i+="}"},x=function(e,t){var n=e.length;if(n<=t)return[e];for(var r=[],i=0;i<n;i+=t)i+t>n?r.push(e.substring(i,n)):r.push(e.substring(i,i+t));return r};function M(e,t){for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])}var L=function(e){s.assert(!k(e),"Invalid JSON number");var t,n,r,i,o,a,u;for(0===e?(n=0,r=0,t=1/e===-1/0?1:0):(t=e<0,(e=Math.abs(e))>=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(e)/Math.LN2),1023))+1023,r=Math.round(e*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,r=Math.round(e/Math.pow(2,-1074)))),a=[],o=52;o;o-=1)a.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)a.push(n%2?1:0),n=Math.floor(n/2);a.push(t?1:0),a.reverse(),u=a.join("");var c="";for(o=0;o<64;o+=8){var l=parseInt(u.substr(o,8),2).toString(16);1===l.length&&(l="0"+l),c+=l}return c.toLowerCase()},F=new RegExp("^-?\\d{1,10}$"),U=function(e){if(F.test(e)){var t=Number(e);if(t>=-2147483648&&t<=2147483647)return t}return null},q=function(e){try{e()}catch(t){setTimeout((function(){var e=t.stack||"";throw I("Exception was thrown by user callback.",e),t}),Math.floor(0))}},V=function(){return("object"===typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},j=function(e,t){var n=setTimeout(e,t);return"object"===typeof n&&n.unref&&n.unref(),n},B=function(){function e(e,t){if(void 0===t){this.pieces_=e.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_=e,this.pieceNum_=t}return Object.defineProperty(e,"Empty",{get:function(){return new e("")},enumerable:!0,configurable:!0}),e.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},e.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},e.prototype.popFront=function(){var t=this.pieceNum_;return t<this.pieces_.length&&t++,new e(this.pieces_,t)},e.prototype.getBack=function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},e.prototype.toString=function(){for(var e="",t=this.pieceNum_;t<this.pieces_.length;t++)""!==this.pieces_[t]&&(e+="/"+this.pieces_[t]);return e||"/"},e.prototype.toUrlEncodedString=function(){for(var e="",t=this.pieceNum_;t<this.pieces_.length;t++)""!==this.pieces_[t]&&(e+="/"+encodeURIComponent(String(this.pieces_[t])));return e||"/"},e.prototype.slice=function(e){return void 0===e&&(e=0),this.pieces_.slice(this.pieceNum_+e)},e.prototype.parent=function(){if(this.pieceNum_>=this.pieces_.length)return null;for(var t=[],n=this.pieceNum_;n<this.pieces_.length-1;n++)t.push(this.pieces_[n]);return new e(t,0)},e.prototype.child=function(t){for(var n=[],r=this.pieceNum_;r<this.pieces_.length;r++)n.push(this.pieces_[r]);if(t instanceof e)for(r=t.pieceNum_;r<t.pieces_.length;r++)n.push(t.pieces_[r]);else{var i=t.split("/");for(r=0;r<i.length;r++)i[r].length>0&&n.push(i[r])}return new e(n,0)},e.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},e.relativePath=function(t,n){var r=t.getFront(),i=n.getFront();if(null===r)return n;if(r===i)return e.relativePath(t.popFront(),n.popFront());
1throw new Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+t+")")},e.comparePaths=function(e,t){for(var n=e.slice(),r=t.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},e.prototype.equals=function(e){if(this.getLength()!==e.getLength())return!1;for(var t=this.pieceNum_,n=e.pieceNum_;t<=this.pieces_.length;t++,n++)if(this.pieces_[t]!==e.pieces_[n])return!1;return!0},e.prototype.contains=function(e){var t=this.pieceNum_,n=e.pieceNum_;if(this.getLength()>e.getLength())return!1;for(;t<this.pieces_.length;){if(this.pieces_[t]!==e.pieces_[n])return!1;++t,++n}return!0},e}(),W=function(){function e(e,t){this.errorPrefix_=t,this.parts_=e.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=s.stringLength(this.parts_[n]);this.checkValid_()}return Object.defineProperty(e,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!0,configurable:!0}),Object.defineProperty(e,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!0,configurable:!0}),e.prototype.push=function(e){this.parts_.length>0&&(this.byteLength_+=1),this.parts_.push(e),this.byteLength_+=s.stringLength(e),this.checkValid_()},e.prototype.pop=function(){var e=this.parts_.pop();this.byteLength_-=s.stringLength(e),this.parts_.length>0&&(this.byteLength_-=1)},e.prototype.checkValid_=function(){if(this.byteLength_>e.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+e.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>e.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+e.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},e.prototype.toErrorString=function(){return 0==this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},e}(),Q="long_polling",K=function(){function e(e,t,n,r,i,o){void 0===i&&(i=""),void 0===o&&(o=!1),this.secure=t,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.includeNamespaceInQueryParams=o,this.host=e.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=f.get("host:"+e)||this.host}return e.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},e.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},e.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},e.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},e.prototype.updateHost=function(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&f.set("host:"+this.host,this.internalHost))},e.prototype.connectionURL=function(e,t){var n;if(s.assert("string"===typeof e,"typeof type must == string"),s.assert("object"===typeof t,"typeof params must == object"),"websocket"===e)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(e!==Q)throw new Error("Unknown connection type: "+e);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(t.ns=this.namespace);var r=[];return M(t,(function(e,t){r.push(e+"="+t)})),n+r.join("&")},e.prototype.toString=function(){var e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e},e.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},e}();var z,H,G=function(e){var t=Y(e),n=t.namespace;"firebase"===t.domain&&C(t.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),n&&"undefined"!=n||"localhost"===t.domain||C("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),t.secure||"undefined"!==typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&I("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var r="ws"===t.scheme||"wss"===t.scheme;return{repoInfo:new K(t.host,t.secure,n,r,"",n!=t.subdomain),path:new B(t.pathString)}},Y=function(e){var t="",n="",r="",i="",o="",s=!0,u="https",c=443;if("string"===typeof e){var l=e.indexOf("//");l>=0&&(u=e.substring(0,l-1),e=e.substring(l+2));var h=e.indexOf("/");-1===h&&(h=e.length);var f=e.indexOf("?");-1===f&&(f=e.length),t=e.substring(0,Math.min(h,f)),h<f&&(i=function(e){for(var t="",n=e.split("/"),r=0;r<n.length;r++)if(n[r].length>0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(o){}t+="/"+i}return t}(e.substring(h,f)));var p=function(e){var t,n,r={};"?"===e.charAt(0)&&(e=e.substring(1));try{for(var i=a.__values(e.split("&")),o=i.next();!o.done;o=i.next()){var s=o.value;if(0!==s.length){var u=s.split("=");
12===u.length?r[decodeURIComponent(u[0])]=decodeURIComponent(u[1]):I("Invalid query segment '"+s+"' in query '"+e+"'")}}}catch(c){t={error:c}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r}(e.substring(Math.min(e.length,f)));(l=t.indexOf(":"))>=0?(s="https"===u||"wss"===u,c=parseInt(t.substring(l+1),10)):l=e.length;var d=t.split(".");3===d.length?(n=d[1],o=r=d[0].toLowerCase()):2===d.length?n=d[0]:"localhost"===d[0].slice(0,l).toLowerCase()&&(n="localhost"),"ns"in p&&(o=p.ns)}return{host:t,port:c,domain:n,subdomain:r,secure:s,scheme:u,pathString:i,namespace:o}},X=/[\[\].#$\/\u0000-\u001F\u007F]/,J=/[\[\].#$\u0000-\u001F\u007F]/,$=function(e){return"string"===typeof e&&0!==e.length&&!X.test(e)},Z=function(e){return"string"===typeof e&&0!==e.length&&!J.test(e)},ee=function(e){return null===e||"string"===typeof e||"number"===typeof e&&!k(e)||e&&"object"===typeof e&&s.contains(e,".sv")},te=function(e,t,n,r,i){i&&void 0===n||ne(s.errorPrefix(e,t,i),n,r)},ne=function e(t,n,r){var i=r instanceof B?new W(r,t):r;if(void 0===n)throw new Error(t+"contains undefined "+i.toErrorString());if("function"===typeof n)throw new Error(t+"contains a function "+i.toErrorString()+" with contents = "+n.toString());if(k(n))throw new Error(t+"contains "+n.toString()+" "+i.toErrorString());if("string"===typeof n&&n.length>10485760/3&&s.stringLength(n)>10485760)throw new Error(t+"contains a string greater than 10485760 utf8 bytes "+i.toErrorString()+" ('"+n.substring(0,50)+"...')");if(n&&"object"===typeof n){var o=!1,a=!1;if(M(n,(function(n,r){if(".value"===n)o=!0;else if(".priority"!==n&&".sv"!==n&&(a=!0,!$(n)))throw new Error(t+" contains an invalid key ("+n+") "+i.toErrorString()+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');i.push(n),e(t,r,i),i.pop()})),o&&a)throw new Error(t+' contains ".value" child '+i.toErrorString()+" in addition to actual children.")}},re=function(e,t,n,r,i){if(!i||void 0!==n){var o=s.errorPrefix(e,t,i);if(!n||"object"!==typeof n||Array.isArray(n))throw new Error(o+" must be an object containing the children to replace.");var a=[];M(n,(function(e,t){var n=new B(e);if(ne(o,t,r.child(n)),".priority"===n.getBack()&&!ee(t))throw new Error(o+"contains an invalid value for '"+n.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");a.push(n)})),function(e,t){var n,r;for(n=0;n<t.length;n++)for(var i=(r=t[n]).slice(),o=0;o<i.length;o++)if(".priority"===i[o]&&o===i.length-1);else if(!$(i[o]))throw new Error(e+"contains an invalid key ("+i[o]+") in path "+r.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');t.sort(B.comparePaths);var a=null;for(n=0;n<t.length;n++){if(r=t[n],null!==a&&a.contains(r))throw new Error(e+"contains a path "+a.toString()+" that is ancestor of another path "+r.toString());a=r}}(o,a)}},ie=function(e,t,n,r){if(!r||void 0!==n){if(k(n))throw new Error(s.errorPrefix(e,t,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!ee(n))throw new Error(s.errorPrefix(e,t,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},oe=function(e,t,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(s.errorPrefix(e,t,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}},ae=function(e,t,n,r){if((!r||void 0!==n)&&!$(n))throw new Error(s.errorPrefix(e,t,r)+'was an invalid key = "'+n+'".  Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')},se=function(e,t,n,r){if((!r||void 0!==n)&&!Z(n))throw new Error(s.errorPrefix(e,t,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},ue=function(e,t,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),se(e,t,n,r)},ce=function(e,t){if(".info"===t.getFront())throw new Error(e+" failed = Can't modify data under /.info/")},le=function(e,t,n){var r=n.path.toString();if("string"!==typeof n.repoInfo.host||0===n.repoInfo.host.length||!$(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==r.length&&!function(e){return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),Z(e)}(r))throw new Error(s.errorPrefix(e,t,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')},he=function(e,t,n,r){if((!r||void 0!==n)&&"boolean"!==typeof n)throw new Error(s.errorPrefix(e,t,r)+"must be a boolean.")},fe=function(){function e(e,t){this.repo_=e,this.path_=t}return e.prototype.cancel=function(e){s.validateArgCount("OnDisconnect.cancel",0,1,arguments.length),s.validateCallback("OnDisconnect.cancel",1,e,!0);var t=new s.Deferred;return this.repo_.onDisconnectCancel(this.path_,t.wrapCallback(e)),t.promise},e.prototype.remove=function(e){s.validateArgCount("OnDisconnect.remove",0,1,arguments.length),ce("OnDisconnect.remove",this.path_),s.validateCallback("OnDisconnect.remove",1,e,!0);var t=new s.Deferred;return this.repo_.onDisconnectSet(this.path_,null,t.wrapCallback(e)),t.promise},e.prototype.set=function(e,t){s.validateArgCount("OnDisconnect.set",1,2,arguments.length),ce("OnDisconnect.set",this.path_),te("OnDisconnect.set",1,e,this.path_,!1),s.validateCallback("OnDisconnect.set",2,t,!0);var n=new s.Deferred;return this.repo_.onDisconnectSet(this.path_,e,n.wrapCallback(t)),n.promise},e.prototype.setWithPriority=function(e,t,n){s.validateArgCount("OnDisconnect.setWithPriority",2,3,arguments.length),ce("OnDisconnect.setWithPriority",this.path_),te("OnDisconnect.setWithPriority",1,e,this.path_,!1),ie("OnDisconnect.setWithPriority",2,t,!1),s.validateCallback("OnDisconnect.setWithPriority",3,n,!0);var r=new s.Deferred;return this.repo_.onDisconnectSetWithPriority(this.path_,e,t,r.wrapCallback(n)),r.promise},e.prototype.update=function(e,t){if(s.validateArgCount("OnDisconnect.update",1,2,arguments.length),ce("OnDisconnect.update",this.path_),Array.isArray(e)){for(var n={},r=0;r<e.length;++r)n[""+r]=e[r];e=n,I("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.")}re("OnDisconnect.update",1,e,this.path_,!1),s.validateCallback("OnDisconnect.update",2,t,!0);var i=new s.Deferred;return this.repo_.onDisconnectUpdate(this.path_,e,i.wrapCallback(t)),i.promise},e}
1(),pe=function(){function e(e,t){this.committed=e,this.snapshot=t}return e.prototype.toJSON=function(){return s.validateArgCount("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},e}(),de=function(){var e="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",t=0,n=[];return function(r){var i,o=r===t;t=r;var a=new Array(8);for(i=7;i>=0;i--)a[i]=e.charAt(r%64),r=Math.floor(r/64);s.assert(0===r,"Cannot push at time == 0");var u=a.join("");if(o){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+=e.charAt(n[i]);return s.assert(20===u.length,"nextPushId: Length should be 20."),u}}(),me=function(){function e(e,t){this.name=e,this.node=t}return e.Wrap=function(t,n){return new e(t,n)},e}(),ye=function(){function e(){}return e.prototype.getCompare=function(){return this.compare.bind(this)},e.prototype.indexedValueChanged=function(e,t){var n=new me(N,e),r=new me(N,t);return 0!==this.compare(n,r)},e.prototype.minPost=function(){return me.MIN},e}(),ge=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a.__extends(t,e),Object.defineProperty(t,"__EMPTY_NODE",{get:function(){return z},set:function(e){z=e},enumerable:!0,configurable:!0}),t.prototype.compare=function(e,t){return D(e.name,t.name)},t.prototype.isDefinedOn=function(e){throw s.assertionError("KeyIndex.isDefinedOn not expected to be called.")},t.prototype.indexedValueChanged=function(e,t){return!1},t.prototype.minPost=function(){return me.MIN},t.prototype.maxPost=function(){return new me(A,z)},t.prototype.makePost=function(e,t){return s.assert("string"===typeof e,"KeyIndex indexValue must always be a string."),new me(e,z)},t.prototype.toString=function(){return".key"},t}(ye),ve=new ge;var be,_e,we,Ee=function(e){return"number"===typeof e?"number:"+L(e):"string:"+e},Te=function(e){if(e.isLeafNode()){var t=e.val();s.assert("string"===typeof t||"number"===typeof t||"object"===typeof t&&s.contains(t,".sv"),"Priority must be a string or number.")}else s.assert(e===H||e.isEmpty(),"priority of unexpected type.");s.assert(e===H||e.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},Se=function(){function e(t,n){void 0===n&&(n=e.__childrenNodeConstructor.EMPTY_NODE),this.value_=t,this.priorityNode_=n,this.lazyHash_=null,s.assert(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Te(this.priorityNode_)}return Object.defineProperty(e,"__childrenNodeConstructor",{get:function(){return be},set:function(e){be=e},enumerable:!0,configurable:!0}),e.prototype.isLeafNode=function(){return!0},e.prototype.getPriority=function(){return this.priorityNode_},e.prototype.updatePriority=function(t){return new e(this.value_,t)},e.prototype.getImmediateChild=function(t){return".priority"===t?this.priorityNode_:e.__childrenNodeConstructor.EMPTY_NODE},e.prototype.getChild=function(t){return t.isEmpty()?this:".priority"===t.getFront()?this.priorityNode_:e.__childrenNodeConstructor.EMPTY_NODE},e.prototype.hasChild=function(){return!1},e.prototype.getPredecessorChildName=function(e,t){return null},e.prototype.updateImmediateChild=function(t,n){return".priority"===t?this.updatePriority(n):n.isEmpty()&&".priority"!==t?this:e.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,n).updatePriority(this.priorityNode_)},e.prototype.updateChild=function(t,n){var r=t.getFront();return null===r?n:n.isEmpty()&&".priority"!==r?this:(s.assert(".priority"!==r||1===t.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(r,e.__childrenNodeConstructor.EMPTY_NODE.updateChild(t.popFront(),n)))},e.prototype.isEmpty=function(){return!1},e.prototype.numChildren=function(){return 0},e.prototype.forEachChild=function(e,t){return!1},e.prototype.val=function(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},e.prototype.hash=function(){if(null===this.lazyHash_){var e="";this.priorityNode_.isEmpty()||(e+="priority:"+Ee(this.priorityNode_.val())+":");var t=typeof this.value_;e+=t+":",e+="number"===t?L(this.value_):this.value_,this.lazyHash_=g(e)}return this.lazyHash_},e.prototype.getValue=function(){return this.value_},e.prototype.compareTo=function(t){return t===e.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof e.__childrenNodeConstructor?-1:(s.assert(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))},e.prototype.compareToLeafNode_=function(t){var n=typeof t.value_,r=typeof this.value_,i=e.VALUE_TYPE_ORDER.indexOf(n),o=e.VALUE_TYPE_ORDER.indexOf(r);return s.assert(i>=0,"Unknown leaf type: "+n),s.assert(o>=0,"Unknown leaf type: "+r),i===o?"object"===r?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:o-i},e.prototype.withIndex=function(){return this},e.prototype.isIndexed=function(){return!0},e.prototype.equals=function(e){if(e===this)return!0;
1if(e.isLeafNode()){var t=e;return this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_)}return!1},e.VALUE_TYPE_ORDER=["object","boolean","number","string"],e}();var Ce,Ie,ke=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a.__extends(t,e),t.prototype.compare=function(e,t){var n=e.node.getPriority(),r=t.node.getPriority(),i=n.compareTo(r);return 0===i?D(e.name,t.name):i},t.prototype.isDefinedOn=function(e){return!e.getPriority().isEmpty()},t.prototype.indexedValueChanged=function(e,t){return!e.getPriority().equals(t.getPriority())},t.prototype.minPost=function(){return me.MIN},t.prototype.maxPost=function(){return new me(A,new Se("[PRIORITY-POST]",we))},t.prototype.makePost=function(e,t){var n=_e(e);return new me(t,new Se("[PRIORITY-POST]",n))},t.prototype.toString=function(){return".priority"},t}(ye)),Ne=function(){function e(e,t,n,r,i){void 0===i&&(i=null),this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];for(var o=1;!e.isEmpty();)if(e=e,o=t?n(e.key,t):1,r&&(o*=-1),o<0)e=this.isReverse_?e.left:e.right;else{if(0===o){this.nodeStack_.push(e);break}this.nodeStack_.push(e),e=this.isReverse_?e.right:e.left}}return e.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var e,t=this.nodeStack_.pop();if(e=this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value},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},e.prototype.hasNext=function(){return this.nodeStack_.length>0},e.prototype.peek=function(){if(0===this.nodeStack_.length)return null;var e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}},e}(),Ae=function(){function e(t,n,r,i,o){this.key=t,this.value=n,this.color=null!=r?r:e.RED,this.left=null!=i?i:Re.EMPTY_NODE,this.right=null!=o?o:Re.EMPTY_NODE}return e.prototype.copy=function(t,n,r,i,o){return new e(null!=t?t:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},e.prototype.count=function(){return this.left.count()+1+this.right.count()},e.prototype.isEmpty=function(){return!1},e.prototype.inorderTraversal=function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)},e.prototype.reverseTraversal=function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)},e.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},e.prototype.minKey=function(){return this.min_().key},e.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},e.prototype.insert=function(e,t,n){var r,i;return(i=(r=n(e,(i=this).key))<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===r?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n))).fixUp_()},e.prototype.removeMin_=function(){if(this.left.isEmpty())return Re.EMPTY_NODE;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_()},e.prototype.remove=function(e,t){var n,r;if(t(e,(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(e,t),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===t(e,n.key)){if(n.right.isEmpty())return Re.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(e,t))}return n.fixUp_()},e.prototype.isRed_=function(){return this.color},e.prototype.fixUp_=function(){var e=this;return e.right.isRed_()&&!e.left.isRed_()&&(e=e.rotateLeft_()),e.left.isRed_()&&e.left.left.isRed_()&&(e=e.rotateRight_()),e.left.isRed_()&&e.right.isRed_()&&(e=e.colorFlip_()),e},e.prototype.moveRedLeft_=function(){var e=this.colorFlip_();return e.right.left.isRed_()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight_())).rotateLeft_()).colorFlip_()),e},e.prototype.moveRedRight_=function(){var e=this.colorFlip_();return e.left.left.isRed_()&&(e=(e=e.rotateRight_()).colorFlip_()),e},e.prototype.rotateLeft_=function(){var t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},e.prototype.rotateRight_=function(){var t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},e.prototype.colorFlip_=function(){var e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)},e.prototype.checkMaxDepth_=function(){var e=this.check_();return Math.pow(2,e)<=this.count()+1},e.prototype.check_=function(){var e;
1if(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((e=this.left.check_())!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)},e.RED=!0,e.BLACK=!1,e}(),De=function(){function e(){}return e.prototype.copy=function(e,t,n,r,i){return this},e.prototype.insert=function(e,t,n){return new Ae(e,t,null)},e.prototype.remove=function(e,t){return this},e.prototype.count=function(){return 0},e.prototype.isEmpty=function(){return!0},e.prototype.inorderTraversal=function(e){return!1},e.prototype.reverseTraversal=function(e){return!1},e.prototype.minKey=function(){return null},e.prototype.maxKey=function(){return null},e.prototype.check_=function(){return 0},e.prototype.isRed_=function(){return!1},e}(),Re=function(){function e(t,n){void 0===n&&(n=e.EMPTY_NODE),this.comparator_=t,this.root_=n}return e.prototype.insert=function(t,n){return new e(this.comparator_,this.root_.insert(t,n,this.comparator_).copy(null,null,Ae.BLACK,null,null))},e.prototype.remove=function(t){return new e(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Ae.BLACK,null,null))},e.prototype.get=function(e){for(var t,n=this.root_;!n.isEmpty();){if(0===(t=this.comparator_(e,n.key)))return n.value;t<0?n=n.left:t>0&&(n=n.right)}return null},e.prototype.getPredecessorKey=function(e){for(var t,n=this.root_,r=null;!n.isEmpty();){if(0===(t=this.comparator_(e,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}t<0?n=n.left:t>0&&(r=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key.  What gives?")},e.prototype.isEmpty=function(){return this.root_.isEmpty()},e.prototype.count=function(){return this.root_.count()},e.prototype.minKey=function(){return this.root_.minKey()},e.prototype.maxKey=function(){return this.root_.maxKey()},e.prototype.inorderTraversal=function(e){return this.root_.inorderTraversal(e)},e.prototype.reverseTraversal=function(e){return this.root_.reverseTraversal(e)},e.prototype.getIterator=function(e){return new Ne(this.root_,null,this.comparator_,!1,e)},e.prototype.getIteratorFrom=function(e,t){return new Ne(this.root_,e,this.comparator_,!1,t)},e.prototype.getReverseIteratorFrom=function(e,t){return new Ne(this.root_,e,this.comparator_,!0,t)},e.prototype.getReverseIterator=function(e){return new Ne(this.root_,null,this.comparator_,!0,e)},e.EMPTY_NODE=new De,e}(),Oe=Math.log(2),Pe=function(){function e(e){var t;this.count=(t=e+1,parseInt(Math.log(t)/Oe,10)),this.current_=this.count-1;var n,r=(n=this.count,parseInt(Array(n+1).join("1"),2));this.bits_=e+1&r}return e.prototype.nextBitIsOne=function(){var e=!(this.bits_&1<<this.current_);return this.current_--,e},e}(),xe=function(e,t,n,r){e.sort(t);var i=function(t){for(var r=null,i=null,o=e.length,a=function(t,r){var i=o-t,a=o;o-=t;var u=function t(r,i){var o,a,s=i-r;if(0==s)return null;if(1==s)return o=e[r],a=n?n(o):o,new Ae(a,o.node,Ae.BLACK,null,null);var u=parseInt(s/2,10)+r,c=t(r,u),l=t(u+1,i);return o=e[u],a=n?n(o):o,new Ae(a,o.node,Ae.BLACK,c,l)}(i+1,a),c=e[i],l=n?n(c):c;s(new Ae(l,c.node,r,null,u))},s=function(e){r?(r.left=e,r=e):(i=e,r=e)},u=0;u<t.count;++u){var c=t.nextBitIsOne(),l=Math.pow(2,t.count-(u+1));c?a(l,Ae.BLACK):(a(l,Ae.BLACK),a(l,Ae.RED))}return i}(new Pe(e.length));return new Re(r||t,i)},Me={},Le=function(){function e(e,t){this.indexes_=e,this.indexSet_=t}return Object.defineProperty(e,"Default",{get:function(){return s.assert(Me&&ke,"ChildrenNode.ts has not been loaded"),Ce=Ce||new e({".priority":Me},{".priority":ke})},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var t=s.safeGet(this.indexes_,e);if(!t)throw new Error("No index defined for "+e);return t instanceof Re?t:null},e.prototype.hasIndex=function(e){return s.contains(this.indexSet_,e.toString())},e.prototype.addIndex=function(t,n){s.assert(t!==ve,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var r,i=[],o=!1,u=n.getIterator(me.Wrap),c=u.getNext();c;)o=o||t.isDefinedOn(c.node),i.push(c),c=u.getNext();r=o?xe(i,t.getCompare()):Me;var l=t.toString(),h=a.__assign({},this.indexSet_);h[l]=t;var f=a.__assign({},this.indexes_);return f[l]=r,new e(f,h)},e.prototype.addToIndexes=function(t,n){var r=this;return new e(s.map(this.indexes_,(function(e,i){var o=s.safeGet(r.indexSet_,i);if(s.assert(o,"Missing index implementation for "+i),e===Me){if(o.isDefinedOn(t.node)){for(var a=[],u=n.getIterator(me.Wrap),c=u.getNext();c;)c.name!=t.name&&a.push(c),c=u.getNext();return a.push(t),xe(a,o.getCompare())}return Me}var l=n.get(t.name),h=e;return l&&(h=h.remove(new me(t.name,l))),h.insert(t,t.node)})),this.indexSet_)}
1,e.prototype.removeFromIndexes=function(t,n){return new e(s.map(this.indexes_,(function(e){if(e===Me)return e;var r=n.get(t.name);return r?e.remove(new me(t.name,r)):e})),this.indexSet_)},e}();function Fe(e,t){return D(e.name,t.name)}function Ue(e,t){return D(e,t)}var qe=function(){function e(e,t,n){this.children_=e,this.priorityNode_=t,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&Te(this.priorityNode_),this.children_.isEmpty()&&s.assert(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}return Object.defineProperty(e,"EMPTY_NODE",{get:function(){return Ie||(Ie=new e(new Re(Ue),null,Le.Default))},enumerable:!0,configurable:!0}),e.prototype.isLeafNode=function(){return!1},e.prototype.getPriority=function(){return this.priorityNode_||Ie},e.prototype.updatePriority=function(t){return this.children_.isEmpty()?this:new e(this.children_,t,this.indexMap_)},e.prototype.getImmediateChild=function(e){if(".priority"===e)return this.getPriority();var t=this.children_.get(e);return null===t?Ie:t},e.prototype.getChild=function(e){var t=e.getFront();return null===t?this:this.getImmediateChild(t).getChild(e.popFront())},e.prototype.hasChild=function(e){return null!==this.children_.get(e)},e.prototype.updateImmediateChild=function(t,n){if(s.assert(n,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(n);var r,i=new me(t,n),o=void 0,a=void 0;return n.isEmpty()?(o=this.children_.remove(t),a=this.indexMap_.removeFromIndexes(i,this.children_)):(o=this.children_.insert(t,n),a=this.indexMap_.addToIndexes(i,this.children_)),r=o.isEmpty()?Ie:this.priorityNode_,new e(o,r,a)},e.prototype.updateChild=function(e,t){var n=e.getFront();if(null===n)return t;s.assert(".priority"!==e.getFront()||1===e.getLength(),".priority must be the last token in a path");var r=this.getImmediateChild(n).updateChild(e.popFront(),t);return this.updateImmediateChild(n,r)},e.prototype.isEmpty=function(){return this.children_.isEmpty()},e.prototype.numChildren=function(){return this.children_.count()},e.prototype.val=function(t){if(this.isEmpty())return null;var n={},r=0,i=0,o=!0;if(this.forEachChild(ke,(function(a,s){n[a]=s.val(t),r++,o&&e.INTEGER_REGEXP_.test(a)?i=Math.max(i,Number(a)):o=!1})),!t&&o&&i<2*r){var a=[];for(var s in n)a[s]=n[s];return a}return t&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n},e.prototype.hash=function(){if(null===this.lazyHash_){var e="";this.getPriority().isEmpty()||(e+="priority:"+Ee(this.getPriority().val())+":"),this.forEachChild(ke,(function(t,n){var r=n.hash();""!==r&&(e+=":"+t+":"+r)})),this.lazyHash_=""===e?"":g(e)}return this.lazyHash_},e.prototype.getPredecessorChildName=function(e,t,n){var r=this.resolveIndex_(n);if(r){var i=r.getPredecessorKey(new me(e,t));return i?i.name:null}return this.children_.getPredecessorKey(e)},e.prototype.getFirstChildName=function(e){var t=this.resolveIndex_(e);if(t){var n=t.minKey();return n&&n.name}return this.children_.minKey()},e.prototype.getFirstChild=function(e){var t=this.getFirstChildName(e);return t?new me(t,this.children_.get(t)):null},e.prototype.getLastChildName=function(e){var t=this.resolveIndex_(e);if(t){var n=t.maxKey();return n&&n.name}return this.children_.maxKey()},e.prototype.getLastChild=function(e){var t=this.getLastChildName(e);return t?new me(t,this.children_.get(t)):null},e.prototype.forEachChild=function(e,t){var n=this.resolveIndex_(e);return n?n.inorderTraversal((function(e){return t(e.name,e.node)})):this.children_.inorderTraversal(t)},e.prototype.getIterator=function(e){return this.getIteratorFrom(e.minPost(),e)},e.prototype.getIteratorFrom=function(e,t){var n=this.resolveIndex_(t);if(n)return n.getIteratorFrom(e,(function(e){return e}));for(var r=this.children_.getIteratorFrom(e.name,me.Wrap),i=r.peek();null!=i&&t.compare(i,e)<0;)r.getNext(),i=r.peek();return r},e.prototype.getReverseIterator=function(e){return this.getReverseIteratorFrom(e.maxPost(),e)},e.prototype.getReverseIteratorFrom=function(e,t){var n=this.resolveIndex_(t);if(n)return n.getReverseIteratorFrom(e,(function(e){return e}));for(var r=this.children_.getReverseIteratorFrom(e.name,me.Wrap),i=r.peek();null!=i&&t.compare(i,e)>0;)r.getNext(),i=r.peek();return r},e.prototype.compareTo=function(e){return this.isEmpty()?e.isEmpty()?0:-1:e.isLeafNode()||e.isEmpty()?1:e===Ve?-1:0},e.prototype.withIndex=function(t){if(t===ve||this.indexMap_.hasIndex(t))return this;var n=this.indexMap_.addIndex(t,this.children_);return new e(this.children_,this.priorityNode_,n)},e.prototype.isIndexed=function(e){return e===ve||this.indexMap_.hasIndex(e)},e.prototype.equals=function(e){if(e===this)return!0;
1if(e.isLeafNode())return!1;var t=e;if(this.getPriority().equals(t.getPriority())){if(this.children_.count()===t.children_.count()){for(var n=this.getIterator(ke),r=t.getIterator(ke),i=n.getNext(),o=r.getNext();i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1}return!1},e.prototype.resolveIndex_=function(e){return e===ve?null:this.indexMap_.get(e.toString())},e.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,e}(),Ve=new(function(e){function t(){return e.call(this,new Re(Ue),qe.EMPTY_NODE,Le.Default)||this}return a.__extends(t,e),t.prototype.compareTo=function(e){return e===this?0:1},t.prototype.equals=function(e){return e===this},t.prototype.getPriority=function(){return this},t.prototype.getImmediateChild=function(e){return qe.EMPTY_NODE},t.prototype.isEmpty=function(){return!1},t}(qe));Object.defineProperties(me,{MIN:{value:new me(N,qe.EMPTY_NODE)},MAX:{value:new me(A,Ve)}}),ge.__EMPTY_NODE=qe.EMPTY_NODE,Se.__childrenNodeConstructor=qe,H=Ve,function(e){we=e}(Ve);var je=!0;function Be(e,t){if(void 0===t&&(t=null),null===e)return qe.EMPTY_NODE;if("object"===typeof e&&".priority"in e&&(t=e[".priority"]),s.assert(null===t||"string"===typeof t||"number"===typeof t||"object"===typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"===typeof e&&".value"in e&&null!==e[".value"]&&(e=e[".value"]),"object"!==typeof e||".sv"in e)return new Se(e,Be(t));if(e instanceof Array||!je){var n=qe.EMPTY_NODE;return M(e,(function(t,r){if(s.contains(e,t)&&"."!==t.substring(0,1)){var i=Be(r);!i.isLeafNode()&&i.isEmpty()||(n=n.updateImmediateChild(t,i))}})),n.updatePriority(Be(t))}var r=[],i=!1;if(M(e,(function(e,t){if("."!==e.substring(0,1)){var n=Be(t);n.isEmpty()||(i=i||!n.getPriority().isEmpty(),r.push(new me(e,n)))}})),0==r.length)return qe.EMPTY_NODE;var o=xe(r,Fe,(function(e){return e.name}),Ue);if(i){var a=xe(r,ke.getCompare());return new qe(o,Be(t),new Le({".priority":a},{".priority":ke}))}return new qe(o,Be(t),Le.Default)}!function(e){_e=e}(Be);var We,Qe,Ke=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return a.__extends(t,e),t.prototype.compare=function(e,t){var n=e.node.compareTo(t.node);return 0===n?D(e.name,t.name):n},t.prototype.isDefinedOn=function(e){return!0},t.prototype.indexedValueChanged=function(e,t){return!e.equals(t)},t.prototype.minPost=function(){return me.MIN},t.prototype.maxPost=function(){return me.MAX},t.prototype.makePost=function(e,t){var n=Be(e);return new me(t,n)},t.prototype.toString=function(){return".value"},t}(ye)),ze=function(e){function t(t){var n=e.call(this)||this;return n.indexPath_=t,s.assert(!t.isEmpty()&&".priority"!==t.getFront(),"Can't create PathIndex with empty path or .priority key"),n}return a.__extends(t,e),t.prototype.extractChild=function(e){return e.getChild(this.indexPath_)},t.prototype.isDefinedOn=function(e){return!e.getChild(this.indexPath_).isEmpty()},t.prototype.compare=function(e,t){var n=this.extractChild(e.node),r=this.extractChild(t.node),i=n.compareTo(r);return 0===i?D(e.name,t.name):i},t.prototype.makePost=function(e,t){var n=Be(e),r=qe.EMPTY_NODE.updateChild(this.indexPath_,n);return new me(t,r)},t.prototype.maxPost=function(){var e=qe.EMPTY_NODE.updateChild(this.indexPath_,Ve);return new me(A,e)},t.prototype.toString=function(){return this.indexPath_.slice().join("/")},t}(ye),He=function(){function e(e,t,n){this.node_=e,this.ref_=t,this.index_=n}return e.prototype.val=function(){return s.validateArgCount("DataSnapshot.val",0,0,arguments.length),this.node_.val()},e.prototype.exportVal=function(){return s.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},e.prototype.toJSON=function(){return s.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},e.prototype.exists=function(){return s.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},e.prototype.child=function(t){s.validateArgCount("DataSnapshot.child",0,1,arguments.length),t=String(t),se("DataSnapshot.child",1,t,!1);var n=new B(t),r=this.ref_.child(n);return new e(this.node_.getChild(n),r,ke)},e.prototype.hasChild=function(e){s.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),se("DataSnapshot.hasChild",1,e,!1);var t=new B(e);return!this.node_.getChild(t).isEmpty()},e.prototype.getPriority=function(){return s.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},e.prototype.forEach=function(t){var n=this;if(s.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),s.validateCallback("DataSnapshot.forEach",1,t,!1),this.node_.isLeafNode())return!1;var r=this.node_;return!!r.forEachChild(this.index_,(function(r,i){return t(new e(i,n.ref_.child(r),ke))}))},e.prototype.hasChildren=function(){return s.validateArgCount("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(e.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!0,configurable:!0}),e.prototype.numChildren=function(){return s.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},e.prototype.getRef=function(){return s.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(e.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),e}(),Ge=function(){function e(e,t,n,r){this.eventType=e,this.eventRegistration=t,this.snapshot=n,this.prevName=r}return e.prototype.getPath=function(){var e=this.snapshot.getRef();return"value"===this.eventType?e.path:e.getParent().path},e.prototype.getEventType=function(){return this.eventType},e.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},e.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+s.stringify(this.snapshot.exportVal())},e}(),Ye=function(){function e(e,t,n){this.eventRegistration=e,this.error=t,this.path=n}return e.prototype.getPath=function(){return this.path},e.prototype.getEventType=function(){return"cancel"},e.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},e.prototype.toString=function(){return this.path.toString()+":cancel"},e}(),Xe=function(){function e(e,t,n){this.callback_=e,this.cancelCallback_=t,this.context_=n}return e.prototype.respondsTo=function(e){return"value"===e},e.prototype.createEvent=function(e,t){var n=t.getQueryParams().getIndex();return new Ge("value",this,new He(e.snapshotNode,t.getRef(),n))},e.prototype.getEventRunner=function(e){var t=this.context_;if("cancel"===e.getEventType()){s.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(t,e.error)}}var r=this.callback_;return function(){r.call(t,e.snapshot)}},e.prototype.createCancelEvent=function(e,t){return this.cancelCallback_?new Ye(this,e,t):null},e.prototype.matches=function(t){return t instanceof e&&(!t.callback_||!this.callback_||t.callback_===this.callback_&&t.context_===this.context_)},e.prototype.hasAnyCallback=function(){return null!==this.callback_},e}(),Je=function(){function e(e,t,n){this.callbacks_=e,this.cancelCallback_=t,this.context_=n}return e.prototype.respondsTo=function(e){var t="children_added"===e?"child_added":e;return t="children_removed"===t?"child_removed":t,s.contains(this.callbacks_,t)},e.prototype.createCancelEvent=function(e,t){return this.cancelCallback_?new Ye(this,e,t):null},e.prototype.createEvent=function(e,t){s.assert(null!=e.childName,"Child events should have a childName.");var n=t.getRef().child(e.childName),r=t.getQueryParams().getIndex();return new Ge(e.type,this,new He(e.snapshotNode,n,r),e.prevName)},e.prototype.getEventRunner=function(e){var t=this.context_;if("cancel"===e.getEventType()){s.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(t,e.error)}}var r=this.callbacks_[e.eventType];return function(){r.call(t,e.snapshot,e.prevName)}},e.prototype.matches=function(t){var n=this;if(t instanceof e){if(!this.callbacks_||!t.callbacks_)return!0;
1if(this.context_===t.context_){var r=Object.keys(t.callbacks_),i=Object.keys(this.callbacks_),o=r.length;if(o===i.length){if(1===o){var a=r[0],s=i[0];return s===a&&(!t.callbacks_[a]||!this.callbacks_[s]||t.callbacks_[a]===this.callbacks_[s])}return i.every((function(e){return t.callbacks_[e]===n.callbacks_[e]}))}}}return!1},e.prototype.hasAnyCallback=function(){return null!==this.callbacks_},e}(),$e=function(){function e(e,t,n,r){this.repo=e,this.path=t,this.queryParams_=n,this.orderByCalled_=r}return Object.defineProperty(e,"__referenceConstructor",{get:function(){return s.assert(We,"Reference.ts has not been loaded"),We},set:function(e){We=e},enumerable:!0,configurable:!0}),e.validateQueryEndpoints_=function(e){var t=null,n=null;if(e.hasStart()&&(t=e.getIndexStartValue()),e.hasEnd()&&(n=e.getIndexEndValue()),e.getIndex()===ve){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(e.hasStart()){if(e.getIndexStartName()!=N)throw new Error(r);if("string"!==typeof t)throw new Error(i)}if(e.hasEnd()){if(e.getIndexEndName()!=A)throw new Error(r);if("string"!==typeof n)throw new Error(i)}}else if(e.getIndex()===ke){if(null!=t&&!ee(t)||null!=n&&!ee(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(s.assert(e.getIndex()instanceof ze||e.getIndex()===Ke,"unknown index type."),null!=t&&"object"===typeof t||null!=n&&"object"===typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},e.validateLimit_=function(e){if(e.hasStart()&&e.hasEnd()&&e.hasLimit()&&!e.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},e.prototype.validateNoPreviousOrderByCall_=function(e){if(!0===this.orderByCalled_)throw new Error(e+": You can't combine multiple orderBy calls.")},e.prototype.getQueryParams=function(){return this.queryParams_},e.prototype.getRef=function(){return s.validateArgCount("Query.ref",0,0,arguments.length),new e.__referenceConstructor(this.repo,this.path)},e.prototype.on=function(t,n,r,i){s.validateArgCount("Query.on",2,4,arguments.length),oe("Query.on",1,t,!1),s.validateCallback("Query.on",2,n,!1);var o=e.getCancelAndContextArgs_("Query.on",r,i);if("value"===t)this.onValueEvent(n,o.cancel,o.context);else{var a={};a[t]=n,this.onChildEvent(a,o.cancel,o.context)}return n},e.prototype.onValueEvent=function(e,t,n){var r=new Xe(e,t||null,n||null);this.repo.addEventCallbackForQuery(this,r)},e.prototype.onChildEvent=function(e,t,n){var r=new Je(e,t,n);this.repo.addEventCallbackForQuery(this,r)},e.prototype.off=function(e,t,n){s.validateArgCount("Query.off",0,3,arguments.length),oe("Query.off",1,e,!0),s.validateCallback("Query.off",2,t,!0),s.validateContextObject("Query.off",3,n,!0);var r=null,i=null;if("value"===e){var o=t||null;r=new Xe(o,null,n||null)}else e&&(t&&((i={})[e]=t),r=new Je(i,null,n||null));this.repo.removeEventCallbackForQuery(this,r)},e.prototype.once=function(t,n,r,i){var o=this;s.validateArgCount("Query.once",1,4,arguments.length),oe("Query.once",1,t,!1),s.validateCallback("Query.once",2,n,!0);var a=e.getCancelAndContextArgs_("Query.once",r,i),u=!0,c=new s.Deferred;c.promise.catch((function(){}));var l=function e(r){u&&(u=!1,o.off(t,e),n&&n.bind(a.context)(r),c.resolve(r))};return this.on(t,l,(function(e){o.off(t,l),a.cancel&&a.cancel.bind(a.context)(e),c.reject(e)})),c.promise},e.prototype.limitToFirst=function(t){if(s.validateArgCount("Query.limitToFirst",1,1,arguments.length),"number"!==typeof t||Math.floor(t)!==t||t<=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 e(this.repo,this.path,this.queryParams_.limitToFirst(t),this.orderByCalled_)},e.prototype.limitToLast=function(t){if(s.validateArgCount("Query.limitToLast",1,1,arguments.length),"number"!==typeof t||Math.floor(t)!==t||t<=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 
1(by another call to limit, limitToFirst, or limitToLast).");return new e(this.repo,this.path,this.queryParams_.limitToLast(t),this.orderByCalled_)},e.prototype.orderByChild=function(t){if(s.validateArgCount("Query.orderByChild",1,1,arguments.length),"$key"===t)throw new Error('Query.orderByChild: "$key" is invalid.  Use Query.orderByKey() instead.');if("$priority"===t)throw new Error('Query.orderByChild: "$priority" is invalid.  Use Query.orderByPriority() instead.');if("$value"===t)throw new Error('Query.orderByChild: "$value" is invalid.  Use Query.orderByValue() instead.');se("Query.orderByChild",1,t,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var n=new B(t);if(n.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path.  Use Query.orderByValue() instead.");var r=new ze(n),i=this.queryParams_.orderBy(r);return e.validateQueryEndpoints_(i),new e(this.repo,this.path,i,!0)},e.prototype.orderByKey=function(){s.validateArgCount("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var t=this.queryParams_.orderBy(ve);return e.validateQueryEndpoints_(t),new e(this.repo,this.path,t,!0)},e.prototype.orderByPriority=function(){s.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var t=this.queryParams_.orderBy(ke);return e.validateQueryEndpoints_(t),new e(this.repo,this.path,t,!0)},e.prototype.orderByValue=function(){s.validateArgCount("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var t=this.queryParams_.orderBy(Ke);return e.validateQueryEndpoints_(t),new e(this.repo,this.path,t,!0)},e.prototype.startAt=function(t,n){void 0===t&&(t=null),s.validateArgCount("Query.startAt",0,2,arguments.length),te("Query.startAt",1,t,this.path,!0),ae("Query.startAt",2,n,!0);var r=this.queryParams_.startAt(t,n);if(e.validateLimit_(r),e.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===t&&(t=null,n=null),new e(this.repo,this.path,r,this.orderByCalled_)},e.prototype.endAt=function(t,n){void 0===t&&(t=null),s.validateArgCount("Query.endAt",0,2,arguments.length),te("Query.endAt",1,t,this.path,!0),ae("Query.endAt",2,n,!0);var r=this.queryParams_.endAt(t,n);if(e.validateLimit_(r),e.validateQueryEndpoints_(r),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new e(this.repo,this.path,r,this.orderByCalled_)},e.prototype.equalTo=function(e,t){if(s.validateArgCount("Query.equalTo",1,2,arguments.length),te("Query.equalTo",1,e,this.path,!1),ae("Query.equalTo",2,t,!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(e,t).endAt(e,t)},e.prototype.toString=function(){return s.validateArgCount("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},e.prototype.toJSON=function(){return s.validateArgCount("Query.toJSON",0,1,arguments.length),this.toString()},e.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},e.prototype.queryIdentifier=function(){var e=this.queryObject(),t=P(e);return"{}"===t?"default":t},e.prototype.isEqual=function(t){if(s.validateArgCount("Query.isEqual",1,1,arguments.length),!(t instanceof e)){var n="Query.isEqual failed: First argument must be an instance of firebase.database.Query.";throw new Error(n)}
1var r=this.repo===t.repo,i=this.path.equals(t.path),o=this.queryIdentifier()===t.queryIdentifier();return r&&i&&o},e.getCancelAndContextArgs_=function(e,t,n){var r={cancel:null,context:null};if(t&&n)r.cancel=t,s.validateCallback(e,3,r.cancel,!0),r.context=n,s.validateContextObject(e,4,r.context,!0);else if(t)if("object"===typeof t&&null!==t)r.context=t;else{if("function"!==typeof t)throw new Error(s.errorPrefix(e,3,!0)+" must either be a cancel callback or a context object.");r.cancel=t}return r},Object.defineProperty(e.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),e}(),Ze=function(){function e(){this.value=null,this.children=new Map}return e.prototype.find=function(e){if(null!=this.value)return this.value.getChild(e);if(!e.isEmpty()&&this.children.size>0){var t=e.getFront();return e=e.popFront(),this.children.has(t)?this.children.get(t).find(e):null}return null},e.prototype.remember=function(t,n){if(t.isEmpty())this.value=n,this.children.clear();else if(null!==this.value)this.value=this.value.updateChild(t,n);else{var r=t.getFront();this.children.has(r)||this.children.set(r,new e);var i=this.children.get(r);t=t.popFront(),i.remember(t,n)}},e.prototype.forget=function(e){if(e.isEmpty())return this.value=null,this.children.clear(),!0;if(null!==this.value){if(this.value.isLeafNode())return!1;var t=this.value;this.value=null;var n=this;return t.forEachChild(ke,(function(e,t){n.remember(new B(e),t)})),this.forget(e)}if(this.children.size>0){var r=e.getFront();if(e=e.popFront(),this.children.has(r))this.children.get(r).forget(e)&&this.children.delete(r);return 0===this.children.size}return!0},e.prototype.forEachTree=function(e,t){null!==this.value?t(e,this.value):this.forEachChild((function(n,r){var i=new B(e.toString()+"/"+n);r.forEachTree(i,t)}))},e.prototype.forEachChild=function(e){this.children.forEach((function(t,n){e(n,t)}))},e}(),et=function(e,t){return e&&"object"===typeof e?(s.assert(".sv"in e,"Unexpected leaf node or priority contents"),t[e[".sv"]]):e},tt=function e(t,n){var r,i=t.getPriority().val(),o=et(i,n);if(t.isLeafNode()){var a=t,s=et(a.getValue(),n);return s!==a.getValue()||o!==a.getPriority().val()?new Se(s,Be(o)):t}var u=t;return r=u,o!==u.getPriority().val()&&(r=r.updatePriority(new Se(o))),u.forEachChild(ke,(function(t,i){var o=e(i,n);o!==i&&(r=r.updateImmediateChild(t,o))})),r};!function(e){e[e.OVERWRITE=0]="OVERWRITE",e[e.MERGE=1]="MERGE",e[e.ACK_USER_WRITE=2]="ACK_USER_WRITE",e[e.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(Qe||(Qe={}));var nt,rt,it=function(){function e(e,t,n,r){this.fromUser=e,this.fromServer=t,this.queryId=n,this.tagged=r,s.assert(!r||t,"Tagged queries must be from server.")}return e.User=new e(!0,!1,null,!1),e.Server=new e(!1,!0,null,!1),e.forServerTaggedQuery=function(t){return new e(!1,!0,t,!0)},e}(),ot=function(){function e(e,t,n){this.path=e,this.affectedTree=t,this.revert=n,this.type=Qe.ACK_USER_WRITE,this.source=it.User}return e.prototype.operationForChild=function(t){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return s.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var n=this.affectedTree.subtree(new B(t));return new e(B.Empty,n,this.revert)}return s.assert(this.path.getFront()===t,"operationForChild called for unrelated child."),new e(this.path.popFront(),this.affectedTree,this.revert)},e}(),at=function(){return nt||(nt=new Re(R)),nt},st=function(){function e(e,t){void 0===t&&(t=at()),this.value=e,this.children=t}return e.fromObject=function(t){var n=e.Empty;return M(t,(function(e,t){n=n.set(new B(e),t)})),n},e.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},e.prototype.findRootMostMatchingPathAndValue=function(e,t){if(null!=this.value&&t(this.value))return{path:B.Empty,value:this.value};if(e.isEmpty())return null;var n=e.getFront(),r=this.children.get(n);if(null!==r){var i=r.findRootMostMatchingPathAndValue(e.popFront(),t);return null!=i?{path:new B(n).child(i.path),value:i.value}:null}return null},e.prototype.findRootMostValueAndPath=function(e){return this.findRootMostMatchingPathAndValue(e,(function(){return!0}))},e.prototype.subtree=function(t){if(t.isEmpty())return this;var n=t.getFront(),r=this.children.get(n);return null!==r?r.subtree(t.popFront()):e.Empty},e.prototype.set=function(t,n){if(t.isEmpty())return new e(n,this.children);var r=t.getFront(),i=(this.children.get(r)||e.Empty).set(t.popFront(),n),o=this.children.insert(r,i);return new e(this.value,o)},e.prototype.remove=function(t){if(t.isEmpty())return this.children.isEmpty()?e.Empty:new e(null,this.children);var n=t.getFront(),r=this.children.get(n);if(r){var i=r.remove(t.popFront()),o=void 0;return o=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&o.isEmpty()?e.Empty:new e(this.value,o)}return this},e.prototype.get=function(e){if(e.isEmpty())return this.value;var t=e.getFront(),n=this.children.get(t);return n?n.get(e.popFront()):null},e.prototype.setTree=function(t,n){if(t.isEmpty())return n;var r=t.getFront(),i=(this.children.get(r)||e.Empty).setTree(t.popFront(),n),o=void 0;return o=i.isEmpty()?this.children.remove(r):this.children.insert(r,i),new e(this.value,o)},e.prototype.fold=function(e){return this.fold_(B.Empty,e)}
1,e.prototype.fold_=function(e,t){var n={};return this.children.inorderTraversal((function(r,i){n[r]=i.fold_(e.child(r),t)})),t(e,this.value,n)},e.prototype.findOnPath=function(e,t){return this.findOnPath_(e,B.Empty,t)},e.prototype.findOnPath_=function(e,t,n){var r=!!this.value&&n(t,this.value);if(r)return r;if(e.isEmpty())return null;var i=e.getFront(),o=this.children.get(i);return o?o.findOnPath_(e.popFront(),t.child(i),n):null},e.prototype.foreachOnPath=function(e,t){return this.foreachOnPath_(e,B.Empty,t)},e.prototype.foreachOnPath_=function(t,n,r){if(t.isEmpty())return this;this.value&&r(n,this.value);var i=t.getFront(),o=this.children.get(i);return o?o.foreachOnPath_(t.popFront(),n.child(i),r):e.Empty},e.prototype.foreach=function(e){this.foreach_(B.Empty,e)},e.prototype.foreach_=function(e,t){this.children.inorderTraversal((function(n,r){r.foreach_(e.child(n),t)})),this.value&&t(e,this.value)},e.prototype.foreachChild=function(e){this.children.inorderTraversal((function(t,n){n.value&&e(t,n.value)}))},e.Empty=new e(null),e}(),ut=function(){function e(e,t){this.source=e,this.path=t,this.type=Qe.LISTEN_COMPLETE}return e.prototype.operationForChild=function(t){return this.path.isEmpty()?new e(this.source,B.Empty):new e(this.source,this.path.popFront())},e}(),ct=function(){function e(e,t,n){this.source=e,this.path=t,this.snap=n,this.type=Qe.OVERWRITE}return e.prototype.operationForChild=function(t){return this.path.isEmpty()?new e(this.source,B.Empty,this.snap.getImmediateChild(t)):new e(this.source,this.path.popFront(),this.snap)},e}(),lt=function(){function e(e,t,n){this.source=e,this.path=t,this.children=n,this.type=Qe.MERGE}return e.prototype.operationForChild=function(t){if(this.path.isEmpty()){var n=this.children.subtree(new B(t));return n.isEmpty()?null:n.value?new ct(this.source,B.Empty,n.value):new e(this.source,B.Empty,n)}return s.assert(this.path.getFront()===t,"Can't get a merge for a child not on the path of the operation"),new e(this.source,this.path.popFront(),this.children)},e.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},e}(),ht=function(){function e(e,t,n){this.node_=e,this.fullyInitialized_=t,this.filtered_=n}return e.prototype.isFullyInitialized=function(){return this.fullyInitialized_},e.prototype.isFiltered=function(){return this.filtered_},e.prototype.isCompleteForPath=function(e){if(e.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var t=e.getFront();return this.isCompleteForChild(t)},e.prototype.isCompleteForChild=function(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)},e.prototype.getNode=function(){return this.node_},e}(),ft=function(){function e(e,t){this.eventCache_=e,this.serverCache_=t}return e.prototype.updateEventSnap=function(t,n,r){return new e(new ht(t,n,r),this.serverCache_)},e.prototype.updateServerSnap=function(t,n,r){return new e(this.eventCache_,new ht(t,n,r))},e.prototype.getEventCache=function(){return this.eventCache_},e.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},e.prototype.getServerCache=function(){return this.serverCache_},e.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},e.Empty=new e(new ht(qe.EMPTY_NODE,!1,!1),new ht(qe.EMPTY_NODE,!1,!1)),e}(),pt=function(){function e(e,t,n,r,i){this.type=e,this.snapshotNode=t,this.childName=n,this.oldSnap=r,this.prevName=i}return e.valueChange=function(t){return new e(e.VALUE,t)},e.childAddedChange=function(t,n){return new e(e.CHILD_ADDED,n,t)},e.childRemovedChange=function(t,n){return new e(e.CHILD_REMOVED,n,t)},e.childChangedChange=function(t,n,r){return new e(e.CHILD_CHANGED,n,t,r)},e.childMovedChange=function(t,n){return new e(e.CHILD_MOVED,n,t)},e.CHILD_ADDED="child_added",e.CHILD_REMOVED="child_removed",e.CHILD_CHANGED="child_changed",e.CHILD_MOVED="child_moved",e.VALUE="value",e}(),dt=function(){function e(e){this.index_=e}return e.prototype.updateChild=function(e,t,n,r,i,o){s.assert(e.isIndexed(this.index_),"A node must be indexed if only a child is updated");var a=e.getImmediateChild(t);return a.getChild(r).equals(n.getChild(r))&&a.isEmpty()==n.isEmpty()?e:(null!=o&&(n.isEmpty()?e.hasChild(t)?o.trackChildChange(pt.childRemovedChange(t,a)):s.assert(e.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(pt.childAddedChange(t,n)):o.trackChildChange(pt.childChangedChange(t,n,a))),e.isLeafNode()&&n.isEmpty()?e:e.updateImmediateChild(t,n).withIndex(this.index_))},e.prototype.updateFullNode=function(e,t,n){return null!=n&&(e.isLeafNode()||e.forEachChild(ke,(function(e,r){t.hasChild(e)||n.trackChildChange(pt.childRemovedChange(e,r))})),t.isLeafNode()||t.forEachChild(ke,(function(t,r){if(e.hasChild(t)){var i=e.getImmediateChild(t);i.equals(r)||n.trackChildChange(pt.childChangedChange(t,r,i))}else n.trackChildChange(pt.childAddedChange(t,r))}))),t.withIndex(this.index_)},e.prototype.updatePriority=function(e,t){return e.isEmpty()?qe.EMPTY_NODE:e.updatePriority(t)},e.prototype.filtersNodes=function(){return!1},e.prototype.getIndexedFilter=function(){return this},e.prototype.getIndex=function(){return this.index_},e}(),mt=function(){function e(){this.changeMap=new Map}return e.prototype.trackChildChange=function(e){var t=e.type,n=e.childName;s.assert(t==pt.CHILD_ADDED||t==pt.CHILD_CHANGED||t==pt.CHILD_REMOVED,"Only child changes supported for tracking"),s.assert(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(t==pt.CHILD_ADDED&&i==pt.CHILD_REMOVED)this.changeMap.set(n,pt.childChangedChange(n,e.snapshotNode,r.snapshotNode));else if(t==pt.CHILD_REMOVED&&i==pt.CHILD_ADDED)this.changeMap.delete(n);else if(t==pt.CHILD_REMOVED&&i==pt.CHILD_CHANGED)this.changeMap.set(n,pt.childRemovedChange(n,r.oldSnap));else if(t==pt.CHILD_CHANGED&&i==pt.CHILD_ADDED)this.changeMap.set(n,pt.childAddedChange(n,e.snapshotNode));else{if(t!=pt.CHILD_CHANGED||i!=pt.CHILD_CHANGED)throw s.assertionError("Illegal combination of changes: "+e+" occurred after "+r);this.changeMap.set(n,pt.childChangedChange(n,e.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,e)},e.prototype.getChanges=function(){return Array.from(this.changeMap.values())},e}(),yt=new(function(){function e(){}return e.prototype.getCompleteChild=function(e){return null},e.prototype.getChildAfterChild=function(e,t,n){return null},e}()),gt=function(){function e(e,t,n){void 0===n&&(n=null),this.writes_=e,this.viewCache_=t,this.optCompleteServerCache_=n}return e.prototype.getCompleteChild=function(e){var t=this.viewCache_.getEventCache();if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);var n=null!=this.optCompleteServerCache_?new ht(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(e,n)},e.prototype.getChildAfterChild=function(e,t,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),i=this.writes_.calcIndexedSlice(r,t,1,n,e);return 0===i.length?null:i[0]},e}(),vt=function(){return function(e,t){this.viewCache=e,this.changes=t}}(),bt=function(){function e(e){this.filter_=e}return e.prototype.assertIndexed=function(e){s.assert(e.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),s.assert(e.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},e.prototype.applyOperation=function(t,n,r,i){var o,a,u=new mt;if(n.type===Qe.OVERWRITE){var c=n;c.source.fromUser?o=this.applyUserOverwrite_(t,c.path,c.snap,r,i,u):(s.assert(c.source.fromServer,"Unknown source."),a=c.source.tagged||t.getServerCache().isFiltered()&&!c.path.isEmpty(),o=this.applyServerOverwrite_(t,c.path,c.snap,r,i,a,u))}else if(n.type===Qe.MERGE){var l=n;l.source.fromUser?o=this.applyUserMerge_(t,l.path,l.children,r,i,u):(s.assert(l.source.fromServer,"Unknown source."),a=l.source.tagged||t.getServerCache().isFiltered(),o=this.applyServerMerge_(t,l.path,l.children,r,i,a,u))}else if(n.type===Qe.ACK_USER_WRITE){var h=n;o=h.revert?this.revertUserWrite_(t,h.path,r,i,u):this.ackUserWrite_(t,h.path,h.affectedTree,r,i,u)}else{if(n.type!==Qe.LISTEN_COMPLETE)throw s.assertionError("Unknown operation type: "+n.type);o=this.listenComplete_(t,n.path,r,u)}var f=u.getChanges();return e.maybeAddValueEvent_(t,o,f),new vt(o,f)},e.maybeAddValueEvent_=function(e,t,n){var r=t.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=e.getCompleteEventSnap();(n.length>
10||!e.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(pt.valueChange(t.getCompleteEventSnap()))}},e.prototype.generateEventCacheAfterServerEvent_=function(e,t,n,r,i){var o=e.getEventCache();if(null!=n.shadowingWrite(t))return e;var a=void 0,u=void 0;if(t.isEmpty())if(s.assert(e.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),e.getServerCache().isFiltered()){var c=e.getCompleteServerSnap(),l=c instanceof qe?c:qe.EMPTY_NODE,h=n.calcCompleteEventChildren(l);a=this.filter_.updateFullNode(e.getEventCache().getNode(),h,i)}else{var f=n.calcCompleteEventCache(e.getCompleteServerSnap());a=this.filter_.updateFullNode(e.getEventCache().getNode(),f,i)}else{var p=t.getFront();if(".priority"==p){s.assert(1==t.getLength(),"Can't have a priority with additional path components");var d=o.getNode();u=e.getServerCache().getNode();var m=n.calcEventCacheAfterServerOverwrite(t,d,u);a=null!=m?this.filter_.updatePriority(d,m):o.getNode()}else{var y=t.popFront(),g=void 0;if(o.isCompleteForChild(p)){u=e.getServerCache().getNode();var v=n.calcEventCacheAfterServerOverwrite(t,o.getNode(),u);g=null!=v?o.getNode().getImmediateChild(p).updateChild(y,v):o.getNode().getImmediateChild(p)}else g=n.calcCompleteChild(p,e.getServerCache());a=null!=g?this.filter_.updateChild(o.getNode(),p,g,y,r,i):o.getNode()}}return e.updateEventSnap(a,o.isFullyInitialized()||t.isEmpty(),this.filter_.filtersNodes())},e.prototype.applyServerOverwrite_=function(e,t,n,r,i,o,a){var s,u=e.getServerCache(),c=o?this.filter_:this.filter_.getIndexedFilter();if(t.isEmpty())s=c.updateFullNode(u.getNode(),n,null);else if(c.filtersNodes()&&!u.isFiltered()){var l=u.getNode().updateChild(t,n);s=c.updateFullNode(u.getNode(),l,null)}else{var h=t.getFront();if(!u.isCompleteForPath(t)&&t.getLength()>1)return e;var f=t.popFront(),p=u.getNode().getImmediateChild(h).updateChild(f,n);s=".priority"==h?c.updatePriority(u.getNode(),p):c.updateChild(u.getNode(),h,p,f,yt,null)}var d=e.updateServerSnap(s,u.isFullyInitialized()||t.isEmpty(),c.filtersNodes()),m=new gt(r,d,i);return this.generateEventCacheAfterServerEvent_(d,t,r,m,a)},e.prototype.applyUserOverwrite_=function(e,t,n,r,i,o){var a,s,u=e.getEventCache(),c=new gt(r,e,i);if(t.isEmpty())s=this.filter_.updateFullNode(e.getEventCache().getNode(),n,o),a=e.updateEventSnap(s,!0,this.filter_.filtersNodes());else{var l=t.getFront();if(".priority"===l)s=this.filter_.updatePriority(e.getEventCache().getNode(),n),a=e.updateEventSnap(s,u.isFullyInitialized(),u.isFiltered());else{var h=t.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):qe.EMPTY_NODE}if(f.equals(p))a=e;else{var m=this.filter_.updateChild(u.getNode(),l,p,h,c,o);a=e.updateEventSnap(m,u.isFullyInitialized(),this.filter_.filtersNodes())}}}return a},e.cacheHasChild_=function(e,t){return e.getEventCache().isCompleteForChild(t)},e.prototype.applyUserMerge_=function(t,n,r,i,o,a){var s=this,u=t;return r.foreach((function(r,c){var l=n.child(r);e.cacheHasChild_(t,l.getFront())&&(u=s.applyUserOverwrite_(u,l,c,i,o,a))})),r.foreach((function(r,c){var l=n.child(r);e.cacheHasChild_(t,l.getFront())||(u=s.applyUserOverwrite_(u,l,c,i,o,a))})),u},e.prototype.applyMerge_=function(e,t){return t.foreach((function(t,n){e=e.updateChild(t,n)})),e},e.prototype.applyServerMerge_=function(e,t,n,r,i,o,a){var s=this;if(e.getServerCache().getNode().isEmpty()&&!e.getServerCache().isFullyInitialized())return e;var u,c=e;u=t.isEmpty()?n:st.Empty.setTree(t,n);var l=e.getServerCache().getNode();return u.children.inorderTraversal((function(t,n){if(l.hasChild(t)){var u=e.getServerCache().getNode().getImmediateChild(t),h=s.applyMerge_(u,n);c=s.applyServerOverwrite_(c,new B(t),h,r,i,o,a)}})),u.children.inorderTraversal((function(t,n){var u=!e.getServerCache().isCompleteForChild(t)&&null==n.value;if(!l.hasChild(t)&&!u){var h=e.getServerCache().getNode().getImmediateChild(t),f=s.applyMerge_(h,n);c=s.applyServerOverwrite_(c,new B(t),f,r,i,o,a)}})),c},e.prototype.ackUserWrite_=function(e,t,n,r,i,o){if(null!=r.shadowingWrite(t))return e;var a=e.getServerCache().isFiltered(),s=e.getServerCache();if(null!=n.value){if(t.isEmpty()&&s.isFullyInitialized()||s.isCompleteForPath(t))return this.applyServerOverwrite_(e,t,s.getNode().getChild(t),r,i,a,o);if(t.isEmpty()){var u=st.Empty;
1return s.getNode().forEachChild(ve,(function(e,t){u=u.set(new B(e),t)})),this.applyServerMerge_(e,t,u,r,i,a,o)}return e}var c=st.Empty;return n.foreach((function(e,n){var r=t.child(e);s.isCompleteForPath(r)&&(c=c.set(e,s.getNode().getChild(r)))})),this.applyServerMerge_(e,t,c,r,i,a,o)},e.prototype.listenComplete_=function(e,t,n,r){var i=e.getServerCache(),o=e.updateServerSnap(i.getNode(),i.isFullyInitialized()||t.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(o,t,n,yt,r)},e.prototype.revertUserWrite_=function(e,t,n,r,i){var o;if(null!=n.shadowingWrite(t))return e;var a=new gt(n,e,r),u=e.getEventCache().getNode(),c=void 0;if(t.isEmpty()||".priority"===t.getFront()){var l=void 0;if(e.getServerCache().isFullyInitialized())l=n.calcCompleteEventCache(e.getCompleteServerSnap());else{var h=e.getServerCache().getNode();s.assert(h instanceof qe,"serverChildren would be complete if leaf node"),l=n.calcCompleteEventChildren(h)}l=l,c=this.filter_.updateFullNode(u,l,i)}else{var f=t.getFront(),p=n.calcCompleteChild(f,e.getServerCache());null==p&&e.getServerCache().isCompleteForChild(f)&&(p=u.getImmediateChild(f)),(c=null!=p?this.filter_.updateChild(u,f,p,t.popFront(),a,i):e.getEventCache().getNode().hasChild(f)?this.filter_.updateChild(u,f,qe.EMPTY_NODE,t.popFront(),a,i):u).isEmpty()&&e.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(e.getCompleteServerSnap())).isLeafNode()&&(c=this.filter_.updateFullNode(c,o,i))}return o=e.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(B.Empty),e.updateEventSnap(c,o,this.filter_.filtersNodes())},e}(),_t=function(){function e(e){this.query_=e,this.index_=this.query_.getQueryParams().getIndex()}return e.prototype.generateEventsForChanges=function(e,t,n){var r=this,i=[],o=[];return e.forEach((function(e){e.type===pt.CHILD_CHANGED&&r.index_.indexedValueChanged(e.oldSnap,e.snapshotNode)&&o.push(pt.childMovedChange(e.childName,e.snapshotNode))})),this.generateEventsForType_(i,pt.CHILD_REMOVED,e,n,t),this.generateEventsForType_(i,pt.CHILD_ADDED,e,n,t),this.generateEventsForType_(i,pt.CHILD_MOVED,o,n,t),this.generateEventsForType_(i,pt.CHILD_CHANGED,e,n,t),this.generateEventsForType_(i,pt.VALUE,e,n,t),i},e.prototype.generateEventsForType_=function(e,t,n,r,i){var o=this,a=n.filter((function(e){return e.type===t}));a.sort(this.compareChanges_.bind(this)),a.forEach((function(t){var n=o.materializeSingleChange_(t,i);r.forEach((function(r){r.respondsTo(t.type)&&e.push(r.createEvent(n,o.query_))}))}))},e.prototype.materializeSingleChange_=function(e,t){return"value"===e.type||"child_removed"===e.type?e:(e.prevName=t.getPredecessorChildName(e.childName,e.snapshotNode,this.index_),e)},e.prototype.compareChanges_=function(e,t){if(null==e.childName||null==t.childName)throw s.assertionError("Should only compare child_ events.");var n=new me(e.childName,e.snapshotNode),r=new me(t.childName,t.snapshotNode);return this.index_.compare(n,r)},e}(),wt=function(){function e(e,t){this.query_=e,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new dt(n.getIndex()),i=n.getNodeFilter();this.processor_=new bt(i);var o=t.getServerCache(),a=t.getEventCache(),s=r.updateFullNode(qe.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(qe.EMPTY_NODE,a.getNode(),null),c=new ht(s,o.isFullyInitialized(),r.filtersNodes()),l=new ht(u,a.isFullyInitialized(),i.filtersNodes());this.viewCache_=new ft(l,c),this.eventGenerator_=new _t(this.query_)}return e.prototype.getQuery=function(){return this.query_},e.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},e.prototype.getCompleteServerCache=function(e){var t=this.viewCache_.getCompleteServerSnap();return t&&(this.query_.getQueryParams().loadsAllData()||!e.isEmpty()&&!t.getImmediateChild(e.getFront()).isEmpty())?t.getChild(e):null},e.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},e.prototype.addEventRegistration=function(e){this.eventRegistrations_.push(e)},e.prototype.removeEventRegistration=function(e,t){var n=[];if(t){s.assert(null==e,"A cancel should cancel all event registrations.");var r=this.query_.path;this.eventRegistrations_.forEach((function(e){t=t;var i=e.createCancelEvent(t,r);i&&n.push(i)}))}if(e){for(var i=[],o=0;o<this.eventRegistrations_.length;++o){var a=this.eventRegistrations_[o];if(a.matches(e)){if(e.hasAnyCallback()){i=i.concat(this.eventRegistrations_.slice(o+1));break}}else i.push(a)}this.eventRegistrations_=i}else this.eventRegistrations_=[];return n},e.prototype.applyOperation=function(e,t,n){e.type===Qe.MERGE&&null!==e.source.queryId&&(s.assert(this.viewCache_.getCompleteServerSnap(),"We should always have a full c
1ache before handling merges"),s.assert(this.viewCache_.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var r=this.viewCache_,i=this.processor_.applyOperation(r,e,t,n);return this.processor_.assertIndexed(i.viewCache),s.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)},e.prototype.getInitialEvents=function(e){var t=this.viewCache_.getEventCache(),n=[];t.getNode().isLeafNode()||t.getNode().forEachChild(ke,(function(e,t){n.push(pt.childAddedChange(e,t))}));return t.isFullyInitialized()&&n.push(pt.valueChange(t.getNode())),this.generateEventsForChanges_(n,t.getNode(),e)},e.prototype.generateEventsForChanges_=function(e,t,n){var r=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(e,t,r)},e}(),Et=function(){function e(){this.views=new Map}return Object.defineProperty(e,"__referenceConstructor",{get:function(){return s.assert(rt,"Reference.ts has not been loaded"),rt},set:function(e){s.assert(!rt,"__referenceConstructor has already been defined"),rt=e},enumerable:!0,configurable:!0}),e.prototype.isEmpty=function(){return 0===this.views.size},e.prototype.applyOperation=function(e,t,n){var r,i,o=e.source.queryId;if(null!==o){var u=this.views.get(o);return s.assert(null!=u,"SyncTree gave us an op for an invalid query."),u.applyOperation(e,t,n)}var c=[];try{for(var l=a.__values(this.views.values()),h=l.next();!h.done;h=l.next()){u=h.value;c=c.concat(u.applyOperation(e,t,n))}}catch(f){r={error:f}}finally{try{h&&!h.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}return c},e.prototype.addEventRegistration=function(e,t,n,r,i){var o=e.queryIdentifier(),a=this.views.get(o);if(!a){var s=n.calcCompleteEventCache(i?r:null),u=!1;s?u=!0:r instanceof qe?(s=n.calcCompleteEventChildren(r),u=!1):(s=qe.EMPTY_NODE,u=!1);var c=new ft(new ht(s,u,!1),new ht(r,i,!1));a=new wt(e,c),this.views.set(o,a)}return a.addEventRegistration(t),a.getInitialEvents(t)},e.prototype.removeEventRegistration=function(t,n,r){var i,o,s=t.queryIdentifier(),u=[],c=[],l=this.hasCompleteView();if("default"===s)try{for(var h=a.__values(this.views.entries()),f=h.next();!f.done;f=h.next()){var p=a.__read(f.value,2),d=p[0],m=p[1];c=c.concat(m.removeEventRegistration(n,r)),m.isEmpty()&&(this.views.delete(d),m.getQuery().getQueryParams().loadsAllData()||u.push(m.getQuery()))}}catch(y){i={error:y}}finally{try{f&&!f.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}else(m=this.views.get(s))&&(c=c.concat(m.removeEventRegistration(n,r)),m.isEmpty()&&(this.views.delete(s),m.getQuery().getQueryParams().loadsAllData()||u.push(m.getQuery())));return l&&!this.hasCompleteView()&&u.push(new e.__referenceConstructor(t.repo,t.path)),{removed:u,events:c}},e.prototype.getQueryViews=function(){var e,t,n=[];try{for(var r=a.__values(this.views.values()),i=r.next();!i.done;i=r.next()){var o=i.value;o.getQuery().getQueryParams().loadsAllData()||n.push(o)}}catch(s){e={error:s}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},e.prototype.getCompleteServerCache=function(e){var t,n,r=null;try{for(var i=a.__values(this.views.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r||s.getCompleteServerCache(e)}}catch(u){t={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r},e.prototype.viewForQuery=function(e){if(e.getQueryParams().loadsAllData())return this.getCompleteView();var t=e.queryIdentifier();return this.views.get(t)},e.prototype.viewExistsForQuery=function(e){return null!=this.viewForQuery(e)},e.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},e.prototype.getCompleteView=function(){var e,t;try{for(var n=a.__values(this.views.values()),r=n.next();!r.done;r=n.next()){var i=r.value;if(i.getQuery().getQueryParams().loadsAllData())return i}}catch(o){e={error:o}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return null},e}(),Tt=function(){function e(e){this.writeTree_=e}return e.prototype.addWrite=function(t,n){if(t.isEmpty())return new e(new st(n));var r=this.writeTree_.findRootMostValueAndPath(t);if(null!=r){var i=r.path,o=r.value,a=B.relativePath(i,t);return o=o.updateChild(a,n),new e(this.writeTree_.set(i,o))}var s=new st(n);return new e(this.writeTree_.setTree(t,s))},e.prototype.addWrites=function(e,t){var n=this;return M(t,(function(t,r){n=n.addWrite(e.child(t),r)})),n},e.prototype.removeWrite=function(t){return t.isEmpty()?e.Empty:new e(this.writeTree_.setTree(t,st.Empty))},e.prototype.hasCompleteWrite=function(e){return null!=this.getCompleteNode(e)},e.prototype.getCompleteNode=function(e){var t=this.writeTree_.findRootMostValueAndPath(e);return null!=t?this.writeTree_.get(t.path).getChild(B.relativePath(t.path,e)):null},e.prototype.getCompleteChildren=function(){var e=[],t=this.writeTree_.value;return null!=t?t.isLeafNode()||t.forEachChild(ke,(function(t,n){e.push(new me(t,n))})):this.writeTree_.children.inorderTraversal((function(t,n){null!=n.value&&e.push(new me(t,n.value))})),e},e.prototype.childCompoundWrite=function(t){if(t.isEmpty())return this;var n=this.getCompleteNode(t);return new e(null!=n?new st(n):this.writeTree_.subtree(t))},e.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},e.prototype.apply=function(e){return function e(t,n,r){if(null!=n.value)return r.updateChild(t,n.value);var i=null;return n.children.inorderTraversal((function(n,o){".priority"===n?(s.assert(null!==o.value,"Priority writes must al
1ways be leaf nodes"),i=o.value):r=e(t.child(n),o,r)})),r.getChild(t).isEmpty()||null===i||(r=r.updateChild(t.child(".priority"),i)),r}(B.Empty,this.writeTree_,e)},e.Empty=new e(new st(null)),e}();var St=function(){function e(){this.visibleWrites_=Tt.Empty,this.allWrites_=[],this.lastWriteId_=-1}return e.prototype.childWrites=function(e){return new Ct(e,this)},e.prototype.addOverwrite=function(e,t,n,r){s.assert(n>this.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:e,snap:t,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(e,t)),this.lastWriteId_=n},e.prototype.addMerge=function(e,t,n){s.assert(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:e,children:t,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(e,t),this.lastWriteId_=n},e.prototype.getWrite=function(e){for(var t=0;t<this.allWrites_.length;t++){var n=this.allWrites_[t];if(n.writeId===e)return n}return null},e.prototype.removeWrite=function(e){var t=this,n=this.allWrites_.findIndex((function(t){return t.writeId===e}));s.assert(n>=0,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[n];this.allWrites_.splice(n,1);for(var i=r.visible,o=!1,a=this.allWrites_.length-1;i&&a>=0;){var u=this.allWrites_[a];u.visible&&(a>=n&&this.recordContainsPath_(u,r.path)?i=!1:r.path.contains(u.path)&&(o=!0)),a--}if(i){if(o)return this.resetTree_(),!0;r.snap?this.visibleWrites_=this.visibleWrites_.removeWrite(r.path):M(r.children,(function(e){t.visibleWrites_=t.visibleWrites_.removeWrite(r.path.child(e))}));return!0}return!1},e.prototype.getCompleteWriteData=function(e){return this.visibleWrites_.getCompleteNode(e)},e.prototype.calcCompleteEventCache=function(t,n,r,i){if(r||i){var o=this.visibleWrites_.childCompoundWrite(t);if(!i&&o.isEmpty())return n;if(i||null!=n||o.hasCompleteWrite(B.Empty)){var a=e.layerTree_(this.allWrites_,(function(e){return(e.visible||i)&&(!r||!~r.indexOf(e.writeId))&&(e.path.contains(t)||t.contains(e.path))}),t);c=n||qe.EMPTY_NODE;return a.apply(c)}return null}var s=this.visibleWrites_.getCompleteNode(t);if(null!=s)return s;var u=this.visibleWrites_.childCompoundWrite(t);if(u.isEmpty())return n;if(null!=n||u.hasCompleteWrite(B.Empty)){var c=n||qe.EMPTY_NODE;return u.apply(c)}return null},e.prototype.calcCompleteEventChildren=function(e,t){var n=qe.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(e);if(r)return r.isLeafNode()||r.forEachChild(ke,(function(e,t){n=n.updateImmediateChild(e,t)})),n;if(t){var i=this.visibleWrites_.childCompoundWrite(e);return t.forEachChild(ke,(function(e,t){var r=i.childCompoundWrite(new B(e)).apply(t);n=n.updateImmediateChild(e,r)}
1)),i.getCompleteChildren().forEach((function(e){n=n.updateImmediateChild(e.name,e.node)})),n}return this.visibleWrites_.childCompoundWrite(e).getCompleteChildren().forEach((function(e){n=n.updateImmediateChild(e.name,e.node)})),n},e.prototype.calcEventCacheAfterServerOverwrite=function(e,t,n,r){s.assert(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=e.child(t);if(this.visibleWrites_.hasCompleteWrite(i))return null;var o=this.visibleWrites_.childCompoundWrite(i);return o.isEmpty()?r.getChild(t):o.apply(r.getChild(t))},e.prototype.calcCompleteChild=function(e,t,n){var r=e.child(t),i=this.visibleWrites_.getCompleteNode(r);return null!=i?i:n.isCompleteForChild(t)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(t)):null},e.prototype.shadowingWrite=function(e){return this.visibleWrites_.getCompleteNode(e)},e.prototype.calcIndexedSlice=function(e,t,n,r,i,o){var a,s=this.visibleWrites_.childCompoundWrite(e),u=s.getCompleteNode(B.Empty);if(null!=u)a=u;else{if(null==t)return[];a=s.apply(t)}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},e.prototype.recordContainsPath_=function(e,t){if(e.snap)return e.path.contains(t);for(var n in e.children)if(e.children.hasOwnProperty(n)&&e.path.child(n).contains(t))return!0;return!1},e.prototype.resetTree_=function(){this.visibleWrites_=e.layerTree_(this.allWrites_,e.DefaultFilter_,B.Empty),this.allWrites_.length>0?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},e.DefaultFilter_=function(e){return e.visible},e.layerTree_=function(e,t,n){for(var r=Tt.Empty,i=0;i<e.length;++i){var o=e[i];if(t(o)){var a=o.path,u=void 0;if(o.snap)n.contains(a)?(u=B.relativePath(n,a),r=r.addWrite(u,o.snap)):a.contains(n)&&(u=B.relativePath(a,n),r=r.addWrite(B.Empty,o.snap.getChild(u)));else{if(!o.children)throw s.assertionError("WriteRecord should have .snap or .children");if(n.contains(a))u=B.relativePath(n,a),r=r.addWrites(u,o.children);else if(a.contains(n))if((u=B.relativePath(a,n)).isEmpty())r=r.addWrites(B.Empty,o.children);else{var c=s.safeGet(o.children,u.getFront());if(c){var l=c.getChild(u.popFront());r=r.addWrite(B.Empty,l)}}}}}return r},e}(),Ct=function(){function e(e,t){this.treePath_=e,this.writeTree_=t}return e.prototype.calcCompleteEventCache=function(e,t,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,e,t,n)},e.prototype.calcCompleteEventChildren=function(e){return this.writeTree_.calcCompleteEventChildren(this.treePath_,e)},e.prototype.calcEventCacheAfterServerOverwrite=function(e,t,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,e,t,n)},e.prototype.shadowingWrite=function(e){return this.writeTree_.shadowingWrite(this.treePath_.child(e))},e.prototype.calcIndexedSlice=function(e,t,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,e,t,n,r,i)},e.prototype.calcCompleteChild=function(e,t){return this.writeTree_.calcCompleteChild(this.treePath_,e,t)},e.prototype.child=function(t){return new e(this.treePath_.child(t),this.writeTree_)},e}(),It=function(){function e(e){this.listenProvider_=e,this.syncPointTree_=st.Empty,this.pendingWriteTree_=new St,this.tagToQueryMap=new Map,this.queryToTagMap=new Map}return e.prototype.applyUserOverwrite=function(e,t,n,r){return this.pendingWriteTree_.addOverwrite(e,t,n,r),r?this.applyOperationToSyncPoints_(new ct(it.User,e,t)):[]},e.prototype.applyUserMerge=function(e,t,n){this.pendingWriteTree_.addMerge(e,t,n);var r=st.fromObject(t);return this.applyOperationToSyncPoints_(new lt(it.User,e,r))},e.prototype.ackUserWrite=function(e,t){void 0===t&&(t=!1);var n=this.pendingWriteTree_.getWrite(e);if(this.pendingWriteTree_.removeWrite(e)){var r=st.Empty;return null!=n.snap?r=r.set(B.Empty,!0):M(n.children,(function(e,t){r=r.set(new B(e),t)})),this.applyOperationToSyncPoints_(new ot(n.path,r,t))}return[]},e.prototype.applyServerOverwrite=function(e,t){return this.applyOperationToSyncPoints_(new ct(it.Server,e,t))},e.prototype.applyServerMerge=function(e,t){var n=st.fromObject(t);return this.applyOperationToSyncPoints_(new lt(it.Server,e,n))},e.prototype.applyListenComplete=function(e){return this.applyOperationToSyncPoints_(new ut(it.Server,e))},e.prototype.applyTaggedQueryOverwrite=function(t,n,r){var i=this.queryKeyForTag_(r);if(null!=i){var o=e.parseQueryKey_(i),a=o.path,s=o.queryId,u=B.relativePath(a,t),c=new ct(it.forServerTaggedQuery(s),u,n);return this.applyTaggedOperation_(a,c)}return[]},e.prototype.applyTaggedQueryMerge=function(t,n,r){var i=this.queryKeyForTag_(r);if(i){var o=e.parseQueryKey_(i),a=o.path,s=o.queryId,u=B.relativePath(a,t),c=st.fromObject(n),l=new lt(it.forServerTaggedQuery(s),u,c);return this.applyTaggedOperation_(a,l)}return[]},e.prototype.applyTaggedListenComplete=function(t,n){var r=this.queryKeyForTag_(n);if(r){var i=e.parseQueryKey_(r),o=i.path,a=i.queryId,s=B.relativePath(o,t),u=new ut(it.forServerTaggedQuery(a),s);return this.applyTaggedOperation_(o,u)}return[]},e.prototype.addEventRegistration=function(t,n){var r=t.path,i=null,o=!1;this.syncPointTree_.foreachOnPath(r,(function(e,t){var n=B.relativePath(e,r);i=i||t.getCompleteServerCache(n),o=o||t.hasCompleteView()}));var a,u=this.syncPointTree_.get(r);(u?(o=o||u.hasCompleteView(),i=i||u.getCompleteServerCache(B.Empty)):(u=new Et,this.syncPointTree_=this.syncPointTree_.set(r,u)),null!=i)?a=!0:(a=!1,i=qe.EMPTY_NODE,this.syncPointTree_.subtree(r).foreachChild((function(e,t){var n=t.getCompleteServerCache(B.Empty);n&&(i=i.updateImmediateChild(e,n))})));var c=u.viewExistsForQuery(t);if(!c&&!t.getQueryParams().loadsAllData()){var l=e.makeQueryKey_(t);s.assert(!this.queryToTagMap.has(l),"View does not exist, but we have a tag");var h=e.getNextQueryTag_();this.queryToTagMap.set(l,h),this.tagToQueryMap.set(h,l)}var f=this.pendingWriteTree_.childWrites(r),p=u.addEventRegistration(t,n,f,i,a);if(!c&&!o){var d=u.viewForQuery(t);p=p.concat(this.setupListener_(t,d))}return p},e.prototype.removeEventRegistration=function(t,n,r){var i=this,o=t.path,a=this.syncPointTree_.get(o),s=[];
1if(a&&("default"===t.queryIdentifier()||a.viewExistsForQuery(t))){var u=a.removeEventRegistration(t,n,r);a.isEmpty()&&(this.syncPointTree_=this.syncPointTree_.remove(o));var c=u.removed;s=u.events;var l=-1!==c.findIndex((function(e){return e.getQueryParams().loadsAllData()})),h=this.syncPointTree_.findOnPath(o,(function(e,t){return t.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 m=p[d],y=m.getQuery(),g=this.createListenerForView_(m);this.listenProvider_.startListening(e.queryForListening_(y),this.tagForQuery_(y),g.hashFn,g.onComplete)}}if(!h&&c.length>0&&!r)if(l){this.listenProvider_.stopListening(e.queryForListening_(t),null)}else c.forEach((function(t){var n=i.queryToTagMap.get(e.makeQueryKey_(t));i.listenProvider_.stopListening(e.queryForListening_(t),n)}));this.removeTags_(c)}return s},e.prototype.calcCompleteEventCache=function(e,t){var n=this.pendingWriteTree_,r=this.syncPointTree_.findOnPath(e,(function(t,n){var r=B.relativePath(t,e),i=n.getCompleteServerCache(r);if(i)return i}));return n.calcCompleteEventCache(e,r,t,!0)},e.prototype.collectDistinctViewsForSubTree_=function(e){return e.fold((function(e,t,n){if(t&&t.hasCompleteView())return[t.getCompleteView()];var r=[];return t&&(r=t.getQueryViews()),M(n,(function(e,t){r=r.concat(t)})),r}))},e.prototype.removeTags_=function(t){for(var n=0;n<t.length;++n){var r=t[n];if(!r.getQueryParams().loadsAllData()){var i=e.makeQueryKey_(r),o=this.queryToTagMap.get(i);this.queryToTagMap.delete(i),this.tagToQueryMap.delete(o)}}},e.queryForListening_=function(e){return e.getQueryParams().loadsAllData()&&
1!e.getQueryParams().isDefault()?e.getRef():e},e.prototype.setupListener_=function(t,n){var r=t.path,i=this.tagForQuery_(t),o=this.createListenerForView_(n),a=this.listenProvider_.startListening(e.queryForListening_(t),i,o.hashFn,o.onComplete),u=this.syncPointTree_.subtree(r);if(i)s.assert(!u.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var c=u.fold((function(e,t,n){if(!e.isEmpty()&&t&&t.hasCompleteView())return[t.getCompleteView().getQuery()];var r=[];return t&&(r=r.concat(t.getQueryViews().map((function(e){return e.getQuery()})))),M(n,(function(e,t){r=r.concat(t)})),r})),l=0;l<c.length;++l){var h=c[l];this.listenProvider_.stopListening(e.queryForListening_(h),this.tagForQuery_(h))}return a},e.prototype.createListenerForView_=function(e){var t=this,n=e.getQuery(),r=this.tagForQuery_(n);return{hashFn:function(){return(e.getServerCache()||qe.EMPTY_NODE).hash()},onComplete:function(e){if("ok"===e)return r?t.applyTaggedListenComplete(n.path,r):t.applyListenComplete(n.path);var i=function(e,t){var n="Unknown Error";"too_big"===e?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==e?n="Client doesn't have permission to access the desired data.":"unavailable"==e&&(n="The service is unavailable");var r=new Error(e+" at "+t.path.toString()+": "+n);return r.code=e.toUpperCase(),r}(e,n);return t.removeEventRegistration(n,null,i)}}},e.makeQueryKey_=function(e){return e.path.toString()+"$"+e.queryIdentifier()},e.parseQueryKey_=function(e){var t=e.indexOf("$");return s.assert(-1!==t&&t<e.length-1,"Bad queryKey."),{queryId:e.substr(t+1),path:new B(e.substr(0,t))}},e.prototype.queryKeyForTag_=function(e){return this.tagToQueryMap.get(e)},e.prototype.tagForQuery_=function(t){var n=e.makeQueryKey_(t);return this.queryToTagMap.get(n)},e.getNextQueryTag_=function(){return e.nextQueryTag_++},e.prototype.applyTaggedOperation_=function(e,t){var n=this.syncPointTree_.get(e);s.assert(n,"Missing sync point for query tag that we're tracking");var r=this.pendingWriteTree_.childWrites(e);return n.applyOperation(t,r,null)},e.prototype.applyOperationToSyncPoints_=function(e){return this.applyOperationHelper_(e,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(B.Empty))},e.prototype.applyOperationHelper_=function(e,t,n,r){if(e.path.isEmpty())return this.applyOperationDescendantsHelper_(e,t,n,r);var i=t.get(B.Empty);null==n&&null!=i&&(n=i.getCompleteServerCache(B.Empty));var o=[],a=e.path.getFront(),s=e.operationForChild(a),u=t.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(e,r,n))),o},e.prototype.applyOperationDescendantsHelper_=function(e,t,n,r){var i=this,o=t.get(B.Empty);null==n&&null!=o&&(n=o.getCompleteServerCache(B.Empty));var a=[];return t.children.inorderTraversal((function(t,o){var s=n?n.getImmediateChild(t):null,u=r.child(t),c=e.operationForChild(t);c&&(a=a.concat(i.applyOperationDescendantsHelper_(c,o,s,u)))})),o&&(a=a.concat(o.applyOperation(e,r,n))),a},e.nextQueryTag_=1,e}(),kt=function(){function e(){this.rootNode_=qe.EMPTY_NODE}return e.prototype.getNode=function(e){return this.rootNode_.getChild(e)},e.prototype.updateSnapshot=function(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)},e}(),Nt=function(){function e(e){this.app_=e}return e.prototype.getToken=function(e){return this.app_.INTERNAL.getToken(e).then(null,(function(e){return e&&"auth/token-not-initialized"===e.code?(E("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(e)}))},e.prototype.addTokenChangeListener=function(e){this.app_.INTERNAL.addAuthTokenListener(e)},e.prototype.removeTokenChangeListener=function(e){this.app_.INTERNAL.removeAuthTokenListener(e)},e.prototype.notifyForInvalidToken=function(){var e='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?e+='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?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',I(e)},e}(),At=function(){return function(e){this.accessToken=e}}(),Dt=function(){function e(e){this.app_=e}return e.prototype.getToken=function(e){return Promise.resolve(new At("owner"))},e.prototype.addTokenChangeListener=function(e){},e.prototype.removeTokenChangeListener=function(e){},e.prototype.notifyForInvalidToken=function(){I('Database emulator unex
1pectedly rejected fake "owner" credentials.')},e}(),Rt=function(){function e(){this.counters_={}}return e.prototype.incrementCounter=function(e,t){void 0===t&&(t=1),s.contains(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t},e.prototype.get=function(){return s.deepCopy(this.counters_)},e}(),Ot=function(){function e(){}return e.getCollection=function(e){var t=e.toString();return this.collections_[t]||(this.collections_[t]=new Rt),this.collections_[t]},e.getOrCreateReporter=function(e,t){var n=e.toString();return this.reporters_[n]||(this.reporters_[n]=t()),this.reporters_[n]},e.collections_={},e.reporters_={},e}(),Pt=function(){function e(e){this.collection_=e,this.last_=null}return e.prototype.get=function(){var e=this.collection_.get(),t=a.__assign({},e);return this.last_&&M(this.last_,(function(e,n){t[e]=t[e]-n})),this.last_=e,t},e}(),xt=1e4,Mt=3e4,Lt=function(){function e(e,t){this.server_=t,this.statsToReport_={},this.statsListener_=new Pt(e);var n=xt+(Mt-xt)*Math.random();j(this.reportStats_.bind(this),Math.floor(n))}return e.prototype.includeStat=function(e){this.statsToReport_[e]=!0},e.prototype.reportStats_=function(){var e=this,t=this.statsListener_.get(),n={},r=!1;M(t,(function(t,i){i>0&&s.contains(e.statsToReport_,t)&&(n[t]=i,r=!0)})),r&&this.server_.reportStats(n),j(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},e}(),Ft=function(){function e(){this.eventLists_=[],this.recursionDepth_=0}return e.prototype.queueEvents=function(e){for(var t=null,n=0;n<e.length;n++){var r=e[n],i=r.getPath();null===t||i.equals(t.getPath())||(this.eventLists_.push(t),t=null),null===t&&(t=new Ut(i)),t.add(r)}t&&this.eventLists_.push(t)},e.prototype.raiseEventsAtPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_((function(t){return t.equals(e)}))},e.prototype.raiseEventsForChangedPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_((function(t){return t.contains(e)||e.contains(t)}))},e.prototype.raiseQueuedEventsMatchingPredicate_=function(e){this.recursionDepth_++;for(var t=!0,n=0;n<this.eventLists_.length;n++){var r=this.eventLists_[n];if(r)e(r.getPath())?(this.eventLists_[n].raise(),this.eventLists_[n]=null):t=!1}t&&(this.eventLists_=[]),this.recursionDepth_--},e}(),Ut=function(){function e(e){this.path_=e,this.events_=[]}return e.prototype.add=function(e){this.events_.push(e)},e.prototype.raise=function(){for(var e=0;e<this.events_.length;e++){var t=this.events_[e];if(null!==t){this.events_[e]=null;var n=t.getEventRunner();b&&E("event: "+t.toString()),q(n)}}},e.prototype.getPath=function(){return this.path_},e}(),qt=function(){function e(e){this.allowedEvents_=e,this.listeners_={},s.assert(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}return e.prototype.trigger=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(Array.isArray(this.listeners_[e]))for(var r=a.__spread(this.listeners_[e]),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,t)},e.prototype.on=function(e,t,n){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:t,context:n});var r=this.getInitialEvent(e);r&&t.apply(n,r)},e.prototype.off=function(e,t,n){this.validateEventType_(e);for(var r=this.listeners_[e]||[],i=0;i<r.length;i++)if(r[i].callback===t&&(!n||n===r[i].context))return void r.splice(i,1)},e.prototype.validateEventType_=function(e){s.assert(this.allowedEvents_.find((function(t){return t===e})),"Unknown event: "+e)},e}(),Vt=function(e){function t(){var t,n,r=e.call(this,["visible"])||this;return"undefined"!==typeof document&&"undefined"!==typeof document.addEventListener&&("undefined"!==typeof document.hidden?(n="visibilitychange",t="hidden"):"undefined"!==typeof document.mozHidden?(n="mozvisibilitychange",t="mozHidden"):"undefined"!==typeof document.msHidden?(n="msvisibilitychange",t="msHidden"):"undefined"!==typeof document.webkitHidden&&(n="webkitvisibilitychange",t="webkitHidden")),r.visible_=!0,n&&document.addEventListener(n,(function(){var e=!document[t];e!==r.visible_&&(r.visible_=e,r.trigger("visible",e))}),!1),r}return a.__extends(t,e),t.getInstance=function(){return new t},t.prototype.getInitialEvent=function(e){return s.assert("visible"===e,"Unknown event type: "+e),[this.visible_]},t}(qt),jt=function(e){function t(){var t=e.call(this,["online"])||this;return t.online_=!0,"undefined"===typeof window||"undefined"===typeof window.addEventListener||s.isMobileCordova()||(window.addEventListener("online",(function(){t.online_||(t.online_=!0,t.trigger("online",!0))}),!1),window.addEventListener("offline",(function(){t.online_&&(t.online_=!1,t.trigger("online",!1))}),!1)),t}return a.__extends(t,e),t.getInstance=function(){return new t},t.prototype.getInitialEvent=function(e){return s.assert("online"===e,"Unknown event type: "+e),[this.online_]},t.prototype.currentlyOnline=function(){return this.online_},t}(qt),Bt=function(){function e(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}return e.prototype.closeAfter=function(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},e.prototype.handleResponse=function(e,t){var n=this;this.pendingResponses[e]=t;for(var r=function(){var e=i.pendingResponses[i.currentResponseNum];delete i.pendingResponses[i.currentResponseNum];for(var t=function(t){e[t]&&q((function(){n.onMessage_(e[t])}))},r=0;r<e.length;++r)t(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}},e}(),Wt="pLPCommand",Qt="pRTLPCB",Kt=function(){function e(e,t,n,r){this.connId=e,this.repoInfo=t,this.transportSessionId=n,this.lastSessionId=r,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=T(e),this.stats_=Ot.getCollection(t),this.urlFn=function(e){return t.connectionURL(Q,e)}}return e.prototype.open=function(e,t){var n=this;this.curSegmentNum=0,this.onDisconnect_=t,this.myPacketOrderer=new Bt(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout((function(){n.log_("Timed out trying to connect."),n.onClosed_(),n.connectTimeoutTimer_=null}),Math.floor(3e4)),function(e){if(s.isNodeSdk()||"complete"===document.readyState)e();else{var t=!1,n=function n(){document.body?t||(t=!0,e()):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 zt((function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=a.__read(e,5),i=r[0],o=r[1],s=r[2];r[3],r[4];if(n.incrementIncomingBytes_(e),n.scriptTagHolder)if(n.connectTimeoutTimer_&&(clearTimeout(n.connectTimeoutTimer_),n.connectTimeoutTimer_=null),n.everConnected_=!0,"start"==i)n.id=o,n.password=s;else{if("close"!==i)throw new Error("Unrecognized command received: "+i);o?(n.scriptTagHolder.sendNewPolls=!1,n.myPacketOrderer.closeAfter(o,(function(){n.onClosed_()}))):n.onClosed_()}}),(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=a.__read(e,2),i=r[0],o=r[1];n.incrementIncomingBytes_(e),n.myPacketOrderer.handleResponse(i,o)}),(function(){n.onClosed_()}),n.urlFn);var e={start:"t"};e.ser=Math.floor(1e8*Math.random()),n.scriptTagHolder.uniqueCallbackIdentifier&&(e.cb=n.scriptTagHolder.uniqueCallbackIdentifier),e.v="5",n.transportSessionId&&(e.s=n.transportSessionId),n.lastSessionId&&(e.ls=n.lastSessionId),!s.isNodeSdk()&&"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(e.r="f");var t=n.urlFn(e);n.log_("Connecting via long-poll to "+t),n.scriptTagHolder.addTag(t,(function(){}))}}))},e.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},e.forceAllow=function(){e.forceAllow_=!0},e.forceDisallow=function(){e.forceDisallow_=!0},e.isAvailable=function(){return e.forceAllow_||!e.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)&&!s.isNodeSdk()},e.prototype.markConnectionHealthy=function(){},e.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)},e.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},e.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},e.prototype.send=function(e){var t=s.stringify(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);for(var n=s.base64Encode(t),r=x(n,1840),i=0;i<r.length;i++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,r.length,r[i]),this.curSegmentNum++},e.prototype.addDisconnectPingFrame=function(e,t){if(!s.isNodeSdk()){this.myDisconnFrame=document.createElement("iframe");var n={dframe:"t"};n.id=e,n.pw=t,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}},e.prototype.incrementIncomingBytes_=function(e){var t=s.stringify(e).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)},e}(),zt=function(){function e(t,n,r,i){if(this.onDisconnect=r,this.urlFn=i,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,s.isNodeSdk())this.commandCB=t,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=y(),window[Wt+this.uniqueCallbackIdentifier]=t,window[Qt+this.uniqueCallbackIdentifier]=n,this.myIFrame=e.createI
1Frame_();var o="";if(this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length))o='<script>document.domain="'+document.domain+'";<\/script>';var a="<html><body>"+o+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(a),this.myIFrame.doc.close()}catch(u){E("frame writing exception"),u.stack&&E(u.stack),E(u)}}}return e.createIFrame_=function(){var e=document.createElement("iframe");if(e.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(e);try{e.contentWindow.document||E("No IE domain setting required")}catch(n){var t=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+t+"';document.close();})())"}return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e},e.prototype.close=function(){var t=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout((function(){null!==t.myIFrame&&(document.body.removeChild(t.myIFrame),t.myIFrame=null)}),Math.floor(0))),s.isNodeSdk()&&this.myID){var n={disconn:"t"};n.id=this.myID,n.pw=this.myPW;var r=this.urlFn(n);e.nodeRestRequest(r)}var i=this.onDisconnect;i&&(this.onDisconnect=null,i())},e.prototype.startLongPoll=function(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.newRequest_(););},e.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var e={};e.id=this.myID,e.pw=this.myPW,e.ser=this.currentSerial;for(var t=this.urlFn(e),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 t+=n,this.addLongPollTag_(t,this.currentSerial),!0}return!1},e.prototype.enqueueSegment=function(e,t,n){this.pendingSegs.push({seg:e,ts:t,d:n}),this.alive&&this.newRequest_()},e.prototype.addLongPollTag_=function(e,t){var n=this;this.outstandingRequests.add(t);var r=function(){n.outstandingRequests.delete(t),n.newRequest_()},i=setTimeout(r,Math.floor(25e3));this.addTag(e,(function(){clearTimeout(i),r()}))},e.prototype.addTag=function(e,t){var n=this;s.isNodeSdk()?this.doNodeLongPoll(e,t):setTimeout((function(){try{if(!n.sendNewPolls)return;var r=n.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=e,r.onload=r.onreadystatechange=function(){var e=r.readyState;e&&"loaded"!==e&&"complete"!==e||(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),t())},r.onerror=function(){E("Long-poll script failed to load: "+e),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(r)}catch(i){}}),Math.floor(1))},e}(),Ht="";var Gt=null;"undefined"!==typeof MozWebSocket?Gt=MozWebSocket:"undefined"!==typeof WebSocket&&(Gt=WebSocket);var Yt=function(){function e(t,n,r,i){this.connId=t,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=T(this.connId),this.stats_=Ot.getCollection(n),this.connURL=e.connectionURL_(n,r,i)}return e.connectionURL_=function(e,t,n){var r={v:"5"};return!s.isNodeSdk()&&"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(r.r="f"),t&&(r.s=t),n&&(r.ls=n),e.connectionURL("websocket",r)},e.prototype.open=function(e,t){var n=this;this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,f.set("previous_websocket_failure",!0);try{if(s.isNodeSdk()){var i=s.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",o={headers:{"User-Agent":"Firebase/5/"+Ht+"/"+r.platform+"/"+i}},a=Object({NODE_ENV:"production",PUBLIC_URL:""}),u=0==this.connURL.indexOf("wss://")?a.HTTPS_PROXY||a.https_proxy:a.HTTP_PROXY||a.http_proxy;u&&(o.proxy={origin:u}),this.mySock=new Gt(this.connURL,[],o)}else this.mySock=new Gt(this.connURL)}catch(l){this.log_("Error instantiating WebSocket.");var c=l.message||l.data;return c&&this.log_(c),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0}
1,this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(e){n.handleIncomingFrame(e)},this.mySock.onerror=function(e){n.log_("WebSocket error.  Closing connection.");var t=e.message||e.data;t&&n.log_(t),n.onClosed_()}},e.prototype.start=function(){},e.forceDisallow=function(){e.forceDisallow_=!0},e.isAvailable=function(){var t=!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&&(t=!0)}return!t&&null!==Gt&&!e.forceDisallow_},e.previouslyFailed=function(){return f.isInMemoryStorage||!0===f.get("previous_websocket_failure")},e.prototype.markConnectionHealthy=function(){f.remove("previous_websocket_failure")},e.prototype.appendFrame_=function(e){if(this.frames.push(e),this.frames.length==this.totalFrames){var t=this.frames.join("");this.frames=null;var n=s.jsonEval(t);this.onMessage(n)}},e.prototype.handleNewFrameCount_=function(e){this.totalFrames=e,this.frames=[]},e.prototype.extractFrameCount_=function(e){if(s.assert(null===this.frames,"We already have a frame buffer"),e.length<=6){var t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e},e.prototype.handleIncomingFrame=function(e){if(null!==this.mySock){var t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(t);else{var n=this.extractFrameCount_(t);null!==n&&this.appendFrame_(n)}}},e.prototype.send=function(e){this.resetKeepAlive();var t=s.stringify(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);var n=x(t,16384);n.length>1&&this.sendString_(String(n.length));for(var r=0;r<n.length;r++)this.sendString_(n[r])},e.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},e.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},e.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},e.prototype.resetKeepAlive=function(){var e=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval((function(){e.mySock&&e.sendString_("0"),e.resetKeepAlive()}),Math.floor(45e3))},e.prototype.sendString_=function(e){try{this.mySock.send(e)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}},e.responsesRequiredToBeHealthy=2,e.healthyTimeout=3e4,e}(),Xt=function(){function e(e){this.initTransports_(e)}return Object.defineProperty(e,"ALL_TRANSPORTS",{get:function(){return[Kt,Yt]},enumerable:!0,configurable:!0}),e.prototype.initTransports_=function(t){var n,r,i=Yt&&Yt.isAvailable(),o=i&&!Yt.previouslyFailed();if(t.webSocketOnly&&(i||I("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),o=!0),o)this.transports_=[Yt];else{var s=this.transports_=[];try{for(var u=a.__values(e.ALL_TRANSPORTS),c=u.next();!c.done;c=u.next()){var l=c.value;l&&l.isAvailable()&&s.push(l)}}catch(h){n={error:h}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}},e.prototype.initialTransport=function(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")},e.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},e}(),Jt=function(){function e(e,t,n,r,i,o,a){this.id=e,this.repoInfo_=t,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_=T("c:"+this.id+":"),this.transportManager_=new Xt(t),this.log_("Connection created"),this.start_()}return e.prototype.start_=function(){var e=this,t=this.transportManager_.initialTransport();this.conn_=new t(this.nextTransportId_(),this.repoInfo_,void 0,this.lastSessionId),this.primaryResponsesRequired_=t.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(){e.conn_&&e.conn_.open(n,r)}),Math.floor(0));var i=t.healthyTimeout||0;i>0&&(this.healthyTimeout_=j((function(){e.healthyTimeout_=null,e.isHealthy_||(e.conn_&&e.conn_.bytesReceived>
1102400?(e.log_("Connection exceeded healthy timeout but has received "+e.conn_.bytesReceived+" bytes.  Marking connection healthy."),e.isHealthy_=!0,e.conn_.markConnectionHealthy()):e.conn_&&e.conn_.bytesSent>10240?e.log_("Connection exceeded healthy timeout but has sent "+e.conn_.bytesSent+" bytes.  Leaving connection alive."):(e.log_("Closing unhealthy connection after timeout."),e.close()))}),Math.floor(i)))},e.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},e.prototype.disconnReceiver_=function(e){var t=this;return function(n){e===t.conn_?t.onConnectionLost_(n):e===t.secondaryConn_?(t.log_("Secondary connection lost."),t.onSecondaryConnectionLost_()):t.log_("closing an old connection")}},e.prototype.connReceiver_=function(e){var t=this;return function(n){2!=t.state_&&(e===t.rx_?t.onPrimaryMessageReceived_(n):e===t.secondaryConn_?t.onSecondaryMessageReceived_(n):t.log_("message on old connection"))}},e.prototype.sendRequest=function(e){var t={t:"d",d:e};this.sendData_(t)},e.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)},e.prototype.onSecondaryControl_=function(e){if("t"in e){var t=e.t;"a"===t?this.upgradeIfSecondaryHealthy_():"r"===t?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===t&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},e.prototype.onSecondaryMessageReceived_=function(e){var t=O("t",e),n=O("d",e);if("c"==t)this.onSecondaryControl_(n);else{if("d"!=t)throw new Error("Unknown protocol layer: "+t);this.pendingDataMessages.push(n)}},e.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:{}}}))},e.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()},e.prototype.onPrimaryMessageReceived_=function(e){var t=O("t",e),n=O("d",e);"c"==t?this.onControl_(n):"d"==t&&this.onDataMessage_(n)},e.prototype.onDataMessage_=function(e){this.onPrimaryResponse_(),this.onMessage_(e)},e.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},e.prototype.onControl_=function(e){var t=O("t",e);if("d"in e){var n=e.d;if("h"===t)this.onHandshake_(n);else if("n"===t){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"===t?this.onConnectionShutdown_(n):"r"===t?this.onReset_(n):"e"===t?S("Server Error: "+n):"o"===t?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):S("Unknown control packet command: "+t)}},e.prototype.onHandshake_=function(e){var t=e.ts,n=e.v,r=e.h;this.sessionId=e.s,this.repoInfo_.updateHost(r),0==this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),"5"!==n&&I("Protocol version mismatch detected"),this.tryStartUpgrade_())},e.prototype.tryStartUpgrade_=function(){var e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)},e.prototype.startUpgrade_=function(e){var t=this;this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),j((function(){t.secondaryConn_&&(t.log_("Timed out trying to upgrade."),t.secondaryConn_.close())}),Math.floor(6e4))},e.prototype.onReset_=function(e){this.log_("Reset packet received.  New host: "+e),this.repoInfo_.updateHost(e),1===this.state_?this.close():(this.closeConnections_(),this.start_())},e.prototype.onConnectionEstablished_=function(e,t){var n=this;this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(t,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):j((function(){n.sendPingOnPrimaryIfNecessary_()}),Math.floor(5e3))},e.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},e.prototype.onSecondaryConnectionLost_=function(){var e=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==e&&this.rx_!==e||this.close()},e.prototype.onConnectionLost_=function(e){this.conn_=null,e||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()},e.prototype.onConnectionShutdown_=function(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()},e.prototype.sendData_=function(e){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(e)},e.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},e.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)},e}(),$t=function(){function e(){}return e.prototype.put=function(e,t,n,r){},e.prototype.merge=function(e,t,n,r){},e.prototype.refreshAuthToken=function(e){},e.prototype.onDisconnectPut=function(e,t,n){},e.prototype.onDisconnectMerge=function(e,t,n){},e.prototype.onDisconnectCancel=function(e,t){},e.prototype.reportStats=function(e){},e}(),Zt=1e3,en=3e5,tn=function(e){function t(n,r,i,o,a,u){var c=e.call(this)||this;if(c.repoInfo_=n,c.onDataUpdate_=r,c.onConnectStatus_=i,c.onServerInfoUpdate_=o,c.authTokenProvider_=a,c.authOverride_=u,c.id=t.nextPersistentConnectionId_++,c.log_=T("p:"+c.id+":"),c.interruptReasons_={},c.listens=new Map,c.outstandingPuts_=[],c.outstandingPutCount_=0,c.onDisconnectRequestQueue_=[],c.connected_=!1,c.reconnectDelay_=Zt,c.maxReconnectDelay_=en,c.securityDebugCallback_=null,c.lastSessionId=null,c.establishConnectionTimer_=null,c.visible_=!1,
1c.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&&!s.isNodeSdk())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return c.scheduleConnect_(0),Vt.getInstance().on("visible",c.onVisible_,c),-1===n.host.indexOf("fblocal")&&jt.getInstance().on("online",c.onOnline_,c),c}return a.__extends(t,e),t.prototype.sendRequest=function(e,t,n){var r=++this.requestNumber_,i={r:r,a:e,b:t};this.log_(s.stringify(i)),s.assert(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)},t.prototype.listen=function(e,t,n,r){var i=e.queryIdentifier(),o=e.path.toString();this.log_("Listen called for "+o+" "+i),this.listens.has(o)||this.listens.set(o,new Map),s.assert(e.getQueryParams().isDefault()||!e.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),s.assert(!this.listens.get(o).has(i),"listen() called twice for same path/queryId.");var a={onComplete:r,hashFn:t,query:e,tag:n};this.listens.get(o).set(i,a),this.connected_&&this.sendListen_(a)},t.prototype.sendListen_=function(e){var n=this,r=e.query,i=r.path.toString(),o=r.queryIdentifier();this.log_("Listen on "+i+" for "+o);var a={p:i};e.tag&&(a.q=r.queryObject(),a.t=e.tag),a.h=e.hashFn(),this.sendRequest("q",a,(function(a){var s=a.d,u=a.s;t.warnOnListenWarnings_(s,r),(n.listens.get(i)&&n.listens.get(i).get(o))===e&&(n.log_("listen response",a),"ok"!==u&&n.removeListen_(i,o),e.onComplete&&e.onComplete(u,s))}))},t.warnOnListenWarnings_=function(e,t){if(e&&"object"===typeof e&&s.contains(e,"w")){var n=s.safeGet(e,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){var r='".indexOn": "'+t.getQueryParams().getIndex().toString()+'"',i=t.path.toString();I("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.")}}},t.prototype.refreshAuthToken=function(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},(function(){})),this.reduceReconnectDelayIfAdminCredential_(e)},t.prototype.reduceReconnectDelayIfAdminCredential_=function(e){(e&&40===e.length||s.isAdmin(e))&&(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},t.prototype.tryAuth=function(){var e=this;if(this.connected_&&this.authToken_){var t=this.authToken_,n=s.isValidFormat(t)?"auth":"gauth",r={cred:t};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";e.authToken_===t&&("ok"===r?e.invalidAuthTokenCount_=0:e.onAuthRevoked_(r,i))}))}},t.prototype.unlisten=function(e,t){var n=e.path.toString(),r=e.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),s.assert(e.getQueryParams().isDefault()||!e.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,e.queryObject(),t)},t.prototype.sendUnlisten_=function(e,t,n,r){this.log_("Unlisten on "+e+" for "+t);var i={p:e};r&&(i.q=n,i.t=r),this.sendRequest("n",i)},t.prototype.onDisconnectPut=function(e,t,n){this.connected_?this.sendOnDisconnect_("o",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:n})},t.prototype.onDisconnectMerge=function(e,t,n){this.connected_?this.sendOnDisconnect_("om",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:n})},t.prototype.onDisconnectCancel=function(e,t){this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})},t.prototype.sendOnDisconnect_=function(e,t,n,r){var i={p:t,d:n};this.log_("onDisconnect "+e,i),this.sendRequest(e,i,(function(e){r&&setTimeout((function(){r(e.s,e.d)}),Math.floor(0))}))},t.prototype.put=function(e,t,n,r){this.putInternal("p",e,t,n,r)},t.prototype.merge=function(e,t,n,r){this.putInternal("m",e,t,n,r)},t.prototype.putInternal=function(e,t,n,r,i){var o={p:t,d:n};void 0!==i&&(o.h=i),this.outstandingPuts_.push({action:e,request:o,onComplete:r}),this.outstandingPutCount_++;var a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+t)},t.prototype.sendPut_=function(e){var t=this,n=this.outstandingPuts_[e].action,r=this.outstandingPuts_[e].request,i=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(n,r,(function(r){t.log_(n+" response",r),delete t.outstandingPuts_[e],t.outstandingPutCount_--,0===t.outstandingPutCount_&&(t.outstandingPuts_=[]),i&&i(r.s,r.d)}))},t.prototype.reportStats=function(e){var t=this;if(this.connected_){var n={c:e};this.log_("reportStats",n),this.sendRequest("s",n,(function(e){if("ok"!==e.s){var n=e.d;t.log_("reportStats","Error sending stats: "+n)}}))}},t.prototype.onDataMessage_=function(e){if("r"in e){this.log_("from server: "+s.stringify(e));var t=e.r,n=this.requestCBHash_[t];n&&(delete this.requestCBHash_[t],n(e.b))}else{if("error"in e)throw"A server-side error has occurred: "+e.error;"a"in e&&this.onDataPush_(e.a,e.b)}},t.prototype.onDataPush_=function(e,t){this.log_("handleServerMessage",e,t),"d"===e?this.onDataUpdate_(t.p,t.d,!1,t.t):"m"===e?this.onDataUpdate_(t.p,t.d,!0,t.t):"c"===e?this.onListenRevoked_(t.p,t.q):"ac"===e?this.onAuthRevoked_(t.s,t.d):"sd"===e?this.onSecurityDebugPacket_(t):S("Unrecognized action received from server: "+s.stringify(e)+"\nAre you using the latest client?")},t.prototype.onReady_=function(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)},t.prototype.scheduleConnect_=function(e){var t=this;s.assert(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout((function(){t.establishConnectionTimer_=null,t.establishConnection_()}),Math.floor(e))},t.prototype.onVisible_=function(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=Zt,this.realtime_||this.scheduleConnect_(0)),this.visible_=e},t.prototype.onOnline_=function(e){e?(this.log_("Browser went online."),this.reconnectDelay_=Zt,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&&this.realtime_.close())},t.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_=Zt),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();var e=(new Date).getTime()-this.lastConnectionAttemptTime_,t=Math.max(0,this.reconnectDelay_-e);
1t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},t.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+t.nextConnectionId_++,o=this,a=this.lastSessionId,u=!1,c=null,l=function(){c?c.close():(u=!0,r())};this.realtime_={close:l,sendRequest:function(e){s.assert(c,"sendRequest call when we're not connected not allowed."),c.sendRequest(e)}};var h=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(h).then((function(t){u?E("getToken() completed but was canceled"):(E("getToken() completed. Creating connection."),o.authToken_=t&&t.accessToken,c=new Jt(i,o.repoInfo_,e,n,r,(function(e){I(e+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")}),a))})).then(null,(function(e){o.log_("Failed to get token: "+e),u||(s.CONSTANTS.NODE_ADMIN&&I(e),l())}))}},t.prototype.interrupt=function(e){E("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},t.prototype.resume=function(e){E("Resuming connection for reason: "+e),delete this.interruptReasons_[e],s.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=Zt,this.realtime_||this.scheduleConnect_(0))},t.prototype.handleTimestamp_=function(e){var t=e-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:t})},t.prototype.cancelSentTransactions_=function(){for(var e=0;e<this.outstandingPuts_.length;e++){var t=this.outstandingPuts_[e];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])},t.prototype.onListenRevoked_=function(e,t){var n;n=t?t.map((function(e){return P(e)})).join("$"):"default";var r=this.removeListen_(e,n);r&&r.onComplete&&r.onComplete("permission_denied")},t.prototype.removeListen_=function(e,t){var n,r=new B(e).toString();if(this.listens.has(r)){var i=this.listens.get(r);n=i.get(t),i.delete(t),0===i.size&&this.listens.delete(r)}else n=void 0;return n},t.prototype.onAuthRevoked_=function(e,t){E("Auth token revoked: "+e+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==e&&"permission_denied"!==e||(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},t.prototype.onSecurityDebugPacket_=function(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace("\n","\nFIREBASE: "))},t.prototype.restoreState_=function(){var e,t,n,r;this.tryAuth();try{for(var i=a.__values(this.listens.values()),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var u=(n=void 0,a.__values(s.values())),c=u.next();!c.done;c=u.next()){var l=c.value;this.sendListen_(l)}}catch(p){n={error:p}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}}catch(d){e={error:d}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}for(var h=0;h<this.outstandingPuts_.length;h++)this.outstandingPuts_[h]&&this.sendPut_(h);for(;this.onDisconnectRequestQueue_.length;){var f=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(f.action,f.pathString,f.data,f.onComplete)}},t.prototype.sendConnectStats_=function(){var e={},t="js";s.CONSTANTS.NODE_ADMIN?t="admin_node":s.CONSTANTS.NODE_CLIENT&&(t="node"),e["sdk."+t+"."+Ht.replace(/\./g,"-")]=1,s.isMobileCordova()?e["framework.cordova"]=1:s.isReactNative()&&(e["framework.reactnative"]=1),this.reportStats(e)},t.prototype.shouldReconnect_=function(){var e=jt.getInstance().currentlyOnline();return s.isEmpty(this.interruptReasons_)&&e},t.nextPersistentConnectionId_=0,t.nextConnectionId_=0,t}($t),nn=function(e){function t(t,n,r){var i=e.call(this)||this;return i.repoInfo_=t,i.onDataUpdate_=n,i.authTokenProvider_=r,i.log_=T("p:rest:"),i.listens_={},i}return a.__extends(t,e),t.prototype.reportStats=function(e){throw new Error("Method not implemented.")},t.getListenId_=function(e,t){return void 0!==t?"tag$"+t:(s.assert(e.getQueryParams().isDefault(),"should have a tag if it's not a default query."),e.path.toString())},t.prototype.listen=function(e,n,r,i){var o=this,a=e.path.toString();this.log_("Listen called for "+a+" "+e.queryIdentifier());var u=t.getListenId_(e,r),c={};this.listens_[u]=c;var l=e.getQueryParams().toRestQueryStringParameters();this.restRequest_(a+".json",l,(function(e,t){var n=t;(404===e&&(n=null,e=null),null===e&&o.onDataUpdate_(a,n,!1,r),s.safeGet(o.listens_,u)===c)&&i(e?401==e?"permission_denied":"rest_error:"+e:"ok",null)}))},t.prototype.unlisten=function(e,n){var r=t.getListenId_(e,n);delete this.listens_[r]},t.prototype.refreshAuthToken=function(e){},t.prototype.restRequest_=function(e,t,n){var r=this;void 0===t&&(t={}),t.format="export",this.authTokenProvider_.getToken(!1).then((function(i){var o=i&&i.accessToken;o&&(t.auth=o);var a=(r.repoInfo_.secure?"https://":"http://")+r.repoInfo_.host+e+"?ns="+r.repoInfo_.namespace+s.querystring(t);r.log_("Sending REST request for "+a);var u=new XMLHttpRequest;u.onreadystatechange=function(){if(n&&4===u.readyState){r.log_("REST Response for "+a+" received. status:",u.status,"response:",u.responseText);var e=null;if(u.status>=200&&u.status<300){try{e=s.jsonEval(u.responseText)}catch(t){I("Failed to parse JSON response for "+a+": "+u.responseText)}n(null,e)}else 401!==u.status&&404!==u.status&&I("Got unsuccessful REST response for "+a+" Status: "+u.status),n(u.status);n=null}},u.open("GET",a,!0),u.send()}))},t}($t),rn=function(){function e(e,t,n){var i,o=this;if(this.repoInfo_=e,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Ft,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new Ze,this.persistentConnection_=null,i="undefined"!==typeof r&&Object({NODE_ENV:"production",PUBLIC_URL:""}
1)[m]?new Dt(n):new Nt(n),this.stats_=Ot.getCollection(e),t||V())this.server_=new nn(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{s.stringify(a)}catch(u){throw new Error("Invalid authOverride provided: "+u)}}this.persistentConnection_=new tn(this.repoInfo_,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),i,a),this.server_=this.persistentConnection_}i.addTokenChangeListener((function(e){o.server_.refreshAuthToken(e)})),this.statsReporter_=Ot.getOrCreateReporter(e,(function(){return new Lt(o.stats_,o.server_)})),this.transactions_init_(),this.infoData_=new kt,this.infoSyncTree_=new It({startListening:function(e,t,n,r){var i=[],a=o.infoData_.getNode(e.path);return a.isEmpty()||(i=o.infoSyncTree_.applyServerOverwrite(e.path,a),setTimeout((function(){r("ok")}),0)),i},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new It({startListening:function(e,t,n,r){return o.server_.listen(e,n,t,(function(t,n){var i=r(t,n);o.eventQueue_.raiseEventsForChangedPath(e.path,i)})),[]},stopListening:function(e,t){o.server_.unlisten(e,t)}})}return e.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},e.prototype.name=function(){return this.repoInfo_.namespace},e.prototype.serverTime=function(){var e=this.infoData_.getNode(new B(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+e},e.prototype.generateServerValues=function(){return(e=(e={timestamp:this.serverTime()})||{}).timestamp=e.timestamp||(new Date).getTime(),e;var e},e.prototype.onDataUpdate_=function(e,t,n,r){this.dataUpdateCount++;var i=new B(e);t=this.interceptServerDataCallback_?this.interceptServerDataCallback_(e,t):t;var o=[];if(r)if(n){var a=s.map(t,(function(e){return Be(e)}));o=this.serverSyncTree_.applyTaggedQueryMerge(i,a,r)}else{var u=Be(t);o=this.serverSyncTree_.applyTaggedQueryOverwrite(i,u,r)}else if(n){var c=s.map(t,(function(e){return Be(e)}));o=this.serverSyncTree_.applyServerMerge(i,c)}else{var l=Be(t);o=this.serverSyncTree_.applyServerOverwrite(i,l)}var h=i;o.length>0&&(h=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(h,o)},e.prototype.interceptServerData_=function(e){this.interceptServerDataCallback_=e},e.prototype.onConnectStatus_=function(e){this.updateInfo_("connected",e),!1===e&&this.runOnDisconnectEvents_()},e.prototype.onServerInfoUpdate_=function(e){var t=this;M(e,(function(e,n){t.updateInfo_(e,n)}))},e.prototype.updateInfo_=function(e,t){var n=new B("/.info/"+e),r=Be(t);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},e.prototype.getNextWriteId_=function(){return this.nextWriteId_++},e.prototype.setWithPriority=function(e,t,n,r){var i=this;this.log_("set",{path:e.toString(),value:t,priority:n});var o=this.generateServerValues(),a=Be(t,n),s=tt(a,o),u=this.getNextWriteId_(),c=this.serverSyncTree_.applyUserOverwrite(e,s,u,!0);this.eventQueue_.queueEvents(c),this.server_.put(e.toString(),a.val(!0),(function(t,n){var o="ok"===t;o||I("set at "+e+" failed: "+t);var a=i.serverSyncTree_.ackUserWrite(u,!o);i.eventQueue_.raiseEventsForChangedPath(e,a),i.callOnCompleteCallback(r,t,n)}));var l=this.abortTransactions_(e);this.rerunTransactions_(l),this.eventQueue_.raiseEventsForChangedPath(l,[])},e.prototype.update=function(e,t,n){var r=this;this.log_("update",{path:e.toString(),value:t});var i=!0,o=this.generateServerValues(),a={};if(M(t,(function(e,t){i=!1;var n=Be(t);a[e]=tt(n,o)})),i)E("update() called with empty data.  Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var s=this.getNextWriteId_(),u=this.serverSyncTree_.applyUserMerge(e,a,s);this.eventQueue_.queueEvents(u),this.server_.merge(e.toString(),t,(function(t,i){var o="ok"===t;o||I("update at "+e+" failed: "+t);var a=r.serverSyncTree_.ackUserWrite(s,!o),u=a.length>0?r.rerunTransactions_(e):e;r.eventQueue_.raiseEventsForChangedPath(u,a),r.callOnCompleteCallback(n,t,i)})),M(t,(function(t){var n=r.abortTransactions_(e.child(t));r.rerunTransactions_(n)})),this.eventQueue_.raiseEventsForChangedPath(e,[])}},e.prototype.runOnDisconnectEvents_=function(){var e=this;this.log_("onDisconnectEvents");var t=this.generateServerValues(),n=function(e,t){var n=new Ze;return e.forEachTree(new B(""),(function(e,r){n.remember(e,tt(r,t))})),n}(this.onDisconnect_,t),r=[];
1n.forEachTree(B.Empty,(function(t,n){r=r.concat(e.serverSyncTree_.applyServerOverwrite(t,n));var i=e.abortTransactions_(t);e.rerunTransactions_(i)})),this.onDisconnect_=new Ze,this.eventQueue_.raiseEventsForChangedPath(B.Empty,r)},e.prototype.onDisconnectCancel=function(e,t){var n=this;this.server_.onDisconnectCancel(e.toString(),(function(r,i){"ok"===r&&n.onDisconnect_.forget(e),n.callOnCompleteCallback(t,r,i)}))},e.prototype.onDisconnectSet=function(e,t,n){var r=this,i=Be(t);this.server_.onDisconnectPut(e.toString(),i.val(!0),(function(t,o){"ok"===t&&r.onDisconnect_.remember(e,i),r.callOnCompleteCallback(n,t,o)}))},e.prototype.onDisconnectSetWithPriority=function(e,t,n,r){var i=this,o=Be(t,n);this.server_.onDisconnectPut(e.toString(),o.val(!0),(function(t,n){"ok"===t&&i.onDisconnect_.remember(e,o),i.callOnCompleteCallback(r,t,n)}))},e.prototype.onDisconnectUpdate=function(e,t,n){var r=this;if(s.isEmpty(t))return E("onDisconnect().update() called with empty data.  Don't do anything."),void this.callOnCompleteCallback(n,"ok");this.server_.onDisconnectMerge(e.toString(),t,(function(i,o){"ok"===i&&M(t,(function(t,n){var i=Be(n);r.onDisconnect_.remember(e.child(t),i)})),r.callOnCompleteCallback(n,i,o)}))},e.prototype.addEventCallbackForQuery=function(e,t){var n;n=".info"===e.path.getFront()?this.infoSyncTree_.addEventRegistration(e,t):this.serverSyncTree_.addEventRegistration(e,t),this.eventQueue_.raiseEventsAtPath(e.path,n)},e.prototype.removeEventCallbackForQuery=function(e,t){var n;n=".info"===e.path.getFront()?this.infoSyncTree_.removeEventRegistration(e,t):this.serverSyncTree_.removeEventRegistration(e,t),this.eventQueue_.raiseEventsAtPath(e.path,n)},e.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt("repo_interrupt")},e.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume("repo_interrupt")},e.prototype.stats=function(e){if(void 0===e&&(e=!1),"undefined"!==typeof console){var t;e?(this.statsListener_||(this.statsListener_=new Pt(this.stats_)),t=this.statsListener_.get()):t=this.stats_.get();var n=Object.keys(t).reduce((function(e,t){return Math.max(t.length,e)}),0);M(t,(function(e,t){for(var r=e,i=e.length;i<n+2;i++)r+=" ";console.log(r+t)}))}},e.prototype.statsIncrementCounter=function(e){this.stats_.incrementCounter(e),this.statsReporter_.includeStat(e)},e.prototype.log_=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n="";this.persistentConnection_&&(n=this.persistentConnection_.id+":"),E.apply(void 0,a.__spread([n],e))},e.prototype.callOnCompleteCallback=function(e,t,n){e&&q((function(){if("ok"==t)e(null);else{var r=(t||"error").toUpperCase(),i=r;n&&(i+=": "+n);var o=new Error(i);o.code=r,e(o)}}))},Object.defineProperty(e.prototype,"database",{get:function(){return this.__database||(this.__database=new dn(this))},enumerable:!0,configurable:!0}),e}(),on=function(){function e(t){this.indexedFilter_=new dt(t.getIndex()),this.index_=t.getIndex(),this.startPost_=e.getStartPost_(t),this.endPost_=e.getEndPost_(t)}return e.prototype.getStartPost=function(){return this.startPost_},e.prototype.getEndPost=function(){return this.endPost_},e.prototype.matches=function(e){return this.index_.compare(this.getStartPost(),e)<=0&&this.index_.compare(e,this.getEndPost())<=0},e.prototype.updateChild=function(e,t,n,r,i,o){return this.matches(new me(t,n))||(n=qe.EMPTY_NODE),this.indexedFilter_.updateChild(e,t,n,r,i,o)},e.prototype.updateFullNode=function(e,t,n){t.isLeafNode()&&(t=qe.EMPTY_NODE);var r=t.withIndex(this.index_);r=r.updatePriority(qe.EMPTY_NODE);var i=this;return t.forEachChild(ke,(function(e,t){i.matches(new me(e,t))||(r=r.updateImmediateChild(e,qe.EMPTY_NODE))})),this.indexedFilter_.updateFullNode(e,r,n)},e.prototype.updatePriority=function(e,t){return e},e.prototype.filtersNodes=function(){return!0},e.prototype.getIndexedFilter=function(){return this.indexedFilter_},e.prototype.getIndex=function(){return this.index_},e.getStartPost_=function(e){if(e.hasStart()){var t=e.getIndexStartName();return e.getIndex().makePost(e.getIndexStartValue(),t)}return e.getIndex().minPost()},e.getEndPost_=function(e){if(e.hasEnd()){var t=e.getIndexEndName();return e.getIndex().makePost(e.getIndexEndValue(),t)}return e.getIndex().maxPost()},e}
1(),an=function(){function e(e){this.rangedFilter_=new on(e),this.index_=e.getIndex(),this.limit_=e.getLimit(),this.reverse_=!e.isViewFromLeft()}return e.prototype.updateChild=function(e,t,n,r,i,o){return this.rangedFilter_.matches(new me(t,n))||(n=qe.EMPTY_NODE),e.getImmediateChild(t).equals(n)?e:e.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(e,t,n,r,i,o):this.fullLimitUpdateChild_(e,t,n,i,o)},e.prototype.updateFullNode=function(e,t,n){var r;if(t.isLeafNode()||t.isEmpty())r=qe.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<t.numChildren()&&t.isIndexed(this.index_)){r=qe.EMPTY_NODE.withIndex(this.index_);var i=void 0;i=this.reverse_?t.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):t.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=t.withIndex(this.index_)).updatePriority(qe.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(e,t){return l(t,e)}}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,qe.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(e,r,n)},e.prototype.updatePriority=function(e,t){return e},e.prototype.filtersNodes=function(){return!0},e.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},e.prototype.getIndex=function(){return this.index_},e.prototype.fullLimitUpdateChild_=function(e,t,n,r,i){var o;if(this.reverse_){var a=this.index_.getCompare();o=function(e,t){return a(t,e)}}else o=this.index_.getCompare();var u=e;s.assert(u.numChildren()==this.limit_,"");var c=new me(t,n),l=this.reverse_?u.getFirstChild(this.index_):u.getLastChild(this.index_),h=this.rangedFilter_.matches(c);if(u.hasChild(t)){for(var f=u.getImmediateChild(t),p=r.getChildAfterChild(this.index_,l,this.reverse_);null!=p&&(p.name==t||u.hasChild(p.name));)p=r.getChildAfterChild(this.index_,p,this.reverse_);var d=null==p?1:o(p,c);if(h&&!n.isEmpty()&&d>=0)return null!=i&&i.trackChildChange(pt.childChangedChange(t,n,f)),u.updateImmediateChild(t,n);null!=i&&i.trackChildChange(pt.childRemovedChange(t,f));var m=u.updateImmediateChild(t,qe.EMPTY_NODE);return null!=p&&this.rangedFilter_.matches(p)?(null!=i&&i.trackChildChange(pt.childAddedChange(p.name,p.node)),m.updateImmediateChild(p.name,p.node)):m}return n.isEmpty()?e:h&&o(l,c)>=0?(null!=i&&(i.trackChildChange(pt.childRemovedChange(l.name,l.node)),i.trackChildChange(pt.childAddedChange(t,n))),u.updateImmediateChild(t,n).updateImmediateChild(l.name,qe.EMPTY_NODE)):e},e}(),sn=function(){function e(){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_=ke}return e.prototype.hasStart=function(){return this.startSet_},e.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===e.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},e.prototype.getIndexStartValue=function(){return s.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},e.prototype.getIndexStartName=function(){return s.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:N},e.prototype.hasEnd=function(){return this.endSet_},e.prototype.getIndexEndValue=function(){return s.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},e.prototype.getIndexEndName=function(){return s.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:A},e.prototype.hasLimit=function(){return this.limitSet_},e.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},e.prototype.getLimit=function(){return s.assert(this.limitSet_,"Only valid if limit has been set"),this.limit_},e.prototype.getIndex=function(){return this.index_},e.prototype.copy_=function(){var t=new e;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_
1=this.index_,t.viewFrom_=this.viewFrom_,t},e.prototype.limit=function(e){var t=this.copy_();return t.limitSet_=!0,t.limit_=e,t.viewFrom_="",t},e.prototype.limitToFirst=function(t){var n=this.copy_();return n.limitSet_=!0,n.limit_=t,n.viewFrom_=e.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,n},e.prototype.limitToLast=function(t){var n=this.copy_();return n.limitSet_=!0,n.limit_=t,n.viewFrom_=e.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,n},e.prototype.startAt=function(e,t){var n=this.copy_();return n.startSet_=!0,void 0===e&&(e=null),n.indexStartValue_=e,null!=t?(n.startNameSet_=!0,n.indexStartName_=t):(n.startNameSet_=!1,n.indexStartName_=""),n},e.prototype.endAt=function(e,t){var n=this.copy_();return n.endSet_=!0,void 0===e&&(e=null),n.indexEndValue_=e,void 0!==t?(n.endNameSet_=!0,n.indexEndName_=t):(n.endNameSet_=!1,n.indexEndName_=""),n},e.prototype.orderBy=function(e){var t=this.copy_();return t.index_=e,t},e.prototype.getQueryObject=function(){var t=e.WIRE_PROTOCOL_CONSTANTS_,n={};if(this.startSet_&&(n[t.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(n[t.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(n[t.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(n[t.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){n[t.LIMIT]=this.limit_;var r=this.viewFrom_;""===r&&(r=this.isViewFromLeft()?t.VIEW_FROM_LEFT:t.VIEW_FROM_RIGHT),n[t.VIEW_FROM]=r}return this.index_!==ke&&(n[t.INDEX]=this.index_.toString()),n},e.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},e.prototype.isDefault=function(){return this.loadsAllData()&&this.index_==ke},e.prototype.getNodeFilter=function(){return this.loadsAllData()?new dt(this.getIndex()):this.hasLimit()?new an(this):new on(this)},e.prototype.toRestQueryStringParameters=function(){var t,n=e.REST_QUERY_CONSTANTS_,r={};return this.isDefault()?r:(this.index_===ke?t=n.PRIORITY_INDEX:this.index_===Ke?t=n.VALUE_INDEX:this.index_===ve?t=n.KEY_INDEX:(s.assert(this.index_ instanceof ze,"Unrecognized index type!"),t=this.index_.toString()),r[n.ORDER_BY]=s.stringify(t),this.startSet_&&(r[n.START_AT]=s.stringify(this.indexStartValue_),this.startNameSet_&&(r[n.START_AT]+=","+s.stringify(this.indexStartName_))),this.endSet_&&(r[n.END_AT]=s.stringify(this.indexEndValue_),this.endNameSet_&&(r[n.END_AT]+=","+s.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?r[n.LIMIT_TO_FIRST]=this.limit_:r[n.LIMIT_TO_LAST]=this.limit_),r)},e.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"},e.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"},e.DEFAULT=new e,e}(),un=function(e){function t(t,n){if(!(t instanceof rn))throw new Error("new Reference() no longer supported - use app.database().");return e.call(this,t,n,sn.DEFAULT,!1)||this}return a.__extends(t,e),t.prototype.getKey=function(){return s.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},t.prototype.child=function(e){return s.validateArgCount("Reference.child",1,1,arguments.length),"number"===typeof e?e=String(e):e instanceof B||(null===this.path.getFront()?ue("Reference.child",1,e,!1):se("Reference.child",1,e,!1)),new t(this.repo,this.path.child(e))},t.prototype.getParent=function(){s.validateArgCount("Reference.parent",0,0,arguments.length);var e=this.path.parent();return null===e?null:new t(this.repo,e)},t.prototype.getRoot=function(){s.validateArgCount("Reference.root",0,0,arguments.length);for(var e=this;null!==e.getParent();)e=e.getParent();return e},t.prototype.databaseProp=function(){return this.repo.database},t.prototype.set=function(e,t){s.validateArgCount("Reference.set",1,2,arguments.length),ce("Reference.set",this.path),te("Reference.set",1,e,this.path,!1),s.validateCallback("Reference.set",2,t,!0);var n=new s.Deferred;return this.repo.setWithPriority(this.path,e,null,n.wrapCallback(t)),n.promise},t.prototype.update=function(e,t){if(s.validateArgCount("Reference.update",1,2,arguments.length),ce("Reference.update",this.path),Array.isArray(e)){for(var n={},r=0;r<e.length;++r)n[""+r]=e[r];
1e=n,I("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.")}re("Reference.update",1,e,this.path,!1),s.validateCallback("Reference.update",2,t,!0);var i=new s.Deferred;return this.repo.update(this.path,e,i.wrapCallback(t)),i.promise},t.prototype.setWithPriority=function(e,t,n){if(s.validateArgCount("Reference.setWithPriority",2,3,arguments.length),ce("Reference.setWithPriority",this.path),te("Reference.setWithPriority",1,e,this.path,!1),ie("Reference.setWithPriority",2,t,!1),s.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 s.Deferred;return this.repo.setWithPriority(this.path,e,t,r.wrapCallback(n)),r.promise},t.prototype.remove=function(e){return s.validateArgCount("Reference.remove",0,1,arguments.length),ce("Reference.remove",this.path),s.validateCallback("Reference.remove",1,e,!0),this.set(null,e)},t.prototype.transaction=function(e,t,n){if(s.validateArgCount("Reference.transaction",1,3,arguments.length),ce("Reference.transaction",this.path),s.validateCallback("Reference.transaction",1,e,!1),s.validateCallback("Reference.transaction",2,t,!0),he("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 s.Deferred;"function"===typeof t&&r.promise.catch((function(){}));var i=function(e,n,i){e?r.reject(e):r.resolve(new pe(n,i)),"function"===typeof t&&t(e,n,i)};return this.repo.startTransaction(this.path,e,i,n),r.promise},t.prototype.setPriority=function(e,t){s.validateArgCount("Reference.setPriority",1,2,arguments.length),ce("Reference.setPriority",this.path),ie("Reference.setPriority",1,e,!1),s.validateCallback("Reference.setPriority",2,t,!0);var n=new s.Deferred;return this.repo.setWithPriority(this.path.child(".priority"),e,null,n.wrapCallback(t)),n.promise},t.prototype.push=function(e,t){s.validateArgCount("Reference.push",0,2,arguments.length),ce("Reference.push",this.path),te("Reference.push",1,e,this.path,!0),s.validateCallback("Reference.push",2,t,!0);var n,r=this.repo.serverTime(),i=de(r),o=this.child(i),a=this.child(i);return n=null!=e?o.set(e,t).then((function(){return a})):Promise.resolve(a),o.then=n.then.bind(n),o.catch=n.then.bind(n,void 0),"function"===typeof t&&n.catch((function(){})),o},t.prototype.onDisconnect=function(){return ce("Reference.onDisconnect",this.path),new fe(this.repo,this.path)},Object.defineProperty(t.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this.getKey()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this.getParent()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this.getRoot()},enumerable:!0,configurable:!0}),t}($e);$e.__referenceConstructor=un,Et.__referenceConstructor=un;var cn,ln=function(){return function(){this.children={},this.childCount=0,this.value=null}}(),hn=function(){function e(e,t,n){void 0===e&&(e=""),void 0===t&&(t=null),void 0===n&&(n=new ln),this.name_=e,this.parent_=t,this.node_=n}return e.prototype.subTree=function(t){for(var n,r=t instanceof B?t:new B(t),i=this;null!==(n=r.getFront());){i=new e(n,i,s.safeGet(i.node_.children,n)||new ln),r=r.popFront()}return i},e.prototype.getValue=function(){return this.node_.value},e.prototype.setValue=function(e){s.assert("undefined"!==typeof e,"Cannot set value to undefined"),this.node_.value=e,this.updateParents_()},e.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},e.prototype.hasChildren=function(){return this.node_.childCount>0},e.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},e.prototype.forEachChild=function(t){var n=this;M(this.node_.children,(function(r,i){t(new e(r,n,i))}))},e.prototype.forEachDescendant=function(e,t,n){t&&!n&&e(this),this.forEachChild((function(t){t.forEachDescendant(e,!0,n)})),t&&n&&e(this)},e.prototype.forEachAncestor=function(e,t){for(var n=t?this:this.parent();null!==n;){if(e(n))return!0;n=n.parent()}return!1},e.prototype.forEachImmediateDescendantWithValue=function(e){this.forEachChild((function(t){null!==t.getValue()?e(t):t.forEachImmediateDescendantWithValue(e)}))},e.prototype.path=function(){return new B(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},e.prototype.name=function(){return this.name_},e.prototype.parent=function(){return this.parent_},e.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},e.prototype.updateChild_=function(e,t){var n=t.isEmpty(),r=s.contains(this.node_.children,e);n&&r?(delete this.node_.children[e],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[e]=t.node_,this.node_.childCount++,this.updateParents_())},e}();!function(e){e[e.RUN=0]="RUN",e[e.SENT=1]="SENT",e[e.COMPLETED=2]="COMPLETED",e[e.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",e[e.NEEDS_ABORT=4]="NEEDS_ABORT"}(cn||(cn={})),rn.MAX_TRANSACTION_RETRIES_=25,rn.prototype.transactions_init_=function(){this.transactionQueueTree_=new hn},rn.prototype.startTransaction=function(e,t,n,r){this.log_("transaction on "+e);var i=function(){},o=new un(this,e);o.on("value",i);var a={path:e,update:t,onComplete:n,status:null,order:y(),applyLocally:r,retryCount:0,unwatcher:function(){o.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},u=this.getLatestState_(e);a.currentInputSnapshot=u;var c=a.update(u.val());if(void 0===c){if(a.unwatcher(),a.currentOutputSnapshotRaw=null,a.currentOutputSnapshotResolved=null,a.onComplete){var l=new He(a.currentInputSnapshot,new un(this,a.path),ke);a.onComplete(null,!1,l)}}else{ne("transaction failed: Data returned ",c,a.path),a.status=cn.RUN;var h=this.transactionQueueTree_.subTree(e),f=h.getValue()||[];f.push(a),h.setValue(f);var p=void 0;
1if("object"===typeof c&&null!==c&&s.contains(c,".priority"))p=s.safeGet(c,".priority"),s.assert(ee(p),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.");else p=(this.serverSyncTree_.calcCompleteEventCache(e)||qe.EMPTY_NODE).getPriority().val();p=p;var d=this.generateServerValues(),m=Be(c,p),g=tt(m,d);a.currentOutputSnapshotRaw=m,a.currentOutputSnapshotResolved=g,a.currentWriteId=this.getNextWriteId_();var v=this.serverSyncTree_.applyUserOverwrite(e,g,a.currentWriteId,a.applyLocally);this.eventQueue_.raiseEventsForChangedPath(e,v),this.sendReadyTransactions_()}},rn.prototype.getLatestState_=function(e,t){return this.serverSyncTree_.calcCompleteEventCache(e,t)||qe.EMPTY_NODE},rn.prototype.sendReadyTransactions_=function(e){var t=this;if(void 0===e&&(e=this.transactionQueueTree_),e||this.pruneCompletedTransactionsBelowNode_(e),null!==e.getValue()){var n=this.buildTransactionQueue_(e);s.assert(n.length>0,"Sending zero length transaction queue"),n.every((function(e){return e.status===cn.RUN}))&&this.sendTransactionQueue_(e.path(),n)}else e.hasChildren()&&e.forEachChild((function(e){t.sendReadyTransactions_(e)}))},rn.prototype.sendTransactionQueue_=function(e,t){for(var n=this,r=t.map((function(e){return e.currentWriteId})),i=this.getLatestState_(e,r),o=i,a=i.hash(),u=0;u<t.length;u++){var c=t[u];s.assert(c.status===cn.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),c.status=cn.SENT,c.retryCount++;var l=B.relativePath(e,c.path);o=o.updateChild(l,c.currentOutputSnapshotRaw)}var h=o.val(!0),f=e;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<t.length;a++){if(t[a].status=cn.COMPLETED,i=i.concat(n.serverSyncTree_.ackUserWrite(t[a].currentWriteId)),t[a].onComplete){var s=t[a].currentOutputSnapshotResolved,u=new un(n,t[a].path),c=new He(s,u,ke);o.push(t[a].onComplete.bind(null,null,!0,c))}t[a].unwatcher()}n.pruneCompletedTransactionsBelowNode_(n.transactionQueueTree_.subTree(e)),n.sendReadyTransactions_(),n.eventQueue_.raiseEventsForChangedPath(e,i);for(a=0;a<o.length;a++)q(o[a])}else{if("datastale"===r)for(a=0;a<t.length;a++)t[a].status===cn.SENT_NEEDS_ABORT?t[a].status=cn.NEEDS_ABORT:t[a].status=cn.RUN;else{I("transaction at "+f.toString()+" failed: "+r);for(a=0;a<t.length;a++)t[a].status=cn.NEEDS_ABORT,t[a].abortReason=r}n.rerunTransactions_(e)}}),a)},rn.prototype.rerunTransactions_=function(e){var t=this.getAncestorTransactionNode_(e),n=t.path(),r=this.buildTransactionQueue_(t);return this.rerunTransactionQueue_(r,n),n},rn.prototype.rerunTransactionQueue_=function(e,t){if(0!==e.length){for(var n,r=[],i=[],o=e.filter((function(e){return e.status===cn.RUN})).map((function(e){return e.currentWriteId})),a=0;a<e.length;a++){var u=e[a],c=B.relativePath(t,u.path),l=!1,h=void 0;if(s.assert(null!==c,"rerunTransactionsUnderNode_: relativePath should not be null."),u.status===cn.NEEDS_ABORT)l=!0,h=u.abortReason,i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else if(u.status===cn.RUN)if(u.retryCount>=rn.MAX_TRANSACTION_RETRIES_)l=!0,h="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else{var f=this.getLatestState_(u.path,o);u.currentInputSnapshot=f;var p=e[a].update(f.val());if(void 0!==p){ne("transaction failed: Data returned ",p,u.path);var d=Be(p);"object"===typeof p&&null!=p&&s.contains(p,".priority")||(d=d.updatePriority(f.getPriority()));var m=u.currentWriteId,y=this.generateServerValues(),g=tt(d,y);u.currentOutputSnapshotRaw=d,u.currentOutputSnapshotResolved=g,u.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(m),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(u.path,g,u.currentWriteId,u.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(m,!0))}else l=!0,h="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(t,i),i=[],l&&(e[a].status=cn.COMPLETED,n=e[a].unwatcher,setTimeout(n,Math.floor(0)),e[a].onComplete))if("nodata"===h){var v=new un(this,e[a].path),b=e[a].currentInputSnapshot,_=new He(b,v,ke);r.push(e[a].onComplete.bind(null,null,!1,_))}else r.push(e[a].onComplete.bind(null,new Error(h),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(a=0;a<r.length;a++)q(r[a]);this.sendReadyTransactions_()}},rn.prototype.getAncestorTransactionNode_=function(e){for(var t,n=this.transactionQueueTree_;null!==(t=e.getFront())&&null===n.getValue();)n=n.subTree(t),e=e.popFront();return n},rn.prototype.buildTransactionQueue_=function(e){var t=[];return this.aggregateTransactionQueuesForNode_(e,t),t.sort((function(e,t){return e.order-t.order})),t},rn.prototype.aggregateTransactionQueuesForNode_=function(e,t){var n=this,r=e.getValue();if(null!==r)for(var i=0;i<r.length;i++)t.push(r[i]);e.forEachChild((function(e){n.aggregateTransactionQueuesForNode_(e,t)}))},rn.prototype.pruneCompletedTransactionsBelowNode_=function(e){var t=this,n=e.getValue();if(n){for(var r=0,i=0;i<n.length;i++)n[i].status!==cn.COMPLETED&&(n[r]=n[i],r++);n.length=r,e.setValue(n.length>0?n:null)}e.forEachChild((function(e){t.pruneCompletedTransactionsBelowNode_(e)}))},rn.prototype.abortTransactions_=function(e){var t=this,n=this.getAncestorTransactionNode_(e).path(),r=this.transactionQueueTree_.subTree(e);return r.forEachAncestor((function(e){t.abortTransactionsOnNode_(e)})),this.abortTransactionsOnNode_(r),r.forEachDescendant((function(e){t.abortTransactionsOnNode_(e)})),n},rn.prototype.abortTransactionsOnNode_=function(e){var t=e.getValue();if(null!==t){for(var n=[],r=[],i=-1,o=0;o<t.length;o++)if(t[o].status===cn.SENT_NEEDS_ABORT);else if(t[o].status===cn.SENT)s.assert(i===o-1,"All SENT items should be at beginning of queue."),i=o,t[o].status=cn.SENT_NEEDS_ABORT,t[o].abortReason="set";else if(s.assert(t[o].status===cn.RUN,"Unexpected transaction status in abort"),t[o].unwatcher(),r
1=r.concat(this.serverSyncTree_.ackUserWrite(t[o].currentWriteId,!0)),t[o].onComplete){n.push(t[o].onComplete.bind(null,new Error("set"),!1,null))}-1===i?e.setValue(null):t.length=i+1,this.eventQueue_.raiseEventsForChangedPath(e.path(),r);for(o=0;o<n.length;o++)q(n[o])}};var fn,pn=function(){function e(){this.repos_={},this.useRestClient_=!1}return e.getInstance=function(){return fn||(fn=new e),fn},e.prototype.interrupt=function(){for(var e in this.repos_)for(var t in this.repos_[e])this.repos_[e][t].interrupt()},e.prototype.resume=function(){for(var e in this.repos_)for(var t in this.repos_[e])this.repos_[e][t].resume()},e.prototype.databaseFromApp=function(e,t){var n=t||e.options.databaseURL;void 0===n&&C("Can't determine Firebase Database URL.  Be sure to include databaseURL option when calling firebase.initializeApp().");var i=G(n),o=i.repoInfo,a=void 0;return"undefined"!==typeof r&&(a=Object({NODE_ENV:"production",PUBLIC_URL:""})[m]),a&&(n="http://"+a+"?ns="+o.namespace,o=(i=G(n)).repoInfo),le("Invalid Firebase Database URL",1,i),i.path.isEmpty()||C("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(o,e).database},e.prototype.deleteRepo=function(e){var t=s.safeGet(this.repos_,e.app.name);t&&s.safeGet(t,e.repoInfo_.toURLString())===e||C("Database "+e.app.name+"("+e.repoInfo_+") has already been deleted."),e.interrupt(),delete t[e.repoInfo_.toURLString()]},e.prototype.createRepo=function(e,t){var n=s.safeGet(this.repos_,t.name);n||(n={},this.repos_[t.name]=n);var r=s.safeGet(n,e.toURLString());return r&&C("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),r=new rn(e,this.useRestClient_,t),n[e.toURLString()]=r,r},e.prototype.forceRestClient=function(e){this.useRestClient_=e},e}(),dn=function(){function e(e){this.repo_=e,e instanceof rn||C("Don't call new Database() directly - please use firebase.database()."),this.root_=new un(e,B.Empty),this.INTERNAL=new mn(this)}return Object.defineProperty(e.prototype,"app",{get:function(){return this.repo_.app},enumerable:!0,configurable:!0}),e.prototype.ref=function(e){return this.checkDeleted_("ref"),s.validateArgCount("database.ref",0,1,arguments.length),e instanceof un?this.refFromURL(e.toString()):void 0!==e?this.root_.child(e):this.root_},e.prototype.refFromURL=function(e){var t="database.refFromURL";this.checkDeleted_(t),s.validateArgCount(t,1,1,arguments.length);var n=G(e);le(t,1,n);var r=n.repoInfo;return r.host!==this.repo_.repoInfo_.host&&C(t+": Host name does not match the current database: (found "+r.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},e.prototype.checkDeleted_=function(e){null===this.repo_&&C("Cannot call "+e+" on a deleted database.")},e.prototype.goOffline=function(){s.validateArgCount("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},e.prototype.goOnline=function(){s.validateArgCount("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},e.ServerValue={TIMESTAMP:{".sv":"timestamp"}},e}(),mn=function(){function e(e){this.database=e}return e.prototype.delete=function(){return a.__awaiter(this,void 0,void 0,(function(){return a.__generator(this,(function(e){return this.database.checkDeleted_("delete"),pn.getInstance().deleteRepo(this.database.repo_),this.database.repo_=null,this.database.root_=null,this.database.INTERNAL=null,this.database=null,[2]}))}))},e}(),yn=Object.freeze({forceLongPolling:function(){Yt.forceDisallow(),Kt.forceAllow()},forceWebSockets:function(){Kt.forceDisallow()},isWebSocketsAvailable:function(){return Yt.isAvailable()},setSecurityDebugCallback:function(e,t){e.repo.persistentConnection_.securityDebugCallback_=t},stats:function(e,t){e.repo.stats(t)},statsIncrementCounter:function(e,t){e.repo.statsIncrementCounter(t)},dataUpdateCount:function(e){return e.repo.dataUpdateCount},interceptServerData:function(e,t){return e.repo.interceptServerData_(t)}}),gn=tn;tn.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)},tn.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)};var vn=Jt,bn=K,_n=Object.freeze({DataConnection:gn,RealTimeConnection:vn,hijackHash:function(e){var t=tn.prototype.put;return tn.prototype.put=function(n,r,i,o){void 0!==o&&(o=e()),t.call(this,n,r,i,o)},function(){tn.prototype.put=t}},ConnectionTarget:bn,queryIdentifier:function(e){return e.queryIdentifier()},forceRestClient:function(e){pn.getInstance().forceRestClient(e)}}),wn=dn.ServerValue;function En(t){var n;n=t.SDK_VERSION,Ht=n;var r=t.INTERNAL.registerService("database",(function(e,t,n){return pn.getInstance().databaseFromApp(e,n)}),{Reference:un,Query:$e,Database:dn,DataSnapshot:He,enableLogging:w,INTERNAL:yn,ServerValue:wn,TEST_ACCESS:_n},null,!0);s.isNodeSdk()&&(e.exports=r)}En(o),t.DataSnapshot=He,t.Database=dn,t.OnDisconnect=fe,t.Query=$e,t.Reference=un,t.ServerValue=wn,t.enableLogging=w,t.registerDatabase=En}).call(this,n(18))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"===typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"===typeof clearTimeout?clearTimeout:a}catch(e){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 e=s(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++h<t;)u&&u[h].run();h=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);
1if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new d(e,t)),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=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i,o=(r=n(1))&&"object"===typeof r&&"default"in r?r.default:r,a=n(4),s=n(0),u=n(3),c=n(20),l=o.SDK_VERSION,h=new a.Logger("@firebase/firestore");function f(){return h.logLevel===a.LogLevel.DEBUG?i.DEBUG:h.logLevel===a.LogLevel.SILENT?i.SILENT:i.ERROR}function p(e){switch(e){case i.DEBUG:h.logLevel=a.LogLevel.DEBUG;break;case i.ERROR:h.logLevel=a.LogLevel.ERROR;break;case i.SILENT:h.logLevel=a.LogLevel.SILENT;break;default:h.error("Firestore ("+l+"): Invalid value passed to `setLogLevel`")}}function d(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(h.logLevel<=a.LogLevel.DEBUG){var i=n.map(y);h.debug.apply(h,["Firestore ("+l+") ["+e+"]: "+t].concat(i))}}function m(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(h.logLevel<=a.LogLevel.ERROR){var r=t.map(y);h.error.apply(h,["Firestore ("+l+"): "+e].concat(r))}}function y(e){if("string"===typeof e)return e;var t=b.getPlatform();try{return t.formatJSON(e)}catch(n){return e}}function g(e){var t="FIRESTORE ("+l+") INTERNAL ASSERTION FAILED: "+e;throw m(t),new Error(t)}function v(e,t){e||g(t)}!function(e){e[e.DEBUG=0]="DEBUG",e[e.ERROR=1]="ERROR",e[e.SILENT=2]="SILENT"}(i||(i={}));var b=function(){function e(){}return e.setPlatform=function(t){e.platform&&g("Platform already defined"),e.platform=t},e.getPlatform=function(){return e.platform||g("Platform not set"),e.platform},e}();function _(){return b.getPlatform().emptyByteString}var w={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"},E=function(e){function t(t,n){var r=e.call(this,n)||this;return r.code=t,r.message=n,r.name="FirebaseError",r.toString=function(){return r.name+": [code="+r.code+"]: "+r.message},r}return s.__extends(t,e),t}(Error);function T(e,t){function n(){var e="This constructor is private.";throw t&&(e+=" ",e+=t),new E(w.INVALID_ARGUMENT,e)}for(var r in n.prototype=e.prototype,e)e.hasOwnProperty(r)&&(n[r]=e[r]);return n}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e,t){return void 0!==e?e:t}function I(e,t){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Number(n);isNaN(r)||t(r,e[n])}}function k(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function N(e){for(var t in v(null!=e&&"object"===typeof e,"isEmpty() expects object parameter."),e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function A(e,t){if(0!==t.length)throw new E(w.INVALID_ARGUMENT,"Function "+e+"() does not support arguments, but was called with "+H(t.length,"argument")+".")}function D(e,t,n){if(t.length!==n)throw new E(w.INVALID_ARGUMENT,"Function "+e+"() requires "+H(n,"argument")+", but was called with "+H(t.length,"argument")+".")}function R(e,t,n){if(t.length<n)throw new E(w.INVALID_ARGUMENT,"Function "+e+"() requires at least "+H(n,"argument")+", but was called with "+H(t.length,"argument")+".")}function O(e,t,n,r){if(t.length<n||t.length>r)throw new E(w.INVALID_ARGUMENT,"Function "+e+"() requires between "+n+" and "+r+" arguments, but was called with "+H(t.length,"argument")+".")}function P(e,t,n,r){V(e,t,z(n)+" argument",r)}function x(e,t,n,r){void 0!==r&&P(e,t,n,r)}function M(e,t,n,r){V(e,t,n+" option",r)}function L(e,t,n,r){void 0!==r&&M(e,t,n,r)}function F(e,t,n,r,i){void 0!==r&&function(e,t,n,r,i){if(!(r instanceof Array))throw new E(w.INVALID_ARGUMENT,"Function "+e+"() requires its "+t+" option to be an array, but it was: "+B(r));for(var o=0;o<r.length;++o)if(!i(r[o]))throw new E(w.INVALID_ARGUMENT,"Function "+e+"() requires all "+t+" elements to be "+n+", but the value at index "+o+" was: "+B(r[o]))}(e,t,n,r,i)}function U(e,t,n,r,i){void 0!==r&&function(e,t,n,r,i){for(var o=[],a=0,s=i;a<s.length;a++){var u=s[a];if(u===r)return;o.push(B(u))}var c=B(r);throw new E(w.INVALID_ARGUMENT,"Invalid value "+c+" provided to function "+e+'() for option "'+n+'". Acceptable values: '+o.join(", "))}(e,0,n,r,i)}function q(e,t,n,r){if(!t.some((function(e){return e===r})))throw new E(w.INVALID_ARGUMENT,"Invalid value "+B(r)+" provided to function "+e+"() for its "+z(n)+" argument. Acceptable values: "+t.join(", "))}function V(e,t,n,r){if(!("object"===t?j(r):"non-empty string"===t?"string"===typeof r&&""!==r:typeof r===t)){var i=B(r);throw new E(w.INVALID_ARGUMENT,"Function "+e+"() requires its "+n+" to be of type "+t+", but it was: "+i)}}function j(e){return"object"===typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function B(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"===typeof e)return e.length>20&&(e=e.substring(0,20)+"..."),JSON.stringify(e);if("number"===typeof e||"boolean"===typeof e)return""+e;if("object"===typeof e){if(e instanceof Array)return"an array";var t=function(e){if(e.constructor){var t=/function\s+([^\s(]+)\s*\(/.exec(e.constructor.toString());if(t&&t.length>1)return t[1]}return null}(e);return t?"a custom "+t+" object":"an object"}return"function"===typeof e?"a function":g("Unknown wrong type: "+typeof e)}function W(e,t,n){if(void 0===n)throw new E(w.INVALID_ARGUMENT,"Function "+e+"() requires a valid "+z(t)+" argument, but it was undefined.")}function Q(e,t,n){k(t,(function(t,r){if(n.indexOf(t)<0)throw new E(w.INVALID_ARGUMENT,"Unknown option '"+t+"' passed to function "+e+"(). Available options: "+n.join(", "))}))}function K(e,t,n,r){var i=B(r);return new E(w.INVALID_ARGUMENT,"Function "+e+"() requires its "+z(n)+" argument to be a "+t+", but it was: "+i)}function z(e){switch(e){case 1:return"first";
1case 2:return"second";case 3:return"third";default:return e+"th"}}function H(e,t){return e+" "+t+(1===e?"":"s")}var G=function(){function e(){}return e.newId=function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="",n=0;n<20;n++)t+=e.charAt(Math.floor(Math.random()*e.length));return v(20===t.length,"Invalid auto ID: "+t),t},e}();function Y(e,t){return e<t?-1:e>t?1:0}function X(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].isEqual(t[n]))return!1;return!0}function J(e){return e+"\0"}function $(){if("undefined"===typeof Uint8Array)throw new E(w.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function Z(){if(!b.getPlatform().base64Available)throw new E(w.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var ee,te=function(){function e(e){Z(),this._binaryString=e}return e.fromBase64String=function(t){D("Blob.fromBase64String",arguments,1),P("Blob.fromBase64String","string",1,t),Z();try{var n=b.getPlatform().atob(t);return new e(n)}catch(r){throw new E(w.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+r)}},e.fromUint8Array=function(t){if(D("Blob.fromUint8Array",arguments,1),$(),!(t instanceof Uint8Array))throw K("Blob.fromUint8Array","Uint8Array",1,t);var n=Array.prototype.map.call(t,(function(e){return String.fromCharCode(e)})).join("");return new e(n)},e.prototype.toBase64=function(){return D("Blob.toBase64",arguments,0),Z(),b.getPlatform().btoa(this._binaryString)},e.prototype.toUint8Array=function(){D("Blob.toUint8Array",arguments,0),$();for(var e=new Uint8Array(this._binaryString.length),t=0;t<this._binaryString.length;t++)e[t]=this._binaryString.charCodeAt(t);return e},e.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},e.prototype.isEqual=function(e){return this._binaryString===e._binaryString},e.prototype._compareTo=function(e){return Y(this._binaryString,e._binaryString)},e}(),ne=T(te,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),re=function(){return function(e,t,n,r,i){this.databaseId=e,this.persistenceKey=t,this.host=n,this.ssl=r,this.forceLongPolling=i}}(),ie="(default)",oe=function(){function e(e,t){this.projectId=e,this.database=t||ie}return Object.defineProperty(e.prototype,"isDefaultDatabase",{get:function(){return this.database===ie},enumerable:!0,configurable:!0}),e.prototype.isEqual=function(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database},e.prototype.compareTo=function(e){return Y(this.projectId,e.projectId)||Y(this.database,e.database)},e}(),ae=function(){function e(e,t){var n=this;this.previousValue=e,t&&(t.sequenceNumberHandler=function(e){return n.setPreviousValue(e)},this.writeNewSequenceNumber=function(e){return t.writeSequenceNumber(e)})}return e.prototype.setPreviousValue=function(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue},e.prototype.next=function(){var e=++this.previousValue;return this.writeNewSequenceNumber&&this.writeNewSequenceNumber(e),e},e.INVALID=-1,e}(),se=function(){function e(e,t,n){void 0===t?t=0:t>e.length&&g("offset "+t+" out of range "+e.length),void 0===n?n=e.length-t:n>e.length-t&&g("length "+n+" out of range "+(e.length-t)),this.segments=e,this.offset=t,this.len=n}return Object.defineProperty(e.prototype,"length",{get:function(){return this.len},enumerable:!0,configurable:!0}),e.prototype.isEqual=function(t){return 0===e.comparator(this,t)},e.prototype.child=function(t){var n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach((function(e){n.push(e)})):n.push(t),this.construct(n)},e.prototype.limit=function(){return this.offset+this.length},e.prototype.popFirst=function(e){return e=void 0===e?1:e,v(this.length>=e,"Can't call popFirst() with less segments"),this.construct(this.segments,this.offset+e,this.length-e)},e.prototype.popLast=function(){return v(!this.isEmpty(),"Can't call popLast() on empty path"),this.construct(this.segments,this.offset,this.length-1)},e.prototype.firstSegment=function(){return v(!this.isEmpty(),"Can't 
1call firstSegment() on empty path"),this.segments[this.offset]},e.prototype.lastSegment=function(){return this.get(this.length-1)},e.prototype.get=function(e){return v(e<this.length,"Index out of range"),this.segments[this.offset+e]},e.prototype.isEmpty=function(){return 0===this.length},e.prototype.isPrefixOf=function(e){if(e.length<this.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0},e.prototype.isImmediateParentOf=function(e){if(this.length+1!==e.length)return!1;for(var t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0},e.prototype.forEach=function(e){for(var t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])},e.prototype.toArray=function(){return this.segments.slice(this.offset,this.limit())},e.comparator=function(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){var i=e.get(r),o=t.get(r);if(i<o)return-1;if(i>o)return 1}return e.length<t.length?-1:e.length>t.length?1:0},e}(),ue=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s.__extends(t,e),t.prototype.construct=function(e,n,r){return new t(e,n,r)},t.prototype.canonicalString=function(){return this.toArray().join("/")},t.prototype.toString=function(){return this.canonicalString()},t.fromString=function(e){if(e.indexOf("//")>=0)throw new E(w.INVALID_ARGUMENT,"Invalid path ("+e+"). Paths must not contain // in them.");return new t(e.split("/").filter((function(e){return e.length>0})))},t.EMPTY_PATH=new t([]),t}(se),ce=/^[_a-zA-Z][_a-zA-Z0-9]*$/,le=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s.__extends(t,e),t.prototype.construct=function(e,n,r){return new t(e,n,r)},t.isValidIdentifier=function(e){return ce.test(e)},t.prototype.canonicalString=function(){return this.toArray().map((function(e){return e=e.replace("\\","\\\\").replace("`","\\`"),t.isValidIdentifier(e)||(e="`"+e+"`"),e})).join(".")},t.prototype.toString=function(){return this.canonicalString()},t.prototype.isKeyField=function(){return 1===this.length&&"__name__"===this.get(0)},t.keyField=function(){return new t(["__name__"])},t.fromServerFormat=function(e){for(var n=[],r="",i=0,o=function(){if(0===r.length)throw new E(w.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");n.push(r),r=""},a=!1;i<e.length;){var s=e[i];if("\\"===s){if(i+1===e.length)throw new E(w.INVALID_ARGUMENT,"Path has trailing escape character: "+e);var u=e[i+1];if("\\"!==u&&"."!==u&&"`"!==u)throw new E(w.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=u,i+=2}else"`"===s?(a=!a,i++):"."!==s||a?(r+=s,i++):(o(),i++)}if(o(),a)throw new E(w.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new t(n)},t.EMPTY_PATH=new t([]),t}(se),he=function(){function e(t){this.path=t,v(e.isDocumentKey(t),"Invalid DocumentKey with an odd number of segments: "+t.toArray().join("/"))}return e.prototype.hasCollectionId=function(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e},e.prototype.isEqual=function(e){return null!==e&&0===ue.comparator(this.path,e.path)},e.prototype.toString=function(){return this.path.toString()},e.comparator=function(e,t){return ue.comparator(e.path,t.path)},e.isDocumentKey=function(e){return e.length%2===0},e.fromSegments=function(t){return new e(new ue(t.slice()))},e.fromPathString=function(t){return new e(ue.fromString(t))},e.EMPTY=new e(new ue([])),e}(),fe=function(){return function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=n}))}}();!function(e){e.All="all",e.ListenStreamIdle="listen_stream_idle",e.ListenStreamConnectionBackoff="listen_stream_connection_backoff",e.WriteStreamIdle="write_stream_idle",e.WriteStreamConnectionBackoff="write_stream_connection_backoff",e.OnlineStateTimeout="online_state_timeout",e.ClientMetadataRefresh="client_metadata_refresh",e.LruGarbageCollection="lru_garbage_collection",e.RetryTransaction="retry_transaction"}(ee||(ee={}));var pe=function(){function e(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new fe,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(e){}))}return e.createAndSchedule=function(t,n,r,i,o){var a=new e(t,n,Date.now()+r,i,o);return a.start(r),a},e.prototype.start=function(e){var t=this;this.timerHandle=setTimeout((function(){return t.handleDelayElapsed()}),e)},e.prototype.skipDelay=function(){return this.handleDelayElapsed()},e.prototype.cancel=function(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new E(w.CANCELLED,"Operation cancelled"+(e?": "+e:""))))},e.prototype.handleDelayElapsed=function(){var e=this;this.asyncQueue.enqueueAndForget((function(){return null!==e.timerHandle?(e.clearTimeout(),e.op().then((function(t){return e.deferred.resolve(t)}))):Promise.resolve()}))},e.prototype.clearTimeout=function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)},e}(),de=function(){function e(){this.tail=Promise.resolve(),this._isShuttingDown=!1,this.delayedOperations=[],this.failure=null,this.operationInProgress=!1,this.timerIdsToSkip=[]}return Object.defineProperty(e.prototype,"isShuttingDown",{get:function(){return this._isShuttingDown},enumerable:!0,configurable:!0}),e.prototype.enqueueAndForget=function(e){this.enqueue(e)},e.prototype.enqueueAndForgetEvenAfterShutdown=function(e){this.verifyNotFailed(),this.enqueueInternal(e)},e.prototype.enqueueEvenAfterShutdown=function(e){return this.verifyNotFailed(),this.enqueueInternal(e)},e.prototype.enqueueAndInitiateShutdown=function(e){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(t){switch(t.label){case 0:return this.verifyNotFailed(),this._isShuttingDown?[3,2]:(this._isShuttingDown=!0,[4,this.enqueueEvenAfterShutdown(e)]);case 1:t.sent(),t.label=2;case 2:return[2]}}
1))}))},e.prototype.enqueue=function(e){return this.verifyNotFailed(),this._isShuttingDown?new Promise((function(e){})):this.enqueueInternal(e)},e.prototype.enqueueInternal=function(e){var t=this,n=this.tail.then((function(){return t.operationInProgress=!0,e().catch((function(e){t.failure=e,t.operationInProgress=!1;var n=e.stack||e.message||"";throw m("INTERNAL UNHANDLED ERROR: ",n),n.indexOf("Firestore Test Simulated Error")<0&&setTimeout((function(){throw e}),0),e})).then((function(e){return t.operationInProgress=!1,e}))}));return this.tail=n,n},e.prototype.enqueueAfterDelay=function(e,t,n){var r=this;this.verifyNotFailed(),v(t>=0,"Attempted to schedule an operation with a negative delay of "+t),this.timerIdsToSkip.indexOf(e)>-1&&(t=0);var i=pe.createAndSchedule(this,e,t,n,(function(e){return r.removeDelayedOperation(e)}));return this.delayedOperations.push(i),i},e.prototype.verifyNotFailed=function(){this.failure&&g("AsyncQueue is already failed: "+(this.failure.stack||this.failure.message))},e.prototype.verifyOperationInProgress=function(){v(this.operationInProgress,"verifyOpInProgress() called when no op in progress on this queue.")},e.prototype.drain=function(){return this.enqueueEvenAfterShutdown((function(){return Promise.resolve()}))},e.prototype.containsDelayedOperation=function(e){for(var t=0,n=this.delayedOperations;t<n.length;t++){if(n[t].timerId===e)return!0}return!1},e.prototype.runDelayedOperationsEarly=function(e){var t=this;return this.drain().then((function(){v(e===ee.All||t.containsDelayedOperation(e),"Attempted to drain to missing operation "+e),t.delayedOperations.sort((function(e,t){return e.targetTimeMs-t.targetTimeMs}));for(var n=0,r=t.delayedOperations;n<r.length;n++){var i=r[n];if(i.skipDelay(),e!==ee.All&&i.timerId===e)break}return t.drain()}))},e.prototype.skipDelaysForTimerId=function(e){this.timerIdsToSkip.push(e)},e.prototype.removeDelayedOperation=function(e){var t=this.delayedOperations.indexOf(e);v(t>=0,"Delayed operation not found."),this.delayedOperations.splice(t,1)},e}(),me="\x01",ye="\x01",ge="\x10",ve="\x11";function be(e){for(var t="",n=0;n<e.length;n++)t.length>0&&(t=we(t)),t=_e(e.get(n),t);return we(t)}function _e(e,t){for(var n=t,r=e.length,i=0;i<r;i++){var o=e.charAt(i);switch(o){case"\0":n+=me+ge;break;case me:n+=me+ve;break;default:n+=o}}return n}function we(e){return e+me+ye}function Ee(e){var t=e.length;if(v(t>=2,"Invalid path "+e),2===t)return v(e.charAt(0)===me&&e.charAt(1)===ye,"Non-empty path "+e+" had length 2"),ue.EMPTY_PATH;for(var n=t-2,r=[],i="",o=0;o<t;){var a=e.indexOf(me,o);switch((a<0||a>n)&&g('Invalid encoded resource path: "'+e+'"'),e.charAt(a+1)){case ye:var s=e.substring(o,a),u=void 0;0===i.length?u=s:(u=i+=s,i=""),r.push(u);break;case ge:i+=e.substring(o,a),i+="\0";break;case ve:i+=e.substring(o,a+1);break;default:g('Invalid encoded resource path: "'+e+'"')}o=a+2}return new ue(r)}var Te=function(){function e(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new E(w.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new E(w.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new E(w.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new E(w.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}return e.now=function(){return e.fromMillis(Date.now())},e.fromDate=function(t){return e.fromMillis(t.getTime())},e.fromMillis=function(t){var n=Math.floor(t/1e3);return new e(n,1e6*(t-1e3*n))},e.prototype.toDate=function(){return new Date(this.toMillis())},e.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},e.prototype._compareTo=function(e){return this.seconds===e.seconds?Y(this.nanoseconds,e.nanoseconds):Y(this.seconds,e.seconds)},e.prototype.isEqual=function(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds},e.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},e}(),Se=function(){function e(e){this.timestamp=e}return e.fromMicroseconds=function(t){var n=Math.floor(t/1e6);return new e(new Te(n,t%1e6*1e3))},e.fromTimestamp=function(t){return new e(t)},e.forDeletedDoc=function(){return e.MIN},e.prototype.compareTo=function(e){return this.timestamp._compareTo(e.timestamp)},e.prototype.isEqual=function(e){return this.timestamp.isEqual(e.timestamp)},e.prototype.toMicroseconds=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},e.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},e.prototype.toTimestamp=function(){return this.timestamp},e.MIN=new e(new Te(0,0)),e}(),Ce=function(){function e(e,t){this.comparator=e,this.root=t||ke.EMPTY}return e.prototype.insert=function(t,n){return new e(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,ke.BLACK,null,
1null))},e.prototype.remove=function(t){return new e(this.comparator,this.root.remove(t,this.comparator).copy(null,null,ke.BLACK,null,null))},e.prototype.get=function(e){for(var t=this.root;!t.isEmpty();){var n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null},e.prototype.indexOf=function(e){for(var t=0,n=this.root;!n.isEmpty();){var r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1},e.prototype.isEmpty=function(){return this.root.isEmpty()},Object.defineProperty(e.prototype,"size",{get:function(){return this.root.size},enumerable:!0,configurable:!0}),e.prototype.minKey=function(){return this.root.minKey()},e.prototype.maxKey=function(){return this.root.maxKey()},e.prototype.inorderTraversal=function(e){return this.root.inorderTraversal(e)},e.prototype.forEach=function(e){this.inorderTraversal((function(t,n){return e(t,n),!1}))},e.prototype.toString=function(){var e=[];return this.inorderTraversal((function(t,n){return e.push(t+":"+n),!1})),"{"+e.join(", ")+"}"},e.prototype.reverseTraversal=function(e){return this.root.reverseTraversal(e)},e.prototype.getIterator=function(){return new Ie(this.root,null,this.comparator,!1)},e.prototype.getIteratorFrom=function(e){return new Ie(this.root,e,this.comparator,!1)},e.prototype.getReverseIterator=function(){return new Ie(this.root,null,this.comparator,!0)},e.prototype.getReverseIteratorFrom=function(e){return new Ie(this.root,e,this.comparator,!0)},e}(),Ie=function(){function e(e,t,n,r){this.isReverse=r,this.nodeStack=[];for(var i=1;!e.isEmpty();)if(i=t?n(e.key,t):1,r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(0===i){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}return e.prototype.getNext=function(){v(this.nodeStack.length>0,"getNext() called on iterator when hasNext() is false.");var e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(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},e.prototype.hasNext=function(){return this.nodeStack.length>0},e.prototype.peek=function(){if(0===this.nodeStack.length)return null;var e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}},e}(),ke=function(){function e(t,n,r,i,o){this.key=t,this.value=n,this.color=null!=r?r:e.RED,this.left=null!=i?i:e.EMPTY,this.right=null!=o?o:e.EMPTY,this.size=this.left.size+1+this.right.size}return e.prototype.copy=function(t,n,r,i,o){return new e(null!=t?t:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},e.prototype.isEmpty=function(){return!1},e.prototype.inorderTraversal=function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)},e.prototype.reverseTraversal=function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)},e.prototype.min=function(){return this.left.isEmpty()?this:this.left.min()},e.prototype.minKey=function(){return this.min().key},e.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},e.prototype.insert=function(e,t,n){var r=this,i=n(e,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp()},e.prototype.removeMin=function(){if(this.left.isEmpty())return e.EMPTY;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()},e.prototype.remove=function(t,n){var r,i=this;if(n(t,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(t,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(t,i.key)){if(i.right.isEmpty())return e.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(t,n))}return i.fixUp()},e.prototype.isRed=function(){return this.color},e.prototype.fixUp=function(){var e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e},e.prototype.moveRedLeft=function(){var e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e},e.prototype.moveRedRight=function(){var e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e},e.prototype.rotateLeft=function(){var t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},e.prototype.rotateRight=function(){var t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},e.prototype.colorFlip=function(){var e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)},e.prototype.checkMaxDepth=function(){var e=this.check();return Math.pow(2,e)<=this.size+1},e.prototype.check=function(){if(this.isRed()&&this.left.isRed())throw g("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed())throw g("Right child of ("+this.key+","+this.value+") is red");var e=this.left.check();if(e!==this.right.check())throw g("Black depths differ");return e+(this.isRed()?0:1)},e.EMPTY=null,e.RED=!0,e.BLACK=!1,e}(),Ne=function(){function e(){this.size=0}return Object.defineProperty(e.prototype,"key",{get:function(){throw g("LLRBEmptyNode has no key.")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){throw g("LLRBEmptyNode has no value.")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){throw g("LLRBEmptyNode has no color.")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"left",{get:function(){throw g("LLRBEmptyNode has no left child.")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){throw g("LLRBEmptyNode has no right child.")},enumerable:!0,configurable:!0}),e.prototype.copy=function(e,t,n,r,i){return this},e.prototype.insert=function(e,t,n){return new ke(e,t)},e.prototype.remove=function(e,t){return this},e.prototype.isEmpty=function(){return!0},e.prototype.inorderTraversal=function(e){return!1},e.prototype.reverseTraversal=function(e){return!1},e.prototype.minKey=function(){return null},e.prototype.maxKey=function(){return null},e.prototype.isRed=function(){return!1},e.prototype.checkMaxDepth=function(){return!0},e.prototype.check=function(){return 0},e}();
1ke.EMPTY=new Ne;var Ae=function(){function e(e){this.comparator=e,this.data=new Ce(this.comparator)}return e.fromMapKeys=function(t){var n=new e(t.comparator);return t.forEach((function(e){n=n.add(e)})),n},e.prototype.has=function(e){return null!==this.data.get(e)},e.prototype.first=function(){return this.data.minKey()},e.prototype.last=function(){return this.data.maxKey()},Object.defineProperty(e.prototype,"size",{get:function(){return this.data.size},enumerable:!0,configurable:!0}),e.prototype.indexOf=function(e){return this.data.indexOf(e)},e.prototype.forEach=function(e){this.data.inorderTraversal((function(t,n){return e(t),!1}))},e.prototype.forEachInRange=function(e,t){for(var n=this.data.getIteratorFrom(e[0]);n.hasNext();){var r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}},e.prototype.forEachWhile=function(e,t){var n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();){if(!e(n.getNext().key))return}},e.prototype.firstAfterOrEqual=function(e){var t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null},e.prototype.getIterator=function(){return new De(this.data.getIterator())},e.prototype.getIteratorFrom=function(e){return new De(this.data.getIteratorFrom(e))},e.prototype.add=function(e){return this.copy(this.data.remove(e).insert(e,!0))},e.prototype.delete=function(e){return this.has(e)?this.copy(this.data.remove(e)):this},e.prototype.isEmpty=function(){return this.data.isEmpty()},e.prototype.unionWith=function(e){var t=this;return e.forEach((function(e){t=t.add(e)})),t},e.prototype.isEqual=function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.data.getIterator(),r=t.data.getIterator();n.hasNext();){var i=n.getNext().key,o=r.getNext().key;if(0!==this.comparator(i,o))return!1}return!0},e.prototype.toArray=function(){var e=[];return this.forEach((function(t){e.push(t)})),e},e.prototype.toString=function(){var e=[];return this.forEach((function(t){return e.push(t)})),"SortedSet("+e.toString()+")"},e.prototype.copy=function(t){var n=new e(this.comparator);return n.data=t,n},e}(),De=function(){function e(e){this.iter=e}return e.prototype.getNext=function(){return this.iter.getNext().key},e.prototype.hasNext=function(){return this.iter.hasNext()},e}(),Re=new Ce(he.comparator);function Oe(){return Re}function Pe(){return Oe()}var xe=new Ce(he.comparator);function Me(){return xe}var Le=new Ce(he.comparator);function Fe(){return Le}var Ue=new Ae(he.comparator);function qe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=Ue,r=0,i=e;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var Ve=new Ae(Y);function je(){return Ve}var Be=function(){function e(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r,v(r.length>0,"Cannot create an empty mutation batch")}return e.prototype.applyToRemoteDocument=function(e,t,n){t&&v(t.key.isEqual(e),"applyToRemoteDocument: key "+e+" should match maybeDoc key\n        "+t.key);var r=n.mutationResults;v(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(e)){var a=r[i];t=o.applyToRemoteDocument(t,a)}}return t},e.prototype.applyToLocalView=function(e,t){t&&v(t.key.isEqual(e),"applyToLocalDocument: key "+e+" should match maybeDoc key\n        "+t.key);for(var n=0,r=this.baseMutations;n<r.length;n++){(s=r[n]).key.isEqual(e)&&(t=s.applyToLocalView(t,t,this.localWriteTime))}for(var i=t,o=0,a=this.mutations;o<a.length;o++){var s;(s=a[o]).key.isEqual(e)&&(t=s.applyToLocalView(t,i,this.localWriteTime))}return t},e.prototype.applyToLocalDocumentSet=function(e){var t=this,n=e;return this.mutations.forEach((function(r){var i=t.applyToLocalView(r.key,e.get(r.key));i&&(n=n.insert(r.key,i))})),n},e.prototype.keys=function(){return this.mutations.reduce((function(e,t){return e.add(t.key)}),qe())},e.prototype.isEqual=function(e){return this.batchId===e.batchId&&X(this.mutations,e.mutations)&&X(this.baseMutations,e.baseMutations)},e}(),We=function(){function e(e,t,n,r,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.streamToken=r,this.docVersions=i}return e.from=function(t,n,r,i){v(t.mutations.length===r.length,"Mutations sent "+t.mutations.length+" must equal results received "+r.length);for(var o=Fe(),a=t.mutations,s=0;s<a.length;s++)o=o.insert(a[s].key,r[s].version);return new e(t,n,r,i,o)},e}(),Qe=function(){function e(e){var t=this;this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((function(e){t.isDone=!0,t.result=e,t.nextCallback&&t.nextCallback(e)}),(function(e){t.isDone=!0,t.error=e,t.catchCallback&&t.catchCallback(e)}))}return e.prototype.catch=function(e){return this.next(void 0,e)},e.prototype.next=function(t,n){var r=this;return this.callbackAttached&&g("Called next() or catch() twice for PersistencePromise"),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new e((function(e,i){r.nextCallback=function(n){r.wrapSuccess(t,n).next(e,i)},r.catchCallback=function(t){r.wrapFailure(n,t).next(e,i)}}))},e.prototype.toPromise=function(){var e=this;return new Promise((function(t,n){e.next(t,n)}))},e.prototype.wrapUserFunction=function(t){try{var n=t();return n instanceof e?n:e.resolve(n)}catch(r){return e.reject(r)}},e.prototype.wrapSuccess=function(t,n){return t?this.wrapUserFunction((function(){return t(n)})):e.resolve(n)},e.prototype.wrapFailure=function(t,n){return t?this.wrapUserFunction((function(){return t(n)})):e.reject(n)},e.resolve=function(t){return new e((function(e,n){e(t)}))}
1,e.reject=function(t){return new e((function(e,n){n(t)}))},e.waitFor=function(t){return new e((function(e,n){var r=0,i=0,o=!1;t.forEach((function(t){++r,t.next((function(){++i,o&&i===r&&e()}),(function(e){return n(e)}))})),o=!0,i===r&&e()}))},e.or=function(t){for(var n=e.resolve(!1),r=function(t){n=n.next((function(n){return n?e.resolve(n):t()}))},i=0,o=t;i<o.length;i++){r(o[i])}return n},e.forEach=function(e,t){var n=this,r=[];return e.forEach((function(e,i){r.push(t.call(n,e,i))})),this.waitFor(r)},e}(),Ke=function(){function e(e,t,n,r){this.userId=e,this.serializer=t,this.indexManager=n,this.referenceDelegate=r,this.documentKeysByBatchId={}}return e.forUser=function(t,n,r,i){return v(""!==t.uid,"UserID must not be an empty string."),new e(t.isAuthenticated()?t.uid:"",n,r,i)},e.prototype.checkEmpty=function(e){var t=!0,n=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Ye(e).iterate({index:cn.userMutationsIndex,range:n},(function(e,n,r){t=!1,r.done()})).next((function(){return t}))},e.prototype.acknowledgeBatch=function(e,t,n){return this.getMutationQueueMetadata(e).next((function(t){return t.lastStreamToken=Ge(n),Je(e).put(t)}))},e.prototype.getLastStreamToken=function(e){return this.getMutationQueueMetadata(e).next((function(e){return e.lastStreamToken}))},e.prototype.setLastStreamToken=function(e,t){return this.getMutationQueueMetadata(e).next((function(n){return n.lastStreamToken=Ge(t),Je(e).put(n)}))},e.prototype.addMutationBatch=function(e,t,n,r){var i=this,o=Xe(e),a=Ye(e);return a.add({}).next((function(s){v("number"===typeof s,"Auto-generated key is not a number");var u=new Be(s,t,n,r),c=i.serializer.toDbMutationBatch(i.userId,u);i.documentKeysByBatchId[s]=u.keys();for(var l=[],h=0,f=r;h<f.length;h++){var p=f[h],d=ln.key(i.userId,p.key.path,s);l.push(a.put(c)),l.push(o.put(d,ln.PLACEHOLDER)),l.push(i.indexManager.addToCollectionParentIndex(e,p.key.path.popLast()))}
1return Qe.waitFor(l).next((function(){return u}))}))},e.prototype.lookupMutationBatch=function(e,t){var n=this;return Ye(e).get(t).next((function(e){return e?(v(e.userId===n.userId,"Unexpected user '"+e.userId+"' for mutation batch "+t),n.serializer.fromDbMutationBatch(e)):null}))},e.prototype.lookupMutationKeys=function(e,t){var n=this;return this.documentKeysByBatchId[t]?Qe.resolve(this.documentKeysByBatchId[t]):this.lookupMutationBatch(e,t).next((function(e){if(e){var r=e.keys();return n.documentKeysByBatchId[t]=r,r}return null}))},e.prototype.getNextMutationBatchAfterBatchId=function(e,t){var n=this,r=t+1,i=IDBKeyRange.lowerBound([this.userId,r]),o=null;return Ye(e).iterate({index:cn.userMutationsIndex,range:i},(function(e,t,i){t.userId===n.userId&&(v(t.batchId>=r,"Should have found mutation after "+r),o=n.serializer.fromDbMutationBatch(t)),i.done()})).next((function(){return o}))},e.prototype.getHighestUnacknowledgedBatchId=function(e){var t=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),n=-1;return Ye(e).iterate({index:cn.userMutationsIndex,range:t,reverse:!0},(function(e,t,r){n=t.batchId,r.done()})).next((function(){return n}))},e.prototype.getAllMutationBatches=function(e){var t=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return Ye(e).loadAll(cn.userMutationsIndex,n).next((function(e){return e.map((function(e){return t.serializer.fromDbMutationBatch(e)}))}))},e.prototype.getAllMutationBatchesAffectingDocumentKey=function(e,t){var n=this,r=ln.prefixForPath(this.userId,t.path),i=IDBKeyRange.lowerBound(r),o=[];return Xe(e).iterate({range:i},(function(r,i,a){var s=r[0],u=r[1],c=r[2],l=Ee(u);if(s===n.userId&&t.path.isEqual(l))return Ye(e).get(c).next((function(e){if(!e)throw g("Dangling document-mutation reference found: "+r+" which points to "+c);v(e.userId===n.userId,"Unexpected user '"+e.userId+"' for mutation batch "+c),o.push(n.serializer.fromDbMutationBatch(e))}));a.done()})).next((function(){return o}))},e.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,t){var n=this,r=new Ae(Y),i=[];return t.forEach((function(t){var o=ln.prefixForPath(n.userId,t.path),a=IDBKeyRange.lowerBound(o),s=Xe(e).iterate({range:a},(function(e,i,o){var a=e[0],s=e[1],u=e[2],c=Ee(s);a===n.userId&&t.path.isEqual(c)?r=r.add(u):o.done()}));i.push(s)})),Qe.waitFor(i).next((function(){return n.lookupMutationBatches(e,r)}))},e.prototype.getAllMutationBatchesAffectingQuery=function(e,t){var n=this;v(!t.isDocumentQuery(),"Document queries shouldn't go down this path"),v(!t.isCollectionGroupQuery(),"CollectionGroup queries should be handled in LocalDocumentsView");var r=t.path,i=r.length+1,o=ln.prefixForPath(this.userId,r),a=IDBKeyRange.lowerBound(o),s=new Ae(Y);return Xe(e).iterate({range:a},(function(e,t,o){var a=e[0],u=e[1],c=e[2],l=Ee(u);a===n.userId&&r.isPrefixOf(l)?l.length===i&&(s=s.add(c)):o.done()})).next((function(){return n.lookupMutationBatches(e,s)}))},e.prototype.lookupMutationBatches=function(e,t){var n=this,r=[],i=[];return t.forEach((function(t){i.push(Ye(e).get(t).next((function(e){if(null===e)throw g("Dangling document-mutation reference found, which points to "+t);v(e.userId===n.userId,"Unexpected user '"+e.userId+"' for mutation batch "+t),r.push(n.serializer.fromDbMutationBatch(e))})))})),Qe.waitFor(i).next((function(){return r}))},e.prototype.removeMutationBatch=function(e,t){var n=this;return He(e.simpleDbTransaction,this.userId,t).next((function(r){return n.removeCachedMutationKeys(t.batchId),Qe.forEach(r,(function(t){return n.referenceDelegate.removeMutationReference(e,t)}))}))},e.prototype.removeCachedMutationKeys=function(e){delete this.documentKeysByBatchId[e]},e.prototype.performConsistencyCheck=function(e){var t=this;return this.checkEmpty(e).next((function(n){if(!n)return Qe.resolve();
1var r=IDBKeyRange.lowerBound(ln.prefixForUser(t.userId)),i=[];return Xe(e).iterate({range:r},(function(e,n,r){if(e[0]===t.userId){var o=Ee(e[1]);i.push(o)}else r.done()})).next((function(){v(0===i.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+i.map((function(e){return e.canonicalString()})))}))}))},e.prototype.containsKey=function(e,t){return ze(e,this.userId,t)},e.prototype.getMutationQueueMetadata=function(e){var t=this;return Je(e).get(this.userId).next((function(e){return e||new un(t.userId,-1,"")}))},e}();function ze(e,t,n){var r=ln.prefixForPath(t,n.path),i=r[1],o=IDBKeyRange.lowerBound(r),a=!1;return Xe(e).iterate({range:o,keysOnly:!0},(function(e,n,r){var o=e[0],s=e[1];e[2];o===t&&s===i&&(a=!0),r.done()})).next((function(){return a}))}function He(e,t,n){var r=e.store(cn.store),i=e.store(ln.store),o=[],a=IDBKeyRange.only(n.batchId),s=0,u=r.iterate({range:a},(function(e,t,n){return s++,n.delete()}));o.push(u.next((function(){v(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=ln.key(t,f.key.path,n.batchId);o.push(i.delete(p)),c.push(f.key)}
1return Qe.waitFor(o).next((function(){return c}))}function Ge(e){return e instanceof Uint8Array?(v("YES"===Object({NODE_ENV:"production",PUBLIC_URL:""}).USE_MOCK_PERSISTENCE,"Persisting non-string stream tokens is only supported with mock persistence."),e.toString()):e}function Ye(e){return Vn.getStore(e,cn.store)}function Xe(e){return Vn.getStore(e,ln.store)}function Je(e){return Vn.getStore(e,un.store)}var $e,Ze=1;!function(e){e[e.QueryCache=0]="QueryCache",e[e.SyncEngine=1]="SyncEngine"}($e||($e={}));var et=function(){function e(e,t){this.generatorId=e,v((e&Ze)===e,"Generator ID "+e+" contains more than "+Ze+" reserved bits"),this.seek(void 0!==t?t:this.generatorId)}return e.prototype.next=function(){var e=this.nextId;return this.nextId+=1<<Ze,e},e.prototype.after=function(e){return this.seek(e+(1<<Ze)),this.next()},e.prototype.seek=function(e){v((e&Ze)===this.generatorId,"Cannot supply target ID from different generator ID"),this.nextId=e},e.forQueryCache=function(){return new e($e.QueryCache,2)},e.forSyncEngine=function(){return new e($e.SyncEngine)},e}(),tt="SimpleDb",nt=function(){function e(t){this.db=t,12.2===e.getIOSVersion(u.getUA())&&m("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}return e.openOrCreate=function(t,n,r){return v(e.isAvailable(),"IndexedDB not supported in current environment."),d(tt,"Opening database:",t),new Qe((function(i,o){var a=window.indexedDB.open(t,n);a.onsuccess=function(t){var n=t.target.result;i(new e(n))},a.onblocked=function(){o(new E(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(e){var t=e.target.error;"VersionError"===t.name?o(new E(w.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):o(t)},a.onupgradeneeded=function(e){d(tt,'Database "'+t+'" requires upgrade from version:',e.oldVersion);var n=e.target.result,i=new it(a.transaction);r.createOrUpgrade(n,i,e.oldVersion,rn).next((function(){d(tt,"Database upgrade to version "+rn+" complete")}))}})).toPromise()},e.delete=function(e){return d(tt,"Removing database:",e),at(window.indexedDB.deleteDatabase(e)).toPromise()},e.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=u.getUA(),n=e.getIOSVersion(t),r=0<n&&n<10,i=e.getAndroidVersion(t),o=0<i&&i<4.5;return!(t.indexOf("MSIE ")>0||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0||r||o)},e.getStore=function(e,t){return e.store(t)},e.getIOSVersion=function(e){var t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),n=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(n)},e.getAndroidVersion=function(e){var t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)},e.prototype.setVersionChangeListener=function(e){this.db.onversionchange=function(t){return e(t)}},e.prototype.runTransaction=function(e,t,n){var r=it.open(this.db,e,t),i=n(r).catch((function(e){return r.abort(e),Qe.reject(e)})).toPromise();return i.catch((function(){})),r.completionPromise.then((function(){return i}))},e.prototype.close=function(){this.db.close()},e}(),rt=function(){function e(e){this.dbCursor=e,this.shouldStop=!1,this.nextKey=null}return Object.defineProperty(e.prototype,"isDone",{get:function(){return this.shouldStop},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skipToKey",{get:function(){return this.nextKey},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cursor",{set:function(e){this.dbCursor=e},enumerable:!0,configurable:!0}),e.prototype.done=function(){this.shouldStop=!0},e.prototype.skip=function(e){this.nextKey=e},e.prototype.delete=function(){return at(this.dbCursor.delete())},e}(),it=function(){function e(e){var t=this;this.transaction=e,this.aborted=!1,this.completionDeferred=new fe,this.transaction.oncomplete=function(){t.completionDeferred.resolve()},this.transaction.onabort=function(){e.error?t.completionDeferred.reject(e.error):t.completionDeferred.resolve()},this.transaction.onerror=function(e){var n=ut(e.target.error);t.completionDeferred.reject(n)}}return e.open=function(t,n,r){return new e(t.transaction(r,n))},Object.defineProperty(e.prototype,"completionPromise",{get:function(){return this.completionDeferred.promise},enumerable:!0,configurable:!0}),e.prototype.abort=function(e){e&&this.completionDeferred.reject(e),this.aborted||(d(tt,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},e.prototype.store=function(e){var t=this.transaction.objectStore(e);return v(!!t,"Object store not part of transaction: "+e),new ot(t)},e}(),ot=function(){function e(e){this.store=e}return e.prototype.put=function(e,t){var n;return void 0!==t?(d(tt,"PUT",this.store.name,e,t),n=this.store.put(t,e)):(d(tt,"PUT",this.store.name,"<auto-key>",e),n=this.store.put(e)),at(n)},e.prototype.add=function(e){return d(tt,"ADD",this.store.name,e,e),at(this.store.add(e))},e.prototype.get=function(e){var t=this;return at(this.store.get(e)).next((function(n){return void 0===n&&(n=null),d(tt,"GET",t.store.name,e,n),n}))},e.prototype.delete=function(e){return d(tt,"DELETE",this.store.name,e),at(this.store.delete(e))},e.prototype.count=function(){return d(tt,"COUNT",this.store.name),at(this.store.count())},e.prototype.loadAll=function(e,t){var n=this.cursor(this.options(e,t)),r=[];return this.iterateCursor(n,(function(e,t){r.push(t)})).next((function(){return r}))},e.prototype.deleteAll=function(e,t){d(tt,"DELETE ALL",this.store.name);var n=this.options(e,t);n.keysOnly=!1;var r=this.cursor(n);return this.iterateCursor(r,(function(e,t,n){return n.delete()}))},e.prototype.iterate=function(e,t){var n;t?n=e:(n={},t=e);var r=this.cursor(n);return this.iterateCursor(r,t)},e.prototype.iterateSerial=function(e){var t=this.cursor({});return new Qe((function(n,r){t.onerror=function(e){var t=ut(e.target.error);r(t)},t.onsuccess=function(t){var r=t.target.result;r?e(r.primaryKey,r.value).next((function(e){e?r.continue():n()})):n()}}))},e.prototype.iterateCursor=function(e,t){var n=[];return new Qe((function(r,i){e.onerror=function(e){i(e.target.error)},e.onsuccess=function(e){var i=e.target.result;if(i){var o=new rt(i),a=t(i.primaryKey,i.value,o);if(a instanceof Qe){var s=a.catch((function(e){return o.done(),Qe.reject(e)}));n.push(s)}o.isDone?r():null===o.skipToKey?i.continue():i.continue(o.skipToKey)}else r()}}
1)).next((function(){return Qe.waitFor(n)}))},e.prototype.options=function(e,t){var n=void 0;return void 0!==e&&("string"===typeof e?n=e:(v(void 0===t,"3rd argument must not be defined if 2nd is a range."),t=e)),{index:n,range:t}},e.prototype.cursor=function(e){var t="next";if(e.reverse&&(t="prev"),e.index){var n=this.store.index(e.index);return e.keysOnly?n.openKeyCursor(e.range,t):n.openCursor(e.range,t)}return this.store.openCursor(e.range,t)},e}();function at(e){return new Qe((function(t,n){e.onsuccess=function(e){var n=e.target.result;t(n)},e.onerror=function(e){var t=ut(e.target.error);n(t)}}))}var st=!1;function ut(e){var t=nt.getIOSVersion(u.getUA());if(t>=12.2&&t<13){var n="An internal error was encountered in the Indexed Database server";if(e.message.indexOf(n)>=0){var r=new E("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return st||(st=!0,setTimeout((function(){throw r}),0)),r}}return e}var ct=function(){function e(e,t){this.referenceDelegate=e,this.serializer=t,this.targetIdGenerator=et.forQueryCache()}return e.prototype.allocateTargetId=function(e){var t=this;return this.retrieveMetadata(e).next((function(n){return n.highestTargetId=t.targetIdGenerator.after(n.highestTargetId),t.saveMetadata(e,n).next((function(){return n.highestTargetId}))}))},e.prototype.getLastRemoteSnapshotVersion=function(e){return this.retrieveMetadata(e).next((function(e){return Se.fromTimestamp(new Te(e.lastRemoteSnapshotVersion.seconds,e.lastRemoteSnapshotVersion.nanoseconds))}))},e.prototype.getHighestSequenceNumber=function(e){return ft(e.simpleDbTransaction)},e.prototype.setTargetsMetadata=function(e,t,n){var r=this;return this.retrieveMetadata(e).next((function(i){return i.highestListenSequenceNumber=t,n&&(i.lastRemoteSnapshotVersion=n.toTimestamp()),t>i.highestListenSequenceNumber&&(i.highestListenSequenceNumber=t),r.saveMetadata(e,i)}))},e.prototype.addQueryData=function(e,t){var n=this;return this.saveQueryData(e,t).next((function(){return n.retrieveMetadata(e).next((function(r){return r.targetCount+=1,n.updateMetadataFromQueryData(t,r),n.saveMetadata(e,r)}))}))},e.prototype.updateQueryData=function(e,t){return this.saveQueryData(e,t)},e.prototype.removeQueryData=function(e,t){var n=this;return this.removeMatchingKeysForTargetId(e,t.targetId).next((function(){return lt(e).delete(t.targetId)})).next((function(){return n.retrieveMetadata(e)})).next((function(t){return v(t.targetCount>0,"Removing from an empty query cache"),t.targetCount-=1,n.saveMetadata(e,t)}))},e.prototype.removeTargets=function(e,t,n){var r=this,i=0,o=[];return lt(e).iterate((function(a,s){var u=r.serializer.fromDbTarget(s);u.sequenceNumber<=t&&void 0===n[u.targetId]&&(i++,o.push(r.removeQueryData(e,u)))})).next((function(){return Qe.waitFor(o)})).next((function(){return i}))},e.prototype.forEachTarget=function(e,t){var n=this;return lt(e).iterate((function(e,r){var i=n.serializer.fromDbTarget(r);t(i)}))},e.prototype.retrieveMetadata=function(e){return ht(e.simpleDbTransaction)},e.prototype.saveMetadata=function(e,t){return(n=e,Vn.getStore(n,gn.store)).put(gn.key,t);var n},e.prototype.saveQueryData=function(e,t){return lt(e).put(this.serializer.toDbTarget(t))},e.prototype.updateMetadataFromQueryData=function(e,t){var n=!1;return e.targetId>t.highestTargetId&&(t.highestTargetId=e.targetId,n=!0),e.sequenceNumber>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=e.sequenceNumber,n=!0),n},e.prototype.getQueryCount=function(e){return this.retrieveMetadata(e).next((function(e){return e.targetCount}))},e.prototype.getQueryData=function(e,t){var n=this,r=t.canonicalId(),i=IDBKeyRange.bound([r,Number.NEGATIVE_INFINITY],[r,Number.POSITIVE_INFINITY]),o=null;return lt(e).iterate({range:i,index:mn.queryTargetsIndexName},(function(e,r,i){var a=n.serializer.fromDbTarget(r);t.isEqual(a.query)&&(o=a,i.done())})).next((function(){return o}))},e.prototype.addMatchingKeys=function(e,t,n){var r=this,i=[],o=pt(e);return t.forEach((function(t){var a=be(t.path);i.push(o.put(new yn(n,a))),i.push(r.referenceDelegate.addReference(e,t))})),Qe.waitFor(i)},e.prototype.removeMatchingKeys=function(e,t,n){var r=this,i=pt(e);return Qe.forEach(t,(function(t){var o=be(t.path);
1return Qe.waitFor([i.delete([n,o]),r.referenceDelegate.removeReference(e,t)])}))},e.prototype.removeMatchingKeysForTargetId=function(e,t){var n=pt(e),r=IDBKeyRange.bound([t],[t+1],!1,!0);return n.delete(r)},e.prototype.getMatchingKeysForTargetId=function(e,t){var n=IDBKeyRange.bound([t],[t+1],!1,!0),r=pt(e),i=qe();return r.iterate({range:n,keysOnly:!0},(function(e,t,n){var r=Ee(e[1]),o=new he(r);i=i.add(o)})).next((function(){return i}))},e.prototype.containsKey=function(e,t){var n=be(t.path),r=IDBKeyRange.bound([n],[J(n)],!1,!0),i=0;return pt(e).iterate({index:yn.documentTargetsIndex,keysOnly:!0,range:r},(function(e,t,n){var r=e[0];e[1];0!==r&&(i++,n.done())})).next((function(){return i>0}))},e.prototype.getQueryDataForTarget=function(e,t){var n=this;return lt(e).get(t).next((function(e){return e?n.serializer.fromDbTarget(e):null}))},e}();function lt(e){return Vn.getStore(e,mn.store)}function ht(e){return nt.getStore(e,gn.store).get(gn.key).next((function(e){return v(null!==e,"Missing metadata row."),e}))}function ft(e){return ht(e).next((function(e){return e.highestListenSequenceNumber}))}function pt(e){return Vn.getStore(e,yn.store)}var dt,mt=function(){function e(e){this.fields=e}return e.fromSet=function(t){return new e(t)},e.fromArray=function(t){var n=new Ae(le.comparator);return t.forEach((function(e){return n=n.add(e)})),new e(n)},e.prototype.covers=function(e){var t=!1;return this.fields.forEach((function(n){n.isPrefixOf(e)&&(t=!0)})),t},e.prototype.isEqual=function(e){return this.fields.isEqual(e.fields)},e}(),yt=function(){function e(e,t){this.field=e,this.transform=t}return e.prototype.isEqual=function(e){return this.field.isEqual(e.field)&&this.transform.isEqual(e.transform)},e}(),gt=function(){return function(e,t){this.version=e,this.transformResults=t}}();!function(e){e[e.Set=0]="Set",e[e.Patch=1]="Patch",e[e.Transform=2]="Transform",e[e.Delete=3]="Delete"}(dt||(dt={}));var vt,bt,_t=function(){function e(e,t){this.updateTime=e,this.exists=t,v(void 0===e||void 0===t,'Precondition can specify "exists" or "updateTime" but not both')}return e.exists=function(t){return new e(void 0,t)},e.updateTime=function(t){return new e(t)},Object.defineProperty(e.prototype,"isNone",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!0,configurable:!0}),e.prototype.isValidFor=function(e){return void 0!==this.updateTime?e instanceof Wt&&e.version.isEqual(this.updateTime):void 0!==this.exists?this.exists===e instanceof Wt:(v(this.isNone,"Precondition should be empty"),!0)},e.prototype.isEqual=function(e){return t=this.updateTime,n=e.updateTime,(null!==t&&void 0!==t?!(!n||!t.isEqual(n)):t===n)&&this.exists===e.exists;var t,n},e.NONE=new e,e}(),wt=function(){function e(){}return e.prototype.verifyKeyMatches=function(e){null!=e&&v(e.key.isEqual(this.key),"Can only apply a mutation to a document with the same key")},e.getPostMutationVersion=function(e){return e instanceof Wt?e.version:Se.MIN},e}(),Et=function(e){function t(t,n,r){var i=e.call(this)||this;return i.key=t,i.value=n,i.precondition=r,i.type=dt.Set,i}return s.__extends(t,e),t.prototype.applyToRemoteDocument=function(e,t){this.verifyKeyMatches(e),v(null==t.transformResults,"Transform results received by SetMutation.");var n=t.version;return new Wt(this.key,n,{hasCommittedMutations:!0},this.value)},t.prototype.applyToLocalView=function(e,t,n){if(this.verifyKeyMatches(e),!this.precondition.isValidFor(e))return e;var r=wt.getPostMutationVersion(e);return new Wt(this.key,r,{hasLocalMutations:!0},this.value)},t.prototype.extractBaseValue=function(e){return null},t.prototype.isEqual=function(e){return e instanceof t&&this.key.isEqual(e.key)&&this.value.isEqual(e.value)&&this.precondition.isEqual(e.precondition)},t}(wt),Tt=function(e){function t(t,n,r,i){var o=e.call(this)||this;return o.key=t,o.data=n,o.fieldMask=r,o.precondition=i,o.type=dt.Patch,o}return s.__extends(t,e),t.prototype.applyToRemoteDocument=function(e,t){if(this.verifyKeyMatches(e),v(null==t.transformResults,"Transform results received by PatchMutation."),!this.precondition.isValidFor(e))return new Kt(this.key,t.version);var n=this.patchDocument(e);return new Wt(this.key,t.version,{hasCommittedMutations:!0},n)},t.prototype.applyToLocalView=function(e,t,n){if(this.verifyKeyMatches(e),!this.prec
1ondition.isValidFor(e))return e;var r=wt.getPostMutationVersion(e),i=this.patchDocument(e);return new Wt(this.key,r,{hasLocalMutations:!0},i)},t.prototype.extractBaseValue=function(e){return null},t.prototype.isEqual=function(e){return e instanceof t&&this.key.isEqual(e.key)&&this.fieldMask.isEqual(e.fieldMask)&&this.precondition.isEqual(e.precondition)},t.prototype.patchDocument=function(e){var t;return t=e instanceof Wt?e.data():Vt.EMPTY,this.patchObject(t)},t.prototype.patchObject=function(e){var t=this;return this.fieldMask.fields.forEach((function(n){if(!n.isEmpty()){var r=t.data.field(n);e=null!==r?e.set(n,r):e.delete(n)}})),e},t}(wt),St=function(e){function t(t,n){var r=e.call(this)||this;return r.key=t,r.fieldTransforms=n,r.type=dt.Transform,r.precondition=_t.exists(!0),r}return s.__extends(t,e),t.prototype.applyToRemoteDocument=function(e,t){if(this.verifyKeyMatches(e),v(null!=t.transformResults,"Transform results missing for TransformMutation."),!this.precondition.isValidFor(e))return new Kt(this.key,t.version);var n=this.requireDocument(e),r=this.serverTransformResults(e,t.transformResults),i=t.version,o=this.transformObject(n.data(),r);return new Wt(this.key,i,{hasCommittedMutations:!0},o)},t.prototype.applyToLocalView=function(e,t,n){if(this.verifyKeyMatches(e),!this.precondition.isValidFor(e))return e;var r=this.requireDocument(e),i=this.localTransformResults(n,e,t),o=this.transformObject(r.data(),i);return new Wt(this.key,r.version,{hasLocalMutations:!0},o)},t.prototype.extractBaseValue=function(e){for(var t=null,n=0,r=this.fieldTransforms;n<r.length;n++){var i=r[n],o=e instanceof Wt?e.field(i.field):void 0,a=i.transform.computeBaseValue(o||null);
1null!=a&&(t=null==t?Vt.EMPTY.set(i.field,a):t.set(i.field,a))}return t},t.prototype.isEqual=function(e){return e instanceof t&&this.key.isEqual(e.key)&&X(this.fieldTransforms,e.fieldTransforms)&&this.precondition.isEqual(e.precondition)},t.prototype.requireDocument=function(e){v(e instanceof Wt,"Unknown MaybeDocument type "+e);var t=e;return v(t.key.isEqual(this.key),"Can only transform a document with the same key"),t},t.prototype.serverTransformResults=function(e,t){var n=[];v(this.fieldTransforms.length===t.length,"server transform result count ("+t.length+") should match field transform count ("+this.fieldTransforms.length+")");for(var r=0;r<t.length;r++){var i=this.fieldTransforms[r],o=i.transform,a=null;e instanceof Wt&&(a=e.field(i.field)),n.push(o.applyToRemoteDocument(a,t[r]))}return n},t.prototype.localTransformResults=function(e,t,n){for(var r=[],i=0,o=this.fieldTransforms;i<o.length;i++){var a=o[i],s=a.transform,u=null;t instanceof Wt&&(u=t.field(a.field)),null===u&&n instanceof Wt&&(u=n.field(a.field)),r.push(s.applyToLocalView(u,e))}return r},t.prototype.transformObject=function(e,t){v(t.length===this.fieldTransforms.length,"TransformResults length mismatch.");for(var n=0;n<this.fieldTransforms.length;n++){var r=this.fieldTransforms[n].field;e=e.set(r,t[n])}return e},t}(wt),Ct=function(e){function t(t,n){var r=e.call(this)||this;return r.key=t,r.precondition=n,r.type=dt.Delete,r}return s.__extends(t,e),t.prototype.applyToRemoteDocument=function(e,t){return this.verifyKeyMatches(e),v(null==t.transformResults,"Transform results received by DeleteMutation."),new Qt(this.key,t.version,{hasCommittedMutations:!0})},t.prototype.applyToLocalView=function(e,t,n){return this.verifyKeyMatches(e),this.precondition.isValidFor(e)?(e&&v(e.key.isEqual(this.key),"Can only apply mutation to document with same key"),new Qt(this.key,Se.forDeletedDoc())):e},t.prototype.extractBaseValue=function(e){return null},t.prototype.isEqual=function(e){return e instanceof t&&this.key.isEqual(e.key)&&this.precondition.isEqual(e.precondition)},t}(wt);!function(e){e[e.NullValue=0]="NullValue",e[e.BooleanValue=1]="BooleanValue",e[e.NumberValue=2]="NumberValue",e[e.TimestampValue=3]="TimestampValue",e[e.StringValue=4]="StringValue",e[e.BlobValue=5]="BlobValue",e[e.RefValue=6]="RefValue",e[e.GeoPointValue=7]="GeoPointValue",e[e.ArrayValue=8]="ArrayValue",e[e.ObjectValue=9]="ObjectValue"}(vt||(vt={})),function(e){e[e.Default=0]="Default",e[e.Estimate=1]="Estimate",e[e.Previous=2]="Previous"}(bt||(bt={}));var It=function(){function e(e,t){this.serverTimestampBehavior=e,this.timestampsInSnapshots=t}return e.fromSnapshotOptions=function(t,n){switch(t.serverTimestamps){case"estimate":return new e(bt.Estimate,n);case"previous":return new e(bt.Previous,n);case"none":case void 0:return new e(bt.Default,n);default:return g("fromSnapshotOptions() called with invalid options.")}},e}(),kt=function(){function e(){}return e.prototype.toString=function(){var e=this.value();return null===e?"null":e.toString()},e.prototype.defaultCompareTo=function(e){return v(this.typeOrder!==e.typeOrder,"Default compareTo should not be used for values of same type."),Y(this.typeOrder,e.typeOrder)},e}(),Nt=function(e){function t(){var t=e.call(this)||this;return t.typeOrder=vt.NullValue,t.internalValue=null,t}return s.__extends(t,e),t.prototype.value=function(e){return null},t.prototype.isEqual=function(e){return e instanceof t},t.prototype.compareTo=function(e){return e instanceof t?0:this.defaultCompareTo(e)},t.INSTANCE=new t,t}(kt),At=function(e){function t(t){var n=e.call(this)||this;return n.internalValue=t,n.typeOrder=vt.BooleanValue,n}return s.__extends(t,e),t.prototype.value=function(e){return this.internalValue},t.prototype.isEqual=function(e){return e instanceof t&&this.internalValue===e.internalValue},t.prototype.compareTo=function(e){return e instanceof t?Y(this,e):this.defaultCompareTo(e)},t.of=function(e){return e?t.TRUE:t.FALSE},t.TRUE=new t(!0),t.FALSE=new t(!1),t}(kt),Dt=function(e){function t(t){var n=e.call(this)||this;return n.internalValue=t,n.typeOrder=vt.NumberValue,n}return s.__extends(t,e),t.prototype.value=function(e){return this.internalValue},t.prototype.compareTo=function(e){return e instanceof t?(n=this.internalValue,r=e.internalValue,n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1):this.defaultCompareTo(e);var n,r},t}(kt);function Rt(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}var Ot=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s.__extends(t,e),t.prototype.isEqual=function(e){return e instanceof t&&Rt(this.internalValue,e.internalValue)},t}(Dt),Pt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s.__extends(t,e),t.prototype.isEqual=function(e){return e instanceof t&&Rt(this.internalValue,e.internalValue)},t.NAN=new t(NaN),t.POSITIVE_INFINITY=new t(1/0),t.NEGATIVE_INFINITY=new t(-1/0),t}(Dt),xt=function(e){function t(t){var n=e.call(this)||this;return n.internalValue=t,n.typeOrder=vt.StringValue,n}return s.__extends(t,e),t.prototype.value=function(e){return this.internalValue},t.prototype.isEqual=function(e){return e instanceof t&&this.internalValue===e.internalValue},t.prototype.compareTo=function(e){return e instanceof t?Y(this.internalValue,e.internalValue):this.defaultCompareTo(e)},t}(kt),Mt=function(e){function t(t){var n=e.call(this)||this;return n.internalValue=t,n.typeOrder=vt.TimestampValue,n}return s.__extends(t,e),t.prototype.value=function(e){return!e||e.timestampsInSnapshots?this.internalValue:this.internalValue.toDate()},t.prototype.isEqual=function(e){return e instanceof t&&this.internalValue.isEqual(e.internalValue)},t.prototype.compareTo=function(e){return e instanceof t?this.internalValue._compareTo(e.internalValue):e instanceof Lt?-1:this.defaultCompareTo(e)},t}(kt),Lt=function(e){function t(t,n){var r=e.call(this)||this;return r.localWriteTime=t,r.previousValue=n,r.typeOrder=vt.TimestampValue,r}return s.__extends(t,e),t.prototype.value=function(e){return e&&e.serverTimestampBehavior===bt.Estimate?new Mt(this.localWriteTime).value(e):e&&e.serverTimestampBehavior===bt.Previous&&this.previousValue?this.previousValue.value(e):null},t.prototype.isEqual=function(e){return e instanceof t&&this.localWriteTime.isEqual(e.localWriteTime)},t.prototype.compareTo=function(e){return e instanceof t?this.localWriteTime._compareTo(e.localWriteTime):e instanceof Mt?1:this.defaultCompareTo(e)},t.prototype.toString=function(){return"<ServerTimestamp localTime="+this.localWriteTime.toString()+">"},t}(kt),Ft=function(e){function t(t){var n=e.call(this)||this;return n.internalValue=t,n.typeOrder=vt.BlobValue,n}return s.__extends(t,e),t.prototype.value=function(e){return this.internalValue},t.prototype.isEqual=function(e){return e instanceof t&&this.internalValue.isEqual(e.internalValue)},t.prototype.compareTo=function(e){return e instanceof t?this.internalValue._compareTo(e.internalValue):this.defaultCompareTo(e)},t}(kt),Ut=function(e){function t(t,n){var r=e.call(this)||this;return r.databaseId=t,r.key=n,r.typeOrder=vt.RefValue,r}return s.__extends(t,e),t.prototype.value=function(e){return this.key},t.prototype.isEqual=function(e){return e instanceof t&&(this.key.isEqual(e.key)&&this.databaseId.isEqual(e.databaseId))},t.prototype.compareTo=function(e){if(e instanceof t){var n=this.databaseId.compareTo(e.databaseId);return 0!==n?n:he.comparator(this.key,e.key)}return this.defaultCompareTo(e)},t}(kt),qt=function(e){function t(t){var n=e.call(this)||this;return n.internalValue=t,n.typeOrder=vt.GeoPointValue,n}return s.__extends(t,e),t.prototype.value=function(e){return this.internalValue},t.prototype.isEqual=function(e){return e instanceof t&&this.internalValue.isEqual(e.internalValue)},t.prototype.compareTo=function(e){return e instanceof t?this.internalValue._compareTo(e.internalValue):this.defaultCompareTo(e)},t}(kt),Vt=function(e){function t(t){var n=e.call(this)||this;return n.internalValue=t,n.typeOrder=vt.ObjectValue,n}return s.__extends(t,e),t.prototype.value=function(e){var t={};return this.internalValue.inorderTraversal((function(n,r){t[n]=r.value(e)})),t},t.prototype.forEach=function(e){this.internalValue.inorderTraversal(e)},t.prototype.isEqual=function(e){if(e instanceof t){for(var n=this.internalValue.getIterator(),r=e.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},t.prototype.compareTo=function(e){if(e instanceof t){for(var n=this.internalValue.getIterator(),r=e.internalValue.getIterator();n.hasNext()&&r.hasNext();){var i=n.getNext(),o=r.getNext(),a=Y(i.key,o.key)||i.value.compareTo(o.value);if(a)return a}return Y(n.hasNext(),r.hasNext())}return this.defaultCompareTo(e)},t.prototype.set=function(e,n){if(v(!e.isEmpty(),"Cannot set field for empty path on ObjectValue"),1===e.length)return this.setChild(e.firstSegment(),n);var r=this.child(e.firstSegment());r instanceof t||(r=t.EMPTY);var i=r.set(e.popFirst(),n);return this.setChild(e.firstSegment(),i)},t.prototype.delete=function(e){if(v(!e.isEmpty(),"Cannot delete field for empty path on ObjectValue"),1===e.length)return new t(this.internalValue.remove(e.firstSegment()));var n=this.child(e.firstSegment());if(n instanceof t){var r=n.delete(e.popFirst());return new t(this.internalValue.insert(e.firstSegment(),r))}return this},t.prototype.contains=function(e){return null!==this.field(e)},t.prototype.field=function(e){v(!e.isEmpty(),"Can't get field of empty path");var n=this;return e.forEach((function(e){n=n instanceof t?n.internalValue.get(e):null})),n},t.prototype.fieldMask=function(){var e=new Ae(le.comparator);return this.internalValue.forEach((function(n,r){var i=new le([n]);if(r instanceof t){var o=r.fieldMask().fields;
1o.isEmpty()?e=e.add(i):o.forEach((function(t){e=e.add(i.child(t))}))}else e=e.add(i)})),mt.fromSet(e)},t.prototype.toString=function(){return this.internalValue.toString()},t.prototype.child=function(e){return this.internalValue.get(e)||void 0},t.prototype.setChild=function(e,n){return new t(this.internalValue.insert(e,n))},t.EMPTY=new t(new Ce(Y)),t}(kt),jt=function(e){function t(t){var n=e.call(this)||this;return n.internalValue=t,n.typeOrder=vt.ArrayValue,n}return s.__extends(t,e),t.prototype.value=function(e){return this.internalValue.map((function(t){return t.value(e)}))},t.prototype.contains=function(e){for(var t=0,n=this.internalValue;t<n.length;t++){if(n[t].isEqual(e))return!0}return!1},t.prototype.forEach=function(e){this.internalValue.forEach(e)},t.prototype.isEqual=function(e){if(e instanceof t){if(this.internalValue.length!==e.internalValue.length)return!1;for(var n=0;n<this.internalValue.length;n++)if(!this.internalValue[n].isEqual(e.internalValue[n]))return!1;return!0}return!1},t.prototype.compareTo=function(e){if(e instanceof t){for(var n=Math.min(this.internalValue.length,e.internalValue.length),r=0;r<n;r++){var i=this.internalValue[r].compareTo(e.internalValue[r]);if(i)return i}return Y(this.internalValue.length,e.internalValue.length)}return this.defaultCompareTo(e)},t.prototype.toString=function(){return"["+this.internalValue.map((function(e){return e.toString()})).join(",")+"]"},t}(kt),Bt=function(){function e(e,t){this.key=e,this.version=t}return e.compareByKey=function(e,t){return he.comparator(e.key,t.key)},e}(),Wt=function(e){function t(t,n,r,i,o,a){var s=e.call(this,t,n)||this;return s.objectValue=i,s.proto=o,s.converter=a,v(void 0!==s.objectValue||void 0!==s.proto&&void 0!==s.converter,"If objectValue is not defined, proto and converter need to be set."),s.hasLocalMutations=!!r.hasLocalMutations,s.hasCommittedMutations=!!r.hasCommittedMutations,s}return s.__extends(t,e),t.prototype.field=function(e){if(this.objectValue)return this.objectValue.field(e);this.fieldValueCache||(this.fieldValueCache=new Map);var t=e.canonicalString(),n=this.fieldValueCache.get(t);if(void 0===n){var r=this.getProtoField(e);n=void 0===r?null:this.converter(r),this.fieldValueCache.set(t,n)}return n},t.prototype.data=function(){var e=this;if(!this.objectValue){var t=Vt.EMPTY;k(this.proto.fields,(function(n,r){t=t.set(new le([n]),e.converter(r))})),this.objectValue=t,this.fieldValueCache=void 0}return this.objectValue},t.prototype.value=function(){return this.data().value()},t.prototype.isEqual=function(e){return e instanceof t&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.hasLocalMutations===e.hasLocalMutations&&this.hasCommittedMutations===e.hasCommittedMutations&&this.data().isEqual(e.data())},t.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.data.toString()+", {hasLocalMutations: "+this.hasLocalMutations+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return this.hasLocalMutations||this.hasCommittedMutations},enumerable:!0,configurable:!0}),t.prototype.getProtoField=function(e){v(void 0!==this.proto,"Can only call getProtoField() when proto is defined");for(var t=this.proto.fields[e.firstSegment()],n=1;n<e.length;++n){if(!t||!t.mapValue)return;t=t.mapValue.fields[e.get(n)]}return t},t.compareByField=function(e,t,n){var r=t.field(e),i=n.field(e);return null!==r&&null!==i?r.compareTo(i):g("Trying to compare documents on fields that don't exist")},t}(Bt),Qt=function(e){function t(t,n,r){var i=e.call(this,t,n)||this;return i.hasCommittedMutations=!(!r||!r.hasCommittedMutations),i}return s.__extends(t,e),t.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(e){return e instanceof t&&e.hasCommittedMutations===this.hasCommittedMutations&&e.version.isEqual(this.version)&&e.key.isEqual(this.key)},t}(Bt),Kt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s.__extends(t,e),t.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(t.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!0,configurable:!0}
1),t.prototype.isEqual=function(e){return e instanceof t&&e.version.isEqual(this.version)&&e.key.isEqual(this.key)},t}(Bt),zt=function(){function e(e){this.mapKeyFn=e,this.inner={}}return e.prototype.get=function(e){var t=this.mapKeyFn(e),n=this.inner[t];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(e))return s}},e.prototype.has=function(e){return void 0!==this.get(e)},e.prototype.set=function(e,t){var n=this.mapKeyFn(e),r=this.inner[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(r[i][0].isEqual(e))return void(r[i]=[e,t]);r.push([e,t])}else this.inner[n]=[[e,t]]},e.prototype.delete=function(e){var t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(n[r][0].isEqual(e))return 1===n.length?delete this.inner[t]:n.splice(r,1),!0;return!1},e.prototype.forEach=function(e){k(this.inner,(function(t,n){for(var r=0,i=n;r<i.length;r++){var o=i[r],a=o[0],s=o[1];e(a,s)}}))},e.prototype.isEmpty=function(){return N(this.inner)},e}(),Ht=function(){function e(){this.changes=new zt((function(e){return e.toString()})),this.changesApplied=!1}return e.prototype.addEntry=function(e){this.assertNotApplied(),this.changes.set(e.key,e)},e.prototype.removeEntry=function(e){this.assertNotApplied(),this.changes.set(e,null)},e.prototype.getEntry=function(e,t){this.assertNotApplied();var n=this.changes.get(t);return void 0!==n?Qe.resolve(n):this.getFromCache(e,t)},e.prototype.getEntries=function(e,t){return this.getAllFromCache(e,t)},e.prototype.apply=function(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)},e.prototype.assertNotApplied=function(){v(!this.changesApplied,"Changes have already been applied.")},e}(),Gt="The remote document changelog no longer contains all changes for all local query views. It may be necessary to rebuild these views.",Yt=function(){function e(e,t,n){this.serializer=e,this.indexManager=t,this.keepDocumentChangeLog=n,this._lastProcessedDocumentChangeId=0}return Object.defineProperty(e.prototype,"lastProcessedDocumentChangeId",{get:function(){return this._lastProcessedDocumentChangeId},enumerable:!0,configurable:!0}),e.prototype.start=function(e){var t=nt.getStore(e,_n.store);return this.synchronizeLastDocumentChangeId(t)},e.prototype.addEntry=function(e,t,n){var r=this;return Jt(e).put(Zt(t),n).next((function(){r.indexManager.addToCollectionParentIndex(e,t.path.popLast())}))},e.prototype.removeEntry=function(e,t){var n=Jt(e),r=Zt(t);return n.delete(r)},e.prototype.updateMetadata=function(e,t,n){var r=this;return this.getMetadata(e).next((function(i){return i.byteSize+=n,r.setMetadata(e,i).next((function(){if(r.keepDocumentChangeLog)return $t(e).put({changes:r.serializer.toDbResourcePaths(t)})}))}))},e.prototype.getEntry=function(e,t){var n=this;return Jt(e).get(Zt(t)).next((function(e){return e?n.serializer.fromDbRemoteDocument(e):null}))},e.prototype.getSizedEntry=function(e,t){var n=this;return Jt(e).get(Zt(t)).next((function(e){return e?{maybeDocument:n.serializer.fromDbRemoteDocument(e),size:en(e)}:null}))},e.prototype.getEntries=function(e,t){var n=this,r=Pe();return this.forEachDbEntry(e,t,(function(e,t){r=t?r.insert(e,n.serializer.fromDbRemoteDocument(t)):r.insert(e,null)})).next((function(){return r}))},e.prototype.getSizedEntries=function(e,t){var n=this,r=Pe(),i=new Ce(he.comparator);return this.forEachDbEntry(e,t,(function(e,t){t?(r=r.insert(e,n.serializer.fromDbRemoteDocument(t)),i=i.insert(e,en(t))):(r=r.insert(e,null),i=i.insert(e,0))})).next((function(){return{maybeDocuments:r,sizeMap:i}}))},e.prototype.forEachDbEntry=function(e,t,n){if(t.isEmpty())return Qe.resolve();var r=IDBKeyRange.bound(t.first().path.toArray(),t.last().path.toArray()),i=t.getIterator(),o=i.getNext();return Jt(e).iterate({range:r},(function(e,t,r){for(var a=he.fromSegments(e);o&&he.comparator(o,a)<0;)n(o,null),o=i.getNext();o&&o.isEqual(a)&&(n(o,t),o=i.hasNext()?i.getNext():null),o?r.skip(o.path.toArray()):r.done()})).next((function(){for(;o;)n(o,null),o=i.hasNext()?i.getNext():null}))},e.prototype.getDocumentsMatchingQuery=function(e,t){var n=this;v(!t.isCollectionGroupQuery(),"CollectionGroup queries should be handled in LocalDocumentsView");var r=Me(),i=t.path.length+1,o=t.path.toArray(),a=IDBKeyRange.lowerBound(o);return Jt(e).iterate({range:a},(function(e,o,a){if(e.length===i){var s=n.serializer.fromDbRemoteDocument(o);t.path.isPrefixOf(s.key.path)?s instanceof Wt&&t.matches(s)&&(r=r.
1insert(s.key,s)):a.done()}})).next((function(){return r}))},e.prototype.getNewDocumentChanges=function(e){var t=this;v(this.keepDocumentChangeLog,"Can only call getNewDocumentChanges() when document change log is enabled");var n=qe(),r=Oe(),i=IDBKeyRange.lowerBound(this._lastProcessedDocumentChangeId+1),o=!0,a=$t(e);return a.iterate({range:i},(function(e,r){if(o&&(o=!1,t._lastProcessedDocumentChangeId+1!==r.id))return t.synchronizeLastDocumentChangeId(a).next((function(){return Qe.reject(new E(w.DATA_LOSS,Gt))}));n=n.unionWith(t.serializer.fromDbResourcePaths(r.changes)),t._lastProcessedDocumentChangeId=r.id})).next((function(){var i=[];return n.forEach((function(n){i.push(t.getEntry(e,n).next((function(e){var t=e||new Qt(n,Se.forDeletedDoc());r=r.insert(n,t)})))})),Qe.waitFor(i)})).next((function(){return r}))},e.prototype.removeDocumentChangesThroughChangeId=function(e,t){var n=IDBKeyRange.upperBound(t);return $t(e).delete(n)},e.prototype.synchronizeLastDocumentChangeId=function(e){var t=this;return this._lastProcessedDocumentChangeId=0,e.iterate({keysOnly:!0,reverse:!0},(function(e,n,r){t._lastProcessedDocumentChangeId=e,r.done()}))},e.prototype.newChangeBuffer=function(){return new e.RemoteDocumentChangeBuffer(this)},e.prototype.getSize=function(e){return this.getMetadata(e).next((function(e){return e.byteSize}))},e.prototype.getMetadata=function(e){return Xt(e).get(dn.key).next((function(e){return v(!!e,"Missing document cache metadata"),e}))},e.prototype.setMetadata=function(e,t){return Xt(e).put(dn.key,t)},e.RemoteDocumentChangeBuffer=function(e){function t(t){var n=e.call(this)||this;return n.documentCache=t,n.documentSizes=new zt((function(e){return e.toString()})),n}return s.__extends(t,e),t.prototype.applyChanges=function(e){var t=this,n=[],r=0,i=qe();
1return this.changes.forEach((function(o,a){var s=t.documentSizes.get(o);if(v(void 0!==s,"Cannot modify a document that wasn't read (for "+o+")"),a){var u=t.documentCache.serializer.toDbRemoteDocument(a),c=en(u);r+=c-s,n.push(t.documentCache.addEntry(e,o,u))}else r-=s,n.push(t.documentCache.removeEntry(e,o));i=i.add(o)})),n.push(this.documentCache.updateMetadata(e,i,r)),Qe.waitFor(n)},t.prototype.getFromCache=function(e,t){var n=this;return this.documentCache.getSizedEntry(e,t).next((function(e){return null===e?(n.documentSizes.set(t,0),null):(n.documentSizes.set(t,e.size),e.maybeDocument)}))},t.prototype.getAllFromCache=function(e,t){var n=this;return this.documentCache.getSizedEntries(e,t).next((function(e){var t=e.maybeDocuments;return e.sizeMap.forEach((function(e,t){n.documentSizes.set(e,t)})),t}))},t}(Ht),e}();function Xt(e){return Vn.getStore(e,dn.store)}function Jt(e){return Vn.getStore(e,pn.store)}function $t(e){return Vn.getStore(e,_n.store)}function Zt(e){return e.path.toArray()}function en(e){var t;if(e.document)t=e.document;else if(e.unknownDocument)t=e.unknownDocument;else{if(!e.noDocument)throw g("Unknown remote document type");t=e.noDocument}return JSON.stringify(t).length}var tn=function(){function e(){this.collectionParentIndex=new nn}return e.prototype.addToCollectionParentIndex=function(e,t){return this.collectionParentIndex.add(t),Qe.resolve()},e.prototype.getCollectionParents=function(e,t){return Qe.resolve(this.collectionParentIndex.getEntries(t))},e}(),nn=function(){function e(){this.index={}}return e.prototype.add=function(e){v(e.length%2===1,"Expected a collection path.");var t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new Ae(ue.comparator),i=!r.has(n);return this.index[t]=r.add(n),i},e.prototype.getEntries=function(e){return(this.index[e]||new Ae(ue.comparator)).toArray()},e}(),rn=8,on=function(){function e(e){this.serializer=e}return e.prototype.createOrUpgrade=function(e,t,n,r){var i=this;v(n<r&&n>=0&&r<=rn,"Unexpected schema upgrade from v"+n+" to v{toVersion}."),n<1&&r>=1&&(function(e){e.createObjectStore(sn.store)}(e),function(e){e.createObjectStore(un.store,{keyPath:un.keyPath}),e.createObjectStore(cn.store,{keyPath:cn.keyPath,autoIncrement:!0}).createIndex(cn.userMutationsIndex,cn.userMutationsKeyPath,{unique:!0}),e.createObjectStore(ln.store)}(e),bn(e),function(e){e.createObjectStore(pn.store)}(e));var o=Qe.resolve();return n<3&&r>=3&&(0!==n&&(!function(e){e.deleteObjectStore(yn.store),e.deleteObjectStore(mn.store),e.deleteObjectStore(gn.store)}(e),bn(e)),o=o.next((function(){return function(e){var t=e.store(gn.store),n=new gn(0,0,Se.MIN.toTimestamp(),0);return t.put(gn.key,n)}(t)}))),n<4&&r>=4&&(0!==n&&(o=o.next((function(){return function(e,t){return t.store(cn.store).loadAll().next((function(n){e.deleteObjectStore(cn.store),e.createObjectStore(cn.store,{keyPath:cn.keyPath,autoIncrement:!0}).createIndex(cn.userMutationsIndex,cn.userMutationsKeyPath,{unique:!0});var r=t.store(cn.store),i=n.map((function(e){return r.put(e)}));return Qe.waitFor(i)}))}(e,t)}))),o=o.next((function(){!function(e){e.createObjectStore(wn.store,{keyPath:wn.keyPath})}(e),function(e){e.createObjectStore(_n.store,{keyPath:"id",autoIncrement:!0})}(e)}))),n<5&&r>=5&&(o=o.next((function(){return i.removeAcknowledgedMutations(t)}))),n<6&&r>=6&&(o=o.next((function(){return function(e){e.createObjectStore(dn.store)}(e),i.addDocumentGlobal(t)}))),n<7&&r>=7&&(o=o.next((function(){return i.ensureSequenceNumbers(t)}))),n<8&&r>=8&&(o=o.next((function(){return i.createCollectionParentIndex(e,t)}))),o},e.prototype.addDocumentGlobal=function(e){var t=0;return e.store(pn.store).iterate((function(e,n){t+=en(n)})).next((function(){var n=new dn(t);return e.store(dn.store).put(dn.key,n)}))},e.prototype.removeAcknowledgedMutations=function(e){var t=this,n=e.store(un.store),r=e.store(cn.store);return n.loadAll().next((function(n){return Qe.forEach(n,(function(n){var i=IDBKeyRange.bound([n.userId,-1],[n.userId,n.lastAcknowledgedBatchId]);return r.loadAll(cn.userMutationsIndex,i).next((function(r){return Qe.forEach(r,(function(r){v(r.userId===n.userId,"Cannot process batch "+r.batchId+" from unexpected user");var i=t.serializer.fromDbMutationBatch(r);return He(e,n.userId,i).next((function(){}))}))}))}))}))},e.prototype.ensureSequenceNumbers=function(e){var t=e.store(yn.store),n=e.store(pn.store);return ft(e).next((function(e){var r=[];return n.iterate((function(n,i){var o=new ue(n),a=function(e){return[0,be(e)]}(o);r.push(t.get(a).next((function(n){return n?Qe.resolve():function(n){return t.put(new yn(0,be(n),e))}(o)})))}
1)).next((function(){return Qe.waitFor(r)}))}))},e.prototype.createCollectionParentIndex=function(e,t){e.createObjectStore(vn.store,{keyPath:vn.keyPath});var n=t.store(vn.store),r=new nn,i=function(e){if(r.add(e)){var t=e.lastSegment(),i=e.popLast();return n.put({collectionId:t,parent:be(i)})}};return t.store(pn.store).iterate({keysOnly:!0},(function(e,t){var n=new ue(e);return i(n.popLast())})).next((function(){return t.store(ln.store).iterate({keysOnly:!0},(function(e,t){e[0];var n=e[1],r=(e[2],Ee(n));return i(r.popLast())}))}))},e}();var an=function(){return function(e,t){this.seconds=e,this.nanoseconds=t}}(),sn=function(){function e(e,t,n){this.ownerId=e,this.allowTabSynchronization=t,this.leaseTimestampMs=n}return e.store="owner",e.key="owner",e}();var un=function(){function e(e,t,n){this.userId=e,this.lastAcknowledgedBatchId=t,this.lastStreamToken=n}return e.store="mutationQueues",e.keyPath="userId",e}(),cn=function(){function e(e,t,n,r,i){this.userId=e,this.batchId=t,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i}return e.store="mutations",e.keyPath="batchId",e.userMutationsIndex="userMutationsIndex",e.userMutationsKeyPath=["userId","batchId"],e}();var ln=function(){function e(){}return e.prefixForUser=function(e){return[e]},e.prefixForPath=function(e,t){return[e,be(t)]},e.key=function(e,t,n){return[e,be(t),n]},e.store="documentMutations",e.PLACEHOLDER=new e,e}();var hn=function(){return function(e,t){this.path=e,this.readTime=t}}(),fn=function(){return function(e,t){this.path=e,this.version=t}}(),pn=function(){function e(e,t,n,r){this.unknownDocument=e,this.noDocument=t,this.document=n,this.hasCommittedMutations=r}return e.store="remoteDocuments",e}(),dn=function(){function e(e){this.byteSize=e}return e.store="remoteDocumentGlobal",e.key="remoteDocumentGlobalKey",e}();var mn=function(){function e(e,t,n,r,i,o){this.targetId=e,this.canonicalId=t,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.query=o}return e.store="targets",e.keyPath="targetId",e.queryTargetsIndexName="queryTargetsIndex",e.queryTargetsKeyPath=["canonicalId","targetId"],e}(),yn=function(){function e(e,t,n){this.targetId=e,this.path=t,this.sequenceNumber=n,v(0===e===(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 e.store="targetDocuments",e.keyPath=["targetId","path"],e.documentTargetsIndex="documentTargetsIndex",e.documentTargetsKeyPath=["path","targetId"],e}(),gn=function(){function e(e,t,n,r){this.highestTargetId=e,this.highestListenSequenceNumber=t,this.lastRemoteSnapshotVersion=n,this.targetCount=r}return e.key="targetGlobalKey",e.store="targetGlobal",e}(),vn=function(){function e(e,t){this.collectionId=e,this.parent=t}return e.store="collectionParents",e.keyPath=["collectionId","parent"],e}();function bn(e){e.createObjectStore(yn.store,{keyPath:yn.keyPath}).createIndex(yn.documentTargetsIndex,yn.documentTargetsKeyPath,{unique:!0}),e.createObjectStore(mn.store,{keyPath:mn.keyPath}).createIndex(mn.queryTargetsIndexName,mn.queryTargetsKeyPath,{unique:!0}),e.createObjectStore(gn.store)}var _n=function(){function e(e){this.changes=e}return e.store="remoteDocumentChanges",e.keyPath="id",e}();var wn=function(){function e(e,t,n,r,i){this.clientId=e,this.updateTimeMs=t,this.networkEnabled=n,this.inForeground=r,this.lastProcessedDocumentChangeId=i}return e.store="clientMetadata",e.keyPath="clientId",e}();var En,Tn=[un.store,cn.store,ln.store,pn.store,mn.store,sn.store,gn.store,yn.store].concat([wn.store,_n.store]).concat([dn.store]).concat([vn.store]),Sn=function(){function e(){this.collectionParentsCache=new nn}return e.prototype.addToCollectionParentIndex=function(e,t){if(v(t.length%2===1,"Expected a collection path."),this.collectionParentsCache.add(t)){v(t.length>=1,"Invalid collection path.");var n=t.lastSegment(),r=t.popLast();return Cn(e).put({collectionId:n,parent:be(r)})}return Qe.resolve()},e.prototype.getCollectionParents=function(e,t){var n=[],r=IDBKeyRange.bound([t,""],[J(t),""],!1,!0);return Cn(e).loadAll(r).next((function(e){for(var r=0,i=e;r<i.length;r++){var o=i[r];if(o.collectionId!==t)break;n.push(Ee(o.parent))}return n}))},e}();function Cn(e){return Vn.getStore(e,vn.store)}!function(e){e[e.Listen=0]="Listen",e[e.ExistenceFilterMismatch=1]="ExistenceFilterMismatch",e[e.LimboResolution=2]="LimboResolution"}(En||(En={}));var In=function(){function e(e,t,n,r,i,o){void 0===i&&(i=Se.MIN),void 0===o&&(o=_()),this.query=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.resumeToken=o}return e.prototype.copy=function(t){return new e(this.query,this.targetId,this.purpose,void 0===t.sequenceNumber?this.sequenceNumber:t.sequenceNumber,void 0===t.snapshotVersion?this.snapshotVersion:t.snapshotVersion,void 0===t.resumeToken?this.resumeToken:t.resumeToken)},e.prototype.isEqual=function(e){return this.targetId===e.targetId&&this.purpose===e.purpose&&this.sequenceNumber===e.sequenceNumber&&this.snapshotVersion.isEqual(e.snapshotVersion)&&this.resumeToken===e.resumeToken&&this.query.isEqual(e.query)},e}
1(),kn=function(){function e(e){this.remoteSerializer=e}return e.prototype.fromDbRemoteDocument=function(e){if(e.document)return this.remoteSerializer.fromDocument(e.document,!!e.hasCommittedMutations);if(e.noDocument){var t=he.fromSegments(e.noDocument.path),n=this.fromDbTimestamp(e.noDocument.readTime);return new Qt(t,n,{hasCommittedMutations:!!e.hasCommittedMutations})}if(e.unknownDocument){t=he.fromSegments(e.unknownDocument.path),n=this.fromDbTimestamp(e.unknownDocument.version);return new Kt(t,n)}return g("Unexpected DbRemoteDocument")},e.prototype.toDbRemoteDocument=function(e){if(e instanceof Wt){var t=e.proto?e.proto:this.remoteSerializer.toDocument(e),n=e.hasCommittedMutations;return new pn(null,null,t,n)}if(e instanceof Qt){var r=e.key.path.toArray(),i=this.toDbTimestamp(e.version);n=e.hasCommittedMutations;return new pn(null,new hn(r,i),null,n)}if(e instanceof Kt){r=e.key.path.toArray(),i=this.toDbTimestamp(e.version);return new pn(new fn(r,i),null,null,!0)}return g("Unexpected MaybeDocumment")},e.prototype.toDbTimestamp=function(e){var t=e.toTimestamp();return new an(t.seconds,t.nanoseconds)},e.prototype.fromDbTimestamp=function(e){var t=new Te(e.seconds,e.nanoseconds);return Se.fromTimestamp(t)},e.prototype.toDbMutationBatch=function(e,t){var n=this,r=t.baseMutations.map((function(e){return n.remoteSerializer.toMutation(e)})),i=t.mutations.map((function(e){return n.remoteSerializer.toMutation(e)}));return new cn(e,t.batchId,t.localWriteTime.toMillis(),r,i)},e.prototype.fromDbMutationBatch=function(e){var t=this,n=(e.baseMutations||[]).map((function(e){return t.remoteSerializer.fromMutation(e)})),r=e.mutations.map((function(e){return t.remoteSerializer.fromMutation(e)})),i=Te.fromMillis(e.localWriteTimeMs);return new Be(e.batchId,i,n,r)},e.prototype.toDbResourcePaths=function(e){var t=[];return e.forEach((function(e){t.push(be(e.path))})),t},e.prototype.fromDbResourcePaths=function(e){for(var t=qe(),n=0,r=e;n<r.length;n++){var i=r[n];t=t.add(new he(Ee(i)))}return t},e.prototype.fromDbTarget=function(e){var t,n=this.fromDbTimestamp(e.readTime);return t=void 0!==e.query.documents?this.remoteSerializer.fromDocumentsTarget(e.query):this.remoteSerializer.fromQueryTarget(e.query),new In(t,e.targetId,En.Listen,e.lastListenSequenceNumber,n,e.resumeToken)},e.prototype.toDbTarget=function(e){v(En.Listen===e.purpose,"Only queries with purpose "+En.Listen+" may be stored, got "+e.purpose);var t,n,r=this.toDbTimestamp(e.snapshotVersion);return t=e.query.isDocumentQuery()?this.remoteSerializer.toDocumentsTarget(e.query):this.remoteSerializer.toQueryTarget(e.query),e.resumeToken instanceof Uint8Array?(v("YES"===Object({NODE_ENV:"production",PUBLIC_URL:""}).USE_MOCK_PERSISTENCE,"Persisting non-string stream tokens is only supported with mock persistence ."),n=e.resumeToken.toString()):n=e.resumeToken,new mn(e.targetId,e.query.canonicalId(),r,n,e.sequenceNumber,t)},e}();function Nn(e,t){var n=e[0],r=e[1],i=t[0],o=t[1],a=Y(n,i);return 0===a?Y(r,o):a}var An=function(){function e(e){this.maxElements=e,this.buffer=new Ae(Nn),this.previousIndex=0}return e.prototype.nextIndex=function(){return++this.previousIndex},e.prototype.addElement=function(e){var t=[e,this.nextIndex()];if(this.buffer.size<this.maxElements)this.buffer=this.buffer.add(t);else{var n=this.buffer.last();Nn(t,n)<0&&(this.buffer=this.buffer.delete(n).add(t))}},Object.defineProperty(e.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!0,configurable:!0}),e}(),Dn={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},Rn=function(){function e(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}return e.withCacheSize=function(t){return new e(t,e.DEFAULT_COLLECTION_PERCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)},e.COLLECTION_DISABLED=-1,e.MINIMUM_CACHE_SIZE_BYTES=1048576,e.DEFAULT_CACHE_SIZE_BYTES=41943040,e.DEFAULT_COLLECTION_PERCENTILE=10,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,e.DEFAULT=new e(e.DEFAULT_CACHE_SIZE_BYTES,e.DEFAULT_COLLECTION_PERCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),e.DISABLED=new e(e.COLLECTION_DISABLED,0,0),e}(),On=function(){function e(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.hasRun=!1,this.gcTask=null}return e.prototype.start=function(){v(null===this.gcTask,"Cannot start an already started LruScheduler"),this.garbageCollector.params.cacheSizeCollectionThreshold!==Rn.COLLECTION_DISABLED&&this.scheduleGC()},e.prototype.stop=function(){this.gcTask&&(this.gcTask.cancel(),this.gcTask=null)},Object.defineProperty(e.prototype,"started",{get:function(){return null!==this.gcTask},enumerable:!0,configurable:!0}),e.prototype.scheduleGC=function(){var e=this;v(null===this.gcTask,"Cannot schedule GC while a task is pending");var t=this.hasRun?3e5:6e4;d("LruGarbageCollector","Garbage collection scheduled in "+t+"ms"),this.gcTask=this.asyncQueue.enqueueAfterDelay(ee.LruGarbageCollection,t,(function(){return e.gcTask=null,e.hasRun=!0,e.localStore.collectGarbage(e.garbageCollector).then((function(){return e.scheduleGC()})).catch(jn)}))},e}(),Pn=function(){function e(e,t){this.delegate=e,this.params=t}return e.prototype.calculateTargetCount=function(e,t){return this.delegate.getSequenceNumberCount(e).next((function(e){return Math.floor(t/100*e)}))},e.prototype.nthSequenceNumber=function(e,t){var n=this;if(0===t)return Qe.resolve(ae.INVALID);var r=new An(t);return this.delegate.forEachTarget(e,(function(e){return r.addElement(e.sequenceNumber)})).next((function(){return n.delegate.forEachOrphanedDocumentSequenceNumber(e,(function(e){return r.addElement(e)}))})).next((function(){return r.maxValue}))},e.prototype.removeTargets=function(e,t,n){return this.delegate.removeTargets(e,t,n)},e.prototype.removeOrphanedDocuments=function(e,t){return this.delegate.removeOrphanedDocuments(e,t)},e.prototype.collect=function(e,t){var n=this;return this.params.cacheSizeCollectionThreshold===Rn.COLLECTION_DISABLED?(d("LruGarbageCollector","Garbage collection skipped; disabled"),Qe.resolve(Dn)):this.getCacheSize(e).next((function(r){return r<n.params.cacheSizeCollectionThreshold?(d("LruGarbageCollector","Garbage collection skipped; Cache size "+r+" is lower than threshold "+n.params.cacheSizeCollectionThreshold),Dn):n.runGarbageCollection(e,t)}))},e.prototype.getCacheSize=function(e){return this.delegate.getCacheSize(e)},e.prototype.runGarbageCollection=function(e,t){var n,r,o,a,s,u,c,l=this,h=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((function(t){return t>l.params.maximumSequenceNumbersToCollect?(d("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+l.params.maximumSequenceNumbersToCollect+" from "+t),r=l.params.maximumSequenceNumbersToCollect):r=t,a=Date.now(),l.nthSequenceNumber(e,r)})).next((function(r){return n=r,s=Date.now(),l.removeTargets(e,n,t)})).next((function(t){return o=t,u=Date.now(),l.removeOrphanedDocuments(e,n)})).next((function(e){(c=Date.now(),f()<=i.DEBUG)&&d("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(a-h)+"ms\n\tDetermined least recently used "+r+" in "+(s-a)+"ms\n\tRemoved "+o+" targets in "+(u-s)+"ms\n\tRemoved "+e+" documents in "+(c-u)+"ms\nTotal Duration: "+(c-h)+"ms");return Qe.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:o,documentsRemoved:e})}))},e}(),xn=function(){return function(){}}(),Mn="IndexedDbPersistence",Ln="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Fn="Another tab has exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs.",Un="This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.",qn=function(e){function t(t,n){var r=e.call(this)||this;return r.simpleDbTransaction=t,r.currentSequenceNumber=n,r}return s.__extends(t,e),t}
1(xn),Vn=function(){function e(t,n,r,i,o,a,s){if(this.persistenceKey=t,this.clientId=n,this.queue=i,this.multiClientParams=s,this._started=!1,this.isPrimary=!1,this.networkEnabled=!0,this.windowUnloadHandler=null,this.inForeground=!1,this.documentVisibilityHandler=null,this.clientMetadataRefresher=null,this.lastGarbageCollectionTime=Number.NEGATIVE_INFINITY,this.primaryStateListener=function(e){return Promise.resolve()},!e.isAvailable())throw new E(w.UNIMPLEMENTED,Un);if(this.referenceDelegate=new Qn(this,a),this.dbName=t+e.MAIN_DATABASE,this.serializer=new kn(o),this.document=r.document,this.allowTabSynchronization=void 0!==s,this.queryCache=new ct(this.referenceDelegate,this.serializer),this.indexManager=new Sn,this.remoteDocumentCache=new Yt(this.serializer,this.indexManager,this.allowTabSynchronization),!r.window||!r.window.localStorage)throw new E(w.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");this.window=r.window,this.webStorage=this.window.localStorage}return e.getStore=function(e,t){if(e instanceof qn)return nt.getStore(e.simpleDbTransaction,t);throw g("IndexedDbPersistence must use instances of IndexedDbTransaction")},e.createIndexedDbPersistence=function(t,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 e(t,n,r,i,o,a)).start()];case 1:return s.sent(),[2,u]}}))}))},e.createMultiClientIndexedDbPersistence=function(t,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 e(t,n,r,i,o,a,u)).start()];case 1:return s.sent(),[2,c]}}))}))},e.prototype.start=function(){var e=this;return v(!this.started,"IndexedDbPersistence double-started!"),v(null!==this.window,"Expected 'window' to be defined"),nt.openOrCreate(this.dbName,rn,new on(this.serializer)).then((function(t){return e.simpleDb=t,e.updateClientMetadataAndTryBecomePrimary()})).then((function(){return e.attachVisibilityHandler(),e.attachWindowUnloadHook(),e.scheduleClientMetadataAndPrimaryLeaseRefreshes(),e.startRemoteDocumentCache()})).then((function(){return e.simpleDb.runTransaction("readonly",[gn.store],(function(t){return ft(t).next((function(t){var n=e.multiClientParams?e.multiClientParams.sequenceNumberSyncer:void 0;e.listenSequence=new ae(t,n)}))}))})).then((function(){e._started=!0})).catch((function(t){return e.simpleDb&&e.simpleDb.close(),Promise.reject(t)}))},e.prototype.startRemoteDocumentCache=function(){var e=this;return this.simpleDb.runTransaction("readonly",Tn,(function(t){return e.remoteDocumentCache.start(t)}))},e.prototype.setPrimaryStateListener=function(e){var t=this;return this.primaryStateListener=function(n){return s.__awaiter(t,void 0,void 0,(function(){return s.__generator(this,(function(t){return this.started?[2,e(n)]:[2]}))}))},e(this.isPrimary)},e.prototype.setDatabaseDeletedListener=function(e){var t=this;this.simpleDb.setVersionChangeListener((function(n){return s.__awaiter(t,void 0,void 0,(function(){return s.__generator(this,(function(t){switch(t.label){case 0:return null!==n.newVersion?[3,2]:[4,e()];case 1:t.sent(),t.label=2;case 2:return[2]}}
1))}))}))},e.prototype.setNetworkEnabled=function(e){var t=this;this.networkEnabled!==e&&(this.networkEnabled=e,this.queue.enqueueAndForget((function(){return s.__awaiter(t,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return this.started?[4,this.updateClientMetadataAndTryBecomePrimary()]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))})))},e.prototype.updateClientMetadataAndTryBecomePrimary=function(){var e=this;return this.simpleDb.runTransaction("readwrite",Tn,(function(t){return Wn(t).put(new wn(e.clientId,Date.now(),e.networkEnabled,e.inForeground,e.remoteDocumentCache.lastProcessedDocumentChangeId)).next((function(){if(e.isPrimary)return e.verifyPrimaryLease(t).next((function(t){t||(e.isPrimary=!1,e.queue.enqueueAndForget((function(){return e.primaryStateListener(!1)})))}))})).next((function(){return e.canActAsPrimary(t)})).next((function(n){var r=e.isPrimary;return e.isPrimary=n,r!==e.isPrimary&&e.queue.enqueueAndForget((function(){return e.primaryStateListener(e.isPrimary)})),r&&!e.isPrimary?e.releasePrimaryLeaseIfHeld(t):e.isPrimary?e.acquireOrExtendPrimaryLease(t):void 0}))}))},e.prototype.verifyPrimaryLease=function(e){var t=this;return Bn(e).get(sn.key).next((function(e){return Qe.resolve(t.isLocalClient(e))}))},e.prototype.removeClientMetadata=function(e){return Wn(e).delete(this.clientId)},e.prototype.maybeGarbageCollectMultiClientState=function(){return s.__awaiter(this,void 0,void 0,(function(){var t,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=e.getStore(i,wn.store);return o.loadAll().next((function(e){t=r.filterActiveClients(e,18e5),n=e.filter((function(e){return-1===t.indexOf(e)}))})).next((function(){return Qe.forEach(n,(function(e){return o.delete(e.clientId)}))})).next((function(){if((t=t.filter((function(e){return e.clientId!==r.clientId}))).length>0){var e=t.map((function(e){return e.lastProcessedDocumentChangeId||0})),n=Math.min.apply(Math,e);return r.remoteDocumentCache.removeDocumentChangesThroughChangeId(i,n)}}))}))]);case 1:i.sent(),n.forEach((function(e){r.window.localStorage.removeItem(r.zombiedClientLocalStorageKey(e.clientId))})),i.label=2;case 2:return[2]}}
1))}))},e.prototype.scheduleClientMetadataAndPrimaryLeaseRefreshes=function(){var e=this;this.clientMetadataRefresher=this.queue.enqueueAfterDelay(ee.ClientMetadataRefresh,4e3,(function(){return e.updateClientMetadataAndTryBecomePrimary().then((function(){return e.maybeGarbageCollectMultiClientState()})).then((function(){return e.scheduleClientMetadataAndPrimaryLeaseRefreshes()}))}))},e.prototype.isLocalClient=function(e){return!!e&&e.ownerId===this.clientId},e.prototype.canActAsPrimary=function(e){var t=this;return Bn(e).get(sn.key).next((function(n){if(null!==n&&t.isWithinAge(n.leaseTimestampMs,5e3)&&!t.isClientZombied(n.ownerId)){if(t.isLocalClient(n)&&t.networkEnabled)return!0;if(!t.isLocalClient(n)){if(!n.allowTabSynchronization)throw new E(w.FAILED_PRECONDITION,Fn);return!1}}return!(!t.networkEnabled||!t.inForeground)||Wn(e).loadAll().next((function(e){return void 0===t.filterActiveClients(e,5e3).find((function(e){if(t.clientId!==e.clientId){var n=!t.networkEnabled&&e.networkEnabled,r=!t.inForeground&&e.inForeground,i=t.networkEnabled===e.networkEnabled;if(n||r&&i)return!0}return!1}))}))})).next((function(e){return t.isPrimary!==e&&d(Mn,"Client "+(e?"is":"is not")+" eligible for a primary lease."),e}))},e.prototype.shutdown=function(){return s.__awaiter(this,void 0,void 0,(function(){var e=this;return s.__generator(this,(function(t){switch(t.label){case 0:return this._started=!1,this.markClientZombied(),this.clientMetadataRefresher&&(this.clientMetadataRefresher.cancel(),this.clientMetadataRefresher=null),this.detachVisibilityHandler(),this.detachWindowUnloadHook(),[4,this.simpleDb.runTransaction("readwrite",[sn.store,wn.store],(function(t){return e.releasePrimaryLeaseIfHeld(t).next((function(){return e.removeClientMetadata(t)}))}))];case 1:return t.sent(),this.simpleDb.close(),this.removeClientZombiedEntry(),[2]}}))}))},e.prototype.filterActiveClients=function(e,t){var n=this;return e.filter((function(e){return n.isWithinAge(e.updateTimeMs,t)&&!n.isClientZombied(e.clientId)}))},e.prototype.getActiveClients=function(){var e=this;return this.simpleDb.runTransaction("readonly",[wn.store],(function(t){return Wn(t).loadAll().next((function(t){return e.filterActiveClients(t,18e5).map((function(e){return e.clientId}))}))}))},e.clearPersistence=function(t){return s.__awaiter(this,void 0,void 0,(function(){var n;return s.__generator(this,(function(r){switch(r.label){case 0:return e.isAvailable()?(n=t+e.MAIN_DATABASE,[4,nt.delete(n)]):[2,Promise.resolve()];case 1:return r.sent(),[2]}}))}))},Object.defineProperty(e.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),e.prototype.getMutationQueue=function(e){return v(this.started,"Cannot initialize MutationQueue before persistence is started."),Ke.forUser(e,this.serializer,this.indexManager,this.referenceDelegate)},e.prototype.getQueryCache=function(){return v(this.started,"Cannot initialize QueryCache before persistence is started."),this.queryCache},e.prototype.getRemoteDocumentCache=function(){return v(this.started,"Cannot initialize RemoteDocumentCache before persistence is started."),this.remoteDocumentCache},e.prototype.getIndexManager=function(){return v(this.started,"Cannot initialize IndexManager before persistence is started."),this.indexManager},e.prototype.runTransaction=function(e,t,n){var r=this;return d(Mn,"Starting transaction:",e),this.simpleDb.runTransaction("readonly"===t?"readonly":"readwrite",Tn,(function(i){return"readwrite-primary"===t?r.verifyPrimaryLease(i).next((function(t){if(!t)throw m("Failed to obtain primary lease for action '"+e+"'."),r.isPrimary=!1,r.queue.enqueueAndForget((function(){return r.primaryStateListener(!1)})),new E(w.FAILED_PRECONDITION,Ln);return n(new qn(i,r.listenSequence.next()))})).next((function(e){return r.acquireOrExtendPrimaryLease(i).next((function(){return e}))})):r.verifyAllowTabSynchronization(i).next((function(){return n(new qn(i,r.listenSequence.next()))}))}))},e.prototype.verifyAllowTabSynchronization=function(e){var t=this;return Bn(e).get(sn.key).next((function(e){if(null!==e&&t.isWithinAge(e.leaseTimestampMs,5e3)&&!t.isClientZombied(e.ownerId)&&!t.isLocalClient(e)&&!e.allowTabSynchronization)throw new E(w.FAILED_PRECONDITION,Fn)}))},e.prototype.acquireOrExtendPrimaryLease=function(e){var t=new sn(this.clientId,this.allowTabSynchronization,Date.now());return Bn(e).put(sn.key,t)}
1,e.isAvailable=function(){return nt.isAvailable()},e.buildStoragePrefix=function(e){var t=e.databaseId.projectId;return e.databaseId.isDefaultDatabase||(t+="."+e.databaseId.database),"firestore/"+e.persistenceKey+"/"+t+"/"},e.prototype.releasePrimaryLeaseIfHeld=function(e){var t=this,n=Bn(e);return n.get(sn.key).next((function(e){return t.isLocalClient(e)?(d(Mn,"Releasing primary lease."),n.delete(sn.key)):Qe.resolve()}))},e.prototype.isWithinAge=function(e,t){var n=Date.now();return!(e<n-t)&&(!(e>n)||(m("Detected an update time that is in the future: "+e+" > "+n),!1))},e.prototype.attachVisibilityHandler=function(){var e=this;null!==this.document&&"function"===typeof this.document.addEventListener&&(this.documentVisibilityHandler=function(){e.queue.enqueueAndForget((function(){return e.inForeground="visible"===e.document.visibilityState,e.updateClientMetadataAndTryBecomePrimary()}))},this.document.addEventListener("visibilitychange",this.documentVisibilityHandler),this.inForeground="visible"===this.document.visibilityState)},e.prototype.detachVisibilityHandler=function(){this.documentVisibilityHandler&&(v(null!==this.document&&"function"===typeof this.document.addEventListener,"Expected 'document.addEventListener' to be a function"),this.document.removeEventListener("visibilitychange",this.documentVisibilityHandler),this.documentVisibilityHandler=null)},e.prototype.attachWindowUnloadHook=function(){var e=this;"function"===typeof this.window.addEventListener&&(this.windowUnloadHandler=function(){e.markClientZombied(),e.queue.enqueueAndForget((function(){return e.shutdown()}))},this.window.addEventListener("unload",this.windowUnloadHandler))},e.prototype.detachWindowUnloadHook=function(){this.windowUnloadHandler&&(v("function"===typeof this.window.removeEventListener,"Expected 'window.removeEventListener' to be a function"),this.window.removeEventListener("unload",this.windowUnloadHandler),this.windowUnloadHandler=null)},e.prototype.isClientZombied=function(e){try{var t=null!==this.webStorage.getItem(this.zombiedClientLocalStorageKey(e));return d(Mn,"Client '"+e+"' "+(t?"is":"is not")+" zombied in LocalStorage"),t}catch(n){return m(Mn,"Failed to get zombied client id.",n),!1}},e.prototype.markClientZombied=function(){try{this.webStorage.setItem(this.zombiedClientLocalStorageKey(this.clientId),String(Date.now()))}catch(e){m("Failed to set zombie client id.",e)}},e.prototype.removeClientZombiedEntry=function(){try{this.webStorage.removeItem(this.zombiedClientLocalStorageKey(this.clientId))}catch(e){}},e.prototype.zombiedClientLocalStorageKey=function(e){return"firestore_zombie_"+this.persistenceKey+"_"+e},e.MAIN_DATABASE="main",e}();function jn(e){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(t){if(!function(e){return e.code===w.FAILED_PRECONDITION&&e.message===Ln}(e))throw e;return d(Mn,"Unexpectedly lost primary lease"),[2]}))}))}function Bn(e){return e.store(sn.store)}function Wn(e){return e.store(wn.store)}var Qn=function(){function e(e,t){this.db=e,this.inMemoryPins=null,this.garbageCollector=new Pn(this,t)}return e.prototype.getSequenceNumberCount=function(e){var t=this.orphanedDocmentCount(e);return this.db.getQueryCache().getQueryCount(e).next((function(e){return t.next((function(t){return e+t}))}))},e.prototype.orphanedDocmentCount=function(e){var t=0;return this.forEachOrphanedDocumentSequenceNumber(e,(function(e){t++})).next((function(){return t}))},e.prototype.forEachTarget=function(e,t){return this.db.getQueryCache().forEachTarget(e,t)},e.prototype.forEachOrphanedDocumentSequenceNumber=function(e,t){return this.forEachOrphanedDocument(e,(function(e,n){return t(n)}))},e.prototype.setInMemoryPins=function(e){this.inMemoryPins=e},e.prototype.addReference=function(e,t){return Kn(e,t)},e.prototype.removeReference=function(e,t){return Kn(e,t)},e.prototype.removeTargets=function(e,t,n){return this.db.getQueryCache().removeTargets(e,t,n)},e.prototype.removeMutationReference=function(e,t){return Kn(e,t)},e.prototype.isPinned=function(e,t){return this.inMemoryPins.containsKey(t)?Qe.resolve(!0):function(e,t){var n=!1;return Je(e).iterateSerial((function(r){return ze(e,r,t).next((function(e){return e&&(n=!0),Qe.resolve(!e)}))})).next((function(){return n}))}(e,t)},e.prototype.removeOrphanedDocuments=function(e,t){var n=this,r=this.db.getRemoteDocumentCache().newChangeBuffer(),i=[],o=0;return this.forEachOrphanedDocument(e,(function(a,s){if(s<=t){var u=n.isPinned(e,a).next((function(t){if(!t)return o++,r.getEntry(e,a).next((function(){return r.removeEntry(a),pt(e).delete([0,be(a.path)])}))}));i.push(u)}}
1)).next((function(){return Qe.waitFor(i)})).next((function(){return r.apply(e)})).next((function(){return o}))},e.prototype.removeTarget=function(e,t){var n=t.copy({sequenceNumber:e.currentSequenceNumber});return this.db.getQueryCache().updateQueryData(e,n)},e.prototype.updateLimboDocument=function(e,t){return Kn(e,t)},e.prototype.forEachOrphanedDocument=function(e,t){var n,r=pt(e),i=ae.INVALID;return r.iterate({index:yn.documentTargetsIndex},(function(e,r){var o=e[0],a=(e[1],r.path),s=r.sequenceNumber;0===o?(i!==ae.INVALID&&t(new he(Ee(n)),i),i=s,n=a):i=ae.INVALID})).next((function(){i!==ae.INVALID&&t(new he(Ee(n)),i)}))},e.prototype.getCacheSize=function(e){return this.db.getRemoteDocumentCache().getSize(e)},e}();function Kn(e,t){return pt(e).put(function(e,t){return new yn(0,be(e.path),t)}(t,e.currentSequenceNumber))}var zn=function(){function e(e,t,n){this.remoteDocumentCache=e,this.mutationQueue=t,this.indexManager=n}return e.prototype.getDocument=function(e,t){var n=this;return this.mutationQueue.getAllMutationBatchesAffectingDocumentKey(e,t).next((function(r){return n.getDocumentInternal(e,t,r)}))},e.prototype.getDocumentInternal=function(e,t,n){return this.remoteDocumentCache.getEntry(e,t).next((function(e){for(var r=0,i=n;r<i.length;r++){e=i[r].applyToLocalView(t,e)}return e}))},e.prototype.applyLocalMutationsToDocuments=function(e,t,n){var r=Pe();return t.forEach((function(e,t){for(var i=0,o=n;i<o.length;i++){t=o[i].applyToLocalView(e,t)}r=r.insert(e,t)})),r},e.prototype.getDocuments=function(e,t){var n=this;return this.remoteDocumentCache.getEntries(e,t).next((function(t){return n.getLocalViewOfDocuments(e,t)}))},e.prototype.getLocalViewOfDocuments=function(e,t){var n=this;return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((function(r){var i=n.applyLocalMutationsToDocuments(e,t,r),o=Oe();return i.forEach((function(e,t){t||(t=new Qt(e,Se.forDeletedDoc())),o=o.insert(e,t)})),o}))},e.prototype.getDocumentsMatchingQuery=function(e,t){return t.isDocumentQuery()?this.getDocumentsMatchingDocumentQuery(e,t.path):t.isCollectionGroupQuery()?this.getDocumentsMatchingCollectionGroupQuery(e,t):this.getDocumentsMatchingCollectionQuery(e,t)},e.prototype.getDocumentsMatchingDocumentQuery=function(e,t){return this.getDocument(e,new he(t)).next((function(e){var t=Me();return e instanceof Wt&&(t=t.insert(e.key,e)),t}))},e.prototype.getDocumentsMatchingCollectionGroupQuery=function(e,t){var n=this;v(t.path.isEmpty(),"Currently we only support collection group queries at the root.");var r=t.collectionGroup,i=Me();return this.indexManager.getCollectionParents(e,r).next((function(o){return Qe.forEach(o,(function(o){var a=t.asCollectionQueryAtPath(o.child(r));return n.getDocumentsMatchingCollectionQuery(e,a).next((function(e){e.forEach((function(e,t){i=i.insert(e,t)}))}))})).next((function(){return i}))}))},e.prototype.getDocumentsMatchingCollectionQuery=function(e,t){var n,r,i=this;return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t).next((function(r){return n=r,i.mutationQueue.getAllMutationBatchesAffectingQuery(e,t)})).next((function(t){return r=t,i.addMissingBaseDocuments(e,r,n).next((function(e){n=e;for(var t=0,i=r;t<i.length;t++)for(var o=i[t],a=0,s=o.mutations;a<s.length;a++){var u=s[a],c=u.key,l=n.get(c),h=u.applyToLocalView(l,l,o.localWriteTime);n=h instanceof Wt?n.insert(c,h):n.remove(c)}}))})).next((function(){return n.forEach((function(e,r){t.matches(r)||(n=n.remove(e))})),n}))},e.prototype.addMissingBaseDocuments=function(e,t,n){for(var r=qe(),i=0,o=t;i<o.length;i++)for(var a=0,s=o[i].mutations;a<s.length;a++){var u=s[a];u instanceof Tt&&null===n.get(u.key)&&(r=r.add(u.key))}var c=n;return this.remoteDocumentCache.getEntries(e,r).next((function(e){return e.forEach((function(e,t){null!==t&&t instanceof Wt&&(c=c.insert(e,t))})),c}))},e}(),Hn=function(){function e(){this.refsByKey=new Ae(Gn.compareByKey),this.refsByTarget=new Ae(Gn.compareByTargetId)}return e.prototype.isEmpty=function(){return this.refsByKey.isEmpty()},e.prototype.addReference=function(e,t){var n=new Gn(e,t);this.refsByKey=this.refsByKey.add(n),this.refsByTarget=this.refsByTarget.add(n)},e.prototype.addReferences=function(e,t){var n=this;e.forEach((function(e){return n.addReference(e,t)}))},e.prototype.removeReference=function(e,t){this.removeRef(new Gn(e,t))},e.prototype.removeReferences=function(e,t){var n=this;e.forEach((function(e){return n.removeReference(e,t)}))},e.prototype.removeReferencesForId=function(e){var t=this,n=he.EMPTY,r=new Gn(n,e),i=new Gn(n,e+1),o=[];return this.refsByTarget.forEachInRange([r,i],(function(e){t.removeRef(e),o.push(e.key)})),o},e.prototype.removeAllReferences=function(){var e=this;
1this.refsByKey.forEach((function(t){return e.removeRef(t)}))},e.prototype.removeRef=function(e){this.refsByKey=this.refsByKey.delete(e),this.refsByTarget=this.refsByTarget.delete(e)},e.prototype.referencesForId=function(e){var t=he.EMPTY,n=new Gn(t,e),r=new Gn(t,e+1),i=qe();return this.refsByTarget.forEachInRange([n,r],(function(e){i=i.add(e.key)})),i},e.prototype.containsKey=function(e){var t=new Gn(e,0),n=this.refsByKey.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)},e}(),Gn=function(){function e(e,t){this.key=e,this.targetOrBatchId=t}return e.compareByKey=function(e,t){return he.comparator(e.key,t.key)||Y(e.targetOrBatchId,t.targetOrBatchId)},e.compareByTargetId=function(e,t){return Y(e.targetOrBatchId,t.targetOrBatchId)||he.comparator(e.key,t.key)},e}(),Yn=function(){function e(e,t){this.persistence=e,this.localViewReferences=new Hn,this.queryDataByTarget={},v(e.started,"LocalStore was passed an unstarted persistence implementation"),this.persistence.referenceDelegate.setInMemoryPins(this.localViewReferences),this.mutationQueue=e.getMutationQueue(t),this.remoteDocuments=e.getRemoteDocumentCache(),this.queryCache=e.getQueryCache(),this.localDocuments=new zn(this.remoteDocuments,this.mutationQueue,this.persistence.getIndexManager())}return e.prototype.handleUserChange=function(e){var t=this;return this.persistence.runTransaction("Handle user change","readonly",(function(n){var r;return t.mutationQueue.getAllMutationBatches(n).next((function(i){return r=i,t.mutationQueue=t.persistence.getMutationQueue(e),t.localDocuments=new zn(t.remoteDocuments,t.mutationQueue,t.persistence.getIndexManager()),t.mutationQueue.getAllMutationBatches(n)})).next((function(e){for(var i=[],o=[],a=qe(),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=e;p<d.length;p++){c=d[p];o.push(c.batchId);for(var m=0,y=c.mutations;m<y.length;m++){f=y[m];a=a.add(f.key)}}return t.localDocuments.getDocuments(n,a).next((function(e){return{affectedDocuments:e,removedBatchIds:i,addedBatchIds:o}}))}))}))},e.prototype.localWrite=function(e){var t=this,n=Te.now(),r=e.reduce((function(e,t){return e.add(t.key)}),qe());return this.persistence.runTransaction("Locally write mutations","readwrite",(function(i){return t.localDocuments.getDocuments(i,r).next((function(r){for(var o=[],a=0,s=e;a<s.length;a++){var u=s[a],c=u.extractBaseValue(r.get(u.key));null!=c&&o.push(new Tt(u.key,c,c.fieldMask(),_t.exists(!0)))}return t.mutationQueue.addMutationBatch(i,n,o,e).next((function(e){var t=e.applyToLocalDocumentSet(r);return{batchId:e.batchId,changes:t}}))}))}))},e.prototype.lookupMutationDocuments=function(e){var t=this;return this.persistence.runTransaction("Lookup mutation documents","readonly",(function(n){return t.mutationQueue.lookupMutationKeys(n,e).next((function(e){return e?t.localDocuments.getDocuments(n,e):Qe.resolve(null)}))}))},e.prototype.acknowledgeBatch=function(e){var t=this;return this.persistence.runTransaction("Acknowledge batch","readwrite-primary",(function(n){var r=e.batch.keys(),i=t.remoteDocuments.newChangeBuffer();return t.mutationQueue.acknowledgeBatch(n,e.batch,e.streamToken).next((function(){return t.applyWriteToRemoteDocuments(n,e,i)})).next((function(){return i.apply(n)})).next((function(){return t.mutationQueue.performConsistencyCheck(n)})).next((function(){return t.localDocuments.getDocuments(n,r)}))}))},e.prototype.rejectBatch=function(e){var t=this;return this.persistence.runTransaction("Reject batch","readwrite-primary",(function(n){var r;return t.mutationQueue.lookupMutationBatch(n,e).next((function(e){return v(null!==e,"Attempt to reject nonexistent batch!"),r=e.keys(),t.mutationQueue.removeMutationBatch(n,e)})).next((function(){return t.mutationQueue.performConsistencyCheck(n)})).next((function(){return t.localDocuments.getDocuments(n,r)}))}))},e.prototype.getHighestUnacknowledgedBatchId=function(){var e=this;return this.persistence.runTransaction("Get highest unacknowledged batch id","readonly",(function(t){return e.mutationQueue.getHighestUnacknowledgedBatchId(t)}))},e.prototype.getLastStreamToken=function(){var e=this;return this.persistence.runTransaction("Get last stream token","readonly",(function(t){return e.mutation
1Queue.getLastStreamToken(t)}))},e.prototype.setLastStreamToken=function(e){var t=this;return this.persistence.runTransaction("Set last stream token","readwrite-primary",(function(n){return t.mutationQueue.setLastStreamToken(n,e)}))},e.prototype.getLastRemoteSnapshotVersion=function(){var e=this;return this.persistence.runTransaction("Get last remote snapshot version","readonly",(function(t){return e.queryCache.getLastRemoteSnapshotVersion(t)}))},e.prototype.applyRemoteEvent=function(t){var n=this,r=this.remoteDocuments.newChangeBuffer(),i=t.snapshotVersion;return this.persistence.runTransaction("Apply remote event","readwrite-primary",(function(o){var a=[];I(t.targetChanges,(function(t,r){var s=n.queryDataByTarget[t];if(s){a.push(n.queryCache.removeMatchingKeys(o,r.removedDocuments,t).next((function(){return n.queryCache.addMatchingKeys(o,r.addedDocuments,t)})));var u=r.resumeToken;if(u.length>0){var c=s.copy({resumeToken:u,snapshotVersion:i});n.queryDataByTarget[t]=c,e.shouldPersistQueryData(s,c,r)&&a.push(n.queryCache.updateQueryData(o,c))}}}));var s=Oe(),u=qe();if(t.documentUpdates.forEach((function(e,t){u=u.add(e)})),a.push(r.getEntries(o,u).next((function(e){t.documentUpdates.forEach((function(i,u){var c=e.get(i);null==c||u.version.compareTo(c.version)>0||0===u.version.compareTo(c.version)&&c.hasPendingWrites?(r.addEntry(u),s=s.insert(i,u)):u instanceof Qt&&u.version.isEqual(Se.MIN)?(r.removeEntry(i),s=s.insert(i,u)):d("LocalStore","Ignoring outdated watch update for ",i,". Current version:",c.version," Watch version:",u.version),t.resolvedLimboDocuments.has(i)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(o,i))}))}))),!i.isEqual(Se.MIN)){var c=n.queryCache.getLastRemoteSnapshotVersion(o).next((function(e){return v(i.compareTo(e)>=0,"Watch stream reverted to previous snapshot?? "+i+" < "+e),n.queryCache.setTargetsMetadata(o,o.currentSequenceNumber,i)}));a.push(c)}
1return Qe.waitFor(a).next((function(){return r.apply(o)})).next((function(){return n.localDocuments.getLocalViewOfDocuments(o,s)}))}))},e.shouldPersistQueryData=function(e,t,n){return v(t.resumeToken.length>0,"Attempted to persist query data with no resume token"),0===e.resumeToken.length||(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=this.RESUME_TOKEN_MAX_AGE_MICROS||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)},e.prototype.notifyLocalViewChanges=function(e){var t=this;return this.persistence.runTransaction("notifyLocalViewChanges","readwrite",(function(n){return Qe.forEach(e,(function(e){return t.localViewReferences.addReferences(e.addedKeys,e.targetId),t.localViewReferences.removeReferences(e.removedKeys,e.targetId),Qe.forEach(e.removedKeys,(function(e){return t.persistence.referenceDelegate.removeReference(n,e)}))}))}))},e.prototype.nextMutationBatch=function(e){var t=this;return this.persistence.runTransaction("Get next mutation batch","readonly",(function(n){return void 0===e&&(e=-1),t.mutationQueue.getNextMutationBatchAfterBatchId(n,e)}))},e.prototype.readDocument=function(e){var t=this;return this.persistence.runTransaction("read document","readonly",(function(n){return t.localDocuments.getDocument(n,e)}))},e.prototype.allocateQuery=function(e){var t=this;return this.persistence.runTransaction("Allocate query","readwrite",(function(n){var r;return t.queryCache.getQueryData(n,e).next((function(i){return i?(r=i,Qe.resolve()):t.queryCache.allocateTargetId(n).next((function(i){return r=new In(e,i,En.Listen,n.currentSequenceNumber),t.queryCache.addQueryData(n,r)}))})).next((function(){return v(!t.queryDataByTarget[r.targetId],"Tried to allocate an already allocated query: "+e),t.queryDataByTarget[r.targetId]=r,r}))}))},e.prototype.releaseQuery=function(e,t){var n=this,r=t?"readwrite":"readwrite-primary";return this.persistence.runTransaction("Release query",r,(function(r){return n.queryCache.getQueryData(r,e).next((function(i){v(null!=i,"Tried to release nonexistent query: "+e);var o=i.targetId,a=n.queryDataByTarget[o],s=n.localViewReferences.removeReferencesForId(o);return delete n.queryDataByTarget[o],t?Qe.resolve():Qe.forEach(s,(function(e){return n.persistence.referenceDelegate.removeReference(r,e)})).next((function(){return n.persistence.referenceDelegate.removeTarget(r,a)}))}))}))},e.prototype.executeQuery=function(e){var t=this;return this.persistence.runTransaction("Execute query","readonly",(function(n){return t.localDocuments.getDocumentsMatchingQuery(n,e)}))},e.prototype.remoteDocumentKeys=function(e){var t=this;return this.persistence.runTransaction("Remote document keys","readonly",(function(n){return t.queryCache.getMatchingKeysForTargetId(n,e)}))},e.prototype.getActiveClients=function(){return this.persistence.getActiveClients()},e.prototype.removeCachedMutationBatchMetadata=function(e){this.mutationQueue.removeCachedMutationKeys(e)},e.prototype.setNetworkEnabled=function(e){this.persistence.setNetworkEnabled(e)},e.prototype.applyWriteToRemoteDocuments=function(e,t,n){var r=this,i=t.batch,o=i.keys(),a=Qe.resolve();return o.forEach((function(r){a=a.next((function(){return n.getEntry(e,r)})).next((function(e){var o=e,a=t.docVersions.get(r);v(null!==a,"ackVersions should contain every doc in the write."),(!o||o.version.compareTo(a)<0)&&((o=i.applyToRemoteDocument(r,o,t))?n.addEntry(o):v(!e,"Mutation batch "+i+" applied to document "+e+" resulted in null"))}))})),a.next((function(){return r.mutationQueue.removeMutationBatch(e,i)}))},e.prototype.collectGarbage=function(e){var t=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",(function(n){return e.collect(n,t.queryDataByTarget)}))},e.prototype.getQueryForTarget=function(e){var t=this;return this.queryDataByTarget[e]?Promise.resolve(this.queryDataByTarget[e].query):this.persistence.runTransaction("Get query data","readonly",(function(n){return t.queryCache.getQueryDataForTarget(n,e).next((function(e){return e?e.query:null}))}))},e.prototype.getNewDocumentChanges=function(){var e=this;return this.persistence.runTransaction("Get new document changes","readonly",(function(t){return e.remoteDocuments.getNewDocumentChanges(t)}))},e.RESUME_TOKEN_MAX_AGE_MICROS=3e8,e}(),Xn=function(){function e(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutation
1Queue=[],this.nextBatchId=1,this.lastStreamToken=_(),this.batchesByDocumentKey=new Ae(Gn.compareByKey)}return e.prototype.checkEmpty=function(e){return Qe.resolve(0===this.mutationQueue.length)},e.prototype.acknowledgeBatch=function(e,t,n){var r=t.batchId,i=this.indexOfExistingBatchId(r,"acknowledged");v(0===i,"Can only acknowledge the first batch in the mutation queue");var o=this.mutationQueue[i];return v(r===o.batchId,"Queue ordering failure: expected batch "+r+", got batch "+o.batchId),this.lastStreamToken=n,Qe.resolve()},e.prototype.getLastStreamToken=function(e){return Qe.resolve(this.lastStreamToken)},e.prototype.setLastStreamToken=function(e,t){return this.lastStreamToken=t,Qe.resolve()},e.prototype.addMutationBatch=function(e,t,n,r){v(0!==r.length,"Mutation batches should not be empty");var i=this.nextBatchId;(this.nextBatchId++,this.mutationQueue.length>0)&&v(this.mutationQueue[this.mutationQueue.length-1].batchId<i,"Mutation batchIDs must be monotonically increasing order");var o=new Be(i,t,n,r);this.mutationQueue.push(o);for(var a=0,s=r;a<s.length;a++){var u=s[a];this.batchesByDocumentKey=this.batchesByDocumentKey.add(new Gn(u.key,i)),this.indexManager.addToCollectionParentIndex(e,u.key.path.popLast())}return Qe.resolve(o)},e.prototype.lookupMutationBatch=function(e,t){return Qe.resolve(this.findMutationBatch(t))},e.prototype.lookupMutationKeys=function(e,t){var n=this.findMutationBatch(t);return v(null!=n,"Failed to find local mutation batch."),Qe.resolve(n.keys())},e.prototype.getNextMutationBatchAfterBatchId=function(e,t){var n=t+1,r=this.indexOfBatchId(n),i=r<0?0:r;return Qe.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)},e.prototype.getHighestUnacknowledgedBatchId=function(){return Qe.resolve(0===this.mutationQueue.length?-1:this.nextBatchId-1)},e.prototype.getAllMutationBatches=function(e){return Qe.resolve(this.mutationQueue.slice())},e.prototype.getAllMutationBatchesAffectingDocumentKey=function(e,t){var n=this,r=new Gn(t,0),i=new Gn(t,Number.POSITIVE_INFINITY),o=[];return this.batchesByDocumentKey.forEachInRange([r,i],(function(e){v(t.isEqual(e.key),"Should only iterate over a single key's batches");var r=n.findMutationBatch(e.targetOrBatchId);v(null!==r,"Batches in the index must exist in the main table"),o.push(r)})),Qe.resolve(o)},e.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,t){var n=this,r=new Ae(Y);return t.forEach((function(e){var t=new Gn(e,0),i=new Gn(e,Number.POSITIVE_INFINITY);n.batchesByDocumentKey.forEachInRange([t,i],(function(t){v(e.isEqual(t.key),"For each key, should only iterate over a single key's batches"),r=r.add(t.targetOrBatchId)}))})),Qe.resolve(this.findMutationBatches(r))},e.prototype.getAllMutationBatchesAffectingQuery=function(e,t){v(!t.isCollectionGroupQuery(),"CollectionGroup queries should be handled in LocalDocumentsView");var n=t.path,r=n.length+1,i=n;he.isDocumentKey(i)||(i=i.child(""));var o=new Gn(new he(i),0),a=new Ae(Y);return this.batchesByDocumentKey.forEachWhile((function(e){var t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(a=a.add(e.targetOrBatchId)),!0)}),o),Qe.resolve(this.findMutationBatches(a))},e.prototype.findMutationBatches=function(e){var t=this,n=[];return e.forEach((function(e){var r=t.findMutationBatch(e);null!==r&&n.push(r)})),n},e.prototype.removeMutationBatch=function(e,t){var n=this;v(0===this.indexOfExistingBatchId(t.batchId,"removed"),"Can only remove the first entry of the mutation queue"),this.mutationQueue.shift();var r=this.batchesByDocumentKey;return Qe.forEach(t.mutations,(function(i){var o=new Gn(i.key,t.batchId);return r=r.delete(o),n.referenceDelegate.removeMutationReference(e,i.key)})).next((function(){n.batchesByDocumentKey=r}))},e.prototype.removeCachedMutationKeys=function(e){},e.prototype.containsKey=function(e,t){var n=new Gn(t,0),r=this.batchesByDocumentKey.firstAfterOrEqual(n);return Qe.resolve(t.isEqual(r&&r.key))},e.prototype.performConsistencyCheck=function(e){return 0===this.mutationQueue.length&&v(this.batchesByDocumentKey.isEmpty(),"Document leak -- detected dangling mutation references when queue is empty."),Qe.resolve()},e.prototype.indexOfExistingBatchId=function(e,t){var n=this.indexOfBatchId(e);return v(n>
1=0&&n<this.mutationQueue.length,"Batches must exist to be "+t),n},e.prototype.indexOfBatchId=function(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId},e.prototype.findMutationBatch=function(e){var t=this.indexOfBatchId(e);if(t<0||t>=this.mutationQueue.length)return null;var n=this.mutationQueue[t];return v(n.batchId===e,"If found batch must match"),n},e}(),Jn=function(){function e(e){this.persistence=e,this.queries=new zt((function(e){return e.canonicalId()})),this.lastRemoteSnapshotVersion=Se.MIN,this.highestTargetId=0,this.highestSequenceNumber=0,this.references=new Hn,this.targetCount=0,this.targetIdGenerator=et.forQueryCache()}return e.prototype.getTargetCount=function(e){return Qe.resolve(this.targetCount)},e.prototype.forEachTarget=function(e,t){return this.queries.forEach((function(e,n){return t(n)})),Qe.resolve()},e.prototype.getLastRemoteSnapshotVersion=function(e){return Qe.resolve(this.lastRemoteSnapshotVersion)},e.prototype.getHighestSequenceNumber=function(e){return Qe.resolve(this.highestSequenceNumber)},e.prototype.allocateTargetId=function(e){var t=this.targetIdGenerator.after(this.highestTargetId);return this.highestTargetId=t,Qe.resolve(t)},e.prototype.setTargetsMetadata=function(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.highestSequenceNumber&&(this.highestSequenceNumber=t),Qe.resolve()},e.prototype.saveQueryData=function(e){this.queries.set(e.query,e);var t=e.targetId;t>this.highestTargetId&&(this.highestTargetId=t),e.sequenceNumber>this.highestSequenceNumber&&(this.highestSequenceNumber=e.sequenceNumber)},e.prototype.addQueryData=function(e,t){return v(!this.queries.has(t.query),"Adding a query that already exists"),this.saveQueryData(t),this.targetCount+=1,Qe.resolve()},e.prototype.updateQueryData=function(e,t){return v(this.queries.has(t.query),"Updating a non-existent query"),this.saveQueryData(t),Qe.resolve()},e.prototype.removeQueryData=function(e,t){return v(this.targetCount>0,"Removing a target from an empty cache"),v(this.queries.has(t.query),"Removing a non-existent target from the cache"),this.queries.delete(t.query),this.references.removeReferencesForId(t.targetId),this.targetCount-=1,Qe.resolve()},e.prototype.removeTargets=function(e,t,n){var r=this,i=0,o=[];return this.queries.forEach((function(a,s){s.sequenceNumber<=t&&!n[s.targetId]&&(r.queries.delete(a),o.push(r.removeMatchingKeysForTargetId(e,s.targetId)),i++)})),Qe.waitFor(o).next((function(){return i}))},e.prototype.getQueryCount=function(e){return Qe.resolve(this.targetCount)},e.prototype.getQueryData=function(e,t){var n=this.queries.get(t)||null;return Qe.resolve(n)},e.prototype.getQueryDataForTarget=function(e,t){return g("Not yet implemented.")},e.prototype.addMatchingKeys=function(e,t,n){this.references.addReferences(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((function(t){i.push(r.addReference(e,t))})),Qe.waitFor(i)},e.prototype.removeMatchingKeys=function(e,t,n){this.references.removeReferences(t,n);var r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((function(t){i.push(r.removeReference(e,t))})),Qe.waitFor(i)},e.prototype.removeMatchingKeysForTargetId=function(e,t){return this.references.removeReferencesForId(t),Qe.resolve()},e.prototype.getMatchingKeysForTargetId=function(e,t){var n=this.references.referencesForId(t);return Qe.resolve(n)},e.prototype.containsKey=function(e,t){return Qe.resolve(this.references.containsKey(t))},e}();var $n=function(){function e(e,t){this.indexManager=e,this.sizer=t,this.docs=new Ce(he.comparator),this.newDocumentChanges=qe(),this.size=0}return e.prototype.addEntry=function(e,t){var n=t.key,r=this.docs.get(n),i=r?r.size:0,o=this.sizer(t);return this.docs=this.docs.insert(n,{maybeDocument:t,size:o}),this.newDocumentChanges=this.newDocumentChanges.add(n),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())},e.prototype.removeEntry=function(e){var t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)},e.prototype.getEntry=function(e,t){var n=this.docs.get(t);return Qe.resolve(n?n.maybeDocument:null)},e.prototype.getEntries=function(e,t){var n=this,r=Pe();return t.forEach((function(e){var t=n.docs.get(e);r=r.insert(e,t?t.maybeDocument:null)})),Qe.resolve(r)},e.prototype.getDocumentsMatchingQuery=function(e,t){v(!t.isCollectionGroupQuery(),"CollectionGroup queries should be handled in LocalDocumentsView");for(var n=Me(),r=new he(t.path.child("")),i=this.docs.getIteratorFrom(r);i.hasNext();){var o=i.getNext(),a=o.key,s=o.value.maybeDocument;if(!t.path.isPrefixOf(a.path))break;s instanceof Wt&&t.matches(s)&&(n=n.insert(s.key,s))}return Qe.resolve(n)},e.prototype.forEachDocumentKey=function(e,t){return Qe.forEach(this.docs,(function(e){return t(e)}))},e.prototype.getNewDocumentChanges=function(e){var t=this,n=Oe();
1return this.newDocumentChanges.forEach((function(e){var r=t.docs.get(e),i=r?r.maybeDocument:new Qt(e,Se.forDeletedDoc());n=n.insert(e,i)})),this.newDocumentChanges=qe(),Qe.resolve(n)},e.prototype.newChangeBuffer=function(){return new e.RemoteDocumentChangeBuffer(this)},e.prototype.getSize=function(e){return Qe.resolve(this.size)},e.RemoteDocumentChangeBuffer=function(e){function t(t){var n=e.call(this)||this;return n.documentCache=t,n}return s.__extends(t,e),t.prototype.applyChanges=function(e){var t=this,n=[];return this.changes.forEach((function(r,i){i?n.push(t.documentCache.addEntry(e,i)):t.documentCache.removeEntry(r)})),Qe.waitFor(n)},t.prototype.getFromCache=function(e,t){return this.documentCache.getEntry(e,t)},t.prototype.getAllFromCache=function(e,t){return this.documentCache.getEntries(e,t)},t}(Ht),e}(),Zn=function(){function e(e,t){var n=this;this.clientId=e,this.mutationQueues={},this.listenSequence=new ae(0),this._started=!1,this._started=!0,this.referenceDelegate=t(this),this.queryCache=new Jn(this);this.indexManager=new tn,this.remoteDocumentCache=new $n(this.indexManager,(function(e){return n.referenceDelegate.documentSize(e)}))}return e.createLruPersistence=function(t,n,r){return new e(t,(function(e){return new nr(e,new kn(n),r)}))},e.createEagerPersistence=function(t){return new e(t,(function(e){return new tr(e)}))},e.prototype.shutdown=function(){return this._started=!1,Promise.resolve()},Object.defineProperty(e.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),e.prototype.getActiveClients=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){return[2,[this.clientId]]}))}))},e.prototype.setPrimaryStateListener=function(e){return e(!0)},e.prototype.setDatabaseDeletedListener=function(){},e.prototype.setNetworkEnabled=function(e){},e.prototype.getIndexManager=function(){return this.indexManager},e.prototype.getMutationQueue=function(e){var t=this.mutationQueues[e.toKey()];return t||(t=new Xn(this.indexManager,this.referenceDelegate),this.mutationQueues[e.toKey()]=t),t},e.prototype.getQueryCache=function(){return this.queryCache},e.prototype.getRemoteDocumentCache=function(){return this.remoteDocumentCache},e.prototype.runTransaction=function(e,t,n){var r=this;d("MemoryPersistence","Starting transaction:",e);var i=new er(this.listenSequence.next());return this.referenceDelegate.onTransactionStarted(),n(i).next((function(e){return r.referenceDelegate.onTransactionCommitted(i).next((function(){return e}))})).toPromise()},e.prototype.mutationQueuesContainKey=function(e,t){return Qe.or(function(e){var t=[];return k(e,(function(e,n){return t.push(n)})),t}(this.mutationQueues).map((function(n){return function(){return n.containsKey(e,t)}})))},e}(),er=function(){return function(e){this.currentSequenceNumber=e}}(),tr=function(){function e(e){this.persistence=e,this.inMemoryPins=null,this._orphanedDocuments=null}return Object.defineProperty(e.prototype,"orphanedDocuments",{get:function(){if(this._orphanedDocuments)return this._orphanedDocuments;throw g("orphanedDocuments is only valid during a transaction.")},enumerable:!0,configurable:!0}),e.prototype.setInMemoryPins=function(e){this.inMemoryPins=e},e.prototype.addReference=function(e,t){return this.orphanedDocuments.delete(t),Qe.resolve()},e.prototype.removeReference=function(e,t){return this.orphanedDocuments.add(t),Qe.resolve()},e.prototype.removeMutationReference=function(e,t){return this.orphanedDocuments.add(t),Qe.resolve()},e.prototype.removeTarget=function(e,t){var n=this,r=this.persistence.getQueryCache();return r.getMatchingKeysForTargetId(e,t.targetId).next((function(e){e.forEach((function(e){return n.orphanedDocuments.add(e)}))})).next((function(){return r.removeQueryData(e,t)}))},e.prototype.onTransactionStarted=function(){this._orphanedDocuments=new Set},e.prototype.onTransactionCommitted=function(e){var t=this,n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Qe.forEach(this.orphanedDocuments,(function(r){return t.isReferenced(e,r).next((function(e){e||n.removeEntry(r)}))}
1)).next((function(){return t._orphanedDocuments=null,n.apply(e)}))},e.prototype.updateLimboDocument=function(e,t){var n=this;return this.isReferenced(e,t).next((function(e){e?n.orphanedDocuments.delete(t):n.orphanedDocuments.add(t)}))},e.prototype.documentSize=function(e){return 0},e.prototype.isReferenced=function(e,t){var n=this;return Qe.or([function(){return n.persistence.getQueryCache().containsKey(e,t)},function(){return n.persistence.mutationQueuesContainKey(e,t)},function(){return Qe.resolve(n.inMemoryPins.containsKey(t))}])},e}(),nr=function(){function e(e,t,n){this.persistence=e,this.serializer=t,this.inMemoryPins=null,this.orphanedSequenceNumbers=new zt((function(e){return be(e.path)})),this.garbageCollector=new Pn(this,n)}return e.prototype.onTransactionStarted=function(){},e.prototype.onTransactionCommitted=function(e){return Qe.resolve()},e.prototype.forEachTarget=function(e,t){return this.persistence.getQueryCache().forEachTarget(e,t)},e.prototype.getSequenceNumberCount=function(e){var t=this.orphanedDocumentCount(e);return this.persistence.getQueryCache().getTargetCount(e).next((function(e){return t.next((function(t){return e+t}))}))},e.prototype.orphanedDocumentCount=function(e){var t=0;return this.forEachOrphanedDocumentSequenceNumber(e,(function(e){t++})).next((function(){return t}))},e.prototype.forEachOrphanedDocumentSequenceNumber=function(e,t){var n=this;return Qe.forEach(this.orphanedSequenceNumbers,(function(r,i){return n.isPinned(e,r,i).next((function(e){return e?Qe.resolve():t(i)}))}))},e.prototype.setInMemoryPins=function(e){this.inMemoryPins=e},e.prototype.removeTargets=function(e,t,n){return this.persistence.getQueryCache().removeTargets(e,t,n)},e.prototype.removeOrphanedDocuments=function(e,t){var n=this,r=0,i=this.persistence.getRemoteDocumentCache(),o=i.newChangeBuffer();return i.forEachDocumentKey(e,(function(i){return n.isPinned(e,i,t).next((function(e){e||(r++,o.removeEntry(i))}))})).next((function(){return o.apply(e)})).next((function(){return r}))},e.prototype.removeMutationReference=function(e,t){return this.orphanedSequenceNumbers.set(t,e.currentSequenceNumber),Qe.resolve()},e.prototype.removeTarget=function(e,t){var n=t.copy({sequenceNumber:e.currentSequenceNumber});return this.persistence.getQueryCache().updateQueryData(e,n)},e.prototype.addReference=function(e,t){return this.orphanedSequenceNumbers.set(t,e.currentSequenceNumber),Qe.resolve()},e.prototype.removeReference=function(e,t){return this.orphanedSequenceNumbers.set(t,e.currentSequenceNumber),Qe.resolve()},e.prototype.updateLimboDocument=function(e,t){return this.orphanedSequenceNumbers.set(t,e.currentSequenceNumber),Qe.resolve()},e.prototype.documentSize=function(e){var t,n=this.serializer.toDbRemoteDocument(e);if(n.document)t=n.document;else if(n.unknownDocument)t=n.unknownDocument;else{if(!n.noDocument)throw g("Unknown remote document type");t=n.noDocument}return JSON.stringify(t).length},e.prototype.isPinned=function(e,t,n){var r=this;return Qe.or([function(){return r.persistence.mutationQueuesContainKey(e,t)},function(){return Qe.resolve(r.inMemoryPins.containsKey(t))},function(){return r.persistence.getQueryCache().containsKey(e,t)},function(){var e=r.orphanedSequenceNumbers.get(t);return Qe.resolve(void 0!==e&&e>n)}])},e.prototype.getCacheSize=function(e){return this.persistence.getRemoteDocumentCache().getSize(e)},e}(),rr=Number,ir=rr.MIN_SAFE_INTEGER||-(Math.pow(2,53)-1),or=rr.MAX_SAFE_INTEGER||Math.pow(2,53)-1,ar=rr.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e};function sr(e){return null===e||void 0===e}function ur(e){return ar(e)&&e<=or&&e>=ir}var cr,lr=1e3,hr=1.5,fr=6e4,pr=function(){function e(e,t,n,r,i){void 0===n&&(n=lr),void 0===r&&(r=hr),void 0===i&&(i=fr),this.queue=e,this.timerId=t,this.initialDelayMs=n,this.backoffFactor=r,this.maxDelayMs=i,this.currentBaseMs=0,this.timerPromise=null,this.lastAttemptTime=Date.now(),this.reset()}return e.prototype.reset=function(){this.currentBaseMs=0},e.prototype.resetToMax=function(){this.currentBaseMs=this.maxDelayMs},e.prototype.backoffAndRun=function(e){var t=this;this.cancel();
1var n=Math.floor(this.currentBaseMs+this.jitterDelayMs()),r=Math.max(0,Date.now()-this.lastAttemptTime),i=Math.max(0,n-r);this.currentBaseMs>0&&d("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 t.lastAttemptTime=Date.now(),e()})),this.currentBaseMs*=this.backoffFactor,this.currentBaseMs<this.initialDelayMs&&(this.currentBaseMs=this.initialDelayMs),this.currentBaseMs>this.maxDelayMs&&(this.currentBaseMs=this.maxDelayMs)},e.prototype.cancel=function(){null!==this.timerPromise&&(this.timerPromise.cancel(),this.timerPromise=null)},e.prototype.jitterDelayMs=function(){return(Math.random()-.5)*this.currentBaseMs},e}();!function(e){e[e.Initial=0]="Initial",e[e.Starting=1]="Starting",e[e.Open=2]="Open",e[e.Error=3]="Error",e[e.Backoff=4]="Backoff"}(cr||(cr={}));var dr,mr,yr=function(){function e(e,t,n,r,i,o){this.queue=e,this.idleTimerId=n,this.connection=r,this.credentialsProvider=i,this.listener=o,this.state=cr.Initial,this.closeCount=0,this.idleTimer=null,this.stream=null,this.backoff=new pr(e,t)}return e.prototype.isStarted=function(){return this.state===cr.Starting||this.state===cr.Open||this.state===cr.Backoff},e.prototype.isOpen=function(){return this.state===cr.Open},e.prototype.start=function(){this.state!==cr.Error?(v(this.state===cr.Initial,"Already started"),this.auth()):this.performBackoff()},e.prototype.stop=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return this.isStarted()?[4,this.close(cr.Initial)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}
1))}))},e.prototype.inhibitBackoff=function(){v(!this.isStarted(),"Can only inhibit backoff in a stopped state"),this.state=cr.Initial,this.backoff.reset()},e.prototype.markIdle=function(){var e=this;this.isOpen()&&null===this.idleTimer&&(this.idleTimer=this.queue.enqueueAfterDelay(this.idleTimerId,6e4,(function(){return e.handleIdleCloseTimer()})))},e.prototype.sendRequest=function(e){this.cancelIdleCheck(),this.stream.send(e)},e.prototype.handleIdleCloseTimer=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){return this.isOpen()?[2,this.close(cr.Initial)]:[2]}))}))},e.prototype.cancelIdleCheck=function(){this.idleTimer&&(this.idleTimer.cancel(),this.idleTimer=null)},e.prototype.close=function(e,t){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(n){switch(n.label){case 0:return v(this.isStarted(),"Only started streams should be closed."),v(e===cr.Error||sr(t),"Can't provide an error when not in an error state."),this.cancelIdleCheck(),this.backoff.cancel(),this.closeCount++,e!==cr.Error?this.backoff.reset():t&&t.code===w.RESOURCE_EXHAUSTED?(m(t.toString()),m("Using maximum backoff delay to prevent overloading the backend."),this.backoff.resetToMax()):t&&t.code===w.UNAUTHENTICATED&&this.credentialsProvider.invalidateToken(),null!==this.stream&&(this.tearDown(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.onClose(t)];case 1:return n.sent(),[2]}}))}))},e.prototype.tearDown=function(){},e.prototype.auth=function(){var e=this;v(this.state===cr.Initial,"Must be in initial state to auth"),this.state=cr.Starting;var t=this.getCloseGuardedDispatcher(this.closeCount),n=this.closeCount;this.credentialsProvider.getToken().then((function(t){e.closeCount===n&&e.startStream(t)}),(function(n){t((function(){var t=new E(w.UNKNOWN,"Fetching auth token failed: "+n.message);return e.handleStreamClose(t)}))}))},e.prototype.startStream=function(e){var t=this;v(this.state===cr.Starting,"Trying to start stream in a non-starting state");var n=this.getCloseGuardedDispatcher(this.closeCount);this.stream=this.startRpc(e),this.stream.onOpen((function(){n((function(){return v(t.state===cr.Starting,"Expected stream to be in state Starting, but was "+t.state),t.state=cr.Open,t.listener.onOpen()}))})),this.stream.onClose((function(e){n((function(){return t.handleStreamClose(e)}))})),this.stream.onMessage((function(e){n((function(){return t.onMessage(e)}))}))},e.prototype.performBackoff=function(){var e=this;v(this.state===cr.Error,"Should only perform backoff when in Error state"),this.state=cr.Backoff,this.backoff.backoffAndRun((function(){return s.__awaiter(e,void 0,void 0,(function(){return s.__generator(this,(function(e){return v(this.state===cr.Backoff,"Backoff elapsed but state is now: "+this.state),this.state=cr.Initial,this.start(),v(this.isStarted(),"PersistentStream should have started"),[2]}))}))}))},e.prototype.handleStreamClose=function(e){return v(this.isStarted(),"Can't handle server close on non-started stream"),d("PersistentStream","close with error: "+e),this.stream=null,this.close(cr.Error,e)},e.prototype.getCloseGuardedDispatcher=function(e){var t=this;return function(n){t.queue.enqueueAndForget((function(){return t.closeCount===e?n():(d("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())}))}},e}(),gr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,ee.ListenStreamConnectionBackoff,ee.ListenStreamIdle,n,r,o)||this;return a.serializer=i,a}return s.__extends(t,e),t.prototype.startRpc=function(e){return this.connection.openStream("Listen",e)},t.prototype.onMessage=function(e){this.backoff.reset();var t=this.serializer.fromWatchChange(e),n=this.serializer.versionFromListenResponse(e);return this.listener.onWatchChange(t,n)},t.prototype.watch=function(e){var t={};t.database=this.serializer.encodedDatabaseId,t.addTarget=this.serializer.toTarget(e);var n=this.serializer.toListenRequestLabels(e);n&&(t.labels=n),this.sendRequest(t)},t.prototype.unwatch=function(e){var t={};t.database=this.serializer.encodedDatabaseId,t.removeTarget=e,this.sendRequest(t)},t}(yr),vr=function(e){function t(t,n,r,i,o){var a=e.call(this,t,ee.WriteStreamConnectionBackoff,ee.WriteStreamIdle,n,r,o)||this;
1return a.serializer=i,a.handshakeComplete_=!1,a.lastStreamToken=_(),a}return s.__extends(t,e),Object.defineProperty(t.prototype,"handshakeComplete",{get:function(){return this.handshakeComplete_},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.handshakeComplete_=!1,e.prototype.start.call(this)},t.prototype.tearDown=function(){this.handshakeComplete_&&this.writeMutations([])},t.prototype.startRpc=function(e){return this.connection.openStream("Write",e)},t.prototype.onMessage=function(e){if(v(!!e.streamToken,"Got a write response without a stream token"),this.lastStreamToken=e.streamToken,this.handshakeComplete_){this.backoff.reset();var t=this.serializer.fromWriteResults(e.writeResults,e.commitTime),n=this.serializer.fromVersion(e.commitTime);return this.listener.onMutationResult(n,t)}return v(!e.writeResults||0===e.writeResults.length,"Got mutation results for handshake"),this.handshakeComplete_=!0,this.listener.onHandshakeComplete()},t.prototype.writeHandshake=function(){v(this.isOpen(),"Writing handshake requires an opened stream"),v(!this.handshakeComplete_,"Handshake already completed");var e={};e.database=this.serializer.encodedDatabaseId,this.sendRequest(e)},t.prototype.writeMutations=function(e){var t=this;v(this.isOpen(),"Writing mutations requires an opened stream"),v(this.handshakeComplete_,"Handshake must be complete before writing mutations"),v(this.lastStreamToken.length>0,"Trying to write mutation without a token");var n={streamToken:this.lastStreamToken,writes:e.map((function(e){return t.serializer.toMutation(e)}))};this.sendRequest(n)},t}(yr),br=function(){function e(e,t,n,r){this.queue=e,this.connection=t,this.credentials=n,this.serializer=r}return e.prototype.newPersistentWriteStream=function(e){return new vr(this.queue,this.connection,this.credentials,this.serializer,e)},e.prototype.newPersistentWatchStream=function(e){return new gr(this.queue,this.connection,this.credentials,this.serializer,e)},e.prototype.commit=function(e){var t=this,n={database:this.serializer.encodedDatabaseId,writes:e.map((function(e){return t.serializer.toMutation(e)}))};return this.invokeRPC("Commit",n).then((function(e){return t.serializer.fromWriteResults(e.writeResults,e.commitTime)}))},e.prototype.lookup=function(e){var t=this,n={database:this.serializer.encodedDatabaseId,documents:e.map((function(e){return t.serializer.toName(e)}))};return this.invokeStreamingRPC("BatchGetDocuments",n).then((function(n){var r=Oe();n.forEach((function(e){var n=t.serializer.fromMaybeDocument(e);r=r.insert(n.key,n)}));var i=[];return e.forEach((function(e){var t=r.get(e);v(!!t,"Missing entity in write response for "+e),i.push(t)})),i}))},e.prototype.invokeRPC=function(e,t){var n=this;return this.credentials.getToken().then((function(r){return n.connection.invokeRPC(e,t,r)})).catch((function(e){throw e.code===w.UNAUTHENTICATED&&n.credentials.invalidateToken(),e}))},e.prototype.invokeStreamingRPC=function(e,t){var n=this;return this.credentials.getToken().then((function(r){return n.connection.invokeStreamingRPC(e,t,r)})).catch((function(e){throw e.code===w.UNAUTHENTICATED&&n.credentials.invalidateToken(),e}))},e}(),_r=function(){function e(e){this.datastore=e,this.readVersions=Fe(),this.mutations=[],this.committed=!1,this.lastWriteError=null,this.writtenDocs=new Set}return e.prototype.lookup=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n=this;return s.__generator(this,(function(r){switch(r.label){case 0:if(this.ensureCommitNotCalled(),this.mutations.length>0)throw new E(w.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,this.datastore.lookup(e)];case 1:return(t=r.sent()).forEach((function(e){e instanceof Qt||e instanceof Wt?n.recordVersion(e):g("Document in a transaction was a "+e.constructor.name)})),[2,t]}}))}))},e.prototype.set=function(e,t){this.write(t.toMutations(e,this.precondition(e))),this.writtenDocs.add(e)},e.prototype.update=function(e,t){try{this.write(t.toMutations(e,this.preconditionForUpdate(e)))}catch(n){this.lastWriteError=n}this.writtenDocs.add(e)}
1,e.prototype.delete=function(e){this.write([new Ct(e,this.precondition(e))]),this.writtenDocs.add(e)},e.prototype.commit=function(){return s.__awaiter(this,void 0,void 0,(function(){var e;return s.__generator(this,(function(t){switch(t.label){case 0:if(this.ensureCommitNotCalled(),this.lastWriteError)throw this.lastWriteError;if(e=this.readVersions,this.mutations.forEach((function(t){e=e.remove(t.key)})),!e.isEmpty())throw new E(w.INVALID_ARGUMENT,"Every document read in a transaction must also be written.");return[4,this.datastore.commit(this.mutations)];case 1:return t.sent(),this.committed=!0,[2]}}))}))},e.prototype.recordVersion=function(e){var t;if(e instanceof Wt)t=e.version;else{if(!(e instanceof Qt))throw g("Document in a transaction was a "+e.constructor.name);t=Se.forDeletedDoc()}var n=this.readVersions.get(e.key);if(null!==n){if(!t.isEqual(n))throw new E(w.ABORTED,"Document version changed between two reads.")}else this.readVersions=this.readVersions.insert(e.key,t)},e.prototype.precondition=function(e){var t=this.readVersions.get(e);return!this.writtenDocs.has(e)&&t?_t.updateTime(t):_t.NONE},e.prototype.preconditionForUpdate=function(e){var t=this.readVersions.get(e);if(!this.writtenDocs.has(e)&&t){if(t.isEqual(Se.forDeletedDoc()))throw new E(w.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return _t.updateTime(t)}return _t.exists(!0)},e.prototype.write=function(e){this.ensureCommitNotCalled(),this.mutations=this.mutations.concat(e)},e.prototype.ensureCommitNotCalled=function(){v(!this.committed,"A transaction object cannot be used after its update callback has been invoked.")},e}();!function(e){e[e.Unknown=0]="Unknown",e[e.Online=1]="Online",e[e.Offline=2]="Offline"}(dr||(dr={})),function(e){e[e.RemoteStore=0]="RemoteStore",e[e.SharedClientState=1]="SharedClientState"}(mr||(mr={}));var wr,Er=function(){function e(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state=dr.Unknown,this.watchStreamFailures=0,this.onlineStateTimer=null,this.shouldWarnClientIsOffline=!0}return e.prototype.handleWatchStreamStart=function(){var e=this;0===this.watchStreamFailures&&(this.setAndBroadcast(dr.Unknown),v(null===this.onlineStateTimer,"onlineStateTimer shouldn't be started yet"),this.onlineStateTimer=this.asyncQueue.enqueueAfterDelay(ee.OnlineStateTimeout,1e4,(function(){return e.onlineStateTimer=null,v(e.state===dr.Unknown,"Timer should be canceled if we transitioned to a different state."),e.logClientOfflineWarningIfNecessary("Backend didn't respond within 10 seconds."),e.setAndBroadcast(dr.Offline),Promise.resolve()})))},e.prototype.handleWatchStreamFailure=function(e){this.state===dr.Online?(this.setAndBroadcast(dr.Unknown),v(0===this.watchStreamFailures,"watchStreamFailures must be 0"),v(null===this.onlineStateTimer,"onlineStateTimer must be null")):(this.watchStreamFailures++,this.watchStreamFailures>=1&&(this.clearOnlineStateTimer(),this.logClientOfflineWarningIfNecessary("Connection failed 1 times. Most recent error: "+e.toString()),this.setAndBroadcast(dr.Offline)))},e.prototype.set=function(e){this.clearOnlineStateTimer(),this.watchStreamFailures=0,e===dr.Online&&(this.shouldWarnClientIsOffline=!1),this.setAndBroadcast(e)},e.prototype.setAndBroadcast=function(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))},e.prototype.logClientOfflineWarningIfNecessary=function(e){var t="Could not reach Cloud Firestore backend. "+e+"\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?(m(t),this.shouldWarnClientIsOffline=!1):d("OnlineStateTracker",t)},e.prototype.clearOnlineStateTimer=function(){null!==this.onlineStateTimer&&(this.onlineStateTimer.cancel(),this.onlineStateTimer=null)},e}();function Tr(e){switch(e){case w.OK:return g("Treated status OK as error");case w.CANCELLED:case w.UNKNOWN:case w.DEADLINE_EXCEEDED:case w.RESOURCE_EXHAUSTED:case w.INTERNAL:case w.UNAVAILABLE:case w.UNAUTHENTICATED:return!1;case w.INVALID_ARGUMENT:case w.NOT_FOUND:case w.ALREADY_EXISTS:case w.PERMISSION_DENIED:case w.FAILED_PRECONDITION:case w.ABORTED:case w.OUT_OF_RANGE:case w.UNIMPLEMENT
1ED:case w.DATA_LOSS:return!0;default:return g("Unknown status code: "+e)}}function Sr(e){if(void 0===e)return m("GRPC error has no .code"),w.UNKNOWN;switch(e){case wr.OK:return w.OK;case wr.CANCELLED:return w.CANCELLED;case wr.UNKNOWN:return w.UNKNOWN;case wr.DEADLINE_EXCEEDED:return w.DEADLINE_EXCEEDED;case wr.RESOURCE_EXHAUSTED:return w.RESOURCE_EXHAUSTED;case wr.INTERNAL:return w.INTERNAL;case wr.UNAVAILABLE:return w.UNAVAILABLE;case wr.UNAUTHENTICATED:return w.UNAUTHENTICATED;case wr.INVALID_ARGUMENT:return w.INVALID_ARGUMENT;case wr.NOT_FOUND:return w.NOT_FOUND;case wr.ALREADY_EXISTS:return w.ALREADY_EXISTS;case wr.PERMISSION_DENIED:return w.PERMISSION_DENIED;case wr.FAILED_PRECONDITION:return w.FAILED_PRECONDITION;case wr.ABORTED:return w.ABORTED;case wr.OUT_OF_RANGE:return w.OUT_OF_RANGE;case wr.UNIMPLEMENTED:return w.UNIMPLEMENTED;case wr.DATA_LOSS:return w.DATA_LOSS;default:return g("Unknown status code: "+e)}}function Cr(e){if(void 0===e)return wr.OK;switch(e){case w.OK:return wr.OK;case w.CANCELLED:return wr.CANCELLED;case w.UNKNOWN:return wr.UNKNOWN;case w.DEADLINE_EXCEEDED:return wr.DEADLINE_EXCEEDED;case w.RESOURCE_EXHAUSTED:return wr.RESOURCE_EXHAUSTED;case w.INTERNAL:return wr.INTERNAL;case w.UNAVAILABLE:return wr.UNAVAILABLE;case w.UNAUTHENTICATED:return wr.UNAUTHENTICATED;case w.INVALID_ARGUMENT:return wr.INVALID_ARGUMENT;case w.NOT_FOUND:return wr.NOT_FOUND;case w.ALREADY_EXISTS:return wr.ALREADY_EXISTS;case w.PERMISSION_DENIED:return wr.PERMISSION_DENIED;case w.FAILED_PRECONDITION:return wr.FAILED_PRECONDITION;case w.ABORTED:return wr.ABORTED;case w.OUT_OF_RANGE:return wr.OUT_OF_RANGE;case w.UNIMPLEMENTED:return wr.UNIMPLEMENTED;case w.DATA_LOSS:return wr.DATA_LOSS;default:return g("Unknown status code: "+e)}}!function(e){e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS"}(wr||(wr={}));var Ir,kr,Nr=function(){function e(e){this.comparator=e?function(t,n){return e(t,n)||he.comparator(t.key,n.key)}:function(e,t){return he.comparator(e.key,t.key)},this.keyedMap=Me(),this.sortedSet=new Ce(this.comparator)}return e.emptySet=function(t){return new e(t.comparator)},e.prototype.has=function(e){return null!=this.keyedMap.get(e)},e.prototype.get=function(e){return this.keyedMap.get(e)},e.prototype.first=function(){return this.sortedSet.minKey()},e.prototype.last=function(){return this.sortedSet.maxKey()},e.prototype.isEmpty=function(){return this.sortedSet.isEmpty()},e.prototype.indexOf=function(e){var t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1},Object.defineProperty(e.prototype,"size",{get:function(){return this.sortedSet.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e){this.sortedSet.inorderTraversal((function(t,n){return e(t),!1}))},e.prototype.add=function(e){var t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))},e.prototype.delete=function(e){var t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this},e.prototype.isEqual=function(t){if(!(t instanceof e))return!1;if(this.size!==t.size)return!1;for(var n=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();n.hasNext();){var i=n.getNext().key,o=r.getNext().key;if(!i.isEqual(o))return!1}return!0},e.prototype.toString=function(){var e=[];return this.forEach((function(t){e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n  "+e.join("  \n")+"\n)"},e.prototype.copy=function(t,n){var r=new e;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=n,r},e}();!function(e){e[e.Added=0]="Added",e[e.Removed=1]="Removed",e[e.Modified=2]="Modified",e[e.Metadata=3]="Metadata"}(Ir||(Ir={})),function(e){e[e.Local=0]="Local",e[e.Synced=1]="Synced"}(kr||(kr={}));var Ar,Dr=function(){function e(){this.changeMap=new Ce(he.comparator)}return e.prototype.track=function(e){var t=e.doc.key,n=this.changeMap.get(t);n?e.type!==Ir.Added&&n.type===Ir.Metadata?this.changeMap=this.changeMap.insert(t,e):e.type===Ir.Metadata&&n.type!==Ir.Removed?this.changeMap=this.changeMap.insert(t,{type:n.type,doc:e.doc}):e.type===Ir.Modified&&n.type===Ir.Modified?this.changeMap=this.changeMap.insert(t,{type:Ir.Modified,doc:e.doc}):e.type===Ir.Modified&&n.type===Ir.Added?this.changeMap=this.changeMap.insert(t,{type:Ir.Added,doc:e.doc}):e.type===Ir.Removed&&n.type===Ir.Added?this.changeMap=this.changeMap.remove(t):e.type===Ir.Removed&&n.type===Ir.Modified?this.changeMap=this.changeMap.insert(t,{type:Ir.Removed,doc:n.doc}):e.type===Ir.Added&&n.type===Ir.Removed?this.changeMap=this.changeMap.insert(t,{type:Ir.Modified,doc:e.doc}):g("unsupported combination of changes: "+JSON.stringify(e)+" after "+JSON.stringify(n)):this.changeMap=this.changeMap.insert(t,e)},e.prototype.getChanges=function(){var e=[];return this.changeMap.inorderTraversal((function(t,n){e.push(n)})),e},e}(),Rr=function(){function e(e,t,n,r,i,o,a,s){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=s}return e.fromInitialDocuments=function(t,n,r,i){var o=[];
1return n.forEach((function(e){o.push({type:Ir.Added,doc:e})})),new e(t,n,Nr.emptySet(n),o,r,i,!0,!1)},Object.defineProperty(e.prototype,"hasPendingWrites",{get:function(){return!this.mutatedKeys.isEmpty()},enumerable:!0,configurable:!0}),e.prototype.isEqual=function(e){if(this.fromCache!==e.fromCache||this.syncStateChanged!==e.syncStateChanged||!this.mutatedKeys.isEqual(e.mutatedKeys)||!this.query.isEqual(e.query)||!this.docs.isEqual(e.docs)||!this.oldDocs.isEqual(e.oldDocs))return!1;var t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(var r=0;r<t.length;r++)if(t[r].type!==n[r].type||!t[r].doc.isEqual(n[r].doc))return!1;return!0},e}(),Or=function(){function e(e,t,n,r,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}return e.createSynthesizedRemoteEventForCurrentChange=function(t,n){var r,i=((r={})[t]=Pr.createSynthesizedTargetChangeForCurrentChange(t,n),r);return new e(Se.MIN,i,je(),Oe(),qe())},e}(),Pr=function(){function e(e,t,n,r,i){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}return e.createSynthesizedTargetChangeForCurrentChange=function(t,n){return new e(_(),n,qe(),qe(),qe())},e}(),xr=function(){return function(e,t,n,r){this.updatedTargetIds=e,this.removedTargetIds=t,this.key=n,this.newDoc=r}}(),Mr=function(){return function(e,t){this.targetId=e,this.existenceFilter=t}}();!function(e){e[e.NoChange=0]="NoChange",e[e.Added=1]="Added",e[e.Removed=2]="Removed",e[e.Current=3]="Current",e[e.Reset=4]="Reset"}(Ar||(Ar={}));var Lr=function(){return function(e,t,n,r){void 0===n&&(n=_()),void 0===r&&(r=null),this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}(),Fr=function(){function e(){this.pendingResponses=0,this.documentChanges=Vr(),this._resumeToken=_(),this._current=!1,this._hasPendingChanges=!0}return Object.defineProperty(e.prototype,"current",{get:function(){return this._current},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"resumeToken",{get:function(){return this._resumeToken},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPending",{get:function(){return 0!==this.pendingResponses},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasPendingChanges",{get:function(){return this._hasPendingChanges},enumerable:!0,configurable:!0}),e.prototype.updateResumeToken=function(e){e.length>0&&(this._hasPendingChanges=!0,this._resumeToken=e)},e.prototype.toTargetChange=function(){var e=qe(),t=qe(),n=qe();
1return this.documentChanges.forEach((function(r,i){switch(i){case Ir.Added:e=e.add(r);break;case Ir.Modified:t=t.add(r);break;case Ir.Removed:n=n.add(r);break;default:g("Encountered invalid change type: "+i)}})),new Pr(this._resumeToken,this._current,e,t,n)},e.prototype.clearPendingChanges=function(){this._hasPendingChanges=!1,this.documentChanges=Vr()},e.prototype.addDocumentChange=function(e,t){this._hasPendingChanges=!0,this.documentChanges=this.documentChanges.insert(e,t)},e.prototype.removeDocumentChange=function(e){this._hasPendingChanges=!0,this.documentChanges=this.documentChanges.remove(e)},e.prototype.recordPendingTargetRequest=function(){this.pendingResponses+=1},e.prototype.recordTargetResponse=function(){this.pendingResponses-=1},e.prototype.markCurrent=function(){this._hasPendingChanges=!0,this._current=!0},e}(),Ur=function(){function e(e){this.metadataProvider=e,this.targetStates={},this.pendingDocumentUpdates=Oe(),this.pendingDocumentTargetMapping=qr(),this.pendingTargetResets=new Ae(Y)}return e.prototype.handleDocumentChange=function(e){for(var t=0,n=e.updatedTargetIds;t<n.length;t++){var r=n[t];e.newDoc instanceof Wt?this.addDocumentToTarget(r,e.newDoc):e.newDoc instanceof Qt&&this.removeDocumentFromTarget(r,e.key,e.newDoc)}for(var i=0,o=e.removedTargetIds;i<o.length;i++){r=o[i];this.removeDocumentFromTarget(r,e.key,e.newDoc)}},e.prototype.handleTargetChange=function(e){var t=this;this.forEachTarget(e,(function(n){var r=t.ensureTargetState(n);switch(e.state){case Ar.NoChange:t.isActiveTarget(n)&&r.updateResumeToken(e.resumeToken);break;case Ar.Added:r.recordTargetResponse(),r.isPending||r.clearPendingChanges(),r.updateResumeToken(e.resumeToken);break;case Ar.Removed:r.recordTargetResponse(),r.isPending||t.removeTarget(n),v(!e.cause,"WatchChangeAggregator does not handle errored targets");break;case Ar.Current:t.isActiveTarget(n)&&(r.markCurrent(),r.updateResumeToken(e.resumeToken));break;case Ar.Reset:t.isActiveTarget(n)&&(t.resetTarget(n),r.updateResumeToken(e.resumeToken));break;default:g("Unknown target watch change state: "+e.state)}}))},e.prototype.forEachTarget=function(e,t){e.targetIds.length>0?e.targetIds.forEach(t):I(this.targetStates,t)},e.prototype.handleExistenceFilter=function(e){var t=e.targetId,n=e.existenceFilter.count,r=this.queryDataForActiveTarget(t);if(r){var i=r.query;if(i.isDocumentQuery())if(0===n){var o=new he(i.path);this.removeDocumentFromTarget(t,o,new Qt(o,Se.forDeletedDoc()))}else v(1===n,"Single document existence filter with count: "+n);else this.getCurrentDocumentCountForTarget(t)!==n&&(this.resetTarget(t),this.pendingTargetResets=this.pendingTargetResets.add(t))}},e.prototype.createRemoteEvent=function(e){var t=this,n={};I(this.targetStates,(function(r,i){var o=t.queryDataForActiveTarget(r);if(o){if(i.current&&o.query.isDocumentQuery()){var a=new he(o.query.path);null!==t.pendingDocumentUpdates.get(a)||t.targetContainsDocument(r,a)||t.removeDocumentFromTarget(r,a,new Qt(a,e))}i.hasPendingChanges&&(n[r]=i.toTargetChange(),i.clearPendingChanges())}}));var r=qe();this.pendingDocumentTargetMapping.forEach((function(e,n){var i=!0;n.forEachWhile((function(e){var n=t.queryDataForActiveTarget(e);return!n||n.purpose===En.LimboResolution||(i=!1,!1)})),i&&(r=r.add(e))}));var i=new Or(e,n,this.pendingTargetResets,this.pendingDocumentUpdates,r);return this.pendingDocumentUpdates=Oe(),this.pendingDocumentTargetMapping=qr(),this.pendingTargetResets=new Ae(Y),i},e.prototype.addDocumentToTarget=function(e,t){if(this.isActiveTarget(e)){var n=this.targetContainsDocument(e,t.key)?Ir.Modified:Ir.Added;this.ensureTargetState(e).addDocumentChange(t.key,n),this.pendingDocumentUpdates=this.pendingDocumentUpdates.insert(t.key,t),this.pendingDocumentTargetMapping=this.pendingDocumentTargetMapping.insert(t.key,this.ensureDocumentTargetMapping(t.key).add(e))}},e.prototype.removeDocumentFromTarget=function(e,t,n){if(this.isActiveTarget(e)){var r=this.ensureTargetState(e);this.targetContainsDocument(e,t)?r.addDocumentChange(t,Ir.Removed):r.removeDocumentChange(t),this.pendingDocumentTargetMapping=this.pendingDocumentTargetMapping.insert(t,this.ensureDocumentTargetMapping(t).delete(e)),n&&(this.pendingDocumentUpdates=this.pendingDocumentUpdates.insert(t,n))}},e.prototype.removeTarget=function(e){delete this.targetStates[e]},e.prototype.getCurrentDocumentCountForTarget=function(e){var t=this.ensureTargetState(e).toTargetChange();return this.metadataProvider.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size},e.prototype.recordPendingTargetRequest=function(e){this.ensureTargetState(e).recordPendingTargetRequest
1()},e.prototype.ensureTargetState=function(e){return this.targetStates[e]||(this.targetStates[e]=new Fr),this.targetStates[e]},e.prototype.ensureDocumentTargetMapping=function(e){var t=this.pendingDocumentTargetMapping.get(e);return t||(t=new Ae(Y),this.pendingDocumentTargetMapping=this.pendingDocumentTargetMapping.insert(e,t)),t},e.prototype.isActiveTarget=function(e){var t=null!==this.queryDataForActiveTarget(e);return t||d("WatchChangeAggregator","Detected inactive target",e),t},e.prototype.queryDataForActiveTarget=function(e){var t=this.targetStates[e];return t&&t.isPending?null:this.metadataProvider.getQueryDataForTarget(e)},e.prototype.resetTarget=function(e){var t=this;v(!this.targetStates[e].isPending,"Should only reset active targets"),this.targetStates[e]=new Fr,this.metadataProvider.getRemoteKeysForTarget(e).forEach((function(n){t.removeDocumentFromTarget(e,n,null)}))},e.prototype.targetContainsDocument=function(e,t){return this.metadataProvider.getRemoteKeysForTarget(e).has(t)},e}();function qr(){return new Ce(he.comparator)}function Vr(){return new Ce(he.comparator)}var jr="RemoteStore",Br=function(){function e(e,t,n,r,i){var o=this;this.localStore=e,this.datastore=t,this.writePipeline=[],this.listenTargets={},this.watchChangeAggregator=null,this.networkEnabled=!1,this.isPrimary=!1,this.connectivityMonitor=i,this.connectivityMonitor.addCallback((function(e){n.enqueueAndForget((function(){return s.__awaiter(o,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return this.canUseNetwork()?(d(jr,"Restarting streams for network reachability change."),[4,this.restartNetwork()]):[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}
1))}))}))})),this.onlineStateTracker=new Er(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 e.prototype.start=function(){return this.enableNetwork()},e.prototype.enableNetwork=function(){return s.__awaiter(this,void 0,void 0,(function(){var e;return s.__generator(this,(function(t){switch(t.label){case 0:return this.networkEnabled=!0,this.canUseNetwork()?(e=this.writeStream,[4,this.localStore.getLastStreamToken()]):[3,3];case 1:return e.lastStreamToken=t.sent(),this.shouldStartWatchStream()?this.startWatchStream():this.onlineStateTracker.set(dr.Unknown),[4,this.fillWritePipeline()];case 2:t.sent(),t.label=3;case 3:return[2]}}
1))}))},e.prototype.disableNetwork=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return this.networkEnabled=!1,[4,this.disableNetworkInternal()];case 1:return e.sent(),this.onlineStateTracker.set(dr.Offline),[2]}}))}))},e.prototype.disableNetworkInternal=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return[4,this.writeStream.stop()];case 1:return e.sent(),[4,this.watchStream.stop()];case 2:return e.sent(),this.writePipeline.length>0&&(d(jr,"Stopping write stream with "+this.writePipeline.length+" pending writes"),this.writePipeline=[]),this.cleanUpWatchStreamState(),[2]}}))}))},e.prototype.shutdown=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return d(jr,"RemoteStore shutting down."),this.networkEnabled=!1,[4,this.disableNetworkInternal()];case 1:return e.sent(),this.connectivityMonitor.shutdown(),this.onlineStateTracker.set(dr.Unknown),[2]}}))}))},e.prototype.listen=function(e){v(!S(this.listenTargets,e.targetId),"listen called with duplicate targetId!"),this.listenTargets[e.targetId]=e,this.shouldStartWatchStream()?this.startWatchStream():this.watchStream.isOpen()&&this.sendWatchRequest(e)},e.prototype.unlisten=function(e){v(S(this.listenTargets,e),"unlisten called without assigned target ID!"),delete this.listenTargets[e],this.watchStream.isOpen()&&this.sendUnwatchRequest(e),N(this.listenTargets)&&(this.watchStream.isOpen()?this.watchStream.markIdle():this.canUseNetwork()&&this.onlineStateTracker.set(dr.Unknown))},e.prototype.getQueryDataForTarget=function(e){return this.listenTargets[e]||null},e.prototype.getRemoteKeysForTarget=function(e){return this.syncEngine.getRemoteKeysForTarget(e)},e.prototype.sendWatchRequest=function(e){this.watchChangeAggregator.recordPendingTargetRequest(e.targetId),this.watchStream.watch(e)},e.prototype.sendUnwatchRequest=function(e){this.watchChangeAggregator.recordPendingTargetRequest(e),this.watchStream.unwatch(e)},e.prototype.startWatchStream=function(){v(this.shouldStartWatchStream(),"startWatchStream() called when shouldStartWatchStream() is false."),this.watchChangeAggregator=new Ur(this),this.watchStream.start(),this.onlineStateTracker.handleWatchStreamStart()},e.prototype.shouldStartWatchStream=function(){return this.canUseNetwork()&&!this.watchStream.isStarted()&&!N(this.listenTargets)},e.prototype.canUseNetwork=function(){return this.isPrimary&&this.networkEnabled},e.prototype.cleanUpWatchStreamState=function(){this.watchChangeAggregator=null},e.prototype.onWatchStreamOpen=function(){return s.__awaiter(this,void 0,void 0,(function(){var e=this;return s.__generator(this,(function(t){return I(this.listenTargets,(function(t,n){e.sendWatchRequest(n)})),[2]}))}))},e.prototype.onWatchStreamClose=function(e){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(t){return void 0===e&&v(!this.shouldStartWatchStream(),"Watch stream was stopped gracefully while still needed."),this.cleanUpWatchStreamState(),this.shouldStartWatchStream()?(this.onlineStateTracker.handleWatchStreamFailure(e),this.startWatchStream()):this.onlineStateTracker.set(dr.Unknown),[2]}))}
1))},e.prototype.onWatchStreamChange=function(e,t){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(dr.Online),e instanceof Lr&&e.state===Ar.Removed&&e.cause?[2,this.handleTargetError(e)]:(e instanceof xr?this.watchChangeAggregator.handleDocumentChange(e):e instanceof Mr?this.watchChangeAggregator.handleExistenceFilter(e):(v(e instanceof Lr,"Expected watchChange to be an instance of WatchTargetChange"),this.watchChangeAggregator.handleTargetChange(e)),t.isEqual(Se.MIN)?[3,3]:[4,this.localStore.getLastRemoteSnapshotVersion()]);case 1:return n=r.sent(),t.compareTo(n)>=0?[4,this.raiseWatchSnapshot(t)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},e.prototype.raiseWatchSnapshot=function(e){var t=this;v(!e.isEqual(Se.MIN),"Can't raise event for unknown SnapshotVersion");var n=this.watchChangeAggregator.createRemoteEvent(e);return I(n.targetChanges,(function(n,r){if(r.resumeToken.length>0){var i=t.listenTargets[n];i&&(t.listenTargets[n]=i.copy({resumeToken:r.resumeToken,snapshotVersion:e}))}})),n.targetMismatches.forEach((function(e){var n=t.listenTargets[e];if(n){t.listenTargets[e]=n.copy({resumeToken:_()}),t.sendUnwatchRequest(e);var r=new In(n.query,e,En.ExistenceFilterMismatch,n.sequenceNumber);t.sendWatchRequest(r)}})),this.syncEngine.applyRemoteEvent(n)},e.prototype.handleTargetError=function(e){var t=this;v(!!e.cause,"Handling target error without a cause");var n=e.cause,r=Promise.resolve();return e.targetIds.forEach((function(e){r=r.then((function(){return s.__awaiter(t,void 0,void 0,(function(){return s.__generator(this,(function(t){return S(this.listenTargets,e)?(delete this.listenTargets[e],this.watchChangeAggregator.removeTarget(e),[2,this.syncEngine.rejectListen(e,n)]):[2]}))}))}))})),r},e.prototype.fillWritePipeline=function(){return s.__awaiter(this,void 0,void 0,(function(){var e,t;return s.__generator(this,(function(n){switch(n.label){case 0:return this.canAddToWritePipeline()?(e=this.writePipeline.length>0?this.writePipeline[this.writePipeline.length-1].batchId:-1,[4,this.localStore.nextMutationBatch(e)]):[3,4];case 1:return null!==(t=n.sent())?[3,2]:(0===this.writePipeline.length&&this.writeStream.markIdle(),[3,4]);case 2:return this.addToWritePipeline(t),[4,this.fillWritePipeline()];case 3:n.sent(),n.label=4;case 4:return this.shouldStartWriteStream()&&this.startWriteStream(),[2]}}))}))},e.prototype.canAddToWritePipeline=function(){return this.canUseNetwork()&&this.writePipeline.length<10},e.prototype.outstandingWrites=function(){return this.writePipeline.length},e.prototype.addToWritePipeline=function(e){v(this.canAddToWritePipeline(),"addToWritePipeline called when pipeline is full"),this.writePipeline.push(e),this.writeStream.isOpen()&&this.writeStream.handshakeComplete&&this.writeStream.writeMutations(e.mutations)},e.prototype.shouldStartWriteStream=function(){return this.canUseNetwork()&&!this.writeStream.isStarted()&&this.writePipeline.length>0},e.prototype.startWriteStream=function(){v(this.shouldStartWriteStream(),"startWriteStream() called when shouldStartWriteStream() is false."),this.writeStream.start()},e.prototype.onWriteStreamOpen=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){return this.writeStream.writeHandshake(),[2]}))}))},e.prototype.onWriteHandshakeComplete=function(){var e=this;return this.localStore.setLastStreamToken(this.writeStream.lastStreamToken).then((function(){for(var t=0,n=e.writePipeline;t<n.length;t++){var r=n[t];e.writeStream.writeMutations(r.mutations)}})).catch(jn)},e.prototype.onMutationResult=function(e,t){var n=this;v(this.writePipeline.length>0,"Got result for empty write pipeline");var r=this.writePipeline.shift(),i=We.from(r,e,t,this.writeStream.lastStreamToken);return this.syncEngine.applySuccessfulWrite(i).then((function(){return n.fillWritePipeline()}))},e.prototype.onWriteStreamClose=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t=this;return s.__generator(this,(function(n){return void 0===e&&v(!this.shouldStartWriteStream(),"Write stream was stopped gracefully while still needed."),e&&this.writePipeline.length>0?(void 0,[2,(this.writeStream.handshakeComplete?this.handleWriteError(e):this.handleHandshakeError(e)).then((function(){t.shouldStartWriteStream()&&t.startWriteStream()}))]):[2]}))}))},e.prototype.handleHandshakeError=function(e){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(t){return Tr(e.code)?(d(jr,"RemoteStore error before completed handshake; resetting stream token: ",this.writeStream.lastStreamToken),this.writeStream.lastStreamToken=_(),[2,this.localStore.setLastStreamToken(_()).catch(jn)]):[2]}))}))},e.prototype.handleWriteError=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n=this;return s.__generator(this,(function(r){return Tr(i=e.code)&&i!==w.ABORTED?(t=this.writePipeline.shift(),this.writeStream.inhibitBackoff(),[2,this.syncEngine.rejectFailedWrite(t.batchId,e).then((function(){return n.fillWritePipeline()}))]):[2];var i}))}))},e.prototype.createTransaction=function(){return new _r(this.datastore)},e.prototype.restartNetwork=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return this.networkEnabled=!1,[4,this.disableNetworkInternal()];case 1:return e.sent(),this.onlineStateTracker.set(dr.Unknown),[4,this.enableNetwork()];case 2:return e.sent(),[2]}}))}))},e.prototype.handleCredentialChange=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return this.canUseNetwork()?(d(jr,"RemoteStore restarting streams for new credential"),[4,this.restartNetwork()]):[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}
1))}))},e.prototype.applyPrimaryState=function(e){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(t){switch(t.label){case 0:return this.isPrimary=e,e&&this.networkEnabled?[4,this.enableNetwork()]:[3,2];case 1:return t.sent(),[3,4];case 2:return e?[3,4]:[4,this.disableNetworkInternal()];case 3:t.sent(),this.onlineStateTracker.set(dr.Unknown),t.label=4;case 4:return[2]}}))}))},e}(),Wr=function(){function e(e,t){if(D("GeoPoint",arguments,2),P("GeoPoint","number",1,e),P("GeoPoint","number",2,t),!isFinite(e)||e<-90||e>90)throw new E(w.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new E(w.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}return Object.defineProperty(e.prototype,"latitude",{get:function(){return this._lat},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"longitude",{get:function(){return this._long},enumerable:!0,configurable:!0}),e.prototype.isEqual=function(e){return this._lat===e._lat&&this._long===e._long},e.prototype._compareTo=function(e){return Y(this._lat,e._lat)||Y(this._long,e._long)},e}(),Qr=function(){function e(e,t,n,r,i,o,a){void 0===t&&(t=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===a&&(a=null),this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=a,this.memoizedCanonicalId=null,this.memoizedOrderBy=null,this.startAt&&this.assertValidBound(this.startAt),this.endAt&&this.assertValidBound(this.endAt)}return e.atPath=function(t){return new e(t)},Object.defineProperty(e.prototype,"orderBy",{get:function(){if(null===this.memoizedOrderBy){var e=this.getInequalityFilterField(),t=this.getFirstOrderByField();if(null!==e&&null===t)e.isKeyField()?this.memoizedOrderBy=[ni]:this.memoizedOrderBy=[new ti(e),ni];else{v(null===e||null!==t&&e.isEqual(t),"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:Zr.ASCENDING;this.memoizedOrderBy.push(a===Zr.ASCENDING?ni:ri)}}}return this.memoizedOrderBy},enumerable:!0,configurable:!0}),e.prototype.addFilter=function(t){v(null==this.getInequalityFilterField()||!(t instanceof Hr)||!t.isInequality()||t.field.isEqual(this.getInequalityFilterField()),"Query must only have one inequality field."),v(!this.isDocumentQuery(),"No filtering allowed for document query");var n=this.filters.concat([t]);return new e(this.path,this.collectionGroup,this.explicitOrderBy.slice(),n,this.limit,this.startAt,this.endAt)},e.prototype.addOrderBy=function(t){v(!this.startAt&&!this.endAt,"Bounds must be set after orderBy");var n=this.explicitOrderBy.concat([t]);return new e(this.path,this.collectionGroup,n,this.filters.slice(),this.limit,this.startAt,this.endAt)},e.prototype.withLimit=function(t){return new e(this.path,this.collectionGroup,this.explicitOrderBy.slice(),this.filters.slice(),t,this.startAt,this.endAt)},e.prototype.withStartAt=function(t){return new e(this.path,this.collectionGroup,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,t,this.endAt)},e.prototype.withEndAt=function(t){return new e(this.path,this.collectionGroup,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,this.startAt,t)},e.prototype.asCollectionQueryAtPath=function(t){return new e(t,null,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,this.startAt,this.endAt)},e.prototype.canonicalId=function(){if(null===this.memoizedCanonicalId){var e=this.path.canonicalString();this.isCollectionGroupQuery()&&(e+="|cg:"+this.collectionGroup),e+="|f:";for(var t=0,n=this.filters;t<n.length;t++){e+=n[t].canonicalId(),e+=","}e+="|ob:";for(var r=0,i=this.orderBy;r<i.length;r++){e+=i[r].canonicalId(),e+=","}sr(this.limit)||(e+="|l:",e+=this.limit),this.startAt&&(e+="|lb:",e+=this.startAt.canonicalId()),this.endAt&&(e+="|ub:",e+=this.endAt.canonicalId()),this.memoizedCanonicalId=e}return this.memoizedCanonicalId}
1,e.prototype.toString=function(){var e="Query("+this.path.canonicalString();return this.isCollectionGroupQuery()&&(e+=" collectionGroup="+this.collectionGroup),this.filters.length>0&&(e+=", filters: ["+this.filters.join(", ")+"]"),sr(this.limit)||(e+=", limit: "+this.limit),this.explicitOrderBy.length>0&&(e+=", orderBy: ["+this.explicitOrderBy.join(", ")+"]"),this.startAt&&(e+=", startAt: "+this.startAt.canonicalId()),this.endAt&&(e+=", endAt: "+this.endAt.canonicalId()),e+")"},e.prototype.isEqual=function(e){if(this.limit!==e.limit)return!1;if(this.orderBy.length!==e.orderBy.length)return!1;for(var t=0;t<this.orderBy.length;t++)if(!this.orderBy[t].isEqual(e.orderBy[t]))return!1;if(this.filters.length!==e.filters.length)return!1;for(t=0;t<this.filters.length;t++)if(!this.filters[t].isEqual(e.filters[t]))return!1;return this.collectionGroup===e.collectionGroup&&(!!this.path.isEqual(e.path)&&(!(null!==this.startAt?!this.startAt.isEqual(e.startAt):null!==e.startAt)&&(null!==this.endAt?this.endAt.isEqual(e.endAt):null===e.endAt)))},e.prototype.docComparator=function(e,t){for(var n=!1,r=0,i=this.orderBy;r<i.length;r++){var o=i[r],a=o.compare(e,t);if(0!==a)return a;n=n||o.field.isKeyField()}return v(n,"orderBy used that doesn't compare on key field"),0},e.prototype.matches=function(e){return this.matchesPathAndCollectionGroup(e)&&this.matchesOrderBy(e)&&this.matchesFilters(e)&&this.matchesBounds(e)},e.prototype.hasLimit=function(){return!sr(this.limit)},e.prototype.getFirstOrderByField=function(){return this.explicitOrderBy.length>0?this.explicitOrderBy[0].field:null},e.prototype.getInequalityFilterField=function(){for(var e=0,t=this.filters;e<t.length;e++){var n=t[e];if(n instanceof Hr&&n.isInequality())return n.field}return null},e.prototype.findFilterOperator=function(e){for(var t=0,n=this.filters;t<n.length;t++){var r=n[t];if(r instanceof Hr&&e.indexOf(r.op)>=0)return r.op}return null},e.prototype.isDocumentQuery=function(){return he.isDocumentKey(this.path)&&null===this.collectionGroup&&0===this.filters.length},e.prototype.isCollectionGroupQuery=function(){return null!==this.collectionGroup},e.prototype.matchesPathAndCollectionGroup=function(e){var t=e.key.path;return null!==this.collectionGroup?e.key.hasCollectionId(this.collectionGroup)&&this.path.isPrefixOf(t):he.isDocumentKey(this.path)?this.path.isEqual(t):this.path.isImmediateParentOf(t)},e.prototype.matchesOrderBy=function(e){for(var t=0,n=this.explicitOrderBy;t<n.length;t++){var r=n[t];if(!r.field.isKeyField()&&null===e.field(r.field))return!1}return!0},e.prototype.matchesFilters=function(e){for(var t=0,n=this.filters;t<n.length;t++){if(!n[t].matches(e))return!1}return!0},e.prototype.matchesBounds=function(e){return!(this.startAt&&!this.startAt.sortsBeforeDocument(this.orderBy,e))&&(!this.endAt||!this.endAt.sortsBeforeDocument(this.orderBy,e))},e.prototype.assertValidBound=function(e){v(e.position.length<=this.orderBy.length,"Bound is longer than orderBy")},e}(),Kr=function(){return function(){}}(),zr=function(){function e(e){this.name=e}return e.fromString=function(t){switch(t){case"<":return e.LESS_THAN;case"<=":return e.LESS_THAN_OR_EQUAL;case"==":return e.EQUAL;case">=":return e.GREATER_THAN_OR_EQUAL;case">":return e.GREATER_THAN;case"array-contains":return e.ARRAY_CONTAINS;case"in":return e.IN;case"array-contains-any":return e.ARRAY_CONTAINS_ANY;default:return g("Unknown FieldFilter operator: "+t)}},e.prototype.toString=function(){return this.name},e.prototype.isEqual=function(e){return this.name===e.name},e.LESS_THAN=new e("<"),e.LESS_THAN_OR_EQUAL=new e("<="),e.EQUAL=new e("=="),e.GREATER_THAN=new e(">"),e.GREATER_THAN_OR_EQUAL=new e(">="),e.ARRAY_CONTAINS=new e("array-contains"),e.IN=new e("in"),e.ARRAY_CONTAINS_ANY=new e("array-contains-any"),e}(),Hr=function(e){function t(t,n,r){var i=e.call(this)||this;return i.field=t,i.op=n,i.value=r,i}return s.__extends(t,e),t.create=function(e,n,r){if(e.isKeyField())return n===zr.IN?(v(r instanceof jt,"Comparing on key with IN, but filter value not an ArrayValue"),v(r.internalValue.every((function(e){return e instanceof Ut})),"Comparing on key with IN, but an array value was not a RefValue"),new Yr(e,r)):(v(r instanceof Ut,"Comparing on key, but filter value not a RefValue"),v(n!==zr.ARRAY_CONTAINS&&n!==zr.ARRAY_CONTAINS_ANY,"'"+n.toString()+"' queries don't make sense on document keys."),new Gr(e,n,r));if(r.isEqual(Nt.INSTANCE)){if(n!==zr.EQUAL)throw new E(w.INVALID_ARGUMENT,"Invalid query. Null supports only equality comparisons.");return new t(e,n,r)}if(r.isEqual(Pt.NAN)){if(n!==zr.EQUAL)throw new E(w.INVALID_ARGUMENT,"Invalid query. NaN supports only equality comparisons.");return new t(e,n,r)}return n===zr.ARRAY_CONTAINS?new Xr(e,r):n===zr.IN?(v(r instanceof jt,"IN filter has invali
1d value: "+r.toString()),new Jr(e,r)):n===zr.ARRAY_CONTAINS_ANY?(v(r instanceof jt,"ARRAY_CONTAINS_ANY filter has invalid value: "+r.toString()),new $r(e,r)):new t(e,n,r)},t.prototype.matches=function(e){var t=e.field(this.field);return null!==t&&this.value.typeOrder===t.typeOrder&&this.matchesComparison(t.compareTo(this.value))},t.prototype.matchesComparison=function(e){switch(this.op){case zr.LESS_THAN:return e<0;case zr.LESS_THAN_OR_EQUAL:return e<=0;case zr.EQUAL:return 0===e;case zr.GREATER_THAN:return e>0;case zr.GREATER_THAN_OR_EQUAL:return e>=0;default:return g("Unknown FieldFilter operator: "+this.op)}},t.prototype.isInequality=function(){return[zr.LESS_THAN,zr.LESS_THAN_OR_EQUAL,zr.GREATER_THAN,zr.GREATER_THAN_OR_EQUAL].indexOf(this.op)>=0},t.prototype.canonicalId=function(){return this.field.canonicalString()+this.op.toString()+this.value.toString()},t.prototype.isEqual=function(e){return e instanceof t&&(this.op.isEqual(e.op)&&this.field.isEqual(e.field)&&this.value.isEqual(e.value))},t.prototype.toString=function(){return this.field.canonicalString()+" "+this.op+" "+this.value.value()},t}(Kr),Gr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s.__extends(t,e),t.prototype.matches=function(e){var t=this.value,n=he.comparator(e.key,t.key);return this.matchesComparison(n)},t}(Hr),Yr=function(e){function t(t,n){var r=e.call(this,t,zr.IN,n)||this;return r.value=n,r}return s.__extends(t,e),t.prototype.matches=function(e){return this.value.internalValue.some((function(t){return e.key.isEqual(t.key)}))},t}(Hr),Xr=function(e){function t(t,n){return e.call(this,t,zr.ARRAY_CONTAINS,n)||this}return s.__extends(t,e),t.prototype.matches=function(e){var t=e.field(this.field);return t instanceof jt&&t.contains(this.value)},t}(Hr),Jr=function(e){function t(t,n){var r=e.call(this,t,zr.IN,n)||this;return r.value=n,r}return s.__extends(t,e),t.prototype.matches=function(e){var t=this.value,n=e.field(this.field);return null!==n&&t.contains(n)},t}(Hr),$r=function(e){function t(t,n){var r=e.call(this,t,zr.ARRAY_CONTAINS_ANY,n)||this;return r.value=n,r}return s.__extends(t,e),t.prototype.matches=function(e){var t=this,n=e.field(this.field);return n instanceof jt&&n.internalValue.some((function(e){return t.value.contains(e)}))},t}(Hr),Zr=function(){function e(e){this.name=e}return e.prototype.toString=function(){return this.name},e.ASCENDING=new e("asc"),e.DESCENDING=new e("desc"),e}(),ei=function(){function e(e,t){this.position=e,this.before=t}return e.prototype.canonicalId=function(){for(var e=this.before?"b:":"a:",t=0,n=this.position;t<n.length;t++){e+=n[t].toString()}return e},e.prototype.sortsBeforeDocument=function(e,t){v(this.position.length<=e.length,"Bound has more components than query's orderBy");for(var n=0,r=0;r<this.position.length;r++){var i=e[r],o=this.position[r];if(i.field.isKeyField())v(o instanceof Ut,"Bound has a non-key value where the key path is being used."),n=he.comparator(o.key,t.key);else{var a=t.field(i.field);v(null!==a,"Field should exist since document matched the orderBy already."),n=o.compareTo(a)}if(i.dir===Zr.DESCENDING&&(n*=-1),0!==n)break}return this.before?n<=0:n<0},e.prototype.isEqual=function(e){if(null===e)return!1;if(this.before!==e.before||this.position.length!==e.position.length)return!1;for(var t=0;t<this.position.length;t++){var n=this.position[t],r=e.position[t];if(!n.isEqual(r))return!1}return!0},e}(),ti=function(){function e(e,t){this.field=e,void 0===t&&(t=Zr.ASCENDING),this.dir=t,this.isKeyOrderBy=e.isKeyField()}return e.prototype.compare=function(e,t){var n=this.isKeyOrderBy?Wt.compareByKey(e,t):Wt.compareByField(this.field,e,t);switch(this.dir){case Zr.ASCENDING:return n;case Zr.DESCENDING:return-1*n;default:return g("Unknown direction: "+this.dir)}},e.prototype.canonicalId=function(){return this.field.canonicalString()+this.dir.toString()},e.prototype.toString=function(){return this.field.canonicalString()+" ("+this.dir+")"},e.prototype.isEqual=function(e){return this.dir===e.dir&&this.field.isEqual(e.field)},e}(),ni=new ti(le.keyField(),Zr.ASCENDING),ri=new ti(le.keyField(),Zr.DESCENDING),ii=function(){function e(){}return e.prototype.applyToLocalView=function(e,t){return new Lt(t,e)},e.prototype.applyToRemoteDocument=function(e,t){return t},e.prototype.computeBaseValue=function(e){return null},e.prototype.isEqual=function(t){return t instanceof e},e.instance=new e,e}(),oi=function(){function e(e){this.elements=e}return e.prototype.applyToLocalView=function(e,t){return this.apply(e)},e.prototype.applyToRemoteDocument=function(e,t){return this.apply(e)},e.prototype.apply=function(e){for(var t=ui(e),n=function(e){t.find((function(t){return t.isEqual(e)}
1))||t.push(e)},r=0,i=this.elements;r<i.length;r++){n(i[r])}return new jt(t)},e.prototype.computeBaseValue=function(e){return null},e.prototype.isEqual=function(t){return t instanceof e&&X(t.elements,this.elements)},e}(),ai=function(){function e(e){this.elements=e}return e.prototype.applyToLocalView=function(e,t){return this.apply(e)},e.prototype.applyToRemoteDocument=function(e,t){return this.apply(e)},e.prototype.apply=function(e){for(var t=ui(e),n=function(e){t=t.filter((function(t){return!t.isEqual(e)}))},r=0,i=this.elements;r<i.length;r++){n(i[r])}return new jt(t)},e.prototype.computeBaseValue=function(e){return null},e.prototype.isEqual=function(t){return t instanceof e&&X(t.elements,this.elements)},e}(),si=function(){function e(e){this.operand=e}return e.prototype.applyToLocalView=function(e,t){var n=this.computeBaseValue(e);if(n instanceof Ot&&this.operand instanceof Ot){var r=n.internalValue+this.operand.internalValue;return new Ot(r)}r=n.internalValue+this.operand.internalValue;return new Pt(r)},e.prototype.applyToRemoteDocument=function(e,t){return v(null!==t,"Didn't receive transformResult for NUMERIC_ADD transform"),t},e.prototype.computeBaseValue=function(e){return e instanceof Dt?e:new Ot(0)},e.prototype.isEqual=function(t){return t instanceof e&&this.operand.isEqual(t.operand)},e}();function ui(e){return e instanceof jt?e.internalValue.slice():[]}var ci=function(){function e(e){this.count=e}return e.prototype.isEqual=function(e){return e&&e.count===this.count},e}(),li=function(){var e={};return e[Zr.ASCENDING.name]="ASCENDING",e[Zr.DESCENDING.name]="DESCENDING",e}(),hi=function(){var e={};return e[zr.LESS_THAN.name]="LESS_THAN",e[zr.LESS_THAN_OR_EQUAL.name]="LESS_THAN_OR_EQUAL",e[zr.GREATER_THAN.name]="GREATER_THAN",e[zr.GREATER_THAN_OR_EQUAL.name]="GREATER_THAN_OR_EQUAL",e[zr.EQUAL.name]="EQUAL",e[zr.ARRAY_CONTAINS.name]="ARRAY_CONTAINS",e[zr.IN.name]="IN",e[zr.ARRAY_CONTAINS_ANY.name]="ARRAY_CONTAINS_ANY",e}(),fi=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function pi(e,t){v(!sr(e),t+" is missing")}function di(e){return"number"===typeof e?e:"string"===typeof e?Number(e):g("can't parse "+e)}var mi=function(){function e(e,t){this.databaseId=e,this.options=t}return e.prototype.emptyByteString=function(){return this.options.useProto3Json?"":new Uint8Array(0)},e.prototype.unsafeCastProtoByteString=function(e){return e},e.prototype.fromRpcStatus=function(e){var t=void 0===e.code?w.UNKNOWN:Sr(e.code);return new E(t,e.message||"")},e.prototype.toInt32Value=function(e){return sr(e)?void 0:{value:e}},e.prototype.fromInt32Value=function(e){var t;return sr(t="object"===typeof e?e.value:e)?null:t},e.prototype.toTimestamp=function(e){return{seconds:""+e.seconds,nanos:e.nanoseconds}},e.prototype.fromTimestamp=function(e){if("string"===typeof e)return this.fromIso8601String(e);v(!!e,"Cannot deserialize null or undefined timestamp.");var t=di(e.seconds||"0"),n=e.nanos||0;return new Te(t,n)},e.prototype.fromIso8601String=function(e){var t=0,n=fi.exec(e);if(v(!!n,"invalid timestamp: "+e),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),t=Number(r)}var i=new Date(e),o=Math.floor(i.getTime()/1e3);return new Te(o,t)},e.prototype.toBytes=function(e){return this.options.useProto3Json?e.toBase64():this.unsafeCastProtoByteString(e.toUint8Array())},e.prototype.fromBlob=function(e){return"string"===typeof e?(v(this.options.useProto3Json,"Expected bytes to be passed in as Uint8Array, but got a string instead."),te.fromBase64String(e)):(v(!this.options.useProto3Json,"Expected bytes to be passed in as Uint8Array, but got a string instead."),te.fromUint8Array(e))},e.prototype.toVersion=function(e){return this.toTimestamp(e.toTimestamp())},e.prototype.fromVersion=function(e){return v(!!e,"Trying to deserialize version that isn't set"),Se.fromTimestamp(this.fromTimestamp(e))},e.prototype.toResourceName=function(e,t){return this.fullyQualifiedPrefixPath(e).child("documents").child(t).canonicalString()},e.prototype.fromResourceName=function(e){var t=ue.fromString(e);return v(this.isValidResourceName(t),"Tried to deserialize invalid key "+t.toString()),t},e.prototype.toName=function(e){return this.toResourceName(this.databaseId,e.path)},e.prototype.fromName=function(e){var t=this.fromResourceName(e);return v(t.get(1)===this.databaseId.projectId,"Tried to deserialize key from different project: "+t.get(1)+" vs "+this.databaseId.projectId),v(!t.get(3)&&!this.databaseId.database||t.get(3)===this.databaseId.database,"Tried to deserialize key from different database: "+t.get(3)+" vs "+this.databaseId.database),new he(this.extractLocalPathFromResourceName(t))},e.prototype.toQueryPath=function(e){return this.toResourceName(this.databaseId,e)},e.prototype.fromQueryPath=function(e){var t=this.fromResourceName(e);return 4===t.length?ue.EMPTY_PATH:this.extractLocalPathFromResourceName(t)},Object.defineProperty(e.prototype,"encodedDatabaseId",{get:function(){return new ue(["projects",this.databaseId.projectId,"databases",this.databaseId.database]).canonicalString()},enumerable:!0,configurable:!0}),e.prototype.fullyQualifiedPrefixPath=function(e){return new ue(["projects",e.projectId,"databases",e.database])},e.prototype.extractLocalPathFromResourceName=function(e){return v(e.length>4&&"documents"===e.get(4),"tried to deserialize invalid key "+e.toString()),e.popFirst(5)},e.prototype.isValidResourceName=function(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)},e.prototype.toValue=function(e){if(e instanceof Nt)return{nullValue:"NULL_VALUE"};if(e instanceof At)return{booleanValue:e.value()};if(e instanceof Ot)return{integerValue:""+e.value()};if(e instanceof Pt){var t=e.value();if(this.options.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:e.value()}}return e instanceof xt?{stringValue:e.value()}:e instanceof Vt?{mapValue:this.toMapValue(e)}:e instanceof jt?{arrayValue:this.toArrayValue(e)}
1:e instanceof Mt?{timestampValue:this.toTimestamp(e.internalValue)}:e instanceof qt?{geoPointValue:{latitude:e.value().latitude,longitude:e.value().longitude}}:e instanceof Ft?{bytesValue:this.toBytes(e.value())}:e instanceof Ut?{referenceValue:this.toResourceName(e.databaseId,e.key.path)}:g("Unknown FieldValue "+JSON.stringify(e))},e.prototype.fromValue=function(e){var t=this;if("nullValue"in e)return Nt.INSTANCE;if("booleanValue"in e)return At.of(e.booleanValue);if("integerValue"in e)return new Ot(di(e.integerValue));if("doubleValue"in e){if(this.options.useProto3Json){if("NaN"===e.doubleValue)return Pt.NAN;if("Infinity"===e.doubleValue)return Pt.POSITIVE_INFINITY;if("-Infinity"===e.doubleValue)return Pt.NEGATIVE_INFINITY}return new Pt(e.doubleValue)}if("stringValue"in e)return new xt(e.stringValue);if("mapValue"in e)return this.fromFields(e.mapValue.fields||{});if("arrayValue"in e){pi(e.arrayValue,"arrayValue");var n=e.arrayValue.values||[];return new jt(n.map((function(e){return t.fromValue(e)})))}if("timestampValue"in e)return pi(e.timestampValue,"timestampValue"),new Mt(this.fromTimestamp(e.timestampValue));if("geoPointValue"in e){pi(e.geoPointValue,"geoPointValue");var r=e.geoPointValue.latitude||0,i=e.geoPointValue.longitude||0;return new qt(new Wr(r,i))}if("bytesValue"in e){pi(e.bytesValue,"bytesValue");var o=this.fromBlob(e.bytesValue);return new Ft(o)}if("referenceValue"in e){pi(e.referenceValue,"referenceValue");var a=this.fromResourceName(e.referenceValue),s=new oe(a.get(1),a.get(3)),u=new he(this.extractLocalPathFromResourceName(a));return new Ut(s,u)}return g("Unknown Value proto "+JSON.stringify(e))},e.prototype.toMutationDocument=function(e,t){return{name:this.toName(e),fields:this.toFields(t)}},e.prototype.toDocument=function(e){return v(!e.hasLocalMutations,"Can't serialize documents with mutations."),{name:this.toName(e.key),fields:this.toFields(e.data()),updateTime:this.toTimestamp(e.version.toTimestamp())}},e.prototype.fromDocument=function(e,t){var n=this,r=this.fromName(e.name),i=this.fromVersion(e.updateTime);return new Wt(r,i,{hasCommittedMutations:!!t},void 0,e,(function(e){return n.fromValue(e)}))},e.prototype.toFields=function(e){var t=this,n={};return e.forEach((function(e,r){n[e]=t.toValue(r)})),n},e.prototype.fromFields=function(e){var t=this,n=e,r=Vt.EMPTY;return k(n,(function(e,n){r=r.set(new le([e]),t.fromValue(n))})),r},e.prototype.toMapValue=function(e){return{fields:this.toFields(e)}},e.prototype.toArrayValue=function(e){var t=this,n=[];return e.forEach((function(e){n.push(t.toValue(e))})),{values:n}},e.prototype.fromFound=function(e){var t=this;v(!!e.found,"Tried to deserialize a found document from a missing document."),pi(e.found.name,"doc.found.name"),pi(e.found.updateTime,"doc.found.updateTime");var n=this.fromName(e.found.name),r=this.fromVersion(e.found.updateTime);return new Wt(n,r,{},void 0,e.found,(function(e){return t.fromValue(e)}))},e.prototype.fromMissing=function(e){v(!!e.missing,"Tried to deserialize a missing document from a found document."),v(!!e.readTime,"Tried to deserialize a missing document without a read time.");var t=this.fromName(e.missing),n=this.fromVersion(e.readTime);return new Qt(t,n)},e.prototype.fromMaybeDocument=function(e){return"found"in e?this.fromFound(e):"missing"in e?this.fromMissing(e):g("invalid batch get response: "+JSON.stringify(e))},e.prototype.toWatchTargetChangeState=function(e){switch(e){case Ar.Added:return"ADD";case Ar.Current:return"CURRENT";case Ar.NoChange:return"NO_CHANGE";case Ar.Removed:return"REMOVE";case Ar.Reset:return"RESET";default:return g("Unknown WatchTargetChangeState: "+e)}},e.prototype.toTestWatchChange=function(e){if(e instanceof Mr)return{filter:{count:e.existenceFilter.count,targetId:e.targetId}};if(e instanceof xr){if(e.newDoc instanceof Wt){var t=e.newDoc;return{documentChange:{document:{name:this.toName(t.key),fields:this.toFields(t.data()),updateTime:this.toVersion(t.version)},targetIds:e.updatedTargetIds,removedTargetIds:e.removedTargetIds}}}if(e.newDoc instanceof Qt){t=e.newDoc;return{documentDelete:{document:this.toName(t.key),readTime:this.toVersion(t.version),removedTargetIds:e.removedTargetIds}}}if(null===e.newDoc)return{documentRemove:{document:this.toName(e.key),removedTargetIds:e.removedTargetIds}}}if(e instanceof Lr){var n=void 0;return e.cause&&(n={code:Cr(e.cause.code),message:e.cause.message}),{targetChange:{targetChangeType:this.toWatchTargetChangeState(e.state),targetIds:e.targetIds,resumeToken:this.unsafeCastProtoByteString(e.resumeToken),cause:n}}}
1return g("Unrecognized watch change: "+JSON.stringify(e))},e.prototype.fromWatchChange=function(e){var t,n=this;if("targetChange"in e){pi(e.targetChange,"targetChange");var r=this.fromWatchTargetChangeState(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],o=e.targetChange.resumeToken||this.emptyByteString(),a=e.targetChange.cause,s=a&&this.fromRpcStatus(a);t=new Lr(r,i,o,s||null)}else if("documentChange"in e){pi(e.documentChange,"documentChange"),pi(e.documentChange.document,"documentChange.name"),pi(e.documentChange.document.name,"documentChange.document.name"),pi(e.documentChange.document.updateTime,"documentChange.document.updateTime");var u=e.documentChange,c=this.fromName(u.document.name),l=this.fromVersion(u.document.updateTime),h=new Wt(c,l,{},void 0,u.document,(function(e){return n.fromValue(e)})),f=u.targetIds||[],p=u.removedTargetIds||[];t=new xr(f,p,h.key,h)}else if("documentDelete"in e){pi(e.documentDelete,"documentDelete"),pi(e.documentDelete.document,"documentDelete.document");var d=e.documentDelete;c=this.fromName(d.document),l=d.readTime?this.fromVersion(d.readTime):Se.forDeletedDoc(),h=new Qt(c,l),p=d.removedTargetIds||[];t=new xr([],p,h.key,h)}else if("documentRemove"in e){pi(e.documentRemove,"documentRemove"),pi(e.documentRemove.document,"documentRemove");var m=e.documentRemove;c=this.fromName(m.document),p=m.removedTargetIds||[];t=new xr([],p,c,null)}else{if(!("filter"in e))return g("Unknown change type "+JSON.stringify(e));pi(e.filter,"filter"),pi(e.filter.targetId,"filter.targetId");var y=e.filter,v=y.count||0,b=new ci(v),_=y.targetId;t=new Mr(_,b)}return t},e.prototype.fromWatchTargetChangeState=function(e){return"NO_CHANGE"===e?Ar.NoChange:"ADD"===e?Ar.Added:"REMOVE"===e?Ar.Removed:"CURRENT"===e?Ar.Current:"RESET"===e?Ar.Reset:g("Got unexpected TargetChange.state: "+e)},e.prototype.versionFromListenResponse=function(e){if(!("targetChange"in e))return Se.MIN;var t=e.targetChange;return t.targetIds&&t.targetIds.length?Se.MIN:t.readTime?this.fromVersion(t.readTime):Se.MIN},e.prototype.toMutation=function(e){var t,n=this;if(e instanceof Et)t={update:this.toMutationDocument(e.key,e.value)};else if(e instanceof Ct)t={delete:this.toName(e.key)};else if(e instanceof Tt)t={update:this.toMutationDocument(e.key,e.data),updateMask:this.toDocumentMask(e.fieldMask)};else{if(!(e instanceof St))return g("Unknown mutation type "+e.type);t={transform:{document:this.toName(e.key),fieldTransforms:e.fieldTransforms.map((function(e){return n.toFieldTransform(e)}))}}}return e.precondition.isNone||(t.currentDocument=this.toPrecondition(e.precondition)),t},e.prototype.fromMutation=function(e){var t=this,n=e.currentDocument?this.fromPrecondition(e.currentDocument):_t.NONE;if(e.update){pi(e.update.name,"name");var r=this.fromName(e.update.name),i=this.fromFields(e.update.fields||{});if(e.updateMask){var o=this.fromDocumentMask(e.updateMask);return new Tt(r,i,o,n)}return new Et(r,i,n)}if(e.delete){r=this.fromName(e.delete);return new Ct(r,n)}if(e.transform){r=this.fromName(e.transform.document);var a=e.transform.fieldTransforms.map((function(e){return t.fromFieldTransform(e)}));return v(!0===n.exists,'Transforms only support precondition "exists == true"'),new St(r,a)}return g("unknown mutation proto: "+JSON.stringify(e))},e.prototype.toPrecondition=function(e){return v(!e.isNone,"Can't serialize an empty precondition"),void 0!==e.updateTime?{updateTime:this.toVersion(e.updateTime)}:void 0!==e.exists?{exists:e.exists}:g("Unknown precondition")},e.prototype.fromPrecondition=function(e){return void 0!==e.updateTime?_t.updateTime(this.fromVersion(e.updateTime)):void 0!==e.exists?_t.exists(e.exists):_t.NONE},e.prototype.fromWriteResult=function(e,t){var n=this,r=e.updateTime?this.fromVersion(e.updateTime):this.fromVersion(t),i=null;return e.transformResults&&e.transformResults.length>0&&(i=e.transformResults.map((function(e){return n.fromValue(e)}))),new gt(r,i)},e.prototype.fromWriteResults=function(e,t){var n=this;return e&&e.length>0?(v(void 0!==t,"Received a write result without a commit time"),e.map((function(e){return n.fromWriteResult(e,t)}))):[]},e.prototype.toFieldTransform=function(e){var t=this,n=e.transform;if(n instanceof ii)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof oi)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements.map((function(e){return t.toValue(e)}))}};if(n instanceof ai)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements.map((function(e){return t.toValue(e)}))}};if(n instanceof si)return{fieldPath:e.field.canonicalString(),increment:this.toValue(n.operand)};throw g("Unknown transform: "+e.transform)},e.prototype.fromFieldTransform=function(e){var t=this,n=null;if("setToServerValue"in e)v("REQUEST_TIME"===e.setToServerValue,"Unknown server value transform proto: "+JSON.stringify(e)),n=ii.instance;else if("appendMissingElements"in e){var r=e.appendMissingElements.values||[];n=new oi(r.map((function(e){return t.fromValue(e)})))}else if("removeAllFromArray"in e){r=e.removeAllFromArray.values||[];n=new ai(r.map((function(e){return t.fromValue(e)})))}else if("increment"in e){var i=this.fromValue(e.increment);v(i instanceof Dt,"NUMERIC_ADD transform requires a NumberValue"),n=new si(i)}else g("Unknown transform proto: "+JSON.stringify(e));var o=le.fromServerFormat(e.fieldPath);return new yt(o,n)},e.prototype.toDocumentsTarget=function(e){return{documents:[this.toQueryPath(e.path)]}},e.prototype.fromDocumentsTarget=function(e){var t=e.documents.length;v(1===t,"DocumentsTarget contained other than 1 document: "+t);var n=e.documents[0];return Qr.atPath(this.fromQueryPath(n))},e.prototype.toQueryTarget=function(e){var t={structuredQuery:{}},n=e.path;null!==e.collectionGroup?(v(n.length%2===0,"Collection Group queries should be within a document path or root."),t.parent=this.toQueryPath(n),t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(v(n.length%2!==0,"Document queries with filters are not supported."),t.parent=this.toQueryPath(n.popLast()),t.structuredQuery.from=[{collectionId:n.lastSegment()}]);var r=this.toFilter(e.filters);r&&(t.structuredQuery.where=r);var i=this.toOrder(e.orderBy);i&&(t.structuredQuery.orderBy=i);var o=this.toInt32Value(e.limit);return void 0!==o&&(t.structuredQuery.limit=o),e.startAt&&(t.structuredQuery.startAt=this.toCursor(e.startAt)),e.endAt&&(t.structuredQuery.endAt=this.toCursor(e.endAt)),t},e.prototype.fromQueryTarget=function(e){var t=this.fromQueryPath(e.parent),n=e.structuredQuery,r
1=n.from?n.from.length:0,i=null;if(r>0){v(1===r,"StructuredQuery.from with more than one collection is not supported.");var o=n.from[0];o.allDescendants?i=o.collectionId:t=t.child(o.collectionId)}var a=[];n.where&&(a=this.fromFilter(n.where));var s=[];n.orderBy&&(s=this.fromOrder(n.orderBy));var u=null;n.limit&&(u=this.fromInt32Value(n.limit));var c=null;n.startAt&&(c=this.fromCursor(n.startAt));var l=null;return n.endAt&&(l=this.fromCursor(n.endAt)),new Qr(t,i,s,a,u,c,l)},e.prototype.toListenRequestLabels=function(e){var t=this.toLabel(e.purpose);return null==t?null:{"goog-listen-tags":t}},e.prototype.toLabel=function(e){switch(e){case En.Listen:return null;case En.ExistenceFilterMismatch:return"existence-filter-mismatch";case En.LimboResolution:return"limbo-document";default:return g("Unrecognized query purpose: "+e)}},e.prototype.toTarget=function(e){var t,n=e.query;return(t=n.isDocumentQuery()?{documents:this.toDocumentsTarget(n)}:{query:this.toQueryTarget(n)}).targetId=e.targetId,e.resumeToken.length>0&&(t.resumeToken=this.unsafeCastProtoByteString(e.resumeToken)),t},e.prototype.toFilter=function(e){var t=this;if(0!==e.length){var n=e.map((function(e){return e instanceof Hr?t.toUnaryOrFieldFilter(e):g("Unrecognized filter: "+JSON.stringify(e))}));return 1===n.length?n[0]:{compositeFilter:{op:"AND",filters:n}}}},e.prototype.fromFilter=function(e){var t=this;return e?void 0!==e.unaryFilter?[this.fromUnaryFilter(e)]:void 0!==e.fieldFilter?[this.fromFieldFilter(e)]:void 0!==e.compositeFilter?e.compositeFilter.filters.map((function(e){return t.fromFilter(e)})).reduce((function(e,t){return e.concat(t)})):g("Unknown filter: "+JSON.stringify(e)):[]},e.prototype.toOrder=function(e){var t=this;if(0!==e.length)return e.map((function(e){return t.toPropertyOrder(e)}))},e.prototype.fromOrder=function(e){var t=this;return e.map((function(e){return t.fromPropertyOrder(e)}))},e.prototype.toCursor=function(e){var t=this;return{before:e.before,values:e.position.map((function(e){return t.toValue(e)}))}},e.prototype.fromCursor=function(e){var t=this,n=!!e.before,r=e.values.map((function(e){return t.fromValue(e)}));return new ei(r,n)},e.prototype.toDirection=function(e){return li[e.name]},e.prototype.fromDirection=function(e){switch(e){case"ASCENDING":return Zr.ASCENDING;case"DESCENDING":return Zr.DESCENDING;default:return}},e.prototype.toOperatorName=function(e){return hi[e.name]},e.prototype.fromOperatorName=function(e){switch(e){case"EQUAL":return zr.EQUAL;case"GREATER_THAN":return zr.GREATER_THAN;case"GREATER_THAN_OR_EQUAL":return zr.GREATER_THAN_OR_EQUAL;case"LESS_THAN":return zr.LESS_THAN;case"LESS_THAN_OR_EQUAL":return zr.LESS_THAN_OR_EQUAL;case"ARRAY_CONTAINS":return zr.ARRAY_CONTAINS;case"IN":return zr.IN;case"ARRAY_CONTAINS_ANY":return zr.ARRAY_CONTAINS_ANY;case"OPERATOR_UNSPECIFIED":return g("Unspecified operator");default:return g("Unknown operator")}},e.prototype.toFieldPathReference=function(e){return{fieldPath:e.canonicalString()}},e.prototype.fromFieldPathReference=function(e){return le.fromServerFormat(e.fieldPath)},e.prototype.toPropertyOrder=function(e){return{field:this.toFieldPathReference(e.field),direction:this.toDirection(e.dir)}},e.prototype.fromPropertyOrder=function(e){return new ti(this.fromFieldPathReference(e.field),this.fromDirection(e.direction))},e.prototype.fromFieldFilter=function(e){return Hr.create(this.fromFieldPathReference(e.fieldFilter.field),this.fromOperatorName(e.fieldFilter.op),this.fromValue(e.fieldFilter.value))},e.prototype.toUnaryOrFieldFilter=function(e){if(e.op===zr.EQUAL){if(e.value.isEqual(Pt.NAN))return{unaryFilter:{field:this.toFieldPathReference(e.field),op:"IS_NAN"}};if(e.value.isEqual(Nt.INSTANCE))return{unaryFilter:{field:this.toFieldPathReference(e.field),op:"IS_NULL"}}}return{fieldFilter:{field:this.toFieldPathReference(e.field),op:this.toOperatorName(e.op),value:this.toValue(e.value)}}},e.prototype.fromUnaryFilter=function(e){switch(e.unaryFilter.op){case"IS_NAN":var t=this.fromFieldPathReference(e.unaryFilter.field);return Hr.create(t,zr.EQUAL,Pt.NAN);case"IS_NULL":var n=this.fromFieldPathReference(e.unaryFilter.field);return Hr.create(n,zr.EQUAL,Nt.INSTANCE);case"OPERATOR_UNSPECIFIED":return g("Unspecified filter");default:return g("Unknown filter")}},e.prototype.toDocumentMask=function(e){var t=[];return e.fields.forEach((function(e){return t.push(e.canonicalString())})),{fieldPaths:t}},e.prototype.fromDocumentMask=function(e){var t=(e.fieldPaths||[]).map((function(e){return le.fromServerFormat(e)}));return mt.fromArray(t)},e}(),yi=function(){return function(){this.viewSnap=null,this.targetId=0,this.listeners=[]}}(),gi=function(){function e(e){this.syncEngine=e,this.queries=new zt((function(e){return e.canonicalId()})),this.onlineState=dr.Unknown,this.syncEngine.subscribe(this)}return e.prototype.listen=function(e){var t=e.query,n=!1,r=this.queries.get(t);return r||(n=!0,r=new yi,this.queries.set(t,r)),r.listeners.push(e),e.applyOnlineStateChange(this.onlineState),r.viewSnap&&e.onViewSnapsh
1ot(r.viewSnap),n?this.syncEngine.listen(t).then((function(e){return r.targetId=e,e})):Promise.resolve(r.targetId)},e.prototype.unlisten=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n,r,i;return s.__generator(this,(function(o){return t=e.query,n=!1,(r=this.queries.get(t))&&(i=r.listeners.indexOf(e))>=0&&(r.listeners.splice(i,1),n=0===r.listeners.length),n?(this.queries.delete(t),[2,this.syncEngine.unlisten(t)]):[2]}))}))},e.prototype.onWatchChange=function(e){for(var t=0,n=e;t<n.length;t++){var r=n[t],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}}},e.prototype.onWatchError=function(e,t){var n=this.queries.get(e);if(n)for(var r=0,i=n.listeners;r<i.length;r++){i[r].onError(t)}this.queries.delete(e)},e.prototype.onOnlineStateChange=function(e){this.onlineState=e,this.queries.forEach((function(t,n){for(var r=0,i=n.listeners;r<i.length;r++){i[r].applyOnlineStateChange(e)}}))},e}(),vi=function(){function e(e,t,n){this.query=e,this.queryObserver=t,this.raisedInitialEvent=!1,this.snap=null,this.onlineState=dr.Unknown,this.options=n||{}}return e.prototype.onViewSnapshot=function(e){if(v(e.docChanges.length>0||e.syncStateChanged,"We got a new snapshot with no changes?"),!this.options.includeMetadataChanges){for(var t=[],n=0,r=e.docChanges;n<r.length;n++){var i=r[n];i.type!==Ir.Metadata&&t.push(i)}e=new Rr(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0)}this.raisedInitialEvent?this.shouldRaiseEvent(e)&&this.queryObserver.next(e):this.shouldRaiseInitialEvent(e,this.onlineState)&&this.raiseInitialEvent(e),this.snap=e},e.prototype.onError=function(e){this.queryObserver.error(e)},e.prototype.applyOnlineStateChange=function(e){this.onlineState=e,this.snap&&!this.raisedInitialEvent&&this.shouldRaiseInitialEvent(this.snap,e)&&this.raiseInitialEvent(this.snap)},e.prototype.shouldRaiseInitialEvent=function(e,t){if(v(!this.raisedInitialEvent,"Determining whether to raise first event but already had first event"),!e.fromCache)return!0;var n=t!==dr.Offline;return this.options.waitForSyncWhenOnline&&n?(v(e.fromCache,"Waiting for sync, but snapshot is not from cache"),!1):!e.docs.isEmpty()||t===dr.Offline},e.prototype.shouldRaiseEvent=function(e){if(e.docChanges.length>0)return!0;var t=this.snap&&this.snap.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges},e.prototype.raiseInitialEvent=function(e){v(!this.raisedInitialEvent,"Trying to raise initial events for second time"),e=Rr.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache),this.raisedInitialEvent=!0,this.queryObserver.next(e)},e}(),bi=function(){function e(e,t,n){this.targetId=e,this.addedKeys=t,this.removedKeys=n}return e.fromSnapshot=function(t,n){for(var r=qe(),i=qe(),o=0,a=n.docChanges;o<a.length;o++){var s=a[o];switch(s.type){case Ir.Added:r=r.add(s.doc.key);break;case Ir.Removed:i=i.add(s.doc.key)}}return new e(t,r,i)},e}(),_i=function(){return function(e){this.key=e}}(),wi=function(){return function(e){this.key=e}}(),Ei=function(){function e(e,t){this.query=e,this._syncedDocuments=t,this.syncState=null,this.current=!1,this.limboDocuments=qe(),this.mutatedKeys=qe(),this.documentSet=new Nr(e.docComparator.bind(e))}return Object.defineProperty(e.prototype,"syncedDocuments",{get:function(){return this._syncedDocuments},enumerable:!0,configurable:!0}),e.prototype.computeDocChanges=function(e,t){var n=this,r=t?t.changeSet:new Dr,i=t?t.documentSet:this.documentSet,o=t?t.mutatedKeys:this.mutatedKeys,a=i,s=!1,u=this.query.hasLimit()&&i.size===this.query.limit?i.last():null;if(e.inorderTraversal((function(e,t){var c=i.get(e),l=t instanceof Wt?t:null;l&&(v(e.isEqual(l.key),"Mismatching keys found in document changes: "+e+" != "+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:Ir.Metadata,doc:l}),p=!0):n.shouldWaitForSyncedDocument(c,l)||(r.track({type:Ir.Modified,doc:l}),p=!0,u&&n.query.docComparator(l,u)>0&&(s=!0)):!c&&l?(r.track({type:Ir.Added,doc:l}),p=!0):c&&!l&&(r.track({type:Ir.Removed,doc:c}),p=!0,u&&(s=!0));p&&(l?(a=a.add(l),o=f?o.add(e):o.delete(e)):(a=a.delete(e),o=o.delete(e)))})),this.query.hasLimit())for(;a.size>this.query.limit;
1){var c=a.last();a=a.delete(c.key),o=o.delete(c.key),r.track({type:Ir.Removed,doc:c})}return v(!s||!t,"View was refilled using docs that themselves needed refilling."),{documentSet:a,changeSet:r,needsRefill:s,mutatedKeys:o}},e.prototype.shouldWaitForSyncedDocument=function(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations},e.prototype.applyChanges=function(e,t,n){var r=this;v(!e.needsRefill,"Cannot apply changes that need a refill");var i=this.documentSet;this.documentSet=e.documentSet,this.mutatedKeys=e.mutatedKeys;var o=e.changeSet.getChanges();o.sort((function(e,t){return function(e,t){var n=function(e){switch(e){case Ir.Added:return 1;case Ir.Modified:case Ir.Metadata:return 2;case Ir.Removed:return 0;default:return g("Unknown ChangeType: "+e)}};return n(e)-n(t)}(e.type,t.type)||r.query.docComparator(e.doc,t.doc)})),this.applyTargetChange(n);var a=t?this.updateLimboDocuments():[],s=0===this.limboDocuments.size&&this.current?kr.Synced:kr.Local,u=s!==this.syncState;return this.syncState=s,0!==o.length||u?{snapshot:new Rr(this.query,e.documentSet,i,o,e.mutatedKeys,s===kr.Local,u,!1),limboChanges:a}:{limboChanges:a}},e.prototype.applyOnlineStateChange=function(e){return this.current&&e===dr.Offline?(this.current=!1,this.applyChanges({documentSet:this.documentSet,changeSet:new Dr,mutatedKeys:this.mutatedKeys,needsRefill:!1},!1)):{limboChanges:[]}},e.prototype.shouldBeInLimbo=function(e){return!this._syncedDocuments.has(e)&&(!!this.documentSet.has(e)&&!this.documentSet.get(e).hasLocalMutations)},e.prototype.applyTargetChange=function(e){var t=this;e&&(e.addedDocuments.forEach((function(e){return t._syncedDocuments=t._syncedDocuments.add(e)})),e.modifiedDocuments.forEach((function(e){return v(t._syncedDocuments.has(e),"Modified document "+e+" not found in view.")})),e.removedDocuments.forEach((function(e){return t._syncedDocuments=t._syncedDocuments.delete(e)})),this.current=e.current)},e.prototype.updateLimboDocuments=function(){var e=this;if(!this.current)return[];var t=this.limboDocuments;this.limboDocuments=qe(),this.documentSet.forEach((function(t){e.shouldBeInLimbo(t.key)&&(e.limboDocuments=e.limboDocuments.add(t.key))}));var n=[];return t.forEach((function(t){e.limboDocuments.has(t)||n.push(new wi(t))})),this.limboDocuments.forEach((function(e){t.has(e)||n.push(new _i(e))})),n},e.prototype.synchronizeWithPersistedState=function(e,t){this._syncedDocuments=t,this.limboDocuments=qe();var n=this.computeDocChanges(e);return this.applyChanges(n,!0)},e.prototype.computeInitialSnapshot=function(){return Rr.fromInitialDocuments(this.query,this.documentSet,this.mutatedKeys,this.syncState===kr.Local)},e}();var Ti=5,Si=function(){function e(e,t,n,r){this.asyncQueue=e,this.remoteStore=t,this.updateFunction=n,this.deferred=r,this.retries=Ti,this.backoff=new pr(this.asyncQueue,ee.RetryTransaction)}return e.prototype.run=function(){this.runWithBackOff()},e.prototype.runWithBackOff=function(){var e=this;this.backoff.backoffAndRun((function(){return s.__awaiter(e,void 0,void 0,(function(){var e,t,n=this;return s.__generator(this,(function(r){return e=this.remoteStore.createTransaction(),(t=this.tryRunUpdateFunction(e))&&t.then((function(t){n.asyncQueue.enqueueAndForget((function(){return e.commit().then((function(){n.deferred.resolve(t)})).catch((function(e){n.handleTransactionError(e)}))}))})).catch((function(e){n.handleTransactionError(e)})),[2]}))}))}))},e.prototype.tryRunUpdateFunction=function(e){try{var t=this.updateFunction(e);return!sr(t)&&t.catch&&t.then?t:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(m){return this.deferred.reject(m),null}},e.prototype.handleTransactionError=function(e){var t=this;this.retries>0&&this.isRetryableTransactionError(e)?(this.retries-=1,this.asyncQueue.enqueueAndForget((function(){return t.runWithBackOff(),Promise.resolve()}))):this.deferred.reject(e)},e.prototype.isRetryableTransactionError=function(e){if("FirebaseError"===e.name){var t=e.code;return"aborted"===t||"failed-precondition"===t||!Tr(t)}return!1},e}(),Ci=function(){return function(e,t,n){this.query=e,this.targetId=t,this.view=n}}(),Ii=function(){return function(e){this.key=e,this.receivedDocument=!1}}(),ki=function(){function e(e,t,n,r){this.localStore=e,this.remoteStore=t,this.sharedCl
1ientState=n,this.currentUser=r,this.syncEngineListener=null,this.queryViewsByQuery=new zt((function(e){return e.canonicalId()})),this.queryViewsByTarget={},this.limboTargetsByKey=new Ce(he.comparator),this.limboResolutionsByTarget={},this.limboDocumentRefs=new Hn,this.mutationUserCallbacks={},this.pendingWritesCallbacks=new Map,this.limboTargetIdGenerator=et.forSyncEngine(),this.isPrimary=void 0,this.onlineState=dr.Unknown}return Object.defineProperty(e.prototype,"isPrimaryClient",{get:function(){return!0===this.isPrimary},enumerable:!0,configurable:!0}),e.prototype.subscribe=function(e){v(null!==e,"SyncEngine listener cannot be null"),v(null===this.syncEngineListener,"SyncEngine already has a subscriber."),this.syncEngineListener=e},e.prototype.listen=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n,r,i,o;return s.__generator(this,(function(a){switch(a.label){case 0:return this.assertSubscribed("listen()"),(r=this.queryViewsByQuery.get(e))?(t=r.targetId,this.sharedClientState.addLocalQueryTarget(t),n=r.view.computeInitialSnapshot(),[3,4]):[3,1];case 1:return[4,this.localStore.allocateQuery(e)];case 2:return i=a.sent(),o=this.sharedClientState.addLocalQueryTarget(i.targetId),t=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,t]}}))}))},e.prototype.initializeViewAndComputeSnapshot=function(e,t){return s.__awaiter(this,void 0,void 0,(function(){var n,r,i,o,a,u,c,l;return s.__generator(this,(function(s){switch(s.label){case 0:return n=e.query,[4,this.localStore.executeQuery(n)];case 1:return r=s.sent(),[4,this.localStore.remoteDocumentKeys(e.targetId)];case 2:return i=s.sent(),o=new Ei(n,i),a=o.computeDocChanges(r),u=Pr.createSynthesizedTargetChangeForCurrentChange(e.targetId,t&&this.onlineState!==dr.Offline),v(0===(c=o.applyChanges(a,!0===this.isPrimary,u)).limboChanges.length,"View returned limbo docs before target ack from the server."),v(!!c.snapshot,"applyChanges for new view should always return a snapshot"),l=new Ci(n,e.targetId,o),this.queryViewsByQuery.set(n,l),this.queryViewsByTarget[e.targetId]=l,[2,c.snapshot]}}))}))},e.prototype.synchronizeViewAndComputeSnapshot=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n,r;return s.__generator(this,(function(i){switch(i.label){case 0:return[4,this.localStore.executeQuery(e.query)];case 1:return t=i.sent(),[4,this.localStore.remoteDocumentKeys(e.targetId)];case 2:return n=i.sent(),r=e.view.synchronizeWithPersistedState(t,n),this.isPrimary&&this.updateTrackedLimbos(e.targetId,r.limboChanges),[2,r]}}))}))},e.prototype.unlisten=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n=this;return s.__generator(this,(function(r){switch(r.label){case 0:return this.assertSubscribed("unlisten()"),v(!!(t=this.queryViewsByQuery.get(e)),"Trying to unlisten on query not found:"+e),this.isPrimary?(this.sharedClientState.removeLocalQueryTarget(t.targetId),this.sharedClientState.isActiveQueryTarget(t.targetId)?[3,2]:[4,this.localStore.releaseQuery(e,!1).then((function(){n.sharedClientState.clearQueryState(t.targetId),n.remoteStore.unlisten(t.targetId),n.removeAndCleanupQuery(t)})).catch(jn)]):[3,3];case 1:r.sent(),r.label=2;case 2:return[3,5];case 3:return this.removeAndCleanupQuery(t),[4,this.localStore.releaseQuery(e,!0)];case 4:r.sent(),r.label=5;case 5:return[2]}}
1))}))},e.prototype.write=function(e,t){return s.__awaiter(this,void 0,void 0,(function(){var n;return s.__generator(this,(function(r){switch(r.label){case 0:return this.assertSubscribed("write()"),[4,this.localStore.localWrite(e)];case 1:return n=r.sent(),this.sharedClientState.addPendingMutation(n.batchId),this.addMutationCallback(n.batchId,t),[4,this.emitNewSnapsAndNotifyLocalStore(n.changes)];case 2:return r.sent(),[4,this.remoteStore.fillWritePipeline()];case 3:return r.sent(),[2]}}))}))},e.prototype.runTransaction=function(e,t,n){new Si(e,this.remoteStore,t,n).run()},e.prototype.applyRemoteEvent=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n=this;return s.__generator(this,(function(r){switch(r.label){case 0:this.assertSubscribed("applyRemoteEvent()"),r.label=1;case 1:return r.trys.push([1,4,,6]),[4,this.localStore.applyRemoteEvent(e)];case 2:return t=r.sent(),k(e.targetChanges,(function(e,t){var r=n.limboResolutionsByTarget[Number(e)];r&&(v(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1,"Limbo resolution for single document contains multiple changes."),t.addedDocuments.size>0?r.receivedDocument=!0:t.modifiedDocuments.size>0?v(r.receivedDocument,"Received change for limbo target document without add."):t.removedDocuments.size>0&&(v(r.receivedDocument,"Received remove for limbo target document without add."),r.receivedDocument=!1))})),[4,this.emitNewSnapsAndNotifyLocalStore(t,e)];case 3:return r.sent(),[3,6];case 4:return[4,jn(r.sent())];case 5:return r.sent(),[3,6];case 6:return[2]}}
1))}))},e.prototype.applyOnlineStateChange=function(e,t){if(this.isPrimary&&t===mr.RemoteStore||!this.isPrimary&&t===mr.SharedClientState){this.assertSubscribed("applyOnlineStateChange()");var n=[];this.queryViewsByQuery.forEach((function(t,r){var i=r.view.applyOnlineStateChange(e);v(0===i.limboChanges.length,"OnlineState should not affect limbo documents."),i.snapshot&&n.push(i.snapshot)})),this.syncEngineListener.onOnlineStateChange(e),this.syncEngineListener.onWatchChange(n),this.onlineState=e,this.isPrimary&&this.sharedClientState.setOnlineState(e)}},e.prototype.rejectListen=function(e,t){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(e,"rejected",t),n=this.limboResolutionsByTarget[e],(r=n&&n.key)?(this.limboTargetsByKey=this.limboTargetsByKey.remove(r),delete this.limboResolutionsByTarget[e],i=(i=new Ce(he.comparator)).insert(r,new Qt(r,Se.forDeletedDoc())),o=qe().add(r),a=new Or(Se.MIN,{},new Ae(Y),i,o),[2,this.applyRemoteEvent(a)]):[3,1];case 1:return v(!!(u=this.queryViewsByTarget[e]),"Unknown targetId: "+e),[4,this.localStore.releaseQuery(u.query,!1).then((function(){return c.removeAndCleanupQuery(u)})).catch(jn)];case 2:s.sent(),this.syncEngineListener.onWatchError(u.query,t),s.label=3;case 3:return[2]}}
1))}))},e.prototype.applyBatchState=function(e,t,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(e)];case 1:return null===(r=i.sent())?(d("SyncEngine","Cannot apply mutation batch with id: "+e),[2]):"pending"!==t?[3,3]:[4,this.remoteStore.fillWritePipeline()];case 2:return i.sent(),[3,4];case 3:"acknowledged"===t||"rejected"===t?(this.processUserCallback(e,n||null),this.localStore.removeCachedMutationBatchMetadata(e)):g("Unknown batchState: "+t),i.label=4;case 4:return[4,this.emitNewSnapsAndNotifyLocalStore(r)];case 5:return i.sent(),[2]}}))}))},e.prototype.applySuccessfulWrite=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n;return s.__generator(this,(function(r){switch(r.label){case 0:this.assertSubscribed("applySuccessfulWrite()"),t=e.batch.batchId,this.processUserCallback(t,null),this.triggerPendingWritesCallbacks(t),r.label=1;case 1:return r.trys.push([1,4,,6]),[4,this.localStore.acknowledgeBatch(e)];case 2:return n=r.sent(),this.sharedClientState.updateMutationState(t,"acknowledged"),[4,this.emitNewSnapsAndNotifyLocalStore(n)];case 3:return r.sent(),[3,6];case 4:return[4,jn(r.sent())];case 5:return r.sent(),[3,6];case 6:return[2]}}
1))}))},e.prototype.rejectFailedWrite=function(e,t){return s.__awaiter(this,void 0,void 0,(function(){var n;return s.__generator(this,(function(r){switch(r.label){case 0:this.assertSubscribed("rejectFailedWrite()"),this.processUserCallback(e,t),this.triggerPendingWritesCallbacks(e),r.label=1;case 1:return r.trys.push([1,4,,6]),[4,this.localStore.rejectBatch(e)];case 2:return n=r.sent(),this.sharedClientState.updateMutationState(e,"rejected",t),[4,this.emitNewSnapsAndNotifyLocalStore(n)];case 3:return r.sent(),[3,6];case 4:return[4,jn(r.sent())];case 5:return r.sent(),[3,6];case 6:return[2]}}))}))},e.prototype.registerPendingWritesCallback=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n;return s.__generator(this,(function(r){switch(r.label){case 0:return this.remoteStore.canUseNetwork()||d("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),[4,this.localStore.getHighestUnacknowledgedBatchId()];case 1:return-1===(t=r.sent())?(e.resolve(),[2]):((n=this.pendingWritesCallbacks.get(t)||[]).push(e),this.pendingWritesCallbacks.set(t,n),[2])}}))}))},e.prototype.triggerPendingWritesCallbacks=function(e){(this.pendingWritesCallbacks.get(e)||[]).forEach((function(e){e.resolve()})),this.pendingWritesCallbacks.delete(e)},e.prototype.rejectOutstandingPendingWritesCallbacks=function(e){this.pendingWritesCallbacks.forEach((function(t){t.forEach((function(t){t.reject(new E(w.CANCELLED,e))}))})),this.pendingWritesCallbacks.clear()},e.prototype.addMutationCallback=function(e,t){var n=this.mutationUserCallbacks[this.currentUser.toKey()];n||(n=new Ce(Y)),n=n.insert(e,t),this.mutationUserCallbacks[this.currentUser.toKey()]=n},e.prototype.processUserCallback=function(e,t){var n=this.mutationUserCallbacks[this.currentUser.toKey()];if(n){var r=n.get(e);r&&(v(e===n.minKey(),"Mutation callbacks processed out-of-order?"),t?r.reject(t):r.resolve(),n=n.remove(e)),this.mutationUserCallbacks[this.currentUser.toKey()]=n}},e.prototype.removeAndCleanupQuery=function(e){var t=this;if(this.sharedClientState.removeLocalQueryTarget(e.targetId),this.queryViewsByQuery.delete(e.query),delete this.queryViewsByTarget[e.targetId],this.isPrimary){var n=this.limboDocumentRefs.referencesForId(e.targetId);this.limboDocumentRefs.removeReferencesForId(e.targetId),n.forEach((function(e){t.limboDocumentRefs.containsKey(e)||t.removeLimboTarget(e)}))}},e.prototype.removeLimboTarget=function(e){var t=this.limboTargetsByKey.get(e);null!==t&&(this.remoteStore.unlisten(t),this.limboTargetsByKey=this.limboTargetsByKey.remove(e),delete this.limboResolutionsByTarget[t])},e.prototype.updateTrackedLimbos=function(e,t){for(var n=0,r=t;n<r.length;n++){var i=r[n];if(i instanceof _i)this.limboDocumentRefs.addReference(i.key,e),this.trackLimboChange(i);else if(i instanceof wi){d("SyncEngine","Document no longer in limbo: "+i.key),this.limboDocumentRefs.removeReference(i.key,e),this.limboDocumentRefs.containsKey(i.key)||this.removeLimboTarget(i.key)}else g("Unknown limbo change: "+JSON.stringify(i))}},e.prototype.trackLimboChange=function(e){var t=e.key;if(!this.limboTargetsByKey.get(t)){d("SyncEngine","New document in limbo: "+t);var n=this.limboTargetIdGenerator.next(),r=Qr.atPath(t.path);this.limboResolutionsByTarget[n]=new Ii(t),this.remoteStore.listen(new In(r,n,En.LimboResolution,ae.INVALID)),this.limboTargetsByKey=this.limboTargetsByKey.insert(t,n)}},e.prototype.currentLimboDocs=function(){return this.limboTargetsByKey},e.prototype.emitNewSnapsAndNotifyLocalStore=function(e,t){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 t=s.view.computeDocChanges(e);return t.needsRefill?o.localStore.executeQuery(s.query).then((function(e){return s.view.computeDocChanges(e,t)})):t})).then((function(e){var i=t&&t.targetChanges[s.targetId],a=s.view.applyChanges(e,!0===o.isPrimary,i);if(o.updateTrackedLimbos(s.targetId,a.limboChanges),a.snapshot){o.isPrimary&&o.sharedCl
1ientState.updateQueryState(s.targetId,a.snapshot.fromCache?"not-current":"current"),n.push(a.snapshot);var u=bi.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]}}))}))},e.prototype.assertSubscribed=function(e){v(null!==this.syncEngineListener,"Trying to call "+e+" before calling subscribe().")},e.prototype.handleCredentialChange=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n;return s.__generator(this,(function(r){switch(r.label){case 0:return t=!this.currentUser.isEqual(e),this.currentUser=e,t?(this.rejectOutstandingPendingWritesCallbacks("'waitForPendingWrites' promise is rejected due to a user change."),[4,this.localStore.handleUserChange(e)]):[3,3];case 1:return n=r.sent(),this.sharedClientState.handleUserChange(e,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]}}))}))},e.prototype.applyPrimaryState=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n,r,i,o,a,u,c=this;return s.__generator(this,(function(s){switch(s.label){case 0:return!0!==e||!0===this.isPrimary?[3,3]:(this.isPrimary=!0,[4,this.remoteStore.applyPrimaryState(!0)]);case 1:return s.sent(),t=this.sharedClientState.getAllActiveQueryTargets(),[4,this.synchronizeQueryViewsAndRaiseSnapshots(t.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!==e||!1===this.isPrimary?[3,7]:(this.isPrimary=!1,a=[],u=Promise.resolve(),I(this.queryViewsByTarget,(function(e,t){c.sharedClientState.isLocalQueryTarget(e)?a.push(e):u=u.then((function(){return c.unlisten(t.query)})),c.remoteStore.unlisten(t.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]}}
1))}))},e.prototype.resetLimboDocuments=function(){var e=this;I(this.limboResolutionsByTarget,(function(t){e.remoteStore.unlisten(t)})),this.limboDocumentRefs.removeAllReferences(),this.limboResolutionsByTarget=[],this.limboTargetsByKey=new Ce(he.comparator)},e.prototype.synchronizeQueryViewsAndRaiseSnapshots=function(e){return s.__awaiter(this,void 0,void 0,(function(){var t,n,r,i,o,a,u,c,l;return s.__generator(this,(function(s){switch(s.label){case 0:t=[],n=[],r=0,i=e,s.label=1;case 1:return r<i.length?(o=i[r],a=void 0,(u=this.queryViewsByTarget[o])?[4,this.localStore.releaseQuery(u.query,!0)]:[3,5]):[3,11];case 2:return s.sent(),[4,this.localStore.allocateQuery(u.query)];case 3:return a=s.sent(),[4,this.synchronizeViewAndComputeSnapshot(u)];case 4:return(c=s.sent()).snapshot&&n.push(c.snapshot),[3,9];case 5:return v(!0===this.isPrimary,"A secondary tab should never have an active query without an active view."),[4,this.localStore.getQueryForTarget(o)];case 6:return v(!!(l=s.sent()),"Query data for target "+o+" not found"),[4,this.localStore.allocateQuery(l)];case 7:return a=s.sent(),[4,this.initializeViewAndComputeSnapshot(a,!1)];case 8:s.sent(),s.label=9;case 9:t.push(a),s.label=10;case 10:return r++,[3,1];case 11:return this.syncEngineListener.onWatchChange(n),[2,t]}}))}))},e.prototype.getActiveClients=function(){return this.localStore.getActiveClients()},e.prototype.applyTargetState=function(e,t,n){return s.__awaiter(this,void 0,void 0,(function(){var r,i,o,a,u;return s.__generator(this,(function(s){switch(s.label){case 0:if(this.isPrimary)return d("SyncEngine","Ignoring unexpected query state notification."),[2];if(!this.queryViewsByTarget[e])return[3,11];switch(t){case"current":case"not-current":return[3,1];case"rejected":return[3,8]}return[3,10];case 1:return s.trys.push([1,4,,8]),[4,this.localStore.getNewDocumentChanges()];case 2:return r=s.sent(),i=Or.createSynthesizedRemoteEventForCurrentChange(e,"current"===t),[4,this.emitNewSnapsAndNotifyLocalStore(r,i)];case 3:return s.sent(),[3,11];case 4:return o=s.sent(),(c=o).code!==w.DATA_LOSS||c.message!==Gt?[3,6]:(a=[],I(this.queryViewsByTarget,(function(e){return a.push(e)})),[4,this.synchronizeQueryViewsAndRaiseSnapshots(a)]);case 5:return s.sent(),[3,7];case 6:throw o;case 7:return[3,8];case 8:return u=this.queryViewsByTarget[e],this.removeAndCleanupQuery(u),[4,this.localStore.releaseQuery(u.query,!0)];case 9:return s.sent(),this.syncEngineListener.onWatchError(u.query,n),[3,11];case 10:g("Unexpected target state: "+t),s.label=11;case 11:return[2]}var c}))}))},e.prototype.applyActiveTargetsChange=function(e,t){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=e,p.label=1;case 1:return n<r.length?(h=r[n],v(!this.queryViewsByTarget[h],"Trying to add an already active target"),[4,this.localStore.getQueryForTarget(h)]):[3,6];case 2:return v(!!(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(e){var t;return s.__generator(this,(function(n){switch(n.label){case 0:return(t=u.queryViewsByTarget[e])?[4,u.localStore.releaseQuery(t.query,!1).then((function(){f.remoteStore.unlisten(e),f.removeAndCleanupQuery(t)})).catch(jn)]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}
1))},u=this,c=0,l=t,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]}}))}))},e.prototype.enableNetwork=function(){return this.localStore.setNetworkEnabled(!0),this.remoteStore.enableNetwork()},e.prototype.disableNetwork=function(){return this.localStore.setNetworkEnabled(!1),this.remoteStore.disableNetwork()},e.prototype.getRemoteKeysForTarget=function(e){var t=this.limboResolutionsByTarget[e];return t&&t.receivedDocument?qe().add(t.key):this.queryViewsByTarget[e]?this.queryViewsByTarget[e].view.syncedDocuments:qe()},e}(),Ni=function(){function e(e){this.uid=e}return e.prototype.isAuthenticated=function(){return null!=this.uid},e.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},e.prototype.isEqual=function(e){return e.uid===this.uid},e.UNAUTHENTICATED=new e(null),e.GOOGLE_CREDENTIALS=new e("google-credentials-uid"),e.FIRST_PARTY=new e("first-party-uid"),e}(),Ai="SharedClientState",Di="firestore_clients",Ri="firestore_mutations",Oi="firestore_targets",Pi="firestore_online_state",xi="firestore_sequence_number",Mi=function(){function e(e,t,n,r){this.user=e,this.batchId=t,this.state=n,this.error=r,v(void 0!==r===("rejected"===n),"MutationMetadata must contain an error iff state is 'rejected'")}return e.fromWebStorageEntry=function(t,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 E(i.error.code,i.error.message)),o?new e(t,n,i.state,a):(m(Ai,"Failed to parse mutation state for ID '"+n+"': "+r),null)},e.prototype.toWebStorageJSON=function(){var e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)},e}(),Li=function(){function e(e,t,n){this.targetId=e,this.state=t,this.error=n,v(void 0!==n===("rejected"===t),"QueryTargetMetadata must contain an error iff state is 'rejected'")}return e.fromWebStorageEntry=function(t,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 E(r.error.code,r.error.message)),i?new e(t,r.state,o):(m(Ai,"Failed to parse target state for ID '"+t+"': "+n),null)},e.prototype.toWebStorageJSON=function(){var e={state:this.state,updateTimeMs:Date.now()};return this.error&&(e.error={code:this.error.code,message:this.error.message}),JSON.stringify(e)},e}(),Fi=function(){function e(e,t){this.clientId=e,this.activeTargetIds=t}return e.fromWebStorageEntry=function(t,n){for(var r=JSON.parse(n),i="object"===typeof r&&r.activeTargetIds instanceof Array,o=je(),a=0;i&&a<r.activeTargetIds.length;++a)i=ur(r.activeTargetIds[a]),o=o.add(r.activeTargetIds[a]);return i?new e(t,o):(m(Ai,"Failed to parse client data for instance '"+t+"': "+n),null)},e}(),Ui=function(){function e(e,t){this.clientId=e,this.onlineState=t}return e.fromWebStorageEntry=function(t){var n=JSON.parse(t);return"object"===typeof n&&n.onlineState in dr&&"string"===typeof n.clientId?new e(n.clientId,dr[n.onlineState]):(m(Ai,"Failed to parse online state: "+t),null)},e}(),qi=function(){function e(){this.activeTargetIds=je()}return e.prototype.addQueryTarget=function(e){v(!this.activeTargetIds.has(e),"Target with ID '"+e+"' already active."),this.activeTargetIds=this.activeTargetIds.add(e)},e.prototype.removeQueryTarget=function(e){this.activeTargetIds=this.activeTargetIds.delete(e)},e.prototype.toWebStorageJSON=function(){var e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)},e}(),Vi=function(){function e(t,n,r,i,o){if(this.queue=t,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=[],!e.isAvailable(this.platform))throw new E(w.UNIMPLEMENT
1ED,"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=xi+"_"+r,this.activeClients[this.localClientId]=new qi,this.clientStateKeyRe=new RegExp("^"+Di+"_"+a+"_([^_]*)$"),this.mutationBatchKeyRe=new RegExp("^"+Ri+"_"+a+"_(\\d+)(?:_(.*))?$"),this.queryTargetKeyRe=new RegExp("^"+Oi+"_"+a+"_(\\d+)$"),this.onlineStateKey=Pi+"_"+r,this.platform.window.addEventListener("storage",this.storageListener)}return e.isAvailable=function(e){return!(!e.window||null==e.window.localStorage)},e.prototype.start=function(){return s.__awaiter(this,void 0,void 0,(function(){var e,t,n,r,i,o,a,u,c,l,h,f=this;return s.__generator(this,(function(s){switch(s.label){case 0:return v(!this.started,"WebStorageSharedClientState already started"),v(null!==this.syncEngine,"syncEngine property must be set before calling start()"),v(null!==this.onlineStateHandler,"onlineStateHandler property must be set before calling start()"),[4,this.syncEngine.getActiveClients()];case 1:for(e=s.sent(),t=0,n=e;t<n.length;t++)(r=n[t])!==this.localClientId&&(i=this.getItem(this.toWebStorageClientStateKey(r)))&&(o=Fi.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]}}))}))},e.prototype.writeSequenceNumber=function(e){this.setItem(this.sequenceNumberKey,JSON.stringify(e))},e.prototype.getAllActiveQueryTargets=function(){var e=je();return k(this.activeClients,(function(t,n){e=e.unionWith(n.activeTargetIds)})),e},e.prototype.isActiveQueryTarget=function(e){for(var t in this.activeClients)if(this.activeClients.hasOwnProperty(t)&&this.activeClients[t].activeTargetIds.has(e))return!0;return!1},e.prototype.addPendingMutation=function(e){this.persistMutationState(e,"pending")},e.prototype.updateMutationState=function(e,t,n){this.persistMutationState(e,t,n),this.removeMutationState(e)},e.prototype.addLocalQueryTarget=function(e){var t="not-current";if(this.isActiveQueryTarget(e)){var n=this.storage.getItem(this.toWebStorageQueryTargetMetadataKey(e));if(n){var r=Li.fromWebStorageEntry(e,n);r&&(t=r.state)}}return this.localClientState.addQueryTarget(e),this.persistClientState(),t},e.prototype.removeLocalQueryTarget=function(e){this.localClientState.removeQueryTarget(e),this.persistClientState()},e.prototype.isLocalQueryTarget=function(e){return this.localClientState.activeTargetIds.has(e)},e.prototype.clearQueryState=function(e){this.removeItem(this.toWebStorageQueryTargetMetadataKey(e))},e.prototype.updateQueryState=function(e,t,n){this.persistQueryTargetState(e,t,n)},e.prototype.handleUserChange=function(e,t,n){var r=this;t.forEach((function(e){r.removeMutationState(e)})),this.currentUser=e,n.forEach((function(e){r.addPendingMutation(e)}))},e.prototype.setOnlineState=function(e){this.persistOnlineState(e)},e.prototype.shutdown=function(){this.started&&(this.platform.window.removeEventListener("storage",this.storageListener),this.removeItem(this.localClientStorageKey),this.started=!1)},e.prototype.getItem=function(e){var t=this.storage.getItem(e);return d(Ai,"READ",e,t),t},e.prototype.setItem=function(e,t){d(Ai,"SET",e,t),this.storage.setItem(e,t)},e.prototype.removeItem=function(e){d(Ai,"REMOVE",e),this.storage.removeItem(e)},e.prototype.handleWebStorageEvent=function(e){var t=this;if(e.storageArea===this.storage){if(d(Ai,"EVENT",e.key,e.newValue),e.key===this.localClientStorageKey)return void m("Received WebStorage notification for local change. Another client might have garbage-collected our state");this.queue.enqueueAndForget((function(){return s.__awaiter(t,void 0,void 0,(function(){var t,n,r,i,o,a;return s.__generator(this,(function(s){if(!this.started)return this.earlyEvents.push(e),[2];if(null===e.key)return[2];if(this.clientStateKeyRe.test(e.key)){if(null==e.newValue)return n=this.fromWebStorageClientStateKey(e.ke
1y),[2,this.handleClientStateEvent(n,null)];if(t=this.fromWebStorageClientState(e.key,e.newValue))return[2,this.handleClientStateEvent(t.clientId,t)]}else if(this.mutationBatchKeyRe.test(e.key)){if(null!==e.newValue&&(r=this.fromWebStorageMutationMetadata(e.key,e.newValue)))return[2,this.handleMutationBatchEvent(r)]}else if(this.queryTargetKeyRe.test(e.key)){if(null!==e.newValue&&(i=this.fromWebStorageQueryTargetMetadata(e.key,e.newValue)))return[2,this.handleQueryTargetEvent(i)]}else if(e.key===this.onlineStateKey){if(null!==e.newValue&&(o=this.fromWebStorageOnlineState(e.newValue)))return[2,this.handleOnlineStateEvent(o)]}else e.key===this.sequenceNumberKey&&(v(!!this.sequenceNumberHandler,"Missing sequenceNumberHandler"),(a=function(e){var t=ae.INVALID;if(null!=e)try{var n=JSON.parse(e);v("number"===typeof n,"Found non-numeric sequence number"),t=n}catch(r){m(Ai,"Failed to read sequence number from WebStorage",r)}return t}(e.newValue))!==ae.INVALID&&this.sequenceNumberHandler(a));return[2]}))}))}))}},Object.defineProperty(e.prototype,"localClientState",{get:function(){return this.activeClients[this.localClientId]},enumerable:!0,configurable:!0}),e.prototype.persistClientState=function(){this.setItem(this.localClientStorageKey,this.localClientState.toWebStorageJSON())},e.prototype.persistMutationState=function(e,t,n){var r=new Mi(this.currentUser,e,t,n),i=this.toWebStorageMutationBatchKey(e);this.setItem(i,r.toWebStorageJSON())},e.prototype.removeMutationState=function(e){var t=this.toWebStorageMutationBatchKey(e);this.removeItem(t)},e.prototype.persistOnlineState=function(e){var t={clientId:this.localClientId,onlineState:dr[e]};this.storage.setItem(this.onlineStateKey,JSON.stringify(t))},e.prototype.persistQueryTargetState=function(e,t,n){var r=this.toWebStorageQueryTargetMetadataKey(e),i=new Li(e,t,n);this.setItem(r,i.toWebStorageJSON())},e.prototype.toWebStorageClientStateKey=function(e){return v(-1===e.indexOf("_"),"Client key cannot contain '_', but was '"+e+"'"),Di+"_"+this.persistenceKey+"_"+e},e.prototype.toWebStorageQueryTargetMetadataKey=function(e){return Oi+"_"+this.persistenceKey+"_"+e},e.prototype.toWebStorageMutationBatchKey=function(e){var t=Ri+"_"+this.persistenceKey+"_"+e;return this.currentUser.isAuthenticated()&&(t+="_"+this.currentUser.uid),t},e.prototype.fromWebStorageClientStateKey=function(e){var t=this.clientStateKeyRe.exec(e);return t?t[1]:null},e.prototype.fromWebStorageClientState=function(e,t){var n=this.fromWebStorageClientStateKey(e);return v(null!==n,"Cannot parse client state key '"+e+"'"),Fi.fromWebStorageEntry(n,t)},e.prototype.fromWebStorageMutationMetadata=function(e,t){var n=this.mutationBatchKeyRe.exec(e);v(null!==n,"Cannot parse mutation batch key '"+e+"'");var r=Number(n[1]),i=void 0!==n[2]?n[2]:null;return Mi.fromWebStorageEntry(new Ni(i),r,t)},e.prototype.fromWebStorageQueryTargetMetadata=function(e,t){var n=this.queryTargetKeyRe.exec(e);v(null!==n,"Cannot parse query target key '"+e+"'");var r=Number(n[1]);return Li.fromWebStorageEntry(r,t)},e.prototype.fromWebStorageOnlineState=function(e){return Ui.fromWebStorageEntry(e)},e.prototype.handleMutationBatchEvent=function(e){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(t){return e.user.uid!==this.currentUser.uid?(d(Ai,"Ignoring mutation for non-active user "+e.user.uid),[2]):[2,this.syncEngine.applyBatchState(e.batchId,e.state,e.error)]}))}))},e.prototype.handleQueryTargetEvent=function(e){return this.syncEngine.applyTargetState(e.targetId,e.state,e.error)},e.prototype.handleClientStateEvent=function(e,t){var n=this,r=this.getAllActiveQueryTargets();t?this.activeClients[e]=t:delete this.activeClients[e];var i=this.getAllActiveQueryTargets(),o=[],a=[];return i.forEach((function(e){return s.__awaiter(n,void 0,void 0,(function(){return s.__generator(this,(function(t){return r.has(e)||o.push(e),[2]}))}))})),r.forEach((function(e){return s.__awaiter(n,void 0,void 0,(function(){return s.__generator(this,(function(t){return i.has(e)||a.push(e),[2]}))}))})),this.syncEngine.applyActiveTargetsChange(o,a)},e.prototype.handleOnlineStateEvent=function(e){this.activeClients[e.clientId]&&this.onlineStateHandler(e.onlineState)},e}();var ji=function(){function e(){this.localState=new qi,this.queryState={},this.syncEngine=null,this.onlineStateHandler=null,this.sequenceNumberHandler=null}return e.prototype.addPendingMutation=function(e){},e.prototype.updateMutationState=function(e,t,n){},e.prototype.addLocalQueryTarget=function(e){return this.localState.addQueryTarget(e),this.queryState[e]||"not-current"},e.prototype.updateQueryState=function(e,t,n){this.queryState[e]=t},e.prototype.removeLocalQueryTarget=function(e){this.localState.removeQueryTarget(e)},e.prototype.isLocalQueryTarget=function(e){return this.localState.activeTargetIds.has(e)},e.prototype.clearQueryState=function(e){delete this.queryState[e]},e.prototype.getAllActiveQueryTargets=function(){return this.localState.activeTargetIds},e.prototype.isActiveQueryTarget=function(e){return this.localState.activeTargetIds.has(e)},e.prototype.start=function(){return this.localState=new qi,Promise.resolve()},e.prototype.handleUserChange=function(e,t,n){},e.prototype.setOnlineState=function(e){},e.prototype.shutdown=function(){},e.prototype.writeSequenceNumber=function(e){},e}(),Bi=function(){function e(e,t){this.cacheSizeBytes=e,this.synchronizeTabs=t}return e.prototype.lruParams=function(){return Rn.withCacheSize(this.cacheSizeBytes)},e}(),Wi=function(){return function(){}}(),Qi=function(){function e(e,t,n,r){this.platform=e,this.databaseInfo=t,this.credentials=n,this.asyncQueue=r,this.clientId=G.newId()}return e.prototype.start=function(e){var t=this;this.verifyNotTerminated();var n=new fe,r=new fe,i=!1;return this.credentials.setChangeListener((function(o){i?t.asyncQueue.enqueueAndForget((function(){return t.handleCredentialChange(o)})):(i=!0,t.initializePersistence(e,r,o).then((function(e){return t.initializeRest(o,e)})).then(n.resolve,n.reject))})),this.asyncQueue.enqueueAndForget((function(){return n.promise})),r.promise},e.prototype.enableNetwork=function(){var e=this;return this.verifyNotTerminated(),this.asyncQueue.enqueue((function(){return e.syncEngine.enableNetwork()}))},e.prototype.initializePersistence=function(e,t,n){var r=this;return e instanceof Bi?this.startIndexedDbPersistence(n,e).then((function(e){return t.resolve(),e})).catch((function(e){if(t.reject(e),!r.canFallback(e))throw e;return console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+e),r.startMemoryPersistence()})):(t.resolve(),this.startMemoryPersistence())},e.prototype.canFallback=function(e){return e instanceof E?e.code===w.FAILED_PRECONDITION||e.code===w.UNIMPLEMENT
1ED:!("undefined"!==typeof DOMException&&e instanceof DOMException)||(22===e.code||20===e.code||11===e.code)},e.prototype.verifyNotTerminated=function(){if(this.asyncQueue.isShuttingDown)throw new E(w.FAILED_PRECONDITION,"The client has already been terminated.")},e.prototype.startIndexedDbPersistence=function(e,t){var n=this,r=Vn.buildStoragePrefix(this.databaseInfo),i=new mi(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(t.synchronizeTabs&&!Vi.isAvailable(this.platform))throw new E(w.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");return o=t.lruParams(),t.synchronizeTabs?(this.sharedClientState=new Vi(this.asyncQueue,this.platform,r,this.clientId,e),[4,Vn.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 ji,[4,Vn.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]}}))}))}))},e.prototype.startMemoryPersistence=function(){return this.persistence=Zn.createEagerPersistence(this.clientId),this.sharedClientState=new ji,Promise.resolve(null)},e.prototype.initializeRest=function(e,t){var n=this;return d("FirestoreClient","Initializing. user=",e.uid),this.platform.loadConnection(this.databaseInfo).then((function(r){return s.__awaiter(n,void 0,void 0,(function(){var n,i,o,a,u,c=this;return s.__generator(this,(function(l){switch(l.label){case 0:return this.localStore=new Yn(this.persistence,e),t&&(this.lruScheduler
1=new On(t,this.asyncQueue,this.localStore)),n=this.platform.newConnectivityMonitor(),i=this.platform.newSerializer(this.databaseInfo.databaseId),o=new br(this.asyncQueue,r,this.credentials,i),a=function(e){return c.syncEngine.applyOnlineStateChange(e,mr.RemoteStore)},u=function(e){return c.syncEngine.applyOnlineStateChange(e,mr.SharedClientState)},this.remoteStore=new Br(this.localStore,o,this.asyncQueue,a,n),this.syncEngine=new ki(this.localStore,this.remoteStore,this.sharedClientState,e),this.sharedClientState.onlineStateHandler=u,this.remoteStore.syncEngine=this.syncEngine,this.sharedClientState.syncEngine=this.syncEngine,this.eventMgr=new gi(this.syncEngine),[4,this.sharedClientState.start()];case 1:return l.sent(),[4,this.remoteStore.start()];case 2:return l.sent(),[4,this.persistence.setPrimaryStateListener((function(e){return s.__awaiter(c,void 0,void 0,(function(){return s.__generator(this,(function(t){switch(t.label){case 0:return[4,this.syncEngine.applyPrimaryState(e)];case 1:return t.sent(),this.lruScheduler&&(e&&!this.lruScheduler.started?this.lruScheduler.start():e||this.lruScheduler.stop()),[2]}}))}))}))];case 3:return l.sent(),[4,this.persistence.setDatabaseDeletedListener((function(){return s.__awaiter(c,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return[4,this.terminate()];case 1:return e.sent(),[2]}}))}))}))];case 4:return l.sent(),[2]}}))}))}))},e.prototype.handleCredentialChange=function(e){return this.asyncQueue.verifyOperationInProgress(),d("FirestoreClient","Credential Changed. Current user: "+e.uid),this.syncEngine.handleCredentialChange(e)},e.prototype.disableNetwork=function(){var e=this;return this.verifyNotTerminated(),this.asyncQueue.enqueue((function(){return e.syncEngine.disableNetwork()}))},e.prototype.terminate=function(){var e=this;return this.asyncQueue.enqueueAndInitiateShutdown((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()];case 3:return e.sent(),this.credentials.removeChangeListener(),[2]}}))}))}))},e.prototype.waitForPendingWrites=function(){var e=this;this.verifyNotTerminated();var t=new fe;return this.asyncQueue.enqueueAndForget((function(){return e.syncEngine.registerPendingWritesCallback(t)})),t.promise},e.prototype.listen=function(e,t,n){var r=this;this.verifyNotTerminated();var i=new vi(e,t,n);return this.asyncQueue.enqueueAndForget((function(){return r.eventMgr.listen(i)})),i},e.prototype.unlisten=function(e){var t=this;this.clientTerminated||this.asyncQueue.enqueueAndForget((function(){return t.eventMgr.unlisten(e)}))},e.prototype.getDocumentFromLocalCache=function(e){var t=this;return this.verifyNotTerminated(),this.asyncQueue.enqueue((function(){return t.localStore.readDocument(e)})).then((function(e){if(e instanceof Wt)return e;if(e instanceof Qt)return null;throw new E(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.)")}))},e.prototype.getDocumentsFromLocalCache=function(e){var t=this;return this.verifyNotTerminated(),this.asyncQueue.enqueue((function(){return t.localStore.executeQuery(e)})).then((function(t){var n=qe(),r=new Ei(e,n),i=r.computeDocChanges(t);return r.applyChanges(i,!1).snapshot}))},e.prototype.write=function(e){var t=this;this.verifyNotTerminated();var n=new fe;return this.asyncQueue.enqueueAndForget((function(){return t.syncEngine.write(e,n)})),n.promise},e.prototype.databaseId=function(){return this.databaseInfo.databaseId},Object.defineProperty(e.prototype,"clientTerminated",{get:function(){return this.asyncQueue.isShuttingDown},enumerable:!0,configurable:!0}),e.prototype.transaction=function(e){var t=this;this.verifyNotTerminated();var n=new fe;return this.asyncQueue.enqueueAndForget((function(){return t.syncEngine.runTransaction(t.asyncQueue,e,n),Promise.resolve()})),n.promise},e}(),Ki=function(){function e(e){this.observer=e,this.muted=!1}return e.prototype.next=function(e){this.scheduleEvent(this.observer.next,e)},e.prototype.error=function(e){this.scheduleEvent(this.observer.error,e)},e.prototype.mute=function(){this.muted=!0}
1,e.prototype.scheduleEvent=function(e,t){var n=this;this.muted||setTimeout((function(){n.muted||e(t)}),0)},e}(),zi=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];!function(e,t,n,r){if(!(t instanceof Array)||t.length<r)throw new E(w.INVALID_ARGUMENT,"Function "+e+"() requires its "+n+" argument to be an array with at least "+H(r,"element")+".")}("FieldPath",e,"fieldNames",1);for(var n=0;n<e.length;++n)if(P("FieldPath","string",n,e[n]),0===e[n].length)throw new E(w.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new le(e)}return e.documentId=function(){return e._DOCUMENT_ID},e.prototype.isEqual=function(t){if(!(t instanceof e))throw K("isEqual","FieldPath",1,t);return this._internalPath.isEqual(t._internalPath)},e._DOCUMENT_ID=new e(le.keyField().canonicalString()),e}(),Hi=new RegExp("[~\\*/\\[\\]]");var Gi=function(){return function(e,t){this.user=t,this.type="OAuth",this.authHeaders={Authorization:"Bearer "+e}}}(),Yi=function(){function e(){this.changeListener=null}return e.prototype.getToken=function(){return Promise.resolve(null)},e.prototype.invalidateToken=function(){},e.prototype.setChangeListener=function(e){v(!this.changeListener,"Can only call setChangeListener() once."),this.changeListener=e,e(Ni.UNAUTHENTICATED)},e.prototype.removeChangeListener=function(){v(null!==this.changeListener,"removeChangeListener() when no listener registered"),this.changeListener=null},e}(),Xi=function(){function e(e){var t=this;this.app=e,this.tokenListener=null,this.currentUser=Ni.UNAUTHENTICATED,this.tokenCounter=0,this.changeListener=null,this.forceRefresh=!1,this.tokenListener=function(){t.tokenCounter++,t.currentUser=t.getUser(),t.changeListener&&t.changeListener(t.currentUser)},this.currentUser=this.getUser(),this.tokenCounter=0,this.app.INTERNAL.addAuthTokenListener(this.tokenListener)}return e.prototype.getToken=function(){var e=this;v(null!=this.tokenListener,"getToken cannot be called after listener removed.");var t=this.tokenCounter,n=this.forceRefresh;return this.forceRefresh=!1,this.app.INTERNAL.getToken(n).then((function(n){if(e.tokenCounter!==t)throw new E(w.ABORTED,"getToken aborted due to token change.");return n?(v("string"===typeof n.accessToken,"Invalid tokenData returned from getToken():"+n),new Gi(n.accessToken,e.currentUser)):null}))},e.prototype.invalidateToken=function(){this.forceRefresh=!0},e.prototype.setChangeListener=function(e){v(!this.changeListener,"Can only call setChangeListener() once."),this.changeListener=e,e(this.currentUser)},e.prototype.removeChangeListener=function(){v(null!=this.tokenListener,"removeChangeListener() called twice"),v(null!==this.changeListener,"removeChangeListener() called when no listener registered"),this.app.INTERNAL.removeAuthTokenListener(this.tokenListener),this.tokenListener=null,this.changeListener=null},e.prototype.getUser=function(){var e=this.app.INTERNAL.getUid();return v(null===e||"string"===typeof e,"Received invalid UID: "+e),new Ni(e)},e}(),Ji=function(){function e(e,t){this.gapi=e,this.sessionIndex=t,this.type="FirstParty",this.user=Ni.FIRST_PARTY}return Object.defineProperty(e.prototype,"authHeaders",{get:function(){var e={"X-Goog-AuthUser":this.sessionIndex},t=this.gapi.auth.getAuthHeaderValueForFirstParty([]);return t&&(e.Authorization=t),e},enumerable:!0,configurable:!0}),e}(),$i=function(){function e(e,t){this.gapi=e,this.sessionIndex=t}return e.prototype.getToken=function(){return Promise.resolve(new Ji(this.gapi,this.sessionIndex))},e.prototype.setChangeListener=function(e){e(Ni.FIRST_PARTY)},e.prototype.removeChangeListener=function(){},e.prototype.invalidateToken=function(){},e}();function Zi(e){if(!e)return new Yi;switch(e.type){case"gapi":var t=e.client;return v(!("object"!==typeof t||null===t||!t.auth||!t.auth.getAuthHeaderValueForFirstParty),"unexpected gapi interface"),new $i(t,e.sessionIndex||"0");case"provider":return e.client;default:throw new E(w.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}function eo(e){return function(e,t){if("object"!==typeof e||null===e)return!1;for(var n=e,r=0,i=t;r<i.length;r++){var o=i[r];if(o in n&&"function"===typeof n[o])return!0}return!1}(e,["next","error","complete"])}var to,no=function(){function e(e){this._methodName=e}return e.delete=function(){return A("FieldValue.delete",arguments),ro.instance},e.serverTimestamp=function(){return A("FieldValue.serverTimestamp",arguments),io.instance},e.arrayUnion=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];
1return R("FieldValue.arrayUnion",arguments,1),new oo(e)},e.arrayRemove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return R("FieldValue.arrayRemove",arguments,1),new ao(e)},e.increment=function(e){return P("FieldValue.increment","number",1,e),D("FieldValue.increment",arguments,1),new so(e)},e.prototype.isEqual=function(e){return this===e},e}(),ro=function(e){function t(){return e.call(this,"FieldValue.delete")||this}return s.__extends(t,e),t.instance=new t,t}(no),io=function(e){function t(){return e.call(this,"FieldValue.serverTimestamp")||this}return s.__extends(t,e),t.instance=new t,t}(no),oo=function(e){function t(t){var n=e.call(this,"FieldValue.arrayUnion")||this;return n._elements=t,n}return s.__extends(t,e),t}(no),ao=function(e){function t(t){var n=e.call(this,"FieldValue.arrayRemove")||this;return n._elements=t,n}return s.__extends(t,e),t}(no),so=function(e){function t(t){var n=e.call(this,"FieldValue.increment")||this;return n._operand=t,n}return s.__extends(t,e),t}(no),uo=T(no,"Use FieldValue.<field>() instead."),co=/^__.*__$/,lo=function(){function e(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}return e.prototype.toMutations=function(e,t){var n=[];return null!==this.fieldMask?n.push(new Tt(e,this.data,this.fieldMask,t)):n.push(new Et(e,this.data,t)),this.fieldTransforms.length>0&&n.push(new St(e,this.fieldTransforms)),n},e}(),ho=function(){function e(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}return e.prototype.toMutations=function(e,t){var n=[new Tt(e,this.data,this.fieldMask,t)];return this.fieldTransforms.length>0&&n.push(new St(e,this.fieldTransforms)),n},e}();function fo(e){switch(e){case to.Set:case to.MergeSet:case to.Update:return!0;case to.Argument:return!1;default:throw g("Unexpected case for UserDataSource: "+e)}}!function(e){e[e.Set=0]="Set",e[e.Update=1]="Update",e[e.MergeSet=2]="MergeSet",e[e.Argument=3]="Argument"}(to||(to={}));var po=function(){function e(e,t,n,r,i,o){this.dataSource=e,this.methodName=t,this.path=n,this.arrayElement=r,void 0===i&&this.validatePath(),this.arrayElement=void 0!==r&&r,this.fieldTransforms=i||[],this.fieldMask=o||[]}return e.prototype.childContextForField=function(t){var n=null==this.path?null:this.path.child(t),r=new e(this.dataSource,this.methodName,n,!1,this.fieldTransforms,this.fieldMask);return r.validatePathSegment(t),r},e.prototype.childContextForFieldPath=function(t){var n=null==this.path?null:this.path.child(t),r=new e(this.dataSource,this.methodName,n,!1,this.fieldTransforms,this.fieldMask);return r.validatePath(),r},e.prototype.childContextForArray=function(t){return new e(this.dataSource,this.methodName,null,!0,this.fieldTransforms,this.fieldMask)},e.prototype.createError=function(e){var t=null===this.path||this.path.isEmpty()?"":" (found in field "+this.path.toString()+")";return new E(w.INVALID_ARGUMENT,"Function "+this.methodName+"() called with invalid data. "+e+t)},e.prototype.contains=function(e){return void 0!==this.fieldMask.find((function(t){return e.isPrefixOf(t)}))||void 0!==this.fieldTransforms.find((function(t){return e.isPrefixOf(t.field)}))},e.prototype.validatePath=function(){if(null!==this.path)for(var e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))},e.prototype.validatePathSegment=function(e){if(fo(this.dataSource)&&co.test(e))throw this.createError("Document fields cannot begin and end with __")},e}(),mo=function(){return function(e,t){this.databaseId=e,this.key=t}}(),yo=function(){function e(e){this.preConverter=e}return e.prototype.parseSetData=function(e,t){var n=new po(to.Set,e,le.EMPTY_PATH);vo("Data must be an object, but it was:",n,t);var r=this.parseData(t,n);return new lo(r,null,n.fieldTransforms)},e.prototype.parseMergeData=function(e,t,n){var r=new po(to.MergeSet,e,le.EMPTY_PATH);vo("Data must be an object, but it was:",r,t);var i,o,a=this.parseData(t,r);if(n){for(var s=new Ae(le.comparator),u=0,c=n;u<c.length;u++){var l=c[u],h=void 0;if(l instanceof zi)h=l._internalPath;else{if("string"!==typeof l)throw g("Expected stringOrFieldPath to be a string or a FieldPath");h=_o(e,l)}if(!r.contains(h))throw new E(w.INVALID_ARGUMENT,"Field '"+h+"' is specified in your field mask but missing from your input data.");s=s.add(h)}i=mt.fromSet(s),o=r.fieldTransforms.filter((function(e){return i.covers(e.field)}))}else i=mt.fromArray(r.fieldMask),o=r.fieldTransforms;return new lo(a,i,o)}
1,e.prototype.parseUpdateData=function(e,t){var n=this,r=new po(to.Update,e,le.EMPTY_PATH);vo("Data must be an object, but it was:",r,t);var i=new Ae(le.comparator),o=Vt.EMPTY;k(t,(function(t,a){var s=_o(e,t),u=r.childContextForFieldPath(s);if((a=n.runPreConverter(a,u))instanceof ro)i=i.add(s);else{var c=n.parseData(a,u);null!=c&&(i=i.add(s),o=o.set(s,c))}}));var a=mt.fromSet(i);return new ho(o,a,r.fieldTransforms)},e.prototype.parseUpdateVarargs=function(e,t,n,r){var i=new po(to.Update,e,le.EMPTY_PATH),o=[bo(e,t)],a=[n];if(r.length%2!==0)throw new E(w.INVALID_ARGUMENT,"Function "+e+"() 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(bo(e,r[s])),a.push(r[s+1]);var u=new Ae(le.comparator),c=Vt.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 ro)u=u.add(l);else{var p=this.parseData(f,h);null!=p&&(u=u.add(l),c=c.set(l,p))}}var d=mt.fromSet(u);return new ho(c,d,i.fieldTransforms)},e.prototype.parseQueryValue=function(e,t){var n=new po(to.Argument,e,le.EMPTY_PATH),r=this.parseData(t,n);return v(null!=r,"Parsed data should not be null."),v(0===n.fieldTransforms.length,"Field transforms should have been disallowed."),r},e.prototype.runPreConverter=function(e,t){try{return this.preConverter(e)}catch(r){var n=wo(r);throw t.createError(n)}},e.prototype.parseData=function(e,t){if(go(e=this.runPreConverter(e,t)))return vo("Unsupported field value:",t,e),this.parseObject(e,t);if(e instanceof no)return this.parseSentinelFieldValue(e,t),null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.arrayElement)throw t.createError("Nested arrays are not supported");return this.parseArray(e,t)}return this.parseScalarValue(e,t)},e.prototype.parseObject=function(e,t){var n=this,r=new Ce(Y);return N(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):k(e,(function(e,i){var o=n.parseData(i,t.childContextForField(e));null!=o&&(r=r.insert(e,o))})),new Vt(r)},e.prototype.parseArray=function(e,t){for(var n=[],r=0,i=0,o=e;i<o.length;i++){var a=o[i],s=this.parseData(a,t.childContextForArray(r));null==s&&(s=Nt.INSTANCE),n.push(s),r++}return new jt(n)},e.prototype.parseSentinelFieldValue=function(e,t){if(!fo(t.dataSource))throw t.createError(e._methodName+"() can only be used with update() and set()");if(null===t.path)throw t.createError(e._methodName+"() is not currently supported inside arrays");if(e instanceof ro){if(t.dataSource!==to.MergeSet)throw t.dataSource===to.Update?(v(t.path.length>0,"FieldValue.delete() at the top level should have already been handled."),t.createError("FieldValue.delete() can only appear at the top level of your update data")):t.createError("FieldValue.delete() cannot be used with set() unless you pass {merge:true}");t.fieldMask.push(t.path)}else if(e instanceof io)t.fieldTransforms.push(new yt(t.path,ii.instance));else if(e instanceof oo){var n=this.parseArrayTransformElements(e._methodName,e._elements),r=new oi(n);t.fieldTransforms.push(new yt(t.path,r))}else if(e instanceof ao){n=this.parseArrayTransformElements(e._methodName,e._elements);var i=new ai(n);t.fieldTransforms.push(new yt(t.path,i))}else if(e instanceof so){var o=this.parseQueryValue("FieldValue.increment",e._operand),a=new si(o);t.fieldTransforms.push(new yt(t.path,a))}else g("Unknown FieldValue type: "+e)},e.prototype.parseScalarValue=function(e,t){if(null===e)return Nt.INSTANCE;if("number"===typeof e)return ur(e)?new Ot(e):new Pt(e);if("boolean"===typeof e)return At.of(e);if("string"===typeof e)return new xt(e);if(e instanceof Date)return new Mt(Te.fromDate(e));if(e instanceof Te)return new Mt(new Te(e.seconds,1e3*Math.floor(e.nanoseconds/1e3)));if(e instanceof Wr)return new qt(e);if(e instanceof te)return new Ft(e);if(e instanceof mo)return new Ut(e.databaseId,e.key);throw t.createError("Unsupported field value: "+B(e))},e.prototype.parseArrayTransformElements=function(e,t){var n=this;return t.map((function(t,r){var i=new po(to.Argument,e,le.EMPTY_PATH);return n.parseData(t,i.childContextForArray(r))}))},e}();function go(e){return"object"===typeof e&&null!==e&&!(e instanceof Array)&&!(e instanceof Date)&&!(e instanceof Te)&&!(e instanceof Wr)&&!(e instanceof te)&&!(e instanceof mo)&&!(e instanceof no)}function vo(e,t,n){if(!go(n)||!j(n)){var r=B(n);throw"an object"===r?t.createError(e+" a custom object"):t.createError(e+" "+r)}}function bo(e,t){if(t instanceof zi)return t._internalPath;if("string"===typeof t)return _o(e,t);throw new E(w.INVALID_ARGUMENT,"Function "+e+"() called with invali
1d data. Field path arguments must be of type string or FieldPath.")}function _o(e,t){try{return function(e){if(e.search(Hi)>=0)throw new E(w.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(zi.bind.apply(zi,[void 0].concat(e.split("."))))}catch(t){throw new E(w.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(t)._internalPath}catch(r){var n=wo(r);throw new E(w.INVALID_ARGUMENT,"Function "+e+"() called with invalid data. "+n)}}function wo(e){return e instanceof Error?e.message:e.toString()}var Eo="firestore.googleapis.com",To=!0,So=!0,Co=!1,Io=Rn.COLLECTION_DISABLED,ko=function(){function e(e){if(void 0===e.host){if(void 0!==e.ssl)throw new E(w.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Eo,this.ssl=To}else M("settings","non-empty string","host",e.host),this.host=e.host,L("settings","boolean","ssl",e.ssl),this.ssl=C(e.ssl,To);if(Q("settings",e,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling"]),L("settings","object","credentials",e.credentials),this.credentials=e.credentials,L("settings","boolean","timestampsInSnapshots",e.timestampsInSnapshots),!0===e.timestampsInSnapshots?m("\n  The timestampsInSnapshots setting now defaults to true and you no\n  longer need to explicitly set it. In a future release, the setting\n  will be removed entirely and so it is recommended that you remove it\n  from your firestore.settings() call now."):!1===e.timestampsInSnapshots&&m("\n  The timestampsInSnapshots setting will soon be removed. YOU MUST UPDATE\n  YOUR CODE.\n\n  To hide this warning, stop using the timestampsInSnapshots setting in your\n  firestore.settings({ ... }) call.\n\n  Once you remove the setting, Timestamps stored in Cloud Firestore will be\n  read back as Firebase Timestamp objects instead of as system Date objects.\n  So you will also need to update code expecting a Date to instead expect a\n  Timestamp. For example:\n\n  // Old:\n  const date = snapshot.get('created_at');\n  // New:\n  const timestamp = snapshot.get('created_at'); const date =\n  timestamp.toDate();\n\n  Please audit all existing usages of Date when you enable the new\n  behavior."),this.timestampsInSnapshots=C(e.timestampsInSnapshots,So),L("settings","number","cacheSizeBytes",e.cacheSizeBytes),void 0===e.cacheSizeBytes)this.cacheSizeBytes=Rn.DEFAULT_CACHE_SIZE_BYTES;else{if(e.cacheSizeBytes!==Io&&e.cacheSizeBytes<Rn.MINIMUM_CACHE_SIZE_BYTES)throw new E(w.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+Rn.MINIMUM_CACHE_SIZE_BYTES);this.cacheSizeBytes=e.cacheSizeBytes}L("settings","boolean","experimentalForceLongPolling",e.experimentalForceLongPolling),this.forceLongPolling=void 0===e.experimentalForceLongPolling?Co:e.experimentalForceLongPolling}return e.prototype.isEqual=function(e){return this.host===e.host&&this.ssl===e.ssl&&this.timestampsInSnapshots===e.timestampsInSnapshots&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.forceLongPolling===e.forceLongPolling},e}(),No=function(){function e(t){var n=this;if(this._firebaseApp=null,this._queue=new de,this.INTERNAL={delete:function(){return s.__awaiter(n,void 0,void 0,(function(){return s.__generator(this,(function(e){switch(e.label){case 0:return this.ensureClientConfigured(),[4,this._firestoreClient.terminate()];case 1:return e.sent(),[2]}}))}))}},"object"===typeof t.options){var r=t;this._firebaseApp=r,this._databaseId=e.databaseIdFromApp(r),this._persistenceKey=r.name,this._credentials=new Xi(r)}else{var i=t;if(!i.projectId)throw new E(w.INVALID_ARGUMENT,"Must provide projectId");this._databaseId=new oe(i.projectId,i.database),this._persistenceKey="[DEFAULT]",this._credentials=new Yi}this._settings=new ko({}),this._dataConverter=this.createDataConverter(this._databaseId)}return e.prototype.settings=function(e){if(D("Firestore.settings",arguments,1),P("Firestore.settings","object",1,e),S(e,"persistence"))throw new E(w.INVALID_ARGUMENT,'"persistence" is now specified with a separate call to firestore.enablePersistence().');var t=new ko(e);if(this._firestoreClient&&!this._settings.isEqual(t))throw new E(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._settings=t,void 0!==t.credentials&&(this._credentials=Zi(t.credentials))},e.prototype.enableNetwork=function(){return this.ensureClientConfigured(),this._firestoreClient.enableNetwork()},e.prototype.disableNetwork=function(){return this.ensureClientConfigured(),this._firestoreClient.disableNetwork()},e.prototype.enablePersistence=function(e){if(this._firestoreClient)throw new E(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.");var t=!1;return e&&(void 0!==e.experimentalTabSynchronization&&m("The 'experimentalTabSynchronization' setting has been renamed to 'synchronizeTabs'. In a future release, the setting will be removed and it is recommended that you update your firestore.enablePersistence() call to use 'synchronizeTabs'."),t=C(void 0!==e.synchronizeTabs?e.synchronizeTabs:e.experimentalTabSynchronization,!1)),this.configureClient(new Bi(this._settings.cacheSizeBytes,t))},e.prototype.clearPersistence=function(){var e=this,t=Vn.buildStoragePrefix(this.makeDatabaseInfo()),n=new fe;return this._queue.enqueueAndForgetEvenAfterShutdown((function(){return s.__awaiter(e,void 0,void 0,(function(){var e;return s.__generator(this,(function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),void 0!==this._firestoreClient&&!this._firestoreClient.clientTerminated)throw new E(w.FAILED_PRECONDITION,"Persistence cannot be cleared after this Firestore instance is initialized.");return[4,Vn.clearPersistence(t)];case 1:return r.sent(),n.resolve(),[3,3];case 2:return e=r.sent(),n.reject(e),[3,3];case 3:return[2]}}
1))}))})),n.promise},e.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(e.prototype,"_isTerminated",{get:function(){return this.ensureClientConfigured(),this._firestoreClient.clientTerminated},enumerable:!0,configurable:!0}),e.prototype.waitForPendingWrites=function(){return this.ensureClientConfigured(),this._firestoreClient.waitForPendingWrites()},e.prototype.ensureClientConfigured=function(){return this._firestoreClient||this.configureClient(new Wi),this._firestoreClient},e.prototype.makeDatabaseInfo=function(){return new re(this._databaseId,this._persistenceKey,this._settings.host,this._settings.ssl,this._settings.forceLongPolling)},e.prototype.configureClient=function(e){v(!!this._settings.host,"FirestoreSettings.host is not set"),v(!this._firestoreClient,"configureClient() called multiple times");var t=this.makeDatabaseInfo();return this._firestoreClient=new Qi(b.getPlatform(),t,this._credentials,this._queue),this._firestoreClient.start(e)},e.prototype.createDataConverter=function(e){return new yo((function(t){if(t instanceof Ro){var n=e,r=t.firestore._databaseId;if(!r.isEqual(n))throw new E(w.INVALID_ARGUMENT,"Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return new mo(e,t._key)}return t}))},e.databaseIdFromApp=function(e){var t=e.options;if(!S(t,"projectId"))throw new E(w.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var n=t.projectId;if(!n||"string"!==typeof n)throw new E(w.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new oe(n)},Object.defineProperty(e.prototype,"app",{get:function(){if(!this._firebaseApp)throw new E(w.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._firebaseApp},enumerable:!0,configurable:!0}),e.prototype.collection=function(e){return D("Firestore.collection",arguments,1),P("Firestore.collection","non-empty string",1,e),this.ensureClientConfigured(),new Fo(ue.fromString(e),this)},e.prototype.doc=function(e){return D("Firestore.doc",arguments,1),P("Firestore.doc","non-empty string",1,e),this.ensureClientConfigured(),Ro.forPath(ue.fromString(e),this)},e.prototype.collectionGroup=function(e){if(D("Firestore.collectionGroup",arguments,1),P("Firestore.collectionGroup","non-empty string",1,e),e.indexOf("/")>=0)throw new E(w.INVALID_ARGUMENT,"Invalid collection ID '"+e+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.ensureClientConfigured(),new Mo(new Qr(ue.EMPTY_PATH,e),this)},e.prototype.runTransaction=function(e){var t=this;return D("Firestore.runTransaction",arguments,1),P("Firestore.runTransaction","function",1,e),this.ensureClientConfigured().transaction((function(n){return e(new Ao(t,n))}))},e.prototype.batch=function(){return this.ensureClientConfigured(),new Do(this)},Object.defineProperty(e,"logLevel",{get:function(){switch(f()){case i.DEBUG:return"debug";case i.ERROR:return"error";case i.SILENT:return"silent";default:return g("Unknown log level: "+f())}},enumerable:!0,configurable:!0}),e.setLogLevel=function(e){switch(D("Firestore.setLogLevel",arguments,1),P("Firestore.setLogLevel","non-empty string",1,e),e){case"debug":p(i.DEBUG);break;case"error":p(i.ERROR);break;case"silent":p(i.SILENT);break;default:throw new E(w.INVALID_ARGUMENT,"Invalid log level: "+e)}},e.prototype._areTimestampsInSnapshotsEnabled=function(){return this._settings.timestampsInSnapshots},e}(),Ao=function(){function e(e,t){this._firestore=e,this._transaction=t}return e.prototype.get=function(e){var t=this;D("Transaction.get",arguments,1);var n=jo("Transaction.get",e,this._firestore);return this._transaction.lookup([n._key]).then((function(e){if(!e||1!==e.length)return g("Mismatch in docs returned from document lookup.");var r=e[0];if(r instanceof Qt)return new Po(t._firestore,n._key,null,!1,!1);if(r instanceof Wt)return new Po(t._firestore,n._key,r,!1,!1);throw g("BatchGetDocumentsRequest returned unexpected document type: "+r.constructor.name)}))},e.prototype.set=function(e,t,n){O("Transaction.set",arguments,2,3);var r=jo("Transaction.set",e,this._firestore),i=(n=Uo("Transaction.set",n)).merge||n.mergeFields?this._firestore._dataConverter.parseMergeData("Transaction.set",t,n.mergeFields):this._firestore._dataConverter.parseSetData("Transaction.set",t);return this._transaction.set(r._key,i),this},e.prototype.update=function(e,t,n){for(var r,i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return"string"===typeof t||t instanceof zi?(R("Transaction.update",arguments,3),r=jo("Transaction.update",e,this._firestore),i=this._firestore._dataConverter.parseUpd
1ateVarargs("Transaction.update",t,n,o)):(D("Transaction.update",arguments,2),r=jo("Transaction.update",e,this._firestore),i=this._firestore._dataConverter.parseUpdateData("Transaction.update",t)),this._transaction.update(r._key,i),this},e.prototype.delete=function(e){D("Transaction.delete",arguments,1);var t=jo("Transaction.delete",e,this._firestore);return this._transaction.delete(t._key),this},e}(),Do=function(){function e(e){this._firestore=e,this._mutations=[],this._committed=!1}return e.prototype.set=function(e,t,n){O("WriteBatch.set",arguments,2,3),this.verifyNotCommitted();var r=jo("WriteBatch.set",e,this._firestore),i=(n=Uo("WriteBatch.set",n)).merge||n.mergeFields?this._firestore._dataConverter.parseMergeData("WriteBatch.set",t,n.mergeFields):this._firestore._dataConverter.parseSetData("WriteBatch.set",t);return this._mutations=this._mutations.concat(i.toMutations(r._key,_t.NONE)),this},e.prototype.update=function(e,t,n){for(var r,i,o=[],a=3;a<arguments.length;a++)o[a-3]=arguments[a];return this.verifyNotCommitted(),"string"===typeof t||t instanceof zi?(R("WriteBatch.update",arguments,3),r=jo("WriteBatch.update",e,this._firestore),i=this._firestore._dataConverter.parseUpdateVarargs("WriteBatch.update",t,n,o)):(D("WriteBatch.update",arguments,2),r=jo("WriteBatch.update",e,this._firestore),i=this._firestore._dataConverter.parseUpdateData("WriteBatch.update",t)),this._mutations=this._mutations.concat(i.toMutations(r._key,_t.exists(!0))),this},e.prototype.delete=function(e){D("WriteBatch.delete",arguments,1),this.verifyNotCommitted();var t=jo("WriteBatch.delete",e,this._firestore);return this._mutations=this._mutations.concat(new Ct(t._key,_t.NONE)),this},e.prototype.commit=function(){return s.__awaiter(this,void 0,void 0,(function(){return s.__generator(this,(function(e){return this.verifyNotCommitted(),this._committed=!0,this._mutations.length>0?[2,this._firestore.ensureClientConfigured().write(this._mutations)]:[2]}))}))},e.prototype.verifyNotCommitted=function(){if(this._committed)throw new E(w.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},e}(),Ro=function(){function e(e,t){this._key=e,this.firestore=t,this._firestoreClient=this.firestore.ensureClientConfigured()}return e.forPath=function(t,n){if(t.length%2!==0)throw new E(w.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.canonicalString()+" has "+t.length);return new e(new he(t),n)},Object.defineProperty(e.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return new Fo(this._key.path.popLast(),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._key.path.canonicalString()},enumerable:!0,configurable:!0}),e.prototype.collection=function(e){if(D("DocumentReference.collection",arguments,1),P("DocumentReference.collection","non-empty string",1,e),!e)throw new E(w.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var t=ue.fromString(e);return new Fo(this._key.path.child(t),this.firestore)},e.prototype.isEqual=function(t){if(!(t instanceof e))throw K("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this._key.isEqual(t._key)},e.prototype.set=function(e,t){O("DocumentReference.set",arguments,1,2);var n=(t=Uo("DocumentReference.set",t)).merge||t.mergeFields?this.firestore._dataConverter.parseMergeData("DocumentReference.set",e,t.mergeFields):this.firestore._dataConverter.parseSetData("DocumentReference.set",e);return this._firestoreClient.write(n.toMutations(this._key,_t.NONE))},e.prototype.update=function(e,t){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return"string"===typeof e||e instanceof zi?(R("DocumentReference.update",arguments,2),n=this.firestore._dataConverter.parseUpdateVarargs("DocumentReference.update",e,t,r)):(D("DocumentReference.update",arguments,1),n=this.firestore._dataConverter.parseUpdateData("DocumentReference.update",e)),this._firestoreClient.write(n.toMutations(this._key,_t.exists(!0)))},e.prototype.delete=function(){return D("DocumentReference.delete",arguments,0),this._firestoreClient.write([new Ct(this._key,_t.NONE)])},e.prototype.onSnapshot=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];O("DocumentReference.onSnapshot",arguments,1,4);var n,r={includeMetadataChanges:!1},i=0;"object"!==typeof e[i]||eo(e[i])||(Q("DocumentReference.onSnapshot",r=e[i],["includeMetadataChanges"]),L("DocumentReference.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++);var o={includeMetadataChanges:r.includeMetadataChanges};return eo(e[i])?n=e[i]:(P("DocumentReference.onSnapshot","function",i,e[i]),x("DocumentReference.onSnapshot","function",i+1,e[i+1]),x("DocumentReference.onSnapshot","function",i+2,e[i+2]),n={next:e[i],error:e[i+1],complete:e[i+2]}),this.onSnapshotInternal(o,n)},e.prototype.onSnapshotInternal=function(e,t){var n=this,r=function(e){console.error("Uncaught Error in onSnapshot:",e)};t.error&&(r=t.error.bind(t));var i=new Ki({next:function(e){if(t.next){v(e.docs.size<=1,"Too many documents returned on a document query");var r=e.docs.get(n._key);
1t.next(new Po(n.firestore,n._key,r,e.fromCache,e.hasPendingWrites))}},error:r}),o=this._firestoreClient.listen(Qr.atPath(this._key.path),i,e);return function(){i.mute(),n._firestoreClient.unlisten(o)}},e.prototype.get=function(e){var t=this;return O("DocumentReference.get",arguments,0,1),Vo("DocumentReference.get",e),new Promise((function(n,r){e&&"cache"===e.source?t.firestore.ensureClientConfigured().getDocumentFromLocalCache(t._key).then((function(e){n(new Po(t.firestore,t._key,e,!0,e instanceof Wt&&e.hasLocalMutations))}),r):t.getViaSnapshotListener(n,r,e)}))},e.prototype.getViaSnapshotListener=function(e,t,n){var r=this.onSnapshotInternal({includeMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(i){r(),!i.exists&&i.metadata.fromCache?t(new E(w.UNAVAILABLE,"Failed to get document because the client is offline.")):i.exists&&i.metadata.fromCache&&n&&"server"===n.source?t(new E(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.)')):e(i)},error:t})},e}(),Oo=function(){function e(e,t){this.hasPendingWrites=e,this.fromCache=t}return e.prototype.isEqual=function(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache},e}(),Po=function(){function e(e,t,n,r,i){this._firestore=e,this._key=t,this._document=n,this._fromCache=r,this._hasPendingWrites=i}return e.prototype.data=function(e){return O("DocumentSnapshot.data",arguments,0,1),e=qo("DocumentSnapshot.data",e),this._document?this.convertObject(this._document.data(),It.fromSnapshotOptions(e,this._firestore._areTimestampsInSnapshotsEnabled())):void 0},e.prototype.get=function(e,t){if(O("DocumentSnapshot.get",arguments,1,2),t=qo("DocumentSnapshot.get",t),this._document){var n=this._document.data().field(bo("DocumentSnapshot.get",e));if(null!==n)return this.convertValue(n,It.fromSnapshotOptions(t,this._firestore._areTimestampsInSnapshotsEnabled()))}},Object.defineProperty(e.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ref",{get:function(){return new Ro(this._key,this._firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exists",{get:function(){return null!==this._document},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"metadata",{get:function(){return new Oo(this._hasPendingWrites,this._fromCache)},enumerable:!0,configurable:!0}),e.prototype.isEqual=function(t){if(!(t instanceof e))throw K("isEqual","DocumentSnapshot",1,t);return this._firestore===t._firestore&&this._fromCache===t._fromCache&&this._key.isEqual(t._key)&&(null===this._document?null===t._document:this._document.isEqual(t._document))},e.prototype.convertObject=function(e,t){var n=this,r={};return e.forEach((function(e,i){r[e]=n.convertValue(i,t)})),r},e.prototype.convertValue=function(e,t){if(e instanceof Vt)return this.convertObject(e,t);if(e instanceof jt)return this.convertArray(e,t);if(e instanceof Ut){var n=e.value(t),r=this._firestore.ensureClientConfigured().databaseId();return e.databaseId.isEqual(r)||m("Document "+this._key.path+" contains a document reference within a different database ("+e.databaseId.projectId+"/"+e.databaseId.database+") which is not supported. It will be treated as a reference in the current database ("+r.projectId+"/"+r.database+") instead."),new Ro(n,this._firestore)}return e.value(t)},e.prototype.convertArray=function(e,t){var n=this;return e.internalValue.map((function(e){return n.convertValue(e,t)}))},e}(),xo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s.__extends(t,e),t.prototype.data=function(t){var n=e.prototype.data.call(this,t);return v("object"===typeof n,"Document in a QueryDocumentSnapshot should exist"),n},t}(Po),Mo=function(){function e(e,t){this._query=e,this.firestore=t}return e.prototype.where=function(t,n,r){if(D("Query.where",arguments,3),W("Query.where",3,r),"in"!==n&&"array-contains-any"!==n){var i=["<","<=","==",">=",">","array-contains"];q("Query.where",i,2,n)}var o,a=bo("Query.where",t),s=zr.fromString(n);
1if(a.isKeyField()){if(s===zr.ARRAY_CONTAINS||s===zr.ARRAY_CONTAINS_ANY)throw new E(w.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+s.toString()+"' queries on FieldPath.documentId().");if(s===zr.IN){this.validateDisjunctiveFilterElements(r,s);for(var u=[],c=0,l=r;c<l.length;c++){var h=l[c];u.push(this.parseDocumentIdValue(h))}o=new jt(u)}else o=this.parseDocumentIdValue(r)}else s!==zr.IN&&s!==zr.ARRAY_CONTAINS_ANY||this.validateDisjunctiveFilterElements(r,s),o=this.firestore._dataConverter.parseQueryValue("Query.where",r);var f=Hr.create(a,s,o);return this.validateNewFilter(f),new e(this._query.addFilter(f),this.firestore)},e.prototype.orderBy=function(t,n){var r;if(O("Query.orderBy",arguments,1,2),x("Query.orderBy","non-empty string",2,n),void 0===n||"asc"===n)r=Zr.ASCENDING;else{if("desc"!==n)throw new E(w.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+n+"', expected 'asc' or 'desc'.");r=Zr.DESCENDING}if(null!==this._query.startAt)throw new E(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 E(w.INVALID_ARGUMENT,"Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");var i=bo("Query.orderBy",t),o=new ti(i,r);return this.validateNewOrderBy(o),new e(this._query.addOrderBy(o),this.firestore)},e.prototype.limit=function(t){if(D("Query.limit",arguments,1),P("Query.limit","number",1,t),t<=0)throw new E(w.INVALID_ARGUMENT,"Invalid Query. Query limit ("+t+") is invalid. Limit must be positive.");return new e(this._query.withLimit(t),this.firestore)},e.prototype.startAt=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];R("Query.startAt",arguments,1);var i=this.boundFromDocOrFields("Query.startAt",t,n,!0);return new e(this._query.withStartAt(i),this.firestore)},e.prototype.startAfter=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];R("Query.startAfter",arguments,1);var i=this.boundFromDocOrFields("Query.startAfter",t,n,!1);return new e(this._query.withStartAt(i),this.firestore)},e.prototype.endBefore=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];R("Query.endBefore",arguments,1);var i=this.boundFromDocOrFields("Query.endBefore",t,n,!0);return new e(this._query.withEndAt(i),this.firestore)},e.prototype.endAt=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];R("Query.endAt",arguments,1);var i=this.boundFromDocOrFields("Query.endAt",t,n,!1);return new e(this._query.withEndAt(i),this.firestore)},e.prototype.isEqual=function(t){if(!(t instanceof e))throw K("isEqual","Query",1,t);return this.firestore===t.firestore&&this._query.isEqual(t._query)},e.prototype.boundFromDocOrFields=function(e,t,n,r){if(W(e,1,t),t instanceof Po){if(n.length>0)throw new E(w.INVALID_ARGUMENT,"Too many arguments provided to "+e+"().");var i=t;if(!i.exists)throw new E(w.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+e+"().");return this.boundFromDocument(e,i._document,r)}var o=[t].concat(n);return this.boundFromFields(e,o,r)},e.prototype.boundFromDocument=function(e,t,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 Ut(this.firestore._databaseId,t.key));else{var s=t.field(a.field);if(s instanceof Lt)throw new E(w.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+a.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===s){var u=a.field.canonicalString();throw new E(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 ei(r,n)},e.prototype.boundFromFields=function(e,t,n){var r=this._query.explicitOrderBy;if(t.length>r.length)throw new E(w.INVALID_ARGUMENT,"Too many arguments provided to "+e+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var i=[],o=0;o<t.length;o++){var a=t[o];
1if(r[o].field.isKeyField()){if("string"!==typeof a)throw new E(w.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+e+"(), but got a "+typeof a);if(!this._query.isCollectionGroupQuery()&&-1!==a.indexOf("/"))throw new E(w.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+e+"() must be a plain document ID, but '"+a+"' contains a slash.");var s=this._query.path.child(ue.fromString(a));if(!he.isDocumentKey(s))throw new E(w.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+e+"() must result in a valid document path, but '"+s+"' is not because it contains an odd number of segments.");var u=new he(s);i.push(new Ut(this.firestore._databaseId,u))}else{var c=this.firestore._dataConverter.parseQueryValue(e,a);i.push(c)}}return new ei(i,n)},e.prototype.onSnapshot=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];O("Query.onSnapshot",arguments,1,4);var n,r={},i=0;return"object"!==typeof e[i]||eo(e[i])||(Q("Query.onSnapshot",r=e[i],["includeMetadataChanges"]),L("Query.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++),eo(e[i])?n=e[i]:(P("Query.onSnapshot","function",i,e[i]),x("Query.onSnapshot","function",i+1,e[i+1]),x("Query.onSnapshot","function",i+2,e[i+2]),n={next:e[i],error:e[i+1],complete:e[i+2]}),this.onSnapshotInternal(r,n)},e.prototype.onSnapshotInternal=function(e,t){var n=this,r=function(e){console.error("Uncaught Error in onSnapshot:",e)};t.error&&(r=t.error.bind(t));var i=new Ki({next:function(e){t.next&&t.next(new Lo(n.firestore,n._query,e))},error:r}),o=this.firestore.ensureClientConfigured(),a=o.listen(this._query,i,e);return function(){i.mute(),o.unlisten(a)}},e.prototype.get=function(e){var t=this;return O("Query.get",arguments,0,1),Vo("Query.get",e),new Promise((function(n,r){e&&"cache"===e.source?t.firestore.ensureClientConfigured().getDocumentsFromLocalCache(t._query).then((function(e){n(new Lo(t.firestore,t._query,e))}),r):t.getViaSnapshotListener(n,r,e)}))},e.prototype.getViaSnapshotListener=function(e,t,n){var r=this.onSnapshotInternal({includeMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(i){r(),i.metadata.fromCache&&n&&"server"===n.source?t(new E(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.)')):e(i)},error:t})},e.prototype.parseDocumentIdValue=function(e){if("string"===typeof e){if(""===e)throw new E(w.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!this._query.isCollectionGroupQuery()&&-1!==e.indexOf("/"))throw new E(w.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+e+"' contains a '/' character.");var t=this._query.path.child(ue.fromString(e));if(!he.isDocumentKey(t))throw new E(w.INVALID_ARGUMENT,"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '"+t+"' is not because it has an odd number of segments ("+t.length+").");return new Ut(this.firestore._databaseId,new he(t))}if(e instanceof Ro){var n=e;return new Ut(this.firestore._databaseId,n._key)}throw new E(w.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+B(e)+".")},e.prototype.validateDisjunctiveFilterElements=function(e,t){if(!Array.isArray(e)||0===e.length)throw new E(w.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+t.toString()+"' filters.");if(e.length>10)throw new E(w.INVALID_ARGUMENT,"Invalid Query. '"+t.toString()+"' filters support a maximum of 10 elements in the value array.");if(e.indexOf(null)>=0)throw new E(w.INVALID_ARGUMENT,"Invalid Query. '"+t.toString()+"' filters cannot contain 'null' in the value array.");if(e.filter((function(e){return Number.isNaN(e)})).length>0)throw new E(w.INVALID_ARGUMENT,"Invalid Query. '"+t.toString()+"' filters cannot contain 'NaN' in the value array.")},e.prototype.validateNewFilter=function(e){if(e instanceof Hr){var t=[zr.ARRAY_CONTAINS,zr.ARRAY_CONTAINS_ANY],n=[zr.IN,zr.ARRAY_CONTAINS_ANY],r=t.indexOf(e.op)>=0,i=n.indexOf(e.op)>=0;if(e.isInequality()){var o=this._query.getInequalityFilterField();if(null!==o&&!o.isEqual(e.field))throw new E(w.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+o.toString()+"' and '"+e.field.toString()+"'");var a=this._query.getFirstOrderByField();null!==a&&this.validateOrderByAndInequalityMatch(e.field,a)}else if(i||r){var s=null;if(i&&(s=this._query.findFilterOperator(n)),null===s&&r&&(s=this._query.findFilterOperator(t)),null!=s)throw s===e.op?new E(w.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new E(w.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+s.toString()+"' filters.")}}},e.prototype.validateNewOrderBy=function(e){if(null===this._query.getFirstOrderByField()){var t=this._query.getInequalityFilterField();null!==t&&this.validateOrderByAndInequalityMatch(t,e.field)}},e.prototype.validateOrderByAndInequalityMatch=function(e,t){if(!t.isEqual(e))throw new E(w.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+t.toString()+"' instead.")},e}(),Lo=function(){function e(e,t,n){this._firestore=e,this._originalQuery=t,this._snapshot=n,this._cachedChanges=null,this._cachedChangesIncludeMetadataChanges=null,this.metadata=new Oo(n.hasPendingWrites,n.fromCache)}return Object.defineProperty(e.prototype,"docs",{get:function(){var e=[];return this.forEach((function(t){return e.push(t)})),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"empty",{get:function(){return this._snapshot.docs.isEmpty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._snapshot.docs.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,t){var n=this;
1O("QuerySnapshot.forEach",arguments,1,2),P("QuerySnapshot.forEach","function",1,e),this._snapshot.docs.forEach((function(r){e.call(t,n.convertToDocumentImpl(r))}))},Object.defineProperty(e.prototype,"query",{get:function(){return new Mo(this._originalQuery,this._firestore)},enumerable:!0,configurable:!0}),e.prototype.docChanges=function(e){e&&(Q("QuerySnapshot.docChanges",e,["includeMetadataChanges"]),L("QuerySnapshot.docChanges","boolean","includeMetadataChanges",e.includeMetadataChanges));var t=!(!e||!e.includeMetadataChanges);if(t&&this._snapshot.excludesMetadataChanges)throw new E(w.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t,n){if(n.oldDocs.isEmpty()){var r,i=0;return n.docChanges.map((function(t){var o=new xo(e,t.doc.key,t.doc,n.fromCache,n.mutatedKeys.has(t.doc.key));return v(t.type===Ir.Added,"Invalid event type for first snapshot"),v(!r||n.query.docComparator(r,t.doc)<0,"Got added events in wrong order"),r=t.doc,{type:"added",doc:o,oldIndex:-1,newIndex:i++}}))}var o=n.oldDocs;return n.docChanges.filter((function(e){return t||e.type!==Ir.Metadata})).map((function(t){var r=new xo(e,t.doc.key,t.doc,n.fromCache,n.mutatedKeys.has(t.doc.key)),i=-1,a=-1;return t.type!==Ir.Added&&(v((i=o.indexOf(t.doc.key))>=0,"Index for document not found"),o=o.delete(t.doc.key)),t.type!==Ir.Removed&&(a=(o=o.add(t.doc)).indexOf(t.doc.key)),{type:Bo(t.type),doc:r,oldIndex:i,newIndex:a}}))}(this._firestore,t,this._snapshot),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges},e.prototype.isEqual=function(t){if(!(t instanceof e))throw K("isEqual","QuerySnapshot",1,t);return this._firestore===t._firestore&&this._originalQuery.isEqual(t._originalQuery)&&this._snapshot.isEqual(t._snapshot)},e.prototype.convertToDocumentImpl=function(e){return new xo(this._firestore,e.key,e,this.metadata.fromCache,this._snapshot.mutatedKeys.has(e.key))},e}();["length","forEach","map"].concat("undefined"!==typeof Symbol?[Symbol.iterator]:[]).forEach((function(e){try{Object.defineProperty(Lo.prototype.docChanges,e,{get:function(){return function(){throw new E(w.INVALID_ARGUMENT,'QuerySnapshot.docChanges has been changed from a property into a method, so usages like "querySnapshot.docChanges" should become "querySnapshot.docChanges()"')}()}})}catch(t){}}));var Fo=function(e){function t(t,n){var r=e.call(this,Qr.atPath(t),n)||this;if(t.length%2!==1)throw new E(w.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.canonicalString()+" has "+t.length);return r}return s.__extends(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._query.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){var e=this._query.path.popLast();return e.isEmpty()?null:new Ro(new he(e),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this._query.path.canonicalString()},enumerable:!0,configurable:!0}),t.prototype.doc=function(e){if(O("CollectionReference.doc",arguments,0,1),0===arguments.length&&(e=G.newId()),P("CollectionReference.doc","non-empty string",1,e),""===e)throw new E(w.INVALID_ARGUMENT,"Document path must be a non-empty string");var t=ue.fromString(e);return Ro.forPath(this._query.path.child(t),this.firestore)},t.prototype.add=function(e){D("CollectionReference.add",arguments,1),P("CollectionReference.add","object",1,e);var t=this.doc();return t.set(e).then((function(){return t}))},t}(Mo);function Uo(e,t){if(void 0===t)return{merge:!1};if(Q(e,t,["merge","mergeFields"]),L(e,"boolean","merge",t.merge),F(e,"mergeFields","a string or a FieldPath",t.mergeFields,(function(e){return"string"===typeof e||e instanceof zi})),void 0!==t.mergeFields&&void 0!==t.merge)throw new E(w.INVALID_ARGUMENT,"Invalid options passed to function "+e+'(): You cannot specify both "merge" and "mergeFields".');return t}function qo(e,t){return void 0===t?{}:(Q(e,t,["serverTimestamps"]),U(e,0,"serverTimestamps",t.serverTimestamps,["estimate","previous","none"]),t)}function Vo(e,t){x(e,"object",1,t),t&&(Q(e,t,["source"]),U(e,0,"source",t.source,["default","server","cache"]))}function jo(e,t,n){if(t instanceof Ro){if(t.firestore!==n)throw new E(w.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}throw K(e,"DocumentReference",1,t)}function Bo(e){switch(e){case Ir.Added:return"added";case Ir.Modified:case Ir.Metadata:return"modified";case Ir.Removed:return"removed";default:return g("Unknown change type: "+e)}}var Wo=T(No,"Use firebase.firestore() instead."),Qo=T(Ao,"Use firebase.firestore().runTransaction() instead."),Ko=T(Do,"Use firebase.firestore().batch() instead."),zo=T(Ro,"Use firebase.firestore().doc() instead."),Ho=T(Po),Go=T(xo),Yo=T(Mo),Xo=T(Lo),Jo=T(Fo,"Use firebase.firestore().collection() instead."),$o={Firestore:Wo,GeoPoint:Wr,Timestamp:Te,Blob:ne,Transaction:Qo,WriteBatch:Ko,DocumentReference:zo,DocumentSnapshot:Ho,Query:Yo,QueryDocumentSnapshot:Go,QuerySnapsh
1ot:Xo,CollectionReference:Jo,FieldPath:zi,FieldValue:uo,setLogLevel:No.setLogLevel,CACHE_SIZE_UNLIMITED:Io};function Zo(e){e.INTERNAL.registerService("firestore",(function(e){return new No(e)}),function(e){v(e&&"object"===typeof e,"shallowCopy() expects object parameter.");var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}($o))}var ea=function(){function e(){}return e.prototype.addCallback=function(e){},e.prototype.shutdown=function(){},e}(),ta=function(){function e(){var e=this;this.networkAvailableListener=function(){return e.onNetworkAvailable()},this.networkUnavailableListener=function(){return e.onNetworkUnavailable()},this.callbacks=[],this.configureNetworkMonitoring()}return e.prototype.addCallback=function(e){this.callbacks.push(e)},e.prototype.shutdown=function(){window.removeEventListener("online",this.networkAvailableListener),window.removeEventListener("offline",this.networkUnavailableListener)},e.prototype.configureNetworkMonitoring=function(){window.addEventListener("online",this.networkAvailableListener),window.addEventListener("offline",this.networkUnavailableListener)},e.prototype.onNetworkAvailable=function(){d("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var e=0,t=this.callbacks;e<t.length;e++){(0,t[e])(0)}},e.prototype.onNetworkUnavailable=function(){d("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var e=0,t=this.callbacks;e<t.length;e++){(0,t[e])(1)}},e.isAvailable=function(){return"undefined"!==typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},e}(),na=function(){function e(e){this.sendFn=e.sendFn,this.closeFn=e.closeFn}return e.prototype.onOpen=function(e){v(!this.wrappedOnOpen,"Called onOpen on stream twice!"),this.wrappedOnOpen=e},e.prototype.onClose=function(e){v(!this.wrappedOnClose,"Called onClose on stream twice!"),this.wrappedOnClose=e},e.prototype.onMessage=function(e){v(!this.wrappedOnMessage,"Called onMessage on stream twice!"),this.wrappedOnMessage=e},e.prototype.close=function(){this.closeFn()},e.prototype.send=function(e){this.sendFn(e)},e.prototype.callOnOpen=function(){v(void 0!==this.wrappedOnOpen,"Cannot call onOpen because no callback was set"),this.wrappedOnOpen()},e.prototype.callOnClose=function(e){v(void 0!==this.wrappedOnClose,"Cannot call onClose because no callback was set"),this.wrappedOnClose(e)},e.prototype.callOnMessage=function(e){v(void 0!==this.wrappedOnMessage,"Cannot call onMessage because no callback was set"),this.wrappedOnMessage(e)},e}(),ra="Connection",ia={BatchGetDocuments:"batchGet",Commit:"commit"},oa="gl-js/ fire/"+l,aa=function(){function e(e){this.databaseId=e.databaseId;var t=e.ssl?"https":"http";this.baseUrl=t+"://"+e.host,this.forceLongPolling=e.forceLongPolling}return e.prototype.modifyHeadersForRequest=function(e,t){if(t)for(var n in t.authHeaders)t.authHeaders.hasOwnProperty(n)&&(e[n]=t.authHeaders[n]);e["X-Goog-Api-Client"]=oa},e.prototype.invokeRPC=function(e,t,n){var r=this,i=this.makeUrl(e);return new Promise((function(o,a){var s=new c.XhrIo;s.listenOnce(c.EventType.COMPLETE,(function(){try{switch(s.getLastErrorCode()){case c.ErrorCode.NO_ERROR:var t=s.getResponseJson();d(ra,"XHR received:",JSON.stringify(t)),o(t);break;case c.ErrorCode.TIMEOUT:d(ra,'RPC "'+e+'" timed out'),a(new E(w.DEADLINE_EXCEEDED,"Request time out"));break;case c.ErrorCode.HTTP_ERROR:var n=s.getStatus();if(d(ra,'RPC "'+e+'" failed with status:',n,"response text:",s.getResponseText()),n>0){var r=s.getResponseJson().error;if(r&&r.status&&r.message){var i=function(e){var t=e.toLowerCase().replace("_","-");return Object.values(w).indexOf(t)>=0?t:w.UNKNOWN}(r.status);a(new E(i,r.message))}else a(new E(w.UNKNOWN,"Server responded with status "+s.getStatus()))}else d(ra,'RPC "'+e+'" failed'),a(new E(w.UNAVAILABLE,"Connection failed."));break;default:g('RPC "'+e+'" failed with unanticipated webchannel error '+s.getLastErrorCode()+": "+s.getLastError()+", giving up.")}}finally{d(ra,'RPC "'+e+'" completed.')}}));var u=JSON.stringify(t);d(ra,"XHR sending: ",i+" "+u);var l={"Content-Type":"text/plain"};r.modifyHeadersForRequest(l,n),s.send(i,"POST",u,l,15)}))},e.prototype.invokeStreamingRPC=function(e,t,n){return this.invokeRPC(e,t,n)},e.prototype.openStream=function(e,t){var n=[this.baseUrl,"/","google.firestore.v1.Firestore","/",e,"/channel"],r=c.createWebChannelTransport(),i={backgroundChannelTest:!0,httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database}
1,sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this.modifyHeadersForRequest(i.initMessageHeaders,t),u.isReactNative()||(i.httpHeadersOverwriteParam="$httpHeaders");var o=n.join("");d(ra,"Creating WebChannel: "+o+" "+i);var a=r.createWebChannel(o,i),s=!1,l=!1,h=new na({sendFn:function(e){l?d(ra,"Not sending because WebChannel is closed:",e):(s||(d(ra,"Opening WebChannel transport."),a.open(),s=!0),d(ra,"WebChannel sending:",e),a.send(e))},closeFn:function(){return a.close()}}),f=function(e,t){a.listen(e,(function(e){try{t(e)}catch(n){setTimeout((function(){throw n}),0)}}))};return f(c.WebChannel.EventType.OPEN,(function(){l||d(ra,"WebChannel transport opened.")})),f(c.WebChannel.EventType.CLOSE,(function(){l||(l=!0,d(ra,"WebChannel transport closed"),h.callOnClose())})),f(c.WebChannel.EventType.ERROR,(function(e){l||(l=!0,d(ra,"WebChannel transport errored:",e),h.callOnClose(new E(w.UNAVAILABLE,"The operation could not be completed")))})),f(c.WebChannel.EventType.MESSAGE,(function(e){if(!l){var t=e.data[0];v(!!t,"Got a webchannel message without data.");var n=t,r=n.error||n[0]&&n[0].error;if(r){d(ra,"WebChannel received error:",r);var i=r.status,o=function(e){var t=wr[e];if(void 0!==t)return Sr(t)}(i),s=r.message;void 0===o&&(o=w.INTERNAL,s="Unknown error status: "+i+" with message "+r.message),l=!0,h.callOnClose(new E(o,s)),a.close()}else d(ra,"WebChannel received:",t),h.callOnMessage(t)}})),setTimeout((function(){h.callOnOpen()}),0),h},e.prototype.makeUrl=function(e){var t=ia[e];v(void 0!==t,"Unknown REST mapping for: "+e);var n=[this.baseUrl,"/","v1"];return n.push("/projects/"),n.push(this.databaseId.projectId),n.push("/databases/"),n.push(this.databaseId.database),n.push("/documents"),n.push(":"),n.push(t),n.join("")},e}(),sa=function(){function e(){this.emptyByteString="",this.base64Available="undefined"!==typeof atob}return Object.defineProperty(e.prototype,"document",{get:function(){return"undefined"!==typeof document?document:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"window",{get:function(){return"undefined"!==typeof window?window:null},enumerable:!0,configurable:!0}),e.prototype.loadConnection=function(e){return Promise.resolve(new aa(e))},e.prototype.newConnectivityMonitor=function(){return ta.isAvailable()?new ta:new ea},e.prototype.newSerializer=function(e){return new mi(e,{useProto3Json:!0})},e.prototype.formatJSON=function(e){return JSON.stringify(e)},e.prototype.atob=function(e){return atob(e)},e.prototype.btoa=function(e){return btoa(e)},e}();function ua(e){Zo(e)}b.setPlatform(new sa),ua(o),t.registerFirestore=ua},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"ErrorCode",(function(){return ur})),n.d(t,"EventType",(function(){return cr})),n.d(t,"WebChannel",(function(){return lr})),n.d(t,"XhrIo",(function(){return hr})),n.d(t,"createWebChannelTransport",(function(){return sr}));var r,i="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof e?e:"undefined"!==typeof self?self:{},o=o||{},a=i;function s(e){return"string"==typeof e}function u(e){return"number"==typeof e}function c(e,t){e=e.split("."),t=t||a;for(var n=0;n<e.length;n++)if(null==(t=t[e[n]]))return null;return t}function l(){}function h(e){var t=typeof e;if("object"==t){if(!e)return"null";if(e instanceof Array)return"array";if(e instanceof Object)return t;var n=Object.prototype.toString.call(e);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof e.length&&"undefined"!=typeof e.splice&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||"undefined"!=typeof e.call&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("call"))return"function"}else if("function"==t&&"undefined"==typeof e.call)return"object";return t}function f(e){return"array"==h(e)}function p(e){var t=h(e);return"array"==t||"object"==t&&"number"==typeof e.length}function d(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var m="closure_uid_"+(1e9*Math.random()>>>0),y=0;function g(e,t,n){return e.call.apply(e.bind,arguments)}function v(e,t,n){if(!e)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),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function b(e,t,n){return(b=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?g
1:v).apply(null,arguments)}function _(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}var w=Date.now||function(){return+new Date};function E(e,t){function n(){}n.prototype=t.prototype,e.N=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.yb=function(e,n,r){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return t.prototype[n].apply(e,i)}}function T(){this.j=this.j,this.i=this.i}T.prototype.j=!1,T.prototype.la=function(){if(!this.j&&(this.j=!0,this.G(),0))this[m]||(this[m]=++y)},T.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var S=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if(s(e))return s(t)&&1==t.length?e.indexOf(t,0):-1;for(var n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return-1},C=Array.prototype.forEach?function(e,t,n){Array.prototype.forEach.call(e,t,n)}:function(e,t,n){for(var r=e.length,i=s(e)?e.split(""):e,o=0;o<r;o++)o in i&&t.call(n,i[o],o,e)};function I(e){return Array.prototype.concat.apply([],arguments)}function k(e){var t=e.length;if(0<t){for(var n=Array(t),r=0;r<t;r++)n[r]=e[r];return n}return[]}function N(e){return/^[\s\xa0]*$/.test(e)}var A,D=String.prototype.trim?function(e){return e.trim()}:function(e){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(e)[1]};function R(e,t){return-1!=e.indexOf(t)}function O(e,t){return e<t?-1:e>t?1:0}e:{var P=a.navigator;if(P){var x=P.userAgent;if(x){A=x;break e}}A=""}function M(e,t,n){for(var r in e)t.call(n,e[r],r,e)}function L(e){var t,n={};for(t in e)n[t]=e[t];return n}var F="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function U(e,t){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])e[n]=r[n];for(var o=0;o<F.length;o++)n=F[o],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function q(e){return q[" "](e),e}q[" "]=l;var V,j=R(A,"Opera"),B=R(A,"Trident")||R(A,"MSIE"),W=R(A,"Edge"),Q=W||B,K=R(A,"Gecko")&&!(R(A.toLowerCase(),"webkit")&&!R(A,"Edge"))&&!(R(A,"Trident")||R(A,"MSIE"))&&!R(A,"Edge"),z=R(A.toLowerCase(),"webkit")&&!R(A,"Edge");function H(){var e=a.document;return e?e.documentMode:void 0}e:{var G="",Y=function(){var e=A;return K?/rv:([^\);]+)(\)|;)/.exec(e):W?/Edge\/([\d\.]+)/.exec(e):B?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(e):z?/WebKit\/(\S+)/.exec(e):j?/(?:Version)[ \/]?(\S+)/.exec(e):void 0}();if(Y&&(G=Y?Y[1]:""),B){var X=H();if(null!=X&&X>parseFloat(G)){V=String(X);break e}}V=G}var J,$={};function Z(e){return function(e,t){var n=$;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,(function(){for(var t=0,n=D(String(V)).split("."),r=D(String(e)).split("."),i=Math.max(n.length,r.length),o=0;0==t&&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;t=O(0==a[1].length?0:parseInt(a[1],10),0==s[1].length?0:parseInt(s[1],10))||O(0==a[2].length,0==s[2].length)||O(a[2],s[2]),a=a[3],s=s[3]}while(0==t)}return 0<=t}))}var ee=a.document;J=ee&&B?H()||("CSS1Compat"==ee.compatMode?parseInt(V,10):5):void 0;var te=!B||9<=Number(J),ne=B&&!Z("9"),re=function(){if(!a.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{a.addEventListener("test",l,t),a.removeEventListener("test",l,t)}catch(n){}return e}();function ie(e,t){this.type=e,this.a=this.target=t,this.Ja=!0}function oe(e,t){if(ie.call(this,e?e.type:""),this.relatedTarget=this.a=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.c=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.a=t,t=e.relatedTarget){if(K){e:{try{q(t.nodeName);var i=!0;break e}catch(o){}i=!1}i||(t=null)}}
1else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(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.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=s(e.pointerType)?e.pointerType:ae[e.pointerType]||"",this.c=e,e.defaultPrevented&&this.b()}}ie.prototype.b=function(){this.Ja=!1},E(oe,ie);var ae={2:"touch",3:"pen",4:"mouse"};oe.prototype.b=function(){oe.N.b.call(this);var e=this.c;if(e.preventDefault)e.preventDefault();else if(e.returnValue=!1,ne)try{(e.ctrlKey||112<=e.keyCode&&123>=e.keyCode)&&(e.keyCode=-1)}catch(t){}};var se="closure_listenable_"+(1e6*Math.random()|0),ue=0;function ce(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.da=i,this.key=++ue,this.X=this.Z=!1}function le(e){e.X=!0,e.listener=null,e.proxy=null,e.src=null,e.da=null}function he(e){this.src=e,this.a={},this.b=0}function fe(e,t){var n=t.type;if(n in e.a){var r,i=e.a[n],o=S(i,t);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(le(t),0==e.a[n].length&&(delete e.a[n],e.b--))}}function pe(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i];if(!o.X&&o.listener==t&&o.capture==!!n&&o.da==r)return i}return-1}he.prototype.add=function(e,t,n,r,i){var o=e.toString();(e=this.a[o])||(e=this.a[o]=[],this.b++);var a=pe(e,t,r,i);return-1<a?(t=e[a],n||(t.Z=!1)):((t=new ce(t,this.src,o,!!r,i)).Z=n,e.push(t)),t};var de="closure_lm_"+(1e6*Math.random()|0),me={};function ye(e,t,n,r,i){if(r&&r.once)return function e(t,n,r,i,o){if(f(n)){for(var a=0;a<n.length;a++)e(t,n[a],r,i,o);return null}r=Se(r);return t&&t[se]?t.Ba(n,r,d(i)?!!i.capture:!!i,o):ge(t,n,r,!0,i,o)}(e,t,n,r,i);if(f(t)){for(var o=0;o<t.length;o++)ye(e,t[o],n,r,i);return null}return n=Se(n),e&&e[se]?e.Aa(t,n,d(r)?!!r.capture:!!r,i):ge(e,t,n,!1,r,i)}function ge(e,t,n,r,i,o){if(!t)throw Error("Invalid event type");var a=d(i)?!!i.capture:!!i;if(a&&!te)return null;var s=Ee(e);if(s||(e[de]=s=new he(e)),(n=s.add(t,n,r,a,o)).proxy)return n;if(r=function(){var e=we,t=te?function(n){return e.call(t.src,t.listener,n)}:function(n){if(!(n=e.call(t.src,t.listener,n)))return n};return t}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)re||(i=a),void 0===i&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(be(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}function ve(e){if(!u(e)&&e&&!e.X){var t=e.src;if(t&&t[se])fe(t.c,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(be(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Ee(t))?(fe(n,e),0==n.b&&(n.src=null,t[de]=null)):le(e)}}}function be(e){return e in me?me[e]:me[e]="on"+e}function _e(e,t){var n=e.listener,r=e.da||e.src;return e.Z&&ve(e),n.call(r,t)}function we(e,t){return!!e.X||(te?_e(e,new oe(t,this)):_e(e,t=new oe(t||c("window.event"),this)))}function Ee(e){return(e=e[de])instanceof he?e:null}var Te="__closure_events_fn_"+(1e9*Math.random()>>>0);function Se(e){return"function"==h(e)?e:(e[Te]||(e[Te]=function(t){return e.handleEvent(t)}),e[Te])}function Ce(){T.call(this),this.c=new he(this),this.J=this,this.B=null}function Ie(e,t,n,r){if(!(t=e.c.a[String(t)]))return!0;t=t.concat();for(var i=!0,o=0;o<t.length;++o){var a=t[o];if(a&&!a.X&&a.capture==n){var s=a.listener,u=a.da||a.src;a.Z&&fe(e.c,a),i=!1!==s.call(u,r)&&i}}return i&&0!=r.Ja}E(Ce,T),Ce.prototype[se]=!0,(r=Ce.prototype).addEventListener=function(e,t,n,r){ye(this,e,t,n,r)},r.removeEventListener=function(e,t,n,r){!function e(t,n,r,i,o){if(f(n))for(var a=0;a<n.length;a++)e(t,n[a],r,i,o);else i=d(i)?!!i.capture:!!i,r=Se(r),t&&t[se]?(t=t.c,(n=String(n).toString())in t.a&&(-1<(r=pe(a=t.a[n],r,i,o))&&(le(a[r]),Array.prototype.splice.call(a,r,1),0==a.length&&(delete t.a[n],t.b--)))):t&&(t=Ee(t))&&(n=t.a[n.toString()],t=-1,n&&(t=pe(n,r,i,o)),(r=-1<t?n[t]:null)&&ve(r))}(this,e,t,n,r)},r.dispatchEvent=function(e){var t,n=this.B;if(n)for(t=[];n;n=n.B)t.push(n);n=this.J;var r=e.type||e;if(s(e))e=new ie(e,n);else if(e instanceof ie)e.target=e.target||n;else{var i=e;U(e=new ie(r,n),i)}if(i=!0,t)for(var o=t.length-1;0<=o;o--){var a=e.a=t[o];i=Ie(a,r,!0,e)&&i}if(i=Ie(a=e.a=n,r,!0,e)&&i,i=Ie(a,r,!1,e)&&i,t)for(o=0;o<t.length;o++)i=Ie(a=e.a=t[o],r,!1,e)&&i;return i}
1,r.G=function(){if(Ce.N.G.call(this),this.c){var e,t=this.c;for(e in t.a){for(var n=t.a[e],r=0;r<n.length;r++)le(n[r]);delete t.a[e],t.b--}}this.B=null},r.Aa=function(e,t,n,r){return this.c.add(String(e),t,!1,n,r)},r.Ba=function(e,t,n,r){return this.c.add(String(e),t,!0,n,r)};var ke=a.JSON.stringify;function Ne(e,t){this.c=e,this.f=t,this.b=0,this.a=null}function Ae(){this.b=this.a=null}Ne.prototype.get=function(){if(0<this.b){this.b--;var e=this.a;this.a=e.next,e.next=null}else e=this.c();return e};var De,Re=new Ne((function(){return new Pe}),(function(e){e.reset()}));function Oe(){var e=Fe,t=null;return e.a&&(t=e.a,e.a=e.a.next,e.a||(e.b=null),t.next=null),t}function Pe(){this.next=this.b=this.a=null}function xe(e){a.setTimeout((function(){throw e}),0)}function Me(e,t){De||function(){var e=a.Promise.resolve(void 0);De=function(){e.then(Ue)}}(),Le||(De(),Le=!0),Fe.add(e,t)}Ae.prototype.add=function(e,t){var n=Re.get();n.set(e,t),this.b?this.b.next=n:this.a=n,this.b=n},Pe.prototype.set=function(e,t){this.a=e,this.b=t,this.next=null},Pe.prototype.reset=function(){this.next=this.b=this.a=null};var Le=!1,Fe=new Ae;function Ue(){for(var e;e=Oe();){try{e.a.call(e.b)}catch(n){xe(n)}var t=Re;t.f(e),100>t.b&&(t.b++,e.next=t.a,t.a=e)}Le=!1}function qe(e,t){Ce.call(this),this.b=e||1,this.a=t||a,this.f=b(this.gb,this),this.g=w()}function Ve(e){e.ba=!1,e.L&&(e.a.clearTimeout(e.L),e.L=null)}function je(e,t,n){if("function"==h(e))n&&(e=b(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=b(e.handleEvent,e)}return 2147483647<Number(t)?-1:a.setTimeout(e,t||0)}function Be(e,t,n){T.call(this),this.f=null!=n?b(e,n):e,this.c=t,this.b=b(this.ab,this),this.a=[]}function We(e){e.U=je(e.b,e.c),e.f.apply(null,e.a)}function Qe(e){T.call(this),this.b=e,this.a={}}E(qe,Ce),(r=qe.prototype).ba=!1,r.L=null,r.gb=function(){if(this.ba){var e=w()-this.g;0<e&&e<.8*this.b?this.L=this.a.setTimeout(this.f,this.b-e):(this.L&&(this.a.clearTimeout(this.L),this.L=null),this.dispatchEvent("tick"),this.ba&&(Ve(this),this.start()))}},r.start=function(){this.ba=!0,this.L||(this.L=this.a.setTimeout(this.f,this.b),this.g=w())},r.G=function(){qe.N.G.call(this),Ve(this),delete this.a},E(Be,T),(r=Be.prototype).ea=!1,r.U=null,r.Ua=function(e){this.a=arguments,this.U?this.ea=!0:We(this)},r.G=function(){Be.N.G.call(this),this.U&&(a.clearTimeout(this.U),this.U=null,this.ea=!1,this.a=[])},r.ab=function(){this.U=null,this.ea&&(this.ea=!1,We(this))},E(Qe,T);var Ke=[];function ze(e,t,n,r){f(n)||(n&&(Ke[0]=n.toString()),n=Ke);for(var i=0;i<n.length;i++){var o=ye(t,n[i],r||e.handleEvent,!1,e.b||e);if(!o)break;e.a[o.key]=o}}function He(e){M(e.a,(function(e,t){this.a.hasOwnProperty(t)&&ve(e)}),e),e.a={}}function Ge(){}Qe.prototype.G=function(){Qe.N.G.call(this),He(this)},Qe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Ye=new Ce;function Xe(e){ie.call(this,"serverreachability",e)}function Je(e){Ye.dispatchEvent(new Xe(Ye,e))}function $e(e){ie.call(this,"statevent",e)}function Ze(e){Ye.dispatchEvent(new $e(Ye,e))}function et(e){ie.call(this,"timingevent",e)}function tt(e,t){if("function"!=h(e))throw Error("Fn must not be null and must be a function");return a.setTimeout((function(){e()}),t)}E(Xe,ie),E($e,ie),E(et,ie);var nt={NO_ERROR:0,hb:1,ob:2,nb:3,kb:4,mb:5,pb:6,Ma:7,TIMEOUT:8,sb:9},rt={jb:"complete",wb:"success",Na:"error",Ma:"abort",ub:"ready",vb:"readystatechange",TIMEOUT:"timeout",qb:"incrementaldata",tb:"progress",lb:"downloadprogress",xb:"uploadprogress"};function it(){}function ot(e){var t;return(t=e.a)||(t=e.a={}),t}function at(){}it.prototype.a=null;var st,ut={OPEN:"a",ib:"b",Na:"c",rb:"d"};function ct(){ie.call(this,"d")}function lt(){ie.call(this,"c")}function ht(){}function ft(e,t,n){this.g=e,this.W=t,this.V=n||1,this.I=new Qe(this),this.O=pt,e=Q?125:void 0,this.P=new qe(e),this.h=null,this.b=!1,this.l=this.D=this.f=this.F=this.v=this.R=this.i=null,this.j=[],this.a=null,this.A=0,this.c=this.w=null,this.o=-1,this.m=!1,this.J=0,this.B=null,this.s=this.S=this.H=!1}
1E(ct,ie),E(lt,ie),E(ht,it),st=new ht;var pt=45e3,dt={},mt={};function yt(e,t,n){e.F=1,e.f=jt(xt(t)),e.l=n,e.H=!0,vt(e,null)}function gt(e,t,n,r){e.F=1,e.f=jt(xt(t)),e.l=null,e.H=n,vt(e,r)}function vt(e,t){e.v=w(),wt(e),e.D=xt(e.f),Vt(e.D,"t",e.V),e.A=0,e.a=e.g.$(e.g.Y()?t:null),0<e.J&&(e.B=new Be(b(e.Ka,e,e.a),e.J)),ze(e.I,e.a,"readystatechange",e.eb),t=e.h?L(e.h):{},e.l?(e.w||(e.w="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.a.ca(e.D,e.w,e.l,t)):(e.w="GET",e.a.ca(e.D,e.w,null,t)),Je(1)}function bt(e,t,n){for(var r=!0;!e.m&&e.A<n.length;){var i=_t(e,n);if(i==mt){4==t&&(e.c=4,Ze(14),r=!1);break}if(i==dt){e.c=4,Ze(15),r=!1;break}It(e,i)}4==t&&0==n.length&&(e.c=1,Ze(16),r=!1),e.b=e.b&&r,r||(Ct(e),St(e))}function _t(e,t){var n=e.A,r=t.indexOf("\n",n);return-1==r?mt:(n=Number(t.substring(n,r)),isNaN(n)?dt:(r+=1)+n>t.length?mt:(t=t.substr(r,n),e.A=r+n,t))}function wt(e){e.R=w()+e.O,Et(e,e.O)}function Et(e,t){if(null!=e.i)throw Error("WatchDog timer not null");e.i=tt(b(e.bb,e),t)}function Tt(e){e.i&&(a.clearTimeout(e.i),e.i=null)}function St(e){e.g.Da()||e.m||e.g.na(e)}function Ct(e){Tt(e);var t=e.B;t&&"function"==typeof t.la&&t.la(),e.B=null,Ve(e.P),He(e.I),e.a&&(t=e.a,e.a=null,t.abort(),t.la())}function It(e,t){try{e.g.Ga(e,t),Je(4)}catch(n){}}function kt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(p(e)||s(e))C(e,t,void 0);else{if(e.K&&"function"==typeof e.K)var n=e.K();else if(e.C&&"function"==typeof e.C)n=void 0;else if(p(e)||s(e)){n=[];for(var r=e.length,i=0;i<r;i++)n.push(i)}else for(i in n=[],r=0,e)n[r++]=i;i=(r=function(e){if(e.C&&"function"==typeof e.C)return e.C();if(s(e))return e.split("");if(p(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e)).length;for(var o=0;o<i;o++)t.call(void 0,r[o],n&&n[o],e)}}function Nt(e,t){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(e)if(e instanceof Nt)for(n=e.K(),r=0;r<n.length;r++)this.set(n[r],e.get(n[r]));else for(r in e)this.set(r,e[r])}function At(e,t){Rt(e.b,t)&&(delete e.b[t],e.c--,e.a.length>2*e.c&&Dt(e))}function Dt(e){if(e.c!=e.a.length){for(var t=0,n=0;t<e.a.length;){var r=e.a[t];Rt(e.b,r)&&(e.a[n++]=r),t++}e.a.length=n}if(e.c!=e.a.length){var i={};for(n=t=0;t<e.a.length;)Rt(i,r=e.a[t])||(e.a[n++]=r,i[r]=1),t++;e.a.length=n}}function Rt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(r=ft.prototype).setTimeout=function(e){this.O=e},r.eb=function(e){e=e.target;var t=this.B;t&&3==xn(e)?t.Ua():this.Ka(e)},r.Ka=function(e){try{if(e==this.a)e:{var t=xn(this.a),n=this.a.ya(),r=this.a.T();if(!(3>t||3==t&&!Q&&!this.a.aa())){this.m||4!=t||7==n||Je(8==n||0>=r?3:2),Tt(this);var i=this.a.T();this.o=i;var o=this.a.aa();if(this.b=200==i){if(this.S&&!this.s){t:{if(this.a){var a=Mn(this.a,"X-HTTP-Initial-Response");if(a&&!N(a)){var s=a;break t}}s=null}if(!s){this.b=!1,this.c=3,Ze(12),Ct(this),St(this);break e}this.s=!0,It(this,s)}this.H?(bt(this,t,o),Q&&this.b&&3==t&&(ze(this.I,this.P,"tick",this.cb),this.P.start())):It(this,o),4==t&&Ct(this),this.b&&!this.m&&(4==t?this.g.na(this):(this.b=!1,wt(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.c=3,Ze(12)):(this.c=0,Ze(13)),Ct(this),St(this)}}}catch(u){}},r.cb=function(){if(this.a){var e=xn(this.a),t=this.a.aa();this.A<t.length&&(Tt(this),bt(this,e,t),this.b&&4!=e&&wt(this))}},r.cancel=function(){this.m=!0,Ct(this)},r.bb=function(){this.i=null;var e=w();0<=e-this.R?(2!=this.F&&(Je(3),Ze(17)),Ct(this),this.c=2,St(this)):Et(this,this.R-e)},(r=Nt.prototype).C=function(){Dt(this);for(var e=[],t=0;t<this.a.length;t++)e.push(this.b[this.a[t]]);return e},r.K=function(){return Dt(this),this.a.concat()},r.get=function(e,t){return Rt(this.b,e)?this.b[e]:t},r.set=function(e,t){Rt(this.b,e)||(this.c++,this.a.push(e)),this.b[e]=t},r.forEach=function(e,t){for(var n=this.K(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);e.call(t,o,i,this)}};var Ot=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Pt(e,t){var n;this.b=this.j=this.f="",this.i=null,this.g=this.a="",this.h=!1,e instanceof Pt?(this.h=void 0!==t?t:e.h,Mt(this,e.f),this.j=e.j,Lt(this,e.b),Ft(this,e.i),this.a=e.a,Ut(this,tn(e.c)),this.g=e.g):e&&(n=String(e).match(Ot))?(this.h=!!t,Mt(this,n[1]||"",!0),this.j=Bt(n[2]||""),Lt(this,n[3]||"",!0),Ft(this,n[4]),this.a=Bt(n[5]||"",!0),Ut(this,n[6]||"",!0),this.g=Bt(n[7]||"")):(this.h=!!t,this.c=new Xt(null,this.h))}function xt(e){return new Pt(e)}function Mt(e,t,n){e.f=n?Bt(t,!0):t,e.f&&(e.f=e.f.replace(/:$/,""))}function Lt(e,t,n){e.b=n?Bt(t,!0):t}function Ft(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.i=t}else e.i=null}function Ut(e,t,n){t instanceof Xt?(e.c=t,function(e,t){t&&!e.f&&(Jt(e),e.c=null,e.a.forEach((function(e,t){var n=t.toLowerCase();t!=n&&($t(this,t),en(this,n,e))}),e)),e.f=t}(e.c,e.h)):(n||(t=Wt(t,Gt)),e.c=new Xt(t,e.h))}function qt(e,t,n){e.c.set(t,n)}function Vt(e,t,n){f(n)||(n=[String(n)]),en(e.c,t,n)}function jt(e){return qt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^w()).toString(36)),e}function Bt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function Wt(e,t,n){return s(e)?(e=encodeURI(e).replace(t,Qt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Qt(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Pt.prototype.toString=function(){var e=[],t=this.f;t&&e.push(Wt(t,Kt,!0),":");var n=this.b;return(n||"file"==t)&&(e.push("//"),(t=this.j)&&e.push(Wt(t,Kt,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.i)&&e.push(":",String(n))),(n=this.a)&&(this.b&&"/"!=n.charAt(0)&&e.push("/"),e.push(Wt(n,"/"==n.charAt(0)?Ht:zt,!0))),(n=this.c.toString())&&e.push("?",n),(n=this.g)&&e.push("#",Wt(n,Yt)),e.join("")},Pt.prototype.resolve=function(e){var t=xt(this),n=!!e.f;n?Mt(t,e.f):n=!!e.j,n?t.j=e.j:n=!!e.b,n?Lt(t,e.b):n=null!=e.i;var r=e.a;
1if(n)Ft(t,e.i);else if(n=!!e.a){if("/"!=r.charAt(0))if(this.b&&!this.a)r="/"+r;else{var i=t.a.lastIndexOf("/");-1!=i&&(r=t.a.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(R(i,"./")||R(i,"/.")){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?t.a=r:n=""!==e.c.toString(),n?Ut(t,tn(e.c)):n=!!e.g,n&&(t.g=e.g),t};var Kt=/[#\/\?@]/g,zt=/[#\?:]/g,Ht=/[#\?]/g,Gt=/[#\?@]/g,Yt=/#/g;function Xt(e,t){this.b=this.a=null,this.c=e||null,this.f=!!t}function Jt(e){e.a||(e.a=new Nt,e.b=0,e.c&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),i=null;if(0<=r){var o=e[n].substring(0,r);i=e[n].substring(r+1)}else o=e[n];t(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.c,(function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)})))}function $t(e,t){Jt(e),t=nn(e,t),Rt(e.a.b,t)&&(e.c=null,e.b-=e.a.get(t).length,At(e.a,t))}function Zt(e,t){return Jt(e),t=nn(e,t),Rt(e.a.b,t)}function en(e,t,n){$t(e,t),0<n.length&&(e.c=null,e.a.set(nn(e,t),k(n)),e.b+=n.length)}function tn(e){var t=new Xt;return t.c=e.c,e.a&&(t.a=new Nt(e.a),t.b=e.b),t}function nn(e,t){return t=String(t),e.f&&(t=t.toLowerCase()),t}function rn(e){this.a=e,this.b=this.h=null,this.g=!1,this.i=null,this.c=-1,this.l=this.f=null}function on(e){var t=e.a.F.a;if(null!=t)Ze(4),t?(Ze(10),Hn(e.a,e,!1)):(Ze(11),Hn(e.a,e,!0));else{e.b=new ft(e,void 0,void 0),e.b.h=e.h,t=$n(t=e.a,t.Y()?e.f:null,e.i),Ze(4),Vt(t,"TYPE","xmlhttp");var n=e.a.j,r=e.a.I;n&&r&&qt(t,n,r),gt(e.b,t,!1,e.f)}}function an(){this.a=this.b=null}function sn(){this.a=new Nt}function un(e){var t=typeof e;return"object"==t&&e||"function"==t?"o"+(e[m]||(e[m]=++y)):t.charAt(0)+e}function cn(e,t){this.b=e,this.a=t}function ln(e){this.g=e||hn,a.PerformanceNavigationTiming?e=0<(e=a.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(a.ka&&a.ka.Ea&&a.ka.Ea()&&a.ka.Ea().zb),this.f=e?this.g:1,this.a=null,1<this.f&&(this.a=new sn),this.b=null,this.c=[]}(r=Xt.prototype).add=function(e,t){Jt(this),this.c=null,e=nn(this,e);var n=this.a.get(e);return n||this.a.set(e,n=[]),n.push(t),this.b+=1,this},r.forEach=function(e,t){Jt(this),this.a.forEach((function(n,r){C(n,(function(n){e.call(t,n,r,this)}),this)}),this)},r.K=function(){Jt(this);for(var e=this.a.C(),t=this.a.K(),n=[],r=0;r<t.length;r++)for(var i=e[r],o=0;o<i.length;o++)n.push(t[r]);return n},r.C=function(e){Jt(this);var t=[];if(s(e))Zt(this,e)&&(t=I(t,this.a.get(nn(this,e))));else{e=this.a.C();for(var n=0;n<e.length;n++)t=I(t,e[n])}return t},r.set=function(e,t){return Jt(this),this.c=null,Zt(this,e=nn(this,e))&&(this.b-=this.a.get(e).length),this.a.set(e,[t]),this.b+=1,this},r.get=function(e,t){return e&&0<(e=this.C(e)).length?String(e[0]):t},r.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var e=[],t=this.a.K(),n=0;n<t.length;n++){var r=t[n],i=encodeURIComponent(String(r));r=this.C(r);for(var o=0;o<r.length;o++){var a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),e.push(a)}}return this.c=e.join("&")},E((function(){}),(function(){})),(r=rn.prototype).M=null,r.$=function(e){return this.a.$(e)},r.abort=function(){this.b&&(this.b.cancel(),this.b=null),this.c=-1},r.Da=function(){return!1},r.Ga=function(e,t){if(this.c=e.o,0==this.M){if(!this.a.o&&(e=e.a)){var n=Mn(e,"X-Client-Wire-Protocol");this.l=n||null,this.a.j&&(e=Mn(e,"X-HTTP-Session-Id"))&&(this.a.I=e)}if(t){try{var r=this.a.ja.a.parse(t)}catch(i){return(t=this.a).m=this.c,void Xn(t,2)}this.f=r[0]}else(t=this.a).m=this.c,Xn(t,2)}else 1==this.M&&(this.g?Ze(6):"11111"==t?(Ze(5),this.g=!0,(!B||10<=Number(J))&&(this.c=200,this.b.cancel(),Ze(11),Hn(this.a,this,!0))):(Ze(7),this.g=!1))},r.na=function(){if(this.c=this.b.o,this.b.b)0==this.M?(this.M=1,on(this)):1==this.M&&(this.g?(Ze(11),Hn(this.a,this,!0)):(Ze(10),Hn(this.a,this,!1)));else{0==this.M?Ze(8):1==this.M&&Ze(9);var e=this.a;e.m=this.c,Xn(e,2)}},r.Y=function(){return this.a.Y()},r.ma=function(){return this.a.ma()},sn.prototype.add=function(e){this.a.set(un(e),e)},sn.prototype.C=function(){return this.a.C()};var hn=10;function fn(e,t){!e.a&&(R(t,"spdy")||R(t,"quic")||R(t,"h2"))&&(e.f=e.g,e.a=new sn,e.b&&(yn(e,e.b),e.b=null))}function pn(e){return!!e.b||!!e.a&&e.a.a.c>=e.f}function dn(e){return e.b?1:e.a?e.a.a.c:0}function mn(e,t){return e.b?e=e.b==t:e.a?(t=un(t),e=Rt(e.a.a.b,t)):e=!1,e}function yn(e,t){e.a?e.a.add(t):e.b=t}function gn(e,t){var n;e.b&&e.b==t?e.b=null:((n=e.a)&&(n=un(t),n=Rt(e.a.a.b,n)),n&&At(e.a.a,un(t)))}function vn(e){if(null!=e.b)return e.c.concat(e.b.j);if(null!=e.a&&0!=e.a.a.c){var t=e.c;return C(e.a.C(),(function(e){t=t.concat(e.j)})),t}return k(e.c)}function bn(){}function _n(){this.a=new bn}function wn(e,t,n){var r=n||"";try{kt(e,(function(e,n){var i=e;d(e)&&(i=ke(e)),t.push(r+n+"="+encodeURIComponent(i))}))}catch(i){throw t.push(r+"type="+encodeURIComponent("_badmap")),i}}function En(e,t,n,r,i){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,i(r)}catch(o){}}ln.prototype.cancel=function(){var e;this.c=vn(this),this.b?(this.b.cancel(),this.b=null):this.a&&0!=this.a.a.c&&
1(C(this.a.C(),(function(e){e.cancel()})),(e=this.a.a).b={},e.a.length=0,e.c=0)},bn.prototype.stringify=function(e){return a.JSON.stringify(e,void 0)},bn.prototype.parse=function(e){return a.JSON.parse(e,void 0)};var Tn=a.JSON.parse;function Sn(e){Ce.call(this),this.headers=new Nt,this.H=e||null,this.b=!1,this.s=this.a=null,this.A="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.I=Cn,this.D=this.F=!1}E(Sn,Ce);var Cn="",In=/^https?$/i,kn=["POST","PUT"];function Nn(e){return"content-type"==e.toLowerCase()}function An(e,t){e.b=!1,e.a&&(e.g=!0,e.a.abort(),e.g=!1),e.f=t,e.h=5,Dn(e),On(e)}function Dn(e){e.v||(e.v=!0,e.dispatchEvent("complete"),e.dispatchEvent("error"))}function Rn(e){if(e.b&&"undefined"!=typeof o&&(!e.s[1]||4!=xn(e)||2!=e.T()))if(e.l&&4==xn(e))je(e.Fa,0,e);else if(e.dispatchEvent("readystatechange"),4==xn(e)){e.b=!1;try{var t,n=e.T();e:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break e;default:r=!1}if(!(t=r)){var i;if(i=0===n){var s=String(e.A).match(Ot)[1]||null;if(!s&&a.self&&a.self.location){var u=a.self.location.protocol;s=u.substr(0,u.length-1)}i=!In.test(s?s.toLowerCase():"")}t=i}t?(e.dispatchEvent("complete"),e.dispatchEvent("success")):(e.h=6,e.f=e.za()+" ["+e.T()+"]",Dn(e))}finally{On(e)}}}function On(e,t){if(e.a){Pn(e);var n=e.a,r=e.s[0]?l:null;e.a=null,e.s=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(i){}}}function Pn(e){e.a&&e.D&&(e.a.ontimeout=null),e.m&&(a.clearTimeout(e.m),e.m=null)}function xn(e){return e.a?e.a.readyState:0}function Mn(e,t){return e.a?e.a.getResponseHeader(t):null}function Ln(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}if(r)return e;if(n=function(e){var t="";return M(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}(n),s(e)){if(t=encodeURIComponent(String(t)),t+=n=null!=n?"="+encodeURIComponent(String(n)):""){if(0>(n=e.indexOf("#"))&&(n=e.length),0>(r=e.indexOf("?"))||r>n){r=n;var i=""}else i=e.substring(r+1,n);n=(e=[e.substr(0,r),i,e.substr(n)])[1],e[1]=t?n?n+"&"+t:t:n,e=e[0]+(e[1]?"?"+e[1]:"")+e[2]}return e}return qt(e,t,n),e}function Fn(e){this.f=[],this.F=new an,this.ga=this.pa=this.B=this.ha=this.a=this.I=this.j=this.V=this.g=this.J=this.i=null,this.Ra=this.P=0,this.Pa=!!c("internalChannelParams.failFast",e),this.ia=this.w=this.s=this.l=this.h=this.c=null,this.oa=!0,this.m=this.ra=this.O=-1,this.S=this.v=this.A=0,this.Oa=c("internalChannelParams.baseRetryDelayMs",e)||5e3,this.Sa=c("internalChannelParams.retryDelaySeedMs",e)||1e4,this.Qa=c("internalChannelParams.forwardChannelMaxRetries",e)||2,this.qa=c("internalChannelParams.forwardChannelRequestTimeoutMs",e)||2e4,this.La=e&&e.Ab||void 0,this.D=void 0,this.R=e&&e.supportsCrossDomainXhr||!1,this.H="",this.b=new ln(e&&e.concurrentRequestLimit),this.ja=new _n,this.o=!e||void 0===e.backgroundChannelTest||e.backgroundChannelTest,(this.W=e&&e.fastHandshake||!1)&&!this.o&&(this.o=!0),e&&e.forceLongPolling&&(this.oa=!1),this.fa=void 0}function Un(e){if(qn(e),3==e.u){var t=e.P++,n=xt(e.B);qt(n,"SID",e.H),qt(n,"RID",t),qt(n,"TYPE","terminate"),Wn(e,n),(t=new ft(e,t,void 0)).F=2,t.f=jt(xt(n)),n=!1,a.navigator&&a.navigator.sendBeacon&&(n=a.navigator.sendBeacon(t.f.toString(),"")),!n&&a.Image&&((new Image).src=t.f,n=!0),n||(t.a=t.g.$(null),t.a.ca(t.f)),t.v=w(),wt(t)}Jn(e)}function qn(e){e.w&&(e.w.abort(),e.w=null),e.a&&(e.a.cancel(),e.a=null),e.l&&(a.clearTimeout(e.l),e.l=null),Gn(e),e.b.cancel(),e.h&&(u(e.h)&&a.clearTimeout(e.h),e.h=null)}function Vn(e,t){e.f.push(new cn(e.Ra++,t)),3==e.u&&jn(e)}function jn(e){pn(e.b)||e.h||(e.h=!0,Me(e.Ia,e),e.A=0)}function Bn(e,t){var n;n=t?t.W:e.P++;var r=xt(e.B);qt(r,"SID",e.H),qt(r,"RID",n),qt(r,"AID",e.O),Wn(e,r),e.g&&e.i&&Ln(r,e.g,e.i),n=new ft(e,n,e.A+1),null===e.g&&(n.h=e.i),t&&(e.f=t.j.concat(e.f)),t=Qn(e,n,1e3),n.setTimeout(Math.round(.5*e.qa)+Math.round(.5*e.qa*Math.random())),yn(e.b,n),yt(n,r,t)}function Wn(e,t){e.c&&kt({},(function(e,n){qt(t,n,e)}))}function Qn(e,t,n){n=Math.min(e.f.length,n);var r=e.c?b(e.c.Ta,e.c,e):null;e:for(var i=e.f,o=-1;;){var a=["count="+n];-1==o?0<n?(o=i[0].b,a.push("ofs="+o)):o=0:a.push("ofs="+o);for(var s=!0,u=0;u<n;u++){var c=i[u].b,l=i[u].a;if(0>(c-=o))o=Math.max(0,i[u].b-100),s=!1;else try{wn(l,a,"req"+c+"_")}catch(h){r&&r(l)}}if(s){r=a.join("&");break e}}return e=e.f.splice(0,n),t.j=e,r}function Kn(e){e.a||e.l||(e.S=1,Me(e.Ha,e),e.v=0)}function zn(e){return!(e.a||e.l||3<=e.v)&&(e.S++,e.l=tt(b(e.Ha,e),Yn(e,e.v)),e.v++,!0)}function Hn(e,t,n){var r=t.l;r&&fn(e.b,r),e.ia=e.oa&&n,e.m=t.c,e.B=$n(e,null,e.ha),jn(e)}function Gn(e){null!=e.s&&(a.clearTimeout(e.s),e.s=null)}function Yn(e,t){var n=e.Oa+Math.floor(Math.random()*e.Sa);return e.ma()||(n*=2),n*t}function Xn(e,t){if(2==t){var n=null;e.c&&(n=null);var r=b(e.fb,e);n||(n=new Pt("//www.google.com/images/cleardot.gif"),a.location&&"http"==a.location.protocol||Mt(n,"https"),jt(n)),function(e,t){var n=new Ge;if(a.Image){var r=new Image;r.onload=_(En,n,r,"TestLoadImage: loaded",!0,t),r.onerror=_(En,n,r,"TestLoadImage: error",!1,t),r.onabort=_(En,n,r,"TestLoadImage: abort",!1,t),r.ontimeout=_(En,n,r,"TestLoadImage: timeout",!1,t),a.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=e}else t(!1)}(n.toString(),r)}else Ze(2);e.u=0,e.c&&e.c.ta(t),Jn(e),qn(e)}function Jn(e){e.u=0,e.m=-1,e.c&&(0==vn(e.b).length&&0==e.f.length||(e.b.c.length=0,k(e.f),e.f.length=0),e.c.sa())}function $n(e,t,n){var r=function(e){return e instanceof Pt?xt(e):new Pt(e,void 0)}(n);if(""!=r.b)t&&Lt(r,t+"."+r.b),Ft(r,r.i);else{var i,o=a.location;i=t?t+"."+o.hostname:o.hostname,r=function(e,t,n,r){var i=new Pt(null,void 0);return e&&Mt(i,e),t&&Lt(i,t),n&&Ft(i,n),r&&(i.a=r),i}(o.protocol,i,+o.port,n)}return e.V&&M(e.V,(function(e,t){qt(r,t,e)})),t=e.j,n=e.I,t&&n&&qt(r,t,n),qt(r,"VER",e.wa),Wn(e,r),r}function Zn(){}function er(){if(B&&!(10<=Number(J)))throw Error("Environmental error: no available transport.")}function tr(e,t){Ce.call(this),this.a=new Fn(t),this.g=e,this.m=t&&t.testUrl?t.testUrl:function(e){for(var t=arguments[0],n=1;n<arguments.length;n++){var r,i=arguments[n];if(0==i.lastIndexOf("/",0))t=i;else(r=""==t)||(r=0<=(r=t.length-1)&&t.indexOf("/",r)==r),t+=r?i:"/"+i}return t}(this.g,"test"),this.b=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.a.i=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.xa&&(e?e["X-WebChannel-Client-Profile"]=t.xa:e={"X-WebChannel-Client-Profile":t.xa}),this.a.J=e,(e=t&&t.httpHeadersOverwriteParam)&&!N(e)&&(this.a.g=e),this.l=t&&t.supportsCrossDomainXhr||!1,this.h=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!N(t)&&(this.a.j=t,null!==(e=this.b)&&t in e&&(t in(e=this.b)&&delete e[t])),this.f=new ir(this)}function nr(e){ct.call(this);var t=e.__sm__;if(t){e:{for(var n in t){e=n;break e}e=void 0}(this.c=e)?(e=this.c,this.data=null!==t&&e in t?t[e]:void 0):this.data=t}else this.data=e}function rr(){lt.call(this),this.status=1}function ir(e){this.a=e}(r=Sn.prototype).ca=function(e,t,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.A
1+"; newUri="+e);t=t?t.toUpperCase():"GET",this.A=e,this.f="",this.h=0,this.v=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.H?ot(this.H):ot(st),this.a.onreadystatechange=b(this.Fa,this);try{this.w=!0,this.a.open(t,String(e),!0),this.w=!1}catch(o){return void An(this,o)}e=n||"";var i=new Nt(this.headers);r&&kt(r,(function(e,t){i.set(t,e)})),r=function(e){e:{for(var t=Nn,n=e.length,r=s(e)?e.split(""):e,i=0;i<n;i++)if(i in r&&t.call(void 0,r[i],i,e)){t=i;break e}t=-1}return 0>t?null:s(e)?e.charAt(t):e[t]}(i.K()),n=a.FormData&&e instanceof a.FormData,!(0<=S(kn,t))||r||n||i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i.forEach((function(e,t){this.a.setRequestHeader(t,e)}),this),this.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{Pn(this),0<this.o&&((this.D=function(e){return B&&Z(9)&&u(e.timeout)&&void 0!==e.ontimeout}(this.a))?(this.a.timeout=this.o,this.a.ontimeout=b(this.Ca,this)):this.m=je(this.Ca,this.o,this)),this.l=!0,this.a.send(e),this.l=!1}catch(o){An(this,o)}},r.Ca=function(){"undefined"!=typeof o&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))},r.abort=function(e){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=e||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),On(this))},r.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),On(this,!0)),Sn.N.G.call(this)},r.Fa=function(){this.j||(this.w||this.l||this.g?Rn(this):this.$a())},r.$a=function(){Rn(this)},r.T=function(){try{return 2<xn(this)?this.a.status:-1}catch(e){return-1}},r.za=function(){try{return 2<xn(this)?this.a.statusText:""}catch(e){return""}},r.aa=function(){try{return this.a?this.a.responseText:""}catch(e){return""}},r.Va=function(e){if(this.a){var t=this.a.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),Tn(t)}},r.ya=function(){return this.h},r.Ya=function(){return s(this.f)?this.f:String(this.f)},(r=Fn.prototype).wa=8,r.u=1,r.Da=function(){return 0==this.u},r.Ia=function(e){if(this.h)if(this.h=null,1==this.u){if(!e){this.P=Math.floor(1e5*Math.random());var t,n=new ft(this,e=this.P++,void 0),r=this.i;if(this.J&&(r?U(r=L(r),this.J):r=this.J),null===this.g&&(n.h=r),this.W)e:{for(var i=t=0;i<this.f.length;i++){var o=this.f[i];if(void 0===(o="__data__"in o.a&&s(o=o.a.__data__)?o.length:void 0))break;if(4096<(t+=o)){t=i;break e}if(4096===t||i===this.f.length-1){t=i+1;break e}}t=1e3}else t=1e3;t=Qn(this,n,t),qt(i=xt(this.B),"RID",e),qt(i,"CVER",22),this.o&&this.j&&qt(i,"X-HTTP-Session-Id",this.j),Wn(this,i),this.g&&r&&Ln(i,this.g,r),yn(this.b,n),this.W?(qt(i,"$req",t),qt(i,"SID","null"),n.S=!0,yt(n,i,null)):yt(n,i,t),this.u=2}}else 3==this.u&&(e?Bn(this,e):0==this.f.length||pn(this.b)||Bn(this))},r.Ha=function(){this.l=null,this.a=new ft(this,"rpc",this.S),null===this.g&&(this.a.h=this.i),this.a.J=0;var e=xt(this.pa);qt(e,"RID","rpc"),qt(e,"SID",this.H),qt(e,"CI",this.ia?"0":"1"),qt(e,"AID",this.O),Wn(this,e),qt(e,"TYPE","xmlhttp"),this.g&&this.i&&Ln(e,this.g,this.i),this.D&&this.a.setTimeout(this.D),gt(this.a,e,!0,this.ga)},r.Ga=function(e,t){if(0!=this.u&&(this.a==e||mn(this.b,e)))if(this.m=e.o,!e.s&&mn(this.b,e)&&3==this.u){try{var n=this.ja.a.parse(t)}catch(o){n=null}if(f(n)&&3==n.length){if(0==(t=n)[0]){e:if(!this.l){if(this.a){if(!(this.a.v+3e3<e.v))break e;Gn(this),this.a.cancel(),this.a=null}zn(this),Ze(18)}}else this.ra=t[1],0<this.ra-this.O&&37500>t[2]&&this.ia&&0==this.v&&!this.s&&(this.s=tt(b(this.Za,this),6e3));if(1>=dn(this.b)&&this.fa){try{this.fa()}catch(o){}this.fa=void 0}}else Xn(this,11)}else if((e.s||this.a==e)&&Gn(this),!N(t))for(t=n=this.ja.a.parse(t),n=0;n<t.length;n++){var r=t[n];if(this.O=r[0],r=r[1],2==this.u)if("c"==r[0]){this.H=r[1],this.ga=r[2];var i=r[3];null!=i&&(this.wa=i),null!=(r=r[5])&&u(r)&&0<r&&(this.D=1.5*r),this.o&&(r=e.a)&&((i=Mn(r,"X-Client-Wire-Protocol"))&&fn(this.b,i),this.j&&(r=Mn(r,"X-HTTP-Session-Id")))&&(this.I=r,qt(this.B,this.j,r)),this.u=3,this.c&&this.c.va(),r=e,this.pa=$n(this,this.Y()?this.ga:null,this.ha),r.s?(gn(this.b,r),(i=this.D)&&r.setTimeout(i),r.i&&(Tt(r),wt(r)),this.a=r):Kn(this),0<this.f.length&&jn(this)}else"stop"!=r[0]&&"close"!=r[0]||Xn(this,7);else 3==this.u&&("stop"==r[0]||"close"==r[0]?"stop"==r[0]?Xn(this,7):Un(this):"noop"!=r[0]&&this.c&&this.c.ua(r),this.v=0)}},r.Za=function(){null!=this.s&&(this.s=null,this.a.cancel(),this.a=null,z
1n(this),Ze(19))},r.na=function(e){var t=null;if(this.a==e){Gn(this),this.a=null;var n=2}else{if(!mn(this.b,e))return;t=e.j,gn(this.b,e),n=1}if(this.m=e.o,0!=this.u)if(e.b)1==n?(t=w()-e.v,Ye.dispatchEvent(new et(Ye,e.l?e.l.length:0,t,this.A)),jn(this)):Kn(this);else{var r=e.c;if(3==r||0==r&&0<this.m||!(1==n&&function(e,t){return!(dn(e.b)>=e.b.f-(e.h?1:0))&&(e.h?(e.f=t.j.concat(e.f),!0):!(1==e.u||2==e.u||e.A>=(e.Pa?0:e.Qa))&&(e.h=tt(b(e.Ia,e,t),Yn(e,e.A)),e.A++,!0))}(this,e)||2==n&&zn(this)))switch(t&&0<t.length&&(e=this.b,e.c=e.c.concat(t)),r){case 1:Xn(this,5);break;case 4:Xn(this,10);break;case 3:Xn(this,6);break;default:Xn(this,2)}}},r.fb=function(e){Ze(e?2:1)},r.$=function(e){if(e&&!this.R)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new Sn(this.La)).F=this.R,e},r.ma=function(){return!!this.c&&!0},r.Y=function(){return this.R},(r=Zn.prototype).va=function(){},r.ua=function(){},r.ta=function(){},r.sa=function(){},r.Ta=function(){},er.prototype.a=function(e,t){return new tr(e,t)},E(tr,Ce),(r=tr.prototype).addEventListener=function(e,t,n,r){tr.N.addEventListener.call(this,e,t,n,r)},r.removeEventListener=function(e,t,n,r){tr.N.removeEventListener.call(this,e,t,n,r)},r.Wa=function(){this.a.c=this.f,this.l&&(this.a.R=!0);var e=this.a,t=this.m,n=this.g,r=this.b||void 0;Ze(0),e.ha=n,e.V=r||{},e.o&&(e.F.b=[],e.F.a=!1),e.w=new rn(e),null===e.g&&(e.w.h=e.i),n=t,e.g&&e.i&&(n=Ln(t,e.g,e.i)),(e=e.w).i=n,t=$n(e.a,null,e.i),Ze(3),null!=(n=e.a.F.b)?(e.f=n[0],e.M=1,on(e)):(Vt(t,"MODE","init"),!e.a.o&&e.a.j&&Vt(t,"X-HTTP-Session-Id",e.a.j),e.b=new ft(e,void 0,void 0),e.b.h=e.h,gt(e.b,t,!1,null),e.M=0)},r.close=function(){Un(this.a)},r.Xa=function(e){if(s(e)){var t={};t.__data__=e,Vn(this.a,t)}else this.h?((t={}).__data__=ke(e),Vn(this.a,t)):Vn(this.a,e)},r.G=function(){this.a.c=null,delete this.f,Un(this.a),delete this.a,tr.N.G.call(this)},E(nr,ct),E(rr,lt),E(ir,Zn),ir.prototype.va=function(){this.a.dispatchEvent("a")},ir.prototype.ua=function(e){this.a.dispatchEvent(new nr(e))},ir.prototype.ta=function(e){this.a.dispatchEvent(new rr(e))},ir.prototype.sa=function(){this.a.dispatchEvent("b")};var or=_((function(e,t){function n(){}n.prototype=e.prototype;var r=new n;return e.apply(r,Array.prototype.slice.call(arguments,1)),r}),er);er.prototype.createWebChannel=er.prototype.a,tr.prototype.send=tr.prototype.Xa,tr.prototype.open=tr.prototype.Wa,tr.prototype.close=tr.prototype.close,nt.NO_ERROR=0,nt.TIMEOUT=8,nt.HTTP_ERROR=6,rt.COMPLETE="complete",at.EventType=ut,ut.OPEN="a",ut.CLOSE="b",ut.ERROR="c",ut.MESSAGE="d",Ce.prototype.listen=Ce.prototype.Aa,Sn.prototype.listenOnce=Sn.prototype.Ba,Sn.prototype.getLastError=Sn.prototype.Ya,Sn.prototype.getLastErrorCode=Sn.prototype.ya,Sn.prototype.getStatus=Sn.prototype.T,Sn.prototype.getStatusText=Sn.prototype.za,Sn.prototype.getResponseJson=Sn.prototype.Va,Sn.prototype.getResponseText=Sn.prototype.aa,Sn.prototype.send=Sn.prototype.ca;var ar={createWebChannelTransport:or,ErrorCode:nt,EventType:rt,WebChannel:at,XhrIo:Sn},sr=ar.createWebChannelTransport,ur=ar.ErrorCode,cr=ar.EventType,lr=ar.WebChannel,hr=ar.XhrIo;t.default=ar}.call(this,n(5))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=(r=n(1))&&"object"===typeof r&&"default"in r?r.default:r,o=n(0),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(e){function t(n,r,i){var o=e.call(this,r)||this;return Object.setPrototypeOf(o,t.prototype),o.code=n,o.details=i,o}return o.__extends(t,e),t}(Error);var u=function(){function e(e){this.app=e}return e.prototype.getAuthToken=function(){return o.__awaiter(this,void 0,void 0,(function(){var e;return o.__generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.app.INTERNAL.getToken()];case 1:return(e=t.sent())?[2,e.accessToken]:[2,void 0];case 2:return t.sent(),[2,void 0];case 3:return[2]}}
1))}))},e.prototype.getInstanceIdToken=function(){return o.__awaiter(this,void 0,void 0,(function(){var e;return o.__generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this.app.messaging?[4,this.app.messaging().getToken()]:[2,void 0];case 1:return(e=t.sent())?[2,e]:[2,void 0];case 2:return t.sent(),[2,void 0];case 3:return[2]}}))}))},e.prototype.getContext=function(){return o.__awaiter(this,void 0,void 0,(function(){var e,t;return o.__generator(this,(function(n){switch(n.label){case 0:return[4,this.getAuthToken()];case 1:return e=n.sent(),[4,this.getInstanceIdToken()];case 2:return t=n.sent(),[2,{authToken:e,instanceIdToken:t}]}}))}))},e}();function c(e,t){var n={};for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}var l=function(){function e(){}return e.prototype.encode=function(e){var t=this;if(null==e)return null;if(e instanceof Number&&(e=e.valueOf()),"number"===typeof e&&isFinite(e))return e;if(!0===e||!1===e)return e;if("[object String]"===Object.prototype.toString.call(e))return e;if(Array.isArray(e))return e.map((function(e){return t.encode(e)}));if("function"===typeof e||"object"===typeof e)return c(e,(function(e){return t.encode(e)}));throw new Error("Data cannot be encoded in JSON: "+e)},e.prototype.decode=function(e){var t=this;if(null==e)return e;if(e["@type"])switch(e["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":var n=Number(e.value);if(isNaN(n))throw new Error("Data cannot be decoded from JSON: "+e);return n;default:throw new Error("Data cannot be decoded from JSON: "+e)}return Array.isArray(e)?e.map((function(e){return t.decode(e)})):"function"===typeof e||"object"===typeof e?c(e,(function(e){return t.decode(e)})):e},e}();var h=function(){function e(e,t){var n=this;void 0===t&&(t="us-central1"),this.app_=e,this.region_=t,this.serializer=new l,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return n.deleteService()}},this.contextProvider=new u(e),this.cancelAllRequests=new Promise((function(e){n.deleteService=function(){return e()}}))}return Object.defineProperty(e.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),e.prototype._url=function(e){var t=this.app_.options.projectId,n=this.region_;return null!==this.emulatorOrigin?this.emulatorOrigin+"/"+t+"/"+n+"/"+e:"https://"+n+"-"+t+".cloudfunctions.net/"+e},e.prototype.useFunctionsEmulator=function(e){this.emulatorOrigin=e},e.prototype.httpsCallable=function(e,t){var n=this;return function(r){return n.call(e,r,t||{})}},e.prototype.postJSON=function(e,t,n){return o.__awaiter(this,void 0,void 0,(function(){var r,i;return o.__generator(this,(function(o){switch(o.label){case 0:n.append("Content-Type","application/json"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,fetch(e,{method:"POST",body:JSON.stringify(t),headers:n})];case 2:return r=o.sent(),[3,4];case 3:return o.sent(),[2,{status:0,json:null}];case 4:i=null,o.label=5;case 5:return o.trys.push([5,7,,8]),[4,r.json()];case 6:return i=o.sent(),[3,8];case 7:return o.sent(),[3,8];case 8:return[2,{status:r.status,json:i}]}}))}))},e.prototype.call=function(e,t,n){return o.__awaiter(this,void 0,void 0,(function(){var r,i,u,c,l,h,f,p;return o.__generator(this,(function(o){switch(o.label){case 0:return r=this._url(e),t=this.serializer.encode(t),i={data:t},u=new Headers,[4,this.contextProvider.getContext()];case 1:return(c=o.sent()).authToken&&u.append("Authorization","Bearer "+c.authToken),c.instanceIdToken&&u.append("Firebase-Instance-ID-Token",c.instanceIdToken),l=n.timeout||7e4,[4,Promise.race([this.postJSON(r,i,u),(d=l,new Promise((function(e,t){setTimeout((function(){t(new s("deadline-exceeded","deadline-exceeded"))}),d)}))),this.cancelAllRequests])];case 2:if(!(h=o.sent()))throw new s("cancelled","Firebase Functions instance was deleted.");if(f=function(e,t,n){var r=function(e){if(e>=200&&e<300)return"ok";switch(e){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"}(e),i=r,o=void 0;try{var u=t&&t.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;
1"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)}(h.status,h.json,this.serializer))throw f;if(!h.json)throw new s("internal","Response is not valid JSON object.");if("undefined"===typeof(p=h.json.data)&&(p=h.json.result),"undefined"===typeof p)throw new s("internal","Response is missing data field.");return[2,{data:this.serializer.decode(p)}]}var d}))}))},e}(),f="functions";function p(e,t,n){return new h(e,n)}function d(e){var t={Functions:h};e.INTERNAL.registerService(f,p,t,void 0,!0)}d(i),t.registerFunctions=d},function(e,t,n){"use strict";n.r(t),n.d(t,"isSupported",(function(){return P})),n.d(t,"registerMessaging",(function(){return O}));var r,i,o,a=n(1),s=n.n(a),u=n(0),c=n(3),l=((r={})["only-available-in-window"]="This method is available in a Window context.",r["only-available-in-sw"]="This method is available in a service worker context.",r["should-be-overriden"]="This method should be overriden by extended classes.",r["bad-sender-id"]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",r["permission-default"]="The required permissions were not granted and dismissed instead.",r["permission-blocked"]="The required permissions were not granted and blocked instead.",r["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",r["notifications-blocked"]="Notifications have been blocked.",r["failed-serviceworker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",r["sw-registration-expected"]="A service worker registration was the expected input.",r["get-subscription-failed"]="There was an error when trying to get any existing Push Subscriptions.",r["invalid-saved-token"]="Unable to access details of the saved token.",r["sw-reg-redundant"]="The service worker being used for push was made redundant.",r["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$errorInfo}",r["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",r["token-subscribe-no-push-set"]="FCM returned an invalid response when getting an FCM token.",r["token-unsubscribe-failed"]="A problem occured while unsubscribing the user from FCM: {$errorInfo}",r["token-update-failed"]="A problem occured while updating the user from FCM: {$errorInfo}",r["token-update-no-token"]="FCM returned no token when updating the user to push.",r["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["invalid-delete-token"]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",r["delete-token-not-found"]="The deletion attempt for token could not be performed as the token was not found.",r["delete-scope-not-found"]="The deletion attempt for service worker scope could not be performed as the scope was not found.",r["bg-handler-function-expected"]="The input to setBackgroundMessageHandler() must be a function.",r["no-window-client-to-msg"]="An attempt was made to message a non-existant window client.",r["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. {$errorInfo}",r["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["failed-to-delete-token"]="Unable to delete the currently saved token.",r["no-sw-in-reg"]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",r["bad-scope"]="The service worker scope must be a string with at least one character.",r["bad-vapid-key"]="The public VAPID key is not a Uint8Array with 65 bytes.",r["bad-subscription"]="The subscription must be a valid PushSubscription.",r["bad-token"]="The FCM Token used for storage / lookup was not a valid token string.",r["bad-push-set"]="The FCM push set used for storage / lookup was not not a valid push set string.",r["failed-delete-vapid-key"]="The VAPID key could not be deleted.",r["invali
1d-public-vapid-key"]="The public VAPID key must be a string.",r["use-public-key-before-get-token"]="The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used.",r["public-vapid-key-decryption-failed"]="The public VAPID key did not equal 65 bytes when decrypted.",r),h=new c.ErrorFactory("messaging","Messaging",l),f=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]),p="https://fcm.googleapis.com";function d(e,t){if(null==e||null==t)return!1;if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e),r=new DataView(t),i=0;i<e.byteLength;i++)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0}function m(e){return function(e){var t=new Uint8Array(e);return btoa(String.fromCharCode.apply(String,Object(u.__spread)(t)))}(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}!function(e){e.TYPE_OF_MSG="firebase-messaging-msg-type",e.DATA="firebase-messaging-msg-data"}(i||(i={})),function(e){e.PUSH_MSG_RECEIVED="push-msg-received",e.NOTIFICATION_CLICKED="notification-clicked"}(o||(o={}));var y=function(){function e(){}return e.prototype.getToken=function(e,t,n){return Object(u.__awaiter)(this,void 0,void 0,(function(){var r,i,o,a,s,c,l,y,g;return Object(u.__generator)(this,(function(u){switch(u.label){case 0:r=m(t.getKey("p256dh")),i=m(t.getKey("auth")),o="authorized_entity="+e+"&endpoint="+t.endpoint+"&encryption_key="+r+"&encryption_auth="+i,d(n.buffer,f.buffer)||(a=m(n),o+="&application_pub_key="+a),(s=new Headers).append("Content-Type","application/x-www-form-urlencoded"),c={method:"POST",headers:s,body:o},u.label=1;case 1:return u.trys.push([1,4,,5]),[4,fetch(p+"/fcm/connect/subscribe",c)];case 2:return[4,u.sent().json()];case 3:return l=u.sent(),[3,5];case 4:throw y=u.sent(),h.create("token-subscribe-failed",{errorInfo:y});case 5:if(l.error)throw g=l.error.message,h.create("token-subscribe-failed",{errorInfo:g});if(!l.token)throw h.create("token-subscribe-no-token");if(!l.pushSet)throw h.create("token-subscribe-no-push-set");return[2,{token:l.token,pushSet:l.pushSet}]}}))}))},e.prototype.updateToken=function(e,t,n,r,i){return Object(u.__awaiter)(this,void 0,void 0,(function(){var o,a,s,c,l,y,g,v,b;return Object(u.__generator)(this,(function(u){switch(u.label){case 0:o=m(r.getKey("p256dh")),a=m(r.getKey("auth")),s="push_set="+n+"&token="+t+"&authorized_entity="+e+"&endpoint="+r.endpoint+"&encryption_key="+o+"&encryption_auth="+a,d(i.buffer,f.buffer)||(c=m(i),s+="&application_pub_key="+c),(l=new Headers).append("Content-Type","application/x-www-form-urlencoded"),y={method:"POST",headers:l,body:s},u.label=1;case 1:return u.trys.push([1,4,,5]),[4,fetch(p+"/fcm/connect/subscribe",y)];case 2:return[4,u.sent().json()];case 3:return g=u.sent(),[3,5];case 4:throw v=u.sent(),h.create("token-update-failed",{errorInfo:v});case 5:if(g.error)throw b=g.error.message,h.create("token-update-failed",{errorInfo:b});if(!g.token)throw h.create("token-update-no-token");return[2,g.token]}}))}))},e.prototype.deleteToken=function(e,t,n){return Object(u.__awaiter)(this,void 0,void 0,(function(){var r,i,o,a,s,c;return Object(u.__generator)(this,(function(u){switch(u.label){case 0:r="authorized_entity="+e+"&token="+t+"&pushSet="+n,(i=new Headers).append("Content-Type","application/x-www-form-urlencoded"),o={method:"POST",headers:i,body:r},u.label=1;case 1:return u.trys.push([1,4,,5]),[4,fetch(p+"/fcm/connect/unsubscribe",o)];case 2:return[4,u.sent().json()];case 3:if((a=u.sent()).error)throw s=a.error.message,h.create("token-unsubscribe-failed",{errorInfo:s});return[3,5];case 4:throw c=u.sent(),h.create("token-unsubscribe-failed",{errorInfo:c});case 5:return[2]}}
1))}))},e}();function g(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}var v="undefined",b="fcm_token_object_Store";function _(){var e=indexedDB.open(v);e.onerror=function(e){},e.onsuccess=function(t){!function(e){if(e.objectStoreNames.contains(b)){var t=e.transaction(b).objectStore(b),n=new y,r=t.openCursor();r.onerror=function(e){console.warn("Unable to cleanup old IDB.",e)},r.onsuccess=function(){var t=r.result;if(t){var i=t.value;n.deleteToken(i.fcmSenderId,i.fcmToken,i.fcmPushSet),t.continue()}else e.close(),indexedDB.deleteDatabase(v)}}}(e.result)}}var w=function(){function e(){this.dbPromise=null}return e.prototype.get=function(e){return this.createTransaction((function(t){return t.get(e)}))},e.prototype.getIndex=function(e,t){return this.createTransaction((function(n){return n.index(e).get(t)}))},e.prototype.put=function(e){return this.createTransaction((function(t){return t.put(e)}),"readwrite")},e.prototype.delete=function(e){return this.createTransaction((function(t){return t.delete(e)}),"readwrite")},e.prototype.closeDatabase=function(){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(e){switch(e.label){case 0:return this.dbPromise?[4,this.dbPromise]:[3,2];case 1:e.sent().close(),this.dbPromise=null,e.label=2;case 2:return[2]}}
1))}))},e.prototype.createTransaction=function(e,t){return void 0===t&&(t="readonly"),Object(u.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o;return Object(u.__generator)(this,(function(a){switch(a.label){case 0:return[4,this.getDb()];case 1:return n=a.sent(),r=n.transaction(this.objectStoreName,t),i=r.objectStore(this.objectStoreName),[4,E(e(i))];case 2:return o=a.sent(),[2,new Promise((function(e,t){r.oncomplete=function(){e(o)},r.onerror=function(){t(r.error)}}))]}}))}))},e.prototype.getDb=function(){var e=this;return this.dbPromise||(this.dbPromise=new Promise((function(t,n){var r=indexedDB.open(e.dbName,e.dbVersion);r.onsuccess=function(){t(r.result)},r.onerror=function(){e.dbPromise=null,n(r.error)},r.onupgradeneeded=function(t){return e.onDbUpgrade(r,t)}}))),this.dbPromise},e}();function E(e){return new Promise((function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}var T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.dbName="fcm_token_details_db",t.dbVersion=3,t.objectStoreName="fcm_token_object_Store",t}return Object(u.__extends)(t,e),t.prototype.onDbUpgrade=function(e,t){var n=e.result;switch(t.oldVersion){case 0:(r=n.createObjectStore(this.objectStoreName,{keyPath:"swScope"})).createIndex("fcmSenderId","fcmSenderId",{unique:!1}),r.createIndex("fcmToken","fcmToken",{unique:!0});case 1:_();case 2:var r,i=(r=e.transaction.objectStore(this.objectStoreName)).openCursor();i.onsuccess=function(){var e=i.result;if(e){var t=e.value,n=Object(u.__assign)({},t);t.createTime||(n.createTime=Date.now()),"string"===typeof t.vapidKey&&(n.vapidKey=g(t.vapidKey)),"string"===typeof t.auth&&(n.auth=g(t.auth).buffer),"string"===typeof t.auth&&(n.p256dh=g(t.p256dh).buffer),e.update(n),e.continue()}}}},t.prototype.getTokenDetailsFromToken=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(t){if(!e)throw h.create("bad-token");return S({fcmToken:e}),[2,this.getIndex("fcmToken",e)]}))}))},t.prototype.getTokenDetailsFromSWScope=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(t){if(!e)throw h.create("bad-scope");return S({swScope:e}),[2,this.get(e)]}))}))},t.prototype.saveTokenDetails=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(t){if(!e.swScope)throw h.create("bad-scope");if(!e.vapidKey)throw h.create("bad-vapid-key");if(!e.endpoint||!e.auth||!e.p256dh)throw h.create("bad-subscription");if(!e.fcmSenderId)throw h.create("bad-sender-id");if(!e.fcmToken)throw h.create("bad-token");if(!e.fcmPushSet)throw h.create("bad-push-set");return S(e),[2,this.put(e)]}))}))},t.prototype.deleteToken=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t;return Object(u.__generator)(this,(function(n){switch(n.label){case 0:return"string"!==typeof e||0===e.length?[2,Promise.reject(h.create("invalid-delete-token"))]:[4,this.getTokenDetailsFromToken(e)];case 1:if(!(t=n.sent()))throw h.create("delete-token-not-found");return[4,this.delete(t.swScope)];case 2:return n.sent(),[2,t]}}))}))},t}(w);function S(e){if(e.fcmToken&&("string"!==typeof e.fcmToken||0===e.fcmToken.length))throw h.create("bad-token");if(e.swScope&&("string"!==typeof e.swScope||0===e.swScope.length))throw h.create("bad-scope");if(e.vapidKey&&(!(e.vapidKey instanceof Uint8Array)||65!==e.vapidKey.length))throw h.create("bad-vapid-key");if(e.endpoint&&("string"!==typeof e.endpoint||0===e.endpoint.length))throw h.create("bad-subscription");if(e.auth&&!(e.auth instanceof ArrayBuffer))throw h.create("bad-subscription");if(e.p256dh&&!(e.p256dh instanceof ArrayBuffer))throw h.create("bad-subscription");if(e.fcmSenderId&&("string"!==typeof e.fcmSenderId||0===e.fcmSenderId.length))throw h.create("bad-sender-id");if(e.fcmPushSet&&("string"!==typeof e.fcmPushSet||0===e.fcmPushSet.length))throw h.create("bad-push-set")}var C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.dbName="fcm_vapid_details_db",t.dbVersion=1,t.objectStoreName="fcm_vapid_object_Store",t}return Object(u.__extends)(t,e),t.prototype.onDbUpgrade=function(e){e.result.createObjectStore(this.objectStoreName,{keyPath:"swScope"})},t.prototype.getVapidFromSWScope=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t;return Object(u.__generator)(this,(function(n){switch(n.label){case 0:if("string"!==typeof e||0===e.length)throw h.create("bad-scope");return[4,this.get(e)];case 1:return[2,(t=n.sent())?t.vapidKey:void 0]}}))}))},t.prototype.saveVapidDetails=function(e,t){return Object(u.__awaiter)(this,void 0,void 0,(function(){var n;return Object(u.__generator)(this,(function(r){if("string"!==typeof e||0===e.length)throw h.create("bad-scope");
1if(null===t||65!==t.length)throw h.create("bad-vapid-key");return n={swScope:e,vapidKey:t},[2,this.put(n)]}))}))},t.prototype.deleteVapidDetails=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t;return Object(u.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.getVapidFromSWScope(e)];case 1:if(!(t=n.sent()))throw h.create("delete-scope-not-found");return[4,this.delete(e)];case 2:return n.sent(),[2,t]}}))}))},t}(w),I="messagingSenderId",k=function(){function e(e){var t=this;if(!e.options[I]||"string"!==typeof e.options[I])throw h.create("bad-sender-id");this.messagingSenderId=e.options[I],this.tokenDetailsModel=new T,this.vapidDetailsModel=new C,this.iidModel=new y,this.app=e,this.INTERNAL={delete:function(){return t.delete()}}}return e.prototype.getToken=function(){return Object(u.__awaiter)(this,void 0,void 0,(function(){var e,t,n,r,i;return Object(u.__generator)(this,(function(o){switch(o.label){case 0:if("denied"===(e=this.getNotificationPermission_()))throw h.create("notifications-blocked");return"granted"!==e?[2,null]:[4,this.getSWRegistration_()];case 1:return t=o.sent(),[4,this.getPublicVapidKey_()];case 2:return n=o.sent(),[4,this.getPushSubscription(t,n)];case 3:return r=o.sent(),[4,this.tokenDetailsModel.getTokenDetailsFromSWScope(t.scope)];case 4:return(i=o.sent())?[2,this.manageExistingToken(t,r,n,i)]:[2,this.getNewToken(t,r,n)]}}))}))},e.prototype.manageExistingToken=function(e,t,n,r){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(i){switch(i.label){case 0:return function(e,t,n){if(!n.vapidKey||!d(t.buffer,n.vapidKey.buffer))return!1;var r=e.endpoint===n.endpoint,i=d(e.getKey("auth"),n.auth),o=d(e.getKey("p256dh"),n.p256dh);return r&&i&&o}(t,n,r)?Date.now()<r.createTime+6048e5?[2,r.fcmToken]:[2,this.updateToken(e,t,n,r)]:[4,this.deleteTokenFromDB(r.fcmToken)];case 1:return i.sent(),[2,this.getNewToken(e,t,n)]}}))}))},e.prototype.updateToken=function(e,t,n,r){return Object(u.__awaiter)(this,void 0,void 0,(function(){var i,o,a;return Object(u.__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,t,n)];case 1:return i=s.sent(),o={swScope:e.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:i,fcmPushSet:r.fcmPushSet,createTime:Date.now(),endpoint:t.endpoint,auth:t.getKey("auth"),p256dh:t.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(o)];case 2:return s.sent(),[4,this.vapidDetailsModel.saveVapidDetails(e.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]}}
1))}))},e.prototype.getNewToken=function(e,t,n){return Object(u.__awaiter)(this,void 0,void 0,(function(){var r,i;return Object(u.__generator)(this,(function(o){switch(o.label){case 0:return[4,this.iidModel.getToken(this.messagingSenderId,t,n)];case 1:return r=o.sent(),i={swScope:e.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:r.token,fcmPushSet:r.pushSet,createTime:Date.now(),endpoint:t.endpoint,auth:t.getKey("auth"),p256dh:t.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(i)];case 2:return o.sent(),[4,this.vapidDetailsModel.saveVapidDetails(e.scope,n)];case 3:return o.sent(),[2,r.token]}}))}))},e.prototype.deleteToken=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(u.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.deleteTokenFromDB(e)];case 1:return r.sent(),[4,this.getSWRegistration_()];case 2:return(t=r.sent())?[4,t.pushManager.getSubscription()]:[3,4];case 3:if(n=r.sent())return[2,n.unsubscribe()];r.label=4;case 4:return[2,!0]}}))}))},e.prototype.deleteTokenFromDB=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t;return Object(u.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.tokenDetailsModel.deleteToken(e)];case 1:return t=n.sent(),[4,this.iidModel.deleteToken(t.fcmSenderId,t.fcmToken,t.fcmPushSet)];case 2:return n.sent(),[2]}}))}))},e.prototype.getPushSubscription=function(e,t){return e.pushManager.getSubscription().then((function(n){return n||e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t})}))},e.prototype.requestPermission=function(){throw h.create("only-available-in-window")},e.prototype.useServiceWorker=function(e){throw h.create("only-available-in-window")},e.prototype.usePublicVapidKey=function(e){throw h.create("only-available-in-window")},e.prototype.onMessage=function(e,t,n){throw h.create("only-available-in-window")},e.prototype.onTokenRefresh=function(e,t,n){throw h.create("only-available-in-window")},e.prototype.setBackgroundMessageHandler=function(e){throw h.create("only-available-in-sw")},e.prototype.delete=function(){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(e){switch(e.label){case 0:return[4,Promise.all([this.tokenDetailsModel.closeDatabase(),this.vapidDetailsModel.closeDatabase()])];case 1:return e.sent(),[2]}}))}))},e.prototype.getNotificationPermission_=function(){return Notification.permission},e.prototype.getTokenDetailsModel=function(){return this.tokenDetailsModel},e.prototype.getVapidDetailsModel=function(){return this.vapidDetailsModel},e.prototype.getIidModel=function(){return this.iidModel},e}();var N=function(e){function t(t){var n=e.call(this,t)||this;return n.bgMessageHandler=null,self.addEventListener("push",(function(e){n.onPush(e)})),self.addEventListener("pushsubscriptionchange",(function(e){n.onSubChange(e)})),self.addEventListener("notificationclick",(function(e){n.onNotificationClick(e)})),n}return Object(u.__extends)(t,e),t.prototype.onPush=function(e){e.waitUntil(this.onPush_(e))},t.prototype.onSubChange=function(e){e.waitUntil(this.onSubChange_(e))},t.prototype.onNotificationClick=function(e){e.waitUntil(this.onNotificationClick_(e))},t.prototype.onPush_=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i,o,a;return Object(u.__generator)(this,(function(s){switch(s.label){case 0:if(!e.data)return[2];try{t=e.data.json()}catch(u){return[2]}return[4,this.hasVisibleClients_()];case 1:return s.sent()?[2,this.sendMessageToWindowClients_(t)]:(n=this.getNotificationData_(t))?(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(t)]:[3,5];case 4:return s.sent(),[2];case 5:return[2]}}
1))}))},t.prototype.onSubChange_=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var e,t,n,r;return Object(u.__generator)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return e=i.sent(),[3,3];case 2:throw t=i.sent(),h.create("unable-to-resubscribe",{errorInfo:t});case 3:return i.trys.push([3,5,,8]),[4,e.pushManager.getSubscription()];case 4:return i.sent(),[3,8];case 5:return n=i.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(e.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]}}))}))},t.prototype.onNotificationClick_=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i;return Object(u.__generator)(this,(function(a){switch(a.label){case 0:return e.notification&&e.notification.data&&e.notification.data.FCM_MSG?e.action?[2]:(e.stopImmediatePropagation(),e.notification.close(),(t=e.notification.data.FCM_MSG).notification&&(n=t.fcmOptions&&t.fcmOptions.link||t.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 t.notification,delete t.fcmOptions,i=D(o.NOTIFICATION_CLICKED,t),[2,this.attemptToMessageClient_(r,i)]):[2]}}))}))},t.prototype.getNotificationData_=function(e){var t;if(e&&"object"===typeof e.notification){var n=Object(u.__assign)({},e.notification);return n.data=Object(u.__assign)({},e.notification.data,((t={}).FCM_MSG=e,t)),n}},t.prototype.setBackgroundMessageHandler=function(e){if(!e||"function"!==typeof e)throw h.create("bg-handler-function-expected");this.bgMessageHandler=e},t.prototype.getWindowClient_=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i;return Object(u.__generator)(this,(function(o){switch(o.label){case 0:return t=new URL(e,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===t){r=n[i];break}return[2,r]}}))}))},t.prototype.attemptToMessageClient_=function(e,t){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(n){if(!e)throw h.create("no-window-client-to-msg");return e.postMessage(t),[2]}))}))},t.prototype.hasVisibleClients_=function(){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(e){switch(e.label){case 0:return[4,A()];case 1:return[2,e.sent().some((function(e){return"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://")}))]}}))}))},t.prototype.sendMessageToWindowClients_=function(e){return Object(u.__awaiter)(this,void 0,void 0,(function(){var t,n,r=this;return Object(u.__generator)(this,(function(i){switch(i.label){case 0:return[4,A()];case 1:return t=i.sent(),n=D(o.PUSH_MSG_RECEIVED,e),[4,Promise.all(t.map((function(e){return r.attemptToMessageClient_(e,n)})))];case 2:return i.sent(),[2]}}))}))},t.prototype.getSWRegistration_=function(){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(e){return[2,self.registration]}))}))},t.prototype.getPublicVapidKey_=function(){return Object(u.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(u.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.getSWRegistration_()];case 1:if(!(e=n.sent()))throw h.create("sw-registration-expected");return[4,this.getVapidDetailsModel().getVapidFromSWScope(e.scope)];case 2:return null==(t=n.sent())?[2,f]:[2,t]}}))}))},t}(k);function A(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function D(e,t){var n;return(n={})[i.TYPE_OF_MSG]=e,n[i.DATA]=t,n}var R=function(e){function t(t){var n=e.call(this,t)||this;return n.registrationToUse=null,n.publicVapidKeyToUse=null,n.messageObserver=null,n.tokenRefreshObserver=null,n.onMessageInternal=Object(c.createSubscribe)((function(e){n.messageObserver=e})),n.onTokenRefreshInternal=Object(c.createSubscribe)((function(e){n.tokenRefreshObserver=e})),n.setupSWMessageListener_(),n}return Object(u.__extends)(t,e),t.prototype.requestPermission=function(){return Object(u.__awaiter)(this,void 0,void 0,(function(){var e;return Object(u.__generator)(this,(function(t){switch(t.label){case 0:return"granted"===this.getNotificationPermission_()?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(e=t.sent()))return[2];throw"denied"===e?h.create("permission-blocked"):h.create("permission-default")}}))}))},t.prototype.useServiceWorker=function(e){if(!(e instanceof ServiceWorkerRegistration))throw h.create("sw-registration-expected");if(null!=this.registrationToUse)throw h.create("use-sw-before-get-token");this.registrationToUse=e},t.prototype.usePublicVapidKey=function(e){if("string"!==typeof e)throw h.create("invalid-public-vapid-key");if(null!=this.publicVapidKeyToUse)throw h.create("use-public-key-before-get-token");var t=g(e);
1if(65!==t.length)throw h.create("public-vapid-key-decryption-failed");this.publicVapidKeyToUse=t},t.prototype.onMessage=function(e,t,n){return"function"===typeof e?this.onMessageInternal(e,t,n):this.onMessageInternal(e)},t.prototype.onTokenRefresh=function(e,t,n){return"function"===typeof e?this.onTokenRefreshInternal(e,t,n):this.onTokenRefreshInternal(e)},t.prototype.waitForRegistrationToActivate_=function(e){var t=e.installing||e.waiting||e.active;return new Promise((function(n,r){if(t)if("activated"!==t.state)if("redundant"!==t.state){t.addEventListener("statechange",(function i(){if("activated"===t.state)n(e);else{if("redundant"!==t.state)return;r(h.create("sw-reg-redundant"))}t.removeEventListener("statechange",i)}))}else r(h.create("sw-reg-redundant"));else n(e);else r(h.create("no-sw-in-reg"))}))},t.prototype.getSWRegistration_=function(){var e=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(e){throw h.create("failed-serviceworker-registration",{browserErrorMessage:e.message})})).then((function(t){return e.waitForRegistrationToActivate_(t).then((function(){return e.registrationToUse=t,t.update(),t}))})))},t.prototype.getPublicVapidKey_=function(){return Object(u.__awaiter)(this,void 0,void 0,(function(){return Object(u.__generator)(this,(function(e){return this.publicVapidKeyToUse?[2,this.publicVapidKeyToUse]:[2,f]}))}))},t.prototype.setupSWMessageListener_=function(){var e=this;navigator.serviceWorker.addEventListener("message",(function(t){if(t.data&&t.data[i.TYPE_OF_MSG]){var n=t.data;switch(n[i.TYPE_OF_MSG]){case o.PUSH_MSG_RECEIVED:case o.NOTIFICATION_CLICKED:var r=n[i.DATA];e.messageObserver&&e.messageObserver.next(r)}}}),!1)},t}(k);function O(e){var t={isSupported:P};e.INTERNAL.registerService("messaging",(function(e){if(!P())throw h.create("unsupported-browser");return self&&"ServiceWorkerGlobalScope"in self?new N(e):new R(e)}),t)}function P(){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")}O(s.a)},function(e,t,n){"use strict";n.r(t),n.d(t,"registerStorage",(function(){return nt}));var r=n(1),i=n.n(r),o=n(0),a="firebasestorage.googleapis.com",s="storageBucket",u=12e4,c=6e4,l=-9007199254740991,h=function(){function e(e,t){this.code_=p(e),this.message_="Firebase Storage: "+t,this.serverResponse_=null,this.name_="FirebaseError"}return e.prototype.codeProp=function(){return this.code},e.prototype.codeEquals=function(e){return p(e)===this.codeProp()},e.prototype.serverResponseProp=function(){return this.serverResponse_},e.prototype.setServerResponseProp=function(e){this.serverResponse_=e},Object.defineProperty(e.prototype,"name",{get:function(){return this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"code",{get:function(){return this.code_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this.message_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!0,configurable:!0}),e}(),f={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",INVA
1LID_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 p(e){return"storage/"+e}function d(){return new h(f.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function m(){return new h(f.CANCELED,"User canceled the upload/download.")}function y(){return new h(f.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function g(){return new h(f.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function v(e,t,n){return new h(f.INVALID_ARGUMENT,"Invalid argument in `"+t+"` at index "+e+": "+n)}function b(){return new h(f.APP_DELETED,"The Firebase app was deleted.")}function _(e,t){return new h(f.INVALID_FORMAT,"String does not match format '"+e+"': "+t)}function w(e){throw new h(f.INTERNAL_ERROR,"Internal error: "+e)}var E={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};function T(e){switch(e){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(e,t){this.data=e,this.contentType=t||null}}();function C(e,t){switch(e){case E.RAW:return new S(I(t));case E.BASE64:case E.BASE64URL:return new S(k(e,t));case E.DATA_URL:return new S(function(e){var t=new N(e);return t.base64?k(E.BASE64,t.rest):function(e){var t;try{t=decodeURIComponent(e)}catch(n){throw _(E.DATA_URL,"Malformed data URL.")}return I(t)}(t.rest)}(t),new N(t).contentType)}throw d()}function I(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<=127)t.push(r);else if(r<=2047)t.push(192|r>>6,128|63&r);else if(55296===(64512&r))if(n<e.length-1&&56320===(64512&e.charCodeAt(n+1)))r=65536|(1023&r)<<10|1023&e.charCodeAt(++n),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r);else t.push(239,191,189);else 56320===(64512&r)?t.push(239,191,189):t.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(t)}function k(e,t){switch(e){case E.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw _(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case E.BASE64URL:var i=-1!==t.indexOf("+"),o=-1!==t.indexOf("/");if(i||o)throw _(e,"Invalid character '"+(i?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var a;try{a=atob(t)}catch(c){throw _(e,"Invalid character found")}for(var s=new Uint8Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);return s}var N=function(){return function(e){this.base64=!1,this.contentType=null;var t=e.match(/^data:([^,]+)?,/);if(null===t)throw _(E.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n=t[1]||null;null!=n&&(this.base64=function(e,t){if(!(e.length>=t.length))return!1;return e.substring(e.length-t.length)===t}(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-";base64".length):n),this.rest=e.substring(e.indexOf(",")+1)}}();var A,D={STATE_CHANGED:"state_changed"},R={RUNNING:"running",PAUSING:"pausing",PAUSED:"paused",SUCCESS:"success",CANCELING:"canceling",CANCELED:"canceled",ERROR:"error"},O={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function P(e){switch(e){case R.RUNNING:case R.PAUSING:case R.CANCELING:return O.RUNNING;case R.PAUSED:return O.PAUSED;case R.SUCCESS:return O.SUCCESS;case R.CANCELED:return O.CANCELED;case R.ERROR:default:return O.ERROR}}function x(e){return null!=e}function M(e){return void 0!==e}function L(e){return"function"===typeof e}function F(e){return"object"===typeof e}function U(e){return F(e)&&null!==e}function q(e){return"string"===typeof e||e instanceof String}function V(e){return j(e)&&Number.isInteger(e)}function j(e){return"number"===typeof e||e instanceof Number}function B(e){return W()&&e instanceof Blob}function W(){return"undefined"!==typeof Blob}!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(A||(A={}));var Q=function(){function e(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=A.NO_ERROR,this.sendPromise_=new Promise((function(t){e.xhr_.addEventListener("abort",(function(){e.errorCode_=A.ABORT,t(e)})),e.xhr_.addEventListener("error",(function(){e.errorCode_=A.NETWORK_E
1RROR,t(e)})),e.xhr_.addEventListener("load",(function(){t(e)}))}))}return e.prototype.send=function(e,t,n,r){if(this.sent_)throw w("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),x(r))for(var i in r)r.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,r[i].toString());return x(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},e.prototype.getErrorCode=function(){if(!this.sent_)throw w("cannot .getErrorCode() before sending");return this.errorCode_},e.prototype.getStatus=function(){if(!this.sent_)throw w("cannot .getStatus() before sending");try{return this.xhr_.status}catch(e){return-1}},e.prototype.getResponseText=function(){if(!this.sent_)throw w("cannot .getResponseText() before sending");return this.xhr_.responseText},e.prototype.abort=function(){this.xhr_.abort()},e.prototype.getResponseHeader=function(e){return this.xhr_.getResponseHeader(e)},e.prototype.addUploadProgressListener=function(e){x(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",e)},e.prototype.removeUploadProgressListener=function(e){x(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",e)},e}(),K=function(){function e(){}return e.prototype.createXhrIo=function(){return new Q},e}();function z(){return"undefined"!==typeof BlobBuilder?BlobBuilder:"undefined"!==typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function H(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=z();if(void 0!==n){for(var r=new n,i=0;i<e.length;i++)r.append(e[i]);return r.getBlob()}if(W())return new Blob(e);throw Error("This browser doesn't seem to support creating Blobs")}var G=function(){function e(e,t){var n=0,r="";B(e)?(this.data_=e,n=e.size,r=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),n=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),n=e.length),this.size_=n,this.type_=r}return e.prototype.size=function(){return this.size_},e.prototype.type=function(){return this.type_},e.prototype.slice=function(t,n){if(B(this.data_)){var r=function(e,t,n){return e.webkitSlice?e.webkitSlice(t,n):e.mozSlice?e.mozSlice(t,n):e.slice?e.slice(t,n):null}(this.data_,t,n);return null===r?null:new e(r)}return new e(new Uint8Array(this.data_.buffer,t,n-t),!0)},e.getBlob=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(W()){var r=t.map((function(t){return t instanceof e?t.data_:t}));return new e(H.apply(null,r))}var i=t.map((function(e){return q(e)?C(E.RAW,e).data:e.data_})),o=0;i.forEach((function(e){o+=e.byteLength}));var a=new Uint8Array(o),s=0;return i.forEach((function(e){for(var t=0;t<e.length;t++)a[s++]=e[t]})),new e(a,!0)},e.prototype.uploadData=function(){return this.data_},e}(),Y=function(){function e(e,t){this.bucket=e,this.path_=t}return Object.defineProperty(e.prototype,"path",{get:function(){return this.path_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!0,configurable:!0}),e.prototype.fullServerUrl=function(){var e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)},e.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},e.makeFromBucketSpec=function(t){var n,r;try{n=e.makeFromUrl(t)}catch(i){return new e(t,"")}if(""===n.path)return n;throw r=t,new h(f.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+r+"'.")},e.makeFromUrl=function(t){var n=null;var r=new RegExp("^gs://([A-Za-z0-9.\\-_]+)(/(.*))?$","i");for(var i=a.replace(/[.]/g,"\\."),o=[{regex:r,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:new RegExp("^https?://"+i+"/v[A-Za-z0-9_]+/b/([A-Za-z0-9.\\-_]+)/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:function(e){e.path_=decodeURIComponent(e.path)}}],s=0;s<o.length;s++){var u=o[s],c=u.regex.exec(t);if(c){var l=c[u.indices.bucket],p=c[u.indices.path];p||(p=""),n=new e(l,p),u.postModify(n);break}}if(null==n)throw function(e){return new h(f.INVALID_URL,"Invalid URL '"+e+"'.")}(t);return n},e}();function X(e){var t,n;try{t=JSON.parse(e)}catch(r){return null}return F(n=t)&&!Array.isArray(n)?t:null}function J(e,t){var n=t.split("/").filter((function(e){return e.length>0})).join("/");return 0===e.length?n:e+"/"+n}function $(e){var t=e.lastIndexOf("/",e.length-2);return-1===t?e:e.slice(t+1)}function Z(e){return"https://"+a+"/v0"+e}function ee(e){var t=encodeURIComponent,n="?";for(var r in e){if(e.hasOwnProperty(r))n=n+(t(r)+"="+t(e[r]))+"&"}return n=n.slice(0,-1)}function te(e,t){return t}var ne=function(){return function(e,t,n,r){this.server=e,this.local=t||e,this.writable=!!n,this.xform=r||te}}(),re=null;function ie(){if(re)return re;var e=[];e.push(new ne("bucket")),e.push(new ne("generation")),e.push(new ne("metageneration")),e.push(new ne("name","fullPath",!0));var t=new ne("name");t.xform=function(e,t){return function(e){return!q(e)||e.length<2?e:$(e)}(t)},e.push(t);var n=new ne("size");return n.xform=function(e,t){return x(t)?Number(t):t},e.push(n),e.push(new ne("timeCreated")),e.push(new ne("updated")),e.push(new ne("md5Hash",null,!0)),e.push(new ne("cacheControl",null,!0)),e.push(new ne("contentDisposition",null,!0)),e.push(new ne("contentEncoding",null,!0)),e.push(new ne("contentLanguage",null,!0)),e.push(new ne("contentType",null,!0)),e.push(new ne("metadata","customMetadata",!0)),re=e}function oe(e,t,n){for(var r={type:"file"},i=n.length,o=0;o<i;o++){var a=n[o];r[a.local]=a.xform(r,t[a.server])}return function(e,t){Object.defineProperty(e,"ref",{get:function(){var n=e.bucket,r=e.fullPath,i=new Y(n,r);return t.makeStorageReference(i)}})}(r,e),r}function ae(e,t,n){var r=X(t);return null===r?null:oe(e,r,n)}function se(e,t){for(var n={},r=t.length,i=0;i<r;i++){var o=t[i];o.writable&&(n[o.server]=e[o.local])}return JSON.stringify(n)}function ue(e){if(!F(e)||!e)throw"Expected Metadata object.";for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];if("customMetadata"===t){if(!F(n))throw"Expected object for 'customMetadata' mapping."}else if(U(n))throw"Mapping for '"+t+"' cannot be an object."}}var ce="maxResults",le=1e3,he="pageToken",fe="prefixes",pe="items";function de(e,t){var n={prefixes:[],items:[],nextPageToken:t.nextPageToken},r=e.bucket();if(null===r)throw new h(f.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+s+"' property when initializing the app?");if(t[fe])for(var i=0,o=t[fe];i<o.length;i++){var a=o[i].replace(/\/$/,""),u=e.makeStorageReference(new Y(r,a));n.prefixes.push(u)}if(t[pe])for(var c=0,l=t[pe];c<l.length;c++){var p=l[c];u=e.makeStorageReference(new Y(r,p.name));n.items.push(u)}return n}function me(e){if(!F(e)||!e)throw"Expected ListOptions object.";for(var t in e)if(t===ce){if(!V(e[ce])||e[ce]<=0)throw"Expected maxResults to be a positive number.";if(e[ce]>1e3)throw"Expected maxResults to be less than or equal to "+le+"."}else{if(t!==he)throw"Unknown option: "+t;if(e[he]&&!q(e[he]))throw"Expected pageToken to be string."}}var ye=function(){return function(e,t,n,r){this.url=e,this.method=t,this.handler=n,this.timeout=r,this.urlParam
1s={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}();function ge(e){if(!e)throw d()}function ve(e,t){return function(n,r){var i=ae(e,r,t);return ge(null!==i),i}}function be(e){return function(t,n){var r=function(e,t){var n=X(t);return null===n?null:de(e,n)}(e,n);return ge(null!==r),r}}function _e(e,t){return function(n,r){var i=ae(e,r,t);return ge(null!==i),function(e,t){var n=X(t);if(null===n)return null;if(!q(n.downloadTokens))return null;var r=n.downloadTokens;if(0===r.length)return null;var i=encodeURIComponent;return r.split(",").map((function(t){var n=e.bucket,r=e.fullPath;return Z("/b/"+i(n)+"/o/"+i(r))+ee({alt:"media",token:t})}))[0]}(i,r)}}function we(e){return function(t,n){var r,i,o;return 401===t.getStatus()?r=new h(f.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(o=e.bucket,r=new h(f.QUOTA_EXCEEDED,"Quota for bucket '"+o+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(i=e.path,r=new h(f.UNAUTHORIZED,"User does not have permission to access '"+i+"'.")):r=n,r.setServerResponseProp(n.serverResponseProp()),r}}function Ee(e){var t=we(e);return function(n,r){var i,o=t(n,r);return 404===n.getStatus()&&(i=e.path,o=new h(f.OBJECT_NOT_FOUND,"Object '"+i+"' does not exist.")),o.setServerResponseProp(r.serverResponseProp()),o}}function Te(e,t,n){var r=Z(t.fullServerUrl()),i=e.maxOperationRetryTime(),o=new ye(r,"GET",ve(e,n),i);return o.errorHandler=Ee(t),o}function Se(e,t,n,r,i){var o={};t.isRoot?o.prefix="":o.prefix=t.path+"/",n&&n.length>0&&(o.delimiter=n),r&&(o.pageToken=r),i&&(o.maxResults=i);var a=Z(t.bucketOnlyServerUrl()),s=e.maxOperationRetryTime(),u=new ye(a,"GET",be(e),s);return u.urlParams=o,u.errorHandler=we(t),u}function Ce(e,t,n){var r=Z(t.fullServerUrl()),i=e.maxOperationRetryTime(),o=new ye(r,"GET",_e(e,n),i);return o.errorHandler=Ee(t),o}function Ie(e,t,n,r){var i=Z(t.fullServerUrl()),o=se(n,r),a=e.maxOperationRetryTime(),s=new ye(i,"PATCH",ve(e,r),a);return s.headers={"Content-Type":"application/json; charset=utf-8"},s.body=o,s.errorHandler=Ee(t),s}function ke(e,t){var n=Z(t.fullServerUrl()),r=e.maxOperationRetryTime();var i=new ye(n,"DELETE",(function(e,t){}),r);return i.successCodes=[200,204],i.errorHandler=Ee(t),i}function Ne(e,t,n){var r=Object.assign({},n);return r.fullPath=e.path,r.size=t.size(),r.contentType||(r.contentType=function(e,t){return e&&e.contentType||t&&t.type()||"application/octet-stream"}(null,t)),r}var Ae=function(){return function(e,t,n,r){this.current=e,this.total=t,this.finalized=!!n,this.metadata=r||null}}();function De(e,t){var n=null;try{n=e.getResponseHeader("X-Goog-Upload-Status")}catch(r){ge(!1)}return ge(!!n&&-1!==(t||["active"]).indexOf(n)),n}function Re(e,t,n,r,i,o,a,s){var u=new Ae(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 h(f.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 p=u.current,d=p+l,m={"X-Goog-Upload-Command":l===c?"upload, finalize":"upload","X-Goog-Upload-Offset":u.current},g=r.slice(p,d);if(null===g)throw y();var v=t.maxUploadRetryTime(),b=new ye(n,"POST",(function(e,n){var i,a=De(e,["active","final"]),s=u.current+l,c=r.size();return i="final"===a?ve(t,o)(e,n):null,new Ae(s,c,"final"===a,i)}),v);return b.headers=m,b.body=g.uploadData(),b.progressCallback=s||null,b.errorHandler=we(e),b}var Oe=function(){return function(e,t,n){if(L(e)||x(t)||x(n))this.next=e,this.error=t||null,this.complete=n||null;else{var r=e;this.next=r.next||null,this.error=r.error||null,this.complete=r.complete||null}}}(),Pe=function(){return function(e,t,n,r,i,o){this.bytesTransferred=e,this.totalBytes=t,this.state=n,this.metadata=r,this.task=i,this.ref=o}}();function xe(e,t,n){for(var r=t.length,i=t.length,o=0;o<t.length;o++)if(t[o].optional){r=o;break}if(!(r<=n.length&&n.length<=i))throw function(e,t,n,r){var i,o;return e===t?(i=e,o=1===e?"argument":"arguments"):(i="between "+e+" and "+t,o="arguments"),new h(f.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+n+"`: Expected "+i+" "+o+", received "+r+".")}(r,i,e,n.length);for(o=0;o<n.length;o++)try{t[o].validator(n[o])}catch(a){throw a instanceof Error?v(o,e,a.message):v(o,e,a)}}var Me=function(){return function(e,t){var n=this;this.validator=function(t){n.optional&&!M(t)||e(t)},this.optional=!!t}}();function Le(e,t){function n(e){if(!q(e))throw"Expected string."}var r,i,o;return e?(i=n,o=e,r=function(e){i(e),o(e)}):r=n,new Me(r,t)}function Fe(){return new Me((function(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer||W()&&e instanceof Blob))throw"Expected Blob or File."}))}function Ue(e){return new Me(ue,e)}function qe(e){return new Me(me,e)}function Ve(){return new Me((function(e){if(!(j(e)&&e>=0))throw"Expected a number 0 or greater."}))}function je(e,t){return new Me((function(t){if(!(null===t||x(t)&&t instanceof Object))throw"Expected an Object.";void 0!==e&&null!==e&&e(t)}),t)}function Be(e){return new Me((function(e){if(!(null===e||L(e)))throw"Expected a Function."}),e)}function We(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];Promise.resolve().then((function(){return e.apply(void 0,t)}))}}var Qe=function(){function e(e,t,n,r,i,o){var a=this;void 0===o&&(o=null),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_=e,this.authWrapper_=t,this.location_=n,this.blob_=i,this.metadata_=o,this.mappings_=r,this.resumable_=this.shouldDoResumable_(this.blob_),this.state_=R.RUNNING,this.errorHandler_=function(e){a.request_=null,a.chunkMultiplier_=1,e.codeEquals(f.CANCELED)?(a.needToFetchStatus_=!0,a.completeTransitions_()):(a.error_=e,a.transition_(R.ERROR))},this.metadataErrorHandler_=function(e){a.request_=null,e.codeEquals(f.CANCELED)?a.completeTransitions_():(a.error_=e,a.transition_(R.ERROR))},this.promise_=new Promise((function(e,t){a.resolve_=e,a.reject_=t,a.start_()}
1)),this.promise_.then(null,(function(){}))}return e.prototype.makeProgressCallback_=function(){var e=this,t=this.transferred_;return function(n){return e.updateProgress_(t+n)}},e.prototype.shouldDoResumable_=function(e){return e.size()>262144},e.prototype.start_=function(){this.state_===R.RUNNING&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},e.prototype.resolveToken_=function(e){var t=this;this.authWrapper_.getAuthToken().then((function(n){switch(t.state_){case R.RUNNING:e(n);break;case R.CANCELING:t.transition_(R.CANCELED);break;case R.PAUSING:t.transition_(R.PAUSED)}}))},e.prototype.createResumable_=function(){var e=this;this.resolveToken_((function(t){var n=function(e,t,n,r,i){var o=t.bucketOnlyServerUrl(),a=Ne(t,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=se(a,n),h=e.maxUploadRetryTime(),f=new ye(u,"POST",(function(e){var t;De(e);try{t=e.getResponseHeader("X-Goog-Upload-URL")}catch(n){ge(!1)}return ge(q(t)),t}),h);return f.urlParams=s,f.headers=c,f.body=l,f.errorHandler=we(t),f}(e.authWrapper_,e.location_,e.mappings_,e.blob_,e.metadata_),r=e.authWrapper_.makeRequest(n,t);e.request_=r,r.getPromise().then((function(t){e.request_=null,e.uploadUrl_=t,e.needToFetchStatus_=!1,e.completeTransitions_()}),e.errorHandler_)}))},e.prototype.fetchStatus_=function(){var e=this,t=this.uploadUrl_;this.resolveToken_((function(n){var r=function(e,t,n,r){var i=e.maxUploadRetryTime(),o=new ye(n,"POST",(function(e){var t=De(e,["active","final"]),n=null;try{n=e.getResponseHeader("X-Goog-Upload-Size-Received")}catch(o){ge(!1)}n||ge(!1);var i=Number(n);return ge(!isNaN(i)),new Ae(i,r.size(),"final"===t)}),i);return o.headers={"X-Goog-Upload-Command":"query"},o.errorHandler=we(t),o}(e.authWrapper_,e.location_,t,e.blob_),i=e.authWrapper_.makeRequest(r,n);e.request_=i,i.getPromise().then((function(t){t=t,e.request_=null,e.updateProgress_(t.current),e.needToFetchStatus_=!1,t.finalized&&(e.needToFetchMetadata_=!0),e.completeTransitions_()}),e.errorHandler_)}))},e.prototype.continueUpload_=function(){var e=this,t=262144*this.chunkMultiplier_,n=new Ae(this.transferred_,this.blob_.size()),r=this.uploadUrl_;this.resolveToken_((function(i){var o;try{o=Re(e.location_,e.authWrapper_,r,e.blob_,t,e.mappings_,n,e.makeProgressCallback_())}catch(s){return e.error_=s,void e.transition_(R.ERROR)}var a=e.authWrapper_.makeRequest(o,i);e.request_=a,a.getPromise().then((function(t){e.increaseMultiplier_(),e.request_=null,e.updateProgress_(t.current),t.finalized?(e.metadata_=t.metadata,e.transition_(R.SUCCESS)):e.completeTransitions_()}),e.errorHandler_)}))},e.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},e.prototype.fetchMetadata_=function(){var e=this;this.resolveToken_((function(t){var n=Te(e.authWrapper_,e.location_,e.mappings_),r=e.authWrapper_.makeRequest(n,t);e.request_=r,r.getPromise().then((function(t){e.request_=null,e.metadata_=t,e.transition_(R.SUCCESS)}),e.metadataErrorHandler_)}))},e.prototype.oneShotUpload_=function(){var e=this;this.resolveToken_((function(t){var n=function(e,t,n,r,i){var o=t.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},s=function(){for(var e="",t=0;t<2;t++)e+=Math.random().toString().slice(2);return e}();a["Content-Type"]="multipart/related; boundary="+s;var u=Ne(t,r,i),c="--"+s+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+se(u,n)+"\r\n--"+s+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",l="\r\n--"+s+"--",h=G.getBlob(c,r,l);if(null===h)throw y();var f={name:u.fullPath},p=Z(o),d=e.maxUploadRetryTime(),m=new ye(p,"POST",ve(e,n),d);return m.urlParams=f,m.headers=a,m.body=h.uploadData(),m.errorHandler=we(t),m}(e.authWrapper_,e.location_,e.mappings_,e.blob_,e.metadata_),r=e.authWrapper_.makeRequest
1(n,t);e.request_=r,r.getPromise().then((function(t){e.request_=null,e.metadata_=t,e.updateProgress_(e.blob_.size()),e.transition_(R.SUCCESS)}),e.errorHandler_)}))},e.prototype.updateProgress_=function(e){var t=this.transferred_;this.transferred_=e,this.transferred_!==t&&this.notifyObservers_()},e.prototype.transition_=function(e){if(this.state_!==e)switch(e){case R.CANCELING:case R.PAUSING:this.state_=e,null!==this.request_&&this.request_.cancel();break;case R.RUNNING:var t=this.state_===R.PAUSED;this.state_=e,t&&(this.notifyObservers_(),this.start_());break;case R.PAUSED:this.state_=e,this.notifyObservers_();break;case R.CANCELED:this.error_=m(),this.state_=e,this.notifyObservers_();break;case R.ERROR:case R.SUCCESS:this.state_=e,this.notifyObservers_()}},e.prototype.completeTransitions_=function(){switch(this.state_){case R.PAUSING:this.transition_(R.PAUSED);break;case R.CANCELING:this.transition_(R.CANCELED);break;case R.RUNNING:this.start_()}},Object.defineProperty(e.prototype,"snapshot",{get:function(){var e=P(this.state_);return new Pe(this.transferred_,this.blob_.size(),e,this.metadata_,this,this.ref_)},enumerable:!0,configurable:!0}),e.prototype.on=function(e,t,n,r){function i(){if(e!==D.STATE_CHANGED)throw"Expected one of the event types: ["+D.STATE_CHANGED+"]."}var o="Expected a function or an Object with one of `next`, `error`, `complete` properties.",a=Be(!0).validator,s=je(null,!0).validator;function u(e){try{return void a(e)}catch(t){}try{if(s(e),!(M(e.next)||M(e.error)||M(e.complete)))throw"";return}catch(t){throw o}}var c=[Le(i),je(u,!0),Be(!0),Be(!0)];xe("on",c,arguments);var l=this;function h(e){return function(t,n,i){null!==e&&xe("on",e,arguments);var o=new Oe(t,n,r);return l.addObserver_(o),function(){l.removeObserver_(o)}}}function f(e){if(null===e)throw o;u(e)}var p=[je(f),Be(!0),Be(!0)],d=!(M(t)||M(n)||M(r));return d?h(p):h(null)(t,n,r)},e.prototype.then=function(e,t){return this.promise_.then(e,t)},e.prototype.catch=function(e){return this.then(null,e)},e.prototype.addObserver_=function(e){this.observers_.push(e),this.notifyObserver_(e)},e.prototype.removeObserver_=function(e){var t=this.observers_.indexOf(e);-1!==t&&this.observers_.splice(t,1)},e.prototype.notifyObservers_=function(){var e=this;this.finishPromise_(),this.observers_.slice().forEach((function(t){e.notifyObserver_(t)}))},e.prototype.finishPromise_=function(){if(null!==this.resolve_){var e=!0;switch(P(this.state_)){case O.SUCCESS:We(this.resolve_.bind(null,this.snapshot))();break;case O.CANCELED:case O.ERROR:We(this.reject_.bind(null,this.error_))();break;default:e=!1}e&&(this.resolve_=null,this.reject_=null)}},e.prototype.notifyObserver_=function(e){switch(P(this.state_)){case O.RUNNING:case O.PAUSED:e.next&&We(e.next.bind(e,this.snapshot))();break;case O.SUCCESS:e.complete&&We(e.complete.bind(e))();break;case O.CANCELED:case O.ERROR:e.error&&We(e.error.bind(e,this.error_))();break;default:e.error&&We(e.error.bind(e,this.error_))()}},e.prototype.resume=function(){xe("resume",[],arguments);var e=this.state_===R.PAUSED||this.state_===R.PAUSING;return e&&this.transition_(R.RUNNING),e},e.prototype.pause=function(){xe("pause",[],arguments);var e=this.state_===R.RUNNING;return e&&this.transition_(R.PAUSING),e},e.prototype.cancel=function(){xe("cancel",[],arguments);var e=this.state_===R.RUNNING||this.state_===R.PAUSING;return e&&this.transition_(R.CANCELING),e},e}(),Ke=function(){function e(e,t){this.authWrapper=e,this.location=t instanceof Y?t:Y.makeFromUrl(t)}return e.prototype.toString=function(){return xe("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},e.prototype.newRef=function(t,n){return new e(t,n)},e.prototype.mappings=function(){return ie()},e.prototype.child=function(e){xe("child",[Le()],arguments);var t=J(this.location.path,e),n=new Y(this.location.bucket,t);return this.newRef(this.authWrapper,n)},Object.defineProperty(e.prototype,"parent",{get:function(){var e=function(e){if(0===e.length)return null;var t=e.lastIndexOf("/");return-1===t?"":e.slice(0,t)}(this.location.path);if(null===e)return null;var t=new Y(this.location.bucket,e);return this.newRef(this.authWrapper,t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){var e=new Y(this.location.bucket,"");return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return $(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),e.prototype.put=function(e,t){return void 0===t&&(t=null),xe("put",[Fe(),Ue(!0)],arguments),this.throwIfRoot_("put"),new Qe(this,this.authWrapper,this.location,this.mappings(),new G(e),t)},e.prototype.putString=function(e,t,n){void 0===t&&(t=E.RAW),xe("putString",[Le(),Le(T,!0),Ue(!0)],arguments),this.throwIfRoot_("putString");var r=C(t,e),i=Object.assign({},n);return!x(i.contentType)&&x(r.contentType)&&(i.contentType=r.contentType),new Qe(this,this.authWrapper,this.location,this.mappings(),new G(r.data,!0),i)},e.prototype.delete=function(){var e=this;return xe("delete",[],arguments),this.throwIfRoot_("delete"),this.authWrapper.getAuthToken().then((function(t){var n=ke(e.authWrapper,e.location);
1return e.authWrapper.makeRequest(n,t).getPromise()}))},e.prototype.listAll=function(){xe("listAll",[],arguments);var e={prefixes:[],items:[]};return this.listAllHelper(e).then((function(){return e}))},e.prototype.listAllHelper=function(e,t){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,r,i,a;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return n={pageToken:t},[4,this.list(n)];case 1:return r=o.sent(),(i=e.prefixes).push.apply(i,r.prefixes),(a=e.items).push.apply(a,r.items),null==r.nextPageToken?[3,3]:[4,this.listAllHelper(e,r.nextPageToken)];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},e.prototype.list=function(e){xe("list",[qe(!0)],arguments);var t=this;return this.authWrapper.getAuthToken().then((function(n){var r=e||{},i=Se(t.authWrapper,t.location,"/",r.pageToken,r.maxResults);return t.authWrapper.makeRequest(i,n).getPromise()}))},e.prototype.getMetadata=function(){var e=this;return xe("getMetadata",[],arguments),this.throwIfRoot_("getMetadata"),this.authWrapper.getAuthToken().then((function(t){var n=Te(e.authWrapper,e.location,e.mappings());return e.authWrapper.makeRequest(n,t).getPromise()}))},e.prototype.updateMetadata=function(e){var t=this;return xe("updateMetadata",[Ue()],arguments),this.throwIfRoot_("updateMetadata"),this.authWrapper.getAuthToken().then((function(n){var r=Ie(t.authWrapper,t.location,e,t.mappings());return t.authWrapper.makeRequest(r,n).getPromise()}))},e.prototype.getDownloadURL=function(){var e=this;return xe("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL"),this.authWrapper.getAuthToken().then((function(t){var n=Ce(e.authWrapper,e.location,e.mappings());return e.authWrapper.makeRequest(n,t).getPromise().then((function(e){if(null===e)throw g();return e}))}))},e.prototype.throwIfRoot_=function(e){if(""===this.location.path)throw function(e){return new h(f.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(e)},e}(),ze=function(){function e(e){this.promise_=Promise.reject(e)}return e.prototype.getPromise=function(){return this.promise_},e.prototype.cancel=function(e){},e}(),He=function(){function e(){this.map=new Map,this.id=l}return e.prototype.addRequest=function(e){var t=this,n=this.id;this.id++,this.map.set(n,e),e.getPromise().then((function(){return t.map.delete(n)}),(function(){return t.map.delete(n)}))},e.prototype.clear=function(){this.map.forEach((function(e){e&&e.cancel(!0)})),this.map.clear()},e}(),Ge=function(){function e(t,n,r,i,o){if(this.bucket_=null,this.deleted_=!1,this.app_=t,null!==this.app_){var a=this.app_.options;x(a)&&(this.bucket_=e.extractBucket_(a))}this.storageRefMaker_=n,this.requestMaker_=r,this.pool_=o,this.service_=i,this.maxOperationRetryTime_=u,this.maxUploadRetryTime_=c,this.requestMap_=new He}return e.extractBucket_=function(e){var t=e[s]||null;return null==t?null:Y.makeFromBucketSpec(t).bucket},e.prototype.getAuthToken=function(){return null!==this.app_&&x(this.app_.INTERNAL)&&x(this.app_.INTERNAL.getToken)?this.app_.INTERNAL.getToken().then((function(e){return null!==e?e.accessToken:null}),(function(){return null})):Promise.resolve(null)},e.prototype.bucket=function(){if(this.deleted_)throw b();return this.bucket_},e.prototype.service=function(){return this.service_},e.prototype.makeStorageReference=function(e){return this.storageRefMaker_(this,e)},e.prototype.makeRequest=function(e,t){if(this.deleted_)return new ze(b());var n=this.requestMaker_(e,t,this.pool_);return this.requestMap_.addRequest(n),n},e.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requestMap_.clear()},e.prototype.maxUploadRetryTime=function(){return this.maxUploadRetryTime_},e.prototype.setMaxUploadRetryTime=function(e){this.maxUploadRetryTime_=e},e.prototype.maxOperationRetryTime=function(){return this.maxOperationRetryTime_},e.prototype.setMaxOperationRetryTime=function(e){this.maxOperationRetryTime_=e},e}();var Ye=function(){function e(e,t,n,r,i,o,a,s,u,c,l){var h=this;this.pendingXhr_=null,this.backoffId_=null,this.resolve_=null,this.reject_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=e,this.method_=t,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,this.promise_=new Promise((function(e,t){h.resolve_=e,h.reject_=t,h.start_()}
1))}return e.prototype.start_=function(){var e=this;function t(t,n){var r,i=e.resolve_,o=e.reject_,a=n.xhr;if(n.wasSuccessCode)try{var s=e.callback_(a,a.getResponseText());M(s)?i(s):i()}catch(u){o(u)}else null!==a?((r=d()).setServerResponseProp(a.getResponseText()),e.errorCallback_?o(e.errorCallback_(a,r)):o(r)):n.canceled?o(r=e.appDelete_?b():m()):o(r=new h(f.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again."))}this.canceled_?t(0,new Xe(!1,null,!0)):this.backoffId_=function(e,t,n){var r=1,i=null,o=!1,a=0;function s(){return 2===a}var u=!1;function c(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];u||(u=!0,t.apply(null,e))}function l(t){i=setTimeout((function(){i=null,e(h,s())}),t)}function h(e){for(var t,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];u||(e?c.call.apply(c,[null,e].concat(n)):s()||o?c.call.apply(c,[null,e].concat(n)):(r<64&&(r*=2),1===a?(a=2,t=0):t=1e3*(r+Math.random()),l(t)))}var f=!1;function p(e){f||(f=!0,u||(null!==i?(e||(a=2),clearTimeout(i),l(0)):e||(a=1)))}return l(0),setTimeout((function(){o=!0,p(!0)}),n),p}((function(t,n){if(n)t(!1,new Xe(!1,null,!0));else{var r=e.pool_.createXhrIo();e.pendingXhr_=r,null!==e.progressCallback_&&r.addUploadProgressListener(i),r.send(e.url_,e.method_,e.body_,e.headers_).then((function(n){null!==e.progressCallback_&&n.removeUploadProgressListener(i),e.pendingXhr_=null;var r=(n=n).getErrorCode()===A.NO_ERROR,o=n.getStatus();if(r&&!e.isRetryStatusCode_(o)){var a=-1!==e.successCodes_.indexOf(o);t(!0,new Xe(a,n))}else{var s=n.getErrorCode()===A.ABORT;t(!1,new Xe(!1,null,s))}}))}function i(t){var n=t.loaded,r=t.lengthComputable?t.total:-1;null!==e.progressCallback_&&e.progressCallback_(n,r)}}),t,this.timeout_)},e.prototype.getPromise=function(){return this.promise_},e.prototype.cancel=function(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingXhr_&&this.pendingXhr_.abort()},e.prototype.isRetryStatusCode_=function(e){var t=e>=500&&e<600,n=-1!==[408,429].indexOf(e),r=-1!==this.additionalRetryCodes_.indexOf(e);return t||n||r},e}(),Xe=function(){return function(e,t,n){this.wasSuccessCode=e,this.xhr=t,this.canceled=!!n}}();function Je(e,t,n){var r=ee(e.urlParams),o=e.url+r,a=Object.assign({},e.headers);return function(e,t){null!==t&&t.length>0&&(e.Authorization="Firebase "+t)}(a,t),function(e){var t="undefined"!==typeof i.a?i.a.SDK_VERSION:"AppManager";e["X-Firebase-Storage-Version"]="webjs/"+t}(a),new Ye(o,e.method,a,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,n)}var $e=function(){function e(e,t,n){if(this.bucket_=null,this.authWrapper_=new Ge(e,(function(e,t){return new Ke(e,t)}),Je,this,t),this.app_=e,null!=n)this.bucket_=Y.makeFromBucketSpec(n);else{var r=this.authWrapper_.bucket();null!=r&&(this.bucket_=new Y(r,""))}this.internals_=new Ze(this)}return e.prototype.ref=function(e){function t(e){if("string"!==typeof e)throw"Path is not a string.";if(/^[A-Za-z]+:\/\//.test(e))throw"Expected child path but got a URL, use refFromURL instead."}if(xe("ref",[Le(t,!0)],arguments),null==this.bucket_)throw new Error("No Storage Bucket defined in Firebase Options.");var n=new Ke(this.authWrapper_,this.bucket_);return null!=e?n.child(e):n},e.prototype.refFromURL=function(e){function t(e){if("string"!==typeof e)throw"Path is not a string.";if(!/^[A-Za-z]+:\/\//.test(e))throw"Expected full URL but got a child path, use ref instead.";try{Y.makeFromUrl(e)}catch(t){throw"Expected valid full URL but got an invalid one."}}return xe("refFromURL",[Le(t,!1)],arguments),new Ke(this.authWrapper_,e)},Object.defineProperty(e.prototype,"maxUploadRetryTime",{get:function(){return this.authWrapper_.maxUploadRetryTime()},enumerable:!0,configurable:!0}),e.prototype.setMaxUploadRetryTime=function(e){xe("setMaxUploadRetryTime",[Ve()],arguments),this.authWrapper_.setMaxUploadRetryTime(e)},e.prototype.setMaxOperationRetryTime=function(e){xe("setMaxOperationRetryTime",[Ve()],arguments),this.authWrapper_.setMaxOperationRetryTime(e)},Object.defineProperty(e.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!0,configurable:!0}),e}(),Ze=function(){function e(e){this.service_=e}return e.prototype.delete=function(){return this.service_.authWrapper_.deleteApp(),Promise.resolve()},e}(),et="storage";function tt(e,t,n){return new $e(e,new K,n)}function nt(e){var t={TaskState:O,TaskEvent:D,StringFormat:E,Storage:$e,Reference:Ke};e.INTERNAL.registerService(et,tt,t,void 0,!0)}nt(i.a)},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0});var r,i=(r=n(1))&&"object"===typeof r&&"default"in r?r.default:r,o=n(0),a=n(3);n(25);var s,u,c,l,h=n(4),f="0.2.18",p="FB-PERF-TRACE-START",d="FB-PERF-TRACE-STOP",m="FB-PERF-TRACE-MEASURE",y="_wt_",g="@firebase/performance/config",v="@firebase/performance/configexpire",b=((s={})["trace started"]="Trace {$traceName} was started before.",s["trace stopped"]="Trace {$traceName} is not running.",s["no window"]="Window is not available.",s["no app id"]="App id is not available.",s["no project id"]="Project id is not available.",s["no api key"]="Api key is not available.",s["invalid cc log"]="Attempted to queue invalid cc event",s["FB not default"]="Performance can only start when Firebase app instance is the default one.",s["RC response not ok"]="RC response is not ok",s["invalid attribute name"]="Attribute name {$attributeName} is invalid.",s["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",s["invalide custom metric name"]="Custom metric name {$customMetricName} is invalid",s),_=new a.ErrorFactory("performance","Performance",b),w=function(){function e(e){if(!e)throw _.create("no window");this.performance=e.performance,this.PerformanceObserver=e.PerformanceObserver,this.windowLocation=e.location,this.navigator=e.navigator,this.document=e.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=e.localStorage),e.perfMetrics&&e.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=e.perfMetrics.onFirstInputDelay)}return e.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},e.prototype.mark=function(e){this.performance&&this.performance.mark&&this.performance.mark(e)},e.prototype.measure=function(e,t,n){this.performance&&this.performance.measure&&this.performance.measure(e,t,n)},e.prototype.getEntriesByType=function(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]},e.prototype.getEntriesByName=function(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]},e.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},e.prototype.requiredApisAvailable=function(){return!!(fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled)},e.prototype.setupObserver=function(e,t){this.PerformanceObserver&&new this.PerformanceObserver((function(e){for(var n=0,r=e.getEntries();n<r.length;n++){var i=r[n];t(i)}})).observe({entryTypes:[e]})},e.getInstance=function(){return void 0===u&&(u=new e(c)),u},e}();var E,T,S=function(){function e(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}return e.prototype.getAppId=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!e)throw _.create("no app id");return e},e.prototype.getProjectId=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!e)throw _.create("no project id");return e},e.prototype.getApiKey=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!e)throw _.create("no api key");return e},e.getInstance=function(){return void 0===l&&(l=new e),l},e}();function C(){return E}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.VISIBLE=1]="VISIBLE",e[e.HIDDEN=2]="HIDDEN",e[e.PRERENDER=3]="PRERENDER",e[e.UNLOADED=4]="UNLOADED"}(T||(T={}));var I=["firebase_","google_","ga_"],k=new RegExp("^[a-zA-Z]\\w*$"),N=40,A=100;function D(){var e=w.getInstance().navigator;return"serviceWorker"in e?e.serviceWorker.controller?2:3:1}function R(){switch(w.getInstance().document.visibilityState){case"visible":return T.VISIBLE;case"hidden":return T.HIDDEN;case"prerender":return T.PRERENDER;default:return T.UNKNOWN}}function O(){var e=w.getInstance().navigator.connection;switch(e&&e.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}var P=new h.Logger("Performance");P.logLevel=h.LogLevel.INFO;var x="0.0.1",M={loggingEnabled:!0},L="FIREBASE_INSTALLATIONS_AUTH";function F(e){var t=function(){var e=w.getInstance().localStorage,t=e.getItem(v);if(!t||(n=t,!(Number(n)>Date.now())))return;var n;var r=e.getItem(g);if(!r)return;try{return JSON.parse(r)}catch(s){return}}();return t?(q(t),Promise.resolve()):function(e){return function(){var e=S.getInstance().firebaseAppInstance.installations().getToken();return e.then((function(e){})),e}().then((function(t){var n="https://firebaseremoteconfig.googleapis.com/v1/projects/"+S.getInstance().getProjectId()+"/namespaces/fireperf:fetch?ke
1y="+S.getInstance().getApiKey(),r=new Request(n,{method:"POST",headers:{Authorization:L+" "+t},body:JSON.stringify({app_instance_id:e,app_instance_id_token:t,app_id:S.getInstance().getAppId(),app_version:f,sdk_version:x})});return fetch(r).then((function(e){if(e.ok)return e.json();throw _.create("RC response not ok")}))})).catch((function(){P.info(U)}))}(e).then((function(e){return q(e)})).then((function(e){return function(e){if(!e)return;var t=w.getInstance().localStorage;t.setItem(g,JSON.stringify(e)),t.setItem(v,String(Date.now()+60*S.getInstance().configTimeToLive*60*1e3))}(e)}),(function(){}))}var U="Could not fetch config, will use default configs";function q(e){if(!e)return e;var t=S.getInstance(),n=e.entries||{};return void 0!==n.fpr_enabled?t.loggingEnabled="true"===String(n.fpr_enabled):t.loggingEnabled=M.loggingEnabled,n.fpr_log_source&&(t.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(t.logEndPointUrl=n.fpr_log_endpoint_url),void 0!==n.fpr_vc_network_request_sampling_rate&&(t.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(t.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),t.logTraceAfterSampling=V(t.tracesSamplingRate),t.logNetworkAfterSampling=V(t.networkRequestsSamplingRate),e}function V(e){return Math.random()<=e}var j,B=1;function W(){return B=2,j=j||function(){var e=w.getInstance().document;return new Promise((function(t){e&&"complete"!==e.readyState?e.addEventListener("readystatechange",(function n(){"complete"===e.readyState&&(e.removeEventListener("readystatechange",n),t())})):t()}))}().then((function(){return function(){var e=S.getInstance().firebaseAppInstance.installations().getId();return e.then((function(e){E=e})),e}()})).then((function(e){return F(e)})).then((function(){return Q()}),(function(){return Q()}))}function Q(){B=3}var K,z=1e4,H=3,G=H,Y=[];function X(e){if(!e.eventTime||!e.message)throw _.create("invalid cc log");Y=Y.concat([e])}function J(){if(K)return K;var e=function(e){return function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=e.apply(void 0,r);X({message:o,eventTime:Date.now()})}}(ee);return(K=new h.Logger("@firebase/performance/cc")).logHandler=e,K}function $(e){var t=S.getInstance();!t.instrumentationEnabled&&e.isAuto||(t.dataCollectionEnabled||e.isAuto)&&w.getInstance().requiredApisAvailable()&&(e.isAuto&&R()!==T.VISIBLE||t.loggingEnabled&&t.logTraceAfterSampling&&(3===B?Z(e):W().then((function(){return Z(e)}),(function(){return Z(e)}))))}function Z(e){C()&&setTimeout((function(){return J().log(e,1)}),0)}function ee(e,t){return 0===t?function(e){var t={url:e.url,http_method:e.httpMethod||0,http_response_code:200,response_payload_bytes:e.responsePayloadBytes,client_start_time_us:e.startTimeUs,time_to_response_initiated_us:e.timeToResponseInitiatedUs,time_to_response_completed_us:e.timeToResponseCompletedUs},n={application_info:te(),network_request_metric:t};return JSON.stringify(n)}(e):function(e){var t={name:e.name,is_auto:e.isAuto,client_start_time_us:e.startTimeUs,duration_us:e.durationUs};0!==Object.keys(e.counters).length&&(t.counters=ne(e.counters));var n=e.getAttributes();0!==Object.keys(n).length&&(t.custom_attributes=ne(n));var r={application_info:te(),trace_metric:t};return JSON.stringify(r)}(e)}function te(){return{google_app_id:S.getInstance().getAppId(),app_instance_id:C(),web_app_info:{sdk_version:f,page_url:w.getInstance().getUrl(),service_worker_status:D(),visibility_state:R(),effective_connection_type:O()},application_process_state:0}}function ne(e){return Object.keys(e).map((function(t){return{key:t,value:e[t]}}))}!function e(t){setTimeout((function(){if(0!==G){if(!Y.length)return e(z);var t=Y.slice();Y=[];var n=t.map((function(e){return{source_extension_json:e.message,event_time_ms:String(e.eventTime)}})),r={request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:S.getInstance().logSource,log_event:n};fetch(S.getInstance().logEndPointUrl,{method:"POST",body:JSON.stringify(r)}).then((function(e){return e.ok||P.info("Call to Firebase backend failed."),e.json()}
1)).then((function(t){var n=Number(t.next_request_wait_millis),r=isNaN(n)?z:Math.max(z,n);G=H,e(r)})).catch((function(){Y=t.concat(Y),G--,P.info("Tries left: "+G+"."),e(z)}))}}),t)}(5500);var re=100,ie="_",oe=["_fp","_fcp","_fid"];var ae=function(){function e(e,t,n){void 0===t&&(t=!1),this.name=e,this.isAuto=t,this.state=1,this.customAttributes={},this.counters={},this.api=w.getInstance(),this.randomId=Math.floor(1e6*Math.random()),this.isAuto||(this.traceStartMark=p+"-"+this.randomId+"-"+this.name,this.traceStopMark=d+"-"+this.randomId+"-"+this.name,this.traceMeasure=n||m+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}return e.prototype.start=function(){if(1!==this.state)throw _.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},e.prototype.stop=function(){if(2!==this.state)throw _.create("trace stopped",{traceName:this.name});this.state=3,this.api.mark(this.traceStopMark),this.api.measure(this.traceMeasure,this.traceStartMark,this.traceStopMark),this.calculateTraceMetrics(),$(this)},e.prototype.record=function(e,t,n){if(this.durationUs=Math.floor(1e3*t),this.startTimeUs=Math.floor(1e3*e),n&&n.attributes&&(this.customAttributes=o.__assign({},n.attributes)),n&&n.metrics)for(var r=0,i=Object.keys(n.metrics);r<i.length;r++){var a=i[r];isNaN(Number(n.metrics[a]))||(this.counters[a]=Number(Math.floor(n.metrics[a])))}$(this)},e.prototype.incrementMetric=function(e,t){void 0===t&&(t=1),void 0===this.counters[e]&&this.putMetric(e,0),this.counters[e]+=t},e.prototype.putMetric=function(e,t){if(n=e,r=this.name,0===n.length||n.length>re||!(r&&r.startsWith(y)&&oe.indexOf(n)>-1)&&n.startsWith(ie))throw _.create("invalide custom metric name",{customMetricName:e});var n,r;this.counters[e]=t},e.prototype.getMetric=function(e){return this.counters[e]||0},e.prototype.putAttribute=function(e,t){var n,r=!(0===(n=e).length||n.length>N)&&!I.some((function(e){return n.startsWith(e)}))&&!!n.match(k),i=function(e){return 0!==e.length&&e.length<=A}(t);if(r&&i)this.customAttributes[e]=t;else{if(!r)throw _.create("invalid attribute name",{attributeName:e});if(!i)throw _.create("invalid attribute value",{attributeValue:t})}},e.prototype.getAttribute=function(e){return this.customAttributes[e]},e.prototype.removeAttribute=function(e){void 0!==this.customAttributes[e]&&delete this.customAttributes[e]},e.prototype.getAttributes=function(){return o.__assign({},this.customAttributes)},e.prototype.setStartTime=function(e){this.startTimeUs=e},e.prototype.setDuration=function(e){this.durationUs=e},e.prototype.calculateTraceMetrics=function(){var e=this.api.getEntriesByName(this.traceMeasure),t=e&&e[0];t&&(this.durationUs=Math.floor(1e3*t.duration),this.startTimeUs=Math.floor(1e3*(t.startTime+this.api.getTimeOrigin())))},e.createOobTrace=function(t,n,r){var i=w.getInstance().getUrl();if(i){var o=new e(y+i,!0),a=Math.floor(1e3*w.getInstance().getTimeOrigin());o.setStartTime(a),t&&t[0]&&(o.setDuration(Math.floor(1e3*t[0].duration)),o.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),o.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),o.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd)));if(n){var s=n.find((function(e){return"first-paint"===e.name}));s&&s.startTime&&o.putMetric("_fp",Math.floor(1e3*s.startTime));var u=n.find((function(e){return"first-contentful-paint"===e.name}));u&&u.startTime&&o.putMetric("_fcp",Math.floor(1e3*u.startTime)),r&&o.putMetric("_fid",Math.floor(1e3*r))}$(o)}},e.createUserTimingTrace=function(t){$(new e(t,!1,t))},e}();function se(e){var t=e;if(t&&void 0!==t.responseStart){var n=w.getInstance().getTimeOrigin(),r=Math.floor(1e3*(t.startTime+n)),i=t.responseStart?Math.floor(1e3*(t.responseStart-t.startTime)):void 0,o=Math.floor(1e3*(t.responseEnd-t.startTime));!function(e){var t=S.getInstance();t.instrumentationEnabled&&e.url!==t.logEndPointUrl.split("?")[0]&&t.loggingEnabled&&t.logNetworkAfterSampling&&setTimeout((function(){return J().log(e,0)}),0)}({url:t.name&&t.name.split("?")[0],responsePayloadBytes:t.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}}var ue=5e3;function ce(){C()&&(setTimeout((function(){return function(){var e=w.getInstance(),t=e.getEntriesByType("navigation"),n=e.getEntriesByType("paint");if(e.onFirstInputDelay){var r=setTimeout((function(){ae.createOobTrace(t,n),r=void 0}),ue);e.onFirstInputDelay((function(e){r&&(clearTimeout(r),ae.createOobTrace(t,n,e))}))}else ae.createOobTrace(t,n)}()}),0),setTimeout((function(){return function(){for(var e=w.getInstance(),t=e.getEntriesByType("resource"),n=0,r=t;n<r.length;n++){se(r[n])}e.setupObserver("resource",se)}()}),0),setTimeout((function(){return function(){for(var e=w.getInstance(),t=e.getEntriesByType("measure"),n=0,r=t;n<r.length;n++){le(r[n])}e.setupObserver("measure",le)}()}),0))}function le(e){var t=e.name;t.substring(0,m.length)!==m&&ae.createUserTimingTrace(t)}var he=function(){function e(e){this.app=e,w.getInstance().requiredApisAvailable()?W().then(ce,ce):P.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.")}return e.prototype.trace=function(e){return new ae(e)},Object.defineProperty(e.prototype,"instrumentationEnabled",{get:function(){return S.getInstance().instrumentationEnabled}
1,set:function(e){S.getInstance().instrumentationEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataCollectionEnabled",{get:function(){return S.getInstance().dataCollectionEnabled},set:function(e){S.getInstance().dataCollectionEnabled=e},enumerable:!0,configurable:!0}),e}(),fe="[DEFAULT]";function pe(e){e.INTERNAL.registerService("performance",(function(e){if(e.name!==fe)throw _.create("FB not default");if("undefined"===typeof window)throw _.create("no window");return function(e){c=e}(window),S.getInstance().firebaseAppInstance=e,new he(e)}),{})}pe(i),t.registerPerformance=pe},function(e,t,n){"use strict";n.r(t),n.d(t,"registerInstallations",(function(){return G}));var r,i=n(1),o=n.n(i),a=n(0),s=n(3),u=n(9),c=1e4,l="w:0.2.6",h="FIS_v2",f="https://firebaseinstallations.googleapis.com/v1",p=36e5,d=((r={})["missing-app-config-values"]="Missing App configuration values.",r["create-installation-failed"]="Could not register Firebase Installation.",r["generate-token-failed"]="Could not generate Auth Token.",r["not-registered"]="Firebase Installation is not registered.",r["installation-not-found"]="Firebase Installation not found.",r["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',r["app-offline"]="Could not process request. Application offline.",r["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",r),m=new s.ErrorFactory("installations","Installations",d);function y(e){return e instanceof s.FirebaseError&&e.code.includes("request-failed")}function g(e){if(!e||!e.options)throw m.create("missing-app-config-values");var t=e.name,n=e.options,r=n.projectId,i=n.apiKey,o=n.appId;if(!t||!r||!i||!o)throw m.create("missing-app-config-values");
1return{appName:t,projectId:r,apiKey:i,appId:o}}function v(e){var t=e.projectId;return f+"/projects/"+t+"/installations"}function b(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}function _(e,t){return Object(a.__awaiter)(this,void 0,void 0,(function(){var n,r;return Object(a.__generator)(this,(function(i){switch(i.label){case 0:return[4,t.json()];case 1:return n=i.sent(),r=n.error,[2,m.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})]}}))}))}function w(e){var t=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function E(e,t){var n=t.refreshToken,r=w(e);return r.append("Authorization",function(e){return h+" "+e}(n)),r}function T(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t;return Object(a.__generator)(this,(function(n){switch(n.label){case 0:return[4,e()];case 1:return(t=n.sent()).status>=500&&t.status<600?[2,e()]:[2,t]}}))}))}function S(e,t){var n=t.fid;return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,r,i,o,s,u;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:return t=v(e),r=w(e),i={fid:n,authVersion:h,appId:e.appId,sdkVersion:l},o={method:"POST",headers:r,body:JSON.stringify(i)},[4,T((function(){return fetch(t,o)}))];case 1:return(s=a.sent()).ok?[4,s.json()]:[3,3];case 2:return u=a.sent(),[2,{fid:u.fid||n,registrationStatus:2,refreshToken:u.refreshToken,authToken:b(u.authToken)}];case 3:return[4,_("Create Installation",s)];case 4:throw a.sent()}}))}))}function C(e){return new Promise((function(t){setTimeout(t,e)}))}var I=/^[cdef][\w-]{21}$/,k="";function N(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;var t=function(e){return(t=e,btoa(String.fromCharCode.apply(String,Object(a.__spread)(t))).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return I.test(t)?t:k}catch(r){return k}}var A="firebase-installations-database",D=1,R="firebase-installations-store",O=null;function P(){return O||(O=Object(u.openDb)(A,D,(function(e){switch(e.oldVersion){case 0:e.createObjectStore(R)}}))),O}function x(e,t){return Object(a.__awaiter)(this,void 0,void 0,(function(){var n,r,i;return Object(a.__generator)(this,(function(o){switch(o.label){case 0:return n=F(e),[4,P()];case 1:return r=o.sent(),[4,(i=r.transaction(R,"readwrite")).objectStore(R).put(t,n)];case 2:return o.sent(),[4,i.complete];case 3:return o.sent(),[2,t]}}))}))}function M(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,n,r;return Object(a.__generator)(this,(function(i){switch(i.label){case 0:return t=F(e),[4,P()];case 1:return n=i.sent(),[4,(r=n.transaction(R,"readwrite")).objectStore(R).delete(t)];case 2:return i.sent(),[4,r.complete];case 3:return i.sent(),[2]}}))}))}function L(e,t){return Object(a.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,u;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:return n=F(e),[4,P()];case 1:return r=a.sent(),i=r.transaction(R,"readwrite"),[4,(o=i.objectStore(R)).get(n)];case 2:return s=a.sent(),(u=t(s))===s?[2,u]:void 0!==u?[3,4]:[4,o.delete(n)];case 3:return a.sent(),[3,6];case 4:return[4,o.put(u,n)];case 5:a.sent(),a.label=6;case 6:return[4,i.complete];case 7:return a.sent(),[2,u]}}))}))}function F(e){return e.appName+"!"+e.appId}function U(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,n,r;return Object(a.__generator)(this,(function(i){switch(i.label){case 0:return[4,L(e,(function(n){var r=function(e){var t=e||{fid:N(),registrationStatus:0};if(j(t))return{fid:t.fid,registrationStatus:0};return t}(n),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){var n=Promise.reject(m.create("app-offline"));return{installationEntry:t,registrationPromise:n}}var r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=function(e,t){return Object(a.__awaiter)(this,void 0,void 0,(function(){var n,r;return Object(a.__generator)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,7]),[4,S(e,t)];case 1:return n=i.sent(),[2,x(e,n)];case 2:return y(r=i.sent())&&409===r.serverCode?[4,M(e)]:[3,4];case 3:return i.sent(),[3,6];case 4:return[4,x(e,{fid:t.fid,registrationStatus:0})];case 5:i.sent(),i.label=6;case 6:throw r;case 7:return[2]}}
1))}))}(e,r);return{installationEntry:r,registrationPromise:i}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:q(e)}:{installationEntry:t}}(e,r);return t=i.registrationPromise,i.installationEntry}))];case 1:return(n=i.sent()).fid!==k?[3,3]:(r={},[4,t]);case 2:return[2,(r.installationEntry=i.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:t}]}}))}))}function q(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t;return Object(a.__generator)(this,(function(n){switch(n.label){case 0:return[4,V(e)];case 1:t=n.sent(),n.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,C(100)];case 3:return n.sent(),[4,V(e)];case 4:return t=n.sent(),[3,2];case 5:if(0===t.registrationStatus)throw m.create("create-installation-failed");return[2,t]}}))}))}function V(e){return L(e,(function(e){if(!e)throw m.create("installation-not-found");return j(e)?{fid:e.fid,registrationStatus:0}:e}))}function j(e){return 1===e.registrationStatus&&e.registrationTime+c<Date.now()}function B(e,t){return Object(a.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o,s,u;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:return n=function(e,t){var n=t.fid;return v(e)+"/"+n+"/authTokens:generate"}(e,t),r=E(e,t),i={installation:{sdkVersion:l}},o={method:"POST",headers:r,body:JSON.stringify(i)},[4,T((function(){return fetch(n,o)}))];case 1:return(s=a.sent()).ok?[4,s.json()]:[3,3];case 2:return u=a.sent(),[2,b(u)];case 3:return[4,_("Generate Auth Token",s)];case 4:throw a.sent()}}))}))}function W(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,n,r;return Object(a.__generator)(this,(function(i){switch(i.label){case 0:return[4,L(e,(function(n){if(!K(n))throw m.create("not-registered");var r=n.authToken;if(function(e){return 2===e.requestStatus&&!function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+p}(e)}(r))return n;if(1===r.requestStatus)return t=function(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(a.__generator)(this,(function(r){switch(r.label){case 0:return[4,Q(e)];case 1:t=r.sent(),r.label=2;case 2:return 1!==t.authToken.requestStatus?[3,5]:[4,C(100)];case 3:return r.sent(),[4,Q(e)];case 4:return t=r.sent(),[3,2];case 5:if(0===(n=t.authToken).requestStatus)throw m.create("generate-token-failed");return[2,n]}}))}))}(e),n;if(!navigator.onLine)throw m.create("app-offline");var i=function(e){var t={requestStatus:1,requestTime:Date.now()};return Object(a.__assign)({},e,{authToken:t})}(n);return t=function(e,t){return Object(a.__awaiter)(this,void 0,void 0,(function(){var n,r,i;return Object(a.__generator)(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,8]),[4,B(e,t)];case 1:return n=o.sent(),i=Object(a.__assign)({},t,{authToken:n}),[4,x(e,i)];case 2:return o.sent(),[2,n];case 3:return!y(r=o.sent())||401!==r.serverCode&&404!==r.serverCode?[3,5]:[4,M(e)];case 4:return o.sent(),[3,7];case 5:return i=Object(a.__assign)({},t,{authToken:{requestStatus:0}}),[4,x(e,i)];case 6:o.sent(),o.label=7;case 7:throw r;case 8:return[2]}}
1))}))}(e,i),i}))];case 1:return n=i.sent(),t?[4,t]:[3,3];case 2:return r=i.sent(),[3,4];case 3:r=n.authToken,i.label=4;case 4:return[2,r.token]}}))}))}function Q(e){return L(e,(function(e){if(!K(e))throw m.create("not-registered");var t,n=e.authToken;return 1===(t=n).requestStatus&&t.requestTime+c<Date.now()?Object(a.__assign)({},e,{authToken:{requestStatus:0}}):e}))}function K(e){return void 0!==e&&2===e.registrationStatus}function z(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,n,r;return Object(a.__generator)(this,(function(i){switch(i.label){case 0:return[4,U(e)];case 1:return t=i.sent(),n=t.installationEntry,(r=t.registrationPromise)?[4,r]:[3,3];case 2:return i.sent(),[3,4];case 3:if(2!==n.registrationStatus)throw m.create("create-installation-failed");i.label=4;case 4:return[2]}}))}))}function H(e,t){return Object(a.__awaiter)(this,void 0,void 0,(function(){var n,r,i,o;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:return n=function(e,t){var n=t.fid;return v(e)+"/"+n}(e,t),r=E(e,t),i={method:"DELETE",headers:r},[4,T((function(){return fetch(n,i)}))];case 1:return(o=a.sent()).ok?[3,3]:[4,_("Delete Installation",o)];case 2:throw a.sent();case 3:return[2]}}
1))}))}function G(e){e.INTERNAL.registerService("installations",(function(e){return g(e),{app:e,getId:function(){return function(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,n,r,i;return Object(a.__generator)(this,(function(o){switch(o.label){case 0:return[4,U(t=g(e))];case 1:return n=o.sent(),r=n.installationEntry,(i=n.registrationPromise)&&i.catch((function(){})),2===r.registrationStatus&&W(t).catch((function(){})),[2,r.fid]}}))}))}(e)},getToken:function(){return function(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t;return Object(a.__generator)(this,(function(n){switch(n.label){case 0:return[4,z(t=g(e))];case 1:return n.sent(),[2,W(t)]}}))}))}(e)},delete:function(){return function(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,n;return Object(a.__generator)(this,(function(r){switch(r.label){case 0:return[4,L(t=g(e),(function(e){if(!e||0!==e.registrationStatus)return e}))];case 1:if(!(n=r.sent()))return[3,6];if(1!==n.registrationStatus)return[3,2];throw m.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw m.create("app-offline");case 3:return[4,H(t,n)];case 4:return r.sent(),[4,M(t)];case 5:r.sent(),r.label=6;case 6:return[2]}}
1))}))}(e)}}}))}G(o.a)}]]);
2//# sourceMappingURL=2.1ba09ef0.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.