@thefittingroom/sdk 1.5.0 → 1.5.2

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.5.0 (2024-09-01T16:52:25.366Z)
2
+ * thefittingroom v1.5.2 (2024-09-03T15:43:56.403Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
@@ -198,7 +198,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
198
198
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
199
  * See the License for the specific language governing permissions and
200
200
  * limitations under the License.
201
- */var k;!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"}(k||(k={}));const R={debug:k.DEBUG,verbose:k.VERBOSE,info:k.INFO,warn:k.WARN,error:k.ERROR,silent:k.SILENT},N=k.INFO,D={[k.DEBUG]:"log",[k.VERBOSE]:"log",[k.INFO]:"info",[k.WARN]:"warn",[k.ERROR]:"error"},O=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=D[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};class L{constructor(t){this.name=t,this._logLevel=N,this._logHandler=O,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in k))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?R[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,k.DEBUG,...t),this._logHandler(this,k.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,k.VERBOSE,...t),this._logHandler(this,k.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,k.INFO,...t),this._logHandler(this,k.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,k.WARN,...t),this._logHandler(this,k.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,k.ERROR,...t),this._logHandler(this,k.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,x;const U=new WeakMap,F=new WeakMap,V=new WeakMap,B=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return F.get(t);if("objectStoreNames"===e)return t.objectStoreNames||V.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function $(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(x||(x=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(W(this),e),K(U.get(this))}:function(...e){return K(t.apply(W(this),e))}:function(e,...n){const r=t.call(W(this),e,...n);return V.set(r,e.sort?e.sort():[e]),K(r)}}function q(t){return"function"==typeof t?$(t):(t instanceof IDBTransaction&&function(t){if(F.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)}));F.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function K(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(K(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&U.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(B.has(t))return B.get(t);const e=q(t);return e!==t&&(B.set(t,e),H.set(e,t)),e}const W=t=>H.get(t);const G=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],Q=new Map;function Y(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Q.get(e))return Q.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=z.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!G.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 Q.set(e,i),i}j=(t=>({...t,get:(e,n,r)=>Y(e,n)||t.get(e,n,r),has:(e,n)=>!!Y(e,n)||t.has(e,n)}))(j);
201
+ */var k;!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"}(k||(k={}));const N={debug:k.DEBUG,verbose:k.VERBOSE,info:k.INFO,warn:k.WARN,error:k.ERROR,silent:k.SILENT},R=k.INFO,O={[k.DEBUG]:"log",[k.VERBOSE]:"log",[k.INFO]:"info",[k.WARN]:"warn",[k.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=O[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};class L{constructor(t){this.name=t,this._logLevel=R,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in k))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[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,k.DEBUG,...t),this._logHandler(this,k.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,k.VERBOSE,...t),this._logHandler(this,k.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,k.INFO,...t),this._logHandler(this,k.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,k.WARN,...t),this._logHandler(this,k.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,k.ERROR,...t),this._logHandler(this,k.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,x;const U=new WeakMap,F=new WeakMap,V=new WeakMap,B=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return F.get(t);if("objectStoreNames"===e)return t.objectStoreNames||V.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function $(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(x||(x=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(W(this),e),K(U.get(this))}:function(...e){return K(t.apply(W(this),e))}:function(e,...n){const r=t.call(W(this),e,...n);return V.set(r,e.sort?e.sort():[e]),K(r)}}function q(t){return"function"==typeof t?$(t):(t instanceof IDBTransaction&&function(t){if(F.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)}));F.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function K(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(K(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&U.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(B.has(t))return B.get(t);const e=q(t);return e!==t&&(B.set(t,e),H.set(e,t)),e}const W=t=>H.get(t);const G=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],Q=new Map;function Y(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Q.get(e))return Q.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=z.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!G.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 Q.set(e,i),i}j=(t=>({...t,get:(e,n,r)=>Y(e,n)||t.get(e,n,r),has:(e,n)=>!!Y(e,n)||t.has(e,n)}))(j);
202
202
  /**
203
203
  * @license
204
204
  * Copyright 2019 Google LLC
@@ -215,7 +215,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
215
215
  * See the License for the specific language governing permissions and
216
216
  * limitations under the License.
217
217
  */
218
- class J{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 X="@firebase/app",Z="0.9.13",tt=new L("@firebase/app"),et="@firebase/app-compat",nt="@firebase/analytics-compat",rt="@firebase/analytics",st="@firebase/app-check-compat",it="@firebase/app-check",ot="@firebase/auth",at="@firebase/auth-compat",ct="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",lt="@firebase/functions-compat",dt="@firebase/installations",ft="@firebase/installations-compat",pt="@firebase/messaging",gt="@firebase/messaging-compat",mt="@firebase/performance",yt="@firebase/performance-compat",vt="@firebase/remote-config",wt="@firebase/remote-config-compat",_t="@firebase/storage",Tt="@firebase/storage-compat",Et="@firebase/firestore",St="@firebase/firestore-compat",It="firebase",bt="[DEFAULT]",At={[X]:"fire-core",[et]:"fire-core-compat",[rt]:"fire-analytics",[nt]:"fire-analytics-compat",[it]:"fire-app-check",[st]:"fire-app-check-compat",[ot]:"fire-auth",[at]:"fire-auth-compat",[ct]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[lt]:"fire-fn-compat",[dt]:"fire-iid",[ft]:"fire-iid-compat",[pt]:"fire-fcm",[gt]:"fire-fcm-compat",[mt]:"fire-perf",[yt]:"fire-perf-compat",[vt]:"fire-rc",[wt]:"fire-rc-compat",[_t]:"fire-gcs",[Tt]:"fire-gcs-compat",[Et]:"fire-fst",[St]:"fire-fst-compat","fire-js":"fire-js",[It]:"fire-js-all"},Ct=new Map,kt=new Map;function Rt(t,e){try{t.container.addComponent(e)}catch(n){tt.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Nt(t){const e=t.name;if(kt.has(e))return tt.debug(`There were multiple attempts to register component ${e}.`),!1;kt.set(e,t);for(const e of Ct.values())Rt(e,t);return!0}function Dt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
218
+ class J{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 X="@firebase/app",Z="0.10.9",tt=new L("@firebase/app"),et="@firebase/app-compat",nt="@firebase/analytics-compat",rt="@firebase/analytics",st="@firebase/app-check-compat",it="@firebase/app-check",ot="@firebase/auth",at="@firebase/auth-compat",ct="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",lt="@firebase/functions-compat",dt="@firebase/installations",ft="@firebase/installations-compat",pt="@firebase/messaging",gt="@firebase/messaging-compat",mt="@firebase/performance",yt="@firebase/performance-compat",vt="@firebase/remote-config",wt="@firebase/remote-config-compat",_t="@firebase/storage",Tt="@firebase/storage-compat",Et="@firebase/firestore",St="@firebase/vertexai-preview",It="@firebase/firestore-compat",bt="firebase",At="[DEFAULT]",Ct={[X]:"fire-core",[et]:"fire-core-compat",[rt]:"fire-analytics",[nt]:"fire-analytics-compat",[it]:"fire-app-check",[st]:"fire-app-check-compat",[ot]:"fire-auth",[at]:"fire-auth-compat",[ct]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[lt]:"fire-fn-compat",[dt]:"fire-iid",[ft]:"fire-iid-compat",[pt]:"fire-fcm",[gt]:"fire-fcm-compat",[mt]:"fire-perf",[yt]:"fire-perf-compat",[vt]:"fire-rc",[wt]:"fire-rc-compat",[_t]:"fire-gcs",[Tt]:"fire-gcs-compat",[Et]:"fire-fst",[It]:"fire-fst-compat",[St]:"fire-vertex","fire-js":"fire-js",[bt]:"fire-js-all"},kt=new Map,Nt=new Map,Rt=new Map;function Ot(t,e){try{t.container.addComponent(e)}catch(n){tt.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Dt(t){const e=t.name;if(Rt.has(e))return tt.debug(`There were multiple attempts to register component ${e}.`),!1;Rt.set(e,t);for(const e of kt.values())Ot(e,t);for(const e of Nt.values())Ot(e,t);return!0}function Lt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Pt(t){return void 0!==t.settings}
219
219
  /**
220
220
  * @license
221
221
  * Copyright 2019 Google LLC
@@ -231,7 +231,7 @@ class J{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
231
231
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
232
232
  * See the License for the specific language governing permissions and
233
233
  * limitations under the License.
234
- */const Ot=new p("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","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}."});
234
+ */const Mt=new p("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","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","server-app-deleted":"Firebase Server App has been 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}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});
235
235
  /**
236
236
  * @license
237
237
  * Copyright 2019 Google LLC
@@ -248,7 +248,7 @@ class J{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
248
248
  * See the License for the specific language governing permissions and
249
249
  * limitations under the License.
250
250
  */
251
- class Lt{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 I("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 Ot.create("app-deleted",{appName:this._name})}}
251
+ class xt{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 I("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 Mt.create("app-deleted",{appName:this._name})}}
252
252
  /**
253
253
  * @license
254
254
  * Copyright 2019 Google LLC
@@ -264,7 +264,7 @@ class Lt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
264
264
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
265
265
  * See the License for the specific language governing permissions and
266
266
  * limitations under the License.
267
- */const Pt="9.23.0";function Mt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:bt,automaticDataCollectionEnabled:!1},e),s=r.name;if("string"!=typeof s||!s)throw Ot.create("bad-app-name",{appName:String(s)});if(n||(n=u()),!n)throw Ot.create("no-options");const i=Ct.get(s);if(i){if(m(n,i.options)&&m(r,i.config))return i;throw Ot.create("duplicate-app",{appName:s})}const o=new C(s);for(const t of kt.values())o.addComponent(t);const a=new Lt(n,r,o);return Ct.set(s,a),a}function xt(t=bt){const e=Ct.get(t);if(!e&&t===bt&&u())return Mt();if(!e)throw Ot.create("no-app",{appName:t});return e}function Ut(t,e,n){var r;let s=null!==(r=At[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 tt.warn(t.join(" "))}Nt(new I(`${s}-version`,(()=>({library:s,version:e})),"VERSION"))}
267
+ */const Ut="10.13.0";function Ft(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:At,automaticDataCollectionEnabled:!1},e),s=r.name;if("string"!=typeof s||!s)throw Mt.create("bad-app-name",{appName:String(s)});if(n||(n=u()),!n)throw Mt.create("no-options");const i=kt.get(s);if(i){if(m(n,i.options)&&m(r,i.config))return i;throw Mt.create("duplicate-app",{appName:s})}const o=new C(s);for(const t of Rt.values())o.addComponent(t);const a=new xt(n,r,o);return kt.set(s,a),a}function Vt(t=At){const e=kt.get(t);if(!e&&t===At&&u())return Ft();if(!e)throw Mt.create("no-app",{appName:t});return e}function Bt(t,e,n){var r;let s=null!==(r=Ct[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 tt.warn(t.join(" "))}Dt(new I(`${s}-version`,(()=>({library:s,version:e})),"VERSION"))}
268
268
  /**
269
269
  * @license
270
270
  * Copyright 2021 Google LLC
@@ -280,7 +280,7 @@ class Lt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
280
280
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
281
281
  * See the License for the specific language governing permissions and
282
282
  * limitations under the License.
283
- */const Ft="firebase-heartbeat-database",Vt=1,Bt="firebase-heartbeat-store";let Ht=null;function jt(){return Ht||(Ht=function(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=K(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(K(o.result),t.oldVersion,t.newVersion,K(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{i&&t.addEventListener("close",(()=>i())),s&&t.addEventListener("versionchange",(t=>s(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ft,Vt,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(Bt)}}).catch((t=>{throw Ot.create("idb-open",{originalErrorMessage:t.message})}))),Ht}async function $t(t,e){try{const n=(await jt()).transaction(Bt,"readwrite"),r=n.objectStore(Bt);await r.put(e,qt(t)),await n.done}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Ot.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}function qt(t){return`${t.name}!${t.options.appId}`}
283
+ */const Ht="firebase-heartbeat-database",jt=1,$t="firebase-heartbeat-store";let qt=null;function Kt(){return qt||(qt=function(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=K(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(K(o.result),t.oldVersion,t.newVersion,K(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{i&&t.addEventListener("close",(()=>i())),s&&t.addEventListener("versionchange",(t=>s(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ht,jt,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore($t)}catch(t){console.warn(t)}}}).catch((t=>{throw Mt.create("idb-open",{originalErrorMessage:t.message})}))),qt}async function Wt(t,e){try{const n=(await Kt()).transaction($t,"readwrite"),r=n.objectStore($t);await r.put(e,Gt(t)),await n.done}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Mt.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}function Gt(t){return`${t.name}!${t.options.appId}`}
284
284
  /**
285
285
  * @license
286
286
  * Copyright 2021 Google LLC
@@ -296,7 +296,7 @@ class Lt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
296
296
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
297
297
  * See the License for the specific language governing permissions and
298
298
  * limitations under the License.
299
- */class Kt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Gt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=Wt();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=Wt(),{heartbeatsToSend:e,unsentEntries:n}=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),zt(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),zt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=i(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}}function Wt(){return(new Date).toISOString().substring(0,10)}class Gt{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){const t=await async function(t){try{const e=await jt();return await e.transaction(Bt).objectStore(Bt).get(qt(t))}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Ot.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}(this.app);return t||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return $t(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 $t(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function zt(t){return i(JSON.stringify({version:2,heartbeats:t})).length}
299
+ */class zt{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(){var t,e,n;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Qt();if(console.log("heartbeats",null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats),null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some((t=>t.date===s)))return;return this._heartbeatsCache.heartbeats.push({date:s,agent:r}),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)}catch(t){tt.warn(t)}}async getHeartbeatsHeader(){var t;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const e=Qt(),{heartbeatsToSend:n,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),Jt(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Jt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=i(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return tt.warn(t),""}}}function Qt(){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){const t=await async function(t){try{const e=(await Kt()).transaction($t),n=await e.objectStore($t).get(Gt(t));return await e.done,n}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Mt.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}(this.app);return(null==t?void 0:t.heartbeats)?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(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 Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Jt(t){return i(JSON.stringify({version:2,heartbeats:t})).length}
300
300
  /**
301
301
  * @license
302
302
  * Copyright 2019 Google LLC
@@ -312,7 +312,7 @@ class Lt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
312
312
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313
313
  * See the License for the specific language governing permissions and
314
314
  * limitations under the License.
315
- */var Qt;Qt="",Nt(new I("platform-logger",(t=>new J(t)),"PRIVATE")),Nt(new I("heartbeat",(t=>new Kt(t)),"PRIVATE")),Ut(X,Z,Qt),Ut(X,Z,"esm2017"),Ut("fire-js","");
315
+ */var Xt;Xt="",Dt(new I("platform-logger",(t=>new J(t)),"PRIVATE")),Dt(new I("heartbeat",(t=>new zt(t)),"PRIVATE")),Bt(X,Z,Xt),Bt(X,Z,"esm2017"),Bt("fire-js","");
316
316
  /**
317
317
  * @license
318
318
  * Copyright 2017 Google LLC
@@ -345,7 +345,7 @@ class Lt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
345
345
  * See the License for the specific language governing permissions and
346
346
  * limitations under the License.
347
347
  */
348
- const Yt=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},Jt={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(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Yt(t),e)},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)}}},Xt=function(t){return function(t){const e=Yt(t);return Jt.encodeByteArray(e,!0)}(t).replace(/\./g,"")};
348
+ const Zt=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},te={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(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Zt(t),e)},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)}}},ee=function(t){return function(t){const e=Zt(t);return te.encodeByteArray(e,!0)}(t).replace(/\./g,"")};
349
349
  /**
350
350
  * @license
351
351
  * Copyright 2022 Google LLC
@@ -362,7 +362,7 @@ const Yt=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.char
362
362
  * See the License for the specific language governing permissions and
363
363
  * limitations under the License.
364
364
  */
365
- const Zt=()=>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__,te=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return Jt.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},ee=()=>{try{return Zt()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||te()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},ne=t=>{const e=(t=>{var e,n;return null===(n=null===(e=ee())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(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]};class re extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,re.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,se.prototype.create)}}class se{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(ie,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new re(r,o,n)}}const ie=/\{\$([^}]+)}/g;
365
+ const ne=()=>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__,re=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return te.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},se=()=>{try{return ne()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||re()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},ie=t=>{const e=(t=>{var e,n;return null===(n=null===(e=se())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(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]};class oe extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,oe.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ae.prototype.create)}}class ae{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(ce,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new oe(r,o,n)}}const ce=/\{\$([^}]+)}/g;
366
366
  /**
367
367
  * @license
368
368
  * Copyright 2021 Google LLC
@@ -378,7 +378,7 @@ const Zt=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
378
378
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
379
379
  * See the License for the specific language governing permissions and
380
380
  * limitations under the License.
381
- */function oe(t){return t&&t._delegate?t._delegate:t}class ae{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}}
381
+ */function ue(t){return t&&t._delegate?t._delegate:t}class he{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}}
382
382
  /**
383
383
  * @license
384
384
  * Copyright 2017 Google LLC
@@ -394,7 +394,7 @@ const Zt=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
394
394
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
395
395
  * See the License for the specific language governing permissions and
396
396
  * limitations under the License.
397
- */var ce;!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"}(ce||(ce={}));const ue={debug:ce.DEBUG,verbose:ce.VERBOSE,info:ce.INFO,warn:ce.WARN,error:ce.ERROR,silent:ce.SILENT},he=ce.INFO,le={[ce.DEBUG]:"log",[ce.VERBOSE]:"log",[ce.INFO]:"info",[ce.WARN]:"warn",[ce.ERROR]:"error"},de=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=le[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};var fe=function(t,e){return fe=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])},fe(t,e)};function pe(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 ge(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 me,ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ve=ve||{},we=ye||self;function _e(){}function Te(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 Ee(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Se="closure_uid_"+(1e9*Math.random()>>>0),Ie=0;function be(t,e,n){return t.call.apply(t.bind,arguments)}function Ae(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 Ce(t,e,n){return(Ce=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?be:Ae).apply(null,arguments)}function ke(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 Re(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 Ne(){this.s=this.s,this.o=this.o}Ne.prototype.s=!1,Ne.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Se)&&t[Se]||(t[Se]=++Ie))},Ne.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var De=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 Oe(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 Le(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Te(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 Pe(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Pe.prototype.h=function(){this.defaultPrevented=!0};var Me=function(){if(!we.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{we.addEventListener("test",_e,e),we.removeEventListener("test",_e,e)}catch(t){}return t}();function xe(t){return/^[\s\xa0]*$/.test(t)}var Ue=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Fe(t,e){return t<e?-1:t>e?1:0}function Ve(){var t=we.navigator;return t&&(t=t.userAgent)?t:""}function Be(t){return-1!=Ve().indexOf(t)}function He(t){return He[" "](t),t}He[" "]=_e;var je,$e,qe=Be("Opera"),Ke=Be("Trident")||Be("MSIE"),We=Be("Edge"),Ge=We||Ke,ze=Be("Gecko")&&!(-1!=Ve().toLowerCase().indexOf("webkit")&&!Be("Edge"))&&!(Be("Trident")||Be("MSIE"))&&!Be("Edge"),Qe=-1!=Ve().toLowerCase().indexOf("webkit")&&!Be("Edge");function Ye(){var t=we.document;return t?t.documentMode:void 0}t:{var Je="",Xe=($e=Ve(),ze?/rv:([^\);]+)(\)|;)/.exec($e):We?/Edge\/([\d\.]+)/.exec($e):Ke?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec($e):Qe?/WebKit\/(\S+)/.exec($e):qe?/(?:Version)[ \/]?(\S+)/.exec($e):void 0);if(Xe&&(Je=Xe?Xe[1]:""),Ke){var Ze=Ye();if(null!=Ze&&Ze>parseFloat(Je)){je=String(Ze);break t}}je=Je}var tn,en={};function nn(){return function(t){var e=en;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Ue(String(je)).split("."),n=Ue("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=Fe(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Fe(0==i[2].length,0==o[2].length)||Fe(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(we.document&&Ke){var rn=Ye();tn=rn||(parseInt(je,10)||void 0)}else tn=void 0;var sn=tn;function on(t,e){if(Pe.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(ze){t:{try{He(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:an[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&on.X.h.call(this)}}Re(on,Pe);var an={2:"touch",3:"pen",4:"mouse"};on.prototype.h=function(){on.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var cn="closure_listenable_"+(1e6*Math.random()|0),un=0;function hn(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=++un,this.ba=this.ea=!1}function ln(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function dn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function fn(t){var e={};for(var n in t)e[n]=t[n];return e}var pn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function gn(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<pn.length;i++)n=pn[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function mn(t){this.src=t,this.g={},this.h=0}function yn(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=De(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(ln(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function vn(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}mn.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=vn(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new hn(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var wn="closure_lm_"+(1e6*Math.random()|0),_n={};function Tn(t,e,n,r,s){if(r&&r.once)return Sn(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Tn(t,e[i],n,r,s);return null}return n=Nn(n),t&&t[cn]?t.N(e,n,Ee(r)?!!r.capture:!!r,s):En(t,e,n,!1,r,s)}function En(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Ee(s)?!!s.capture:!!s,a=kn(t);if(a||(t[wn]=a=new mn(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=Cn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Me||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(An(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Sn(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Sn(t,e[i],n,r,s);return null}return n=Nn(n),t&&t[cn]?t.O(e,n,Ee(r)?!!r.capture:!!r,s):En(t,e,n,!0,r,s)}function In(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)In(t,e[i],n,r,s);else r=Ee(r)?!!r.capture:!!r,n=Nn(n),t&&t[cn]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=vn(i=t.g[e],n,r,s))&&(ln(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=kn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=vn(e,n,r,s)),(n=-1<t?e[t]:null)&&bn(n))}function bn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[cn])yn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(An(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=kn(e))?(yn(n,t),0==n.h&&(n.src=null,e[wn]=null)):ln(t)}}}function An(t){return t in _n?_n[t]:_n[t]="on"+t}function Cn(t,e){if(t.ba)t=!0;else{e=new on(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&bn(t),t=n.call(r,e)}return t}function kn(t){return(t=t[wn])instanceof mn?t:null}var Rn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Nn(t){return"function"==typeof t?t:(t[Rn]||(t[Rn]=function(e){return t.handleEvent(e)}),t[Rn])}function Dn(){Ne.call(this),this.i=new mn(this),this.P=this,this.I=null}function On(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 Pe(e,t);else if(e instanceof Pe)e.target=e.target||t;else{var s=e;gn(e=new Pe(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=Ln(o,r,!0,e)&&s}if(s=Ln(o=e.g=t,r,!0,e)&&s,s=Ln(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=Ln(o=e.g=n[i],r,!1,e)&&s}function Ln(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&&yn(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}Re(Dn,Ne),Dn.prototype[cn]=!0,Dn.prototype.removeEventListener=function(t,e,n,r){In(this,t,e,n,r)},Dn.prototype.M=function(){if(Dn.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++)ln(n[r]);delete e.g[t],e.h--}}this.I=null},Dn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Dn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Pn=we.JSON.stringify;function Mn(){var t=$n,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var xn,Un=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Fn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Fn=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 Vn}),(function(t){return t.reset()})),Vn=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 Bn(t){we.setTimeout((function(){throw t}),0)}function Hn(t,e){xn||function(){var t=we.Promise.resolve(void 0);xn=function(){t.then(qn)}}(),jn||(xn(),jn=!0),$n.add(t,e)}var jn=!1,$n=new Un;function qn(){for(var t;t=Mn();){try{t.h.call(t.g)}catch(t){Bn(t)}var e=Fn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}jn=!1}function Kn(t,e){Dn.call(this),this.h=t||1,this.g=e||we,this.j=Ce(this.lb,this),this.l=Date.now()}function Wn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Gn(t,e,n){if("function"==typeof t)n&&(t=Ce(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Ce(t.handleEvent,t)}return 2147483647<Number(e)?-1:we.setTimeout(t,e||0)}function zn(t){t.g=Gn((function(){t.g=null,t.i&&(t.i=!1,zn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Re(Kn,Dn),(me=Kn.prototype).ca=!1,me.R=null,me.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),On(this,"tick"),this.ca&&(Wn(this),this.start()))}},me.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},me.M=function(){Kn.X.M.call(this),Wn(this),delete this.g};var Qn=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}fe(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:zn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(we.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Ne);function Yn(t){Ne.call(this),this.h=t,this.g={}}Re(Yn,Ne);var Jn=[];function Xn(t,e,n,r){Array.isArray(n)||(n&&(Jn[0]=n.toString()),n=Jn);for(var s=0;s<n.length;s++){var i=Tn(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function Zn(t){dn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&bn(t)}),t),t.g={}}function tr(){this.g=!0}function er(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 Pn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Yn.prototype.M=function(){Yn.X.M.call(this),Zn(this)},Yn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},tr.prototype.Aa=function(){this.g=!1},tr.prototype.info=function(){};var nr={},rr=null;function sr(){return rr=rr||new Dn}function ir(t){Pe.call(this,nr.Pa,t)}function or(t){var e=sr();On(e,new ir(e))}function ar(t,e){Pe.call(this,nr.STAT_EVENT,t),this.stat=e}function cr(t){var e=sr();On(e,new ar(e,t))}function ur(t,e){Pe.call(this,nr.Qa,t),this.size=e}function hr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return we.setTimeout((function(){t()}),e)}nr.Pa="serverreachability",Re(ir,Pe),nr.STAT_EVENT="statevent",Re(ar,Pe),nr.Qa="timingevent",Re(ur,Pe);var lr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},dr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function fr(){}function pr(t){return t.h||(t.h=t.i())}function gr(){}fr.prototype.h=null;var mr,yr={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function vr(){Pe.call(this,"d")}function wr(){Pe.call(this,"c")}function _r(){}function Tr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Yn(this),this.O=Sr,t=Ge?125:void 0,this.T=new Kn(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 Er}function Er(){this.i=null,this.g="",this.h=!1}Re(vr,Pe),Re(wr,Pe),Re(_r,fr),_r.prototype.g=function(){return new XMLHttpRequest},_r.prototype.i=function(){return{}},mr=new _r;var Sr=45e3,Ir={},br={};function Ar(t,e,n){t.K=1,t.v=Kr(Br(e)),t.s=n,t.P=!0,Cr(t,null)}function Cr(t,e){t.F=Date.now(),Dr(t),t.A=Br(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),ss(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Er,t.g=si(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Qn(Ce(t.La,t,t.g),t.N)),Xn(t.S,t.g,"readystatechange",t.ib),e=t.H?fn(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)),or(),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 kr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Rr(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Nr(t,n))==br){4==e&&(t.o=4,cr(14),s=!1),er(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ir){t.o=4,cr(15),er(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}er(t.j,t.m,r,null),xr(t,r)}kr(t)&&r!=br&&r!=Ir&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,cr(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),Ys(e),e.K=!0,cr(11))):(er(t.j,t.m,n,"[Invalid Chunked Response]"),Mr(t),Pr(t))}function Nr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?br:(n=Number(e.substring(n,r)),isNaN(n)?Ir:(r+=1)+n>e.length?br:(e=e.substr(r,n),t.C=r+n,e))}function Dr(t){t.V=Date.now()+t.O,Or(t,t.O)}function Or(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=hr(Ce(t.gb,t),e)}function Lr(t){t.B&&(we.clearTimeout(t.B),t.B=null)}function Pr(t){0==t.l.G||t.I||Zs(t.l,t)}function Mr(t){Lr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Wn(t.T),Zn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function xr(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||ls(n.h,t)))if(!t.J&&ls(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;Xs(n),js(n)}Qs(n),cr(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=hr(Ce(n.cb,n),6e3));if(1>=hs(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else ei(n,11)}else if((t.J||n.g==t)&&Xs(n),!xe(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&&(ds(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,qr(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=ri(r,r.H?r.ka:null,r.V),f.J){fs(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(Lr(p),Dr(p)),r.g=f}else zs(r);0<n.i.length&&qs(n)}else"stop"!=i[0]&&"close"!=i[0]||ei(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?ei(n,7):Hs(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}or()}catch(i){}}function Ur(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Te(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(Te(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(Te(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)}(me=Tr.prototype).setTimeout=function(t){this.O=t},me.ib=function(t){t=t.target;var e=this.L;e&&3==Ms(t)?e.l():this.La(t)},me.La=function(t){try{if(t==this.g)t:{var e=Ms(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ge||this.g&&(this.h.h||this.g.fa()||xs(this.g)))){this.I||4!=e||7==n||or(),Lr(this);var r=this.g.aa();this.Y=r;e:if(kr(this)){var s=xs(this.g);t="";var i=s.length,o=4==Ms(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Mr(this),Pr(this);var a="";break e}this.h.i=new we.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)&&!xe(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,cr(12),Mr(this),Pr(this);break t}er(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,xr(this,r)}this.P?(Rr(this,e,a),Ge&&this.i&&3==e&&(Xn(this.S,this.T,"tick",this.hb),this.T.start())):(er(this.j,this.m,a,null),xr(this,a)),4==e&&Mr(this),this.i&&!this.I&&(4==e?Zs(this.l,this):(this.i=!1,Dr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,cr(12)):(this.o=0,cr(13)),Mr(this),Pr(this)}}}catch(e){}},me.hb=function(){if(this.g){var t=Ms(this.g),e=this.g.fa();this.C<e.length&&(Lr(this),Rr(this,t,e),this.i&&4!=t&&Dr(this))}},me.cancel=function(){this.I=!0,Mr(this)},me.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&&(or(),cr(17)),Mr(this),this.o=2,Pr(this)):Or(this,this.V-t)};var Fr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Vr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Vr){this.h=void 0!==e?e:t.h,Hr(this,t.j),this.s=t.s,this.g=t.g,jr(this,t.m),this.l=t.l,e=t.i;var n=new ts;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),$r(this,n),this.o=t.o}else t&&(n=String(t).match(Fr))?(this.h=!!e,Hr(this,n[1]||"",!0),this.s=Wr(n[2]||""),this.g=Wr(n[3]||"",!0),jr(this,n[4]),this.l=Wr(n[5]||"",!0),$r(this,n[6]||"",!0),this.o=Wr(n[7]||"")):(this.h=!!e,this.i=new ts(null,this.h))}function Br(t){return new Vr(t)}function Hr(t,e,n){t.j=n?Wr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function jr(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 $r(t,e,n){e instanceof ts?(t.i=e,function(t,e){e&&!t.j&&(es(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ns(this,e),ss(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Gr(e,Xr)),t.i=new ts(e,t.h))}function qr(t,e,n){t.i.set(e,n)}function Kr(t){return qr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Wr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Gr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,zr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function zr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Vr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Gr(e,Qr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Gr(e,Qr,!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(Gr(n,"/"==n.charAt(0)?Jr:Yr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Gr(n,Zr)),t.join("")};var Qr=/[#\/\?@]/g,Yr=/[#\?:]/g,Jr=/[#\?]/g,Xr=/[#\?@]/g,Zr=/#/g;function ts(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function es(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 ns(t,e){es(t),e=is(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function rs(t,e){return es(t),e=is(t,e),t.g.has(e)}function ss(t,e,n){ns(t,e),0<n.length&&(t.i=null,t.g.set(is(t,e),Oe(n)),t.h+=n.length)}function is(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(me=ts.prototype).add=function(t,e){es(this),this.i=null,t=is(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},me.forEach=function(t,e){es(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},me.oa=function(){es(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},me.W=function(t){es(this);var e=[];if("string"==typeof t)rs(this,t)&&(e=e.concat(this.g.get(is(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},me.set=function(t,e){return es(this),this.i=null,rs(this,t=is(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},me.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},me.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 os=function(t,e){this.h=t,this.g=e};function as(t){this.l=t||cs,we.PerformanceNavigationTiming?t=0<(t=we.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(we.g&&we.g.Ga&&we.g.Ga()&&we.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 cs=10;function us(t){return!!t.h||!!t.g&&t.g.size>=t.j}function hs(t){return t.h?1:t.g?t.g.size:0}function ls(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function ds(t,e){t.g?t.g.add(e):t.h=e}function fs(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function ps(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=pe(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 Oe(t.i)}function gs(){}function ms(){this.g=new gs}function ys(t,e,n){var r=n||"";try{Ur(t,(function(t,n){var s=t;Ee(t)&&(s=Pn(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function vs(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function ws(t){this.l=t.ac||null,this.j=t.jb||!1}function _s(t,e){Dn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Ts,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}as.prototype.cancel=function(){var t,e;if(this.i=ps(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=pe(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()}},gs.prototype.stringify=function(t){return we.JSON.stringify(t,void 0)},gs.prototype.parse=function(t){return we.JSON.parse(t,void 0)},Re(ws,fr),ws.prototype.g=function(){return new _s(this.l,this.j)},ws.prototype.i=function(t){return function(){return t}}({}),Re(_s,Dn);var Ts=0;function Es(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ss(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Is(t)}function Is(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(me=_s.prototype).open=function(t,e){if(this.readyState!=Ts)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Is(this)},me.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||we).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},me.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,Ss(this)),this.readyState=Ts},me.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,Is(this)),this.g&&(this.readyState=3,Is(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==we.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;Es(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},me.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?Ss(this):Is(this),3==this.readyState&&Es(this)}},me.Va=function(t){this.g&&(this.response=this.responseText=t,Ss(this))},me.Ua=function(t){this.g&&(this.response=t,Ss(this))},me.ga=function(){this.g&&Ss(this)},me.setRequestHeader=function(t,e){this.v.append(t,e)},me.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},me.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(_s.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var bs=we.JSON.parse;function As(t){Dn.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=Cs,this.K=this.L=!1}Re(As,Dn);var Cs="",ks=/^https?$/i,Rs=["POST","PUT"];function Ns(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Ds(t),Ls(t)}function Ds(t){t.D||(t.D=!0,On(t,"complete"),On(t,"error"))}function Os(t){if(t.h&&void 0!==ve&&(!t.C[1]||4!=Ms(t)||2!=t.aa()))if(t.v&&4==Ms(t))Gn(t.Ha,0,t);else if(On(t,"readystatechange"),4==Ms(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(Fr)[1]||null;if(!i&&we.self&&we.self.location){var o=we.self.location.protocol;i=o.substr(0,o.length-1)}s=!ks.test(i?i.toLowerCase():"")}e=s}if(e)On(t,"complete"),On(t,"success");else{t.m=6;try{var a=2<Ms(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Ds(t)}}finally{Ls(t)}}}function Ls(t,e){if(t.g){Ps(t);var n=t.g,r=t.C[0]?_e:null;t.g=null,t.C=null,e||On(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Ps(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(we.clearTimeout(t.A),t.A=null)}function Ms(t){return t.g?t.g.readyState:0}function xs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Cs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Us(t){var e="";return dn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Fs(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Us(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):qr(t,e,n))}function Vs(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Bs(t){this.Ca=0,this.i=[],this.j=new tr,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=Vs("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=Vs("baseRetryDelayMs",5e3,t),this.bb=Vs("retryDelaySeedMs",1e4,t),this.$a=Vs("forwardChannelMaxRetries",2,t),this.ta=Vs("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 as(t&&t.concurrentRequestLimit),this.Fa=new ms,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 Hs(t){if($s(t),3==t.G){var e=t.U++,n=Br(t.F);qr(n,"SID",t.I),qr(n,"RID",e),qr(n,"TYPE","terminate"),Ws(t,n),(e=new Tr(t,t.j,e,void 0)).K=2,e.v=Kr(Br(n)),n=!1,we.navigator&&we.navigator.sendBeacon&&(n=we.navigator.sendBeacon(e.v.toString(),"")),!n&&we.Image&&((new Image).src=e.v,n=!0),n||(e.g=si(e.l,null),e.g.da(e.v)),e.F=Date.now(),Dr(e)}ni(t)}function js(t){t.g&&(Ys(t),t.g.cancel(),t.g=null)}function $s(t){js(t),t.u&&(we.clearTimeout(t.u),t.u=null),Xs(t),t.h.cancel(),t.m&&("number"==typeof t.m&&we.clearTimeout(t.m),t.m=null)}function qs(t){us(t.h)||t.m||(t.m=!0,Hn(t.Ja,t),t.C=0)}function Ks(t,e){var n;n=e?e.m:t.U++;var r=Br(t.F);qr(r,"SID",t.I),qr(r,"RID",n),qr(r,"AID",t.T),Ws(t,r),t.o&&t.s&&Fs(r,t.o,t.s),n=new Tr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Gs(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),ds(t.h,n),Ar(n,r,e)}function Ws(t,e){t.ia&&dn(t.ia,(function(t,n){qr(e,n,t)})),t.l&&Ur({},(function(t,n){qr(e,n,t)}))}function Gs(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Ce(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{ys(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 zs(t){t.g||t.u||(t.Z=1,Hn(t.Ia,t),t.A=0)}function Qs(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=hr(Ce(t.Ia,t),ti(t,t.A)),t.A++,!0)}function Ys(t){null!=t.B&&(we.clearTimeout(t.B),t.B=null)}function Js(t){t.g=new Tr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Br(t.sa);qr(e,"RID","rpc"),qr(e,"SID",t.I),qr(e,"CI",t.L?"0":"1"),qr(e,"AID",t.T),qr(e,"TYPE","xmlhttp"),Ws(t,e),t.o&&t.s&&Fs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Kr(Br(e)),n.s=null,n.P=!0,Cr(n,t)}function Xs(t){null!=t.v&&(we.clearTimeout(t.v),t.v=null)}function Zs(t,e){var n=null;if(t.g==e){Xs(t),Ys(t),t.g=null;var r=2}else{if(!ls(t.h,e))return;n=e.D,fs(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;On(r=sr(),new ur(r,n)),qs(t)}else zs(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(hs(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=hr(Ce(t.Ja,t,e),ti(t,t.C)),t.C++,0)))}(t,e)||2==r&&Qs(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:ei(t,5);break;case 4:ei(t,10);break;case 3:ei(t,6);break;default:ei(t,2)}}function ti(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ei(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Ce(t.kb,t);n||(n=new Vr("//www.google.com/images/cleardot.gif"),we.location&&"http"==we.location.protocol||Hr(n,"https"),Kr(n)),function(t,e){var n=new tr;if(we.Image){var r=new Image;r.onload=ke(vs,n,r,"TestLoadImage: loaded",!0,e),r.onerror=ke(vs,n,r,"TestLoadImage: error",!1,e),r.onabort=ke(vs,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=ke(vs,n,r,"TestLoadImage: timeout",!1,e),we.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else cr(2);t.G=0,t.l&&t.l.va(e),ni(t),$s(t)}function ni(t){if(t.G=0,t.la=[],t.l){var e=ps(t.h);0==e.length&&0==t.i.length||(Le(t.la,e),Le(t.la,t.i),t.h.i.length=0,Oe(t.i),t.i.length=0),t.l.ua()}}function ri(t,e,n){var r=n instanceof Vr?Br(n):new Vr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),jr(r,r.m);else{var s=we.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Vr(null,void 0);r&&Hr(i,r),e&&(i.g=e),s&&jr(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&qr(r,n,e),qr(r,"VER",t.ma),Ws(t,r),r}function si(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 As(new ws({jb:!0})):new As(t.ra)).Ka(t.H),e}function ii(){}function oi(){if(Ke&&!(10<=Number(sn)))throw Error("Environmental error: no available transport.")}function ai(t,e){Dn.call(this),this.g=new Bs(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)&&!xe(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!xe(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new hi(this)}function ci(t){vr.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 ui(){wr.call(this),this.status=1}function hi(t){this.g=t}(me=As.prototype).Ka=function(t){this.L=t},me.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():mr.g(),this.C=this.u?pr(this.u):pr(mr),this.g.onreadystatechange=Ce(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Ns(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=pe(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=we.FormData&&t instanceof we.FormData,!(0<=De(Rs,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=pe(n),f=d.next();!f.done;f=d.next()){var p=ge(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{Ps(this),0<this.B&&((this.K=function(t){return Ke&&nn()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ce(this.qa,this)):this.A=Gn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Ns(this,l)}},me.qa=function(){void 0!==ve&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,On(this,"timeout"),this.abort(8))},me.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,On(this,"complete"),On(this,"abort"),Ls(this))},me.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Ls(this,!0)),As.X.M.call(this)},me.Ha=function(){this.s||(this.F||this.v||this.l?Os(this):this.fb())},me.fb=function(){Os(this)},me.aa=function(){try{return 2<Ms(this)?this.g.status:-1}catch(t){return-1}},me.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},me.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),bs(e)}},me.Ea=function(){return this.m},me.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(me=Bs.prototype).ma=8,me.G=1,me.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 Tr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?gn(n=fn(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=Gs(this,e,r),qr(s=Br(this.F),"RID",t),qr(s,"CVER",22),this.D&&qr(s,"X-HTTP-Session-Id",this.D),Ws(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Us(n)))+"&"+r:this.o&&Fs(s,this.o,n)),ds(this.h,e),this.Ya&&qr(s,"TYPE","init"),this.O?(qr(s,"$req",r),qr(s,"SID","null"),e.Z=!0,Ar(e,s,null)):Ar(e,s,r),this.G=2}}else 3==this.G&&(t?Ks(this,t):0==this.i.length||us(this.h)||Ks(this))},me.Ia=function(){if(this.u=null,Js(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=hr(Ce(this.eb,this),t)}},me.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,cr(10),js(this),Js(this))},me.cb=function(){null!=this.v&&(this.v=null,js(this),Qs(this),cr(19))},me.kb=function(t){t?(this.j.info("Successfully pinged google.com"),cr(2)):(this.j.info("Failed to ping google.com"),cr(1))},(me=ii.prototype).xa=function(){},me.wa=function(){},me.va=function(){},me.ua=function(){},me.Ra=function(){},oi.prototype.g=function(t,e){return new ai(t,e)},Re(ai,Dn),ai.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;cr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=ri(t,null,t.V),qs(t)},ai.prototype.close=function(){Hs(this.g)},ai.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Pn(t),t=n);e.i.push(new os(e.ab++,t)),3==e.G&&qs(e)},ai.prototype.M=function(){this.g.l=null,delete this.j,Hs(this.g),delete this.g,ai.X.M.call(this)},Re(ci,vr),Re(ui,wr),Re(hi,ii),hi.prototype.xa=function(){On(this.g,"a")},hi.prototype.wa=function(t){On(this.g,new ci(t))},hi.prototype.va=function(t){On(this.g,new ui)},hi.prototype.ua=function(){On(this.g,"b")},oi.prototype.createWebChannel=oi.prototype.g,ai.prototype.send=ai.prototype.u,ai.prototype.open=ai.prototype.m,ai.prototype.close=ai.prototype.close,lr.NO_ERROR=0,lr.TIMEOUT=8,lr.HTTP_ERROR=6,dr.COMPLETE="complete",gr.EventType=yr,yr.OPEN="a",yr.CLOSE="b",yr.ERROR="c",yr.MESSAGE="d",Dn.prototype.listen=Dn.prototype.N,As.prototype.listenOnce=As.prototype.O,As.prototype.getLastError=As.prototype.Oa,As.prototype.getLastErrorCode=As.prototype.Ea,As.prototype.getStatus=As.prototype.aa,As.prototype.getResponseJson=As.prototype.Sa,As.prototype.getResponseText=As.prototype.fa,As.prototype.send=As.prototype.da,As.prototype.setWithCredentials=As.prototype.Ka;var li=lr,di=dr,fi=nr,pi=10,gi=11,mi=ws,yi=gr,vi=As;const wi="@firebase/firestore";
397
+ */var le;!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"}(le||(le={}));const de={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},fe=le.INFO,pe={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},ge=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=pe[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};var me=function(t,e){return me=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])},me(t,e)};function ye(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 ve(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 we,_e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Te=Te||{},Ee=_e||self;function Se(){}function Ie(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 be(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ae="closure_uid_"+(1e9*Math.random()>>>0),Ce=0;function ke(t,e,n){return t.call.apply(t.bind,arguments)}function Ne(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 Re(t,e,n){return(Re=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ke:Ne).apply(null,arguments)}function Oe(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 De(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 Le(){this.s=this.s,this.o=this.o}Le.prototype.s=!1,Le.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ae)&&t[Ae]||(t[Ae]=++Ce))},Le.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Pe=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 Me(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 xe(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Ie(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 Ue(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Ue.prototype.h=function(){this.defaultPrevented=!0};var Fe=function(){if(!Ee.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Ee.addEventListener("test",Se,e),Ee.removeEventListener("test",Se,e)}catch(t){}return t}();function Ve(t){return/^[\s\xa0]*$/.test(t)}var Be=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function He(t,e){return t<e?-1:t>e?1:0}function je(){var t=Ee.navigator;return t&&(t=t.userAgent)?t:""}function $e(t){return-1!=je().indexOf(t)}function qe(t){return qe[" "](t),t}qe[" "]=Se;var Ke,We,Ge=$e("Opera"),ze=$e("Trident")||$e("MSIE"),Qe=$e("Edge"),Ye=Qe||ze,Je=$e("Gecko")&&!(-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge"))&&!($e("Trident")||$e("MSIE"))&&!$e("Edge"),Xe=-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge");function Ze(){var t=Ee.document;return t?t.documentMode:void 0}t:{var tn="",en=(We=je(),Je?/rv:([^\);]+)(\)|;)/.exec(We):Qe?/Edge\/([\d\.]+)/.exec(We):ze?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(We):Xe?/WebKit\/(\S+)/.exec(We):Ge?/(?:Version)[ \/]?(\S+)/.exec(We):void 0);if(en&&(tn=en?en[1]:""),ze){var nn=Ze();if(null!=nn&&nn>parseFloat(tn)){Ke=String(nn);break t}}Ke=tn}var rn,sn={};function on(){return function(t){var e=sn;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Be(String(Ke)).split("."),n=Be("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=He(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||He(0==i[2].length,0==o[2].length)||He(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(Ee.document&&ze){var an=Ze();rn=an||(parseInt(Ke,10)||void 0)}else rn=void 0;var cn=rn;function un(t,e){if(Ue.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(Je){t:{try{qe(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:hn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&un.X.h.call(this)}}De(un,Ue);var hn={2:"touch",3:"pen",4:"mouse"};un.prototype.h=function(){un.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var ln="closure_listenable_"+(1e6*Math.random()|0),dn=0;function fn(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=++dn,this.ba=this.ea=!1}function pn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function gn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function mn(t){var e={};for(var n in t)e[n]=t[n];return e}var yn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function vn(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<yn.length;i++)n=yn[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function wn(t){this.src=t,this.g={},this.h=0}function _n(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=Pe(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(pn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Tn(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}wn.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Tn(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new fn(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var En="closure_lm_"+(1e6*Math.random()|0),Sn={};function In(t,e,n,r,s){if(r&&r.once)return An(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)In(t,e[i],n,r,s);return null}return n=Ln(n),t&&t[ln]?t.N(e,n,be(r)?!!r.capture:!!r,s):bn(t,e,n,!1,r,s)}function bn(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=be(s)?!!s.capture:!!s,a=On(t);if(a||(t[En]=a=new wn(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=Rn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Fe||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Nn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function An(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)An(t,e[i],n,r,s);return null}return n=Ln(n),t&&t[ln]?t.O(e,n,be(r)?!!r.capture:!!r,s):bn(t,e,n,!0,r,s)}function Cn(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Cn(t,e[i],n,r,s);else r=be(r)?!!r.capture:!!r,n=Ln(n),t&&t[ln]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Tn(i=t.g[e],n,r,s))&&(pn(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=On(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Tn(e,n,r,s)),(n=-1<t?e[t]:null)&&kn(n))}function kn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[ln])_n(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Nn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=On(e))?(_n(n,t),0==n.h&&(n.src=null,e[En]=null)):pn(t)}}}function Nn(t){return t in Sn?Sn[t]:Sn[t]="on"+t}function Rn(t,e){if(t.ba)t=!0;else{e=new un(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&kn(t),t=n.call(r,e)}return t}function On(t){return(t=t[En])instanceof wn?t:null}var Dn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ln(t){return"function"==typeof t?t:(t[Dn]||(t[Dn]=function(e){return t.handleEvent(e)}),t[Dn])}function Pn(){Le.call(this),this.i=new wn(this),this.P=this,this.I=null}function Mn(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 Ue(e,t);else if(e instanceof Ue)e.target=e.target||t;else{var s=e;vn(e=new Ue(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=xn(o,r,!0,e)&&s}if(s=xn(o=e.g=t,r,!0,e)&&s,s=xn(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=xn(o=e.g=n[i],r,!1,e)&&s}function xn(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&&_n(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}De(Pn,Le),Pn.prototype[ln]=!0,Pn.prototype.removeEventListener=function(t,e,n,r){Cn(this,t,e,n,r)},Pn.prototype.M=function(){if(Pn.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++)pn(n[r]);delete e.g[t],e.h--}}this.I=null},Pn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Pn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Un=Ee.JSON.stringify;function Fn(){var t=Wn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Vn,Bn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Hn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Hn=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 jn}),(function(t){return t.reset()})),jn=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 $n(t){Ee.setTimeout((function(){throw t}),0)}function qn(t,e){Vn||function(){var t=Ee.Promise.resolve(void 0);Vn=function(){t.then(Gn)}}(),Kn||(Vn(),Kn=!0),Wn.add(t,e)}var Kn=!1,Wn=new Bn;function Gn(){for(var t;t=Fn();){try{t.h.call(t.g)}catch(t){$n(t)}var e=Hn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Kn=!1}function zn(t,e){Pn.call(this),this.h=t||1,this.g=e||Ee,this.j=Re(this.lb,this),this.l=Date.now()}function Qn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Yn(t,e,n){if("function"==typeof t)n&&(t=Re(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Re(t.handleEvent,t)}return 2147483647<Number(e)?-1:Ee.setTimeout(t,e||0)}function Jn(t){t.g=Yn((function(){t.g=null,t.i&&(t.i=!1,Jn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}De(zn,Pn),(we=zn.prototype).ca=!1,we.R=null,we.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),Mn(this,"tick"),this.ca&&(Qn(this),this.start()))}},we.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},we.M=function(){zn.X.M.call(this),Qn(this),delete this.g};var Xn=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}me(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:Jn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(Ee.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Le);function Zn(t){Le.call(this),this.h=t,this.g={}}De(Zn,Le);var tr=[];function er(t,e,n,r){Array.isArray(n)||(n&&(tr[0]=n.toString()),n=tr);for(var s=0;s<n.length;s++){var i=In(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function nr(t){gn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&kn(t)}),t),t.g={}}function rr(){this.g=!0}function sr(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 Un(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Zn.prototype.M=function(){Zn.X.M.call(this),nr(this)},Zn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},rr.prototype.Aa=function(){this.g=!1},rr.prototype.info=function(){};var ir={},or=null;function ar(){return or=or||new Pn}function cr(t){Ue.call(this,ir.Pa,t)}function ur(t){var e=ar();Mn(e,new cr(e))}function hr(t,e){Ue.call(this,ir.STAT_EVENT,t),this.stat=e}function lr(t){var e=ar();Mn(e,new hr(e,t))}function dr(t,e){Ue.call(this,ir.Qa,t),this.size=e}function fr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return Ee.setTimeout((function(){t()}),e)}ir.Pa="serverreachability",De(cr,Ue),ir.STAT_EVENT="statevent",De(hr,Ue),ir.Qa="timingevent",De(dr,Ue);var pr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},gr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function mr(){}function yr(t){return t.h||(t.h=t.i())}function vr(){}mr.prototype.h=null;var wr,_r={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Tr(){Ue.call(this,"d")}function Er(){Ue.call(this,"c")}function Sr(){}function Ir(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Zn(this),this.O=Ar,t=Ye?125:void 0,this.T=new zn(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 br}function br(){this.i=null,this.g="",this.h=!1}De(Tr,Ue),De(Er,Ue),De(Sr,mr),Sr.prototype.g=function(){return new XMLHttpRequest},Sr.prototype.i=function(){return{}},wr=new Sr;var Ar=45e3,Cr={},kr={};function Nr(t,e,n){t.K=1,t.v=zr($r(e)),t.s=n,t.P=!0,Rr(t,null)}function Rr(t,e){t.F=Date.now(),Pr(t),t.A=$r(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),as(n.i,"t",r),t.C=0,n=t.l.H,t.h=new br,t.g=ai(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Xn(Re(t.La,t,t.g),t.N)),er(t.S,t.g,"readystatechange",t.ib),e=t.H?mn(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)),ur(),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 Or(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Dr(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Lr(t,n))==kr){4==e&&(t.o=4,lr(14),s=!1),sr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Cr){t.o=4,lr(15),sr(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}sr(t.j,t.m,r,null),Vr(t,r)}Or(t)&&r!=kr&&r!=Cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,lr(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),Zs(e),e.K=!0,lr(11))):(sr(t.j,t.m,n,"[Invalid Chunked Response]"),Fr(t),Ur(t))}function Lr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?kr:(n=Number(e.substring(n,r)),isNaN(n)?Cr:(r+=1)+n>e.length?kr:(e=e.substr(r,n),t.C=r+n,e))}function Pr(t){t.V=Date.now()+t.O,Mr(t,t.O)}function Mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=fr(Re(t.gb,t),e)}function xr(t){t.B&&(Ee.clearTimeout(t.B),t.B=null)}function Ur(t){0==t.l.G||t.I||ni(t.l,t)}function Fr(t){xr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Qn(t.T),nr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Vr(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||ps(n.h,t)))if(!t.J&&ps(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;ei(n),Ks(n)}Xs(n),lr(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=fr(Re(n.cb,n),6e3));if(1>=fs(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else si(n,11)}else if((t.J||n.g==t)&&ei(n),!Ve(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&&(gs(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,Gr(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=oi(r,r.H?r.ka:null,r.V),f.J){ms(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(xr(p),Pr(p)),r.g=f}else Js(r);0<n.i.length&&Gs(n)}else"stop"!=i[0]&&"close"!=i[0]||si(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?si(n,7):qs(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}ur()}catch(i){}}function Br(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Ie(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(Ie(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(Ie(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)}(we=Ir.prototype).setTimeout=function(t){this.O=t},we.ib=function(t){t=t.target;var e=this.L;e&&3==Fs(t)?e.l():this.La(t)},we.La=function(t){try{if(t==this.g)t:{var e=Fs(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ye||this.g&&(this.h.h||this.g.fa()||Vs(this.g)))){this.I||4!=e||7==n||ur(),xr(this);var r=this.g.aa();this.Y=r;e:if(Or(this)){var s=Vs(this.g);t="";var i=s.length,o=4==Fs(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Fr(this),Ur(this);var a="";break e}this.h.i=new Ee.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)&&!Ve(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,lr(12),Fr(this),Ur(this);break t}sr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Vr(this,r)}this.P?(Dr(this,e,a),Ye&&this.i&&3==e&&(er(this.S,this.T,"tick",this.hb),this.T.start())):(sr(this.j,this.m,a,null),Vr(this,a)),4==e&&Fr(this),this.i&&!this.I&&(4==e?ni(this.l,this):(this.i=!1,Pr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,lr(12)):(this.o=0,lr(13)),Fr(this),Ur(this)}}}catch(e){}},we.hb=function(){if(this.g){var t=Fs(this.g),e=this.g.fa();this.C<e.length&&(xr(this),Dr(this,t,e),this.i&&4!=t&&Pr(this))}},we.cancel=function(){this.I=!0,Fr(this)},we.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&&(ur(),lr(17)),Fr(this),this.o=2,Ur(this)):Mr(this,this.V-t)};var Hr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function jr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof jr){this.h=void 0!==e?e:t.h,qr(this,t.j),this.s=t.s,this.g=t.g,Kr(this,t.m),this.l=t.l,e=t.i;var n=new rs;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Wr(this,n),this.o=t.o}else t&&(n=String(t).match(Hr))?(this.h=!!e,qr(this,n[1]||"",!0),this.s=Qr(n[2]||""),this.g=Qr(n[3]||"",!0),Kr(this,n[4]),this.l=Qr(n[5]||"",!0),Wr(this,n[6]||"",!0),this.o=Qr(n[7]||"")):(this.h=!!e,this.i=new rs(null,this.h))}function $r(t){return new jr(t)}function qr(t,e,n){t.j=n?Qr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Kr(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 Wr(t,e,n){e instanceof rs?(t.i=e,function(t,e){e&&!t.j&&(ss(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(is(this,e),as(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Yr(e,es)),t.i=new rs(e,t.h))}function Gr(t,e,n){t.i.set(e,n)}function zr(t){return Gr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Qr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Yr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Jr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Jr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}jr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Yr(e,Xr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Yr(e,Xr,!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(Yr(n,"/"==n.charAt(0)?ts:Zr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Yr(n,ns)),t.join("")};var Xr=/[#\/\?@]/g,Zr=/[#\?:]/g,ts=/[#\?]/g,es=/[#\?@]/g,ns=/#/g;function rs(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ss(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 is(t,e){ss(t),e=cs(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function os(t,e){return ss(t),e=cs(t,e),t.g.has(e)}function as(t,e,n){is(t,e),0<n.length&&(t.i=null,t.g.set(cs(t,e),Me(n)),t.h+=n.length)}function cs(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(we=rs.prototype).add=function(t,e){ss(this),this.i=null,t=cs(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},we.forEach=function(t,e){ss(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},we.oa=function(){ss(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},we.W=function(t){ss(this);var e=[];if("string"==typeof t)os(this,t)&&(e=e.concat(this.g.get(cs(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},we.set=function(t,e){return ss(this),this.i=null,os(this,t=cs(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},we.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},we.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 us=function(t,e){this.h=t,this.g=e};function hs(t){this.l=t||ls,Ee.PerformanceNavigationTiming?t=0<(t=Ee.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(Ee.g&&Ee.g.Ga&&Ee.g.Ga()&&Ee.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 ls=10;function ds(t){return!!t.h||!!t.g&&t.g.size>=t.j}function fs(t){return t.h?1:t.g?t.g.size:0}function ps(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function gs(t,e){t.g?t.g.add(e):t.h=e}function ms(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function ys(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=ye(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 Me(t.i)}function vs(){}function ws(){this.g=new vs}function _s(t,e,n){var r=n||"";try{Br(t,(function(t,n){var s=t;be(t)&&(s=Un(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Ts(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function Es(t){this.l=t.ac||null,this.j=t.jb||!1}function Ss(t,e){Pn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Is,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}hs.prototype.cancel=function(){var t,e;if(this.i=ys(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ye(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()}},vs.prototype.stringify=function(t){return Ee.JSON.stringify(t,void 0)},vs.prototype.parse=function(t){return Ee.JSON.parse(t,void 0)},De(Es,mr),Es.prototype.g=function(){return new Ss(this.l,this.j)},Es.prototype.i=function(t){return function(){return t}}({}),De(Ss,Pn);var Is=0;function bs(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function As(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Cs(t)}function Cs(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(we=Ss.prototype).open=function(t,e){if(this.readyState!=Is)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Cs(this)},we.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||Ee).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},we.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,As(this)),this.readyState=Is},we.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,Cs(this)),this.g&&(this.readyState=3,Cs(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==Ee.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;bs(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},we.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?As(this):Cs(this),3==this.readyState&&bs(this)}},we.Va=function(t){this.g&&(this.response=this.responseText=t,As(this))},we.Ua=function(t){this.g&&(this.response=t,As(this))},we.ga=function(){this.g&&As(this)},we.setRequestHeader=function(t,e){this.v.append(t,e)},we.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},we.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(Ss.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var ks=Ee.JSON.parse;function Ns(t){Pn.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=Rs,this.K=this.L=!1}De(Ns,Pn);var Rs="",Os=/^https?$/i,Ds=["POST","PUT"];function Ls(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Ps(t),xs(t)}function Ps(t){t.D||(t.D=!0,Mn(t,"complete"),Mn(t,"error"))}function Ms(t){if(t.h&&void 0!==Te&&(!t.C[1]||4!=Fs(t)||2!=t.aa()))if(t.v&&4==Fs(t))Yn(t.Ha,0,t);else if(Mn(t,"readystatechange"),4==Fs(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(Hr)[1]||null;if(!i&&Ee.self&&Ee.self.location){var o=Ee.self.location.protocol;i=o.substr(0,o.length-1)}s=!Os.test(i?i.toLowerCase():"")}e=s}if(e)Mn(t,"complete"),Mn(t,"success");else{t.m=6;try{var a=2<Fs(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Ps(t)}}finally{xs(t)}}}function xs(t,e){if(t.g){Us(t);var n=t.g,r=t.C[0]?Se:null;t.g=null,t.C=null,e||Mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Us(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(Ee.clearTimeout(t.A),t.A=null)}function Fs(t){return t.g?t.g.readyState:0}function Vs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Rs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Bs(t){var e="";return gn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Hs(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Bs(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Gr(t,e,n))}function js(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function $s(t){this.Ca=0,this.i=[],this.j=new rr,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=js("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=js("baseRetryDelayMs",5e3,t),this.bb=js("retryDelaySeedMs",1e4,t),this.$a=js("forwardChannelMaxRetries",2,t),this.ta=js("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 hs(t&&t.concurrentRequestLimit),this.Fa=new ws,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 qs(t){if(Ws(t),3==t.G){var e=t.U++,n=$r(t.F);Gr(n,"SID",t.I),Gr(n,"RID",e),Gr(n,"TYPE","terminate"),Qs(t,n),(e=new Ir(t,t.j,e,void 0)).K=2,e.v=zr($r(n)),n=!1,Ee.navigator&&Ee.navigator.sendBeacon&&(n=Ee.navigator.sendBeacon(e.v.toString(),"")),!n&&Ee.Image&&((new Image).src=e.v,n=!0),n||(e.g=ai(e.l,null),e.g.da(e.v)),e.F=Date.now(),Pr(e)}ii(t)}function Ks(t){t.g&&(Zs(t),t.g.cancel(),t.g=null)}function Ws(t){Ks(t),t.u&&(Ee.clearTimeout(t.u),t.u=null),ei(t),t.h.cancel(),t.m&&("number"==typeof t.m&&Ee.clearTimeout(t.m),t.m=null)}function Gs(t){ds(t.h)||t.m||(t.m=!0,qn(t.Ja,t),t.C=0)}function zs(t,e){var n;n=e?e.m:t.U++;var r=$r(t.F);Gr(r,"SID",t.I),Gr(r,"RID",n),Gr(r,"AID",t.T),Qs(t,r),t.o&&t.s&&Hs(r,t.o,t.s),n=new Ir(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Ys(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),gs(t.h,n),Nr(n,r,e)}function Qs(t,e){t.ia&&gn(t.ia,(function(t,n){Gr(e,n,t)})),t.l&&Br({},(function(t,n){Gr(e,n,t)}))}function Ys(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Re(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{_s(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 Js(t){t.g||t.u||(t.Z=1,qn(t.Ia,t),t.A=0)}function Xs(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=fr(Re(t.Ia,t),ri(t,t.A)),t.A++,!0)}function Zs(t){null!=t.B&&(Ee.clearTimeout(t.B),t.B=null)}function ti(t){t.g=new Ir(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=$r(t.sa);Gr(e,"RID","rpc"),Gr(e,"SID",t.I),Gr(e,"CI",t.L?"0":"1"),Gr(e,"AID",t.T),Gr(e,"TYPE","xmlhttp"),Qs(t,e),t.o&&t.s&&Hs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=zr($r(e)),n.s=null,n.P=!0,Rr(n,t)}function ei(t){null!=t.v&&(Ee.clearTimeout(t.v),t.v=null)}function ni(t,e){var n=null;if(t.g==e){ei(t),Zs(t),t.g=null;var r=2}else{if(!ps(t.h,e))return;n=e.D,ms(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;Mn(r=ar(),new dr(r,n)),Gs(t)}else Js(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(fs(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=fr(Re(t.Ja,t,e),ri(t,t.C)),t.C++,0)))}(t,e)||2==r&&Xs(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:si(t,5);break;case 4:si(t,10);break;case 3:si(t,6);break;default:si(t,2)}}function ri(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function si(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Re(t.kb,t);n||(n=new jr("//www.google.com/images/cleardot.gif"),Ee.location&&"http"==Ee.location.protocol||qr(n,"https"),zr(n)),function(t,e){var n=new rr;if(Ee.Image){var r=new Image;r.onload=Oe(Ts,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Oe(Ts,n,r,"TestLoadImage: error",!1,e),r.onabort=Oe(Ts,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Oe(Ts,n,r,"TestLoadImage: timeout",!1,e),Ee.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else lr(2);t.G=0,t.l&&t.l.va(e),ii(t),Ws(t)}function ii(t){if(t.G=0,t.la=[],t.l){var e=ys(t.h);0==e.length&&0==t.i.length||(xe(t.la,e),xe(t.la,t.i),t.h.i.length=0,Me(t.i),t.i.length=0),t.l.ua()}}function oi(t,e,n){var r=n instanceof jr?$r(n):new jr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Kr(r,r.m);else{var s=Ee.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new jr(null,void 0);r&&qr(i,r),e&&(i.g=e),s&&Kr(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&Gr(r,n,e),Gr(r,"VER",t.ma),Qs(t,r),r}function ai(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 Ns(new Es({jb:!0})):new Ns(t.ra)).Ka(t.H),e}function ci(){}function ui(){if(ze&&!(10<=Number(cn)))throw Error("Environmental error: no available transport.")}function hi(t,e){Pn.call(this),this.g=new $s(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)&&!Ve(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Ve(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new fi(this)}function li(t){Tr.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 di(){Er.call(this),this.status=1}function fi(t){this.g=t}(we=Ns.prototype).Ka=function(t){this.L=t},we.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():wr.g(),this.C=this.u?yr(this.u):yr(wr),this.g.onreadystatechange=Re(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Ls(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=ye(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=Ee.FormData&&t instanceof Ee.FormData,!(0<=Pe(Ds,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ye(n),f=d.next();!f.done;f=d.next()){var p=ve(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{Us(this),0<this.B&&((this.K=function(t){return ze&&on()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Re(this.qa,this)):this.A=Yn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Ls(this,l)}},we.qa=function(){void 0!==Te&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Mn(this,"timeout"),this.abort(8))},we.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Mn(this,"complete"),Mn(this,"abort"),xs(this))},we.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),xs(this,!0)),Ns.X.M.call(this)},we.Ha=function(){this.s||(this.F||this.v||this.l?Ms(this):this.fb())},we.fb=function(){Ms(this)},we.aa=function(){try{return 2<Fs(this)?this.g.status:-1}catch(t){return-1}},we.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},we.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),ks(e)}},we.Ea=function(){return this.m},we.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(we=$s.prototype).ma=8,we.G=1,we.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 Ir(this,this.j,t,void 0),n=this.s;if(this.S&&(n?vn(n=mn(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=Ys(this,e,r),Gr(s=$r(this.F),"RID",t),Gr(s,"CVER",22),this.D&&Gr(s,"X-HTTP-Session-Id",this.D),Qs(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Bs(n)))+"&"+r:this.o&&Hs(s,this.o,n)),gs(this.h,e),this.Ya&&Gr(s,"TYPE","init"),this.O?(Gr(s,"$req",r),Gr(s,"SID","null"),e.Z=!0,Nr(e,s,null)):Nr(e,s,r),this.G=2}}else 3==this.G&&(t?zs(this,t):0==this.i.length||ds(this.h)||zs(this))},we.Ia=function(){if(this.u=null,ti(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=fr(Re(this.eb,this),t)}},we.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,lr(10),Ks(this),ti(this))},we.cb=function(){null!=this.v&&(this.v=null,Ks(this),Xs(this),lr(19))},we.kb=function(t){t?(this.j.info("Successfully pinged google.com"),lr(2)):(this.j.info("Failed to ping google.com"),lr(1))},(we=ci.prototype).xa=function(){},we.wa=function(){},we.va=function(){},we.ua=function(){},we.Ra=function(){},ui.prototype.g=function(t,e){return new hi(t,e)},De(hi,Pn),hi.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;lr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=oi(t,null,t.V),Gs(t)},hi.prototype.close=function(){qs(this.g)},hi.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Un(t),t=n);e.i.push(new us(e.ab++,t)),3==e.G&&Gs(e)},hi.prototype.M=function(){this.g.l=null,delete this.j,qs(this.g),delete this.g,hi.X.M.call(this)},De(li,Tr),De(di,Er),De(fi,ci),fi.prototype.xa=function(){Mn(this.g,"a")},fi.prototype.wa=function(t){Mn(this.g,new li(t))},fi.prototype.va=function(t){Mn(this.g,new di)},fi.prototype.ua=function(){Mn(this.g,"b")},ui.prototype.createWebChannel=ui.prototype.g,hi.prototype.send=hi.prototype.u,hi.prototype.open=hi.prototype.m,hi.prototype.close=hi.prototype.close,pr.NO_ERROR=0,pr.TIMEOUT=8,pr.HTTP_ERROR=6,gr.COMPLETE="complete",vr.EventType=_r,_r.OPEN="a",_r.CLOSE="b",_r.ERROR="c",_r.MESSAGE="d",Pn.prototype.listen=Pn.prototype.N,Ns.prototype.listenOnce=Ns.prototype.O,Ns.prototype.getLastError=Ns.prototype.Oa,Ns.prototype.getLastErrorCode=Ns.prototype.Ea,Ns.prototype.getStatus=Ns.prototype.aa,Ns.prototype.getResponseJson=Ns.prototype.Sa,Ns.prototype.getResponseText=Ns.prototype.fa,Ns.prototype.send=Ns.prototype.da,Ns.prototype.setWithCredentials=Ns.prototype.Ka;var pi=pr,gi=gr,mi=ir,yi=10,vi=11,wi=Es,_i=vr,Ti=Ns;const Ei="@firebase/firestore";
398
398
  /**
399
399
  * @license
400
400
  * Copyright 2017 Google LLC
@@ -410,7 +410,7 @@ const Zt=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
410
410
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
411
411
  * See the License for the specific language governing permissions and
412
412
  * limitations under the License.
413
- */class _i{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}}_i.UNAUTHENTICATED=new _i(null),_i.GOOGLE_CREDENTIALS=new _i("google-credentials-uid"),_i.FIRST_PARTY=new _i("first-party-uid"),_i.MOCK_USER=new _i("mock-user");
413
+ */class Si{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}}Si.UNAUTHENTICATED=new Si(null),Si.GOOGLE_CREDENTIALS=new Si("google-credentials-uid"),Si.FIRST_PARTY=new Si("first-party-uid"),Si.MOCK_USER=new Si("mock-user");
414
414
  /**
415
415
  * @license
416
416
  * Copyright 2017 Google LLC
@@ -427,7 +427,7 @@ const Zt=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
427
427
  * See the License for the specific language governing permissions and
428
428
  * limitations under the License.
429
429
  */
430
- let Ti="9.15.0";
430
+ let Ii="9.15.0";
431
431
  /**
432
432
  * @license
433
433
  * Copyright 2017 Google LLC
@@ -443,7 +443,7 @@ let Ti="9.15.0";
443
443
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
444
444
  * See the License for the specific language governing permissions and
445
445
  * limitations under the License.
446
- */const Ei=new class{constructor(t){this.name=t,this._logLevel=he,this._logHandler=de,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in ce))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?ue[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,ce.DEBUG,...t),this._logHandler(this,ce.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,ce.VERBOSE,...t),this._logHandler(this,ce.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,ce.INFO,...t),this._logHandler(this,ce.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,ce.WARN,...t),this._logHandler(this,ce.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,ce.ERROR,...t),this._logHandler(this,ce.ERROR,...t)}}("@firebase/firestore");function Si(){return Ei.logLevel}function Ii(t,...e){if(Ei.logLevel<=ce.DEBUG){const n=e.map(Ci);Ei.debug(`Firestore (${Ti}): ${t}`,...n)}}function bi(t,...e){if(Ei.logLevel<=ce.ERROR){const n=e.map(Ci);Ei.error(`Firestore (${Ti}): ${t}`,...n)}}function Ai(t,...e){if(Ei.logLevel<=ce.WARN){const n=e.map(Ci);Ei.warn(`Firestore (${Ti}): ${t}`,...n)}}function Ci(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
446
+ */const bi=new class{constructor(t){this.name=t,this._logLevel=fe,this._logHandler=ge,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in le))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?de[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,le.DEBUG,...t),this._logHandler(this,le.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,le.VERBOSE,...t),this._logHandler(this,le.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,le.INFO,...t),this._logHandler(this,le.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,le.WARN,...t),this._logHandler(this,le.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,le.ERROR,...t),this._logHandler(this,le.ERROR,...t)}}("@firebase/firestore");function Ai(){return bi.logLevel}function Ci(t,...e){if(bi.logLevel<=le.DEBUG){const n=e.map(Ri);bi.debug(`Firestore (${Ii}): ${t}`,...n)}}function ki(t,...e){if(bi.logLevel<=le.ERROR){const n=e.map(Ri);bi.error(`Firestore (${Ii}): ${t}`,...n)}}function Ni(t,...e){if(bi.logLevel<=le.WARN){const n=e.map(Ri);bi.warn(`Firestore (${Ii}): ${t}`,...n)}}function Ri(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
447
447
  /**
448
448
  * @license
449
449
  * Copyright 2020 Google LLC
@@ -475,7 +475,7 @@ let Ti="9.15.0";
475
475
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
476
476
  * See the License for the specific language governing permissions and
477
477
  * limitations under the License.
478
- */function ki(t="Unexpected state"){const e=`FIRESTORE (${Ti}) INTERNAL ASSERTION FAILED: `+t;throw bi(e),new Error(e)}function Ri(t,e){t||ki()}function Ni(t,e){return t}
478
+ */function Oi(t="Unexpected state"){const e=`FIRESTORE (${Ii}) INTERNAL ASSERTION FAILED: `+t;throw ki(e),new Error(e)}function Di(t,e){t||Oi()}function Li(t,e){return t}
479
479
  /**
480
480
  * @license
481
481
  * Copyright 2017 Google LLC
@@ -491,7 +491,7 @@ let Ti="9.15.0";
491
491
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
492
492
  * See the License for the specific language governing permissions and
493
493
  * limitations under the License.
494
- */const Di={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 Oi extends re{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
494
+ */const Pi={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 Mi extends oe{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
495
495
  /**
496
496
  * @license
497
497
  * Copyright 2017 Google LLC
@@ -507,7 +507,7 @@ let Ti="9.15.0";
507
507
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
508
508
  * See the License for the specific language governing permissions and
509
509
  * limitations under the License.
510
- */class Li{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
510
+ */class xi{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
511
511
  /**
512
512
  * @license
513
513
  * Copyright 2017 Google LLC
@@ -523,7 +523,7 @@ let Ti="9.15.0";
523
523
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
524
524
  * See the License for the specific language governing permissions and
525
525
  * limitations under the License.
526
- */class Pi{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Mi{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(_i.UNAUTHENTICATED)))}shutdown(){}}class xi{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 Ui{constructor(t){this.t=t,this.currentUser=_i.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 Li;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Li,t.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const e=s;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Ii("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):(Ii("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Li)}}),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?(Ii("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Ri("string"==typeof e.accessToken),new Pi(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 Ri(null===t||"string"==typeof t),new _i(t)}}class Fi{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=_i.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Ri(!("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 Vi{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new Fi(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(_i.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Bi{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 Hi{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Ii("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,Ii("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Ii("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):Ii("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Ri("string"==typeof t.token),this.A=t.token,new Bi(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
526
+ */class Ui{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Fi{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Si.UNAUTHENTICATED)))}shutdown(){}}class Vi{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 Bi{constructor(t){this.t=t,this.currentUser=Si.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 xi;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new xi,t.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const e=s;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Ci("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):(Ci("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new xi)}}),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?(Ci("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Di("string"==typeof e.accessToken),new Ui(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 Di(null===t||"string"==typeof t),new Si(t)}}class Hi{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=Si.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Di(!("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 ji{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new Hi(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Si.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class $i{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 qi{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Ci("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,Ci("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Ci("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):Ci("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Di("string"==typeof t.token),this.A=t.token,new $i(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
527
527
  /**
528
528
  * @license
529
529
  * Copyright 2020 Google LLC
@@ -539,7 +539,7 @@ let Ti="9.15.0";
539
539
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
540
540
  * See the License for the specific language governing permissions and
541
541
  * limitations under the License.
542
- */function ji(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}
542
+ */function Ki(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}
543
543
  /**
544
544
  * @license
545
545
  * Copyright 2017 Google LLC
@@ -555,7 +555,7 @@ let Ti="9.15.0";
555
555
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
556
556
  * See the License for the specific language governing permissions and
557
557
  * limitations under the License.
558
- */class $i{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=ji(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%62))}return n}}function qi(t,e){return t<e?-1:t>e?1:0}function Ki(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
558
+ */class Wi{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=Ki(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%62))}return n}}function Gi(t,e){return t<e?-1:t>e?1:0}function zi(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
559
559
  /**
560
560
  * @license
561
561
  * Copyright 2017 Google LLC
@@ -571,7 +571,7 @@ let Ti="9.15.0";
571
571
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
572
572
  * See the License for the specific language governing permissions and
573
573
  * limitations under the License.
574
- */class Wi{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Oi(Di.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Oi(Di.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Oi(Di.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Oi(Di.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Wi.fromMillis(Date.now())}static fromDate(t){return Wi.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Wi(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?qi(this.nanoseconds,t.nanoseconds):qi(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")}}
574
+ */class Qi{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Qi.fromMillis(Date.now())}static fromDate(t){return Qi.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Qi(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Gi(this.nanoseconds,t.nanoseconds):Gi(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")}}
575
575
  /**
576
576
  * @license
577
577
  * Copyright 2017 Google LLC
@@ -587,7 +587,7 @@ let Ti="9.15.0";
587
587
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
588
588
  * See the License for the specific language governing permissions and
589
589
  * limitations under the License.
590
- */class Gi{constructor(t){this.timestamp=t}static fromTimestamp(t){return new Gi(t)}static min(){return new Gi(new Wi(0,0))}static max(){return new Gi(new Wi(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}}
590
+ */class Yi{constructor(t){this.timestamp=t}static fromTimestamp(t){return new Yi(t)}static min(){return new Yi(new Qi(0,0))}static max(){return new Yi(new Qi(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}}
591
591
  /**
592
592
  * @license
593
593
  * Copyright 2017 Google LLC
@@ -603,7 +603,7 @@ let Ti="9.15.0";
603
603
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
604
604
  * See the License for the specific language governing permissions and
605
605
  * limitations under the License.
606
- */class zi{constructor(t,e,n){void 0===e?e=0:e>t.length&&ki(),void 0===n?n=t.length-e:n>t.length-e&&ki(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===zi.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof zi?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 Qi extends zi{construct(t,e,n){return new Qi(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 Oi(Di.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new Qi(e)}static emptyPath(){return new Qi([])}}const Yi=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Ji extends zi{construct(t,e,n){return new Ji(t,e,n)}static isValidIdentifier(t){return Yi.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Ji.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new Ji(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Oi(Di.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 Oi(Di.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Oi(Di.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 Oi(Di.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Ji(e)}static emptyPath(){return new Ji([])}}
606
+ */class Ji{constructor(t,e,n){void 0===e?e=0:e>t.length&&Oi(),void 0===n?n=t.length-e:n>t.length-e&&Oi(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===Ji.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof Ji?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 Xi extends Ji{construct(t,e,n){return new Xi(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 Mi(Pi.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new Xi(e)}static emptyPath(){return new Xi([])}}const Zi=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class to extends Ji{construct(t,e,n){return new to(t,e,n)}static isValidIdentifier(t){return Zi.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),to.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new to(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Mi(Pi.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 Mi(Pi.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Mi(Pi.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 Mi(Pi.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new to(e)}static emptyPath(){return new to([])}}
607
607
  /**
608
608
  * @license
609
609
  * Copyright 2017 Google LLC
@@ -619,7 +619,7 @@ let Ti="9.15.0";
619
619
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
620
620
  * See the License for the specific language governing permissions and
621
621
  * limitations under the License.
622
- */class Xi{constructor(t){this.path=t}static fromPath(t){return new Xi(Qi.fromString(t))}static fromName(t){return new Xi(Qi.fromString(t).popFirst(5))}static empty(){return new Xi(Qi.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===Qi.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Qi.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Xi(new Qi(t.slice()))}}function Zi(t){return new to(t.readTime,t.key,-1)}class to{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new to(Gi.min(),Xi.empty(),-1)}static max(){return new to(Gi.max(),Xi.empty(),-1)}}function eo(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=Xi.comparator(t.documentKey,e.documentKey),0!==n?n:qi(t.largestBatchId,e.largestBatchId)
622
+ */class eo{constructor(t){this.path=t}static fromPath(t){return new eo(Xi.fromString(t))}static fromName(t){return new eo(Xi.fromString(t).popFirst(5))}static empty(){return new eo(Xi.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===Xi.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Xi.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new eo(new Xi(t.slice()))}}function no(t){return new ro(t.readTime,t.key,-1)}class ro{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ro(Yi.min(),eo.empty(),-1)}static max(){return new ro(Yi.max(),eo.empty(),-1)}}function so(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=eo.comparator(t.documentKey,e.documentKey),0!==n?n:Gi(t.largestBatchId,e.largestBatchId)
623
623
  /**
624
624
  * @license
625
625
  * Copyright 2020 Google LLC
@@ -635,7 +635,7 @@ let Ti="9.15.0";
635
635
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
636
636
  * See the License for the specific language governing permissions and
637
637
  * limitations under the License.
638
- */)}const no="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class ro{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
638
+ */)}const io="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class oo{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
639
639
  /**
640
640
  * @license
641
641
  * Copyright 2017 Google LLC
@@ -651,7 +651,7 @@ let Ti="9.15.0";
651
651
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
652
652
  * See the License for the specific language governing permissions and
653
653
  * limitations under the License.
654
- */async function so(t){if(t.code!==Di.FAILED_PRECONDITION||t.message!==no)throw t;Ii("LocalStore","Unexpectedly lost primary lease")}
654
+ */async function ao(t){if(t.code!==Pi.FAILED_PRECONDITION||t.message!==io)throw t;Ci("LocalStore","Unexpectedly lost primary lease")}
655
655
  /**
656
656
  * @license
657
657
  * Copyright 2017 Google LLC
@@ -667,7 +667,7 @@ let Ti="9.15.0";
667
667
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
668
668
  * See the License for the specific language governing permissions and
669
669
  * limitations under the License.
670
- */class io{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&&ki(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new io(((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 io?e:io.resolve(e)}catch(t){return io.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):io.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):io.reject(e)}static resolve(t){return new io(((e,n)=>{e(t)}))}static reject(t){return new io(((e,n)=>{n(t)}))}static waitFor(t){return new io(((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=io.resolve(!1);for(const n of t)e=e.next((t=>t?io.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 io(((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 io(((n,r)=>{const s=()=>{!0===t()?e().next((()=>{s()}),r):n()};s()}))}}function oo(t){return"IndexedDbTransactionError"===t.name}
670
+ */class co{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&&Oi(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new co(((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 co?e:co.resolve(e)}catch(t){return co.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):co.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):co.reject(e)}static resolve(t){return new co(((e,n)=>{e(t)}))}static reject(t){return new co(((e,n)=>{n(t)}))}static waitFor(t){return new co(((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=co.resolve(!1);for(const n of t)e=e.next((t=>t?co.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 co(((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 co(((n,r)=>{const s=()=>{!0===t()?e().next((()=>{s()}),r):n()};s()}))}}function uo(t){return"IndexedDbTransactionError"===t.name}
671
671
  /**
672
672
  * @license
673
673
  * Copyright 2018 Google LLC
@@ -683,7 +683,7 @@ let Ti="9.15.0";
683
683
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
684
684
  * See the License for the specific language governing permissions and
685
685
  * limitations under the License.
686
- */class ao{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}}ao.at=-1;
686
+ */class ho{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}}ho.at=-1;
687
687
  /**
688
688
  * @license
689
689
  * Copyright 2017 Google LLC
@@ -700,7 +700,7 @@ let Ti="9.15.0";
700
700
  * See the License for the specific language governing permissions and
701
701
  * limitations under the License.
702
702
  */
703
- class co{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 uo{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new uo("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof uo&&t.projectId===this.projectId&&t.database===this.database}}
703
+ class lo{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 fo{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new fo("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof fo&&t.projectId===this.projectId&&t.database===this.database}}
704
704
  /**
705
705
  * @license
706
706
  * Copyright 2017 Google LLC
@@ -716,7 +716,7 @@ class co{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
716
716
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
717
717
  * See the License for the specific language governing permissions and
718
718
  * limitations under the License.
719
- */function ho(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function lo(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function fo(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
719
+ */function po(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function go(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function mo(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
720
720
  /**
721
721
  * @license
722
722
  * Copyright 2017 Google LLC
@@ -732,7 +732,7 @@ class co{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
732
732
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
733
733
  * See the License for the specific language governing permissions and
734
734
  * limitations under the License.
735
- */function po(t){return null==t}function go(t){return 0===t&&1/t==-1/0}
735
+ */function yo(t){return null==t}function vo(t){return 0===t&&1/t==-1/0}
736
736
  /**
737
737
  * @license
738
738
  * Copyright 2020 Google LLC
@@ -749,7 +749,7 @@ class co{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
749
749
  * See the License for the specific language governing permissions and
750
750
  * limitations under the License.
751
751
  */
752
- class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new mo(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 mo(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}
752
+ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new wo(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 wo(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}
753
753
  /**
754
754
  * @license
755
755
  * Copyright 2020 Google LLC
@@ -765,7 +765,7 @@ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
765
765
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
766
766
  * See the License for the specific language governing permissions and
767
767
  * limitations under the License.
768
- */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return qi(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}mo.EMPTY_BYTE_STRING=new mo("");const yo=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function vo(t){if(Ri(!!t),"string"==typeof t){let e=0;const n=yo.exec(t);if(Ri(!!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:wo(t.seconds),nanos:wo(t.nanos)}}function wo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function _o(t){return"string"==typeof t?mo.fromBase64String(t):mo.fromUint8Array(t)}
768
+ */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Gi(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}wo.EMPTY_BYTE_STRING=new wo("");const _o=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function To(t){if(Di(!!t),"string"==typeof t){let e=0;const n=_o.exec(t);if(Di(!!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:Eo(t.seconds),nanos:Eo(t.nanos)}}function Eo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function So(t){return"string"==typeof t?wo.fromBase64String(t):wo.fromUint8Array(t)}
769
769
  /**
770
770
  * @license
771
771
  * Copyright 2020 Google LLC
@@ -781,7 +781,7 @@ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
781
781
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
782
782
  * See the License for the specific language governing permissions and
783
783
  * limitations under the License.
784
- */function To(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 Eo(t){const e=t.mapValue.fields.__previous_value__;return To(e)?Eo(e):e}function So(t){const e=vo(t.mapValue.fields.__local_write_time__.timestampValue);return new Wi(e.seconds,e.nanos)}
784
+ */function Io(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 bo(t){const e=t.mapValue.fields.__previous_value__;return Io(e)?bo(e):e}function Ao(t){const e=To(t.mapValue.fields.__local_write_time__.timestampValue);return new Qi(e.seconds,e.nanos)}
785
785
  /**
786
786
  * @license
787
787
  * Copyright 2020 Google LLC
@@ -797,7 +797,7 @@ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
797
797
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
798
798
  * See the License for the specific language governing permissions and
799
799
  * limitations under the License.
800
- */const Io={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function bo(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?To(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
800
+ */const Co={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function ko(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?Io(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
801
801
  /**
802
802
  * @license
803
803
  * Copyright 2022 Google LLC
@@ -813,7 +813,7 @@ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
813
813
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
814
814
  * See the License for the specific language governing permissions and
815
815
  * limitations under the License.
816
- */(t)?9007199254740991:10:ki()}function Ao(t,e){if(t===e)return!0;const n=bo(t);if(n!==bo(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return So(t).isEqual(So(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=vo(t.timestampValue),r=vo(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 _o(t.bytesValue).isEqual(_o(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return wo(t.geoPointValue.latitude)===wo(e.geoPointValue.latitude)&&wo(t.geoPointValue.longitude)===wo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return wo(t.integerValue)===wo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=wo(t.doubleValue),r=wo(e.doubleValue);return n===r?go(n)===go(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Ki(t.arrayValue.values||[],e.arrayValue.values||[],Ao);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(ho(n)!==ho(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Ao(n[t],r[t])))return!1;return!0}(t,e);default:return ki()}}function Co(t,e){return void 0!==(t.values||[]).find((t=>Ao(t,e)))}function ko(t,e){if(t===e)return 0;const n=bo(t),r=bo(e);if(n!==r)return qi(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return qi(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=wo(t.integerValue||t.doubleValue),r=wo(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 Ro(t.timestampValue,e.timestampValue);case 4:return Ro(So(t),So(e));case 5:return qi(t.stringValue,e.stringValue);case 6:return function(t,e){const n=_o(t),r=_o(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=qi(n[t],r[t]);if(0!==e)return e}return qi(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=qi(wo(t.latitude),wo(e.latitude));return 0!==n?n:qi(wo(t.longitude),wo(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=ko(n[t],r[t]);if(e)return e}return qi(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Io.mapValue&&e===Io.mapValue)return 0;if(t===Io.mapValue)return 1;if(e===Io.mapValue)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=qi(r[t],i[t]);if(0!==e)return e;const o=ko(n[r[t]],s[i[t]]);if(0!==o)return o}return qi(r.length,i.length)}(t.mapValue,e.mapValue);default:throw ki()}}function Ro(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return qi(t,e);const n=vo(t),r=vo(e),s=qi(n.seconds,r.seconds);return 0!==s?s:qi(n.nanos,r.nanos)}function No(t){return Do(t)}function Do(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=vo(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?_o(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,Xi.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+=Do(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}:${Do(t.fields[s])}`;return n+"}"}(t.mapValue):ki();var e,n}function Oo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Lo(t){return!!t&&"integerValue"in t}function Po(t){return!!t&&"arrayValue"in t}function Mo(t){return!!t&&"nullValue"in t}function xo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Uo(t){return!!t&&"mapValue"in t}function Fo(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 lo(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Fo(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Fo(t.arrayValue.values[n]);return e}return Object.assign({},t)}class Vo{constructor(t,e){this.position=t,this.inclusive=e}}function Bo(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()?Xi.comparator(Xi.fromName(o.referenceValue),n.key):ko(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function Ho(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(!Ao(t.position[n],e.position[n]))return!1;return!0}
816
+ */(t)?9007199254740991:10:Oi()}function No(t,e){if(t===e)return!0;const n=ko(t);if(n!==ko(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ao(t).isEqual(Ao(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=To(t.timestampValue),r=To(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 So(t.bytesValue).isEqual(So(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Eo(t.geoPointValue.latitude)===Eo(e.geoPointValue.latitude)&&Eo(t.geoPointValue.longitude)===Eo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Eo(t.integerValue)===Eo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Eo(t.doubleValue),r=Eo(e.doubleValue);return n===r?vo(n)===vo(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return zi(t.arrayValue.values||[],e.arrayValue.values||[],No);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(po(n)!==po(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!No(n[t],r[t])))return!1;return!0}(t,e);default:return Oi()}}function Ro(t,e){return void 0!==(t.values||[]).find((t=>No(t,e)))}function Oo(t,e){if(t===e)return 0;const n=ko(t),r=ko(e);if(n!==r)return Gi(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Gi(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Eo(t.integerValue||t.doubleValue),r=Eo(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 Do(t.timestampValue,e.timestampValue);case 4:return Do(Ao(t),Ao(e));case 5:return Gi(t.stringValue,e.stringValue);case 6:return function(t,e){const n=So(t),r=So(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=Gi(n[t],r[t]);if(0!==e)return e}return Gi(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Gi(Eo(t.latitude),Eo(e.latitude));return 0!==n?n:Gi(Eo(t.longitude),Eo(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=Oo(n[t],r[t]);if(e)return e}return Gi(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Co.mapValue&&e===Co.mapValue)return 0;if(t===Co.mapValue)return 1;if(e===Co.mapValue)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=Gi(r[t],i[t]);if(0!==e)return e;const o=Oo(n[r[t]],s[i[t]]);if(0!==o)return o}return Gi(r.length,i.length)}(t.mapValue,e.mapValue);default:throw Oi()}}function Do(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Gi(t,e);const n=To(t),r=To(e),s=Gi(n.seconds,r.seconds);return 0!==s?s:Gi(n.nanos,r.nanos)}function Lo(t){return Po(t)}function Po(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=To(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?So(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,eo.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+=Po(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}:${Po(t.fields[s])}`;return n+"}"}(t.mapValue):Oi();var e,n}function Mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function xo(t){return!!t&&"integerValue"in t}function Uo(t){return!!t&&"arrayValue"in t}function Fo(t){return!!t&&"nullValue"in t}function Vo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Bo(t){return!!t&&"mapValue"in t}function Ho(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 go(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Ho(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ho(t.arrayValue.values[n]);return e}return Object.assign({},t)}class jo{constructor(t,e){this.position=t,this.inclusive=e}}function $o(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()?eo.comparator(eo.fromName(o.referenceValue),n.key):Oo(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function qo(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(!No(t.position[n],e.position[n]))return!1;return!0}
817
817
  /**
818
818
  * @license
819
819
  * Copyright 2022 Google LLC
@@ -829,7 +829,7 @@ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
829
829
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
830
830
  * See the License for the specific language governing permissions and
831
831
  * limitations under the License.
832
- */class jo{}class $o extends jo{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 Yo(t,e,n):"array-contains"===e?new ta(t,n):"in"===e?new ea(t,n):"not-in"===e?new na(t,n):"array-contains-any"===e?new ra(t,n):new $o(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new Jo(t,n):new Xo(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(ko(e,this.value)):null!==e&&bo(this.value)===bo(e)&&this.matchesComparison(ko(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 ki()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class qo extends jo{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new qo(t,e)}matches(t){return Ko(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 Ko(t){return"and"===t.op}function Wo(t){return function(t){for(const e of t.filters)if(e instanceof qo)return!1;return!0}(t)&&Ko(t)}function Go(t){if(t instanceof $o)return t.field.canonicalString()+t.op.toString()+No(t.value);{const e=t.filters.map((t=>Go(t))).join(",");return`${t.op}(${e})`}}function zo(t,e){return t instanceof $o?function(t,e){return e instanceof $o&&t.op===e.op&&t.field.isEqual(e.field)&&Ao(t.value,e.value)}(t,e):t instanceof qo?function(t,e){return e instanceof qo&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&zo(n,e.filters[r])),!0)}(t,e):void ki()}function Qo(t){return t instanceof $o?function(t){return`${t.field.canonicalString()} ${t.op} ${No(t.value)}`}(t):t instanceof qo?function(t){return t.op.toString()+" {"+t.getFilters().map(Qo).join(" ,")+"}"}(t):"Filter"}class Yo extends $o{constructor(t,e,n){super(t,e,n),this.key=Xi.fromName(n.referenceValue)}matches(t){const e=Xi.comparator(t.key,this.key);return this.matchesComparison(e)}}class Jo extends $o{constructor(t,e){super(t,"in",e),this.keys=Zo("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class Xo extends $o{constructor(t,e){super(t,"not-in",e),this.keys=Zo("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function Zo(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>Xi.fromName(t.referenceValue)))}class ta extends $o{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Po(e)&&Co(e.arrayValue,this.value)}}class ea extends $o{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Co(this.value.arrayValue,e)}}class na extends $o{constructor(t,e){super(t,"not-in",e)}matches(t){if(Co(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Co(this.value.arrayValue,e)}}class ra extends $o{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Po(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Co(this.value.arrayValue,t)))}}
832
+ */class Ko{}class Wo extends Ko{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 Zo(t,e,n):"array-contains"===e?new ra(t,n):"in"===e?new sa(t,n):"not-in"===e?new ia(t,n):"array-contains-any"===e?new oa(t,n):new Wo(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ta(t,n):new ea(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Oo(e,this.value)):null!==e&&ko(this.value)===ko(e)&&this.matchesComparison(Oo(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 Oi()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Go extends Ko{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Go(t,e)}matches(t){return zo(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 zo(t){return"and"===t.op}function Qo(t){return function(t){for(const e of t.filters)if(e instanceof Go)return!1;return!0}(t)&&zo(t)}function Yo(t){if(t instanceof Wo)return t.field.canonicalString()+t.op.toString()+Lo(t.value);{const e=t.filters.map((t=>Yo(t))).join(",");return`${t.op}(${e})`}}function Jo(t,e){return t instanceof Wo?function(t,e){return e instanceof Wo&&t.op===e.op&&t.field.isEqual(e.field)&&No(t.value,e.value)}(t,e):t instanceof Go?function(t,e){return e instanceof Go&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Jo(n,e.filters[r])),!0)}(t,e):void Oi()}function Xo(t){return t instanceof Wo?function(t){return`${t.field.canonicalString()} ${t.op} ${Lo(t.value)}`}(t):t instanceof Go?function(t){return t.op.toString()+" {"+t.getFilters().map(Xo).join(" ,")+"}"}(t):"Filter"}class Zo extends Wo{constructor(t,e,n){super(t,e,n),this.key=eo.fromName(n.referenceValue)}matches(t){const e=eo.comparator(t.key,this.key);return this.matchesComparison(e)}}class ta extends Wo{constructor(t,e){super(t,"in",e),this.keys=na("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class ea extends Wo{constructor(t,e){super(t,"not-in",e),this.keys=na("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function na(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>eo.fromName(t.referenceValue)))}class ra extends Wo{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Uo(e)&&Ro(e.arrayValue,this.value)}}class sa extends Wo{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Ro(this.value.arrayValue,e)}}class ia extends Wo{constructor(t,e){super(t,"not-in",e)}matches(t){if(Ro(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Ro(this.value.arrayValue,e)}}class oa extends Wo{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Uo(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Ro(this.value.arrayValue,t)))}}
833
833
  /**
834
834
  * @license
835
835
  * Copyright 2022 Google LLC
@@ -845,7 +845,7 @@ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
845
845
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
846
846
  * See the License for the specific language governing permissions and
847
847
  * limitations under the License.
848
- */class sa{constructor(t,e="asc"){this.field=t,this.dir=e}}function ia(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
848
+ */class aa{constructor(t,e="asc"){this.field=t,this.dir=e}}function ca(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
849
849
  /**
850
850
  * @license
851
851
  * Copyright 2017 Google LLC
@@ -861,7 +861,7 @@ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
861
861
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
862
862
  * See the License for the specific language governing permissions and
863
863
  * limitations under the License.
864
- */class oa{constructor(t,e){this.comparator=t,this.root=e||ca.EMPTY}insert(t,e){return new oa(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,ca.BLACK,null,null))}remove(t){return new oa(this.comparator,this.root.remove(t,this.comparator).copy(null,null,ca.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 aa(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new aa(this.root,t,this.comparator,!1)}getReverseIterator(){return new aa(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new aa(this.root,t,this.comparator,!0)}}class aa{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 ca{constructor(t,e,n,r,s){this.key=t,this.value=e,this.color=null!=n?n:ca.RED,this.left=null!=r?r:ca.EMPTY,this.right=null!=s?s:ca.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,s){return new ca(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 ca.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 ca.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,ca.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,ca.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 ki();if(this.right.isRed())throw ki();const t=this.left.check();if(t!==this.right.check())throw ki();return t+(this.isRed()?0:1)}}ca.EMPTY=null,ca.RED=!0,ca.BLACK=!1,ca.EMPTY=new class{constructor(){this.size=0}get key(){throw ki()}get value(){throw ki()}get color(){throw ki()}get left(){throw ki()}get right(){throw ki()}copy(t,e,n,r,s){return this}insert(t,e,n){return new ca(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}};
864
+ */class ua{constructor(t,e){this.comparator=t,this.root=e||la.EMPTY}insert(t,e){return new ua(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,la.BLACK,null,null))}remove(t){return new ua(this.comparator,this.root.remove(t,this.comparator).copy(null,null,la.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 ha(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new ha(this.root,t,this.comparator,!1)}getReverseIterator(){return new ha(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new ha(this.root,t,this.comparator,!0)}}class ha{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 la{constructor(t,e,n,r,s){this.key=t,this.value=e,this.color=null!=n?n:la.RED,this.left=null!=r?r:la.EMPTY,this.right=null!=s?s:la.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,s){return new la(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 la.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 la.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,la.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,la.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 Oi();if(this.right.isRed())throw Oi();const t=this.left.check();if(t!==this.right.check())throw Oi();return t+(this.isRed()?0:1)}}la.EMPTY=null,la.RED=!0,la.BLACK=!1,la.EMPTY=new class{constructor(){this.size=0}get key(){throw Oi()}get value(){throw Oi()}get color(){throw Oi()}get left(){throw Oi()}get right(){throw Oi()}copy(t,e,n,r,s){return this}insert(t,e,n){return new la(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}};
865
865
  /**
866
866
  * @license
867
867
  * Copyright 2017 Google LLC
@@ -878,7 +878,7 @@ class mo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
878
878
  * See the License for the specific language governing permissions and
879
879
  * limitations under the License.
880
880
  */
881
- class ua{constructor(t){this.comparator=t,this.data=new oa(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 ha(this.data.getIterator())}getIteratorFrom(t){return new ha(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 ua))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 ua(this.comparator);return e.data=t,e}}class ha{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
881
+ class da{constructor(t){this.comparator=t,this.data=new ua(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 fa(this.data.getIterator())}getIteratorFrom(t){return new fa(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 da))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 da(this.comparator);return e.data=t,e}}class fa{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
882
882
  /**
883
883
  * @license
884
884
  * Copyright 2020 Google LLC
@@ -894,7 +894,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
894
894
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
895
895
  * See the License for the specific language governing permissions and
896
896
  * limitations under the License.
897
- */class la{constructor(t){this.fields=t,t.sort(Ji.comparator)}static empty(){return new la([])}unionWith(t){let e=new ua(Ji.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new la(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return Ki(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
897
+ */class pa{constructor(t){this.fields=t,t.sort(to.comparator)}static empty(){return new pa([])}unionWith(t){let e=new da(to.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new pa(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return zi(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
898
898
  /**
899
899
  * @license
900
900
  * Copyright 2017 Google LLC
@@ -910,7 +910,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
910
910
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
911
911
  * See the License for the specific language governing permissions and
912
912
  * limitations under the License.
913
- */class da{constructor(t){this.value=t}static empty(){return new da({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)],!Uo(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Fo(e)}setAll(t){let e=Ji.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()]=Fo(t):r.push(s.lastSegment())}));const s=this.getFieldsMap(e);this.applyChanges(s,n,r)}delete(t){const e=this.field(t.popLast());Uo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Ao(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)];Uo(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){lo(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new da(Fo(this.value))}}function fa(t){const e=[];return lo(t.fields,((t,n)=>{const r=new Ji([t]);if(Uo(n)){const t=fa(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new la(e)
913
+ */class ga{constructor(t){this.value=t}static empty(){return new ga({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)],!Bo(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Ho(e)}setAll(t){let e=to.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()]=Ho(t):r.push(s.lastSegment())}));const s=this.getFieldsMap(e);this.applyChanges(s,n,r)}delete(t){const e=this.field(t.popLast());Bo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return No(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)];Bo(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){go(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new ga(Ho(this.value))}}function ma(t){const e=[];return go(t.fields,((t,n)=>{const r=new to([t]);if(Bo(n)){const t=ma(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new pa(e)
914
914
  /**
915
915
  * @license
916
916
  * Copyright 2017 Google LLC
@@ -926,7 +926,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
926
926
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
927
927
  * See the License for the specific language governing permissions and
928
928
  * limitations under the License.
929
- */}class pa{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 pa(t,0,Gi.min(),Gi.min(),Gi.min(),da.empty(),0)}static newFoundDocument(t,e,n,r){return new pa(t,1,e,Gi.min(),n,r,0)}static newNoDocument(t,e){return new pa(t,2,e,Gi.min(),Gi.min(),da.empty(),0)}static newUnknownDocument(t,e){return new pa(t,3,e,Gi.min(),Gi.min(),da.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Gi.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=da.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=da.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Gi.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 pa&&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 pa(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}})`}}
929
+ */}class ya{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 ya(t,0,Yi.min(),Yi.min(),Yi.min(),ga.empty(),0)}static newFoundDocument(t,e,n,r){return new ya(t,1,e,Yi.min(),n,r,0)}static newNoDocument(t,e){return new ya(t,2,e,Yi.min(),Yi.min(),ga.empty(),0)}static newUnknownDocument(t,e){return new ya(t,3,e,Yi.min(),Yi.min(),ga.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Yi.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=ga.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=ga.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Yi.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 ya&&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 ya(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}})`}}
930
930
  /**
931
931
  * @license
932
932
  * Copyright 2019 Google LLC
@@ -942,7 +942,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
942
942
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
943
943
  * See the License for the specific language governing permissions and
944
944
  * limitations under the License.
945
- */class ga{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 ma(t,e=null,n=[],r=[],s=null,i=null,o=null){return new ga(t,e,n,r,s,i,o)}function ya(t){const e=Ni(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Go(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),po(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>No(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>No(t))).join(",")),e.ft=t}return e.ft}function va(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(!ia(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(!zo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Ho(t.startAt,e.startAt)&&Ho(t.endAt,e.endAt)}function wa(t){return Xi.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
945
+ */class va{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 wa(t,e=null,n=[],r=[],s=null,i=null,o=null){return new va(t,e,n,r,s,i,o)}function _a(t){const e=Li(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Yo(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),yo(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Lo(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Lo(t))).join(",")),e.ft=t}return e.ft}function Ta(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(!ca(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(!Jo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!qo(t.startAt,e.startAt)&&qo(t.endAt,e.endAt)}function Ea(t){return eo.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
946
946
  /**
947
947
  * @license
948
948
  * Copyright 2017 Google LLC
@@ -958,7 +958,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
958
958
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
959
959
  * See the License for the specific language governing permissions and
960
960
  * limitations under the License.
961
- */class _a{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 Ta(t){return new _a(t)}function Ea(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 Sa(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Ia(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function ba(t){return null!==t.collectionGroup}function Aa(t){const e=Ni(t);if(null===e.dt){e.dt=[];const t=Ia(e),n=Sa(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new sa(t)),e.dt.push(new sa(Ji.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 sa(Ji.keyField(),t))}}}return e.dt}function Ca(t){const e=Ni(t);if(!e._t)if("F"===e.limitType)e._t=ma(e.path,e.collectionGroup,Aa(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Aa(e)){const e="desc"===n.dir?"asc":"desc";t.push(new sa(n.field,e))}const n=e.endAt?new Vo(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Vo(e.startAt.position,e.startAt.inclusive):null;e._t=ma(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function ka(t,e){e.getFirstInequalityField(),Ia(t);const n=t.filters.concat([e]);return new _a(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Ra(t,e,n){return new _a(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Na(t,e){return va(Ca(t),Ca(e))&&t.limitType===e.limitType}function Da(t){return`${ya(Ca(t))}|lt:${t.limitType}`}function Oa(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=>Qo(t))).join(", ")}]`),po(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=>No(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>No(t))).join(",")),`Target(${e})`}(Ca(t))}; limitType=${t.limitType})`}function La(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):Xi.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Aa(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=Bo(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Aa(t),e))&&!(t.endAt&&!function(t,e,n){const r=Bo(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Aa(t),e))}(t,e)}function Pa(t){return(e,n)=>{let r=!1;for(const s of Aa(t)){const t=Ma(s,e,n);if(0!==t)return t;r=r||s.field.isKeyField()}return 0}}function Ma(t,e,n){const r=t.field.isKeyField()?Xi.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?ko(r,s):ki()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return ki()}}
961
+ */class Sa{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 Ia(t){return new Sa(t)}function ba(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 Aa(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Ca(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function ka(t){return null!==t.collectionGroup}function Na(t){const e=Li(t);if(null===e.dt){e.dt=[];const t=Ca(e),n=Aa(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new aa(t)),e.dt.push(new aa(to.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 aa(to.keyField(),t))}}}return e.dt}function Ra(t){const e=Li(t);if(!e._t)if("F"===e.limitType)e._t=wa(e.path,e.collectionGroup,Na(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Na(e)){const e="desc"===n.dir?"asc":"desc";t.push(new aa(n.field,e))}const n=e.endAt?new jo(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new jo(e.startAt.position,e.startAt.inclusive):null;e._t=wa(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function Oa(t,e){e.getFirstInequalityField(),Ca(t);const n=t.filters.concat([e]);return new Sa(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Da(t,e,n){return new Sa(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function La(t,e){return Ta(Ra(t),Ra(e))&&t.limitType===e.limitType}function Pa(t){return`${_a(Ra(t))}|lt:${t.limitType}`}function Ma(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=>Xo(t))).join(", ")}]`),yo(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=>Lo(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Lo(t))).join(",")),`Target(${e})`}(Ra(t))}; limitType=${t.limitType})`}function xa(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):eo.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Na(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=$o(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Na(t),e))&&!(t.endAt&&!function(t,e,n){const r=$o(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Na(t),e))}(t,e)}function Ua(t){return(e,n)=>{let r=!1;for(const s of Na(t)){const t=Fa(s,e,n);if(0!==t)return t;r=r||s.field.isKeyField()}return 0}}function Fa(t,e,n){const r=t.field.isKeyField()?eo.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?Oo(r,s):Oi()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Oi()}}
962
962
  /**
963
963
  * @license
964
964
  * Copyright 2020 Google LLC
@@ -974,7 +974,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
974
974
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
975
975
  * See the License for the specific language governing permissions and
976
976
  * limitations under the License.
977
- */function xa(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:go(e)?"-0":e}}function Ua(t){return{integerValue:""+t}}function Fa(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!go(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Ua(e):xa(t,e)}
977
+ */function Va(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:vo(e)?"-0":e}}function Ba(t){return{integerValue:""+t}}function Ha(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!vo(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Ba(e):Va(t,e)}
978
978
  /**
979
979
  * @license
980
980
  * Copyright 2018 Google LLC
@@ -990,7 +990,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
990
990
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
991
991
  * See the License for the specific language governing permissions and
992
992
  * limitations under the License.
993
- */class Va{constructor(){this._=void 0}}function Ba(t,e,n){return t instanceof $a?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 qa?Ka(t,e):t instanceof Wa?Ga(t,e):function(t,e){const n=ja(t,e),r=Qa(n)+Qa(t.gt);return Lo(n)&&Lo(t.gt)?Ua(r):xa(t.yt,r)}(t,e)}function Ha(t,e,n){return t instanceof qa?Ka(t,e):t instanceof Wa?Ga(t,e):n}function ja(t,e){return t instanceof za?Lo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class $a extends Va{}class qa extends Va{constructor(t){super(),this.elements=t}}function Ka(t,e){const n=Ya(e);for(const e of t.elements)n.some((t=>Ao(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Wa extends Va{constructor(t){super(),this.elements=t}}function Ga(t,e){let n=Ya(e);for(const e of t.elements)n=n.filter((t=>!Ao(t,e)));return{arrayValue:{values:n}}}class za extends Va{constructor(t,e){super(),this.yt=t,this.gt=e}}function Qa(t){return wo(t.integerValue||t.doubleValue)}function Ya(t){return Po(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class Ja{constructor(t,e){this.version=t,this.transformResults=e}}class Xa{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Xa}static exists(t){return new Xa(void 0,t)}static updateTime(t){return new Xa(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 Za(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class tc{}function ec(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new lc(t.key,Xa.none()):new oc(t.key,t.data,Xa.none());{const n=t.data,r=da.empty();let s=new ua(Ji.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 ac(t.key,r,new la(s.toArray()),Xa.none())}}function nc(t,e,n){t instanceof oc?function(t,e,n){const r=t.value.clone(),s=uc(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof ac?function(t,e,n){if(!Za(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=uc(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(cc(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 rc(t,e,n,r){return t instanceof oc?function(t,e,n,r){if(!Za(t.precondition,e))return n;const s=t.value.clone(),i=hc(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof ac?function(t,e,n,r){if(!Za(t.precondition,e))return n;const s=hc(t.fieldTransforms,r,e),i=e.data;return i.setAll(cc(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 Za(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function sc(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),s=ja(r.transform,t||null);null!=s&&(null===n&&(n=da.empty()),n.set(r.field,s))}return n||null}function ic(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)&&Ki(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof qa&&e instanceof qa||t instanceof Wa&&e instanceof Wa?Ki(t.elements,e.elements,Ao):t instanceof za&&e instanceof za?Ao(t.gt,e.gt):t instanceof $a&&e instanceof $a}(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 oc extends tc{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 ac extends tc{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 cc(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 uc(t,e,n){const r=new Map;Ri(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,Ha(o,a,n[s]))}return r}function hc(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,Ba(t,i,e))}return r}class lc extends tc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class dc extends tc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
993
+ */class ja{constructor(){this._=void 0}}function $a(t,e,n){return t instanceof Wa?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 Ga?za(t,e):t instanceof Qa?Ya(t,e):function(t,e){const n=Ka(t,e),r=Xa(n)+Xa(t.gt);return xo(n)&&xo(t.gt)?Ba(r):Va(t.yt,r)}(t,e)}function qa(t,e,n){return t instanceof Ga?za(t,e):t instanceof Qa?Ya(t,e):n}function Ka(t,e){return t instanceof Ja?xo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class Wa extends ja{}class Ga extends ja{constructor(t){super(),this.elements=t}}function za(t,e){const n=Za(e);for(const e of t.elements)n.some((t=>No(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Qa extends ja{constructor(t){super(),this.elements=t}}function Ya(t,e){let n=Za(e);for(const e of t.elements)n=n.filter((t=>!No(t,e)));return{arrayValue:{values:n}}}class Ja extends ja{constructor(t,e){super(),this.yt=t,this.gt=e}}function Xa(t){return Eo(t.integerValue||t.doubleValue)}function Za(t){return Uo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class tc{constructor(t,e){this.version=t,this.transformResults=e}}class ec{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ec}static exists(t){return new ec(void 0,t)}static updateTime(t){return new ec(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 nc(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class rc{}function sc(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new pc(t.key,ec.none()):new uc(t.key,t.data,ec.none());{const n=t.data,r=ga.empty();let s=new da(to.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 hc(t.key,r,new pa(s.toArray()),ec.none())}}function ic(t,e,n){t instanceof uc?function(t,e,n){const r=t.value.clone(),s=dc(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof hc?function(t,e,n){if(!nc(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=dc(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(lc(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 oc(t,e,n,r){return t instanceof uc?function(t,e,n,r){if(!nc(t.precondition,e))return n;const s=t.value.clone(),i=fc(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof hc?function(t,e,n,r){if(!nc(t.precondition,e))return n;const s=fc(t.fieldTransforms,r,e),i=e.data;return i.setAll(lc(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 nc(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ac(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),s=Ka(r.transform,t||null);null!=s&&(null===n&&(n=ga.empty()),n.set(r.field,s))}return n||null}function cc(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)&&zi(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Ga&&e instanceof Ga||t instanceof Qa&&e instanceof Qa?zi(t.elements,e.elements,No):t instanceof Ja&&e instanceof Ja?No(t.gt,e.gt):t instanceof Wa&&e instanceof Wa}(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 uc extends rc{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 hc extends rc{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 lc(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 dc(t,e,n){const r=new Map;Di(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,qa(o,a,n[s]))}return r}function fc(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,$a(t,i,e))}return r}class pc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class gc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
994
994
  /**
995
995
  * @license
996
996
  * Copyright 2017 Google LLC
@@ -1006,7 +1006,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
1006
1006
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1007
1007
  * See the License for the specific language governing permissions and
1008
1008
  * limitations under the License.
1009
- */class fc{constructor(t){this.count=t}}
1009
+ */class mc{constructor(t){this.count=t}}
1010
1010
  /**
1011
1011
  * @license
1012
1012
  * Copyright 2017 Google LLC
@@ -1022,7 +1022,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
1022
1022
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1023
1023
  * See the License for the specific language governing permissions and
1024
1024
  * limitations under the License.
1025
- */var pc,gc;function mc(t){if(void 0===t)return bi("GRPC error has no .code"),Di.UNKNOWN;switch(t){case pc.OK:return Di.OK;case pc.CANCELLED:return Di.CANCELLED;case pc.UNKNOWN:return Di.UNKNOWN;case pc.DEADLINE_EXCEEDED:return Di.DEADLINE_EXCEEDED;case pc.RESOURCE_EXHAUSTED:return Di.RESOURCE_EXHAUSTED;case pc.INTERNAL:return Di.INTERNAL;case pc.UNAVAILABLE:return Di.UNAVAILABLE;case pc.UNAUTHENTICATED:return Di.UNAUTHENTICATED;case pc.INVALID_ARGUMENT:return Di.INVALID_ARGUMENT;case pc.NOT_FOUND:return Di.NOT_FOUND;case pc.ALREADY_EXISTS:return Di.ALREADY_EXISTS;case pc.PERMISSION_DENIED:return Di.PERMISSION_DENIED;case pc.FAILED_PRECONDITION:return Di.FAILED_PRECONDITION;case pc.ABORTED:return Di.ABORTED;case pc.OUT_OF_RANGE:return Di.OUT_OF_RANGE;case pc.UNIMPLEMENTED:return Di.UNIMPLEMENTED;case pc.DATA_LOSS:return Di.DATA_LOSS;default:return ki()}}(gc=pc||(pc={}))[gc.OK=0]="OK",gc[gc.CANCELLED=1]="CANCELLED",gc[gc.UNKNOWN=2]="UNKNOWN",gc[gc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",gc[gc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",gc[gc.NOT_FOUND=5]="NOT_FOUND",gc[gc.ALREADY_EXISTS=6]="ALREADY_EXISTS",gc[gc.PERMISSION_DENIED=7]="PERMISSION_DENIED",gc[gc.UNAUTHENTICATED=16]="UNAUTHENTICATED",gc[gc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",gc[gc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",gc[gc.ABORTED=10]="ABORTED",gc[gc.OUT_OF_RANGE=11]="OUT_OF_RANGE",gc[gc.UNIMPLEMENTED=12]="UNIMPLEMENTED",gc[gc.INTERNAL=13]="INTERNAL",gc[gc.UNAVAILABLE=14]="UNAVAILABLE",gc[gc.DATA_LOSS=15]="DATA_LOSS";
1025
+ */var yc,vc;function wc(t){if(void 0===t)return ki("GRPC error has no .code"),Pi.UNKNOWN;switch(t){case yc.OK:return Pi.OK;case yc.CANCELLED:return Pi.CANCELLED;case yc.UNKNOWN:return Pi.UNKNOWN;case yc.DEADLINE_EXCEEDED:return Pi.DEADLINE_EXCEEDED;case yc.RESOURCE_EXHAUSTED:return Pi.RESOURCE_EXHAUSTED;case yc.INTERNAL:return Pi.INTERNAL;case yc.UNAVAILABLE:return Pi.UNAVAILABLE;case yc.UNAUTHENTICATED:return Pi.UNAUTHENTICATED;case yc.INVALID_ARGUMENT:return Pi.INVALID_ARGUMENT;case yc.NOT_FOUND:return Pi.NOT_FOUND;case yc.ALREADY_EXISTS:return Pi.ALREADY_EXISTS;case yc.PERMISSION_DENIED:return Pi.PERMISSION_DENIED;case yc.FAILED_PRECONDITION:return Pi.FAILED_PRECONDITION;case yc.ABORTED:return Pi.ABORTED;case yc.OUT_OF_RANGE:return Pi.OUT_OF_RANGE;case yc.UNIMPLEMENTED:return Pi.UNIMPLEMENTED;case yc.DATA_LOSS:return Pi.DATA_LOSS;default:return Oi()}}(vc=yc||(yc={}))[vc.OK=0]="OK",vc[vc.CANCELLED=1]="CANCELLED",vc[vc.UNKNOWN=2]="UNKNOWN",vc[vc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",vc[vc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",vc[vc.NOT_FOUND=5]="NOT_FOUND",vc[vc.ALREADY_EXISTS=6]="ALREADY_EXISTS",vc[vc.PERMISSION_DENIED=7]="PERMISSION_DENIED",vc[vc.UNAUTHENTICATED=16]="UNAUTHENTICATED",vc[vc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",vc[vc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",vc[vc.ABORTED=10]="ABORTED",vc[vc.OUT_OF_RANGE=11]="OUT_OF_RANGE",vc[vc.UNIMPLEMENTED=12]="UNIMPLEMENTED",vc[vc.INTERNAL=13]="INTERNAL",vc[vc.UNAVAILABLE=14]="UNAVAILABLE",vc[vc.DATA_LOSS=15]="DATA_LOSS";
1026
1026
  /**
1027
1027
  * @license
1028
1028
  * Copyright 2017 Google LLC
@@ -1039,7 +1039,7 @@ class ua{constructor(t){this.comparator=t,this.data=new oa(this.comparator)}has(
1039
1039
  * See the License for the specific language governing permissions and
1040
1040
  * limitations under the License.
1041
1041
  */
1042
- class yc{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){lo(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return fo(this.inner)}size(){return this.innerSize}}
1042
+ class _c{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){go(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return mo(this.inner)}size(){return this.innerSize}}
1043
1043
  /**
1044
1044
  * @license
1045
1045
  * Copyright 2017 Google LLC
@@ -1055,7 +1055,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1055
1055
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1056
1056
  * See the License for the specific language governing permissions and
1057
1057
  * limitations under the License.
1058
- */const vc=new oa(Xi.comparator);function wc(){return vc}const _c=new oa(Xi.comparator);function Tc(...t){let e=_c;for(const n of t)e=e.insert(n.key,n);return e}function Ec(t){let e=_c;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Sc(){return bc()}function Ic(){return bc()}function bc(){return new yc((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Ac=new oa(Xi.comparator),Cc=new ua(Xi.comparator);function kc(...t){let e=Cc;for(const n of t)e=e.add(n);return e}const Rc=new ua(qi);function Nc(){return Rc}
1058
+ */const Tc=new ua(eo.comparator);function Ec(){return Tc}const Sc=new ua(eo.comparator);function Ic(...t){let e=Sc;for(const n of t)e=e.insert(n.key,n);return e}function bc(t){let e=Sc;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Ac(){return kc()}function Cc(){return kc()}function kc(){return new _c((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Nc=new ua(eo.comparator),Rc=new da(eo.comparator);function Oc(...t){let e=Rc;for(const n of t)e=e.add(n);return e}const Dc=new da(Gi);function Lc(){return Dc}
1059
1059
  /**
1060
1060
  * @license
1061
1061
  * Copyright 2017 Google LLC
@@ -1071,7 +1071,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1071
1071
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1072
1072
  * See the License for the specific language governing permissions and
1073
1073
  * limitations under the License.
1074
- */class Dc{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,Oc.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new Dc(Gi.min(),r,Nc(),wc(),kc())}}class Oc{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 Oc(n,e,kc(),kc(),kc())}}
1074
+ */class Pc{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,Mc.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new Pc(Yi.min(),r,Lc(),Ec(),Oc())}}class Mc{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 Mc(n,e,Oc(),Oc(),Oc())}}
1075
1075
  /**
1076
1076
  * @license
1077
1077
  * Copyright 2017 Google LLC
@@ -1087,7 +1087,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1087
1087
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1088
1088
  * See the License for the specific language governing permissions and
1089
1089
  * limitations under the License.
1090
- */class Lc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Pc{constructor(t,e){this.targetId=t,this.Et=e}}class Mc{constructor(t,e,n=mo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class xc{constructor(){this.At=0,this.Rt=Vc(),this.bt=mo.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=kc(),e=kc(),n=kc();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:ki()}})),new Oc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=Vc()}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 Uc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=wc(),this.qt=Fc(),this.Ut=new ua(qi)}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:ki()}}))}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(wa(t))if(0===n){const n=new Xi(t.path);this.Qt(e,n,pa.newNoDocument(n,Gi.min()))}else Ri(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&&wa(s.target)){const e=new Xi(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,pa.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=kc();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 Dc(t,e,this.Ut,this.Lt,n);return this.Lt=wc(),this.qt=Fc(),this.Ut=new ua(qi),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 xc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new ua(qi),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Ii("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 xc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Fc(){return new oa(Xi.comparator)}function Vc(){return new oa(Xi.comparator)}
1090
+ */class xc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Uc{constructor(t,e){this.targetId=t,this.Et=e}}class Fc{constructor(t,e,n=wo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Vc{constructor(){this.At=0,this.Rt=jc(),this.bt=wo.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=Oc(),e=Oc(),n=Oc();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:Oi()}})),new Mc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=jc()}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 Bc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ec(),this.qt=Hc(),this.Ut=new da(Gi)}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:Oi()}}))}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(Ea(t))if(0===n){const n=new eo(t.path);this.Qt(e,n,ya.newNoDocument(n,Yi.min()))}else Di(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&&Ea(s.target)){const e=new eo(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,ya.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Oc();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 Pc(t,e,this.Ut,this.Lt,n);return this.Lt=Ec(),this.qt=Hc(),this.Ut=new da(Gi),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 Vc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new da(Gi),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Ci("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 Vc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Hc(){return new ua(eo.comparator)}function jc(){return new ua(eo.comparator)}
1091
1091
  /**
1092
1092
  * @license
1093
1093
  * Copyright 2017 Google LLC
@@ -1103,7 +1103,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1103
1103
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1104
1104
  * See the License for the specific language governing permissions and
1105
1105
  * limitations under the License.
1106
- */const Bc={asc:"ASCENDING",desc:"DESCENDING"},Hc={"<":"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"},jc={and:"AND",or:"OR"};class $c{constructor(t,e){this.databaseId=t,this.wt=e}}function qc(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 Kc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Wc(t,e){return qc(t,e.toTimestamp())}function Gc(t){return Ri(!!t),Gi.fromTimestamp(function(t){const e=vo(t);return new Wi(e.seconds,e.nanos)}(t))}function zc(t,e){return function(t){return new Qi(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Qc(t){const e=Qi.fromString(t);return Ri(fu(e)),e}function Yc(t,e){return zc(t.databaseId,e.path)}function Jc(t,e){const n=Qc(e);if(n.get(1)!==t.databaseId.projectId)throw new Oi(Di.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 Oi(Di.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Xi(tu(n))}function Xc(t,e){return zc(t.databaseId,e)}function Zc(t){return new Qi(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function tu(t){return Ri(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function eu(t,e,n){return{name:Yc(t,e),fields:n.value.mapValue.fields}}function nu(t,e){return{documents:[Xc(t,e.path)]}}function ru(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Xc(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xc(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return lu(qo.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:uu(t.field),direction:ou(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||po(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 su(t){let e=function(t){const e=Qc(t);return 4===e.length?Qi.emptyPath():tu(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Ri(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=iu(t);return e instanceof qo&&Wo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new sa(hu(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,po(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Vo(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new Vo(n,e)}(n.endAt)),function(t,e,n,r,s,i,o,a){return new _a(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function iu(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=hu(t.unaryFilter.field);return $o.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=hu(t.unaryFilter.field);return $o.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=hu(t.unaryFilter.field);return $o.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=hu(t.unaryFilter.field);return $o.create(s,"!=",{nullValue:"NULL_VALUE"});default:return ki()}}(t):void 0!==t.fieldFilter?function(t){return $o.create(hu(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 ki()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return qo.create(t.compositeFilter.filters.map((t=>iu(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return ki()}}(t.compositeFilter.op))}(t):ki()}function ou(t){return Bc[t]}function au(t){return Hc[t]}function cu(t){return jc[t]}function uu(t){return{fieldPath:t.canonicalString()}}function hu(t){return Ji.fromServerFormat(t.fieldPath)}function lu(t){return t instanceof $o?function(t){if("=="===t.op){if(xo(t.value))return{unaryFilter:{field:uu(t.field),op:"IS_NAN"}};if(Mo(t.value))return{unaryFilter:{field:uu(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(xo(t.value))return{unaryFilter:{field:uu(t.field),op:"IS_NOT_NAN"}};if(Mo(t.value))return{unaryFilter:{field:uu(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:uu(t.field),op:au(t.op),value:t.value}}}(t):t instanceof qo?function(t){const e=t.getFilters().map((t=>lu(t)));return 1===e.length?e[0]:{compositeFilter:{op:cu(t.op),filters:e}}}(t):ki()}function du(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function fu(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1106
+ */const $c={asc:"ASCENDING",desc:"DESCENDING"},qc={"<":"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"},Kc={and:"AND",or:"OR"};class Wc{constructor(t,e){this.databaseId=t,this.wt=e}}function Gc(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 zc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Qc(t,e){return Gc(t,e.toTimestamp())}function Yc(t){return Di(!!t),Yi.fromTimestamp(function(t){const e=To(t);return new Qi(e.seconds,e.nanos)}(t))}function Jc(t,e){return function(t){return new Xi(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Xc(t){const e=Xi.fromString(t);return Di(mu(e)),e}function Zc(t,e){return Jc(t.databaseId,e.path)}function tu(t,e){const n=Xc(e);if(n.get(1)!==t.databaseId.projectId)throw new Mi(Pi.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 Mi(Pi.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new eo(ru(n))}function eu(t,e){return Jc(t.databaseId,e)}function nu(t){return new Xi(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function ru(t){return Di(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function su(t,e,n){return{name:Zc(t,e),fields:n.value.mapValue.fields}}function iu(t,e){return{documents:[eu(t,e.path)]}}function ou(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=eu(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=eu(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return pu(Go.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:du(t.field),direction:uu(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||yo(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 au(t){let e=function(t){const e=Xc(t);return 4===e.length?Xi.emptyPath():ru(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Di(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=cu(t);return e instanceof Go&&Qo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new aa(fu(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,yo(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new jo(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new jo(n,e)}(n.endAt)),function(t,e,n,r,s,i,o,a){return new Sa(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function cu(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=fu(t.unaryFilter.field);return Wo.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=fu(t.unaryFilter.field);return Wo.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=fu(t.unaryFilter.field);return Wo.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=fu(t.unaryFilter.field);return Wo.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Oi()}}(t):void 0!==t.fieldFilter?function(t){return Wo.create(fu(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 Oi()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Go.create(t.compositeFilter.filters.map((t=>cu(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Oi()}}(t.compositeFilter.op))}(t):Oi()}function uu(t){return $c[t]}function hu(t){return qc[t]}function lu(t){return Kc[t]}function du(t){return{fieldPath:t.canonicalString()}}function fu(t){return to.fromServerFormat(t.fieldPath)}function pu(t){return t instanceof Wo?function(t){if("=="===t.op){if(Vo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NAN"}};if(Fo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Vo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NOT_NAN"}};if(Fo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:du(t.field),op:hu(t.op),value:t.value}}}(t):t instanceof Go?function(t){const e=t.getFilters().map((t=>pu(t)));return 1===e.length?e[0]:{compositeFilter:{op:lu(t.op),filters:e}}}(t):Oi()}function gu(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function mu(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1107
1107
  /**
1108
1108
  * @license
1109
1109
  * Copyright 2017 Google LLC
@@ -1119,7 +1119,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1119
1119
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1120
1120
  * See the License for the specific language governing permissions and
1121
1121
  * limitations under the License.
1122
- */class pu{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)&&nc(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=rc(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=rc(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ic();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=ec(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(Gi.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),kc())}isEqual(t){return this.batchId===t.batchId&&Ki(this.mutations,t.mutations,((t,e)=>ic(t,e)))&&Ki(this.baseMutations,t.baseMutations,((t,e)=>ic(t,e)))}}class gu{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Ri(t.mutations.length===n.length);let r=Ac;const s=t.mutations;for(let t=0;t<s.length;t++)r=r.insert(s[t].key,n[t].version);return new gu(t,e,n,r)}}
1122
+ */class yu{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)&&ic(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=oc(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=oc(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Cc();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=sc(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(Yi.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Oc())}isEqual(t){return this.batchId===t.batchId&&zi(this.mutations,t.mutations,((t,e)=>cc(t,e)))&&zi(this.baseMutations,t.baseMutations,((t,e)=>cc(t,e)))}}class vu{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Di(t.mutations.length===n.length);let r=Nc;const s=t.mutations;for(let t=0;t<s.length;t++)r=r.insert(s[t].key,n[t].version);return new vu(t,e,n,r)}}
1123
1123
  /**
1124
1124
  * @license
1125
1125
  * Copyright 2022 Google LLC
@@ -1135,7 +1135,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1135
1135
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1136
1136
  * See the License for the specific language governing permissions and
1137
1137
  * limitations under the License.
1138
- */class mu{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 }`}}
1138
+ */class wu{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 }`}}
1139
1139
  /**
1140
1140
  * @license
1141
1141
  * Copyright 2017 Google LLC
@@ -1151,7 +1151,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1151
1151
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1152
1152
  * See the License for the specific language governing permissions and
1153
1153
  * limitations under the License.
1154
- */class yu{constructor(t,e,n,r,s=Gi.min(),i=Gi.min(),o=mo.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 yu(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new yu(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new yu(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
1154
+ */class _u{constructor(t,e,n,r,s=Yi.min(),i=Yi.min(),o=wo.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 _u(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new _u(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new _u(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
1155
1155
  /**
1156
1156
  * @license
1157
1157
  * Copyright 2017 Google LLC
@@ -1167,7 +1167,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1167
1167
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1168
1168
  * See the License for the specific language governing permissions and
1169
1169
  * limitations under the License.
1170
- */class vu{constructor(t){this.ie=t}}function wu(t){const e=su({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Ra(e,e.limit,"L"):e}
1170
+ */class Tu{constructor(t){this.ie=t}}function Eu(t){const e=au({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Da(e,e.limit,"L"):e}
1171
1171
  /**
1172
1172
  * @license
1173
1173
  * Copyright 2019 Google LLC
@@ -1183,7 +1183,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1183
1183
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1184
1184
  * See the License for the specific language governing permissions and
1185
1185
  * limitations under the License.
1186
- */class _u{constructor(){this.Je=new Tu}addToCollectionParentIndex(t,e){return this.Je.add(e),io.resolve()}getCollectionParents(t,e){return io.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return io.resolve()}deleteFieldIndex(t,e){return io.resolve()}getDocumentsMatchingTarget(t,e){return io.resolve(null)}getIndexType(t,e){return io.resolve(0)}getFieldIndexes(t,e){return io.resolve([])}getNextCollectionGroupToUpdate(t){return io.resolve(null)}getMinOffset(t,e){return io.resolve(to.min())}getMinOffsetFromCollectionGroup(t,e){return io.resolve(to.min())}updateCollectionGroup(t,e,n){return io.resolve()}updateIndexEntries(t,e){return io.resolve()}}class Tu{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new ua(Qi.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 ua(Qi.comparator)).toArray()}}
1186
+ */class Su{constructor(){this.Je=new Iu}addToCollectionParentIndex(t,e){return this.Je.add(e),co.resolve()}getCollectionParents(t,e){return co.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return co.resolve()}deleteFieldIndex(t,e){return co.resolve()}getDocumentsMatchingTarget(t,e){return co.resolve(null)}getIndexType(t,e){return co.resolve(0)}getFieldIndexes(t,e){return co.resolve([])}getNextCollectionGroupToUpdate(t){return co.resolve(null)}getMinOffset(t,e){return co.resolve(ro.min())}getMinOffsetFromCollectionGroup(t,e){return co.resolve(ro.min())}updateCollectionGroup(t,e,n){return co.resolve()}updateIndexEntries(t,e){return co.resolve()}}class Iu{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new da(Xi.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 da(Xi.comparator)).toArray()}}
1187
1187
  /**
1188
1188
  * @license
1189
1189
  * Copyright 2017 Google LLC
@@ -1199,7 +1199,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1199
1199
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1200
1200
  * See the License for the specific language governing permissions and
1201
1201
  * limitations under the License.
1202
- */class Eu{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new Eu(0)}static vn(){return new Eu(-1)}}
1202
+ */class bu{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new bu(0)}static vn(){return new bu(-1)}}
1203
1203
  /**
1204
1204
  * @license
1205
1205
  * Copyright 2017 Google LLC
@@ -1215,7 +1215,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1215
1215
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1216
1216
  * See the License for the specific language governing permissions and
1217
1217
  * limitations under the License.
1218
- */class Su{constructor(){this.changes=new yc((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,pa.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?io.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(){}}
1218
+ */class Au{constructor(){this.changes=new _c((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,ya.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?co.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(){}}
1219
1219
  /**
1220
1220
  * @license
1221
1221
  * Copyright 2017 Google LLC
@@ -1247,7 +1247,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1247
1247
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1248
1248
  * See the License for the specific language governing permissions and
1249
1249
  * limitations under the License.
1250
- */class Iu{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
1250
+ */class Cu{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
1251
1251
  /**
1252
1252
  * @license
1253
1253
  * Copyright 2017 Google LLC
@@ -1263,7 +1263,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1263
1263
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1264
1264
  * See the License for the specific language governing permissions and
1265
1265
  * limitations under the License.
1266
- */class bu{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&&rc(n.mutation,t,la.empty(),Wi.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,kc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=kc()){const r=Sc();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Tc();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Sc();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,kc())))}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=wc();const i=bc(),o=bc();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof ac)?s=s.insert(e.key,e):void 0!==o&&(i.set(e.key,o.mutation.getFieldMask()),rc(o.mutation,e,o.mutation.getFieldMask(),Wi.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 Iu(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=bc();let r=new oa(((t,e)=>t-e)),s=kc();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)||la.empty();o=s.applyToLocalView(i,o),n.set(t,o);const a=(r.get(s.batchId)||kc()).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=Ic();c.forEach((t=>{if(!s.has(t)){const r=ec(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 io.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 Xi.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):ba(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):io.resolve(Sc());let o=-1,a=s;return i.next((e=>io.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(e)?io.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,kc()))).next((t=>({batchId:o,changes:Ec(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new Xi(e)).next((t=>{let e=Tc();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let s=Tc();return this.indexManager.getCollectionParents(t,r).next((i=>io.forEach(i,(i=>{const o=function(t,e){return new _a(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,pa.newInvalidDocument(n)))}));let n=Tc();return r.forEach(((r,s)=>{const i=t.get(r);void 0!==i&&rc(i.mutation,s,la.empty(),Wi.now()),La(e,s)&&(n=n.insert(r,s))})),n}))}}
1266
+ */class ku{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&&oc(n.mutation,t,pa.empty(),Qi.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Oc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Oc()){const r=Ac();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Ic();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Ac();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Oc())))}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=Ec();const i=kc(),o=kc();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof hc)?s=s.insert(e.key,e):void 0!==o&&(i.set(e.key,o.mutation.getFieldMask()),oc(o.mutation,e,o.mutation.getFieldMask(),Qi.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 Cu(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=kc();let r=new ua(((t,e)=>t-e)),s=Oc();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)||pa.empty();o=s.applyToLocalView(i,o),n.set(t,o);const a=(r.get(s.batchId)||Oc()).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=Cc();c.forEach((t=>{if(!s.has(t)){const r=sc(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 co.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 eo.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):ka(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):co.resolve(Ac());let o=-1,a=s;return i.next((e=>co.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(e)?co.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,Oc()))).next((t=>({batchId:o,changes:bc(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new eo(e)).next((t=>{let e=Ic();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let s=Ic();return this.indexManager.getCollectionParents(t,r).next((i=>co.forEach(i,(i=>{const o=function(t,e){return new Sa(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,ya.newInvalidDocument(n)))}));let n=Ic();return r.forEach(((r,s)=>{const i=t.get(r);void 0!==i&&oc(i.mutation,s,pa.empty(),Qi.now()),xa(e,s)&&(n=n.insert(r,s))})),n}))}}
1267
1267
  /**
1268
1268
  * @license
1269
1269
  * Copyright 2020 Google LLC
@@ -1279,7 +1279,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1279
1279
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1280
1280
  * See the License for the specific language governing permissions and
1281
1281
  * limitations under the License.
1282
- */class Au{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return io.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Gc(n.createTime)}),io.resolve()}getNamedQuery(t,e){return io.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:wu(t.bundledQuery),readTime:Gc(t.readTime)}}(e)),io.resolve()}}
1282
+ */class Nu{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return co.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Yc(n.createTime)}),co.resolve()}getNamedQuery(t,e){return co.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:Eu(t.bundledQuery),readTime:Yc(t.readTime)}}(e)),co.resolve()}}
1283
1283
  /**
1284
1284
  * @license
1285
1285
  * Copyright 2022 Google LLC
@@ -1295,7 +1295,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1295
1295
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1296
1296
  * See the License for the specific language governing permissions and
1297
1297
  * limitations under the License.
1298
- */class Cu{constructor(){this.overlays=new oa(Xi.comparator),this.es=new Map}getOverlay(t,e){return io.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Sc();return io.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)})),io.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)),io.resolve()}getOverlaysForCollection(t,e,n){const r=Sc(),s=e.length+1,i=new Xi(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 io.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let s=new oa(((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=Sc(),s=s.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Sc(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return io.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 mu(e,n));let s=this.es.get(e);void 0===s&&(s=kc(),this.es.set(e,s)),this.es.set(e,s.add(n.key))}}
1298
+ */class Ru{constructor(){this.overlays=new ua(eo.comparator),this.es=new Map}getOverlay(t,e){return co.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Ac();return co.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)})),co.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)),co.resolve()}getOverlaysForCollection(t,e,n){const r=Ac(),s=e.length+1,i=new eo(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 co.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let s=new ua(((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=Ac(),s=s.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Ac(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return co.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 wu(e,n));let s=this.es.get(e);void 0===s&&(s=Oc(),this.es.set(e,s)),this.es.set(e,s.add(n.key))}}
1299
1299
  /**
1300
1300
  * @license
1301
1301
  * Copyright 2017 Google LLC
@@ -1311,7 +1311,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1311
1311
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312
1312
  * See the License for the specific language governing permissions and
1313
1313
  * limitations under the License.
1314
- */class ku{constructor(){this.ns=new ua(Ru.ss),this.rs=new ua(Ru.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Ru(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 Ru(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new Xi(new Qi([])),n=new Ru(e,t),r=new Ru(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 Xi(new Qi([])),n=new Ru(e,t),r=new Ru(e,t+1);let s=kc();return this.rs.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new Ru(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ru{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return Xi.comparator(t.key,e.key)||qi(t._s,e._s)}static os(t,e){return qi(t._s,e._s)||Xi.comparator(t.key,e.key)}}
1314
+ */class Ou{constructor(){this.ns=new da(Du.ss),this.rs=new da(Du.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Du(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 Du(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new eo(new Xi([])),n=new Du(e,t),r=new Du(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 eo(new Xi([])),n=new Du(e,t),r=new Du(e,t+1);let s=Oc();return this.rs.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new Du(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Du{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return eo.comparator(t.key,e.key)||Gi(t._s,e._s)}static os(t,e){return Gi(t._s,e._s)||eo.comparator(t.key,e.key)}}
1315
1315
  /**
1316
1316
  * @license
1317
1317
  * Copyright 2017 Google LLC
@@ -1327,7 +1327,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1327
1327
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1328
1328
  * See the License for the specific language governing permissions and
1329
1329
  * limitations under the License.
1330
- */class Nu{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new ua(Ru.ss)}checkEmpty(t){return io.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 pu(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.gs=this.gs.add(new Ru(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return io.resolve(i)}lookupMutationBatch(t,e){return io.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),s=r<0?0:r;return io.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return io.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return io.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ru(e,0),r=new Ru(e,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);s.push(e)})),io.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new ua(qi);return e.forEach((t=>{const e=new Ru(t,0),r=new Ru(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),io.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;Xi.isDocumentKey(s)||(s=s.child(""));const i=new Ru(new Xi(s),0);let o=new ua(qi);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),i),io.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){Ri(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return io.forEach(e.mutations,(r=>{const s=new Ru(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 Ru(e,0),r=this.gs.firstAfterOrEqual(n);return io.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,io.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]}}
1330
+ */class Lu{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new da(Du.ss)}checkEmpty(t){return co.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 yu(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.gs=this.gs.add(new Du(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return co.resolve(i)}lookupMutationBatch(t,e){return co.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),s=r<0?0:r;return co.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return co.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return co.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Du(e,0),r=new Du(e,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);s.push(e)})),co.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new da(Gi);return e.forEach((t=>{const e=new Du(t,0),r=new Du(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),co.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;eo.isDocumentKey(s)||(s=s.child(""));const i=new Du(new eo(s),0);let o=new da(Gi);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),i),co.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){Di(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return co.forEach(e.mutations,(r=>{const s=new Du(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 Du(e,0),r=this.gs.firstAfterOrEqual(n);return co.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,co.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]}}
1331
1331
  /**
1332
1332
  * @license
1333
1333
  * Copyright 2017 Google LLC
@@ -1343,7 +1343,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1343
1343
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1344
1344
  * See the License for the specific language governing permissions and
1345
1345
  * limitations under the License.
1346
- */class Du{constructor(t){this.Es=t,this.docs=new oa(Xi.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 io.resolve(n?n.document.mutableCopy():pa.newInvalidDocument(e))}getEntries(t,e){let n=wc();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():pa.newInvalidDocument(t))})),io.resolve(n)}getAllFromCollection(t,e,n){let r=wc();const s=new Xi(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||eo(Zi(s),n)<=0||(r=r.insert(s.key,s.mutableCopy()))}return io.resolve(r)}getAllFromCollectionGroup(t,e,n,r){ki()}As(t,e){return io.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Ou(this)}getSize(t){return io.resolve(this.size)}}class Ou extends Su{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)})),io.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
1346
+ */class Pu{constructor(t){this.Es=t,this.docs=new ua(eo.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 co.resolve(n?n.document.mutableCopy():ya.newInvalidDocument(e))}getEntries(t,e){let n=Ec();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():ya.newInvalidDocument(t))})),co.resolve(n)}getAllFromCollection(t,e,n){let r=Ec();const s=new eo(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||so(no(s),n)<=0||(r=r.insert(s.key,s.mutableCopy()))}return co.resolve(r)}getAllFromCollectionGroup(t,e,n,r){Oi()}As(t,e){return co.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Mu(this)}getSize(t){return co.resolve(this.size)}}class Mu extends Au{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)})),co.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
1347
1347
  /**
1348
1348
  * @license
1349
1349
  * Copyright 2017 Google LLC
@@ -1359,7 +1359,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1359
1359
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1360
1360
  * See the License for the specific language governing permissions and
1361
1361
  * limitations under the License.
1362
- */class Lu{constructor(t){this.persistence=t,this.Rs=new yc((t=>ya(t)),va),this.lastRemoteSnapshotVersion=Gi.min(),this.highestTargetId=0,this.bs=0,this.Ps=new ku,this.targetCount=0,this.vs=Eu.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),io.resolve()}getLastRemoteSnapshotVersion(t){return io.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return io.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),io.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),io.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new Eu(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,io.resolve()}updateTargetData(t,e){return this.Dn(e),io.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,io.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++)})),io.waitFor(s).next((()=>r))}getTargetCount(t){return io.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return io.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),io.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))})),io.waitFor(s)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),io.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return io.resolve(n)}containsKey(t,e){return io.resolve(this.Ps.containsKey(e))}}
1362
+ */class xu{constructor(t){this.persistence=t,this.Rs=new _c((t=>_a(t)),Ta),this.lastRemoteSnapshotVersion=Yi.min(),this.highestTargetId=0,this.bs=0,this.Ps=new Ou,this.targetCount=0,this.vs=bu.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),co.resolve()}getLastRemoteSnapshotVersion(t){return co.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return co.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),co.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),co.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new bu(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,co.resolve()}updateTargetData(t,e){return this.Dn(e),co.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,co.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++)})),co.waitFor(s).next((()=>r))}getTargetCount(t){return co.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return co.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),co.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))})),co.waitFor(s)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),co.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return co.resolve(n)}containsKey(t,e){return co.resolve(this.Ps.containsKey(e))}}
1363
1363
  /**
1364
1364
  * @license
1365
1365
  * Copyright 2017 Google LLC
@@ -1375,7 +1375,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1375
1375
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1376
1376
  * See the License for the specific language governing permissions and
1377
1377
  * limitations under the License.
1378
- */class Pu{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new ao(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Lu(this),this.indexManager=new _u,this.remoteDocumentCache=function(t){return new Du(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new vu(e),this.Ns=new Au(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 Cu,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Nu(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){Ii("MemoryPersistence","Starting transaction:",t);const r=new Mu(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 io.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Mu extends ro{constructor(t){super(),this.currentSequenceNumber=t}}class xu{constructor(t){this.persistence=t,this.Fs=new ku,this.$s=null}static Bs(t){return new xu(t)}get Ls(){if(this.$s)return this.$s;throw ki()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),io.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),io.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),io.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 io.forEach(this.Ls,(n=>{const r=Xi.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,Gi.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 io.or([()=>io.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
1378
+ */class Uu{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new ho(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new xu(this),this.indexManager=new Su,this.remoteDocumentCache=function(t){return new Pu(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new Tu(e),this.Ns=new Nu(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 Ru,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Lu(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){Ci("MemoryPersistence","Starting transaction:",t);const r=new Fu(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 co.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Fu extends oo{constructor(t){super(),this.currentSequenceNumber=t}}class Vu{constructor(t){this.persistence=t,this.Fs=new Ou,this.$s=null}static Bs(t){return new Vu(t)}get Ls(){if(this.$s)return this.$s;throw Oi()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),co.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),co.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),co.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 co.forEach(this.Ls,(n=>{const r=eo.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,Yi.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 co.or([()=>co.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
1379
1379
  /**
1380
1380
  * @license
1381
1381
  * Copyright 2017 Google LLC
@@ -1391,7 +1391,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1391
1391
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1392
1392
  * See the License for the specific language governing permissions and
1393
1393
  * limitations under the License.
1394
- */class Uu{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=kc(),r=kc();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 Uu(t,e.fromCache,n,r)}}
1394
+ */class Bu{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=Oc(),r=Oc();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 Bu(t,e.fromCache,n,r)}}
1395
1395
  /**
1396
1396
  * @license
1397
1397
  * Copyright 2019 Google LLC
@@ -1407,7 +1407,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1407
1407
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1408
1408
  * See the License for the specific language governing permissions and
1409
1409
  * limitations under the License.
1410
- */class Fu{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(Ea(e))return io.resolve(null);let n=Ca(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=Ra(e,null,"F"),n=Ca(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=kc(...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,Ra(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,r){return Ea(e)||r.isEqual(Gi.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):(Si()<=ce.DEBUG&&Ii("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Oa(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=Gi.fromTimestamp(1e9===r?new Wi(n+1,0):new Wi(n,r));return new to(s,Xi.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new ua(Pa(t));return e.forEach(((e,r)=>{La(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 Si()<=ce.DEBUG&&Ii("QueryEngine","Using full collection scan to execute query:",Oa(e)),this.Ni.getDocumentsMatchingQuery(t,e,to.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)))}}
1410
+ */class Hu{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(ba(e))return co.resolve(null);let n=Ra(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=Da(e,null,"F"),n=Ra(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=Oc(...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,Da(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,r){return ba(e)||r.isEqual(Yi.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):(Ai()<=le.DEBUG&&Ci("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Ma(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=Yi.fromTimestamp(1e9===r?new Qi(n+1,0):new Qi(n,r));return new ro(s,eo.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new da(Ua(t));return e.forEach(((e,r)=>{xa(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 Ai()<=le.DEBUG&&Ci("QueryEngine","Using full collection scan to execute query:",Ma(e)),this.Ni.getDocumentsMatchingQuery(t,e,ro.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)))}}
1411
1411
  /**
1412
1412
  * @license
1413
1413
  * Copyright 2020 Google LLC
@@ -1423,7 +1423,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1423
1423
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1424
1424
  * See the License for the specific language governing permissions and
1425
1425
  * limitations under the License.
1426
- */class Vu{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new oa(qi),this.Ui=new yc((t=>ya(t)),va),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 bu(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 Bu(t,e){const n=Ni(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=kc();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 Hu(t){const e=Ni(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function ju(t,e){const n=Ni(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(mo.EMPTY_BYTE_STRING,Gi.min()).withLastLimboFreeSnapshotVersion(Gi.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=wc(),c=kc();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=kc(),s=kc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=wc();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(Gi.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)):Ii("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(Gi.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return io.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}function $u(t,e){const n=Ni(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function qu(t,e,n){const r=Ni(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(!oo(t))throw t;Ii("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function Ku(t,e,n){const r=Ni(t);let s=Gi.min(),i=kc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Ni(t),s=r.Ui.get(n);return void 0!==s?io.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Ca(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:Gi.min(),n?i:kc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Gi.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 Wu{constructor(){this.activeTargetIds=Nc()}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 Gu{constructor(){this.Lr=new Wu,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 Wu,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1426
+ */class ju{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new ua(Gi),this.Ui=new _c((t=>_a(t)),Ta),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 ku(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 $u(t,e){const n=Li(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=Oc();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 qu(t){const e=Li(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Ku(t,e){const n=Li(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(wo.EMPTY_BYTE_STRING,Yi.min()).withLastLimboFreeSnapshotVersion(Yi.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=Ec(),c=Oc();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=Oc(),s=Oc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ec();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(Yi.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)):Ci("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(Yi.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return co.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}function Wu(t,e){const n=Li(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function Gu(t,e,n){const r=Li(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(!uo(t))throw t;Ci("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function zu(t,e,n){const r=Li(t);let s=Yi.min(),i=Oc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Li(t),s=r.Ui.get(n);return void 0!==s?co.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Ra(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:Yi.min(),n?i:Oc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Yi.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 Qu{constructor(){this.activeTargetIds=Lc()}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 Yu{constructor(){this.Lr=new Qu,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 Qu,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1427
1427
  /**
1428
1428
  * @license
1429
1429
  * Copyright 2019 Google LLC
@@ -1439,7 +1439,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1439
1439
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1440
1440
  * See the License for the specific language governing permissions and
1441
1441
  * limitations under the License.
1442
- */class zu{Ur(t){}shutdown(){}}
1442
+ */class Ju{Ur(t){}shutdown(){}}
1443
1443
  /**
1444
1444
  * @license
1445
1445
  * Copyright 2019 Google LLC
@@ -1455,7 +1455,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1455
1455
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1456
1456
  * See the License for the specific language governing permissions and
1457
1457
  * limitations under the License.
1458
- */class Qu{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(){Ii("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Ii("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}}
1458
+ */class Xu{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(){Ci("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Ci("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}}
1459
1459
  /**
1460
1460
  * @license
1461
1461
  * Copyright 2020 Google LLC
@@ -1471,7 +1471,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1471
1471
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1472
1472
  * See the License for the specific language governing permissions and
1473
1473
  * limitations under the License.
1474
- */const Yu={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1474
+ */const Zu={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1475
1475
  /**
1476
1476
  * @license
1477
1477
  * Copyright 2017 Google LLC
@@ -1487,7 +1487,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1487
1487
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1488
1488
  * See the License for the specific language governing permissions and
1489
1489
  * limitations under the License.
1490
- */class Ju{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)}}
1490
+ */class th{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)}}
1491
1491
  /**
1492
1492
  * @license
1493
1493
  * Copyright 2017 Google LLC
@@ -1503,7 +1503,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1503
1503
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1504
1504
  * See the License for the specific language governing permissions and
1505
1505
  * limitations under the License.
1506
- */class Xu 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);Ii("RestConnection","Sending: ",i,n);const o={};return this.lo(o,r,s),this.fo(t,i,o,n).then((t=>(Ii("RestConnection","Received: ",t),t)),(e=>{throw Ai("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/"+Ti,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=Yu[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 vi;o.setWithCredentials(!0),o.listenOnce(di.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case li.NO_ERROR:const e=o.getResponseJson();Ii("Connection","XHR received:",JSON.stringify(e)),s(e);break;case li.TIMEOUT:Ii("Connection",'RPC "'+t+'" timed out'),i(new Oi(Di.DEADLINE_EXCEEDED,"Request time out"));break;case li.HTTP_ERROR:const n=o.getStatus();if(Ii("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(Di).indexOf(e)>=0?e:Di.UNKNOWN}(e.status);i(new Oi(t,e.message))}else i(new Oi(Di.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new Oi(Di.UNAVAILABLE,"Connection failed."));break;default:ki()}}finally{Ii("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 oi,i=sr(),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 mi({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Ii("Connection","Creating WebChannel: "+a,o);const c=s.createWebChannel(a,o);let u=!1,h=!1;const l=new Ju({Hr:t=>{h?Ii("Connection","Not sending because WebChannel is closed:",t):(u||(Ii("Connection","Opening WebChannel transport."),c.open(),u=!0),Ii("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,yi.EventType.OPEN,(()=>{h||Ii("Connection","WebChannel transport opened.")})),d(c,yi.EventType.CLOSE,(()=>{h||(h=!0,Ii("Connection","WebChannel transport closed"),l.io())})),d(c,yi.EventType.ERROR,(t=>{h||(h=!0,Ai("Connection","WebChannel transport errored:",t),l.io(new Oi(Di.UNAVAILABLE,"The operation could not be completed")))})),d(c,yi.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Ri(!!n);const r=n,s=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(s){Ii("Connection","WebChannel received error:",s);const t=s.status;let e=function(t){const e=pc[t];if(void 0!==e)return mc(e)}(t),n=s.message;void 0===e&&(e=Di.INTERNAL,n="Unknown error status: "+t+" with message "+s.message),h=!0,l.io(new Oi(e,n)),c.close()}else Ii("Connection","WebChannel received:",n),l.ro(n)}})),d(i,fi.STAT_EVENT,(t=>{t.stat===pi?Ii("Connection","Detected buffering proxy"):t.stat===gi&&Ii("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Zu(){return"undefined"!=typeof document?document:null}
1506
+ */class eh 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);Ci("RestConnection","Sending: ",i,n);const o={};return this.lo(o,r,s),this.fo(t,i,o,n).then((t=>(Ci("RestConnection","Received: ",t),t)),(e=>{throw Ni("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/"+Ii,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=Zu[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 Ti;o.setWithCredentials(!0),o.listenOnce(gi.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case pi.NO_ERROR:const e=o.getResponseJson();Ci("Connection","XHR received:",JSON.stringify(e)),s(e);break;case pi.TIMEOUT:Ci("Connection",'RPC "'+t+'" timed out'),i(new Mi(Pi.DEADLINE_EXCEEDED,"Request time out"));break;case pi.HTTP_ERROR:const n=o.getStatus();if(Ci("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(Pi).indexOf(e)>=0?e:Pi.UNKNOWN}(e.status);i(new Mi(t,e.message))}else i(new Mi(Pi.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new Mi(Pi.UNAVAILABLE,"Connection failed."));break;default:Oi()}}finally{Ci("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 ui,i=ar(),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 wi({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Ci("Connection","Creating WebChannel: "+a,o);const c=s.createWebChannel(a,o);let u=!1,h=!1;const l=new th({Hr:t=>{h?Ci("Connection","Not sending because WebChannel is closed:",t):(u||(Ci("Connection","Opening WebChannel transport."),c.open(),u=!0),Ci("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,_i.EventType.OPEN,(()=>{h||Ci("Connection","WebChannel transport opened.")})),d(c,_i.EventType.CLOSE,(()=>{h||(h=!0,Ci("Connection","WebChannel transport closed"),l.io())})),d(c,_i.EventType.ERROR,(t=>{h||(h=!0,Ni("Connection","WebChannel transport errored:",t),l.io(new Mi(Pi.UNAVAILABLE,"The operation could not be completed")))})),d(c,_i.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Di(!!n);const r=n,s=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(s){Ci("Connection","WebChannel received error:",s);const t=s.status;let e=function(t){const e=yc[t];if(void 0!==e)return wc(e)}(t),n=s.message;void 0===e&&(e=Pi.INTERNAL,n="Unknown error status: "+t+" with message "+s.message),h=!0,l.io(new Mi(e,n)),c.close()}else Ci("Connection","WebChannel received:",n),l.ro(n)}})),d(i,mi.STAT_EVENT,(t=>{t.stat===yi?Ci("Connection","Detected buffering proxy"):t.stat===vi&&Ci("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function nh(){return"undefined"!=typeof document?document:null}
1507
1507
  /**
1508
1508
  * @license
1509
1509
  * Copyright 2020 Google LLC
@@ -1519,7 +1519,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1519
1519
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1520
1520
  * See the License for the specific language governing permissions and
1521
1521
  * limitations under the License.
1522
- */function th(t){return new $c(t,!0)}class eh{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&&Ii("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}}
1522
+ */function rh(t){return new Wc(t,!0)}class sh{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&&Ci("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}}
1523
1523
  /**
1524
1524
  * @license
1525
1525
  * Copyright 2017 Google LLC
@@ -1535,7 +1535,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1535
1535
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1536
1536
  * See the License for the specific language governing permissions and
1537
1537
  * limitations under the License.
1538
- */class nh{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 eh(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===Di.RESOURCE_EXHAUSTED?(bi(e.toString()),bi("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Di.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 Oi(Di.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 Ii("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Ii("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class rh extends nh{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:ki()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Ri(void 0===e||"string"==typeof e),mo.fromBase64String(e||"")):(Ri(void 0===e||e instanceof Uint8Array),mo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Di.UNKNOWN:mc(t.code);return new Oi(e,t.message||"")}(o);n=new Mc(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=Jc(t,r.document.name),i=Gc(r.document.updateTime),o=r.document.createTime?Gc(r.document.createTime):Gi.min(),a=new da({mapValue:{fields:r.document.fields}}),c=pa.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new Lc(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Jc(t,r.document),i=r.readTime?Gc(r.readTime):Gi.min(),o=pa.newNoDocument(s,i),a=r.removedTargetIds||[];n=new Lc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Jc(t,r.document),i=r.removedTargetIds||[];n=new Lc([],i,s,null)}else{if(!("filter"in e))return ki();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new fc(r),i=t.targetId;n=new Pc(i,s)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Gi.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Gi.min():e.readTime?Gc(e.readTime):Gi.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Zc(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=wa(r)?{documents:nu(t,r)}:{query:ru(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Kc(t,e.resumeToken):e.snapshotVersion.compareTo(Gi.min())>0&&(n.readTime=qc(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 ki()}}(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=Zc(this.yt),e.removeTarget=t,this.Bo(e)}}class sh extends nh{constructor(t,e,n,r,s,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,i),this.yt=s,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Ri(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Ri(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Gc(t.updateTime):Gc(e);return n.isEqual(Gi.min())&&(n=Gc(e)),new Ja(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Gc(t.commitTime);return this.listener.Zo(n,e)}return Ri(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=Zc(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof oc)n={update:eu(t,e.key,e.value)};else if(e instanceof lc)n={delete:Yc(t,e.key)};else if(e instanceof ac)n={update:eu(t,e.key,e.data),updateMask:du(e.fieldMask)};else{if(!(e instanceof dc))return ki();n={verify:Yc(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof $a)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof qa)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Wa)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof za)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw ki()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Wc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:ki()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
1538
+ */class ih{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 sh(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===Pi.RESOURCE_EXHAUSTED?(ki(e.toString()),ki("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Pi.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 Mi(Pi.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 Ci("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Ci("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class oh extends ih{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:Oi()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Di(void 0===e||"string"==typeof e),wo.fromBase64String(e||"")):(Di(void 0===e||e instanceof Uint8Array),wo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Pi.UNKNOWN:wc(t.code);return new Mi(e,t.message||"")}(o);n=new Fc(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=tu(t,r.document.name),i=Yc(r.document.updateTime),o=r.document.createTime?Yc(r.document.createTime):Yi.min(),a=new ga({mapValue:{fields:r.document.fields}}),c=ya.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new xc(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=tu(t,r.document),i=r.readTime?Yc(r.readTime):Yi.min(),o=ya.newNoDocument(s,i),a=r.removedTargetIds||[];n=new xc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=tu(t,r.document),i=r.removedTargetIds||[];n=new xc([],i,s,null)}else{if(!("filter"in e))return Oi();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new mc(r),i=t.targetId;n=new Uc(i,s)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Yi.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Yi.min():e.readTime?Yc(e.readTime):Yi.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=nu(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=Ea(r)?{documents:iu(t,r)}:{query:ou(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=zc(t,e.resumeToken):e.snapshotVersion.compareTo(Yi.min())>0&&(n.readTime=Gc(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 Oi()}}(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=nu(this.yt),e.removeTarget=t,this.Bo(e)}}class ah extends ih{constructor(t,e,n,r,s,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,i),this.yt=s,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Di(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Di(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Yc(t.updateTime):Yc(e);return n.isEqual(Yi.min())&&(n=Yc(e)),new tc(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Yc(t.commitTime);return this.listener.Zo(n,e)}return Di(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=nu(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof uc)n={update:su(t,e.key,e.value)};else if(e instanceof pc)n={delete:Zc(t,e.key)};else if(e instanceof hc)n={update:su(t,e.key,e.data),updateMask:gu(e.fieldMask)};else{if(!(e instanceof gc))return Oi();n={verify:Zc(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Wa)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ga)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Qa)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ja)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw Oi()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Qc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Oi()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
1539
1539
  /**
1540
1540
  * @license
1541
1541
  * Copyright 2017 Google LLC
@@ -1551,7 +1551,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1551
1551
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1552
1552
  * See the License for the specific language governing permissions and
1553
1553
  * limitations under the License.
1554
- */class ih 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 Oi(Di.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===Di.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Oi(Di.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===Di.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Oi(Di.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class oh{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?(bi(e),this.ou=!1):Ii("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1554
+ */class ch 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 Mi(Pi.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===Pi.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Mi(Pi.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===Pi.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Mi(Pi.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class uh{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?(ki(e),this.ou=!1):Ci("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1555
1555
  /**
1556
1556
  * @license
1557
1557
  * Copyright 2017 Google LLC
@@ -1567,7 +1567,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1567
1567
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1568
1568
  * See the License for the specific language governing permissions and
1569
1569
  * limitations under the License.
1570
- */class ah{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()=>{mh(this)&&(Ii("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Ni(t);e._u.add(4),await uh(e),e.gu.set("Unknown"),e._u.delete(4),await ch(e)}(this))}))})),this.gu=new oh(n,r)}}async function ch(t){if(mh(t))for(const e of t.wu)await e(!0)}async function uh(t){for(const e of t.wu)await e(!1)}function hh(t,e){const n=Ni(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),gh(n)?ph(n):Lh(n).ko()&&dh(n,e))}function lh(t,e){const n=Ni(t),r=Lh(n);n.du.delete(e),r.ko()&&fh(n,e),0===n.du.size&&(r.ko()?r.Fo():mh(n)&&n.gu.set("Unknown"))}function dh(t,e){t.yu.Ot(e.targetId),Lh(t).zo(e)}function fh(t,e){t.yu.Ot(e),Lh(t).Ho(e)}function ph(t){t.yu=new Uc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),Lh(t).start(),t.gu.uu()}function gh(t){return mh(t)&&!Lh(t).No()&&t.du.size>0}function mh(t){return 0===Ni(t)._u.size}function yh(t){t.yu=void 0}async function vh(t){t.du.forEach(((e,n)=>{dh(t,e)}))}async function wh(t,e){yh(t),gh(t)?(t.gu.hu(e),ph(t)):t.gu.set("Unknown")}async function _h(t,e,n){if(t.gu.set("Online"),e instanceof Mc&&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){Ii("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Th(t,n)}else if(e instanceof Lc?t.yu.Kt(e):e instanceof Pc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Gi.min()))try{const e=await Hu(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(mo.EMPTY_BYTE_STRING,n.snapshotVersion)),fh(t,e);const r=new yu(n.target,e,1,n.sequenceNumber);dh(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Ii("RemoteStore","Failed to raise snapshot:",e),await Th(t,e)}}async function Th(t,e,n){if(!oo(e))throw e;t._u.add(1),await uh(t),t.gu.set("Offline"),n||(n=()=>Hu(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Ii("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await ch(t)}))}function Eh(t,e){return e().catch((n=>Th(t,n,e)))}async function Sh(t){const e=Ni(t),n=Ph(e);let r=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Ih(e);)try{const t=await $u(e.localStore,r);if(null===t){0===e.fu.length&&n.Fo();break}r=t.batchId,bh(e,t)}catch(t){await Th(e,t)}Ah(e)&&Ch(e)}function Ih(t){return mh(t)&&t.fu.length<10}function bh(t,e){t.fu.push(e);const n=Ph(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Ah(t){return mh(t)&&!Ph(t).No()&&t.fu.length>0}function Ch(t){Ph(t).start()}async function kh(t){Ph(t).eu()}async function Rh(t){const e=Ph(t);for(const n of t.fu)e.Xo(n.mutations)}async function Nh(t,e,n){const r=t.fu.shift(),s=gu.from(r,e,n);await Eh(t,(()=>t.remoteSyncer.applySuccessfulWrite(s))),await Sh(t)}async function Dh(t,e){e&&Ph(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return ki();case Di.CANCELLED:case Di.UNKNOWN:case Di.DEADLINE_EXCEEDED:case Di.RESOURCE_EXHAUSTED:case Di.INTERNAL:case Di.UNAVAILABLE:case Di.UNAUTHENTICATED:return!1;case Di.INVALID_ARGUMENT:case Di.NOT_FOUND:case Di.ALREADY_EXISTS:case Di.PERMISSION_DENIED:case Di.FAILED_PRECONDITION:case Di.ABORTED:case Di.OUT_OF_RANGE:case Di.UNIMPLEMENTED:case Di.DATA_LOSS:return!0}}(n=e.code)&&n!==Di.ABORTED){const n=t.fu.shift();Ph(t).Mo(),await Eh(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Sh(t)}var n}(t,e),Ah(t)&&Ch(t)}async function Oh(t,e){const n=Ni(t);n.asyncQueue.verifyOperationInProgress(),Ii("RemoteStore","RemoteStore received new credentials");const r=mh(n);n._u.add(3),await uh(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await ch(n)}function Lh(t){return t.pu||(t.pu=function(t,e,n){const r=Ni(t);return r.su(),new rh(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
1570
+ */class hh{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()=>{wh(this)&&(Ci("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Li(t);e._u.add(4),await dh(e),e.gu.set("Unknown"),e._u.delete(4),await lh(e)}(this))}))})),this.gu=new uh(n,r)}}async function lh(t){if(wh(t))for(const e of t.wu)await e(!0)}async function dh(t){for(const e of t.wu)await e(!1)}function fh(t,e){const n=Li(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),vh(n)?yh(n):xh(n).ko()&&gh(n,e))}function ph(t,e){const n=Li(t),r=xh(n);n.du.delete(e),r.ko()&&mh(n,e),0===n.du.size&&(r.ko()?r.Fo():wh(n)&&n.gu.set("Unknown"))}function gh(t,e){t.yu.Ot(e.targetId),xh(t).zo(e)}function mh(t,e){t.yu.Ot(e),xh(t).Ho(e)}function yh(t){t.yu=new Bc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),xh(t).start(),t.gu.uu()}function vh(t){return wh(t)&&!xh(t).No()&&t.du.size>0}function wh(t){return 0===Li(t)._u.size}function _h(t){t.yu=void 0}async function Th(t){t.du.forEach(((e,n)=>{gh(t,e)}))}async function Eh(t,e){_h(t),vh(t)?(t.gu.hu(e),yh(t)):t.gu.set("Unknown")}async function Sh(t,e,n){if(t.gu.set("Online"),e instanceof Fc&&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){Ci("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Ih(t,n)}else if(e instanceof xc?t.yu.Kt(e):e instanceof Uc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Yi.min()))try{const e=await qu(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(wo.EMPTY_BYTE_STRING,n.snapshotVersion)),mh(t,e);const r=new _u(n.target,e,1,n.sequenceNumber);gh(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Ci("RemoteStore","Failed to raise snapshot:",e),await Ih(t,e)}}async function Ih(t,e,n){if(!uo(e))throw e;t._u.add(1),await dh(t),t.gu.set("Offline"),n||(n=()=>qu(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Ci("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await lh(t)}))}function bh(t,e){return e().catch((n=>Ih(t,n,e)))}async function Ah(t){const e=Li(t),n=Uh(e);let r=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Ch(e);)try{const t=await Wu(e.localStore,r);if(null===t){0===e.fu.length&&n.Fo();break}r=t.batchId,kh(e,t)}catch(t){await Ih(e,t)}Nh(e)&&Rh(e)}function Ch(t){return wh(t)&&t.fu.length<10}function kh(t,e){t.fu.push(e);const n=Uh(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Nh(t){return wh(t)&&!Uh(t).No()&&t.fu.length>0}function Rh(t){Uh(t).start()}async function Oh(t){Uh(t).eu()}async function Dh(t){const e=Uh(t);for(const n of t.fu)e.Xo(n.mutations)}async function Lh(t,e,n){const r=t.fu.shift(),s=vu.from(r,e,n);await bh(t,(()=>t.remoteSyncer.applySuccessfulWrite(s))),await Ah(t)}async function Ph(t,e){e&&Uh(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return Oi();case Pi.CANCELLED:case Pi.UNKNOWN:case Pi.DEADLINE_EXCEEDED:case Pi.RESOURCE_EXHAUSTED:case Pi.INTERNAL:case Pi.UNAVAILABLE:case Pi.UNAUTHENTICATED:return!1;case Pi.INVALID_ARGUMENT:case Pi.NOT_FOUND:case Pi.ALREADY_EXISTS:case Pi.PERMISSION_DENIED:case Pi.FAILED_PRECONDITION:case Pi.ABORTED:case Pi.OUT_OF_RANGE:case Pi.UNIMPLEMENTED:case Pi.DATA_LOSS:return!0}}(n=e.code)&&n!==Pi.ABORTED){const n=t.fu.shift();Uh(t).Mo(),await bh(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Ah(t)}var n}(t,e),Nh(t)&&Rh(t)}async function Mh(t,e){const n=Li(t);n.asyncQueue.verifyOperationInProgress(),Ci("RemoteStore","RemoteStore received new credentials");const r=wh(n);n._u.add(3),await dh(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await lh(n)}function xh(t){return t.pu||(t.pu=function(t,e,n){const r=Li(t);return r.su(),new oh(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
1571
1571
  /**
1572
1572
  * @license
1573
1573
  * Copyright 2018 Google LLC
@@ -1583,7 +1583,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1583
1583
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1584
1584
  * See the License for the specific language governing permissions and
1585
1585
  * limitations under the License.
1586
- */}(t.datastore,t.asyncQueue,{Yr:vh.bind(null,t),Zr:wh.bind(null,t),Wo:_h.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),gh(t)?ph(t):t.gu.set("Unknown")):(await t.pu.stop(),yh(t))}))),t.pu}function Ph(t){return t.Iu||(t.Iu=function(t,e,n){const r=Ni(t);return r.su(),new sh(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)}(t.datastore,t.asyncQueue,{Yr:kh.bind(null,t),Zr:Dh.bind(null,t),tu:Rh.bind(null,t),Zo:Nh.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Sh(t)):(await t.Iu.stop(),t.fu.length>0&&(Ii("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
1586
+ */}(t.datastore,t.asyncQueue,{Yr:Th.bind(null,t),Zr:Eh.bind(null,t),Wo:Sh.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),vh(t)?yh(t):t.gu.set("Unknown")):(await t.pu.stop(),_h(t))}))),t.pu}function Uh(t){return t.Iu||(t.Iu=function(t,e,n){const r=Li(t);return r.su(),new ah(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)}(t.datastore,t.asyncQueue,{Yr:Oh.bind(null,t),Zr:Ph.bind(null,t),tu:Dh.bind(null,t),Zo:Lh.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Ah(t)):(await t.Iu.stop(),t.fu.length>0&&(Ci("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
1587
1587
  /**
1588
1588
  * @license
1589
1589
  * Copyright 2017 Google LLC
@@ -1599,7 +1599,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1599
1599
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1600
1600
  * See the License for the specific language governing permissions and
1601
1601
  * limitations under the License.
1602
- */}class Mh{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new Li,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 Mh(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 Oi(Di.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 xh(t,e){if(bi("AsyncQueue",`${e}: ${t}`),oo(t))return new Oi(Di.UNAVAILABLE,`${e}: ${t}`);throw t}
1602
+ */}class Fh{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new xi,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 Fh(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 Mi(Pi.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 Vh(t,e){if(ki("AsyncQueue",`${e}: ${t}`),uo(t))return new Mi(Pi.UNAVAILABLE,`${e}: ${t}`);throw t}
1603
1603
  /**
1604
1604
  * @license
1605
1605
  * Copyright 2017 Google LLC
@@ -1615,7 +1615,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1615
1615
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
1616
  * See the License for the specific language governing permissions and
1617
1617
  * limitations under the License.
1618
- */class Uh{constructor(t){this.comparator=t?(e,n)=>t(e,n)||Xi.comparator(e.key,n.key):(t,e)=>Xi.comparator(t.key,e.key),this.keyedMap=Tc(),this.sortedSet=new oa(this.comparator)}static emptySet(t){return new Uh(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 Uh))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 Uh;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
1618
+ */class Bh{constructor(t){this.comparator=t?(e,n)=>t(e,n)||eo.comparator(e.key,n.key):(t,e)=>eo.comparator(t.key,e.key),this.keyedMap=Ic(),this.sortedSet=new ua(this.comparator)}static emptySet(t){return new Bh(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 Bh))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 Bh;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
1619
1619
  /**
1620
1620
  * @license
1621
1621
  * Copyright 2017 Google LLC
@@ -1631,7 +1631,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1631
1631
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1632
1632
  * See the License for the specific language governing permissions and
1633
1633
  * limitations under the License.
1634
- */class Fh{constructor(){this.Tu=new oa(Xi.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}):ki():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Vh{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 Vh(t,e,Uh.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)&&Na(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}}
1634
+ */class Hh{constructor(){this.Tu=new ua(eo.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}):Oi():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class jh{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 jh(t,e,Bh.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)&&La(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}}
1635
1635
  /**
1636
1636
  * @license
1637
1637
  * Copyright 2017 Google LLC
@@ -1647,7 +1647,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1647
1647
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1648
1648
  * See the License for the specific language governing permissions and
1649
1649
  * limitations under the License.
1650
- */class Bh{constructor(){this.Au=void 0,this.listeners=[]}}class Hh{constructor(){this.queries=new yc((t=>Da(t)),Na),this.onlineState="Unknown",this.Ru=new Set}}async function jh(t,e){const n=Ni(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new Bh),s)try{i.Au=await n.onListen(r)}catch(t){const n=xh(t,`Initialization of query '${Oa(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)&&Wh(n)}async function $h(t,e){const n=Ni(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 qh(t,e){const n=Ni(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&&Wh(n)}function Kh(t,e,n){const r=Ni(t),s=r.queries.get(e);if(s)for(const t of s.listeners)t.onError(n);r.queries.delete(e)}function Wh(t){t.Ru.forEach((t=>{t.next()}))}class Gh{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 Vh(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=Vh.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1650
+ */class $h{constructor(){this.Au=void 0,this.listeners=[]}}class qh{constructor(){this.queries=new _c((t=>Pa(t)),La),this.onlineState="Unknown",this.Ru=new Set}}async function Kh(t,e){const n=Li(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new $h),s)try{i.Au=await n.onListen(r)}catch(t){const n=Vh(t,`Initialization of query '${Ma(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)&&Qh(n)}async function Wh(t,e){const n=Li(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 Gh(t,e){const n=Li(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&&Qh(n)}function zh(t,e,n){const r=Li(t),s=r.queries.get(e);if(s)for(const t of s.listeners)t.onError(n);r.queries.delete(e)}function Qh(t){t.Ru.forEach((t=>{t.next()}))}class Yh{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 jh(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=jh.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1651
1651
  /**
1652
1652
  * @license
1653
1653
  * Copyright 2017 Google LLC
@@ -1663,7 +1663,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1663
1663
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1664
1664
  * See the License for the specific language governing permissions and
1665
1665
  * limitations under the License.
1666
- */class zh{constructor(t){this.key=t}}class Qh{constructor(t){this.key=t}}class Yh{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=kc(),this.mutatedKeys=kc(),this.Gu=Pa(t),this.Qu=new Uh(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Fh,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=La(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 ki()}};return n(t)-n(e)}
1666
+ */class Jh{constructor(t){this.key=t}}class Xh{constructor(t){this.key=t}}class Zh{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Oc(),this.mutatedKeys=Oc(),this.Gu=Ua(t),this.Qu=new Bh(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Hh,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=xa(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 Oi()}};return n(t)-n(e)}
1667
1667
  /**
1668
1668
  * @license
1669
1669
  * Copyright 2020 Google LLC
@@ -1679,7 +1679,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1679
1679
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1680
1680
  * See the License for the specific language governing permissions and
1681
1681
  * limitations under the License.
1682
- */(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 Vh(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 Fh,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=kc(),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 Qh(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new zh(n))})),e}tc(t){this.qu=t.Hi,this.Ku=kc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Vh.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Jh{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class Xh{constructor(t){this.key=t,this.nc=!1}}class Zh{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 yc((t=>Da(t)),Na),this.rc=new Map,this.oc=new Set,this.uc=new oa(Xi.comparator),this.cc=new Map,this.ac=new ku,this.hc={},this.lc=new Map,this.fc=Eu.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function tl(t,e){const n=function(t){const e=Ni(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=rl.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=yl.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=il.bind(null,e),e.sc.Wo=qh.bind(null,e.eventManager),e.sc.wc=Kh.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=Ni(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,io.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new yu(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,Ca(e));n.isPrimaryClient&&hh(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 Ku(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 dl(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await Ku(t.localStore,e,!0),o=new Yh(e,i.Hi),a=o.Wu(i.documents),c=Oc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),u=o.applyChanges(a,t.isPrimaryClient,c);dl(t,n,u.Xu);const h=new Jh(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 el(t,e){const n=Ni(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=>!Na(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await qu(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),lh(n.remoteStore,r.targetId),hl(n,r.targetId)})).catch(so)):(hl(n,r.targetId),await qu(n.localStore,r.targetId,!0))}async function nl(t,e,n){const r=function(t){const e=Ni(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ol.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=al.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ni(t),r=Wi.now(),s=e.reduce(((t,e)=>t.add(e.key)),kc());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=wc(),c=kc();return n.Gi.getEntries(t,s).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((s=>{i=s;const o=[];for(const t of e){const e=sc(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new ac(t.key,e,fa(e.value.mapValue),Xa.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:Ec(i)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new oa(qi)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await gl(r,t.changes),await Sh(r.remoteStore)}catch(t){const e=xh(t,"Failed to persist write");n.reject(e)}}async function rl(t,e){const n=Ni(t);try{const t=await ju(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Ri(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Ri(r.nc):t.removedDocuments.size>0&&(Ri(r.nc),r.nc=!1))})),await gl(n,t,e)}catch(t){await so(t)}}function sl(t,e,n){const r=Ni(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=Ni(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Wh(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function il(t,e,n){const r=Ni(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new oa(Xi.comparator);t=t.insert(i,pa.newNoDocument(i,Gi.min()));const n=kc().add(i),s=new Dc(Gi.min(),new Map,new ua(qi),t,n);await rl(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),pl(r)}else await qu(r.localStore,e,!1).then((()=>hl(r,e,n))).catch(so)}async function ol(t,e){const n=Ni(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Ni(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),s=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const s=n.batch,i=s.keys();let o=io.resolve();return i.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const i=n.docVersions.get(t);Ri(null!==i),e.version.compareTo(i)<0&&(s.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,s)))}(n,t,e,s).next((()=>s.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=kc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);ul(n,r,null),cl(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await gl(n,t)}catch(t){await so(t)}}async function al(t,e,n){const r=Ni(t);try{const t=await function(t,e){const n=Ni(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Ri(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);ul(r,e,n),cl(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await gl(r,t)}catch(n){await so(n)}}function cl(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function ul(t,e,n){const r=Ni(t);let s=r.hc[r.currentUser.toKey()];if(s){const t=s.get(e);t&&(n?t.reject(n):t.resolve(),s=s.remove(e)),r.hc[r.currentUser.toKey()]=s}}function hl(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)||ll(t,e)}))}function ll(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(lh(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),pl(t))}function dl(t,e,n){for(const r of n)r instanceof zh?(t.ac.addReference(r.key,e),fl(t,r)):r instanceof Qh?(Ii("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||ll(t,r.key)):ki()}function fl(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Ii("SyncEngine","New document in limbo: "+n),t.oc.add(r),pl(t))}function pl(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 Xi(Qi.fromString(e)),r=t.fc.next();t.cc.set(r,new Xh(n)),t.uc=t.uc.insert(n,r),hh(t.remoteStore,new yu(Ca(Ta(n.path)),r,2,ao.at))}}async function gl(t,e,n){const r=Ni(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=Uu.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Ni(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>io.forEach(e,(e=>io.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>io.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!oo(t))throw t;Ii("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 ml(t,e){const n=Ni(t);if(!n.currentUser.isEqual(e)){Ii("SyncEngine","User change. New user:",e.toKey());const t=await Bu(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Oi(Di.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await gl(n,t.ji)}}function yl(t,e){const n=Ni(t),r=n.cc.get(e);if(r&&r.nc)return kc().add(r.key);{let t=kc();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 vl{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=th(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 Vu(t,e,n,r)}(this.persistence,new Fu,t.initialUser,this.yt)}yc(t){return new Pu(xu.Bs,this.yt)}gc(t){return new Gu}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class wl{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=>sl(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=ml.bind(null,this.syncEngine),await async function(t,e){const n=Ni(t);e?(n._u.delete(2),await ch(n)):e||(n._u.add(2),await uh(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Hh}createDatastore(t){const e=th(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new Xu(r));var r;return function(t,e,n,r){return new ih(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>sl(this.syncEngine,t,0),i=Qu.C()?new Qu:new zu,new ah(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 Zh(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=Ni(t);Ii("RemoteStore","RemoteStore shutting down."),e._u.add(5),await uh(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1682
+ */(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 jh(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 Hh,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=Oc(),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 Xh(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Jh(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return jh.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class tl{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class el{constructor(t){this.key=t,this.nc=!1}}class nl{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 _c((t=>Pa(t)),La),this.rc=new Map,this.oc=new Set,this.uc=new ua(eo.comparator),this.cc=new Map,this.ac=new Ou,this.hc={},this.lc=new Map,this.fc=bu.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function rl(t,e){const n=function(t){const e=Li(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ol.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=_l.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=cl.bind(null,e),e.sc.Wo=Gh.bind(null,e.eventManager),e.sc.wc=zh.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=Li(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,co.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new _u(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,Ra(e));n.isPrimaryClient&&fh(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 zu(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 gl(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await zu(t.localStore,e,!0),o=new Zh(e,i.Hi),a=o.Wu(i.documents),c=Mc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),u=o.applyChanges(a,t.isPrimaryClient,c);gl(t,n,u.Xu);const h=new tl(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 sl(t,e){const n=Li(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=>!La(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Gu(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),ph(n.remoteStore,r.targetId),fl(n,r.targetId)})).catch(ao)):(fl(n,r.targetId),await Gu(n.localStore,r.targetId,!0))}async function il(t,e,n){const r=function(t){const e=Li(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ul.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hl.bind(null,e),e}(t);try{const t=await function(t,e){const n=Li(t),r=Qi.now(),s=e.reduce(((t,e)=>t.add(e.key)),Oc());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=Ec(),c=Oc();return n.Gi.getEntries(t,s).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((s=>{i=s;const o=[];for(const t of e){const e=ac(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new hc(t.key,e,ma(e.value.mapValue),ec.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:bc(i)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new ua(Gi)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await vl(r,t.changes),await Ah(r.remoteStore)}catch(t){const e=Vh(t,"Failed to persist write");n.reject(e)}}async function ol(t,e){const n=Li(t);try{const t=await Ku(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Di(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Di(r.nc):t.removedDocuments.size>0&&(Di(r.nc),r.nc=!1))})),await vl(n,t,e)}catch(t){await ao(t)}}function al(t,e,n){const r=Li(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=Li(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Qh(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function cl(t,e,n){const r=Li(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new ua(eo.comparator);t=t.insert(i,ya.newNoDocument(i,Yi.min()));const n=Oc().add(i),s=new Pc(Yi.min(),new Map,new da(Gi),t,n);await ol(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),yl(r)}else await Gu(r.localStore,e,!1).then((()=>fl(r,e,n))).catch(ao)}async function ul(t,e){const n=Li(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),s=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const s=n.batch,i=s.keys();let o=co.resolve();return i.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const i=n.docVersions.get(t);Di(null!==i),e.version.compareTo(i)<0&&(s.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,s)))}(n,t,e,s).next((()=>s.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Oc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);dl(n,r,null),ll(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await vl(n,t)}catch(t){await ao(t)}}async function hl(t,e,n){const r=Li(t);try{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Di(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);dl(r,e,n),ll(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await vl(r,t)}catch(n){await ao(n)}}function ll(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function dl(t,e,n){const r=Li(t);let s=r.hc[r.currentUser.toKey()];if(s){const t=s.get(e);t&&(n?t.reject(n):t.resolve(),s=s.remove(e)),r.hc[r.currentUser.toKey()]=s}}function fl(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)||pl(t,e)}))}function pl(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ph(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),yl(t))}function gl(t,e,n){for(const r of n)r instanceof Jh?(t.ac.addReference(r.key,e),ml(t,r)):r instanceof Xh?(Ci("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||pl(t,r.key)):Oi()}function ml(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Ci("SyncEngine","New document in limbo: "+n),t.oc.add(r),yl(t))}function yl(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 eo(Xi.fromString(e)),r=t.fc.next();t.cc.set(r,new el(n)),t.uc=t.uc.insert(n,r),fh(t.remoteStore,new _u(Ra(Ia(n.path)),r,2,ho.at))}}async function vl(t,e,n){const r=Li(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=Bu.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Li(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>co.forEach(e,(e=>co.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>co.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!uo(t))throw t;Ci("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 wl(t,e){const n=Li(t);if(!n.currentUser.isEqual(e)){Ci("SyncEngine","User change. New user:",e.toKey());const t=await $u(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Mi(Pi.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await vl(n,t.ji)}}function _l(t,e){const n=Li(t),r=n.cc.get(e);if(r&&r.nc)return Oc().add(r.key);{let t=Oc();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 Tl{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=rh(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 ju(t,e,n,r)}(this.persistence,new Hu,t.initialUser,this.yt)}yc(t){return new Uu(Vu.Bs,this.yt)}gc(t){return new Yu}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class El{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=>al(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=wl.bind(null,this.syncEngine),await async function(t,e){const n=Li(t);e?(n._u.delete(2),await lh(n)):e||(n._u.add(2),await dh(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new qh}createDatastore(t){const e=rh(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new eh(r));var r;return function(t,e,n,r){return new ch(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>al(this.syncEngine,t,0),i=Xu.C()?new Xu:new Ju,new hh(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 nl(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=Li(t);Ci("RemoteStore","RemoteStore shutting down."),e._u.add(5),await dh(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1683
1683
  /**
1684
1684
  * @license
1685
1685
  * Copyright 2017 Google LLC
@@ -1695,7 +1695,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1695
1695
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1696
1696
  * See the License for the specific language governing permissions and
1697
1697
  * limitations under the License.
1698
- */function _l(t,e,n){if(!n)throw new Oi(Di.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Tl(t){if(!Xi.isDocumentKey(t))throw new Oi(Di.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function El(t){if(Xi.isDocumentKey(t))throw new Oi(Di.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Sl(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":ki()}function Il(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Oi(Di.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Sl(t);throw new Oi(Di.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
1698
+ */function Sl(t,e,n){if(!n)throw new Mi(Pi.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Il(t){if(!eo.isDocumentKey(t))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function bl(t){if(eo.isDocumentKey(t))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Al(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":Oi()}function Cl(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Mi(Pi.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Al(t);throw new Mi(Pi.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
1699
1699
  /**
1700
1700
  * @license
1701
1701
  * Copyright 2020 Google LLC
@@ -1711,7 +1711,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1711
1711
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1712
1712
  * See the License for the specific language governing permissions and
1713
1713
  * limitations under the License.
1714
- */const bl=new Map;class Al{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Oi(Di.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 Oi(Di.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 Oi(Di.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}}
1714
+ */const kl=new Map;class Nl{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Mi(Pi.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 Mi(Pi.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 Mi(Pi.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}}
1715
1715
  /**
1716
1716
  * @license
1717
1717
  * Copyright 2020 Google LLC
@@ -1727,7 +1727,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1727
1727
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1728
1728
  * See the License for the specific language governing permissions and
1729
1729
  * limitations under the License.
1730
- */class Cl{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 Al({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Oi(Di.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 Oi(Di.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 Al(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Mi;switch(t.type){case"gapi":const e=t.client;return new Vi(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Oi(Di.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=bl.get(t);e&&(Ii("ComponentProvider","Removing Datastore"),bl.delete(t),e.terminate())}(this),Promise.resolve()}}function kl(t,e,n,r={}){var s;const i=(t=Il(t,Cl))._getSettings();if("firestore.googleapis.com"!==i.host&&i.host!==e&&Ai("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},i),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=_i.MOCK_USER;else{e=
1730
+ */class Rl{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 Nl({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Mi(Pi.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 Mi(Pi.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 Nl(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Fi;switch(t.type){case"gapi":const e=t.client;return new ji(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Mi(Pi.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=kl.get(t);e&&(Ci("ComponentProvider","Removing Datastore"),kl.delete(t),e.terminate())}(this),Promise.resolve()}}function Ol(t,e,n,r={}){var s;const i=(t=Cl(t,Rl))._getSettings();if("firestore.googleapis.com"!==i.host&&i.host!==e&&Ni("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},i),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=Si.MOCK_USER;else{e=
1731
1731
  /**
1732
1732
  * @license
1733
1733
  * Copyright 2021 Google LLC
@@ -1744,7 +1744,7 @@ class yc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1744
1744
  * See the License for the specific language governing permissions and
1745
1745
  * limitations under the License.
1746
1746
  */
1747
- 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 n=e||"demo-project",r=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},t);return[Xt(JSON.stringify({alg:"none",type:"JWT"})),Xt(JSON.stringify(i)),""].join(".")}
1747
+ 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 n=e||"demo-project",r=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},t);return[ee(JSON.stringify({alg:"none",type:"JWT"})),ee(JSON.stringify(i)),""].join(".")}
1748
1748
  /**
1749
1749
  * @license
1750
1750
  * Copyright 2017 Google LLC
@@ -1760,7 +1760,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1760
1760
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1761
1761
  * See the License for the specific language governing permissions and
1762
1762
  * limitations under the License.
1763
- */(r.mockUserToken,null===(s=t._app)||void 0===s?void 0:s.options.projectId);const i=r.mockUserToken.sub||r.mockUserToken.user_id;if(!i)throw new Oi(Di.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new _i(i)}t._authCredentials=new xi(new Pi(e,n))}}
1763
+ */(r.mockUserToken,null===(s=t._app)||void 0===s?void 0:s.options.projectId);const i=r.mockUserToken.sub||r.mockUserToken.user_id;if(!i)throw new Mi(Pi.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Si(i)}t._authCredentials=new Vi(new Ui(e,n))}}
1764
1764
  /**
1765
1765
  * @license
1766
1766
  * Copyright 2020 Google LLC
@@ -1776,7 +1776,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1776
1776
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1777
1777
  * See the License for the specific language governing permissions and
1778
1778
  * limitations under the License.
1779
- */class Rl{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 Dl(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Rl(this.firestore,t,this._key)}}class Nl{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Nl(this.firestore,t,this._query)}}class Dl extends Nl{constructor(t,e,n){super(t,e,Ta(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 Rl(this.firestore,null,new Xi(t))}withConverter(t){return new Dl(this.firestore,t,this._path)}}function Ol(t,e,...n){if(t=oe(t),_l("collection","path",e),t instanceof Cl){const r=Qi.fromString(e,...n);return El(r),new Dl(t,null,r)}{if(!(t instanceof Rl||t instanceof Dl))throw new Oi(Di.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Qi.fromString(e,...n));return El(r),new Dl(t.firestore,null,r)}}function Ll(t,e,...n){if(t=oe(t),1===arguments.length&&(e=$i.R()),_l("doc","path",e),t instanceof Cl){const r=Qi.fromString(e,...n);return Tl(r),new Rl(t,null,new Xi(r))}{if(!(t instanceof Rl||t instanceof Dl))throw new Oi(Di.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Qi.fromString(e,...n));return Tl(r),new Rl(t.firestore,t instanceof Dl?t.converter:null,new Xi(r))}}
1779
+ */class Dl{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 Pl(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Dl(this.firestore,t,this._key)}}class Ll{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Ll(this.firestore,t,this._query)}}class Pl extends Ll{constructor(t,e,n){super(t,e,Ia(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 Dl(this.firestore,null,new eo(t))}withConverter(t){return new Pl(this.firestore,t,this._path)}}function Ml(t,e,...n){if(t=ue(t),Sl("collection","path",e),t instanceof Rl){const r=Xi.fromString(e,...n);return bl(r),new Pl(t,null,r)}{if(!(t instanceof Dl||t instanceof Pl))throw new Mi(Pi.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Xi.fromString(e,...n));return bl(r),new Pl(t.firestore,null,r)}}function xl(t,e,...n){if(t=ue(t),1===arguments.length&&(e=Wi.R()),Sl("doc","path",e),t instanceof Rl){const r=Xi.fromString(e,...n);return Il(r),new Dl(t,null,new eo(r))}{if(!(t instanceof Dl||t instanceof Pl))throw new Mi(Pi.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Xi.fromString(e,...n));return Il(r),new Dl(t.firestore,t instanceof Pl?t.converter:null,new eo(r))}}
1780
1780
  /**
1781
1781
  * @license
1782
1782
  * Copyright 2020 Google LLC
@@ -1808,7 +1808,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1808
1808
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1809
1809
  * See the License for the specific language governing permissions and
1810
1810
  * limitations under the License.
1811
- */class Pl{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):bi("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
1811
+ */class Ul{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):ki("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
1812
1812
  /**
1813
1813
  * @license
1814
1814
  * Copyright 2017 Google LLC
@@ -1824,7 +1824,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1824
1824
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1825
1825
  * See the License for the specific language governing permissions and
1826
1826
  * limitations under the License.
1827
- */class Ml{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=_i.UNAUTHENTICATED,this.clientId=$i.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Ii("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Ii("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 Oi(Di.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Li;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=xh(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function xl(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Ii("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Ii("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await Bu(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new vl)),t.offlineComponents}(t);Ii("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>Oh(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Oh(e.remoteStore,n))),t.onlineComponents=e}async function Ul(t){return t.onlineComponents||(Ii("FirestoreClient","Using default OnlineComponentProvider"),await xl(t,new wl)),t.onlineComponents}async function Fl(t){const e=await Ul(t),n=e.eventManager;return n.onListen=tl.bind(null,e.syncEngine),n.onUnlisten=el.bind(null,e.syncEngine),n}class Vl{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 eh(this,"async_queue_retry"),this.Wc=()=>{const t=Zu();t&&Ii("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=Zu();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=Zu();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new Li;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(!oo(t))throw t;Ii("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}
1827
+ */class Fl{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=Si.UNAUTHENTICATED,this.clientId=Wi.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Ci("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Ci("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 Mi(Pi.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new xi;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=Vh(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function Vl(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Ci("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Ci("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await $u(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Tl)),t.offlineComponents}(t);Ci("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>Mh(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Mh(e.remoteStore,n))),t.onlineComponents=e}async function Bl(t){return t.onlineComponents||(Ci("FirestoreClient","Using default OnlineComponentProvider"),await Vl(t,new El)),t.onlineComponents}async function Hl(t){const e=await Bl(t),n=e.eventManager;return n.onListen=rl.bind(null,e.syncEngine),n.onUnlisten=sl.bind(null,e.syncEngine),n}class jl{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 sh(this,"async_queue_retry"),this.Wc=()=>{const t=nh();t&&Ci("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=nh();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=nh();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new xi;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(!uo(t))throw t;Ci("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}
1828
1828
  /**
1829
1829
  * @license
1830
1830
  * Copyright 2017 Google LLC
@@ -1840,7 +1840,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1840
1840
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1841
1841
  * See the License for the specific language governing permissions and
1842
1842
  * limitations under the License.
1843
- */(t);throw bi("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=Mh.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&ki()}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 Bl(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}
1843
+ */(t);throw ki("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=Fh.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&Oi()}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 $l(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}
1844
1844
  /**
1845
1845
  * @license
1846
1846
  * Copyright 2020 Google LLC
@@ -1856,7 +1856,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1856
1856
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1857
1857
  * See the License for the specific language governing permissions and
1858
1858
  * limitations under the License.
1859
- */(t)}class Hl extends Cl{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new Vl,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||$l(this),this._firestoreClient.terminate()}}function jl(t){return t._firestoreClient||$l(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function $l(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new co(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
1859
+ */(t)}class ql extends Rl{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new jl,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Wl(this),this._firestoreClient.terminate()}}function Kl(t){return t._firestoreClient||Wl(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Wl(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new lo(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
1860
1860
  /**
1861
1861
  * @license
1862
1862
  * Copyright 2020 Google LLC
@@ -1872,7 +1872,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1872
1872
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1873
1873
  * See the License for the specific language governing permissions and
1874
1874
  * limitations under the License.
1875
- */(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new Ml(t._authCredentials,t._appCheckCredentials,t._queue,r)}
1875
+ */(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new Fl(t._authCredentials,t._appCheckCredentials,t._queue,r)}
1876
1876
  /**
1877
1877
  * @license
1878
1878
  * Copyright 2020 Google LLC
@@ -1904,7 +1904,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1904
1904
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1905
1905
  * See the License for the specific language governing permissions and
1906
1906
  * limitations under the License.
1907
- */class ql{constructor(t){this._byteString=t}static fromBase64String(t){try{return new ql(mo.fromBase64String(t))}catch(t){throw new Oi(Di.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new ql(mo.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)}}
1907
+ */class Gl{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Gl(wo.fromBase64String(t))}catch(t){throw new Mi(Pi.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Gl(wo.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)}}
1908
1908
  /**
1909
1909
  * @license
1910
1910
  * Copyright 2020 Google LLC
@@ -1920,7 +1920,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1920
1920
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1921
1921
  * See the License for the specific language governing permissions and
1922
1922
  * limitations under the License.
1923
- */class Kl{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Oi(Di.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Ji(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
1923
+ */class zl{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Mi(Pi.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new to(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
1924
1924
  /**
1925
1925
  * @license
1926
1926
  * Copyright 2020 Google LLC
@@ -1937,7 +1937,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1937
1937
  * See the License for the specific language governing permissions and
1938
1938
  * limitations under the License.
1939
1939
  */
1940
- class Wl{constructor(t){this._methodName=t}}
1940
+ class Ql{constructor(t){this._methodName=t}}
1941
1941
  /**
1942
1942
  * @license
1943
1943
  * Copyright 2017 Google LLC
@@ -1953,7 +1953,7 @@ class Wl{constructor(t){this._methodName=t}}
1953
1953
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1954
1954
  * See the License for the specific language governing permissions and
1955
1955
  * limitations under the License.
1956
- */class Gl{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Oi(Di.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Oi(Di.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 qi(this._lat,t._lat)||qi(this._long,t._long)}}
1956
+ */class Yl{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Mi(Pi.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Mi(Pi.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 Gi(this._lat,t._lat)||Gi(this._long,t._long)}}
1957
1957
  /**
1958
1958
  * @license
1959
1959
  * Copyright 2017 Google LLC
@@ -1969,7 +1969,7 @@ class Wl{constructor(t){this._methodName=t}}
1969
1969
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1970
1970
  * See the License for the specific language governing permissions and
1971
1971
  * limitations under the License.
1972
- */const zl=/^__.*__$/;class Ql{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new ac(t,this.data,this.fieldMask,e,this.fieldTransforms):new oc(t,this.data,e,this.fieldTransforms)}}function Yl(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ki()}}class Jl{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 Jl(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 cd(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(Yl(this.sa)&&zl.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class Xl{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||th(t)}da(t,e,n,r=!1){return new Jl({sa:t,methodName:e,fa:n,path:Ji.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Zl(t){const e=t._freezeSettings(),n=th(t._databaseId);return new Xl(t._databaseId,!!e.ignoreUndefinedProperties,n)}function td(t,e,n,r,s,i={}){const o=t.da(i.merge||i.mergeFields?2:0,e,n,s);sd("Data must be an object, but it was:",o,r);const a=nd(r,o);let c,u;if(i.merge)c=new la(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const t=[];for(const r of i.mergeFields){const s=id(e,r,n);if(!o.contains(s))throw new Oi(Di.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);ud(t,s)||t.push(s)}c=new la(t),u=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,u=o.fieldTransforms;return new Ql(new da(a),c,u)}function ed(t,e){if(rd(t=oe(t)))return sd("Unsupported field value:",e,t),nd(t,e);if(t instanceof Wl)return function(t,e){if(!Yl(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=ed(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=oe(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Fa(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Wi.fromDate(t);return{timestampValue:qc(e.yt,n)}}if(t instanceof Wi){const n=new Wi(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:qc(e.yt,n)}}if(t instanceof Gl)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof ql)return{bytesValue:Kc(e.yt,t._byteString)};if(t instanceof Rl){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:zc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Sl(t)}`)}(t,e)}function nd(t,e){const n={};return fo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):lo(t,((t,r)=>{const s=ed(r,e.ra(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}function rd(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Wi||t instanceof Gl||t instanceof ql||t instanceof Rl||t instanceof Wl)}function sd(t,e,n){if(!rd(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Sl(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function id(t,e,n){if((e=oe(e))instanceof Kl)return e._internalPath;if("string"==typeof e)return ad(t,e);throw cd("Field path arguments must be of type string or ",t,!1,void 0,n)}const od=new RegExp("[~\\*/\\[\\]]");function ad(t,e,n){if(e.search(od)>=0)throw cd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Kl(...e.split("."))._internalPath}catch(r){throw cd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function cd(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 Oi(Di.INVALID_ARGUMENT,a+t+c)}function ud(t,e){return t.some((t=>t.isEqual(e)))}
1972
+ */const Jl=/^__.*__$/;class Xl{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new hc(t,this.data,this.fieldMask,e,this.fieldTransforms):new uc(t,this.data,e,this.fieldTransforms)}}function Zl(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Oi()}}class td{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 td(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 ld(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(Zl(this.sa)&&Jl.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class ed{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||rh(t)}da(t,e,n,r=!1){return new td({sa:t,methodName:e,fa:n,path:to.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function nd(t){const e=t._freezeSettings(),n=rh(t._databaseId);return new ed(t._databaseId,!!e.ignoreUndefinedProperties,n)}function rd(t,e,n,r,s,i={}){const o=t.da(i.merge||i.mergeFields?2:0,e,n,s);ad("Data must be an object, but it was:",o,r);const a=id(r,o);let c,u;if(i.merge)c=new pa(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const t=[];for(const r of i.mergeFields){const s=cd(e,r,n);if(!o.contains(s))throw new Mi(Pi.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);dd(t,s)||t.push(s)}c=new pa(t),u=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,u=o.fieldTransforms;return new Xl(new ga(a),c,u)}function sd(t,e){if(od(t=ue(t)))return ad("Unsupported field value:",e,t),id(t,e);if(t instanceof Ql)return function(t,e){if(!Zl(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=sd(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=ue(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ha(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Qi.fromDate(t);return{timestampValue:Gc(e.yt,n)}}if(t instanceof Qi){const n=new Qi(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Gc(e.yt,n)}}if(t instanceof Yl)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Gl)return{bytesValue:zc(e.yt,t._byteString)};if(t instanceof Dl){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:Jc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Al(t)}`)}(t,e)}function id(t,e){const n={};return mo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):go(t,((t,r)=>{const s=sd(r,e.ra(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}function od(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Qi||t instanceof Yl||t instanceof Gl||t instanceof Dl||t instanceof Ql)}function ad(t,e,n){if(!od(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Al(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function cd(t,e,n){if((e=ue(e))instanceof zl)return e._internalPath;if("string"==typeof e)return hd(t,e);throw ld("Field path arguments must be of type string or ",t,!1,void 0,n)}const ud=new RegExp("[~\\*/\\[\\]]");function hd(t,e,n){if(e.search(ud)>=0)throw ld(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new zl(...e.split("."))._internalPath}catch(r){throw ld(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function ld(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 Mi(Pi.INVALID_ARGUMENT,a+t+c)}function dd(t,e){return t.some((t=>t.isEqual(e)))}
1973
1973
  /**
1974
1974
  * @license
1975
1975
  * Copyright 2020 Google LLC
@@ -1985,7 +1985,7 @@ class Wl{constructor(t){this._methodName=t}}
1985
1985
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1986
1986
  * See the License for the specific language governing permissions and
1987
1987
  * limitations under the License.
1988
- */class hd{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 Rl(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new ld(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(dd("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class ld extends hd{data(){return super.data()}}function dd(t,e){return"string"==typeof e?ad(t,e):e instanceof Kl?e._internalPath:e._delegate._internalPath}
1988
+ */class fd{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 Dl(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new pd(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(gd("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class pd extends fd{data(){return super.data()}}function gd(t,e){return"string"==typeof e?hd(t,e):e instanceof zl?e._internalPath:e._delegate._internalPath}
1989
1989
  /**
1990
1990
  * @license
1991
1991
  * Copyright 2020 Google LLC
@@ -2001,7 +2001,7 @@ class Wl{constructor(t){this._methodName=t}}
2001
2001
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2002
2002
  * See the License for the specific language governing permissions and
2003
2003
  * limitations under the License.
2004
- */function fd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Oi(Di.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class pd{}class gd extends pd{}function md(t,e,...n){let r=[];e instanceof pd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof wd)).length,n=t.filter((t=>t instanceof yd)).length;if(e>1||e>0&&n>0)throw new Oi(Di.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(...)))`.")}
2004
+ */function md(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Mi(Pi.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class yd{}class vd extends yd{}function wd(t,e,...n){let r=[];e instanceof yd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof Ed)).length,n=t.filter((t=>t instanceof _d)).length;if(e>1||e>0&&n>0)throw new Mi(Pi.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(...)))`.")}
2005
2005
  /**
2006
2006
  * @license
2007
2007
  * Copyright 2020 Google LLC
@@ -2017,7 +2017,7 @@ class Wl{constructor(t){this._methodName=t}}
2017
2017
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2018
2018
  * See the License for the specific language governing permissions and
2019
2019
  * limitations under the License.
2020
- */(r);for(const e of r)t=e._apply(t);return t}class yd extends gd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new yd(t,e,n)}_apply(t){const e=this._parse(t);return Ed(t._query,e),new Nl(t.firestore,t.converter,ka(t._query,e))}_parse(t){const e=Zl(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 Oi(Di.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Td(o,i);const e=[];for(const n of o)e.push(_d(r,t,n));a={arrayValue:{values:e}}}else a=_d(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Td(o,i),a=function(t,e,n,r=!1){return ed(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return $o.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function vd(t,e,n){const r=e,s=dd("where",t);return yd._create(s,r,n)}class wd extends pd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new wd(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]:qo.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)Ed(n,t),n=ka(n,t)}(t._query,e),new Nl(t.firestore,t.converter,ka(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function _d(t,e,n){if("string"==typeof(n=oe(n))){if(""===n)throw new Oi(Di.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ba(e)&&-1!==n.indexOf("/"))throw new Oi(Di.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(Qi.fromString(n));if(!Xi.isDocumentKey(r))throw new Oi(Di.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 Oo(t,new Xi(r))}if(n instanceof Rl)return Oo(t,n._key);throw new Oi(Di.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Sl(n)}.`)}function Td(t,e){if(!Array.isArray(t)||0===t.length)throw new Oi(Di.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Oi(Di.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Ed(t,e){if(e.isInequality()){const n=Ia(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Oi(Di.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=Sa(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new Oi(Di.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 Oi(Di.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Oi(Di.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Sd{convertValue(t,e="none"){switch(bo(t)){case 0:return null;case 1:return t.booleanValue;case 2:return wo(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(_o(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 ki()}}convertObject(t,e){const n={};return lo(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Gl(wo(t.latitude),wo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Eo(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(So(t));default:return null}}convertTimestamp(t){const e=vo(t);return new Wi(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Qi.fromString(t);Ri(fu(n));const r=new uo(n.get(1),n.get(3)),s=new Xi(n.popFirst(5));return r.isEqual(e)||bi(`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}}
2020
+ */(r);for(const e of r)t=e._apply(t);return t}class _d extends vd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new _d(t,e,n)}_apply(t){const e=this._parse(t);return bd(t._query,e),new Ll(t.firestore,t.converter,Oa(t._query,e))}_parse(t){const e=nd(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 Mi(Pi.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Id(o,i);const e=[];for(const n of o)e.push(Sd(r,t,n));a={arrayValue:{values:e}}}else a=Sd(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Id(o,i),a=function(t,e,n,r=!1){return sd(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Wo.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function Td(t,e,n){const r=e,s=gd("where",t);return _d._create(s,r,n)}class Ed extends yd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Ed(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]:Go.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)bd(n,t),n=Oa(n,t)}(t._query,e),new Ll(t.firestore,t.converter,Oa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Sd(t,e,n){if("string"==typeof(n=ue(n))){if(""===n)throw new Mi(Pi.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ka(e)&&-1!==n.indexOf("/"))throw new Mi(Pi.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(Xi.fromString(n));if(!eo.isDocumentKey(r))throw new Mi(Pi.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 Mo(t,new eo(r))}if(n instanceof Dl)return Mo(t,n._key);throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Al(n)}.`)}function Id(t,e){if(!Array.isArray(t)||0===t.length)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function bd(t,e){if(e.isInequality()){const n=Ca(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Mi(Pi.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=Aa(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new Mi(Pi.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 Mi(Pi.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Ad{convertValue(t,e="none"){switch(ko(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Eo(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(So(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 Oi()}}convertObject(t,e){const n={};return go(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Yl(Eo(t.latitude),Eo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=bo(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ao(t));default:return null}}convertTimestamp(t){const e=To(t);return new Qi(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Xi.fromString(t);Di(mu(n));const r=new fo(n.get(1),n.get(3)),s=new eo(n.popFirst(5));return r.isEqual(e)||ki(`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}}
2021
2021
  /**
2022
2022
  * @license
2023
2023
  * Copyright 2020 Google LLC
@@ -2050,7 +2050,7 @@ class Wl{constructor(t){this._methodName=t}}
2050
2050
  * See the License for the specific language governing permissions and
2051
2051
  * limitations under the License.
2052
2052
  */
2053
- class Id{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class bd extends hd{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 Ad(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(dd("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Ad extends bd{data(t={}){return super.data(t)}}class Cd{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Id(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 Ad(this._firestore,this._userDataWriter,n.key,n,new Id(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 Oi(Di.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 Ad(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Id(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 Ad(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Id(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:kd(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function kd(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ki()}}
2053
+ class Cd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class kd extends fd{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 Nd(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(gd("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Nd extends kd{data(t={}){return super.data(t)}}class Rd{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Cd(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 Nd(this._firestore,this._userDataWriter,n.key,n,new Cd(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 Mi(Pi.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 Nd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Cd(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 Nd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Cd(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:Od(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Od(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Oi()}}
2054
2054
  /**
2055
2055
  * @license
2056
2056
  * Copyright 2020 Google LLC
@@ -2066,7 +2066,7 @@ class Id{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2066
2066
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2067
2067
  * See the License for the specific language governing permissions and
2068
2068
  * limitations under the License.
2069
- */function Rd(t){t=Il(t,Rl);const e=Il(t.firestore,Hl);return function(t,e,n={}){const r=new Li;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Pl({next:i=>{e.enqueueAndForget((()=>$h(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Oi(Di.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Oi(Di.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 Gh(Ta(n.path),i,{includeMetadataChanges:!0,Nu:!0});return jh(t,o)}(await Fl(t),t.asyncQueue,e,n,r))),r.promise}(jl(e),t._key).then((n=>Pd(e,t,n)))}class Nd extends Sd{constructor(t){super(),this.firestore=t}convertBytes(t){return new ql(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Rl(this.firestore,null,e)}}function Dd(t){t=Il(t,Nl);const e=Il(t.firestore,Hl),n=jl(e),r=new Nd(e);return fd(t._query),function(t,e,n={}){const r=new Li;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Pl({next:n=>{e.enqueueAndForget((()=>$h(t,o))),n.fromCache&&"server"===r.source?s.reject(new Oi(Di.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 Gh(n,i,{includeMetadataChanges:!0,Nu:!0});return jh(t,o)}(await Fl(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Cd(e,r,t,n)))}function Od(t,e,n){t=Il(t,Rl);const r=Il(t.firestore,Hl),s=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new Li;return t.asyncQueue.enqueueAndForget((async()=>nl(await function(t){return Ul(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(jl(t),e)}(r,[td(Zl(r),"setDoc",t._key,s,null!==t.converter,n).toMutation(t._key,Xa.none())])}function Ld(t,...e){var n,r,s;t=oe(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||Bl(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(Bl(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 Rl)u=Il(t.firestore,Hl),h=Ta(t._key.path),c={next:n=>{e[o]&&e[o](Pd(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Il(t,Nl);u=Il(n.firestore,Hl),h=n._query;const r=new Nd(u);c={next:t=>{e[o]&&e[o](new Cd(u,r,n,t))},error:e[o+1],complete:e[o+2]},fd(t._query)}return function(t,e,n,r){const s=new Pl(r),i=new Gh(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>jh(await Fl(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>$h(await Fl(t),i)))}}(jl(u),h,a,c)}function Pd(t,e,n){const r=n.docs.get(e._key),s=new Nd(t);return new bd(t,s,e._key,r,new Id(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Ti=Pt,Nt(new ae("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new Hl(new Ui(t.getProvider("auth-internal")),new Hi(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Oi(Di.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new uo(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),Ut(wi,"3.8.0",t),Ut(wi,"3.8.0","esm2017")}();
2069
+ */function Dd(t){t=Cl(t,Dl);const e=Cl(t.firestore,ql);return function(t,e,n={}){const r=new xi;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Ul({next:i=>{e.enqueueAndForget((()=>Wh(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Mi(Pi.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Mi(Pi.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 Yh(Ia(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Kh(t,o)}(await Hl(t),t.asyncQueue,e,n,r))),r.promise}(Kl(e),t._key).then((n=>Ud(e,t,n)))}class Ld extends Ad{constructor(t){super(),this.firestore=t}convertBytes(t){return new Gl(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Dl(this.firestore,null,e)}}function Pd(t){t=Cl(t,Ll);const e=Cl(t.firestore,ql),n=Kl(e),r=new Ld(e);return md(t._query),function(t,e,n={}){const r=new xi;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Ul({next:n=>{e.enqueueAndForget((()=>Wh(t,o))),n.fromCache&&"server"===r.source?s.reject(new Mi(Pi.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 Yh(n,i,{includeMetadataChanges:!0,Nu:!0});return Kh(t,o)}(await Hl(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Rd(e,r,t,n)))}function Md(t,e,n){t=Cl(t,Dl);const r=Cl(t.firestore,ql),s=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new xi;return t.asyncQueue.enqueueAndForget((async()=>il(await function(t){return Bl(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(Kl(t),e)}(r,[rd(nd(r),"setDoc",t._key,s,null!==t.converter,n).toMutation(t._key,ec.none())])}function xd(t,...e){var n,r,s;t=ue(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||$l(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if($l(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 Dl)u=Cl(t.firestore,ql),h=Ia(t._key.path),c={next:n=>{e[o]&&e[o](Ud(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Cl(t,Ll);u=Cl(n.firestore,ql),h=n._query;const r=new Ld(u);c={next:t=>{e[o]&&e[o](new Rd(u,r,n,t))},error:e[o+1],complete:e[o+2]},md(t._query)}return function(t,e,n,r){const s=new Ul(r),i=new Yh(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>Kh(await Hl(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>Wh(await Hl(t),i)))}}(Kl(u),h,a,c)}function Ud(t,e,n){const r=n.docs.get(e._key),s=new Ld(t);return new kd(t,s,e._key,r,new Cd(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Ii=Ut,Dt(new he("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new ql(new Bi(t.getProvider("auth-internal")),new qi(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Mi(Pi.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new fo(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),Bt(Ei,"3.8.0",t),Bt(Ei,"3.8.0","esm2017")}();
2070
2070
  /**
2071
2071
  * @license
2072
2072
  * Copyright 2020 Google LLC
@@ -2083,7 +2083,7 @@ class Id{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2083
2083
  * See the License for the specific language governing permissions and
2084
2084
  * limitations under the License.
2085
2085
  */
2086
- Ut("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){return Md.instance||(Md.instance=new Md),Md.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Ud.firebase:xd.firebase}get api(){return"prod"===this.env?Ud.api:xd.api}get config(){return"prod"===this.env?Ud.config:xd.config}}const xd={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:Number("120000"),vtoTimeout:Number("120000")}},Ud={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:Number("120000"),vtoTimeout:Number("120000")}};var Fd=1e3,Vd=6e4,Bd=36e5,Hd="millisecond",jd="second",$d="minute",qd="hour",Kd="day",Wd="week",Gd="month",zd="quarter",Qd="year",Yd="date",Jd="Invalid Date",Xd=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,Zd=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,tf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},ef=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},nf={s:ef,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+ef(r,2,"0")+":"+ef(s,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),s=e.clone().add(r,Gd),i=n-s<0,o=e.clone().add(r+(i?-1:1),Gd);return+(-(r+(n-s)/(i?s-o:o-s))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Gd,y:Qd,w:Wd,d:Kd,D:Yd,h:qd,m:$d,s:jd,ms:Hd,Q:zd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},rf="en",sf={};sf[rf]=tf;var of="$isDayjsObject",af=function(t){return t instanceof lf||!(!t||!t[of])},cf=function t(e,n,r){var s;if(!e)return rf;if("string"==typeof e){var i=e.toLowerCase();sf[i]&&(s=i),n&&(sf[i]=n,s=i);var o=e.split("-");if(!s&&o.length>1)return t(o[0])}else{var a=e.name;sf[a]=e,s=a}return!r&&s&&(rf=s),s||!r&&rf},uf=function(t,e){if(af(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new lf(n)},hf=nf;hf.l=cf,hf.i=af,hf.w=function(t,e){return uf(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var lf=function(){function t(t){this.$L=cf(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[of]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(hf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(Xd);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return hf},e.isValid=function(){return!(this.$d.toString()===Jd)},e.isSame=function(t,e){var n=uf(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return uf(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<uf(t)},e.$g=function(t,e,n){return hf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!hf.u(e)||e,s=hf.p(t),i=function(t,e){var s=hf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?s:s.endOf(Kd)},o=function(t,e){return hf.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,u=this.$D,h="set"+(this.$u?"UTC":"");switch(s){case Qd:return r?i(1,0):i(31,11);case Gd:return r?i(1,c):i(0,c+1);case Wd:var l=this.$locale().weekStart||0,d=(a<l?a+7:a)-l;return i(r?u-d:u+(6-d),c);case Kd:case Yd:return o(h+"Hours",0);case qd:return o(h+"Minutes",1);case $d:return o(h+"Seconds",2);case jd:return o(h+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=hf.p(t),s="set"+(this.$u?"UTC":""),i=(n={},n[Kd]=s+"Date",n[Yd]=s+"Date",n[Gd]=s+"Month",n[Qd]=s+"FullYear",n[qd]=s+"Hours",n[$d]=s+"Minutes",n[jd]=s+"Seconds",n[Hd]=s+"Milliseconds",n)[r],o=r===Kd?this.$D+(e-this.$W):e;if(r===Gd||r===Qd){var a=this.clone().set(Yd,1);a.$d[i](o),a.init(),this.$d=a.set(Yd,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[hf.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var s=hf.p(e),i=function(e){var n=uf(r);return hf.w(n.date(n.date()+Math.round(e*t)),r)};if(s===Gd)return this.set(Gd,this.$M+t);if(s===Qd)return this.set(Qd,this.$y+t);if(s===Kd)return i(1);if(s===Wd)return i(7);var o=(n={},n[$d]=Vd,n[qd]=Bd,n[jd]=Fd,n)[s]||1,a=this.$d.getTime()+t*o;return hf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||Jd;var r=t||"YYYY-MM-DDTHH:mm:ssZ",s=hf.z(this),i=this.$H,o=this.$m,a=this.$M,c=n.weekdays,u=n.months,h=n.meridiem,l=function(t,n,s,i){return t&&(t[n]||t(e,r))||s[n].slice(0,i)},d=function(t){return hf.s(i%12||12,t,"0")},f=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(Zd,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return hf.s(e.$y,4,"0");case"M":return a+1;case"MM":return hf.s(a+1,2,"0");case"MMM":return l(n.monthsShort,a,u,3);case"MMMM":return l(u,a);case"D":return e.$D;case"DD":return hf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(n.weekdaysMin,e.$W,c,2);case"ddd":return l(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(i);case"HH":return hf.s(i,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(i,o,!0);case"A":return f(i,o,!1);case"m":return String(o);case"mm":return hf.s(o,2,"0");case"s":return String(e.$s);case"ss":return hf.s(e.$s,2,"0");case"SSS":return hf.s(e.$ms,3,"0");case"Z":return s}return null}(t)||s.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,s=this,i=hf.p(e),o=uf(t),a=(o.utcOffset()-this.utcOffset())*Vd,c=this-o,u=function(){return hf.m(s,o)};switch(i){case Qd:r=u()/12;break;case Gd:r=u();break;case zd:r=u()/3;break;case Wd:r=(c-a)/6048e5;break;case Kd:r=(c-a)/864e5;break;case qd:r=c/Bd;break;case $d:r=c/Vd;break;case jd:r=c/Fd;break;default:r=c}return n?r:hf.a(r)},e.daysInMonth=function(){return this.endOf(Gd).$D},e.$locale=function(){return sf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=cf(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return hf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),df=lf.prototype;function ff(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 pf(){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."}}uf.prototype=df,[["$ms",Hd],["$s",jd],["$m",$d],["$H",qd],["$W",Kd],["$M",Gd],["$y",Qd],["$D",Yd]].forEach((function(t){df[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),uf.extend=function(t,e){return t.$i||(t(e,lf,uf),t.$i=!0),uf},uf.locale=cf,uf.isDayjs=af,uf.unix=function(t){return uf(1e3*t)},uf.en=sf[rf],uf.Ls=sf,uf.p={},"function"==typeof SuppressedError&&SuppressedError;const gf=pf,mf=new p("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."}),yf="auth/user-disabled",vf=new L("@firebase/auth");function wf(t,...e){vf.logLevel<=k.ERROR&&vf.error(`Auth (${Pt}): ${t}`,...e)}
2086
+ Bt("firebase","10.13.0","app");class Fd{constructor(){}static getInstance(){return Fd.instance||(Fd.instance=new Fd),Fd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Bd.firebase:Vd.firebase}get api(){return"prod"===this.env?Bd.api:Vd.api}get config(){return"prod"===this.env?Bd.config:Vd.config}}const Vd={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:Number("120000"),vtoTimeout:Number("120000")}},Bd={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:Number("120000"),vtoTimeout:Number("120000")}};var Hd=1e3,jd=6e4,$d=36e5,qd="millisecond",Kd="second",Wd="minute",Gd="hour",zd="day",Qd="week",Yd="month",Jd="quarter",Xd="year",Zd="date",tf="Invalid Date",ef=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,nf=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,rf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},sf=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},of={s:sf,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+sf(r,2,"0")+":"+sf(s,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),s=e.clone().add(r,Yd),i=n-s<0,o=e.clone().add(r+(i?-1:1),Yd);return+(-(r+(n-s)/(i?s-o:o-s))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Yd,y:Xd,w:Qd,d:zd,D:Zd,h:Gd,m:Wd,s:Kd,ms:qd,Q:Jd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},af="en",cf={};cf[af]=rf;var uf="$isDayjsObject",hf=function(t){return t instanceof pf||!(!t||!t[uf])},lf=function t(e,n,r){var s;if(!e)return af;if("string"==typeof e){var i=e.toLowerCase();cf[i]&&(s=i),n&&(cf[i]=n,s=i);var o=e.split("-");if(!s&&o.length>1)return t(o[0])}else{var a=e.name;cf[a]=e,s=a}return!r&&s&&(af=s),s||!r&&af},df=function(t,e){if(hf(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new pf(n)},ff=of;ff.l=lf,ff.i=hf,ff.w=function(t,e){return df(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var pf=function(){function t(t){this.$L=lf(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[uf]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(ff.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(ef);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return ff},e.isValid=function(){return!(this.$d.toString()===tf)},e.isSame=function(t,e){var n=df(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return df(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<df(t)},e.$g=function(t,e,n){return ff.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!ff.u(e)||e,s=ff.p(t),i=function(t,e){var s=ff.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?s:s.endOf(zd)},o=function(t,e){return ff.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,u=this.$D,h="set"+(this.$u?"UTC":"");switch(s){case Xd:return r?i(1,0):i(31,11);case Yd:return r?i(1,c):i(0,c+1);case Qd:var l=this.$locale().weekStart||0,d=(a<l?a+7:a)-l;return i(r?u-d:u+(6-d),c);case zd:case Zd:return o(h+"Hours",0);case Gd:return o(h+"Minutes",1);case Wd:return o(h+"Seconds",2);case Kd:return o(h+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=ff.p(t),s="set"+(this.$u?"UTC":""),i=(n={},n[zd]=s+"Date",n[Zd]=s+"Date",n[Yd]=s+"Month",n[Xd]=s+"FullYear",n[Gd]=s+"Hours",n[Wd]=s+"Minutes",n[Kd]=s+"Seconds",n[qd]=s+"Milliseconds",n)[r],o=r===zd?this.$D+(e-this.$W):e;if(r===Yd||r===Xd){var a=this.clone().set(Zd,1);a.$d[i](o),a.init(),this.$d=a.set(Zd,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[ff.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var s=ff.p(e),i=function(e){var n=df(r);return ff.w(n.date(n.date()+Math.round(e*t)),r)};if(s===Yd)return this.set(Yd,this.$M+t);if(s===Xd)return this.set(Xd,this.$y+t);if(s===zd)return i(1);if(s===Qd)return i(7);var o=(n={},n[Wd]=jd,n[Gd]=$d,n[Kd]=Hd,n)[s]||1,a=this.$d.getTime()+t*o;return ff.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||tf;var r=t||"YYYY-MM-DDTHH:mm:ssZ",s=ff.z(this),i=this.$H,o=this.$m,a=this.$M,c=n.weekdays,u=n.months,h=n.meridiem,l=function(t,n,s,i){return t&&(t[n]||t(e,r))||s[n].slice(0,i)},d=function(t){return ff.s(i%12||12,t,"0")},f=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(nf,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return ff.s(e.$y,4,"0");case"M":return a+1;case"MM":return ff.s(a+1,2,"0");case"MMM":return l(n.monthsShort,a,u,3);case"MMMM":return l(u,a);case"D":return e.$D;case"DD":return ff.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(n.weekdaysMin,e.$W,c,2);case"ddd":return l(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(i);case"HH":return ff.s(i,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(i,o,!0);case"A":return f(i,o,!1);case"m":return String(o);case"mm":return ff.s(o,2,"0");case"s":return String(e.$s);case"ss":return ff.s(e.$s,2,"0");case"SSS":return ff.s(e.$ms,3,"0");case"Z":return s}return null}(t)||s.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,s=this,i=ff.p(e),o=df(t),a=(o.utcOffset()-this.utcOffset())*jd,c=this-o,u=function(){return ff.m(s,o)};switch(i){case Xd:r=u()/12;break;case Yd:r=u();break;case Jd:r=u()/3;break;case Qd:r=(c-a)/6048e5;break;case zd:r=(c-a)/864e5;break;case Gd:r=c/$d;break;case Wd:r=c/jd;break;case Kd:r=c/Hd;break;default:r=c}return n?r:ff.a(r)},e.daysInMonth=function(){return this.endOf(Yd).$D},e.$locale=function(){return cf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=lf(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return ff.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),gf=pf.prototype;function mf(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 yf(){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."}}df.prototype=gf,[["$ms",qd],["$s",Kd],["$m",Wd],["$H",Gd],["$W",zd],["$M",Yd],["$y",Xd],["$D",Zd]].forEach((function(t){gf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),df.extend=function(t,e){return t.$i||(t(e,pf,df),t.$i=!0),df},df.locale=lf,df.isDayjs=hf,df.unix=function(t){return df(1e3*t)},df.en=cf[af],df.Ls=cf,df.p={},"function"==typeof SuppressedError&&SuppressedError;const vf=yf,wf=new p("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."}),_f="auth/user-disabled",Tf=new L("@firebase/auth");function Ef(t,...e){Tf.logLevel<=k.ERROR&&Tf.error(`Auth (${Ut}): ${t}`,...e)}
2087
2087
  /**
2088
2088
  * @license
2089
2089
  * Copyright 2020 Google LLC
@@ -2099,7 +2099,7 @@ Ut("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
2099
2099
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2100
2100
  * See the License for the specific language governing permissions and
2101
2101
  * limitations under the License.
2102
- */function _f(t,...e){throw Ef(t,...e)}function Tf(t,...e){return Ef(t,...e)}function Ef(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 mf.create(t,...e)}function Sf(t,e,...n){if(!t)throw Ef(e,...n)}function If(t){const e="INTERNAL ASSERTION FAILED: "+t;throw wf(e),new Error(e)}function bf(t,e){t||If(e)}
2102
+ */function Sf(t,...e){throw Cf(t,...e)}function If(t,...e){return Cf(t,...e)}function bf(t,e,n){const r=Object.assign(Object.assign({},vf()),{[e]:n});return new p("auth","Firebase",r).create(e,{appName:t.name})}function Af(t){return bf(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Cf(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 wf.create(t,...e)}function kf(t,e,...n){if(!t)throw Cf(e,...n)}function Nf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Ef(e),new Error(e)}function Rf(t,e){t||Nf(e)}
2103
2103
  /**
2104
2104
  * @license
2105
2105
  * Copyright 2020 Google LLC
@@ -2115,7 +2115,7 @@ Ut("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
2115
2115
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2116
2116
  * See the License for the specific language governing permissions and
2117
2117
  * limitations under the License.
2118
- */function Af(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Cf(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2118
+ */function Of(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Df(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2119
2119
  /**
2120
2120
  * @license
2121
2121
  * Copyright 2020 Google LLC
@@ -2131,7 +2131,7 @@ Ut("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
2131
2131
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2132
2132
  * See the License for the specific language governing permissions and
2133
2133
  * limitations under the License.
2134
- */function kf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Cf()&&"https:"!==Cf()&&!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}
2134
+ */function Lf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Df()&&"https:"!==Df()&&!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}
2135
2135
  /**
2136
2136
  * @license
2137
2137
  * Copyright 2020 Google LLC
@@ -2148,7 +2148,7 @@ Ut("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
2148
2148
  * See the License for the specific language governing permissions and
2149
2149
  * limitations under the License.
2150
2150
  */
2151
- class Rf{constructor(t,e){this.shortDelay=t,this.longDelay=e,bf(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(d())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return kf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2151
+ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(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(d())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Lf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2152
2152
  /**
2153
2153
  * @license
2154
2154
  * Copyright 2020 Google LLC
@@ -2164,7 +2164,7 @@ class Rf{constructor(t,e){this.shortDelay=t,this.longDelay=e,bf(e>t,"Short delay
2164
2164
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2165
2165
  * See the License for the specific language governing permissions and
2166
2166
  * limitations under the License.
2167
- */function Nf(t,e){bf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2167
+ */function Mf(t,e){Rf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2168
2168
  /**
2169
2169
  * @license
2170
2170
  * Copyright 2020 Google LLC
@@ -2180,7 +2180,7 @@ class Rf{constructor(t,e){this.shortDelay=t,this.longDelay=e,bf(e>t,"Short delay
2180
2180
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2181
2181
  * See the License for the specific language governing permissions and
2182
2182
  * limitations under the License.
2183
- */class Df{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 If("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 If("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 If("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2183
+ */class xf{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:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Nf("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:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Nf("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:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Nf("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2184
2184
  /**
2185
2185
  * @license
2186
2186
  * Copyright 2020 Google LLC
@@ -2196,7 +2196,7 @@ class Rf{constructor(t,e){this.shortDelay=t,this.longDelay=e,bf(e>t,"Short delay
2196
2196
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2197
2197
  * See the License for the specific language governing permissions and
2198
2198
  * limitations under the License.
2199
- */const Of={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:"missing-password",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",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Lf=new Rf(3e4,6e4);
2199
+ */const Uf={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:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",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",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",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",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Ff=new Pf(3e4,6e4);
2200
2200
  /**
2201
2201
  * @license
2202
2202
  * Copyright 2020 Google LLC
@@ -2212,7 +2212,7 @@ class Rf{constructor(t,e){this.shortDelay=t,this.longDelay=e,bf(e>t,"Short delay
2212
2212
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2213
2213
  * See the License for the specific language governing permissions and
2214
2214
  * limitations under the License.
2215
- */function Pf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Mf(t,e,n,r,s={}){return xf(t,s,(async()=>{let s={},i={};r&&("GET"===e?i=r:s={body:JSON.stringify(r)});const o=v(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),Df.fetch()(Ff(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function xf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Of),e);try{const e=new Vf(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw Bf(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 Bf(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Bf(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw Bf(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({},gf()),{[e]:n});return new p("auth","Firebase",r).create(e,{appName:t.name})}(t,a,o);_f(t,a)}}catch(e){if(e instanceof f)throw e;_f(t,"network-request-failed",{message:String(e)})}}async function Uf(t,e,n,r,s={}){const i=await Mf(t,e,n,r,s);return"mfaPendingCredential"in i&&_f(t,"multi-factor-auth-required",{_serverResponse:i}),i}function Ff(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?Nf(t.config,s):`${t.config.apiScheme}://${s}`}class Vf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(Tf(this.auth,"network-request-failed"))),Lf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Bf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Tf(t,e,r);return s.customData._tokenResponse=n,s}
2215
+ */function Vf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Bf(t,e,n,r,s={}){return Hf(t,s,(async()=>{let s={},i={};r&&("GET"===e?i=r:s={body:JSON.stringify(r)});const o=v(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),xf.fetch()($f(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function Hf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Uf),e);try{const e=new Kf(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw Wf(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 Wf(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Wf(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw Wf(t,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw bf(t,a,o);Sf(t,a)}}catch(e){if(e instanceof f)throw e;Sf(t,"network-request-failed",{message:String(e)})}}async function jf(t,e,n,r,s={}){const i=await Bf(t,e,n,r,s);return"mfaPendingCredential"in i&&Sf(t,"multi-factor-auth-required",{_serverResponse:i}),i}function $f(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?Mf(t.config,s):`${t.config.apiScheme}://${s}`}function qf(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Kf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(If(this.auth,"network-request-failed"))),Ff.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Wf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=If(t,e,r);return s.customData._tokenResponse=n,s}function Gf(t){return void 0!==t&&void 0!==t.enterprise}class zf{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return qf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Qf(t,e){return Bf(t,"POST","/v1/accounts:lookup",e)}
2216
2216
  /**
2217
2217
  * @license
2218
2218
  * Copyright 2020 Google LLC
@@ -2228,7 +2228,7 @@ class Rf{constructor(t,e){this.shortDelay=t,this.longDelay=e,bf(e>t,"Short delay
2228
2228
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2229
2229
  * See the License for the specific language governing permissions and
2230
2230
  * limitations under the License.
2231
- */
2231
+ */function Yf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Jf(t){return 1e3*Number(t)}function Xf(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return Ef("JWT malformed, contained fewer than 3 sections"),null;try{const t=o(n);return t?JSON.parse(t):(Ef("Failed to decode base64 JWT payload"),null)}catch(t){return Ef("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function Zf(t){const e=Xf(t);return kf(e,"internal-error"),kf(void 0!==e.exp,"internal-error"),kf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
2232
2232
  /**
2233
2233
  * @license
2234
2234
  * Copyright 2020 Google LLC
@@ -2244,8 +2244,7 @@ class Rf{constructor(t,e){this.shortDelay=t,this.longDelay=e,bf(e>t,"Short delay
2244
2244
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2245
2245
  * See the License for the specific language governing permissions and
2246
2246
  * limitations under the License.
2247
- */
2248
- function Hf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function jf(t){return 1e3*Number(t)}function $f(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return wf("JWT malformed, contained fewer than 3 sections"),null;try{const t=o(n);return t?JSON.parse(t):(wf("Failed to decode base64 JWT payload"),null)}catch(t){return wf("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}
2247
+ */async function tp(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof f&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
2249
2248
  /**
2250
2249
  * @license
2251
2250
  * Copyright 2020 Google LLC
@@ -2261,8 +2260,7 @@ function Hf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))retur
2261
2260
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2262
2261
  * See the License for the specific language governing permissions and
2263
2262
  * limitations under the License.
2264
- */
2265
- async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof f&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
2263
+ */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class ep{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()}}
2266
2264
  /**
2267
2265
  * @license
2268
2266
  * Copyright 2020 Google LLC
@@ -2278,10 +2276,10 @@ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2278
2276
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2279
2277
  * See the License for the specific language governing permissions and
2280
2278
  * limitations under the License.
2281
- */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class Kf{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()}}
2279
+ */class np{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Yf(this.lastLoginAt),this.creationTime=Yf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2282
2280
  /**
2283
2281
  * @license
2284
- * Copyright 2020 Google LLC
2282
+ * Copyright 2019 Google LLC
2285
2283
  *
2286
2284
  * Licensed under the Apache License, Version 2.0 (the "License");
2287
2285
  * you may not use this file except in compliance with the License.
@@ -2294,10 +2292,10 @@ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2294
2292
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2295
2293
  * See the License for the specific language governing permissions and
2296
2294
  * limitations under the License.
2297
- */class Wf{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Hf(this.lastLoginAt),this.creationTime=Hf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2295
+ */async function rp(t){var e;const n=t.auth,r=await t.getIdToken(),s=await tp(t,Qf(n,{idToken:r}));kf(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)?sp(i.providerUserInfo):[],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 np(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}function sp(t){return t.map((t=>{var{providerId:e}=t,n=mf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}
2298
2296
  /**
2299
2297
  * @license
2300
- * Copyright 2019 Google LLC
2298
+ * Copyright 2020 Google LLC
2301
2299
  *
2302
2300
  * Licensed under the Apache License, Version 2.0 (the "License");
2303
2301
  * you may not use this file except in compliance with the License.
@@ -2310,7 +2308,7 @@ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2310
2308
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2311
2309
  * See the License for the specific language governing permissions and
2312
2310
  * limitations under the License.
2313
- */async function Gf(t){var e;const n=t.auth,r=await t.getIdToken(),s=await qf(t,async function(t,e){return Mf(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:r}));Sf(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=ff(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 Wf(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}
2311
+ */
2314
2312
  /**
2315
2313
  * @license
2316
2314
  * Copyright 2020 Google LLC
@@ -2327,7 +2325,7 @@ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2327
2325
  * See the License for the specific language governing permissions and
2328
2326
  * limitations under the License.
2329
2327
  */
2330
- class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Sf(t.idToken,"internal-error"),Sf(void 0!==t.idToken,"internal-error"),Sf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=$f(t);return Sf(e,"internal-error"),Sf(void 0!==e.exp,"internal-error"),Sf(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 Sf(!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}=
2328
+ class ip{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){kf(t.idToken,"internal-error"),kf(void 0!==t.idToken,"internal-error"),kf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):Zf(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){kf(0!==t.length,"internal-error");const e=Zf(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(kf(this.refreshToken,t,"user-token-expired"),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 async function(t,e){const n=await Hf(t,{},(async()=>{const n=v({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=$f(t,r,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",xf.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 ip;return n&&(kf("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(kf("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(kf("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 ip,this.toJSON())}_performRefresh(){return Nf("not implemented")}}
2331
2329
  /**
2332
2330
  * @license
2333
2331
  * Copyright 2020 Google LLC
@@ -2343,7 +2341,7 @@ class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2343
2341
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2344
2342
  * See the License for the specific language governing permissions and
2345
2343
  * limitations under the License.
2346
- */await async function(t,e){const n=await xf(t,{},(async()=>{const n=v({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=Ff(t,r,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Df.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 zf;return n&&(Sf("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(Sf("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(Sf("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 zf,this.toJSON())}_performRefresh(){return If("not implemented")}}
2344
+ */function op(t,e){kf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class ap{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,s=mf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ep(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 np(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await tp(this,this.stsTokenManager.getToken(this.auth,t));return kf(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=S(t),r=await n.getIdToken(e),s=Xf(r);kf(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:Yf(Jf(s.auth_time)),issuedAtTime:Yf(Jf(s.iat)),expirationTime:Yf(Jf(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=S(t);await rp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(kf(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){const e=new ap(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){kf(!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 rp(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pt(this.auth.app))return Promise.reject(Af(this.auth));const t=await this.getIdToken();return await tp(this,
2347
2345
  /**
2348
2346
  * @license
2349
2347
  * Copyright 2020 Google LLC
@@ -2359,7 +2357,8 @@ class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2359
2357
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2360
2358
  * See the License for the specific language governing permissions and
2361
2359
  * limitations under the License.
2362
- */function Qf(t,e){Sf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Yf{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,s=ff(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Kf(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 Wf(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await qf(this,this.stsTokenManager.getToken(this.auth,t));return Sf(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=S(t),r=await n.getIdToken(e),s=$f(r);Sf(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:Hf(jf(s.auth_time)),issuedAtTime:Hf(jf(s.iat)),expirationTime:Hf(jf(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=S(t);await Gf(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Sf(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){const e=new Yf(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Sf(!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 Gf(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await qf(this,async function(t,e){return Mf(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:_,providerData:T,stsTokenManager:E}=e;Sf(v&&E,t,"internal-error");const S=zf.fromJSON(this.name,E);Sf("string"==typeof v,t,"internal-error"),Qf(h,t.name),Qf(l,t.name),Sf("boolean"==typeof w,t,"internal-error"),Sf("boolean"==typeof _,t,"internal-error"),Qf(d,t.name),Qf(f,t.name),Qf(p,t.name),Qf(g,t.name),Qf(m,t.name),Qf(y,t.name);const I=new Yf({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:S,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(I.providerData=T.map((t=>Object.assign({},t)))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(t,e,n=!1){const r=new zf;r.updateFromServerResponse(e);const s=new Yf({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await Gf(s),s}}
2360
+ */
2361
+ async function(t,e){return Bf(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:_,providerData:T,stsTokenManager:E}=e;kf(v&&E,t,"internal-error");const S=ip.fromJSON(this.name,E);kf("string"==typeof v,t,"internal-error"),op(h,t.name),op(l,t.name),kf("boolean"==typeof w,t,"internal-error"),kf("boolean"==typeof _,t,"internal-error"),op(d,t.name),op(f,t.name),op(p,t.name),op(g,t.name),op(m,t.name),op(y,t.name);const I=new ap({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:S,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(I.providerData=T.map((t=>Object.assign({},t)))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(t,e,n=!1){const r=new ip;r.updateFromServerResponse(e);const s=new ap({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await rp(s),s}static async _fromGetAccountInfoResponse(t,e,n){const r=e.users[0];kf(void 0!==r.localId,"internal-error");const s=void 0!==r.providerUserInfo?sp(r.providerUserInfo):[],i=!(r.email&&r.passwordHash||(null==s?void 0:s.length)),o=new ip;o.updateFromIdToken(n);const a=new ap({uid:r.localId,auth:t,stsTokenManager:o,isAnonymous:i}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new np(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||(null==s?void 0:s.length))};return Object.assign(a,c),a}}
2363
2362
  /**
2364
2363
  * @license
2365
2364
  * Copyright 2020 Google LLC
@@ -2375,7 +2374,7 @@ class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
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
- */const Jf=new Map;function Xf(t){bf(t instanceof Function,"Expected a class definition");let e=Jf.get(t);return e?(bf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Jf.set(t,e),e)}
2377
+ */const cp=new Map;function up(t){Rf(t instanceof Function,"Expected a class definition");let e=cp.get(t);return e?(Rf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,cp.set(t,e),e)}
2379
2378
  /**
2380
2379
  * @license
2381
2380
  * Copyright 2019 Google LLC
@@ -2391,7 +2390,7 @@ class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
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
- */class Zf{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){}}Zf.type="NONE";const tp=Zf;
2393
+ */class hp{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){}}hp.type="NONE";const lp=hp;
2395
2394
  /**
2396
2395
  * @license
2397
2396
  * Copyright 2019 Google LLC
@@ -2407,7 +2406,7 @@ class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
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
- */function ep(t,e,n){return`firebase:${t}:${e}:${n}`}class np{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=ep(this.userKey,r.apiKey,s),this.fullPersistenceKey=ep("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?Yf._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 np(Xf(tp),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||Xf(tp);const i=ep(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=Yf._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 np(s,t,n)):new np(s,t,n)}}
2409
+ */function dp(t,e,n){return`firebase:${t}:${e}:${n}`}class fp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=dp(this.userKey,r.apiKey,s),this.fullPersistenceKey=dp("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?ap._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 fp(up(lp),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||up(lp);const i=dp(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=ap._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 fp(s,t,n)):new fp(s,t,n)}}
2411
2410
  /**
2412
2411
  * @license
2413
2412
  * Copyright 2020 Google LLC
@@ -2423,7 +2422,7 @@ class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2423
2422
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2424
2423
  * See the License for the specific language governing permissions and
2425
2424
  * limitations under the License.
2426
- */function rp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(ap(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(sp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(up(e))return"Blackberry";if(hp(e))return"Webos";if(ip(e))return"Safari";if((e.includes("chrome/")||op(e))&&!e.includes("edge/"))return"Chrome";if(cp(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 sp(t=d()){return/firefox\//i.test(t)}function ip(t=d()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function op(t=d()){return/crios\//i.test(t)}function ap(t=d()){return/iemobile/i.test(t)}function cp(t=d()){return/android/i.test(t)}function up(t=d()){return/blackberry/i.test(t)}function hp(t=d()){return/webos/i.test(t)}function lp(t=d()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function dp(){return function(){const t=d();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function fp(t=d()){return lp(t)||cp(t)||hp(t)||up(t)||/windows phone/i.test(t)||ap(t)}
2425
+ */function pp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(vp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(gp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(_p(e))return"Blackberry";if(Tp(e))return"Webos";if(mp(e))return"Safari";if((e.includes("chrome/")||yp(e))&&!e.includes("edge/"))return"Chrome";if(wp(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 gp(t=d()){return/firefox\//i.test(t)}function mp(t=d()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function yp(t=d()){return/crios\//i.test(t)}function vp(t=d()){return/iemobile/i.test(t)}function wp(t=d()){return/android/i.test(t)}function _p(t=d()){return/blackberry/i.test(t)}function Tp(t=d()){return/webos/i.test(t)}function Ep(t=d()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Sp(){return function(){const t=d();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function Ip(t=d()){return Ep(t)||wp(t)||Tp(t)||_p(t)||/windows phone/i.test(t)||vp(t)}
2427
2426
  /**
2428
2427
  * @license
2429
2428
  * Copyright 2020 Google LLC
@@ -2439,8 +2438,39 @@ class zf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2439
2438
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2440
2439
  * See the License for the specific language governing permissions and
2441
2440
  * limitations under the License.
2442
- */
2443
- function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n=`${rp(d())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Pt}/${r}`}async function gp(t,e){return Mf(t,"GET","/v2/recaptchaConfig",Pf(t,e))}function mp(t){return void 0!==t&&void 0!==t.enterprise}class yp{constructor(t){if(this.siteKey="",this.emailPasswordEnabled=!1,void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.emailPasswordEnabled=t.recaptchaEnforcementState.some((t=>"EMAIL_PASSWORD_PROVIDER"===t.provider&&"OFF"!==t.enforcementState))}}
2441
+ */function bp(t,e=[]){let n;switch(t){case"Browser":n=pp(d());break;case"Worker":n=`${pp(d())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ut}/${r}`}
2442
+ /**
2443
+ * @license
2444
+ * Copyright 2022 Google LLC
2445
+ *
2446
+ * Licensed under the Apache License, Version 2.0 (the "License");
2447
+ * you may not use this file except in compliance with the License.
2448
+ * You may obtain a copy of the License at
2449
+ *
2450
+ * http://www.apache.org/licenses/LICENSE-2.0
2451
+ *
2452
+ * Unless required by applicable law or agreed to in writing, software
2453
+ * distributed under the License is distributed on an "AS IS" BASIS,
2454
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2455
+ * See the License for the specific language governing permissions and
2456
+ * limitations under the License.
2457
+ */class Ap{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})}}}
2458
+ /**
2459
+ * @license
2460
+ * Copyright 2023 Google LLC
2461
+ *
2462
+ * Licensed under the Apache License, Version 2.0 (the "License");
2463
+ * you may not use this file except in compliance with the License.
2464
+ * You may obtain a copy of the License at
2465
+ *
2466
+ * http://www.apache.org/licenses/LICENSE-2.0
2467
+ *
2468
+ * Unless required by applicable law or agreed to in writing, software
2469
+ * distributed under the License is distributed on an "AS IS" BASIS,
2470
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2471
+ * See the License for the specific language governing permissions and
2472
+ * limitations under the License.
2473
+ */class Cp{constructor(t){var e,n,r,s;const i=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=i.minPasswordLength)&&void 0!==e?e:6,i.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=i.maxPasswordLength),void 0!==i.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=i.containsLowercaseCharacter),void 0!==i.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=i.containsUppercaseCharacter),void 0!==i.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=i.containsNumericCharacter),void 0!==i.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=i.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(s=t.forceUpgradeOnSignin)&&void 0!==s&&s,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,r,s,i,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsUppercaseLetter)||void 0===s||s),a.isValid&&(a.isValid=null===(i=a.containsNumericCharacter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),r&&(e.meetsMaxPasswordLength=t.length<=r)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let r=0;r<t.length;r++)n=t.charAt(r),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,r,s){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=s))}}
2444
2474
  /**
2445
2475
  * @license
2446
2476
  * Copyright 2020 Google LLC
@@ -2456,10 +2486,10 @@ function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n
2456
2486
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2457
2487
  * See the License for the specific language governing permissions and
2458
2488
  * limitations under the License.
2459
- */function vp(t){return new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=Tf("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)}))}class wp{constructor(t){this.type="recaptcha-enterprise",this.auth=Sp(t)}async verify(t="verify",e=!1){function n(e,n,r){const s=window.grecaptcha;mp(s)?s.enterprise.ready((()=>{s.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,r)=>{(async function(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{gp(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new yp(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))})(this.auth).then((s=>{if(!e&&mp(window.grecaptcha))n(s,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));vp("https://www.google.com/recaptcha/enterprise.js?render="+s).then((()=>{n(s,t,r)})).catch((t=>{r(t)}))}})).catch((t=>{r(t)}))}))}}async function _p(t,e,n,r=!1){const s=new wp(t);let i;try{i=await s.verify(n)}catch(t){i=await s.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:i}):Object.assign(o,{captchaResponse:i}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}
2489
+ */class kp{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Rp(this),this.idTokenSubscription=new Rp(this),this.beforeStateQueue=new Ap(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=wf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=up(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await fp.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 initializeCurrentUserFromIdToken(t){try{const e=await Qf(this,{idToken:t}),n=await ap._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var e;if(Pt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise((e=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(t).then(e,e)))})):this.directlySetCurrentUser(null)}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 kf(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 rp(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){if(Pt(this.app))return Promise.reject(Af(this));const e=t?S(t):null;return e&&kf(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&&kf(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 Pt(this.app)?Promise.reject(Af(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Pt(this.app)?Promise.reject(Af(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(up(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Bf(t,"GET","/v2/passwordPolicy",Vf(t,e))}
2460
2490
  /**
2461
2491
  * @license
2462
- * Copyright 2022 Google LLC
2492
+ * Copyright 2023 Google LLC
2463
2493
  *
2464
2494
  * Licensed under the Apache License, Version 2.0 (the "License");
2465
2495
  * you may not use this file except in compliance with the License.
@@ -2472,7 +2502,7 @@ function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n
2472
2502
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2473
2503
  * See the License for the specific language governing permissions and
2474
2504
  * limitations under the License.
2475
- */class Tp{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})}}}
2505
+ */(this),e=new Cp(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new p("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)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Bf(t,"POST","/v2/accounts:revokeToken",Vf(t,e))}(this,e)}}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&&up(t)||this._popupRedirectResolver;kf(e,this,"argument-error"),this.redirectPersistenceManager=await fp.create(this,[up(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);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(kf(o,this,"internal-error"),o.then((()=>{i||s(this.currentUser)})),"function"==typeof e){const s=t.addObserver(e,n,r);return()=>{i=!0,s()}}{const n=t.addObserver(e);return()=>{i=!0,n()}}}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 kf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=bp(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());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){Tf.logLevel<=k.WARN&&Tf.warn(`Auth (${Ut}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Np(t){return S(t)}class Rp{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new T(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return kf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2476
2506
  /**
2477
2507
  * @license
2478
2508
  * Copyright 2020 Google LLC
@@ -2488,7 +2518,7 @@ function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n
2488
2518
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2489
2519
  * See the License for the specific language governing permissions and
2490
2520
  * limitations under the License.
2491
- */class Ep{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ip(this),this.idTokenSubscription=new Ip(this),this.beforeStateQueue=new Tp(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=mf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Xf(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await np.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 Sf(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 Gf(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?S(t):null;return e&&Sf(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&&Sf(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(Xf(t))}))}async initializeRecaptchaConfig(){const t=await gp(this,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),e=new yp(t);if(null==this.tenantId?this._agentRecaptchaConfig=e:this._tenantRecaptchaConfigs[this.tenantId]=e,e.emailPasswordEnabled){new wp(this).verify()}}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new p("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&&Xf(t)||this._popupRedirectResolver;Sf(e,this,"argument-error"),this.redirectPersistenceManager=await np.create(this,[Xf(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 Sf(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 Sf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=pp(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());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){vf.logLevel<=k.WARN&&vf.warn(`Auth (${Pt}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Sp(t){return S(t)}class Ip{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new T(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Sf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2521
+ */let Op={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Dp(t){return Op.loadJS(t)}class Lp{constructor(t){this.type="recaptcha-enterprise",this.auth=Np(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{(async function(t,e){return Bf(t,"GET","/v2/recaptchaConfig",Vf(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new zf(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))}function r(e,n,r){const s=window.grecaptcha;Gf(s)?s.enterprise.ready((()=>{s.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,s)=>{n(this.auth).then((n=>{if(!e&&Gf(window.grecaptcha))r(n,t,s);else{if("undefined"==typeof window)return void s(new Error("RecaptchaVerifier is only supported in browser"));let e=Op.recaptchaEnterpriseScript;0!==e.length&&(e+=n),Dp(e).then((()=>{r(n,t,s)})).catch((t=>{s(t)}))}})).catch((t=>{s(t)}))}))}}async function Pp(t,e,n,r=!1){const s=new Lp(t);let i;try{i=await s.verify(n)}catch(t){i=await s.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:i}):Object.assign(o,{captchaResponse:i}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Mp(t,e,n,r){var s;if(null===(s=t._getRecaptchaConfig())||void 0===s?void 0:s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await Pp(t,e,n,"getOobCode"===n);return r(t,s)}return r(t,e).catch((async s=>{if("auth/missing-recaptcha-token"===s.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const s=await Pp(t,e,n,"getOobCode"===n);return r(t,s)}return Promise.reject(s)}))}
2492
2522
  /**
2493
2523
  * @license
2494
2524
  * Copyright 2020 Google LLC
@@ -2504,7 +2534,7 @@ function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n
2504
2534
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2505
2535
  * See the License for the specific language governing permissions and
2506
2536
  * limitations under the License.
2507
- */function bp(t,e,n){const r=Sp(t);Sf(r._canInitEmulator,r,"emulator-config-failed"),Sf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=Ap(e),{host:o,port:a}=function(t){const e=Ap(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:Cp(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Cp(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())}
2537
+ */function xp(t,e,n){const r=Np(t);kf(r._canInitEmulator,r,"emulator-config-failed"),kf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=Up(e),{host:o,port:a}=function(t){const e=Up(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:Fp(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Fp(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())}
2508
2538
  /**
2509
2539
  * @license
2510
2540
  * Copyright 2020 Google LLC
@@ -2520,7 +2550,7 @@ function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n
2520
2550
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2521
2551
  * See the License for the specific language governing permissions and
2522
2552
  * limitations under the License.
2523
- */()}function Ap(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Cp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class kp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return If("not implemented")}_getIdTokenResponse(t){return If("not implemented")}_linkToIdToken(t,e){return If("not implemented")}_getReauthenticationResolver(t){return If("not implemented")}}
2553
+ */()}function Up(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Fp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Vp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Nf("not implemented")}_getIdTokenResponse(t){return Nf("not implemented")}_linkToIdToken(t,e){return Nf("not implemented")}_getReauthenticationResolver(t){return Nf("not implemented")}}
2524
2554
  /**
2525
2555
  * @license
2526
2556
  * Copyright 2020 Google LLC
@@ -2536,7 +2566,7 @@ function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n
2536
2566
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2537
2567
  * See the License for the specific language governing permissions and
2538
2568
  * limitations under the License.
2539
- */
2569
+ */async function Bp(t,e){return Bf(t,"POST","/v1/accounts:signUp",e)}
2540
2570
  /**
2541
2571
  * @license
2542
2572
  * Copyright 2020 Google LLC
@@ -2552,8 +2582,7 @@ function pp(t,e=[]){let n;switch(t){case"Browser":n=rp(d());break;case"Worker":n
2552
2582
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2553
2583
  * See the License for the specific language governing permissions and
2554
2584
  * limitations under the License.
2555
- */
2556
- async function Rp(t,e){return Uf(t,"POST","/v1/accounts:signInWithPassword",Pf(t,e))}async function Np(t,e){return async function(t,e){return Mf(t,"POST","/v1/accounts:sendOobCode",Pf(t,e))}(t,e)}
2585
+ */async function Hp(t,e){return jf(t,"POST","/v1/accounts:signInWithPassword",Vf(t,e))}async function jp(t,e){return async function(t,e){return Bf(t,"POST","/v1/accounts:sendOobCode",Vf(t,e))}(t,e)}
2557
2586
  /**
2558
2587
  * @license
2559
2588
  * Copyright 2020 Google LLC
@@ -2586,7 +2615,7 @@ async function Rp(t,e){return Uf(t,"POST","/v1/accounts:signInWithPassword",Pf(t
2586
2615
  * See the License for the specific language governing permissions and
2587
2616
  * limitations under the License.
2588
2617
  */
2589
- class Dp extends kp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new Dp(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new Dp(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){var e;switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(e=t._getRecaptchaConfig())||void 0===e?void 0:e.emailPasswordEnabled){const e=await _p(t,n,"signInWithPassword");return Rp(t,e)}return Rp(t,n).catch((async e=>{if("auth/missing-recaptcha-token"===e.code){console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");const e=await _p(t,n,"signInWithPassword");return Rp(t,e)}return Promise.reject(e)}));case"emailLink":return async function(t,e){return Uf(t,"POST","/v1/accounts:signInWithEmailLink",Pf(t,e))}(t,{email:this._email,oobCode:this._password});default:_f(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return async function(t,e){return Mf(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 Uf(t,"POST","/v1/accounts:signInWithEmailLink",Pf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:_f(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2618
+ class $p extends Vp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new $p(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new $p(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":return Mp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Hp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{email:this._email,oobCode:this._password});default:Sf(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Mp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Bp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:Sf(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2590
2619
  /**
2591
2620
  * @license
2592
2621
  * Copyright 2020 Google LLC
@@ -2602,7 +2631,7 @@ class Dp extends kp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2602
2631
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2603
2632
  * See the License for the specific language governing permissions and
2604
2633
  * limitations under the License.
2605
- */async function Op(t,e){return Uf(t,"POST","/v1/accounts:signInWithIdp",Pf(t,e))}
2634
+ */async function qp(t,e){return jf(t,"POST","/v1/accounts:signInWithIdp",Vf(t,e))}
2606
2635
  /**
2607
2636
  * @license
2608
2637
  * Copyright 2020 Google LLC
@@ -2618,7 +2647,7 @@ class Dp extends kp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2618
2647
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2619
2648
  * See the License for the specific language governing permissions and
2620
2649
  * limitations under the License.
2621
- */class Lp extends kp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Lp(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):_f("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=ff(e,["providerId","signInMethod"]);if(!n||!r)return null;const i=new Lp(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 Op(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Op(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Op(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=v(e)}return t}}
2650
+ */class Kp extends Vp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Kp(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):Sf("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=mf(e,["providerId","signInMethod"]);if(!n||!r)return null;const i=new Kp(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 qp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,qp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,qp(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=v(e)}return t}}
2622
2651
  /**
2623
2652
  * @license
2624
2653
  * Copyright 2020 Google LLC
@@ -2634,7 +2663,7 @@ class Dp extends kp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2634
2663
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2635
2664
  * See the License for the specific language governing permissions and
2636
2665
  * limitations under the License.
2637
- */class Pp{constructor(t){var e,n,r,s,i,o;const a=w(_(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);Sf(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=w(_(t)).link,n=e?w(_(e)).deep_link_id:null,r=w(_(t)).deep_link_id;return(r?w(_(r)).link:null)||r||n||e||t}(t);try{return new Pp(e)}catch(t){return null}}}
2666
+ */class Wp{constructor(t){var e,n,r,s,i,o;const a=w(_(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);kf(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=w(_(t)).link,n=e?w(_(e)).deep_link_id:null,r=w(_(t)).deep_link_id;return(r?w(_(r)).link:null)||r||n||e||t}(t);try{return new Wp(e)}catch(t){return null}}}
2638
2667
  /**
2639
2668
  * @license
2640
2669
  * Copyright 2020 Google LLC
@@ -2650,7 +2679,7 @@ class Dp extends kp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2650
2679
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2651
2680
  * See the License for the specific language governing permissions and
2652
2681
  * limitations under the License.
2653
- */class Mp{constructor(){this.providerId=Mp.PROVIDER_ID}static credential(t,e){return Dp._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Pp.parseLink(e);return Sf(n,"argument-error"),Dp._fromEmailAndCode(t,n.code,n.tenantId)}}Mp.PROVIDER_ID="password",Mp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Mp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2682
+ */class Gp{constructor(){this.providerId=Gp.PROVIDER_ID}static credential(t,e){return $p._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Wp.parseLink(e);return kf(n,"argument-error"),$p._fromEmailAndCode(t,n.code,n.tenantId)}}Gp.PROVIDER_ID="password",Gp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Gp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2654
2683
  /**
2655
2684
  * @license
2656
2685
  * Copyright 2020 Google LLC
@@ -2667,7 +2696,7 @@ class Dp extends kp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2667
2696
  * See the License for the specific language governing permissions and
2668
2697
  * limitations under the License.
2669
2698
  */
2670
- class xp{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}}
2699
+ class zp{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}}
2671
2700
  /**
2672
2701
  * @license
2673
2702
  * Copyright 2019 Google LLC
@@ -2683,7 +2712,7 @@ class xp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2683
2712
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2684
2713
  * See the License for the specific language governing permissions and
2685
2714
  * limitations under the License.
2686
- */class Up extends xp{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
2715
+ */class Qp extends zp{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
2687
2716
  /**
2688
2717
  * @license
2689
2718
  * Copyright 2020 Google LLC
@@ -2699,7 +2728,7 @@ class xp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2699
2728
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2700
2729
  * See the License for the specific language governing permissions and
2701
2730
  * limitations under the License.
2702
- */class Fp extends Up{constructor(){super("facebook.com")}static credential(t){return Lp._fromParams({providerId:Fp.PROVIDER_ID,signInMethod:Fp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Fp.credentialFromTaggedObject(t)}static credentialFromError(t){return Fp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Fp.credential(t.oauthAccessToken)}catch(t){return null}}}Fp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Fp.PROVIDER_ID="facebook.com";
2731
+ */class Yp extends Qp{constructor(){super("facebook.com")}static credential(t){return Kp._fromParams({providerId:Yp.PROVIDER_ID,signInMethod:Yp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Yp.credentialFromTaggedObject(t)}static credentialFromError(t){return Yp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Yp.credential(t.oauthAccessToken)}catch(t){return null}}}Yp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Yp.PROVIDER_ID="facebook.com";
2703
2732
  /**
2704
2733
  * @license
2705
2734
  * Copyright 2020 Google LLC
@@ -2716,7 +2745,7 @@ class xp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2716
2745
  * See the License for the specific language governing permissions and
2717
2746
  * limitations under the License.
2718
2747
  */
2719
- class Vp extends Up{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Lp._fromParams({providerId:Vp.PROVIDER_ID,signInMethod:Vp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Vp.credentialFromTaggedObject(t)}static credentialFromError(t){return Vp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Vp.credential(e,n)}catch(t){return null}}}Vp.GOOGLE_SIGN_IN_METHOD="google.com",Vp.PROVIDER_ID="google.com";
2748
+ class Jp extends Qp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Kp._fromParams({providerId:Jp.PROVIDER_ID,signInMethod:Jp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Jp.credentialFromTaggedObject(t)}static credentialFromError(t){return Jp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Jp.credential(e,n)}catch(t){return null}}}Jp.GOOGLE_SIGN_IN_METHOD="google.com",Jp.PROVIDER_ID="google.com";
2720
2749
  /**
2721
2750
  * @license
2722
2751
  * Copyright 2020 Google LLC
@@ -2733,7 +2762,7 @@ class Vp extends Up{constructor(){super("google.com"),this.addScope("profile")}s
2733
2762
  * See the License for the specific language governing permissions and
2734
2763
  * limitations under the License.
2735
2764
  */
2736
- class Bp extends Up{constructor(){super("github.com")}static credential(t){return Lp._fromParams({providerId:Bp.PROVIDER_ID,signInMethod:Bp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Bp.credentialFromTaggedObject(t)}static credentialFromError(t){return Bp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Bp.credential(t.oauthAccessToken)}catch(t){return null}}}Bp.GITHUB_SIGN_IN_METHOD="github.com",Bp.PROVIDER_ID="github.com";
2765
+ class Xp extends Qp{constructor(){super("github.com")}static credential(t){return Kp._fromParams({providerId:Xp.PROVIDER_ID,signInMethod:Xp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Xp.credentialFromTaggedObject(t)}static credentialFromError(t){return Xp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Xp.credential(t.oauthAccessToken)}catch(t){return null}}}Xp.GITHUB_SIGN_IN_METHOD="github.com",Xp.PROVIDER_ID="github.com";
2737
2766
  /**
2738
2767
  * @license
2739
2768
  * Copyright 2020 Google LLC
@@ -2750,7 +2779,7 @@ class Bp extends Up{constructor(){super("github.com")}static credential(t){retur
2750
2779
  * See the License for the specific language governing permissions and
2751
2780
  * limitations under the License.
2752
2781
  */
2753
- class Hp extends Up{constructor(){super("twitter.com")}static credential(t,e){return Lp._fromParams({providerId:Hp.PROVIDER_ID,signInMethod:Hp.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Hp.credentialFromTaggedObject(t)}static credentialFromError(t){return Hp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Hp.credential(e,n)}catch(t){return null}}}Hp.TWITTER_SIGN_IN_METHOD="twitter.com",Hp.PROVIDER_ID="twitter.com";
2782
+ class Zp extends Qp{constructor(){super("twitter.com")}static credential(t,e){return Kp._fromParams({providerId:Zp.PROVIDER_ID,signInMethod:Zp.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Zp.credentialFromTaggedObject(t)}static credentialFromError(t){return Zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Zp.credential(e,n)}catch(t){return null}}}Zp.TWITTER_SIGN_IN_METHOD="twitter.com",Zp.PROVIDER_ID="twitter.com";
2754
2783
  /**
2755
2784
  * @license
2756
2785
  * Copyright 2020 Google LLC
@@ -2767,7 +2796,7 @@ class Hp extends Up{constructor(){super("twitter.com")}static credential(t,e){re
2767
2796
  * See the License for the specific language governing permissions and
2768
2797
  * limitations under the License.
2769
2798
  */
2770
- class jp{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 Yf._fromIdTokenResponse(t,n,r),i=$p(n);return new jp({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=$p(n);return new jp({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function $p(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2799
+ class tg{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 ap._fromIdTokenResponse(t,n,r),i=eg(n);return new tg({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=eg(n);return new tg({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function eg(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2771
2800
  /**
2772
2801
  * @license
2773
2802
  * Copyright 2020 Google LLC
@@ -2783,7 +2812,7 @@ class jp{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2783
2812
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2784
2813
  * See the License for the specific language governing permissions and
2785
2814
  * limitations under the License.
2786
- */class qp extends f{constructor(t,e,n,r){var s;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,qp.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 qp(t,e,n,r)}}function Kp(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw qp._fromErrorAndOperation(t,n,e,r);throw n}))}
2815
+ */class ng extends f{constructor(t,e,n,r){var s;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,ng.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 ng(t,e,n,r)}}function rg(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw ng._fromErrorAndOperation(t,n,e,r);throw n}))}
2787
2816
  /**
2788
2817
  * @license
2789
2818
  * Copyright 2020 Google LLC
@@ -2800,7 +2829,7 @@ class jp{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2800
2829
  * See the License for the specific language governing permissions and
2801
2830
  * limitations under the License.
2802
2831
  */
2803
- async function Wp(t,e,n=!1){const r="signIn",s=await Kp(t,r,e),i=await jp._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}
2832
+ async function sg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const r="signIn",s=await rg(t,r,e),i=await tg._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}
2804
2833
  /**
2805
2834
  * @license
2806
2835
  * Copyright 2020 Google LLC
@@ -2817,7 +2846,7 @@ async function Wp(t,e,n=!1){const r="signIn",s=await Kp(t,r,e),i=await jp._fromI
2817
2846
  * See the License for the specific language governing permissions and
2818
2847
  * limitations under the License.
2819
2848
  */
2820
- function Gp(t,e,n){var r;Sf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Sf(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&&(Sf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Sf(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)}
2849
+ async function ig(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function og(t,e,n){const r=Np(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&
2821
2850
  /**
2822
2851
  * @license
2823
2852
  * Copyright 2020 Google LLC
@@ -2833,7 +2862,8 @@ function Gp(t,e,n){var r;Sf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
2833
2862
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2834
2863
  * See the License for the specific language governing permissions and
2835
2864
  * limitations under the License.
2836
- */async function zp(t,e,n){await async function(t,e){return Mf(t,"POST","/v1/accounts:resetPassword",Pf(t,e))}(S(t),{oobCode:e,newPassword:n})}function Qp(t,e,n){return async function(t,e){return Wp(Sp(t),e)}(S(t),Mp.credential(e,n))}const Yp="__sak";
2865
+ */
2866
+ function(t,e,n){var r;kf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),kf(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&&(kf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(kf(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 Mp(r,s,"getOobCode",jp)}async function ag(t,e,n){await async function(t,e){return Bf(t,"POST","/v1/accounts:resetPassword",Vf(t,e))}(S(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ig(t),e}))}function cg(t,e,n){return Pt(t.app)?Promise.reject(Af(t)):async function(t,e){return sg(Np(t),e)}(S(t),Gp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ig(t),e}))}const ug="__sak";
2837
2867
  /**
2838
2868
  * @license
2839
2869
  * Copyright 2019 Google LLC
@@ -2849,7 +2879,7 @@ function Gp(t,e,n){var r;Sf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
2849
2879
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2850
2880
  * See the License for the specific language governing permissions and
2851
2881
  * limitations under the License.
2852
- */class Jp{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Yp,"1"),this.storage.removeItem(Yp),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()}}
2882
+ */class hg{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(ug,"1"),this.storage.removeItem(ug),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()}}
2853
2883
  /**
2854
2884
  * @license
2855
2885
  * Copyright 2020 Google LLC
@@ -2865,7 +2895,7 @@ function Gp(t,e,n){var r;Sf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
2865
2895
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2866
2896
  * See the License for the specific language governing permissions and
2867
2897
  * limitations under the License.
2868
- */class Xp extends Jp{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=d();return ip(t)||lp(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=fp(),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);dp()&&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]}}Xp.type="LOCAL";const Zp=Xp;
2898
+ */class lg extends hg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ip(),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;e?this.detachListener():this.stopPolling();const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);Sp()&&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]}}lg.type="LOCAL";const dg=lg;
2869
2899
  /**
2870
2900
  * @license
2871
2901
  * Copyright 2020 Google LLC
@@ -2881,7 +2911,7 @@ function Gp(t,e,n){var r;Sf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
2881
2911
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2882
2912
  * See the License for the specific language governing permissions and
2883
2913
  * limitations under the License.
2884
- */class tg extends Jp{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}tg.type="SESSION";const eg=tg;
2914
+ */class fg extends hg{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}fg.type="SESSION";const pg=fg;
2885
2915
  /**
2886
2916
  * @license
2887
2917
  * Copyright 2019 Google LLC
@@ -2914,7 +2944,7 @@ function Gp(t,e,n){var r;Sf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
2914
2944
  * See the License for the specific language governing permissions and
2915
2945
  * limitations under the License.
2916
2946
  */
2917
- class ng{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 ng(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)}}
2947
+ class gg{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 gg(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)}}
2918
2948
  /**
2919
2949
  * @license
2920
2950
  * Copyright 2020 Google LLC
@@ -2931,7 +2961,7 @@ class ng{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
2931
2961
  * See the License for the specific language governing permissions and
2932
2962
  * limitations under the License.
2933
2963
  */
2934
- function rg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2964
+ function mg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2935
2965
  /**
2936
2966
  * @license
2937
2967
  * Copyright 2019 Google LLC
@@ -2947,7 +2977,7 @@ function rg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2947
2977
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2948
2978
  * See the License for the specific language governing permissions and
2949
2979
  * limitations under the License.
2950
- */ng.receivers=[];class sg{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=rg("",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)}))}}
2980
+ */gg.receivers=[];class yg{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=mg("",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)}))}}
2951
2981
  /**
2952
2982
  * @license
2953
2983
  * Copyright 2020 Google LLC
@@ -2963,7 +2993,7 @@ function rg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2963
2993
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2964
2994
  * See the License for the specific language governing permissions and
2965
2995
  * limitations under the License.
2966
- */function ig(){return window}
2996
+ */function vg(){return window}
2967
2997
  /**
2968
2998
  * @license
2969
2999
  * Copyright 2020 Google LLC.
@@ -2980,7 +3010,7 @@ function rg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2980
3010
  * See the License for the specific language governing permissions and
2981
3011
  * limitations under the License.
2982
3012
  */
2983
- function og(){return void 0!==ig().WorkerGlobalScope&&"function"==typeof ig().importScripts}
3013
+ function wg(){return void 0!==vg().WorkerGlobalScope&&"function"==typeof vg().importScripts}
2984
3014
  /**
2985
3015
  * @license
2986
3016
  * Copyright 2019 Google LLC
@@ -2997,7 +3027,7 @@ function og(){return void 0!==ig().WorkerGlobalScope&&"function"==typeof ig().im
2997
3027
  * See the License for the specific language governing permissions and
2998
3028
  * limitations under the License.
2999
3029
  */
3000
- const ag="firebaseLocalStorageDb",cg="firebaseLocalStorage",ug="fbase_key";class hg{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 lg(t,e){return t.transaction([cg],e?"readwrite":"readonly").objectStore(cg)}function dg(){const t=indexedDB.open(ag,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(cg,{keyPath:ug})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(cg)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(ag);return new hg(t).toPromise()}(),e(await dg()))}))}))}async function fg(t,e,n){const r=lg(t,!0).put({[ug]:e,value:n});return new hg(r).toPromise()}function pg(t,e){const n=lg(t,!0).delete(e);return new hg(n).toPromise()}class gg{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 dg()),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 og()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ng._getInstance(og()?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 sg(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 dg();return await fg(t,Yp,"1"),await pg(t,Yp),!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=>fg(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=lg(t,!1).get(e),r=await new hg(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=>pg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=lg(t,!1).getAll();return new hg(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()}}gg.type="LOCAL";const mg=gg;new Rf(3e4,6e4);
3030
+ const _g="firebaseLocalStorageDb",Tg="firebaseLocalStorage",Eg="fbase_key";class Sg{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 Ig(t,e){return t.transaction([Tg],e?"readwrite":"readonly").objectStore(Tg)}function bg(){const t=indexedDB.open(_g,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Tg,{keyPath:Eg})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Tg)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(_g);return new Sg(t).toPromise()}(),e(await bg()))}))}))}async function Ag(t,e,n){const r=Ig(t,!0).put({[Eg]:e,value:n});return new Sg(r).toPromise()}function Cg(t,e){const n=Ig(t,!0).delete(e);return new Sg(n).toPromise()}class kg{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 bg()),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 wg()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=gg._getInstance(wg()?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 yg(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 bg();return await Ag(t,ug,"1"),await Cg(t,ug),!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=>Ag(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=Ig(t,!1).get(e),r=await new Sg(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=>Cg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Ig(t,!1).getAll();return new Sg(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)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()}}kg.type="LOCAL";const Ng=kg;new Pf(3e4,6e4);
3001
3031
  /**
3002
3032
  * @license
3003
3033
  * Copyright 2019 Google LLC
@@ -3014,7 +3044,7 @@ const ag="firebaseLocalStorageDb",cg="firebaseLocalStorage",ug="fbase_key";class
3014
3044
  * See the License for the specific language governing permissions and
3015
3045
  * limitations under the License.
3016
3046
  */
3017
- class yg extends kp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Op(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Op(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Op(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 vg(t){return Wp(t.auth,new yg(t),t.bypassAuthState)}function wg(t){const{auth:e,user:n}=t;return Sf(n,e,"internal-error"),
3047
+ class Rg extends Vp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return qp(t,this._buildIdpRequest())}_linkToIdToken(t,e){return qp(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return qp(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 Og(t){return sg(t.auth,new Rg(t),t.bypassAuthState)}function Dg(t){const{auth:e,user:n}=t;return kf(n,e,"internal-error"),
3018
3048
  /**
3019
3049
  * @license
3020
3050
  * Copyright 2019 Google LLC
@@ -3031,7 +3061,7 @@ class yg extends kp{constructor(t){super("custom","custom"),this.params=t}_getId
3031
3061
  * See the License for the specific language governing permissions and
3032
3062
  * limitations under the License.
3033
3063
  */
3034
- async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await qf(t,Kp(r,s,e,t),n);Sf(i.idToken,r,"internal-error");const o=$f(i.idToken);Sf(o,r,"internal-error");const{sub:a}=o;return Sf(t.uid===a,r,"user-mismatch"),jp._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&_f(r,"user-mismatch"),t}}(n,new yg(t),t.bypassAuthState)}async function _g(t){const{auth:e,user:n}=t;return Sf(n,e,"internal-error"),async function(t,e,n=!1){const r=await qf(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return jp._forOperation(t,"link",r)}(n,new yg(t),t.bypassAuthState)}
3064
+ async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Af(r));const s="reauthenticate";try{const i=await tp(t,rg(r,s,e,t),n);kf(i.idToken,r,"internal-error");const o=Xf(i.idToken);kf(o,r,"internal-error");const{sub:a}=o;return kf(t.uid===a,r,"user-mismatch"),tg._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&Sf(r,"user-mismatch"),t}}(n,new Rg(t),t.bypassAuthState)}async function Lg(t){const{auth:e,user:n}=t;return kf(n,e,"internal-error"),async function(t,e,n=!1){const r=await tp(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return tg._forOperation(t,"link",r)}(n,new Rg(t),t.bypassAuthState)}
3035
3065
  /**
3036
3066
  * @license
3037
3067
  * Copyright 2020 Google LLC
@@ -3047,7 +3077,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await qf
3047
3077
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3048
3078
  * See the License for the specific language governing permissions and
3049
3079
  * limitations under the License.
3050
- */class Tg{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 vg;case"linkViaPopup":case"linkViaRedirect":return _g;case"reauthViaPopup":case"reauthViaRedirect":return wg;default:_f(this.auth,"internal-error")}}resolve(t){bf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){bf(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()}}
3080
+ */class Pg{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 Og;case"linkViaPopup":case"linkViaRedirect":return Lg;case"reauthViaPopup":case"reauthViaRedirect":return Dg;default:Sf(this.auth,"internal-error")}}resolve(t){Rf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Rf(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()}}
3051
3081
  /**
3052
3082
  * @license
3053
3083
  * Copyright 2020 Google LLC
@@ -3063,7 +3093,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await qf
3063
3093
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3064
3094
  * See the License for the specific language governing permissions and
3065
3095
  * limitations under the License.
3066
- */const Eg=new Rf(2e3,1e4);class Sg extends Tg{constructor(t,e,n,r,s){super(t,e,r,s),this.provider=n,this.authWindow=null,this.pollId=null,Sg.currentPopupAction&&Sg.currentPopupAction.cancel(),Sg.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Sf(t,this.auth,"internal-error"),t}async onExecution(){bf(1===this.filter.length,"Popup operations only handle one event");const t=rg();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(Tf(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(Tf(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Sg.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(Tf(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Eg.get())};t()}}Sg.currentPopupAction=null;
3096
+ */const Mg=new Pf(2e3,1e4);class xg extends Pg{constructor(t,e,n,r,s){super(t,e,r,s),this.provider=n,this.authWindow=null,this.pollId=null,xg.currentPopupAction&&xg.currentPopupAction.cancel(),xg.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return kf(t,this.auth,"internal-error"),t}async onExecution(){Rf(1===this.filter.length,"Popup operations only handle one event");const t=mg();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(If(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(If(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,xg.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(If(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Mg.get())};t()}}xg.currentPopupAction=null;
3067
3097
  /**
3068
3098
  * @license
3069
3099
  * Copyright 2020 Google LLC
@@ -3080,7 +3110,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await qf
3080
3110
  * See the License for the specific language governing permissions and
3081
3111
  * limitations under the License.
3082
3112
  */
3083
- const Ig="pendingRedirect",bg=new Map;class Ag extends Tg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=bg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return ep(Ig,t.config.apiKey,t.name)}(e),r=function(t){return Xf(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)}bg.set(this.auth._key(),t)}return this.bypassAuthState||bg.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 Cg(t,e){bg.set(t._key(),e)}async function kg(t,e,n=!1){const r=Sp(t),s=
3113
+ const Ug="pendingRedirect",Fg=new Map;class Vg extends Pg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=Fg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return dp(Ug,t.config.apiKey,t.name)}(e),r=function(t){return up(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)}Fg.set(this.auth._key(),t)}return this.bypassAuthState||Fg.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 Bg(t,e){Fg.set(t._key(),e)}async function Hg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const r=Np(t),s=
3084
3114
  /**
3085
3115
  * @license
3086
3116
  * Copyright 2021 Google LLC
@@ -3097,7 +3127,7 @@ const Ig="pendingRedirect",bg=new Map;class Ag extends Tg{constructor(t,e,n=!1){
3097
3127
  * See the License for the specific language governing permissions and
3098
3128
  * limitations under the License.
3099
3129
  */
3100
- function(t,e){return e?Xf(e):(Sf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),i=new Ag(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}
3130
+ function(t,e){return e?up(e):(kf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),i=new Vg(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}
3101
3131
  /**
3102
3132
  * @license
3103
3133
  * Copyright 2020 Google LLC
@@ -3113,7 +3143,7 @@ function(t,e){return e?Xf(e):(Sf(t._popupRedirectResolver,t,"argument-error"),t.
3113
3143
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3114
3144
  * See the License for the specific language governing permissions and
3115
3145
  * limitations under the License.
3116
- */class Rg{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 Dg(t);default:return!1}}
3146
+ */class jg{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 qg(t);default:return!1}}
3117
3147
  /**
3118
3148
  * @license
3119
3149
  * Copyright 2020 Google LLC
@@ -3129,7 +3159,7 @@ function(t,e){return e?Xf(e):(Sf(t._popupRedirectResolver,t,"argument-error"),t.
3129
3159
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3130
3160
  * See the License for the specific language governing permissions and
3131
3161
  * limitations under the License.
3132
- */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Dg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(Tf(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(Ng(t))}saveEventToCache(t){this.cachedEventUids.add(Ng(t)),this.lastProcessedEventTime=Date.now()}}function Ng(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Dg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3162
+ */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!qg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(If(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($g(t))}saveEventToCache(t){this.cachedEventUids.add($g(t)),this.lastProcessedEventTime=Date.now()}}function $g(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function qg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3133
3163
  /**
3134
3164
  * @license
3135
3165
  * Copyright 2020 Google LLC
@@ -3146,7 +3176,7 @@ function(t,e){return e?Xf(e):(Sf(t._popupRedirectResolver,t,"argument-error"),t.
3146
3176
  * See the License for the specific language governing permissions and
3147
3177
  * limitations under the License.
3148
3178
  */
3149
- const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Lg=/^https?/;async function Pg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Mf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Mg(t))return}catch(t){}_f(t,"unauthorized-domain")}function Mg(t){const e=Af(),{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(!Lg.test(n))return!1;if(Og.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3179
+ const Kg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Wg=/^https?/;async function Gg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Bf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(zg(t))return}catch(t){}Sf(t,"unauthorized-domain")}function zg(t){const e=Of(),{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(!Wg.test(n))return!1;if(Kg.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3150
3180
  /**
3151
3181
  * @license
3152
3182
  * Copyright 2020 Google LLC.
@@ -3162,7 +3192,7 @@ const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Lg=/^https?/;async function Pg(t
3162
3192
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3163
3193
  * See the License for the specific language governing permissions and
3164
3194
  * limitations under the License.
3165
- */const xg=new Rf(3e4,6e4);function Ug(){const t=ig().___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 Fg(t){return new Promise(((e,n)=>{var r,s,i;function o(){Ug(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Ug(),n(Tf(t,"network-request-failed"))},timeout:xg.get()})}if(null===(s=null===(r=ig().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=ig().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return ig()[e]=()=>{gapi.load?o():n(Tf(t,"network-request-failed"))},vp(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Vg=null,t}))}let Vg=null;
3195
+ */const Qg=new Pf(3e4,6e4);function Yg(){const t=vg().___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 Jg(t){return new Promise(((e,n)=>{var r,s,i;function o(){Yg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Yg(),n(If(t,"network-request-failed"))},timeout:Qg.get()})}if(null===(s=null===(r=vg().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=vg().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return vg()[e]=()=>{gapi.load?o():n(If(t,"network-request-failed"))},Dp(`${Op.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Xg=null,t}))}let Xg=null;
3166
3196
  /**
3167
3197
  * @license
3168
3198
  * Copyright 2020 Google LLC.
@@ -3179,7 +3209,7 @@ const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Lg=/^https?/;async function Pg(t
3179
3209
  * See the License for the specific language governing permissions and
3180
3210
  * limitations under the License.
3181
3211
  */
3182
- const Bg=new Rf(5e3,15e3),Hg="__/auth/iframe",jg="emulator/auth/iframe",$g={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qg=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Kg(t){const e=t.config;Sf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Nf(e,jg):`https://${t.config.authDomain}/${Hg}`,r={apiKey:e.apiKey,appName:t.name,v:Pt},s=qg.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${v(r).slice(1)}`}async function Wg(t){const e=await function(t){return Vg=Vg||Fg(t),Vg}(t),n=ig().gapi;return Sf(n,t,"internal-error"),e.open({where:document.body,url:Kg(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:$g,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=Tf(t,"network-request-failed"),i=ig().setTimeout((()=>{r(s)}),Bg.get());function o(){ig().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
3212
+ const Zg=new Pf(5e3,15e3),tm="__/auth/iframe",em="emulator/auth/iframe",nm={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},rm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function sm(t){const e=t.config;kf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Mf(e,em):`https://${t.config.authDomain}/${tm}`,r={apiKey:e.apiKey,appName:t.name,v:Ut},s=rm.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${v(r).slice(1)}`}async function im(t){const e=await function(t){return Xg=Xg||Jg(t),Xg}(t),n=vg().gapi;return kf(n,t,"internal-error"),e.open({where:document.body,url:sm(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:nm,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=If(t,"network-request-failed"),i=vg().setTimeout((()=>{r(s)}),Zg.get());function o(){vg().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
3183
3213
  /**
3184
3214
  * @license
3185
3215
  * Copyright 2020 Google LLC.
@@ -3195,7 +3225,7 @@ const Bg=new Rf(5e3,15e3),Hg="__/auth/iframe",jg="emulator/auth/iframe",$g={styl
3195
3225
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3196
3226
  * See the License for the specific language governing permissions and
3197
3227
  * limitations under the License.
3198
- */const Gg={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class zg{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Qg(t,e,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},Gg),{width:r.toString(),height:s.toString(),top:i,left:o}),u=d().toLowerCase();n&&(a=op(u)?"_blank":n),sp(u)&&(e=e||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=d()){var e;return lp(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(u)&&"_self"!==a)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)}
3228
+ */const om={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class am{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function cm(t,e,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},om),{width:r.toString(),height:s.toString(),top:i,left:o}),u=d().toLowerCase();n&&(a=yp(u)?"_blank":n),gp(u)&&(e=e||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=d()){var e;return Ep(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(u)&&"_self"!==a)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)}
3199
3229
  /**
3200
3230
  * @license
3201
3231
  * Copyright 2021 Google LLC
@@ -3211,7 +3241,7 @@ const Bg=new Rf(5e3,15e3),Hg="__/auth/iframe",jg="emulator/auth/iframe",$g={styl
3211
3241
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3212
3242
  * See the License for the specific language governing permissions and
3213
3243
  * limitations under the License.
3214
- */(e||"",a),new zg(null);const l=window.open(e||"",a,h);Sf(l,t,"popup-blocked");try{l.focus()}catch(t){}return new zg(l)}const Yg="__/auth/handler",Jg="emulator/auth/handler",Xg=encodeURIComponent("fac");async function Zg(t,e,n,r,s,i){Sf(t.config.authDomain,t,"auth-domain-config-required"),Sf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Pt,eventId:s};if(e instanceof xp){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 Up){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];const c=await t._getAppCheckToken(),u=c?`#${Xg}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Yg}`;return Nf(t,Jg)}
3244
+ */(e||"",a),new am(null);const l=window.open(e||"",a,h);kf(l,t,"popup-blocked");try{l.focus()}catch(t){}return new am(l)}const um="__/auth/handler",hm="emulator/auth/handler",lm=encodeURIComponent("fac");async function dm(t,e,n,r,s,i){kf(t.config.authDomain,t,"auth-domain-config-required"),kf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ut,eventId:s};if(e instanceof zp){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 Qp){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];const c=await t._getAppCheckToken(),u=c?`#${lm}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${um}`;return Mf(t,hm)}
3215
3245
  /**
3216
3246
  * @license
3217
3247
  * Copyright 2020 Google LLC
@@ -3227,7 +3257,7 @@ const Bg=new Rf(5e3,15e3),Hg="__/auth/iframe",jg="emulator/auth/iframe",$g={styl
3227
3257
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3228
3258
  * See the License for the specific language governing permissions and
3229
3259
  * limitations under the License.
3230
- */(t)}?${v(a).slice(1)}${u}`}const tm="webStorageSupport";const em=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=eg,this._completeRedirectFn=kg,this._overrideRedirectResult=Cg}async _openPopup(t,e,n,r){var s;bf(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return Qg(t,await Zg(t,e,n,Af(),r),rg())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){ig().location.href=t}(await Zg(t,e,n,Af(),r)),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):(bf(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 Wg(t),n=new Rg(t);return e.register("authEvent",(e=>{Sf(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(tm,{type:tm},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[tm];void 0!==s&&e(!!s),_f(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Pg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return fp()||ip()||lp()}};var nm="@firebase/auth",rm="0.23.2";
3260
+ */(t)}?${v(a).slice(1)}${u}`}const fm="webStorageSupport";const pm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=pg,this._completeRedirectFn=Hg,this._overrideRedirectResult=Bg}async _openPopup(t,e,n,r){var s;Rf(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return cm(t,await dm(t,e,n,Of(),r),mg())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){vg().location.href=t}(await dm(t,e,n,Of(),r)),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):(Rf(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 im(t),n=new jg(t);return e.register("authEvent",(e=>{kf(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(fm,{type:fm},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[fm];void 0!==s&&e(!!s),Sf(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Gg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return Ip()||mp()||Ep()}};var gm="@firebase/auth",mm="1.7.7";
3231
3261
  /**
3232
3262
  * @license
3233
3263
  * Copyright 2020 Google LLC
@@ -3244,7 +3274,7 @@ const Bg=new Rf(5e3,15e3),Hg="__/auth/iframe",jg="emulator/auth/iframe",$g={styl
3244
3274
  * See the License for the specific language governing permissions and
3245
3275
  * limitations under the License.
3246
3276
  */
3247
- class sm{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(){Sf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3277
+ class ym{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(){kf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3248
3278
  /**
3249
3279
  * @license
3250
3280
  * Copyright 2020 Google LLC
@@ -3277,5 +3307,5 @@ class sm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3277
3307
  * See the License for the specific language governing permissions and
3278
3308
  * limitations under the License.
3279
3309
  */
3280
- const im=h("authIdTokenMaxAge")||300;let om=null;function am(t=xt()){const e=Dt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Dt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(m(n.getOptions(),null!=e?e:{}))return t;_f(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:em,persistence:[mg,Zp,eg]}),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>im)return;const r=null==e?void 0:e.token;om!==r&&(om=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){S(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){S(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var s;const i=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return i&&bp(n,`http://${i}`),n}var cm;cm="Browser",Nt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Sf(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:cm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:pp(cm)},c=new Ep(n,r,s,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Xf);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Nt(new I("auth-internal",(t=>(t=>new sm(t))(Sp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ut(nm,rm,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(cm)),Ut(nm,rm,"esm2017");class um extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class hm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class lm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}const dm="avatar not created";var fm=Object.freeze({__proto__:null,AvatarNotCreatedError:um,UserNotLoggedInError:hm,NoColorwaySizeAssetsFoundError:lm,AvatarNotCreated:dm});class pm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=am(e),this.auth.setPersistence(Zp)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(t){return new Promise((e=>{const n=this.auth.onAuthStateChanged((r=>{this.setUser(r),e(Boolean(r)),n(),r&&this.logUserLogin(t,r)}))}))}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,s,i,o;try{const a=Ll(this.firestore,"user_logging",e.uid),c=await Rd(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(l&&uf(u).diff(uf(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[t])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[t]:{brand_id:t,last_login:u,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:u,updated_at:u};await Od(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return(await Rd(Ll(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=md(Ol(this.firestore,"users"),vd(new Kl("__name__"),"==",this.id));return e=Ld(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Qp(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await async function(t,e,n){var r;const s=Sp(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(null===(r=s._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const t=await _p(s,i,"getOobCode",!0);n&&Gp(s,t,n),await Np(s,t)}else n&&Gp(s,i,n),await Np(s,i).catch((async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const t=await _p(s,i,"getOobCode",!0);n&&Gp(s,t,n),await Np(s,t)}}))}(this.auth,t)}async confirmPasswordReset(t,e){await zp(this.auth,t,e)}}class gm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Ld(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Md.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Dt("object"==typeof t?t:xt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=ne("firestore");t&&kl(r,...t)}return r}(t),this.user=new pm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=md(Ol(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Dd(md(Ol(this.firestore,t),...e))}async getDoc(t,e){const n=Ll(this.firestore,t,e),r=await Rd(n);return r.exists()?r.data():null}}const mm=t=>{if(t.code===yf)throw new Error("account has been disabled");throw new Error(t.message)};class ym{static get endpoint(){return Md.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:"omit"};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 vm{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new hm;try{const r=await ym.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===dm)throw new um;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await ym.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new lm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new lm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[vd("brand_id","==",this.brandId)];r.push(vd("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return mm(t)}}async getColorwaySizeAssets(t,e){const n=[vd("brand_id","==",this.brandId)];t&&n.push(vd("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(vd("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 mm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return mm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return mm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return mm(t)}}}const wm=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Md.getInstance().setEnv(e),new vm(t,new gm));var _m;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(_m||(_m={}));const Tm={[_m.ACROSS_BACK]:"Across back",[_m.ACROSS_FRONT]:"Across front",[_m.ACROSS_SHOULDER]:"Across shoulder",[_m.ANKLE]:"Ankle",[_m.ARMEYE]:"Armeye",[_m.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[_m.BACK_CROTCH_LENGTH]:"Back crotch length",[_m.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[_m.BELOW_KNEE]:"Below knee",[_m.BICEP]:"Bicep",[_m.BUST]:"Chest/Bust",[_m.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[_m.CALF]:"Calf",[_m.CB_NECK_TO_WAIST]:"Cb neck to waist",[_m.CB_NECK_TO_WRIST]:"Cb neck to wrist",[_m.CF_NECK_TO_WAIST]:"Cf neck to waist",[_m.ELBOW]:"Elbow",[_m.FOREARM]:"Forearm",[_m.FRONT_CROTCH_LENGTH]:"Front crotch length",[_m.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[_m.HIGH_HIP]:"High hip",[_m.HSP_TO_ACROSS_BACK]:"Hsp to across back",[_m.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[_m.HSP_TO_BUST_POINT]:"Hsp to bust point",[_m.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[_m.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[_m.INSEAM]:"Inseam",[_m.KNEE]:"Knee",[_m.LOW_HIP]:"Low hip",[_m.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[_m.MID_NECK]:"Mid neck",[_m.NECK_AT_BASE]:"Neck at base",[_m.SHOULDER_DROP]:"Shoulder drop",[_m.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[_m.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[_m.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[_m.THIGH]:"Thigh",[_m.TOTAL_RISE_LENGTH]:"Total rise length",[_m.UNDER_BUST]:"Under bust",[_m.VERTICAL_TRUNK]:"Vertical trunk",[_m.WAIST]:"Waist",[_m.WRIST]:"Wrist"};var Em;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Em||(Em={}));const Sm={[Em.BLOUSES]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.COATS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.DRESSES]:[_m.LOW_HIP,_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST],[Em.JACKETS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.PANTS]:[_m.LOW_HIP,_m.WAIST,_m.THIGH,_m.INSEAM],[Em.PUFFERS_AND_PARKAS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.SHORTS]:[_m.LOW_HIP,_m.WAIST,_m.THIGH,_m.INSEAM],[Em.SKIRTS]:[_m.LOW_HIP,_m.WAIST],[Em.SWEATERS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP],[Em.T_SHIRTS_AND_TANKS]:[_m.BUST,_m.ACROSS_SHOULDER,_m.WAIST,_m.LOW_HIP,_m.HIGH_HIP]},Im={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},bm={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Am={activewear:{leggings:Em.PANTS,joggers:Em.PANTS,sweatshirts:Em.SWEATERS},dresses:{a_line:Em.DRESSES,bodycon:Em.DRESSES,fit_and_flare:Em.DRESSES,knit:Em.DRESSES,shirt:Em.DRESSES,slip:Em.DRESSES,straight:Em.DRESSES,wrap:Em.DRESSES},jackets_and_coats:{denim_jackets:Em.JACKETS,parkas:Em.PUFFERS_AND_PARKAS,peacoats:Em.COATS,puffer_jackets:Em.PUFFERS_AND_PARKAS,raincoats:Em.COATS,rompers:Em.COATS,shackets:Em.JACKETS,trench_coats:Em.COATS},jeans:{bootcut:Em.PANTS,flared:Em.PANTS,mom:Em.PANTS,relaxed:Em.PANTS,skinny:Em.PANTS,slim:Em.PANTS,straight:Em.PANTS,tapered:Em.PANTS,wide_leg:Em.PANTS},jumpsuits_and_rompers:{boiler_suits:Em.DRESSES,denim:Em.DRESSES,jumpsuits:Em.DRESSES,overalls:Em.DRESSES,rompers:Em.DRESSES,unitards:Em.DRESSES},pants_and_shorts:{cigarette:Em.PANTS,culottes:Em.SHORTS,denim_shorts:Em.SHORTS,flared:Em.PANTS,joggers:Em.PANTS,leggings:Em.PANTS,skinny:Em.PANTS,wide_leg:Em.PANTS},skirts:{a_line_flared:Em.SKIRTS,denim:Em.SKIRTS,knit:Em.SKIRTS,pencil:Em.SKIRTS,pleated:Em.SKIRTS,skater:Em.SKIRTS,slip:Em.SKIRTS,wrap:Em.SKIRTS},suits_and_tailoring:{blazers:Em.JACKETS,suit_jackets:Em.JACKETS,suit_skirts:Em.SKIRTS,suit_trousers:Em.PANTS,suit_vests:Em.SWEATERS,trousers:Em.PANTS},sweaters:{cardigans:Em.SWEATERS,crewnecks:Em.SWEATERS,hoodies_and_zipups:Em.SWEATERS,sweatshirts:Em.SWEATERS,turtlenecks:Em.SWEATERS,v_necks:Em.SWEATERS},tops:{bodysuits:Em.BLOUSES,corsets_and_bustiers:Em.BLOUSES,polos:Em.T_SHIRTS_AND_TANKS,shirts_and_blouses:Em.BLOUSES,t_shirts:Em.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Em.T_SHIRTS_AND_TANKS}};var Cm;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Cm||(Cm={}));const km={[Cm.TOO_TIGHT]:"Too Tight",[Cm.TIGHT]:"Tight",[Cm.SLIGHTLY_TIGHT]:"Slightly Tight",[Cm.PERFECT_FIT]:"Perfect Fit",[Cm.SLIGHTLY_LOOSE]:"Slightly Loose",[Cm.LOOSE]:"Loose",[Cm.OVERSIZED]:"Oversized",[Cm.TOO_SHORT]:"Too Short",[Cm.SHORT]:"Short",[Cm.SLIGHTLY_SHORT]:"Slightly Short",[Cm.SLIGHTLY_LONG]:"Slightly Long",[Cm.LONG]:"Long",[Cm.TOO_LONG]:"Too Long"};var Rm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Rm||(Rm={}));var Nm=Object.freeze({__proto__:null,get AvatarState(){return Rm},get MeasurementLocation(){return _m},MeasurementLocationName:Tm,get Classification(){return Em},ClassificationLocations:Sm,CategoryNames:Im,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:bm,Taxonomy:Am,get Fit(){return Cm},FitNames:km});export{fm as Errors,wm as initShop,t as requests,e as responses,Nm as types};
3310
+ const vm=h("authIdTokenMaxAge")||300;let wm=null;function _m(t=Vt()){const e=Lt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Lt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(m(n.getOptions(),null!=e?e:{}))return t;Sf(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:pm,persistence:[Ng,dg,pg]}),r=h("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(r,location.origin);if(location.origin===t.origin){const e=(s=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>vm)return;const r=null==e?void 0:e.token;wm!==r&&(wm=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){S(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,r){S(t).onIdTokenChanged(e,n,r)}(n,(t=>e(t)))}}var s;const i=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return i&&xp(n,`http://${i}`),n}var Tm;!function(t){Op=t}({loadJS:t=>new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=If("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)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Tm="Browser",Dt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;kf(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Tm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:bp(Tm)},c=new kp(n,r,s,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(up);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Dt(new I("auth-internal",(t=>(t=>new ym(t))(Np(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Bt(gm,mm,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Tm)),Bt(gm,mm,"esm2017");class Em extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Sm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Im extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}const bm="avatar not created";var Am=Object.freeze({__proto__:null,AvatarNotCreatedError:Em,UserNotLoggedInError:Sm,NoColorwaySizeAssetsFoundError:Im,AvatarNotCreated:bm});class Cm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=_m(e),this.auth.setPersistence(dg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&this.logUserLogin(t,e)})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,s,i,o;try{const a=xl(this.firestore,"user_logging",e.uid),c=await Dd(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(l&&df(u).diff(df(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[t])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[t]:{brand_id:t,last_login:u,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:u,updated_at:u};await Md(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Sm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Sm;return(await Dd(xl(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=wd(Ml(this.firestore,"users"),Td(new zl("__name__"),"==",this.id));return e=xd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await cg(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await og(this.auth,t)}async confirmPasswordReset(t,e){await ag(this.auth,t,e)}}class km{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=xd(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Ft(Fd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Lt("object"==typeof t?t:Vt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=ie("firestore");t&&Ol(r,...t)}return r}(t),this.user=new Cm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=wd(Ml(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Pd(wd(Ml(this.firestore,t),...e))}async getDoc(t,e){const n=xl(this.firestore,t,e),r=await Dd(n);return r.exists()?r.data():null}}const Nm=t=>{if(t.code===_f)throw new Error("account has been disabled");throw new Error(t.message)};class Rm{static get endpoint(){return Fd.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:"omit"};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 Om{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Sm;try{const r=await Rm.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===bm)throw new Em;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Rm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[Td("brand_id","==",this.brandId)];r.push(Td("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Nm(t)}}async getColorwaySizeAssets(t,e){const n=[Td("brand_id","==",this.brandId)];t&&n.push(Td("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(Td("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 Nm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Nm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Nm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Nm(t)}}}const Dm=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Fd.getInstance().setEnv(e),new Om(t,new km));var Lm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(Lm||(Lm={}));const Pm={[Lm.ACROSS_BACK]:"Across back",[Lm.ACROSS_FRONT]:"Across front",[Lm.ACROSS_SHOULDER]:"Across shoulder",[Lm.ANKLE]:"Ankle",[Lm.ARMEYE]:"Armeye",[Lm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Lm.BACK_CROTCH_LENGTH]:"Back crotch length",[Lm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Lm.BELOW_KNEE]:"Below knee",[Lm.BICEP]:"Bicep",[Lm.BUST]:"Chest/Bust",[Lm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Lm.CALF]:"Calf",[Lm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Lm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Lm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Lm.ELBOW]:"Elbow",[Lm.FOREARM]:"Forearm",[Lm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Lm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Lm.HIGH_HIP]:"High hip",[Lm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Lm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Lm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Lm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Lm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Lm.INSEAM]:"Inseam",[Lm.KNEE]:"Knee",[Lm.LOW_HIP]:"Low hip",[Lm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Lm.MID_NECK]:"Mid neck",[Lm.NECK_AT_BASE]:"Neck at base",[Lm.SHOULDER_DROP]:"Shoulder drop",[Lm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Lm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Lm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Lm.THIGH]:"Thigh",[Lm.TOTAL_RISE_LENGTH]:"Total rise length",[Lm.UNDER_BUST]:"Under bust",[Lm.VERTICAL_TRUNK]:"Vertical trunk",[Lm.WAIST]:"Waist",[Lm.WRIST]:"Wrist"};var Mm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Mm||(Mm={}));const xm={[Mm.BLOUSES]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.COATS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.DRESSES]:[Lm.LOW_HIP,Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST],[Mm.JACKETS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.PANTS]:[Lm.LOW_HIP,Lm.WAIST,Lm.THIGH,Lm.INSEAM],[Mm.PUFFERS_AND_PARKAS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.SHORTS]:[Lm.LOW_HIP,Lm.WAIST,Lm.THIGH,Lm.INSEAM],[Mm.SKIRTS]:[Lm.LOW_HIP,Lm.WAIST],[Mm.SWEATERS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.T_SHIRTS_AND_TANKS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP]},Um={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},Fm={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Vm={activewear:{leggings:Mm.PANTS,joggers:Mm.PANTS,sweatshirts:Mm.SWEATERS},dresses:{a_line:Mm.DRESSES,bodycon:Mm.DRESSES,fit_and_flare:Mm.DRESSES,knit:Mm.DRESSES,shirt:Mm.DRESSES,slip:Mm.DRESSES,straight:Mm.DRESSES,wrap:Mm.DRESSES},jackets_and_coats:{denim_jackets:Mm.JACKETS,parkas:Mm.PUFFERS_AND_PARKAS,peacoats:Mm.COATS,puffer_jackets:Mm.PUFFERS_AND_PARKAS,raincoats:Mm.COATS,rompers:Mm.COATS,shackets:Mm.JACKETS,trench_coats:Mm.COATS},jeans:{bootcut:Mm.PANTS,flared:Mm.PANTS,mom:Mm.PANTS,relaxed:Mm.PANTS,skinny:Mm.PANTS,slim:Mm.PANTS,straight:Mm.PANTS,tapered:Mm.PANTS,wide_leg:Mm.PANTS},jumpsuits_and_rompers:{boiler_suits:Mm.DRESSES,denim:Mm.DRESSES,jumpsuits:Mm.DRESSES,overalls:Mm.DRESSES,rompers:Mm.DRESSES,unitards:Mm.DRESSES},pants_and_shorts:{cigarette:Mm.PANTS,culottes:Mm.SHORTS,denim_shorts:Mm.SHORTS,flared:Mm.PANTS,joggers:Mm.PANTS,leggings:Mm.PANTS,skinny:Mm.PANTS,wide_leg:Mm.PANTS},skirts:{a_line_flared:Mm.SKIRTS,denim:Mm.SKIRTS,knit:Mm.SKIRTS,pencil:Mm.SKIRTS,pleated:Mm.SKIRTS,skater:Mm.SKIRTS,slip:Mm.SKIRTS,wrap:Mm.SKIRTS},suits_and_tailoring:{blazers:Mm.JACKETS,suit_jackets:Mm.JACKETS,suit_skirts:Mm.SKIRTS,suit_trousers:Mm.PANTS,suit_vests:Mm.SWEATERS,trousers:Mm.PANTS},sweaters:{cardigans:Mm.SWEATERS,crewnecks:Mm.SWEATERS,hoodies_and_zipups:Mm.SWEATERS,sweatshirts:Mm.SWEATERS,turtlenecks:Mm.SWEATERS,v_necks:Mm.SWEATERS},tops:{bodysuits:Mm.BLOUSES,corsets_and_bustiers:Mm.BLOUSES,polos:Mm.T_SHIRTS_AND_TANKS,shirts_and_blouses:Mm.BLOUSES,t_shirts:Mm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Mm.T_SHIRTS_AND_TANKS}};var Bm;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Bm||(Bm={}));const Hm={[Bm.TOO_TIGHT]:"Too Tight",[Bm.TIGHT]:"Tight",[Bm.SLIGHTLY_TIGHT]:"Slightly Tight",[Bm.PERFECT_FIT]:"Perfect Fit",[Bm.SLIGHTLY_LOOSE]:"Slightly Loose",[Bm.LOOSE]:"Loose",[Bm.OVERSIZED]:"Oversized",[Bm.TOO_SHORT]:"Too Short",[Bm.SHORT]:"Short",[Bm.SLIGHTLY_SHORT]:"Slightly Short",[Bm.SLIGHTLY_LONG]:"Slightly Long",[Bm.LONG]:"Long",[Bm.TOO_LONG]:"Too Long"};var jm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(jm||(jm={}));var $m=Object.freeze({__proto__:null,get AvatarState(){return jm},get MeasurementLocation(){return Lm},MeasurementLocationName:Pm,get Classification(){return Mm},ClassificationLocations:xm,CategoryNames:Um,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Fm,Taxonomy:Vm,get Fit(){return Bm},FitNames:Hm});export{Am as Errors,Dm as initShop,t as requests,e as responses,$m as types};
3281
3311
  //# sourceMappingURL=index.min.js.map