@thefittingroom/sdk 0.0.1-alpha.10 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +21 -12
- package/dist/esm/api/fetcher.d.ts +8 -5
- package/dist/esm/api/shop.d.ts +8 -5
- package/dist/esm/firebase/firebase-user.d.ts +1 -1
- package/dist/esm/firebase/firebase.d.ts +3 -4
- package/dist/esm/helpers/config.d.ts +22 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +143 -51
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +184 -185
- package/dist/esm/index.min.js.map +1 -1
- package/package.json +6 -44
- package/.env.dev +0 -14
- package/.env.prod +0 -14
package/dist/esm/index.min.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v0.0.
|
|
2
|
+
* thefittingroom v0.0.3 (2023-07-18T18:14:19.719Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
|
-
var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
|
|
6
5
|
/**
|
|
7
6
|
* @license
|
|
8
7
|
* Copyright 2017 Google LLC
|
|
@@ -35,7 +34,7 @@ var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
|
|
|
35
34
|
* See the License for the specific language governing permissions and
|
|
36
35
|
* limitations under the License.
|
|
37
36
|
*/
|
|
38
|
-
const
|
|
37
|
+
const t=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):55296==(64512&s)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++r)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},e={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const s=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(e,n){return this.HAS_NATIVE_SUPPORT&&!n?btoa(e):this.encodeByteArray(t(e),n)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const s=n[t.charAt(e++)],i=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==s||null==i||null==o||null==a)throw Error();const c=s<<2|i>>4;if(r.push(c),64!==o){const t=i<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},n=function(n){return function(n){const r=t(n);return e.encodeByteArray(r,!0)}(n).replace(/\./g,"")},r=function(t){try{return e.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
39
38
|
/**
|
|
40
39
|
* @license
|
|
41
40
|
* Copyright 2017 Google LLC
|
|
@@ -52,7 +51,7 @@ const n=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charC
|
|
|
52
51
|
* See the License for the specific language governing permissions and
|
|
53
52
|
* limitations under the License.
|
|
54
53
|
*/
|
|
55
|
-
function
|
|
54
|
+
function s(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}
|
|
56
55
|
/**
|
|
57
56
|
* @license
|
|
58
57
|
* Copyright 2022 Google LLC
|
|
@@ -69,7 +68,7 @@ function o(){return"undefined"!=typeof navigator&&"string"==typeof navigator.use
|
|
|
69
68
|
* See the License for the specific language governing permissions and
|
|
70
69
|
* limitations under the License.
|
|
71
70
|
*/
|
|
72
|
-
const
|
|
71
|
+
const i=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,o=()=>{try{return i()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&r(t[1]);return e&&JSON.parse(e)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},a=t=>{var e,n;return null===(n=null===(e=o())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]},c=t=>{var e;return null===(e=o())||void 0===e?void 0:e[`_${t}`]};
|
|
73
72
|
/**
|
|
74
73
|
* @license
|
|
75
74
|
* Copyright 2017 Google LLC
|
|
@@ -86,7 +85,7 @@ const a=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=t
|
|
|
86
85
|
* See the License for the specific language governing permissions and
|
|
87
86
|
* limitations under the License.
|
|
88
87
|
*/
|
|
89
|
-
class
|
|
88
|
+
class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch((()=>{})),1===t.length?t(e):t(e,n))}}}
|
|
90
89
|
/**
|
|
91
90
|
* @license
|
|
92
91
|
* Copyright 2021 Google LLC
|
|
@@ -102,7 +101,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
102
101
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
103
102
|
* See the License for the specific language governing permissions and
|
|
104
103
|
* limitations under the License.
|
|
105
|
-
*/class
|
|
104
|
+
*/class h extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,l.prototype.create)}}class l{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,s=this.errors[t],i=s?function(t,e){return t.replace(d,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new h(r,o,n)}}const d=/\{\$([^}]+)}/g;function f(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const n=t[s],i=e[s];if(p(n)&&p(i)){if(!f(n,i))return!1}else if(n!==i)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function p(t){return null!==t&&"object"==typeof t}
|
|
106
105
|
/**
|
|
107
106
|
* @license
|
|
108
107
|
* Copyright 2017 Google LLC
|
|
@@ -118,7 +117,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
118
117
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
118
|
* See the License for the specific language governing permissions and
|
|
120
119
|
* limitations under the License.
|
|
121
|
-
*/function
|
|
120
|
+
*/function g(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function m(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function y(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class v{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=w),void 0===r.error&&(r.error=w),void 0===r.complete&&(r.complete=w);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),s}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function w(){}
|
|
122
121
|
/**
|
|
123
122
|
* @license
|
|
124
123
|
* Copyright 2021 Google LLC
|
|
@@ -134,7 +133,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
134
133
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
135
134
|
* See the License for the specific language governing permissions and
|
|
136
135
|
* limitations under the License.
|
|
137
|
-
*/function
|
|
136
|
+
*/function I(t){return t&&t._delegate?t._delegate:t}class b{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
|
|
138
137
|
/**
|
|
139
138
|
* @license
|
|
140
139
|
* Copyright 2019 Google LLC
|
|
@@ -166,7 +165,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
166
165
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
167
166
|
* See the License for the specific language governing permissions and
|
|
168
167
|
* limitations under the License.
|
|
169
|
-
*/class
|
|
168
|
+
*/class E{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new u;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),r=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(r)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
|
|
170
169
|
/**
|
|
171
170
|
* @license
|
|
172
171
|
* Copyright 2019 Google LLC
|
|
@@ -182,7 +181,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
182
181
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
182
|
* See the License for the specific language governing permissions and
|
|
184
183
|
* limitations under the License.
|
|
185
|
-
*/(t))try{this.getOrInitializeService({instanceIdentifier:T})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=T){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=T){return this.instances.has(t)}getOptions(t=T){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(r)}return r}onInit(t,e){var n;const r=this.normalizeInstanceIdentifier(e),s=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;s.add(t),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&t(i,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const r of n)try{r(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=t,r===T?void 0:r),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var r;return n||null}normalizeInstanceIdentifier(t=T){return this.component?this.component.multipleInstances?t:T:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class
|
|
184
|
+
*/(t))try{this.getOrInitializeService({instanceIdentifier:T})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=T){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=T){return this.instances.has(t)}getOptions(t=T){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(r)}return r}onInit(t,e){var n;const r=this.normalizeInstanceIdentifier(e),s=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;s.add(t),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&t(i,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const r of n)try{r(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=t,r===T?void 0:r),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var r;return n||null}normalizeInstanceIdentifier(t=T){return this.component?this.component.multipleInstances?t:T:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class _{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new E(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
|
|
186
185
|
/**
|
|
187
186
|
* @license
|
|
188
187
|
* Copyright 2017 Google LLC
|
|
@@ -198,7 +197,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
198
197
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
198
|
* See the License for the specific language governing permissions and
|
|
200
199
|
* limitations under the License.
|
|
201
|
-
*/var
|
|
200
|
+
*/var S;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(S||(S={}));const C={debug:S.DEBUG,verbose:S.VERBOSE,info:S.INFO,warn:S.WARN,error:S.ERROR,silent:S.SILENT},k=S.INFO,A={[S.DEBUG]:"log",[S.VERBOSE]:"log",[S.INFO]:"info",[S.WARN]:"warn",[S.ERROR]:"error"},N=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=A[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};class D{constructor(t){this.name=t,this._logLevel=k,this._logHandler=N,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in S))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?C[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,S.DEBUG,...t),this._logHandler(this,S.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,S.VERBOSE,...t),this._logHandler(this,S.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,S.INFO,...t),this._logHandler(this,S.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,S.WARN,...t),this._logHandler(this,S.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,S.ERROR,...t),this._logHandler(this,S.ERROR,...t)}}let R,O;const L=new WeakMap,P=new WeakMap,M=new WeakMap,x=new WeakMap,U=new WeakMap;let F={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return P.get(t);if("objectStoreNames"===e)return t.objectStoreNames||M.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return j(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function V(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(O||(O=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(B(this),e),j(L.get(this))}:function(...e){return j(t.apply(B(this),e))}:function(e,...n){const r=t.call(B(this),e,...n);return M.set(r,e.sort?e.sort():[e]),j(r)}}function q(t){return"function"==typeof t?V(t):(t instanceof IDBTransaction&&function(t){if(P.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",i),t.removeEventListener("abort",i)},s=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",s),t.addEventListener("error",i),t.addEventListener("abort",i)}));P.set(t,e)}(t),e=t,(R||(R=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,F):t);var e}function j(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",i)},s=()=>{e(j(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&L.set(e,t)})).catch((()=>{})),U.set(e,t),e}(t);if(x.has(t))return x.get(t);const e=q(t);return e!==t&&(x.set(t,e),U.set(e,t)),e}const B=t=>U.get(t);const z=["get","getKey","getAll","getAllKeys","count"],$=["put","add","delete","clear"],K=new Map;function H(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(K.get(e))return K.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=$.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!z.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),s&&i.done]))[0]};return K.set(e,i),i}F=(t=>({...t,get:(e,n,r)=>H(e,n)||t.get(e,n,r),has:(e,n)=>!!H(e,n)||t.has(e,n)}))(F);
|
|
202
201
|
/**
|
|
203
202
|
* @license
|
|
204
203
|
* Copyright 2019 Google LLC
|
|
@@ -215,7 +214,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
215
214
|
* See the License for the specific language governing permissions and
|
|
216
215
|
* limitations under the License.
|
|
217
216
|
*/
|
|
218
|
-
class
|
|
217
|
+
class G{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const W="@firebase/app",Q="0.9.0",Y=new D("@firebase/app"),X="[DEFAULT]",J={[W]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},Z=new Map,tt=new Map;function et(t,e){try{t.container.addComponent(e)}catch(n){Y.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function nt(t){const e=t.name;if(tt.has(e))return Y.debug(`There were multiple attempts to register component ${e}.`),!1;tt.set(e,t);for(const e of Z.values())et(e,t);return!0}function rt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
|
|
219
218
|
/**
|
|
220
219
|
* @license
|
|
221
220
|
* Copyright 2019 Google LLC
|
|
@@ -231,7 +230,7 @@ class Q{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
|
|
|
231
230
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
232
231
|
* See the License for the specific language governing permissions and
|
|
233
232
|
* limitations under the License.
|
|
234
|
-
*/const
|
|
233
|
+
*/const st=new l("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});
|
|
235
234
|
/**
|
|
236
235
|
* @license
|
|
237
236
|
* Copyright 2019 Google LLC
|
|
@@ -248,7 +247,7 @@ class Q{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
|
|
|
248
247
|
* See the License for the specific language governing permissions and
|
|
249
248
|
* limitations under the License.
|
|
250
249
|
*/
|
|
251
|
-
class
|
|
250
|
+
class it{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new b("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw st.create("app-deleted",{appName:this._name})}}
|
|
252
251
|
/**
|
|
253
252
|
* @license
|
|
254
253
|
* Copyright 2019 Google LLC
|
|
@@ -264,7 +263,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
264
263
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
265
264
|
* See the License for the specific language governing permissions and
|
|
266
265
|
* limitations under the License.
|
|
267
|
-
*/const
|
|
266
|
+
*/const ot="9.15.0";function at(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:X,automaticDataCollectionEnabled:!1},e),s=r.name;if("string"!=typeof s||!s)throw st.create("bad-app-name",{appName:String(s)});if(n||(n=(()=>{var t;return null===(t=o())||void 0===t?void 0:t.config})()),!n)throw st.create("no-options");const i=Z.get(s);if(i){if(f(n,i.options)&&f(r,i.config))return i;throw st.create("duplicate-app",{appName:s})}const a=new _(s);for(const t of tt.values())a.addComponent(t);const c=new it(n,r,a);return Z.set(s,c),c}function ct(t=X){const e=Z.get(t);if(!e&&t===X)return at();if(!e)throw st.create("no-app",{appName:t});return e}function ut(t,e,n){var r;let s=null!==(r=J[t])&&void 0!==r?r:t;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const t=[`Unable to register library "${s}" with version "${e}":`];return i&&t.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void Y.warn(t.join(" "))}nt(new b(`${s}-version`,(()=>({library:s,version:e})),"VERSION"))}
|
|
268
267
|
/**
|
|
269
268
|
* @license
|
|
270
269
|
* Copyright 2021 Google LLC
|
|
@@ -280,7 +279,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
280
279
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
281
280
|
* See the License for the specific language governing permissions and
|
|
282
281
|
* limitations under the License.
|
|
283
|
-
*/const
|
|
282
|
+
*/const ht="firebase-heartbeat-store";let lt=null;function dt(){return lt||(lt=function(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=j(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(j(o.result),t.oldVersion,t.newVersion,j(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),a.then((t=>{i&&t.addEventListener("close",(()=>i())),s&&t.addEventListener("versionchange",(()=>s()))})).catch((()=>{})),a}("firebase-heartbeat-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(ht)}}).catch((t=>{throw st.create("idb-open",{originalErrorMessage:t.message})}))),lt}async function ft(t,e){try{const n=(await dt()).transaction(ht,"readwrite"),r=n.objectStore(ht);return await r.put(e,pt(t)),n.done}catch(t){if(t instanceof h)Y.warn(t.message);else{const e=st.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});Y.warn(e.message)}}}function pt(t){return`${t.name}!${t.options.appId}`}
|
|
284
283
|
/**
|
|
285
284
|
* @license
|
|
286
285
|
* Copyright 2021 Google LLC
|
|
@@ -296,7 +295,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
296
295
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
297
296
|
* See the License for the specific language governing permissions and
|
|
298
297
|
* limitations under the License.
|
|
299
|
-
*/class
|
|
298
|
+
*/class gt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new yt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=mt();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==e&&!this._heartbeatsCache.heartbeats.some((t=>t.date===e)))return this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const t=mt(),{heartbeatsToSend:e,unsentEntries:r}=function(t,e=1024){const n=[];let r=t.slice();for(const s of t){const t=n.find((t=>t.agent===s.agent));if(t){if(t.dates.push(s.date),vt(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),vt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=n(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}}function mt(){return(new Date).toISOString().substring(0,10)}class yt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var t;e((null===(t=s.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(t){try{return(await dt()).transaction(ht).objectStore(ht).get(pt(t))}catch(t){if(t instanceof h)Y.warn(t.message);else{const e=st.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});Y.warn(e.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return ft(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return ft(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function vt(t){return n(JSON.stringify({version:2,heartbeats:t})).length}
|
|
300
299
|
/**
|
|
301
300
|
* @license
|
|
302
301
|
* Copyright 2019 Google LLC
|
|
@@ -312,7 +311,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
312
311
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
313
312
|
* See the License for the specific language governing permissions and
|
|
314
313
|
* limitations under the License.
|
|
315
|
-
*/var bt;bt="",st(new _("platform-logger",(t=>new Q(t)),"PRIVATE")),st(new _("heartbeat",(t=>new yt(t)),"PRIVATE")),lt(J,X,bt),lt(J,X,"esm2017"),lt("fire-js","");var Et=function(t,e){return Et=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Et(t,e)};function _t(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tt(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}var St,At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ct=Ct||{},kt=At||self;function Nt(){}function Dt(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function Rt(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ot="closure_uid_"+(1e9*Math.random()>>>0),Lt=0;function Pt(t,e,n){return t.call.apply(t.bind,arguments)}function Mt(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function xt(t,e,n){return(xt=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Pt:Mt).apply(null,arguments)}function Ut(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function Ft(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}function Vt(){this.s=this.s,this.o=this.o}Vt.prototype.s=!1,Vt.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ot)&&t[Ot]||(t[Ot]=++Lt))},Vt.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var qt=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function jt(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function Bt(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Dt(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function zt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}zt.prototype.h=function(){this.defaultPrevented=!0};var $t=function(){if(!kt.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{kt.addEventListener("test",Nt,e),kt.removeEventListener("test",Nt,e)}catch(t){}return t}();function Kt(t){return/^[\s\xa0]*$/.test(t)}var Ht=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Gt(t,e){return t<e?-1:t>e?1:0}function Wt(){var t=kt.navigator;return t&&(t=t.userAgent)?t:""}function Qt(t){return-1!=Wt().indexOf(t)}function Jt(t){return Jt[" "](t),t}Jt[" "]=Nt;var Xt,Yt,Zt=Qt("Opera"),te=Qt("Trident")||Qt("MSIE"),ee=Qt("Edge"),ne=ee||te,re=Qt("Gecko")&&!(-1!=Wt().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),se=-1!=Wt().toLowerCase().indexOf("webkit")&&!Qt("Edge");function ie(){var t=kt.document;return t?t.documentMode:void 0}t:{var oe="",ae=(Yt=Wt(),re?/rv:([^\);]+)(\)|;)/.exec(Yt):ee?/Edge\/([\d\.]+)/.exec(Yt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Yt):se?/WebKit\/(\S+)/.exec(Yt):Zt?/(?:Version)[ \/]?(\S+)/.exec(Yt):void 0);if(ae&&(oe=ae?ae[1]:""),te){var ce=ie();if(null!=ce&&ce>parseFloat(oe)){Xt=String(ce);break t}}Xt=oe}var ue,he={};function le(){return function(t){var e=he;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Ht(String(Xt)).split("."),n=Ht("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=Gt(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Gt(0==i[2].length,0==o[2].length)||Gt(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(kt.document&&te){var de=ie();ue=de||(parseInt(Xt,10)||void 0)}else ue=void 0;var fe=ue;function pe(t,e){if(zt.call(this,t?t.type:""),this.relatedTarget=this.g=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.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(re){t:{try{Jt(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,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!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:ge[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&pe.X.h.call(this)}}Ft(pe,zt);var ge={2:"touch",3:"pen",4:"mouse"};pe.prototype.h=function(){pe.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var me="closure_listenable_"+(1e6*Math.random()|0),ye=0;function ve(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,this.key=++ye,this.ba=this.ea=!1}function we(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function Ie(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function be(t){var e={};for(var n in t)e[n]=t[n];return e}var Ee="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function _e(t,e){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<Ee.length;i++)n=Ee[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Te(t){this.src=t,this.g={},this.h=0}function Se(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=qt(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}Te.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,r,s){if(r&&r.once)return Re(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Rt(r)?!!r.capture:!!r,s):De(t,e,n,!1,r,s)}function De(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Rt(s)?!!s.capture:!!s,a=xe(t);if(a||(t[Ce]=a=new Te(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)$t||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Re(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Re(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Rt(r)?!!r.capture:!!r,s):De(t,e,n,!0,r,s)}function Oe(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Oe(t,e[i],n,r,s);else r=Rt(r)?!!r.capture:!!r,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,r,s))&&(we(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=xe(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Ae(e,n,r,s)),(n=-1<t?e[t]:null)&&Le(n))}function Le(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[me])Se(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Pe(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=xe(e))?(Se(n,t),0==n.h&&(n.src=null,e[Ce]=null)):we(t)}}}function Pe(t){return t in ke?ke[t]:ke[t]="on"+t}function Me(t,e){if(t.ba)t=!0;else{e=new pe(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&Le(t),t=n.call(r,e)}return t}function xe(t){return(t=t[Ce])instanceof Te?t:null}var Ue="__closure_events_fn_"+(1e9*Math.random()>>>0);function Fe(t){return"function"==typeof t?t:(t[Ue]||(t[Ue]=function(e){return t.handleEvent(e)}),t[Ue])}function Ve(){Vt.call(this),this.i=new Te(this),this.P=this,this.I=null}function qe(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new zt(e,t);else if(e instanceof zt)e.target=e.target||t;else{var s=e;_e(e=new zt(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=je(o,r,!0,e)&&s}if(s=je(o=e.g=t,r,!0,e)&&s,s=je(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=je(o=e.g=n[i],r,!1,e)&&s}function je(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&Se(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,r){Oe(this,t,e,n,r)},Ve.prototype.M=function(){if(Ve.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)we(n[r]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Ve.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Be=kt.JSON.stringify;function ze(){var t=Xe,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var $e,Ke=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=He.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),He=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new Ge}),(function(t){return t.reset()})),Ge=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function We(t){kt.setTimeout((function(){throw t}),0)}function Qe(t,e){$e||function(){var t=kt.Promise.resolve(void 0);$e=function(){t.then(Ye)}}(),Je||($e(),Je=!0),Xe.add(t,e)}var Je=!1,Xe=new Ke;function Ye(){for(var t;t=ze();){try{t.h.call(t.g)}catch(t){We(t)}var e=He;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Je=!1}function Ze(t,e){Ve.call(this),this.h=t||1,this.g=e||kt,this.j=xt(this.lb,this),this.l=Date.now()}function tn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function en(t,e,n){if("function"==typeof t)n&&(t=xt(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=xt(t.handleEvent,t)}return 2147483647<Number(e)?-1:kt.setTimeout(t,e||0)}function nn(t){t.g=en((function(){t.g=null,t.i&&(t.i=!1,nn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ft(Ze,Ve),(St=Ze.prototype).ca=!1,St.R=null,St.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),qe(this,"tick"),this.ca&&(tn(this),this.start()))}},St.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},St.M=function(){Ze.X.M.call(this),tn(this),delete this.g};var rn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Et(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:nn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(kt.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Vt);function sn(t){Vt.call(this),this.h=t,this.g={}}Ft(sn,Vt);var on=[];function an(t,e,n,r){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var s=0;s<n.length;s++){var i=Ne(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function cn(t){Ie(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Le(t)}),t),t.g={}}function un(){this.g=!0}function hn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return Be(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}sn.prototype.M=function(){sn.X.M.call(this),cn(this)},sn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},un.prototype.Aa=function(){this.g=!1},un.prototype.info=function(){};var ln={},dn=null;function fn(){return dn=dn||new Ve}function pn(t){zt.call(this,ln.Pa,t)}function gn(t){var e=fn();qe(e,new pn(e))}function mn(t,e){zt.call(this,ln.STAT_EVENT,t),this.stat=e}function yn(t){var e=fn();qe(e,new mn(e,t))}function vn(t,e){zt.call(this,ln.Qa,t),this.size=e}function wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return kt.setTimeout((function(){t()}),e)}ln.Pa="serverreachability",Ft(pn,zt),ln.STAT_EVENT="statevent",Ft(mn,zt),ln.Qa="timingevent",Ft(vn,zt);var In={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},bn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function En(){}function _n(t){return t.h||(t.h=t.i())}function Tn(){}En.prototype.h=null;var Sn,An={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Cn(){zt.call(this,"d")}function kn(){zt.call(this,"c")}function Nn(){}function Dn(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new sn(this),this.O=On,t=ne?125:void 0,this.T=new Ze(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new Rn}function Rn(){this.i=null,this.g="",this.h=!1}Ft(Cn,zt),Ft(kn,zt),Ft(Nn,En),Nn.prototype.g=function(){return new XMLHttpRequest},Nn.prototype.i=function(){return{}},Sn=new Nn;var On=45e3,Ln={},Pn={};function Mn(t,e,n){t.K=1,t.v=tr(Qn(e)),t.s=n,t.P=!0,xn(t,null)}function xn(t,e){t.F=Date.now(),qn(t),t.A=Qn(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),fr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Rn,t.g=fs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new rn(xt(t.La,t,t.g),t.N)),an(t.S,t.g,"readystatechange",t.ib),e=t.H?be(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),gn(),function(t,e,n,r,s,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Un(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Fn(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),s=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}hn(t.j,t.m,r,null),Kn(t,r)}Un(t)&&r!=Pn&&r!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),s=!1),t.i=t.i&&s,s?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),is(e),e.K=!0,yn(11))):(hn(t.j,t.m,n,"[Invalid Chunked Response]"),$n(t),zn(t))}function Vn(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?Pn:(n=Number(e.substring(n,r)),isNaN(n)?Ln:(r+=1)+n>e.length?Pn:(e=e.substr(r,n),t.C=r+n,e))}function qn(t){t.V=Date.now()+t.O,jn(t,t.O)}function jn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=wn(xt(t.gb,t),e)}function Bn(t){t.B&&(kt.clearTimeout(t.B),t.B=null)}function zn(t){0==t.l.G||t.I||cs(t.l,t)}function $n(t){Bn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,tn(t.T),cn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Kn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||Ir(n.h,t)))if(!t.J&&Ir(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;as(n),Xr(n)}ss(n),yn(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=wr(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hs(n,11)}else if((t.J||n.g==t)&&as(n),!Kt(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(br(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Zn(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=ds(r,r.H?r.ka:null,r.V),f.J){Er(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(Bn(p),qn(p)),r.g=f}else rs(r);0<n.i.length&&Zr(n)}else"stop"!=i[0]&&"close"!=i[0]||hs(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hs(n,7):Jr(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}gn()}catch(i){}}function Hn(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Dt(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Dt(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Dt(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}(St=Dn.prototype).setTimeout=function(t){this.O=t},St.ib=function(t){t=t.target;var e=this.L;e&&3==$r(t)?e.l():this.La(t)},St.La=function(t){try{if(t==this.g)t:{var e=$r(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||Kr(this.g)))){this.I||4!=e||7==n||gn(),Bn(this);var r=this.g.aa();this.Y=r;e:if(Un(this)){var s=Kr(this.g);t="";var i=s.length,o=4==$r(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){$n(this),zn(this);var a="";break e}this.h.i=new kt.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Kt(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,yn(12),$n(this),zn(this);break t}hn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Kn(this,r)}this.P?(Fn(this,e,a),ne&&this.i&&3==e&&(an(this.S,this.T,"tick",this.hb),this.T.start())):(hn(this.j,this.m,a,null),Kn(this,a)),4==e&&$n(this),this.i&&!this.I&&(4==e?cs(this.l,this):(this.i=!1,qn(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,yn(12)):(this.o=0,yn(13)),$n(this),zn(this)}}}catch(e){}},St.hb=function(){if(this.g){var t=$r(this.g),e=this.g.fa();this.C<e.length&&(Bn(this),Fn(this,t,e),this.i&&4!=t&&qn(this))}},St.cancel=function(){this.I=!0,$n(this)},St.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(gn(),yn(17)),$n(this),this.o=2,zn(this)):jn(this,this.V-t)};var Gn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Wn(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Wn){this.h=void 0!==e?e:t.h,Jn(this,t.j),this.s=t.s,this.g=t.g,Xn(this,t.m),this.l=t.l,e=t.i;var n=new ur;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Yn(this,n),this.o=t.o}else t&&(n=String(t).match(Gn))?(this.h=!!e,Jn(this,n[1]||"",!0),this.s=er(n[2]||""),this.g=er(n[3]||"",!0),Xn(this,n[4]),this.l=er(n[5]||"",!0),Yn(this,n[6]||"",!0),this.o=er(n[7]||"")):(this.h=!!e,this.i=new ur(null,this.h))}function Qn(t){return new Wn(t)}function Jn(t,e,n){t.j=n?er(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Xn(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Yn(t,e,n){e instanceof ur?(t.i=e,function(t,e){e&&!t.j&&(hr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(lr(this,e),fr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=nr(e,ar)),t.i=new ur(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function tr(t){return Zn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function er(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function nr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,rr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function rr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Wn.prototype.toString=function(){var t=[],e=this.j;e&&t.push(nr(e,sr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(nr(e,sr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(nr(n,"/"==n.charAt(0)?or:ir,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",nr(n,cr)),t.join("")};var sr=/[#\/\?@]/g,ir=/[#\?:]/g,or=/[#\?]/g,ar=/[#\?@]/g,cr=/#/g;function ur(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function lr(t,e){hr(t),e=pr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function dr(t,e){return hr(t),e=pr(t,e),t.g.has(e)}function fr(t,e,n){lr(t,e),0<n.length&&(t.i=null,t.g.set(pr(t,e),jt(n)),t.h+=n.length)}function pr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(St=ur.prototype).add=function(t,e){hr(this),this.i=null,t=pr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},St.forEach=function(t,e){hr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},St.oa=function(){hr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},St.W=function(t){hr(this);var e=[];if("string"==typeof t)dr(this,t)&&(e=e.concat(this.g.get(pr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},St.set=function(t,e){return hr(this),this.i=null,dr(this,t=pr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},St.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},St.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var gr=function(t,e){this.h=t,this.g=e};function mr(t){this.l=t||yr,kt.PerformanceNavigationTiming?t=0<(t=kt.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(kt.g&&kt.g.Ga&&kt.g.Ga()&&kt.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var yr=10;function vr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function wr(t){return t.h?1:t.g?t.g.size:0}function Ir(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function br(t,e){t.g?t.g.add(e):t.h=e}function Er(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function _r(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=_t(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return jt(t.i)}function Tr(){}function Sr(){this.g=new Tr}function Ar(t,e,n){var r=n||"";try{Hn(t,(function(t,n){var s=t;Rt(t)&&(s=Be(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Cr(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function kr(t){this.l=t.ac||null,this.j=t.jb||!1}function Nr(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Dr,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}mr.prototype.cancel=function(){var t,e;if(this.i=_r(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=_t(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Tr.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Tr.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(kr,En),kr.prototype.g=function(){return new Nr(this.l,this.j)},kr.prototype.i=function(t){return function(){return t}}({}),Ft(Nr,Ve);var Dr=0;function Rr(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Or(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Lr(t)}function Lr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(St=Nr.prototype).open=function(t,e){if(this.readyState!=Dr)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Lr(this)},St.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||kt).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},St.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Or(this)),this.readyState=Dr},St.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Lr(this)),this.g&&(this.readyState=3,Lr(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==kt.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Rr(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},St.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Or(this):Lr(this),3==this.readyState&&Rr(this)}},St.Va=function(t){this.g&&(this.response=this.responseText=t,Or(this))},St.Ua=function(t){this.g&&(this.response=t,Or(this))},St.ga=function(){this.g&&Or(this)},St.setRequestHeader=function(t,e){this.v.append(t,e)},St.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},St.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Nr.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Pr=kt.JSON.parse;function Mr(t){Ve.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=xr,this.K=this.L=!1}Ft(Mr,Ve);var xr="",Ur=/^https?$/i,Fr=["POST","PUT"];function Vr(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,qr(t),Br(t)}function qr(t){t.D||(t.D=!0,qe(t,"complete"),qe(t,"error"))}function jr(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=$r(t)||2!=t.aa()))if(t.v&&4==$r(t))en(t.Ha,0,t);else if(qe(t,"readystatechange"),4==$r(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match(Gn)[1]||null;if(!i&&kt.self&&kt.self.location){var o=kt.self.location.protocol;i=o.substr(0,o.length-1)}s=!Ur.test(i?i.toLowerCase():"")}e=s}if(e)qe(t,"complete"),qe(t,"success");else{t.m=6;try{var a=2<$r(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",qr(t)}}finally{Br(t)}}}function Br(t,e){if(t.g){zr(t);var n=t.g,r=t.C[0]?Nt:null;t.g=null,t.C=null,e||qe(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function zr(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function $r(t){return t.g?t.g.readyState:0}function Kr(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Hr(t){var e="";return Ie(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Gr(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Hr(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function Wr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qr(t){this.Ca=0,this.i=[],this.j=new un,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Wr("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Wr("baseRetryDelayMs",5e3,t),this.bb=Wr("retryDelaySeedMs",1e4,t),this.$a=Wr("forwardChannelMaxRetries",2,t),this.ta=Wr("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new mr(t&&t.concurrentRequestLimit),this.Fa=new Sr,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Jr(t){if(Yr(t),3==t.G){var e=t.U++,n=Qn(t.F);Zn(n,"SID",t.I),Zn(n,"RID",e),Zn(n,"TYPE","terminate"),es(t,n),(e=new Dn(t,t.j,e,void 0)).K=2,e.v=tr(Qn(n)),n=!1,kt.navigator&&kt.navigator.sendBeacon&&(n=kt.navigator.sendBeacon(e.v.toString(),"")),!n&&kt.Image&&((new Image).src=e.v,n=!0),n||(e.g=fs(e.l,null),e.g.da(e.v)),e.F=Date.now(),qn(e)}ls(t)}function Xr(t){t.g&&(is(t),t.g.cancel(),t.g=null)}function Yr(t){Xr(t),t.u&&(kt.clearTimeout(t.u),t.u=null),as(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zr(t){vr(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function ts(t,e){var n;n=e?e.m:t.U++;var r=Qn(t.F);Zn(r,"SID",t.I),Zn(r,"RID",n),Zn(r,"AID",t.T),es(t,r),t.o&&t.s&&Gr(r,t.o,t.s),n=new Dn(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=ns(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),br(t.h,n),Mn(n,r,e)}function es(t,e){t.ia&&Ie(t.ia,(function(t,n){Zn(e,n,t)})),t.l&&Hn({},(function(t,n){Zn(e,n,t)}))}function ns(t,e,n){n=Math.min(t.i.length,n);var r=t.l?xt(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{Ar(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function rs(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function ss(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),us(t,t.A)),t.A++,!0)}function is(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function os(t){t.g=new Dn(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Qn(t.sa);Zn(e,"RID","rpc"),Zn(e,"SID",t.I),Zn(e,"CI",t.L?"0":"1"),Zn(e,"AID",t.T),Zn(e,"TYPE","xmlhttp"),es(t,e),t.o&&t.s&&Gr(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=tr(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function as(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cs(t,e){var n=null;if(t.g==e){as(t),is(t),t.g=null;var r=2}else{if(!Ir(t.h,e))return;n=e.D,Er(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;qe(r=fn(),new vn(r,n)),Zr(t)}else rs(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(wr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=wn(xt(t.Ja,t,e),us(t,t.C)),t.C++,0)))}(t,e)||2==r&&ss(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:hs(t,5);break;case 4:hs(t,10);break;case 3:hs(t,6);break;default:hs(t,2)}}function us(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hs(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=xt(t.kb,t);n||(n=new Wn("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Jn(n,"https"),tr(n)),function(t,e){var n=new un;if(kt.Image){var r=new Image;r.onload=Ut(Cr,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Ut(Cr,n,r,"TestLoadImage: error",!1,e),r.onabort=Ut(Cr,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Ut(Cr,n,r,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else yn(2);t.G=0,t.l&&t.l.va(e),ls(t),Yr(t)}function ls(t){if(t.G=0,t.la=[],t.l){var e=_r(t.h);0==e.length&&0==t.i.length||(Bt(t.la,e),Bt(t.la,t.i),t.h.i.length=0,jt(t.i),t.i.length=0),t.l.ua()}}function ds(t,e,n){var r=n instanceof Wn?Qn(n):new Wn(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Xn(r,r.m);else{var s=kt.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Wn(null,void 0);r&&Jn(i,r),e&&(i.g=e),s&&Xn(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&Zn(r,n,e),Zn(r,"VER",t.ma),es(t,r),r}function fs(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Mr(new kr({jb:!0})):new Mr(t.ra)).Ka(t.H),e}function ps(){}function gs(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function ms(t,e){Ve.call(this),this.g=new Qr(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Kt(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Kt(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ws(this)}function ys(t){Cn.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function vs(){kn.call(this),this.status=1}function ws(t){this.g=t}(St=Mr.prototype).Ka=function(t){this.L=t},St.da=function(t,e,n,r){var s,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():Sn.g(),this.C=this.u?_n(this.u):_n(Sn),this.g.onreadystatechange=xt(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Vr(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=_t(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=qt(Fr,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=_t(n),f=d.next();!f.done;f=d.next()){var p=Tt(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{zr(this),0<this.B&&((this.K=function(t){return te&&le()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=xt(this.qa,this)):this.A=en(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Vr(this,l)}},St.qa=function(){void 0!==Ct&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,qe(this,"timeout"),this.abort(8))},St.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,qe(this,"complete"),qe(this,"abort"),Br(this))},St.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Br(this,!0)),Mr.X.M.call(this)},St.Ha=function(){this.s||(this.F||this.v||this.l?jr(this):this.fb())},St.fb=function(){jr(this)},St.aa=function(){try{return 2<$r(this)?this.g.status:-1}catch(t){return-1}},St.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},St.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Pr(e)}},St.Ea=function(){return this.m},St.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(St=Qr.prototype).ma=8,St.G=1,St.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Dn(this,this.j,t,void 0),n=this.s;if(this.S&&(n?_e(n=be(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=ns(this,e,r),Zn(s=Qn(this.F),"RID",t),Zn(s,"CVER",22),this.D&&Zn(s,"X-HTTP-Session-Id",this.D),es(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Hr(n)))+"&"+r:this.o&&Gr(s,this.o,n)),br(this.h,e),this.Ya&&Zn(s,"TYPE","init"),this.O?(Zn(s,"$req",r),Zn(s,"SID","null"),e.Z=!0,Mn(e,s,null)):Mn(e,s,r),this.G=2}}else 3==this.G&&(t?ts(this,t):0==this.i.length||vr(this.h)||ts(this))},St.Ia=function(){if(this.u=null,os(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=wn(xt(this.eb,this),t)}},St.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,yn(10),Xr(this),os(this))},St.cb=function(){null!=this.v&&(this.v=null,Xr(this),ss(this),yn(19))},St.kb=function(t){t?(this.j.info("Successfully pinged google.com"),yn(2)):(this.j.info("Failed to ping google.com"),yn(1))},(St=ps.prototype).xa=function(){},St.wa=function(){},St.va=function(){},St.ua=function(){},St.Ra=function(){},gs.prototype.g=function(t,e){return new ms(t,e)},Ft(ms,Ve),ms.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;yn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=ds(t,null,t.V),Zr(t)},ms.prototype.close=function(){Jr(this.g)},ms.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Be(t),t=n);e.i.push(new gr(e.ab++,t)),3==e.G&&Zr(e)},ms.prototype.M=function(){this.g.l=null,delete this.j,Jr(this.g),delete this.g,ms.X.M.call(this)},Ft(ys,Cn),Ft(vs,kn),Ft(ws,ps),ws.prototype.xa=function(){qe(this.g,"a")},ws.prototype.wa=function(t){qe(this.g,new ys(t))},ws.prototype.va=function(t){qe(this.g,new vs)},ws.prototype.ua=function(){qe(this.g,"b")},gs.prototype.createWebChannel=gs.prototype.g,ms.prototype.send=ms.prototype.u,ms.prototype.open=ms.prototype.m,ms.prototype.close=ms.prototype.close,In.NO_ERROR=0,In.TIMEOUT=8,In.HTTP_ERROR=6,bn.COMPLETE="complete",Tn.EventType=An,An.OPEN="a",An.CLOSE="b",An.ERROR="c",An.MESSAGE="d",Ve.prototype.listen=Ve.prototype.N,Mr.prototype.listenOnce=Mr.prototype.O,Mr.prototype.getLastError=Mr.prototype.Oa,Mr.prototype.getLastErrorCode=Mr.prototype.Ea,Mr.prototype.getStatus=Mr.prototype.aa,Mr.prototype.getResponseJson=Mr.prototype.Sa,Mr.prototype.getResponseText=Mr.prototype.fa,Mr.prototype.send=Mr.prototype.da,Mr.prototype.setWithCredentials=Mr.prototype.Ka;var Is=In,bs=bn,Es=ln,_s=10,Ts=11,Ss=kr,As=Tn,Cs=Mr;const ks="@firebase/firestore";
|
|
314
|
+
*/var wt;wt="",nt(new b("platform-logger",(t=>new G(t)),"PRIVATE")),nt(new b("heartbeat",(t=>new gt(t)),"PRIVATE")),ut(W,Q,wt),ut(W,Q,"esm2017"),ut("fire-js","");var It=function(t,e){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},It(t,e)};function bt(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Tt(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}var Et,_t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},St=St||{},Ct=_t||self;function kt(){}function At(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function Nt(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Dt="closure_uid_"+(1e9*Math.random()>>>0),Rt=0;function Ot(t,e,n){return t.call.apply(t.bind,arguments)}function Lt(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Pt(t,e,n){return(Pt=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Ot:Lt).apply(null,arguments)}function Mt(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function xt(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}function Ut(){this.s=this.s,this.o=this.o}Ut.prototype.s=!1,Ut.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Dt)&&t[Dt]||(t[Dt]=++Rt))},Ut.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Ft=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Vt(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function qt(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(At(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function jt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}jt.prototype.h=function(){this.defaultPrevented=!0};var Bt=function(){if(!Ct.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Ct.addEventListener("test",kt,e),Ct.removeEventListener("test",kt,e)}catch(t){}return t}();function zt(t){return/^[\s\xa0]*$/.test(t)}var $t=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Kt(t,e){return t<e?-1:t>e?1:0}function Ht(){var t=Ct.navigator;return t&&(t=t.userAgent)?t:""}function Gt(t){return-1!=Ht().indexOf(t)}function Wt(t){return Wt[" "](t),t}Wt[" "]=kt;var Qt,Yt,Xt=Gt("Opera"),Jt=Gt("Trident")||Gt("MSIE"),Zt=Gt("Edge"),te=Zt||Jt,ee=Gt("Gecko")&&!(-1!=Ht().toLowerCase().indexOf("webkit")&&!Gt("Edge"))&&!(Gt("Trident")||Gt("MSIE"))&&!Gt("Edge"),ne=-1!=Ht().toLowerCase().indexOf("webkit")&&!Gt("Edge");function re(){var t=Ct.document;return t?t.documentMode:void 0}t:{var se="",ie=(Yt=Ht(),ee?/rv:([^\);]+)(\)|;)/.exec(Yt):Zt?/Edge\/([\d\.]+)/.exec(Yt):Jt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Yt):ne?/WebKit\/(\S+)/.exec(Yt):Xt?/(?:Version)[ \/]?(\S+)/.exec(Yt):void 0);if(ie&&(se=ie?ie[1]:""),Jt){var oe=re();if(null!=oe&&oe>parseFloat(se)){Qt=String(oe);break t}}Qt=se}var ae,ce={};function ue(){return function(t){var e=ce;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=$t(String(Qt)).split("."),n=$t("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=Kt(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Kt(0==i[2].length,0==o[2].length)||Kt(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(Ct.document&&Jt){var he=re();ae=he||(parseInt(Qt,10)||void 0)}else ae=void 0;var le=ae;function de(t,e){if(jt.call(this,t?t.type:""),this.relatedTarget=this.g=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.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(ee){t:{try{Wt(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,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!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:fe[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&de.X.h.call(this)}}xt(de,jt);var fe={2:"touch",3:"pen",4:"mouse"};de.prototype.h=function(){de.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var pe="closure_listenable_"+(1e6*Math.random()|0),ge=0;function me(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,this.key=++ge,this.ba=this.ea=!1}function ye(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function ve(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function we(t){var e={};for(var n in t)e[n]=t[n];return e}var Ie="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function be(t,e){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Te(t){this.src=t,this.g={},this.h=0}function Ee(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=Ft(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(ye(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function _e(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}Te.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=_e(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new me(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var Se="closure_lm_"+(1e6*Math.random()|0),Ce={};function ke(t,e,n,r,s){if(r&&r.once)return Ne(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)ke(t,e[i],n,r,s);return null}return n=xe(n),t&&t[pe]?t.N(e,n,Nt(r)?!!r.capture:!!r,s):Ae(t,e,n,!1,r,s)}function Ae(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Nt(s)?!!s.capture:!!s,a=Pe(t);if(a||(t[Se]=a=new Te(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Le;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Bt||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Oe(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Ne(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,r,s);return null}return n=xe(n),t&&t[pe]?t.O(e,n,Nt(r)?!!r.capture:!!r,s):Ae(t,e,n,!0,r,s)}function De(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)De(t,e[i],n,r,s);else r=Nt(r)?!!r.capture:!!r,n=xe(n),t&&t[pe]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=_e(i=t.g[e],n,r,s))&&(ye(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=Pe(t))&&(e=t.g[e.toString()],t=-1,e&&(t=_e(e,n,r,s)),(n=-1<t?e[t]:null)&&Re(n))}function Re(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[pe])Ee(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Oe(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Pe(e))?(Ee(n,t),0==n.h&&(n.src=null,e[Se]=null)):ye(t)}}}function Oe(t){return t in Ce?Ce[t]:Ce[t]="on"+t}function Le(t,e){if(t.ba)t=!0;else{e=new de(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&Re(t),t=n.call(r,e)}return t}function Pe(t){return(t=t[Se])instanceof Te?t:null}var Me="__closure_events_fn_"+(1e9*Math.random()>>>0);function xe(t){return"function"==typeof t?t:(t[Me]||(t[Me]=function(e){return t.handleEvent(e)}),t[Me])}function Ue(){Ut.call(this),this.i=new Te(this),this.P=this,this.I=null}function Fe(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new jt(e,t);else if(e instanceof jt)e.target=e.target||t;else{var s=e;be(e=new jt(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=Ve(o,r,!0,e)&&s}if(s=Ve(o=e.g=t,r,!0,e)&&s,s=Ve(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=Ve(o=e.g=n[i],r,!1,e)&&s}function Ve(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&Ee(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}xt(Ue,Ut),Ue.prototype[pe]=!0,Ue.prototype.removeEventListener=function(t,e,n,r){De(this,t,e,n,r)},Ue.prototype.M=function(){if(Ue.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)ye(n[r]);delete e.g[t],e.h--}}this.I=null},Ue.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Ue.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var qe=Ct.JSON.stringify;function je(){var t=Qe,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Be,ze=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=$e.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),$e=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new Ke}),(function(t){return t.reset()})),Ke=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function He(t){Ct.setTimeout((function(){throw t}),0)}function Ge(t,e){Be||function(){var t=Ct.Promise.resolve(void 0);Be=function(){t.then(Ye)}}(),We||(Be(),We=!0),Qe.add(t,e)}var We=!1,Qe=new ze;function Ye(){for(var t;t=je();){try{t.h.call(t.g)}catch(t){He(t)}var e=$e;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}We=!1}function Xe(t,e){Ue.call(this),this.h=t||1,this.g=e||Ct,this.j=Pt(this.lb,this),this.l=Date.now()}function Je(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Ze(t,e,n){if("function"==typeof t)n&&(t=Pt(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Pt(t.handleEvent,t)}return 2147483647<Number(e)?-1:Ct.setTimeout(t,e||0)}function tn(t){t.g=Ze((function(){t.g=null,t.i&&(t.i=!1,tn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}xt(Xe,Ue),(Et=Xe.prototype).ca=!1,Et.R=null,Et.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Fe(this,"tick"),this.ca&&(Je(this),this.start()))}},Et.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},Et.M=function(){Xe.X.M.call(this),Je(this),delete this.g};var en=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}It(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:tn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(Ct.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Ut);function nn(t){Ut.call(this),this.h=t,this.g={}}xt(nn,Ut);var rn=[];function sn(t,e,n,r){Array.isArray(n)||(n&&(rn[0]=n.toString()),n=rn);for(var s=0;s<n.length;s++){var i=ke(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function on(t){ve(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Re(t)}),t),t.g={}}function an(){this.g=!0}function cn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return qe(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}nn.prototype.M=function(){nn.X.M.call(this),on(this)},nn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},an.prototype.Aa=function(){this.g=!1},an.prototype.info=function(){};var un={},hn=null;function ln(){return hn=hn||new Ue}function dn(t){jt.call(this,un.Pa,t)}function fn(t){var e=ln();Fe(e,new dn(e))}function pn(t,e){jt.call(this,un.STAT_EVENT,t),this.stat=e}function gn(t){var e=ln();Fe(e,new pn(e,t))}function mn(t,e){jt.call(this,un.Qa,t),this.size=e}function yn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return Ct.setTimeout((function(){t()}),e)}un.Pa="serverreachability",xt(dn,jt),un.STAT_EVENT="statevent",xt(pn,jt),un.Qa="timingevent",xt(mn,jt);var vn={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},wn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function In(){}function bn(t){return t.h||(t.h=t.i())}function Tn(){}In.prototype.h=null;var En,_n={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Sn(){jt.call(this,"d")}function Cn(){jt.call(this,"c")}function kn(){}function An(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new nn(this),this.O=Dn,t=te?125:void 0,this.T=new Xe(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new Nn}function Nn(){this.i=null,this.g="",this.h=!1}xt(Sn,jt),xt(Cn,jt),xt(kn,In),kn.prototype.g=function(){return new XMLHttpRequest},kn.prototype.i=function(){return{}},En=new kn;var Dn=45e3,Rn={},On={};function Ln(t,e,n){t.K=1,t.v=Jn(Gn(e)),t.s=n,t.P=!0,Pn(t,null)}function Pn(t,e){t.F=Date.now(),Fn(t),t.A=Gn(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),lr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Nn,t.g=ls(t.l,n?e:null,!t.s),0<t.N&&(t.L=new en(Pt(t.La,t,t.g),t.N)),sn(t.S,t.g,"readystatechange",t.ib),e=t.H?we(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),fn(),function(t,e,n,r,s,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Mn(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function xn(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Un(t,n))==On){4==e&&(t.o=4,gn(14),s=!1),cn(t.j,t.m,null,"[Incomplete Response]");break}if(r==Rn){t.o=4,gn(15),cn(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}cn(t.j,t.m,r,null),zn(t,r)}Mn(t)&&r!=On&&r!=Rn&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,gn(16),s=!1),t.i=t.i&&s,s?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),rs(e),e.K=!0,gn(11))):(cn(t.j,t.m,n,"[Invalid Chunked Response]"),Bn(t),jn(t))}function Un(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?On:(n=Number(e.substring(n,r)),isNaN(n)?Rn:(r+=1)+n>e.length?On:(e=e.substr(r,n),t.C=r+n,e))}function Fn(t){t.V=Date.now()+t.O,Vn(t,t.O)}function Vn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=yn(Pt(t.gb,t),e)}function qn(t){t.B&&(Ct.clearTimeout(t.B),t.B=null)}function jn(t){0==t.l.G||t.I||os(t.l,t)}function Bn(t){qn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Je(t.T),on(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function zn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||vr(n.h,t)))if(!t.J&&vr(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;is(n),Qr(n)}ns(n),gn(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=yn(Pt(n.cb,n),6e3));if(1>=yr(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else cs(n,11)}else if((t.J||n.g==t)&&is(n),!zt(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(wr(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Xn(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=hs(r,r.H?r.ka:null,r.V),f.J){Ir(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(qn(p),Fn(p)),r.g=f}else es(r);0<n.i.length&&Xr(n)}else"stop"!=i[0]&&"close"!=i[0]||cs(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?cs(n,7):Wr(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}fn()}catch(i){}}function $n(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(At(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(At(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(At(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}(Et=An.prototype).setTimeout=function(t){this.O=t},Et.ib=function(t){t=t.target;var e=this.L;e&&3==Br(t)?e.l():this.La(t)},Et.La=function(t){try{if(t==this.g)t:{var e=Br(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||te||this.g&&(this.h.h||this.g.fa()||zr(this.g)))){this.I||4!=e||7==n||fn(),qn(this);var r=this.g.aa();this.Y=r;e:if(Mn(this)){var s=zr(this.g);t="";var i=s.length,o=4==Br(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Bn(this),jn(this);var a="";break e}this.h.i=new Ct.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!zt(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,gn(12),Bn(this),jn(this);break t}cn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,zn(this,r)}this.P?(xn(this,e,a),te&&this.i&&3==e&&(sn(this.S,this.T,"tick",this.hb),this.T.start())):(cn(this.j,this.m,a,null),zn(this,a)),4==e&&Bn(this),this.i&&!this.I&&(4==e?os(this.l,this):(this.i=!1,Fn(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,gn(12)):(this.o=0,gn(13)),Bn(this),jn(this)}}}catch(e){}},Et.hb=function(){if(this.g){var t=Br(this.g),e=this.g.fa();this.C<e.length&&(qn(this),xn(this,t,e),this.i&&4!=t&&Fn(this))}},Et.cancel=function(){this.I=!0,Bn(this)},Et.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(fn(),gn(17)),Bn(this),this.o=2,jn(this)):Vn(this,this.V-t)};var Kn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Hn(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Hn){this.h=void 0!==e?e:t.h,Wn(this,t.j),this.s=t.s,this.g=t.g,Qn(this,t.m),this.l=t.l,e=t.i;var n=new ar;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Yn(this,n),this.o=t.o}else t&&(n=String(t).match(Kn))?(this.h=!!e,Wn(this,n[1]||"",!0),this.s=Zn(n[2]||""),this.g=Zn(n[3]||"",!0),Qn(this,n[4]),this.l=Zn(n[5]||"",!0),Yn(this,n[6]||"",!0),this.o=Zn(n[7]||"")):(this.h=!!e,this.i=new ar(null,this.h))}function Gn(t){return new Hn(t)}function Wn(t,e,n){t.j=n?Zn(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Qn(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Yn(t,e,n){e instanceof ar?(t.i=e,function(t,e){e&&!t.j&&(cr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ur(this,e),lr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=tr(e,ir)),t.i=new ar(e,t.h))}function Xn(t,e,n){t.i.set(e,n)}function Jn(t){return Xn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Zn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function tr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,er),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function er(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Hn.prototype.toString=function(){var t=[],e=this.j;e&&t.push(tr(e,nr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(tr(e,nr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(tr(n,"/"==n.charAt(0)?sr:rr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",tr(n,or)),t.join("")};var nr=/[#\/\?@]/g,rr=/[#\?:]/g,sr=/[#\?]/g,ir=/[#\?@]/g,or=/#/g;function ar(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function cr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function ur(t,e){cr(t),e=dr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function hr(t,e){return cr(t),e=dr(t,e),t.g.has(e)}function lr(t,e,n){ur(t,e),0<n.length&&(t.i=null,t.g.set(dr(t,e),Vt(n)),t.h+=n.length)}function dr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(Et=ar.prototype).add=function(t,e){cr(this),this.i=null,t=dr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},Et.forEach=function(t,e){cr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},Et.oa=function(){cr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},Et.W=function(t){cr(this);var e=[];if("string"==typeof t)hr(this,t)&&(e=e.concat(this.g.get(dr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},Et.set=function(t,e){return cr(this),this.i=null,hr(this,t=dr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},Et.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},Et.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var fr=function(t,e){this.h=t,this.g=e};function pr(t){this.l=t||gr,Ct.PerformanceNavigationTiming?t=0<(t=Ct.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(Ct.g&&Ct.g.Ga&&Ct.g.Ga()&&Ct.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var gr=10;function mr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function yr(t){return t.h?1:t.g?t.g.size:0}function vr(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function wr(t,e){t.g?t.g.add(e):t.h=e}function Ir(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function br(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=bt(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return Vt(t.i)}function Tr(){}function Er(){this.g=new Tr}function _r(t,e,n){var r=n||"";try{$n(t,(function(t,n){var s=t;Nt(t)&&(s=qe(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Sr(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function Cr(t){this.l=t.ac||null,this.j=t.jb||!1}function kr(t,e){Ue.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Ar,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}pr.prototype.cancel=function(){var t,e;if(this.i=br(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=bt(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Tr.prototype.stringify=function(t){return Ct.JSON.stringify(t,void 0)},Tr.prototype.parse=function(t){return Ct.JSON.parse(t,void 0)},xt(Cr,In),Cr.prototype.g=function(){return new kr(this.l,this.j)},Cr.prototype.i=function(t){return function(){return t}}({}),xt(kr,Ue);var Ar=0;function Nr(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Dr(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Rr(t)}function Rr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(Et=kr.prototype).open=function(t,e){if(this.readyState!=Ar)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Rr(this)},Et.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||Ct).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},Et.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Dr(this)),this.readyState=Ar},Et.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Rr(this)),this.g&&(this.readyState=3,Rr(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==Ct.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Nr(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},Et.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Dr(this):Rr(this),3==this.readyState&&Nr(this)}},Et.Va=function(t){this.g&&(this.response=this.responseText=t,Dr(this))},Et.Ua=function(t){this.g&&(this.response=t,Dr(this))},Et.ga=function(){this.g&&Dr(this)},Et.setRequestHeader=function(t,e){this.v.append(t,e)},Et.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},Et.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(kr.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Or=Ct.JSON.parse;function Lr(t){Ue.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Pr,this.K=this.L=!1}xt(Lr,Ue);var Pr="",Mr=/^https?$/i,xr=["POST","PUT"];function Ur(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Fr(t),qr(t)}function Fr(t){t.D||(t.D=!0,Fe(t,"complete"),Fe(t,"error"))}function Vr(t){if(t.h&&void 0!==St&&(!t.C[1]||4!=Br(t)||2!=t.aa()))if(t.v&&4==Br(t))Ze(t.Ha,0,t);else if(Fe(t,"readystatechange"),4==Br(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match(Kn)[1]||null;if(!i&&Ct.self&&Ct.self.location){var o=Ct.self.location.protocol;i=o.substr(0,o.length-1)}s=!Mr.test(i?i.toLowerCase():"")}e=s}if(e)Fe(t,"complete"),Fe(t,"success");else{t.m=6;try{var a=2<Br(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Fr(t)}}finally{qr(t)}}}function qr(t,e){if(t.g){jr(t);var n=t.g,r=t.C[0]?kt:null;t.g=null,t.C=null,e||Fe(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function jr(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(Ct.clearTimeout(t.A),t.A=null)}function Br(t){return t.g?t.g.readyState:0}function zr(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Pr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function $r(t){var e="";return ve(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Kr(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=$r(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Xn(t,e,n))}function Hr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Gr(t){this.Ca=0,this.i=[],this.j=new an,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Hr("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Hr("baseRetryDelayMs",5e3,t),this.bb=Hr("retryDelaySeedMs",1e4,t),this.$a=Hr("forwardChannelMaxRetries",2,t),this.ta=Hr("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new pr(t&&t.concurrentRequestLimit),this.Fa=new Er,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Wr(t){if(Yr(t),3==t.G){var e=t.U++,n=Gn(t.F);Xn(n,"SID",t.I),Xn(n,"RID",e),Xn(n,"TYPE","terminate"),Zr(t,n),(e=new An(t,t.j,e,void 0)).K=2,e.v=Jn(Gn(n)),n=!1,Ct.navigator&&Ct.navigator.sendBeacon&&(n=Ct.navigator.sendBeacon(e.v.toString(),"")),!n&&Ct.Image&&((new Image).src=e.v,n=!0),n||(e.g=ls(e.l,null),e.g.da(e.v)),e.F=Date.now(),Fn(e)}us(t)}function Qr(t){t.g&&(rs(t),t.g.cancel(),t.g=null)}function Yr(t){Qr(t),t.u&&(Ct.clearTimeout(t.u),t.u=null),is(t),t.h.cancel(),t.m&&("number"==typeof t.m&&Ct.clearTimeout(t.m),t.m=null)}function Xr(t){mr(t.h)||t.m||(t.m=!0,Ge(t.Ja,t),t.C=0)}function Jr(t,e){var n;n=e?e.m:t.U++;var r=Gn(t.F);Xn(r,"SID",t.I),Xn(r,"RID",n),Xn(r,"AID",t.T),Zr(t,r),t.o&&t.s&&Kr(r,t.o,t.s),n=new An(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=ts(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),wr(t.h,n),Ln(n,r,e)}function Zr(t,e){t.ia&&ve(t.ia,(function(t,n){Xn(e,n,t)})),t.l&&$n({},(function(t,n){Xn(e,n,t)}))}function ts(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Pt(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{_r(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function es(t){t.g||t.u||(t.Z=1,Ge(t.Ia,t),t.A=0)}function ns(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=yn(Pt(t.Ia,t),as(t,t.A)),t.A++,!0)}function rs(t){null!=t.B&&(Ct.clearTimeout(t.B),t.B=null)}function ss(t){t.g=new An(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Gn(t.sa);Xn(e,"RID","rpc"),Xn(e,"SID",t.I),Xn(e,"CI",t.L?"0":"1"),Xn(e,"AID",t.T),Xn(e,"TYPE","xmlhttp"),Zr(t,e),t.o&&t.s&&Kr(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Jn(Gn(e)),n.s=null,n.P=!0,Pn(n,t)}function is(t){null!=t.v&&(Ct.clearTimeout(t.v),t.v=null)}function os(t,e){var n=null;if(t.g==e){is(t),rs(t),t.g=null;var r=2}else{if(!vr(t.h,e))return;n=e.D,Ir(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;Fe(r=ln(),new mn(r,n)),Xr(t)}else es(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(yr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=yn(Pt(t.Ja,t,e),as(t,t.C)),t.C++,0)))}(t,e)||2==r&&ns(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:cs(t,5);break;case 4:cs(t,10);break;case 3:cs(t,6);break;default:cs(t,2)}}function as(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function cs(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Pt(t.kb,t);n||(n=new Hn("//www.google.com/images/cleardot.gif"),Ct.location&&"http"==Ct.location.protocol||Wn(n,"https"),Jn(n)),function(t,e){var n=new an;if(Ct.Image){var r=new Image;r.onload=Mt(Sr,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Mt(Sr,n,r,"TestLoadImage: error",!1,e),r.onabort=Mt(Sr,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Mt(Sr,n,r,"TestLoadImage: timeout",!1,e),Ct.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else gn(2);t.G=0,t.l&&t.l.va(e),us(t),Yr(t)}function us(t){if(t.G=0,t.la=[],t.l){var e=br(t.h);0==e.length&&0==t.i.length||(qt(t.la,e),qt(t.la,t.i),t.h.i.length=0,Vt(t.i),t.i.length=0),t.l.ua()}}function hs(t,e,n){var r=n instanceof Hn?Gn(n):new Hn(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Qn(r,r.m);else{var s=Ct.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Hn(null,void 0);r&&Wn(i,r),e&&(i.g=e),s&&Qn(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&Xn(r,n,e),Xn(r,"VER",t.ma),Zr(t,r),r}function ls(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Lr(new Cr({jb:!0})):new Lr(t.ra)).Ka(t.H),e}function ds(){}function fs(){if(Jt&&!(10<=Number(le)))throw Error("Environmental error: no available transport.")}function ps(t,e){Ue.call(this),this.g=new Gr(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!zt(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!zt(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ys(this)}function gs(t){Sn.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function ms(){Cn.call(this),this.status=1}function ys(t){this.g=t}(Et=Lr.prototype).Ka=function(t){this.L=t},Et.da=function(t,e,n,r){var s,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():En.g(),this.C=this.u?bn(this.u):bn(En),this.g.onreadystatechange=Pt(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Ur(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=bt(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=Ct.FormData&&t instanceof Ct.FormData,!(0<=Ft(xr,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=bt(n),f=d.next();!f.done;f=d.next()){var p=Tt(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{jr(this),0<this.B&&((this.K=function(t){return Jt&&ue()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Pt(this.qa,this)):this.A=Ze(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Ur(this,l)}},Et.qa=function(){void 0!==St&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Fe(this,"timeout"),this.abort(8))},Et.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Fe(this,"complete"),Fe(this,"abort"),qr(this))},Et.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),qr(this,!0)),Lr.X.M.call(this)},Et.Ha=function(){this.s||(this.F||this.v||this.l?Vr(this):this.fb())},Et.fb=function(){Vr(this)},Et.aa=function(){try{return 2<Br(this)?this.g.status:-1}catch(t){return-1}},Et.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},Et.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Or(e)}},Et.Ea=function(){return this.m},Et.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(Et=Gr.prototype).ma=8,Et.G=1,Et.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new An(this,this.j,t,void 0),n=this.s;if(this.S&&(n?be(n=we(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=ts(this,e,r),Xn(s=Gn(this.F),"RID",t),Xn(s,"CVER",22),this.D&&Xn(s,"X-HTTP-Session-Id",this.D),Zr(this,s),n&&(this.N?r="headers="+encodeURIComponent(String($r(n)))+"&"+r:this.o&&Kr(s,this.o,n)),wr(this.h,e),this.Ya&&Xn(s,"TYPE","init"),this.O?(Xn(s,"$req",r),Xn(s,"SID","null"),e.Z=!0,Ln(e,s,null)):Ln(e,s,r),this.G=2}}else 3==this.G&&(t?Jr(this,t):0==this.i.length||mr(this.h)||Jr(this))},Et.Ia=function(){if(this.u=null,ss(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=yn(Pt(this.eb,this),t)}},Et.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,gn(10),Qr(this),ss(this))},Et.cb=function(){null!=this.v&&(this.v=null,Qr(this),ns(this),gn(19))},Et.kb=function(t){t?(this.j.info("Successfully pinged google.com"),gn(2)):(this.j.info("Failed to ping google.com"),gn(1))},(Et=ds.prototype).xa=function(){},Et.wa=function(){},Et.va=function(){},Et.ua=function(){},Et.Ra=function(){},fs.prototype.g=function(t,e){return new ps(t,e)},xt(ps,Ue),ps.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;gn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=hs(t,null,t.V),Xr(t)},ps.prototype.close=function(){Wr(this.g)},ps.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=qe(t),t=n);e.i.push(new fr(e.ab++,t)),3==e.G&&Xr(e)},ps.prototype.M=function(){this.g.l=null,delete this.j,Wr(this.g),delete this.g,ps.X.M.call(this)},xt(gs,Sn),xt(ms,Cn),xt(ys,ds),ys.prototype.xa=function(){Fe(this.g,"a")},ys.prototype.wa=function(t){Fe(this.g,new gs(t))},ys.prototype.va=function(t){Fe(this.g,new ms)},ys.prototype.ua=function(){Fe(this.g,"b")},fs.prototype.createWebChannel=fs.prototype.g,ps.prototype.send=ps.prototype.u,ps.prototype.open=ps.prototype.m,ps.prototype.close=ps.prototype.close,vn.NO_ERROR=0,vn.TIMEOUT=8,vn.HTTP_ERROR=6,wn.COMPLETE="complete",Tn.EventType=_n,_n.OPEN="a",_n.CLOSE="b",_n.ERROR="c",_n.MESSAGE="d",Ue.prototype.listen=Ue.prototype.N,Lr.prototype.listenOnce=Lr.prototype.O,Lr.prototype.getLastError=Lr.prototype.Oa,Lr.prototype.getLastErrorCode=Lr.prototype.Ea,Lr.prototype.getStatus=Lr.prototype.aa,Lr.prototype.getResponseJson=Lr.prototype.Sa,Lr.prototype.getResponseText=Lr.prototype.fa,Lr.prototype.send=Lr.prototype.da,Lr.prototype.setWithCredentials=Lr.prototype.Ka;var vs=vn,ws=wn,Is=un,bs=10,Ts=11,Es=Cr,_s=Tn,Ss=Lr;const Cs="@firebase/firestore";
|
|
316
315
|
/**
|
|
317
316
|
* @license
|
|
318
317
|
* Copyright 2017 Google LLC
|
|
@@ -328,7 +327,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
328
327
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
329
328
|
* See the License for the specific language governing permissions and
|
|
330
329
|
* limitations under the License.
|
|
331
|
-
*/class
|
|
330
|
+
*/class ks{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}ks.UNAUTHENTICATED=new ks(null),ks.GOOGLE_CREDENTIALS=new ks("google-credentials-uid"),ks.FIRST_PARTY=new ks("first-party-uid"),ks.MOCK_USER=new ks("mock-user");
|
|
332
331
|
/**
|
|
333
332
|
* @license
|
|
334
333
|
* Copyright 2017 Google LLC
|
|
@@ -345,7 +344,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
345
344
|
* See the License for the specific language governing permissions and
|
|
346
345
|
* limitations under the License.
|
|
347
346
|
*/
|
|
348
|
-
let
|
|
347
|
+
let As="9.15.0";
|
|
349
348
|
/**
|
|
350
349
|
* @license
|
|
351
350
|
* Copyright 2017 Google LLC
|
|
@@ -361,7 +360,7 @@ let Ds="9.15.0";
|
|
|
361
360
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
362
361
|
* See the License for the specific language governing permissions and
|
|
363
362
|
* limitations under the License.
|
|
364
|
-
*/const
|
|
363
|
+
*/const Ns=new D("@firebase/firestore");function Ds(){return Ns.logLevel}function Rs(t,...e){if(Ns.logLevel<=S.DEBUG){const n=e.map(Ps);Ns.debug(`Firestore (${As}): ${t}`,...n)}}function Os(t,...e){if(Ns.logLevel<=S.ERROR){const n=e.map(Ps);Ns.error(`Firestore (${As}): ${t}`,...n)}}function Ls(t,...e){if(Ns.logLevel<=S.WARN){const n=e.map(Ps);Ns.warn(`Firestore (${As}): ${t}`,...n)}}function Ps(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
|
|
365
364
|
/**
|
|
366
365
|
* @license
|
|
367
366
|
* Copyright 2020 Google LLC
|
|
@@ -393,7 +392,7 @@ let Ds="9.15.0";
|
|
|
393
392
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
394
393
|
* See the License for the specific language governing permissions and
|
|
395
394
|
* limitations under the License.
|
|
396
|
-
*/function
|
|
395
|
+
*/function Ms(t="Unexpected state"){const e=`FIRESTORE (${As}) INTERNAL ASSERTION FAILED: `+t;throw Os(e),new Error(e)}function xs(t,e){t||Ms()}function Us(t,e){return t}
|
|
397
396
|
/**
|
|
398
397
|
* @license
|
|
399
398
|
* Copyright 2017 Google LLC
|
|
@@ -409,7 +408,7 @@ let Ds="9.15.0";
|
|
|
409
408
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
410
409
|
* See the License for the specific language governing permissions and
|
|
411
410
|
* limitations under the License.
|
|
412
|
-
*/const
|
|
411
|
+
*/const Fs={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"};class Vs extends h{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
|
|
413
412
|
/**
|
|
414
413
|
* @license
|
|
415
414
|
* Copyright 2017 Google LLC
|
|
@@ -425,7 +424,7 @@ let Ds="9.15.0";
|
|
|
425
424
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
426
425
|
* See the License for the specific language governing permissions and
|
|
427
426
|
* limitations under the License.
|
|
428
|
-
*/class
|
|
427
|
+
*/class qs{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
|
|
429
428
|
/**
|
|
430
429
|
* @license
|
|
431
430
|
* Copyright 2017 Google LLC
|
|
@@ -441,7 +440,7 @@ let Ds="9.15.0";
|
|
|
441
440
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
442
441
|
* See the License for the specific language governing permissions and
|
|
443
442
|
* limitations under the License.
|
|
444
|
-
*/class
|
|
443
|
+
*/class js{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Bs{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(ks.UNAUTHENTICATED)))}shutdown(){}}class zs{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class $s{constructor(t){this.t=t,this.currentUser=ks.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let s=new qs;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new qs,t.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const e=s;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Rs("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Rs("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new qs)}}),0),i()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Rs("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(xs("string"==typeof e.accessToken),new js(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return xs(null===t||"string"==typeof t),new ks(t)}}class Ks{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=ks.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(xs(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class Hs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new Ks(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(ks.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Gs{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Ws{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Rs("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,Rs("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Rs("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):Rs("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(xs("string"==typeof t.token),this.A=t.token,new Gs(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
|
|
445
444
|
/**
|
|
446
445
|
* @license
|
|
447
446
|
* Copyright 2020 Google LLC
|
|
@@ -457,7 +456,7 @@ let Ds="9.15.0";
|
|
|
457
456
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
458
457
|
* See the License for the specific language governing permissions and
|
|
459
458
|
* limitations under the License.
|
|
460
|
-
*/function
|
|
459
|
+
*/function Qs(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
|
|
461
460
|
/**
|
|
462
461
|
* @license
|
|
463
462
|
* Copyright 2017 Google LLC
|
|
@@ -473,7 +472,7 @@ let Ds="9.15.0";
|
|
|
473
472
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
474
473
|
* See the License for the specific language governing permissions and
|
|
475
474
|
* limitations under the License.
|
|
476
|
-
*/class Ys{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length;let n="";for(;n.length<20;){const r=
|
|
475
|
+
*/class Ys{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length;let n="";for(;n.length<20;){const r=Qs(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%t.length))}return n}}function Xs(t,e){return t<e?-1:t>e?1:0}function Js(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
|
|
477
476
|
/**
|
|
478
477
|
* @license
|
|
479
478
|
* Copyright 2017 Google LLC
|
|
@@ -489,7 +488,7 @@ let Ds="9.15.0";
|
|
|
489
488
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
490
489
|
* See the License for the specific language governing permissions and
|
|
491
490
|
* limitations under the License.
|
|
492
|
-
*/class
|
|
491
|
+
*/class Zs{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Vs(Fs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Vs(Fs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Vs(Fs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Vs(Fs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Zs.fromMillis(Date.now())}static fromDate(t){return Zs.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Zs(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Xs(this.nanoseconds,t.nanoseconds):Xs(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
|
|
493
492
|
/**
|
|
494
493
|
* @license
|
|
495
494
|
* Copyright 2017 Google LLC
|
|
@@ -505,7 +504,7 @@ let Ds="9.15.0";
|
|
|
505
504
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
506
505
|
* See the License for the specific language governing permissions and
|
|
507
506
|
* limitations under the License.
|
|
508
|
-
*/class
|
|
507
|
+
*/class ti{constructor(t){this.timestamp=t}static fromTimestamp(t){return new ti(t)}static min(){return new ti(new Zs(0,0))}static max(){return new ti(new Zs(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}
|
|
509
508
|
/**
|
|
510
509
|
* @license
|
|
511
510
|
* Copyright 2017 Google LLC
|
|
@@ -521,7 +520,7 @@ let Ds="9.15.0";
|
|
|
521
520
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
522
521
|
* See the License for the specific language governing permissions and
|
|
523
522
|
* limitations under the License.
|
|
524
|
-
*/class
|
|
523
|
+
*/class ei{constructor(t,e,n){void 0===e?e=0:e>t.length&&Ms(),void 0===n?n=t.length-e:n>t.length-e&&Ms(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===ei.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof ei?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),s=e.get(r);if(n<s)return-1;if(n>s)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class ni extends ei{construct(t,e,n){return new ni(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new ni(e)}static emptyPath(){return new ni([])}}const ri=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class si extends ei{construct(t,e,n){return new si(t,e,n)}static isValidIdentifier(t){return ri.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),si.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new si(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let i=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new Vs(Fs.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Vs(Fs.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(i=!i,r++):"."!==e||i?(n+=e,r++):(s(),r++)}if(s(),i)throw new Vs(Fs.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new si(e)}static emptyPath(){return new si([])}}
|
|
525
524
|
/**
|
|
526
525
|
* @license
|
|
527
526
|
* Copyright 2017 Google LLC
|
|
@@ -537,7 +536,7 @@ let Ds="9.15.0";
|
|
|
537
536
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
538
537
|
* See the License for the specific language governing permissions and
|
|
539
538
|
* limitations under the License.
|
|
540
|
-
*/class
|
|
539
|
+
*/class ii{constructor(t){this.path=t}static fromPath(t){return new ii(ni.fromString(t))}static fromName(t){return new ii(ni.fromString(t).popFirst(5))}static empty(){return new ii(ni.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===ni.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return ni.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new ii(new ni(t.slice()))}}function oi(t){return new ai(t.readTime,t.key,-1)}class ai{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ai(ti.min(),ii.empty(),-1)}static max(){return new ai(ti.max(),ii.empty(),-1)}}function ci(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=ii.comparator(t.documentKey,e.documentKey),0!==n?n:Xs(t.largestBatchId,e.largestBatchId))}
|
|
541
540
|
/**
|
|
542
541
|
* @license
|
|
543
542
|
* Copyright 2020 Google LLC
|
|
@@ -553,7 +552,7 @@ let Ds="9.15.0";
|
|
|
553
552
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
554
553
|
* See the License for the specific language governing permissions and
|
|
555
554
|
* limitations under the License.
|
|
556
|
-
*/class
|
|
555
|
+
*/class ui{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
|
|
557
556
|
/**
|
|
558
557
|
* @license
|
|
559
558
|
* Copyright 2017 Google LLC
|
|
@@ -569,7 +568,7 @@ let Ds="9.15.0";
|
|
|
569
568
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
570
569
|
* See the License for the specific language governing permissions and
|
|
571
570
|
* limitations under the License.
|
|
572
|
-
*/async function
|
|
571
|
+
*/async function hi(t){if(t.code!==Fs.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==t.message)throw t;Rs("LocalStore","Unexpectedly lost primary lease")}
|
|
573
572
|
/**
|
|
574
573
|
* @license
|
|
575
574
|
* Copyright 2017 Google LLC
|
|
@@ -585,7 +584,7 @@ let Ds="9.15.0";
|
|
|
585
584
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
586
585
|
* See the License for the specific language governing permissions and
|
|
587
586
|
* limitations under the License.
|
|
588
|
-
*/class
|
|
587
|
+
*/class li{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&Ms(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new li(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof li?e:li.resolve(e)}catch(t){return li.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):li.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):li.reject(e)}static resolve(t){return new li(((e,n)=>{e(t)}))}static reject(t){return new li(((e,n)=>{n(t)}))}static waitFor(t){return new li(((e,n)=>{let r=0,s=0,i=!1;t.forEach((t=>{++r,t.next((()=>{++s,i&&s===r&&e()}),(t=>n(t)))})),i=!0,s===r&&e()}))}static or(t){let e=li.resolve(!1);for(const n of t)e=e.next((t=>t?li.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}static mapArray(t,e){return new li(((n,r)=>{const s=t.length,i=new Array(s);let o=0;for(let a=0;a<s;a++){const c=a;e(t[c]).next((t=>{i[c]=t,++o,o===s&&n(i)}),(t=>r(t)))}}))}static doWhile(t,e){return new li(((n,r)=>{const s=()=>{!0===t()?e().next((()=>{s()}),r):n()};s()}))}}function di(t){return"IndexedDbTransactionError"===t.name}
|
|
589
588
|
/**
|
|
590
589
|
* @license
|
|
591
590
|
* Copyright 2018 Google LLC
|
|
@@ -601,7 +600,7 @@ let Ds="9.15.0";
|
|
|
601
600
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
602
601
|
* See the License for the specific language governing permissions and
|
|
603
602
|
* limitations under the License.
|
|
604
|
-
*/class
|
|
603
|
+
*/class fi{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.ut(t),this.ct=t=>e.writeSequenceNumber(t))}ut(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ct&&this.ct(t),t}}fi.at=-1;
|
|
605
604
|
/**
|
|
606
605
|
* @license
|
|
607
606
|
* Copyright 2017 Google LLC
|
|
@@ -618,7 +617,7 @@ let Ds="9.15.0";
|
|
|
618
617
|
* See the License for the specific language governing permissions and
|
|
619
618
|
* limitations under the License.
|
|
620
619
|
*/
|
|
621
|
-
class
|
|
620
|
+
class pi{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class gi{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new gi("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof gi&&t.projectId===this.projectId&&t.database===this.database}}
|
|
622
621
|
/**
|
|
623
622
|
* @license
|
|
624
623
|
* Copyright 2017 Google LLC
|
|
@@ -634,7 +633,7 @@ class mi{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
634
633
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
635
634
|
* See the License for the specific language governing permissions and
|
|
636
635
|
* limitations under the License.
|
|
637
|
-
*/function
|
|
636
|
+
*/function mi(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function yi(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function vi(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
|
|
638
637
|
/**
|
|
639
638
|
* @license
|
|
640
639
|
* Copyright 2017 Google LLC
|
|
@@ -650,7 +649,7 @@ class mi{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
650
649
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
651
650
|
* See the License for the specific language governing permissions and
|
|
652
651
|
* limitations under the License.
|
|
653
|
-
*/function
|
|
652
|
+
*/function wi(t){return null==t}function Ii(t){return 0===t&&1/t==-1/0}
|
|
654
653
|
/**
|
|
655
654
|
* @license
|
|
656
655
|
* Copyright 2020 Google LLC
|
|
@@ -667,7 +666,7 @@ class mi{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
667
666
|
* See the License for the specific language governing permissions and
|
|
668
667
|
* limitations under the License.
|
|
669
668
|
*/
|
|
670
|
-
class
|
|
669
|
+
class bi{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new bi(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new bi(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return t=this.binaryString,btoa(t);var t}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}
|
|
671
670
|
/**
|
|
672
671
|
* @license
|
|
673
672
|
* Copyright 2020 Google LLC
|
|
@@ -683,7 +682,7 @@ class _i{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
683
682
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
684
683
|
* See the License for the specific language governing permissions and
|
|
685
684
|
* limitations under the License.
|
|
686
|
-
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return
|
|
685
|
+
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Xs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}bi.EMPTY_BYTE_STRING=new bi("");const Ti=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Ei(t){if(xs(!!t),"string"==typeof t){let e=0;const n=Ti.exec(t);if(xs(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:_i(t.seconds),nanos:_i(t.nanos)}}function _i(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Si(t){return"string"==typeof t?bi.fromBase64String(t):bi.fromUint8Array(t)}
|
|
687
686
|
/**
|
|
688
687
|
* @license
|
|
689
688
|
* Copyright 2020 Google LLC
|
|
@@ -699,7 +698,7 @@ class _i{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
699
698
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
700
699
|
* See the License for the specific language governing permissions and
|
|
701
700
|
* limitations under the License.
|
|
702
|
-
*/function
|
|
701
|
+
*/function Ci(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ki(t){const e=t.mapValue.fields.__previous_value__;return Ci(e)?ki(e):e}function Ai(t){const e=Ei(t.mapValue.fields.__local_write_time__.timestampValue);return new Zs(e.seconds,e.nanos)}
|
|
703
702
|
/**
|
|
704
703
|
* @license
|
|
705
704
|
* Copyright 2020 Google LLC
|
|
@@ -715,7 +714,7 @@ class _i{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
715
714
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
716
715
|
* See the License for the specific language governing permissions and
|
|
717
716
|
* limitations under the License.
|
|
718
|
-
*/const
|
|
717
|
+
*/const Ni={fields:{__type__:{stringValue:"__max__"}}};function Di(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?Ci(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
|
|
719
718
|
/**
|
|
720
719
|
* @license
|
|
721
720
|
* Copyright 2022 Google LLC
|
|
@@ -731,7 +730,7 @@ class _i{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
731
730
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
732
731
|
* See the License for the specific language governing permissions and
|
|
733
732
|
* limitations under the License.
|
|
734
|
-
*/(t)?9007199254740991:10:
|
|
733
|
+
*/(t)?9007199254740991:10:Ms()}function Ri(t,e){if(t===e)return!0;const n=Di(t);if(n!==Di(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ai(t).isEqual(Ai(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=Ei(t.timestampValue),r=Ei(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Si(t.bytesValue).isEqual(Si(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return _i(t.geoPointValue.latitude)===_i(e.geoPointValue.latitude)&&_i(t.geoPointValue.longitude)===_i(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return _i(t.integerValue)===_i(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=_i(t.doubleValue),r=_i(e.doubleValue);return n===r?Ii(n)===Ii(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Js(t.arrayValue.values||[],e.arrayValue.values||[],Ri);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(mi(n)!==mi(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Ri(n[t],r[t])))return!1;return!0}(t,e);default:return Ms()}}function Oi(t,e){return void 0!==(t.values||[]).find((t=>Ri(t,e)))}function Li(t,e){if(t===e)return 0;const n=Di(t),r=Di(e);if(n!==r)return Xs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Xs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=_i(t.integerValue||t.doubleValue),r=_i(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return Pi(t.timestampValue,e.timestampValue);case 4:return Pi(Ai(t),Ai(e));case 5:return Xs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Si(t),r=Si(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=Xs(n[t],r[t]);if(0!==e)return e}return Xs(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Xs(_i(t.latitude),_i(e.latitude));return 0!==n?n:Xs(_i(t.longitude),_i(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Li(n[t],r[t]);if(e)return e}return Xs(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Ni&&e===Ni)return 0;if(t===Ni)return 1;if(e===Ni)return-1;const n=t.fields||{},r=Object.keys(n),s=e.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let t=0;t<r.length&&t<i.length;++t){const e=Xs(r[t],i[t]);if(0!==e)return e;const o=Li(n[r[t]],s[i[t]]);if(0!==o)return o}return Xs(r.length,i.length)}(t.mapValue,e.mapValue);default:throw Ms()}}function Pi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Xs(t,e);const n=Ei(t),r=Ei(e),s=Xs(n.seconds,r.seconds);return 0!==s?s:Xs(n.nanos,r.nanos)}function Mi(t){return xi(t)}function xi(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=Ei(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Si(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,ii.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=xi(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const s of e)r?r=!1:n+=",",n+=`${s}:${xi(t.fields[s])}`;return n+"}"}(t.mapValue):Ms();var e,n}function Ui(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Fi(t){return!!t&&"integerValue"in t}function Vi(t){return!!t&&"arrayValue"in t}function qi(t){return!!t&&"nullValue"in t}function ji(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Bi(t){return!!t&&"mapValue"in t}function zi(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return yi(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=zi(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=zi(t.arrayValue.values[n]);return e}return Object.assign({},t)}class $i{constructor(t,e){this.position=t,this.inclusive=e}}function Ki(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(r=i.field.isKeyField()?ii.comparator(ii.fromName(o.referenceValue),n.key):Li(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function Hi(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!Ri(t.position[n],e.position[n]))return!1;return!0}
|
|
735
734
|
/**
|
|
736
735
|
* @license
|
|
737
736
|
* Copyright 2022 Google LLC
|
|
@@ -747,7 +746,7 @@ class _i{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
747
746
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
748
747
|
* See the License for the specific language governing permissions and
|
|
749
748
|
* limitations under the License.
|
|
750
|
-
*/class
|
|
749
|
+
*/class Gi{}class Wi extends Gi{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new eo(t,e,n):"array-contains"===e?new io(t,n):"in"===e?new oo(t,n):"not-in"===e?new ao(t,n):"array-contains-any"===e?new co(t,n):new Wi(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new no(t,n):new ro(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Li(e,this.value)):null!==e&&Di(this.value)===Di(e)&&this.matchesComparison(Li(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Ms()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Qi extends Gi{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Qi(t,e)}matches(t){return Yi(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Yi(t){return"and"===t.op}function Xi(t){return function(t){for(const e of t.filters)if(e instanceof Qi)return!1;return!0}(t)&&Yi(t)}function Ji(t){if(t instanceof Wi)return t.field.canonicalString()+t.op.toString()+Mi(t.value);{const e=t.filters.map((t=>Ji(t))).join(",");return`${t.op}(${e})`}}function Zi(t,e){return t instanceof Wi?function(t,e){return e instanceof Wi&&t.op===e.op&&t.field.isEqual(e.field)&&Ri(t.value,e.value)}(t,e):t instanceof Qi?function(t,e){return e instanceof Qi&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Zi(n,e.filters[r])),!0)}(t,e):void Ms()}function to(t){return t instanceof Wi?function(t){return`${t.field.canonicalString()} ${t.op} ${Mi(t.value)}`}(t):t instanceof Qi?function(t){return t.op.toString()+" {"+t.getFilters().map(to).join(" ,")+"}"}(t):"Filter"}class eo extends Wi{constructor(t,e,n){super(t,e,n),this.key=ii.fromName(n.referenceValue)}matches(t){const e=ii.comparator(t.key,this.key);return this.matchesComparison(e)}}class no extends Wi{constructor(t,e){super(t,"in",e),this.keys=so("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class ro extends Wi{constructor(t,e){super(t,"not-in",e),this.keys=so("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function so(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>ii.fromName(t.referenceValue)))}class io extends Wi{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Vi(e)&&Oi(e.arrayValue,this.value)}}class oo extends Wi{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Oi(this.value.arrayValue,e)}}class ao extends Wi{constructor(t,e){super(t,"not-in",e)}matches(t){if(Oi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Oi(this.value.arrayValue,e)}}class co extends Wi{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Vi(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Oi(this.value.arrayValue,t)))}}
|
|
751
750
|
/**
|
|
752
751
|
* @license
|
|
753
752
|
* Copyright 2022 Google LLC
|
|
@@ -763,7 +762,7 @@ class _i{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
763
762
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
764
763
|
* See the License for the specific language governing permissions and
|
|
765
764
|
* limitations under the License.
|
|
766
|
-
*/class
|
|
765
|
+
*/class uo{constructor(t,e="asc"){this.field=t,this.dir=e}}function ho(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
|
|
767
766
|
/**
|
|
768
767
|
* @license
|
|
769
768
|
* Copyright 2017 Google LLC
|
|
@@ -779,7 +778,7 @@ class _i{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
779
778
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
780
779
|
* See the License for the specific language governing permissions and
|
|
781
780
|
* limitations under the License.
|
|
782
|
-
*/class
|
|
781
|
+
*/class lo{constructor(t,e){this.comparator=t,this.root=e||po.EMPTY}insert(t,e){return new lo(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,po.BLACK,null,null))}remove(t){return new lo(this.comparator,this.root.remove(t,this.comparator).copy(null,null,po.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new fo(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new fo(this.root,t,this.comparator,!1)}getReverseIterator(){return new fo(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new fo(this.root,t,this.comparator,!0)}}class fo{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!t.isEmpty();)if(s=e?n(t.key,e):1,e&&r&&(s*=-1),s<0)t=this.isReverse?t.left:t.right;else{if(0===s){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class po{constructor(t,e,n,r,s){this.key=t,this.value=e,this.color=null!=n?n:po.RED,this.left=null!=r?r:po.EMPTY,this.right=null!=s?s:po.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,s){return new po(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const s=n(t,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===s?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return po.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return po.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,po.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,po.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Ms();if(this.right.isRed())throw Ms();const t=this.left.check();if(t!==this.right.check())throw Ms();return t+(this.isRed()?0:1)}}po.EMPTY=null,po.RED=!0,po.BLACK=!1,po.EMPTY=new class{constructor(){this.size=0}get key(){throw Ms()}get value(){throw Ms()}get color(){throw Ms()}get left(){throw Ms()}get right(){throw Ms()}copy(t,e,n,r,s){return this}insert(t,e,n){return new po(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
|
|
783
782
|
/**
|
|
784
783
|
* @license
|
|
785
784
|
* Copyright 2017 Google LLC
|
|
@@ -796,7 +795,7 @@ class _i{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
796
795
|
* See the License for the specific language governing permissions and
|
|
797
796
|
* limitations under the License.
|
|
798
797
|
*/
|
|
799
|
-
class
|
|
798
|
+
class go{constructor(t){this.comparator=t,this.data=new lo(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new mo(this.data.getIterator())}getIteratorFrom(t){return new mo(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach((t=>{e=e.add(t)})),e}isEqual(t){if(!(t instanceof go))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new go(this.comparator);return e.data=t,e}}class mo{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
|
|
800
799
|
/**
|
|
801
800
|
* @license
|
|
802
801
|
* Copyright 2020 Google LLC
|
|
@@ -812,7 +811,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
812
811
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
813
812
|
* See the License for the specific language governing permissions and
|
|
814
813
|
* limitations under the License.
|
|
815
|
-
*/class
|
|
814
|
+
*/class yo{constructor(t){this.fields=t,t.sort(si.comparator)}static empty(){return new yo([])}unionWith(t){let e=new go(si.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new yo(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return Js(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
|
|
816
815
|
/**
|
|
817
816
|
* @license
|
|
818
817
|
* Copyright 2017 Google LLC
|
|
@@ -828,7 +827,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
828
827
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
829
828
|
* See the License for the specific language governing permissions and
|
|
830
829
|
* limitations under the License.
|
|
831
|
-
*/class
|
|
830
|
+
*/class vo{constructor(t){this.value=t}static empty(){return new vo({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!Bi(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=zi(e)}setAll(t){let e=si.emptyPath(),n={},r=[];t.forEach(((t,s)=>{if(!e.isImmediateParentOf(s)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=s.popLast()}t?n[s.lastSegment()]=zi(t):r.push(s.lastSegment())}));const s=this.getFieldsMap(e);this.applyChanges(s,n,r)}delete(t){const e=this.field(t.popLast());Bi(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Ri(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let r=e.mapValue.fields[t.get(n)];Bi(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){yi(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new vo(zi(this.value))}}
|
|
832
831
|
/**
|
|
833
832
|
* @license
|
|
834
833
|
* Copyright 2017 Google LLC
|
|
@@ -844,7 +843,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
844
843
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
845
844
|
* See the License for the specific language governing permissions and
|
|
846
845
|
* limitations under the License.
|
|
847
|
-
*/class
|
|
846
|
+
*/class wo{constructor(t,e,n,r,s,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=o}static newInvalidDocument(t){return new wo(t,0,ti.min(),ti.min(),ti.min(),vo.empty(),0)}static newFoundDocument(t,e,n,r){return new wo(t,1,e,ti.min(),n,r,0)}static newNoDocument(t,e){return new wo(t,2,e,ti.min(),ti.min(),vo.empty(),0)}static newUnknownDocument(t,e){return new wo(t,3,e,ti.min(),ti.min(),vo.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(ti.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=vo.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=vo.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ti.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof wo&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new wo(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
|
|
848
847
|
/**
|
|
849
848
|
* @license
|
|
850
849
|
* Copyright 2019 Google LLC
|
|
@@ -860,7 +859,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
860
859
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
861
860
|
* See the License for the specific language governing permissions and
|
|
862
861
|
* limitations under the License.
|
|
863
|
-
*/class
|
|
862
|
+
*/class Io{constructor(t,e=null,n=[],r=[],s=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.ft=null}}function bo(t,e=null,n=[],r=[],s=null,i=null,o=null){return new Io(t,e,n,r,s,i,o)}function To(t){const e=Us(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Ji(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),wi(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Mi(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Mi(t))).join(",")),e.ft=t}return e.ft}function Eo(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!ho(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!Zi(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Hi(t.startAt,e.startAt)&&Hi(t.endAt,e.endAt)}function _o(t){return ii.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
|
|
864
863
|
/**
|
|
865
864
|
* @license
|
|
866
865
|
* Copyright 2017 Google LLC
|
|
@@ -876,7 +875,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
876
875
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
877
876
|
* See the License for the specific language governing permissions and
|
|
878
877
|
* limitations under the License.
|
|
879
|
-
*/class
|
|
878
|
+
*/class So{constructor(t,e=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function Co(t){return new So(t)}function ko(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Ao(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function No(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Do(t){return null!==t.collectionGroup}function Ro(t){const e=Us(t);if(null===e.dt){e.dt=[];const t=No(e),n=Ao(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new uo(t)),e.dt.push(new uo(si.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new uo(si.keyField(),t))}}}return e.dt}function Oo(t){const e=Us(t);if(!e._t)if("F"===e.limitType)e._t=bo(e.path,e.collectionGroup,Ro(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Ro(e)){const e="desc"===n.dir?"asc":"desc";t.push(new uo(n.field,e))}const n=e.endAt?new $i(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new $i(e.startAt.position,e.startAt.inclusive):null;e._t=bo(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function Lo(t,e){e.getFirstInequalityField(),No(t);const n=t.filters.concat([e]);return new So(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Po(t,e,n){return new So(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Mo(t,e){return Eo(Oo(t),Oo(e))&&t.limitType===e.limitType}function xo(t){return`${To(Oo(t))}|lt:${t.limitType}`}function Uo(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>to(t))).join(", ")}]`),wi(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>Mi(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Mi(t))).join(",")),`Target(${e})`}(Oo(t))}; limitType=${t.limitType})`}function Fo(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):ii.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Ro(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=Ki(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Ro(t),e))&&!(t.endAt&&!function(t,e,n){const r=Ki(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Ro(t),e))}(t,e)}function Vo(t){return(e,n)=>{let r=!1;for(const s of Ro(t)){const t=qo(s,e,n);if(0!==t)return t;r=r||s.field.isKeyField()}return 0}}function qo(t,e,n){const r=t.field.isKeyField()?ii.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),s=n.data.field(t);return null!==r&&null!==s?Li(r,s):Ms()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Ms()}}
|
|
880
879
|
/**
|
|
881
880
|
* @license
|
|
882
881
|
* Copyright 2020 Google LLC
|
|
@@ -892,7 +891,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
892
891
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
893
892
|
* See the License for the specific language governing permissions and
|
|
894
893
|
* limitations under the License.
|
|
895
|
-
*/function
|
|
894
|
+
*/function jo(t,e){if(t.wt){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ii(e)?"-0":e}}function Bo(t){return{integerValue:""+t}}function zo(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!Ii(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Bo(e):jo(t,e)}
|
|
896
895
|
/**
|
|
897
896
|
* @license
|
|
898
897
|
* Copyright 2018 Google LLC
|
|
@@ -908,7 +907,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
908
907
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
909
908
|
* See the License for the specific language governing permissions and
|
|
910
909
|
* limitations under the License.
|
|
911
|
-
*/class
|
|
910
|
+
*/class $o{constructor(){this._=void 0}}function Ko(t,e,n){return t instanceof Go?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Wo?Qo(t,e):t instanceof Yo?Xo(t,e):function(t,e){const n=function(t,e){return t instanceof Jo?Fi(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),r=Zo(n)+Zo(t.gt);return Fi(n)&&Fi(t.gt)?Bo(r):jo(t.yt,r)}(t,e)}function Ho(t,e,n){return t instanceof Wo?Qo(t,e):t instanceof Yo?Xo(t,e):n}class Go extends $o{}class Wo extends $o{constructor(t){super(),this.elements=t}}function Qo(t,e){const n=ta(e);for(const e of t.elements)n.some((t=>Ri(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Yo extends $o{constructor(t){super(),this.elements=t}}function Xo(t,e){let n=ta(e);for(const e of t.elements)n=n.filter((t=>!Ri(t,e)));return{arrayValue:{values:n}}}class Jo extends $o{constructor(t,e){super(),this.yt=t,this.gt=e}}function Zo(t){return _i(t.integerValue||t.doubleValue)}function ta(t){return Vi(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class ea{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ea}static exists(t){return new ea(void 0,t)}static updateTime(t){return new ea(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function na(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ra{}function sa(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new fa(t.key,ea.none()):new ca(t.key,t.data,ea.none());{const n=t.data,r=vo.empty();let s=new go(si.comparator);for(let t of e.fields)if(!s.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),s=s.add(t)}return new ua(t.key,r,new yo(s.toArray()),ea.none())}}function ia(t,e,n){t instanceof ca?function(t,e,n){const r=t.value.clone(),s=la(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof ua?function(t,e,n){if(!na(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=la(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(ha(t)),s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function oa(t,e,n,r){return t instanceof ca?function(t,e,n,r){if(!na(t.precondition,e))return n;const s=t.value.clone(),i=da(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof ua?function(t,e,n,r){if(!na(t.precondition,e))return n;const s=da(t.fieldTransforms,r,e),i=e.data;return i.setAll(ha(t)),i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return na(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function aa(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&Js(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Wo&&e instanceof Wo||t instanceof Yo&&e instanceof Yo?Js(t.elements,e.elements,Ri):t instanceof Jo&&e instanceof Jo?Ri(t.gt,e.gt):t instanceof Go&&e instanceof Go}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class ca extends ra{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class ua extends ra{constructor(t,e,n,r,s=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function ha(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function la(t,e,n){const r=new Map;xs(t.length===n.length);for(let s=0;s<n.length;s++){const i=t[s],o=i.transform,a=e.data.field(i.field);r.set(i.field,Ho(o,a,n[s]))}return r}function da(t,e,n){const r=new Map;for(const s of t){const t=s.transform,i=n.data.field(s.field);r.set(s.field,Ko(t,i,e))}return r}class fa extends ra{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
|
|
912
911
|
/**
|
|
913
912
|
* @license
|
|
914
913
|
* Copyright 2017 Google LLC
|
|
@@ -924,7 +923,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
924
923
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
925
924
|
* See the License for the specific language governing permissions and
|
|
926
925
|
* limitations under the License.
|
|
927
|
-
*/class
|
|
926
|
+
*/class pa{constructor(t){this.count=t}}
|
|
928
927
|
/**
|
|
929
928
|
* @license
|
|
930
929
|
* Copyright 2017 Google LLC
|
|
@@ -940,7 +939,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
940
939
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
941
940
|
* See the License for the specific language governing permissions and
|
|
942
941
|
* limitations under the License.
|
|
943
|
-
*/var
|
|
942
|
+
*/var ga,ma;function ya(t){if(void 0===t)return Os("GRPC error has no .code"),Fs.UNKNOWN;switch(t){case ga.OK:return Fs.OK;case ga.CANCELLED:return Fs.CANCELLED;case ga.UNKNOWN:return Fs.UNKNOWN;case ga.DEADLINE_EXCEEDED:return Fs.DEADLINE_EXCEEDED;case ga.RESOURCE_EXHAUSTED:return Fs.RESOURCE_EXHAUSTED;case ga.INTERNAL:return Fs.INTERNAL;case ga.UNAVAILABLE:return Fs.UNAVAILABLE;case ga.UNAUTHENTICATED:return Fs.UNAUTHENTICATED;case ga.INVALID_ARGUMENT:return Fs.INVALID_ARGUMENT;case ga.NOT_FOUND:return Fs.NOT_FOUND;case ga.ALREADY_EXISTS:return Fs.ALREADY_EXISTS;case ga.PERMISSION_DENIED:return Fs.PERMISSION_DENIED;case ga.FAILED_PRECONDITION:return Fs.FAILED_PRECONDITION;case ga.ABORTED:return Fs.ABORTED;case ga.OUT_OF_RANGE:return Fs.OUT_OF_RANGE;case ga.UNIMPLEMENTED:return Fs.UNIMPLEMENTED;case ga.DATA_LOSS:return Fs.DATA_LOSS;default:return Ms()}}(ma=ga||(ga={}))[ma.OK=0]="OK",ma[ma.CANCELLED=1]="CANCELLED",ma[ma.UNKNOWN=2]="UNKNOWN",ma[ma.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ma[ma.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ma[ma.NOT_FOUND=5]="NOT_FOUND",ma[ma.ALREADY_EXISTS=6]="ALREADY_EXISTS",ma[ma.PERMISSION_DENIED=7]="PERMISSION_DENIED",ma[ma.UNAUTHENTICATED=16]="UNAUTHENTICATED",ma[ma.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ma[ma.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ma[ma.ABORTED=10]="ABORTED",ma[ma.OUT_OF_RANGE=11]="OUT_OF_RANGE",ma[ma.UNIMPLEMENTED=12]="UNIMPLEMENTED",ma[ma.INTERNAL=13]="INTERNAL",ma[ma.UNAVAILABLE=14]="UNAVAILABLE",ma[ma.DATA_LOSS=15]="DATA_LOSS";
|
|
944
943
|
/**
|
|
945
944
|
* @license
|
|
946
945
|
* Copyright 2017 Google LLC
|
|
@@ -957,7 +956,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
957
956
|
* See the License for the specific language governing permissions and
|
|
958
957
|
* limitations under the License.
|
|
959
958
|
*/
|
|
960
|
-
class
|
|
959
|
+
class va{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],t))return void(r[n]=[t,e]);r.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(t){yi(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return vi(this.inner)}size(){return this.innerSize}}
|
|
961
960
|
/**
|
|
962
961
|
* @license
|
|
963
962
|
* Copyright 2017 Google LLC
|
|
@@ -973,7 +972,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
973
972
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
974
973
|
* See the License for the specific language governing permissions and
|
|
975
974
|
* limitations under the License.
|
|
976
|
-
*/const
|
|
975
|
+
*/const wa=new lo(ii.comparator);function Ia(){return wa}const ba=new lo(ii.comparator);function Ta(...t){let e=ba;for(const n of t)e=e.insert(n.key,n);return e}function Ea(t){let e=ba;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function _a(){return Ca()}function Sa(){return Ca()}function Ca(){return new va((t=>t.toString()),((t,e)=>t.isEqual(e)))}new lo(ii.comparator);const ka=new go(ii.comparator);function Aa(...t){let e=ka;for(const n of t)e=e.add(n);return e}const Na=new go(Xs);function Da(){return Na}
|
|
977
976
|
/**
|
|
978
977
|
* @license
|
|
979
978
|
* Copyright 2017 Google LLC
|
|
@@ -989,7 +988,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
989
988
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
990
989
|
* See the License for the specific language governing permissions and
|
|
991
990
|
* limitations under the License.
|
|
992
|
-
*/class
|
|
991
|
+
*/class Ra{constructor(t,e,n,r,s){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const r=new Map;return r.set(t,Oa.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new Ra(ti.min(),r,Da(),Ia(),Aa())}}class Oa{constructor(t,e,n,r,s){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Oa(n,e,Aa(),Aa(),Aa())}}
|
|
993
992
|
/**
|
|
994
993
|
* @license
|
|
995
994
|
* Copyright 2017 Google LLC
|
|
@@ -1005,7 +1004,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1005
1004
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1006
1005
|
* See the License for the specific language governing permissions and
|
|
1007
1006
|
* limitations under the License.
|
|
1008
|
-
*/class
|
|
1007
|
+
*/class La{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Pa{constructor(t,e){this.targetId=t,this.Et=e}}class Ma{constructor(t,e,n=bi.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class xa{constructor(){this.At=0,this.Rt=Va(),this.bt=bi.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Aa(),e=Aa(),n=Aa();return this.Rt.forEach(((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Ms()}})),new Oa(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=Va()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Ua{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ia(),this.qt=Fa(),this.Ut=new go(Xs)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:Ms()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(_o(t))if(0===n){const n=new ii(t.path);this.Qt(e,n,wo.newNoDocument(n,ti.min()))}else xs(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const s=this.Yt(r);if(s){if(n.current&&_o(s.target)){const e=new ii(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,wo.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Aa();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new Ra(t,e,this.Ut,this.Lt,n);return this.Lt=Ia(),this.qt=Fa(),this.Ut=new go(Xs),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new xa,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new go(Xs),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Rs("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new xa),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Fa(){return new lo(ii.comparator)}function Va(){return new lo(ii.comparator)}
|
|
1009
1008
|
/**
|
|
1010
1009
|
* @license
|
|
1011
1010
|
* Copyright 2017 Google LLC
|
|
@@ -1021,7 +1020,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1021
1020
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1022
1021
|
* See the License for the specific language governing permissions and
|
|
1023
1022
|
* limitations under the License.
|
|
1024
|
-
*/const
|
|
1023
|
+
*/const qa={asc:"ASCENDING",desc:"DESCENDING"},ja={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Ba={and:"AND",or:"OR"};class za{constructor(t,e){this.databaseId=t,this.wt=e}}function $a(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Ka(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Ha(t){return xs(!!t),ti.fromTimestamp(function(t){const e=Ei(t);return new Zs(e.seconds,e.nanos)}(t))}function Ga(t,e){return function(t){return new ni(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Wa(t){const e=ni.fromString(t);return xs(uc(e)),e}function Qa(t,e){const n=Wa(e);if(n.get(1)!==t.databaseId.projectId)throw new Vs(Fs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Vs(Fs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ii(Ja(n))}function Ya(t,e){return Ga(t.databaseId,e)}function Xa(t){return new ni(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Ja(t){return xs(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function Za(t,e){return{documents:[Ya(t,e.path)]}}function tc(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Ya(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Ya(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return cc(Qi.create(t,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:oc(t.field),direction:rc(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||wi(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function ec(t){let e=function(t){const e=Wa(t);return 4===e.length?ni.emptyPath():Ja(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){xs(1===r);const t=n.from[0];t.allDescendants?s=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=nc(t);return e instanceof Qi&&Xi(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new uo(ac(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,wi(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new $i(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new $i(n,e)}(n.endAt)),function(t,e,n,r,s,i,o,a){return new So(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function nc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=ac(t.unaryFilter.field);return Wi.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=ac(t.unaryFilter.field);return Wi.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=ac(t.unaryFilter.field);return Wi.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=ac(t.unaryFilter.field);return Wi.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Ms()}}(t):void 0!==t.fieldFilter?function(t){return Wi.create(ac(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Ms()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Qi.create(t.compositeFilter.filters.map((t=>nc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Ms()}}(t.compositeFilter.op))}(t):Ms()}function rc(t){return qa[t]}function sc(t){return ja[t]}function ic(t){return Ba[t]}function oc(t){return{fieldPath:t.canonicalString()}}function ac(t){return si.fromServerFormat(t.fieldPath)}function cc(t){return t instanceof Wi?function(t){if("=="===t.op){if(ji(t.value))return{unaryFilter:{field:oc(t.field),op:"IS_NAN"}};if(qi(t.value))return{unaryFilter:{field:oc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(ji(t.value))return{unaryFilter:{field:oc(t.field),op:"IS_NOT_NAN"}};if(qi(t.value))return{unaryFilter:{field:oc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:oc(t.field),op:sc(t.op),value:t.value}}}(t):t instanceof Qi?function(t){const e=t.getFilters().map((t=>cc(t)));return 1===e.length?e[0]:{compositeFilter:{op:ic(t.op),filters:e}}}(t):Ms()}function uc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
|
|
1025
1024
|
/**
|
|
1026
1025
|
* @license
|
|
1027
1026
|
* Copyright 2017 Google LLC
|
|
@@ -1037,7 +1036,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1037
1036
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1038
1037
|
* See the License for the specific language governing permissions and
|
|
1039
1038
|
* limitations under the License.
|
|
1040
|
-
*/class
|
|
1039
|
+
*/class hc{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&ia(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=oa(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=oa(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Sa();return this.mutations.forEach((r=>{const s=t.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=e.has(r.key)?null:o;const a=sa(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(ti.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Aa())}isEqual(t){return this.batchId===t.batchId&&Js(this.mutations,t.mutations,((t,e)=>aa(t,e)))&&Js(this.baseMutations,t.baseMutations,((t,e)=>aa(t,e)))}}
|
|
1041
1040
|
/**
|
|
1042
1041
|
* @license
|
|
1043
1042
|
* Copyright 2022 Google LLC
|
|
@@ -1053,7 +1052,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1053
1052
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1054
1053
|
* See the License for the specific language governing permissions and
|
|
1055
1054
|
* limitations under the License.
|
|
1056
|
-
*/class
|
|
1055
|
+
*/class lc{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
|
|
1057
1056
|
/**
|
|
1058
1057
|
* @license
|
|
1059
1058
|
* Copyright 2017 Google LLC
|
|
@@ -1069,7 +1068,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1069
1068
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1070
1069
|
* See the License for the specific language governing permissions and
|
|
1071
1070
|
* limitations under the License.
|
|
1072
|
-
*/class
|
|
1071
|
+
*/class dc{constructor(t,e,n,r,s=ti.min(),i=ti.min(),o=bi.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o}withSequenceNumber(t){return new dc(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new dc(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new dc(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
|
|
1073
1072
|
/**
|
|
1074
1073
|
* @license
|
|
1075
1074
|
* Copyright 2017 Google LLC
|
|
@@ -1085,7 +1084,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1085
1084
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1086
1085
|
* See the License for the specific language governing permissions and
|
|
1087
1086
|
* limitations under the License.
|
|
1088
|
-
*/class
|
|
1087
|
+
*/class fc{constructor(t){this.ie=t}}function pc(t){const e=ec({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Po(e,e.limit,"L"):e}
|
|
1089
1088
|
/**
|
|
1090
1089
|
* @license
|
|
1091
1090
|
* Copyright 2019 Google LLC
|
|
@@ -1101,7 +1100,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1101
1100
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1102
1101
|
* See the License for the specific language governing permissions and
|
|
1103
1102
|
* limitations under the License.
|
|
1104
|
-
*/class
|
|
1103
|
+
*/class gc{constructor(){this.Je=new mc}addToCollectionParentIndex(t,e){return this.Je.add(e),li.resolve()}getCollectionParents(t,e){return li.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return li.resolve()}deleteFieldIndex(t,e){return li.resolve()}getDocumentsMatchingTarget(t,e){return li.resolve(null)}getIndexType(t,e){return li.resolve(0)}getFieldIndexes(t,e){return li.resolve([])}getNextCollectionGroupToUpdate(t){return li.resolve(null)}getMinOffset(t,e){return li.resolve(ai.min())}getMinOffsetFromCollectionGroup(t,e){return li.resolve(ai.min())}updateCollectionGroup(t,e,n){return li.resolve()}updateIndexEntries(t,e){return li.resolve()}}class mc{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new go(ni.comparator),s=!r.has(n);return this.index[e]=r.add(n),s}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new go(ni.comparator)).toArray()}}
|
|
1105
1104
|
/**
|
|
1106
1105
|
* @license
|
|
1107
1106
|
* Copyright 2017 Google LLC
|
|
@@ -1117,7 +1116,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1117
1116
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1118
1117
|
* See the License for the specific language governing permissions and
|
|
1119
1118
|
* limitations under the License.
|
|
1120
|
-
*/class
|
|
1119
|
+
*/class yc{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new yc(0)}static vn(){return new yc(-1)}}
|
|
1121
1120
|
/**
|
|
1122
1121
|
* @license
|
|
1123
1122
|
* Copyright 2017 Google LLC
|
|
@@ -1133,7 +1132,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1133
1132
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1134
1133
|
* See the License for the specific language governing permissions and
|
|
1135
1134
|
* limitations under the License.
|
|
1136
|
-
*/class
|
|
1135
|
+
*/class vc{constructor(){this.changes=new va((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,wo.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?li.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}
|
|
1137
1136
|
/**
|
|
1138
1137
|
* @license
|
|
1139
1138
|
* Copyright 2017 Google LLC
|
|
@@ -1165,7 +1164,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1165
1164
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1166
1165
|
* See the License for the specific language governing permissions and
|
|
1167
1166
|
* limitations under the License.
|
|
1168
|
-
*/class
|
|
1167
|
+
*/class wc{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
|
|
1169
1168
|
/**
|
|
1170
1169
|
* @license
|
|
1171
1170
|
* Copyright 2017 Google LLC
|
|
@@ -1181,7 +1180,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1181
1180
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1182
1181
|
* See the License for the specific language governing permissions and
|
|
1183
1182
|
* limitations under the License.
|
|
1184
|
-
*/class
|
|
1183
|
+
*/class Ic{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&oa(n.mutation,t,yo.empty(),Zs.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Aa()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Aa()){const r=_a();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Ta();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=_a();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Aa())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let s=Ia();const i=Ca(),o=Ca();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof ua)?s=s.insert(e.key,e):void 0!==o&&(i.set(e.key,o.mutation.getFieldMask()),oa(o.mutation,e,o.mutation.getFieldMask(),Zs.now()))})),this.recalculateAndSaveOverlays(t,s).next((t=>(t.forEach(((t,e)=>i.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new wc(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=Ca();let r=new lo(((t,e)=>t-e)),s=Aa();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const s of t)s.keys().forEach((t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||yo.empty();o=s.applyToLocalView(i,o),n.set(t,o);const a=(r.get(s.batchId)||Aa()).add(t);r=r.insert(s.batchId,a)}))})).next((()=>{const i=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,u=Sa();c.forEach((t=>{if(!s.has(t)){const r=sa(e.get(t),n.get(t));null!==r&&u.set(t,r),s=s.add(t)}})),i.push(this.documentOverlayCache.saveOverlays(t,a,u))}return li.waitFor(i)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n){return function(t){return ii.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Do(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-s.size):li.resolve(_a());let o=-1,a=s;return i.next((e=>li.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(e)?li.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,s))).next((()=>this.computeViews(t,a,e,Aa()))).next((t=>({batchId:o,changes:Ea(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new ii(e)).next((t=>{let e=Ta();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let s=Ta();return this.indexManager.getCollectionParents(t,r).next((i=>li.forEach(i,(i=>{const o=function(t,e){return new So(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,i.child(r));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{s=s.insert(t,e)}))}))})).next((()=>s))))}getDocumentsMatchingCollectionQuery(t,e,n){let r;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((s=>(r=s,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===r.get(n)&&(r=r.insert(n,wo.newInvalidDocument(n)))}));let n=Ta();return r.forEach(((r,s)=>{const i=t.get(r);void 0!==i&&oa(i.mutation,s,yo.empty(),Zs.now()),Fo(e,s)&&(n=n.insert(r,s))})),n}))}}
|
|
1185
1184
|
/**
|
|
1186
1185
|
* @license
|
|
1187
1186
|
* Copyright 2020 Google LLC
|
|
@@ -1197,7 +1196,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1197
1196
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1198
1197
|
* See the License for the specific language governing permissions and
|
|
1199
1198
|
* limitations under the License.
|
|
1200
|
-
*/class
|
|
1199
|
+
*/class bc{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return li.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Ha(n.createTime)}),li.resolve()}getNamedQuery(t,e){return li.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:pc(t.bundledQuery),readTime:Ha(t.readTime)}}(e)),li.resolve()}}
|
|
1201
1200
|
/**
|
|
1202
1201
|
* @license
|
|
1203
1202
|
* Copyright 2022 Google LLC
|
|
@@ -1213,7 +1212,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1213
1212
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1214
1213
|
* See the License for the specific language governing permissions and
|
|
1215
1214
|
* limitations under the License.
|
|
1216
|
-
*/class Tc{constructor(){this.overlays=new
|
|
1215
|
+
*/class Tc{constructor(){this.overlays=new lo(ii.comparator),this.es=new Map}getOverlay(t,e){return li.resolve(this.overlays.get(e))}getOverlays(t,e){const n=_a();return li.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,r)=>{this.oe(t,e,r)})),li.resolve()}removeOverlaysForBatchId(t,e,n){const r=this.es.get(n);return void 0!==r&&(r.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),li.resolve()}getOverlaysForCollection(t,e,n){const r=_a(),s=e.length+1,i=new ii(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===s&&t.largestBatchId>n&&r.set(t.getKey(),t)}return li.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let s=new lo(((t,e)=>t-e));const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=s.get(t.largestBatchId);null===e&&(e=_a(),s=s.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=_a(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return li.resolve(o)}oe(t,e,n){const r=this.overlays.get(n.key);if(null!==r){const t=this.es.get(r.largestBatchId).delete(n.key);this.es.set(r.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new lc(e,n));let s=this.es.get(e);void 0===s&&(s=Aa(),this.es.set(e,s)),this.es.set(e,s.add(n.key))}}
|
|
1217
1216
|
/**
|
|
1218
1217
|
* @license
|
|
1219
1218
|
* Copyright 2017 Google LLC
|
|
@@ -1229,7 +1228,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1229
1228
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1230
1229
|
* See the License for the specific language governing permissions and
|
|
1231
1230
|
* limitations under the License.
|
|
1232
|
-
*/class
|
|
1231
|
+
*/class Ec{constructor(){this.ns=new go(_c.ss),this.rs=new go(_c.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new _c(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new _c(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new ii(new ni([])),n=new _c(e,t),r=new _c(e,t+1),s=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),s.push(t.key)})),s}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new ii(new ni([])),n=new _c(e,t),r=new _c(e,t+1);let s=Aa();return this.rs.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new _c(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class _c{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return ii.comparator(t.key,e.key)||Xs(t._s,e._s)}static os(t,e){return Xs(t._s,e._s)||ii.comparator(t.key,e.key)}}
|
|
1233
1232
|
/**
|
|
1234
1233
|
* @license
|
|
1235
1234
|
* Copyright 2017 Google LLC
|
|
@@ -1245,7 +1244,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1245
1244
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1246
1245
|
* See the License for the specific language governing permissions and
|
|
1247
1246
|
* limitations under the License.
|
|
1248
|
-
*/class
|
|
1247
|
+
*/class Sc{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new go(_c.ss)}checkEmpty(t){return li.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const s=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new hc(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.gs=this.gs.add(new _c(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return li.resolve(i)}lookupMutationBatch(t,e){return li.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),s=r<0?0:r;return li.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return li.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return li.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new _c(e,0),r=new _c(e,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);s.push(e)})),li.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new go(Xs);return e.forEach((t=>{const e=new _c(t,0),r=new _c(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),li.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;ii.isDocumentKey(s)||(s=s.child(""));const i=new _c(new ii(s),0);let o=new go(Xs);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),i),li.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){xs(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return li.forEach(e.mutations,(r=>{const s=new _c(r.key,e.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new _c(e,0),r=this.gs.firstAfterOrEqual(n);return li.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,li.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
|
|
1249
1248
|
/**
|
|
1250
1249
|
* @license
|
|
1251
1250
|
* Copyright 2017 Google LLC
|
|
@@ -1261,7 +1260,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1261
1260
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1262
1261
|
* See the License for the specific language governing permissions and
|
|
1263
1262
|
* limitations under the License.
|
|
1264
|
-
*/class
|
|
1263
|
+
*/class Cc{constructor(t){this.Es=t,this.docs=new lo(ii.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),s=r?r.size:0,i=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return li.resolve(n?n.document.mutableCopy():wo.newInvalidDocument(e))}getEntries(t,e){let n=Ia();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():wo.newInvalidDocument(t))})),li.resolve(n)}getAllFromCollection(t,e,n){let r=Ia();const s=new ii(e.child("")),i=this.docs.getIteratorFrom(s);for(;i.hasNext();){const{key:t,value:{document:s}}=i.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||ci(oi(s),n)<=0||(r=r.insert(s.key,s.mutableCopy()))}return li.resolve(r)}getAllFromCollectionGroup(t,e,n,r){Ms()}As(t,e){return li.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new kc(this)}getSize(t){return li.resolve(this.size)}}class kc extends vc{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.Yn.addEntry(t,r)):this.Yn.removeEntry(n)})),li.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
|
|
1265
1264
|
/**
|
|
1266
1265
|
* @license
|
|
1267
1266
|
* Copyright 2017 Google LLC
|
|
@@ -1277,7 +1276,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1277
1276
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1278
1277
|
* See the License for the specific language governing permissions and
|
|
1279
1278
|
* limitations under the License.
|
|
1280
|
-
*/class
|
|
1279
|
+
*/class Ac{constructor(t){this.persistence=t,this.Rs=new va((t=>To(t)),Eo),this.lastRemoteSnapshotVersion=ti.min(),this.highestTargetId=0,this.bs=0,this.Ps=new Ec,this.targetCount=0,this.vs=yc.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),li.resolve()}getLastRemoteSnapshotVersion(t){return li.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return li.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),li.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),li.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new yc(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,li.resolve()}updateTargetData(t,e){return this.Dn(e),li.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,li.resolve()}removeTargets(t,e,n){let r=0;const s=[];return this.Rs.forEach(((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(i),s.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),li.waitFor(s).next((()=>r))}getTargetCount(t){return li.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return li.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),li.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const r=this.persistence.referenceDelegate,s=[];return r&&e.forEach((e=>{s.push(r.markPotentiallyOrphaned(t,e))})),li.waitFor(s)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),li.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return li.resolve(n)}containsKey(t,e){return li.resolve(this.Ps.containsKey(e))}}
|
|
1281
1280
|
/**
|
|
1282
1281
|
* @license
|
|
1283
1282
|
* Copyright 2017 Google LLC
|
|
@@ -1293,7 +1292,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1293
1292
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1294
1293
|
* See the License for the specific language governing permissions and
|
|
1295
1294
|
* limitations under the License.
|
|
1296
|
-
*/class
|
|
1295
|
+
*/class Nc{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new fi(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Ac(this),this.indexManager=new gc,this.remoteDocumentCache=function(t){return new Cc(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new fc(e),this.Ns=new bc(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Tc,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Sc(e,this.referenceDelegate),this.Vs[t.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(t,e,n){Rs("MemoryPersistence","Starting transaction:",t);const r=new Dc(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((t=>this.referenceDelegate.Os(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Ms(t,e){return li.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Dc extends ui{constructor(t){super(),this.currentSequenceNumber=t}}class Rc{constructor(t){this.persistence=t,this.Fs=new Ec,this.$s=null}static Bs(t){return new Rc(t)}get Ls(){if(this.$s)return this.$s;throw Ms()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),li.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),li.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),li.resolve()}removeTarget(t,e){this.Fs.ls(e.targetId).forEach((t=>this.Ls.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Ls.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}ks(){this.$s=new Set}Os(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return li.forEach(this.Ls,(n=>{const r=ii.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,ti.min())}))})).next((()=>(this.$s=null,e.apply(t))))}updateLimboDocument(t,e){return this.qs(t,e).next((t=>{t?this.Ls.delete(e.toString()):this.Ls.add(e.toString())}))}xs(t){return 0}qs(t,e){return li.or([()=>li.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
|
|
1297
1296
|
/**
|
|
1298
1297
|
* @license
|
|
1299
1298
|
* Copyright 2017 Google LLC
|
|
@@ -1309,7 +1308,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1309
1308
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1310
1309
|
* See the License for the specific language governing permissions and
|
|
1311
1310
|
* limitations under the License.
|
|
1312
|
-
*/class
|
|
1311
|
+
*/class Oc{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=Aa(),r=Aa();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new Oc(t,e.fromCache,n,r)}}
|
|
1313
1312
|
/**
|
|
1314
1313
|
* @license
|
|
1315
1314
|
* Copyright 2019 Google LLC
|
|
@@ -1325,7 +1324,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1325
1324
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1326
1325
|
* See the License for the specific language governing permissions and
|
|
1327
1326
|
* limitations under the License.
|
|
1328
|
-
*/class
|
|
1327
|
+
*/class Lc{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((s=>s||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(ko(e))return li.resolve(null);let n=Oo(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=Po(e,null,"F"),n=Oo(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=Aa(...r);return this.Ni.getDocuments(t,s).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Fi(e,r);return this.$i(e,i,s,n.readTime)?this.ki(t,Po(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,r){return ko(e)||r.isEqual(ti.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((s=>{const i=this.Fi(e,s);return this.$i(e,i,n,r)?this.Mi(t,e):(Ds()<=S.DEBUG&&Rs("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Uo(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=ti.fromTimestamp(1e9===r?new Zs(n+1,0):new Zs(n,r));return new ai(s,ii.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new go(Vo(t));return e.forEach(((e,r)=>{Fo(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const s="F"===t.limitType?e.last():e.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}Mi(t,e){return Ds()<=S.DEBUG&&Rs("QueryEngine","Using full collection scan to execute query:",Uo(e)),this.Ni.getDocumentsMatchingQuery(t,e,ai.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
|
|
1329
1328
|
/**
|
|
1330
1329
|
* @license
|
|
1331
1330
|
* Copyright 2020 Google LLC
|
|
@@ -1341,7 +1340,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1341
1340
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1342
1341
|
* See the License for the specific language governing permissions and
|
|
1343
1342
|
* limitations under the License.
|
|
1344
|
-
*/class
|
|
1343
|
+
*/class Pc{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new lo(Xs),this.Ui=new va((t=>To(t)),Eo),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Ic(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function Mc(t,e){const n=Us(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=Aa();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function xc(t){const e=Us(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Uc(t,e){const n=Us(t),r=e.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(bi.EMPTY_BYTE_STRING,ti.min()).withLastLimboFreeSnapshotVersion(ti.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ia(),c=Aa();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Aa(),s=Aa();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ia();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(ti.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):Rs("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(ti.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return li.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}async function Fc(t,e,n){const r=Us(t),s=r.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!di(t))throw t;Rs("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function Vc(t,e,n){const r=Us(t);let s=ti.min(),i=Aa();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Us(t),s=r.Ui.get(n);return void 0!==s?li.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Oo(e)).next((e=>{if(e)return s=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?s:ti.min(),n?i:Aa()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||ti.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:i})))))}class qc{constructor(){this.activeTargetIds=Da()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class jc{constructor(){this.Lr=new qc,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new qc,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
|
|
1345
1344
|
/**
|
|
1346
1345
|
* @license
|
|
1347
1346
|
* Copyright 2019 Google LLC
|
|
@@ -1357,7 +1356,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1357
1356
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1358
1357
|
* See the License for the specific language governing permissions and
|
|
1359
1358
|
* limitations under the License.
|
|
1360
|
-
*/class
|
|
1359
|
+
*/class Bc{Ur(t){}shutdown(){}}
|
|
1361
1360
|
/**
|
|
1362
1361
|
* @license
|
|
1363
1362
|
* Copyright 2019 Google LLC
|
|
@@ -1373,7 +1372,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1373
1372
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1374
1373
|
* See the License for the specific language governing permissions and
|
|
1375
1374
|
* limitations under the License.
|
|
1376
|
-
*/class
|
|
1375
|
+
*/class zc{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){Rs("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Rs("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.Wr)t(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
|
|
1377
1376
|
/**
|
|
1378
1377
|
* @license
|
|
1379
1378
|
* Copyright 2020 Google LLC
|
|
@@ -1389,7 +1388,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1389
1388
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1390
1389
|
* See the License for the specific language governing permissions and
|
|
1391
1390
|
* limitations under the License.
|
|
1392
|
-
*/const
|
|
1391
|
+
*/const $c={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
|
|
1393
1392
|
/**
|
|
1394
1393
|
* @license
|
|
1395
1394
|
* Copyright 2017 Google LLC
|
|
@@ -1405,7 +1404,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1405
1404
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1406
1405
|
* See the License for the specific language governing permissions and
|
|
1407
1406
|
* limitations under the License.
|
|
1408
|
-
*/class
|
|
1407
|
+
*/class Kc{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
|
|
1409
1408
|
/**
|
|
1410
1409
|
* @license
|
|
1411
1410
|
* Copyright 2017 Google LLC
|
|
@@ -1421,7 +1420,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1421
1420
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1422
1421
|
* See the License for the specific language governing permissions and
|
|
1423
1422
|
* limitations under the License.
|
|
1424
|
-
*/class
|
|
1423
|
+
*/class Hc extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,s){const i=this.ho(t,e);Rs("RestConnection","Sending: ",i,n);const o={};return this.lo(o,r,s),this.fo(t,i,o,n).then((t=>(Rs("RestConnection","Received: ",t),t)),(e=>{throw Ls("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,r,s,i){return this.ao(t,e,n,r,s)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+As,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=$c[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((s,i)=>{const o=new Ss;o.setWithCredentials(!0),o.listenOnce(ws.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case vs.NO_ERROR:const e=o.getResponseJson();Rs("Connection","XHR received:",JSON.stringify(e)),s(e);break;case vs.TIMEOUT:Rs("Connection",'RPC "'+t+'" timed out'),i(new Vs(Fs.DEADLINE_EXCEEDED,"Request time out"));break;case vs.HTTP_ERROR:const n=o.getStatus();if(Rs("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Fs).indexOf(e)>=0?e:Fs.UNKNOWN}(e.status);i(new Vs(t,e.message))}else i(new Vs(Fs.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new Vs(Fs.UNAVAILABLE,"Connection failed."));break;default:Ms()}}finally{Rs("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],s=new fs,i=ln(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new Es({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Rs("Connection","Creating WebChannel: "+a,o);const c=s.createWebChannel(a,o);let u=!1,h=!1;const l=new Kc({Hr:t=>{h?Rs("Connection","Not sending because WebChannel is closed:",t):(u||(Rs("Connection","Opening WebChannel transport."),c.open(),u=!0),Rs("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,_s.EventType.OPEN,(()=>{h||Rs("Connection","WebChannel transport opened.")})),d(c,_s.EventType.CLOSE,(()=>{h||(h=!0,Rs("Connection","WebChannel transport closed"),l.io())})),d(c,_s.EventType.ERROR,(t=>{h||(h=!0,Ls("Connection","WebChannel transport errored:",t),l.io(new Vs(Fs.UNAVAILABLE,"The operation could not be completed")))})),d(c,_s.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];xs(!!n);const r=n,s=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(s){Rs("Connection","WebChannel received error:",s);const t=s.status;let e=function(t){const e=ga[t];if(void 0!==e)return ya(e)}(t),n=s.message;void 0===e&&(e=Fs.INTERNAL,n="Unknown error status: "+t+" with message "+s.message),h=!0,l.io(new Vs(e,n)),c.close()}else Rs("Connection","WebChannel received:",n),l.ro(n)}})),d(i,Is.STAT_EVENT,(t=>{t.stat===bs?Rs("Connection","Detected buffering proxy"):t.stat===Ts&&Rs("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Gc(){return"undefined"!=typeof document?document:null}
|
|
1425
1424
|
/**
|
|
1426
1425
|
* @license
|
|
1427
1426
|
* Copyright 2020 Google LLC
|
|
@@ -1437,7 +1436,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1437
1436
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1438
1437
|
* See the License for the specific language governing permissions and
|
|
1439
1438
|
* limitations under the License.
|
|
1440
|
-
*/function
|
|
1439
|
+
*/function Wc(t){return new za(t,!0)}class Qc{constructor(t,e,n=1e3,r=1.5,s=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=r,this.po=s,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,e-n);r>0&&Rs("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
|
|
1441
1440
|
/**
|
|
1442
1441
|
* @license
|
|
1443
1442
|
* Copyright 2017 Google LLC
|
|
@@ -1453,7 +1452,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1453
1452
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1454
1453
|
* See the License for the specific language governing permissions and
|
|
1455
1454
|
* limitations under the License.
|
|
1456
|
-
*/class Yc{constructor(t,e,n,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new
|
|
1455
|
+
*/class Yc{constructor(t,e,n,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new Qc(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===Fs.RESOURCE_EXHAUSTED?(Os(e.toString()),Os("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Fs.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new Vs(Fs.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return Rs("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Rs("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Xc extends Yc{constructor(t,e,n,r,s,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,i),this.yt=s}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Ms()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(xs(void 0===e||"string"==typeof e),bi.fromBase64String(e||"")):(xs(void 0===e||e instanceof Uint8Array),bi.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Fs.UNKNOWN:ya(t.code);return new Vs(e,t.message||"")}(o);n=new Ma(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Qa(t,r.document.name),i=Ha(r.document.updateTime),o=r.document.createTime?Ha(r.document.createTime):ti.min(),a=new vo({mapValue:{fields:r.document.fields}}),c=wo.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new La(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Qa(t,r.document),i=r.readTime?Ha(r.readTime):ti.min(),o=wo.newNoDocument(s,i),a=r.removedTargetIds||[];n=new La([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Qa(t,r.document),i=r.removedTargetIds||[];n=new La([],i,s,null)}else{if(!("filter"in e))return Ms();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new pa(r),i=t.targetId;n=new Pa(i,s)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return ti.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?ti.min():e.readTime?Ha(e.readTime):ti.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Xa(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=_o(r)?{documents:Za(t,r)}:{query:tc(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Ka(t,e.resumeToken):e.snapshotVersion.compareTo(ti.min())>0&&(n.readTime=$a(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Ms()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=Xa(this.yt),e.removeTarget=t,this.Bo(e)}}
|
|
1457
1456
|
/**
|
|
1458
1457
|
* @license
|
|
1459
1458
|
* Copyright 2017 Google LLC
|
|
@@ -1469,7 +1468,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1469
1468
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1470
1469
|
* See the License for the specific language governing permissions and
|
|
1471
1470
|
* limitations under the License.
|
|
1472
|
-
*/class
|
|
1471
|
+
*/class Jc extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new Vs(Fs.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,s])=>this.connection.ao(t,e,n,r,s))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Fs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Vs(Fs.UNKNOWN,t.toString())}))}_o(t,e,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection._o(t,e,n,s,i,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Fs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Vs(Fs.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class Zc{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(t){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.cu("Offline")))}set(t){this.lu(),this.iu=0,"Online"===t&&(this.ou=!1),this.cu(t)}cu(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}au(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.ou?(Os(e),this.ou=!1):Rs("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
|
|
1473
1472
|
/**
|
|
1474
1473
|
* @license
|
|
1475
1474
|
* Copyright 2017 Google LLC
|
|
@@ -1485,7 +1484,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1485
1484
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1486
1485
|
* See the License for the specific language governing permissions and
|
|
1487
1486
|
* limitations under the License.
|
|
1488
|
-
*/class
|
|
1487
|
+
*/class tu{constructor(t,e,n,r,s){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=s,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{uu(this)&&(Rs("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Us(t);e._u.add(4),await nu(e),e.gu.set("Unknown"),e._u.delete(4),await eu(e)}(this))}))})),this.gu=new Zc(n,r)}}async function eu(t){if(uu(t))for(const e of t.wu)await e(!0)}async function nu(t){for(const e of t.wu)await e(!1)}function ru(t,e){const n=Us(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),cu(n)?au(n):mu(n).ko()&&iu(n,e))}function su(t,e){const n=Us(t),r=mu(n);n.du.delete(e),r.ko()&&ou(n,e),0===n.du.size&&(r.ko()?r.Fo():uu(n)&&n.gu.set("Unknown"))}function iu(t,e){t.yu.Ot(e.targetId),mu(t).zo(e)}function ou(t,e){t.yu.Ot(e),mu(t).Ho(e)}function au(t){t.yu=new Ua({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),mu(t).start(),t.gu.uu()}function cu(t){return uu(t)&&!mu(t).No()&&t.du.size>0}function uu(t){return 0===Us(t)._u.size}function hu(t){t.yu=void 0}async function lu(t){t.du.forEach(((e,n)=>{iu(t,e)}))}async function du(t,e){hu(t),cu(t)?(t.gu.hu(e),au(t)):t.gu.set("Unknown")}async function fu(t,e,n){if(t.gu.set("Online"),e instanceof Ma&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.du.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.du.delete(r),t.yu.removeTarget(r))}(t,e)}catch(n){Rs("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await pu(t,n)}else if(e instanceof La?t.yu.Kt(e):e instanceof Pa?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(ti.min()))try{const e=await xc(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=t.du.get(r);s&&t.du.set(r,s.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(bi.EMPTY_BYTE_STRING,n.snapshotVersion)),ou(t,e);const r=new dc(n.target,e,1,n.sequenceNumber);iu(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Rs("RemoteStore","Failed to raise snapshot:",e),await pu(t,e)}}async function pu(t,e,n){if(!di(e))throw e;t._u.add(1),await nu(t),t.gu.set("Offline"),n||(n=()=>xc(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Rs("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await eu(t)}))}async function gu(t,e){const n=Us(t);n.asyncQueue.verifyOperationInProgress(),Rs("RemoteStore","RemoteStore received new credentials");const r=uu(n);n._u.add(3),await nu(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await eu(n)}function mu(t){return t.pu||(t.pu=function(t,e,n){const r=Us(t);return r.su(),new Xc(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
|
|
1489
1488
|
/**
|
|
1490
1489
|
* @license
|
|
1491
1490
|
* Copyright 2018 Google LLC
|
|
@@ -1501,7 +1500,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1501
1500
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1502
1501
|
* See the License for the specific language governing permissions and
|
|
1503
1502
|
* limitations under the License.
|
|
1504
|
-
*/}(t.datastore,t.asyncQueue,{Yr:
|
|
1503
|
+
*/}(t.datastore,t.asyncQueue,{Yr:lu.bind(null,t),Zr:du.bind(null,t),Wo:fu.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),cu(t)?au(t):t.gu.set("Unknown")):(await t.pu.stop(),hu(t))}))),t.pu
|
|
1505
1504
|
/**
|
|
1506
1505
|
* @license
|
|
1507
1506
|
* Copyright 2017 Google LLC
|
|
@@ -1517,7 +1516,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1517
1516
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1518
1517
|
* See the License for the specific language governing permissions and
|
|
1519
1518
|
* limitations under the License.
|
|
1520
|
-
*/}class
|
|
1519
|
+
*/}class yu{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new qs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,s){const i=Date.now()+n,o=new yu(t,e,i,r,s);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Vs(Fs.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function vu(t,e){if(Os("AsyncQueue",`${e}: ${t}`),di(t))return new Vs(Fs.UNAVAILABLE,`${e}: ${t}`);throw t}
|
|
1521
1520
|
/**
|
|
1522
1521
|
* @license
|
|
1523
1522
|
* Copyright 2017 Google LLC
|
|
@@ -1533,7 +1532,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1533
1532
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1534
1533
|
* See the License for the specific language governing permissions and
|
|
1535
1534
|
* limitations under the License.
|
|
1536
|
-
*/class
|
|
1535
|
+
*/class wu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||ii.comparator(e.key,n.key):(t,e)=>ii.comparator(t.key,e.key),this.keyedMap=Ta(),this.sortedSet=new lo(this.comparator)}static emptySet(t){return new wu(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof wu))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new wu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
|
|
1537
1536
|
/**
|
|
1538
1537
|
* @license
|
|
1539
1538
|
* Copyright 2017 Google LLC
|
|
@@ -1549,7 +1548,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1549
1548
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1550
1549
|
* See the License for the specific language governing permissions and
|
|
1551
1550
|
* limitations under the License.
|
|
1552
|
-
*/class
|
|
1551
|
+
*/class Iu{constructor(){this.Tu=new lo(ii.comparator)}track(t){const e=t.doc.key,n=this.Tu.get(e);n?0!==t.type&&3===n.type?this.Tu=this.Tu.insert(e,t):3===t.type&&1!==n.type?this.Tu=this.Tu.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Tu=this.Tu.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Tu=this.Tu.remove(e):1===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):Ms():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class bu{constructor(t,e,n,r,s,i,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,r,s){const i=[];return e.forEach((t=>{i.push({type:0,doc:t})})),new bu(t,e,wu.emptySet(e),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&Mo(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}
|
|
1553
1552
|
/**
|
|
1554
1553
|
* @license
|
|
1555
1554
|
* Copyright 2017 Google LLC
|
|
@@ -1565,7 +1564,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1565
1564
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1566
1565
|
* See the License for the specific language governing permissions and
|
|
1567
1566
|
* limitations under the License.
|
|
1568
|
-
*/class Tu{constructor(){this.Au=void 0,this.listeners=[]}}class
|
|
1567
|
+
*/class Tu{constructor(){this.Au=void 0,this.listeners=[]}}class Eu{constructor(){this.queries=new va((t=>xo(t)),Mo),this.onlineState="Unknown",this.Ru=new Set}}async function _u(t,e){const n=Us(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new Tu),s)try{i.Au=await n.onListen(r)}catch(t){const n=vu(t,`Initialization of query '${Uo(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,i),i.listeners.push(e),e.bu(n.onlineState),i.Au&&e.Pu(i.Au)&&Au(n)}async function Su(t,e){const n=Us(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const t=i.listeners.indexOf(e);t>=0&&(i.listeners.splice(t,1),s=0===i.listeners.length)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function Cu(t,e){const n=Us(t);let r=!1;for(const t of e){const e=t.query,s=n.queries.get(e);if(s){for(const e of s.listeners)e.Pu(t)&&(r=!0);s.Au=t}}r&&Au(n)}function ku(t,e,n){const r=Us(t),s=r.queries.get(e);if(s)for(const t of s.listeners)t.onError(n);r.queries.delete(e)}function Au(t){t.Ru.forEach((t=>{t.next()}))}class Nu{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new bu(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=bu.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
|
|
1569
1568
|
/**
|
|
1570
1569
|
* @license
|
|
1571
1570
|
* Copyright 2017 Google LLC
|
|
@@ -1581,7 +1580,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1581
1580
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1582
1581
|
* See the License for the specific language governing permissions and
|
|
1583
1582
|
* limitations under the License.
|
|
1584
|
-
*/class
|
|
1583
|
+
*/class Du{constructor(t){this.key=t}}class Ru{constructor(t){this.key=t}}class Ou{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Aa(),this.mutatedKeys=Aa(),this.Gu=Vo(t),this.Qu=new wu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Iu,r=e?e.Qu:this.Qu;let s=e?e.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const u=r.get(t),h=Fo(this.query,e)?e:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.Hu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Gu(h,a)>0||c&&this.Gu(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(t):s.delete(t)):(i=i.delete(t),s=s.delete(t)))})),null!==this.query.limit)for(;i.size>this.query.limit;){const t="F"===this.query.limitType?i.last():i.first();i=i.delete(t.key),s=s.delete(t.key),n.track({type:1,doc:t})}return{Qu:i,zu:n,$i:o,mutatedKeys:s}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const s=t.zu.Eu();s.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ms()}};return n(t)-n(e)}
|
|
1585
1584
|
/**
|
|
1586
1585
|
* @license
|
|
1587
1586
|
* Copyright 2020 Google LLC
|
|
@@ -1597,7 +1596,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1597
1596
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1598
1597
|
* See the License for the specific language governing permissions and
|
|
1599
1598
|
* limitations under the License.
|
|
1600
|
-
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==s.length||a?{snapshot:new
|
|
1599
|
+
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==s.length||a?{snapshot:new bu(this.query,t.Qu,r,s,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Iu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Aa(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Ru(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Du(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Aa();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return bu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Lu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class Pu{constructor(t){this.key=t,this.nc=!1}}class Mu{constructor(t,e,n,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new va((t=>xo(t)),Mo),this.rc=new Map,this.oc=new Set,this.uc=new lo(ii.comparator),this.cc=new Map,this.ac=new Ec,this.hc={},this.lc=new Map,this.fc=yc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function xu(t,e){const n=function(t){const e=Us(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Fu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Wu.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=qu.bind(null,e),e.sc.Wo=Cu.bind(null,e.eventManager),e.sc.wc=ku.bind(null,e.eventManager),e}(t);let r,s;const i=n.ic.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.ec();else{const t=await function(t,e){const n=Us(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,li.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new dc(e,s,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Oo(e));n.isPrimaryClient&&ru(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,s=await async function(t,e,n,r,s){t._c=(e,n,r)=>async function(t,e,n,r){let s=e.view.Wu(n);s.$i&&(s=await Vc(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,s))));const i=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(s,t.isPrimaryClient,i);return zu(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await Vc(t.localStore,e,!0),o=new Ou(e,i.Hi),a=o.Wu(i.documents),c=Oa.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),u=o.applyChanges(a,t.isPrimaryClient,c);zu(t,n,u.Xu);const h=new Lu(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,r,"current"===i,t.resumeToken)}return s}async function Uu(t,e){const n=Us(t),r=n.ic.get(e),s=n.rc.get(r.targetId);if(s.length>1)return n.rc.set(r.targetId,s.filter((t=>!Mo(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Fc(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),su(n.remoteStore,r.targetId),ju(n,r.targetId)})).catch(hi)):(ju(n,r.targetId),await Fc(n.localStore,r.targetId,!0))}async function Fu(t,e){const n=Us(t);try{const t=await Uc(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(xs(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?xs(r.nc):t.removedDocuments.size>0&&(xs(r.nc),r.nc=!1))})),await Hu(n,t,e)}catch(t){await hi(t)}}function Vu(t,e,n){const r=Us(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const s=r.view.bu(e);s.snapshot&&t.push(s.snapshot)})),function(t,e){const n=Us(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Au(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function qu(t,e,n){const r=Us(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new lo(ii.comparator);t=t.insert(i,wo.newNoDocument(i,ti.min()));const n=Aa().add(i),s=new Ra(ti.min(),new Map,new go(Xs),t,n);await Fu(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),Ku(r)}else await Fc(r.localStore,e,!1).then((()=>ju(r,e,n))).catch(hi)}function ju(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||Bu(t,e)}))}function Bu(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(su(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),Ku(t))}function zu(t,e,n){for(const r of n)r instanceof Du?(t.ac.addReference(r.key,e),$u(t,r)):r instanceof Ru?(Rs("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||Bu(t,r.key)):Ms()}function $u(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Rs("SyncEngine","New document in limbo: "+n),t.oc.add(r),Ku(t))}function Ku(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new ii(ni.fromString(e)),r=t.fc.next();t.cc.set(r,new Pu(n)),t.uc=t.uc.insert(n,r),ru(t.remoteStore,new dc(Oo(Co(n.path)),r,2,fi.at))}}async function Hu(t,e,n){const r=Us(t),s=[],i=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){s.push(t);const e=Oc.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Us(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>li.forEach(e,(e=>li.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>li.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!di(t))throw t;Rs("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,s)}}}(r.localStore,i))}async function Gu(t,e){const n=Us(t);if(!n.currentUser.isEqual(e)){Rs("SyncEngine","User change. New user:",e.toKey());const t=await Mc(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Vs(Fs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await Hu(n,t.ji)}}function Wu(t,e){const n=Us(t),r=n.cc.get(e);if(r&&r.nc)return Aa().add(r.key);{let t=Aa();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class Qu{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=Wc(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new Pc(t,e,n,r)}(this.persistence,new Lc,t.initialUser,this.yt)}yc(t){return new Nc(Rc.Bs,this.yt)}gc(t){return new jc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Yu{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>Vu(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Gu.bind(null,this.syncEngine),await async function(t,e){const n=Us(t);e?(n._u.delete(2),await eu(n)):e||(n._u.add(2),await nu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Eu}createDatastore(t){const e=Wc(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new Hc(r));var r;return function(t,e,n,r){return new Jc(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>Vu(this.syncEngine,t,0),i=zc.C()?new zc:new Bc,new tu(e,n,r,s,i);var e,n,r,s,i}createSyncEngine(t,e){return function(t,e,n,r,s,i,o){const a=new Mu(t,e,n,r,s,i);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Us(t);Rs("RemoteStore","RemoteStore shutting down."),e._u.add(5),await nu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1601
1600
|
/**
|
|
1602
1601
|
* @license
|
|
1603
1602
|
* Copyright 2017 Google LLC
|
|
@@ -1613,7 +1612,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1613
1612
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1614
1613
|
* See the License for the specific language governing permissions and
|
|
1615
1614
|
* limitations under the License.
|
|
1616
|
-
*/function
|
|
1615
|
+
*/function Xu(t,e,n){if(!n)throw new Vs(Fs.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Ju(t){if(!ii.isDocumentKey(t))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Zu(t){if(ii.isDocumentKey(t))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function th(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Ms()}function eh(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Vs(Fs.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=th(t);throw new Vs(Fs.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
|
|
1617
1616
|
/**
|
|
1618
1617
|
* @license
|
|
1619
1618
|
* Copyright 2020 Google LLC
|
|
@@ -1629,7 +1628,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1629
1628
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1630
1629
|
* See the License for the specific language governing permissions and
|
|
1631
1630
|
* limitations under the License.
|
|
1632
|
-
*/const
|
|
1631
|
+
*/const nh=new Map;class rh{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Vs(Fs.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Vs(Fs.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new Vs(Fs.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}
|
|
1633
1632
|
/**
|
|
1634
1633
|
* @license
|
|
1635
1634
|
* Copyright 2020 Google LLC
|
|
@@ -1645,7 +1644,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1645
1644
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1646
1645
|
* See the License for the specific language governing permissions and
|
|
1647
1646
|
* limitations under the License.
|
|
1648
|
-
*/class
|
|
1647
|
+
*/class sh{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new rh({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Vs(Fs.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Vs(Fs.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new rh(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Bs;switch(t.type){case"gapi":const e=t.client;return new Hs(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Vs(Fs.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=nh.get(t);e&&(Rs("ComponentProvider","Removing Datastore"),nh.delete(t),e.terminate())}(this),Promise.resolve()}}function ih(t,e,r,s={}){var i;const o=(t=eh(t,sh))._getSettings();if("firestore.googleapis.com"!==o.host&&o.host!==e&&Ls("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},o),{host:`${e}:${r}`,ssl:!1})),s.mockUserToken){let e,r;if("string"==typeof s.mockUserToken)e=s.mockUserToken,r=ks.MOCK_USER;else{e=function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const r=e||"demo-project",s=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[n(JSON.stringify({alg:"none",type:"JWT"})),n(JSON.stringify(o)),""].join(".")}
|
|
1649
1648
|
/**
|
|
1650
1649
|
* @license
|
|
1651
1650
|
* Copyright 2017 Google LLC
|
|
@@ -1661,7 +1660,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1661
1660
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1662
1661
|
* See the License for the specific language governing permissions and
|
|
1663
1662
|
* limitations under the License.
|
|
1664
|
-
*/(
|
|
1663
|
+
*/(s.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const o=s.mockUserToken.sub||s.mockUserToken.user_id;if(!o)throw new Vs(Fs.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");r=new ks(o)}t._authCredentials=new zs(new js(e,r))}}
|
|
1665
1664
|
/**
|
|
1666
1665
|
* @license
|
|
1667
1666
|
* Copyright 2020 Google LLC
|
|
@@ -1677,7 +1676,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1677
1676
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1678
1677
|
* See the License for the specific language governing permissions and
|
|
1679
1678
|
* limitations under the License.
|
|
1680
|
-
*/class
|
|
1679
|
+
*/class oh{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new ch(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new oh(this.firestore,t,this._key)}}class ah{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new ah(this.firestore,t,this._query)}}class ch extends ah{constructor(t,e,n){super(t,e,Co(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new oh(this.firestore,null,new ii(t))}withConverter(t){return new ch(this.firestore,t,this._path)}}function uh(t,e,...n){if(t=I(t),Xu("collection","path",e),t instanceof sh){const r=ni.fromString(e,...n);return Zu(r),new ch(t,null,r)}{if(!(t instanceof oh||t instanceof ch))throw new Vs(Fs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(ni.fromString(e,...n));return Zu(r),new ch(t.firestore,null,r)}}
|
|
1681
1680
|
/**
|
|
1682
1681
|
* @license
|
|
1683
1682
|
* Copyright 2020 Google LLC
|
|
@@ -1710,7 +1709,7 @@ class Ia{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1710
1709
|
* See the License for the specific language governing permissions and
|
|
1711
1710
|
* limitations under the License.
|
|
1712
1711
|
*/
|
|
1713
|
-
class
|
|
1712
|
+
class hh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next&&this.Rc(this.observer.next,t)}error(t){this.observer.error?this.Rc(this.observer.error,t):Os("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
|
|
1714
1713
|
/**
|
|
1715
1714
|
* @license
|
|
1716
1715
|
* Copyright 2017 Google LLC
|
|
@@ -1726,7 +1725,7 @@ class dh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next
|
|
|
1726
1725
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1727
1726
|
* See the License for the specific language governing permissions and
|
|
1728
1727
|
* limitations under the License.
|
|
1729
|
-
*/class
|
|
1728
|
+
*/class lh{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=ks.UNAUTHENTICATED,this.clientId=Ys.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Rs("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Rs("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Vs(Fs.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new qs;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=vu(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function dh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Rs("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Rs("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await Mc(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Qu)),t.offlineComponents}(t);Rs("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>gu(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>gu(e.remoteStore,n))),t.onlineComponents=e}async function fh(t){const e=await async function(t){return t.onlineComponents||(Rs("FirestoreClient","Using default OnlineComponentProvider"),await dh(t,new Yu)),t.onlineComponents}(t),n=e.eventManager;return n.onListen=xu.bind(null,e.syncEngine),n.onUnlisten=Uu.bind(null,e.syncEngine),n}class ph{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new Qc(this,"async_queue_retry"),this.Wc=()=>{const t=Gc();t&&Rs("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=Gc();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=Gc();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new qs;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!di(t))throw t;Rs("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
|
|
1730
1729
|
/**
|
|
1731
1730
|
* @license
|
|
1732
1731
|
* Copyright 2017 Google LLC
|
|
@@ -1742,7 +1741,7 @@ class dh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next
|
|
|
1742
1741
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1743
1742
|
* See the License for the specific language governing permissions and
|
|
1744
1743
|
* limitations under the License.
|
|
1745
|
-
*/(t);throw
|
|
1744
|
+
*/(t);throw Os("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.Gc=!1,t))))));return this.Bc=e,e}enqueueAfterDelay(t,e,n){this.zc(),this.jc.indexOf(t)>-1&&(e=0);const r=yu.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&Ms()}verifyOperationInProgress(){}async Xc(){let t;do{t=this.Bc,await t}while(t!==this.Bc)}Zc(t){for(const e of this.Uc)if(e.timerId===t)return!0;return!1}ta(t){return this.Xc().then((()=>{this.Uc.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.Uc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.Xc()}))}ea(t){this.jc.push(t)}Yc(t){const e=this.Uc.indexOf(t);this.Uc.splice(e,1)}}function gh(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of["next","error","complete"])if(t in n&&"function"==typeof n[t])return!0;return!1}
|
|
1746
1745
|
/**
|
|
1747
1746
|
* @license
|
|
1748
1747
|
* Copyright 2020 Google LLC
|
|
@@ -1758,7 +1757,7 @@ class dh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next
|
|
|
1758
1757
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1759
1758
|
* See the License for the specific language governing permissions and
|
|
1760
1759
|
* limitations under the License.
|
|
1761
|
-
*/(t)}class
|
|
1760
|
+
*/(t)}class mh extends sh{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new ph,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||wh(this),this._firestoreClient.terminate()}}function yh(t,e){const n="string"==typeof t?t:e||"(default)",r=rt("object"==typeof t?t:ct(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=(t=>{const e=a(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]})("firestore");t&&ih(r,...t)}return r}function vh(t){return t._firestoreClient||wh(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function wh(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new pi(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
|
|
1762
1761
|
/**
|
|
1763
1762
|
* @license
|
|
1764
1763
|
* Copyright 2020 Google LLC
|
|
@@ -1774,7 +1773,7 @@ class dh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next
|
|
|
1774
1773
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1775
1774
|
* See the License for the specific language governing permissions and
|
|
1776
1775
|
* limitations under the License.
|
|
1777
|
-
*/(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new
|
|
1776
|
+
*/(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new lh(t._authCredentials,t._appCheckCredentials,t._queue,r)}
|
|
1778
1777
|
/**
|
|
1779
1778
|
* @license
|
|
1780
1779
|
* Copyright 2020 Google LLC
|
|
@@ -1806,7 +1805,7 @@ class dh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next
|
|
|
1806
1805
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1807
1806
|
* See the License for the specific language governing permissions and
|
|
1808
1807
|
* limitations under the License.
|
|
1809
|
-
*/class
|
|
1808
|
+
*/class Ih{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Ih(bi.fromBase64String(t))}catch(t){throw new Vs(Fs.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Ih(bi.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
|
|
1810
1809
|
/**
|
|
1811
1810
|
* @license
|
|
1812
1811
|
* Copyright 2020 Google LLC
|
|
@@ -1822,7 +1821,7 @@ class dh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next
|
|
|
1822
1821
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1823
1822
|
* See the License for the specific language governing permissions and
|
|
1824
1823
|
* limitations under the License.
|
|
1825
|
-
*/class
|
|
1824
|
+
*/class bh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Vs(Fs.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new si(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
|
|
1826
1825
|
/**
|
|
1827
1826
|
* @license
|
|
1828
1827
|
* Copyright 2020 Google LLC
|
|
@@ -1855,7 +1854,7 @@ class Th{constructor(t){this._methodName=t}}
|
|
|
1855
1854
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1856
1855
|
* See the License for the specific language governing permissions and
|
|
1857
1856
|
* limitations under the License.
|
|
1858
|
-
*/class
|
|
1857
|
+
*/class Eh{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Vs(Fs.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Vs(Fs.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return Xs(this._lat,t._lat)||Xs(this._long,t._long)}}
|
|
1859
1858
|
/**
|
|
1860
1859
|
* @license
|
|
1861
1860
|
* Copyright 2017 Google LLC
|
|
@@ -1871,7 +1870,7 @@ class Th{constructor(t){this._methodName=t}}
|
|
|
1871
1870
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1872
1871
|
* See the License for the specific language governing permissions and
|
|
1873
1872
|
* limitations under the License.
|
|
1874
|
-
*/const
|
|
1873
|
+
*/const _h=/^__.*__$/;function Sh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ms()}}class Ch{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new Ch(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return Rh(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(Sh(this.sa)&&_h.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class kh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||Wc(t)}da(t,e,n,r=!1){return new Ch({sa:t,methodName:e,fa:n,path:si.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Ah(t,e){if(Nh(t=I(t)))return function(t,e,n){if(!Nh(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=th(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}("Unsupported field value:",e,t),function(t,e){const n={};return vi(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):yi(t,((t,r)=>{const s=Ah(r,e.ra(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}(t,e);if(t instanceof Th)return function(t,e){if(!Sh(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const s of t){let t=Ah(s,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=I(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return zo(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Zs.fromDate(t);return{timestampValue:$a(e.yt,n)}}if(t instanceof Zs){const n=new Zs(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:$a(e.yt,n)}}if(t instanceof Eh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Ih)return{bytesValue:Ka(e.yt,t._byteString)};if(t instanceof oh){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Ga(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${th(t)}`)}(t,e)}function Nh(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Zs||t instanceof Eh||t instanceof Ih||t instanceof oh||t instanceof Th)}const Dh=new RegExp("[~\\*/\\[\\]]");function Rh(t,e,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Vs(Fs.INVALID_ARGUMENT,a+t+c)
|
|
1875
1874
|
/**
|
|
1876
1875
|
* @license
|
|
1877
1876
|
* Copyright 2020 Google LLC
|
|
@@ -1887,7 +1886,7 @@ class Th{constructor(t){this._methodName=t}}
|
|
|
1887
1886
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1888
1887
|
* See the License for the specific language governing permissions and
|
|
1889
1888
|
* limitations under the License.
|
|
1890
|
-
*/}class
|
|
1889
|
+
*/}class Oh{constructor(t,e,n,r,s){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new oh(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new Lh(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(Ph("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class Lh extends Oh{data(){return super.data()}}function Ph(t,e){return"string"==typeof e?function(t,e,n){if(e.search(Dh)>=0)throw Rh(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new bh(...e.split("."))._internalPath}catch(r){throw Rh(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}(t,e):e instanceof bh?e._internalPath:e._delegate._internalPath}
|
|
1891
1890
|
/**
|
|
1892
1891
|
* @license
|
|
1893
1892
|
* Copyright 2020 Google LLC
|
|
@@ -1903,7 +1902,7 @@ class Th{constructor(t){this._methodName=t}}
|
|
|
1903
1902
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1904
1903
|
* See the License for the specific language governing permissions and
|
|
1905
1904
|
* limitations under the License.
|
|
1906
|
-
*/function
|
|
1905
|
+
*/function Mh(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Vs(Fs.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class xh{}class Uh extends xh{}function Fh(t,e,...n){let r=[];e instanceof xh&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof jh)).length,n=t.filter((t=>t instanceof Vh)).length;if(e>1||e>0&&n>0)throw new Vs(Fs.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
|
|
1907
1906
|
/**
|
|
1908
1907
|
* @license
|
|
1909
1908
|
* Copyright 2020 Google LLC
|
|
@@ -1919,7 +1918,7 @@ class Th{constructor(t){this._methodName=t}}
|
|
|
1919
1918
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1920
1919
|
* See the License for the specific language governing permissions and
|
|
1921
1920
|
* limitations under the License.
|
|
1922
|
-
*/(r);for(const e of r)t=e._apply(t);return t}class
|
|
1921
|
+
*/(r);for(const e of r)t=e._apply(t);return t}class Vh extends Uh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Vh(t,e,n)}_apply(t){const e=this._parse(t);return $h(t._query,e),new ah(t.firestore,t.converter,Lo(t._query,e))}_parse(t){const e=function(t){const e=t._freezeSettings(),n=Wc(t._databaseId);return new kh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){zh(o,i);const e=[];for(const n of o)e.push(Bh(r,t,n));a={arrayValue:{values:e}}}else a=Bh(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||zh(o,i),a=function(t,e,n,r=!1){return Ah(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Wi.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function qh(t,e,n){const r=e,s=Ph("where",t);return Vh._create(s,r,n)}class jh extends xh{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new jh(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Qi.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)$h(n,t),n=Lo(n,t)}(t._query,e),new ah(t.firestore,t.converter,Lo(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Bh(t,e,n){if("string"==typeof(n=I(n))){if(""===n)throw new Vs(Fs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Do(e)&&-1!==n.indexOf("/"))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(ni.fromString(n));if(!ii.isDocumentKey(r))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Ui(t,new ii(r))}if(n instanceof oh)return Ui(t,n._key);throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${th(n)}.`)}function zh(t,e){if(!Array.isArray(t)||0===t.length)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function $h(t,e){if(e.isInequality()){const n=No(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const s=Ao(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,s)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Vs(Fs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Vs(Fs.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Kh{convertValue(t,e="none"){switch(Di(t)){case 0:return null;case 1:return t.booleanValue;case 2:return _i(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(Si(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Ms()}}convertObject(t,e){const n={};return yi(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Eh(_i(t.latitude),_i(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=ki(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ai(t));default:return null}}convertTimestamp(t){const e=Ei(t);return new Zs(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=ni.fromString(t);xs(uc(n));const r=new gi(n.get(1),n.get(3)),s=new ii(n.popFirst(5));return r.isEqual(e)||Os(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),s}}
|
|
1923
1922
|
/**
|
|
1924
1923
|
* @license
|
|
1925
1924
|
* Copyright 2020 Google LLC
|
|
@@ -1935,7 +1934,7 @@ class Th{constructor(t){this._methodName=t}}
|
|
|
1935
1934
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1936
1935
|
* See the License for the specific language governing permissions and
|
|
1937
1936
|
* limitations under the License.
|
|
1938
|
-
*/class
|
|
1937
|
+
*/class Hh{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Gh extends Oh{constructor(t,e,n,r,s,i){super(t,e,n,r,i),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Wh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(Ph("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Wh extends Gh{data(t={}){return super.data(t)}}class Qh{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Hh(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Wh(this._firestore,this._userDataWriter,n.key,n,new Hh(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Vs(Fs.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Wh(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Hh(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Wh(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Hh(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,i=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:Yh(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Yh(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ms()}}
|
|
1939
1938
|
/**
|
|
1940
1939
|
* @license
|
|
1941
1940
|
* Copyright 2020 Google LLC
|
|
@@ -1951,7 +1950,7 @@ class Th{constructor(t){this._methodName=t}}
|
|
|
1951
1950
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1952
1951
|
* See the License for the specific language governing permissions and
|
|
1953
1952
|
* limitations under the License.
|
|
1954
|
-
*/function
|
|
1953
|
+
*/function Xh(t){t=eh(t,oh);const e=eh(t.firestore,mh);return function(t,e,n={}){const r=new qs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new hh({next:i=>{e.enqueueAndForget((()=>Su(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Vs(Fs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Vs(Fs.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.)')):s.resolve(i)},error:t=>s.reject(t)}),o=new Nu(Co(n.path),i,{includeMetadataChanges:!0,Nu:!0});return _u(t,o)}(await fh(t),t.asyncQueue,e,n,r))),r.promise}(vh(e),t._key).then((n=>tl(e,t,n)))}class Jh extends Kh{constructor(t){super(),this.firestore=t}convertBytes(t){return new Ih(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new oh(this.firestore,null,e)}}function Zh(t){t=eh(t,ah);const e=eh(t.firestore,mh),n=vh(e),r=new Jh(e);return Mh(t._query),function(t,e,n={}){const r=new qs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new hh({next:n=>{e.enqueueAndForget((()=>Su(t,o))),n.fromCache&&"server"===r.source?s.reject(new Vs(Fs.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.)')):s.resolve(n)},error:t=>s.reject(t)}),o=new Nu(n,i,{includeMetadataChanges:!0,Nu:!0});return _u(t,o)}(await fh(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Qh(e,r,t,n)))}function tl(t,e,n){const r=n.docs.get(e._key),s=new Jh(t);return new Gh(t,s,e._key,r,new Hh(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){As=ot,nt(new b("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new mh(new $s(t.getProvider("auth-internal")),new Ws(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Vs(Fs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new gi(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),ut(Cs,"3.8.0",t),ut(Cs,"3.8.0","esm2017")}();
|
|
1955
1954
|
/**
|
|
1956
1955
|
* @license
|
|
1957
1956
|
* Copyright 2020 Google LLC
|
|
@@ -1968,7 +1967,7 @@ class Th{constructor(t){this._methodName=t}}
|
|
|
1968
1967
|
* See the License for the specific language governing permissions and
|
|
1969
1968
|
* limitations under the License.
|
|
1970
1969
|
*/
|
|
1971
|
-
|
|
1970
|
+
ut("firebase","9.15.0","app");class el{constructor(){}static getInstance(){return el.instance||(el.instance=new el),el.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?rl.firebase:nl.firebase}get api(){return"prod"===this.env?rl.api:nl.api}get config(){return"prod"===this.env?rl.config:nl.config}}const nl={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:"120000",vtoTimeout:"120000"}},rl={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:"120000",vtoTimeout:"120000"}};function sl(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]])}return n}function il(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const ol=il,al=new l("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),cl="auth/user-disabled",ul=new D("@firebase/auth");function hl(t,...e){ul.logLevel<=S.ERROR&&ul.error(`Auth (${ot}): ${t}`,...e)}
|
|
1972
1971
|
/**
|
|
1973
1972
|
* @license
|
|
1974
1973
|
* Copyright 2020 Google LLC
|
|
@@ -1984,7 +1983,7 @@ lt("firebase","9.15.0","app");const il=sl,ol=new f("auth","Firebase",{"dependent
|
|
|
1984
1983
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1985
1984
|
* See the License for the specific language governing permissions and
|
|
1986
1985
|
* limitations under the License.
|
|
1987
|
-
*/function
|
|
1986
|
+
*/function ll(t,...e){throw fl(t,...e)}function dl(t,...e){return fl(t,...e)}function fl(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return al.create(t,...e)}function pl(t,e,...n){if(!t)throw fl(e,...n)}function gl(t){const e="INTERNAL ASSERTION FAILED: "+t;throw hl(e),new Error(e)}function ml(t,e){t||gl(e)}
|
|
1988
1987
|
/**
|
|
1989
1988
|
* @license
|
|
1990
1989
|
* Copyright 2020 Google LLC
|
|
@@ -2000,7 +1999,7 @@ lt("firebase","9.15.0","app");const il=sl,ol=new f("auth","Firebase",{"dependent
|
|
|
2000
1999
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2001
2000
|
* See the License for the specific language governing permissions and
|
|
2002
2001
|
* limitations under the License.
|
|
2003
|
-
*/const
|
|
2002
|
+
*/const yl=new Map;function vl(t){ml(t instanceof Function,"Expected a class definition");let e=yl.get(t);return e?(ml(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,yl.set(t,e),e)}
|
|
2004
2003
|
/**
|
|
2005
2004
|
* @license
|
|
2006
2005
|
* Copyright 2020 Google LLC
|
|
@@ -2033,7 +2032,7 @@ lt("firebase","9.15.0","app");const il=sl,ol=new f("auth","Firebase",{"dependent
|
|
|
2033
2032
|
* See the License for the specific language governing permissions and
|
|
2034
2033
|
* limitations under the License.
|
|
2035
2034
|
*/
|
|
2036
|
-
function
|
|
2035
|
+
function wl(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Il(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
|
|
2037
2036
|
/**
|
|
2038
2037
|
* @license
|
|
2039
2038
|
* Copyright 2020 Google LLC
|
|
@@ -2049,7 +2048,7 @@ function vl(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||v
|
|
|
2049
2048
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2050
2049
|
* See the License for the specific language governing permissions and
|
|
2051
2050
|
* limitations under the License.
|
|
2052
|
-
*/function
|
|
2051
|
+
*/function bl(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Il()&&"https:"!==Il()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
|
|
2053
2052
|
/**
|
|
2054
2053
|
* @license
|
|
2055
2054
|
* Copyright 2020 Google LLC
|
|
@@ -2066,7 +2065,7 @@ function vl(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||v
|
|
|
2066
2065
|
* See the License for the specific language governing permissions and
|
|
2067
2066
|
* limitations under the License.
|
|
2068
2067
|
*/
|
|
2069
|
-
class
|
|
2068
|
+
class Tl{constructor(t,e){this.shortDelay=t,this.longDelay=e,ml(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(s())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return bl()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
|
|
2070
2069
|
/**
|
|
2071
2070
|
* @license
|
|
2072
2071
|
* Copyright 2020 Google LLC
|
|
@@ -2082,7 +2081,7 @@ class bl{constructor(t,e){this.shortDelay=t,this.longDelay=e,gl(e>t,"Short delay
|
|
|
2082
2081
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2083
2082
|
* See the License for the specific language governing permissions and
|
|
2084
2083
|
* limitations under the License.
|
|
2085
|
-
*/function El(t,e){
|
|
2084
|
+
*/function El(t,e){ml(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
|
|
2086
2085
|
/**
|
|
2087
2086
|
* @license
|
|
2088
2087
|
* Copyright 2020 Google LLC
|
|
@@ -2098,7 +2097,7 @@ class bl{constructor(t,e){this.shortDelay=t,this.longDelay=e,gl(e>t,"Short delay
|
|
|
2098
2097
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2099
2098
|
* See the License for the specific language governing permissions and
|
|
2100
2099
|
* limitations under the License.
|
|
2101
|
-
*/class _l{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void
|
|
2100
|
+
*/class _l{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void gl("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void gl("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void gl("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
|
|
2102
2101
|
/**
|
|
2103
2102
|
* @license
|
|
2104
2103
|
* Copyright 2020 Google LLC
|
|
@@ -2114,7 +2113,7 @@ class bl{constructor(t,e){this.shortDelay=t,this.longDelay=e,gl(e>t,"Short delay
|
|
|
2114
2113
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2115
2114
|
* See the License for the specific language governing permissions and
|
|
2116
2115
|
* limitations under the License.
|
|
2117
|
-
*/const
|
|
2116
|
+
*/const Sl={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",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_REQ_TYPE:"internal-error",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",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",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error"},Cl=new Tl(3e4,6e4);
|
|
2118
2117
|
/**
|
|
2119
2118
|
* @license
|
|
2120
2119
|
* Copyright 2020 Google LLC
|
|
@@ -2130,7 +2129,7 @@ class bl{constructor(t,e){this.shortDelay=t,this.longDelay=e,gl(e>t,"Short delay
|
|
|
2130
2129
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2131
2130
|
* See the License for the specific language governing permissions and
|
|
2132
2131
|
* limitations under the License.
|
|
2133
|
-
*/function
|
|
2132
|
+
*/function kl(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Al(t,e,n,r,s={}){return Nl(t,s,(async()=>{let s={},i={};r&&("GET"===e?i=r:s={body:JSON.stringify(r)});const o=g(Object.assign({key:t.config.apiKey},i)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),_l.fetch()(Rl(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function Nl(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Sl),e);try{const e=new Ol(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw Ll(t,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const e=s.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Ll(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Ll(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw Ll(t,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const r=Object.assign(Object.assign({},ol()),{[e]:n});return new l("auth","Firebase",r).create(e,{appName:t.name})}(t,a,o);ll(t,a)}}catch(e){if(e instanceof h)throw e;ll(t,"network-request-failed")}}async function Dl(t,e,n,r,s={}){const i=await Al(t,e,n,r,s);return"mfaPendingCredential"in i&&ll(t,"multi-factor-auth-required",{_serverResponse:i}),i}function Rl(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?El(t.config,s):`${t.config.apiScheme}://${s}`}class Ol{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(dl(this.auth,"network-request-failed"))),Cl.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Ll(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=dl(t,e,r);return s.customData._tokenResponse=n,s}
|
|
2134
2133
|
/**
|
|
2135
2134
|
* @license
|
|
2136
2135
|
* Copyright 2020 Google LLC
|
|
@@ -2163,7 +2162,7 @@ class bl{constructor(t,e){this.shortDelay=t,this.longDelay=e,gl(e>t,"Short delay
|
|
|
2163
2162
|
* See the License for the specific language governing permissions and
|
|
2164
2163
|
* limitations under the License.
|
|
2165
2164
|
*/
|
|
2166
|
-
function
|
|
2165
|
+
function Pl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Ml(t){return 1e3*Number(t)}function xl(t){const[e,n,s]=t.split(".");if(void 0===e||void 0===n||void 0===s)return hl("JWT malformed, contained fewer than 3 sections"),null;try{const t=r(n);return t?JSON.parse(t):(hl("Failed to decode base64 JWT payload"),null)}catch(t){return hl("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}
|
|
2167
2166
|
/**
|
|
2168
2167
|
* @license
|
|
2169
2168
|
* Copyright 2020 Google LLC
|
|
@@ -2180,7 +2179,7 @@ function Ll(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))retur
|
|
|
2180
2179
|
* See the License for the specific language governing permissions and
|
|
2181
2180
|
* limitations under the License.
|
|
2182
2181
|
*/
|
|
2183
|
-
async function
|
|
2182
|
+
async function Ul(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof h&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
|
|
2184
2183
|
/**
|
|
2185
2184
|
* @license
|
|
2186
2185
|
* Copyright 2020 Google LLC
|
|
@@ -2196,7 +2195,7 @@ async function xl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2196
2195
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2197
2196
|
* See the License for the specific language governing permissions and
|
|
2198
2197
|
* limitations under the License.
|
|
2199
|
-
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class
|
|
2198
|
+
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class Fl{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
|
|
2200
2199
|
/**
|
|
2201
2200
|
* @license
|
|
2202
2201
|
* Copyright 2020 Google LLC
|
|
@@ -2212,7 +2211,7 @@ async function xl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2212
2211
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2213
2212
|
* See the License for the specific language governing permissions and
|
|
2214
2213
|
* limitations under the License.
|
|
2215
|
-
*/class
|
|
2214
|
+
*/class Vl{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Pl(this.lastLoginAt),this.creationTime=Pl(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
|
|
2216
2215
|
/**
|
|
2217
2216
|
* @license
|
|
2218
2217
|
* Copyright 2019 Google LLC
|
|
@@ -2228,7 +2227,7 @@ async function xl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2228
2227
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2229
2228
|
* See the License for the specific language governing permissions and
|
|
2230
2229
|
* limitations under the License.
|
|
2231
|
-
*/async function
|
|
2230
|
+
*/async function ql(t){var e;const n=t.auth,r=await t.getIdToken(),s=await Ul(t,async function(t,e){return Al(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:r}));pl(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=(null===(e=i.providerUserInfo)||void 0===e?void 0:e.length)?i.providerUserInfo.map((t=>{var{providerId:e}=t,n=sl(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(c=t.providerData,u=o,[...c.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var c,u;const h=t.isAnonymous,l=!(t.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new Vl(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}
|
|
2232
2231
|
/**
|
|
2233
2232
|
* @license
|
|
2234
2233
|
* Copyright 2020 Google LLC
|
|
@@ -2245,7 +2244,7 @@ async function xl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2245
2244
|
* See the License for the specific language governing permissions and
|
|
2246
2245
|
* limitations under the License.
|
|
2247
2246
|
*/
|
|
2248
|
-
class
|
|
2247
|
+
class jl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){pl(t.idToken,"internal-error"),pl(void 0!==t.idToken,"internal-error"),pl(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=xl(t);return pl(e,"internal-error"),pl(void 0!==e.exp,"internal-error"),pl(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return pl(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:s}=await
|
|
2249
2248
|
/**
|
|
2250
2249
|
* @license
|
|
2251
2250
|
* Copyright 2020 Google LLC
|
|
@@ -2262,7 +2261,7 @@ class ql{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2262
2261
|
* See the License for the specific language governing permissions and
|
|
2263
2262
|
* limitations under the License.
|
|
2264
2263
|
*/
|
|
2265
|
-
async function(t,e){const n=await
|
|
2264
|
+
async function(t,e){const n=await Nl(t,{},(async()=>{const n=g({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=Rl(t,r,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",_l.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:s}=e,i=new jl;return n&&(pl("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(pl("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(pl("number"==typeof s,"internal-error",{appName:t}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new jl,this.toJSON())}_performRefresh(){return gl("not implemented")}}
|
|
2266
2265
|
/**
|
|
2267
2266
|
* @license
|
|
2268
2267
|
* Copyright 2020 Google LLC
|
|
@@ -2278,7 +2277,7 @@ async function(t,e){const n=await kl(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2278
2277
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2279
2278
|
* See the License for the specific language governing permissions and
|
|
2280
2279
|
* limitations under the License.
|
|
2281
|
-
*/function
|
|
2280
|
+
*/function Bl(t,e){pl("string"==typeof t||void 0===t,"internal-error",{appName:e})}class zl{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,s=sl(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Fl(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Vl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await Ul(this,this.stsTokenManager.getToken(this.auth,t));return pl(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=I(t),r=await n.getIdToken(e),s=xl(r);pl(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Pl(Ml(s.auth_time)),issuedAtTime:Pl(Ml(s.iat)),expirationTime:Pl(Ml(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=I(t);await ql(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(pl(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){return new zl(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){pl(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await ql(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await Ul(this,async function(t,e){return Al(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,s,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(s=e.phoneNumber)&&void 0!==s?s:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:I,providerData:b,stsTokenManager:T}=e;pl(v&&T,t,"internal-error");const E=jl.fromJSON(this.name,T);pl("string"==typeof v,t,"internal-error"),Bl(h,t.name),Bl(l,t.name),pl("boolean"==typeof w,t,"internal-error"),pl("boolean"==typeof I,t,"internal-error"),Bl(d,t.name),Bl(f,t.name),Bl(p,t.name),Bl(g,t.name),Bl(m,t.name),Bl(y,t.name);const _=new zl({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:I,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return b&&Array.isArray(b)&&(_.providerData=b.map((t=>Object.assign({},t)))),g&&(_._redirectEventId=g),_}static async _fromIdTokenResponse(t,e,n=!1){const r=new jl;r.updateFromServerResponse(e);const s=new zl({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await ql(s),s}}
|
|
2282
2281
|
/**
|
|
2283
2282
|
* @license
|
|
2284
2283
|
* Copyright 2019 Google LLC
|
|
@@ -2294,7 +2293,7 @@ async function(t,e){const n=await kl(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2294
2293
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2295
2294
|
* See the License for the specific language governing permissions and
|
|
2296
2295
|
* limitations under the License.
|
|
2297
|
-
*/class
|
|
2296
|
+
*/class $l{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}$l.type="NONE";const Kl=$l;
|
|
2298
2297
|
/**
|
|
2299
2298
|
* @license
|
|
2300
2299
|
* Copyright 2019 Google LLC
|
|
@@ -2310,7 +2309,7 @@ async function(t,e){const n=await kl(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2310
2309
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2311
2310
|
* See the License for the specific language governing permissions and
|
|
2312
2311
|
* limitations under the License.
|
|
2313
|
-
*/function
|
|
2312
|
+
*/function Hl(t,e,n){return`firebase:${t}:${e}:${n}`}class Gl{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=Hl(this.userKey,r.apiKey,s),this.fullPersistenceKey=Hl("persistence",r.apiKey,s),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?zl._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new Gl(vl(Kl),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||vl(Kl);const i=Hl(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const r=zl._fromJSON(t,e);n!==s&&(o=r),s=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==s)try{await t._remove(i)}catch(t){}}))),new Gl(s,t,n)):new Gl(s,t,n)}}
|
|
2314
2313
|
/**
|
|
2315
2314
|
* @license
|
|
2316
2315
|
* Copyright 2020 Google LLC
|
|
@@ -2326,7 +2325,7 @@ async function(t,e){const n=await kl(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2326
2325
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2327
2326
|
* See the License for the specific language governing permissions and
|
|
2328
2327
|
* limitations under the License.
|
|
2329
|
-
*/function
|
|
2328
|
+
*/function Wl(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Jl(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Ql(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(td(e))return"Blackberry";if(ed(e))return"Webos";if(Yl(e))return"Safari";if((e.includes("chrome/")||Xl(e))&&!e.includes("edge/"))return"Chrome";if(Zl(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function Ql(t=s()){return/firefox\//i.test(t)}function Yl(t=s()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Xl(t=s()){return/crios\//i.test(t)}function Jl(t=s()){return/iemobile/i.test(t)}function Zl(t=s()){return/android/i.test(t)}function td(t=s()){return/blackberry/i.test(t)}function ed(t=s()){return/webos/i.test(t)}function nd(t=s()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function rd(){return function(){const t=s();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function sd(t=s()){return nd(t)||Zl(t)||ed(t)||td(t)||/windows phone/i.test(t)||Jl(t)}
|
|
2330
2329
|
/**
|
|
2331
2330
|
* @license
|
|
2332
2331
|
* Copyright 2020 Google LLC
|
|
@@ -2343,7 +2342,7 @@ async function(t,e){const n=await kl(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2343
2342
|
* See the License for the specific language governing permissions and
|
|
2344
2343
|
* limitations under the License.
|
|
2345
2344
|
*/
|
|
2346
|
-
function
|
|
2345
|
+
function id(t,e=[]){let n;switch(t){case"Browser":n=Wl(s());break;case"Worker":n=`${Wl(s())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ot}/${r}`}
|
|
2347
2346
|
/**
|
|
2348
2347
|
* @license
|
|
2349
2348
|
* Copyright 2022 Google LLC
|
|
@@ -2359,7 +2358,7 @@ function sd(t,e=[]){let n;switch(t){case"Browser":n=Gl(o());break;case"Worker":n
|
|
|
2359
2358
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2360
2359
|
* See the License for the specific language governing permissions and
|
|
2361
2360
|
* limitations under the License.
|
|
2362
|
-
*/class
|
|
2361
|
+
*/class od{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
|
|
2363
2362
|
/**
|
|
2364
2363
|
* @license
|
|
2365
2364
|
* Copyright 2020 Google LLC
|
|
@@ -2375,7 +2374,7 @@ function sd(t,e=[]){let n;switch(t){case"Browser":n=Gl(o());break;case"Worker":n
|
|
|
2375
2374
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2376
2375
|
* See the License for the specific language governing permissions and
|
|
2377
2376
|
* limitations under the License.
|
|
2378
|
-
*/class
|
|
2377
|
+
*/class ad{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ud(this),this.idTokenSubscription=new ud(this),this.beforeStateQueue=new od(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=al,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=vl(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await Gl.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return pl(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await ql(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?I(t):null;return e&&pl(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&pl(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(vl(t))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new l("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&vl(t)||this._popupRedirectResolver;pl(e,this,"argument-error"),this.redirectPersistenceManager=await Gl.create(this,[vl(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e),i=this._isInitialized?Promise.resolve():this._initializationPromise;return pl(i,this,"internal-error"),i.then((()=>s(this.currentUser))),"function"==typeof e?t.addObserver(e,n,r):t.addObserver(e)}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return pl(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=id(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());return n&&(e["X-Firebase-Client"]=n),e}}function cd(t){return I(t)}class ud{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new v(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return pl(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function hd(t,e,n){const r=cd(t);pl(r._canInitEmulator,r,"emulator-config-failed"),pl(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=ld(e),{host:o,port:a}=function(t){const e=ld(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const t=s[1];return{host:t,port:dd(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:dd(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
|
|
2379
2378
|
/**
|
|
2380
2379
|
* @license
|
|
2381
2380
|
* Copyright 2020 Google LLC
|
|
@@ -2391,7 +2390,7 @@ function sd(t,e=[]){let n;switch(t){case"Browser":n=Gl(o());break;case"Worker":n
|
|
|
2391
2390
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2392
2391
|
* See the License for the specific language governing permissions and
|
|
2393
2392
|
* limitations under the License.
|
|
2394
|
-
*/()}function
|
|
2393
|
+
*/()}function ld(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function dd(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class fd{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return gl("not implemented")}_getIdTokenResponse(t){return gl("not implemented")}_linkToIdToken(t,e){return gl("not implemented")}_getReauthenticationResolver(t){return gl("not implemented")}}
|
|
2395
2394
|
/**
|
|
2396
2395
|
* @license
|
|
2397
2396
|
* Copyright 2020 Google LLC
|
|
@@ -2407,7 +2406,7 @@ function sd(t,e=[]){let n;switch(t){case"Browser":n=Gl(o());break;case"Worker":n
|
|
|
2407
2406
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2408
2407
|
* See the License for the specific language governing permissions and
|
|
2409
2408
|
* limitations under the License.
|
|
2410
|
-
*/async function
|
|
2409
|
+
*/async function pd(t,e){return async function(t,e){return Al(t,"POST","/v1/accounts:sendOobCode",kl(t,e))}(t,e)}
|
|
2411
2410
|
/**
|
|
2412
2411
|
* @license
|
|
2413
2412
|
* Copyright 2020 Google LLC
|
|
@@ -2440,7 +2439,7 @@ function sd(t,e=[]){let n;switch(t){case"Browser":n=Gl(o());break;case"Worker":n
|
|
|
2440
2439
|
* See the License for the specific language governing permissions and
|
|
2441
2440
|
* limitations under the License.
|
|
2442
2441
|
*/
|
|
2443
|
-
class
|
|
2442
|
+
class gd extends fd{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new gd(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new gd(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":
|
|
2444
2443
|
/**
|
|
2445
2444
|
* @license
|
|
2446
2445
|
* Copyright 2020 Google LLC
|
|
@@ -2457,7 +2456,7 @@ class pd extends dd{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2457
2456
|
* See the License for the specific language governing permissions and
|
|
2458
2457
|
* limitations under the License.
|
|
2459
2458
|
*/
|
|
2460
|
-
return async function(t,e){return
|
|
2459
|
+
return async function(t,e){return Dl(t,"POST","/v1/accounts:signInWithPassword",kl(t,e))}(t,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Dl(t,"POST","/v1/accounts:signInWithEmailLink",kl(t,e))}(t,{email:this._email,oobCode:this._password});default:ll(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return async function(t,e){return Al(t,"POST","/v1/accounts:update",e)}(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Dl(t,"POST","/v1/accounts:signInWithEmailLink",kl(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:ll(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
|
|
2461
2460
|
/**
|
|
2462
2461
|
* @license
|
|
2463
2462
|
* Copyright 2020 Google LLC
|
|
@@ -2473,7 +2472,7 @@ return async function(t,e){return Nl(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2473
2472
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2474
2473
|
* See the License for the specific language governing permissions and
|
|
2475
2474
|
* limitations under the License.
|
|
2476
|
-
*/async function
|
|
2475
|
+
*/async function md(t,e){return Dl(t,"POST","/v1/accounts:signInWithIdp",kl(t,e))}
|
|
2477
2476
|
/**
|
|
2478
2477
|
* @license
|
|
2479
2478
|
* Copyright 2020 Google LLC
|
|
@@ -2489,7 +2488,7 @@ return async function(t,e){return Nl(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2489
2488
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2490
2489
|
* See the License for the specific language governing permissions and
|
|
2491
2490
|
* limitations under the License.
|
|
2492
|
-
*/class
|
|
2491
|
+
*/class yd extends fd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new yd(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):ll("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,s=sl(e,["providerId","signInMethod"]);if(!n||!r)return null;const i=new yd(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(t){return md(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,md(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,md(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=g(e)}return t}}
|
|
2493
2492
|
/**
|
|
2494
2493
|
* @license
|
|
2495
2494
|
* Copyright 2020 Google LLC
|
|
@@ -2505,7 +2504,7 @@ return async function(t,e){return Nl(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2505
2504
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2506
2505
|
* See the License for the specific language governing permissions and
|
|
2507
2506
|
* limitations under the License.
|
|
2508
|
-
*/class
|
|
2507
|
+
*/class vd{constructor(t){var e,n,r,s,i,o;const a=m(y(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);pl(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=m(y(t)).link,n=e?m(y(e)).deep_link_id:null,r=m(y(t)).deep_link_id;return(r?m(y(r)).link:null)||r||n||e||t}(t);try{return new vd(e)}catch(t){return null}}}
|
|
2509
2508
|
/**
|
|
2510
2509
|
* @license
|
|
2511
2510
|
* Copyright 2020 Google LLC
|
|
@@ -2521,7 +2520,7 @@ return async function(t,e){return Nl(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2521
2520
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2522
2521
|
* See the License for the specific language governing permissions and
|
|
2523
2522
|
* limitations under the License.
|
|
2524
|
-
*/class
|
|
2523
|
+
*/class wd{constructor(){this.providerId=wd.PROVIDER_ID}static credential(t,e){return gd._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=vd.parseLink(e);return pl(n,"argument-error"),gd._fromEmailAndCode(t,n.code,n.tenantId)}}wd.PROVIDER_ID="password",wd.EMAIL_PASSWORD_SIGN_IN_METHOD="password",wd.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
|
|
2525
2524
|
/**
|
|
2526
2525
|
* @license
|
|
2527
2526
|
* Copyright 2020 Google LLC
|
|
@@ -2538,7 +2537,7 @@ return async function(t,e){return Nl(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2538
2537
|
* See the License for the specific language governing permissions and
|
|
2539
2538
|
* limitations under the License.
|
|
2540
2539
|
*/
|
|
2541
|
-
class
|
|
2540
|
+
class Id{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
|
|
2542
2541
|
/**
|
|
2543
2542
|
* @license
|
|
2544
2543
|
* Copyright 2019 Google LLC
|
|
@@ -2554,7 +2553,7 @@ class wd{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2554
2553
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2555
2554
|
* See the License for the specific language governing permissions and
|
|
2556
2555
|
* limitations under the License.
|
|
2557
|
-
*/class
|
|
2556
|
+
*/class bd extends Id{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
|
|
2558
2557
|
/**
|
|
2559
2558
|
* @license
|
|
2560
2559
|
* Copyright 2020 Google LLC
|
|
@@ -2570,7 +2569,7 @@ class wd{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2570
2569
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2571
2570
|
* See the License for the specific language governing permissions and
|
|
2572
2571
|
* limitations under the License.
|
|
2573
|
-
*/class
|
|
2572
|
+
*/class Td extends bd{constructor(){super("facebook.com")}static credential(t){return yd._fromParams({providerId:Td.PROVIDER_ID,signInMethod:Td.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Td.credentialFromTaggedObject(t)}static credentialFromError(t){return Td.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Td.credential(t.oauthAccessToken)}catch(t){return null}}}Td.FACEBOOK_SIGN_IN_METHOD="facebook.com",Td.PROVIDER_ID="facebook.com";
|
|
2574
2573
|
/**
|
|
2575
2574
|
* @license
|
|
2576
2575
|
* Copyright 2020 Google LLC
|
|
@@ -2587,7 +2586,7 @@ class wd{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2587
2586
|
* See the License for the specific language governing permissions and
|
|
2588
2587
|
* limitations under the License.
|
|
2589
2588
|
*/
|
|
2590
|
-
class Ed extends
|
|
2589
|
+
class Ed extends bd{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return yd._fromParams({providerId:Ed.PROVIDER_ID,signInMethod:Ed.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Ed.credentialFromTaggedObject(t)}static credentialFromError(t){return Ed.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Ed.credential(e,n)}catch(t){return null}}}Ed.GOOGLE_SIGN_IN_METHOD="google.com",Ed.PROVIDER_ID="google.com";
|
|
2591
2590
|
/**
|
|
2592
2591
|
* @license
|
|
2593
2592
|
* Copyright 2020 Google LLC
|
|
@@ -2604,7 +2603,7 @@ class Ed extends Id{constructor(){super("google.com"),this.addScope("profile")}s
|
|
|
2604
2603
|
* See the License for the specific language governing permissions and
|
|
2605
2604
|
* limitations under the License.
|
|
2606
2605
|
*/
|
|
2607
|
-
class _d extends
|
|
2606
|
+
class _d extends bd{constructor(){super("github.com")}static credential(t){return yd._fromParams({providerId:_d.PROVIDER_ID,signInMethod:_d.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return _d.credentialFromTaggedObject(t)}static credentialFromError(t){return _d.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return _d.credential(t.oauthAccessToken)}catch(t){return null}}}_d.GITHUB_SIGN_IN_METHOD="github.com",_d.PROVIDER_ID="github.com";
|
|
2608
2607
|
/**
|
|
2609
2608
|
* @license
|
|
2610
2609
|
* Copyright 2020 Google LLC
|
|
@@ -2621,7 +2620,7 @@ class _d extends Id{constructor(){super("github.com")}static credential(t){retur
|
|
|
2621
2620
|
* See the License for the specific language governing permissions and
|
|
2622
2621
|
* limitations under the License.
|
|
2623
2622
|
*/
|
|
2624
|
-
class
|
|
2623
|
+
class Sd extends bd{constructor(){super("twitter.com")}static credential(t,e){return yd._fromParams({providerId:Sd.PROVIDER_ID,signInMethod:Sd.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Sd.credentialFromTaggedObject(t)}static credentialFromError(t){return Sd.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Sd.credential(e,n)}catch(t){return null}}}Sd.TWITTER_SIGN_IN_METHOD="twitter.com",Sd.PROVIDER_ID="twitter.com";
|
|
2625
2624
|
/**
|
|
2626
2625
|
* @license
|
|
2627
2626
|
* Copyright 2020 Google LLC
|
|
@@ -2638,7 +2637,7 @@ class Td extends Id{constructor(){super("twitter.com")}static credential(t,e){re
|
|
|
2638
2637
|
* See the License for the specific language governing permissions and
|
|
2639
2638
|
* limitations under the License.
|
|
2640
2639
|
*/
|
|
2641
|
-
class
|
|
2640
|
+
class Cd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const s=await zl._fromIdTokenResponse(t,n,r),i=kd(n);return new Cd({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=kd(n);return new Cd({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function kd(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
|
|
2642
2641
|
/**
|
|
2643
2642
|
* @license
|
|
2644
2643
|
* Copyright 2020 Google LLC
|
|
@@ -2654,7 +2653,7 @@ class Sd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2654
2653
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2655
2654
|
* See the License for the specific language governing permissions and
|
|
2656
2655
|
* limitations under the License.
|
|
2657
|
-
*/class
|
|
2656
|
+
*/class Ad extends h{constructor(t,e,n,r){var s;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,Ad.prototype),this.customData={appName:t.name,tenantId:null!==(s=t.tenantId)&&void 0!==s?s:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new Ad(t,e,n,r)}}function Nd(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw Ad._fromErrorAndOperation(t,n,e,r);throw n}))}
|
|
2658
2657
|
/**
|
|
2659
2658
|
* @license
|
|
2660
2659
|
* Copyright 2020 Google LLC
|
|
@@ -2671,7 +2670,7 @@ class Sd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2671
2670
|
* See the License for the specific language governing permissions and
|
|
2672
2671
|
* limitations under the License.
|
|
2673
2672
|
*/
|
|
2674
|
-
async function
|
|
2673
|
+
async function Dd(t,e,n=!1){const r="signIn",s=await Nd(t,r,e),i=await Cd._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}
|
|
2675
2674
|
/**
|
|
2676
2675
|
* @license
|
|
2677
2676
|
* Copyright 2020 Google LLC
|
|
@@ -2688,7 +2687,7 @@ async function Nd(t,e,n=!1){const r="signIn",s=await kd(t,r,e),i=await Sd._fromI
|
|
|
2688
2687
|
* See the License for the specific language governing permissions and
|
|
2689
2688
|
* limitations under the License.
|
|
2690
2689
|
*/
|
|
2691
|
-
async function
|
|
2690
|
+
async function Rd(t,e,n){const r=I(t),s={requestType:"PASSWORD_RESET",email:e};n&&
|
|
2692
2691
|
/**
|
|
2693
2692
|
* @license
|
|
2694
2693
|
* Copyright 2020 Google LLC
|
|
@@ -2705,7 +2704,7 @@ async function Dd(t,e,n){const r=E(t),s={requestType:"PASSWORD_RESET",email:e};n
|
|
|
2705
2704
|
* See the License for the specific language governing permissions and
|
|
2706
2705
|
* limitations under the License.
|
|
2707
2706
|
*/
|
|
2708
|
-
function(t,e,n){var r;
|
|
2707
|
+
function(t,e,n){var r;pl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),pl(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(pl(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(pl(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,s,n),await pd(r,s)}async function Od(t,e,n){await async function(t,e){return Al(t,"POST","/v1/accounts:resetPassword",kl(t,e))}(I(t),{oobCode:e,newPassword:n})}function Ld(t,e,n){return async function(t,e){return Dd(cd(t),e)}(I(t),wd.credential(e,n))}const Pd="__sak";
|
|
2709
2708
|
/**
|
|
2710
2709
|
* @license
|
|
2711
2710
|
* Copyright 2019 Google LLC
|
|
@@ -2721,7 +2720,7 @@ function(t,e,n){var r;fl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2721
2720
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2722
2721
|
* See the License for the specific language governing permissions and
|
|
2723
2722
|
* limitations under the License.
|
|
2724
|
-
*/class
|
|
2723
|
+
*/class Md{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Pd,"1"),this.storage.removeItem(Pd),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
|
|
2725
2724
|
/**
|
|
2726
2725
|
* @license
|
|
2727
2726
|
* Copyright 2020 Google LLC
|
|
@@ -2737,7 +2736,7 @@ function(t,e,n){var r;fl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2737
2736
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2738
2737
|
* See the License for the specific language governing permissions and
|
|
2739
2738
|
* limitations under the License.
|
|
2740
|
-
*/class
|
|
2739
|
+
*/class xd extends Md{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=s();return Yl(t)||nd(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=sd(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(t.newValue!==r)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);rd()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}xd.type="LOCAL";const Ud=xd;
|
|
2741
2740
|
/**
|
|
2742
2741
|
* @license
|
|
2743
2742
|
* Copyright 2020 Google LLC
|
|
@@ -2753,7 +2752,7 @@ function(t,e,n){var r;fl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2753
2752
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2754
2753
|
* See the License for the specific language governing permissions and
|
|
2755
2754
|
* limitations under the License.
|
|
2756
|
-
*/class
|
|
2755
|
+
*/class Fd extends Md{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}Fd.type="SESSION";const Vd=Fd;
|
|
2757
2756
|
/**
|
|
2758
2757
|
* @license
|
|
2759
2758
|
* Copyright 2019 Google LLC
|
|
@@ -2786,7 +2785,7 @@ function(t,e,n){var r;fl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2786
2785
|
* See the License for the specific language governing permissions and
|
|
2787
2786
|
* limitations under the License.
|
|
2788
2787
|
*/
|
|
2789
|
-
class
|
|
2788
|
+
class qd{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new qd(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:s}=e.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map((async t=>t(e.origin,s))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
|
|
2790
2789
|
/**
|
|
2791
2790
|
* @license
|
|
2792
2791
|
* Copyright 2020 Google LLC
|
|
@@ -2803,7 +2802,7 @@ class Vd{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
|
|
|
2803
2802
|
* See the License for the specific language governing permissions and
|
|
2804
2803
|
* limitations under the License.
|
|
2805
2804
|
*/
|
|
2806
|
-
function
|
|
2805
|
+
function jd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
|
|
2807
2806
|
/**
|
|
2808
2807
|
* @license
|
|
2809
2808
|
* Copyright 2019 Google LLC
|
|
@@ -2819,7 +2818,7 @@ function qd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2819
2818
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2820
2819
|
* See the License for the specific language governing permissions and
|
|
2821
2820
|
* limitations under the License.
|
|
2822
|
-
*/
|
|
2821
|
+
*/qd.receivers=[];class Bd{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=jd("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
|
|
2823
2822
|
/**
|
|
2824
2823
|
* @license
|
|
2825
2824
|
* Copyright 2020 Google LLC
|
|
@@ -2835,7 +2834,7 @@ function qd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2835
2834
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2836
2835
|
* See the License for the specific language governing permissions and
|
|
2837
2836
|
* limitations under the License.
|
|
2838
|
-
*/function
|
|
2837
|
+
*/function zd(){return window}
|
|
2839
2838
|
/**
|
|
2840
2839
|
* @license
|
|
2841
2840
|
* Copyright 2020 Google LLC.
|
|
@@ -2852,7 +2851,7 @@ function qd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2852
2851
|
* See the License for the specific language governing permissions and
|
|
2853
2852
|
* limitations under the License.
|
|
2854
2853
|
*/
|
|
2855
|
-
function
|
|
2854
|
+
function $d(){return void 0!==zd().WorkerGlobalScope&&"function"==typeof zd().importScripts}
|
|
2856
2855
|
/**
|
|
2857
2856
|
* @license
|
|
2858
2857
|
* Copyright 2019 Google LLC
|
|
@@ -2869,7 +2868,7 @@ function zd(){return void 0!==Bd().WorkerGlobalScope&&"function"==typeof Bd().im
|
|
|
2869
2868
|
* See the License for the specific language governing permissions and
|
|
2870
2869
|
* limitations under the License.
|
|
2871
2870
|
*/
|
|
2872
|
-
const
|
|
2871
|
+
const Kd="firebaseLocalStorageDb",Hd="firebaseLocalStorage",Gd="fbase_key";class Wd{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Qd(t,e){return t.transaction([Hd],e?"readwrite":"readonly").objectStore(Hd)}function Yd(){const t=indexedDB.open(Kd,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Hd,{keyPath:Gd})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Hd)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Kd);return new Wd(t).toPromise()}(),e(await Yd()))}))}))}async function Xd(t,e,n){const r=Qd(t,!0).put({[Gd]:e,value:n});return new Wd(r).toPromise()}function Jd(t,e){const n=Qd(t,!0).delete(e);return new Wd(n).toPromise()}class Zd{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Yd()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return $d()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=qd._getInstance($d()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new Bd(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await Yd();return await Xd(t,Pd,"1"),await Jd(t,Pd),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Xd(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=Qd(t,!1).get(e),r=await new Wd(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>Jd(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Qd(t,!1).getAll();return new Wd(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:r,value:s}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Zd.type="LOCAL";const tf=Zd;
|
|
2873
2872
|
/**
|
|
2874
2873
|
* @license
|
|
2875
2874
|
* Copyright 2020 Google LLC
|
|
@@ -2885,7 +2884,7 @@ const $d="firebaseLocalStorageDb",Kd="firebaseLocalStorage",Hd="fbase_key";class
|
|
|
2885
2884
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2886
2885
|
* See the License for the specific language governing permissions and
|
|
2887
2886
|
* limitations under the License.
|
|
2888
|
-
*/function
|
|
2887
|
+
*/function ef(t){return new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=dl("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)}))}new Tl(3e4,6e4);
|
|
2889
2888
|
/**
|
|
2890
2889
|
* @license
|
|
2891
2890
|
* Copyright 2019 Google LLC
|
|
@@ -2902,7 +2901,7 @@ const $d="firebaseLocalStorageDb",Kd="firebaseLocalStorage",Hd="fbase_key";class
|
|
|
2902
2901
|
* See the License for the specific language governing permissions and
|
|
2903
2902
|
* limitations under the License.
|
|
2904
2903
|
*/
|
|
2905
|
-
class
|
|
2904
|
+
class nf extends fd{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return md(t,this._buildIdpRequest())}_linkToIdToken(t,e){return md(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return md(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function rf(t){return Dd(t.auth,new nf(t),t.bypassAuthState)}function sf(t){const{auth:e,user:n}=t;return pl(n,e,"internal-error"),
|
|
2906
2905
|
/**
|
|
2907
2906
|
* @license
|
|
2908
2907
|
* Copyright 2019 Google LLC
|
|
@@ -2919,7 +2918,7 @@ class ef extends dd{constructor(t){super("custom","custom"),this.params=t}_getId
|
|
|
2919
2918
|
* See the License for the specific language governing permissions and
|
|
2920
2919
|
* limitations under the License.
|
|
2921
2920
|
*/
|
|
2922
|
-
async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await
|
|
2921
|
+
async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await Ul(t,Nd(r,s,e,t),n);pl(i.idToken,r,"internal-error");const o=xl(i.idToken);pl(o,r,"internal-error");const{sub:a}=o;return pl(t.uid===a,r,"user-mismatch"),Cd._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&ll(r,"user-mismatch"),t}}(n,new nf(t),t.bypassAuthState)}async function of(t){const{auth:e,user:n}=t;return pl(n,e,"internal-error"),async function(t,e,n=!1){const r=await Ul(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Cd._forOperation(t,"link",r)}(n,new nf(t),t.bypassAuthState)}
|
|
2923
2922
|
/**
|
|
2924
2923
|
* @license
|
|
2925
2924
|
* Copyright 2020 Google LLC
|
|
@@ -2935,7 +2934,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await xl
|
|
|
2935
2934
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2936
2935
|
* See the License for the specific language governing permissions and
|
|
2937
2936
|
* limitations under the License.
|
|
2938
|
-
*/class
|
|
2937
|
+
*/class af{constructor(t,e,n,r,s=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return rf;case"linkViaPopup":case"linkViaRedirect":return of;case"reauthViaPopup":case"reauthViaRedirect":return sf;default:ll(this.auth,"internal-error")}}resolve(t){ml(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){ml(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
|
|
2939
2938
|
/**
|
|
2940
2939
|
* @license
|
|
2941
2940
|
* Copyright 2020 Google LLC
|
|
@@ -2951,7 +2950,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await xl
|
|
|
2951
2950
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2952
2951
|
* See the License for the specific language governing permissions and
|
|
2953
2952
|
* limitations under the License.
|
|
2954
|
-
*/const
|
|
2953
|
+
*/const cf=new Tl(2e3,1e4);class uf extends af{constructor(t,e,n,r,s){super(t,e,r,s),this.provider=n,this.authWindow=null,this.pollId=null,uf.currentPopupAction&&uf.currentPopupAction.cancel(),uf.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return pl(t,this.auth,"internal-error"),t}async onExecution(){ml(1===this.filter.length,"Popup operations only handle one event");const t=jd();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(dl(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(dl(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,uf.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(dl(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(t,cf.get())};t()}}uf.currentPopupAction=null;
|
|
2955
2954
|
/**
|
|
2956
2955
|
* @license
|
|
2957
2956
|
* Copyright 2020 Google LLC
|
|
@@ -2968,7 +2967,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await xl
|
|
|
2968
2967
|
* See the License for the specific language governing permissions and
|
|
2969
2968
|
* limitations under the License.
|
|
2970
2969
|
*/
|
|
2971
|
-
const
|
|
2970
|
+
const hf="pendingRedirect",lf=new Map;class df extends af{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=lf.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return Hl(hf,t.config.apiKey,t.name)}(e),r=function(t){return vl(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}lf.set(this.auth._key(),t)}return this.bypassAuthState||lf.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function ff(t,e){lf.set(t._key(),e)}async function pf(t,e,n=!1){const r=cd(t),s=
|
|
2972
2971
|
/**
|
|
2973
2972
|
* @license
|
|
2974
2973
|
* Copyright 2021 Google LLC
|
|
@@ -2985,7 +2984,7 @@ const uf="pendingRedirect",hf=new Map;class lf extends of{constructor(t,e,n=!1){
|
|
|
2985
2984
|
* See the License for the specific language governing permissions and
|
|
2986
2985
|
* limitations under the License.
|
|
2987
2986
|
*/
|
|
2988
|
-
function(t,e){return e?
|
|
2987
|
+
function(t,e){return e?vl(e):(pl(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),i=new df(r,s,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
|
|
2989
2988
|
/**
|
|
2990
2989
|
* @license
|
|
2991
2990
|
* Copyright 2020 Google LLC
|
|
@@ -3001,7 +3000,7 @@ function(t,e){return e?yl(e):(fl(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3001
3000
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3002
3001
|
* See the License for the specific language governing permissions and
|
|
3003
3002
|
* limitations under the License.
|
|
3004
|
-
*/class
|
|
3003
|
+
*/class gf{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return yf(t);default:return!1}}
|
|
3005
3004
|
/**
|
|
3006
3005
|
* @license
|
|
3007
3006
|
* Copyright 2020 Google LLC
|
|
@@ -3017,7 +3016,7 @@ function(t,e){return e?yl(e):(fl(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3017
3016
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3018
3017
|
* See the License for the specific language governing permissions and
|
|
3019
3018
|
* limitations under the License.
|
|
3020
|
-
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!
|
|
3019
|
+
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!yf(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(dl(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(mf(t))}saveEventToCache(t){this.cachedEventUids.add(mf(t)),this.lastProcessedEventTime=Date.now()}}function mf(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function yf({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
|
|
3021
3020
|
/**
|
|
3022
3021
|
* @license
|
|
3023
3022
|
* Copyright 2020 Google LLC
|
|
@@ -3034,7 +3033,7 @@ function(t,e){return e?yl(e):(fl(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3034
3033
|
* See the License for the specific language governing permissions and
|
|
3035
3034
|
* limitations under the License.
|
|
3036
3035
|
*/
|
|
3037
|
-
const
|
|
3036
|
+
const vf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,wf=/^https?/;async function If(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Al(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(bf(t))return}catch(t){}ll(t,"unauthorized-domain")}function bf(t){const e=wl(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const s=new URL(t);return""===s.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!wf.test(n))return!1;if(vf.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
|
|
3038
3037
|
/**
|
|
3039
3038
|
* @license
|
|
3040
3039
|
* Copyright 2020 Google LLC.
|
|
@@ -3050,7 +3049,7 @@ const yf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,vf=/^https?/;async function wf(t
|
|
|
3050
3049
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3051
3050
|
* See the License for the specific language governing permissions and
|
|
3052
3051
|
* limitations under the License.
|
|
3053
|
-
*/const
|
|
3052
|
+
*/const Tf=new Tl(3e4,6e4);function Ef(){const t=zd().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function _f(t){return new Promise(((e,n)=>{var r,s,i;function o(){Ef(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Ef(),n(dl(t,"network-request-failed"))},timeout:Tf.get()})}if(null===(s=null===(r=zd().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=zd().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return zd()[e]=()=>{gapi.load?o():n(dl(t,"network-request-failed"))},ef(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Sf=null,t}))}let Sf=null;
|
|
3054
3053
|
/**
|
|
3055
3054
|
* @license
|
|
3056
3055
|
* Copyright 2020 Google LLC.
|
|
@@ -3067,7 +3066,7 @@ const yf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,vf=/^https?/;async function wf(t
|
|
|
3067
3066
|
* See the License for the specific language governing permissions and
|
|
3068
3067
|
* limitations under the License.
|
|
3069
3068
|
*/
|
|
3070
|
-
const
|
|
3069
|
+
const Cf=new Tl(5e3,15e3),kf={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Af=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Nf(t){const e=t.config;pl(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?El(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,r={apiKey:e.apiKey,appName:t.name,v:ot},s=Af.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${g(r).slice(1)}`}async function Df(t){const e=await function(t){return Sf=Sf||_f(t),Sf}(t),n=zd().gapi;return pl(n,t,"internal-error"),e.open({where:document.body,url:Nf(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:kf,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=dl(t,"network-request-failed"),i=zd().setTimeout((()=>{r(s)}),Cf.get());function o(){zd().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
|
|
3071
3070
|
/**
|
|
3072
3071
|
* @license
|
|
3073
3072
|
* Copyright 2020 Google LLC.
|
|
@@ -3083,7 +3082,7 @@ const Sf=new bl(5e3,15e3),Af={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3083
3082
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3084
3083
|
* See the License for the specific language governing permissions and
|
|
3085
3084
|
* limitations under the License.
|
|
3086
|
-
*/const
|
|
3085
|
+
*/const Rf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Of{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Lf(t,e,n,r=500,i=600){const o=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const u=Object.assign(Object.assign({},Rf),{width:r.toString(),height:i.toString(),top:o,left:a}),h=s().toLowerCase();n&&(c=Xl(h)?"_blank":n),Ql(h)&&(e=e||"http://localhost",u.scrollbars="yes");const l=Object.entries(u).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=s()){var e;return nd(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(h)&&"_self"!==c)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
|
|
3087
3086
|
/**
|
|
3088
3087
|
* @license
|
|
3089
3088
|
* Copyright 2021 Google LLC
|
|
@@ -3099,7 +3098,7 @@ const Sf=new bl(5e3,15e3),Af={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3099
3098
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3100
3099
|
* See the License for the specific language governing permissions and
|
|
3101
3100
|
* limitations under the License.
|
|
3102
|
-
*/(e||"",c),new
|
|
3101
|
+
*/(e||"",c),new Of(null);const d=window.open(e||"",c,l);pl(d,t,"popup-blocked");try{d.focus()}catch(t){}return new Of(d)}const Pf="__/auth/handler",Mf="emulator/auth/handler";function xf(t,e,n,r,s,i){pl(t.config.authDomain,t,"auth-domain-config-required"),pl(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:ot,eventId:s};if(e instanceof Id){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(i||{}))o[t]=e}if(e instanceof bd){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Pf}`;return El(t,Mf)}
|
|
3103
3102
|
/**
|
|
3104
3103
|
* @license
|
|
3105
3104
|
* Copyright 2020 Google LLC
|
|
@@ -3115,7 +3114,7 @@ const Sf=new bl(5e3,15e3),Af={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3115
3114
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3116
3115
|
* See the License for the specific language governing permissions and
|
|
3117
3116
|
* limitations under the License.
|
|
3118
|
-
*/(t)}?${
|
|
3117
|
+
*/(t)}?${g(a).slice(1)}`}const Uf="webStorageSupport";const Ff=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Vd,this._completeRedirectFn=pf,this._overrideRedirectResult=ff}async _openPopup(t,e,n,r){var s;ml(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return Lf(t,xf(t,e,n,wl(),r),jd())}async _openRedirect(t,e,n,r){var s;return await this._originValidation(t),s=xf(t,e,n,wl(),r),zd().location.href=s,new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(ml(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await Df(t),n=new gf(t);return e.register("authEvent",(e=>{pl(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(Uf,{type:Uf},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[Uf];void 0!==s&&e(!!s),ll(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=If(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return sd()||Yl()||nd()}};var Vf="@firebase/auth",qf="0.21.0";
|
|
3119
3118
|
/**
|
|
3120
3119
|
* @license
|
|
3121
3120
|
* Copyright 2020 Google LLC
|
|
@@ -3132,7 +3131,7 @@ const Sf=new bl(5e3,15e3),Af={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3132
3131
|
* See the License for the specific language governing permissions and
|
|
3133
3132
|
* limitations under the License.
|
|
3134
3133
|
*/
|
|
3135
|
-
class
|
|
3134
|
+
class jf{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){pl(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
|
|
3136
3135
|
/**
|
|
3137
3136
|
* @license
|
|
3138
3137
|
* Copyright 2020 Google LLC
|
|
@@ -3165,5 +3164,5 @@ class qf{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3165
3164
|
* See the License for the specific language governing permissions and
|
|
3166
3165
|
* limitations under the License.
|
|
3167
3166
|
*/
|
|
3168
|
-
const jf=h("authIdTokenMaxAge")||300;let Bf=null;function zf(t=ht()){const e=it(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=it(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(g(n.getOptions(),null!=e?e:{}))return t;hl(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Uf,persistence:[Zd,xd,Fd]}),r=h("authTokenSyncURL");if(r){const t=(s=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>jf)return;const r=null==e?void 0:e.token;Bf!==r&&(Bf=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){E(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){E(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var s;const i=u("auth");return i&&ud(n,`http://${i}`),n}var $f;$f="Browser",st(new _("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:s,authDomain:i}=n.options;return((t,n)=>{fl(s&&!s.includes(":"),"invalid-api-key",{appName:t.name}),fl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const r={apiKey:s,authDomain:i,clientPlatform:$f,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:sd($f)},o=new od(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(yl);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),st(new _("auth-internal",(t=>(t=>new qf(t))(ad(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),lt(Ff,Vf,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}($f)),lt(Ff,Vf,"esm2017");class Kf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Hf extends Error{constructor(){super("request timeout"),this.name="RequestTimeoutError"}}class Gf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Wf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Qf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}class Jf extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}var Xf=Object.freeze({__proto__:null,NoFramesFoundError:Kf,RequestTimeoutError:Hf,UserNotLoggedInError:Gf,NoColorwaySizeAssetsFoundError:Wf,NoStylesFoundError:Qf,RecommendedAvailableSizesError:Jf});class Yf{constructor(t,e){this.firestore=t,this.auth=zf(e),this.auth.setPersistence(xd)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{this.auth.onAuthStateChanged((e=>{if(this.setUser(e),e)return t();throw new Gf}))}))}setUser(t){this.user=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Gf;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Gf;const e=await Zh(function(t,e,...n){if(t=E(t),1===arguments.length&&(e=Ys.R()),Zu("doc","path",e),t instanceof oh){const r=si.fromString(e,...n);return th(r),new ch(t,null,new ai(r))}{if(!(t instanceof ch||t instanceof hh))throw new js(qs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(si.fromString(e,...n));return th(r),new ch(t.firestore,t instanceof hh?t.converter:null,new ai(r))}}(this.firestore,"users",this.id));return e.data()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Od(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await Dd(this.auth,t)}async confirmPasswordReset(t,e){await Rd(this.auth,t,e)}}class Zf{constructor(){this.promisefyOnSnapshot=t=>{let e;const n=new Promise((n=>e=function(t,...e){var n,r,s;t=E(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||yh(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(yh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let c,u,h;if(t instanceof ch)u=rh(t.firestore,vh),h=ko(t._key.path),c={next:n=>{e[o]&&e[o](nl(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=rh(t,uh);u=rh(n.firestore,vh),h=n._query;const r=new tl(u);c={next:t=>{e[o]&&e[o](new Xh(u,r,n,t))},error:e[o+1],complete:e[o+2]},Uh(t._query)}return function(t,e,n,r){const s=new dh(r),i=new Ru(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>Au(await gh(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>Cu(await gh(t),i)))}}(Ih(u),h,a,c)}(t,(t=>n(t)))));return{promise:n,unsubscribe:()=>e()}},this.firestore=wh(Zf.App),this.user=new Yf(this.firestore,Zf.App)}onInit(){return this.user.onInit()}query(t,e){const n=qh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(n)}getDocs(t,e){return el(qh(lh(this.firestore,t),...e))}}Zf.App=ut({apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"});const tp=t=>{if(t.code===al)throw new Error("account has been disabled");throw new Error(t.message)};class ep{static async Fetch({user:t,endpointPath:e,method:n,body:r}){const s="https://tfr.dev.thefittingroom.xyz/v1"+e,i={method:n,headers:{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`},credentials:"include"};r&&(i.body=JSON.stringify(r));const o=await fetch(s,i);if(o.ok)return o;if(500===o.status)throw new Error(o.statusText);const a=await o.json();return Promise.reject(a)}static Get(t,e){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null})}static Post(t,e,n=null){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n})}static Put(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n})}static Patch(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n})}static Delete(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n})}}class np{constructor(t,e){this.brandId=t,this.firebase=e}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async tryOn(t){if(!this.isLoggedIn)throw new Gf;try{return await this.getColorwaySizeAssetFrames(t)}catch(e){if(e instanceof Kf)throw new Kf;return this.requestThenGetColorwaySizeAssetFrames(t)}}async awaitAvatarCreated(){if(!this.isLoggedIn)throw new Gf;const{promise:t,unsubscribe:e}=this.firebase.query("users",Bh(new _h("__name__"),"==",this.user.id)),n=setTimeout((()=>{throw e(),new Hf}),np.AVATAR_TIMEOUT),r=await t;clearTimeout(n);return"CREATED"===r.docs[0].data().avatar_status}async getRecommendedSize(t){if(!this.isLoggedIn)throw new Gf;const e=await ep.Get(this.user,`/styles/${t}/recommendation`);return await e.json()}async getStyles(t,e){const n=[Bh("brand_id","==",this.brandId)];(null==t?void 0:t.length)>0&&n.push(Bh("id","in",t)),(null==e?void 0:e.length)>0&&n.push(Bh("brand_style_id","in",e));try{const t=await this.firebase.getDocs("styles",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return tp(t)}}awaitColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Gf;return this.getColorwaySizeAssetFrames(t)}async requestThenGetColorwaySizeAssetFrames(t){var e,n;const[r,s]=await(i=this.getColorwaySizeAssetFromSku(t),i.then((t=>[null,t])).catch((t=>[t])));var i;if(r)throw r;try{return await this.requestColorwaySizeAssetFrames(s.id),this.awaitColorwaySizeAssetFrames(t)}catch(r){if(!r.recommended_size_id)throw new Error(r);const t=r,i=(await this.getStyles([s.style_id],null)).get(s.style_id);if(!(null==i?void 0:i.sizes))throw new Qf;const o=(null===(e=i.sizes[t.recommended_size_id])||void 0===e?void 0:e.label)||(null===(n=i.sizes[t.recommended_size_id])||void 0===n?void 0:n.size),a=t.available_size_ids.filter((t=>{var e;return(null===(e=i.sizes[t])||void 0===e?void 0:e.size)!==o})).map((t=>{var e,n;return(null===(e=i.sizes[t])||void 0===e?void 0:e.label)||(null===(n=i.sizes[t])||void 0===n?void 0:n.size)}));throw new Jf(o,a)}}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Wf;return Array.from(e.values())[0]}async getColorwaySizeAssets(t,e){const n=[Bh("brand_id","==",this.brandId)];t&&n.push(Bh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(Bh("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return tp(t)}}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Gf;await ep.Post(this.user,`/colorway-size-assets/${t}/frames`)}async getColorwaySizeAssetFrames(t){var e,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(e=null==s?void 0:s.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Kf;if(!await(t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))})(i[0]))throw new Kf;return i}}np.AVATAR_TIMEOUT=process.env.AVATAR_TIMEOUT?Number(process.env.AVATAR_TIMEOUT):1e4;const rp=t=>new np(t,new Zf);var sp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(sp||(sp={}));var ip=Object.freeze({__proto__:null,get AvatarState(){return sp}});export{Xf as Errors,rp as initShop,t as requests,e as responses,ip as types};
|
|
3167
|
+
const Bf=c("authIdTokenMaxAge")||300;let zf=null;function $f(t=ct()){const e=rt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=rt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(f(n.getOptions(),null!=e?e:{}))return t;ll(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Ff,persistence:[tf,Ud,Vd]}),r=c("authTokenSyncURL");if(r){const t=(s=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Bf)return;const r=null==e?void 0:e.token;zf!==r&&(zf=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){I(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var s;const i=a("auth");return i&&hd(n,`http://${i}`),n}var Kf;Kf="Browser",nt(new b("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:s,authDomain:i}=n.options;return((t,n)=>{pl(s&&!s.includes(":"),"invalid-api-key",{appName:t.name}),pl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const r={apiKey:s,authDomain:i,clientPlatform:Kf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:id(Kf)},o=new ad(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(vl);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),nt(new b("auth-internal",(t=>(t=>new jf(t))(cd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),ut(Vf,qf,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Kf)),ut(Vf,qf,"esm2017");class Hf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Gf extends Error{constructor(){super("request timeout"),this.name="RequestTimeoutError"}}class Wf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Qf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Yf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}class Xf extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}var Jf=Object.freeze({__proto__:null,NoFramesFoundError:Hf,RequestTimeoutError:Gf,UserNotLoggedInError:Wf,NoColorwaySizeAssetsFoundError:Qf,NoStylesFoundError:Yf,RecommendedAvailableSizesError:Xf});class Zf{constructor(t,e){this.firestore=t,this.auth=$f(e),this.auth.setPersistence(Ud)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Wf;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Wf;const e=await Xh(function(t,e,...n){if(t=I(t),1===arguments.length&&(e=Ys.R()),Xu("doc","path",e),t instanceof sh){const r=ni.fromString(e,...n);return Ju(r),new oh(t,null,new ii(r))}{if(!(t instanceof oh||t instanceof ch))throw new Vs(Fs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(ni.fromString(e,...n));return Ju(r),new oh(t.firestore,t instanceof ch?t.converter:null,new ii(r))}}(this.firestore,"users",this.id));return e.data()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Ld(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await Rd(this.auth,t)}async confirmPasswordReset(t,e){await Od(this.auth,t,e)}}class tp{constructor(){this.promisefyOnSnapshot=t=>{let e;const n=new Promise((n=>e=function(t,...e){var n,r,s;t=I(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||gh(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(gh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let c,u,h;if(t instanceof oh)u=eh(t.firestore,mh),h=Co(t._key.path),c={next:n=>{e[o]&&e[o](tl(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=eh(t,ah);u=eh(n.firestore,mh),h=n._query;const r=new Jh(u);c={next:t=>{e[o]&&e[o](new Qh(u,r,n,t))},error:e[o+1],complete:e[o+2]},Mh(t._query)}return function(t,e,n,r){const s=new hh(r),i=new Nu(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>_u(await fh(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>Su(await fh(t),i)))}}(vh(u),h,a,c)}(t,(t=>n(t)))));return{promise:n,unsubscribe:()=>e()}};const t=at(el.getInstance().firebase);this.firestore=yh(t),this.user=new Zf(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e){const n=Fh(uh(this.firestore,t),e);return this.promisefyOnSnapshot(n)}getDocs(t,e){return Zh(Fh(uh(this.firestore,t),...e))}}const ep=t=>{if(t.code===cl)throw new Error("account has been disabled");throw new Error(t.message)};class np{static endpoint(){return el.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class rp{constructor(t,e){this.brandId=t,this.firebase=e;const n=el.getInstance().config;rp.avatarTimeout=n.avatarTimeout?Number(n.avatarTimeout):12e4,rp.vtoTimeout=n.vtoTimeout?Number(n.vtoTimeout):12e4}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}onInit(){return this.firebase.onInit()}async tryOn(t){if(!this.isLoggedIn)throw new Wf;try{return await this.getColorwaySizeAssetFrames(t)}catch(e){if(!(e instanceof Hf))throw e;return this.requestThenGetColorwaySizeAssetFrames(t)}}async awaitAvatarCreated(){if(!this.isLoggedIn)throw new Wf;const{promise:t,unsubscribe:e}=this.firebase.query("users",qh(new bh("__name__"),"==",this.user.id)),n=setTimeout((()=>{throw e(),new Gf}),rp.avatarTimeout),r=await t;clearTimeout(n);return"CREATED"===r.docs[0].data().avatar_status}async getRecommendedSizes(t){if(!this.isLoggedIn)throw new Wf;const e=await np.Get(this.user,`/styles/${t}/recommendation`);return await e.json()}async getStyles(t,e){const n=[qh("brand_id","==",this.brandId)];(null==t?void 0:t.length)>0&&n.push(qh("id","in",t)),(null==e?void 0:e.length)>0&&n.push(qh("brand_style_id","in",e));try{const t=await this.firebase.getDocs("styles",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return ep(t)}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await np.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}awaitColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Wf;return this.getColorwaySizeAssetFrames(t)}async requestThenGetColorwaySizeAssetFrames(t){var e,n;const[r,s]=await(i=this.getColorwaySizeAssetFromSku(t),i.then((t=>[null,t])).catch((t=>[t])));var i;if(r)throw r;try{return await this.requestColorwaySizeAssetFrames(s.id),this.awaitColorwaySizeAssetFrames(t)}catch(r){if(!r.recommended_size_id)throw new Error(r);const t=r,i=(await this.getStyles([s.style_id],null)).get(s.style_id);if(!(null==i?void 0:i.sizes))throw new Yf;const o=(null===(e=i.sizes[t.recommended_size_id])||void 0===e?void 0:e.label)||(null===(n=i.sizes[t.recommended_size_id])||void 0===n?void 0:n.size),a=t.available_size_ids.filter((t=>{var e;return(null===(e=i.sizes[t])||void 0===e?void 0:e.size)!==o})).map((t=>{var e,n;return(null===(e=i.sizes[t])||void 0===e?void 0:e.label)||(null===(n=i.sizes[t])||void 0===n?void 0:n.size)}));throw new Xf(o,a)}}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Qf;return Array.from(e.values())[0]}async getColorwaySizeAssets(t,e){const n=[qh("brand_id","==",this.brandId)];t&&n.push(qh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(qh("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return ep(t)}}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Wf;await np.Post(this.user,`/colorway-size-assets/${t}/frames`)}async getColorwaySizeAssetFrames(t){var e,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(e=null==s?void 0:s.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Hf;if(!await(t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))})(i[0]))throw new Hf;return i}}const sp=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),el.getInstance().setEnv(e),new rp(t,new tp));var ip,op=Object.freeze({__proto__:null}),ap=Object.freeze({__proto__:null});!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(ip||(ip={}));var cp=Object.freeze({__proto__:null,get AvatarState(){return ip}});const up=rp.vtoTimeout;export{Jf as Errors,up as VTO_TIMEOUT_MS,sp as initShop,op as requests,ap as responses,cp as types};
|
|
3169
3168
|
//# sourceMappingURL=index.min.js.map
|