@thefittingroom/sdk 1.0.1 → 1.0.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.
- package/dist/esm/index.js +97 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +130 -130
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.0.
|
|
2
|
+
* thefittingroom v1.0.2 (2024-02-16T14:48:59.401Z)
|
|
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});
|
|
@@ -35,7 +35,7 @@ var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
|
|
|
35
35
|
* See the License for the specific language governing permissions and
|
|
36
36
|
* limitations under the License.
|
|
37
37
|
*/
|
|
38
|
-
const n=function(t){const e=[];let n=0;for(let
|
|
38
|
+
const n=function(t){const e=[];let n=0;for(let s=0;s<t.length;s++){let r=t.charCodeAt(s);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&s+1<t.length&&56320==(64512&t.charCodeAt(s+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++s)),e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128)}return e},s={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_,s=[];for(let e=0;e<t.length;e+=3){const r=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=r>>2,h=(3&r)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),s.push(n[u],n[h],n[l],n[d])}return s.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(n(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,s=0;for(;n<t.length;){const r=t[n++];if(r<128)e[s++]=String.fromCharCode(r);else if(r>191&&r<224){const i=t[n++];e[s++]=String.fromCharCode((31&r)<<6|63&i)}else if(r>239&&r<365){const i=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[s++]=String.fromCharCode(55296+(i>>10)),e[s++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[s++]=String.fromCharCode((15&r)<<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_,s=[];for(let e=0;e<t.length;){const r=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==r||null==i||null==o||null==a)throw Error();const c=r<<2|i>>4;if(s.push(c),64!==o){const t=i<<4&240|o>>2;if(s.push(t),64!==a){const t=o<<6&192|a;s.push(t)}}}return s},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)}}},r=function(t){return function(t){const e=n(t);return s.encodeByteArray(e,!0)}(t).replace(/\./g,"")},i=function(t){try{return s.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
39
39
|
/**
|
|
40
40
|
* @license
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
@@ -102,7 +102,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
102
102
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
103
103
|
* See the License for the specific language governing permissions and
|
|
104
104
|
* limitations under the License.
|
|
105
|
-
*/class d extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,d.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,f.prototype.create)}}class f{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},
|
|
105
|
+
*/class d extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,d.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,f.prototype.create)}}class f{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},s=`${this.service}/${t}`,r=this.errors[t],i=r?function(t,e){return t.replace(p,((t,n)=>{const s=e[n];return null!=s?String(s):`<${n}?>`}))}(r,n):"Error",o=`${this.serviceName}: ${i} (${s}).`;return new d(s,o,n)}}const p=/\{\$([^}]+)}/g;function g(t,e){if(t===e)return!0;const n=Object.keys(t),s=Object.keys(e);for(const r of n){if(!s.includes(r))return!1;const n=t[r],i=e[r];if(m(n)&&m(i)){if(!g(n,i))return!1}else if(n!==i)return!1}for(const t of s)if(!n.includes(t))return!1;return!0}function m(t){return null!==t&&"object"==typeof t}
|
|
106
106
|
/**
|
|
107
107
|
* @license
|
|
108
108
|
* Copyright 2017 Google LLC
|
|
@@ -118,7 +118,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
118
118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
119
|
* See the License for the specific language governing permissions and
|
|
120
120
|
* limitations under the License.
|
|
121
|
-
*/function y(t){const e=[];for(const[n,
|
|
121
|
+
*/function y(t){const e=[];for(const[n,s]of Object.entries(t))Array.isArray(s)?s.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return e.length?"&"+e.join("&"):""}function v(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,s]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(s)}})),e}function w(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class _{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let s;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");s=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===s.next&&(s.next=T),void 0===s.error&&(s.error=T),void 0===s.complete&&(s.complete=T);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch(t){}})),this.observers.push(s),r}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function T(){}
|
|
122
122
|
/**
|
|
123
123
|
* @license
|
|
124
124
|
* Copyright 2021 Google LLC
|
|
@@ -166,7 +166,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
166
166
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
167
167
|
* See the License for the specific language governing permissions and
|
|
168
168
|
* limitations under the License.
|
|
169
|
-
*/class b{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new l;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),
|
|
169
|
+
*/class b{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new l;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),s=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(s)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(s)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
|
|
170
170
|
/**
|
|
171
171
|
* @license
|
|
172
172
|
* Copyright 2019 Google LLC
|
|
@@ -182,7 +182,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
182
182
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
183
|
* See the License for the specific language governing permissions and
|
|
184
184
|
* limitations under the License.
|
|
185
|
-
*/(t))try{this.getOrInitializeService({instanceIdentifier:S})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=S){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=S){return this.instances.has(t)}getOptions(t=S){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const
|
|
185
|
+
*/(t))try{this.getOrInitializeService({instanceIdentifier:S})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=S){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=S){return this.instances.has(t)}getOptions(t=S){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(s)}return s}onInit(t,e){var n;const s=this.normalizeInstanceIdentifier(e),r=null!==(n=this.onInitCallbacks.get(s))&&void 0!==n?n:new Set;r.add(t),this.onInitCallbacks.set(s,r);const i=this.instances.get(s);return i&&t(i,s),()=>{r.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const s of n)try{s(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(s=t,s===S?void 0:s),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var s;return n||null}normalizeInstanceIdentifier(t=S){return this.component?this.component.multipleInstances?t:S:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class A{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new b(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
|
|
186
186
|
/**
|
|
187
187
|
* @license
|
|
188
188
|
* Copyright 2017 Google LLC
|
|
@@ -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 C;!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"}(C||(C={}));const k={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},N=C.INFO,R={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const
|
|
201
|
+
*/var C;!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"}(C||(C={}));const k={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},N=C.INFO,R={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const s=(new Date).toISOString(),r=R[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${s}] ${t.name}:`,...n)};class O{constructor(t){this.name=t,this._logLevel=N,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in C))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?k[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,C.DEBUG,...t),this._logHandler(this,C.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,C.VERBOSE,...t),this._logHandler(this,C.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,C.INFO,...t),this._logHandler(this,C.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,C.WARN,...t),this._logHandler(this,C.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,C.ERROR,...t),this._logHandler(this,C.ERROR,...t)}}let L,P;const M=new WeakMap,x=new WeakMap,U=new WeakMap,F=new WeakMap,V=new WeakMap;let B={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return x.get(t);if("objectStoreNames"===e)return t.objectStoreNames||U.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return q(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function j(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(P||(P=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(K(this),e),q(M.get(this))}:function(...e){return q(t.apply(K(this),e))}:function(e,...n){const s=t.call(K(this),e,...n);return U.set(s,e.sort?e.sort():[e]),q(s)}}function H(t){return"function"==typeof t?j(t):(t instanceof IDBTransaction&&function(t){if(x.has(t))return;const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)}));x.set(t,e)}(t),e=t,(L||(L=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,B):t);var e}function q(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(q(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&M.set(e,t)})).catch((()=>{})),V.set(e,t),e}(t);if(F.has(t))return F.get(t);const e=H(t);return e!==t&&(F.set(t,e),V.set(e,t)),e}const K=t=>V.get(t);const z=["get","getKey","getAll","getAllKeys","count"],W=["put","add","delete","clear"],G=new Map;function $(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(G.get(e))return G.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=W.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!z.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let o=i.store;return s&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),r&&i.done]))[0]};return G.set(e,i),i}B=(t=>({...t,get:(e,n,s)=>$(e,n)||t.get(e,n,s),has:(e,n)=>!!$(e,n)||t.has(e,n)}))(B);
|
|
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 Q{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
|
|
218
|
+
class Q{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 J="@firebase/app",Y="0.9.0",X=new O("@firebase/app"),Z="[DEFAULT]",tt={[J]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},et=new Map,nt=new Map;function st(t,e){try{t.container.addComponent(e)}catch(n){X.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function rt(t){const e=t.name;if(nt.has(e))return X.debug(`There were multiple attempts to register component ${e}.`),!1;nt.set(e,t);for(const e of et.values())st(e,t);return!0}function it(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
|
|
219
219
|
/**
|
|
220
220
|
* @license
|
|
221
221
|
* Copyright 2019 Google LLC
|
|
@@ -264,7 +264,7 @@ class at{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 ct="9.15.0";function ut(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const
|
|
267
|
+
*/const ct="9.15.0";function ut(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const s=Object.assign({name:Z,automaticDataCollectionEnabled:!1},e),r=s.name;if("string"!=typeof r||!r)throw ot.create("bad-app-name",{appName:String(r)});if(n||(n=(()=>{var t;return null===(t=c())||void 0===t?void 0:t.config})()),!n)throw ot.create("no-options");const i=et.get(r);if(i){if(g(n,i.options)&&g(s,i.config))return i;throw ot.create("duplicate-app",{appName:r})}const o=new A(r);for(const t of nt.values())o.addComponent(t);const a=new at(n,s,o);return et.set(r,a),a}function ht(t=Z){const e=et.get(t);if(!e&&t===Z)return ut();if(!e)throw ot.create("no-app",{appName:t});return e}function lt(t,e,n){var s;let r=null!==(s=tt[t])&&void 0!==s?s:t;n&&(r+=`-${n}`);const i=r.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const t=[`Unable to register library "${r}" with version "${e}":`];return i&&t.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void X.warn(t.join(" "))}rt(new E(`${r}-version`,(()=>({library:r,version:e})),"VERSION"))}
|
|
268
268
|
/**
|
|
269
269
|
* @license
|
|
270
270
|
* Copyright 2021 Google LLC
|
|
@@ -280,7 +280,7 @@ class at{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 dt="firebase-heartbeat-store";let ft=null;function pt(){return ft||(ft=function(t,e,{blocked:n,upgrade:
|
|
283
|
+
*/const dt="firebase-heartbeat-store";let ft=null;function pt(){return ft||(ft=function(t,e,{blocked:n,upgrade:s,blocking:r,terminated:i}={}){const o=indexedDB.open(t,e),a=q(o);return s&&o.addEventListener("upgradeneeded",(t=>{s(q(o.result),t.oldVersion,t.newVersion,q(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),a.then((t=>{i&&t.addEventListener("close",(()=>i())),r&&t.addEventListener("versionchange",(()=>r()))})).catch((()=>{})),a}("firebase-heartbeat-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(dt)}}).catch((t=>{throw ot.create("idb-open",{originalErrorMessage:t.message})}))),ft}async function gt(t,e){try{const n=(await pt()).transaction(dt,"readwrite"),s=n.objectStore(dt);return await s.put(e,mt(t)),n.done}catch(t){if(t instanceof d)X.warn(t.message);else{const e=ot.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});X.warn(e.message)}}}function mt(t){return`${t.name}!${t.options.appId}`}
|
|
284
284
|
/**
|
|
285
285
|
* @license
|
|
286
286
|
* Copyright 2021 Google LLC
|
|
@@ -296,7 +296,7 @@ class at{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 yt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new wt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=vt();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=vt(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let
|
|
299
|
+
*/class yt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new wt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=vt();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=vt(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let s=t.slice();for(const r of t){const t=n.find((t=>t.agent===r.agent));if(t){if(t.dates.push(r.date),_t(n)>e){t.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),_t(n)>e){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}(this._heartbeatsCache.heartbeats),s=r(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)),s}}function vt(){return(new Date).toISOString().substring(0,10)}class wt{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 s="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(s);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(s),t(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var t;e((null===(t=r.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(t){try{return(await pt()).transaction(dt).objectStore(dt).get(mt(t))}catch(t){if(t instanceof d)X.warn(t.message);else{const e=ot.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});X.warn(e.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(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 gt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function _t(t){return r(JSON.stringify({version:2,heartbeats:t})).length}
|
|
300
300
|
/**
|
|
301
301
|
* @license
|
|
302
302
|
* Copyright 2019 Google LLC
|
|
@@ -312,7 +312,7 @@ class at{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 Tt;Tt="",st(new E("platform-logger",(t=>new Q(t)),"PRIVATE")),st(new E("heartbeat",(t=>new yt(t)),"PRIVATE")),lt(Y,J,Tt),lt(Y,J,"esm2017"),lt("fire-js","");var It=function(t,e){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},It(t,e)};function Et(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 St(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 bt,At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ct=Ct||{},kt=At||self;function Nt(){}function Rt(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 Dt(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ot="closure_uid_"+(1e9*Math.random()>>>0),Lt=0;function Pt(t,e,n){return t.call.apply(t.bind,arguments)}function Mt(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function xt(t,e,n){return(xt=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Pt:Mt).apply(null,arguments)}function Ut(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function Ft(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}function Vt(){this.s=this.s,this.o=this.o}Vt.prototype.s=!1,Vt.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ot)&&t[Ot]||(t[Ot]=++Lt))},Vt.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Bt=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 Ht(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 jt(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Rt(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 qt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}qt.prototype.h=function(){this.defaultPrevented=!0};var Kt=function(){if(!kt.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{kt.addEventListener("test",Nt,e),kt.removeEventListener("test",Nt,e)}catch(t){}return t}();function zt(t){return/^[\s\xa0]*$/.test(t)}var Wt=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Gt(t,e){return t<e?-1:t>e?1:0}function $t(){var t=kt.navigator;return t&&(t=t.userAgent)?t:""}function Qt(t){return-1!=$t().indexOf(t)}function Yt(t){return Yt[" "](t),t}Yt[" "]=Nt;var Jt,Xt,Zt=Qt("Opera"),te=Qt("Trident")||Qt("MSIE"),ee=Qt("Edge"),ne=ee||te,re=Qt("Gecko")&&!(-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),se=-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge");function ie(){var t=kt.document;return t?t.documentMode:void 0}t:{var oe="",ae=(Xt=$t(),re?/rv:([^\);]+)(\)|;)/.exec(Xt):ee?/Edge\/([\d\.]+)/.exec(Xt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Xt):se?/WebKit\/(\S+)/.exec(Xt):Zt?/(?:Version)[ \/]?(\S+)/.exec(Xt):void 0);if(ae&&(oe=ae?ae[1]:""),te){var ce=ie();if(null!=ce&&ce>parseFloat(oe)){Jt=String(ce);break t}}Jt=oe}var ue,he={};function le(){return function(t){var e=he;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Wt(String(Jt)).split("."),n=Wt("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=Gt(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Gt(0==i[2].length,0==o[2].length)||Gt(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(kt.document&&te){var de=ie();ue=de||(parseInt(Jt,10)||void 0)}else ue=void 0;var fe=ue;function pe(t,e){if(qt.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(re){t:{try{Yt(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:ge[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&pe.X.h.call(this)}}Ft(pe,qt);var ge={2:"touch",3:"pen",4:"mouse"};pe.prototype.h=function(){pe.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var me="closure_listenable_"+(1e6*Math.random()|0),ye=0;function ve(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,this.key=++ye,this.ba=this.ea=!1}function we(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function _e(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Te(t){var e={};for(var n in t)e[n]=t[n];return e}var Ie="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ee(t,e){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Se(t){this.src=t,this.g={},this.h=0}function be(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=Bt(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}Se.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,r,s){if(r&&r.once)return De(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Dt(r)?!!r.capture:!!r,s):Re(t,e,n,!1,r,s)}function Re(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Dt(s)?!!s.capture:!!s,a=xe(t);if(a||(t[Ce]=a=new Se(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Kt||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function De(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)De(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Dt(r)?!!r.capture:!!r,s):Re(t,e,n,!0,r,s)}function Oe(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Oe(t,e[i],n,r,s);else r=Dt(r)?!!r.capture:!!r,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,r,s))&&(we(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=xe(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Ae(e,n,r,s)),(n=-1<t?e[t]:null)&&Le(n))}function Le(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[me])be(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Pe(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=xe(e))?(be(n,t),0==n.h&&(n.src=null,e[Ce]=null)):we(t)}}}function Pe(t){return t in ke?ke[t]:ke[t]="on"+t}function Me(t,e){if(t.ba)t=!0;else{e=new pe(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&Le(t),t=n.call(r,e)}return t}function xe(t){return(t=t[Ce])instanceof Se?t:null}var Ue="__closure_events_fn_"+(1e9*Math.random()>>>0);function Fe(t){return"function"==typeof t?t:(t[Ue]||(t[Ue]=function(e){return t.handleEvent(e)}),t[Ue])}function Ve(){Vt.call(this),this.i=new Se(this),this.P=this,this.I=null}function Be(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 qt(e,t);else if(e instanceof qt)e.target=e.target||t;else{var s=e;Ee(e=new qt(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=He(o,r,!0,e)&&s}if(s=He(o=e.g=t,r,!0,e)&&s,s=He(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=He(o=e.g=n[i],r,!1,e)&&s}function He(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&&be(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,r){Oe(this,t,e,n,r)},Ve.prototype.M=function(){if(Ve.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)we(n[r]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Ve.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var je=kt.JSON.stringify;function qe(){var t=Je,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Ke,ze=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=We.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),We=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new Ge}),(function(t){return t.reset()})),Ge=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function $e(t){kt.setTimeout((function(){throw t}),0)}function Qe(t,e){Ke||function(){var t=kt.Promise.resolve(void 0);Ke=function(){t.then(Xe)}}(),Ye||(Ke(),Ye=!0),Je.add(t,e)}var Ye=!1,Je=new ze;function Xe(){for(var t;t=qe();){try{t.h.call(t.g)}catch(t){$e(t)}var e=We;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Ye=!1}function Ze(t,e){Ve.call(this),this.h=t||1,this.g=e||kt,this.j=xt(this.lb,this),this.l=Date.now()}function tn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function en(t,e,n){if("function"==typeof t)n&&(t=xt(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=xt(t.handleEvent,t)}return 2147483647<Number(e)?-1:kt.setTimeout(t,e||0)}function nn(t){t.g=en((function(){t.g=null,t.i&&(t.i=!1,nn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ft(Ze,Ve),(bt=Ze.prototype).ca=!1,bt.R=null,bt.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),Be(this,"tick"),this.ca&&(tn(this),this.start()))}},bt.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},bt.M=function(){Ze.X.M.call(this),tn(this),delete this.g};var rn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}It(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:nn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(kt.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Vt);function sn(t){Vt.call(this),this.h=t,this.g={}}Ft(sn,Vt);var on=[];function an(t,e,n,r){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var s=0;s<n.length;s++){var i=Ne(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function cn(t){_e(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Le(t)}),t),t.g={}}function un(){this.g=!0}function hn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return je(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}sn.prototype.M=function(){sn.X.M.call(this),cn(this)},sn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},un.prototype.Aa=function(){this.g=!1},un.prototype.info=function(){};var ln={},dn=null;function fn(){return dn=dn||new Ve}function pn(t){qt.call(this,ln.Pa,t)}function gn(t){var e=fn();Be(e,new pn(e))}function mn(t,e){qt.call(this,ln.STAT_EVENT,t),this.stat=e}function yn(t){var e=fn();Be(e,new mn(e,t))}function vn(t,e){qt.call(this,ln.Qa,t),this.size=e}function wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return kt.setTimeout((function(){t()}),e)}ln.Pa="serverreachability",Ft(pn,qt),ln.STAT_EVENT="statevent",Ft(mn,qt),ln.Qa="timingevent",Ft(vn,qt);var _n={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Tn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function In(){}function En(t){return t.h||(t.h=t.i())}function Sn(){}In.prototype.h=null;var bn,An={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Cn(){qt.call(this,"d")}function kn(){qt.call(this,"c")}function Nn(){}function Rn(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new sn(this),this.O=On,t=ne?125:void 0,this.T=new Ze(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new Dn}function Dn(){this.i=null,this.g="",this.h=!1}Ft(Cn,qt),Ft(kn,qt),Ft(Nn,In),Nn.prototype.g=function(){return new XMLHttpRequest},Nn.prototype.i=function(){return{}},bn=new Nn;var On=45e3,Ln={},Pn={};function Mn(t,e,n){t.K=1,t.v=tr(Qn(e)),t.s=n,t.P=!0,xn(t,null)}function xn(t,e){t.F=Date.now(),Bn(t),t.A=Qn(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),fr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Dn,t.g=fs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new rn(xt(t.La,t,t.g),t.N)),an(t.S,t.g,"readystatechange",t.ib),e=t.H?Te(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),gn(),function(t,e,n,r,s,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Un(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Fn(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),s=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}hn(t.j,t.m,r,null),zn(t,r)}Un(t)&&r!=Pn&&r!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),s=!1),t.i=t.i&&s,s?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),is(e),e.K=!0,yn(11))):(hn(t.j,t.m,n,"[Invalid Chunked Response]"),Kn(t),qn(t))}function Vn(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?Pn:(n=Number(e.substring(n,r)),isNaN(n)?Ln:(r+=1)+n>e.length?Pn:(e=e.substr(r,n),t.C=r+n,e))}function Bn(t){t.V=Date.now()+t.O,Hn(t,t.O)}function Hn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=wn(xt(t.gb,t),e)}function jn(t){t.B&&(kt.clearTimeout(t.B),t.B=null)}function qn(t){0==t.l.G||t.I||cs(t.l,t)}function Kn(t){jn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,tn(t.T),cn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function zn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||_r(n.h,t)))if(!t.J&&_r(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;as(n),Jr(n)}ss(n),yn(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=wr(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hs(n,11)}else if((t.J||n.g==t)&&as(n),!zt(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(Tr(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Zn(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=ds(r,r.H?r.ka:null,r.V),f.J){Ir(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(jn(p),Bn(p)),r.g=f}else rs(r);0<n.i.length&&Zr(n)}else"stop"!=i[0]&&"close"!=i[0]||hs(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hs(n,7):Yr(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}gn()}catch(i){}}function Wn(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Rt(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(Rt(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(Rt(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)}(bt=Rn.prototype).setTimeout=function(t){this.O=t},bt.ib=function(t){t=t.target;var e=this.L;e&&3==Kr(t)?e.l():this.La(t)},bt.La=function(t){try{if(t==this.g)t:{var e=Kr(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||zr(this.g)))){this.I||4!=e||7==n||gn(),jn(this);var r=this.g.aa();this.Y=r;e:if(Un(this)){var s=zr(this.g);t="";var i=s.length,o=4==Kr(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Kn(this),qn(this);var a="";break e}this.h.i=new kt.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!zt(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,yn(12),Kn(this),qn(this);break t}hn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,zn(this,r)}this.P?(Fn(this,e,a),ne&&this.i&&3==e&&(an(this.S,this.T,"tick",this.hb),this.T.start())):(hn(this.j,this.m,a,null),zn(this,a)),4==e&&Kn(this),this.i&&!this.I&&(4==e?cs(this.l,this):(this.i=!1,Bn(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,yn(12)):(this.o=0,yn(13)),Kn(this),qn(this)}}}catch(e){}},bt.hb=function(){if(this.g){var t=Kr(this.g),e=this.g.fa();this.C<e.length&&(jn(this),Fn(this,t,e),this.i&&4!=t&&Bn(this))}},bt.cancel=function(){this.I=!0,Kn(this)},bt.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(gn(),yn(17)),Kn(this),this.o=2,qn(this)):Hn(this,this.V-t)};var Gn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function $n(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof $n){this.h=void 0!==e?e:t.h,Yn(this,t.j),this.s=t.s,this.g=t.g,Jn(this,t.m),this.l=t.l,e=t.i;var n=new ur;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Xn(this,n),this.o=t.o}else t&&(n=String(t).match(Gn))?(this.h=!!e,Yn(this,n[1]||"",!0),this.s=er(n[2]||""),this.g=er(n[3]||"",!0),Jn(this,n[4]),this.l=er(n[5]||"",!0),Xn(this,n[6]||"",!0),this.o=er(n[7]||"")):(this.h=!!e,this.i=new ur(null,this.h))}function Qn(t){return new $n(t)}function Yn(t,e,n){t.j=n?er(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Jn(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 Xn(t,e,n){e instanceof ur?(t.i=e,function(t,e){e&&!t.j&&(hr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(lr(this,e),fr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=nr(e,ar)),t.i=new ur(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function tr(t){return Zn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function er(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function nr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,rr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function rr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}$n.prototype.toString=function(){var t=[],e=this.j;e&&t.push(nr(e,sr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(nr(e,sr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(nr(n,"/"==n.charAt(0)?or:ir,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",nr(n,cr)),t.join("")};var sr=/[#\/\?@]/g,ir=/[#\?:]/g,or=/[#\?]/g,ar=/[#\?@]/g,cr=/#/g;function ur(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function lr(t,e){hr(t),e=pr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function dr(t,e){return hr(t),e=pr(t,e),t.g.has(e)}function fr(t,e,n){lr(t,e),0<n.length&&(t.i=null,t.g.set(pr(t,e),Ht(n)),t.h+=n.length)}function pr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(bt=ur.prototype).add=function(t,e){hr(this),this.i=null,t=pr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},bt.forEach=function(t,e){hr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},bt.oa=function(){hr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},bt.W=function(t){hr(this);var e=[];if("string"==typeof t)dr(this,t)&&(e=e.concat(this.g.get(pr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},bt.set=function(t,e){return hr(this),this.i=null,dr(this,t=pr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},bt.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},bt.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var gr=function(t,e){this.h=t,this.g=e};function mr(t){this.l=t||yr,kt.PerformanceNavigationTiming?t=0<(t=kt.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(kt.g&&kt.g.Ga&&kt.g.Ga()&&kt.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var yr=10;function vr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function wr(t){return t.h?1:t.g?t.g.size:0}function _r(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Tr(t,e){t.g?t.g.add(e):t.h=e}function Ir(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Er(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=Et(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 Ht(t.i)}function Sr(){}function br(){this.g=new Sr}function Ar(t,e,n){var r=n||"";try{Wn(t,(function(t,n){var s=t;Dt(t)&&(s=je(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Cr(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function kr(t){this.l=t.ac||null,this.j=t.jb||!1}function Nr(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Rr,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}mr.prototype.cancel=function(){var t,e;if(this.i=Er(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Et(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()}},Sr.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Sr.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(kr,In),kr.prototype.g=function(){return new Nr(this.l,this.j)},kr.prototype.i=function(t){return function(){return t}}({}),Ft(Nr,Ve);var Rr=0;function Dr(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Or(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Lr(t)}function Lr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(bt=Nr.prototype).open=function(t,e){if(this.readyState!=Rr)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Lr(this)},bt.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||kt).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},bt.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Or(this)),this.readyState=Rr},bt.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Lr(this)),this.g&&(this.readyState=3,Lr(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==kt.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Dr(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},bt.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Or(this):Lr(this),3==this.readyState&&Dr(this)}},bt.Va=function(t){this.g&&(this.response=this.responseText=t,Or(this))},bt.Ua=function(t){this.g&&(this.response=t,Or(this))},bt.ga=function(){this.g&&Or(this)},bt.setRequestHeader=function(t,e){this.v.append(t,e)},bt.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},bt.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Nr.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Pr=kt.JSON.parse;function Mr(t){Ve.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=xr,this.K=this.L=!1}Ft(Mr,Ve);var xr="",Ur=/^https?$/i,Fr=["POST","PUT"];function Vr(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Br(t),jr(t)}function Br(t){t.D||(t.D=!0,Be(t,"complete"),Be(t,"error"))}function Hr(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=Kr(t)||2!=t.aa()))if(t.v&&4==Kr(t))en(t.Ha,0,t);else if(Be(t,"readystatechange"),4==Kr(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match(Gn)[1]||null;if(!i&&kt.self&&kt.self.location){var o=kt.self.location.protocol;i=o.substr(0,o.length-1)}s=!Ur.test(i?i.toLowerCase():"")}e=s}if(e)Be(t,"complete"),Be(t,"success");else{t.m=6;try{var a=2<Kr(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Br(t)}}finally{jr(t)}}}function jr(t,e){if(t.g){qr(t);var n=t.g,r=t.C[0]?Nt:null;t.g=null,t.C=null,e||Be(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function qr(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function Kr(t){return t.g?t.g.readyState:0}function zr(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Wr(t){var e="";return _e(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Gr(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Wr(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function $r(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qr(t){this.Ca=0,this.i=[],this.j=new un,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=$r("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=$r("baseRetryDelayMs",5e3,t),this.bb=$r("retryDelaySeedMs",1e4,t),this.$a=$r("forwardChannelMaxRetries",2,t),this.ta=$r("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new mr(t&&t.concurrentRequestLimit),this.Fa=new br,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 Yr(t){if(Xr(t),3==t.G){var e=t.U++,n=Qn(t.F);Zn(n,"SID",t.I),Zn(n,"RID",e),Zn(n,"TYPE","terminate"),es(t,n),(e=new Rn(t,t.j,e,void 0)).K=2,e.v=tr(Qn(n)),n=!1,kt.navigator&&kt.navigator.sendBeacon&&(n=kt.navigator.sendBeacon(e.v.toString(),"")),!n&&kt.Image&&((new Image).src=e.v,n=!0),n||(e.g=fs(e.l,null),e.g.da(e.v)),e.F=Date.now(),Bn(e)}ls(t)}function Jr(t){t.g&&(is(t),t.g.cancel(),t.g=null)}function Xr(t){Jr(t),t.u&&(kt.clearTimeout(t.u),t.u=null),as(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zr(t){vr(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function ts(t,e){var n;n=e?e.m:t.U++;var r=Qn(t.F);Zn(r,"SID",t.I),Zn(r,"RID",n),Zn(r,"AID",t.T),es(t,r),t.o&&t.s&&Gr(r,t.o,t.s),n=new Rn(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=ns(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Tr(t.h,n),Mn(n,r,e)}function es(t,e){t.ia&&_e(t.ia,(function(t,n){Zn(e,n,t)})),t.l&&Wn({},(function(t,n){Zn(e,n,t)}))}function ns(t,e,n){n=Math.min(t.i.length,n);var r=t.l?xt(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{Ar(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function rs(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function ss(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),us(t,t.A)),t.A++,!0)}function is(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function os(t){t.g=new Rn(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Qn(t.sa);Zn(e,"RID","rpc"),Zn(e,"SID",t.I),Zn(e,"CI",t.L?"0":"1"),Zn(e,"AID",t.T),Zn(e,"TYPE","xmlhttp"),es(t,e),t.o&&t.s&&Gr(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=tr(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function as(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cs(t,e){var n=null;if(t.g==e){as(t),is(t),t.g=null;var r=2}else{if(!_r(t.h,e))return;n=e.D,Ir(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;Be(r=fn(),new vn(r,n)),Zr(t)}else rs(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(wr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=wn(xt(t.Ja,t,e),us(t,t.C)),t.C++,0)))}(t,e)||2==r&&ss(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:hs(t,5);break;case 4:hs(t,10);break;case 3:hs(t,6);break;default:hs(t,2)}}function us(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hs(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=xt(t.kb,t);n||(n=new $n("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Yn(n,"https"),tr(n)),function(t,e){var n=new un;if(kt.Image){var r=new Image;r.onload=Ut(Cr,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Ut(Cr,n,r,"TestLoadImage: error",!1,e),r.onabort=Ut(Cr,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Ut(Cr,n,r,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else yn(2);t.G=0,t.l&&t.l.va(e),ls(t),Xr(t)}function ls(t){if(t.G=0,t.la=[],t.l){var e=Er(t.h);0==e.length&&0==t.i.length||(jt(t.la,e),jt(t.la,t.i),t.h.i.length=0,Ht(t.i),t.i.length=0),t.l.ua()}}function ds(t,e,n){var r=n instanceof $n?Qn(n):new $n(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Jn(r,r.m);else{var s=kt.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new $n(null,void 0);r&&Yn(i,r),e&&(i.g=e),s&&Jn(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&Zn(r,n,e),Zn(r,"VER",t.ma),es(t,r),r}function fs(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Mr(new kr({jb:!0})):new Mr(t.ra)).Ka(t.H),e}function ps(){}function gs(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function ms(t,e){Ve.call(this),this.g=new Qr(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!zt(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!zt(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ws(this)}function ys(t){Cn.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function vs(){kn.call(this),this.status=1}function ws(t){this.g=t}(bt=Mr.prototype).Ka=function(t){this.L=t},bt.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():bn.g(),this.C=this.u?En(this.u):En(bn),this.g.onreadystatechange=xt(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Vr(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=Et(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=Bt(Fr,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Et(n),f=d.next();!f.done;f=d.next()){var p=St(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{qr(this),0<this.B&&((this.K=function(t){return te&&le()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=xt(this.qa,this)):this.A=en(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Vr(this,l)}},bt.qa=function(){void 0!==Ct&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Be(this,"timeout"),this.abort(8))},bt.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Be(this,"complete"),Be(this,"abort"),jr(this))},bt.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),jr(this,!0)),Mr.X.M.call(this)},bt.Ha=function(){this.s||(this.F||this.v||this.l?Hr(this):this.fb())},bt.fb=function(){Hr(this)},bt.aa=function(){try{return 2<Kr(this)?this.g.status:-1}catch(t){return-1}},bt.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},bt.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Pr(e)}},bt.Ea=function(){return this.m},bt.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(bt=Qr.prototype).ma=8,bt.G=1,bt.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 Rn(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Ee(n=Te(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=ns(this,e,r),Zn(s=Qn(this.F),"RID",t),Zn(s,"CVER",22),this.D&&Zn(s,"X-HTTP-Session-Id",this.D),es(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Wr(n)))+"&"+r:this.o&&Gr(s,this.o,n)),Tr(this.h,e),this.Ya&&Zn(s,"TYPE","init"),this.O?(Zn(s,"$req",r),Zn(s,"SID","null"),e.Z=!0,Mn(e,s,null)):Mn(e,s,r),this.G=2}}else 3==this.G&&(t?ts(this,t):0==this.i.length||vr(this.h)||ts(this))},bt.Ia=function(){if(this.u=null,os(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=wn(xt(this.eb,this),t)}},bt.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,yn(10),Jr(this),os(this))},bt.cb=function(){null!=this.v&&(this.v=null,Jr(this),ss(this),yn(19))},bt.kb=function(t){t?(this.j.info("Successfully pinged google.com"),yn(2)):(this.j.info("Failed to ping google.com"),yn(1))},(bt=ps.prototype).xa=function(){},bt.wa=function(){},bt.va=function(){},bt.ua=function(){},bt.Ra=function(){},gs.prototype.g=function(t,e){return new ms(t,e)},Ft(ms,Ve),ms.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;yn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=ds(t,null,t.V),Zr(t)},ms.prototype.close=function(){Yr(this.g)},ms.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=je(t),t=n);e.i.push(new gr(e.ab++,t)),3==e.G&&Zr(e)},ms.prototype.M=function(){this.g.l=null,delete this.j,Yr(this.g),delete this.g,ms.X.M.call(this)},Ft(ys,Cn),Ft(vs,kn),Ft(ws,ps),ws.prototype.xa=function(){Be(this.g,"a")},ws.prototype.wa=function(t){Be(this.g,new ys(t))},ws.prototype.va=function(t){Be(this.g,new vs)},ws.prototype.ua=function(){Be(this.g,"b")},gs.prototype.createWebChannel=gs.prototype.g,ms.prototype.send=ms.prototype.u,ms.prototype.open=ms.prototype.m,ms.prototype.close=ms.prototype.close,_n.NO_ERROR=0,_n.TIMEOUT=8,_n.HTTP_ERROR=6,Tn.COMPLETE="complete",Sn.EventType=An,An.OPEN="a",An.CLOSE="b",An.ERROR="c",An.MESSAGE="d",Ve.prototype.listen=Ve.prototype.N,Mr.prototype.listenOnce=Mr.prototype.O,Mr.prototype.getLastError=Mr.prototype.Oa,Mr.prototype.getLastErrorCode=Mr.prototype.Ea,Mr.prototype.getStatus=Mr.prototype.aa,Mr.prototype.getResponseJson=Mr.prototype.Sa,Mr.prototype.getResponseText=Mr.prototype.fa,Mr.prototype.send=Mr.prototype.da,Mr.prototype.setWithCredentials=Mr.prototype.Ka;var _s=_n,Ts=Tn,Is=ln,Es=10,Ss=11,bs=kr,As=Sn,Cs=Mr;const ks="@firebase/firestore";
|
|
315
|
+
*/var Tt;Tt="",rt(new E("platform-logger",(t=>new Q(t)),"PRIVATE")),rt(new E("heartbeat",(t=>new yt(t)),"PRIVATE")),lt(J,Y,Tt),lt(J,Y,"esm2017"),lt("fire-js","");var It=function(t,e){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},It(t,e)};function Et(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],s=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function St(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var s,r,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o}var bt,At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ct=Ct||{},kt=At||self;function Nt(){}function Rt(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 Dt(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ot="closure_uid_"+(1e9*Math.random()>>>0),Lt=0;function Pt(t,e,n){return t.call.apply(t.bind,arguments)}function Mt(t,e,n){if(!t)throw Error();if(2<arguments.length){var s=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,s),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function xt(t,e,n){return(xt=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Pt:Mt).apply(null,arguments)}function Ut(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function Ft(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}function Vt(){this.s=this.s,this.o=this.o}Vt.prototype.s=!1,Vt.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ot)&&t[Ot]||(t[Ot]=++Lt))},Vt.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Bt=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function jt(t){var e=t.length;if(0<e){for(var n=Array(e),s=0;s<e;s++)n[s]=t[s];return n}return[]}function Ht(t,e){for(var n=1;n<arguments.length;n++){var s=arguments[n];if(Rt(s)){var r=t.length||0,i=s.length||0;t.length=r+i;for(var o=0;o<i;o++)t[r+o]=s[o]}else t.push(s)}}function qt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}qt.prototype.h=function(){this.defaultPrevented=!0};var Kt=function(){if(!kt.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{kt.addEventListener("test",Nt,e),kt.removeEventListener("test",Nt,e)}catch(t){}return t}();function zt(t){return/^[\s\xa0]*$/.test(t)}var Wt=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Gt(t,e){return t<e?-1:t>e?1:0}function $t(){var t=kt.navigator;return t&&(t=t.userAgent)?t:""}function Qt(t){return-1!=$t().indexOf(t)}function Jt(t){return Jt[" "](t),t}Jt[" "]=Nt;var Yt,Xt,Zt=Qt("Opera"),te=Qt("Trident")||Qt("MSIE"),ee=Qt("Edge"),ne=ee||te,se=Qt("Gecko")&&!(-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),re=-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge");function ie(){var t=kt.document;return t?t.documentMode:void 0}t:{var oe="",ae=(Xt=$t(),se?/rv:([^\);]+)(\)|;)/.exec(Xt):ee?/Edge\/([\d\.]+)/.exec(Xt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Xt):re?/WebKit\/(\S+)/.exec(Xt):Zt?/(?:Version)[ \/]?(\S+)/.exec(Xt):void 0);if(ae&&(oe=ae?ae[1]:""),te){var ce=ie();if(null!=ce&&ce>parseFloat(oe)){Yt=String(ce);break t}}Yt=oe}var ue,he={};function le(){return function(t){var e=he;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Wt(String(Yt)).split("."),n=Wt("9").split("."),s=Math.max(e.length,n.length),r=0;0==t&&r<s;r++){var i=e[r]||"",o=n[r]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=Gt(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Gt(0==i[2].length,0==o[2].length)||Gt(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(kt.document&&te){var de=ie();ue=de||(parseInt(Yt,10)||void 0)}else ue=void 0;var fe=ue;function pe(t,e){if(qt.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,s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(se){t:{try{Jt(e.nodeName);var r=!0;break t}catch(t){}r=!1}r||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:ge[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&pe.X.h.call(this)}}Ft(pe,qt);var ge={2:"touch",3:"pen",4:"mouse"};pe.prototype.h=function(){pe.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var me="closure_listenable_"+(1e6*Math.random()|0),ye=0;function ve(t,e,n,s,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!s,this.ha=r,this.key=++ye,this.ba=this.ea=!1}function we(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function _e(t,e,n){for(var s in t)e.call(n,t[s],s,t)}function Te(t){var e={};for(var n in t)e[n]=t[n];return e}var Ie="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ee(t,e){for(var n,s,r=1;r<arguments.length;r++){for(n in s=arguments[r])t[n]=s[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}}function Se(t){this.src=t,this.g={},this.h=0}function be(t,e){var n=e.type;if(n in t.g){var s,r=t.g[n],i=Bt(r,e);(s=0<=i)&&Array.prototype.splice.call(r,i,1),s&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,s){for(var r=0;r<t.length;++r){var i=t[r];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==s)return r}return-1}Se.prototype.add=function(t,e,n,s,r){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,s,r);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!s,r)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,s,r){if(s&&s.once)return De(t,e,n,s,r);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,s,r);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Dt(s)?!!s.capture:!!s,r):Re(t,e,n,!1,s,r)}function Re(t,e,n,s,r,i){if(!e)throw Error("Invalid event type");var o=Dt(r)?!!r.capture:!!r,a=xe(t);if(a||(t[Ce]=a=new Se(t)),(n=a.add(e,n,s,o,i)).proxy)return n;if(s=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=s,s.src=t,s.listener=n,t.addEventListener)Kt||(r=o),void 0===r&&(r=!1),t.addEventListener(e.toString(),s,r);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),s);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(s)}return n}function De(t,e,n,s,r){if(Array.isArray(e)){for(var i=0;i<e.length;i++)De(t,e[i],n,s,r);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Dt(s)?!!s.capture:!!s,r):Re(t,e,n,!0,s,r)}function Oe(t,e,n,s,r){if(Array.isArray(e))for(var i=0;i<e.length;i++)Oe(t,e[i],n,s,r);else s=Dt(s)?!!s.capture:!!s,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,s,r))&&(we(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=xe(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Ae(e,n,s,r)),(n=-1<t?e[t]:null)&&Le(n))}function Le(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[me])be(e.i,t);else{var n=t.type,s=t.proxy;e.removeEventListener?e.removeEventListener(n,s,t.capture):e.detachEvent?e.detachEvent(Pe(n),s):e.addListener&&e.removeListener&&e.removeListener(s),(n=xe(e))?(be(n,t),0==n.h&&(n.src=null,e[Ce]=null)):we(t)}}}function Pe(t){return t in ke?ke[t]:ke[t]="on"+t}function Me(t,e){if(t.ba)t=!0;else{e=new pe(e,this);var n=t.listener,s=t.ha||t.src;t.ea&&Le(t),t=n.call(s,e)}return t}function xe(t){return(t=t[Ce])instanceof Se?t:null}var Ue="__closure_events_fn_"+(1e9*Math.random()>>>0);function Fe(t){return"function"==typeof t?t:(t[Ue]||(t[Ue]=function(e){return t.handleEvent(e)}),t[Ue])}function Ve(){Vt.call(this),this.i=new Se(this),this.P=this,this.I=null}function Be(t,e){var n,s=t.I;if(s)for(n=[];s;s=s.I)n.push(s);if(t=t.P,s=e.type||e,"string"==typeof e)e=new qt(e,t);else if(e instanceof qt)e.target=e.target||t;else{var r=e;Ee(e=new qt(s,t),r)}if(r=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];r=je(o,s,!0,e)&&r}if(r=je(o=e.g=t,s,!0,e)&&r,r=je(o,s,!1,e)&&r,n)for(i=0;i<n.length;i++)r=je(o=e.g=n[i],s,!1,e)&&r}function je(t,e,n,s){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var r=!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&&be(t.i,o),r=!1!==a.call(c,s)&&r}}return r&&!s.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,s){Oe(this,t,e,n,s)},Ve.prototype.M=function(){if(Ve.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],s=0;s<n.length;s++)we(n[s]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,s){return this.i.add(String(t),e,!1,n,s)},Ve.prototype.O=function(t,e,n,s){return this.i.add(String(t),e,!0,n,s)};var He=kt.JSON.stringify;function qe(){var t=Ye,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Ke,ze=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=We.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),We=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new Ge}),(function(t){return t.reset()})),Ge=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function $e(t){kt.setTimeout((function(){throw t}),0)}function Qe(t,e){Ke||function(){var t=kt.Promise.resolve(void 0);Ke=function(){t.then(Xe)}}(),Je||(Ke(),Je=!0),Ye.add(t,e)}var Je=!1,Ye=new ze;function Xe(){for(var t;t=qe();){try{t.h.call(t.g)}catch(t){$e(t)}var e=We;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Je=!1}function Ze(t,e){Ve.call(this),this.h=t||1,this.g=e||kt,this.j=xt(this.lb,this),this.l=Date.now()}function tn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function en(t,e,n){if("function"==typeof t)n&&(t=xt(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=xt(t.handleEvent,t)}return 2147483647<Number(e)?-1:kt.setTimeout(t,e||0)}function nn(t){t.g=en((function(){t.g=null,t.i&&(t.i=!1,nn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ft(Ze,Ve),(bt=Ze.prototype).ca=!1,bt.R=null,bt.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),Be(this,"tick"),this.ca&&(tn(this),this.start()))}},bt.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},bt.M=function(){Ze.X.M.call(this),tn(this),delete this.g};var sn=function(t){function e(e,n){var s=t.call(this)||this;return s.m=e,s.j=n,s.h=null,s.i=!1,s.g=null,s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}It(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:nn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(kt.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Vt);function rn(t){Vt.call(this),this.h=t,this.g={}}Ft(rn,Vt);var on=[];function an(t,e,n,s){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var r=0;r<n.length;r++){var i=Ne(e,n[r],s||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function cn(t){_e(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Le(t)}),t),t.g={}}function un(){this.g=!0}function hn(t,e,n,s){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 s=n[t];if(!(2>s.length)){var r=s[1];if(Array.isArray(r)&&!(1>r.length)){var i=r[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<r.length;o++)r[o]=""}}}return He(n)}catch(t){return e}}(t,n)+(s?" "+s:"")}))}rn.prototype.M=function(){rn.X.M.call(this),cn(this)},rn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},un.prototype.Aa=function(){this.g=!1},un.prototype.info=function(){};var ln={},dn=null;function fn(){return dn=dn||new Ve}function pn(t){qt.call(this,ln.Pa,t)}function gn(t){var e=fn();Be(e,new pn(e))}function mn(t,e){qt.call(this,ln.STAT_EVENT,t),this.stat=e}function yn(t){var e=fn();Be(e,new mn(e,t))}function vn(t,e){qt.call(this,ln.Qa,t),this.size=e}function wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return kt.setTimeout((function(){t()}),e)}ln.Pa="serverreachability",Ft(pn,qt),ln.STAT_EVENT="statevent",Ft(mn,qt),ln.Qa="timingevent",Ft(vn,qt);var _n={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Tn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function In(){}function En(t){return t.h||(t.h=t.i())}function Sn(){}In.prototype.h=null;var bn,An={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Cn(){qt.call(this,"d")}function kn(){qt.call(this,"c")}function Nn(){}function Rn(t,e,n,s){this.l=t,this.j=e,this.m=n,this.U=s||1,this.S=new rn(this),this.O=On,t=ne?125:void 0,this.T=new Ze(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new Dn}function Dn(){this.i=null,this.g="",this.h=!1}Ft(Cn,qt),Ft(kn,qt),Ft(Nn,In),Nn.prototype.g=function(){return new XMLHttpRequest},Nn.prototype.i=function(){return{}},bn=new Nn;var On=45e3,Ln={},Pn={};function Mn(t,e,n){t.K=1,t.v=ts(Qn(e)),t.s=n,t.P=!0,xn(t,null)}function xn(t,e){t.F=Date.now(),Bn(t),t.A=Qn(t.v);var n=t.A,s=t.U;Array.isArray(s)||(s=[String(s)]),fs(n.i,"t",s),t.C=0,n=t.l.H,t.h=new Dn,t.g=fr(t.l,n?e:null,!t.s),0<t.N&&(t.L=new sn(xt(t.La,t,t.g),t.N)),an(t.S,t.g,"readystatechange",t.ib),e=t.H?Te(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),gn(),function(t,e,n,s,r,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 ("+s+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Un(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Fn(t,e,n){for(var s,r=!0;!t.I&&t.C<n.length;){if((s=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),r=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(s==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}hn(t.j,t.m,s,null),zn(t,s)}Un(t)&&s!=Pn&&s!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),r=!1),t.i=t.i&&r,r?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),ir(e),e.K=!0,yn(11))):(hn(t.j,t.m,n,"[Invalid Chunked Response]"),Kn(t),qn(t))}function Vn(t,e){var n=t.C,s=e.indexOf("\n",n);return-1==s?Pn:(n=Number(e.substring(n,s)),isNaN(n)?Ln:(s+=1)+n>e.length?Pn:(e=e.substr(s,n),t.C=s+n,e))}function Bn(t){t.V=Date.now()+t.O,jn(t,t.O)}function jn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=wn(xt(t.gb,t),e)}function Hn(t){t.B&&(kt.clearTimeout(t.B),t.B=null)}function qn(t){0==t.l.G||t.I||cr(t.l,t)}function Kn(t){Hn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,tn(t.T),cn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function zn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||_s(n.h,t)))if(!t.J&&_s(n.h,t)&&3==n.G){try{var s=n.Fa.g.parse(e)}catch(i){s=null}if(Array.isArray(s)&&3==s.length){var r=s;if(0==r[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ar(n),Ys(n)}rr(n),yn(18)}}else n.Ba=r[1],0<n.Ba-n.T&&37500>r[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=ws(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hr(n,11)}else if((t.J||n.g==t)&&ar(n),!zt(e))for(r=n.Fa.g.parse(e),e=0;e<r.length;e++){var i=r[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&&(s=1.5*c,n.J=s,n.j.info("backChannelRequestTimeoutMs_="+s)),s=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=s.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&&(Ts(l,l.h),l.h=null))}if(s.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(s.za=d,Zn(s.F,s.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((s=n).sa=dr(s,s.H?s.ka:null,s.V),f.J){Is(s.h,f);var p=f,g=s.J;g&&p.setTimeout(g),p.B&&(Hn(p),Bn(p)),s.g=f}else sr(s);0<n.i.length&&Zs(n)}else"stop"!=i[0]&&"close"!=i[0]||hr(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hr(n,7):Js(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}gn()}catch(i){}}function Wn(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Rt(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(Rt(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var s in e=[],n=0,t)e[n++]=s;return e}}}(t),s=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(Rt(t)){for(var e=[],n=t.length,s=0;s<n;s++)e.push(t[s]);return e}for(s in e=[],n=0,t)e[n++]=t[s];return e}(t),r=s.length,i=0;i<r;i++)e.call(void 0,s[i],n&&n[i],t)}(bt=Rn.prototype).setTimeout=function(t){this.O=t},bt.ib=function(t){t=t.target;var e=this.L;e&&3==Ks(t)?e.l():this.La(t)},bt.La=function(t){try{if(t==this.g)t:{var e=Ks(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||zs(this.g)))){this.I||4!=e||7==n||gn(),Hn(this);var s=this.g.aa();this.Y=s;e:if(Un(this)){var r=zs(this.g);t="";var i=r.length,o=4==Ks(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Kn(this),qn(this);var a="";break e}this.h.i=new kt.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(r[n],{stream:o&&n==i-1});r.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==s,function(t,e,n,s,r,i,o){t.info((function(){return"XMLHTTP RESP ("+s+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,s),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!zt(c)){var h=c;break e}}h=null}if(!(s=h)){this.i=!1,this.o=3,yn(12),Kn(this),qn(this);break t}hn(this.j,this.m,s,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,zn(this,s)}this.P?(Fn(this,e,a),ne&&this.i&&3==e&&(an(this.S,this.T,"tick",this.hb),this.T.start())):(hn(this.j,this.m,a,null),zn(this,a)),4==e&&Kn(this),this.i&&!this.I&&(4==e?cr(this.l,this):(this.i=!1,Bn(this)))}else 400==s&&0<a.indexOf("Unknown SID")?(this.o=3,yn(12)):(this.o=0,yn(13)),Kn(this),qn(this)}}}catch(e){}},bt.hb=function(){if(this.g){var t=Ks(this.g),e=this.g.fa();this.C<e.length&&(Hn(this),Fn(this,t,e),this.i&&4!=t&&Bn(this))}},bt.cancel=function(){this.I=!0,Kn(this)},bt.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(gn(),yn(17)),Kn(this),this.o=2,qn(this)):jn(this,this.V-t)};var Gn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function $n(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof $n){this.h=void 0!==e?e:t.h,Jn(this,t.j),this.s=t.s,this.g=t.g,Yn(this,t.m),this.l=t.l,e=t.i;var n=new us;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Xn(this,n),this.o=t.o}else t&&(n=String(t).match(Gn))?(this.h=!!e,Jn(this,n[1]||"",!0),this.s=es(n[2]||""),this.g=es(n[3]||"",!0),Yn(this,n[4]),this.l=es(n[5]||"",!0),Xn(this,n[6]||"",!0),this.o=es(n[7]||"")):(this.h=!!e,this.i=new us(null,this.h))}function Qn(t){return new $n(t)}function Jn(t,e,n){t.j=n?es(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Yn(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 Xn(t,e,n){e instanceof us?(t.i=e,function(t,e){e&&!t.j&&(hs(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ls(this,e),fs(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=ns(e,as)),t.i=new us(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function ts(t){return Zn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function es(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ns(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,ss),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function ss(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}$n.prototype.toString=function(){var t=[],e=this.j;e&&t.push(ns(e,rs,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(ns(e,rs,!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(ns(n,"/"==n.charAt(0)?os:is,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",ns(n,cs)),t.join("")};var rs=/[#\/\?@]/g,is=/[#\?:]/g,os=/[#\?]/g,as=/[#\?@]/g,cs=/#/g;function us(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hs(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 s=t[n].indexOf("="),r=null;if(0<=s){var i=t[n].substring(0,s);r=t[n].substring(s+1)}else i=t[n];e(i,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function ls(t,e){hs(t),e=ps(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ds(t,e){return hs(t),e=ps(t,e),t.g.has(e)}function fs(t,e,n){ls(t,e),0<n.length&&(t.i=null,t.g.set(ps(t,e),jt(n)),t.h+=n.length)}function ps(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(bt=us.prototype).add=function(t,e){hs(this),this.i=null,t=ps(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},bt.forEach=function(t,e){hs(this),this.g.forEach((function(n,s){n.forEach((function(n){t.call(e,n,s,this)}),this)}),this)},bt.oa=function(){hs(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],s=0;s<e.length;s++)for(var r=t[s],i=0;i<r.length;i++)n.push(e[s]);return n},bt.W=function(t){hs(this);var e=[];if("string"==typeof t)ds(this,t)&&(e=e.concat(this.g.get(ps(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},bt.set=function(t,e){return hs(this),this.i=null,ds(this,t=ps(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},bt.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},bt.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 s=e[n],r=encodeURIComponent(String(s)),i=this.W(s);for(s=0;s<i.length;s++){var o=r;""!==i[s]&&(o+="="+encodeURIComponent(String(i[s]))),t.push(o)}}return this.i=t.join("&")};var gs=function(t,e){this.h=t,this.g=e};function ms(t){this.l=t||ys,kt.PerformanceNavigationTiming?t=0<(t=kt.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(kt.g&&kt.g.Ga&&kt.g.Ga()&&kt.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var ys=10;function vs(t){return!!t.h||!!t.g&&t.g.size>=t.j}function ws(t){return t.h?1:t.g?t.g.size:0}function _s(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Ts(t,e){t.g?t.g.add(e):t.h=e}function Is(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Es(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var s=t.i;try{for(var r=Et(t.g.values()),i=r.next();!i.done;i=r.next()){var o=i.value;s=s.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return s}return jt(t.i)}function Ss(){}function bs(){this.g=new Ss}function As(t,e,n){var s=n||"";try{Wn(t,(function(t,n){var r=t;Dt(t)&&(r=He(t)),e.push(s+n+"="+encodeURIComponent(r))}))}catch(t){throw e.push(s+"type="+encodeURIComponent("_badmap")),t}}function Cs(t,e,n,s,r){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,r(s)}catch(t){}}function ks(t){this.l=t.ac||null,this.j=t.jb||!1}function Ns(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Rs,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}ms.prototype.cancel=function(){var t,e;if(this.i=Es(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Et(this.g.values()),s=n.next();!s.done;s=n.next()){s.value.cancel()}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Ss.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Ss.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(ks,In),ks.prototype.g=function(){return new Ns(this.l,this.j)},ks.prototype.i=function(t){return function(){return t}}({}),Ft(Ns,Ve);var Rs=0;function Ds(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Os(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ls(t)}function Ls(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(bt=Ns.prototype).open=function(t,e){if(this.readyState!=Rs)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ls(this)},bt.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||kt).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},bt.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,Os(this)),this.readyState=Rs},bt.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,Ls(this)),this.g&&(this.readyState=3,Ls(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==kt.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Ds(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},bt.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?Os(this):Ls(this),3==this.readyState&&Ds(this)}},bt.Va=function(t){this.g&&(this.response=this.responseText=t,Os(this))},bt.Ua=function(t){this.g&&(this.response=t,Os(this))},bt.ga=function(){this.g&&Os(this)},bt.setRequestHeader=function(t,e){this.v.append(t,e)},bt.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},bt.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(Ns.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Ps=kt.JSON.parse;function Ms(t){Ve.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=xs,this.K=this.L=!1}Ft(Ms,Ve);var xs="",Us=/^https?$/i,Fs=["POST","PUT"];function Vs(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Bs(t),Hs(t)}function Bs(t){t.D||(t.D=!0,Be(t,"complete"),Be(t,"error"))}function js(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=Ks(t)||2!=t.aa()))if(t.v&&4==Ks(t))en(t.Ha,0,t);else if(Be(t,"readystatechange"),4==Ks(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 s=!0;break t;default:s=!1}if(!(e=s)){var r;if(r=0===n){var i=String(t.H).match(Gn)[1]||null;if(!i&&kt.self&&kt.self.location){var o=kt.self.location.protocol;i=o.substr(0,o.length-1)}r=!Us.test(i?i.toLowerCase():"")}e=r}if(e)Be(t,"complete"),Be(t,"success");else{t.m=6;try{var a=2<Ks(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Bs(t)}}finally{Hs(t)}}}function Hs(t,e){if(t.g){qs(t);var n=t.g,s=t.C[0]?Nt:null;t.g=null,t.C=null,e||Be(t,"ready");try{n.onreadystatechange=s}catch(t){}}}function qs(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function Ks(t){return t.g?t.g.readyState:0}function zs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Ws(t){var e="";return _e(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Gs(t,e,n){t:{for(s in n){var s=!1;break t}s=!0}s||(n=Ws(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function $s(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qs(t){this.Ca=0,this.i=[],this.j=new un,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=$s("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=$s("baseRetryDelayMs",5e3,t),this.bb=$s("retryDelaySeedMs",1e4,t),this.$a=$s("forwardChannelMaxRetries",2,t),this.ta=$s("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 ms(t&&t.concurrentRequestLimit),this.Fa=new bs,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 Js(t){if(Xs(t),3==t.G){var e=t.U++,n=Qn(t.F);Zn(n,"SID",t.I),Zn(n,"RID",e),Zn(n,"TYPE","terminate"),er(t,n),(e=new Rn(t,t.j,e,void 0)).K=2,e.v=ts(Qn(n)),n=!1,kt.navigator&&kt.navigator.sendBeacon&&(n=kt.navigator.sendBeacon(e.v.toString(),"")),!n&&kt.Image&&((new Image).src=e.v,n=!0),n||(e.g=fr(e.l,null),e.g.da(e.v)),e.F=Date.now(),Bn(e)}lr(t)}function Ys(t){t.g&&(ir(t),t.g.cancel(),t.g=null)}function Xs(t){Ys(t),t.u&&(kt.clearTimeout(t.u),t.u=null),ar(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zs(t){vs(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function tr(t,e){var n;n=e?e.m:t.U++;var s=Qn(t.F);Zn(s,"SID",t.I),Zn(s,"RID",n),Zn(s,"AID",t.T),er(t,s),t.o&&t.s&&Gs(s,t.o,t.s),n=new Rn(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=nr(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Ts(t.h,n),Mn(n,s,e)}function er(t,e){t.ia&&_e(t.ia,(function(t,n){Zn(e,n,t)})),t.l&&Wn({},(function(t,n){Zn(e,n,t)}))}function nr(t,e,n){n=Math.min(t.i.length,n);var s=t.l?xt(t.l.Ra,t.l,t):null;t:for(var r=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=r[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=r[c].h,h=r[c].g;if(0>(u-=i))i=Math.max(0,r[c].h-100),a=!1;else try{As(h,o,"req"+u+"_")}catch(t){s&&s(h)}}if(a){s=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,s}function sr(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function rr(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),ur(t,t.A)),t.A++,!0)}function ir(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function or(t){t.g=new Rn(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Qn(t.sa);Zn(e,"RID","rpc"),Zn(e,"SID",t.I),Zn(e,"CI",t.L?"0":"1"),Zn(e,"AID",t.T),Zn(e,"TYPE","xmlhttp"),er(t,e),t.o&&t.s&&Gs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=ts(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function ar(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cr(t,e){var n=null;if(t.g==e){ar(t),ir(t),t.g=null;var s=2}else{if(!_s(t.h,e))return;n=e.D,Is(t.h,e),s=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==s){n=e.s?e.s.length:0,e=Date.now()-e.F;var r=t.C;Be(s=fn(),new vn(s,n)),Zs(t)}else sr(t);else if(3==(r=e.o)||0==r&&0<t.pa||!(1==s&&function(t,e){return!(ws(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=wn(xt(t.Ja,t,e),ur(t,t.C)),t.C++,0)))}(t,e)||2==s&&rr(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),r){case 1:hr(t,5);break;case 4:hr(t,10);break;case 3:hr(t,6);break;default:hr(t,2)}}function ur(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hr(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var s=xt(t.kb,t);n||(n=new $n("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Jn(n,"https"),ts(n)),function(t,e){var n=new un;if(kt.Image){var s=new Image;s.onload=Ut(Cs,n,s,"TestLoadImage: loaded",!0,e),s.onerror=Ut(Cs,n,s,"TestLoadImage: error",!1,e),s.onabort=Ut(Cs,n,s,"TestLoadImage: abort",!1,e),s.ontimeout=Ut(Cs,n,s,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){s.ontimeout&&s.ontimeout()}),1e4),s.src=t}else e(!1)}(n.toString(),s)}else yn(2);t.G=0,t.l&&t.l.va(e),lr(t),Xs(t)}function lr(t){if(t.G=0,t.la=[],t.l){var e=Es(t.h);0==e.length&&0==t.i.length||(Ht(t.la,e),Ht(t.la,t.i),t.h.i.length=0,jt(t.i),t.i.length=0),t.l.ua()}}function dr(t,e,n){var s=n instanceof $n?Qn(n):new $n(n,void 0);if(""!=s.g)e&&(s.g=e+"."+s.g),Yn(s,s.m);else{var r=kt.location;s=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;var i=new $n(null,void 0);s&&Jn(i,s),e&&(i.g=e),r&&Yn(i,r),n&&(i.l=n),s=i}return n=t.D,e=t.za,n&&e&&Zn(s,n,e),Zn(s,"VER",t.ma),er(t,s),s}function fr(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 Ms(new ks({jb:!0})):new Ms(t.ra)).Ka(t.H),e}function pr(){}function gr(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function mr(t,e){Ve.call(this),this.g=new Qs(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!zt(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!zt(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new wr(this)}function yr(t){Cn.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function vr(){kn.call(this),this.status=1}function wr(t){this.g=t}(bt=Ms.prototype).Ka=function(t){this.L=t},bt.da=function(t,e,n,s){var r,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():bn.g(),this.C=this.u?En(this.u):En(bn),this.g.onreadystatechange=xt(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Vs(this,l)}if(t=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var c in s)n.set(c,s[c]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));try{for(var u=Et(s.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,s.get(l))}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}s=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=Bt(Fs,e))||s||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Et(n),f=d.next();!f.done;f=d.next()){var p=St(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{qs(this),0<this.B&&((this.K=function(t){return te&&le()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=xt(this.qa,this)):this.A=en(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Vs(this,l)}},bt.qa=function(){void 0!==Ct&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Be(this,"timeout"),this.abort(8))},bt.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Be(this,"complete"),Be(this,"abort"),Hs(this))},bt.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Hs(this,!0)),Ms.X.M.call(this)},bt.Ha=function(){this.s||(this.F||this.v||this.l?js(this):this.fb())},bt.fb=function(){js(this)},bt.aa=function(){try{return 2<Ks(this)?this.g.status:-1}catch(t){return-1}},bt.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},bt.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Ps(e)}},bt.Ea=function(){return this.m},bt.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(bt=Qs.prototype).ma=8,bt.G=1,bt.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 Rn(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Ee(n=Te(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var s=0,r=0;r<this.i.length;r++){var i=this.i[r];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(s+=i)){s=r;break t}if(4096===s||r===this.i.length-1){s=r+1;break t}}s=1e3}else s=1e3;s=nr(this,e,s),Zn(r=Qn(this.F),"RID",t),Zn(r,"CVER",22),this.D&&Zn(r,"X-HTTP-Session-Id",this.D),er(this,r),n&&(this.N?s="headers="+encodeURIComponent(String(Ws(n)))+"&"+s:this.o&&Gs(r,this.o,n)),Ts(this.h,e),this.Ya&&Zn(r,"TYPE","init"),this.O?(Zn(r,"$req",s),Zn(r,"SID","null"),e.Z=!0,Mn(e,r,null)):Mn(e,r,s),this.G=2}}else 3==this.G&&(t?tr(this,t):0==this.i.length||vs(this.h)||tr(this))},bt.Ia=function(){if(this.u=null,or(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=wn(xt(this.eb,this),t)}},bt.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,yn(10),Ys(this),or(this))},bt.cb=function(){null!=this.v&&(this.v=null,Ys(this),rr(this),yn(19))},bt.kb=function(t){t?(this.j.info("Successfully pinged google.com"),yn(2)):(this.j.info("Failed to ping google.com"),yn(1))},(bt=pr.prototype).xa=function(){},bt.wa=function(){},bt.va=function(){},bt.ua=function(){},bt.Ra=function(){},gr.prototype.g=function(t,e){return new mr(t,e)},Ft(mr,Ve),mr.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;yn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=dr(t,null,t.V),Zs(t)},mr.prototype.close=function(){Js(this.g)},mr.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=He(t),t=n);e.i.push(new gs(e.ab++,t)),3==e.G&&Zs(e)},mr.prototype.M=function(){this.g.l=null,delete this.j,Js(this.g),delete this.g,mr.X.M.call(this)},Ft(yr,Cn),Ft(vr,kn),Ft(wr,pr),wr.prototype.xa=function(){Be(this.g,"a")},wr.prototype.wa=function(t){Be(this.g,new yr(t))},wr.prototype.va=function(t){Be(this.g,new vr)},wr.prototype.ua=function(){Be(this.g,"b")},gr.prototype.createWebChannel=gr.prototype.g,mr.prototype.send=mr.prototype.u,mr.prototype.open=mr.prototype.m,mr.prototype.close=mr.prototype.close,_n.NO_ERROR=0,_n.TIMEOUT=8,_n.HTTP_ERROR=6,Tn.COMPLETE="complete",Sn.EventType=An,An.OPEN="a",An.CLOSE="b",An.ERROR="c",An.MESSAGE="d",Ve.prototype.listen=Ve.prototype.N,Ms.prototype.listenOnce=Ms.prototype.O,Ms.prototype.getLastError=Ms.prototype.Oa,Ms.prototype.getLastErrorCode=Ms.prototype.Ea,Ms.prototype.getStatus=Ms.prototype.aa,Ms.prototype.getResponseJson=Ms.prototype.Sa,Ms.prototype.getResponseText=Ms.prototype.fa,Ms.prototype.send=Ms.prototype.da,Ms.prototype.setWithCredentials=Ms.prototype.Ka;var _r=_n,Tr=Tn,Ir=ln,Er=10,Sr=11,br=ks,Ar=Sn,Cr=Ms;const kr="@firebase/firestore";
|
|
316
316
|
/**
|
|
317
317
|
* @license
|
|
318
318
|
* Copyright 2017 Google LLC
|
|
@@ -328,7 +328,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
328
328
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
329
329
|
* See the License for the specific language governing permissions and
|
|
330
330
|
* limitations under the License.
|
|
331
|
-
*/class
|
|
331
|
+
*/class Nr{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}}Nr.UNAUTHENTICATED=new Nr(null),Nr.GOOGLE_CREDENTIALS=new Nr("google-credentials-uid"),Nr.FIRST_PARTY=new Nr("first-party-uid"),Nr.MOCK_USER=new Nr("mock-user");
|
|
332
332
|
/**
|
|
333
333
|
* @license
|
|
334
334
|
* Copyright 2017 Google LLC
|
|
@@ -345,7 +345,7 @@ class at{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
|
-
let
|
|
348
|
+
let Rr="9.15.0";
|
|
349
349
|
/**
|
|
350
350
|
* @license
|
|
351
351
|
* Copyright 2017 Google LLC
|
|
@@ -361,7 +361,7 @@ let Rs="9.15.0";
|
|
|
361
361
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
362
362
|
* See the License for the specific language governing permissions and
|
|
363
363
|
* limitations under the License.
|
|
364
|
-
*/const
|
|
364
|
+
*/const Dr=new O("@firebase/firestore");function Or(){return Dr.logLevel}function Lr(t,...e){if(Dr.logLevel<=C.DEBUG){const n=e.map(xr);Dr.debug(`Firestore (${Rr}): ${t}`,...n)}}function Pr(t,...e){if(Dr.logLevel<=C.ERROR){const n=e.map(xr);Dr.error(`Firestore (${Rr}): ${t}`,...n)}}function Mr(t,...e){if(Dr.logLevel<=C.WARN){const n=e.map(xr);Dr.warn(`Firestore (${Rr}): ${t}`,...n)}}function xr(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
|
|
365
365
|
/**
|
|
366
366
|
* @license
|
|
367
367
|
* Copyright 2020 Google LLC
|
|
@@ -393,7 +393,7 @@ let Rs="9.15.0";
|
|
|
393
393
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
394
394
|
* See the License for the specific language governing permissions and
|
|
395
395
|
* limitations under the License.
|
|
396
|
-
*/function
|
|
396
|
+
*/function Ur(t="Unexpected state"){const e=`FIRESTORE (${Rr}) INTERNAL ASSERTION FAILED: `+t;throw Pr(e),new Error(e)}function Fr(t,e){t||Ur()}function Vr(t,e){return t}
|
|
397
397
|
/**
|
|
398
398
|
* @license
|
|
399
399
|
* Copyright 2017 Google LLC
|
|
@@ -409,7 +409,7 @@ let Rs="9.15.0";
|
|
|
409
409
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
410
410
|
* See the License for the specific language governing permissions and
|
|
411
411
|
* limitations under the License.
|
|
412
|
-
*/const
|
|
412
|
+
*/const Br={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 jr extends d{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
|
|
413
413
|
/**
|
|
414
414
|
* @license
|
|
415
415
|
* Copyright 2017 Google LLC
|
|
@@ -425,7 +425,7 @@ let Rs="9.15.0";
|
|
|
425
425
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
426
426
|
* See the License for the specific language governing permissions and
|
|
427
427
|
* limitations under the License.
|
|
428
|
-
*/class
|
|
428
|
+
*/class Hr{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
|
|
429
429
|
/**
|
|
430
430
|
* @license
|
|
431
431
|
* Copyright 2017 Google LLC
|
|
@@ -441,7 +441,7 @@ let Rs="9.15.0";
|
|
|
441
441
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
442
442
|
* See the License for the specific language governing permissions and
|
|
443
443
|
* limitations under the License.
|
|
444
|
-
*/class
|
|
444
|
+
*/class qr{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Kr{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Nr.UNAUTHENTICATED)))}shutdown(){}}class zr{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 Wr{constructor(t){this.t=t,this.currentUser=Nr.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const s=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let r=new Hr;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new Hr,t.enqueueRetryable((()=>s(this.currentUser)))};const i=()=>{const e=r;t.enqueueRetryable((async()=>{await e.promise,await s(this.currentUser)}))},o=t=>{Lr("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):(Lr("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Hr)}}),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?(Lr("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Fr("string"==typeof e.accessToken),new qr(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 Fr(null===t||"string"==typeof t),new Nr(t)}}class Gr{constructor(t,e,n,s){this.h=t,this.l=e,this.m=n,this.g=s,this.type="FirstParty",this.user=Nr.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Fr(!("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 $r{constructor(t,e,n,s){this.h=t,this.l=e,this.m=n,this.g=s}getToken(){return Promise.resolve(new Gr(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Nr.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Qr{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 Jr{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Lr("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,Lr("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const s=t=>{Lr("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>s(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?s(t):Lr("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Fr("string"==typeof t.token),this.A=t.token,new Qr(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
|
|
445
445
|
/**
|
|
446
446
|
* @license
|
|
447
447
|
* Copyright 2020 Google LLC
|
|
@@ -457,7 +457,7 @@ let Rs="9.15.0";
|
|
|
457
457
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
458
458
|
* See the License for the specific language governing permissions and
|
|
459
459
|
* limitations under the License.
|
|
460
|
-
*/function
|
|
460
|
+
*/function Yr(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
|
|
461
461
|
/**
|
|
462
462
|
* @license
|
|
463
463
|
* Copyright 2017 Google LLC
|
|
@@ -473,7 +473,7 @@ let Rs="9.15.0";
|
|
|
473
473
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
474
474
|
* See the License for the specific language governing permissions and
|
|
475
475
|
* limitations under the License.
|
|
476
|
-
*/class
|
|
476
|
+
*/class Xr{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length;let n="";for(;n.length<20;){const s=Yr(40);for(let r=0;r<s.length;++r)n.length<20&&s[r]<e&&(n+=t.charAt(s[r]%t.length))}return n}}function Zr(t,e){return t<e?-1:t>e?1:0}function ti(t,e,n){return t.length===e.length&&t.every(((t,s)=>n(t,e[s])))}
|
|
477
477
|
/**
|
|
478
478
|
* @license
|
|
479
479
|
* Copyright 2017 Google LLC
|
|
@@ -489,7 +489,7 @@ let Rs="9.15.0";
|
|
|
489
489
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
490
490
|
* See the License for the specific language governing permissions and
|
|
491
491
|
* limitations under the License.
|
|
492
|
-
*/class ei{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new
|
|
492
|
+
*/class ei{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new jr(Br.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new jr(Br.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new jr(Br.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new jr(Br.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return ei.fromMillis(Date.now())}static fromDate(t){return ei.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new ei(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Zr(this.nanoseconds,t.nanoseconds):Zr(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
|
|
493
493
|
/**
|
|
494
494
|
* @license
|
|
495
495
|
* Copyright 2017 Google LLC
|
|
@@ -521,7 +521,7 @@ let Rs="9.15.0";
|
|
|
521
521
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
522
522
|
* See the License for the specific language governing permissions and
|
|
523
523
|
* limitations under the License.
|
|
524
|
-
*/class
|
|
524
|
+
*/class si{constructor(t,e,n){void 0===e?e=0:e>t.length&&Ur(),void 0===n?n=t.length-e:n>t.length-e&&Ur(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===si.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof si?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 s=0;s<n;s++){const n=t.get(s),r=e.get(s);if(n<r)return-1;if(n>r)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class ri extends si{construct(t,e,n){return new ri(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 jr(Br.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new ri(e)}static emptyPath(){return new ri([])}}const ii=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class oi extends si{construct(t,e,n){return new oi(t,e,n)}static isValidIdentifier(t){return ii.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),oi.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new oi(["__name__"])}static fromServerFormat(t){const e=[];let n="",s=0;const r=()=>{if(0===n.length)throw new jr(Br.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(;s<t.length;){const e=t[s];if("\\"===e){if(s+1===t.length)throw new jr(Br.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[s+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new jr(Br.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,s+=2}else"`"===e?(i=!i,s++):"."!==e||i?(n+=e,s++):(r(),s++)}if(r(),i)throw new jr(Br.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new oi(e)}static emptyPath(){return new oi([])}}
|
|
525
525
|
/**
|
|
526
526
|
* @license
|
|
527
527
|
* Copyright 2017 Google LLC
|
|
@@ -537,7 +537,7 @@ let Rs="9.15.0";
|
|
|
537
537
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
538
538
|
* See the License for the specific language governing permissions and
|
|
539
539
|
* limitations under the License.
|
|
540
|
-
*/class ai{constructor(t){this.path=t}static fromPath(t){return new ai(
|
|
540
|
+
*/class ai{constructor(t){this.path=t}static fromPath(t){return new ai(ri.fromString(t))}static fromName(t){return new ai(ri.fromString(t).popFirst(5))}static empty(){return new ai(ri.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===ri.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return ri.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new ai(new ri(t.slice()))}}function ci(t){return new ui(t.readTime,t.key,-1)}class ui{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ui(ni.min(),ai.empty(),-1)}static max(){return new ui(ni.max(),ai.empty(),-1)}}function hi(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=ai.comparator(t.documentKey,e.documentKey),0!==n?n:Zr(t.largestBatchId,e.largestBatchId))}
|
|
541
541
|
/**
|
|
542
542
|
* @license
|
|
543
543
|
* Copyright 2020 Google LLC
|
|
@@ -569,7 +569,7 @@ let Rs="9.15.0";
|
|
|
569
569
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
570
570
|
* See the License for the specific language governing permissions and
|
|
571
571
|
* limitations under the License.
|
|
572
|
-
*/async function di(t){if(t.code!==
|
|
572
|
+
*/async function di(t){if(t.code!==Br.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==t.message)throw t;Lr("LocalStore","Unexpectedly lost primary lease")}
|
|
573
573
|
/**
|
|
574
574
|
* @license
|
|
575
575
|
* Copyright 2017 Google LLC
|
|
@@ -585,7 +585,7 @@ let Rs="9.15.0";
|
|
|
585
585
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
586
586
|
* See the License for the specific language governing permissions and
|
|
587
587
|
* limitations under the License.
|
|
588
|
-
*/class fi{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&&
|
|
588
|
+
*/class fi{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&&Ur(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new fi(((n,s)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,s)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,s)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof fi?e:fi.resolve(e)}catch(t){return fi.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):fi.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):fi.reject(e)}static resolve(t){return new fi(((e,n)=>{e(t)}))}static reject(t){return new fi(((e,n)=>{n(t)}))}static waitFor(t){return new fi(((e,n)=>{let s=0,r=0,i=!1;t.forEach((t=>{++s,t.next((()=>{++r,i&&r===s&&e()}),(t=>n(t)))})),i=!0,r===s&&e()}))}static or(t){let e=fi.resolve(!1);for(const n of t)e=e.next((t=>t?fi.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,s)=>{n.push(e.call(this,t,s))})),this.waitFor(n)}static mapArray(t,e){return new fi(((n,s)=>{const r=t.length,i=new Array(r);let o=0;for(let a=0;a<r;a++){const c=a;e(t[c]).next((t=>{i[c]=t,++o,o===r&&n(i)}),(t=>s(t)))}}))}static doWhile(t,e){return new fi(((n,s)=>{const r=()=>{!0===t()?e().next((()=>{r()}),s):n()};r()}))}}function pi(t){return"IndexedDbTransactionError"===t.name}
|
|
589
589
|
/**
|
|
590
590
|
* @license
|
|
591
591
|
* Copyright 2018 Google LLC
|
|
@@ -618,7 +618,7 @@ let Rs="9.15.0";
|
|
|
618
618
|
* See the License for the specific language governing permissions and
|
|
619
619
|
* limitations under the License.
|
|
620
620
|
*/
|
|
621
|
-
class mi{constructor(t,e,n,r,
|
|
621
|
+
class mi{constructor(t,e,n,s,r,i,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=s,this.ssl=r,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class yi{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new yi("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof yi&&t.projectId===this.projectId&&t.database===this.database}}
|
|
622
622
|
/**
|
|
623
623
|
* @license
|
|
624
624
|
* Copyright 2017 Google LLC
|
|
@@ -683,7 +683,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
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
|
-
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return
|
|
686
|
+
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Zr(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}Ei.EMPTY_BYTE_STRING=new Ei("");const Si=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function bi(t){if(Fr(!!t),"string"==typeof t){let e=0;const n=Si.exec(t);if(Fr(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const s=new Date(t);return{seconds:Math.floor(s.getTime()/1e3),nanos:e}}return{seconds:Ai(t.seconds),nanos:Ai(t.nanos)}}function Ai(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Ci(t){return"string"==typeof t?Ei.fromBase64String(t):Ei.fromUint8Array(t)}
|
|
687
687
|
/**
|
|
688
688
|
* @license
|
|
689
689
|
* Copyright 2020 Google LLC
|
|
@@ -731,7 +731,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
731
731
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
732
732
|
* See the License for the specific language governing permissions and
|
|
733
733
|
* limitations under the License.
|
|
734
|
-
*/(t)?9007199254740991:10:
|
|
734
|
+
*/(t)?9007199254740991:10:Ur()}function Li(t,e){if(t===e)return!0;const n=Oi(t);if(n!==Oi(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ri(t).isEqual(Ri(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=bi(t.timestampValue),s=bi(e.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Ci(t.bytesValue).isEqual(Ci(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ai(t.geoPointValue.latitude)===Ai(e.geoPointValue.latitude)&&Ai(t.geoPointValue.longitude)===Ai(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Ai(t.integerValue)===Ai(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Ai(t.doubleValue),s=Ai(e.doubleValue);return n===s?Ii(n)===Ii(s):isNaN(n)&&isNaN(s)}return!1}(t,e);case 9:return ti(t.arrayValue.values||[],e.arrayValue.values||[],Li);case 10:return function(t,e){const n=t.mapValue.fields||{},s=e.mapValue.fields||{};if(vi(n)!==vi(s))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===s[t]||!Li(n[t],s[t])))return!1;return!0}(t,e);default:return Ur()}}function Pi(t,e){return void 0!==(t.values||[]).find((t=>Li(t,e)))}function Mi(t,e){if(t===e)return 0;const n=Oi(t),s=Oi(e);if(n!==s)return Zr(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return Zr(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ai(t.integerValue||t.doubleValue),s=Ai(e.integerValue||e.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(t,e);case 3:return xi(t.timestampValue,e.timestampValue);case 4:return xi(Ri(t),Ri(e));case 5:return Zr(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Ci(t),s=Ci(e);return n.compareTo(s)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),s=e.split("/");for(let t=0;t<n.length&&t<s.length;t++){const e=Zr(n[t],s[t]);if(0!==e)return e}return Zr(n.length,s.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Zr(Ai(t.latitude),Ai(e.latitude));return 0!==n?n:Zr(Ai(t.longitude),Ai(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],s=e.values||[];for(let t=0;t<n.length&&t<s.length;++t){const e=Mi(n[t],s[t]);if(e)return e}return Zr(n.length,s.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Di&&e===Di)return 0;if(t===Di)return 1;if(e===Di)return-1;const n=t.fields||{},s=Object.keys(n),r=e.fields||{},i=Object.keys(r);s.sort(),i.sort();for(let t=0;t<s.length&&t<i.length;++t){const e=Zr(s[t],i[t]);if(0!==e)return e;const o=Mi(n[s[t]],r[i[t]]);if(0!==o)return o}return Zr(s.length,i.length)}(t.mapValue,e.mapValue);default:throw Ur()}}function xi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Zr(t,e);const n=bi(t),s=bi(e),r=Zr(n.seconds,s.seconds);return 0!==r?r:Zr(n.nanos,s.nanos)}function Ui(t){return Fi(t)}function Fi(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=bi(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Ci(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,ai.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const s of t.values||[])n?n=!1:e+=",",e+=Fi(s);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",s=!0;for(const r of e)s?s=!1:n+=",",n+=`${r}:${Fi(t.fields[r])}`;return n+"}"}(t.mapValue):Ur();var e,n}function Vi(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Bi(t){return!!t&&"integerValue"in t}function ji(t){return!!t&&"arrayValue"in t}function Hi(t){return!!t&&"nullValue"in t}function qi(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Ki(t){return!!t&&"mapValue"in t}function zi(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return wi(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=zi(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=zi(t.arrayValue.values[n]);return e}return Object.assign({},t)}class Wi{constructor(t,e){this.position=t,this.inclusive=e}}function Gi(t,e,n){let s=0;for(let r=0;r<t.position.length;r++){const i=e[r],o=t.position[r];if(s=i.field.isKeyField()?ai.comparator(ai.fromName(o.referenceValue),n.key):Mi(o,n.data.field(i.field)),"desc"===i.dir&&(s*=-1),0!==s)break}return s}function $i(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(!Li(t.position[n],e.position[n]))return!1;return!0}
|
|
735
735
|
/**
|
|
736
736
|
* @license
|
|
737
737
|
* Copyright 2022 Google LLC
|
|
@@ -747,7 +747,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
747
747
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
748
748
|
* See the License for the specific language governing permissions and
|
|
749
749
|
* limitations under the License.
|
|
750
|
-
*/class Qi{}class
|
|
750
|
+
*/class Qi{}class Ji extends Qi{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 so(t,e,n):"array-contains"===e?new ao(t,n):"in"===e?new co(t,n):"not-in"===e?new uo(t,n):"array-contains-any"===e?new ho(t,n):new Ji(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ro(t,n):new io(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Mi(e,this.value)):null!==e&&Oi(this.value)===Oi(e)&&this.matchesComparison(Mi(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 Ur()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Yi extends Qi{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Yi(t,e)}matches(t){return Xi(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 Xi(t){return"and"===t.op}function Zi(t){return function(t){for(const e of t.filters)if(e instanceof Yi)return!1;return!0}(t)&&Xi(t)}function to(t){if(t instanceof Ji)return t.field.canonicalString()+t.op.toString()+Ui(t.value);{const e=t.filters.map((t=>to(t))).join(",");return`${t.op}(${e})`}}function eo(t,e){return t instanceof Ji?function(t,e){return e instanceof Ji&&t.op===e.op&&t.field.isEqual(e.field)&&Li(t.value,e.value)}(t,e):t instanceof Yi?function(t,e){return e instanceof Yi&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,s)=>t&&eo(n,e.filters[s])),!0)}(t,e):void Ur()}function no(t){return t instanceof Ji?function(t){return`${t.field.canonicalString()} ${t.op} ${Ui(t.value)}`}(t):t instanceof Yi?function(t){return t.op.toString()+" {"+t.getFilters().map(no).join(" ,")+"}"}(t):"Filter"}class so extends Ji{constructor(t,e,n){super(t,e,n),this.key=ai.fromName(n.referenceValue)}matches(t){const e=ai.comparator(t.key,this.key);return this.matchesComparison(e)}}class ro extends Ji{constructor(t,e){super(t,"in",e),this.keys=oo("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class io extends Ji{constructor(t,e){super(t,"not-in",e),this.keys=oo("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function oo(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>ai.fromName(t.referenceValue)))}class ao extends Ji{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return ji(e)&&Pi(e.arrayValue,this.value)}}class co extends Ji{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Pi(this.value.arrayValue,e)}}class uo extends Ji{constructor(t,e){super(t,"not-in",e)}matches(t){if(Pi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Pi(this.value.arrayValue,e)}}class ho extends Ji{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!ji(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Pi(this.value.arrayValue,t)))}}
|
|
751
751
|
/**
|
|
752
752
|
* @license
|
|
753
753
|
* Copyright 2022 Google LLC
|
|
@@ -779,7 +779,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
779
779
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
780
780
|
* See the License for the specific language governing permissions and
|
|
781
781
|
* limitations under the License.
|
|
782
|
-
*/class po{constructor(t,e){this.comparator=t,this.root=e||mo.EMPTY}insert(t,e){return new po(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,mo.BLACK,null,null))}remove(t){return new po(this.comparator,this.root.remove(t,this.comparator).copy(null,null,mo.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
|
|
782
|
+
*/class po{constructor(t,e){this.comparator=t,this.root=e||mo.EMPTY}insert(t,e){return new po(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,mo.BLACK,null,null))}remove(t){return new po(this.comparator,this.root.remove(t,this.comparator).copy(null,null,mo.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 s=this.comparator(t,n.key);if(0===s)return e+n.left.size;s<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 go(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new go(this.root,t,this.comparator,!1)}getReverseIterator(){return new go(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new go(this.root,t,this.comparator,!0)}}class go{constructor(t,e,n,s){this.isReverse=s,this.nodeStack=[];let r=1;for(;!t.isEmpty();)if(r=e?n(t.key,e):1,e&&s&&(r*=-1),r<0)t=this.isReverse?t.left:t.right;else{if(0===r){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 mo{constructor(t,e,n,s,r){this.key=t,this.value=e,this.color=null!=n?n:mo.RED,this.left=null!=s?s:mo.EMPTY,this.right=null!=r?r:mo.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,s,r){return new mo(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=s?s:this.left,null!=r?r: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 s=this;const r=n(t,s.key);return s=r<0?s.copy(null,null,null,s.left.insert(t,e,n),null):0===r?s.copy(null,e,null,null,null):s.copy(null,null,null,null,s.right.insert(t,e,n)),s.fixUp()}removeMin(){if(this.left.isEmpty())return mo.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,s=this;if(e(t,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(t,e),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),0===e(t,s.key)){if(s.right.isEmpty())return mo.EMPTY;n=s.right.min(),s=s.copy(n.key,n.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(t,e))}return s.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,mo.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,mo.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 Ur();if(this.right.isRed())throw Ur();const t=this.left.check();if(t!==this.right.check())throw Ur();return t+(this.isRed()?0:1)}}mo.EMPTY=null,mo.RED=!0,mo.BLACK=!1,mo.EMPTY=new class{constructor(){this.size=0}get key(){throw Ur()}get value(){throw Ur()}get color(){throw Ur()}get left(){throw Ur()}get right(){throw Ur()}copy(t,e,n,s,r){return this}insert(t,e,n){return new mo(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
|
|
783
783
|
/**
|
|
784
784
|
* @license
|
|
785
785
|
* Copyright 2017 Google LLC
|
|
@@ -796,7 +796,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
796
796
|
* See the License for the specific language governing permissions and
|
|
797
797
|
* limitations under the License.
|
|
798
798
|
*/
|
|
799
|
-
class yo{constructor(t){this.comparator=t,this.data=new po(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
|
|
799
|
+
class yo{constructor(t){this.comparator=t,this.data=new po(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 s=n.getNext();if(this.comparator(s.key,t[1])>=0)return;e(s.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 vo(this.data.getIterator())}getIteratorFrom(t){return new vo(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 yo))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,s=n.getNext().key;if(0!==this.comparator(t,s))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 yo(this.comparator);return e.data=t,e}}class vo{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
|
|
800
800
|
/**
|
|
801
801
|
* @license
|
|
802
802
|
* Copyright 2020 Google LLC
|
|
@@ -828,7 +828,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
828
828
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
829
829
|
* See the License for the specific language governing permissions and
|
|
830
830
|
* limitations under the License.
|
|
831
|
-
*/class _o{constructor(t){this.value=t}static empty(){return new _o({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)],!Ki(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=zi(e)}setAll(t){let e=oi.emptyPath(),n={},
|
|
831
|
+
*/class _o{constructor(t){this.value=t}static empty(){return new _o({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)],!Ki(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=zi(e)}setAll(t){let e=oi.emptyPath(),n={},s=[];t.forEach(((t,r)=>{if(!e.isImmediateParentOf(r)){const t=this.getFieldsMap(e);this.applyChanges(t,n,s),n={},s=[],e=r.popLast()}t?n[r.lastSegment()]=zi(t):s.push(r.lastSegment())}));const r=this.getFieldsMap(e);this.applyChanges(r,n,s)}delete(t){const e=this.field(t.popLast());Ki(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Li(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 s=e.mapValue.fields[t.get(n)];Ki(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=s),e=s}return e.mapValue.fields}applyChanges(t,e,n){wi(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new _o(zi(this.value))}}
|
|
832
832
|
/**
|
|
833
833
|
* @license
|
|
834
834
|
* Copyright 2017 Google LLC
|
|
@@ -844,7 +844,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
844
844
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
845
845
|
* See the License for the specific language governing permissions and
|
|
846
846
|
* limitations under the License.
|
|
847
|
-
*/class To{constructor(t,e,n,r,
|
|
847
|
+
*/class To{constructor(t,e,n,s,r,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=s,this.createTime=r,this.data=i,this.documentState=o}static newInvalidDocument(t){return new To(t,0,ni.min(),ni.min(),ni.min(),_o.empty(),0)}static newFoundDocument(t,e,n,s){return new To(t,1,e,ni.min(),n,s,0)}static newNoDocument(t,e){return new To(t,2,e,ni.min(),ni.min(),_o.empty(),0)}static newUnknownDocument(t,e){return new To(t,3,e,ni.min(),ni.min(),_o.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(ni.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=_o.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=_o.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ni.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 To&&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 To(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
|
|
848
848
|
/**
|
|
849
849
|
* @license
|
|
850
850
|
* Copyright 2019 Google LLC
|
|
@@ -860,7 +860,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
860
860
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
861
861
|
* See the License for the specific language governing permissions and
|
|
862
862
|
* limitations under the License.
|
|
863
|
-
*/class Io{constructor(t,e=null,n=[],
|
|
863
|
+
*/class Io{constructor(t,e=null,n=[],s=[],r=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=s,this.limit=r,this.startAt=i,this.endAt=o,this.ft=null}}function Eo(t,e=null,n=[],s=[],r=null,i=null,o=null){return new Io(t,e,n,s,r,i,o)}function So(t){const e=Vr(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>to(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),Ti(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Ui(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Ui(t))).join(",")),e.ft=t}return e.ft}function bo(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(!fo(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(!eo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!$i(t.startAt,e.startAt)&&$i(t.endAt,e.endAt)}function Ao(t){return ai.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
|
|
864
864
|
/**
|
|
865
865
|
* @license
|
|
866
866
|
* Copyright 2017 Google LLC
|
|
@@ -876,7 +876,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
876
876
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
877
877
|
* See the License for the specific language governing permissions and
|
|
878
878
|
* limitations under the License.
|
|
879
|
-
*/class Co{constructor(t,e=null,n=[],
|
|
879
|
+
*/class Co{constructor(t,e=null,n=[],s=[],r=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=s,this.limit=r,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function ko(t){return new Co(t)}function No(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 Ro(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Do(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Oo(t){return null!==t.collectionGroup}function Lo(t){const e=Vr(t);if(null===e.dt){e.dt=[];const t=Do(e),n=Ro(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new lo(t)),e.dt.push(new lo(oi.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 lo(oi.keyField(),t))}}}return e.dt}function Po(t){const e=Vr(t);if(!e._t)if("F"===e.limitType)e._t=Eo(e.path,e.collectionGroup,Lo(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Lo(e)){const e="desc"===n.dir?"asc":"desc";t.push(new lo(n.field,e))}const n=e.endAt?new Wi(e.endAt.position,e.endAt.inclusive):null,s=e.startAt?new Wi(e.startAt.position,e.startAt.inclusive):null;e._t=Eo(e.path,e.collectionGroup,t,e.filters,e.limit,n,s)}return e._t}function Mo(t,e){e.getFirstInequalityField(),Do(t);const n=t.filters.concat([e]);return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function xo(t,e,n){return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Uo(t,e){return bo(Po(t),Po(e))&&t.limitType===e.limitType}function Fo(t){return`${So(Po(t))}|lt:${t.limitType}`}function Vo(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=>no(t))).join(", ")}]`),Ti(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=>Ui(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Ui(t))).join(",")),`Target(${e})`}(Po(t))}; limitType=${t.limitType})`}function Bo(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):ai.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Lo(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 s=Gi(t,e,n);return t.inclusive?s<=0:s<0}(t.startAt,Lo(t),e))&&!(t.endAt&&!function(t,e,n){const s=Gi(t,e,n);return t.inclusive?s>=0:s>0}(t.endAt,Lo(t),e))}(t,e)}function jo(t){return(e,n)=>{let s=!1;for(const r of Lo(t)){const t=Ho(r,e,n);if(0!==t)return t;s=s||r.field.isKeyField()}return 0}}function Ho(t,e,n){const s=t.field.isKeyField()?ai.comparator(e.key,n.key):function(t,e,n){const s=e.data.field(t),r=n.data.field(t);return null!==s&&null!==r?Mi(s,r):Ur()}(t.field,e,n);switch(t.dir){case"asc":return s;case"desc":return-1*s;default:return Ur()}}
|
|
880
880
|
/**
|
|
881
881
|
* @license
|
|
882
882
|
* Copyright 2020 Google LLC
|
|
@@ -908,7 +908,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
908
908
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
909
909
|
* See the License for the specific language governing permissions and
|
|
910
910
|
* limitations under the License.
|
|
911
|
-
*/class Wo{constructor(){this._=void 0}}function Go(t,e,n){return t instanceof Qo?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 Yo
|
|
911
|
+
*/class Wo{constructor(){this._=void 0}}function Go(t,e,n){return t instanceof Qo?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 Jo?Yo(t,e):t instanceof Xo?Zo(t,e):function(t,e){const n=function(t,e){return t instanceof ta?Bi(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),s=ea(n)+ea(t.gt);return Bi(n)&&Bi(t.gt)?Ko(s):qo(t.yt,s)}(t,e)}function $o(t,e,n){return t instanceof Jo?Yo(t,e):t instanceof Xo?Zo(t,e):n}class Qo extends Wo{}class Jo extends Wo{constructor(t){super(),this.elements=t}}function Yo(t,e){const n=na(e);for(const e of t.elements)n.some((t=>Li(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Xo extends Wo{constructor(t){super(),this.elements=t}}function Zo(t,e){let n=na(e);for(const e of t.elements)n=n.filter((t=>!Li(t,e)));return{arrayValue:{values:n}}}class ta extends Wo{constructor(t,e){super(),this.yt=t,this.gt=e}}function ea(t){return Ai(t.integerValue||t.doubleValue)}function na(t){return ji(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class sa{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new sa}static exists(t){return new sa(void 0,t)}static updateTime(t){return new sa(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 ra(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ia{}function oa(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new ga(t.key,sa.none()):new ha(t.key,t.data,sa.none());{const n=t.data,s=_o.empty();let r=new yo(oi.comparator);for(let t of e.fields)if(!r.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?s.delete(t):s.set(t,e),r=r.add(t)}return new la(t.key,s,new wo(r.toArray()),sa.none())}}function aa(t,e,n){t instanceof ha?function(t,e,n){const s=t.value.clone(),r=fa(t.fieldTransforms,e,n.transformResults);s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):t instanceof la?function(t,e,n){if(!ra(t.precondition,e))return void e.convertToUnknownDocument(n.version);const s=fa(t.fieldTransforms,e,n.transformResults),r=e.data;r.setAll(da(t)),r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ca(t,e,n,s){return t instanceof ha?function(t,e,n,s){if(!ra(t.precondition,e))return n;const r=t.value.clone(),i=pa(t.fieldTransforms,s,e);return r.setAll(i),e.convertToFoundDocument(e.version,r).setHasLocalMutations(),null}(t,e,n,s):t instanceof la?function(t,e,n,s){if(!ra(t.precondition,e))return n;const r=pa(t.fieldTransforms,s,e),i=e.data;return i.setAll(da(t)),i.setAll(r),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,s):function(t,e,n){return ra(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ua(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)&&ti(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Jo&&e instanceof Jo||t instanceof Xo&&e instanceof Xo?ti(t.elements,e.elements,Li):t instanceof ta&&e instanceof ta?Li(t.gt,e.gt):t instanceof Qo&&e instanceof Qo}(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 ha extends ia{constructor(t,e,n,s=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class la extends ia{constructor(t,e,n,s,r=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=s,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function da(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const s=t.data.field(n);e.set(n,s)}})),e}function fa(t,e,n){const s=new Map;Fr(t.length===n.length);for(let r=0;r<n.length;r++){const i=t[r],o=i.transform,a=e.data.field(i.field);s.set(i.field,$o(o,a,n[r]))}return s}function pa(t,e,n){const s=new Map;for(const r of t){const t=r.transform,i=n.data.field(r.field);s.set(r.field,Go(t,i,e))}return s}class ga extends ia{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
|
|
912
912
|
/**
|
|
913
913
|
* @license
|
|
914
914
|
* Copyright 2017 Google LLC
|
|
@@ -940,7 +940,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
940
940
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
941
941
|
* See the License for the specific language governing permissions and
|
|
942
942
|
* limitations under the License.
|
|
943
|
-
*/var ya,va;function wa(t){if(void 0===t)return
|
|
943
|
+
*/var ya,va;function wa(t){if(void 0===t)return Pr("GRPC error has no .code"),Br.UNKNOWN;switch(t){case ya.OK:return Br.OK;case ya.CANCELLED:return Br.CANCELLED;case ya.UNKNOWN:return Br.UNKNOWN;case ya.DEADLINE_EXCEEDED:return Br.DEADLINE_EXCEEDED;case ya.RESOURCE_EXHAUSTED:return Br.RESOURCE_EXHAUSTED;case ya.INTERNAL:return Br.INTERNAL;case ya.UNAVAILABLE:return Br.UNAVAILABLE;case ya.UNAUTHENTICATED:return Br.UNAUTHENTICATED;case ya.INVALID_ARGUMENT:return Br.INVALID_ARGUMENT;case ya.NOT_FOUND:return Br.NOT_FOUND;case ya.ALREADY_EXISTS:return Br.ALREADY_EXISTS;case ya.PERMISSION_DENIED:return Br.PERMISSION_DENIED;case ya.FAILED_PRECONDITION:return Br.FAILED_PRECONDITION;case ya.ABORTED:return Br.ABORTED;case ya.OUT_OF_RANGE:return Br.OUT_OF_RANGE;case ya.UNIMPLEMENTED:return Br.UNIMPLEMENTED;case ya.DATA_LOSS:return Br.DATA_LOSS;default:return Ur()}}(va=ya||(ya={}))[va.OK=0]="OK",va[va.CANCELLED=1]="CANCELLED",va[va.UNKNOWN=2]="UNKNOWN",va[va.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",va[va.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",va[va.NOT_FOUND=5]="NOT_FOUND",va[va.ALREADY_EXISTS=6]="ALREADY_EXISTS",va[va.PERMISSION_DENIED=7]="PERMISSION_DENIED",va[va.UNAUTHENTICATED=16]="UNAUTHENTICATED",va[va.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",va[va.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",va[va.ABORTED=10]="ABORTED",va[va.OUT_OF_RANGE=11]="OUT_OF_RANGE",va[va.UNIMPLEMENTED=12]="UNIMPLEMENTED",va[va.INTERNAL=13]="INTERNAL",va[va.UNAVAILABLE=14]="UNAVAILABLE",va[va.DATA_LOSS=15]="DATA_LOSS";
|
|
944
944
|
/**
|
|
945
945
|
* @license
|
|
946
946
|
* Copyright 2017 Google LLC
|
|
@@ -957,7 +957,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
957
957
|
* See the License for the specific language governing permissions and
|
|
958
958
|
* limitations under the License.
|
|
959
959
|
*/
|
|
960
|
-
class _a{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,
|
|
960
|
+
class _a{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,s]of n)if(this.equalsFn(e,t))return s}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),s=this.inner[n];if(void 0===s)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<s.length;n++)if(this.equalsFn(s[n][0],t))return void(s[n]=[t,e]);s.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let s=0;s<n.length;s++)if(this.equalsFn(n[s][0],t))return 1===n.length?delete this.inner[e]:n.splice(s,1),this.innerSize--,!0;return!1}forEach(t){wi(this.inner,((e,n)=>{for(const[e,s]of n)t(e,s)}))}isEmpty(){return _i(this.inner)}size(){return this.innerSize}}
|
|
961
961
|
/**
|
|
962
962
|
* @license
|
|
963
963
|
* Copyright 2017 Google LLC
|
|
@@ -973,7 +973,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
973
973
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
974
974
|
* See the License for the specific language governing permissions and
|
|
975
975
|
* limitations under the License.
|
|
976
|
-
*/const Ta=new po(ai.comparator);function Ia(){return Ta}const Ea=new po(ai.comparator);function Sa(...t){let e=Ea;for(const n of t)e=e.insert(n.key,n);return e}function ba(t){let e=Ea;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Aa(){return ka()}function Ca(){return ka()}function ka(){return new _a((t=>t.toString()),((t,e)=>t.isEqual(e)))}new po(ai.comparator);const Na=new yo(ai.comparator);function Ra(...t){let e=Na;for(const n of t)e=e.add(n);return e}const Da=new yo(
|
|
976
|
+
*/const Ta=new po(ai.comparator);function Ia(){return Ta}const Ea=new po(ai.comparator);function Sa(...t){let e=Ea;for(const n of t)e=e.insert(n.key,n);return e}function ba(t){let e=Ea;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Aa(){return ka()}function Ca(){return ka()}function ka(){return new _a((t=>t.toString()),((t,e)=>t.isEqual(e)))}new po(ai.comparator);const Na=new yo(ai.comparator);function Ra(...t){let e=Na;for(const n of t)e=e.add(n);return e}const Da=new yo(Zr);function Oa(){return Da}
|
|
977
977
|
/**
|
|
978
978
|
* @license
|
|
979
979
|
* Copyright 2017 Google LLC
|
|
@@ -989,7 +989,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
989
989
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
990
990
|
* See the License for the specific language governing permissions and
|
|
991
991
|
* limitations under the License.
|
|
992
|
-
*/class La{constructor(t,e,n,r
|
|
992
|
+
*/class La{constructor(t,e,n,s,r){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=s,this.resolvedLimboDocuments=r}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const s=new Map;return s.set(t,Pa.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new La(ni.min(),s,Oa(),Ia(),Ra())}}class Pa{constructor(t,e,n,s,r){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=s,this.removedDocuments=r}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Pa(n,e,Ra(),Ra(),Ra())}}
|
|
993
993
|
/**
|
|
994
994
|
* @license
|
|
995
995
|
* Copyright 2017 Google LLC
|
|
@@ -1005,7 +1005,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1005
1005
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1006
1006
|
* See the License for the specific language governing permissions and
|
|
1007
1007
|
* limitations under the License.
|
|
1008
|
-
*/class Ma{constructor(t,e,n,
|
|
1008
|
+
*/class Ma{constructor(t,e,n,s){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=s}}class xa{constructor(t,e){this.targetId=t,this.Et=e}}class Ua{constructor(t,e,n=Ei.EMPTY_BYTE_STRING,s=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=s}}class Fa{constructor(){this.At=0,this.Rt=ja(),this.bt=Ei.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=Ra(),e=Ra(),n=Ra();return this.Rt.forEach(((s,r)=>{switch(r){case 0:t=t.add(s);break;case 2:e=e.add(s);break;case 1:n=n.add(s);break;default:Ur()}})),new Pa(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=ja()}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 Va{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ia(),this.qt=Ba(),this.Ut=new yo(Zr)}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:Ur()}}))}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,s=this.Yt(e);if(s){const t=s.target;if(Ao(t))if(0===n){const n=new ai(t.path);this.Qt(e,n,To.newNoDocument(n,ni.min()))}else Fr(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,s)=>{const r=this.Yt(s);if(r){if(n.current&&Ao(r.target)){const e=new ai(r.target.path);null!==this.Lt.get(e)||this.te(s,e)||this.Qt(s,e,To.newNoDocument(e,t))}n.St&&(e.set(s,n.Ct()),n.xt())}}));let n=Ra();this.qt.forEach(((t,e)=>{let s=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(s=!1,!1)})),s&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const s=new La(t,e,this.Ut,this.Lt,n);return this.Lt=Ia(),this.qt=Ba(),this.Ut=new yo(Zr),s}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 s=this.Wt(t);this.te(t,e)?s.Nt(e,1):s.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 Fa,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new yo(Zr),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Lr("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 Fa),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Ba(){return new po(ai.comparator)}function ja(){return new po(ai.comparator)}
|
|
1009
1009
|
/**
|
|
1010
1010
|
* @license
|
|
1011
1011
|
* Copyright 2017 Google LLC
|
|
@@ -1021,7 +1021,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1021
1021
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1022
1022
|
* See the License for the specific language governing permissions and
|
|
1023
1023
|
* limitations under the License.
|
|
1024
|
-
*/const
|
|
1024
|
+
*/const Ha={asc:"ASCENDING",desc:"DESCENDING"},qa={"<":"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"},Ka={and:"AND",or:"OR"};class za{constructor(t,e){this.databaseId=t,this.wt=e}}function Wa(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 Ga(t,e){return t.wt?e.toBase64():e.toUint8Array()}function $a(t){return Fr(!!t),ni.fromTimestamp(function(t){const e=bi(t);return new ei(e.seconds,e.nanos)}(t))}function Qa(t,e){return function(t){return new ri(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Ja(t){const e=ri.fromString(t);return Fr(lc(e)),e}function Ya(t,e){const n=Ja(e);if(n.get(1)!==t.databaseId.projectId)throw new jr(Br.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 jr(Br.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ai(tc(n))}function Xa(t,e){return Qa(t.databaseId,e)}function Za(t){return new ri(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function tc(t){return Fr(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function ec(t,e){return{documents:[Xa(t,e.path)]}}function nc(t,e){const n={structuredQuery:{}},s=e.path;null!==e.collectionGroup?(n.parent=Xa(t,s),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xa(t,s.popLast()),n.structuredQuery.from=[{collectionId:s.lastSegment()}]);const r=function(t){if(0!==t.length)return hc(Yi.create(t,"and"))}(e.filters);r&&(n.structuredQuery.where=r);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:cc(t.field),direction:ic(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||Ti(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 sc(t){let e=function(t){const e=Ja(t);return 4===e.length?ri.emptyPath():tc(e)}(t.parent);const n=t.structuredQuery,s=n.from?n.from.length:0;let r=null;if(s>0){Fr(1===s);const t=n.from[0];t.allDescendants?r=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=rc(t);return e instanceof Yi&&Zi(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new lo(uc(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,Ti(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Wi(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new Wi(n,e)}(n.endAt)),function(t,e,n,s,r,i,o,a){return new Co(t,e,n,s,r,i,o,a)}(e,r,o,i,a,"F",c,u)}function rc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=uc(t.unaryFilter.field);return Ji.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=uc(t.unaryFilter.field);return Ji.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=uc(t.unaryFilter.field);return Ji.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=uc(t.unaryFilter.field);return Ji.create(r,"!=",{nullValue:"NULL_VALUE"});default:return Ur()}}(t):void 0!==t.fieldFilter?function(t){return Ji.create(uc(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 Ur()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Yi.create(t.compositeFilter.filters.map((t=>rc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Ur()}}(t.compositeFilter.op))}(t):Ur()}function ic(t){return Ha[t]}function oc(t){return qa[t]}function ac(t){return Ka[t]}function cc(t){return{fieldPath:t.canonicalString()}}function uc(t){return oi.fromServerFormat(t.fieldPath)}function hc(t){return t instanceof Ji?function(t){if("=="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NAN"}};if(Hi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NAN"}};if(Hi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:cc(t.field),op:oc(t.op),value:t.value}}}(t):t instanceof Yi?function(t){const e=t.getFilters().map((t=>hc(t)));return 1===e.length?e[0]:{compositeFilter:{op:ac(t.op),filters:e}}}(t):Ur()}function lc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
|
|
1025
1025
|
/**
|
|
1026
1026
|
* @license
|
|
1027
1027
|
* Copyright 2017 Google LLC
|
|
@@ -1037,7 +1037,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1037
1037
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1038
1038
|
* See the License for the specific language governing permissions and
|
|
1039
1039
|
* limitations under the License.
|
|
1040
|
-
*/class dc{constructor(t,e,n,
|
|
1040
|
+
*/class dc{constructor(t,e,n,s){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=s}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const s=this.mutations[e];s.key.isEqual(t.key)&&aa(s,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=ca(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=ca(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ca();return this.mutations.forEach((s=>{const r=t.get(s.key),i=r.overlayedDocument;let o=this.applyToLocalView(i,r.mutatedFields);o=e.has(s.key)?null:o;const a=oa(i,o);null!==a&&n.set(s.key,a),i.isValidDocument()||i.convertToNoDocument(ni.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Ra())}isEqual(t){return this.batchId===t.batchId&&ti(this.mutations,t.mutations,((t,e)=>ua(t,e)))&&ti(this.baseMutations,t.baseMutations,((t,e)=>ua(t,e)))}}
|
|
1041
1041
|
/**
|
|
1042
1042
|
* @license
|
|
1043
1043
|
* Copyright 2022 Google LLC
|
|
@@ -1069,7 +1069,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1069
1069
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1070
1070
|
* See the License for the specific language governing permissions and
|
|
1071
1071
|
* limitations under the License.
|
|
1072
|
-
*/class pc{constructor(t,e,n,r
|
|
1072
|
+
*/class pc{constructor(t,e,n,s,r=ni.min(),i=ni.min(),o=Ei.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=s,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o}withSequenceNumber(t){return new pc(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new pc(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new pc(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
|
|
1073
1073
|
/**
|
|
1074
1074
|
* @license
|
|
1075
1075
|
* Copyright 2017 Google LLC
|
|
@@ -1085,7 +1085,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1085
1085
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1086
1086
|
* See the License for the specific language governing permissions and
|
|
1087
1087
|
* limitations under the License.
|
|
1088
|
-
*/class gc{constructor(t){this.ie=t}}function mc(t){const e=
|
|
1088
|
+
*/class gc{constructor(t){this.ie=t}}function mc(t){const e=sc({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?xo(e,e.limit,"L"):e}
|
|
1089
1089
|
/**
|
|
1090
1090
|
* @license
|
|
1091
1091
|
* Copyright 2019 Google LLC
|
|
@@ -1101,7 +1101,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1101
1101
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1102
1102
|
* See the License for the specific language governing permissions and
|
|
1103
1103
|
* limitations under the License.
|
|
1104
|
-
*/class yc{constructor(){this.Je=new vc}addToCollectionParentIndex(t,e){return this.Je.add(e),fi.resolve()}getCollectionParents(t,e){return fi.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return fi.resolve()}deleteFieldIndex(t,e){return fi.resolve()}getDocumentsMatchingTarget(t,e){return fi.resolve(null)}getIndexType(t,e){return fi.resolve(0)}getFieldIndexes(t,e){return fi.resolve([])}getNextCollectionGroupToUpdate(t){return fi.resolve(null)}getMinOffset(t,e){return fi.resolve(ui.min())}getMinOffsetFromCollectionGroup(t,e){return fi.resolve(ui.min())}updateCollectionGroup(t,e,n){return fi.resolve()}updateIndexEntries(t,e){return fi.resolve()}}class vc{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),
|
|
1104
|
+
*/class yc{constructor(){this.Je=new vc}addToCollectionParentIndex(t,e){return this.Je.add(e),fi.resolve()}getCollectionParents(t,e){return fi.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return fi.resolve()}deleteFieldIndex(t,e){return fi.resolve()}getDocumentsMatchingTarget(t,e){return fi.resolve(null)}getIndexType(t,e){return fi.resolve(0)}getFieldIndexes(t,e){return fi.resolve([])}getNextCollectionGroupToUpdate(t){return fi.resolve(null)}getMinOffset(t,e){return fi.resolve(ui.min())}getMinOffsetFromCollectionGroup(t,e){return fi.resolve(ui.min())}updateCollectionGroup(t,e,n){return fi.resolve()}updateIndexEntries(t,e){return fi.resolve()}}class vc{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e]||new yo(ri.comparator),r=!s.has(n);return this.index[e]=s.add(n),r}has(t){const e=t.lastSegment(),n=t.popLast(),s=this.index[e];return s&&s.has(n)}getEntries(t){return(this.index[t]||new yo(ri.comparator)).toArray()}}
|
|
1105
1105
|
/**
|
|
1106
1106
|
* @license
|
|
1107
1107
|
* Copyright 2017 Google LLC
|
|
@@ -1181,7 +1181,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1181
1181
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1182
1182
|
* See the License for the specific language governing permissions and
|
|
1183
1183
|
* limitations under the License.
|
|
1184
|
-
*/class Ic{constructor(t,e,n,
|
|
1184
|
+
*/class Ic{constructor(t,e,n,s){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=s}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((s=>(n=s,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&ca(n.mutation,t,wo.empty(),ei.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Ra()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Ra()){const s=Aa();return this.populateOverlays(t,s,e).next((()=>this.computeViews(t,e,s,n).next((t=>{let e=Sa();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Aa();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Ra())))}populateOverlays(t,e,n){const s=[];return n.forEach((t=>{e.has(t)||s.push(t)})),this.documentOverlayCache.getOverlays(t,s).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,s){let r=Ia();const i=ka(),o=ka();return e.forEach(((t,e)=>{const o=n.get(e.key);s.has(e.key)&&(void 0===o||o.mutation instanceof la)?r=r.insert(e.key,e):void 0!==o&&(i.set(e.key,o.mutation.getFieldMask()),ca(o.mutation,e,o.mutation.getFieldMask(),ei.now()))})),this.recalculateAndSaveOverlays(t,r).next((t=>(t.forEach(((t,e)=>i.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Tc(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=ka();let s=new po(((t,e)=>t-e)),r=Ra();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const r of t)r.keys().forEach((t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||wo.empty();o=r.applyToLocalView(i,o),n.set(t,o);const a=(s.get(r.batchId)||Ra()).add(t);s=s.insert(r.batchId,a)}))})).next((()=>{const i=[],o=s.getReverseIterator();for(;o.hasNext();){const s=o.getNext(),a=s.key,c=s.value,u=Ca();c.forEach((t=>{if(!r.has(t)){const s=oa(e.get(t),n.get(t));null!==s&&u.set(t,s),r=r.add(t)}})),i.push(this.documentOverlayCache.saveOverlays(t,a,u))}return fi.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 ai.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Oo(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,s){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,s).next((r=>{const i=s-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,s-r.size):fi.resolve(Aa());let o=-1,a=r;return i.next((e=>fi.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(e)?fi.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,r))).next((()=>this.computeViews(t,a,e,Ra()))).next((t=>({batchId:o,changes:ba(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new ai(e)).next((t=>{let e=Sa();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const s=e.collectionGroup;let r=Sa();return this.indexManager.getCollectionParents(t,s).next((i=>fi.forEach(i,(i=>{const o=function(t,e){return new Co(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,i.child(s));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{r=r.insert(t,e)}))}))})).next((()=>r))))}getDocumentsMatchingCollectionQuery(t,e,n){let s;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((r=>(s=r,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===s.get(n)&&(s=s.insert(n,To.newInvalidDocument(n)))}));let n=Sa();return s.forEach(((s,r)=>{const i=t.get(s);void 0!==i&&ca(i.mutation,r,wo.empty(),ei.now()),Bo(e,r)&&(n=n.insert(s,r))})),n}))}}
|
|
1185
1185
|
/**
|
|
1186
1186
|
* @license
|
|
1187
1187
|
* Copyright 2020 Google LLC
|
|
@@ -1213,7 +1213,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1213
1213
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1214
1214
|
* See the License for the specific language governing permissions and
|
|
1215
1215
|
* limitations under the License.
|
|
1216
|
-
*/class Sc{constructor(){this.overlays=new po(ai.comparator),this.es=new Map}getOverlay(t,e){return fi.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Aa();return fi.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,
|
|
1216
|
+
*/class Sc{constructor(){this.overlays=new po(ai.comparator),this.es=new Map}getOverlay(t,e){return fi.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Aa();return fi.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,s)=>{this.oe(t,e,s)})),fi.resolve()}removeOverlaysForBatchId(t,e,n){const s=this.es.get(n);return void 0!==s&&(s.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),fi.resolve()}getOverlaysForCollection(t,e,n){const s=Aa(),r=e.length+1,i=new ai(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===r&&t.largestBatchId>n&&s.set(t.getKey(),t)}return fi.resolve(s)}getOverlaysForCollectionGroup(t,e,n,s){let r=new po(((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=r.get(t.largestBatchId);null===e&&(e=Aa(),r=r.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Aa(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=s)););return fi.resolve(o)}oe(t,e,n){const s=this.overlays.get(n.key);if(null!==s){const t=this.es.get(s.largestBatchId).delete(n.key);this.es.set(s.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new fc(e,n));let r=this.es.get(e);void 0===r&&(r=Ra(),this.es.set(e,r)),this.es.set(e,r.add(n.key))}}
|
|
1217
1217
|
/**
|
|
1218
1218
|
* @license
|
|
1219
1219
|
* Copyright 2017 Google LLC
|
|
@@ -1229,7 +1229,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1229
1229
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1230
1230
|
* See the License for the specific language governing permissions and
|
|
1231
1231
|
* limitations under the License.
|
|
1232
|
-
*/class bc{constructor(){this.ns=new yo(Ac.ss),this.rs=new yo(Ac.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Ac(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 Ac(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new ai(new
|
|
1232
|
+
*/class bc{constructor(){this.ns=new yo(Ac.ss),this.rs=new yo(Ac.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Ac(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 Ac(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new ai(new ri([])),n=new Ac(e,t),s=new Ac(e,t+1),r=[];return this.rs.forEachInRange([n,s],(t=>{this.cs(t),r.push(t.key)})),r}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 ai(new ri([])),n=new Ac(e,t),s=new Ac(e,t+1);let r=Ra();return this.rs.forEachInRange([n,s],(t=>{r=r.add(t.key)})),r}containsKey(t){const e=new Ac(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ac{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return ai.comparator(t.key,e.key)||Zr(t._s,e._s)}static os(t,e){return Zr(t._s,e._s)||ai.comparator(t.key,e.key)}}
|
|
1233
1233
|
/**
|
|
1234
1234
|
* @license
|
|
1235
1235
|
* Copyright 2017 Google LLC
|
|
@@ -1245,7 +1245,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1245
1245
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1246
1246
|
* See the License for the specific language governing permissions and
|
|
1247
1247
|
* limitations under the License.
|
|
1248
|
-
*/class Cc{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new yo(Ac.ss)}checkEmpty(t){return fi.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,
|
|
1248
|
+
*/class Cc{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new yo(Ac.ss)}checkEmpty(t){return fi.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,s){const r=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new dc(r,e,n,s);this.mutationQueue.push(i);for(const e of s)this.gs=this.gs.add(new Ac(e.key,r)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return fi.resolve(i)}lookupMutationBatch(t,e){return fi.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,s=this.ps(n),r=s<0?0:s;return fi.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return fi.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return fi.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ac(e,0),s=new Ac(e,Number.POSITIVE_INFINITY),r=[];return this.gs.forEachInRange([n,s],(t=>{const e=this.ys(t._s);r.push(e)})),fi.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new yo(Zr);return e.forEach((t=>{const e=new Ac(t,0),s=new Ac(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,s],(t=>{n=n.add(t._s)}))})),fi.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,s=n.length+1;let r=n;ai.isDocumentKey(r)||(r=r.child(""));const i=new Ac(new ai(r),0);let o=new yo(Zr);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===s&&(o=o.add(t._s)),!0)}),i),fi.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){Fr(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return fi.forEach(e.mutations,(s=>{const r=new Ac(s.key,e.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(t,s.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Ac(e,0),s=this.gs.firstAfterOrEqual(n);return fi.resolve(e.isEqual(s&&s.key))}performConsistencyCheck(t){return this.mutationQueue.length,fi.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
|
|
1249
1249
|
/**
|
|
1250
1250
|
* @license
|
|
1251
1251
|
* Copyright 2017 Google LLC
|
|
@@ -1261,7 +1261,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1261
1261
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1262
1262
|
* See the License for the specific language governing permissions and
|
|
1263
1263
|
* limitations under the License.
|
|
1264
|
-
*/class kc{constructor(t){this.Es=t,this.docs=new po(ai.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,
|
|
1264
|
+
*/class kc{constructor(t){this.Es=t,this.docs=new po(ai.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,s=this.docs.get(n),r=s?s.size:0,i=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-r,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 fi.resolve(n?n.document.mutableCopy():To.newInvalidDocument(e))}getEntries(t,e){let n=Ia();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():To.newInvalidDocument(t))})),fi.resolve(n)}getAllFromCollection(t,e,n){let s=Ia();const r=new ai(e.child("")),i=this.docs.getIteratorFrom(r);for(;i.hasNext();){const{key:t,value:{document:r}}=i.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||hi(ci(r),n)<=0||(s=s.insert(r.key,r.mutableCopy()))}return fi.resolve(s)}getAllFromCollectionGroup(t,e,n,s){Ur()}As(t,e){return fi.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Nc(this)}getSize(t){return fi.resolve(this.size)}}class Nc extends _c{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,s)=>{s.isValidDocument()?e.push(this.Yn.addEntry(t,s)):this.Yn.removeEntry(n)})),fi.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
|
|
1265
1265
|
/**
|
|
1266
1266
|
* @license
|
|
1267
1267
|
* Copyright 2017 Google LLC
|
|
@@ -1277,7 +1277,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1277
1277
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1278
1278
|
* See the License for the specific language governing permissions and
|
|
1279
1279
|
* limitations under the License.
|
|
1280
|
-
*/class Rc{constructor(t){this.persistence=t,this.Rs=new _a((t=>So(t)),bo),this.lastRemoteSnapshotVersion=ni.min(),this.highestTargetId=0,this.bs=0,this.Ps=new bc,this.targetCount=0,this.vs=wc.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),fi.resolve()}getLastRemoteSnapshotVersion(t){return fi.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return fi.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),fi.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),fi.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new wc(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,fi.resolve()}updateTargetData(t,e){return this.Dn(e),fi.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,fi.resolve()}removeTargets(t,e,n){let
|
|
1280
|
+
*/class Rc{constructor(t){this.persistence=t,this.Rs=new _a((t=>So(t)),bo),this.lastRemoteSnapshotVersion=ni.min(),this.highestTargetId=0,this.bs=0,this.Ps=new bc,this.targetCount=0,this.vs=wc.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),fi.resolve()}getLastRemoteSnapshotVersion(t){return fi.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return fi.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),fi.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),fi.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new wc(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,fi.resolve()}updateTargetData(t,e){return this.Dn(e),fi.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,fi.resolve()}removeTargets(t,e,n){let s=0;const r=[];return this.Rs.forEach(((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(i),r.push(this.removeMatchingKeysForTargetId(t,o.targetId)),s++)})),fi.waitFor(r).next((()=>s))}getTargetCount(t){return fi.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return fi.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),fi.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const s=this.persistence.referenceDelegate,r=[];return s&&e.forEach((e=>{r.push(s.markPotentiallyOrphaned(t,e))})),fi.waitFor(r)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),fi.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return fi.resolve(n)}containsKey(t,e){return fi.resolve(this.Ps.containsKey(e))}}
|
|
1281
1281
|
/**
|
|
1282
1282
|
* @license
|
|
1283
1283
|
* Copyright 2017 Google LLC
|
|
@@ -1293,7 +1293,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1293
1293
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1294
1294
|
* See the License for the specific language governing permissions and
|
|
1295
1295
|
* limitations under the License.
|
|
1296
|
-
*/class Dc{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new gi(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Rc(this),this.indexManager=new yc,this.remoteDocumentCache=function(t){return new kc(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new gc(e),this.Ns=new Ec(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 Sc,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Cc(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){
|
|
1296
|
+
*/class Dc{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new gi(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Rc(this),this.indexManager=new yc,this.remoteDocumentCache=function(t){return new kc(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new gc(e),this.Ns=new Ec(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 Sc,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Cc(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){Lr("MemoryPersistence","Starting transaction:",t);const s=new Oc(this.Ss.next());return this.referenceDelegate.ks(),n(s).next((t=>this.referenceDelegate.Os(s).next((()=>t)))).toPromise().then((t=>(s.raiseOnCommittedEvent(),t)))}Ms(t,e){return fi.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Oc extends li{constructor(t){super(),this.currentSequenceNumber=t}}class Lc{constructor(t){this.persistence=t,this.Fs=new bc,this.$s=null}static Bs(t){return new Lc(t)}get Ls(){if(this.$s)return this.$s;throw Ur()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),fi.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),fi.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),fi.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 fi.forEach(this.Ls,(n=>{const s=ai.fromPath(n);return this.qs(t,s).next((t=>{t||e.removeEntry(s,ni.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 fi.or([()=>fi.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
|
|
1297
1297
|
/**
|
|
1298
1298
|
* @license
|
|
1299
1299
|
* Copyright 2017 Google LLC
|
|
@@ -1309,7 +1309,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1309
1309
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1310
1310
|
* See the License for the specific language governing permissions and
|
|
1311
1311
|
* limitations under the License.
|
|
1312
|
-
*/class Pc{constructor(t,e,n,
|
|
1312
|
+
*/class Pc{constructor(t,e,n,s){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=s}static Ci(t,e){let n=Ra(),s=Ra();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:s=s.add(t.doc.key)}return new Pc(t,e.fromCache,n,s)}}
|
|
1313
1313
|
/**
|
|
1314
1314
|
* @license
|
|
1315
1315
|
* Copyright 2019 Google LLC
|
|
@@ -1325,7 +1325,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1325
1325
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1326
1326
|
* See the License for the specific language governing permissions and
|
|
1327
1327
|
* limitations under the License.
|
|
1328
|
-
*/class Mc{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,
|
|
1328
|
+
*/class Mc{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,s){return this.ki(t,e).next((r=>r||this.Oi(t,e,s,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(No(e))return fi.resolve(null);let n=Po(e);return this.indexManager.getIndexType(t,n).next((s=>0===s?null:(null!==e.limit&&1===s&&(e=xo(e,null,"F"),n=Po(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((s=>{const r=Ra(...s);return this.Ni.getDocuments(t,r).next((s=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Fi(e,s);return this.$i(e,i,r,n.readTime)?this.ki(t,xo(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,s){return No(e)||s.isEqual(ni.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((r=>{const i=this.Fi(e,r);return this.$i(e,i,n,s)?this.Mi(t,e):(Or()<=C.DEBUG&&Lr("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),Vo(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,s=t.toTimestamp().nanoseconds+1,r=ni.fromTimestamp(1e9===s?new ei(n+1,0):new ei(n,s));return new ui(r,ai.empty(),e)}(s,-1)))}))}Fi(t,e){let n=new yo(jo(t));return e.forEach(((e,s)=>{Bo(t,s)&&(n=n.add(s))})),n}$i(t,e,n,s){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const r="F"===t.limitType?e.last():e.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(s)>0)}Mi(t,e){return Or()<=C.DEBUG&&Lr("QueryEngine","Using full collection scan to execute query:",Vo(e)),this.Ni.getDocumentsMatchingQuery(t,e,ui.min())}Bi(t,e,n,s){return this.Ni.getDocumentsMatchingQuery(t,n,s).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
|
|
1329
1329
|
/**
|
|
1330
1330
|
* @license
|
|
1331
1331
|
* Copyright 2020 Google LLC
|
|
@@ -1341,7 +1341,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1341
1341
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1342
1342
|
* See the License for the specific language governing permissions and
|
|
1343
1343
|
* limitations under the License.
|
|
1344
|
-
*/class xc{constructor(t,e,n,
|
|
1344
|
+
*/class xc{constructor(t,e,n,s){this.persistence=t,this.Li=e,this.yt=s,this.qi=new po(Zr),this.Ui=new _a((t=>So(t)),bo),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Ic(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function Uc(t,e){const n=Vr(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let s;return n.mutationQueue.getAllMutationBatches(t).next((r=>(s=r,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const r=[],i=[];let o=Ra();for(const t of s){r.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:r,addedBatchIds:i})))}))}))}function Fc(t){const e=Vr(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Vc(t,e){const n=Vr(t),s=e.snapshotVersion;let r=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});r=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=r.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(Ei.EMPTY_BYTE_STRING,ni.min()).withLastLimboFreeSnapshotVersion(ni.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,s)),r=r.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ia(),c=Ra();if(e.documentUpdates.forEach((s=>{e.resolvedLimboDocuments.has(s)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,s))})),o.push(function(t,e,n){let s=Ra(),r=Ra();return n.forEach((t=>s=s.add(t))),e.getEntries(t,s).next((t=>{let s=Ia();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(r=r.add(n)),i.isNoDocument()&&i.version.isEqual(ni.min())?(e.removeEntry(n,i.readTime),s=s.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),s=s.insert(n,i)):Lr("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:s,zi:r}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!s.isEqual(ni.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,s)));o.push(e)}return fi.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=r,t)))}async function Bc(t,e,n){const s=Vr(t),r=s.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await s.persistence.runTransaction("Release target",i,(t=>s.persistence.referenceDelegate.removeTarget(t,r)))}catch(t){if(!pi(t))throw t;Lr("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}s.qi=s.qi.remove(e),s.Ui.delete(r.target)}function jc(t,e,n){const s=Vr(t);let r=ni.min(),i=Ra();return s.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const s=Vr(t),r=s.Ui.get(n);return void 0!==r?fi.resolve(s.qi.get(r)):s.Cs.getTargetData(e,n)}(s,t,Po(e)).next((e=>{if(e)return r=e.lastLimboFreeSnapshotVersion,s.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>s.Li.getDocumentsMatchingQuery(t,e,n?r:ni.min(),n?i:Ra()))).next((t=>(function(t,e,n){let s=t.Ki.get(e)||ni.min();n.forEach(((t,e)=>{e.readTime.compareTo(s)>0&&(s=e.readTime)})),t.Ki.set(e,s)}(s,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 Hc{constructor(){this.activeTargetIds=Oa()}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 qc{constructor(){this.Lr=new Hc,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 Hc,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
|
|
1345
1345
|
/**
|
|
1346
1346
|
* @license
|
|
1347
1347
|
* Copyright 2019 Google LLC
|
|
@@ -1373,7 +1373,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1373
1373
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1374
1374
|
* See the License for the specific language governing permissions and
|
|
1375
1375
|
* limitations under the License.
|
|
1376
|
-
*/class zc{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){
|
|
1376
|
+
*/class zc{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){Lr("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Lr("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.Wr)t(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
|
|
1377
1377
|
/**
|
|
1378
1378
|
* @license
|
|
1379
1379
|
* Copyright 2020 Google LLC
|
|
@@ -1421,7 +1421,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1421
1421
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1422
1422
|
* See the License for the specific language governing permissions and
|
|
1423
1423
|
* limitations under the License.
|
|
1424
|
-
*/class $c 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
|
|
1424
|
+
*/class $c 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,s,r){const i=this.ho(t,e);Lr("RestConnection","Sending: ",i,n);const o={};return this.lo(o,s,r),this.fo(t,i,o,n).then((t=>(Lr("RestConnection","Received: ",t),t)),(e=>{throw Mr("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,s,r,i){return this.ao(t,e,n,s,r)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Rr,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=Wc[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,s){return new Promise(((r,i)=>{const o=new Cr;o.setWithCredentials(!0),o.listenOnce(Tr.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case _r.NO_ERROR:const e=o.getResponseJson();Lr("Connection","XHR received:",JSON.stringify(e)),r(e);break;case _r.TIMEOUT:Lr("Connection",'RPC "'+t+'" timed out'),i(new jr(Br.DEADLINE_EXCEEDED,"Request time out"));break;case _r.HTTP_ERROR:const n=o.getStatus();if(Lr("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(Br).indexOf(e)>=0?e:Br.UNKNOWN}(e.status);i(new jr(t,e.message))}else i(new jr(Br.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new jr(Br.UNAVAILABLE,"Connection failed."));break;default:Ur()}}finally{Lr("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(s);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const s=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new gr,i=fn(),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 br({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=s.join("");Lr("Connection","Creating WebChannel: "+a,o);const c=r.createWebChannel(a,o);let u=!1,h=!1;const l=new Gc({Hr:t=>{h?Lr("Connection","Not sending because WebChannel is closed:",t):(u||(Lr("Connection","Opening WebChannel transport."),c.open(),u=!0),Lr("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,Ar.EventType.OPEN,(()=>{h||Lr("Connection","WebChannel transport opened.")})),d(c,Ar.EventType.CLOSE,(()=>{h||(h=!0,Lr("Connection","WebChannel transport closed"),l.io())})),d(c,Ar.EventType.ERROR,(t=>{h||(h=!0,Mr("Connection","WebChannel transport errored:",t),l.io(new jr(Br.UNAVAILABLE,"The operation could not be completed")))})),d(c,Ar.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Fr(!!n);const s=n,r=s.error||(null===(e=s[0])||void 0===e?void 0:e.error);if(r){Lr("Connection","WebChannel received error:",r);const t=r.status;let e=function(t){const e=ya[t];if(void 0!==e)return wa(e)}(t),n=r.message;void 0===e&&(e=Br.INTERNAL,n="Unknown error status: "+t+" with message "+r.message),h=!0,l.io(new jr(e,n)),c.close()}else Lr("Connection","WebChannel received:",n),l.ro(n)}})),d(i,Ir.STAT_EVENT,(t=>{t.stat===Er?Lr("Connection","Detected buffering proxy"):t.stat===Sr&&Lr("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Qc(){return"undefined"!=typeof document?document:null}
|
|
1425
1425
|
/**
|
|
1426
1426
|
* @license
|
|
1427
1427
|
* Copyright 2020 Google LLC
|
|
@@ -1437,7 +1437,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1437
1437
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1438
1438
|
* See the License for the specific language governing permissions and
|
|
1439
1439
|
* limitations under the License.
|
|
1440
|
-
*/function
|
|
1440
|
+
*/function Jc(t){return new za(t,!0)}class Yc{constructor(t,e,n=1e3,s=1.5,r=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=s,this.po=r,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),s=Math.max(0,e-n);s>0&&Lr("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,s,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
|
|
1441
1441
|
/**
|
|
1442
1442
|
* @license
|
|
1443
1443
|
* Copyright 2017 Google LLC
|
|
@@ -1453,7 +1453,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1453
1453
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1454
1454
|
* See the License for the specific language governing permissions and
|
|
1455
1455
|
* limitations under the License.
|
|
1456
|
-
*/class Xc{constructor(t,e,n,r,
|
|
1456
|
+
*/class Xc{constructor(t,e,n,s,r,i,o,a){this.Hs=t,this.vo=n,this.Vo=s,this.connection=r,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 Yc(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===Br.RESOURCE_EXHAUSTED?(Pr(e.toString()),Pr("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Br.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 jr(Br.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 Lr("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Lr("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Zc extends Xc{constructor(t,e,n,s,r,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,s,i),this.yt=r}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 s=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Ur()}(e.targetChange.targetChangeType||"NO_CHANGE"),r=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Fr(void 0===e||"string"==typeof e),Ei.fromBase64String(e||"")):(Fr(void 0===e||e instanceof Uint8Array),Ei.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Br.UNKNOWN:wa(t.code);return new jr(e,t.message||"")}(o);n=new Ua(s,r,i,a||null)}else if("documentChange"in e){e.documentChange;const s=e.documentChange;s.document,s.document.name,s.document.updateTime;const r=Ya(t,s.document.name),i=$a(s.document.updateTime),o=s.document.createTime?$a(s.document.createTime):ni.min(),a=new _o({mapValue:{fields:s.document.fields}}),c=To.newFoundDocument(r,i,o,a),u=s.targetIds||[],h=s.removedTargetIds||[];n=new Ma(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const s=e.documentDelete;s.document;const r=Ya(t,s.document),i=s.readTime?$a(s.readTime):ni.min(),o=To.newNoDocument(r,i),a=s.removedTargetIds||[];n=new Ma([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const s=e.documentRemove;s.document;const r=Ya(t,s.document),i=s.removedTargetIds||[];n=new Ma([],i,r,null)}else{if(!("filter"in e))return Ur();{e.filter;const t=e.filter;t.targetId;const s=t.count||0,r=new ma(s),i=t.targetId;n=new xa(i,r)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return ni.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?ni.min():e.readTime?$a(e.readTime):ni.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Za(this.yt),e.addTarget=function(t,e){let n;const s=e.target;return n=Ao(s)?{documents:ec(t,s)}:{query:nc(t,s)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Ga(t,e.resumeToken):e.snapshotVersion.compareTo(ni.min())>0&&(n.readTime=Wa(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 Ur()}}(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=Za(this.yt),e.removeTarget=t,this.Bo(e)}}
|
|
1457
1457
|
/**
|
|
1458
1458
|
* @license
|
|
1459
1459
|
* Copyright 2017 Google LLC
|
|
@@ -1469,7 +1469,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1469
1469
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1470
1470
|
* See the License for the specific language governing permissions and
|
|
1471
1471
|
* limitations under the License.
|
|
1472
|
-
*/class tu extends class{}{constructor(t,e,n,
|
|
1472
|
+
*/class tu extends class{}{constructor(t,e,n,s){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=s,this.nu=!1}su(){if(this.nu)throw new jr(Br.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,r])=>this.connection.ao(t,e,n,s,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Br.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new jr(Br.UNKNOWN,t.toString())}))}_o(t,e,n,s){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,i])=>this.connection._o(t,e,n,r,i,s))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Br.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new jr(Br.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class eu{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?(Pr(e),this.ou=!1):Lr("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
|
|
1473
1473
|
/**
|
|
1474
1474
|
* @license
|
|
1475
1475
|
* Copyright 2017 Google LLC
|
|
@@ -1485,7 +1485,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1485
1485
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1486
1486
|
* See the License for the specific language governing permissions and
|
|
1487
1487
|
* limitations under the License.
|
|
1488
|
-
*/class nu{constructor(t,e,n,r
|
|
1488
|
+
*/class nu{constructor(t,e,n,s,r){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=r,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{lu(this)&&(Lr("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Vr(t);e._u.add(4),await ru(e),e.gu.set("Unknown"),e._u.delete(4),await su(e)}(this))}))})),this.gu=new eu(n,s)}}async function su(t){if(lu(t))for(const e of t.wu)await e(!0)}async function ru(t){for(const e of t.wu)await e(!1)}function iu(t,e){const n=Vr(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),hu(n)?uu(n):vu(n).ko()&&au(n,e))}function ou(t,e){const n=Vr(t),s=vu(n);n.du.delete(e),s.ko()&&cu(n,e),0===n.du.size&&(s.ko()?s.Fo():lu(n)&&n.gu.set("Unknown"))}function au(t,e){t.yu.Ot(e.targetId),vu(t).zo(e)}function cu(t,e){t.yu.Ot(e),vu(t).Ho(e)}function uu(t){t.yu=new Va({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),vu(t).start(),t.gu.uu()}function hu(t){return lu(t)&&!vu(t).No()&&t.du.size>0}function lu(t){return 0===Vr(t)._u.size}function du(t){t.yu=void 0}async function fu(t){t.du.forEach(((e,n)=>{au(t,e)}))}async function pu(t,e){du(t),hu(t)?(t.gu.hu(e),uu(t)):t.gu.set("Unknown")}async function gu(t,e,n){if(t.gu.set("Online"),e instanceof Ua&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const s of e.targetIds)t.du.has(s)&&(await t.remoteSyncer.rejectListen(s,n),t.du.delete(s),t.yu.removeTarget(s))}(t,e)}catch(n){Lr("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await mu(t,n)}else if(e instanceof Ma?t.yu.Kt(e):e instanceof xa?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(ni.min()))try{const e=await Fc(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,s)=>{if(n.resumeToken.approximateByteSize()>0){const r=t.du.get(s);r&&t.du.set(s,r.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(Ei.EMPTY_BYTE_STRING,n.snapshotVersion)),cu(t,e);const s=new pc(n.target,e,1,n.sequenceNumber);au(t,s)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Lr("RemoteStore","Failed to raise snapshot:",e),await mu(t,e)}}async function mu(t,e,n){if(!pi(e))throw e;t._u.add(1),await ru(t),t.gu.set("Offline"),n||(n=()=>Fc(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Lr("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await su(t)}))}async function yu(t,e){const n=Vr(t);n.asyncQueue.verifyOperationInProgress(),Lr("RemoteStore","RemoteStore received new credentials");const s=lu(n);n._u.add(3),await ru(n),s&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await su(n)}function vu(t){return t.pu||(t.pu=function(t,e,n){const s=Vr(t);return s.su(),new Zc(e,s.connection,s.authCredentials,s.appCheckCredentials,s.yt,n)
|
|
1489
1489
|
/**
|
|
1490
1490
|
* @license
|
|
1491
1491
|
* Copyright 2018 Google LLC
|
|
@@ -1517,7 +1517,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1517
1517
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1518
1518
|
* See the License for the specific language governing permissions and
|
|
1519
1519
|
* limitations under the License.
|
|
1520
|
-
*/}class wu{constructor(t,e,n,r
|
|
1520
|
+
*/}class wu{constructor(t,e,n,s,r){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=s,this.removalCallback=r,this.deferred=new Hr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,s,r){const i=Date.now()+n,o=new wu(t,e,i,s,r);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 jr(Br.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 _u(t,e){if(Pr("AsyncQueue",`${e}: ${t}`),pi(t))return new jr(Br.UNAVAILABLE,`${e}: ${t}`);throw t}
|
|
1521
1521
|
/**
|
|
1522
1522
|
* @license
|
|
1523
1523
|
* Copyright 2017 Google LLC
|
|
@@ -1533,7 +1533,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1533
1533
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1534
1534
|
* See the License for the specific language governing permissions and
|
|
1535
1535
|
* limitations under the License.
|
|
1536
|
-
*/class Tu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||ai.comparator(e.key,n.key):(t,e)=>ai.comparator(t.key,e.key),this.keyedMap=Sa(),this.sortedSet=new po(this.comparator)}static emptySet(t){return new Tu(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 Tu))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,
|
|
1536
|
+
*/class Tu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||ai.comparator(e.key,n.key):(t,e)=>ai.comparator(t.key,e.key),this.keyedMap=Sa(),this.sortedSet=new po(this.comparator)}static emptySet(t){return new Tu(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 Tu))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,s=n.getNext().key;if(!t.isEqual(s))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 Tu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
|
|
1537
1537
|
/**
|
|
1538
1538
|
* @license
|
|
1539
1539
|
* Copyright 2017 Google LLC
|
|
@@ -1549,7 +1549,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1549
1549
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1550
1550
|
* See the License for the specific language governing permissions and
|
|
1551
1551
|
* limitations under the License.
|
|
1552
|
-
*/class Iu{constructor(){this.Tu=new po(ai.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}):
|
|
1552
|
+
*/class Iu{constructor(){this.Tu=new po(ai.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}):Ur():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Eu{constructor(t,e,n,s,r,i,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=s,this.mutatedKeys=r,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,s,r){const i=[];return e.forEach((t=>{i.push({type:0,doc:t})})),new Eu(t,e,Tu.emptySet(e),i,n,s,!0,!1,r)}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)&&Uo(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}
|
|
1553
1553
|
/**
|
|
1554
1554
|
* @license
|
|
1555
1555
|
* Copyright 2017 Google LLC
|
|
@@ -1565,7 +1565,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1565
1565
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1566
1566
|
* See the License for the specific language governing permissions and
|
|
1567
1567
|
* limitations under the License.
|
|
1568
|
-
*/class Su{constructor(){this.Au=void 0,this.listeners=[]}}class bu{constructor(){this.queries=new _a((t=>Fo(t)),Uo),this.onlineState="Unknown",this.Ru=new Set}}async function Au(t,e){const n=
|
|
1568
|
+
*/class Su{constructor(){this.Au=void 0,this.listeners=[]}}class bu{constructor(){this.queries=new _a((t=>Fo(t)),Uo),this.onlineState="Unknown",this.Ru=new Set}}async function Au(t,e){const n=Vr(t),s=e.query;let r=!1,i=n.queries.get(s);if(i||(r=!0,i=new Su),r)try{i.Au=await n.onListen(s)}catch(t){const n=_u(t,`Initialization of query '${Vo(e.query)}' failed`);return void e.onError(n)}n.queries.set(s,i),i.listeners.push(e),e.bu(n.onlineState),i.Au&&e.Pu(i.Au)&&Ru(n)}async function Cu(t,e){const n=Vr(t),s=e.query;let r=!1;const i=n.queries.get(s);if(i){const t=i.listeners.indexOf(e);t>=0&&(i.listeners.splice(t,1),r=0===i.listeners.length)}if(r)return n.queries.delete(s),n.onUnlisten(s)}function ku(t,e){const n=Vr(t);let s=!1;for(const t of e){const e=t.query,r=n.queries.get(e);if(r){for(const e of r.listeners)e.Pu(t)&&(s=!0);r.Au=t}}s&&Ru(n)}function Nu(t,e,n){const s=Vr(t),r=s.queries.get(e);if(r)for(const t of r.listeners)t.onError(n);s.queries.delete(e)}function Ru(t){t.Ru.forEach((t=>{t.next()}))}class Du{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 Eu(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=Eu.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
|
|
1569
1569
|
/**
|
|
1570
1570
|
* @license
|
|
1571
1571
|
* Copyright 2017 Google LLC
|
|
@@ -1581,7 +1581,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1581
1581
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1582
1582
|
* See the License for the specific language governing permissions and
|
|
1583
1583
|
* limitations under the License.
|
|
1584
|
-
*/class Ou{constructor(t){this.key=t}}class Lu{constructor(t){this.key=t}}class Pu{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Ra(),this.mutatedKeys=Ra(),this.Gu=
|
|
1584
|
+
*/class Ou{constructor(t){this.key=t}}class Lu{constructor(t){this.key=t}}class Pu{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Ra(),this.mutatedKeys=Ra(),this.Gu=jo(t),this.Qu=new Tu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Iu,s=e?e.Qu:this.Qu;let r=e?e.mutatedKeys:this.mutatedKeys,i=s,o=!1;const a="F"===this.query.limitType&&s.size===this.query.limit?s.last():null,c="L"===this.query.limitType&&s.size===this.query.limit?s.first():null;if(t.inorderTraversal(((t,e)=>{const u=s.get(t),h=Bo(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),r=d?r.add(t):r.delete(t)):(i=i.delete(t),r=r.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),r=r.delete(t.key),n.track({type:1,doc:t})}return{Qu:i,zu:n,$i:o,mutatedKeys:r}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const s=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const r=t.zu.Eu();r.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 Ur()}};return n(t)-n(e)}
|
|
1585
1585
|
/**
|
|
1586
1586
|
* @license
|
|
1587
1587
|
* Copyright 2020 Google LLC
|
|
@@ -1597,7 +1597,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1597
1597
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1598
1598
|
* See the License for the specific language governing permissions and
|
|
1599
1599
|
* limitations under the License.
|
|
1600
|
-
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==
|
|
1600
|
+
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==r.length||a?{snapshot:new Eu(this.query,t.Qu,s,r,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Iu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Ra(),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 Lu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Ou(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Ra();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Eu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Mu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class xu{constructor(t){this.key=t,this.nc=!1}}class Uu{constructor(t,e,n,s,r,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=s,this.currentUser=r,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new _a((t=>Fo(t)),Uo),this.rc=new Map,this.oc=new Set,this.uc=new po(ai.comparator),this.cc=new Map,this.ac=new bc,this.hc={},this.lc=new Map,this.fc=wc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function Fu(t,e){const n=function(t){const e=Vr(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ju.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Hu.bind(null,e),e.sc.Wo=ku.bind(null,e.eventManager),e.sc.wc=Nu.bind(null,e.eventManager),e}(t);let s,r;const i=n.ic.get(e);if(i)s=i.targetId,n.sharedClientState.addLocalQueryTarget(s),r=i.view.ec();else{const t=await function(t,e){const n=Vr(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let s;return n.Cs.getTargetData(t,e).next((r=>r?(s=r,fi.resolve(s)):n.Cs.allocateTargetId(t).next((r=>(s=new pc(e,r,0,t.currentSequenceNumber),n.Cs.addTargetData(t,s).next((()=>s)))))))})).then((t=>{const s=n.qi.get(t.targetId);return(null===s||t.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Po(e));n.isPrimaryClient&&iu(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);s=t.targetId,r=await async function(t,e,n,s,r){t._c=(e,n,s)=>async function(t,e,n,s){let r=e.view.Wu(n);r.$i&&(r=await jc(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,r))));const i=s&&s.targetChanges.get(e.targetId),o=e.view.applyChanges(r,t.isPrimaryClient,i);return zu(t,e.targetId,o.Xu),o.snapshot}(t,e,n,s);const i=await jc(t.localStore,e,!0),o=new Pu(e,i.Hi),a=o.Wu(i.documents),c=Pa.createSynthesizedTargetChangeForCurrentChange(n,s&&"Offline"!==t.onlineState,r),u=o.applyChanges(a,t.isPrimaryClient,c);zu(t,n,u.Xu);const h=new Mu(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,s,"current"===i,t.resumeToken)}return r}async function Vu(t,e){const n=Vr(t),s=n.ic.get(e),r=n.rc.get(s.targetId);if(r.length>1)return n.rc.set(s.targetId,r.filter((t=>!Uo(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await Bc(n.localStore,s.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(s.targetId),ou(n.remoteStore,s.targetId),qu(n,s.targetId)})).catch(di)):(qu(n,s.targetId),await Bc(n.localStore,s.targetId,!0))}async function Bu(t,e){const n=Vr(t);try{const t=await Vc(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const s=n.cc.get(e);s&&(Fr(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?s.nc=!0:t.modifiedDocuments.size>0?Fr(s.nc):t.removedDocuments.size>0&&(Fr(s.nc),s.nc=!1))})),await $u(n,t,e)}catch(t){await di(t)}}function ju(t,e,n){const s=Vr(t);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const t=[];s.ic.forEach(((n,s)=>{const r=s.view.bu(e);r.snapshot&&t.push(r.snapshot)})),function(t,e){const n=Vr(t);n.onlineState=e;let s=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(s=!0)})),s&&Ru(n)}(s.eventManager,e),t.length&&s.sc.Wo(t),s.onlineState=e,s.isPrimaryClient&&s.sharedClientState.setOnlineState(e)}}async function Hu(t,e,n){const s=Vr(t);s.sharedClientState.updateQueryState(e,"rejected",n);const r=s.cc.get(e),i=r&&r.key;if(i){let t=new po(ai.comparator);t=t.insert(i,To.newNoDocument(i,ni.min()));const n=Ra().add(i),r=new La(ni.min(),new Map,new yo(Zr),t,n);await Bu(s,r),s.uc=s.uc.remove(i),s.cc.delete(e),Gu(s)}else await Bc(s.localStore,e,!1).then((()=>qu(s,e,n))).catch(di)}function qu(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const s of t.rc.get(e))t.ic.delete(s),n&&t.sc.wc(s,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||Ku(t,e)}))}function Ku(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ou(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),Gu(t))}function zu(t,e,n){for(const s of n)s instanceof Ou?(t.ac.addReference(s.key,e),Wu(t,s)):s instanceof Lu?(Lr("SyncEngine","Document no longer in limbo: "+s.key),t.ac.removeReference(s.key,e),t.ac.containsKey(s.key)||Ku(t,s.key)):Ur()}function Wu(t,e){const n=e.key,s=n.path.canonicalString();t.uc.get(n)||t.oc.has(s)||(Lr("SyncEngine","New document in limbo: "+n),t.oc.add(s),Gu(t))}function Gu(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 ai(ri.fromString(e)),s=t.fc.next();t.cc.set(s,new xu(n)),t.uc=t.uc.insert(n,s),iu(t.remoteStore,new pc(Po(ko(n.path)),s,2,gi.at))}}async function $u(t,e,n){const s=Vr(t),r=[],i=[],o=[];s.ic.isEmpty()||(s.ic.forEach(((t,a)=>{o.push(s._c(a,e,n).then((t=>{if((t||n)&&s.isPrimaryClient&&s.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){r.push(t);const e=Pc.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),s.sc.Wo(r),await async function(t,e){const n=Vr(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>fi.forEach(e,(e=>fi.forEach(e.Si,(s=>n.persistence.referenceDelegate.addReference(t,e.targetId,s))).next((()=>fi.forEach(e.Di,(s=>n.persistence.referenceDelegate.removeReference(t,e.targetId,s)))))))))}catch(t){if(!pi(t))throw t;Lr("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),s=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(s);n.qi=n.qi.insert(e,r)}}}(s.localStore,i))}async function Qu(t,e){const n=Vr(t);if(!n.currentUser.isEqual(e)){Lr("SyncEngine","User change. New user:",e.toKey());const t=await Uc(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new jr(Br.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await $u(n,t.ji)}}function Ju(t,e){const n=Vr(t),s=n.cc.get(e);if(s&&s.nc)return Ra().add(s.key);{let t=Ra();const s=n.rc.get(e);if(!s)return t;for(const e of s){const s=n.ic.get(e);t=t.unionWith(s.view.ju)}return t}}class Yu{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=Jc(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,s){return new xc(t,e,n,s)}(this.persistence,new Mc,t.initialUser,this.yt)}yc(t){return new Dc(Lc.Bs,this.yt)}gc(t){return new qc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Xu{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=>ju(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Qu.bind(null,this.syncEngine),await async function(t,e){const n=Vr(t);e?(n._u.delete(2),await su(n)):e||(n._u.add(2),await ru(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new bu}createDatastore(t){const e=Jc(t.databaseInfo.databaseId),n=(s=t.databaseInfo,new $c(s));var s;return function(t,e,n,s){return new tu(t,e,n,s)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,s=t.asyncQueue,r=t=>ju(this.syncEngine,t,0),i=zc.C()?new zc:new Kc,new nu(e,n,s,r,i);var e,n,s,r,i}createSyncEngine(t,e){return function(t,e,n,s,r,i,o){const a=new Uu(t,e,n,s,r,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=Vr(t);Lr("RemoteStore","RemoteStore shutting down."),e._u.add(5),await ru(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1601
1601
|
/**
|
|
1602
1602
|
* @license
|
|
1603
1603
|
* Copyright 2017 Google LLC
|
|
@@ -1613,7 +1613,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1613
1613
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1614
1614
|
* See the License for the specific language governing permissions and
|
|
1615
1615
|
* limitations under the License.
|
|
1616
|
-
*/function Zu(t,e,n){if(!n)throw new
|
|
1616
|
+
*/function Zu(t,e,n){if(!n)throw new jr(Br.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function th(t){if(!ai.isDocumentKey(t))throw new jr(Br.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function eh(t){if(ai.isDocumentKey(t))throw new jr(Br.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function nh(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":Ur()}function sh(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new jr(Br.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=nh(t);throw new jr(Br.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
|
|
1617
1617
|
/**
|
|
1618
1618
|
* @license
|
|
1619
1619
|
* Copyright 2020 Google LLC
|
|
@@ -1629,7 +1629,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1629
1629
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1630
1630
|
* See the License for the specific language governing permissions and
|
|
1631
1631
|
* limitations under the License.
|
|
1632
|
-
*/const
|
|
1632
|
+
*/const rh=new Map;class ih{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new jr(Br.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 jr(Br.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,s){if(!0===e&&!0===s)throw new jr(Br.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}
|
|
1633
1633
|
/**
|
|
1634
1634
|
* @license
|
|
1635
1635
|
* Copyright 2020 Google LLC
|
|
@@ -1645,7 +1645,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1645
1645
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1646
1646
|
* See the License for the specific language governing permissions and
|
|
1647
1647
|
* limitations under the License.
|
|
1648
|
-
*/class oh{constructor(t,e,n,
|
|
1648
|
+
*/class oh{constructor(t,e,n,s){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new ih({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new jr(Br.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 jr(Br.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 ih(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Kr;switch(t.type){case"gapi":const e=t.client;return new $r(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new jr(Br.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=rh.get(t);e&&(Lr("ComponentProvider","Removing Datastore"),rh.delete(t),e.terminate())}(this),Promise.resolve()}}function ah(t,e,n,s={}){var i;const o=(t=sh(t,oh))._getSettings();if("firestore.googleapis.com"!==o.host&&o.host!==e&&Mr("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},o),{host:`${e}:${n}`,ssl:!1})),s.mockUserToken){let e,n;if("string"==typeof s.mockUserToken)e=s.mockUserToken,n=Nr.MOCK_USER;else{e=function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",s=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[r(JSON.stringify({alg:"none",type:"JWT"})),r(JSON.stringify(o)),""].join(".")}
|
|
1649
1649
|
/**
|
|
1650
1650
|
* @license
|
|
1651
1651
|
* Copyright 2017 Google LLC
|
|
@@ -1661,7 +1661,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1661
1661
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1662
1662
|
* See the License for the specific language governing permissions and
|
|
1663
1663
|
* limitations under the License.
|
|
1664
|
-
*/(
|
|
1664
|
+
*/(s.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const o=s.mockUserToken.sub||s.mockUserToken.user_id;if(!o)throw new jr(Br.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Nr(o)}t._authCredentials=new zr(new qr(e,n))}}
|
|
1665
1665
|
/**
|
|
1666
1666
|
* @license
|
|
1667
1667
|
* Copyright 2020 Google LLC
|
|
@@ -1677,7 +1677,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1677
1677
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1678
1678
|
* See the License for the specific language governing permissions and
|
|
1679
1679
|
* limitations under the License.
|
|
1680
|
-
*/class ch{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 hh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ch(this.firestore,t,this._key)}}class uh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new uh(this.firestore,t,this._query)}}class hh extends uh{constructor(t,e,n){super(t,e,ko(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 ch(this.firestore,null,new ai(t))}withConverter(t){return new hh(this.firestore,t,this._path)}}function lh(t,e,...n){if(t=I(t),Zu("collection","path",e),t instanceof oh){const
|
|
1680
|
+
*/class ch{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 hh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ch(this.firestore,t,this._key)}}class uh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new uh(this.firestore,t,this._query)}}class hh extends uh{constructor(t,e,n){super(t,e,ko(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 ch(this.firestore,null,new ai(t))}withConverter(t){return new hh(this.firestore,t,this._path)}}function lh(t,e,...n){if(t=I(t),Zu("collection","path",e),t instanceof oh){const s=ri.fromString(e,...n);return eh(s),new hh(t,null,s)}{if(!(t instanceof ch||t instanceof hh))throw new jr(Br.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(ri.fromString(e,...n));return eh(s),new hh(t.firestore,null,s)}}function dh(t,e,...n){if(t=I(t),1===arguments.length&&(e=Xr.R()),Zu("doc","path",e),t instanceof oh){const s=ri.fromString(e,...n);return th(s),new ch(t,null,new ai(s))}{if(!(t instanceof ch||t instanceof hh))throw new jr(Br.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(ri.fromString(e,...n));return th(s),new ch(t.firestore,t instanceof hh?t.converter:null,new ai(s))}}
|
|
1681
1681
|
/**
|
|
1682
1682
|
* @license
|
|
1683
1683
|
* Copyright 2020 Google LLC
|
|
@@ -1709,7 +1709,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1709
1709
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1710
1710
|
* See the License for the specific language governing permissions and
|
|
1711
1711
|
* limitations under the License.
|
|
1712
|
-
*/class fh{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):
|
|
1712
|
+
*/class fh{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):Pr("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
|
|
1713
1713
|
/**
|
|
1714
1714
|
* @license
|
|
1715
1715
|
* Copyright 2017 Google LLC
|
|
@@ -1725,7 +1725,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1725
1725
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1726
1726
|
* See the License for the specific language governing permissions and
|
|
1727
1727
|
* limitations under the License.
|
|
1728
|
-
*/class ph{constructor(t,e,n,
|
|
1728
|
+
*/class ph{constructor(t,e,n,s){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=s,this.user=Nr.UNAUTHENTICATED,this.clientId=Xr.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Lr("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Lr("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 jr(Br.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Hr;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=_u(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function gh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Lr("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Lr("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let s=n.initialUser;t.setCredentialChangeListener((async t=>{s.isEqual(t)||(await Uc(e.localStore,t),s=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Yu)),t.offlineComponents}(t);Lr("FirestoreClient","Initializing OnlineComponentProvider");const s=await t.getConfiguration();await e.initialize(n,s),t.setCredentialChangeListener((t=>yu(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>yu(e.remoteStore,n))),t.onlineComponents=e}async function mh(t){const e=await async function(t){return t.onlineComponents||(Lr("FirestoreClient","Using default OnlineComponentProvider"),await gh(t,new Xu)),t.onlineComponents}(t),n=e.eventManager;return n.onListen=Fu.bind(null,e.syncEngine),n.onUnlisten=Vu.bind(null,e.syncEngine),n}class yh{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 Yc(this,"async_queue_retry"),this.Wc=()=>{const t=Qc();t&&Lr("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=Qc();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=Qc();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new Hr;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(!pi(t))throw t;Lr("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}
|
|
1729
1729
|
/**
|
|
1730
1730
|
* @license
|
|
1731
1731
|
* Copyright 2017 Google LLC
|
|
@@ -1741,7 +1741,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1741
1741
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1742
1742
|
* See the License for the specific language governing permissions and
|
|
1743
1743
|
* limitations under the License.
|
|
1744
|
-
*/(t);throw
|
|
1744
|
+
*/(t);throw Pr("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 s=wu.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(s),s}zc(){this.Kc&&Ur()}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 vh(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}
|
|
1745
1745
|
/**
|
|
1746
1746
|
* @license
|
|
1747
1747
|
* Copyright 2020 Google LLC
|
|
@@ -1757,7 +1757,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1757
1757
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1758
1758
|
* See the License for the specific language governing permissions and
|
|
1759
1759
|
* limitations under the License.
|
|
1760
|
-
*/(t)}class wh extends oh{constructor(t,e,n,
|
|
1760
|
+
*/(t)}class wh extends oh{constructor(t,e,n,s){super(t,e,n,s),this.type="firestore",this._queue=new yh,this._persistenceKey=(null==s?void 0:s.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Ih(this),this._firestoreClient.terminate()}}function _h(t,e){const n="string"==typeof t?t:e||"(default)",s=it("object"==typeof t?t:ht(),"firestore").getImmediate({identifier:n});if(!s._initialized){const t=(t=>{const e=u(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 s=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),s]:[e.substring(0,n),s]})("firestore");t&&ah(s,...t)}return s}function Th(t){return t._firestoreClient||Ih(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Ih(t){var e;const n=t._freezeSettings(),s=function(t,e,n,s){return new mi(t,e,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,s.useFetchStreams)}
|
|
1761
1761
|
/**
|
|
1762
1762
|
* @license
|
|
1763
1763
|
* Copyright 2020 Google LLC
|
|
@@ -1773,7 +1773,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1773
1773
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1774
1774
|
* See the License for the specific language governing permissions and
|
|
1775
1775
|
* limitations under the License.
|
|
1776
|
-
*/(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new ph(t._authCredentials,t._appCheckCredentials,t._queue,
|
|
1776
|
+
*/(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new ph(t._authCredentials,t._appCheckCredentials,t._queue,s)}
|
|
1777
1777
|
/**
|
|
1778
1778
|
* @license
|
|
1779
1779
|
* Copyright 2020 Google LLC
|
|
@@ -1805,7 +1805,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1805
1805
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1806
1806
|
* See the License for the specific language governing permissions and
|
|
1807
1807
|
* limitations under the License.
|
|
1808
|
-
*/class Eh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Eh(Ei.fromBase64String(t))}catch(t){throw new
|
|
1808
|
+
*/class Eh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Eh(Ei.fromBase64String(t))}catch(t){throw new jr(Br.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Eh(Ei.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)}}
|
|
1809
1809
|
/**
|
|
1810
1810
|
* @license
|
|
1811
1811
|
* Copyright 2020 Google LLC
|
|
@@ -1821,7 +1821,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1821
1821
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1822
1822
|
* See the License for the specific language governing permissions and
|
|
1823
1823
|
* limitations under the License.
|
|
1824
|
-
*/class Sh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new
|
|
1824
|
+
*/class Sh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new jr(Br.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new oi(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
|
|
1825
1825
|
/**
|
|
1826
1826
|
* @license
|
|
1827
1827
|
* Copyright 2020 Google LLC
|
|
@@ -1854,7 +1854,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1854
1854
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1855
1855
|
* See the License for the specific language governing permissions and
|
|
1856
1856
|
* limitations under the License.
|
|
1857
|
-
*/class Ah{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new
|
|
1857
|
+
*/class Ah{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new jr(Br.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new jr(Br.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 Zr(this._lat,t._lat)||Zr(this._long,t._long)}}
|
|
1858
1858
|
/**
|
|
1859
1859
|
* @license
|
|
1860
1860
|
* Copyright 2017 Google LLC
|
|
@@ -1870,7 +1870,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1870
1870
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1871
1871
|
* See the License for the specific language governing permissions and
|
|
1872
1872
|
* limitations under the License.
|
|
1873
|
-
*/const Ch=/^__.*__$/;function kh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw
|
|
1873
|
+
*/const Ch=/^__.*__$/;function kh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ur()}}class Nh{constructor(t,e,n,s,r,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=s,void 0===r&&this.na(),this.fieldTransforms=r||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new Nh(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),s=this.ia({path:n,oa:!1});return s.ua(t),s}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),s=this.ia({path:n,oa:!1});return s.na(),s}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return Ph(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(kh(this.sa)&&Ch.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class Rh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||Jc(t)}da(t,e,n,s=!1){return new Nh({sa:t,methodName:e,fa:n,path:oi.emptyPath(),oa:!1,la:s},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Dh(t,e){if(Oh(t=I(t)))return function(t,e,n){if(!Oh(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const s=nh(n);throw"an object"===s?e.ha(t+" a custom object"):e.ha(t+" "+s)}}("Unsupported field value:",e,t),function(t,e){const n={};return _i(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):wi(t,((t,s)=>{const r=Dh(s,e.ra(t));null!=r&&(n[t]=r)})),{mapValue:{fields:n}}}(t,e);if(t instanceof bh)return function(t,e){if(!kh(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 s=0;for(const r of t){let t=Dh(r,e.aa(s));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),s++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=I(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return zo(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=ei.fromDate(t);return{timestampValue:Wa(e.yt,n)}}if(t instanceof ei){const n=new ei(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Wa(e.yt,n)}}if(t instanceof Ah)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Eh)return{bytesValue:Ga(e.yt,t._byteString)};if(t instanceof ch){const n=e.databaseId,s=t.firestore._databaseId;if(!s.isEqual(n))throw e.ha(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Qa(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${nh(t)}`)}(t,e)}function Oh(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof ei||t instanceof Ah||t instanceof Eh||t instanceof ch||t instanceof bh)}const Lh=new RegExp("[~\\*/\\[\\]]");function Ph(t,e,n,s,r){const i=s&&!s.isEmpty(),o=void 0!==r;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${s}`),o&&(c+=` in document ${r}`),c+=")"),new jr(Br.INVALID_ARGUMENT,a+t+c)
|
|
1874
1874
|
/**
|
|
1875
1875
|
* @license
|
|
1876
1876
|
* Copyright 2020 Google LLC
|
|
@@ -1886,7 +1886,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1886
1886
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1887
1887
|
* See the License for the specific language governing permissions and
|
|
1888
1888
|
* limitations under the License.
|
|
1889
|
-
*/}class Mh{constructor(t,e,n,r
|
|
1889
|
+
*/}class Mh{constructor(t,e,n,s,r){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=s,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new ch(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new xh(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(Uh("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class xh extends Mh{data(){return super.data()}}function Uh(t,e){return"string"==typeof e?function(t,e,n){if(e.search(Lh)>=0)throw Ph(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Sh(...e.split("."))._internalPath}catch(s){throw Ph(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}(t,e):e instanceof Sh?e._internalPath:e._delegate._internalPath}
|
|
1890
1890
|
/**
|
|
1891
1891
|
* @license
|
|
1892
1892
|
* Copyright 2020 Google LLC
|
|
@@ -1902,7 +1902,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1902
1902
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1903
1903
|
* See the License for the specific language governing permissions and
|
|
1904
1904
|
* limitations under the License.
|
|
1905
|
-
*/function Fh(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new
|
|
1905
|
+
*/function Fh(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new jr(Br.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Vh{}class Bh extends Vh{}function jh(t,e,...n){let s=[];e instanceof Vh&&s.push(e),s=s.concat(n),function(t){const e=t.filter((t=>t instanceof Kh)).length,n=t.filter((t=>t instanceof Hh)).length;if(e>1||e>0&&n>0)throw new jr(Br.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(...)))`.")}
|
|
1906
1906
|
/**
|
|
1907
1907
|
* @license
|
|
1908
1908
|
* Copyright 2020 Google LLC
|
|
@@ -1918,7 +1918,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1918
1918
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1919
1919
|
* See the License for the specific language governing permissions and
|
|
1920
1920
|
* limitations under the License.
|
|
1921
|
-
*/(
|
|
1921
|
+
*/(s);for(const e of s)t=e._apply(t);return t}class Hh extends Bh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Hh(t,e,n)}_apply(t){const e=this._parse(t);return Gh(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e))}_parse(t){const e=function(t){const e=t._freezeSettings(),n=Jc(t._databaseId);return new Rh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,s,r,i,o){let a;if(r.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Wh(o,i);const e=[];for(const n of o)e.push(zh(s,t,n));a={arrayValue:{values:e}}}else a=zh(s,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Wh(o,i),a=function(t,e,n,s=!1){return Dh(n,t.da(s?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Ji.create(r,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function qh(t,e,n){const s=e,r=Uh("where",t);return Hh._create(r,s,n)}class Kh extends Vh{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Kh(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]:Yi.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const s=e.getFlattenedFilters();for(const t of s)Gh(n,t),n=Mo(n,t)}(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function zh(t,e,n){if("string"==typeof(n=I(n))){if(""===n)throw new jr(Br.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Oo(e)&&-1!==n.indexOf("/"))throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const s=e.path.child(ri.fromString(n));if(!ai.isDocumentKey(s))throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);return Vi(t,new ai(s))}if(n instanceof ch)return Vi(t,n._key);throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${nh(n)}.`)}function Wh(t,e){if(!Array.isArray(t)||0===t.length)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Gh(t,e){if(e.isInequality()){const n=Do(t),s=e.field;if(null!==n&&!n.isEqual(s))throw new jr(Br.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 '${s.toString()}'`);const r=Ro(t);null!==r&&function(t,e,n){if(!n.isEqual(e))throw new jr(Br.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,s,r)}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 jr(Br.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new jr(Br.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class $h{convertValue(t,e="none"){switch(Oi(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Ai(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(Ci(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 Ur()}}convertObject(t,e){const n={};return wi(t.fields,((t,s)=>{n[t]=this.convertValue(s,e)})),n}convertGeoPoint(t){return new Ah(Ai(t.latitude),Ai(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Ni(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ri(t));default:return null}}convertTimestamp(t){const e=bi(t);return new ei(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=ri.fromString(t);Fr(lc(n));const s=new yi(n.get(1),n.get(3)),r=new ai(n.popFirst(5));return s.isEqual(e)||Pr(`Document ${r} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),r}}
|
|
1922
1922
|
/**
|
|
1923
1923
|
* @license
|
|
1924
1924
|
* Copyright 2020 Google LLC
|
|
@@ -1934,7 +1934,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1934
1934
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1935
1935
|
* See the License for the specific language governing permissions and
|
|
1936
1936
|
* limitations under the License.
|
|
1937
|
-
*/class Qh{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class
|
|
1937
|
+
*/class Qh{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Jh extends Mh{constructor(t,e,n,s,r,i){super(t,e,n,s,i),this._firestore=t,this._firestoreImpl=t,this.metadata=r}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Yh(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(Uh("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Yh extends Jh{data(t={}){return super.data(t)}}class Xh{constructor(t,e,n,s){this._firestore=t,this._userDataWriter=e,this._snapshot=s,this.metadata=new Qh(s.hasPendingWrites,s.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 Yh(this._firestore,this._userDataWriter,n.key,n,new Qh(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 jr(Br.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 s=new Yh(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Qh(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:s,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const s=new Yh(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Qh(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let r=-1,i=-1;return 0!==e.type&&(r=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:Zh(e.type),doc:s,oldIndex:r,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Zh(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ur()}}
|
|
1938
1938
|
/**
|
|
1939
1939
|
* @license
|
|
1940
1940
|
* Copyright 2020 Google LLC
|
|
@@ -1950,7 +1950,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1950
1950
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1951
1951
|
* See the License for the specific language governing permissions and
|
|
1952
1952
|
* limitations under the License.
|
|
1953
|
-
*/function tl(t){t=
|
|
1953
|
+
*/function tl(t){t=sh(t,ch);const e=sh(t.firestore,wh);return function(t,e,n={}){const s=new Hr;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,s,r){const i=new fh({next:i=>{e.enqueueAndForget((()=>Cu(t,o)));const a=i.docs.has(n);!a&&i.fromCache?r.reject(new jr(Br.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&s&&"server"===s.source?r.reject(new jr(Br.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.)')):r.resolve(i)},error:t=>r.reject(t)}),o=new Du(ko(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,s))),s.promise}(Th(e),t._key).then((n=>rl(e,t,n)))}class el extends $h{constructor(t){super(),this.firestore=t}convertBytes(t){return new Eh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new ch(this.firestore,null,e)}}function nl(t){t=sh(t,uh);const e=sh(t.firestore,wh),n=Th(e),s=new el(e);return Fh(t._query),function(t,e,n={}){const s=new Hr;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,s,r){const i=new fh({next:n=>{e.enqueueAndForget((()=>Cu(t,o))),n.fromCache&&"server"===s.source?r.reject(new jr(Br.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.)')):r.resolve(n)},error:t=>r.reject(t)}),o=new Du(n,i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,s))),s.promise}(n,t._query).then((n=>new Xh(e,s,t,n)))}function sl(t,...e){var n,s,r;t=I(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||vh(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(vh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(s=t.error)||void 0===s?void 0:s.bind(t),e[o+2]=null===(r=t.complete)||void 0===r?void 0:r.bind(t)}let c,u,h;if(t instanceof ch)u=sh(t.firestore,wh),h=ko(t._key.path),c={next:n=>{e[o]&&e[o](rl(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=sh(t,uh);u=sh(n.firestore,wh),h=n._query;const s=new el(u);c={next:t=>{e[o]&&e[o](new Xh(u,s,n,t))},error:e[o+1],complete:e[o+2]},Fh(t._query)}return function(t,e,n,s){const r=new fh(s),i=new Du(e,r,n);return t.asyncQueue.enqueueAndForget((async()=>Au(await mh(t),i))),()=>{r.bc(),t.asyncQueue.enqueueAndForget((async()=>Cu(await mh(t),i)))}}(Th(u),h,a,c)}function rl(t,e,n){const s=n.docs.get(e._key),r=new el(t);return new Jh(t,r,e._key,s,new Qh(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Rr=ct,rt(new E("firestore",((t,{instanceIdentifier:n,options:s})=>{const r=t.getProvider("app").getImmediate(),i=new wh(new Wr(t.getProvider("auth-internal")),new Jr(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new jr(Br.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yi(t.options.projectId,e)}(r,n),r);return s=Object.assign({useFetchStreams:e},s),i._setSettings(s),i}),"PUBLIC").setMultipleInstances(!0)),lt(kr,"3.8.0",t),lt(kr,"3.8.0","esm2017")}();
|
|
1954
1954
|
/**
|
|
1955
1955
|
* @license
|
|
1956
1956
|
* Copyright 2020 Google LLC
|
|
@@ -1967,7 +1967,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1967
1967
|
* See the License for the specific language governing permissions and
|
|
1968
1968
|
* limitations under the License.
|
|
1969
1969
|
*/
|
|
1970
|
-
lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){return il.instance||(il.instance=new il),il.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?al.firebase:ol.firebase}get api(){return"prod"===this.env?al.api:ol.api}get config(){return"prod"===this.env?al.config:ol.config}}const ol={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")}},al={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")}};function cl(t,e){var n={};for(var
|
|
1970
|
+
lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){return il.instance||(il.instance=new il),il.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?al.firebase:ol.firebase}get api(){return"prod"===this.env?al.api:ol.api}get config(){return"prod"===this.env?al.config:ol.config}}const ol={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")}},al={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")}};function cl(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]])}return n}function ul(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const hl=ul,ll=new f("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."}),dl="auth/user-disabled",fl=new O("@firebase/auth");function pl(t,...e){fl.logLevel<=C.ERROR&&fl.error(`Auth (${ct}): ${t}`,...e)}
|
|
1971
1971
|
/**
|
|
1972
1972
|
* @license
|
|
1973
1973
|
* Copyright 2020 Google LLC
|
|
@@ -1983,7 +1983,7 @@ lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){retur
|
|
|
1983
1983
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1984
1984
|
* See the License for the specific language governing permissions and
|
|
1985
1985
|
* limitations under the License.
|
|
1986
|
-
*/function gl(t,...e){throw yl(t,...e)}function ml(t,...e){return yl(t,...e)}function yl(t,...e){if("string"!=typeof t){const n=e[0],
|
|
1986
|
+
*/function gl(t,...e){throw yl(t,...e)}function ml(t,...e){return yl(t,...e)}function yl(t,...e){if("string"!=typeof t){const n=e[0],s=[...e.slice(1)];return s[0]&&(s[0].appName=t.name),t._errorFactory.create(n,...s)}return ll.create(t,...e)}function vl(t,e,...n){if(!t)throw yl(e,...n)}function wl(t){const e="INTERNAL ASSERTION FAILED: "+t;throw pl(e),new Error(e)}function _l(t,e){t||wl(e)}
|
|
1987
1987
|
/**
|
|
1988
1988
|
* @license
|
|
1989
1989
|
* Copyright 2020 Google LLC
|
|
@@ -2129,7 +2129,7 @@ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay
|
|
|
2129
2129
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2130
2130
|
* See the License for the specific language governing permissions and
|
|
2131
2131
|
* limitations under the License.
|
|
2132
|
-
*/function Dl(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Ol(t,e,n,r
|
|
2132
|
+
*/function Dl(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Ol(t,e,n,s,r={}){return Ll(t,r,(async()=>{let r={},i={};s&&("GET"===e?i=s:r={body:JSON.stringify(s)});const o=y(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),kl.fetch()(Ml(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},r))}))}async function Ll(t,e,n){t._canInitEmulator=!1;const s=Object.assign(Object.assign({},Nl),e);try{const e=new xl(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await r.json();if("needConfirmation"in i)throw Ul(t,"account-exists-with-different-credential",i);if(r.ok&&!("errorMessage"in i))return i;{const e=r.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Ul(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Ul(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw Ul(t,"user-disabled",i);const a=s[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const s=Object.assign(Object.assign({},hl()),{[e]:n});return new f("auth","Firebase",s).create(e,{appName:t.name})}(t,a,o);gl(t,a)}}catch(e){if(e instanceof d)throw e;gl(t,"network-request-failed")}}async function Pl(t,e,n,s,r={}){const i=await Ol(t,e,n,s,r);return"mfaPendingCredential"in i&&gl(t,"multi-factor-auth-required",{_serverResponse:i}),i}function Ml(t,e,n,s){const r=`${e}${n}?${s}`;return t.config.emulator?Cl(t.config,r):`${t.config.apiScheme}://${r}`}class xl{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(ml(this.auth,"network-request-failed"))),Rl.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Ul(t,e,n){const s={appName:t.name};n.email&&(s.email=n.email),n.phoneNumber&&(s.phoneNumber=n.phoneNumber);const r=ml(t,e,s);return r.customData._tokenResponse=n,r}
|
|
2133
2133
|
/**
|
|
2134
2134
|
* @license
|
|
2135
2135
|
* Copyright 2020 Google LLC
|
|
@@ -2162,7 +2162,7 @@ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay
|
|
|
2162
2162
|
* See the License for the specific language governing permissions and
|
|
2163
2163
|
* limitations under the License.
|
|
2164
2164
|
*/
|
|
2165
|
-
function Fl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Vl(t){return 1e3*Number(t)}function Bl(t){const[e,n,
|
|
2165
|
+
function Fl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Vl(t){return 1e3*Number(t)}function Bl(t){const[e,n,s]=t.split(".");if(void 0===e||void 0===n||void 0===s)return pl("JWT malformed, contained fewer than 3 sections"),null;try{const t=i(n);return t?JSON.parse(t):(pl("Failed to decode base64 JWT payload"),null)}catch(t){return pl("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}
|
|
2166
2166
|
/**
|
|
2167
2167
|
* @license
|
|
2168
2168
|
* Copyright 2020 Google LLC
|
|
@@ -2179,7 +2179,7 @@ function Fl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))retur
|
|
|
2179
2179
|
* See the License for the specific language governing permissions and
|
|
2180
2180
|
* limitations under the License.
|
|
2181
2181
|
*/
|
|
2182
|
-
async function
|
|
2182
|
+
async function jl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof d&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
|
|
2183
2183
|
/**
|
|
2184
2184
|
* @license
|
|
2185
2185
|
* Copyright 2020 Google LLC
|
|
@@ -2195,7 +2195,7 @@ async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2195
2195
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2196
2196
|
* See the License for the specific language governing permissions and
|
|
2197
2197
|
* limitations under the License.
|
|
2198
|
-
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class
|
|
2198
|
+
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class Hl{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()}}
|
|
2199
2199
|
/**
|
|
2200
2200
|
* @license
|
|
2201
2201
|
* Copyright 2020 Google LLC
|
|
@@ -2227,7 +2227,7 @@ async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2227
2227
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2228
2228
|
* See the License for the specific language governing permissions and
|
|
2229
2229
|
* limitations under the License.
|
|
2230
|
-
*/async function Kl(t){var e;const n=t.auth,
|
|
2230
|
+
*/async function Kl(t){var e;const n=t.auth,s=await t.getIdToken(),r=await jl(t,async function(t,e){return Ol(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:s}));vl(null==r?void 0:r.users.length,n,"internal-error");const i=r.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=cl(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 ql(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}
|
|
2231
2231
|
/**
|
|
2232
2232
|
* @license
|
|
2233
2233
|
* Copyright 2020 Google LLC
|
|
@@ -2244,7 +2244,7 @@ async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2244
2244
|
* See the License for the specific language governing permissions and
|
|
2245
2245
|
* limitations under the License.
|
|
2246
2246
|
*/
|
|
2247
|
-
class zl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){vl(t.idToken,"internal-error"),vl(void 0!==t.idToken,"internal-error"),vl(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=Bl(t);return vl(e,"internal-error"),vl(void 0!==e.exp,"internal-error"),vl(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 vl(!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:
|
|
2247
|
+
class zl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){vl(t.idToken,"internal-error"),vl(void 0!==t.idToken,"internal-error"),vl(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=Bl(t);return vl(e,"internal-error"),vl(void 0!==e.exp,"internal-error"),vl(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 vl(!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:s,expiresIn:r}=await
|
|
2248
2248
|
/**
|
|
2249
2249
|
* @license
|
|
2250
2250
|
* Copyright 2020 Google LLC
|
|
@@ -2261,7 +2261,7 @@ class zl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2261
2261
|
* See the License for the specific language governing permissions and
|
|
2262
2262
|
* limitations under the License.
|
|
2263
2263
|
*/
|
|
2264
|
-
async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:
|
|
2264
|
+
async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=t.config,i=Ml(t,s,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",kl.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,s,Number(r))}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:s,expirationTime:r}=e,i=new zl;return n&&(vl("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),s&&(vl("string"==typeof s,"internal-error",{appName:t}),i.accessToken=s),r&&(vl("number"==typeof r,"internal-error",{appName:t}),i.expirationTime=r),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 zl,this.toJSON())}_performRefresh(){return wl("not implemented")}}
|
|
2265
2265
|
/**
|
|
2266
2266
|
* @license
|
|
2267
2267
|
* Copyright 2020 Google LLC
|
|
@@ -2277,7 +2277,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2277
2277
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2278
2278
|
* See the License for the specific language governing permissions and
|
|
2279
2279
|
* limitations under the License.
|
|
2280
|
-
*/function Wl(t,e){vl("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Gl{constructor(t){var{uid:e,auth:n,stsTokenManager:
|
|
2280
|
+
*/function Wl(t,e){vl("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Gl{constructor(t){var{uid:e,auth:n,stsTokenManager:s}=t,r=cl(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Hl(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new ql(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await jl(this,this.stsTokenManager.getToken(this.auth,t));return vl(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=I(t),s=await n.getIdToken(e),r=Bl(s);vl(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const i="object"==typeof r.firebase?r.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:r,token:s,authTime:Fl(Vl(r.auth_time)),issuedAtTime:Fl(Vl(r.iat)),expirationTime:Fl(Vl(r.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=I(t);await Kl(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(vl(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){return new Gl(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){vl(!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 Kl(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await jl(this,async function(t,e){return Ol(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,s,r,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(s=e.email)&&void 0!==s?s:void 0,d=null!==(r=e.phoneNumber)&&void 0!==r?r: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:I}=e;vl(v&&I,t,"internal-error");const E=zl.fromJSON(this.name,I);vl("string"==typeof v,t,"internal-error"),Wl(h,t.name),Wl(l,t.name),vl("boolean"==typeof w,t,"internal-error"),vl("boolean"==typeof _,t,"internal-error"),Wl(d,t.name),Wl(f,t.name),Wl(p,t.name),Wl(g,t.name),Wl(m,t.name),Wl(y,t.name);const S=new Gl({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(S.providerData=T.map((t=>Object.assign({},t)))),g&&(S._redirectEventId=g),S}static async _fromIdTokenResponse(t,e,n=!1){const s=new zl;s.updateFromServerResponse(e);const r=new Gl({uid:e.localId,auth:t,stsTokenManager:s,isAnonymous:n});return await Kl(r),r}}
|
|
2281
2281
|
/**
|
|
2282
2282
|
* @license
|
|
2283
2283
|
* Copyright 2019 Google LLC
|
|
@@ -2309,7 +2309,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2309
2309
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2310
2310
|
* See the License for the specific language governing permissions and
|
|
2311
2311
|
* limitations under the License.
|
|
2312
|
-
*/function
|
|
2312
|
+
*/function Jl(t,e,n){return`firebase:${t}:${e}:${n}`}class Yl{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:s,name:r}=this.auth;this.fullUserKey=Jl(this.userKey,s.apiKey,r),this.fullPersistenceKey=Jl("persistence",s.apiKey,r),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?Gl._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 Yl(Il(Ql),t,n);const s=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let r=s[0]||Il(Ql);const i=Jl(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const s=Gl._fromJSON(t,e);n!==r&&(o=s),r=n;break}}catch(t){}const a=s.filter((t=>t._shouldAllowMigration));return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==r)try{await t._remove(i)}catch(t){}}))),new Yl(r,t,n)):new Yl(r,t,n)}}
|
|
2313
2313
|
/**
|
|
2314
2314
|
* @license
|
|
2315
2315
|
* Copyright 2020 Google LLC
|
|
@@ -2325,7 +2325,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2325
2325
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2326
2326
|
* See the License for the specific language governing permissions and
|
|
2327
2327
|
* limitations under the License.
|
|
2328
|
-
*/function Xl(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(nd(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Zl(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(
|
|
2328
|
+
*/function Xl(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(nd(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Zl(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(rd(e))return"Blackberry";if(id(e))return"Webos";if(td(e))return"Safari";if((e.includes("chrome/")||ed(e))&&!e.includes("edge/"))return"Chrome";if(sd(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 Zl(t=o()){return/firefox\//i.test(t)}function td(t=o()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ed(t=o()){return/crios\//i.test(t)}function nd(t=o()){return/iemobile/i.test(t)}function sd(t=o()){return/android/i.test(t)}function rd(t=o()){return/blackberry/i.test(t)}function id(t=o()){return/webos/i.test(t)}function od(t=o()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function ad(){return function(){const t=o();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function cd(t=o()){return od(t)||sd(t)||id(t)||rd(t)||/windows phone/i.test(t)||nd(t)}
|
|
2329
2329
|
/**
|
|
2330
2330
|
* @license
|
|
2331
2331
|
* Copyright 2020 Google LLC
|
|
@@ -2342,7 +2342,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2342
2342
|
* See the License for the specific language governing permissions and
|
|
2343
2343
|
* limitations under the License.
|
|
2344
2344
|
*/
|
|
2345
|
-
function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n=`${Xl(o())}-${t}`;break;default:n=t}const
|
|
2345
|
+
function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n=`${Xl(o())}-${t}`;break;default:n=t}const s=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ct}/${s}`}
|
|
2346
2346
|
/**
|
|
2347
2347
|
* @license
|
|
2348
2348
|
* Copyright 2022 Google LLC
|
|
@@ -2358,7 +2358,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
|
|
|
2358
2358
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2359
2359
|
* See the License for the specific language governing permissions and
|
|
2360
2360
|
* limitations under the License.
|
|
2361
|
-
*/class hd{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,
|
|
2361
|
+
*/class hd{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,s)=>{try{n(t(e))}catch(t){s(t)}}));n.onAbort=e,this.queue.push(n);const s=this.queue.length-1;return()=>{this.queue[s]=()=>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})}}}
|
|
2362
2362
|
/**
|
|
2363
2363
|
* @license
|
|
2364
2364
|
* Copyright 2020 Google LLC
|
|
@@ -2374,7 +2374,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
|
|
|
2374
2374
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2375
2375
|
* See the License for the specific language governing permissions and
|
|
2376
2376
|
* limitations under the License.
|
|
2377
|
-
*/class ld{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new fd(this),this.idTokenSubscription=new fd(this),this.beforeStateQueue=new hd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ll,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Il(e)),this._initializationPromise=this.queue((async()=>{var n,
|
|
2377
|
+
*/class ld{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new fd(this),this.idTokenSubscription=new fd(this),this.beforeStateQueue=new hd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ll,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Il(e)),this._initializationPromise=this.queue((async()=>{var n,s;if(!this._deleted&&(this.persistenceManager=await Yl.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===(s=this.currentUser)||void 0===s?void 0:s.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 s=n,r=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==s?void 0:s._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(s=o.user,r=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(s)}catch(t){s=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return vl(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===s._redirectEventId?this.directlySetCurrentUser(s):this.reloadAndSetCurrentUserOrClear(s)}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 Kl(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?I(t):null;return e&&vl(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&&vl(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(Il(t))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new f("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&&Il(t)||this._popupRedirectResolver;vl(e,this,"argument-error"),this.redirectPersistenceManager=await Yl.create(this,[Il(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,s){if(this._deleted)return()=>{};const r="function"==typeof e?e:e.next.bind(e),i=this._isInitialized?Promise.resolve():this._initializationPromise;return vl(i,this,"internal-error"),i.then((()=>r(this.currentUser))),"function"==typeof e?t.addObserver(e,n,s):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 vl(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=ud(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());return n&&(e["X-Firebase-Client"]=n),e}}function dd(t){return I(t)}class fd{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new _(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return vl(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function pd(t,e,n){const s=dd(t);vl(s._canInitEmulator,s,"emulator-config-failed"),vl(/^https?:\/\//.test(e),s,"invalid-emulator-scheme");const r=!!(null==n?void 0:n.disableWarnings),i=gd(e),{host:o,port:a}=function(t){const e=gd(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const s=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(s);if(r){const t=r[1];return{host:t,port:md(s.substr(t.length+1))}}{const[t,e]=s.split(":");return{host:t,port:md(e)}}}(e),c=null===a?"":`:${a}`;s.config.emulator={url:`${i}//${o}${c}/`},s.settings.appVerificationDisabledForTesting=!0,s.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:r})}),r||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())}
|
|
2378
2378
|
/**
|
|
2379
2379
|
* @license
|
|
2380
2380
|
* Copyright 2020 Google LLC
|
|
@@ -2439,7 +2439,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
|
|
|
2439
2439
|
* See the License for the specific language governing permissions and
|
|
2440
2440
|
* limitations under the License.
|
|
2441
2441
|
*/
|
|
2442
|
-
class wd extends yd{constructor(t,e,n,
|
|
2442
|
+
class wd extends yd{constructor(t,e,n,s=null){super("password",n),this._email=t,this._password=e,this._tenantId=s}static _fromEmailAndPassword(t,e){return new wd(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new wd(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":
|
|
2443
2443
|
/**
|
|
2444
2444
|
* @license
|
|
2445
2445
|
* Copyright 2020 Google LLC
|
|
@@ -2488,7 +2488,7 @@ return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2488
2488
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2489
2489
|
* See the License for the specific language governing permissions and
|
|
2490
2490
|
* limitations under the License.
|
|
2491
|
-
*/class Td extends yd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Td(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):gl("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:
|
|
2491
|
+
*/class Td extends yd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Td(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):gl("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:s}=e,r=cl(e,["providerId","signInMethod"]);if(!n||!s)return null;const i=new Td(n,s);return i.idToken=r.idToken||void 0,i.accessToken=r.accessToken||void 0,i.secret=r.secret,i.nonce=r.nonce,i.pendingToken=r.pendingToken||null,i}_getIdTokenResponse(t){return _d(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,_d(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,_d(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=y(e)}return t}}
|
|
2492
2492
|
/**
|
|
2493
2493
|
* @license
|
|
2494
2494
|
* Copyright 2020 Google LLC
|
|
@@ -2504,7 +2504,7 @@ return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2504
2504
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2505
2505
|
* See the License for the specific language governing permissions and
|
|
2506
2506
|
* limitations under the License.
|
|
2507
|
-
*/class Id{constructor(t){var e,n,r,
|
|
2507
|
+
*/class Id{constructor(t){var e,n,s,r,i,o;const a=v(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!==(s=a.mode)&&void 0!==s?s:null);vl(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r: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=v(w(t)).link,n=e?v(w(e)).deep_link_id:null,s=v(w(t)).deep_link_id;return(s?v(w(s)).link:null)||s||n||e||t}(t);try{return new Id(e)}catch(t){return null}}}
|
|
2508
2508
|
/**
|
|
2509
2509
|
* @license
|
|
2510
2510
|
* Copyright 2020 Google LLC
|
|
@@ -2637,7 +2637,7 @@ class Nd extends bd{constructor(){super("twitter.com")}static credential(t,e){re
|
|
|
2637
2637
|
* See the License for the specific language governing permissions and
|
|
2638
2638
|
* limitations under the License.
|
|
2639
2639
|
*/
|
|
2640
|
-
class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,
|
|
2640
|
+
class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,s=!1){const r=await Gl._fromIdTokenResponse(t,n,s),i=Dd(n);return new Rd({user:r,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const s=Dd(n);return new Rd({user:t,providerId:s,_tokenResponse:n,operationType:e})}}function Dd(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
|
|
2641
2641
|
/**
|
|
2642
2642
|
* @license
|
|
2643
2643
|
* Copyright 2020 Google LLC
|
|
@@ -2653,7 +2653,7 @@ class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2653
2653
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2654
2654
|
* See the License for the specific language governing permissions and
|
|
2655
2655
|
* limitations under the License.
|
|
2656
|
-
*/class Od extends d{constructor(t,e,n,
|
|
2656
|
+
*/class Od extends d{constructor(t,e,n,s){var r;super(e.code,e.message),this.operationType=n,this.user=s,Object.setPrototypeOf(this,Od.prototype),this.customData={appName:t.name,tenantId:null!==(r=t.tenantId)&&void 0!==r?r:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,s){return new Od(t,e,n,s)}}function Ld(t,e,n,s){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw Od._fromErrorAndOperation(t,n,e,s);throw n}))}
|
|
2657
2657
|
/**
|
|
2658
2658
|
* @license
|
|
2659
2659
|
* Copyright 2020 Google LLC
|
|
@@ -2670,7 +2670,7 @@ class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2670
2670
|
* See the License for the specific language governing permissions and
|
|
2671
2671
|
* limitations under the License.
|
|
2672
2672
|
*/
|
|
2673
|
-
async function Pd(t,e,n=!1){const
|
|
2673
|
+
async function Pd(t,e,n=!1){const s="signIn",r=await Ld(t,s,e),i=await Rd._fromIdTokenResponse(t,s,r);return n||await t._updateCurrentUser(i.user),i}
|
|
2674
2674
|
/**
|
|
2675
2675
|
* @license
|
|
2676
2676
|
* Copyright 2020 Google LLC
|
|
@@ -2687,7 +2687,7 @@ async function Pd(t,e,n=!1){const r="signIn",s=await Ld(t,r,e),i=await Rd._fromI
|
|
|
2687
2687
|
* See the License for the specific language governing permissions and
|
|
2688
2688
|
* limitations under the License.
|
|
2689
2689
|
*/
|
|
2690
|
-
async function Md(t,e,n){const
|
|
2690
|
+
async function Md(t,e,n){const s=I(t),r={requestType:"PASSWORD_RESET",email:e};n&&
|
|
2691
2691
|
/**
|
|
2692
2692
|
* @license
|
|
2693
2693
|
* Copyright 2020 Google LLC
|
|
@@ -2704,7 +2704,7 @@ async function Md(t,e,n){const r=I(t),s={requestType:"PASSWORD_RESET",email:e};n
|
|
|
2704
2704
|
* See the License for the specific language governing permissions and
|
|
2705
2705
|
* limitations under the License.
|
|
2706
2706
|
*/
|
|
2707
|
-
function(t,e,n){var
|
|
2707
|
+
function(t,e,n){var s;vl((null===(s=n.url)||void 0===s?void 0:s.length)>0,t,"invalid-continue-uri"),vl(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&&(vl(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(vl(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)}(s,r,n),await vd(s,r)}async function xd(t,e,n){await async function(t,e){return Ol(t,"POST","/v1/accounts:resetPassword",Dl(t,e))}(I(t),{oobCode:e,newPassword:n})}function Ud(t,e,n){return async function(t,e){return Pd(dd(t),e)}(I(t),Ed.credential(e,n))}const Fd="__sak";
|
|
2708
2708
|
/**
|
|
2709
2709
|
* @license
|
|
2710
2710
|
* Copyright 2019 Google LLC
|
|
@@ -2736,7 +2736,7 @@ function(t,e,n){var r;vl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2736
2736
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2737
2737
|
* See the License for the specific language governing permissions and
|
|
2738
2738
|
* limitations under the License.
|
|
2739
|
-
*/class Bd extends Vd{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=o();return td(t)||od(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=cd(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),
|
|
2739
|
+
*/class Bd extends Vd{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=o();return td(t)||od(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=cd(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),s=this.localCache[e];n!==s&&t(e,s,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 s=this.storage.getItem(n);if(t.newValue!==s)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const s=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},r=this.storage.getItem(n);ad()&&r!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,10):s()}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]}}Bd.type="LOCAL";const jd=Bd;
|
|
2740
2740
|
/**
|
|
2741
2741
|
* @license
|
|
2742
2742
|
* Copyright 2020 Google LLC
|
|
@@ -2752,7 +2752,7 @@ function(t,e,n){var r;vl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2752
2752
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2753
2753
|
* See the License for the specific language governing permissions and
|
|
2754
2754
|
* limitations under the License.
|
|
2755
|
-
*/class
|
|
2755
|
+
*/class Hd extends Vd{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}Hd.type="SESSION";const qd=Hd;
|
|
2756
2756
|
/**
|
|
2757
2757
|
* @license
|
|
2758
2758
|
* Copyright 2019 Google LLC
|
|
@@ -2785,7 +2785,7 @@ function(t,e,n){var r;vl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2785
2785
|
* See the License for the specific language governing permissions and
|
|
2786
2786
|
* limitations under the License.
|
|
2787
2787
|
*/
|
|
2788
|
-
class Kd{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 Kd(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:
|
|
2788
|
+
class Kd{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 Kd(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:s,data:r}=e.data,i=this.handlersMap[s];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:s});const o=Array.from(i).map((async t=>t(e.origin,r))),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:s,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)}}
|
|
2789
2789
|
/**
|
|
2790
2790
|
* @license
|
|
2791
2791
|
* Copyright 2020 Google LLC
|
|
@@ -2818,7 +2818,7 @@ function zd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2818
2818
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2819
2819
|
* See the License for the specific language governing permissions and
|
|
2820
2820
|
* limitations under the License.
|
|
2821
|
-
*/Kd.receivers=[];class Wd{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
|
|
2821
|
+
*/Kd.receivers=[];class Wd{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 s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,i;return new Promise(((o,a)=>{const c=zd("",20);s.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:s,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(u),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[s.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
|
|
2822
2822
|
/**
|
|
2823
2823
|
* @license
|
|
2824
2824
|
* Copyright 2020 Google LLC
|
|
@@ -2868,7 +2868,7 @@ function $d(){return void 0!==Gd().WorkerGlobalScope&&"function"==typeof Gd().im
|
|
|
2868
2868
|
* See the License for the specific language governing permissions and
|
|
2869
2869
|
* limitations under the License.
|
|
2870
2870
|
*/
|
|
2871
|
-
const Qd="firebaseLocalStorageDb",
|
|
2871
|
+
const Qd="firebaseLocalStorageDb",Jd="firebaseLocalStorage",Yd="fbase_key";class Xd{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 Zd(t,e){return t.transaction([Jd],e?"readwrite":"readonly").objectStore(Jd)}function tf(){const t=indexedDB.open(Qd,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Jd,{keyPath:Yd})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Jd)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Qd);return new Xd(t).toPromise()}(),e(await tf()))}))}))}async function ef(t,e,n){const s=Zd(t,!0).put({[Yd]:e,value:n});return new Xd(s).toPromise()}function nf(t,e){const n=Zd(t,!0).delete(e);return new Xd(n).toPromise()}class sf{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 tf()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return $d()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Kd._getInstance($d()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new Wd(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 tf();return await ef(t,Fd,"1"),await nf(t,Fd),!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=>ef(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=Zd(t,!1).get(e),s=await new Xd(n).toPromise();return void 0===s?null:s.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>nf(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Zd(t,!1).getAll();return new Xd(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:s,value:r}of t)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),e.push(s));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()}}sf.type="LOCAL";const rf=sf;
|
|
2872
2872
|
/**
|
|
2873
2873
|
* @license
|
|
2874
2874
|
* Copyright 2020 Google LLC
|
|
@@ -2884,7 +2884,7 @@ const Qd="firebaseLocalStorageDb",Yd="firebaseLocalStorage",Jd="fbase_key";class
|
|
|
2884
2884
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2885
2885
|
* See the License for the specific language governing permissions and
|
|
2886
2886
|
* limitations under the License.
|
|
2887
|
-
*/function of(t){return new Promise(((e,n)=>{const
|
|
2887
|
+
*/function of(t){return new Promise(((e,n)=>{const s=document.createElement("script");s.setAttribute("src",t),s.onload=e,s.onerror=t=>{const e=ml("internal-error");e.customData=t,n(e)},s.type="text/javascript",s.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(s)}))}new Al(3e4,6e4);
|
|
2888
2888
|
/**
|
|
2889
2889
|
* @license
|
|
2890
2890
|
* Copyright 2019 Google LLC
|
|
@@ -2918,7 +2918,7 @@ class af extends yd{constructor(t){super("custom","custom"),this.params=t}_getId
|
|
|
2918
2918
|
* See the License for the specific language governing permissions and
|
|
2919
2919
|
* limitations under the License.
|
|
2920
2920
|
*/
|
|
2921
|
-
async function(t,e,n=!1){const{auth:
|
|
2921
|
+
async function(t,e,n=!1){const{auth:s}=t,r="reauthenticate";try{const i=await jl(t,Ld(s,r,e,t),n);vl(i.idToken,s,"internal-error");const o=Bl(i.idToken);vl(o,s,"internal-error");const{sub:a}=o;return vl(t.uid===a,s,"user-mismatch"),Rd._forOperation(t,r,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&gl(s,"user-mismatch"),t}}(n,new af(t),t.bypassAuthState)}async function hf(t){const{auth:e,user:n}=t;return vl(n,e,"internal-error"),async function(t,e,n=!1){const s=await jl(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Rd._forOperation(t,"link",s)}(n,new af(t),t.bypassAuthState)}
|
|
2922
2922
|
/**
|
|
2923
2923
|
* @license
|
|
2924
2924
|
* Copyright 2020 Google LLC
|
|
@@ -2934,7 +2934,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await Hl
|
|
|
2934
2934
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2935
2935
|
* See the License for the specific language governing permissions and
|
|
2936
2936
|
* limitations under the License.
|
|
2937
|
-
*/class lf{constructor(t,e,n,r
|
|
2937
|
+
*/class lf{constructor(t,e,n,s,r=!1){this.auth=t,this.resolver=n,this.user=s,this.bypassAuthState=r,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:s,tenantId:r,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:r||void 0,postBody:s||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 cf;case"linkViaPopup":case"linkViaRedirect":return hf;case"reauthViaPopup":case"reauthViaRedirect":return uf;default:gl(this.auth,"internal-error")}}resolve(t){_l(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){_l(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()}}
|
|
2938
2938
|
/**
|
|
2939
2939
|
* @license
|
|
2940
2940
|
* Copyright 2020 Google LLC
|
|
@@ -2950,7 +2950,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await Hl
|
|
|
2950
2950
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2951
2951
|
* See the License for the specific language governing permissions and
|
|
2952
2952
|
* limitations under the License.
|
|
2953
|
-
*/const df=new Al(2e3,1e4);class ff extends lf{constructor(t,e,n,r
|
|
2953
|
+
*/const df=new Al(2e3,1e4);class ff extends lf{constructor(t,e,n,s,r){super(t,e,s,r),this.provider=n,this.authWindow=null,this.pollId=null,ff.currentPopupAction&&ff.currentPopupAction.cancel(),ff.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return vl(t,this.auth,"internal-error"),t}async onExecution(){_l(1===this.filter.length,"Popup operations only handle one event");const t=zd();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(ml(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(ml(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ff.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(ml(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(t,df.get())};t()}}ff.currentPopupAction=null;
|
|
2954
2954
|
/**
|
|
2955
2955
|
* @license
|
|
2956
2956
|
* Copyright 2020 Google LLC
|
|
@@ -2967,7 +2967,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await Hl
|
|
|
2967
2967
|
* See the License for the specific language governing permissions and
|
|
2968
2968
|
* limitations under the License.
|
|
2969
2969
|
*/
|
|
2970
|
-
const pf="pendingRedirect",gf=new Map;class mf extends lf{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=gf.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return
|
|
2970
|
+
const pf="pendingRedirect",gf=new Map;class mf extends lf{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=gf.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return Jl(pf,t.config.apiKey,t.name)}(e),s=function(t){return Il(t._redirectPersistence)}(t);if(!await s._isAvailable())return!1;const r="true"===await s._get(n);return await s._remove(n),r}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}gf.set(this.auth._key(),t)}return this.bypassAuthState||gf.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 yf(t,e){gf.set(t._key(),e)}async function vf(t,e,n=!1){const s=dd(t),r=
|
|
2971
2971
|
/**
|
|
2972
2972
|
* @license
|
|
2973
2973
|
* Copyright 2021 Google LLC
|
|
@@ -2984,7 +2984,7 @@ const pf="pendingRedirect",gf=new Map;class mf extends lf{constructor(t,e,n=!1){
|
|
|
2984
2984
|
* See the License for the specific language governing permissions and
|
|
2985
2985
|
* limitations under the License.
|
|
2986
2986
|
*/
|
|
2987
|
-
function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(
|
|
2987
|
+
function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(s,e),i=new mf(s,r,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await s._persistUserIfCurrent(o.user),await s._setRedirectUser(null,e)),o}
|
|
2988
2988
|
/**
|
|
2989
2989
|
* @license
|
|
2990
2990
|
* Copyright 2020 Google LLC
|
|
@@ -3016,7 +3016,7 @@ function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3016
3016
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3017
3017
|
* See the License for the specific language governing permissions and
|
|
3018
3018
|
* limitations under the License.
|
|
3019
|
-
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Tf(t)){const
|
|
3019
|
+
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Tf(t)){const s=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(ml(this.auth,s))}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(_f(t))}saveEventToCache(t){this.cachedEventUids.add(_f(t)),this.lastProcessedEventTime=Date.now()}}function _f(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Tf({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
|
|
3020
3020
|
/**
|
|
3021
3021
|
* @license
|
|
3022
3022
|
* Copyright 2020 Google LLC
|
|
@@ -3033,7 +3033,7 @@ function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3033
3033
|
* See the License for the specific language governing permissions and
|
|
3034
3034
|
* limitations under the License.
|
|
3035
3035
|
*/
|
|
3036
|
-
const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Ol(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(bf(t))return}catch(t){}gl(t,"unauthorized-domain")}function bf(t){const e=El(),{protocol:n,hostname:
|
|
3036
|
+
const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Ol(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(bf(t))return}catch(t){}gl(t,"unauthorized-domain")}function bf(t){const e=El(),{protocol:n,hostname:s}=new URL(e);if(t.startsWith("chrome-extension://")){const r=new URL(t);return""===r.hostname&&""===s?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===s}if(!Ef.test(n))return!1;if(If.test(t))return s===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(s)}
|
|
3037
3037
|
/**
|
|
3038
3038
|
* @license
|
|
3039
3039
|
* Copyright 2020 Google LLC.
|
|
@@ -3049,7 +3049,7 @@ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t
|
|
|
3049
3049
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3050
3050
|
* See the License for the specific language governing permissions and
|
|
3051
3051
|
* limitations under the License.
|
|
3052
|
-
*/const Af=new Al(3e4,6e4);function Cf(){const t=Gd().___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 kf(t){return new Promise(((e,n)=>{var r,
|
|
3052
|
+
*/const Af=new Al(3e4,6e4);function Cf(){const t=Gd().___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 kf(t){return new Promise(((e,n)=>{var s,r,i;function o(){Cf(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Cf(),n(ml(t,"network-request-failed"))},timeout:Af.get()})}if(null===(r=null===(s=Gd().gapi)||void 0===s?void 0:s.iframes)||void 0===r?void 0:r.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=Gd().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Gd()[e]=()=>{gapi.load?o():n(ml(t,"network-request-failed"))},of(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Nf=null,t}))}let Nf=null;
|
|
3053
3053
|
/**
|
|
3054
3054
|
* @license
|
|
3055
3055
|
* Copyright 2020 Google LLC.
|
|
@@ -3066,7 +3066,7 @@ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t
|
|
|
3066
3066
|
* See the License for the specific language governing permissions and
|
|
3067
3067
|
* limitations under the License.
|
|
3068
3068
|
*/
|
|
3069
|
-
const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Of=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Lf(t){const e=t.config;vl(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Cl(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,
|
|
3069
|
+
const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Of=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Lf(t){const e=t.config;vl(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Cl(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,s={apiKey:e.apiKey,appName:t.name,v:ct},r=Of.get(t.config.apiHost);r&&(s.eid=r);const i=t._getFrameworks();return i.length&&(s.fw=i.join(",")),`${n}?${y(s).slice(1)}`}async function Pf(t){const e=await function(t){return Nf=Nf||kf(t),Nf}(t),n=Gd().gapi;return vl(n,t,"internal-error"),e.open({where:document.body,url:Lf(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Df,dontclear:!0},(e=>new Promise((async(n,s)=>{await e.restyle({setHideOnLeave:!1});const r=ml(t,"network-request-failed"),i=Gd().setTimeout((()=>{s(r)}),Rf.get());function o(){Gd().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{s(r)}))}))))}
|
|
3070
3070
|
/**
|
|
3071
3071
|
* @license
|
|
3072
3072
|
* Copyright 2020 Google LLC.
|
|
@@ -3082,7 +3082,7 @@ const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3082
3082
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3083
3083
|
* See the License for the specific language governing permissions and
|
|
3084
3084
|
* limitations under the License.
|
|
3085
|
-
*/const Mf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class xf{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Uf(t,e,n,
|
|
3085
|
+
*/const Mf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class xf{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Uf(t,e,n,s=500,r=600){const i=Math.max((window.screen.availHeight-r)/2,0).toString(),a=Math.max((window.screen.availWidth-s)/2,0).toString();let c="";const u=Object.assign(Object.assign({},Mf),{width:s.toString(),height:r.toString(),top:i,left:a}),h=o().toLowerCase();n&&(c=ed(h)?"_blank":n),Zl(h)&&(e=e||"http://localhost",u.scrollbars="yes");const l=Object.entries(u).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=o()){var e;return od(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(h)&&"_self"!==c)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const s=document.createEvent("MouseEvent");s.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(s)}
|
|
3086
3086
|
/**
|
|
3087
3087
|
* @license
|
|
3088
3088
|
* Copyright 2021 Google LLC
|
|
@@ -3098,7 +3098,7 @@ const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3098
3098
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3099
3099
|
* See the License for the specific language governing permissions and
|
|
3100
3100
|
* limitations under the License.
|
|
3101
|
-
*/(e||"",c),new xf(null);const d=window.open(e||"",c,l);vl(d,t,"popup-blocked");try{d.focus()}catch(t){}return new xf(d)}const Ff="__/auth/handler",Vf="emulator/auth/handler";function Bf(t,e,n,r,
|
|
3101
|
+
*/(e||"",c),new xf(null);const d=window.open(e||"",c,l);vl(d,t,"popup-blocked");try{d.focus()}catch(t){}return new xf(d)}const Ff="__/auth/handler",Vf="emulator/auth/handler";function Bf(t,e,n,s,r,i){vl(t.config.authDomain,t,"auth-domain-config-required"),vl(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:s,v:ct,eventId:r};if(e instanceof Sd){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(i||{}))o[t]=e}if(e instanceof bd){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Ff}`;return Cl(t,Vf)}
|
|
3102
3102
|
/**
|
|
3103
3103
|
* @license
|
|
3104
3104
|
* Copyright 2020 Google LLC
|
|
@@ -3114,7 +3114,7 @@ const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3114
3114
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3115
3115
|
* See the License for the specific language governing permissions and
|
|
3116
3116
|
* limitations under the License.
|
|
3117
|
-
*/(t)}?${y(a).slice(1)}`}const
|
|
3117
|
+
*/(t)}?${y(a).slice(1)}`}const jf="webStorageSupport";const Hf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=qd,this._completeRedirectFn=vf,this._overrideRedirectResult=yf}async _openPopup(t,e,n,s){var r;_l(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return Uf(t,Bf(t,e,n,El(),s),zd())}async _openRedirect(t,e,n,s){var r;return await this._originValidation(t),r=Bf(t,e,n,El(),s),Gd().location.href=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):(_l(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 Pf(t),n=new wf(t);return e.register("authEvent",(e=>{vl(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(jf,{type:jf},(n=>{var s;const r=null===(s=null==n?void 0:n[0])||void 0===s?void 0:s[jf];void 0!==r&&e(!!r),gl(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Sf(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return cd()||td()||od()}};var qf="@firebase/auth",Kf="0.21.0";
|
|
3118
3118
|
/**
|
|
3119
3119
|
* @license
|
|
3120
3120
|
* Copyright 2020 Google LLC
|
|
@@ -3164,5 +3164,5 @@ class zf{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3164
3164
|
* See the License for the specific language governing permissions and
|
|
3165
3165
|
* limitations under the License.
|
|
3166
3166
|
*/
|
|
3167
|
-
const Wf=h("authIdTokenMaxAge")||300;let Gf=null;function $f(t=ht()){const e=it(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=it(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(g(n.getOptions(),null!=e?e:{}))return t;gl(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:jf,persistence:[sf,Hd,qd]}),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>Wf)return;const r=null==e?void 0:e.token;Gf!==r&&(Gf=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){I(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var s;const i=u("auth");return i&&pd(n,`http://${i}`),n}var Qf;Qf="Browser",st(new E("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:s,authDomain:i}=n.options;return((t,n)=>{vl(s&&!s.includes(":"),"invalid-api-key",{appName:t.name}),vl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const r={apiKey:s,authDomain:i,clientPlatform:Qf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ud(Qf)},o=new ld(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Il);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),st(new E("auth-internal",(t=>(t=>new zf(t))(dd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),lt(qf,Kf,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Qf)),lt(qf,Kf,"esm2017");class Yf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Jf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Xf extends Error{constructor(){super("request timeout"),this.name="RequestTimeoutError"}}class Zf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class tp extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class ep extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}class np extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}class rp extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}const sp="avatar not created";var ip=Object.freeze({__proto__:null,AvatarNotCreatedError:Yf,NoFramesFoundError:Jf,RequestTimeoutError:Xf,UserNotLoggedInError:Zf,NoColorwaySizeAssetsFoundError:tp,NoStylesFoundError:ep,RecommendedAvailableSizesError:np,BrandUserIdNotSetError:rp,AvatarNotCreated:sp});class op{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=$f(e),this.auth.setPersistence(Hd)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Zf;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Zf;return(await tl(dh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t,e){let n;const r=Hh(lh(this.firestore,"users"),qh(new Sh("__name__"),"==",this.id)),s=setTimeout((()=>n()),e);return new Promise((e=>{n=rl(r,(async r=>{await t(r)&&(clearTimeout(s),n(),e(r.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Ud(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await Md(this.auth,t)}async confirmPasswordReset(t,e){await xd(this.auth,t,e)}}class ap{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=rl(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=ut(il.getInstance().firebase);this.firestore=_h(t),this.user=new op(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const r=Hh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return nl(Hh(lh(this.firestore,t),...e))}async getDoc(t,e){const n=dh(this.firestore,t,e),r=await tl(n);return r.exists()?r.data():null}}const cp=t=>{if(t.code===dl)throw new Error("account has been disabled");throw new Error(t.message)};var up;!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"}(up||(up={}));const hp={[up.ACROSS_BACK]:"Across back",[up.ACROSS_FRONT]:"Across front",[up.ACROSS_SHOULDER]:"Across shoulder",[up.ANKLE]:"Ankle",[up.ARMEYE]:"Armeye",[up.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[up.BACK_CROTCH_LENGTH]:"Back crotch length",[up.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[up.BELOW_KNEE]:"Below knee",[up.BICEP]:"Bicep",[up.BUST]:"Chest/Bust",[up.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[up.CALF]:"Calf",[up.CB_NECK_TO_WAIST]:"Cb neck to waist",[up.CB_NECK_TO_WRIST]:"Cb neck to wrist",[up.CF_NECK_TO_WAIST]:"Cf neck to waist",[up.ELBOW]:"Elbow",[up.FOREARM]:"Forearm",[up.FRONT_CROTCH_LENGTH]:"Front crotch length",[up.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[up.HIGH_HIP]:"High hip",[up.HSP_TO_ACROSS_BACK]:"Hsp to across back",[up.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[up.HSP_TO_BUST_POINT]:"Hsp to bust point",[up.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[up.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[up.INSEAM]:"Inseam",[up.KNEE]:"Knee",[up.LOW_HIP]:"Low hip",[up.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[up.MID_NECK]:"Mid neck",[up.NECK_AT_BASE]:"Neck at base",[up.SHOULDER_DROP]:"Shoulder drop",[up.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[up.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[up.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[up.THIGH]:"Thigh",[up.TOTAL_RISE_LENGTH]:"Total rise length",[up.UNDER_BUST]:"Under bust",[up.VERTICAL_TRUNK]:"Vertical trunk",[up.WAIST]:"Waist",[up.WRIST]:"Wrist"};var lp;!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"}(lp||(lp={}));const dp={[lp.BLOUSES]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.COATS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.DRESSES]:[up.LOW_HIP,up.BUST,up.ACROSS_SHOULDER,up.WAIST],[lp.JACKETS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.PANTS]:[up.LOW_HIP,up.WAIST,up.THIGH,up.INSEAM],[lp.PUFFERS_AND_PARKAS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.SHORTS]:[up.LOW_HIP,up.WAIST,up.THIGH,up.INSEAM],[lp.SKIRTS]:[up.LOW_HIP,up.WAIST],[lp.SWEATERS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.T_SHIRTS_AND_TANKS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP]},fp={activewear:{leggings:lp.PANTS,joggers:lp.PANTS,sweatshirts:lp.SWEATERS},dresses:{a_line:lp.DRESSES,bodycon:lp.DRESSES,fit_and_flare:lp.DRESSES,knit:lp.DRESSES,shirt:lp.DRESSES,slip:lp.DRESSES,straight:lp.DRESSES,wrap:lp.DRESSES},jackets_and_coats:{denim_jackets:lp.JACKETS,parkas:lp.PUFFERS_AND_PARKAS,peacoats:lp.COATS,puffer_jackets:lp.PUFFERS_AND_PARKAS,raincoats:lp.COATS,rompers:lp.COATS,shackets:lp.JACKETS,trench_coats:lp.COATS},jeans:{bootcut:lp.PANTS,flared:lp.PANTS,mom:lp.PANTS,relaxed:lp.PANTS,skinny:lp.PANTS,slim:lp.PANTS,straight:lp.PANTS,tapered:lp.PANTS,wide_leg:lp.PANTS},jumpsuits_and_rompers:{boiler_suits:lp.DRESSES,denim:lp.DRESSES,jumpsuits:lp.DRESSES,overalls:lp.DRESSES,rompers:lp.DRESSES,unitards:lp.DRESSES},pants_and_shorts:{cigarette:lp.PANTS,culottes:lp.SHORTS,denim_shorts:lp.SHORTS,flared:lp.PANTS,joggers:lp.PANTS,leggings:lp.PANTS,skinny:lp.PANTS,wide_leg:lp.PANTS},skirts:{a_line_flared:lp.SKIRTS,denim:lp.SKIRTS,knit:lp.SKIRTS,pencil:lp.SKIRTS,pleated:lp.SKIRTS,skater:lp.SKIRTS,slip:lp.SKIRTS,wrap:lp.SKIRTS},suits_and_tailoring:{blazers:lp.JACKETS,suit_jackets:lp.JACKETS,suit_skirts:lp.SKIRTS,suit_trousers:lp.PANTS,suit_vests:lp.SWEATERS,trousers:lp.PANTS},sweaters:{cardigans:lp.SWEATERS,crewnecks:lp.SWEATERS,hoodies_and_zipups:lp.SWEATERS,sweatshirts:lp.SWEATERS,turtlenecks:lp.SWEATERS,v_necks:lp.SWEATERS},tops:{bodysuits:lp.BLOUSES,corsets_and_bustiers:lp.BLOUSES,polos:lp.T_SHIRTS_AND_TANKS,shirts_and_blouses:lp.BLOUSES,t_shirts:lp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:lp.T_SHIRTS_AND_TANKS}};var pp;!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"}(pp||(pp={})),pp.TOO_TIGHT,pp.TIGHT,pp.SLIGHTLY_TIGHT,pp.PERFECT_FIT,pp.SLIGHTLY_LOOSE,pp.LOOSE,pp.OVERSIZED;class gp{static get endpoint(){return il.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class mp{constructor(t,e){this.brandId=t,this.firebase=e}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}onInit(){return this.firebase.onInit()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Zf;try{const r=await gp.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)===sp)throw new Yf;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await gp.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 tp;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t){var e;const n=await this.getColorwaySizeAssetFromSku(t),r=await this.getStyleCategory(n.style_id),s=(null===(e=fp[r.category])||void 0===e?void 0:e[r.sub_category])||null;return s?dp[s].map((t=>hp[t])):null}async getColorwaySizeAssets(t,e){const n=[qh("brand_id","==",this.brandId)];t&&n.push(qh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(qh("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return cp(t)}}async getStyleCategory(t){try{return await this.firebase.getDoc("style_categories",String(t))}catch(t){return cp(t)}}}const yp=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),il.getInstance().setEnv(e),new mp(t,new ap));var vp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(vp||(vp={}));var wp=Object.freeze({__proto__:null,get AvatarState(){return vp}});export{ip as Errors,yp as initShop,t as requests,e as responses,wp as types};
|
|
3167
|
+
const Wf=h("authIdTokenMaxAge")||300;let Gf=null;function $f(t=ht()){const e=it(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=it(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(g(n.getOptions(),null!=e?e:{}))return t;gl(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Hf,persistence:[rf,jd,qd]}),s=h("authTokenSyncURL");if(s){const t=(r=s,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Wf)return;const s=null==e?void 0:e.token;Gf!==s&&(Gf=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,s){I(t).onIdTokenChanged(e,n,s)}(n,(e=>t(e)))}var r;const i=u("auth");return i&&pd(n,`http://${i}`),n}var Qf;Qf="Browser",rt(new E("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),{apiKey:r,authDomain:i}=n.options;return((t,n)=>{vl(r&&!r.includes(":"),"invalid-api-key",{appName:t.name}),vl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const s={apiKey:r,authDomain:i,clientPlatform:Qf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ud(Qf)},o=new ld(t,n,s);return function(t,e){const n=(null==e?void 0:e.persistence)||[],s=(Array.isArray(n)?n:[n]).map(Il);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(s,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,s)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),rt(new E("auth-internal",(t=>(t=>new zf(t))(dd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),lt(qf,Kf,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Qf)),lt(qf,Kf,"esm2017");class Jf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Yf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Xf extends Error{constructor(){super("request timeout"),this.name="RequestTimeoutError"}}class Zf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class tp extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class ep extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}class np extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}class sp extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}const rp="avatar not created";var ip=Object.freeze({__proto__:null,AvatarNotCreatedError:Jf,NoFramesFoundError:Yf,RequestTimeoutError:Xf,UserNotLoggedInError:Zf,NoColorwaySizeAssetsFoundError:tp,NoStylesFoundError:ep,RecommendedAvailableSizesError:np,BrandUserIdNotSetError:sp,AvatarNotCreated:rp});class op{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=$f(e),this.auth.setPersistence(jd)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Zf;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Zf;return(await tl(dh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t,e){let n;const s=jh(lh(this.firestore,"users"),qh(new Sh("__name__"),"==",this.id)),r=setTimeout((()=>n()),e);return new Promise((e=>{n=sl(s,(async s=>{await t(s)&&(clearTimeout(r),n(),e(s.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Ud(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await Md(this.auth,t)}async confirmPasswordReset(t,e){await xd(this.auth,t,e)}}class ap{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((s=>{n=sl(t,(t=>{s(t),e&&n()}))})),unsubscribe:()=>n()}};const t=ut(il.getInstance().firebase);this.firestore=_h(t),this.user=new op(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const s=jh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(s,n)}getDocs(t,e){return nl(jh(lh(this.firestore,t),...e))}async getDoc(t,e){const n=dh(this.firestore,t,e),s=await tl(n);return s.exists()?s.data():null}}const cp=t=>{if(t.code===dl)throw new Error("account has been disabled");throw new Error(t.message)};var up;!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"}(up||(up={}));const hp={[up.ACROSS_BACK]:"Across back",[up.ACROSS_FRONT]:"Across front",[up.ACROSS_SHOULDER]:"Across shoulder",[up.ANKLE]:"Ankle",[up.ARMEYE]:"Armeye",[up.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[up.BACK_CROTCH_LENGTH]:"Back crotch length",[up.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[up.BELOW_KNEE]:"Below knee",[up.BICEP]:"Bicep",[up.BUST]:"Chest/Bust",[up.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[up.CALF]:"Calf",[up.CB_NECK_TO_WAIST]:"Cb neck to waist",[up.CB_NECK_TO_WRIST]:"Cb neck to wrist",[up.CF_NECK_TO_WAIST]:"Cf neck to waist",[up.ELBOW]:"Elbow",[up.FOREARM]:"Forearm",[up.FRONT_CROTCH_LENGTH]:"Front crotch length",[up.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[up.HIGH_HIP]:"High hip",[up.HSP_TO_ACROSS_BACK]:"Hsp to across back",[up.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[up.HSP_TO_BUST_POINT]:"Hsp to bust point",[up.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[up.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[up.INSEAM]:"Inseam",[up.KNEE]:"Knee",[up.LOW_HIP]:"Low hip",[up.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[up.MID_NECK]:"Mid neck",[up.NECK_AT_BASE]:"Neck at base",[up.SHOULDER_DROP]:"Shoulder drop",[up.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[up.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[up.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[up.THIGH]:"Thigh",[up.TOTAL_RISE_LENGTH]:"Total rise length",[up.UNDER_BUST]:"Under bust",[up.VERTICAL_TRUNK]:"Vertical trunk",[up.WAIST]:"Waist",[up.WRIST]:"Wrist"};var lp;!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"}(lp||(lp={}));const dp={[lp.BLOUSES]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.COATS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.DRESSES]:[up.LOW_HIP,up.BUST,up.ACROSS_SHOULDER,up.WAIST],[lp.JACKETS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.PANTS]:[up.LOW_HIP,up.WAIST,up.THIGH,up.INSEAM],[lp.PUFFERS_AND_PARKAS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.SHORTS]:[up.LOW_HIP,up.WAIST,up.THIGH,up.INSEAM],[lp.SKIRTS]:[up.LOW_HIP,up.WAIST],[lp.SWEATERS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.T_SHIRTS_AND_TANKS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP]},fp={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"},pp={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"},gp={activewear:{leggings:lp.PANTS,joggers:lp.PANTS,sweatshirts:lp.SWEATERS},dresses:{a_line:lp.DRESSES,bodycon:lp.DRESSES,fit_and_flare:lp.DRESSES,knit:lp.DRESSES,shirt:lp.DRESSES,slip:lp.DRESSES,straight:lp.DRESSES,wrap:lp.DRESSES},jackets_and_coats:{denim_jackets:lp.JACKETS,parkas:lp.PUFFERS_AND_PARKAS,peacoats:lp.COATS,puffer_jackets:lp.PUFFERS_AND_PARKAS,raincoats:lp.COATS,rompers:lp.COATS,shackets:lp.JACKETS,trench_coats:lp.COATS},jeans:{bootcut:lp.PANTS,flared:lp.PANTS,mom:lp.PANTS,relaxed:lp.PANTS,skinny:lp.PANTS,slim:lp.PANTS,straight:lp.PANTS,tapered:lp.PANTS,wide_leg:lp.PANTS},jumpsuits_and_rompers:{boiler_suits:lp.DRESSES,denim:lp.DRESSES,jumpsuits:lp.DRESSES,overalls:lp.DRESSES,rompers:lp.DRESSES,unitards:lp.DRESSES},pants_and_shorts:{cigarette:lp.PANTS,culottes:lp.SHORTS,denim_shorts:lp.SHORTS,flared:lp.PANTS,joggers:lp.PANTS,leggings:lp.PANTS,skinny:lp.PANTS,wide_leg:lp.PANTS},skirts:{a_line_flared:lp.SKIRTS,denim:lp.SKIRTS,knit:lp.SKIRTS,pencil:lp.SKIRTS,pleated:lp.SKIRTS,skater:lp.SKIRTS,slip:lp.SKIRTS,wrap:lp.SKIRTS},suits_and_tailoring:{blazers:lp.JACKETS,suit_jackets:lp.JACKETS,suit_skirts:lp.SKIRTS,suit_trousers:lp.PANTS,suit_vests:lp.SWEATERS,trousers:lp.PANTS},sweaters:{cardigans:lp.SWEATERS,crewnecks:lp.SWEATERS,hoodies_and_zipups:lp.SWEATERS,sweatshirts:lp.SWEATERS,turtlenecks:lp.SWEATERS,v_necks:lp.SWEATERS},tops:{bodysuits:lp.BLOUSES,corsets_and_bustiers:lp.BLOUSES,polos:lp.T_SHIRTS_AND_TANKS,shirts_and_blouses:lp.BLOUSES,t_shirts:lp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:lp.T_SHIRTS_AND_TANKS}};var mp;!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"}(mp||(mp={}));const yp={[mp.TOO_TIGHT]:"Too Tight",[mp.TIGHT]:"Tight",[mp.SLIGHTLY_TIGHT]:"Slightly Tight",[mp.PERFECT_FIT]:"Perfect Fit",[mp.SLIGHTLY_LOOSE]:"Slightly Loose",[mp.LOOSE]:"Loose",[mp.OVERSIZED]:"Oversized"};class vp{static get endpoint(){return il.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:s,useToken:r=!0}){const i=this.getUrl(e,r),o={method:n,headers:await this.getHeaders(t,r),credentials:"include"};s&&(o.body=JSON.stringify(s));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,s){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:s})}static Put(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:s})}static Patch(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:s})}static Delete(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:s})}}class wp{constructor(t,e){this.brandId=t,this.firebase=e}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}onInit(){return this.firebase.onInit()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Zf;try{const s=await vp.Get(this.user,`/styles/${t}/recommendation`),r=await s.json();return(null===(e=null==r?void 0:r.fits)||void 0===e?void 0:e.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(t){if((null==t?void 0:t.error)===rp)throw new Jf;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await vp.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 tp;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t){var e;const n=await this.getColorwaySizeAssetFromSku(t),s=await this.getStyleCategory(n.style_id),r=(null===(e=gp[s.category])||void 0===e?void 0:e[s.sub_category])||null;return r?dp[r].map((t=>hp[t])):null}async getColorwaySizeAssets(t,e){const n=[qh("brand_id","==",this.brandId)];t&&n.push(qh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(qh("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return cp(t)}}async getStyleCategory(t){try{return await this.firebase.getDoc("style_categories",String(t))}catch(t){return cp(t)}}}const _p=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),il.getInstance().setEnv(e),new wp(t,new ap));var Tp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Tp||(Tp={}));var Ip=Object.freeze({__proto__:null,get AvatarState(){return Tp},get MeasurementLocation(){return up},MeasurementLocationName:hp,get Classification(){return lp},ClassificationLocations:dp,CategoryNames:fp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:pp,Taxonomy:gp,get Fit(){return mp},FitNames:yp});export{ip as Errors,_p as initShop,t as requests,e as responses,Ip as types};
|
|
3168
3168
|
//# sourceMappingURL=index.min.js.map
|