@thefittingroom/shop-ui 1.5.9 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * thefittingroom v1.5.9 (2024-09-10T20:53:03.850Z)
2
+ * thefittingroom v2.0.1 (2024-10-23T16:46:33.229Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
- function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var i=new Image;i.onload=r,i.onerror=r,i.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const r=document.getElementById(t);if(!r)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const i=(null==t?void 0:t.length)-2;r.value=i.toString(),r.max=(t.length-1).toString();const s=()=>{const e=parseInt(r.value);n(r,t[e])};return n(r,t[i]),r.removeEventListener("input",s),r.addEventListener("input",s),()=>{r.removeEventListener("input",s)}}}},r=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(r(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],o=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==o||null==a||null==c)throw new s;const l=i<<2|o>>4;if(r.push(l),64!==a){const t=o<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};
5
+ function t(e,n){let i=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var r=new Image;r.onload=i,r.onerror=i,r.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const i=document.getElementById(t);if(!i)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const r=(null==t?void 0:t.length)-2;i.value=r.toString(),i.max=(t.length-1).toString();const s=()=>{const e=parseInt(i.value);n(i,t[e])};return n(i,t[r]),i.removeEventListener("input",s),i.addEventListener("input",s),()=>{i.removeEventListener("input",s)}}}},i=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++i)),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},r={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_,i=[];for(let e=0;e<t.length;e+=3){const r=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=r>>2,u=(3&r)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),i.push(n[l],n[u],n[h],n[d])}return i.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(i(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,i=0;for(;n<t.length;){const r=t[n++];if(r<128)e[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=t[n++];e[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[i++]=String.fromCharCode(55296+(s>>10)),e[i++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let e=0;e<t.length;){const r=n[t.charAt(e++)],o=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==r||null==o||null==a||null==c)throw new s;const l=r<<2|o>>4;if(i.push(l),64!==a){const t=o<<4&240|a>>2;if(i.push(t),64!==c){const t=a<<6&192|c;i.push(t)}}}return i},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)}}};
6
6
  /*!
7
7
  * thefittingroom v1.5.2 (2024-09-03T15:43:56.403Z)
8
8
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
@@ -38,7 +38,7 @@ function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var
38
38
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39
39
  * See the License for the specific language governing permissions and
40
40
  * limitations under the License.
41
- */class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const o=function(t){return function(t){const e=r(t);return i.encodeByteArray(e,!0)}(t).replace(/\./g,"")},a=function(t){try{return i.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
41
+ */class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const o=function(t){return function(t){const e=i(t);return r.encodeByteArray(e,!0)}(t).replace(/\./g,"")},a=function(t){try{return r.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
42
42
  /**
43
43
  * @license
44
44
  * Copyright 2022 Google LLC
@@ -105,7 +105,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
105
105
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
106
106
  * See the License for the specific language governing permissions and
107
107
  * limitations under the License.
108
- */function f(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class p extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,g.prototype.create)}}class g{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,i=this.errors[t],s=i?function(t,e){return t.replace(m,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`;return new p(r,o,n)}}const m=/\{\$([^}]+)}/g;function y(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const n=t[i],s=e[i];if(v(n)&&v(s)){if(!y(n,s))return!1}else if(n!==s)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function v(t){return null!==t&&"object"==typeof t}
108
+ */function f(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class p extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,g.prototype.create)}}class g{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},i=`${this.service}/${t}`,r=this.errors[t],s=r?function(t,e){return t.replace(m,((t,n)=>{const i=e[n];return null!=i?String(i):`<${n}?>`}))}(r,n):"Error",o=`${this.serviceName}: ${s} (${i}).`;return new p(i,o,n)}}const m=/\{\$([^}]+)}/g;function y(t,e){if(t===e)return!0;const n=Object.keys(t),i=Object.keys(e);for(const r of n){if(!i.includes(r))return!1;const n=t[r],s=e[r];if(v(n)&&v(s)){if(!y(n,s))return!1}else if(n!==s)return!1}for(const t of i)if(!n.includes(t))return!1;return!0}function v(t){return null!==t&&"object"==typeof t}
109
109
  /**
110
110
  * @license
111
111
  * Copyright 2017 Google LLC
@@ -121,7 +121,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
121
121
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122
122
  * See the License for the specific language governing permissions and
123
123
  * limitations under the License.
124
- */function w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function S(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 r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),i}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 E(){}
124
+ */function w(t){const e=[];for(const[n,i]of Object.entries(t))Array.isArray(i)?i.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,i]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(i)}})),e}function S(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class E{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 i;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");i=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===i.next&&(i.next=_),void 0===i.error&&(i.error=_),void 0===i.complete&&(i.complete=_);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(t){}})),this.observers.push(i),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 _(){}
125
125
  /**
126
126
  * @license
127
127
  * Copyright 2021 Google LLC
@@ -169,7 +169,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
169
169
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
170
170
  * See the License for the specific language governing permissions and
171
171
  * limitations under the License.
172
- */class C{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 d;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),r=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(r)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
172
+ */class C{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 d;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),i=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(i)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(i)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}
173
173
  /**
174
174
  * @license
175
175
  * Copyright 2019 Google LLC
@@ -185,7 +185,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
185
185
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
186
186
  * See the License for the specific language governing permissions and
187
187
  * limitations under the License.
188
- */(t))try{this.getOrInitializeService({instanceIdentifier:k})}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=k){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=k){return this.instances.has(t)}getOptions(t=k){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(r)}return r}onInit(t,e){var n;const r=this.normalizeInstanceIdentifier(e),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(t),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&t(s,r),()=>{i.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const r of n)try{r(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=t,r===k?void 0:r),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var r;return n||null}normalizeInstanceIdentifier(t=k){return this.component?this.component.multipleInstances?t:k: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 C(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
188
+ */(t))try{this.getOrInitializeService({instanceIdentifier:k})}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=k){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=k){return this.instances.has(t)}getOptions(t=k){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 i=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(i)}return i}onInit(t,e){var n;const i=this.normalizeInstanceIdentifier(e),r=null!==(n=this.onInitCallbacks.get(i))&&void 0!==n?n:new Set;r.add(t),this.onInitCallbacks.set(i,r);const s=this.instances.get(i);return s&&t(s,i),()=>{r.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const i of n)try{i(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:(i=t,i===k?void 0:i),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 i;return n||null}normalizeInstanceIdentifier(t=k){return this.component?this.component.multipleInstances?t:k: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 C(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
189
189
  /**
190
190
  * @license
191
191
  * Copyright 2017 Google LLC
@@ -201,7 +201,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
201
201
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
202
  * See the License for the specific language governing permissions and
203
203
  * limitations under the License.
204
- */var R;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(R||(R={}));const N={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},L=R.INFO,O={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=O[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};class P{constructor(t){this.name=t,this._logLevel=L,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in R))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,R.DEBUG,...t),this._logHandler(this,R.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,R.VERBOSE,...t),this._logHandler(this,R.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,R.INFO,...t),this._logHandler(this,R.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,R.WARN,...t),this._logHandler(this,R.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,R.ERROR,...t),this._logHandler(this,R.ERROR,...t)}}const x=(t,e)=>e.some((e=>t instanceof e));let M,U;const F=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return z.get(t);if("objectStoreNames"===e)return t.objectStoreNames||B.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return W(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function $(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(U||(U=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(K(this),e),W(F.get(this))}:function(...e){return W(t.apply(K(this),e))}:function(e,...n){const r=t.call(K(this),e,...n);return B.set(r,e.sort?e.sort():[e]),W(r)}}function q(t){return"function"==typeof t?$(t):(t instanceof IDBTransaction&&function(t){if(z.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",s),t.removeEventListener("abort",s)},i=()=>{e(),r()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",i),t.addEventListener("error",s),t.addEventListener("abort",s)}));z.set(t,e)}(t),x(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function W(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",i),t.removeEventListener("error",s)},i=()=>{e(W(t.result)),r()},s=()=>{n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",s)}));return e.then((e=>{e instanceof IDBCursor&&F.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(V.has(t))return V.get(t);const e=q(t);return e!==t&&(V.set(t,e),H.set(e,t)),e}const K=t=>H.get(t);const G=["get","getKey","getAll","getAllKeys","count"],Q=["put","add","delete","clear"],Y=new Map;function J(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Y.get(e))return Y.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=Q.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!G.includes(n))return;const s=async function(t,...e){const s=this.transaction(t,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),i&&s.done]))[0]};return Y.set(e,s),s}j=(t=>({...t,get:(e,n,r)=>J(e,n)||t.get(e,n,r),has:(e,n)=>!!J(e,n)||t.has(e,n)}))(j);
204
+ */var R;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(R||(R={}));const L={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},N=R.INFO,x={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},O=(t,e,...n)=>{if(e<t.logLevel)return;const i=(new Date).toISOString(),r=x[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${i}] ${t.name}:`,...n)};class D{constructor(t){this.name=t,this._logLevel=N,this._logHandler=O,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in R))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?L[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,R.DEBUG,...t),this._logHandler(this,R.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,R.VERBOSE,...t),this._logHandler(this,R.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,R.INFO,...t),this._logHandler(this,R.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,R.WARN,...t),this._logHandler(this,R.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,R.ERROR,...t),this._logHandler(this,R.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,F;const U=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return z.get(t);if("objectStoreNames"===e)return t.objectStoreNames||B.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function q(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(F||(F=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(W(this),e),K(U.get(this))}:function(...e){return K(t.apply(W(this),e))}:function(e,...n){const i=t.call(W(this),e,...n);return B.set(i,e.sort?e.sort():[e]),K(i)}}function $(t){return"function"==typeof t?q(t):(t instanceof IDBTransaction&&function(t){if(z.has(t))return;const e=new Promise(((e,n)=>{const i=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",s),t.removeEventListener("abort",s)},r=()=>{e(),i()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",r),t.addEventListener("error",s),t.addEventListener("abort",s)}));z.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function K(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const i=()=>{t.removeEventListener("success",r),t.removeEventListener("error",s)},r=()=>{e(K(t.result)),i()},s=()=>{n(t.error),i()};t.addEventListener("success",r),t.addEventListener("error",s)}));return e.then((e=>{e instanceof IDBCursor&&U.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(V.has(t))return V.get(t);const e=$(t);return e!==t&&(V.set(t,e),H.set(e,t)),e}const W=t=>H.get(t);const G=["get","getKey","getAll","getAllKeys","count"],Q=["put","add","delete","clear"],Y=new Map;function J(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Y.get(e))return Y.get(e);const n=e.replace(/FromIndex$/,""),i=e!==n,r=Q.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!G.includes(n))return;const s=async function(t,...e){const s=this.transaction(t,r?"readwrite":"readonly");let o=s.store;return i&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),r&&s.done]))[0]};return Y.set(e,s),s}j=(t=>({...t,get:(e,n,i)=>J(e,n)||t.get(e,n,i),has:(e,n)=>!!J(e,n)||t.has(e,n)}))(j);
205
205
  /**
206
206
  * @license
207
207
  * Copyright 2019 Google LLC
@@ -218,7 +218,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
218
218
  * See the License for the specific language governing permissions and
219
219
  * limitations under the License.
220
220
  */
221
- class X{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 Z="@firebase/app",tt="0.10.9",et=new P("@firebase/app"),nt="@firebase/app-compat",rt="@firebase/analytics-compat",it="@firebase/analytics",st="@firebase/app-check-compat",ot="@firebase/app-check",at="@firebase/auth",ct="@firebase/auth-compat",lt="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",dt="@firebase/functions-compat",ft="@firebase/installations",pt="@firebase/installations-compat",gt="@firebase/messaging",mt="@firebase/messaging-compat",yt="@firebase/performance",vt="@firebase/performance-compat",wt="@firebase/remote-config",bt="@firebase/remote-config-compat",St="@firebase/storage",_t="@firebase/storage-compat",Et="@firebase/firestore",Tt="@firebase/vertexai-preview",It="@firebase/firestore-compat",kt="firebase",Ct="[DEFAULT]",At={[Z]:"fire-core",[nt]:"fire-core-compat",[it]:"fire-analytics",[rt]:"fire-analytics-compat",[ot]:"fire-app-check",[st]:"fire-app-check-compat",[at]:"fire-auth",[ct]:"fire-auth-compat",[lt]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[dt]:"fire-fn-compat",[ft]:"fire-iid",[pt]:"fire-iid-compat",[gt]:"fire-fcm",[mt]:"fire-fcm-compat",[yt]:"fire-perf",[vt]:"fire-perf-compat",[wt]:"fire-rc",[bt]:"fire-rc-compat",[St]:"fire-gcs",[_t]:"fire-gcs-compat",[Et]:"fire-fst",[It]:"fire-fst-compat",[Tt]:"fire-vertex","fire-js":"fire-js",[kt]:"fire-js-all"},Rt=new Map,Nt=new Map,Lt=new Map;function Ot(t,e){try{t.container.addComponent(e)}catch(n){et.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Dt(t){const e=t.name;if(Lt.has(e))return et.debug(`There were multiple attempts to register component ${e}.`),!1;Lt.set(e,t);for(const e of Rt.values())Ot(e,t);for(const e of Nt.values())Ot(e,t);return!0}function Pt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function xt(t){return void 0!==t.settings}
221
+ class X{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 Z="@firebase/app",tt="0.10.9",et=new D("@firebase/app"),nt="@firebase/app-compat",it="@firebase/analytics-compat",rt="@firebase/analytics",st="@firebase/app-check-compat",ot="@firebase/app-check",at="@firebase/auth",ct="@firebase/auth-compat",lt="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",dt="@firebase/functions-compat",ft="@firebase/installations",pt="@firebase/installations-compat",gt="@firebase/messaging",mt="@firebase/messaging-compat",yt="@firebase/performance",vt="@firebase/performance-compat",wt="@firebase/remote-config",bt="@firebase/remote-config-compat",St="@firebase/storage",Et="@firebase/storage-compat",_t="@firebase/firestore",Tt="@firebase/vertexai-preview",It="@firebase/firestore-compat",kt="firebase",Ct="[DEFAULT]",At={[Z]:"fire-core",[nt]:"fire-core-compat",[rt]:"fire-analytics",[it]:"fire-analytics-compat",[ot]:"fire-app-check",[st]:"fire-app-check-compat",[at]:"fire-auth",[ct]:"fire-auth-compat",[lt]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[dt]:"fire-fn-compat",[ft]:"fire-iid",[pt]:"fire-iid-compat",[gt]:"fire-fcm",[mt]:"fire-fcm-compat",[yt]:"fire-perf",[vt]:"fire-perf-compat",[wt]:"fire-rc",[bt]:"fire-rc-compat",[St]:"fire-gcs",[Et]:"fire-gcs-compat",[_t]:"fire-fst",[It]:"fire-fst-compat",[Tt]:"fire-vertex","fire-js":"fire-js",[kt]:"fire-js-all"},Rt=new Map,Lt=new Map,Nt=new Map;function xt(t,e){try{t.container.addComponent(e)}catch(n){et.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Ot(t){const e=t.name;if(Nt.has(e))return et.debug(`There were multiple attempts to register component ${e}.`),!1;Nt.set(e,t);for(const e of Rt.values())xt(e,t);for(const e of Lt.values())xt(e,t);return!0}function Dt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Pt(t){return void 0!==t.settings}
222
222
  /**
223
223
  * @license
224
224
  * Copyright 2019 Google LLC
@@ -251,7 +251,7 @@ class X{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
251
251
  * See the License for the specific language governing permissions and
252
252
  * limitations under the License.
253
253
  */
254
- class Ut{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new I("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Mt.create("app-deleted",{appName:this._name})}}
254
+ class Ft{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new I("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Mt.create("app-deleted",{appName:this._name})}}
255
255
  /**
256
256
  * @license
257
257
  * Copyright 2019 Google LLC
@@ -267,7 +267,7 @@ class Ut{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
267
267
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
268
268
  * See the License for the specific language governing permissions and
269
269
  * limitations under the License.
270
- */const Ft="10.13.0";function zt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:Ct,automaticDataCollectionEnabled:!1},e),i=r.name;if("string"!=typeof i||!i)throw Mt.create("bad-app-name",{appName:String(i)});if(n||(n=u()),!n)throw Mt.create("no-options");const s=Rt.get(i);if(s){if(y(n,s.options)&&y(r,s.config))return s;throw Mt.create("duplicate-app",{appName:i})}const o=new A(i);for(const t of Lt.values())o.addComponent(t);const a=new Ut(n,r,o);return Rt.set(i,a),a}function Bt(t=Ct){const e=Rt.get(t);if(!e&&t===Ct&&u())return zt();if(!e)throw Mt.create("no-app",{appName:t});return e}function Vt(t,e,n){var r;let i=null!==(r=At[t])&&void 0!==r?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const t=[`Unable to register library "${i}" with version "${e}":`];return s&&t.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void et.warn(t.join(" "))}Dt(new I(`${i}-version`,(()=>({library:i,version:e})),"VERSION"))}
270
+ */const Ut="10.13.0";function zt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const i=Object.assign({name:Ct,automaticDataCollectionEnabled:!1},e),r=i.name;if("string"!=typeof r||!r)throw Mt.create("bad-app-name",{appName:String(r)});if(n||(n=u()),!n)throw Mt.create("no-options");const s=Rt.get(r);if(s){if(y(n,s.options)&&y(i,s.config))return s;throw Mt.create("duplicate-app",{appName:r})}const o=new A(r);for(const t of Nt.values())o.addComponent(t);const a=new Ft(n,i,o);return Rt.set(r,a),a}function Bt(t=Ct){const e=Rt.get(t);if(!e&&t===Ct&&u())return zt();if(!e)throw Mt.create("no-app",{appName:t});return e}function Vt(t,e,n){var i;let r=null!==(i=At[t])&&void 0!==i?i:t;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const t=[`Unable to register library "${r}" with version "${e}":`];return s&&t.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void et.warn(t.join(" "))}Ot(new I(`${r}-version`,(()=>({library:r,version:e})),"VERSION"))}
271
271
  /**
272
272
  * @license
273
273
  * Copyright 2021 Google LLC
@@ -283,7 +283,7 @@ class Ut{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
283
283
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
284
284
  * See the License for the specific language governing permissions and
285
285
  * limitations under the License.
286
- */const Ht="firebase-heartbeat-database",jt=1,$t="firebase-heartbeat-store";let qt=null;function Wt(){return qt||(qt=function(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=W(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(W(o.result),t.oldVersion,t.newVersion,W(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{s&&t.addEventListener("close",(()=>s())),i&&t.addEventListener("versionchange",(t=>i(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ht,jt,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore($t)}catch(t){console.warn(t)}}}).catch((t=>{throw Mt.create("idb-open",{originalErrorMessage:t.message})}))),qt}async function Kt(t,e){try{const n=(await Wt()).transaction($t,"readwrite"),r=n.objectStore($t);await r.put(e,Gt(t)),await n.done}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Mt.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}function Gt(t){return`${t.name}!${t.options.appId}`}
286
+ */const Ht="firebase-heartbeat-database",jt=1,qt="firebase-heartbeat-store";let $t=null;function Kt(){return $t||($t=function(t,e,{blocked:n,upgrade:i,blocking:r,terminated:s}={}){const o=indexedDB.open(t,e),a=K(o);return i&&o.addEventListener("upgradeneeded",(t=>{i(K(o.result),t.oldVersion,t.newVersion,K(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{s&&t.addEventListener("close",(()=>s())),r&&t.addEventListener("versionchange",(t=>r(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ht,jt,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore(qt)}catch(t){console.warn(t)}}}).catch((t=>{throw Mt.create("idb-open",{originalErrorMessage:t.message})}))),$t}async function Wt(t,e){try{const n=(await Kt()).transaction(qt,"readwrite"),i=n.objectStore(qt);await i.put(e,Gt(t)),await n.done}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Mt.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}function Gt(t){return`${t.name}!${t.options.appId}`}
287
287
  /**
288
288
  * @license
289
289
  * Copyright 2021 Google LLC
@@ -299,7 +299,7 @@ class Ut{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
299
299
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
300
300
  * See the License for the specific language governing permissions and
301
301
  * limitations under the License.
302
- */class Qt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Jt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){var t,e,n;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Yt();if(console.log("heartbeats",null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats),null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some((t=>t.date===i)))return;return this._heartbeatsCache.heartbeats.push({date:i,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(t){et.warn(t)}}async getHeartbeatsHeader(){var t;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const e=Yt(),{heartbeatsToSend:n,unsentEntries:r}=function(t,e=1024){const n=[];let r=t.slice();for(const i of t){const t=n.find((t=>t.agent===i.agent));if(t){if(t.dates.push(i.date),Xt(n)>e){t.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Xt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=o(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return et.warn(t),""}}}function Yt(){return(new Date).toISOString().substring(0,10)}class Jt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await Wt()).transaction($t),n=await e.objectStore($t).get(Gt(t));return await e.done,n}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Mt.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}(this.app);return(null==t?void 0:t.heartbeats)?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Kt(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 Kt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Xt(t){return o(JSON.stringify({version:2,heartbeats:t})).length}
302
+ */class Qt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Jt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){var t,e,n;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=Yt();if(console.log("heartbeats",null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats),null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some((t=>t.date===r)))return;return this._heartbeatsCache.heartbeats.push({date:r,agent:i}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(t){et.warn(t)}}async getHeartbeatsHeader(){var t;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const e=Yt(),{heartbeatsToSend:n,unsentEntries:i}=function(t,e=1024){const n=[];let i=t.slice();for(const r of t){const t=n.find((t=>t.agent===r.agent));if(t){if(t.dates.push(r.date),Xt(n)>e){t.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),Xt(n)>e){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),r=o(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(t){return et.warn(t),""}}}function Yt(){return(new Date).toISOString().substring(0,10)}class Jt{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 i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),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){const t=await async function(t){try{const e=(await Kt()).transaction(qt),n=await e.objectStore(qt).get(Gt(t));return await e.done,n}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Mt.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}(this.app);return(null==t?void 0:t.heartbeats)?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Xt(t){return o(JSON.stringify({version:2,heartbeats:t})).length}
303
303
  /**
304
304
  * @license
305
305
  * Copyright 2019 Google LLC
@@ -315,7 +315,7 @@ class Ut{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
315
315
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
316
316
  * See the License for the specific language governing permissions and
317
317
  * limitations under the License.
318
- */var Zt;Zt="",Dt(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Dt(new I("heartbeat",(t=>new Qt(t)),"PRIVATE")),Vt(Z,tt,Zt),Vt(Z,tt,"esm2017"),Vt("fire-js","");
318
+ */var Zt;Zt="",Ot(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Ot(new I("heartbeat",(t=>new Qt(t)),"PRIVATE")),Vt(Z,tt,Zt),Vt(Z,tt,"esm2017"),Vt("fire-js","");
319
319
  /**
320
320
  * @license
321
321
  * Copyright 2017 Google LLC
@@ -348,7 +348,7 @@ class Ut{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
348
348
  * See the License for the specific language governing permissions and
349
349
  * limitations under the License.
350
350
  */
351
- const te=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},ee={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(te(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],s=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==i||null==s||null==o||null==a)throw Error();const c=i<<2|s>>4;if(r.push(c),64!==o){const t=s<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},ne=function(t){return function(t){const e=te(t);return ee.encodeByteArray(e,!0)}(t).replace(/\./g,"")};
351
+ const te=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let r=t.charCodeAt(i);r<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&t.charCodeAt(++i)),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},ee={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_,i=[];for(let e=0;e<t.length;e+=3){const r=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=r>>2,u=(3&r)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),i.push(n[l],n[u],n[h],n[d])}return i.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(te(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,i=0;for(;n<t.length;){const r=t[n++];if(r<128)e[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=t[n++];e[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[i++]=String.fromCharCode(55296+(s>>10)),e[i++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let e=0;e<t.length;){const r=n[t.charAt(e++)],s=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==s||null==o||null==a)throw Error();const c=r<<2|s>>4;if(i.push(c),64!==o){const t=s<<4&240|o>>2;if(i.push(t),64!==a){const t=o<<6&192|a;i.push(t)}}}return i},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)}}},ne=function(t){return function(t){const e=te(t);return ee.encodeByteArray(e,!0)}(t).replace(/\./g,"")};
352
352
  /**
353
353
  * @license
354
354
  * Copyright 2022 Google LLC
@@ -365,7 +365,7 @@ const te=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.char
365
365
  * See the License for the specific language governing permissions and
366
366
  * limitations under the License.
367
367
  */
368
- const re=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,ie=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return ee.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},se=()=>{try{return re()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||ie()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},oe=t=>{const e=(t=>{var e,n;return null===(n=null===(e=se())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]};class ae extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,ae.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ce.prototype.create)}}class ce{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,i=this.errors[t],s=i?function(t,e){return t.replace(le,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`;return new ae(r,o,n)}}const le=/\{\$([^}]+)}/g;
368
+ const ie=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,re=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return ee.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},se=()=>{try{return ie()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||re()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},oe=t=>{const e=(t=>{var e,n;return null===(n=null===(e=se())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const i=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),i]:[e.substring(0,n),i]};class ae extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,ae.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ce.prototype.create)}}class ce{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},i=`${this.service}/${t}`,r=this.errors[t],s=r?function(t,e){return t.replace(le,((t,n)=>{const i=e[n];return null!=i?String(i):`<${n}?>`}))}(r,n):"Error",o=`${this.serviceName}: ${s} (${i}).`;return new ae(i,o,n)}}const le=/\{\$([^}]+)}/g;
369
369
  /**
370
370
  * @license
371
371
  * Copyright 2021 Google LLC
@@ -397,7 +397,7 @@ const re=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
397
397
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
398
398
  * See the License for the specific language governing permissions and
399
399
  * limitations under the License.
400
- */var de;!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"}(de||(de={}));const fe={debug:de.DEBUG,verbose:de.VERBOSE,info:de.INFO,warn:de.WARN,error:de.ERROR,silent:de.SILENT},pe=de.INFO,ge={[de.DEBUG]:"log",[de.VERBOSE]:"log",[de.INFO]:"info",[de.WARN]:"warn",[de.ERROR]:"error"},me=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=ge[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};var ye=function(t,e){return ye=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])},ye(t,e)};function ve(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 we(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var be,Se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_e=_e||{},Ee=Se||self;function Te(){}function Ie(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function ke(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ce="closure_uid_"+(1e9*Math.random()>>>0),Ae=0;function Re(t,e,n){return t.call.apply(t.bind,arguments)}function Ne(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Le(t,e,n){return(Le=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Re:Ne).apply(null,arguments)}function Oe(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function De(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function Pe(){this.s=this.s,this.o=this.o}Pe.prototype.s=!1,Pe.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ce)&&t[Ce]||(t[Ce]=++Ae))},Pe.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var xe=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function Ue(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Ie(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function Fe(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Fe.prototype.h=function(){this.defaultPrevented=!0};var ze=function(){if(!Ee.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Ee.addEventListener("test",Te,e),Ee.removeEventListener("test",Te,e)}catch(t){}return t}();function Be(t){return/^[\s\xa0]*$/.test(t)}var Ve=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function He(t,e){return t<e?-1:t>e?1:0}function je(){var t=Ee.navigator;return t&&(t=t.userAgent)?t:""}function $e(t){return-1!=je().indexOf(t)}function qe(t){return qe[" "](t),t}qe[" "]=Te;var We,Ke,Ge=$e("Opera"),Qe=$e("Trident")||$e("MSIE"),Ye=$e("Edge"),Je=Ye||Qe,Xe=$e("Gecko")&&!(-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge"))&&!($e("Trident")||$e("MSIE"))&&!$e("Edge"),Ze=-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge");function tn(){var t=Ee.document;return t?t.documentMode:void 0}t:{var en="",nn=(Ke=je(),Xe?/rv:([^\);]+)(\)|;)/.exec(Ke):Ye?/Edge\/([\d\.]+)/.exec(Ke):Qe?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ke):Ze?/WebKit\/(\S+)/.exec(Ke):Ge?/(?:Version)[ \/]?(\S+)/.exec(Ke):void 0);if(nn&&(en=nn?nn[1]:""),Qe){var rn=tn();if(null!=rn&&rn>parseFloat(en)){We=String(rn);break t}}We=en}var sn,on={};function an(){return function(t){var e=on;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Ve(String(We)).split("."),n=Ve("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=He(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||He(0==s[2].length,0==o[2].length)||He(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(Ee.document&&Qe){var cn=tn();sn=cn||(parseInt(We,10)||void 0)}else sn=void 0;var ln=sn;function un(t,e){if(Fe.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(Xe){t:{try{qe(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:hn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&un.X.h.call(this)}}De(un,Fe);var hn={2:"touch",3:"pen",4:"mouse"};un.prototype.h=function(){un.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var dn="closure_listenable_"+(1e6*Math.random()|0),fn=0;function pn(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++fn,this.ba=this.ea=!1}function gn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function mn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function yn(t){var e={};for(var n in t)e[n]=t[n];return e}var vn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function wn(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<vn.length;s++)n=vn[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function bn(t){this.src=t,this.g={},this.h=0}function Sn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=xe(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(gn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function _n(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}bn.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=_n(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new pn(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var En="closure_lm_"+(1e6*Math.random()|0),Tn={};function In(t,e,n,r,i){if(r&&r.once)return Cn(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)In(t,e[s],n,r,i);return null}return n=Pn(n),t&&t[dn]?t.N(e,n,ke(r)?!!r.capture:!!r,i):kn(t,e,n,!1,r,i)}function kn(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=ke(i)?!!i.capture:!!i,a=On(t);if(a||(t[En]=a=new bn(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Ln;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)ze||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Nn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Cn(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Cn(t,e[s],n,r,i);return null}return n=Pn(n),t&&t[dn]?t.O(e,n,ke(r)?!!r.capture:!!r,i):kn(t,e,n,!0,r,i)}function An(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)An(t,e[s],n,r,i);else r=ke(r)?!!r.capture:!!r,n=Pn(n),t&&t[dn]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=_n(s=t.g[e],n,r,i))&&(gn(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=On(t))&&(e=t.g[e.toString()],t=-1,e&&(t=_n(e,n,r,i)),(n=-1<t?e[t]:null)&&Rn(n))}function Rn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[dn])Sn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Nn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=On(e))?(Sn(n,t),0==n.h&&(n.src=null,e[En]=null)):gn(t)}}}function Nn(t){return t in Tn?Tn[t]:Tn[t]="on"+t}function Ln(t,e){if(t.ba)t=!0;else{e=new un(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&Rn(t),t=n.call(r,e)}return t}function On(t){return(t=t[En])instanceof bn?t:null}var Dn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Pn(t){return"function"==typeof t?t:(t[Dn]||(t[Dn]=function(e){return t.handleEvent(e)}),t[Dn])}function xn(){Pe.call(this),this.i=new bn(this),this.P=this,this.I=null}function Mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Fe(e,t);else if(e instanceof Fe)e.target=e.target||t;else{var i=e;wn(e=new Fe(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=Un(o,r,!0,e)&&i}if(i=Un(o=e.g=t,r,!0,e)&&i,i=Un(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=Un(o=e.g=n[s],r,!1,e)&&i}function Un(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&Sn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}De(xn,Pe),xn.prototype[dn]=!0,xn.prototype.removeEventListener=function(t,e,n,r){An(this,t,e,n,r)},xn.prototype.M=function(){if(xn.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++)gn(n[r]);delete e.g[t],e.h--}}this.I=null},xn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},xn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Fn=Ee.JSON.stringify;function zn(){var t=Kn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Bn,Vn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Hn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Hn=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new jn}),(function(t){return t.reset()})),jn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function $n(t){Ee.setTimeout((function(){throw t}),0)}function qn(t,e){Bn||function(){var t=Ee.Promise.resolve(void 0);Bn=function(){t.then(Gn)}}(),Wn||(Bn(),Wn=!0),Kn.add(t,e)}var Wn=!1,Kn=new Vn;function Gn(){for(var t;t=zn();){try{t.h.call(t.g)}catch(t){$n(t)}var e=Hn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Wn=!1}function Qn(t,e){xn.call(this),this.h=t||1,this.g=e||Ee,this.j=Le(this.lb,this),this.l=Date.now()}function Yn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Jn(t,e,n){if("function"==typeof t)n&&(t=Le(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Le(t.handleEvent,t)}return 2147483647<Number(e)?-1:Ee.setTimeout(t,e||0)}function Xn(t){t.g=Jn((function(){t.g=null,t.i&&(t.i=!1,Xn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}De(Qn,xn),(be=Qn.prototype).ca=!1,be.R=null,be.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Mn(this,"tick"),this.ca&&(Yn(this),this.start()))}},be.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},be.M=function(){Qn.X.M.call(this),Yn(this),delete this.g};var Zn=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}ye(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:Xn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(Ee.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Pe);function tr(t){Pe.call(this),this.h=t,this.g={}}De(tr,Pe);var er=[];function nr(t,e,n,r){Array.isArray(n)||(n&&(er[0]=n.toString()),n=er);for(var i=0;i<n.length;i++){var s=In(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function rr(t){mn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Rn(t)}),t),t.g={}}function ir(){this.g=!0}function sr(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return Fn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}tr.prototype.M=function(){tr.X.M.call(this),rr(this)},tr.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},ir.prototype.Aa=function(){this.g=!1},ir.prototype.info=function(){};var or={},ar=null;function cr(){return ar=ar||new xn}function lr(t){Fe.call(this,or.Pa,t)}function ur(t){var e=cr();Mn(e,new lr(e))}function hr(t,e){Fe.call(this,or.STAT_EVENT,t),this.stat=e}function dr(t){var e=cr();Mn(e,new hr(e,t))}function fr(t,e){Fe.call(this,or.Qa,t),this.size=e}function pr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return Ee.setTimeout((function(){t()}),e)}or.Pa="serverreachability",De(lr,Fe),or.STAT_EVENT="statevent",De(hr,Fe),or.Qa="timingevent",De(fr,Fe);var gr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},mr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function yr(){}function vr(t){return t.h||(t.h=t.i())}function wr(){}yr.prototype.h=null;var br,Sr={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function _r(){Fe.call(this,"d")}function Er(){Fe.call(this,"c")}function Tr(){}function Ir(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new tr(this),this.O=Cr,t=Je?125:void 0,this.T=new Qn(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 kr}function kr(){this.i=null,this.g="",this.h=!1}De(_r,Fe),De(Er,Fe),De(Tr,yr),Tr.prototype.g=function(){return new XMLHttpRequest},Tr.prototype.i=function(){return{}},br=new Tr;var Cr=45e3,Ar={},Rr={};function Nr(t,e,n){t.K=1,t.v=Qr($r(e)),t.s=n,t.P=!0,Lr(t,null)}function Lr(t,e){t.F=Date.now(),xr(t),t.A=$r(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),ci(n.i,"t",r),t.C=0,n=t.l.H,t.h=new kr,t.g=cs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Zn(Le(t.La,t,t.g),t.N)),nr(t.S,t.g,"readystatechange",t.ib),e=t.H?yn(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),ur(),function(t,e,n,r,i,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Or(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Dr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=Pr(t,n))==Rr){4==e&&(t.o=4,dr(14),i=!1),sr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ar){t.o=4,dr(15),sr(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}sr(t.j,t.m,r,null),Br(t,r)}Or(t)&&r!=Rr&&r!=Ar&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,dr(16),i=!1),t.i=t.i&&i,i?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),ts(e),e.K=!0,dr(11))):(sr(t.j,t.m,n,"[Invalid Chunked Response]"),zr(t),Fr(t))}function Pr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?Rr:(n=Number(e.substring(n,r)),isNaN(n)?Ar:(r+=1)+n>e.length?Rr:(e=e.substr(r,n),t.C=r+n,e))}function xr(t){t.V=Date.now()+t.O,Mr(t,t.O)}function Mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=pr(Le(t.gb,t),e)}function Ur(t){t.B&&(Ee.clearTimeout(t.B),t.B=null)}function Fr(t){0==t.l.G||t.I||rs(t.l,t)}function zr(t){Ur(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Yn(t.T),rr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Br(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||gi(n.h,t)))if(!t.J&&gi(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ns(n),Wi(n)}Zi(n),dr(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=pr(Le(n.cb,n),6e3));if(1>=pi(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else ss(n,11)}else if((t.J||n.g==t)&&ns(n),!Be(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(mi(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Gr(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=as(r,r.H?r.ka:null,r.V),f.J){yi(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(Ur(p),xr(p)),r.g=f}else Xi(r);0<n.i.length&&Gi(n)}else"stop"!=s[0]&&"close"!=s[0]||ss(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?ss(n,7):qi(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}ur()}catch(s){}}function Vr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Ie(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Ie(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Ie(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(be=Ir.prototype).setTimeout=function(t){this.O=t},be.ib=function(t){t=t.target;var e=this.L;e&&3==zi(t)?e.l():this.La(t)},be.La=function(t){try{if(t==this.g)t:{var e=zi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Je||this.g&&(this.h.h||this.g.fa()||Bi(this.g)))){this.I||4!=e||7==n||ur(),Ur(this);var r=this.g.aa();this.Y=r;e:if(Or(this)){var i=Bi(this.g);t="";var s=i.length,o=4==zi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){zr(this),Fr(this);var a="";break e}this.h.i=new Ee.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),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,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+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,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Be(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,dr(12),zr(this),Fr(this);break t}sr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Br(this,r)}this.P?(Dr(this,e,a),Je&&this.i&&3==e&&(nr(this.S,this.T,"tick",this.hb),this.T.start())):(sr(this.j,this.m,a,null),Br(this,a)),4==e&&zr(this),this.i&&!this.I&&(4==e?rs(this.l,this):(this.i=!1,xr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,dr(12)):(this.o=0,dr(13)),zr(this),Fr(this)}}}catch(e){}},be.hb=function(){if(this.g){var t=zi(this.g),e=this.g.fa();this.C<e.length&&(Ur(this),Dr(this,t,e),this.i&&4!=t&&xr(this))}},be.cancel=function(){this.I=!0,zr(this)},be.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(ur(),dr(17)),zr(this),this.o=2,Fr(this)):Mr(this,this.V-t)};var Hr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function jr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof jr){this.h=void 0!==e?e:t.h,qr(this,t.j),this.s=t.s,this.g=t.g,Wr(this,t.m),this.l=t.l,e=t.i;var n=new ii;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Kr(this,n),this.o=t.o}else t&&(n=String(t).match(Hr))?(this.h=!!e,qr(this,n[1]||"",!0),this.s=Yr(n[2]||""),this.g=Yr(n[3]||"",!0),Wr(this,n[4]),this.l=Yr(n[5]||"",!0),Kr(this,n[6]||"",!0),this.o=Yr(n[7]||"")):(this.h=!!e,this.i=new ii(null,this.h))}function $r(t){return new jr(t)}function qr(t,e,n){t.j=n?Yr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Wr(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 Kr(t,e,n){e instanceof ii?(t.i=e,function(t,e){e&&!t.j&&(si(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(oi(this,e),ci(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Jr(e,ni)),t.i=new ii(e,t.h))}function Gr(t,e,n){t.i.set(e,n)}function Qr(t){return Gr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Yr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Jr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Xr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Xr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}jr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Jr(e,Zr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Jr(e,Zr,!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(Jr(n,"/"==n.charAt(0)?ei:ti,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Jr(n,ri)),t.join("")};var Zr=/[#\/\?@]/g,ti=/[#\?:]/g,ei=/[#\?]/g,ni=/[#\?@]/g,ri=/#/g;function ii(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function si(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("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function oi(t,e){si(t),e=li(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ai(t,e){return si(t),e=li(t,e),t.g.has(e)}function ci(t,e,n){oi(t,e),0<n.length&&(t.i=null,t.g.set(li(t,e),Me(n)),t.h+=n.length)}function li(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(be=ii.prototype).add=function(t,e){si(this),this.i=null,t=li(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},be.forEach=function(t,e){si(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},be.oa=function(){si(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},be.W=function(t){si(this);var e=[];if("string"==typeof t)ai(this,t)&&(e=e.concat(this.g.get(li(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},be.set=function(t,e){return si(this),this.i=null,ai(this,t=li(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},be.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},be.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],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var ui=function(t,e){this.h=t,this.g=e};function hi(t){this.l=t||di,Ee.PerformanceNavigationTiming?t=0<(t=Ee.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(Ee.g&&Ee.g.Ga&&Ee.g.Ga()&&Ee.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var di=10;function fi(t){return!!t.h||!!t.g&&t.g.size>=t.j}function pi(t){return t.h?1:t.g?t.g.size:0}function gi(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function mi(t,e){t.g?t.g.add(e):t.h=e}function yi(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function vi(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 i=ve(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return Me(t.i)}function wi(){}function bi(){this.g=new wi}function Si(t,e,n){var r=n||"";try{Vr(t,(function(t,n){var i=t;ke(t)&&(i=Fn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function _i(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function Ei(t){this.l=t.ac||null,this.j=t.jb||!1}function Ti(t,e){xn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Ii,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}hi.prototype.cancel=function(){var t,e;if(this.i=vi(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ve(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()}},wi.prototype.stringify=function(t){return Ee.JSON.stringify(t,void 0)},wi.prototype.parse=function(t){return Ee.JSON.parse(t,void 0)},De(Ei,yr),Ei.prototype.g=function(){return new Ti(this.l,this.j)},Ei.prototype.i=function(t){return function(){return t}}({}),De(Ti,xn);var Ii=0;function ki(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ci(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ai(t)}function Ai(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(be=Ti.prototype).open=function(t,e){if(this.readyState!=Ii)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ai(this)},be.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||Ee).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},be.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,Ci(this)),this.readyState=Ii},be.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,Ai(this)),this.g&&(this.readyState=3,Ai(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==Ee.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;ki(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},be.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?Ci(this):Ai(this),3==this.readyState&&ki(this)}},be.Va=function(t){this.g&&(this.response=this.responseText=t,Ci(this))},be.Ua=function(t){this.g&&(this.response=t,Ci(this))},be.ga=function(){this.g&&Ci(this)},be.setRequestHeader=function(t,e){this.v.append(t,e)},be.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},be.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(Ti.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Ri=Ee.JSON.parse;function Ni(t){xn.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=Li,this.K=this.L=!1}De(Ni,xn);var Li="",Oi=/^https?$/i,Di=["POST","PUT"];function Pi(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,xi(t),Ui(t)}function xi(t){t.D||(t.D=!0,Mn(t,"complete"),Mn(t,"error"))}function Mi(t){if(t.h&&void 0!==_e&&(!t.C[1]||4!=zi(t)||2!=t.aa()))if(t.v&&4==zi(t))Jn(t.Ha,0,t);else if(Mn(t,"readystatechange"),4==zi(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 i;if(i=0===n){var s=String(t.H).match(Hr)[1]||null;if(!s&&Ee.self&&Ee.self.location){var o=Ee.self.location.protocol;s=o.substr(0,o.length-1)}i=!Oi.test(s?s.toLowerCase():"")}e=i}if(e)Mn(t,"complete"),Mn(t,"success");else{t.m=6;try{var a=2<zi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",xi(t)}}finally{Ui(t)}}}function Ui(t,e){if(t.g){Fi(t);var n=t.g,r=t.C[0]?Te:null;t.g=null,t.C=null,e||Mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Fi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(Ee.clearTimeout(t.A),t.A=null)}function zi(t){return t.g?t.g.readyState:0}function Bi(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Li:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Vi(t){var e="";return mn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Hi(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Vi(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Gr(t,e,n))}function ji(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function $i(t){this.Ca=0,this.i=[],this.j=new ir,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=ji("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=ji("baseRetryDelayMs",5e3,t),this.bb=ji("retryDelaySeedMs",1e4,t),this.$a=ji("forwardChannelMaxRetries",2,t),this.ta=ji("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 hi(t&&t.concurrentRequestLimit),this.Fa=new bi,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 qi(t){if(Ki(t),3==t.G){var e=t.U++,n=$r(t.F);Gr(n,"SID",t.I),Gr(n,"RID",e),Gr(n,"TYPE","terminate"),Yi(t,n),(e=new Ir(t,t.j,e,void 0)).K=2,e.v=Qr($r(n)),n=!1,Ee.navigator&&Ee.navigator.sendBeacon&&(n=Ee.navigator.sendBeacon(e.v.toString(),"")),!n&&Ee.Image&&((new Image).src=e.v,n=!0),n||(e.g=cs(e.l,null),e.g.da(e.v)),e.F=Date.now(),xr(e)}os(t)}function Wi(t){t.g&&(ts(t),t.g.cancel(),t.g=null)}function Ki(t){Wi(t),t.u&&(Ee.clearTimeout(t.u),t.u=null),ns(t),t.h.cancel(),t.m&&("number"==typeof t.m&&Ee.clearTimeout(t.m),t.m=null)}function Gi(t){fi(t.h)||t.m||(t.m=!0,qn(t.Ja,t),t.C=0)}function Qi(t,e){var n;n=e?e.m:t.U++;var r=$r(t.F);Gr(r,"SID",t.I),Gr(r,"RID",n),Gr(r,"AID",t.T),Yi(t,r),t.o&&t.s&&Hi(r,t.o,t.s),n=new Ir(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Ji(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),mi(t.h,n),Nr(n,r,e)}function Yi(t,e){t.ia&&mn(t.ia,(function(t,n){Gr(e,n,t)})),t.l&&Vr({},(function(t,n){Gr(e,n,t)}))}function Ji(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Le(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{Si(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Xi(t){t.g||t.u||(t.Z=1,qn(t.Ia,t),t.A=0)}function Zi(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=pr(Le(t.Ia,t),is(t,t.A)),t.A++,!0)}function ts(t){null!=t.B&&(Ee.clearTimeout(t.B),t.B=null)}function es(t){t.g=new Ir(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=$r(t.sa);Gr(e,"RID","rpc"),Gr(e,"SID",t.I),Gr(e,"CI",t.L?"0":"1"),Gr(e,"AID",t.T),Gr(e,"TYPE","xmlhttp"),Yi(t,e),t.o&&t.s&&Hi(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Qr($r(e)),n.s=null,n.P=!0,Lr(n,t)}function ns(t){null!=t.v&&(Ee.clearTimeout(t.v),t.v=null)}function rs(t,e){var n=null;if(t.g==e){ns(t),ts(t),t.g=null;var r=2}else{if(!gi(t.h,e))return;n=e.D,yi(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 i=t.C;Mn(r=cr(),new fr(r,n)),Gi(t)}else Xi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(pi(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=pr(Le(t.Ja,t,e),is(t,t.C)),t.C++,0)))}(t,e)||2==r&&Zi(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:ss(t,5);break;case 4:ss(t,10);break;case 3:ss(t,6);break;default:ss(t,2)}}function is(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ss(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Le(t.kb,t);n||(n=new jr("//www.google.com/images/cleardot.gif"),Ee.location&&"http"==Ee.location.protocol||qr(n,"https"),Qr(n)),function(t,e){var n=new ir;if(Ee.Image){var r=new Image;r.onload=Oe(_i,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Oe(_i,n,r,"TestLoadImage: error",!1,e),r.onabort=Oe(_i,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Oe(_i,n,r,"TestLoadImage: timeout",!1,e),Ee.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else dr(2);t.G=0,t.l&&t.l.va(e),os(t),Ki(t)}function os(t){if(t.G=0,t.la=[],t.l){var e=vi(t.h);0==e.length&&0==t.i.length||(Ue(t.la,e),Ue(t.la,t.i),t.h.i.length=0,Me(t.i),t.i.length=0),t.l.ua()}}function as(t,e,n){var r=n instanceof jr?$r(n):new jr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Wr(r,r.m);else{var i=Ee.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new jr(null,void 0);r&&qr(s,r),e&&(s.g=e),i&&Wr(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&Gr(r,n,e),Gr(r,"VER",t.ma),Yi(t,r),r}function cs(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 Ni(new Ei({jb:!0})):new Ni(t.ra)).Ka(t.H),e}function ls(){}function us(){if(Qe&&!(10<=Number(ln)))throw Error("Environmental error: no available transport.")}function hs(t,e){xn.call(this),this.g=new $i(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)&&!Be(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Be(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ps(this)}function ds(t){_r.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 fs(){Er.call(this),this.status=1}function ps(t){this.g=t}(be=Ni.prototype).Ka=function(t){this.L=t},be.da=function(t,e,n,r){var i,s,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():br.g(),this.C=this.u?vr(this.u):vr(br),this.g.onreadystatechange=Le(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void Pi(this,h)}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 l=ve(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=Ee.FormData&&t instanceof Ee.FormData,!(0<=xe(Di,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ve(n),f=d.next();!f.done;f=d.next()){var p=we(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,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{Fi(this),0<this.B&&((this.K=function(t){return Qe&&an()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Le(this.qa,this)):this.A=Jn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){Pi(this,h)}},be.qa=function(){void 0!==_e&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Mn(this,"timeout"),this.abort(8))},be.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Mn(this,"complete"),Mn(this,"abort"),Ui(this))},be.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Ui(this,!0)),Ni.X.M.call(this)},be.Ha=function(){this.s||(this.F||this.v||this.l?Mi(this):this.fb())},be.fb=function(){Mi(this)},be.aa=function(){try{return 2<zi(this)?this.g.status:-1}catch(t){return-1}},be.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},be.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Ri(e)}},be.Ea=function(){return this.m},be.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(be=$i.prototype).ma=8,be.G=1,be.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Ir(this,this.j,t,void 0),n=this.s;if(this.S&&(n?wn(n=yn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Ji(this,e,r),Gr(i=$r(this.F),"RID",t),Gr(i,"CVER",22),this.D&&Gr(i,"X-HTTP-Session-Id",this.D),Yi(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Vi(n)))+"&"+r:this.o&&Hi(i,this.o,n)),mi(this.h,e),this.Ya&&Gr(i,"TYPE","init"),this.O?(Gr(i,"$req",r),Gr(i,"SID","null"),e.Z=!0,Nr(e,i,null)):Nr(e,i,r),this.G=2}}else 3==this.G&&(t?Qi(this,t):0==this.i.length||fi(this.h)||Qi(this))},be.Ia=function(){if(this.u=null,es(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=pr(Le(this.eb,this),t)}},be.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,dr(10),Wi(this),es(this))},be.cb=function(){null!=this.v&&(this.v=null,Wi(this),Zi(this),dr(19))},be.kb=function(t){t?(this.j.info("Successfully pinged google.com"),dr(2)):(this.j.info("Failed to ping google.com"),dr(1))},(be=ls.prototype).xa=function(){},be.wa=function(){},be.va=function(){},be.ua=function(){},be.Ra=function(){},us.prototype.g=function(t,e){return new hs(t,e)},De(hs,xn),hs.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;dr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=as(t,null,t.V),Gi(t)},hs.prototype.close=function(){qi(this.g)},hs.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Fn(t),t=n);e.i.push(new ui(e.ab++,t)),3==e.G&&Gi(e)},hs.prototype.M=function(){this.g.l=null,delete this.j,qi(this.g),delete this.g,hs.X.M.call(this)},De(ds,_r),De(fs,Er),De(ps,ls),ps.prototype.xa=function(){Mn(this.g,"a")},ps.prototype.wa=function(t){Mn(this.g,new ds(t))},ps.prototype.va=function(t){Mn(this.g,new fs)},ps.prototype.ua=function(){Mn(this.g,"b")},us.prototype.createWebChannel=us.prototype.g,hs.prototype.send=hs.prototype.u,hs.prototype.open=hs.prototype.m,hs.prototype.close=hs.prototype.close,gr.NO_ERROR=0,gr.TIMEOUT=8,gr.HTTP_ERROR=6,mr.COMPLETE="complete",wr.EventType=Sr,Sr.OPEN="a",Sr.CLOSE="b",Sr.ERROR="c",Sr.MESSAGE="d",xn.prototype.listen=xn.prototype.N,Ni.prototype.listenOnce=Ni.prototype.O,Ni.prototype.getLastError=Ni.prototype.Oa,Ni.prototype.getLastErrorCode=Ni.prototype.Ea,Ni.prototype.getStatus=Ni.prototype.aa,Ni.prototype.getResponseJson=Ni.prototype.Sa,Ni.prototype.getResponseText=Ni.prototype.fa,Ni.prototype.send=Ni.prototype.da,Ni.prototype.setWithCredentials=Ni.prototype.Ka;var gs=gr,ms=mr,ys=or,vs=10,ws=11,bs=Ei,Ss=wr,_s=Ni;const Es="@firebase/firestore";
400
+ */var de;!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"}(de||(de={}));const fe={debug:de.DEBUG,verbose:de.VERBOSE,info:de.INFO,warn:de.WARN,error:de.ERROR,silent:de.SILENT},pe=de.INFO,ge={[de.DEBUG]:"log",[de.VERBOSE]:"log",[de.INFO]:"info",[de.WARN]:"warn",[de.ERROR]:"error"},me=(t,e,...n)=>{if(e<t.logLevel)return;const i=(new Date).toISOString(),r=ge[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${i}] ${t.name}:`,...n)};var ye=function(t,e){return ye=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])},ye(t,e)};function ve(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function we(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}var be,Se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ee=Ee||{},_e=Se||self;function Te(){}function Ie(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function ke(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ce="closure_uid_"+(1e9*Math.random()>>>0),Ae=0;function Re(t,e,n){return t.call.apply(t.bind,arguments)}function Le(t,e,n){if(!t)throw Error();if(2<arguments.length){var i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Ne(t,e,n){return(Ne=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Re:Le).apply(null,arguments)}function xe(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 Oe(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,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return e.prototype[n].apply(t,r)}}function De(){this.s=this.s,this.o=this.o}De.prototype.s=!1,De.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ce)&&t[Ce]||(t[Ce]=++Ae))},De.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Pe=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Me(t){var e=t.length;if(0<e){for(var n=Array(e),i=0;i<e;i++)n[i]=t[i];return n}return[]}function Fe(t,e){for(var n=1;n<arguments.length;n++){var i=arguments[n];if(Ie(i)){var r=t.length||0,s=i.length||0;t.length=r+s;for(var o=0;o<s;o++)t[r+o]=i[o]}else t.push(i)}}function Ue(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Ue.prototype.h=function(){this.defaultPrevented=!0};var ze=function(){if(!_e.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{_e.addEventListener("test",Te,e),_e.removeEventListener("test",Te,e)}catch(t){}return t}();function Be(t){return/^[\s\xa0]*$/.test(t)}var Ve=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function He(t,e){return t<e?-1:t>e?1:0}function je(){var t=_e.navigator;return t&&(t=t.userAgent)?t:""}function qe(t){return-1!=je().indexOf(t)}function $e(t){return $e[" "](t),t}$e[" "]=Te;var Ke,We,Ge=qe("Opera"),Qe=qe("Trident")||qe("MSIE"),Ye=qe("Edge"),Je=Ye||Qe,Xe=qe("Gecko")&&!(-1!=je().toLowerCase().indexOf("webkit")&&!qe("Edge"))&&!(qe("Trident")||qe("MSIE"))&&!qe("Edge"),Ze=-1!=je().toLowerCase().indexOf("webkit")&&!qe("Edge");function tn(){var t=_e.document;return t?t.documentMode:void 0}t:{var en="",nn=(We=je(),Xe?/rv:([^\);]+)(\)|;)/.exec(We):Ye?/Edge\/([\d\.]+)/.exec(We):Qe?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(We):Ze?/WebKit\/(\S+)/.exec(We):Ge?/(?:Version)[ \/]?(\S+)/.exec(We):void 0);if(nn&&(en=nn?nn[1]:""),Qe){var rn=tn();if(null!=rn&&rn>parseFloat(en)){Ke=String(rn);break t}}Ke=en}var sn,on={};function an(){return function(t){var e=on;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Ve(String(Ke)).split("."),n=Ve("9").split("."),i=Math.max(e.length,n.length),r=0;0==t&&r<i;r++){var s=e[r]||"",o=n[r]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=He(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||He(0==s[2].length,0==o[2].length)||He(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(_e.document&&Qe){var cn=tn();sn=cn||(parseInt(Ke,10)||void 0)}else sn=void 0;var ln=sn;function un(t,e){if(Ue.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,i=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Xe){t:{try{$e(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,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:hn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&un.X.h.call(this)}}Oe(un,Ue);var hn={2:"touch",3:"pen",4:"mouse"};un.prototype.h=function(){un.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var dn="closure_listenable_"+(1e6*Math.random()|0),fn=0;function pn(t,e,n,i,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!i,this.ha=r,this.key=++fn,this.ba=this.ea=!1}function gn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function mn(t,e,n){for(var i in t)e.call(n,t[i],i,t)}function yn(t){var e={};for(var n in t)e[n]=t[n];return e}var vn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function wn(t,e){for(var n,i,r=1;r<arguments.length;r++){for(n in i=arguments[r])t[n]=i[n];for(var s=0;s<vn.length;s++)n=vn[s],Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}}function bn(t){this.src=t,this.g={},this.h=0}function Sn(t,e){var n=e.type;if(n in t.g){var i,r=t.g[n],s=Pe(r,e);(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(gn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function En(t,e,n,i){for(var r=0;r<t.length;++r){var s=t[r];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==i)return r}return-1}bn.prototype.add=function(t,e,n,i,r){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=En(t,e,i,r);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new pn(e,this.src,s,!!i,r)).ea=n,t.push(e)),e};var _n="closure_lm_"+(1e6*Math.random()|0),Tn={};function In(t,e,n,i,r){if(i&&i.once)return Cn(t,e,n,i,r);if(Array.isArray(e)){for(var s=0;s<e.length;s++)In(t,e[s],n,i,r);return null}return n=Dn(n),t&&t[dn]?t.N(e,n,ke(i)?!!i.capture:!!i,r):kn(t,e,n,!1,i,r)}function kn(t,e,n,i,r,s){if(!e)throw Error("Invalid event type");var o=ke(r)?!!r.capture:!!r,a=xn(t);if(a||(t[_n]=a=new bn(t)),(n=a.add(e,n,i,o,s)).proxy)return n;if(i=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Nn;return t}(),n.proxy=i,i.src=t,i.listener=n,t.addEventListener)ze||(r=o),void 0===r&&(r=!1),t.addEventListener(e.toString(),i,r);else if(t.attachEvent)t.attachEvent(Ln(e.toString()),i);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(i)}return n}function Cn(t,e,n,i,r){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Cn(t,e[s],n,i,r);return null}return n=Dn(n),t&&t[dn]?t.O(e,n,ke(i)?!!i.capture:!!i,r):kn(t,e,n,!0,i,r)}function An(t,e,n,i,r){if(Array.isArray(e))for(var s=0;s<e.length;s++)An(t,e[s],n,i,r);else i=ke(i)?!!i.capture:!!i,n=Dn(n),t&&t[dn]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=En(s=t.g[e],n,i,r))&&(gn(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=xn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=En(e,n,i,r)),(n=-1<t?e[t]:null)&&Rn(n))}function Rn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[dn])Sn(e.i,t);else{var n=t.type,i=t.proxy;e.removeEventListener?e.removeEventListener(n,i,t.capture):e.detachEvent?e.detachEvent(Ln(n),i):e.addListener&&e.removeListener&&e.removeListener(i),(n=xn(e))?(Sn(n,t),0==n.h&&(n.src=null,e[_n]=null)):gn(t)}}}function Ln(t){return t in Tn?Tn[t]:Tn[t]="on"+t}function Nn(t,e){if(t.ba)t=!0;else{e=new un(e,this);var n=t.listener,i=t.ha||t.src;t.ea&&Rn(t),t=n.call(i,e)}return t}function xn(t){return(t=t[_n])instanceof bn?t:null}var On="__closure_events_fn_"+(1e9*Math.random()>>>0);function Dn(t){return"function"==typeof t?t:(t[On]||(t[On]=function(e){return t.handleEvent(e)}),t[On])}function Pn(){De.call(this),this.i=new bn(this),this.P=this,this.I=null}function Mn(t,e){var n,i=t.I;if(i)for(n=[];i;i=i.I)n.push(i);if(t=t.P,i=e.type||e,"string"==typeof e)e=new Ue(e,t);else if(e instanceof Ue)e.target=e.target||t;else{var r=e;wn(e=new Ue(i,t),r)}if(r=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];r=Fn(o,i,!0,e)&&r}if(r=Fn(o=e.g=t,i,!0,e)&&r,r=Fn(o,i,!1,e)&&r,n)for(s=0;s<n.length;s++)r=Fn(o=e.g=n[s],i,!1,e)&&r}function Fn(t,e,n,i){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var r=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&Sn(t.i,o),r=!1!==a.call(c,i)&&r}}return r&&!i.defaultPrevented}Oe(Pn,De),Pn.prototype[dn]=!0,Pn.prototype.removeEventListener=function(t,e,n,i){An(this,t,e,n,i)},Pn.prototype.M=function(){if(Pn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],i=0;i<n.length;i++)gn(n[i]);delete e.g[t],e.h--}}this.I=null},Pn.prototype.N=function(t,e,n,i){return this.i.add(String(t),e,!1,n,i)},Pn.prototype.O=function(t,e,n,i){return this.i.add(String(t),e,!0,n,i)};var Un=_e.JSON.stringify;function zn(){var t=Wn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Bn,Vn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Hn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Hn=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new jn}),(function(t){return t.reset()})),jn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function qn(t){_e.setTimeout((function(){throw t}),0)}function $n(t,e){Bn||function(){var t=_e.Promise.resolve(void 0);Bn=function(){t.then(Gn)}}(),Kn||(Bn(),Kn=!0),Wn.add(t,e)}var Kn=!1,Wn=new Vn;function Gn(){for(var t;t=zn();){try{t.h.call(t.g)}catch(t){qn(t)}var e=Hn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Kn=!1}function Qn(t,e){Pn.call(this),this.h=t||1,this.g=e||_e,this.j=Ne(this.lb,this),this.l=Date.now()}function Yn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Jn(t,e,n){if("function"==typeof t)n&&(t=Ne(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Ne(t.handleEvent,t)}return 2147483647<Number(e)?-1:_e.setTimeout(t,e||0)}function Xn(t){t.g=Jn((function(){t.g=null,t.i&&(t.i=!1,Xn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Oe(Qn,Pn),(be=Qn.prototype).ca=!1,be.R=null,be.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Mn(this,"tick"),this.ca&&(Yn(this),this.start()))}},be.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},be.M=function(){Qn.X.M.call(this),Yn(this),delete this.g};var Zn=function(t){function e(e,n){var i=t.call(this)||this;return i.m=e,i.j=n,i.h=null,i.i=!1,i.g=null,i}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}ye(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:Xn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(_e.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(De);function ti(t){De.call(this),this.h=t,this.g={}}Oe(ti,De);var ei=[];function ni(t,e,n,i){Array.isArray(n)||(n&&(ei[0]=n.toString()),n=ei);for(var r=0;r<n.length;r++){var s=In(e,n[r],i||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function ii(t){mn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Rn(t)}),t),t.g={}}function ri(){this.g=!0}function si(t,e,n,i){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 i=n[t];if(!(2>i.length)){var r=i[1];if(Array.isArray(r)&&!(1>r.length)){var s=r[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<r.length;o++)r[o]=""}}}return Un(n)}catch(t){return e}}(t,n)+(i?" "+i:"")}))}ti.prototype.M=function(){ti.X.M.call(this),ii(this)},ti.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},ri.prototype.Aa=function(){this.g=!1},ri.prototype.info=function(){};var oi={},ai=null;function ci(){return ai=ai||new Pn}function li(t){Ue.call(this,oi.Pa,t)}function ui(t){var e=ci();Mn(e,new li(e))}function hi(t,e){Ue.call(this,oi.STAT_EVENT,t),this.stat=e}function di(t){var e=ci();Mn(e,new hi(e,t))}function fi(t,e){Ue.call(this,oi.Qa,t),this.size=e}function pi(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return _e.setTimeout((function(){t()}),e)}oi.Pa="serverreachability",Oe(li,Ue),oi.STAT_EVENT="statevent",Oe(hi,Ue),oi.Qa="timingevent",Oe(fi,Ue);var gi={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},mi={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function yi(){}function vi(t){return t.h||(t.h=t.i())}function wi(){}yi.prototype.h=null;var bi,Si={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Ei(){Ue.call(this,"d")}function _i(){Ue.call(this,"c")}function Ti(){}function Ii(t,e,n,i){this.l=t,this.j=e,this.m=n,this.U=i||1,this.S=new ti(this),this.O=Ci,t=Je?125:void 0,this.T=new Qn(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 ki}function ki(){this.i=null,this.g="",this.h=!1}Oe(Ei,Ue),Oe(_i,Ue),Oe(Ti,yi),Ti.prototype.g=function(){return new XMLHttpRequest},Ti.prototype.i=function(){return{}},bi=new Ti;var Ci=45e3,Ai={},Ri={};function Li(t,e,n){t.K=1,t.v=Qi(qi(e)),t.s=n,t.P=!0,Ni(t,null)}function Ni(t,e){t.F=Date.now(),Pi(t),t.A=qi(t.v);var n=t.A,i=t.U;Array.isArray(i)||(i=[String(i)]),cr(n.i,"t",i),t.C=0,n=t.l.H,t.h=new ki,t.g=cs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Zn(Ne(t.La,t,t.g),t.N)),ni(t.S,t.g,"readystatechange",t.ib),e=t.H?yn(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)),ui(),function(t,e,n,i,r,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+i+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function xi(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Oi(t,e,n){for(var i,r=!0;!t.I&&t.C<n.length;){if((i=Di(t,n))==Ri){4==e&&(t.o=4,di(14),r=!1),si(t.j,t.m,null,"[Incomplete Response]");break}if(i==Ai){t.o=4,di(15),si(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}si(t.j,t.m,i,null),Bi(t,i)}xi(t)&&i!=Ri&&i!=Ai&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,di(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),ts(e),e.K=!0,di(11))):(si(t.j,t.m,n,"[Invalid Chunked Response]"),zi(t),Ui(t))}function Di(t,e){var n=t.C,i=e.indexOf("\n",n);return-1==i?Ri:(n=Number(e.substring(n,i)),isNaN(n)?Ai:(i+=1)+n>e.length?Ri:(e=e.substr(i,n),t.C=i+n,e))}function Pi(t){t.V=Date.now()+t.O,Mi(t,t.O)}function Mi(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=pi(Ne(t.gb,t),e)}function Fi(t){t.B&&(_e.clearTimeout(t.B),t.B=null)}function Ui(t){0==t.l.G||t.I||is(t.l,t)}function zi(t){Fi(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Yn(t.T),ii(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Bi(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||gr(n.h,t)))if(!t.J&&gr(n.h,t)&&3==n.G){try{var i=n.Fa.g.parse(e)}catch(s){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ns(n),Kr(n)}Zr(n),di(18)}}else n.Ba=r[1],0<n.Ba-n.T&&37500>r[2]&&n.L&&0==n.A&&!n.v&&(n.v=pi(Ne(n.cb,n),6e3));if(1>=pr(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else ss(n,11)}else if((t.J||n.g==t)&&ns(n),!Be(e))for(r=n.Fa.g.parse(e),e=0;e<r.length;e++){var s=r[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(i=1.5*c,n.J=i,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=i.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(mr(h,h.h),h.h=null))}if(i.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(i.za=d,Gi(i.F,i.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((i=n).sa=as(i,i.H?i.ka:null,i.V),f.J){yr(i.h,f);var p=f,g=i.J;g&&p.setTimeout(g),p.B&&(Fi(p),Pi(p)),i.g=f}else Xr(i);0<n.i.length&&Gr(n)}else"stop"!=s[0]&&"close"!=s[0]||ss(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?ss(n,7):$r(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}ui()}catch(s){}}function Vi(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Ie(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Ie(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var i in e=[],n=0,t)e[n++]=i;return e}}}(t),i=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Ie(t)){for(var e=[],n=t.length,i=0;i<n;i++)e.push(t[i]);return e}for(i in e=[],n=0,t)e[n++]=t[i];return e}(t),r=i.length,s=0;s<r;s++)e.call(void 0,i[s],n&&n[s],t)}(be=Ii.prototype).setTimeout=function(t){this.O=t},be.ib=function(t){t=t.target;var e=this.L;e&&3==zr(t)?e.l():this.La(t)},be.La=function(t){try{if(t==this.g)t:{var e=zr(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Je||this.g&&(this.h.h||this.g.fa()||Br(this.g)))){this.I||4!=e||7==n||ui(),Fi(this);var i=this.g.aa();this.Y=i;e:if(xi(this)){var r=Br(this.g);t="";var s=r.length,o=4==zr(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){zi(this),Ui(this);var a="";break e}this.h.i=new _e.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(r[n],{stream:o&&n==s-1});r.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==i,function(t,e,n,i,r,s,o){t.info((function(){return"XMLHTTP RESP ("+i+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,i),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Be(c)){var u=c;break e}}u=null}if(!(i=u)){this.i=!1,this.o=3,di(12),zi(this),Ui(this);break t}si(this.j,this.m,i,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Bi(this,i)}this.P?(Oi(this,e,a),Je&&this.i&&3==e&&(ni(this.S,this.T,"tick",this.hb),this.T.start())):(si(this.j,this.m,a,null),Bi(this,a)),4==e&&zi(this),this.i&&!this.I&&(4==e?is(this.l,this):(this.i=!1,Pi(this)))}else 400==i&&0<a.indexOf("Unknown SID")?(this.o=3,di(12)):(this.o=0,di(13)),zi(this),Ui(this)}}}catch(e){}},be.hb=function(){if(this.g){var t=zr(this.g),e=this.g.fa();this.C<e.length&&(Fi(this),Oi(this,t,e),this.i&&4!=t&&Pi(this))}},be.cancel=function(){this.I=!0,zi(this)},be.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&&(ui(),di(17)),zi(this),this.o=2,Ui(this)):Mi(this,this.V-t)};var Hi=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function ji(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof ji){this.h=void 0!==e?e:t.h,$i(this,t.j),this.s=t.s,this.g=t.g,Ki(this,t.m),this.l=t.l,e=t.i;var n=new rr;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Wi(this,n),this.o=t.o}else t&&(n=String(t).match(Hi))?(this.h=!!e,$i(this,n[1]||"",!0),this.s=Yi(n[2]||""),this.g=Yi(n[3]||"",!0),Ki(this,n[4]),this.l=Yi(n[5]||"",!0),Wi(this,n[6]||"",!0),this.o=Yi(n[7]||"")):(this.h=!!e,this.i=new rr(null,this.h))}function qi(t){return new ji(t)}function $i(t,e,n){t.j=n?Yi(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Ki(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 Wi(t,e,n){e instanceof rr?(t.i=e,function(t,e){e&&!t.j&&(sr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(or(this,e),cr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Ji(e,nr)),t.i=new rr(e,t.h))}function Gi(t,e,n){t.i.set(e,n)}function Qi(t){return Gi(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Yi(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Ji(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Xi),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Xi(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}ji.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Ji(e,Zi,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Ji(e,Zi,!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(Ji(n,"/"==n.charAt(0)?er:tr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Ji(n,ir)),t.join("")};var Zi=/[#\/\?@]/g,tr=/[#\?:]/g,er=/[#\?]/g,nr=/[#\?@]/g,ir=/#/g;function rr(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function sr(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 i=t[n].indexOf("="),r=null;if(0<=i){var s=t[n].substring(0,i);r=t[n].substring(i+1)}else s=t[n];e(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function or(t,e){sr(t),e=lr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ar(t,e){return sr(t),e=lr(t,e),t.g.has(e)}function cr(t,e,n){or(t,e),0<n.length&&(t.i=null,t.g.set(lr(t,e),Me(n)),t.h+=n.length)}function lr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(be=rr.prototype).add=function(t,e){sr(this),this.i=null,t=lr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},be.forEach=function(t,e){sr(this),this.g.forEach((function(n,i){n.forEach((function(n){t.call(e,n,i,this)}),this)}),this)},be.oa=function(){sr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],i=0;i<e.length;i++)for(var r=t[i],s=0;s<r.length;s++)n.push(e[i]);return n},be.W=function(t){sr(this);var e=[];if("string"==typeof t)ar(this,t)&&(e=e.concat(this.g.get(lr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},be.set=function(t,e){return sr(this),this.i=null,ar(this,t=lr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},be.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},be.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 i=e[n],r=encodeURIComponent(String(i)),s=this.W(i);for(i=0;i<s.length;i++){var o=r;""!==s[i]&&(o+="="+encodeURIComponent(String(s[i]))),t.push(o)}}return this.i=t.join("&")};var ur=function(t,e){this.h=t,this.g=e};function hr(t){this.l=t||dr,_e.PerformanceNavigationTiming?t=0<(t=_e.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(_e.g&&_e.g.Ga&&_e.g.Ga()&&_e.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 dr=10;function fr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function pr(t){return t.h?1:t.g?t.g.size:0}function gr(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function mr(t,e){t.g?t.g.add(e):t.h=e}function yr(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function vr(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var i=t.i;try{for(var r=ve(t.g.values()),s=r.next();!s.done;s=r.next()){var o=s.value;i=i.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return i}return Me(t.i)}function wr(){}function br(){this.g=new wr}function Sr(t,e,n){var i=n||"";try{Vi(t,(function(t,n){var r=t;ke(t)&&(r=Un(t)),e.push(i+n+"="+encodeURIComponent(r))}))}catch(t){throw e.push(i+"type="+encodeURIComponent("_badmap")),t}}function Er(t,e,n,i,r){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,r(i)}catch(t){}}function _r(t){this.l=t.ac||null,this.j=t.jb||!1}function Tr(t,e){Pn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Ir,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}hr.prototype.cancel=function(){var t,e;if(this.i=vr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ve(this.g.values()),i=n.next();!i.done;i=n.next()){i.value.cancel()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},wr.prototype.stringify=function(t){return _e.JSON.stringify(t,void 0)},wr.prototype.parse=function(t){return _e.JSON.parse(t,void 0)},Oe(_r,yi),_r.prototype.g=function(){return new Tr(this.l,this.j)},_r.prototype.i=function(t){return function(){return t}}({}),Oe(Tr,Pn);var Ir=0;function kr(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Cr(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ar(t)}function Ar(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(be=Tr.prototype).open=function(t,e){if(this.readyState!=Ir)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ar(this)},be.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||_e).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},be.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,Cr(this)),this.readyState=Ir},be.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,Ar(this)),this.g&&(this.readyState=3,Ar(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==_e.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;kr(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},be.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?Cr(this):Ar(this),3==this.readyState&&kr(this)}},be.Va=function(t){this.g&&(this.response=this.responseText=t,Cr(this))},be.Ua=function(t){this.g&&(this.response=t,Cr(this))},be.ga=function(){this.g&&Cr(this)},be.setRequestHeader=function(t,e){this.v.append(t,e)},be.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},be.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(Tr.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Rr=_e.JSON.parse;function Lr(t){Pn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Nr,this.K=this.L=!1}Oe(Lr,Pn);var Nr="",xr=/^https?$/i,Or=["POST","PUT"];function Dr(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Pr(t),Fr(t)}function Pr(t){t.D||(t.D=!0,Mn(t,"complete"),Mn(t,"error"))}function Mr(t){if(t.h&&void 0!==Ee&&(!t.C[1]||4!=zr(t)||2!=t.aa()))if(t.v&&4==zr(t))Jn(t.Ha,0,t);else if(Mn(t,"readystatechange"),4==zr(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 i=!0;break t;default:i=!1}if(!(e=i)){var r;if(r=0===n){var s=String(t.H).match(Hi)[1]||null;if(!s&&_e.self&&_e.self.location){var o=_e.self.location.protocol;s=o.substr(0,o.length-1)}r=!xr.test(s?s.toLowerCase():"")}e=r}if(e)Mn(t,"complete"),Mn(t,"success");else{t.m=6;try{var a=2<zr(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Pr(t)}}finally{Fr(t)}}}function Fr(t,e){if(t.g){Ur(t);var n=t.g,i=t.C[0]?Te:null;t.g=null,t.C=null,e||Mn(t,"ready");try{n.onreadystatechange=i}catch(t){}}}function Ur(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(_e.clearTimeout(t.A),t.A=null)}function zr(t){return t.g?t.g.readyState:0}function Br(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Nr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Vr(t){var e="";return mn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Hr(t,e,n){t:{for(i in n){var i=!1;break t}i=!0}i||(n=Vr(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Gi(t,e,n))}function jr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function qr(t){this.Ca=0,this.i=[],this.j=new ri,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=jr("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=jr("baseRetryDelayMs",5e3,t),this.bb=jr("retryDelaySeedMs",1e4,t),this.$a=jr("forwardChannelMaxRetries",2,t),this.ta=jr("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 hr(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 $r(t){if(Wr(t),3==t.G){var e=t.U++,n=qi(t.F);Gi(n,"SID",t.I),Gi(n,"RID",e),Gi(n,"TYPE","terminate"),Yr(t,n),(e=new Ii(t,t.j,e,void 0)).K=2,e.v=Qi(qi(n)),n=!1,_e.navigator&&_e.navigator.sendBeacon&&(n=_e.navigator.sendBeacon(e.v.toString(),"")),!n&&_e.Image&&((new Image).src=e.v,n=!0),n||(e.g=cs(e.l,null),e.g.da(e.v)),e.F=Date.now(),Pi(e)}os(t)}function Kr(t){t.g&&(ts(t),t.g.cancel(),t.g=null)}function Wr(t){Kr(t),t.u&&(_e.clearTimeout(t.u),t.u=null),ns(t),t.h.cancel(),t.m&&("number"==typeof t.m&&_e.clearTimeout(t.m),t.m=null)}function Gr(t){fr(t.h)||t.m||(t.m=!0,$n(t.Ja,t),t.C=0)}function Qr(t,e){var n;n=e?e.m:t.U++;var i=qi(t.F);Gi(i,"SID",t.I),Gi(i,"RID",n),Gi(i,"AID",t.T),Yr(t,i),t.o&&t.s&&Hr(i,t.o,t.s),n=new Ii(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Jr(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),mr(t.h,n),Li(n,i,e)}function Yr(t,e){t.ia&&mn(t.ia,(function(t,n){Gi(e,n,t)})),t.l&&Vi({},(function(t,n){Gi(e,n,t)}))}function Jr(t,e,n){n=Math.min(t.i.length,n);var i=t.l?Ne(t.l.Ra,t.l,t):null;t:for(var r=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=r[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=r[c].h,u=r[c].g;if(0>(l-=s))s=Math.max(0,r[c].h-100),a=!1;else try{Sr(u,o,"req"+l+"_")}catch(t){i&&i(u)}}if(a){i=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,i}function Xr(t){t.g||t.u||(t.Z=1,$n(t.Ia,t),t.A=0)}function Zr(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=pi(Ne(t.Ia,t),rs(t,t.A)),t.A++,!0)}function ts(t){null!=t.B&&(_e.clearTimeout(t.B),t.B=null)}function es(t){t.g=new Ii(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=qi(t.sa);Gi(e,"RID","rpc"),Gi(e,"SID",t.I),Gi(e,"CI",t.L?"0":"1"),Gi(e,"AID",t.T),Gi(e,"TYPE","xmlhttp"),Yr(t,e),t.o&&t.s&&Hr(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Qi(qi(e)),n.s=null,n.P=!0,Ni(n,t)}function ns(t){null!=t.v&&(_e.clearTimeout(t.v),t.v=null)}function is(t,e){var n=null;if(t.g==e){ns(t),ts(t),t.g=null;var i=2}else{if(!gr(t.h,e))return;n=e.D,yr(t.h,e),i=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==i){n=e.s?e.s.length:0,e=Date.now()-e.F;var r=t.C;Mn(i=ci(),new fi(i,n)),Gr(t)}else Xr(t);else if(3==(r=e.o)||0==r&&0<t.pa||!(1==i&&function(t,e){return!(pr(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=pi(Ne(t.Ja,t,e),rs(t,t.C)),t.C++,0)))}(t,e)||2==i&&Zr(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),r){case 1:ss(t,5);break;case 4:ss(t,10);break;case 3:ss(t,6);break;default:ss(t,2)}}function rs(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ss(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var i=Ne(t.kb,t);n||(n=new ji("//www.google.com/images/cleardot.gif"),_e.location&&"http"==_e.location.protocol||$i(n,"https"),Qi(n)),function(t,e){var n=new ri;if(_e.Image){var i=new Image;i.onload=xe(Er,n,i,"TestLoadImage: loaded",!0,e),i.onerror=xe(Er,n,i,"TestLoadImage: error",!1,e),i.onabort=xe(Er,n,i,"TestLoadImage: abort",!1,e),i.ontimeout=xe(Er,n,i,"TestLoadImage: timeout",!1,e),_e.setTimeout((function(){i.ontimeout&&i.ontimeout()}),1e4),i.src=t}else e(!1)}(n.toString(),i)}else di(2);t.G=0,t.l&&t.l.va(e),os(t),Wr(t)}function os(t){if(t.G=0,t.la=[],t.l){var e=vr(t.h);0==e.length&&0==t.i.length||(Fe(t.la,e),Fe(t.la,t.i),t.h.i.length=0,Me(t.i),t.i.length=0),t.l.ua()}}function as(t,e,n){var i=n instanceof ji?qi(n):new ji(n,void 0);if(""!=i.g)e&&(i.g=e+"."+i.g),Ki(i,i.m);else{var r=_e.location;i=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;var s=new ji(null,void 0);i&&$i(s,i),e&&(s.g=e),r&&Ki(s,r),n&&(s.l=n),i=s}return n=t.D,e=t.za,n&&e&&Gi(i,n,e),Gi(i,"VER",t.ma),Yr(t,i),i}function cs(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Lr(new _r({jb:!0})):new Lr(t.ra)).Ka(t.H),e}function ls(){}function us(){if(Qe&&!(10<=Number(ln)))throw Error("Environmental error: no available transport.")}function hs(t,e){Pn.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)&&!Be(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Be(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ps(this)}function ds(t){Ei.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 fs(){_i.call(this),this.status=1}function ps(t){this.g=t}(be=Lr.prototype).Ka=function(t){this.L=t},be.da=function(t,e,n,i){var r,s,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():bi.g(),this.C=this.u?vi(this.u):vi(bi),this.g.onreadystatechange=Ne(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void Dr(this,h)}if(t=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var c in i)n.set(c,i[c]);else{if("function"!=typeof i.keys||"function"!=typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));try{for(var l=ve(i.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,i.get(h))}}catch(t){r={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(r)throw r.error}}}i=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=_e.FormData&&t instanceof _e.FormData,!(0<=Pe(Or,e))||i||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ve(n),f=d.next();!f.done;f=d.next()){var p=we(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,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{Ur(this),0<this.B&&((this.K=function(t){return Qe&&an()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ne(this.qa,this)):this.A=Jn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){Dr(this,h)}},be.qa=function(){void 0!==Ee&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Mn(this,"timeout"),this.abort(8))},be.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Mn(this,"complete"),Mn(this,"abort"),Fr(this))},be.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Fr(this,!0)),Lr.X.M.call(this)},be.Ha=function(){this.s||(this.F||this.v||this.l?Mr(this):this.fb())},be.fb=function(){Mr(this)},be.aa=function(){try{return 2<zr(this)?this.g.status:-1}catch(t){return-1}},be.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},be.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Rr(e)}},be.Ea=function(){return this.m},be.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(be=qr.prototype).ma=8,be.G=1,be.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 Ii(this,this.j,t,void 0),n=this.s;if(this.S&&(n?wn(n=yn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var i=0,r=0;r<this.i.length;r++){var s=this.i[r];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(i+=s)){i=r;break t}if(4096===i||r===this.i.length-1){i=r+1;break t}}i=1e3}else i=1e3;i=Jr(this,e,i),Gi(r=qi(this.F),"RID",t),Gi(r,"CVER",22),this.D&&Gi(r,"X-HTTP-Session-Id",this.D),Yr(this,r),n&&(this.N?i="headers="+encodeURIComponent(String(Vr(n)))+"&"+i:this.o&&Hr(r,this.o,n)),mr(this.h,e),this.Ya&&Gi(r,"TYPE","init"),this.O?(Gi(r,"$req",i),Gi(r,"SID","null"),e.Z=!0,Li(e,r,null)):Li(e,r,i),this.G=2}}else 3==this.G&&(t?Qr(this,t):0==this.i.length||fr(this.h)||Qr(this))},be.Ia=function(){if(this.u=null,es(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=pi(Ne(this.eb,this),t)}},be.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,di(10),Kr(this),es(this))},be.cb=function(){null!=this.v&&(this.v=null,Kr(this),Zr(this),di(19))},be.kb=function(t){t?(this.j.info("Successfully pinged google.com"),di(2)):(this.j.info("Failed to ping google.com"),di(1))},(be=ls.prototype).xa=function(){},be.wa=function(){},be.va=function(){},be.ua=function(){},be.Ra=function(){},us.prototype.g=function(t,e){return new hs(t,e)},Oe(hs,Pn),hs.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;di(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=as(t,null,t.V),Gr(t)},hs.prototype.close=function(){$r(this.g)},hs.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Un(t),t=n);e.i.push(new ur(e.ab++,t)),3==e.G&&Gr(e)},hs.prototype.M=function(){this.g.l=null,delete this.j,$r(this.g),delete this.g,hs.X.M.call(this)},Oe(ds,Ei),Oe(fs,_i),Oe(ps,ls),ps.prototype.xa=function(){Mn(this.g,"a")},ps.prototype.wa=function(t){Mn(this.g,new ds(t))},ps.prototype.va=function(t){Mn(this.g,new fs)},ps.prototype.ua=function(){Mn(this.g,"b")},us.prototype.createWebChannel=us.prototype.g,hs.prototype.send=hs.prototype.u,hs.prototype.open=hs.prototype.m,hs.prototype.close=hs.prototype.close,gi.NO_ERROR=0,gi.TIMEOUT=8,gi.HTTP_ERROR=6,mi.COMPLETE="complete",wi.EventType=Si,Si.OPEN="a",Si.CLOSE="b",Si.ERROR="c",Si.MESSAGE="d",Pn.prototype.listen=Pn.prototype.N,Lr.prototype.listenOnce=Lr.prototype.O,Lr.prototype.getLastError=Lr.prototype.Oa,Lr.prototype.getLastErrorCode=Lr.prototype.Ea,Lr.prototype.getStatus=Lr.prototype.aa,Lr.prototype.getResponseJson=Lr.prototype.Sa,Lr.prototype.getResponseText=Lr.prototype.fa,Lr.prototype.send=Lr.prototype.da,Lr.prototype.setWithCredentials=Lr.prototype.Ka;var gs=gi,ms=mi,ys=oi,vs=10,ws=11,bs=_r,Ss=wi,Es=Lr;const _s="@firebase/firestore";
401
401
  /**
402
402
  * @license
403
403
  * Copyright 2017 Google LLC
@@ -446,7 +446,7 @@ let Is="9.15.0";
446
446
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
447
447
  * See the License for the specific language governing permissions and
448
448
  * limitations under the License.
449
- */const ks=new class{constructor(t){this.name=t,this._logLevel=pe,this._logHandler=me,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in de))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?fe[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,de.DEBUG,...t),this._logHandler(this,de.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,de.VERBOSE,...t),this._logHandler(this,de.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,de.INFO,...t),this._logHandler(this,de.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,de.WARN,...t),this._logHandler(this,de.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,de.ERROR,...t),this._logHandler(this,de.ERROR,...t)}}("@firebase/firestore");function Cs(){return ks.logLevel}function As(t,...e){if(ks.logLevel<=de.DEBUG){const n=e.map(Ls);ks.debug(`Firestore (${Is}): ${t}`,...n)}}function Rs(t,...e){if(ks.logLevel<=de.ERROR){const n=e.map(Ls);ks.error(`Firestore (${Is}): ${t}`,...n)}}function Ns(t,...e){if(ks.logLevel<=de.WARN){const n=e.map(Ls);ks.warn(`Firestore (${Is}): ${t}`,...n)}}function Ls(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
449
+ */const ks=new class{constructor(t){this.name=t,this._logLevel=pe,this._logHandler=me,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in de))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?fe[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,de.DEBUG,...t),this._logHandler(this,de.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,de.VERBOSE,...t),this._logHandler(this,de.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,de.INFO,...t),this._logHandler(this,de.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,de.WARN,...t),this._logHandler(this,de.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,de.ERROR,...t),this._logHandler(this,de.ERROR,...t)}}("@firebase/firestore");function Cs(){return ks.logLevel}function As(t,...e){if(ks.logLevel<=de.DEBUG){const n=e.map(Ns);ks.debug(`Firestore (${Is}): ${t}`,...n)}}function Rs(t,...e){if(ks.logLevel<=de.ERROR){const n=e.map(Ns);ks.error(`Firestore (${Is}): ${t}`,...n)}}function Ls(t,...e){if(ks.logLevel<=de.WARN){const n=e.map(Ns);ks.warn(`Firestore (${Is}): ${t}`,...n)}}function Ns(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
450
450
  /**
451
451
  * @license
452
452
  * Copyright 2020 Google LLC
@@ -478,7 +478,7 @@ let Is="9.15.0";
478
478
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
479
479
  * See the License for the specific language governing permissions and
480
480
  * limitations under the License.
481
- */function Os(t="Unexpected state"){const e=`FIRESTORE (${Is}) INTERNAL ASSERTION FAILED: `+t;throw Rs(e),new Error(e)}function Ds(t,e){t||Os()}function Ps(t,e){return t}
481
+ */function xs(t="Unexpected state"){const e=`FIRESTORE (${Is}) INTERNAL ASSERTION FAILED: `+t;throw Rs(e),new Error(e)}function Os(t,e){t||xs()}function Ds(t,e){return t}
482
482
  /**
483
483
  * @license
484
484
  * Copyright 2017 Google LLC
@@ -494,7 +494,7 @@ let Is="9.15.0";
494
494
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
495
495
  * See the License for the specific language governing permissions and
496
496
  * limitations under the License.
497
- */const xs={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 Ms extends ae{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
497
+ */const Ps={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 Ms extends ae{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
498
498
  /**
499
499
  * @license
500
500
  * Copyright 2017 Google LLC
@@ -510,7 +510,7 @@ let Is="9.15.0";
510
510
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
511
511
  * See the License for the specific language governing permissions and
512
512
  * limitations under the License.
513
- */class Us{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
513
+ */class Fs{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
514
514
  /**
515
515
  * @license
516
516
  * Copyright 2017 Google LLC
@@ -526,7 +526,7 @@ let Is="9.15.0";
526
526
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
527
527
  * See the License for the specific language governing permissions and
528
528
  * limitations under the License.
529
- */class Fs{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class zs{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Ts.UNAUTHENTICATED)))}shutdown(){}}class Bs{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 Vs{constructor(t){this.t=t,this.currentUser=Ts.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let i=new Us;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Us,t.enqueueRetryable((()=>r(this.currentUser)))};const s=()=>{const e=i;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{As("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),s()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(As("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Us)}}),0),s()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(As("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Ds("string"==typeof e.accessToken),new Fs(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 Ds(null===t||"string"==typeof t),new Ts(t)}}class Hs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=Ts.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Ds(!("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 js{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new Hs(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Ts.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class $s{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 qs{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&As("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,As("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{As("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):As("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Ds("string"==typeof t.token),this.A=t.token,new $s(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
529
+ */class Us{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class zs{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Ts.UNAUTHENTICATED)))}shutdown(){}}class Bs{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 Vs{constructor(t){this.t=t,this.currentUser=Ts.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const i=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let r=new Fs;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new Fs,t.enqueueRetryable((()=>i(this.currentUser)))};const s=()=>{const e=r;t.enqueueRetryable((async()=>{await e.promise,await i(this.currentUser)}))},o=t=>{As("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),s()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(As("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Fs)}}),0),s()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(As("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Os("string"==typeof e.accessToken),new Us(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 Os(null===t||"string"==typeof t),new Ts(t)}}class Hs{constructor(t,e,n,i){this.h=t,this.l=e,this.m=n,this.g=i,this.type="FirstParty",this.user=Ts.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Os(!("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 js{constructor(t,e,n,i){this.h=t,this.l=e,this.m=n,this.g=i}getToken(){return Promise.resolve(new Hs(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Ts.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class qs{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 $s{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&As("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,As("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const i=t=>{As("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>i(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?i(t):As("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Os("string"==typeof t.token),this.A=t.token,new qs(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
530
530
  /**
531
531
  * @license
532
532
  * Copyright 2020 Google LLC
@@ -542,7 +542,7 @@ let Is="9.15.0";
542
542
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
543
543
  * See the License for the specific language governing permissions and
544
544
  * limitations under the License.
545
- */function Ws(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}
545
+ */function Ks(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}
546
546
  /**
547
547
  * @license
548
548
  * Copyright 2017 Google LLC
@@ -558,7 +558,7 @@ let Is="9.15.0";
558
558
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
559
559
  * See the License for the specific language governing permissions and
560
560
  * limitations under the License.
561
- */class Ks{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=Ws(40);for(let i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%62))}return n}}function Gs(t,e){return t<e?-1:t>e?1:0}function Qs(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
561
+ */class Ws{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const i=Ks(40);for(let r=0;r<i.length;++r)n.length<20&&i[r]<e&&(n+=t.charAt(i[r]%62))}return n}}function Gs(t,e){return t<e?-1:t>e?1:0}function Qs(t,e,n){return t.length===e.length&&t.every(((t,i)=>n(t,e[i])))}
562
562
  /**
563
563
  * @license
564
564
  * Copyright 2017 Google LLC
@@ -574,7 +574,7 @@ let Is="9.15.0";
574
574
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
575
575
  * See the License for the specific language governing permissions and
576
576
  * limitations under the License.
577
- */class Ys{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Ms(xs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Ms(xs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Ms(xs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Ms(xs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Ys.fromMillis(Date.now())}static fromDate(t){return Ys.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Ys(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Gs(this.nanoseconds,t.nanoseconds):Gs(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")}}
577
+ */class Ys{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Ms(Ps.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Ms(Ps.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Ms(Ps.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Ms(Ps.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Ys.fromMillis(Date.now())}static fromDate(t){return Ys.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Ys(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Gs(this.nanoseconds,t.nanoseconds):Gs(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")}}
578
578
  /**
579
579
  * @license
580
580
  * Copyright 2017 Google LLC
@@ -606,7 +606,7 @@ let Is="9.15.0";
606
606
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
607
607
  * See the License for the specific language governing permissions and
608
608
  * limitations under the License.
609
- */class Xs{constructor(t,e,n){void 0===e?e=0:e>t.length&&Os(),void 0===n?n=t.length-e:n>t.length-e&&Os(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===Xs.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof Xs?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),i=e.get(r);if(n<i)return-1;if(n>i)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class Zs extends Xs{construct(t,e,n){return new Zs(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 Ms(xs.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new Zs(e)}static emptyPath(){return new Zs([])}}const to=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class eo extends Xs{construct(t,e,n){return new eo(t,e,n)}static isValidIdentifier(t){return to.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),eo.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new eo(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const i=()=>{if(0===n.length)throw new Ms(xs.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let s=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new Ms(xs.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Ms(xs.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(s=!s,r++):"."!==e||s?(n+=e,r++):(i(),r++)}if(i(),s)throw new Ms(xs.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new eo(e)}static emptyPath(){return new eo([])}}
609
+ */class Xs{constructor(t,e,n){void 0===e?e=0:e>t.length&&xs(),void 0===n?n=t.length-e:n>t.length-e&&xs(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===Xs.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof Xs?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 i=0;i<n;i++){const n=t.get(i),r=e.get(i);if(n<r)return-1;if(n>r)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class Zs extends Xs{construct(t,e,n){return new Zs(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 Ms(Ps.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new Zs(e)}static emptyPath(){return new Zs([])}}const to=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class eo extends Xs{construct(t,e,n){return new eo(t,e,n)}static isValidIdentifier(t){return to.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),eo.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new eo(["__name__"])}static fromServerFormat(t){const e=[];let n="",i=0;const r=()=>{if(0===n.length)throw new Ms(Ps.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let s=!1;for(;i<t.length;){const e=t[i];if("\\"===e){if(i+1===t.length)throw new Ms(Ps.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[i+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Ms(Ps.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,i+=2}else"`"===e?(s=!s,i++):"."!==e||s?(n+=e,i++):(r(),i++)}if(r(),s)throw new Ms(Ps.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new eo(e)}static emptyPath(){return new eo([])}}
610
610
  /**
611
611
  * @license
612
612
  * Copyright 2017 Google LLC
@@ -622,7 +622,7 @@ let Is="9.15.0";
622
622
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
623
623
  * See the License for the specific language governing permissions and
624
624
  * limitations under the License.
625
- */class no{constructor(t){this.path=t}static fromPath(t){return new no(Zs.fromString(t))}static fromName(t){return new no(Zs.fromString(t).popFirst(5))}static empty(){return new no(Zs.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===Zs.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Zs.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new no(new Zs(t.slice()))}}function ro(t){return new io(t.readTime,t.key,-1)}class io{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new io(Js.min(),no.empty(),-1)}static max(){return new io(Js.max(),no.empty(),-1)}}function so(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=no.comparator(t.documentKey,e.documentKey),0!==n?n:Gs(t.largestBatchId,e.largestBatchId)
625
+ */class no{constructor(t){this.path=t}static fromPath(t){return new no(Zs.fromString(t))}static fromName(t){return new no(Zs.fromString(t).popFirst(5))}static empty(){return new no(Zs.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===Zs.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Zs.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new no(new Zs(t.slice()))}}function io(t){return new ro(t.readTime,t.key,-1)}class ro{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ro(Js.min(),no.empty(),-1)}static max(){return new ro(Js.max(),no.empty(),-1)}}function so(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=no.comparator(t.documentKey,e.documentKey),0!==n?n:Gs(t.largestBatchId,e.largestBatchId)
626
626
  /**
627
627
  * @license
628
628
  * Copyright 2020 Google LLC
@@ -654,7 +654,7 @@ let Is="9.15.0";
654
654
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
655
655
  * See the License for the specific language governing permissions and
656
656
  * limitations under the License.
657
- */async function co(t){if(t.code!==xs.FAILED_PRECONDITION||t.message!==oo)throw t;As("LocalStore","Unexpectedly lost primary lease")}
657
+ */async function co(t){if(t.code!==Ps.FAILED_PRECONDITION||t.message!==oo)throw t;As("LocalStore","Unexpectedly lost primary lease")}
658
658
  /**
659
659
  * @license
660
660
  * Copyright 2017 Google LLC
@@ -670,7 +670,7 @@ let Is="9.15.0";
670
670
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
671
671
  * See the License for the specific language governing permissions and
672
672
  * limitations under the License.
673
- */class lo{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&&Os(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new lo(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof lo?e:lo.resolve(e)}catch(t){return lo.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):lo.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):lo.reject(e)}static resolve(t){return new lo(((e,n)=>{e(t)}))}static reject(t){return new lo(((e,n)=>{n(t)}))}static waitFor(t){return new lo(((e,n)=>{let r=0,i=0,s=!1;t.forEach((t=>{++r,t.next((()=>{++i,s&&i===r&&e()}),(t=>n(t)))})),s=!0,i===r&&e()}))}static or(t){let e=lo.resolve(!1);for(const n of t)e=e.next((t=>t?lo.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}static mapArray(t,e){return new lo(((n,r)=>{const i=t.length,s=new Array(i);let o=0;for(let a=0;a<i;a++){const c=a;e(t[c]).next((t=>{s[c]=t,++o,o===i&&n(s)}),(t=>r(t)))}}))}static doWhile(t,e){return new lo(((n,r)=>{const i=()=>{!0===t()?e().next((()=>{i()}),r):n()};i()}))}}function uo(t){return"IndexedDbTransactionError"===t.name}
673
+ */class lo{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&&xs(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new lo(((n,i)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,i)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,i)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof lo?e:lo.resolve(e)}catch(t){return lo.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):lo.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):lo.reject(e)}static resolve(t){return new lo(((e,n)=>{e(t)}))}static reject(t){return new lo(((e,n)=>{n(t)}))}static waitFor(t){return new lo(((e,n)=>{let i=0,r=0,s=!1;t.forEach((t=>{++i,t.next((()=>{++r,s&&r===i&&e()}),(t=>n(t)))})),s=!0,r===i&&e()}))}static or(t){let e=lo.resolve(!1);for(const n of t)e=e.next((t=>t?lo.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,i)=>{n.push(e.call(this,t,i))})),this.waitFor(n)}static mapArray(t,e){return new lo(((n,i)=>{const r=t.length,s=new Array(r);let o=0;for(let a=0;a<r;a++){const c=a;e(t[c]).next((t=>{s[c]=t,++o,o===r&&n(s)}),(t=>i(t)))}}))}static doWhile(t,e){return new lo(((n,i)=>{const r=()=>{!0===t()?e().next((()=>{r()}),i):n()};r()}))}}function uo(t){return"IndexedDbTransactionError"===t.name}
674
674
  /**
675
675
  * @license
676
676
  * Copyright 2018 Google LLC
@@ -703,7 +703,7 @@ let Is="9.15.0";
703
703
  * See the License for the specific language governing permissions and
704
704
  * limitations under the License.
705
705
  */
706
- class fo{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class po{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new po("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof po&&t.projectId===this.projectId&&t.database===this.database}}
706
+ class fo{constructor(t,e,n,i,r,s,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=i,this.ssl=r,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class po{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new po("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof po&&t.projectId===this.projectId&&t.database===this.database}}
707
707
  /**
708
708
  * @license
709
709
  * Copyright 2017 Google LLC
@@ -768,7 +768,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
768
768
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
769
769
  * See the License for the specific language governing permissions and
770
770
  * limitations under the License.
771
- */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Gs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}bo.EMPTY_BYTE_STRING=new bo("");const So=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function _o(t){if(Ds(!!t),"string"==typeof t){let e=0;const n=So.exec(t);if(Ds(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Eo(t.seconds),nanos:Eo(t.nanos)}}function Eo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function To(t){return"string"==typeof t?bo.fromBase64String(t):bo.fromUint8Array(t)}
771
+ */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Gs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}bo.EMPTY_BYTE_STRING=new bo("");const So=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Eo(t){if(Os(!!t),"string"==typeof t){let e=0;const n=So.exec(t);if(Os(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const i=new Date(t);return{seconds:Math.floor(i.getTime()/1e3),nanos:e}}return{seconds:_o(t.seconds),nanos:_o(t.nanos)}}function _o(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function To(t){return"string"==typeof t?bo.fromBase64String(t):bo.fromUint8Array(t)}
772
772
  /**
773
773
  * @license
774
774
  * Copyright 2020 Google LLC
@@ -784,7 +784,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
784
784
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
785
785
  * See the License for the specific language governing permissions and
786
786
  * limitations under the License.
787
- */function Io(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ko(t){const e=t.mapValue.fields.__previous_value__;return Io(e)?ko(e):e}function Co(t){const e=_o(t.mapValue.fields.__local_write_time__.timestampValue);return new Ys(e.seconds,e.nanos)}
787
+ */function Io(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ko(t){const e=t.mapValue.fields.__previous_value__;return Io(e)?ko(e):e}function Co(t){const e=Eo(t.mapValue.fields.__local_write_time__.timestampValue);return new Ys(e.seconds,e.nanos)}
788
788
  /**
789
789
  * @license
790
790
  * Copyright 2020 Google LLC
@@ -816,7 +816,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
816
816
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
817
817
  * See the License for the specific language governing permissions and
818
818
  * limitations under the License.
819
- */(t)?9007199254740991:10:Os()}function No(t,e){if(t===e)return!0;const n=Ro(t);if(n!==Ro(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Co(t).isEqual(Co(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=_o(t.timestampValue),r=_o(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return To(t.bytesValue).isEqual(To(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Eo(t.geoPointValue.latitude)===Eo(e.geoPointValue.latitude)&&Eo(t.geoPointValue.longitude)===Eo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Eo(t.integerValue)===Eo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Eo(t.doubleValue),r=Eo(e.doubleValue);return n===r?wo(n)===wo(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Qs(t.arrayValue.values||[],e.arrayValue.values||[],No);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(go(n)!==go(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!No(n[t],r[t])))return!1;return!0}(t,e);default:return Os()}}function Lo(t,e){return void 0!==(t.values||[]).find((t=>No(t,e)))}function Oo(t,e){if(t===e)return 0;const n=Ro(t),r=Ro(e);if(n!==r)return Gs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Gs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Eo(t.integerValue||t.doubleValue),r=Eo(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return Do(t.timestampValue,e.timestampValue);case 4:return Do(Co(t),Co(e));case 5:return Gs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=To(t),r=To(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=Gs(n[t],r[t]);if(0!==e)return e}return Gs(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Gs(Eo(t.latitude),Eo(e.latitude));return 0!==n?n:Gs(Eo(t.longitude),Eo(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Oo(n[t],r[t]);if(e)return e}return Gs(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Ao.mapValue&&e===Ao.mapValue)return 0;if(t===Ao.mapValue)return 1;if(e===Ao.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),i=e.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let t=0;t<r.length&&t<s.length;++t){const e=Gs(r[t],s[t]);if(0!==e)return e;const o=Oo(n[r[t]],i[s[t]]);if(0!==o)return o}return Gs(r.length,s.length)}(t.mapValue,e.mapValue);default:throw Os()}}function Do(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Gs(t,e);const n=_o(t),r=_o(e),i=Gs(n.seconds,r.seconds);return 0!==i?i:Gs(n.nanos,r.nanos)}function Po(t){return xo(t)}function xo(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=_o(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?To(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,no.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=xo(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const i of e)r?r=!1:n+=",",n+=`${i}:${xo(t.fields[i])}`;return n+"}"}(t.mapValue):Os();var e,n}function Mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Uo(t){return!!t&&"integerValue"in t}function Fo(t){return!!t&&"arrayValue"in t}function zo(t){return!!t&&"nullValue"in t}function Bo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Vo(t){return!!t&&"mapValue"in t}function Ho(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return mo(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Ho(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ho(t.arrayValue.values[n]);return e}return Object.assign({},t)}class jo{constructor(t,e){this.position=t,this.inclusive=e}}function $o(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(r=s.field.isKeyField()?no.comparator(no.fromName(o.referenceValue),n.key):Oo(o,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return r}function qo(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!No(t.position[n],e.position[n]))return!1;return!0}
819
+ */(t)?9007199254740991:10:xs()}function Lo(t,e){if(t===e)return!0;const n=Ro(t);if(n!==Ro(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Co(t).isEqual(Co(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=Eo(t.timestampValue),i=Eo(e.timestampValue);return n.seconds===i.seconds&&n.nanos===i.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return To(t.bytesValue).isEqual(To(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return _o(t.geoPointValue.latitude)===_o(e.geoPointValue.latitude)&&_o(t.geoPointValue.longitude)===_o(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return _o(t.integerValue)===_o(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=_o(t.doubleValue),i=_o(e.doubleValue);return n===i?wo(n)===wo(i):isNaN(n)&&isNaN(i)}return!1}(t,e);case 9:return Qs(t.arrayValue.values||[],e.arrayValue.values||[],Lo);case 10:return function(t,e){const n=t.mapValue.fields||{},i=e.mapValue.fields||{};if(go(n)!==go(i))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===i[t]||!Lo(n[t],i[t])))return!1;return!0}(t,e);default:return xs()}}function No(t,e){return void 0!==(t.values||[]).find((t=>Lo(t,e)))}function xo(t,e){if(t===e)return 0;const n=Ro(t),i=Ro(e);if(n!==i)return Gs(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return Gs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=_o(t.integerValue||t.doubleValue),i=_o(e.integerValue||e.doubleValue);return n<i?-1:n>i?1:n===i?0:isNaN(n)?isNaN(i)?0:-1:1}(t,e);case 3:return Oo(t.timestampValue,e.timestampValue);case 4:return Oo(Co(t),Co(e));case 5:return Gs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=To(t),i=To(e);return n.compareTo(i)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),i=e.split("/");for(let t=0;t<n.length&&t<i.length;t++){const e=Gs(n[t],i[t]);if(0!==e)return e}return Gs(n.length,i.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Gs(_o(t.latitude),_o(e.latitude));return 0!==n?n:Gs(_o(t.longitude),_o(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],i=e.values||[];for(let t=0;t<n.length&&t<i.length;++t){const e=xo(n[t],i[t]);if(e)return e}return Gs(n.length,i.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Ao.mapValue&&e===Ao.mapValue)return 0;if(t===Ao.mapValue)return 1;if(e===Ao.mapValue)return-1;const n=t.fields||{},i=Object.keys(n),r=e.fields||{},s=Object.keys(r);i.sort(),s.sort();for(let t=0;t<i.length&&t<s.length;++t){const e=Gs(i[t],s[t]);if(0!==e)return e;const o=xo(n[i[t]],r[s[t]]);if(0!==o)return o}return Gs(i.length,s.length)}(t.mapValue,e.mapValue);default:throw xs()}}function Oo(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Gs(t,e);const n=Eo(t),i=Eo(e),r=Gs(n.seconds,i.seconds);return 0!==r?r:Gs(n.nanos,i.nanos)}function Do(t){return Po(t)}function Po(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=Eo(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?To(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,no.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const i of t.values||[])n?n=!1:e+=",",e+=Po(i);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",i=!0;for(const r of e)i?i=!1:n+=",",n+=`${r}:${Po(t.fields[r])}`;return n+"}"}(t.mapValue):xs();var e,n}function Mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Fo(t){return!!t&&"integerValue"in t}function Uo(t){return!!t&&"arrayValue"in t}function zo(t){return!!t&&"nullValue"in t}function Bo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Vo(t){return!!t&&"mapValue"in t}function Ho(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return mo(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Ho(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ho(t.arrayValue.values[n]);return e}return Object.assign({},t)}class jo{constructor(t,e){this.position=t,this.inclusive=e}}function qo(t,e,n){let i=0;for(let r=0;r<t.position.length;r++){const s=e[r],o=t.position[r];if(i=s.field.isKeyField()?no.comparator(no.fromName(o.referenceValue),n.key):xo(o,n.data.field(s.field)),"desc"===s.dir&&(i*=-1),0!==i)break}return i}function $o(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(!Lo(t.position[n],e.position[n]))return!1;return!0}
820
820
  /**
821
821
  * @license
822
822
  * Copyright 2022 Google LLC
@@ -832,7 +832,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
832
832
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
833
833
  * See the License for the specific language governing permissions and
834
834
  * limitations under the License.
835
- */class Wo{}class Ko extends Wo{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 ta(t,e,n):"array-contains"===e?new ia(t,n):"in"===e?new sa(t,n):"not-in"===e?new oa(t,n):"array-contains-any"===e?new aa(t,n):new Ko(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ea(t,n):new na(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Oo(e,this.value)):null!==e&&Ro(this.value)===Ro(e)&&this.matchesComparison(Oo(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Os()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Go extends Wo{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Go(t,e)}matches(t){return Qo(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 Qo(t){return"and"===t.op}function Yo(t){return function(t){for(const e of t.filters)if(e instanceof Go)return!1;return!0}(t)&&Qo(t)}function Jo(t){if(t instanceof Ko)return t.field.canonicalString()+t.op.toString()+Po(t.value);{const e=t.filters.map((t=>Jo(t))).join(",");return`${t.op}(${e})`}}function Xo(t,e){return t instanceof Ko?function(t,e){return e instanceof Ko&&t.op===e.op&&t.field.isEqual(e.field)&&No(t.value,e.value)}(t,e):t instanceof Go?function(t,e){return e instanceof Go&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Xo(n,e.filters[r])),!0)}(t,e):void Os()}function Zo(t){return t instanceof Ko?function(t){return`${t.field.canonicalString()} ${t.op} ${Po(t.value)}`}(t):t instanceof Go?function(t){return t.op.toString()+" {"+t.getFilters().map(Zo).join(" ,")+"}"}(t):"Filter"}class ta extends Ko{constructor(t,e,n){super(t,e,n),this.key=no.fromName(n.referenceValue)}matches(t){const e=no.comparator(t.key,this.key);return this.matchesComparison(e)}}class ea extends Ko{constructor(t,e){super(t,"in",e),this.keys=ra("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class na extends Ko{constructor(t,e){super(t,"not-in",e),this.keys=ra("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function ra(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>no.fromName(t.referenceValue)))}class ia extends Ko{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Fo(e)&&Lo(e.arrayValue,this.value)}}class sa extends Ko{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Lo(this.value.arrayValue,e)}}class oa extends Ko{constructor(t,e){super(t,"not-in",e)}matches(t){if(Lo(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Lo(this.value.arrayValue,e)}}class aa extends Ko{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Fo(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Lo(this.value.arrayValue,t)))}}
835
+ */class Ko{}class Wo extends Ko{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new ta(t,e,n):"array-contains"===e?new ra(t,n):"in"===e?new sa(t,n):"not-in"===e?new oa(t,n):"array-contains-any"===e?new aa(t,n):new Wo(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ea(t,n):new na(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(xo(e,this.value)):null!==e&&Ro(this.value)===Ro(e)&&this.matchesComparison(xo(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 xs()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Go extends Ko{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Go(t,e)}matches(t){return Qo(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 Qo(t){return"and"===t.op}function Yo(t){return function(t){for(const e of t.filters)if(e instanceof Go)return!1;return!0}(t)&&Qo(t)}function Jo(t){if(t instanceof Wo)return t.field.canonicalString()+t.op.toString()+Do(t.value);{const e=t.filters.map((t=>Jo(t))).join(",");return`${t.op}(${e})`}}function Xo(t,e){return t instanceof Wo?function(t,e){return e instanceof Wo&&t.op===e.op&&t.field.isEqual(e.field)&&Lo(t.value,e.value)}(t,e):t instanceof Go?function(t,e){return e instanceof Go&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,i)=>t&&Xo(n,e.filters[i])),!0)}(t,e):void xs()}function Zo(t){return t instanceof Wo?function(t){return`${t.field.canonicalString()} ${t.op} ${Do(t.value)}`}(t):t instanceof Go?function(t){return t.op.toString()+" {"+t.getFilters().map(Zo).join(" ,")+"}"}(t):"Filter"}class ta extends Wo{constructor(t,e,n){super(t,e,n),this.key=no.fromName(n.referenceValue)}matches(t){const e=no.comparator(t.key,this.key);return this.matchesComparison(e)}}class ea extends Wo{constructor(t,e){super(t,"in",e),this.keys=ia("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class na extends Wo{constructor(t,e){super(t,"not-in",e),this.keys=ia("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function ia(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>no.fromName(t.referenceValue)))}class ra extends Wo{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Uo(e)&&No(e.arrayValue,this.value)}}class sa extends Wo{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&No(this.value.arrayValue,e)}}class oa extends Wo{constructor(t,e){super(t,"not-in",e)}matches(t){if(No(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!No(this.value.arrayValue,e)}}class aa extends Wo{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Uo(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>No(this.value.arrayValue,t)))}}
836
836
  /**
837
837
  * @license
838
838
  * Copyright 2022 Google LLC
@@ -864,7 +864,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
864
864
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
865
865
  * See the License for the specific language governing permissions and
866
866
  * limitations under the License.
867
- */class ua{constructor(t,e){this.comparator=t,this.root=e||da.EMPTY}insert(t,e){return new ua(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,da.BLACK,null,null))}remove(t){return new ua(this.comparator,this.root.remove(t,this.comparator).copy(null,null,da.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new ha(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new ha(this.root,t,this.comparator,!1)}getReverseIterator(){return new ha(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new ha(this.root,t,this.comparator,!0)}}class ha{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!t.isEmpty();)if(i=e?n(t.key,e):1,e&&r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}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 da{constructor(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:da.RED,this.left=null!=r?r:da.EMPTY,this.right=null!=i?i:da.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,i){return new da(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const i=n(t,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return da.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return da.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,da.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,da.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 Os();if(this.right.isRed())throw Os();const t=this.left.check();if(t!==this.right.check())throw Os();return t+(this.isRed()?0:1)}}da.EMPTY=null,da.RED=!0,da.BLACK=!1,da.EMPTY=new class{constructor(){this.size=0}get key(){throw Os()}get value(){throw Os()}get color(){throw Os()}get left(){throw Os()}get right(){throw Os()}copy(t,e,n,r,i){return this}insert(t,e,n){return new da(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}};
867
+ */class ua{constructor(t,e){this.comparator=t,this.root=e||da.EMPTY}insert(t,e){return new ua(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,da.BLACK,null,null))}remove(t){return new ua(this.comparator,this.root.remove(t,this.comparator).copy(null,null,da.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 i=this.comparator(t,n.key);if(0===i)return e+n.left.size;i<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new ha(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new ha(this.root,t,this.comparator,!1)}getReverseIterator(){return new ha(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new ha(this.root,t,this.comparator,!0)}}class ha{constructor(t,e,n,i){this.isReverse=i,this.nodeStack=[];let r=1;for(;!t.isEmpty();)if(r=e?n(t.key,e):1,e&&i&&(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 da{constructor(t,e,n,i,r){this.key=t,this.value=e,this.color=null!=n?n:da.RED,this.left=null!=i?i:da.EMPTY,this.right=null!=r?r:da.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,i,r){return new da(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=i?i: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 i=this;const r=n(t,i.key);return i=r<0?i.copy(null,null,null,i.left.insert(t,e,n),null):0===r?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n)),i.fixUp()}removeMin(){if(this.left.isEmpty())return da.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,i=this;if(e(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,e),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===e(t,i.key)){if(i.right.isEmpty())return da.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,e))}return i.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,da.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,da.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 xs();if(this.right.isRed())throw xs();const t=this.left.check();if(t!==this.right.check())throw xs();return t+(this.isRed()?0:1)}}da.EMPTY=null,da.RED=!0,da.BLACK=!1,da.EMPTY=new class{constructor(){this.size=0}get key(){throw xs()}get value(){throw xs()}get color(){throw xs()}get left(){throw xs()}get right(){throw xs()}copy(t,e,n,i,r){return this}insert(t,e,n){return new da(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}};
868
868
  /**
869
869
  * @license
870
870
  * Copyright 2017 Google LLC
@@ -881,7 +881,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
881
881
  * See the License for the specific language governing permissions and
882
882
  * limitations under the License.
883
883
  */
884
- class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new pa(this.data.getIterator())}getIteratorFrom(t){return new pa(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 fa))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new fa(this.comparator);return e.data=t,e}}class pa{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
884
+ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const i=n.getNext();if(this.comparator(i.key,t[1])>=0)return;e(i.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 pa(this.data.getIterator())}getIteratorFrom(t){return new pa(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 fa))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,i=n.getNext().key;if(0!==this.comparator(t,i))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 fa(this.comparator);return e.data=t,e}}class pa{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
885
885
  /**
886
886
  * @license
887
887
  * Copyright 2020 Google LLC
@@ -913,7 +913,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
913
913
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
914
914
  * See the License for the specific language governing permissions and
915
915
  * limitations under the License.
916
- */class ma{constructor(t){this.value=t}static empty(){return new ma({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)],!Vo(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Ho(e)}setAll(t){let e=eo.emptyPath(),n={},r=[];t.forEach(((t,i)=>{if(!e.isImmediateParentOf(i)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=i.popLast()}t?n[i.lastSegment()]=Ho(t):r.push(i.lastSegment())}));const i=this.getFieldsMap(e);this.applyChanges(i,n,r)}delete(t){const e=this.field(t.popLast());Vo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return No(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let r=e.mapValue.fields[t.get(n)];Vo(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){mo(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new ma(Ho(this.value))}}function ya(t){const e=[];return mo(t.fields,((t,n)=>{const r=new eo([t]);if(Vo(n)){const t=ya(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new ga(e)
916
+ */class ma{constructor(t){this.value=t}static empty(){return new ma({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)],!Vo(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Ho(e)}setAll(t){let e=eo.emptyPath(),n={},i=[];t.forEach(((t,r)=>{if(!e.isImmediateParentOf(r)){const t=this.getFieldsMap(e);this.applyChanges(t,n,i),n={},i=[],e=r.popLast()}t?n[r.lastSegment()]=Ho(t):i.push(r.lastSegment())}));const r=this.getFieldsMap(e);this.applyChanges(r,n,i)}delete(t){const e=this.field(t.popLast());Vo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Lo(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 i=e.mapValue.fields[t.get(n)];Vo(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=i),e=i}return e.mapValue.fields}applyChanges(t,e,n){mo(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new ma(Ho(this.value))}}function ya(t){const e=[];return mo(t.fields,((t,n)=>{const i=new eo([t]);if(Vo(n)){const t=ya(n.mapValue).fields;if(0===t.length)e.push(i);else for(const n of t)e.push(i.child(n))}else e.push(i)})),new ga(e)
917
917
  /**
918
918
  * @license
919
919
  * Copyright 2017 Google LLC
@@ -929,7 +929,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
929
929
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
930
930
  * See the License for the specific language governing permissions and
931
931
  * limitations under the License.
932
- */}class va{constructor(t,e,n,r,i,s,o){this.key=t,this.documentType=e,this.version=n,this.readTime=r,this.createTime=i,this.data=s,this.documentState=o}static newInvalidDocument(t){return new va(t,0,Js.min(),Js.min(),Js.min(),ma.empty(),0)}static newFoundDocument(t,e,n,r){return new va(t,1,e,Js.min(),n,r,0)}static newNoDocument(t,e){return new va(t,2,e,Js.min(),Js.min(),ma.empty(),0)}static newUnknownDocument(t,e){return new va(t,3,e,Js.min(),Js.min(),ma.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Js.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=ma.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=ma.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Js.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 va&&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 va(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}})`}}
932
+ */}class va{constructor(t,e,n,i,r,s,o){this.key=t,this.documentType=e,this.version=n,this.readTime=i,this.createTime=r,this.data=s,this.documentState=o}static newInvalidDocument(t){return new va(t,0,Js.min(),Js.min(),Js.min(),ma.empty(),0)}static newFoundDocument(t,e,n,i){return new va(t,1,e,Js.min(),n,i,0)}static newNoDocument(t,e){return new va(t,2,e,Js.min(),Js.min(),ma.empty(),0)}static newUnknownDocument(t,e){return new va(t,3,e,Js.min(),Js.min(),ma.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Js.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=ma.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=ma.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Js.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 va&&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 va(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}})`}}
933
933
  /**
934
934
  * @license
935
935
  * Copyright 2019 Google LLC
@@ -945,7 +945,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
945
945
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
946
946
  * See the License for the specific language governing permissions and
947
947
  * limitations under the License.
948
- */class wa{constructor(t,e=null,n=[],r=[],i=null,s=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=s,this.endAt=o,this.ft=null}}function ba(t,e=null,n=[],r=[],i=null,s=null,o=null){return new wa(t,e,n,r,i,s,o)}function Sa(t){const e=Ps(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Jo(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),vo(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Po(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Po(t))).join(",")),e.ft=t}return e.ft}function _a(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(!la(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(!Xo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!qo(t.startAt,e.startAt)&&qo(t.endAt,e.endAt)}function Ea(t){return no.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
948
+ */class wa{constructor(t,e=null,n=[],i=[],r=null,s=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=i,this.limit=r,this.startAt=s,this.endAt=o,this.ft=null}}function ba(t,e=null,n=[],i=[],r=null,s=null,o=null){return new wa(t,e,n,i,r,s,o)}function Sa(t){const e=Ds(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Jo(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),vo(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Do(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Do(t))).join(",")),e.ft=t}return e.ft}function Ea(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(!la(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(!Xo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!$o(t.startAt,e.startAt)&&$o(t.endAt,e.endAt)}function _a(t){return no.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
949
949
  /**
950
950
  * @license
951
951
  * Copyright 2017 Google LLC
@@ -961,7 +961,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
961
961
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
962
962
  * See the License for the specific language governing permissions and
963
963
  * limitations under the License.
964
- */class Ta{constructor(t,e=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function Ia(t){return new Ta(t)}function ka(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 Ca(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Aa(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Ra(t){return null!==t.collectionGroup}function Na(t){const e=Ps(t);if(null===e.dt){e.dt=[];const t=Aa(e),n=Ca(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new ca(t)),e.dt.push(new ca(eo.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 ca(eo.keyField(),t))}}}return e.dt}function La(t){const e=Ps(t);if(!e._t)if("F"===e.limitType)e._t=ba(e.path,e.collectionGroup,Na(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Na(e)){const e="desc"===n.dir?"asc":"desc";t.push(new ca(n.field,e))}const n=e.endAt?new jo(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new jo(e.startAt.position,e.startAt.inclusive):null;e._t=ba(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function Oa(t,e){e.getFirstInequalityField(),Aa(t);const n=t.filters.concat([e]);return new Ta(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Da(t,e,n){return new Ta(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Pa(t,e){return _a(La(t),La(e))&&t.limitType===e.limitType}function xa(t){return`${Sa(La(t))}|lt:${t.limitType}`}function Ma(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Zo(t))).join(", ")}]`),vo(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=>Po(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Po(t))).join(",")),`Target(${e})`}(La(t))}; limitType=${t.limitType})`}function Ua(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):no.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Na(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=$o(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Na(t),e))&&!(t.endAt&&!function(t,e,n){const r=$o(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Na(t),e))}(t,e)}function Fa(t){return(e,n)=>{let r=!1;for(const i of Na(t)){const t=za(i,e,n);if(0!==t)return t;r=r||i.field.isKeyField()}return 0}}function za(t,e,n){const r=t.field.isKeyField()?no.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),i=n.data.field(t);return null!==r&&null!==i?Oo(r,i):Os()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Os()}}
964
+ */class Ta{constructor(t,e=null,n=[],i=[],r=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=i,this.limit=r,this.limitType=s,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function Ia(t){return new Ta(t)}function ka(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 Ca(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Aa(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Ra(t){return null!==t.collectionGroup}function La(t){const e=Ds(t);if(null===e.dt){e.dt=[];const t=Aa(e),n=Ca(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new ca(t)),e.dt.push(new ca(eo.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 ca(eo.keyField(),t))}}}return e.dt}function Na(t){const e=Ds(t);if(!e._t)if("F"===e.limitType)e._t=ba(e.path,e.collectionGroup,La(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of La(e)){const e="desc"===n.dir?"asc":"desc";t.push(new ca(n.field,e))}const n=e.endAt?new jo(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new jo(e.startAt.position,e.startAt.inclusive):null;e._t=ba(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}return e._t}function xa(t,e){e.getFirstInequalityField(),Aa(t);const n=t.filters.concat([e]);return new Ta(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Oa(t,e,n){return new Ta(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Da(t,e){return Ea(Na(t),Na(e))&&t.limitType===e.limitType}function Pa(t){return`${Sa(Na(t))}|lt:${t.limitType}`}function Ma(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Zo(t))).join(", ")}]`),vo(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=>Do(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Do(t))).join(",")),`Target(${e})`}(Na(t))}; limitType=${t.limitType})`}function Fa(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):no.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of La(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 i=qo(t,e,n);return t.inclusive?i<=0:i<0}(t.startAt,La(t),e))&&!(t.endAt&&!function(t,e,n){const i=qo(t,e,n);return t.inclusive?i>=0:i>0}(t.endAt,La(t),e))}(t,e)}function Ua(t){return(e,n)=>{let i=!1;for(const r of La(t)){const t=za(r,e,n);if(0!==t)return t;i=i||r.field.isKeyField()}return 0}}function za(t,e,n){const i=t.field.isKeyField()?no.comparator(e.key,n.key):function(t,e,n){const i=e.data.field(t),r=n.data.field(t);return null!==i&&null!==r?xo(i,r):xs()}(t.field,e,n);switch(t.dir){case"asc":return i;case"desc":return-1*i;default:return xs()}}
965
965
  /**
966
966
  * @license
967
967
  * Copyright 2020 Google LLC
@@ -993,7 +993,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
993
993
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
994
994
  * See the License for the specific language governing permissions and
995
995
  * limitations under the License.
996
- */class ja{constructor(){this._=void 0}}function $a(t,e,n){return t instanceof Ka?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Ga?Qa(t,e):t instanceof Ya?Ja(t,e):function(t,e){const n=Wa(t,e),r=Za(n)+Za(t.gt);return Uo(n)&&Uo(t.gt)?Va(r):Ba(t.yt,r)}(t,e)}function qa(t,e,n){return t instanceof Ga?Qa(t,e):t instanceof Ya?Ja(t,e):n}function Wa(t,e){return t instanceof Xa?Uo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class Ka extends ja{}class Ga extends ja{constructor(t){super(),this.elements=t}}function Qa(t,e){const n=tc(e);for(const e of t.elements)n.some((t=>No(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Ya extends ja{constructor(t){super(),this.elements=t}}function Ja(t,e){let n=tc(e);for(const e of t.elements)n=n.filter((t=>!No(t,e)));return{arrayValue:{values:n}}}class Xa extends ja{constructor(t,e){super(),this.yt=t,this.gt=e}}function Za(t){return Eo(t.integerValue||t.doubleValue)}function tc(t){return Fo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class ec{constructor(t,e){this.version=t,this.transformResults=e}}class nc{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new nc}static exists(t){return new nc(void 0,t)}static updateTime(t){return new nc(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 rc(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ic{}function sc(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new gc(t.key,nc.none()):new uc(t.key,t.data,nc.none());{const n=t.data,r=ma.empty();let i=new fa(eo.comparator);for(let t of e.fields)if(!i.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),i=i.add(t)}return new hc(t.key,r,new ga(i.toArray()),nc.none())}}function oc(t,e,n){t instanceof uc?function(t,e,n){const r=t.value.clone(),i=fc(t.fieldTransforms,e,n.transformResults);r.setAll(i),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof hc?function(t,e,n){if(!rc(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=fc(t.fieldTransforms,e,n.transformResults),i=e.data;i.setAll(dc(t)),i.setAll(r),e.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ac(t,e,n,r){return t instanceof uc?function(t,e,n,r){if(!rc(t.precondition,e))return n;const i=t.value.clone(),s=pc(t.fieldTransforms,r,e);return i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null}(t,e,n,r):t instanceof hc?function(t,e,n,r){if(!rc(t.precondition,e))return n;const i=pc(t.fieldTransforms,r,e),s=e.data;return s.setAll(dc(t)),s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return rc(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function cc(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),i=Wa(r.transform,t||null);null!=i&&(null===n&&(n=ma.empty()),n.set(r.field,i))}return n||null}function lc(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)&&Qs(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Ga&&e instanceof Ga||t instanceof Ya&&e instanceof Ya?Qs(t.elements,e.elements,No):t instanceof Xa&&e instanceof Xa?No(t.gt,e.gt):t instanceof Ka&&e instanceof Ka}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class uc extends ic{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class hc extends ic{constructor(t,e,n,r,i=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function dc(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function fc(t,e,n){const r=new Map;Ds(t.length===n.length);for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,qa(o,a,n[i]))}return r}function pc(t,e,n){const r=new Map;for(const i of t){const t=i.transform,s=n.data.field(i.field);r.set(i.field,$a(t,s,e))}return r}class gc extends ic{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class mc extends ic{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
996
+ */class ja{constructor(){this._=void 0}}function qa(t,e,n){return t instanceof Wa?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Ga?Qa(t,e):t instanceof Ya?Ja(t,e):function(t,e){const n=Ka(t,e),i=Za(n)+Za(t.gt);return Fo(n)&&Fo(t.gt)?Va(i):Ba(t.yt,i)}(t,e)}function $a(t,e,n){return t instanceof Ga?Qa(t,e):t instanceof Ya?Ja(t,e):n}function Ka(t,e){return t instanceof Xa?Fo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class Wa extends ja{}class Ga extends ja{constructor(t){super(),this.elements=t}}function Qa(t,e){const n=tc(e);for(const e of t.elements)n.some((t=>Lo(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Ya extends ja{constructor(t){super(),this.elements=t}}function Ja(t,e){let n=tc(e);for(const e of t.elements)n=n.filter((t=>!Lo(t,e)));return{arrayValue:{values:n}}}class Xa extends ja{constructor(t,e){super(),this.yt=t,this.gt=e}}function Za(t){return _o(t.integerValue||t.doubleValue)}function tc(t){return Uo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class ec{constructor(t,e){this.version=t,this.transformResults=e}}class nc{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new nc}static exists(t){return new nc(void 0,t)}static updateTime(t){return new nc(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 ic(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class rc{}function sc(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new gc(t.key,nc.none()):new uc(t.key,t.data,nc.none());{const n=t.data,i=ma.empty();let r=new fa(eo.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?i.delete(t):i.set(t,e),r=r.add(t)}return new hc(t.key,i,new ga(r.toArray()),nc.none())}}function oc(t,e,n){t instanceof uc?function(t,e,n){const i=t.value.clone(),r=fc(t.fieldTransforms,e,n.transformResults);i.setAll(r),e.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(t,e,n):t instanceof hc?function(t,e,n){if(!ic(t.precondition,e))return void e.convertToUnknownDocument(n.version);const i=fc(t.fieldTransforms,e,n.transformResults),r=e.data;r.setAll(dc(t)),r.setAll(i),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ac(t,e,n,i){return t instanceof uc?function(t,e,n,i){if(!ic(t.precondition,e))return n;const r=t.value.clone(),s=pc(t.fieldTransforms,i,e);return r.setAll(s),e.convertToFoundDocument(e.version,r).setHasLocalMutations(),null}(t,e,n,i):t instanceof hc?function(t,e,n,i){if(!ic(t.precondition,e))return n;const r=pc(t.fieldTransforms,i,e),s=e.data;return s.setAll(dc(t)),s.setAll(r),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,i):function(t,e,n){return ic(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function cc(t,e){let n=null;for(const i of t.fieldTransforms){const t=e.data.field(i.field),r=Ka(i.transform,t||null);null!=r&&(null===n&&(n=ma.empty()),n.set(i.field,r))}return n||null}function lc(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)&&Qs(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Ga&&e instanceof Ga||t instanceof Ya&&e instanceof Ya?Qs(t.elements,e.elements,Lo):t instanceof Xa&&e instanceof Xa?Lo(t.gt,e.gt):t instanceof Wa&&e instanceof Wa}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class uc extends rc{constructor(t,e,n,i=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class hc extends rc{constructor(t,e,n,i,r=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=i,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function dc(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const i=t.data.field(n);e.set(n,i)}})),e}function fc(t,e,n){const i=new Map;Os(t.length===n.length);for(let r=0;r<n.length;r++){const s=t[r],o=s.transform,a=e.data.field(s.field);i.set(s.field,$a(o,a,n[r]))}return i}function pc(t,e,n){const i=new Map;for(const r of t){const t=r.transform,s=n.data.field(r.field);i.set(r.field,qa(t,s,e))}return i}class gc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class mc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
997
997
  /**
998
998
  * @license
999
999
  * Copyright 2017 Google LLC
@@ -1025,7 +1025,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
1025
1025
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1026
1026
  * See the License for the specific language governing permissions and
1027
1027
  * limitations under the License.
1028
- */var vc,wc;function bc(t){if(void 0===t)return Rs("GRPC error has no .code"),xs.UNKNOWN;switch(t){case vc.OK:return xs.OK;case vc.CANCELLED:return xs.CANCELLED;case vc.UNKNOWN:return xs.UNKNOWN;case vc.DEADLINE_EXCEEDED:return xs.DEADLINE_EXCEEDED;case vc.RESOURCE_EXHAUSTED:return xs.RESOURCE_EXHAUSTED;case vc.INTERNAL:return xs.INTERNAL;case vc.UNAVAILABLE:return xs.UNAVAILABLE;case vc.UNAUTHENTICATED:return xs.UNAUTHENTICATED;case vc.INVALID_ARGUMENT:return xs.INVALID_ARGUMENT;case vc.NOT_FOUND:return xs.NOT_FOUND;case vc.ALREADY_EXISTS:return xs.ALREADY_EXISTS;case vc.PERMISSION_DENIED:return xs.PERMISSION_DENIED;case vc.FAILED_PRECONDITION:return xs.FAILED_PRECONDITION;case vc.ABORTED:return xs.ABORTED;case vc.OUT_OF_RANGE:return xs.OUT_OF_RANGE;case vc.UNIMPLEMENTED:return xs.UNIMPLEMENTED;case vc.DATA_LOSS:return xs.DATA_LOSS;default:return Os()}}(wc=vc||(vc={}))[wc.OK=0]="OK",wc[wc.CANCELLED=1]="CANCELLED",wc[wc.UNKNOWN=2]="UNKNOWN",wc[wc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",wc[wc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",wc[wc.NOT_FOUND=5]="NOT_FOUND",wc[wc.ALREADY_EXISTS=6]="ALREADY_EXISTS",wc[wc.PERMISSION_DENIED=7]="PERMISSION_DENIED",wc[wc.UNAUTHENTICATED=16]="UNAUTHENTICATED",wc[wc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",wc[wc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",wc[wc.ABORTED=10]="ABORTED",wc[wc.OUT_OF_RANGE=11]="OUT_OF_RANGE",wc[wc.UNIMPLEMENTED=12]="UNIMPLEMENTED",wc[wc.INTERNAL=13]="INTERNAL",wc[wc.UNAVAILABLE=14]="UNAVAILABLE",wc[wc.DATA_LOSS=15]="DATA_LOSS";
1028
+ */var vc,wc;function bc(t){if(void 0===t)return Rs("GRPC error has no .code"),Ps.UNKNOWN;switch(t){case vc.OK:return Ps.OK;case vc.CANCELLED:return Ps.CANCELLED;case vc.UNKNOWN:return Ps.UNKNOWN;case vc.DEADLINE_EXCEEDED:return Ps.DEADLINE_EXCEEDED;case vc.RESOURCE_EXHAUSTED:return Ps.RESOURCE_EXHAUSTED;case vc.INTERNAL:return Ps.INTERNAL;case vc.UNAVAILABLE:return Ps.UNAVAILABLE;case vc.UNAUTHENTICATED:return Ps.UNAUTHENTICATED;case vc.INVALID_ARGUMENT:return Ps.INVALID_ARGUMENT;case vc.NOT_FOUND:return Ps.NOT_FOUND;case vc.ALREADY_EXISTS:return Ps.ALREADY_EXISTS;case vc.PERMISSION_DENIED:return Ps.PERMISSION_DENIED;case vc.FAILED_PRECONDITION:return Ps.FAILED_PRECONDITION;case vc.ABORTED:return Ps.ABORTED;case vc.OUT_OF_RANGE:return Ps.OUT_OF_RANGE;case vc.UNIMPLEMENTED:return Ps.UNIMPLEMENTED;case vc.DATA_LOSS:return Ps.DATA_LOSS;default:return xs()}}(wc=vc||(vc={}))[wc.OK=0]="OK",wc[wc.CANCELLED=1]="CANCELLED",wc[wc.UNKNOWN=2]="UNKNOWN",wc[wc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",wc[wc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",wc[wc.NOT_FOUND=5]="NOT_FOUND",wc[wc.ALREADY_EXISTS=6]="ALREADY_EXISTS",wc[wc.PERMISSION_DENIED=7]="PERMISSION_DENIED",wc[wc.UNAUTHENTICATED=16]="UNAUTHENTICATED",wc[wc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",wc[wc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",wc[wc.ABORTED=10]="ABORTED",wc[wc.OUT_OF_RANGE=11]="OUT_OF_RANGE",wc[wc.UNIMPLEMENTED=12]="UNIMPLEMENTED",wc[wc.INTERNAL=13]="INTERNAL",wc[wc.UNAVAILABLE=14]="UNAVAILABLE",wc[wc.DATA_LOSS=15]="DATA_LOSS";
1029
1029
  /**
1030
1030
  * @license
1031
1031
  * Copyright 2017 Google LLC
@@ -1042,7 +1042,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
1042
1042
  * See the License for the specific language governing permissions and
1043
1043
  * limitations under the License.
1044
1044
  */
1045
- class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],t))return void(r[n]=[t,e]);r.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(t){mo(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return yo(this.inner)}size(){return this.innerSize}}
1045
+ class Sc{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,i]of n)if(this.equalsFn(e,t))return i}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),i=this.inner[n];if(void 0===i)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<i.length;n++)if(this.equalsFn(i[n][0],t))return void(i[n]=[t,e]);i.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],t))return 1===n.length?delete this.inner[e]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(t){mo(this.inner,((e,n)=>{for(const[e,i]of n)t(e,i)}))}isEmpty(){return yo(this.inner)}size(){return this.innerSize}}
1046
1046
  /**
1047
1047
  * @license
1048
1048
  * Copyright 2017 Google LLC
@@ -1058,7 +1058,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1058
1058
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1059
1059
  * See the License for the specific language governing permissions and
1060
1060
  * limitations under the License.
1061
- */const _c=new ua(no.comparator);function Ec(){return _c}const Tc=new ua(no.comparator);function Ic(...t){let e=Tc;for(const n of t)e=e.insert(n.key,n);return e}function kc(t){let e=Tc;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Cc(){return Rc()}function Ac(){return Rc()}function Rc(){return new Sc((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Nc=new ua(no.comparator),Lc=new fa(no.comparator);function Oc(...t){let e=Lc;for(const n of t)e=e.add(n);return e}const Dc=new fa(Gs);function Pc(){return Dc}
1061
+ */const Ec=new ua(no.comparator);function _c(){return Ec}const Tc=new ua(no.comparator);function Ic(...t){let e=Tc;for(const n of t)e=e.insert(n.key,n);return e}function kc(t){let e=Tc;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Cc(){return Rc()}function Ac(){return Rc()}function Rc(){return new Sc((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Lc=new ua(no.comparator),Nc=new fa(no.comparator);function xc(...t){let e=Nc;for(const n of t)e=e.add(n);return e}const Oc=new fa(Gs);function Dc(){return Oc}
1062
1062
  /**
1063
1063
  * @license
1064
1064
  * Copyright 2017 Google LLC
@@ -1074,7 +1074,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1074
1074
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1075
1075
  * See the License for the specific language governing permissions and
1076
1076
  * limitations under the License.
1077
- */class xc{constructor(t,e,n,r,i){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const r=new Map;return r.set(t,Mc.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new xc(Js.min(),r,Pc(),Ec(),Oc())}}class Mc{constructor(t,e,n,r,i){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Mc(n,e,Oc(),Oc(),Oc())}}
1077
+ */class Pc{constructor(t,e,n,i,r){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=i,this.resolvedLimboDocuments=r}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const i=new Map;return i.set(t,Mc.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new Pc(Js.min(),i,Dc(),_c(),xc())}}class Mc{constructor(t,e,n,i,r){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=i,this.removedDocuments=r}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Mc(n,e,xc(),xc(),xc())}}
1078
1078
  /**
1079
1079
  * @license
1080
1080
  * Copyright 2017 Google LLC
@@ -1090,7 +1090,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1090
1090
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1091
1091
  * See the License for the specific language governing permissions and
1092
1092
  * limitations under the License.
1093
- */class Uc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Fc{constructor(t,e){this.targetId=t,this.Et=e}}class zc{constructor(t,e,n=bo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Bc{constructor(){this.At=0,this.Rt=jc(),this.bt=bo.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Oc(),e=Oc(),n=Oc();return this.Rt.forEach(((r,i)=>{switch(i){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Os()}})),new Mc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=jc()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Vc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ec(),this.qt=Hc(),this.Ut=new fa(Gs)}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:Os()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(Ea(t))if(0===n){const n=new no(t.path);this.Qt(e,n,va.newNoDocument(n,Js.min()))}else Ds(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const i=this.Yt(r);if(i){if(n.current&&Ea(i.target)){const e=new no(i.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,va.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Oc();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new xc(t,e,this.Ut,this.Lt,n);return this.Lt=Ec(),this.qt=Hc(),this.Ut=new fa(Gs),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Bc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new fa(Gs),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||As("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 Bc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Hc(){return new ua(no.comparator)}function jc(){return new ua(no.comparator)}
1093
+ */class Fc{constructor(t,e,n,i){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=i}}class Uc{constructor(t,e){this.targetId=t,this.Et=e}}class zc{constructor(t,e,n=bo.EMPTY_BYTE_STRING,i=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=i}}class Bc{constructor(){this.At=0,this.Rt=jc(),this.bt=bo.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=xc(),e=xc(),n=xc();return this.Rt.forEach(((i,r)=>{switch(r){case 0:t=t.add(i);break;case 2:e=e.add(i);break;case 1:n=n.add(i);break;default:xs()}})),new Mc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=jc()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Vc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=_c(),this.qt=Hc(),this.Ut=new fa(Gs)}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:xs()}}))}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,i=this.Yt(e);if(i){const t=i.target;if(_a(t))if(0===n){const n=new no(t.path);this.Qt(e,n,va.newNoDocument(n,Js.min()))}else Os(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,i)=>{const r=this.Yt(i);if(r){if(n.current&&_a(r.target)){const e=new no(r.target.path);null!==this.Lt.get(e)||this.te(i,e)||this.Qt(i,e,va.newNoDocument(e,t))}n.St&&(e.set(i,n.Ct()),n.xt())}}));let n=xc();this.qt.forEach(((t,e)=>{let i=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(i=!1,!1)})),i&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const i=new Pc(t,e,this.Ut,this.Lt,n);return this.Lt=_c(),this.qt=Hc(),this.Ut=new fa(Gs),i}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 i=this.Wt(t);this.te(t,e)?i.Nt(e,1):i.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 Bc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new fa(Gs),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||As("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 Bc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Hc(){return new ua(no.comparator)}function jc(){return new ua(no.comparator)}
1094
1094
  /**
1095
1095
  * @license
1096
1096
  * Copyright 2017 Google LLC
@@ -1106,7 +1106,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1106
1106
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1107
1107
  * See the License for the specific language governing permissions and
1108
1108
  * limitations under the License.
1109
- */const $c={asc:"ASCENDING",desc:"DESCENDING"},qc={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Wc={and:"AND",or:"OR"};class Kc{constructor(t,e){this.databaseId=t,this.wt=e}}function Gc(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Qc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Yc(t,e){return Gc(t,e.toTimestamp())}function Jc(t){return Ds(!!t),Js.fromTimestamp(function(t){const e=_o(t);return new Ys(e.seconds,e.nanos)}(t))}function Xc(t,e){return function(t){return new Zs(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Zc(t){const e=Zs.fromString(t);return Ds(yl(e)),e}function tl(t,e){return Xc(t.databaseId,e.path)}function el(t,e){const n=Zc(e);if(n.get(1)!==t.databaseId.projectId)throw new Ms(xs.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 Ms(xs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new no(il(n))}function nl(t,e){return Xc(t.databaseId,e)}function rl(t){return new Zs(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function il(t){return Ds(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function sl(t,e,n){return{name:tl(t,e),fields:n.value.mapValue.fields}}function ol(t,e){return{documents:[nl(t,e.path)]}}function al(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=nl(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=nl(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0!==t.length)return gl(Go.create(t,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const s=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:fl(t.field),direction:ul(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.wt||vo(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 cl(t){let e=function(t){const e=Zc(t);return 4===e.length?Zs.emptyPath():il(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ds(1===r);const t=n.from[0];t.allDescendants?i=t.collectionId:e=e.child(t.collectionId)}let s=[];n.where&&(s=function(t){const e=ll(t);return e instanceof Go&&Yo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new ca(pl(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,vo(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new jo(n,e)}(n.startAt));let l=null;return n.endAt&&(l=function(t){const e=!t.before,n=t.values||[];return new jo(n,e)}(n.endAt)),function(t,e,n,r,i,s,o,a){return new Ta(t,e,n,r,i,s,o,a)}(e,i,o,s,a,"F",c,l)}function ll(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=pl(t.unaryFilter.field);return Ko.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=pl(t.unaryFilter.field);return Ko.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=pl(t.unaryFilter.field);return Ko.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=pl(t.unaryFilter.field);return Ko.create(i,"!=",{nullValue:"NULL_VALUE"});default:return Os()}}(t):void 0!==t.fieldFilter?function(t){return Ko.create(pl(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 Os()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Go.create(t.compositeFilter.filters.map((t=>ll(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Os()}}(t.compositeFilter.op))}(t):Os()}function ul(t){return $c[t]}function hl(t){return qc[t]}function dl(t){return Wc[t]}function fl(t){return{fieldPath:t.canonicalString()}}function pl(t){return eo.fromServerFormat(t.fieldPath)}function gl(t){return t instanceof Ko?function(t){if("=="===t.op){if(Bo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NAN"}};if(zo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Bo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NOT_NAN"}};if(zo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:fl(t.field),op:hl(t.op),value:t.value}}}(t):t instanceof Go?function(t){const e=t.getFilters().map((t=>gl(t)));return 1===e.length?e[0]:{compositeFilter:{op:dl(t.op),filters:e}}}(t):Os()}function ml(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function yl(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1109
+ */const qc={asc:"ASCENDING",desc:"DESCENDING"},$c={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Kc={and:"AND",or:"OR"};class Wc{constructor(t,e){this.databaseId=t,this.wt=e}}function Gc(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Qc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Yc(t,e){return Gc(t,e.toTimestamp())}function Jc(t){return Os(!!t),Js.fromTimestamp(function(t){const e=Eo(t);return new Ys(e.seconds,e.nanos)}(t))}function Xc(t,e){return function(t){return new Zs(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Zc(t){const e=Zs.fromString(t);return Os(yl(e)),e}function tl(t,e){return Xc(t.databaseId,e.path)}function el(t,e){const n=Zc(e);if(n.get(1)!==t.databaseId.projectId)throw new Ms(Ps.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 Ms(Ps.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new no(rl(n))}function nl(t,e){return Xc(t.databaseId,e)}function il(t){return new Zs(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function rl(t){return Os(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function sl(t,e,n){return{name:tl(t,e),fields:n.value.mapValue.fields}}function ol(t,e){return{documents:[nl(t,e.path)]}}function al(t,e){const n={structuredQuery:{}},i=e.path;null!==e.collectionGroup?(n.parent=nl(t,i),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=nl(t,i.popLast()),n.structuredQuery.from=[{collectionId:i.lastSegment()}]);const r=function(t){if(0!==t.length)return gl(Go.create(t,"and"))}(e.filters);r&&(n.structuredQuery.where=r);const s=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:fl(t.field),direction:ul(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.wt||vo(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 cl(t){let e=function(t){const e=Zc(t);return 4===e.length?Zs.emptyPath():rl(e)}(t.parent);const n=t.structuredQuery,i=n.from?n.from.length:0;let r=null;if(i>0){Os(1===i);const t=n.from[0];t.allDescendants?r=t.collectionId:e=e.child(t.collectionId)}let s=[];n.where&&(s=function(t){const e=ll(t);return e instanceof Go&&Yo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new ca(pl(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,vo(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new jo(n,e)}(n.startAt));let l=null;return n.endAt&&(l=function(t){const e=!t.before,n=t.values||[];return new jo(n,e)}(n.endAt)),function(t,e,n,i,r,s,o,a){return new Ta(t,e,n,i,r,s,o,a)}(e,r,o,s,a,"F",c,l)}function ll(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=pl(t.unaryFilter.field);return Wo.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=pl(t.unaryFilter.field);return Wo.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=pl(t.unaryFilter.field);return Wo.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=pl(t.unaryFilter.field);return Wo.create(r,"!=",{nullValue:"NULL_VALUE"});default:return xs()}}(t):void 0!==t.fieldFilter?function(t){return Wo.create(pl(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 xs()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Go.create(t.compositeFilter.filters.map((t=>ll(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return xs()}}(t.compositeFilter.op))}(t):xs()}function ul(t){return qc[t]}function hl(t){return $c[t]}function dl(t){return Kc[t]}function fl(t){return{fieldPath:t.canonicalString()}}function pl(t){return eo.fromServerFormat(t.fieldPath)}function gl(t){return t instanceof Wo?function(t){if("=="===t.op){if(Bo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NAN"}};if(zo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Bo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NOT_NAN"}};if(zo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:fl(t.field),op:hl(t.op),value:t.value}}}(t):t instanceof Go?function(t){const e=t.getFilters().map((t=>gl(t)));return 1===e.length?e[0]:{compositeFilter:{op:dl(t.op),filters:e}}}(t):xs()}function ml(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function yl(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1110
1110
  /**
1111
1111
  * @license
1112
1112
  * Copyright 2017 Google LLC
@@ -1122,7 +1122,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1122
1122
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1123
1123
  * See the License for the specific language governing permissions and
1124
1124
  * limitations under the License.
1125
- */class vl{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&oc(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=ac(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=ac(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ac();return this.mutations.forEach((r=>{const i=t.get(r.key),s=i.overlayedDocument;let o=this.applyToLocalView(s,i.mutatedFields);o=e.has(r.key)?null:o;const a=sc(s,o);null!==a&&n.set(r.key,a),s.isValidDocument()||s.convertToNoDocument(Js.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Oc())}isEqual(t){return this.batchId===t.batchId&&Qs(this.mutations,t.mutations,((t,e)=>lc(t,e)))&&Qs(this.baseMutations,t.baseMutations,((t,e)=>lc(t,e)))}}class wl{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Ds(t.mutations.length===n.length);let r=Nc;const i=t.mutations;for(let t=0;t<i.length;t++)r=r.insert(i[t].key,n[t].version);return new wl(t,e,n,r)}}
1125
+ */class vl{constructor(t,e,n,i){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const i=this.mutations[e];i.key.isEqual(t.key)&&oc(i,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=ac(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=ac(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ac();return this.mutations.forEach((i=>{const r=t.get(i.key),s=r.overlayedDocument;let o=this.applyToLocalView(s,r.mutatedFields);o=e.has(i.key)?null:o;const a=sc(s,o);null!==a&&n.set(i.key,a),s.isValidDocument()||s.convertToNoDocument(Js.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),xc())}isEqual(t){return this.batchId===t.batchId&&Qs(this.mutations,t.mutations,((t,e)=>lc(t,e)))&&Qs(this.baseMutations,t.baseMutations,((t,e)=>lc(t,e)))}}class wl{constructor(t,e,n,i){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=i}static from(t,e,n){Os(t.mutations.length===n.length);let i=Lc;const r=t.mutations;for(let t=0;t<r.length;t++)i=i.insert(r[t].key,n[t].version);return new wl(t,e,n,i)}}
1126
1126
  /**
1127
1127
  * @license
1128
1128
  * Copyright 2022 Google LLC
@@ -1154,7 +1154,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1154
1154
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1155
1155
  * See the License for the specific language governing permissions and
1156
1156
  * limitations under the License.
1157
- */class Sl{constructor(t,e,n,r,i=Js.min(),s=Js.min(),o=bo.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o}withSequenceNumber(t){return new Sl(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new Sl(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new Sl(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
1157
+ */class Sl{constructor(t,e,n,i,r=Js.min(),s=Js.min(),o=bo.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o}withSequenceNumber(t){return new Sl(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new Sl(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new Sl(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
1158
1158
  /**
1159
1159
  * @license
1160
1160
  * Copyright 2017 Google LLC
@@ -1170,7 +1170,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1170
1170
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1171
1171
  * See the License for the specific language governing permissions and
1172
1172
  * limitations under the License.
1173
- */class _l{constructor(t){this.ie=t}}function El(t){const e=cl({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Da(e,e.limit,"L"):e}
1173
+ */class El{constructor(t){this.ie=t}}function _l(t){const e=cl({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Oa(e,e.limit,"L"):e}
1174
1174
  /**
1175
1175
  * @license
1176
1176
  * Copyright 2019 Google LLC
@@ -1186,7 +1186,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1186
1186
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1187
1187
  * See the License for the specific language governing permissions and
1188
1188
  * limitations under the License.
1189
- */class Tl{constructor(){this.Je=new Il}addToCollectionParentIndex(t,e){return this.Je.add(e),lo.resolve()}getCollectionParents(t,e){return lo.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return lo.resolve()}deleteFieldIndex(t,e){return lo.resolve()}getDocumentsMatchingTarget(t,e){return lo.resolve(null)}getIndexType(t,e){return lo.resolve(0)}getFieldIndexes(t,e){return lo.resolve([])}getNextCollectionGroupToUpdate(t){return lo.resolve(null)}getMinOffset(t,e){return lo.resolve(io.min())}getMinOffsetFromCollectionGroup(t,e){return lo.resolve(io.min())}updateCollectionGroup(t,e,n){return lo.resolve()}updateIndexEntries(t,e){return lo.resolve()}}class Il{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new fa(Zs.comparator),i=!r.has(n);return this.index[e]=r.add(n),i}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new fa(Zs.comparator)).toArray()}}
1189
+ */class Tl{constructor(){this.Je=new Il}addToCollectionParentIndex(t,e){return this.Je.add(e),lo.resolve()}getCollectionParents(t,e){return lo.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return lo.resolve()}deleteFieldIndex(t,e){return lo.resolve()}getDocumentsMatchingTarget(t,e){return lo.resolve(null)}getIndexType(t,e){return lo.resolve(0)}getFieldIndexes(t,e){return lo.resolve([])}getNextCollectionGroupToUpdate(t){return lo.resolve(null)}getMinOffset(t,e){return lo.resolve(ro.min())}getMinOffsetFromCollectionGroup(t,e){return lo.resolve(ro.min())}updateCollectionGroup(t,e,n){return lo.resolve()}updateIndexEntries(t,e){return lo.resolve()}}class Il{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),i=this.index[e]||new fa(Zs.comparator),r=!i.has(n);return this.index[e]=i.add(n),r}has(t){const e=t.lastSegment(),n=t.popLast(),i=this.index[e];return i&&i.has(n)}getEntries(t){return(this.index[t]||new fa(Zs.comparator)).toArray()}}
1190
1190
  /**
1191
1191
  * @license
1192
1192
  * Copyright 2017 Google LLC
@@ -1266,7 +1266,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1266
1266
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1267
1267
  * See the License for the specific language governing permissions and
1268
1268
  * limitations under the License.
1269
- */class Rl{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&ac(n.mutation,t,ga.empty(),Ys.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Oc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Oc()){const r=Cc();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Ic();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Cc();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Oc())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let i=Ec();const s=Rc(),o=Rc();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof hc)?i=i.insert(e.key,e):void 0!==o&&(s.set(e.key,o.mutation.getFieldMask()),ac(o.mutation,e,o.mutation.getFieldMask(),Ys.now()))})),this.recalculateAndSaveOverlays(t,i).next((t=>(t.forEach(((t,e)=>s.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Al(e,null!==(n=s.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=Rc();let r=new ua(((t,e)=>t-e)),i=Oc();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const i of t)i.keys().forEach((t=>{const s=e.get(t);if(null===s)return;let o=n.get(t)||ga.empty();o=i.applyToLocalView(s,o),n.set(t,o);const a=(r.get(i.batchId)||Oc()).add(t);r=r.insert(i.batchId,a)}))})).next((()=>{const s=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,l=Ac();c.forEach((t=>{if(!i.has(t)){const r=sc(e.get(t),n.get(t));null!==r&&l.set(t,r),i=i.add(t)}})),s.push(this.documentOverlayCache.saveOverlays(t,a,l))}return lo.waitFor(s)})).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 no.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Ra(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((i=>{const s=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-i.size):lo.resolve(Cc());let o=-1,a=i;return s.next((e=>lo.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(e)?lo.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,i))).next((()=>this.computeViews(t,a,e,Oc()))).next((t=>({batchId:o,changes:kc(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new no(e)).next((t=>{let e=Ic();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let i=Ic();return this.indexManager.getCollectionParents(t,r).next((s=>lo.forEach(s,(s=>{const o=function(t,e){return new Ta(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,s.child(r));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{i=i.insert(t,e)}))}))})).next((()=>i))))}getDocumentsMatchingCollectionQuery(t,e,n){let r;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((i=>(r=i,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===r.get(n)&&(r=r.insert(n,va.newInvalidDocument(n)))}));let n=Ic();return r.forEach(((r,i)=>{const s=t.get(r);void 0!==s&&ac(s.mutation,i,ga.empty(),Ys.now()),Ua(e,i)&&(n=n.insert(r,i))})),n}))}}
1269
+ */class Rl{constructor(t,e,n,i){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=i}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((i=>(n=i,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&ac(n.mutation,t,ga.empty(),Ys.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,xc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=xc()){const i=Cc();return this.populateOverlays(t,i,e).next((()=>this.computeViews(t,e,i,n).next((t=>{let e=Ic();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Cc();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,xc())))}populateOverlays(t,e,n){const i=[];return n.forEach((t=>{e.has(t)||i.push(t)})),this.documentOverlayCache.getOverlays(t,i).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,i){let r=_c();const s=Rc(),o=Rc();return e.forEach(((t,e)=>{const o=n.get(e.key);i.has(e.key)&&(void 0===o||o.mutation instanceof hc)?r=r.insert(e.key,e):void 0!==o&&(s.set(e.key,o.mutation.getFieldMask()),ac(o.mutation,e,o.mutation.getFieldMask(),Ys.now()))})),this.recalculateAndSaveOverlays(t,r).next((t=>(t.forEach(((t,e)=>s.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Al(e,null!==(n=s.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=Rc();let i=new ua(((t,e)=>t-e)),r=xc();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const r of t)r.keys().forEach((t=>{const s=e.get(t);if(null===s)return;let o=n.get(t)||ga.empty();o=r.applyToLocalView(s,o),n.set(t,o);const a=(i.get(r.batchId)||xc()).add(t);i=i.insert(r.batchId,a)}))})).next((()=>{const s=[],o=i.getReverseIterator();for(;o.hasNext();){const i=o.getNext(),a=i.key,c=i.value,l=Ac();c.forEach((t=>{if(!r.has(t)){const i=sc(e.get(t),n.get(t));null!==i&&l.set(t,i),r=r.add(t)}})),s.push(this.documentOverlayCache.saveOverlays(t,a,l))}return lo.waitFor(s)})).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 no.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Ra(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,i).next((r=>{const s=i-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,i-r.size):lo.resolve(Cc());let o=-1,a=r;return s.next((e=>lo.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(e)?lo.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,xc()))).next((t=>({batchId:o,changes:kc(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new no(e)).next((t=>{let e=Ic();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const i=e.collectionGroup;let r=Ic();return this.indexManager.getCollectionParents(t,i).next((s=>lo.forEach(s,(s=>{const o=function(t,e){return new Ta(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,s.child(i));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{r=r.insert(t,e)}))}))})).next((()=>r))))}getDocumentsMatchingCollectionQuery(t,e,n){let i;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((r=>(i=r,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===i.get(n)&&(i=i.insert(n,va.newInvalidDocument(n)))}));let n=Ic();return i.forEach(((i,r)=>{const s=t.get(i);void 0!==s&&ac(s.mutation,r,ga.empty(),Ys.now()),Fa(e,r)&&(n=n.insert(i,r))})),n}))}}
1270
1270
  /**
1271
1271
  * @license
1272
1272
  * Copyright 2020 Google LLC
@@ -1282,7 +1282,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1282
1282
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1283
1283
  * See the License for the specific language governing permissions and
1284
1284
  * limitations under the License.
1285
- */class Nl{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return lo.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Jc(n.createTime)}),lo.resolve()}getNamedQuery(t,e){return lo.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:El(t.bundledQuery),readTime:Jc(t.readTime)}}(e)),lo.resolve()}}
1285
+ */class Ll{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return lo.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Jc(n.createTime)}),lo.resolve()}getNamedQuery(t,e){return lo.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:_l(t.bundledQuery),readTime:Jc(t.readTime)}}(e)),lo.resolve()}}
1286
1286
  /**
1287
1287
  * @license
1288
1288
  * Copyright 2022 Google LLC
@@ -1298,7 +1298,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1298
1298
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1299
1299
  * See the License for the specific language governing permissions and
1300
1300
  * limitations under the License.
1301
- */class Ll{constructor(){this.overlays=new ua(no.comparator),this.es=new Map}getOverlay(t,e){return lo.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Cc();return lo.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,r)=>{this.oe(t,e,r)})),lo.resolve()}removeOverlaysForBatchId(t,e,n){const r=this.es.get(n);return void 0!==r&&(r.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),lo.resolve()}getOverlaysForCollection(t,e,n){const r=Cc(),i=e.length+1,s=new no(e.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){const t=o.getNext().value,s=t.getKey();if(!e.isPrefixOf(s.path))break;s.path.length===i&&t.largestBatchId>n&&r.set(t.getKey(),t)}return lo.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let i=new ua(((t,e)=>t-e));const s=this.overlays.getIterator();for(;s.hasNext();){const t=s.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=i.get(t.largestBatchId);null===e&&(e=Cc(),i=i.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Cc(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return lo.resolve(o)}oe(t,e,n){const r=this.overlays.get(n.key);if(null!==r){const t=this.es.get(r.largestBatchId).delete(n.key);this.es.set(r.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new bl(e,n));let i=this.es.get(e);void 0===i&&(i=Oc(),this.es.set(e,i)),this.es.set(e,i.add(n.key))}}
1301
+ */class Nl{constructor(){this.overlays=new ua(no.comparator),this.es=new Map}getOverlay(t,e){return lo.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Cc();return lo.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,i)=>{this.oe(t,e,i)})),lo.resolve()}removeOverlaysForBatchId(t,e,n){const i=this.es.get(n);return void 0!==i&&(i.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),lo.resolve()}getOverlaysForCollection(t,e,n){const i=Cc(),r=e.length+1,s=new no(e.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){const t=o.getNext().value,s=t.getKey();if(!e.isPrefixOf(s.path))break;s.path.length===r&&t.largestBatchId>n&&i.set(t.getKey(),t)}return lo.resolve(i)}getOverlaysForCollectionGroup(t,e,n,i){let r=new ua(((t,e)=>t-e));const s=this.overlays.getIterator();for(;s.hasNext();){const t=s.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=r.get(t.largestBatchId);null===e&&(e=Cc(),r=r.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Cc(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=i)););return lo.resolve(o)}oe(t,e,n){const i=this.overlays.get(n.key);if(null!==i){const t=this.es.get(i.largestBatchId).delete(n.key);this.es.set(i.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new bl(e,n));let r=this.es.get(e);void 0===r&&(r=xc(),this.es.set(e,r)),this.es.set(e,r.add(n.key))}}
1302
1302
  /**
1303
1303
  * @license
1304
1304
  * Copyright 2017 Google LLC
@@ -1314,7 +1314,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1314
1314
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1315
1315
  * See the License for the specific language governing permissions and
1316
1316
  * limitations under the License.
1317
- */class Ol{constructor(){this.ns=new fa(Dl.ss),this.rs=new fa(Dl.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Dl(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 Dl(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new no(new Zs([])),n=new Dl(e,t),r=new Dl(e,t+1),i=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),i.push(t.key)})),i}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 no(new Zs([])),n=new Dl(e,t),r=new Dl(e,t+1);let i=Oc();return this.rs.forEachInRange([n,r],(t=>{i=i.add(t.key)})),i}containsKey(t){const e=new Dl(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Dl{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return no.comparator(t.key,e.key)||Gs(t._s,e._s)}static os(t,e){return Gs(t._s,e._s)||no.comparator(t.key,e.key)}}
1317
+ */class xl{constructor(){this.ns=new fa(Ol.ss),this.rs=new fa(Ol.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Ol(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 Ol(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new no(new Zs([])),n=new Ol(e,t),i=new Ol(e,t+1),r=[];return this.rs.forEachInRange([n,i],(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 no(new Zs([])),n=new Ol(e,t),i=new Ol(e,t+1);let r=xc();return this.rs.forEachInRange([n,i],(t=>{r=r.add(t.key)})),r}containsKey(t){const e=new Ol(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ol{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return no.comparator(t.key,e.key)||Gs(t._s,e._s)}static os(t,e){return Gs(t._s,e._s)||no.comparator(t.key,e.key)}}
1318
1318
  /**
1319
1319
  * @license
1320
1320
  * Copyright 2017 Google LLC
@@ -1330,7 +1330,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1330
1330
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1331
1331
  * See the License for the specific language governing permissions and
1332
1332
  * limitations under the License.
1333
- */class Pl{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new fa(Dl.ss)}checkEmpty(t){return lo.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const i=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const s=new vl(i,e,n,r);this.mutationQueue.push(s);for(const e of r)this.gs=this.gs.add(new Dl(e.key,i)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return lo.resolve(s)}lookupMutationBatch(t,e){return lo.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),i=r<0?0:r;return lo.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return lo.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return lo.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Dl(e,0),r=new Dl(e,Number.POSITIVE_INFINITY),i=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);i.push(e)})),lo.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new fa(Gs);return e.forEach((t=>{const e=new Dl(t,0),r=new Dl(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),lo.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let i=n;no.isDocumentKey(i)||(i=i.child(""));const s=new Dl(new no(i),0);let o=new fa(Gs);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),s),lo.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){Ds(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return lo.forEach(e.mutations,(r=>{const i=new Dl(r.key,e.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Dl(e,0),r=this.gs.firstAfterOrEqual(n);return lo.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,lo.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]}}
1333
+ */class Dl{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new fa(Ol.ss)}checkEmpty(t){return lo.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,i){const r=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const s=new vl(r,e,n,i);this.mutationQueue.push(s);for(const e of i)this.gs=this.gs.add(new Ol(e.key,r)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return lo.resolve(s)}lookupMutationBatch(t,e){return lo.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,i=this.ps(n),r=i<0?0:i;return lo.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return lo.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return lo.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ol(e,0),i=new Ol(e,Number.POSITIVE_INFINITY),r=[];return this.gs.forEachInRange([n,i],(t=>{const e=this.ys(t._s);r.push(e)})),lo.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new fa(Gs);return e.forEach((t=>{const e=new Ol(t,0),i=new Ol(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,i],(t=>{n=n.add(t._s)}))})),lo.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,i=n.length+1;let r=n;no.isDocumentKey(r)||(r=r.child(""));const s=new Ol(new no(r),0);let o=new fa(Gs);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===i&&(o=o.add(t._s)),!0)}),s),lo.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){Os(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return lo.forEach(e.mutations,(i=>{const r=new Ol(i.key,e.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(t,i.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Ol(e,0),i=this.gs.firstAfterOrEqual(n);return lo.resolve(e.isEqual(i&&i.key))}performConsistencyCheck(t){return this.mutationQueue.length,lo.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]}}
1334
1334
  /**
1335
1335
  * @license
1336
1336
  * Copyright 2017 Google LLC
@@ -1346,7 +1346,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1346
1346
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1347
1347
  * See the License for the specific language governing permissions and
1348
1348
  * limitations under the License.
1349
- */class xl{constructor(t){this.Es=t,this.docs=new ua(no.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),i=r?r.size:0,s=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:s}),this.size+=s-i,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 lo.resolve(n?n.document.mutableCopy():va.newInvalidDocument(e))}getEntries(t,e){let n=Ec();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():va.newInvalidDocument(t))})),lo.resolve(n)}getAllFromCollection(t,e,n){let r=Ec();const i=new no(e.child("")),s=this.docs.getIteratorFrom(i);for(;s.hasNext();){const{key:t,value:{document:i}}=s.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||so(ro(i),n)<=0||(r=r.insert(i.key,i.mutableCopy()))}return lo.resolve(r)}getAllFromCollectionGroup(t,e,n,r){Os()}As(t,e){return lo.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Ml(this)}getSize(t){return lo.resolve(this.size)}}class Ml extends Cl{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.Yn.addEntry(t,r)):this.Yn.removeEntry(n)})),lo.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
1349
+ */class Pl{constructor(t){this.Es=t,this.docs=new ua(no.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,i=this.docs.get(n),r=i?i.size:0,s=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:s}),this.size+=s-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 lo.resolve(n?n.document.mutableCopy():va.newInvalidDocument(e))}getEntries(t,e){let n=_c();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():va.newInvalidDocument(t))})),lo.resolve(n)}getAllFromCollection(t,e,n){let i=_c();const r=new no(e.child("")),s=this.docs.getIteratorFrom(r);for(;s.hasNext();){const{key:t,value:{document:r}}=s.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||so(io(r),n)<=0||(i=i.insert(r.key,r.mutableCopy()))}return lo.resolve(i)}getAllFromCollectionGroup(t,e,n,i){xs()}As(t,e){return lo.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Ml(this)}getSize(t){return lo.resolve(this.size)}}class Ml extends Cl{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,i)=>{i.isValidDocument()?e.push(this.Yn.addEntry(t,i)):this.Yn.removeEntry(n)})),lo.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
1350
1350
  /**
1351
1351
  * @license
1352
1352
  * Copyright 2017 Google LLC
@@ -1362,7 +1362,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1362
1362
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1363
1363
  * See the License for the specific language governing permissions and
1364
1364
  * limitations under the License.
1365
- */class Ul{constructor(t){this.persistence=t,this.Rs=new Sc((t=>Sa(t)),_a),this.lastRemoteSnapshotVersion=Js.min(),this.highestTargetId=0,this.bs=0,this.Ps=new Ol,this.targetCount=0,this.vs=kl.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),lo.resolve()}getLastRemoteSnapshotVersion(t){return lo.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return lo.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),lo.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),lo.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new kl(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,lo.resolve()}updateTargetData(t,e){return this.Dn(e),lo.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,lo.resolve()}removeTargets(t,e,n){let r=0;const i=[];return this.Rs.forEach(((s,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(s),i.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),lo.waitFor(i).next((()=>r))}getTargetCount(t){return lo.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return lo.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),lo.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const r=this.persistence.referenceDelegate,i=[];return r&&e.forEach((e=>{i.push(r.markPotentiallyOrphaned(t,e))})),lo.waitFor(i)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),lo.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return lo.resolve(n)}containsKey(t,e){return lo.resolve(this.Ps.containsKey(e))}}
1365
+ */class Fl{constructor(t){this.persistence=t,this.Rs=new Sc((t=>Sa(t)),Ea),this.lastRemoteSnapshotVersion=Js.min(),this.highestTargetId=0,this.bs=0,this.Ps=new xl,this.targetCount=0,this.vs=kl.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),lo.resolve()}getLastRemoteSnapshotVersion(t){return lo.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return lo.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),lo.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),lo.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new kl(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,lo.resolve()}updateTargetData(t,e){return this.Dn(e),lo.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,lo.resolve()}removeTargets(t,e,n){let i=0;const r=[];return this.Rs.forEach(((s,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(s),r.push(this.removeMatchingKeysForTargetId(t,o.targetId)),i++)})),lo.waitFor(r).next((()=>i))}getTargetCount(t){return lo.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return lo.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),lo.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const i=this.persistence.referenceDelegate,r=[];return i&&e.forEach((e=>{r.push(i.markPotentiallyOrphaned(t,e))})),lo.waitFor(r)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),lo.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return lo.resolve(n)}containsKey(t,e){return lo.resolve(this.Ps.containsKey(e))}}
1366
1366
  /**
1367
1367
  * @license
1368
1368
  * Copyright 2017 Google LLC
@@ -1378,7 +1378,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1378
1378
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1379
1379
  * See the License for the specific language governing permissions and
1380
1380
  * limitations under the License.
1381
- */class Fl{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new ho(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Ul(this),this.indexManager=new Tl,this.remoteDocumentCache=function(t){return new xl(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new _l(e),this.Ns=new Nl(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 Ll,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Pl(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){As("MemoryPersistence","Starting transaction:",t);const r=new zl(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((t=>this.referenceDelegate.Os(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Ms(t,e){return lo.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class zl extends ao{constructor(t){super(),this.currentSequenceNumber=t}}class Bl{constructor(t){this.persistence=t,this.Fs=new Ol,this.$s=null}static Bs(t){return new Bl(t)}get Ls(){if(this.$s)return this.$s;throw Os()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),lo.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),lo.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),lo.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 lo.forEach(this.Ls,(n=>{const r=no.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,Js.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 lo.or([()=>lo.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
1381
+ */class Ul{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new ho(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Fl(this),this.indexManager=new Tl,this.remoteDocumentCache=function(t){return new Pl(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new El(e),this.Ns=new Ll(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 Nl,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Dl(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){As("MemoryPersistence","Starting transaction:",t);const i=new zl(this.Ss.next());return this.referenceDelegate.ks(),n(i).next((t=>this.referenceDelegate.Os(i).next((()=>t)))).toPromise().then((t=>(i.raiseOnCommittedEvent(),t)))}Ms(t,e){return lo.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class zl extends ao{constructor(t){super(),this.currentSequenceNumber=t}}class Bl{constructor(t){this.persistence=t,this.Fs=new xl,this.$s=null}static Bs(t){return new Bl(t)}get Ls(){if(this.$s)return this.$s;throw xs()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),lo.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),lo.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),lo.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 lo.forEach(this.Ls,(n=>{const i=no.fromPath(n);return this.qs(t,i).next((t=>{t||e.removeEntry(i,Js.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 lo.or([()=>lo.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
1382
1382
  /**
1383
1383
  * @license
1384
1384
  * Copyright 2017 Google LLC
@@ -1394,7 +1394,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1394
1394
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1395
1395
  * See the License for the specific language governing permissions and
1396
1396
  * limitations under the License.
1397
- */class Vl{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=Oc(),r=Oc();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new Vl(t,e.fromCache,n,r)}}
1397
+ */class Vl{constructor(t,e,n,i){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=i}static Ci(t,e){let n=xc(),i=xc();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:i=i.add(t.doc.key)}return new Vl(t,e.fromCache,n,i)}}
1398
1398
  /**
1399
1399
  * @license
1400
1400
  * Copyright 2019 Google LLC
@@ -1410,7 +1410,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1410
1410
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1411
1411
  * See the License for the specific language governing permissions and
1412
1412
  * limitations under the License.
1413
- */class Hl{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((i=>i||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(ka(e))return lo.resolve(null);let n=La(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=Da(e,null,"F"),n=La(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const i=Oc(...r);return this.Ni.getDocuments(t,i).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const s=this.Fi(e,r);return this.$i(e,s,i,n.readTime)?this.ki(t,Da(e,null,"F")):this.Bi(t,s,e,n)}))))})))))}Oi(t,e,n,r){return ka(e)||r.isEqual(Js.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((i=>{const s=this.Fi(e,i);return this.$i(e,s,n,r)?this.Mi(t,e):(Cs()<=de.DEBUG&&As("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Ma(e)),this.Bi(t,s,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Js.fromTimestamp(1e9===r?new Ys(n+1,0):new Ys(n,r));return new io(i,no.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new fa(Fa(t));return e.forEach(((e,r)=>{Ua(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const i="F"===t.limitType?e.last():e.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Mi(t,e){return Cs()<=de.DEBUG&&As("QueryEngine","Using full collection scan to execute query:",Ma(e)),this.Ni.getDocumentsMatchingQuery(t,e,io.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
1413
+ */class Hl{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,i){return this.ki(t,e).next((r=>r||this.Oi(t,e,i,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(ka(e))return lo.resolve(null);let n=Na(e);return this.indexManager.getIndexType(t,n).next((i=>0===i?null:(null!==e.limit&&1===i&&(e=Oa(e,null,"F"),n=Na(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((i=>{const r=xc(...i);return this.Ni.getDocuments(t,r).next((i=>this.indexManager.getMinOffset(t,n).next((n=>{const s=this.Fi(e,i);return this.$i(e,s,r,n.readTime)?this.ki(t,Oa(e,null,"F")):this.Bi(t,s,e,n)}))))})))))}Oi(t,e,n,i){return ka(e)||i.isEqual(Js.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((r=>{const s=this.Fi(e,r);return this.$i(e,s,n,i)?this.Mi(t,e):(Cs()<=de.DEBUG&&As("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Ma(e)),this.Bi(t,s,e,function(t,e){const n=t.toTimestamp().seconds,i=t.toTimestamp().nanoseconds+1,r=Js.fromTimestamp(1e9===i?new Ys(n+1,0):new Ys(n,i));return new ro(r,no.empty(),e)}(i,-1)))}))}Fi(t,e){let n=new fa(Ua(t));return e.forEach(((e,i)=>{Fa(t,i)&&(n=n.add(i))})),n}$i(t,e,n,i){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(i)>0)}Mi(t,e){return Cs()<=de.DEBUG&&As("QueryEngine","Using full collection scan to execute query:",Ma(e)),this.Ni.getDocumentsMatchingQuery(t,e,ro.min())}Bi(t,e,n,i){return this.Ni.getDocumentsMatchingQuery(t,n,i).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
1414
1414
  /**
1415
1415
  * @license
1416
1416
  * Copyright 2020 Google LLC
@@ -1426,7 +1426,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1426
1426
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1427
1427
  * See the License for the specific language governing permissions and
1428
1428
  * limitations under the License.
1429
- */class jl{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new ua(Gs),this.Ui=new Sc((t=>Sa(t)),_a),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 Rl(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 $l(t,e){const n=Ps(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((i=>(r=i,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const i=[],s=[];let o=Oc();for(const t of r){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){s.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:i,addedBatchIds:s})))}))}))}function ql(t){const e=Ps(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Wl(t,e){const n=Ps(t),r=e.snapshotVersion;let i=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const s=n.Gi.newChangeBuffer({trackRemovals:!0});i=n.qi;const o=[];e.targetChanges.forEach(((s,a)=>{const c=i.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,s.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,s.addedDocuments,a))));let l=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?l=l.withResumeToken(bo.EMPTY_BYTE_STRING,Js.min()).withLastLimboFreeSnapshotVersion(Js.min()):s.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(s.resumeToken,r)),i=i.insert(a,l),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,l,s)&&o.push(n.Cs.updateTargetData(t,l))}));let a=Ec(),c=Oc();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Oc(),i=Oc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ec();return n.forEach(((n,s)=>{const o=t.get(n);s.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),s.isNoDocument()&&s.version.isEqual(Js.min())?(e.removeEntry(n,s.readTime),r=r.insert(n,s)):!o.isValidDocument()||s.version.compareTo(o.version)>0||0===s.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(s),r=r.insert(n,s)):As("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",s.version)})),{Wi:r,zi:i}}))}(t,s,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(Js.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return lo.waitFor(o).next((()=>s.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=i,t)))}function Kl(t,e){const n=Ps(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function Gl(t,e,n){const r=Ps(t),i=r.qi.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,(t=>r.persistence.referenceDelegate.removeTarget(t,i)))}catch(t){if(!uo(t))throw t;As("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(i.target)}function Ql(t,e,n){const r=Ps(t);let i=Js.min(),s=Oc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Ps(t),i=r.Ui.get(n);return void 0!==i?lo.resolve(r.qi.get(i)):r.Cs.getTargetData(e,n)}(r,t,La(e)).next((e=>{if(e)return i=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{s=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?i:Js.min(),n?s:Oc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Js.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:s})))))}class Yl{constructor(){this.activeTargetIds=Pc()}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 Jl{constructor(){this.Lr=new Yl,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 Yl,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1429
+ */class jl{constructor(t,e,n,i){this.persistence=t,this.Li=e,this.yt=i,this.qi=new ua(Gs),this.Ui=new Sc((t=>Sa(t)),Ea),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 Rl(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 ql(t,e){const n=Ds(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let i;return n.mutationQueue.getAllMutationBatches(t).next((r=>(i=r,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const r=[],s=[];let o=xc();for(const t of i){r.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){s.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:s})))}))}))}function $l(t){const e=Ds(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Kl(t,e){const n=Ds(t),i=e.snapshotVersion;let r=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const s=n.Gi.newChangeBuffer({trackRemovals:!0});r=n.qi;const o=[];e.targetChanges.forEach(((s,a)=>{const c=r.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,s.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,s.addedDocuments,a))));let l=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?l=l.withResumeToken(bo.EMPTY_BYTE_STRING,Js.min()).withLastLimboFreeSnapshotVersion(Js.min()):s.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(s.resumeToken,i)),r=r.insert(a,l),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,l,s)&&o.push(n.Cs.updateTargetData(t,l))}));let a=_c(),c=xc();if(e.documentUpdates.forEach((i=>{e.resolvedLimboDocuments.has(i)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,i))})),o.push(function(t,e,n){let i=xc(),r=xc();return n.forEach((t=>i=i.add(t))),e.getEntries(t,i).next((t=>{let i=_c();return n.forEach(((n,s)=>{const o=t.get(n);s.isFoundDocument()!==o.isFoundDocument()&&(r=r.add(n)),s.isNoDocument()&&s.version.isEqual(Js.min())?(e.removeEntry(n,s.readTime),i=i.insert(n,s)):!o.isValidDocument()||s.version.compareTo(o.version)>0||0===s.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(s),i=i.insert(n,s)):As("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",s.version)})),{Wi:i,zi:r}}))}(t,s,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!i.isEqual(Js.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,i)));o.push(e)}return lo.waitFor(o).next((()=>s.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=r,t)))}function Wl(t,e){const n=Ds(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function Gl(t,e,n){const i=Ds(t),r=i.qi.get(e),s=n?"readwrite":"readwrite-primary";try{n||await i.persistence.runTransaction("Release target",s,(t=>i.persistence.referenceDelegate.removeTarget(t,r)))}catch(t){if(!uo(t))throw t;As("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}i.qi=i.qi.remove(e),i.Ui.delete(r.target)}function Ql(t,e,n){const i=Ds(t);let r=Js.min(),s=xc();return i.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const i=Ds(t),r=i.Ui.get(n);return void 0!==r?lo.resolve(i.qi.get(r)):i.Cs.getTargetData(e,n)}(i,t,Na(e)).next((e=>{if(e)return r=e.lastLimboFreeSnapshotVersion,i.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{s=t}))})).next((()=>i.Li.getDocumentsMatchingQuery(t,e,n?r:Js.min(),n?s:xc()))).next((t=>(function(t,e,n){let i=t.Ki.get(e)||Js.min();n.forEach(((t,e)=>{e.readTime.compareTo(i)>0&&(i=e.readTime)})),t.Ki.set(e,i)}(i,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:s})))))}class Yl{constructor(){this.activeTargetIds=Dc()}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 Jl{constructor(){this.Lr=new Yl,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 Yl,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1430
1430
  /**
1431
1431
  * @license
1432
1432
  * Copyright 2019 Google LLC
@@ -1506,7 +1506,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1506
1506
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1507
1507
  * See the License for the specific language governing permissions and
1508
1508
  * limitations under the License.
1509
- */class nu 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,i){const s=this.ho(t,e);As("RestConnection","Sending: ",s,n);const o={};return this.lo(o,r,i),this.fo(t,s,o,n).then((t=>(As("RestConnection","Received: ",t),t)),(e=>{throw Ns("RestConnection",`${t} failed with error: `,e,"url: ",s,"request:",n),e}))}_o(t,e,n,r,i,s){return this.ao(t,e,n,r,i)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Is,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=tu[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((i,s)=>{const o=new _s;o.setWithCredentials(!0),o.listenOnce(ms.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case gs.NO_ERROR:const e=o.getResponseJson();As("Connection","XHR received:",JSON.stringify(e)),i(e);break;case gs.TIMEOUT:As("Connection",'RPC "'+t+'" timed out'),s(new Ms(xs.DEADLINE_EXCEEDED,"Request time out"));break;case gs.HTTP_ERROR:const n=o.getStatus();if(As("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(xs).indexOf(e)>=0?e:xs.UNKNOWN}(e.status);s(new Ms(t,e.message))}else s(new Ms(xs.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new Ms(xs.UNAVAILABLE,"Connection failed."));break;default:Os()}}finally{As("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=new us,s=cr(),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 bs({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");As("Connection","Creating WebChannel: "+a,o);const c=i.createWebChannel(a,o);let l=!1,u=!1;const h=new eu({Hr:t=>{u?As("Connection","Not sending because WebChannel is closed:",t):(l||(As("Connection","Opening WebChannel transport."),c.open(),l=!0),As("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,Ss.EventType.OPEN,(()=>{u||As("Connection","WebChannel transport opened.")})),d(c,Ss.EventType.CLOSE,(()=>{u||(u=!0,As("Connection","WebChannel transport closed"),h.io())})),d(c,Ss.EventType.ERROR,(t=>{u||(u=!0,Ns("Connection","WebChannel transport errored:",t),h.io(new Ms(xs.UNAVAILABLE,"The operation could not be completed")))})),d(c,Ss.EventType.MESSAGE,(t=>{var e;if(!u){const n=t.data[0];Ds(!!n);const r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){As("Connection","WebChannel received error:",i);const t=i.status;let e=function(t){const e=vc[t];if(void 0!==e)return bc(e)}(t),n=i.message;void 0===e&&(e=xs.INTERNAL,n="Unknown error status: "+t+" with message "+i.message),u=!0,h.io(new Ms(e,n)),c.close()}else As("Connection","WebChannel received:",n),h.ro(n)}})),d(s,ys.STAT_EVENT,(t=>{t.stat===vs?As("Connection","Detected buffering proxy"):t.stat===ws&&As("Connection","Detected no buffering proxy")})),setTimeout((()=>{h.so()}),0),h}}function ru(){return"undefined"!=typeof document?document:null}
1509
+ */class nu 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,i,r){const s=this.ho(t,e);As("RestConnection","Sending: ",s,n);const o={};return this.lo(o,i,r),this.fo(t,s,o,n).then((t=>(As("RestConnection","Received: ",t),t)),(e=>{throw Ls("RestConnection",`${t} failed with error: `,e,"url: ",s,"request:",n),e}))}_o(t,e,n,i,r,s){return this.ao(t,e,n,i,r)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Is,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=tu[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,i){return new Promise(((r,s)=>{const o=new Es;o.setWithCredentials(!0),o.listenOnce(ms.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case gs.NO_ERROR:const e=o.getResponseJson();As("Connection","XHR received:",JSON.stringify(e)),r(e);break;case gs.TIMEOUT:As("Connection",'RPC "'+t+'" timed out'),s(new Ms(Ps.DEADLINE_EXCEEDED,"Request time out"));break;case gs.HTTP_ERROR:const n=o.getStatus();if(As("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(Ps).indexOf(e)>=0?e:Ps.UNKNOWN}(e.status);s(new Ms(t,e.message))}else s(new Ms(Ps.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new Ms(Ps.UNAVAILABLE,"Connection failed."));break;default:xs()}}finally{As("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(i);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const i=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new us,s=ci(),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 bs({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=i.join("");As("Connection","Creating WebChannel: "+a,o);const c=r.createWebChannel(a,o);let l=!1,u=!1;const h=new eu({Hr:t=>{u?As("Connection","Not sending because WebChannel is closed:",t):(l||(As("Connection","Opening WebChannel transport."),c.open(),l=!0),As("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,Ss.EventType.OPEN,(()=>{u||As("Connection","WebChannel transport opened.")})),d(c,Ss.EventType.CLOSE,(()=>{u||(u=!0,As("Connection","WebChannel transport closed"),h.io())})),d(c,Ss.EventType.ERROR,(t=>{u||(u=!0,Ls("Connection","WebChannel transport errored:",t),h.io(new Ms(Ps.UNAVAILABLE,"The operation could not be completed")))})),d(c,Ss.EventType.MESSAGE,(t=>{var e;if(!u){const n=t.data[0];Os(!!n);const i=n,r=i.error||(null===(e=i[0])||void 0===e?void 0:e.error);if(r){As("Connection","WebChannel received error:",r);const t=r.status;let e=function(t){const e=vc[t];if(void 0!==e)return bc(e)}(t),n=r.message;void 0===e&&(e=Ps.INTERNAL,n="Unknown error status: "+t+" with message "+r.message),u=!0,h.io(new Ms(e,n)),c.close()}else As("Connection","WebChannel received:",n),h.ro(n)}})),d(s,ys.STAT_EVENT,(t=>{t.stat===vs?As("Connection","Detected buffering proxy"):t.stat===ws&&As("Connection","Detected no buffering proxy")})),setTimeout((()=>{h.so()}),0),h}}function iu(){return"undefined"!=typeof document?document:null}
1510
1510
  /**
1511
1511
  * @license
1512
1512
  * Copyright 2020 Google LLC
@@ -1522,7 +1522,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1522
1522
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1523
1523
  * See the License for the specific language governing permissions and
1524
1524
  * limitations under the License.
1525
- */function iu(t){return new Kc(t,!0)}class su{constructor(t,e,n=1e3,r=1.5,i=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=r,this.po=i,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,e-n);r>0&&As("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
1525
+ */function ru(t){return new Wc(t,!0)}class su{constructor(t,e,n=1e3,i=1.5,r=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=i,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),i=Math.max(0,e-n);i>0&&As("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,i,(()=>(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}}
1526
1526
  /**
1527
1527
  * @license
1528
1528
  * Copyright 2017 Google LLC
@@ -1538,7 +1538,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1538
1538
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1539
1539
  * See the License for the specific language governing permissions and
1540
1540
  * limitations under the License.
1541
- */class ou{constructor(t,e,n,r,i,s,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new su(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===xs.RESOURCE_EXHAUSTED?(Rs(e.toString()),Rs("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===xs.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 Ms(xs.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 As("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(As("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class au extends ou{constructor(t,e,n,r,i,s){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,s),this.yt=i}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Os()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(t,e){return t.wt?(Ds(void 0===e||"string"==typeof e),bo.fromBase64String(e||"")):(Ds(void 0===e||e instanceof Uint8Array),bo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?xs.UNKNOWN:bc(t.code);return new Ms(e,t.message||"")}(o);n=new zc(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=el(t,r.document.name),s=Jc(r.document.updateTime),o=r.document.createTime?Jc(r.document.createTime):Js.min(),a=new ma({mapValue:{fields:r.document.fields}}),c=va.newFoundDocument(i,s,o,a),l=r.targetIds||[],u=r.removedTargetIds||[];n=new Uc(l,u,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=el(t,r.document),s=r.readTime?Jc(r.readTime):Js.min(),o=va.newNoDocument(i,s),a=r.removedTargetIds||[];n=new Uc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=el(t,r.document),s=r.removedTargetIds||[];n=new Uc([],s,i,null)}else{if(!("filter"in e))return Os();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,i=new yc(r),s=t.targetId;n=new Fc(s,i)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Js.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Js.min():e.readTime?Jc(e.readTime):Js.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=rl(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=Ea(r)?{documents:ol(t,r)}:{query:al(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Qc(t,e.resumeToken):e.snapshotVersion.compareTo(Js.min())>0&&(n.readTime=Gc(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Os()}}(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=rl(this.yt),e.removeTarget=t,this.Bo(e)}}class cu extends ou{constructor(t,e,n,r,i,s){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,s),this.yt=i,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Ds(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Ds(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Jc(t.updateTime):Jc(e);return n.isEqual(Js.min())&&(n=Jc(e)),new ec(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Jc(t.commitTime);return this.listener.Zo(n,e)}return Ds(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=rl(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof uc)n={update:sl(t,e.key,e.value)};else if(e instanceof gc)n={delete:tl(t,e.key)};else if(e instanceof hc)n={update:sl(t,e.key,e.data),updateMask:ml(e.fieldMask)};else{if(!(e instanceof mc))return Os();n={verify:tl(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Ka)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ga)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Ya)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Xa)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw Os()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Yc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Os()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
1541
+ */class ou{constructor(t,e,n,i,r,s,o,a){this.Hs=t,this.vo=n,this.Vo=i,this.connection=r,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new su(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===Ps.RESOURCE_EXHAUSTED?(Rs(e.toString()),Rs("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Ps.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 Ms(Ps.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 As("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(As("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class au extends ou{constructor(t,e,n,i,r,s){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,i,s),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 i=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:xs()}(e.targetChange.targetChangeType||"NO_CHANGE"),r=e.targetChange.targetIds||[],s=function(t,e){return t.wt?(Os(void 0===e||"string"==typeof e),bo.fromBase64String(e||"")):(Os(void 0===e||e instanceof Uint8Array),bo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Ps.UNKNOWN:bc(t.code);return new Ms(e,t.message||"")}(o);n=new zc(i,r,s,a||null)}else if("documentChange"in e){e.documentChange;const i=e.documentChange;i.document,i.document.name,i.document.updateTime;const r=el(t,i.document.name),s=Jc(i.document.updateTime),o=i.document.createTime?Jc(i.document.createTime):Js.min(),a=new ma({mapValue:{fields:i.document.fields}}),c=va.newFoundDocument(r,s,o,a),l=i.targetIds||[],u=i.removedTargetIds||[];n=new Fc(l,u,c.key,c)}else if("documentDelete"in e){e.documentDelete;const i=e.documentDelete;i.document;const r=el(t,i.document),s=i.readTime?Jc(i.readTime):Js.min(),o=va.newNoDocument(r,s),a=i.removedTargetIds||[];n=new Fc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const i=e.documentRemove;i.document;const r=el(t,i.document),s=i.removedTargetIds||[];n=new Fc([],s,r,null)}else{if(!("filter"in e))return xs();{e.filter;const t=e.filter;t.targetId;const i=t.count||0,r=new yc(i),s=t.targetId;n=new Uc(s,r)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Js.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Js.min():e.readTime?Jc(e.readTime):Js.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=il(this.yt),e.addTarget=function(t,e){let n;const i=e.target;return n=_a(i)?{documents:ol(t,i)}:{query:al(t,i)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Qc(t,e.resumeToken):e.snapshotVersion.compareTo(Js.min())>0&&(n.readTime=Gc(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return xs()}}(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=il(this.yt),e.removeTarget=t,this.Bo(e)}}class cu extends ou{constructor(t,e,n,i,r,s){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,i,s),this.yt=r,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Os(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Os(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Jc(t.updateTime):Jc(e);return n.isEqual(Js.min())&&(n=Jc(e)),new ec(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Jc(t.commitTime);return this.listener.Zo(n,e)}return Os(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=il(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof uc)n={update:sl(t,e.key,e.value)};else if(e instanceof gc)n={delete:tl(t,e.key)};else if(e instanceof hc)n={update:sl(t,e.key,e.data),updateMask:ml(e.fieldMask)};else{if(!(e instanceof mc))return xs();n={verify:tl(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Wa)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ga)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Ya)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Xa)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw xs()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Yc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:xs()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
1542
1542
  /**
1543
1543
  * @license
1544
1544
  * Copyright 2017 Google LLC
@@ -1554,7 +1554,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1554
1554
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1555
1555
  * See the License for the specific language governing permissions and
1556
1556
  * limitations under the License.
1557
- */class lu extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new Ms(xs.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,i])=>this.connection.ao(t,e,n,r,i))).catch((t=>{throw"FirebaseError"===t.name?(t.code===xs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Ms(xs.UNKNOWN,t.toString())}))}_o(t,e,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,s])=>this.connection._o(t,e,n,i,s,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===xs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Ms(xs.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class uu{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?(Rs(e),this.ou=!1):As("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1557
+ */class lu extends class{}{constructor(t,e,n,i){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=i,this.nu=!1}su(){if(this.nu)throw new Ms(Ps.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,r])=>this.connection.ao(t,e,n,i,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Ps.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Ms(Ps.UNKNOWN,t.toString())}))}_o(t,e,n,i){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,s])=>this.connection._o(t,e,n,r,s,i))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Ps.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Ms(Ps.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class uu{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?(Rs(e),this.ou=!1):As("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1558
1558
  /**
1559
1559
  * @license
1560
1560
  * Copyright 2017 Google LLC
@@ -1570,7 +1570,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1570
1570
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1571
1571
  * See the License for the specific language governing permissions and
1572
1572
  * limitations under the License.
1573
- */class hu{constructor(t,e,n,r,i){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=i,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{bu(this)&&(As("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Ps(t);e._u.add(4),await fu(e),e.gu.set("Unknown"),e._u.delete(4),await du(e)}(this))}))})),this.gu=new uu(n,r)}}async function du(t){if(bu(t))for(const e of t.wu)await e(!0)}async function fu(t){for(const e of t.wu)await e(!1)}function pu(t,e){const n=Ps(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),wu(n)?vu(n):Uu(n).ko()&&mu(n,e))}function gu(t,e){const n=Ps(t),r=Uu(n);n.du.delete(e),r.ko()&&yu(n,e),0===n.du.size&&(r.ko()?r.Fo():bu(n)&&n.gu.set("Unknown"))}function mu(t,e){t.yu.Ot(e.targetId),Uu(t).zo(e)}function yu(t,e){t.yu.Ot(e),Uu(t).Ho(e)}function vu(t){t.yu=new Vc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),Uu(t).start(),t.gu.uu()}function wu(t){return bu(t)&&!Uu(t).No()&&t.du.size>0}function bu(t){return 0===Ps(t)._u.size}function Su(t){t.yu=void 0}async function _u(t){t.du.forEach(((e,n)=>{mu(t,e)}))}async function Eu(t,e){Su(t),wu(t)?(t.gu.hu(e),vu(t)):t.gu.set("Unknown")}async function Tu(t,e,n){if(t.gu.set("Online"),e instanceof zc&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.du.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.du.delete(r),t.yu.removeTarget(r))}(t,e)}catch(n){As("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Iu(t,n)}else if(e instanceof Uc?t.yu.Kt(e):e instanceof Fc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Js.min()))try{const e=await ql(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const i=t.du.get(r);i&&t.du.set(r,i.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(bo.EMPTY_BYTE_STRING,n.snapshotVersion)),yu(t,e);const r=new Sl(n.target,e,1,n.sequenceNumber);mu(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){As("RemoteStore","Failed to raise snapshot:",e),await Iu(t,e)}}async function Iu(t,e,n){if(!uo(e))throw e;t._u.add(1),await fu(t),t.gu.set("Offline"),n||(n=()=>ql(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{As("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await du(t)}))}function ku(t,e){return e().catch((n=>Iu(t,n,e)))}async function Cu(t){const e=Ps(t),n=Fu(e);let r=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Au(e);)try{const t=await Kl(e.localStore,r);if(null===t){0===e.fu.length&&n.Fo();break}r=t.batchId,Ru(e,t)}catch(t){await Iu(e,t)}Nu(e)&&Lu(e)}function Au(t){return bu(t)&&t.fu.length<10}function Ru(t,e){t.fu.push(e);const n=Fu(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Nu(t){return bu(t)&&!Fu(t).No()&&t.fu.length>0}function Lu(t){Fu(t).start()}async function Ou(t){Fu(t).eu()}async function Du(t){const e=Fu(t);for(const n of t.fu)e.Xo(n.mutations)}async function Pu(t,e,n){const r=t.fu.shift(),i=wl.from(r,e,n);await ku(t,(()=>t.remoteSyncer.applySuccessfulWrite(i))),await Cu(t)}async function xu(t,e){e&&Fu(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return Os();case xs.CANCELLED:case xs.UNKNOWN:case xs.DEADLINE_EXCEEDED:case xs.RESOURCE_EXHAUSTED:case xs.INTERNAL:case xs.UNAVAILABLE:case xs.UNAUTHENTICATED:return!1;case xs.INVALID_ARGUMENT:case xs.NOT_FOUND:case xs.ALREADY_EXISTS:case xs.PERMISSION_DENIED:case xs.FAILED_PRECONDITION:case xs.ABORTED:case xs.OUT_OF_RANGE:case xs.UNIMPLEMENTED:case xs.DATA_LOSS:return!0}}(n=e.code)&&n!==xs.ABORTED){const n=t.fu.shift();Fu(t).Mo(),await ku(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Cu(t)}var n}(t,e),Nu(t)&&Lu(t)}async function Mu(t,e){const n=Ps(t);n.asyncQueue.verifyOperationInProgress(),As("RemoteStore","RemoteStore received new credentials");const r=bu(n);n._u.add(3),await fu(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await du(n)}function Uu(t){return t.pu||(t.pu=function(t,e,n){const r=Ps(t);return r.su(),new au(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
1573
+ */class hu{constructor(t,e,n,i,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()=>{bu(this)&&(As("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Ds(t);e._u.add(4),await fu(e),e.gu.set("Unknown"),e._u.delete(4),await du(e)}(this))}))})),this.gu=new uu(n,i)}}async function du(t){if(bu(t))for(const e of t.wu)await e(!0)}async function fu(t){for(const e of t.wu)await e(!1)}function pu(t,e){const n=Ds(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),wu(n)?vu(n):Fu(n).ko()&&mu(n,e))}function gu(t,e){const n=Ds(t),i=Fu(n);n.du.delete(e),i.ko()&&yu(n,e),0===n.du.size&&(i.ko()?i.Fo():bu(n)&&n.gu.set("Unknown"))}function mu(t,e){t.yu.Ot(e.targetId),Fu(t).zo(e)}function yu(t,e){t.yu.Ot(e),Fu(t).Ho(e)}function vu(t){t.yu=new Vc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),Fu(t).start(),t.gu.uu()}function wu(t){return bu(t)&&!Fu(t).No()&&t.du.size>0}function bu(t){return 0===Ds(t)._u.size}function Su(t){t.yu=void 0}async function Eu(t){t.du.forEach(((e,n)=>{mu(t,e)}))}async function _u(t,e){Su(t),wu(t)?(t.gu.hu(e),vu(t)):t.gu.set("Unknown")}async function Tu(t,e,n){if(t.gu.set("Online"),e instanceof zc&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const i of e.targetIds)t.du.has(i)&&(await t.remoteSyncer.rejectListen(i,n),t.du.delete(i),t.yu.removeTarget(i))}(t,e)}catch(n){As("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Iu(t,n)}else if(e instanceof Fc?t.yu.Kt(e):e instanceof Uc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Js.min()))try{const e=await $l(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,i)=>{if(n.resumeToken.approximateByteSize()>0){const r=t.du.get(i);r&&t.du.set(i,r.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(bo.EMPTY_BYTE_STRING,n.snapshotVersion)),yu(t,e);const i=new Sl(n.target,e,1,n.sequenceNumber);mu(t,i)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){As("RemoteStore","Failed to raise snapshot:",e),await Iu(t,e)}}async function Iu(t,e,n){if(!uo(e))throw e;t._u.add(1),await fu(t),t.gu.set("Offline"),n||(n=()=>$l(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{As("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await du(t)}))}function ku(t,e){return e().catch((n=>Iu(t,n,e)))}async function Cu(t){const e=Ds(t),n=Uu(e);let i=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Au(e);)try{const t=await Wl(e.localStore,i);if(null===t){0===e.fu.length&&n.Fo();break}i=t.batchId,Ru(e,t)}catch(t){await Iu(e,t)}Lu(e)&&Nu(e)}function Au(t){return bu(t)&&t.fu.length<10}function Ru(t,e){t.fu.push(e);const n=Uu(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Lu(t){return bu(t)&&!Uu(t).No()&&t.fu.length>0}function Nu(t){Uu(t).start()}async function xu(t){Uu(t).eu()}async function Ou(t){const e=Uu(t);for(const n of t.fu)e.Xo(n.mutations)}async function Du(t,e,n){const i=t.fu.shift(),r=wl.from(i,e,n);await ku(t,(()=>t.remoteSyncer.applySuccessfulWrite(r))),await Cu(t)}async function Pu(t,e){e&&Uu(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return xs();case Ps.CANCELLED:case Ps.UNKNOWN:case Ps.DEADLINE_EXCEEDED:case Ps.RESOURCE_EXHAUSTED:case Ps.INTERNAL:case Ps.UNAVAILABLE:case Ps.UNAUTHENTICATED:return!1;case Ps.INVALID_ARGUMENT:case Ps.NOT_FOUND:case Ps.ALREADY_EXISTS:case Ps.PERMISSION_DENIED:case Ps.FAILED_PRECONDITION:case Ps.ABORTED:case Ps.OUT_OF_RANGE:case Ps.UNIMPLEMENTED:case Ps.DATA_LOSS:return!0}}(n=e.code)&&n!==Ps.ABORTED){const n=t.fu.shift();Uu(t).Mo(),await ku(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Cu(t)}var n}(t,e),Lu(t)&&Nu(t)}async function Mu(t,e){const n=Ds(t);n.asyncQueue.verifyOperationInProgress(),As("RemoteStore","RemoteStore received new credentials");const i=bu(n);n._u.add(3),await fu(n),i&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await du(n)}function Fu(t){return t.pu||(t.pu=function(t,e,n){const i=Ds(t);return i.su(),new au(e,i.connection,i.authCredentials,i.appCheckCredentials,i.yt,n)
1574
1574
  /**
1575
1575
  * @license
1576
1576
  * Copyright 2018 Google LLC
@@ -1586,7 +1586,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1586
1586
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1587
1587
  * See the License for the specific language governing permissions and
1588
1588
  * limitations under the License.
1589
- */}(t.datastore,t.asyncQueue,{Yr:_u.bind(null,t),Zr:Eu.bind(null,t),Wo:Tu.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),wu(t)?vu(t):t.gu.set("Unknown")):(await t.pu.stop(),Su(t))}))),t.pu}function Fu(t){return t.Iu||(t.Iu=function(t,e,n){const r=Ps(t);return r.su(),new cu(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)}(t.datastore,t.asyncQueue,{Yr:Ou.bind(null,t),Zr:xu.bind(null,t),tu:Du.bind(null,t),Zo:Pu.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Cu(t)):(await t.Iu.stop(),t.fu.length>0&&(As("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
1589
+ */}(t.datastore,t.asyncQueue,{Yr:Eu.bind(null,t),Zr:_u.bind(null,t),Wo:Tu.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),wu(t)?vu(t):t.gu.set("Unknown")):(await t.pu.stop(),Su(t))}))),t.pu}function Uu(t){return t.Iu||(t.Iu=function(t,e,n){const i=Ds(t);return i.su(),new cu(e,i.connection,i.authCredentials,i.appCheckCredentials,i.yt,n)}(t.datastore,t.asyncQueue,{Yr:xu.bind(null,t),Zr:Pu.bind(null,t),tu:Ou.bind(null,t),Zo:Du.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Cu(t)):(await t.Iu.stop(),t.fu.length>0&&(As("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
1590
1590
  /**
1591
1591
  * @license
1592
1592
  * Copyright 2017 Google LLC
@@ -1602,7 +1602,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1602
1602
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1603
1603
  * See the License for the specific language governing permissions and
1604
1604
  * limitations under the License.
1605
- */}class zu{constructor(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new Us,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,i){const s=Date.now()+n,o=new zu(t,e,s,r,i);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 Ms(xs.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 Bu(t,e){if(Rs("AsyncQueue",`${e}: ${t}`),uo(t))return new Ms(xs.UNAVAILABLE,`${e}: ${t}`);throw t}
1605
+ */}class zu{constructor(t,e,n,i,r){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new Fs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,i,r){const s=Date.now()+n,o=new zu(t,e,s,i,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 Ms(Ps.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 Bu(t,e){if(Rs("AsyncQueue",`${e}: ${t}`),uo(t))return new Ms(Ps.UNAVAILABLE,`${e}: ${t}`);throw t}
1606
1606
  /**
1607
1607
  * @license
1608
1608
  * Copyright 2017 Google LLC
@@ -1618,7 +1618,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1618
1618
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1619
1619
  * See the License for the specific language governing permissions and
1620
1620
  * limitations under the License.
1621
- */class Vu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||no.comparator(e.key,n.key):(t,e)=>no.comparator(t.key,e.key),this.keyedMap=Ic(),this.sortedSet=new ua(this.comparator)}static emptySet(t){return new Vu(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 Vu))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Vu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
1621
+ */class Vu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||no.comparator(e.key,n.key):(t,e)=>no.comparator(t.key,e.key),this.keyedMap=Ic(),this.sortedSet=new ua(this.comparator)}static emptySet(t){return new Vu(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 Vu))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,i=n.getNext().key;if(!t.isEqual(i))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 Vu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
1622
1622
  /**
1623
1623
  * @license
1624
1624
  * Copyright 2017 Google LLC
@@ -1634,7 +1634,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1634
1634
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1635
1635
  * See the License for the specific language governing permissions and
1636
1636
  * limitations under the License.
1637
- */class Hu{constructor(){this.Tu=new ua(no.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}):Os():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class ju{constructor(t,e,n,r,i,s,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,r,i){const s=[];return e.forEach((t=>{s.push({type:0,doc:t})})),new ju(t,e,Vu.emptySet(e),s,n,r,!0,!1,i)}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)&&Pa(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}}
1637
+ */class Hu{constructor(){this.Tu=new ua(no.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}):xs():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class ju{constructor(t,e,n,i,r,s,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=r,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,i,r){const s=[];return e.forEach((t=>{s.push({type:0,doc:t})})),new ju(t,e,Vu.emptySet(e),s,n,i,!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)&&Da(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}}
1638
1638
  /**
1639
1639
  * @license
1640
1640
  * Copyright 2017 Google LLC
@@ -1650,7 +1650,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1650
1650
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1651
1651
  * See the License for the specific language governing permissions and
1652
1652
  * limitations under the License.
1653
- */class $u{constructor(){this.Au=void 0,this.listeners=[]}}class qu{constructor(){this.queries=new Sc((t=>xa(t)),Pa),this.onlineState="Unknown",this.Ru=new Set}}async function Wu(t,e){const n=Ps(t),r=e.query;let i=!1,s=n.queries.get(r);if(s||(i=!0,s=new $u),i)try{s.Au=await n.onListen(r)}catch(t){const n=Bu(t,`Initialization of query '${Ma(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,s),s.listeners.push(e),e.bu(n.onlineState),s.Au&&e.Pu(s.Au)&&Yu(n)}async function Ku(t,e){const n=Ps(t),r=e.query;let i=!1;const s=n.queries.get(r);if(s){const t=s.listeners.indexOf(e);t>=0&&(s.listeners.splice(t,1),i=0===s.listeners.length)}if(i)return n.queries.delete(r),n.onUnlisten(r)}function Gu(t,e){const n=Ps(t);let r=!1;for(const t of e){const e=t.query,i=n.queries.get(e);if(i){for(const e of i.listeners)e.Pu(t)&&(r=!0);i.Au=t}}r&&Yu(n)}function Qu(t,e,n){const r=Ps(t),i=r.queries.get(e);if(i)for(const t of i.listeners)t.onError(n);r.queries.delete(e)}function Yu(t){t.Ru.forEach((t=>{t.next()}))}class Ju{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 ju(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=ju.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1653
+ */class qu{constructor(){this.Au=void 0,this.listeners=[]}}class $u{constructor(){this.queries=new Sc((t=>Pa(t)),Da),this.onlineState="Unknown",this.Ru=new Set}}async function Ku(t,e){const n=Ds(t),i=e.query;let r=!1,s=n.queries.get(i);if(s||(r=!0,s=new qu),r)try{s.Au=await n.onListen(i)}catch(t){const n=Bu(t,`Initialization of query '${Ma(e.query)}' failed`);return void e.onError(n)}n.queries.set(i,s),s.listeners.push(e),e.bu(n.onlineState),s.Au&&e.Pu(s.Au)&&Yu(n)}async function Wu(t,e){const n=Ds(t),i=e.query;let r=!1;const s=n.queries.get(i);if(s){const t=s.listeners.indexOf(e);t>=0&&(s.listeners.splice(t,1),r=0===s.listeners.length)}if(r)return n.queries.delete(i),n.onUnlisten(i)}function Gu(t,e){const n=Ds(t);let i=!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)&&(i=!0);r.Au=t}}i&&Yu(n)}function Qu(t,e,n){const i=Ds(t),r=i.queries.get(e);if(r)for(const t of r.listeners)t.onError(n);i.queries.delete(e)}function Yu(t){t.Ru.forEach((t=>{t.next()}))}class Ju{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 ju(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=ju.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1654
1654
  /**
1655
1655
  * @license
1656
1656
  * Copyright 2017 Google LLC
@@ -1666,7 +1666,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1666
1666
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1667
1667
  * See the License for the specific language governing permissions and
1668
1668
  * limitations under the License.
1669
- */class Xu{constructor(t){this.key=t}}class Zu{constructor(t){this.key=t}}class th{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Oc(),this.mutatedKeys=Oc(),this.Gu=Fa(t),this.Qu=new Vu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Hu,r=e?e.Qu:this.Qu;let i=e?e.mutatedKeys:this.mutatedKeys,s=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const l=r.get(t),u=Ua(this.query,e)?e:null,h=!!l&&this.mutatedKeys.has(l.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let f=!1;l&&u?l.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),f=!0):this.Hu(l,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.Gu(u,a)>0||c&&this.Gu(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),f=!0):l&&!u&&(n.track({type:1,doc:l}),f=!0,(a||c)&&(o=!0)),f&&(u?(s=s.add(u),i=d?i.add(t):i.delete(t)):(s=s.delete(t),i=i.delete(t)))})),null!==this.query.limit)for(;s.size>this.query.limit;){const t="F"===this.query.limitType?s.last():s.first();s=s.delete(t.key),i=i.delete(t.key),n.track({type:1,doc:t})}return{Qu:s,zu:n,$i:o,mutatedKeys:i}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const i=t.zu.Eu();i.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 Os()}};return n(t)-n(e)}
1669
+ */class Xu{constructor(t){this.key=t}}class Zu{constructor(t){this.key=t}}class th{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=xc(),this.mutatedKeys=xc(),this.Gu=Ua(t),this.Qu=new Vu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Hu,i=e?e.Qu:this.Qu;let r=e?e.mutatedKeys:this.mutatedKeys,s=i,o=!1;const a="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(t.inorderTraversal(((t,e)=>{const l=i.get(t),u=Fa(this.query,e)?e:null,h=!!l&&this.mutatedKeys.has(l.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let f=!1;l&&u?l.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),f=!0):this.Hu(l,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.Gu(u,a)>0||c&&this.Gu(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),f=!0):l&&!u&&(n.track({type:1,doc:l}),f=!0,(a||c)&&(o=!0)),f&&(u?(s=s.add(u),r=d?r.add(t):r.delete(t)):(s=s.delete(t),r=r.delete(t)))})),null!==this.query.limit)for(;s.size>this.query.limit;){const t="F"===this.query.limitType?s.last():s.first();s=s.delete(t.key),r=r.delete(t.key),n.track({type:1,doc:t})}return{Qu:s,zu:n,$i:o,mutatedKeys:r}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const i=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 xs()}};return n(t)-n(e)}
1670
1670
  /**
1671
1671
  * @license
1672
1672
  * Copyright 2020 Google LLC
@@ -1682,7 +1682,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1682
1682
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1683
1683
  * See the License for the specific language governing permissions and
1684
1684
  * limitations under the License.
1685
- */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==i.length||a?{snapshot:new ju(this.query,t.Qu,r,i,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Hu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Oc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Zu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Xu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return ju.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class eh{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class nh{constructor(t){this.key=t,this.nc=!1}}class rh{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new Sc((t=>xa(t)),Pa),this.rc=new Map,this.oc=new Set,this.uc=new ua(no.comparator),this.cc=new Map,this.ac=new Ol,this.hc={},this.lc=new Map,this.fc=kl.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function ih(t,e){const n=function(t){const e=Ps(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ah.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Sh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=lh.bind(null,e),e.sc.Wo=Gu.bind(null,e.eventManager),e.sc.wc=Qu.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=Ps(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,lo.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new Sl(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,La(e));n.isPrimaryClient&&pu(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await Ql(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return mh(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await Ql(t.localStore,e,!0),o=new th(e,s.Hi),a=o.Wu(s.documents),c=Mc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);mh(t,n,l.Xu);const u=new eh(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,r,"current"===s,t.resumeToken)}return i}async function sh(t,e){const n=Ps(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!Pa(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Gl(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),gu(n.remoteStore,r.targetId),ph(n,r.targetId)})).catch(co)):(ph(n,r.targetId),await Gl(n.localStore,r.targetId,!0))}async function oh(t,e,n){const r=function(t){const e=Ps(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=uh.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hh.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ps(t),r=Ys.now(),i=e.reduce(((t,e)=>t.add(e.key)),Oc());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=Ec(),c=Oc();return n.Gi.getEntries(t,i).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((i=>{s=i;const o=[];for(const t of e){const e=cc(t,s.get(t.key).overlayedDocument);null!=e&&o.push(new hc(t.key,e,ya(e.value.mapValue),nc.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:kc(s)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new ua(Gs)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await wh(r,t.changes),await Cu(r.remoteStore)}catch(t){const e=Bu(t,"Failed to persist write");n.reject(e)}}async function ah(t,e){const n=Ps(t);try{const t=await Wl(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Ds(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Ds(r.nc):t.removedDocuments.size>0&&(Ds(r.nc),r.nc=!1))})),await wh(n,t,e)}catch(t){await co(t)}}function ch(t,e,n){const r=Ps(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const i=r.view.bu(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=Ps(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Yu(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function lh(t,e,n){const r=Ps(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.cc.get(e),s=i&&i.key;if(s){let t=new ua(no.comparator);t=t.insert(s,va.newNoDocument(s,Js.min()));const n=Oc().add(s),i=new xc(Js.min(),new Map,new fa(Gs),t,n);await ah(r,i),r.uc=r.uc.remove(s),r.cc.delete(e),vh(r)}else await Gl(r.localStore,e,!1).then((()=>ph(r,e,n))).catch(co)}async function uh(t,e){const n=Ps(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Ps(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),i=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const i=n.batch,s=i.keys();let o=lo.resolve();return s.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);Ds(null!==s),e.version.compareTo(s)<0&&(i.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,i)))}(n,t,e,i).next((()=>i.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Oc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);fh(n,r,null),dh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await wh(n,t)}catch(t){await co(t)}}async function hh(t,e,n){const r=Ps(t);try{const t=await function(t,e){const n=Ps(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Ds(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);fh(r,e,n),dh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await wh(r,t)}catch(n){await co(n)}}function dh(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function fh(t,e,n){const r=Ps(t);let i=r.hc[r.currentUser.toKey()];if(i){const t=i.get(e);t&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.hc[r.currentUser.toKey()]=i}}function ph(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||gh(t,e)}))}function gh(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(gu(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),vh(t))}function mh(t,e,n){for(const r of n)r instanceof Xu?(t.ac.addReference(r.key,e),yh(t,r)):r instanceof Zu?(As("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||gh(t,r.key)):Os()}function yh(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(As("SyncEngine","New document in limbo: "+n),t.oc.add(r),vh(t))}function vh(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 no(Zs.fromString(e)),r=t.fc.next();t.cc.set(r,new nh(n)),t.uc=t.uc.insert(n,r),pu(t.remoteStore,new Sl(La(Ia(n.path)),r,2,ho.at))}}async function wh(t,e,n){const r=Ps(t),i=[],s=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);const e=Vl.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.sc.Wo(i),await async function(t,e){const n=Ps(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>lo.forEach(e,(e=>lo.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>lo.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!uo(t))throw t;As("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,i)}}}(r.localStore,s))}async function bh(t,e){const n=Ps(t);if(!n.currentUser.isEqual(e)){As("SyncEngine","User change. New user:",e.toKey());const t=await $l(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Ms(xs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await wh(n,t.ji)}}function Sh(t,e){const n=Ps(t),r=n.cc.get(e);if(r&&r.nc)return Oc().add(r.key);{let t=Oc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class _h{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=iu(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new jl(t,e,n,r)}(this.persistence,new Hl,t.initialUser,this.yt)}yc(t){return new Fl(Bl.Bs,this.yt)}gc(t){return new Jl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Eh{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=>ch(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=bh.bind(null,this.syncEngine),await async function(t,e){const n=Ps(t);e?(n._u.delete(2),await du(n)):e||(n._u.add(2),await fu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new qu}createDatastore(t){const e=iu(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new nu(r));var r;return function(t,e,n,r){return new lu(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>ch(this.syncEngine,t,0),s=Zl.C()?new Zl:new Xl,new hu(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new rh(t,e,n,r,i,s);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=Ps(t);As("RemoteStore","RemoteStore shutting down."),e._u.add(5),await fu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1685
+ */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=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 ju(this.query,t.Qu,i,r,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Hu,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=xc(),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 Zu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Xu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=xc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return ju.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class eh{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class nh{constructor(t){this.key=t,this.nc=!1}}class ih{constructor(t,e,n,i,r,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new Sc((t=>Pa(t)),Da),this.rc=new Map,this.oc=new Set,this.uc=new ua(no.comparator),this.cc=new Map,this.ac=new xl,this.hc={},this.lc=new Map,this.fc=kl.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function rh(t,e){const n=function(t){const e=Ds(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ah.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Sh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=lh.bind(null,e),e.sc.Wo=Gu.bind(null,e.eventManager),e.sc.wc=Qu.bind(null,e.eventManager),e}(t);let i,r;const s=n.ic.get(e);if(s)i=s.targetId,n.sharedClientState.addLocalQueryTarget(i),r=s.view.ec();else{const t=await function(t,e){const n=Ds(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let i;return n.Cs.getTargetData(t,e).next((r=>r?(i=r,lo.resolve(i)):n.Cs.allocateTargetId(t).next((r=>(i=new Sl(e,r,0,t.currentSequenceNumber),n.Cs.addTargetData(t,i).next((()=>i)))))))})).then((t=>{const i=n.qi.get(t.targetId);return(null===i||t.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Na(e));n.isPrimaryClient&&pu(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);i=t.targetId,r=await async function(t,e,n,i,r){t._c=(e,n,i)=>async function(t,e,n,i){let r=e.view.Wu(n);r.$i&&(r=await Ql(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,r))));const s=i&&i.targetChanges.get(e.targetId),o=e.view.applyChanges(r,t.isPrimaryClient,s);return mh(t,e.targetId,o.Xu),o.snapshot}(t,e,n,i);const s=await Ql(t.localStore,e,!0),o=new th(e,s.Hi),a=o.Wu(s.documents),c=Mc.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==t.onlineState,r),l=o.applyChanges(a,t.isPrimaryClient,c);mh(t,n,l.Xu);const u=new eh(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,i,"current"===s,t.resumeToken)}return r}async function sh(t,e){const n=Ds(t),i=n.ic.get(e),r=n.rc.get(i.targetId);if(r.length>1)return n.rc.set(i.targetId,r.filter((t=>!Da(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(i.targetId),n.sharedClientState.isActiveQueryTarget(i.targetId)||await Gl(n.localStore,i.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(i.targetId),gu(n.remoteStore,i.targetId),ph(n,i.targetId)})).catch(co)):(ph(n,i.targetId),await Gl(n.localStore,i.targetId,!0))}async function oh(t,e,n){const i=function(t){const e=Ds(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=uh.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hh.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ds(t),i=Ys.now(),r=e.reduce(((t,e)=>t.add(e.key)),xc());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=_c(),c=xc();return n.Gi.getEntries(t,r).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((r=>{s=r;const o=[];for(const t of e){const e=cc(t,s.get(t.key).overlayedDocument);null!=e&&o.push(new hc(t.key,e,ya(e.value.mapValue),nc.exists(!0)))}return n.mutationQueue.addMutationBatch(t,i,o,e)})).next((e=>{o=e;const i=e.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,i)}))})).then((()=>({batchId:o.batchId,changes:kc(s)})))}(i.localStore,e);i.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let i=t.hc[t.currentUser.toKey()];i||(i=new ua(Gs)),i=i.insert(e,n),t.hc[t.currentUser.toKey()]=i}(i,t.batchId,n),await wh(i,t.changes),await Cu(i.remoteStore)}catch(t){const e=Bu(t,"Failed to persist write");n.reject(e)}}async function ah(t,e){const n=Ds(t);try{const t=await Kl(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const i=n.cc.get(e);i&&(Os(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?i.nc=!0:t.modifiedDocuments.size>0?Os(i.nc):t.removedDocuments.size>0&&(Os(i.nc),i.nc=!1))})),await wh(n,t,e)}catch(t){await co(t)}}function ch(t,e,n){const i=Ds(t);if(i.isPrimaryClient&&0===n||!i.isPrimaryClient&&1===n){const t=[];i.ic.forEach(((n,i)=>{const r=i.view.bu(e);r.snapshot&&t.push(r.snapshot)})),function(t,e){const n=Ds(t);n.onlineState=e;let i=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(i=!0)})),i&&Yu(n)}(i.eventManager,e),t.length&&i.sc.Wo(t),i.onlineState=e,i.isPrimaryClient&&i.sharedClientState.setOnlineState(e)}}async function lh(t,e,n){const i=Ds(t);i.sharedClientState.updateQueryState(e,"rejected",n);const r=i.cc.get(e),s=r&&r.key;if(s){let t=new ua(no.comparator);t=t.insert(s,va.newNoDocument(s,Js.min()));const n=xc().add(s),r=new Pc(Js.min(),new Map,new fa(Gs),t,n);await ah(i,r),i.uc=i.uc.remove(s),i.cc.delete(e),vh(i)}else await Gl(i.localStore,e,!1).then((()=>ph(i,e,n))).catch(co)}async function uh(t,e){const n=Ds(t),i=e.batch.batchId;try{const t=await function(t,e){const n=Ds(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const i=e.batch.keys(),r=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,i){const r=n.batch,s=r.keys();let o=lo.resolve();return s.forEach((t=>{o=o.next((()=>i.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);Os(null!==s),e.version.compareTo(s)<0&&(r.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),i.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,r)))}(n,t,e,r).next((()=>r.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,i,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=xc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,i)))}))}(n.localStore,e);fh(n,i,null),dh(n,i),n.sharedClientState.updateMutationState(i,"acknowledged"),await wh(n,t)}catch(t){await co(t)}}async function hh(t,e,n){const i=Ds(t);try{const t=await function(t,e){const n=Ds(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let i;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Os(null!==e),i=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,i,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,i))).next((()=>n.localDocuments.getDocuments(t,i)))}))}(i.localStore,e);fh(i,e,n),dh(i,e),i.sharedClientState.updateMutationState(e,"rejected",n),await wh(i,t)}catch(n){await co(n)}}function dh(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function fh(t,e,n){const i=Ds(t);let r=i.hc[i.currentUser.toKey()];if(r){const t=r.get(e);t&&(n?t.reject(n):t.resolve(),r=r.remove(e)),i.hc[i.currentUser.toKey()]=r}}function ph(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const i of t.rc.get(e))t.ic.delete(i),n&&t.sc.wc(i,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||gh(t,e)}))}function gh(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(gu(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),vh(t))}function mh(t,e,n){for(const i of n)i instanceof Xu?(t.ac.addReference(i.key,e),yh(t,i)):i instanceof Zu?(As("SyncEngine","Document no longer in limbo: "+i.key),t.ac.removeReference(i.key,e),t.ac.containsKey(i.key)||gh(t,i.key)):xs()}function yh(t,e){const n=e.key,i=n.path.canonicalString();t.uc.get(n)||t.oc.has(i)||(As("SyncEngine","New document in limbo: "+n),t.oc.add(i),vh(t))}function vh(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 no(Zs.fromString(e)),i=t.fc.next();t.cc.set(i,new nh(n)),t.uc=t.uc.insert(n,i),pu(t.remoteStore,new Sl(Na(Ia(n.path)),i,2,ho.at))}}async function wh(t,e,n){const i=Ds(t),r=[],s=[],o=[];i.ic.isEmpty()||(i.ic.forEach(((t,a)=>{o.push(i._c(a,e,n).then((t=>{if((t||n)&&i.isPrimaryClient&&i.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){r.push(t);const e=Vl.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),i.sc.Wo(r),await async function(t,e){const n=Ds(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>lo.forEach(e,(e=>lo.forEach(e.Si,(i=>n.persistence.referenceDelegate.addReference(t,e.targetId,i))).next((()=>lo.forEach(e.Di,(i=>n.persistence.referenceDelegate.removeReference(t,e.targetId,i)))))))))}catch(t){if(!uo(t))throw t;As("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),i=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(i);n.qi=n.qi.insert(e,r)}}}(i.localStore,s))}async function bh(t,e){const n=Ds(t);if(!n.currentUser.isEqual(e)){As("SyncEngine","User change. New user:",e.toKey());const t=await ql(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Ms(Ps.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await wh(n,t.ji)}}function Sh(t,e){const n=Ds(t),i=n.cc.get(e);if(i&&i.nc)return xc().add(i.key);{let t=xc();const i=n.rc.get(e);if(!i)return t;for(const e of i){const i=n.ic.get(e);t=t.unionWith(i.view.ju)}return t}}class Eh{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=ru(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,i){return new jl(t,e,n,i)}(this.persistence,new Hl,t.initialUser,this.yt)}yc(t){return new Ul(Bl.Bs,this.yt)}gc(t){return new Jl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class _h{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=>ch(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=bh.bind(null,this.syncEngine),await async function(t,e){const n=Ds(t);e?(n._u.delete(2),await du(n)):e||(n._u.add(2),await fu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new $u}createDatastore(t){const e=ru(t.databaseInfo.databaseId),n=(i=t.databaseInfo,new nu(i));var i;return function(t,e,n,i){return new lu(t,e,n,i)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,i=t.asyncQueue,r=t=>ch(this.syncEngine,t,0),s=Zl.C()?new Zl:new Xl,new hu(e,n,i,r,s);var e,n,i,r,s}createSyncEngine(t,e){return function(t,e,n,i,r,s,o){const a=new ih(t,e,n,i,r,s);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=Ds(t);As("RemoteStore","RemoteStore shutting down."),e._u.add(5),await fu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1686
1686
  /**
1687
1687
  * @license
1688
1688
  * Copyright 2017 Google LLC
@@ -1698,7 +1698,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1698
1698
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1699
1699
  * See the License for the specific language governing permissions and
1700
1700
  * limitations under the License.
1701
- */function Th(t,e,n){if(!n)throw new Ms(xs.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Ih(t){if(!no.isDocumentKey(t))throw new Ms(xs.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function kh(t){if(no.isDocumentKey(t))throw new Ms(xs.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Ch(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":Os()}function Ah(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Ms(xs.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Ch(t);throw new Ms(xs.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
1701
+ */function Th(t,e,n){if(!n)throw new Ms(Ps.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Ih(t){if(!no.isDocumentKey(t))throw new Ms(Ps.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function kh(t){if(no.isDocumentKey(t))throw new Ms(Ps.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Ch(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":xs()}function Ah(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Ms(Ps.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Ch(t);throw new Ms(Ps.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
1702
1702
  /**
1703
1703
  * @license
1704
1704
  * Copyright 2020 Google LLC
@@ -1714,7 +1714,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1714
1714
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1715
1715
  * See the License for the specific language governing permissions and
1716
1716
  * limitations under the License.
1717
- */const Rh=new Map;class Nh{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Ms(xs.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 Ms(xs.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new Ms(xs.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}}
1717
+ */const Rh=new Map;class Lh{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Ms(Ps.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 Ms(Ps.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,i){if(!0===e&&!0===i)throw new Ms(Ps.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}}
1718
1718
  /**
1719
1719
  * @license
1720
1720
  * Copyright 2020 Google LLC
@@ -1730,7 +1730,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1730
1730
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1731
1731
  * See the License for the specific language governing permissions and
1732
1732
  * limitations under the License.
1733
- */class Lh{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Nh({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Ms(xs.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 Ms(xs.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 Nh(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new zs;switch(t.type){case"gapi":const e=t.client;return new js(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Ms(xs.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&&(As("ComponentProvider","Removing Datastore"),Rh.delete(t),e.terminate())}(this),Promise.resolve()}}function Oh(t,e,n,r={}){var i;const s=(t=Ah(t,Lh))._getSettings();if("firestore.googleapis.com"!==s.host&&s.host!==e&&Ns("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},s),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=Ts.MOCK_USER;else{e=
1733
+ */class Nh{constructor(t,e,n,i){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Lh({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Ms(Ps.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 Ms(Ps.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 Lh(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new zs;switch(t.type){case"gapi":const e=t.client;return new js(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Ms(Ps.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&&(As("ComponentProvider","Removing Datastore"),Rh.delete(t),e.terminate())}(this),Promise.resolve()}}function xh(t,e,n,i={}){var r;const s=(t=Ah(t,Nh))._getSettings();if("firestore.googleapis.com"!==s.host&&s.host!==e&&Ls("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},s),{host:`${e}:${n}`,ssl:!1})),i.mockUserToken){let e,n;if("string"==typeof i.mockUserToken)e=i.mockUserToken,n=Ts.MOCK_USER;else{e=
1734
1734
  /**
1735
1735
  * @license
1736
1736
  * Copyright 2021 Google LLC
@@ -1747,7 +1747,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1747
1747
  * See the License for the specific language governing permissions and
1748
1748
  * limitations under the License.
1749
1749
  */
1750
- function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[ne(JSON.stringify({alg:"none",type:"JWT"})),ne(JSON.stringify(s)),""].join(".")}
1750
+ 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",i=t.iat||0,r=t.sub||t.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},t);return[ne(JSON.stringify({alg:"none",type:"JWT"})),ne(JSON.stringify(s)),""].join(".")}
1751
1751
  /**
1752
1752
  * @license
1753
1753
  * Copyright 2017 Google LLC
@@ -1763,7 +1763,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1763
1763
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1764
1764
  * See the License for the specific language governing permissions and
1765
1765
  * limitations under the License.
1766
- */(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new Ms(xs.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Ts(s)}t._authCredentials=new Bs(new Fs(e,n))}}
1766
+ */(i.mockUserToken,null===(r=t._app)||void 0===r?void 0:r.options.projectId);const s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new Ms(Ps.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Ts(s)}t._authCredentials=new Bs(new Us(e,n))}}
1767
1767
  /**
1768
1768
  * @license
1769
1769
  * Copyright 2020 Google LLC
@@ -1779,7 +1779,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1779
1779
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1780
1780
  * See the License for the specific language governing permissions and
1781
1781
  * limitations under the License.
1782
- */class Dh{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 xh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Dh(this.firestore,t,this._key)}}class Ph{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Ph(this.firestore,t,this._query)}}class xh extends Ph{constructor(t,e,n){super(t,e,Ia(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Dh(this.firestore,null,new no(t))}withConverter(t){return new xh(this.firestore,t,this._path)}}function Mh(t,e,...n){if(t=ue(t),Th("collection","path",e),t instanceof Lh){const r=Zs.fromString(e,...n);return kh(r),new xh(t,null,r)}{if(!(t instanceof Dh||t instanceof xh))throw new Ms(xs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Zs.fromString(e,...n));return kh(r),new xh(t.firestore,null,r)}}function Uh(t,e,...n){if(t=ue(t),1===arguments.length&&(e=Ks.R()),Th("doc","path",e),t instanceof Lh){const r=Zs.fromString(e,...n);return Ih(r),new Dh(t,null,new no(r))}{if(!(t instanceof Dh||t instanceof xh))throw new Ms(xs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Zs.fromString(e,...n));return Ih(r),new Dh(t.firestore,t instanceof xh?t.converter:null,new no(r))}}
1782
+ */class Oh{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Ph(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Oh(this.firestore,t,this._key)}}class Dh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Dh(this.firestore,t,this._query)}}class Ph extends Dh{constructor(t,e,n){super(t,e,Ia(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Oh(this.firestore,null,new no(t))}withConverter(t){return new Ph(this.firestore,t,this._path)}}function Mh(t,e,...n){if(t=ue(t),Th("collection","path",e),t instanceof Nh){const i=Zs.fromString(e,...n);return kh(i),new Ph(t,null,i)}{if(!(t instanceof Oh||t instanceof Ph))throw new Ms(Ps.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const i=t._path.child(Zs.fromString(e,...n));return kh(i),new Ph(t.firestore,null,i)}}function Fh(t,e,...n){if(t=ue(t),1===arguments.length&&(e=Ws.R()),Th("doc","path",e),t instanceof Nh){const i=Zs.fromString(e,...n);return Ih(i),new Oh(t,null,new no(i))}{if(!(t instanceof Oh||t instanceof Ph))throw new Ms(Ps.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const i=t._path.child(Zs.fromString(e,...n));return Ih(i),new Oh(t.firestore,t instanceof Ph?t.converter:null,new no(i))}}
1783
1783
  /**
1784
1784
  * @license
1785
1785
  * Copyright 2020 Google LLC
@@ -1811,7 +1811,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1811
1811
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1812
1812
  * See the License for the specific language governing permissions and
1813
1813
  * limitations under the License.
1814
- */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):Rs("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
1814
+ */class Uh{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):Rs("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
1815
1815
  /**
1816
1816
  * @license
1817
1817
  * Copyright 2017 Google LLC
@@ -1827,7 +1827,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1827
1827
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1828
1828
  * See the License for the specific language governing permissions and
1829
1829
  * limitations under the License.
1830
- */class zh{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=Ts.UNAUTHENTICATED,this.clientId=Ks.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{As("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(As("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 Ms(xs.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Us;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=Bu(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function Bh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(As("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),As("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await $l(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new _h)),t.offlineComponents}(t);As("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>Mu(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Mu(e.remoteStore,n))),t.onlineComponents=e}async function Vh(t){return t.onlineComponents||(As("FirestoreClient","Using default OnlineComponentProvider"),await Bh(t,new Eh)),t.onlineComponents}async function Hh(t){const e=await Vh(t),n=e.eventManager;return n.onListen=ih.bind(null,e.syncEngine),n.onUnlisten=sh.bind(null,e.syncEngine),n}class jh{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 su(this,"async_queue_retry"),this.Wc=()=>{const t=ru();t&&As("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=ru();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=ru();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new Us;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!uo(t))throw t;As("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}
1830
+ */class zh{constructor(t,e,n,i){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=i,this.user=Ts.UNAUTHENTICATED,this.clientId=Ws.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{As("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(As("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 Ms(Ps.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Fs;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=Bu(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function Bh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(As("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),As("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let i=n.initialUser;t.setCredentialChangeListener((async t=>{i.isEqual(t)||(await ql(e.localStore,t),i=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Eh)),t.offlineComponents}(t);As("FirestoreClient","Initializing OnlineComponentProvider");const i=await t.getConfiguration();await e.initialize(n,i),t.setCredentialChangeListener((t=>Mu(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Mu(e.remoteStore,n))),t.onlineComponents=e}async function Vh(t){return t.onlineComponents||(As("FirestoreClient","Using default OnlineComponentProvider"),await Bh(t,new _h)),t.onlineComponents}async function Hh(t){const e=await Vh(t),n=e.eventManager;return n.onListen=rh.bind(null,e.syncEngine),n.onUnlisten=sh.bind(null,e.syncEngine),n}class jh{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 su(this,"async_queue_retry"),this.Wc=()=>{const t=iu();t&&As("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=iu();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=iu();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new Fs;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!uo(t))throw t;As("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}
1831
1831
  /**
1832
1832
  * @license
1833
1833
  * Copyright 2017 Google LLC
@@ -1843,7 +1843,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1843
1843
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1844
1844
  * See the License for the specific language governing permissions and
1845
1845
  * limitations under the License.
1846
- */(t);throw Rs("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.Gc=!1,t))))));return this.Bc=e,e}enqueueAfterDelay(t,e,n){this.zc(),this.jc.indexOf(t)>-1&&(e=0);const r=zu.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&Os()}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 $h(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}
1846
+ */(t);throw Rs("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 i=zu.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(i),i}zc(){this.Kc&&xs()}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 qh(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}
1847
1847
  /**
1848
1848
  * @license
1849
1849
  * Copyright 2020 Google LLC
@@ -1859,7 +1859,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1859
1859
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1860
1860
  * See the License for the specific language governing permissions and
1861
1861
  * limitations under the License.
1862
- */(t)}class qh extends Lh{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new jh,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Kh(this),this._firestoreClient.terminate()}}function Wh(t){return t._firestoreClient||Kh(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Kh(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new fo(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
1862
+ */(t)}class $h extends Nh{constructor(t,e,n,i){super(t,e,n,i),this.type="firestore",this._queue=new jh,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Wh(this),this._firestoreClient.terminate()}}function Kh(t){return t._firestoreClient||Wh(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Wh(t){var e;const n=t._freezeSettings(),i=function(t,e,n,i){return new fo(t,e,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,i.useFetchStreams)}
1863
1863
  /**
1864
1864
  * @license
1865
1865
  * Copyright 2020 Google LLC
@@ -1875,7 +1875,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1875
1875
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1876
1876
  * See the License for the specific language governing permissions and
1877
1877
  * limitations under the License.
1878
- */(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new zh(t._authCredentials,t._appCheckCredentials,t._queue,r)}
1878
+ */(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new zh(t._authCredentials,t._appCheckCredentials,t._queue,i)}
1879
1879
  /**
1880
1880
  * @license
1881
1881
  * Copyright 2020 Google LLC
@@ -1907,7 +1907,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1907
1907
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1908
1908
  * See the License for the specific language governing permissions and
1909
1909
  * limitations under the License.
1910
- */class Gh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Gh(bo.fromBase64String(t))}catch(t){throw new Ms(xs.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Gh(bo.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)}}
1910
+ */class Gh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Gh(bo.fromBase64String(t))}catch(t){throw new Ms(Ps.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Gh(bo.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)}}
1911
1911
  /**
1912
1912
  * @license
1913
1913
  * Copyright 2020 Google LLC
@@ -1923,7 +1923,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1923
1923
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1924
1924
  * See the License for the specific language governing permissions and
1925
1925
  * limitations under the License.
1926
- */class Qh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Ms(xs.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new eo(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
1926
+ */class Qh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Ms(Ps.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new eo(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
1927
1927
  /**
1928
1928
  * @license
1929
1929
  * Copyright 2020 Google LLC
@@ -1956,7 +1956,7 @@ class Yh{constructor(t){this._methodName=t}}
1956
1956
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1957
1957
  * See the License for the specific language governing permissions and
1958
1958
  * limitations under the License.
1959
- */class Jh{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Ms(xs.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Ms(xs.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 Gs(this._lat,t._lat)||Gs(this._long,t._long)}}
1959
+ */class Jh{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Ms(Ps.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Ms(Ps.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 Gs(this._lat,t._lat)||Gs(this._long,t._long)}}
1960
1960
  /**
1961
1961
  * @license
1962
1962
  * Copyright 2017 Google LLC
@@ -1972,7 +1972,7 @@ class Yh{constructor(t){this._methodName=t}}
1972
1972
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1973
1973
  * See the License for the specific language governing permissions and
1974
1974
  * limitations under the License.
1975
- */const Xh=/^__.*__$/;class Zh{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new hc(t,this.data,this.fieldMask,e,this.fieldTransforms):new uc(t,this.data,e,this.fieldTransforms)}}function td(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Os()}}class ed{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===i&&this.na(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new ed(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return dd(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(td(this.sa)&&Xh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class nd{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||iu(t)}da(t,e,n,r=!1){return new ed({sa:t,methodName:e,fa:n,path:eo.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function rd(t){const e=t._freezeSettings(),n=iu(t._databaseId);return new nd(t._databaseId,!!e.ignoreUndefinedProperties,n)}function id(t,e,n,r,i,s={}){const o=t.da(s.merge||s.mergeFields?2:0,e,n,i);cd("Data must be an object, but it was:",o,r);const a=od(r,o);let c,l;if(s.merge)c=new ga(o.fieldMask),l=o.fieldTransforms;else if(s.mergeFields){const t=[];for(const r of s.mergeFields){const i=ld(e,r,n);if(!o.contains(i))throw new Ms(xs.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);fd(t,i)||t.push(i)}c=new ga(t),l=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,l=o.fieldTransforms;return new Zh(new ma(a),c,l)}function sd(t,e){if(ad(t=ue(t)))return cd("Unsupported field value:",e,t),od(t,e);if(t instanceof Yh)return function(t,e){if(!td(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const i of t){let t=sd(i,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=ue(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ha(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Ys.fromDate(t);return{timestampValue:Gc(e.yt,n)}}if(t instanceof Ys){const n=new Ys(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Gc(e.yt,n)}}if(t instanceof Jh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Gh)return{bytesValue:Qc(e.yt,t._byteString)};if(t instanceof Dh){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Xc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Ch(t)}`)}(t,e)}function od(t,e){const n={};return yo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):mo(t,((t,r)=>{const i=sd(r,e.ra(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}function ad(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ys||t instanceof Jh||t instanceof Gh||t instanceof Dh||t instanceof Yh)}function cd(t,e,n){if(!ad(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Ch(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function ld(t,e,n){if((e=ue(e))instanceof Qh)return e._internalPath;if("string"==typeof e)return hd(t,e);throw dd("Field path arguments must be of type string or ",t,!1,void 0,n)}const ud=new RegExp("[~\\*/\\[\\]]");function hd(t,e,n){if(e.search(ud)>=0)throw dd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Qh(...e.split("."))._internalPath}catch(r){throw dd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function dd(t,e,n,r,i){const s=r&&!r.isEmpty(),o=void 0!==i;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=")"),new Ms(xs.INVALID_ARGUMENT,a+t+c)}function fd(t,e){return t.some((t=>t.isEqual(e)))}
1975
+ */const Xh=/^__.*__$/;class Zh{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new hc(t,this.data,this.fieldMask,e,this.fieldTransforms):new uc(t,this.data,e,this.fieldTransforms)}}function td(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw xs()}}class ed{constructor(t,e,n,i,r,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=i,void 0===r&&this.na(),this.fieldTransforms=r||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new ed(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),i=this.ia({path:n,oa:!1});return i.ua(t),i}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),i=this.ia({path:n,oa:!1});return i.na(),i}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return dd(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(td(this.sa)&&Xh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class nd{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||ru(t)}da(t,e,n,i=!1){return new ed({sa:t,methodName:e,fa:n,path:eo.emptyPath(),oa:!1,la:i},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function id(t){const e=t._freezeSettings(),n=ru(t._databaseId);return new nd(t._databaseId,!!e.ignoreUndefinedProperties,n)}function rd(t,e,n,i,r,s={}){const o=t.da(s.merge||s.mergeFields?2:0,e,n,r);cd("Data must be an object, but it was:",o,i);const a=od(i,o);let c,l;if(s.merge)c=new ga(o.fieldMask),l=o.fieldTransforms;else if(s.mergeFields){const t=[];for(const i of s.mergeFields){const r=ld(e,i,n);if(!o.contains(r))throw new Ms(Ps.INVALID_ARGUMENT,`Field '${r}' is specified in your field mask but missing from your input data.`);fd(t,r)||t.push(r)}c=new ga(t),l=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,l=o.fieldTransforms;return new Zh(new ma(a),c,l)}function sd(t,e){if(ad(t=ue(t)))return cd("Unsupported field value:",e,t),od(t,e);if(t instanceof Yh)return function(t,e){if(!td(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 i=0;for(const r of t){let t=sd(r,e.aa(i));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),i++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=ue(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ha(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Ys.fromDate(t);return{timestampValue:Gc(e.yt,n)}}if(t instanceof Ys){const n=new Ys(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Gc(e.yt,n)}}if(t instanceof Jh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Gh)return{bytesValue:Qc(e.yt,t._byteString)};if(t instanceof Oh){const n=e.databaseId,i=t.firestore._databaseId;if(!i.isEqual(n))throw e.ha(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Xc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Ch(t)}`)}(t,e)}function od(t,e){const n={};return yo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):mo(t,((t,i)=>{const r=sd(i,e.ra(t));null!=r&&(n[t]=r)})),{mapValue:{fields:n}}}function ad(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ys||t instanceof Jh||t instanceof Gh||t instanceof Oh||t instanceof Yh)}function cd(t,e,n){if(!ad(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const i=Ch(n);throw"an object"===i?e.ha(t+" a custom object"):e.ha(t+" "+i)}}function ld(t,e,n){if((e=ue(e))instanceof Qh)return e._internalPath;if("string"==typeof e)return hd(t,e);throw dd("Field path arguments must be of type string or ",t,!1,void 0,n)}const ud=new RegExp("[~\\*/\\[\\]]");function hd(t,e,n){if(e.search(ud)>=0)throw dd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Qh(...e.split("."))._internalPath}catch(i){throw dd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function dd(t,e,n,i,r){const s=i&&!i.isEmpty(),o=void 0!==r;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${i}`),o&&(c+=` in document ${r}`),c+=")"),new Ms(Ps.INVALID_ARGUMENT,a+t+c)}function fd(t,e){return t.some((t=>t.isEqual(e)))}
1976
1976
  /**
1977
1977
  * @license
1978
1978
  * Copyright 2020 Google LLC
@@ -1988,7 +1988,7 @@ class Yh{constructor(t){this._methodName=t}}
1988
1988
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1989
1989
  * See the License for the specific language governing permissions and
1990
1990
  * limitations under the License.
1991
- */class pd{constructor(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Dh(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new gd(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(md("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class gd extends pd{data(){return super.data()}}function md(t,e){return"string"==typeof e?hd(t,e):e instanceof Qh?e._internalPath:e._delegate._internalPath}
1991
+ */class pd{constructor(t,e,n,i,r){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=i,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new Oh(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new gd(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(md("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class gd extends pd{data(){return super.data()}}function md(t,e){return"string"==typeof e?hd(t,e):e instanceof Qh?e._internalPath:e._delegate._internalPath}
1992
1992
  /**
1993
1993
  * @license
1994
1994
  * Copyright 2020 Google LLC
@@ -2004,7 +2004,7 @@ class Yh{constructor(t){this._methodName=t}}
2004
2004
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2005
2005
  * See the License for the specific language governing permissions and
2006
2006
  * limitations under the License.
2007
- */function yd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Ms(xs.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class vd{}class wd extends vd{}function bd(t,e,...n){let r=[];e instanceof vd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof Ed)).length,n=t.filter((t=>t instanceof Sd)).length;if(e>1||e>0&&n>0)throw new Ms(xs.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(...)))`.")}
2007
+ */function yd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Ms(Ps.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class vd{}class wd extends vd{}function bd(t,e,...n){let i=[];e instanceof vd&&i.push(e),i=i.concat(n),function(t){const e=t.filter((t=>t instanceof _d)).length,n=t.filter((t=>t instanceof Sd)).length;if(e>1||e>0&&n>0)throw new Ms(Ps.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(...)))`.")}
2008
2008
  /**
2009
2009
  * @license
2010
2010
  * Copyright 2020 Google LLC
@@ -2020,7 +2020,7 @@ class Yh{constructor(t){this._methodName=t}}
2020
2020
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2021
2021
  * See the License for the specific language governing permissions and
2022
2022
  * limitations under the License.
2023
- */(r);for(const e of r)t=e._apply(t);return t}class Sd extends wd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Sd(t,e,n)}_apply(t){const e=this._parse(t);return kd(t._query,e),new Ph(t.firestore,t.converter,Oa(t._query,e))}_parse(t){const e=rd(t.firestore),n=function(t,e,n,r,i,s,o){let a;if(i.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new Ms(xs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){Id(o,s);const e=[];for(const n of o)e.push(Td(r,t,n));a={arrayValue:{values:e}}}else a=Td(r,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||Id(o,s),a=function(t,e,n,r=!1){return sd(n,t.da(r?4:3,e))}(n,"where",o,"in"===s||"not-in"===s);return Ko.create(i,s,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function _d(t,e,n){const r=e,i=md("where",t);return Sd._create(i,r,n)}class Ed extends vd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Ed(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Go.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)kd(n,t),n=Oa(n,t)}(t._query,e),new Ph(t.firestore,t.converter,Oa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Td(t,e,n){if("string"==typeof(n=ue(n))){if(""===n)throw new Ms(xs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Ra(e)&&-1!==n.indexOf("/"))throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Zs.fromString(n));if(!no.isDocumentKey(r))throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Mo(t,new no(r))}if(n instanceof Dh)return Mo(t,n._key);throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ch(n)}.`)}function Id(t,e){if(!Array.isArray(t)||0===t.length)throw new Ms(xs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Ms(xs.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function kd(t,e){if(e.isInequality()){const n=Aa(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const i=Ca(t);null!==i&&function(t,e,n){if(!n.isEqual(e))throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,i)}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 Ms(xs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Ms(xs.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Cd{convertValue(t,e="none"){switch(Ro(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Eo(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(To(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 Os()}}convertObject(t,e){const n={};return mo(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Jh(Eo(t.latitude),Eo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=ko(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Co(t));default:return null}}convertTimestamp(t){const e=_o(t);return new Ys(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Zs.fromString(t);Ds(yl(n));const r=new po(n.get(1),n.get(3)),i=new no(n.popFirst(5));return r.isEqual(e)||Rs(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),i}}
2023
+ */(i);for(const e of i)t=e._apply(t);return t}class Sd extends wd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Sd(t,e,n)}_apply(t){const e=this._parse(t);return kd(t._query,e),new Dh(t.firestore,t.converter,xa(t._query,e))}_parse(t){const e=id(t.firestore),n=function(t,e,n,i,r,s,o){let a;if(r.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new Ms(Ps.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){Id(o,s);const e=[];for(const n of o)e.push(Td(i,t,n));a={arrayValue:{values:e}}}else a=Td(i,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||Id(o,s),a=function(t,e,n,i=!1){return sd(n,t.da(i?4:3,e))}(n,"where",o,"in"===s||"not-in"===s);return Wo.create(r,s,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function Ed(t,e,n){const i=e,r=md("where",t);return Sd._create(r,i,n)}class _d extends vd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new _d(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Go.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const i=e.getFlattenedFilters();for(const t of i)kd(n,t),n=xa(n,t)}(t._query,e),new Dh(t.firestore,t.converter,xa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Td(t,e,n){if("string"==typeof(n=ue(n))){if(""===n)throw new Ms(Ps.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Ra(e)&&-1!==n.indexOf("/"))throw new Ms(Ps.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const i=e.path.child(Zs.fromString(n));if(!no.isDocumentKey(i))throw new Ms(Ps.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${i}' is not because it has an odd number of segments (${i.length}).`);return Mo(t,new no(i))}if(n instanceof Oh)return Mo(t,n._key);throw new Ms(Ps.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ch(n)}.`)}function Id(t,e){if(!Array.isArray(t)||0===t.length)throw new Ms(Ps.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Ms(Ps.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function kd(t,e){if(e.isInequality()){const n=Aa(t),i=e.field;if(null!==n&&!n.isEqual(i))throw new Ms(Ps.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 '${i.toString()}'`);const r=Ca(t);null!==r&&function(t,e,n){if(!n.isEqual(e))throw new Ms(Ps.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,i,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 Ms(Ps.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Ms(Ps.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Cd{convertValue(t,e="none"){switch(Ro(t)){case 0:return null;case 1:return t.booleanValue;case 2:return _o(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(To(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 xs()}}convertObject(t,e){const n={};return mo(t.fields,((t,i)=>{n[t]=this.convertValue(i,e)})),n}convertGeoPoint(t){return new Jh(_o(t.latitude),_o(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=ko(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Co(t));default:return null}}convertTimestamp(t){const e=Eo(t);return new Ys(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Zs.fromString(t);Os(yl(n));const i=new po(n.get(1),n.get(3)),r=new no(n.popFirst(5));return i.isEqual(e)||Rs(`Document ${r} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),r}}
2024
2024
  /**
2025
2025
  * @license
2026
2026
  * Copyright 2020 Google LLC
@@ -2053,7 +2053,7 @@ class Yh{constructor(t){this._methodName=t}}
2053
2053
  * See the License for the specific language governing permissions and
2054
2054
  * limitations under the License.
2055
2055
  */
2056
- class Ad{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Rd extends pd{constructor(t,e,n,r,i,s){super(t,e,n,r,s),this._firestore=t,this._firestoreImpl=t,this.metadata=i}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Nd(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(md("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Nd extends Rd{data(t={}){return super.data(t)}}class Ld{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Ad(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Nd(this._firestore,this._userDataWriter,n.key,n,new Ad(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 Ms(xs.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Nd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Ad(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Nd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Ad(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let i=-1,s=-1;return 0!==e.type&&(i=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),s=n.indexOf(e.doc.key)),{type:Od(e.type),doc:r,oldIndex:i,newIndex:s}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Od(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Os()}}
2056
+ class Ad{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Rd extends pd{constructor(t,e,n,i,r,s){super(t,e,n,i,s),this._firestore=t,this._firestoreImpl=t,this.metadata=r}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Ld(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(md("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Ld extends Rd{data(t={}){return super.data(t)}}class Nd{constructor(t,e,n,i){this._firestore=t,this._userDataWriter=e,this._snapshot=i,this.metadata=new Ad(i.hasPendingWrites,i.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 Ld(this._firestore,this._userDataWriter,n.key,n,new Ad(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 Ms(Ps.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 i=new Ld(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Ad(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const i=new Ld(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Ad(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let r=-1,s=-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),s=n.indexOf(e.doc.key)),{type:xd(e.type),doc:i,oldIndex:r,newIndex:s}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function xd(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return xs()}}
2057
2057
  /**
2058
2058
  * @license
2059
2059
  * Copyright 2020 Google LLC
@@ -2069,7 +2069,7 @@ class Ad{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2069
2069
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2070
2070
  * See the License for the specific language governing permissions and
2071
2071
  * limitations under the License.
2072
- */function Dd(t){t=Ah(t,Dh);const e=Ah(t.firestore,qh);return function(t,e,n={}){const r=new Us;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Fh({next:s=>{e.enqueueAndForget((()=>Ku(t,o)));const a=s.docs.has(n);!a&&s.fromCache?i.reject(new Ms(xs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&r&&"server"===r.source?i.reject(new Ms(xs.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.)')):i.resolve(s)},error:t=>i.reject(t)}),o=new Ju(Ia(n.path),s,{includeMetadataChanges:!0,Nu:!0});return Wu(t,o)}(await Hh(t),t.asyncQueue,e,n,r))),r.promise}(Wh(e),t._key).then((n=>Fd(e,t,n)))}class Pd extends Cd{constructor(t){super(),this.firestore=t}convertBytes(t){return new Gh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Dh(this.firestore,null,e)}}function xd(t){t=Ah(t,Ph);const e=Ah(t.firestore,qh),n=Wh(e),r=new Pd(e);return yd(t._query),function(t,e,n={}){const r=new Us;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Fh({next:n=>{e.enqueueAndForget((()=>Ku(t,o))),n.fromCache&&"server"===r.source?i.reject(new Ms(xs.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.)')):i.resolve(n)},error:t=>i.reject(t)}),o=new Ju(n,s,{includeMetadataChanges:!0,Nu:!0});return Wu(t,o)}(await Hh(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Ld(e,r,t,n)))}function Md(t,e,n){t=Ah(t,Dh);const r=Ah(t.firestore,qh),i=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new Us;return t.asyncQueue.enqueueAndForget((async()=>oh(await function(t){return Vh(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(Wh(t),e)}(r,[id(rd(r),"setDoc",t._key,i,null!==t.converter,n).toMutation(t._key,nc.none())])}function Ud(t,...e){var n,r,i;t=ue(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||$h(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if($h(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(i=t.complete)||void 0===i?void 0:i.bind(t)}let c,l,u;if(t instanceof Dh)l=Ah(t.firestore,qh),u=Ia(t._key.path),c={next:n=>{e[o]&&e[o](Fd(l,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Ah(t,Ph);l=Ah(n.firestore,qh),u=n._query;const r=new Pd(l);c={next:t=>{e[o]&&e[o](new Ld(l,r,n,t))},error:e[o+1],complete:e[o+2]},yd(t._query)}return function(t,e,n,r){const i=new Fh(r),s=new Ju(e,i,n);return t.asyncQueue.enqueueAndForget((async()=>Wu(await Hh(t),s))),()=>{i.bc(),t.asyncQueue.enqueueAndForget((async()=>Ku(await Hh(t),s)))}}(Wh(l),u,a,c)}function Fd(t,e,n){const r=n.docs.get(e._key),i=new Pd(t);return new Rd(t,i,e._key,r,new Ad(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Is=Ft,Dt(new he("firestore",((t,{instanceIdentifier:n,options:r})=>{const i=t.getProvider("app").getImmediate(),s=new qh(new Vs(t.getProvider("auth-internal")),new qs(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Ms(xs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new po(t.options.projectId,e)}(i,n),i);return r=Object.assign({useFetchStreams:e},r),s._setSettings(r),s}),"PUBLIC").setMultipleInstances(!0)),Vt(Es,"3.8.0",t),Vt(Es,"3.8.0","esm2017")}();
2072
+ */function Od(t){t=Ah(t,Oh);const e=Ah(t.firestore,$h);return function(t,e,n={}){const i=new Fs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,i,r){const s=new Uh({next:s=>{e.enqueueAndForget((()=>Wu(t,o)));const a=s.docs.has(n);!a&&s.fromCache?r.reject(new Ms(Ps.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&i&&"server"===i.source?r.reject(new Ms(Ps.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(s)},error:t=>r.reject(t)}),o=new Ju(Ia(n.path),s,{includeMetadataChanges:!0,Nu:!0});return Ku(t,o)}(await Hh(t),t.asyncQueue,e,n,i))),i.promise}(Kh(e),t._key).then((n=>Ud(e,t,n)))}class Dd extends Cd{constructor(t){super(),this.firestore=t}convertBytes(t){return new Gh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Oh(this.firestore,null,e)}}function Pd(t){t=Ah(t,Dh);const e=Ah(t.firestore,$h),n=Kh(e),i=new Dd(e);return yd(t._query),function(t,e,n={}){const i=new Fs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,i,r){const s=new Uh({next:n=>{e.enqueueAndForget((()=>Wu(t,o))),n.fromCache&&"server"===i.source?r.reject(new Ms(Ps.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 Ju(n,s,{includeMetadataChanges:!0,Nu:!0});return Ku(t,o)}(await Hh(t),t.asyncQueue,e,n,i))),i.promise}(n,t._query).then((n=>new Nd(e,i,t,n)))}function Md(t,e,n){t=Ah(t,Oh);const i=Ah(t.firestore,$h),r=function(t,e,n){let i;return i=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,i}(t.converter,e,n);return function(t,e){return function(t,e){const n=new Fs;return t.asyncQueue.enqueueAndForget((async()=>oh(await function(t){return Vh(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(Kh(t),e)}(i,[rd(id(i),"setDoc",t._key,r,null!==t.converter,n).toMutation(t._key,nc.none())])}function Fd(t,...e){var n,i,r;t=ue(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||qh(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if(qh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(i=t.error)||void 0===i?void 0:i.bind(t),e[o+2]=null===(r=t.complete)||void 0===r?void 0:r.bind(t)}let c,l,u;if(t instanceof Oh)l=Ah(t.firestore,$h),u=Ia(t._key.path),c={next:n=>{e[o]&&e[o](Ud(l,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Ah(t,Dh);l=Ah(n.firestore,$h),u=n._query;const i=new Dd(l);c={next:t=>{e[o]&&e[o](new Nd(l,i,n,t))},error:e[o+1],complete:e[o+2]},yd(t._query)}return function(t,e,n,i){const r=new Uh(i),s=new Ju(e,r,n);return t.asyncQueue.enqueueAndForget((async()=>Ku(await Hh(t),s))),()=>{r.bc(),t.asyncQueue.enqueueAndForget((async()=>Wu(await Hh(t),s)))}}(Kh(l),u,a,c)}function Ud(t,e,n){const i=n.docs.get(e._key),r=new Dd(t);return new Rd(t,r,e._key,i,new Ad(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Is=Ut,Ot(new he("firestore",((t,{instanceIdentifier:n,options:i})=>{const r=t.getProvider("app").getImmediate(),s=new $h(new Vs(t.getProvider("auth-internal")),new $s(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Ms(Ps.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new po(t.options.projectId,e)}(r,n),r);return i=Object.assign({useFetchStreams:e},i),s._setSettings(i),s}),"PUBLIC").setMultipleInstances(!0)),Vt(_s,"3.8.0",t),Vt(_s,"3.8.0","esm2017")}();
2073
2073
  /**
2074
2074
  * @license
2075
2075
  * Copyright 2020 Google LLC
@@ -2086,7 +2086,7 @@ class Ad{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2086
2086
  * See the License for the specific language governing permissions and
2087
2087
  * limitations under the License.
2088
2088
  */
2089
- Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){return zd.instance||(zd.instance=new zd),zd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Vd.firebase:Bd.firebase}get api(){return"prod"===this.env?Vd.api:Bd.api}get config(){return"prod"===this.env?Vd.config:Bd.config}}const Bd={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")}},Vd={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var Hd=1e3,jd=6e4,$d=36e5,qd="millisecond",Wd="second",Kd="minute",Gd="hour",Qd="day",Yd="week",Jd="month",Xd="quarter",Zd="year",tf="date",ef="Invalid Date",nf=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rf=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,sf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},of=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},af={s:of,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+of(r,2,"0")+":"+of(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,Jd),s=n-i<0,o=e.clone().add(r+(s?-1:1),Jd);return+(-(r+(n-i)/(s?i-o:o-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Jd,y:Zd,w:Yd,d:Qd,D:tf,h:Gd,m:Kd,s:Wd,ms:qd,Q:Xd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},cf="en",lf={};lf[cf]=sf;var uf="$isDayjsObject",hf=function(t){return t instanceof gf||!(!t||!t[uf])},df=function t(e,n,r){var i;if(!e)return cf;if("string"==typeof e){var s=e.toLowerCase();lf[s]&&(i=s),n&&(lf[s]=n,i=s);var o=e.split("-");if(!i&&o.length>1)return t(o[0])}else{var a=e.name;lf[a]=e,i=a}return!r&&i&&(cf=i),i||!r&&cf},ff=function(t,e){if(hf(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new gf(n)},pf=af;pf.l=df,pf.i=hf,pf.w=function(t,e){return ff(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var gf=function(){function t(t){this.$L=df(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[uf]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(pf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(nf);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return pf},e.isValid=function(){return!(this.$d.toString()===ef)},e.isSame=function(t,e){var n=ff(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return ff(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<ff(t)},e.$g=function(t,e,n){return pf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!pf.u(e)||e,i=pf.p(t),s=function(t,e){var i=pf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(Qd)},o=function(t,e){return pf.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,l=this.$D,u="set"+(this.$u?"UTC":"");switch(i){case Zd:return r?s(1,0):s(31,11);case Jd:return r?s(1,c):s(0,c+1);case Yd:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(r?l-d:l+(6-d),c);case Qd:case tf:return o(u+"Hours",0);case Gd:return o(u+"Minutes",1);case Kd:return o(u+"Seconds",2);case Wd:return o(u+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=pf.p(t),i="set"+(this.$u?"UTC":""),s=(n={},n[Qd]=i+"Date",n[tf]=i+"Date",n[Jd]=i+"Month",n[Zd]=i+"FullYear",n[Gd]=i+"Hours",n[Kd]=i+"Minutes",n[Wd]=i+"Seconds",n[qd]=i+"Milliseconds",n)[r],o=r===Qd?this.$D+(e-this.$W):e;if(r===Jd||r===Zd){var a=this.clone().set(tf,1);a.$d[s](o),a.init(),this.$d=a.set(tf,Math.min(this.$D,a.daysInMonth())).$d}else s&&this.$d[s](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[pf.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var i=pf.p(e),s=function(e){var n=ff(r);return pf.w(n.date(n.date()+Math.round(e*t)),r)};if(i===Jd)return this.set(Jd,this.$M+t);if(i===Zd)return this.set(Zd,this.$y+t);if(i===Qd)return s(1);if(i===Yd)return s(7);var o=(n={},n[Kd]=jd,n[Gd]=$d,n[Wd]=Hd,n)[i]||1,a=this.$d.getTime()+t*o;return pf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||ef;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=pf.z(this),s=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return pf.s(s%12||12,t,"0")},f=u||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(rf,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return pf.s(e.$y,4,"0");case"M":return a+1;case"MM":return pf.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return e.$D;case"DD":return pf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,c,2);case"ddd":return h(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(s);case"HH":return pf.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(s,o,!0);case"A":return f(s,o,!1);case"m":return String(o);case"mm":return pf.s(o,2,"0");case"s":return String(e.$s);case"ss":return pf.s(e.$s,2,"0");case"SSS":return pf.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,i=this,s=pf.p(e),o=ff(t),a=(o.utcOffset()-this.utcOffset())*jd,c=this-o,l=function(){return pf.m(i,o)};switch(s){case Zd:r=l()/12;break;case Jd:r=l();break;case Xd:r=l()/3;break;case Yd:r=(c-a)/6048e5;break;case Qd:r=(c-a)/864e5;break;case Gd:r=c/$d;break;case Kd:r=c/jd;break;case Wd:r=c/Hd;break;default:r=c}return n?r:pf.a(r)},e.daysInMonth=function(){return this.endOf(Jd).$D},e.$locale=function(){return lf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=df(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return pf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),mf=gf.prototype;function yf(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function vf(){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."}}ff.prototype=mf,[["$ms",qd],["$s",Wd],["$m",Kd],["$H",Gd],["$W",Qd],["$M",Jd],["$y",Zd],["$D",tf]].forEach((function(t){mf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),ff.extend=function(t,e){return t.$i||(t(e,gf,ff),t.$i=!0),ff},ff.locale=df,ff.isDayjs=hf,ff.unix=function(t){return ff(1e3*t)},ff.en=lf[cf],ff.Ls=lf,ff.p={},"function"==typeof SuppressedError&&SuppressedError;const wf=vf,bf=new g("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."}),Sf="auth/user-disabled",_f=new P("@firebase/auth");function Ef(t,...e){_f.logLevel<=R.ERROR&&_f.error(`Auth (${Ft}): ${t}`,...e)}
2089
+ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){return zd.instance||(zd.instance=new zd),zd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Vd.firebase:Bd.firebase}get api(){return"prod"===this.env?Vd.api:Bd.api}get config(){return"prod"===this.env?Vd.config:Bd.config}}const Bd={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")}},Vd={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var Hd=1e3,jd=6e4,qd=36e5,$d="millisecond",Kd="second",Wd="minute",Gd="hour",Qd="day",Yd="week",Jd="month",Xd="quarter",Zd="year",tf="date",ef="Invalid Date",nf=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rf=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,sf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},of=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},af={s:of,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+of(i,2,"0")+":"+of(r,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var i=12*(n.year()-e.year())+(n.month()-e.month()),r=e.clone().add(i,Jd),s=n-r<0,o=e.clone().add(i+(s?-1:1),Jd);return+(-(i+(n-r)/(s?r-o:o-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Jd,y:Zd,w:Yd,d:Qd,D:tf,h:Gd,m:Wd,s:Kd,ms:$d,Q:Xd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},cf="en",lf={};lf[cf]=sf;var uf="$isDayjsObject",hf=function(t){return t instanceof gf||!(!t||!t[uf])},df=function t(e,n,i){var r;if(!e)return cf;if("string"==typeof e){var s=e.toLowerCase();lf[s]&&(r=s),n&&(lf[s]=n,r=s);var o=e.split("-");if(!r&&o.length>1)return t(o[0])}else{var a=e.name;lf[a]=e,r=a}return!i&&r&&(cf=r),r||!i&&cf},ff=function(t,e){if(hf(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new gf(n)},pf=af;pf.l=df,pf.i=hf,pf.w=function(t,e){return ff(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var gf=function(){function t(t){this.$L=df(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[uf]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(pf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(nf);if(i){var r=i[2]-1||0,s=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return pf},e.isValid=function(){return!(this.$d.toString()===ef)},e.isSame=function(t,e){var n=ff(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return ff(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<ff(t)},e.$g=function(t,e,n){return pf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,i=!!pf.u(e)||e,r=pf.p(t),s=function(t,e){var r=pf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return i?r:r.endOf(Qd)},o=function(t,e){return pf.w(n.toDate()[t].apply(n.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,l=this.$D,u="set"+(this.$u?"UTC":"");switch(r){case Zd:return i?s(1,0):s(31,11);case Jd:return i?s(1,c):s(0,c+1);case Yd:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(i?l-d:l+(6-d),c);case Qd:case tf:return o(u+"Hours",0);case Gd:return o(u+"Minutes",1);case Wd:return o(u+"Seconds",2);case Kd:return o(u+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,i=pf.p(t),r="set"+(this.$u?"UTC":""),s=(n={},n[Qd]=r+"Date",n[tf]=r+"Date",n[Jd]=r+"Month",n[Zd]=r+"FullYear",n[Gd]=r+"Hours",n[Wd]=r+"Minutes",n[Kd]=r+"Seconds",n[$d]=r+"Milliseconds",n)[i],o=i===Qd?this.$D+(e-this.$W):e;if(i===Jd||i===Zd){var a=this.clone().set(tf,1);a.$d[s](o),a.init(),this.$d=a.set(tf,Math.min(this.$D,a.daysInMonth())).$d}else s&&this.$d[s](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[pf.p(t)]()},e.add=function(t,e){var n,i=this;t=Number(t);var r=pf.p(e),s=function(e){var n=ff(i);return pf.w(n.date(n.date()+Math.round(e*t)),i)};if(r===Jd)return this.set(Jd,this.$M+t);if(r===Zd)return this.set(Zd,this.$y+t);if(r===Qd)return s(1);if(r===Yd)return s(7);var o=(n={},n[Wd]=jd,n[Gd]=qd,n[Kd]=Hd,n)[r]||1,a=this.$d.getTime()+t*o;return pf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||ef;var i=t||"YYYY-MM-DDTHH:mm:ssZ",r=pf.z(this),s=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,h=function(t,n,r,s){return t&&(t[n]||t(e,i))||r[n].slice(0,s)},d=function(t){return pf.s(s%12||12,t,"0")},f=u||function(t,e,n){var i=t<12?"AM":"PM";return n?i.toLowerCase():i};return i.replace(rf,(function(t,i){return i||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return pf.s(e.$y,4,"0");case"M":return a+1;case"MM":return pf.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return e.$D;case"DD":return pf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,c,2);case"ddd":return h(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(s);case"HH":return pf.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(s,o,!0);case"A":return f(s,o,!1);case"m":return String(o);case"mm":return pf.s(o,2,"0");case"s":return String(e.$s);case"ss":return pf.s(e.$s,2,"0");case"SSS":return pf.s(e.$ms,3,"0");case"Z":return r}return null}(t)||r.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var i,r=this,s=pf.p(e),o=ff(t),a=(o.utcOffset()-this.utcOffset())*jd,c=this-o,l=function(){return pf.m(r,o)};switch(s){case Zd:i=l()/12;break;case Jd:i=l();break;case Xd:i=l()/3;break;case Yd:i=(c-a)/6048e5;break;case Qd:i=(c-a)/864e5;break;case Gd:i=c/qd;break;case Wd:i=c/jd;break;case Kd:i=c/Hd;break;default:i=c}return n?i:pf.a(i)},e.daysInMonth=function(){return this.endOf(Jd).$D},e.$locale=function(){return lf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),i=df(t,e,!0);return i&&(n.$L=i),n},e.clone=function(){return pf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),mf=gf.prototype;function yf(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}function vf(){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."}}ff.prototype=mf,[["$ms",$d],["$s",Kd],["$m",Wd],["$H",Gd],["$W",Qd],["$M",Jd],["$y",Zd],["$D",tf]].forEach((function(t){mf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),ff.extend=function(t,e){return t.$i||(t(e,gf,ff),t.$i=!0),ff},ff.locale=df,ff.isDayjs=hf,ff.unix=function(t){return ff(1e3*t)},ff.en=lf[cf],ff.Ls=lf,ff.p={},"function"==typeof SuppressedError&&SuppressedError;const wf=vf,bf=new g("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."}),Sf="auth/user-disabled",Ef=new D("@firebase/auth");function _f(t,...e){Ef.logLevel<=R.ERROR&&Ef.error(`Auth (${Ut}): ${t}`,...e)}
2090
2090
  /**
2091
2091
  * @license
2092
2092
  * Copyright 2020 Google LLC
@@ -2102,7 +2102,7 @@ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){retu
2102
2102
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2103
2103
  * See the License for the specific language governing permissions and
2104
2104
  * limitations under the License.
2105
- */function Tf(t,...e){throw Af(t,...e)}function If(t,...e){return Af(t,...e)}function kf(t,e,n){const r=Object.assign(Object.assign({},wf()),{[e]:n});return new g("auth","Firebase",r).create(e,{appName:t.name})}function Cf(t){return kf(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Af(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return bf.create(t,...e)}function Rf(t,e,...n){if(!t)throw Af(e,...n)}function Nf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Ef(e),new Error(e)}function Lf(t,e){t||Nf(e)}
2105
+ */function Tf(t,...e){throw Af(t,...e)}function If(t,...e){return Af(t,...e)}function kf(t,e,n){const i=Object.assign(Object.assign({},wf()),{[e]:n});return new g("auth","Firebase",i).create(e,{appName:t.name})}function Cf(t){return kf(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Af(t,...e){if("string"!=typeof t){const n=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=t.name),t._errorFactory.create(n,...i)}return bf.create(t,...e)}function Rf(t,e,...n){if(!t)throw Af(e,...n)}function Lf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw _f(e),new Error(e)}function Nf(t,e){t||Lf(e)}
2106
2106
  /**
2107
2107
  * @license
2108
2108
  * Copyright 2020 Google LLC
@@ -2118,7 +2118,7 @@ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){retu
2118
2118
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2119
2119
  * See the License for the specific language governing permissions and
2120
2120
  * limitations under the License.
2121
- */function Of(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Df(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2121
+ */function xf(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Of(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2122
2122
  /**
2123
2123
  * @license
2124
2124
  * Copyright 2020 Google LLC
@@ -2134,7 +2134,7 @@ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){retu
2134
2134
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2135
2135
  * See the License for the specific language governing permissions and
2136
2136
  * limitations under the License.
2137
- */function Pf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Df()&&"https:"!==Df()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
2137
+ */function Df(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Of()&&"https:"!==Of()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
2138
2138
  /**
2139
2139
  * @license
2140
2140
  * Copyright 2020 Google LLC
@@ -2151,7 +2151,7 @@ Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){retu
2151
2151
  * See the License for the specific language governing permissions and
2152
2152
  * limitations under the License.
2153
2153
  */
2154
- class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(f())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Pf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2154
+ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Nf(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(f())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Df()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2155
2155
  /**
2156
2156
  * @license
2157
2157
  * Copyright 2020 Google LLC
@@ -2167,7 +2167,7 @@ class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay
2167
2167
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2168
2168
  * See the License for the specific language governing permissions and
2169
2169
  * limitations under the License.
2170
- */function Mf(t,e){Lf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2170
+ */function Mf(t,e){Nf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2171
2171
  /**
2172
2172
  * @license
2173
2173
  * Copyright 2020 Google LLC
@@ -2183,7 +2183,7 @@ class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay
2183
2183
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2184
2184
  * See the License for the specific language governing permissions and
2185
2185
  * limitations under the License.
2186
- */class Uf{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Nf("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Nf("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Nf("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2186
+ */class Ff{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Lf("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Lf("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Lf("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2187
2187
  /**
2188
2188
  * @license
2189
2189
  * Copyright 2020 Google LLC
@@ -2199,7 +2199,7 @@ class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay
2199
2199
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2200
2200
  * See the License for the specific language governing permissions and
2201
2201
  * limitations under the License.
2202
- */const Ff={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},zf=new xf(3e4,6e4);
2202
+ */const Uf={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},zf=new Pf(3e4,6e4);
2203
2203
  /**
2204
2204
  * @license
2205
2205
  * Copyright 2020 Google LLC
@@ -2215,7 +2215,7 @@ class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay
2215
2215
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2216
2216
  * See the License for the specific language governing permissions and
2217
2217
  * limitations under the License.
2218
- */function Bf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Vf(t,e,n,r,i={}){return Hf(t,i,(async()=>{let i={},s={};r&&("GET"===e?s=r:i={body:JSON.stringify(r)});const o=w(Object.assign({key:t.config.apiKey},s)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Uf.fetch()($f(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},i))}))}async function Hf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Ff),e);try{const e=new Wf(t),i=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw Kf(t,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const e=i.ok?s.errorMessage:s.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Kf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Kf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Kf(t,"user-disabled",s);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw kf(t,a,o);Tf(t,a)}}catch(e){if(e instanceof p)throw e;Tf(t,"network-request-failed",{message:String(e)})}}async function jf(t,e,n,r,i={}){const s=await Vf(t,e,n,r,i);return"mfaPendingCredential"in s&&Tf(t,"multi-factor-auth-required",{_serverResponse:s}),s}function $f(t,e,n,r){const i=`${e}${n}?${r}`;return t.config.emulator?Mf(t.config,i):`${t.config.apiScheme}://${i}`}function qf(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Wf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(If(this.auth,"network-request-failed"))),zf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Kf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=If(t,e,r);return i.customData._tokenResponse=n,i}function Gf(t){return void 0!==t&&void 0!==t.enterprise}class Qf{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return qf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Yf(t,e){return Vf(t,"POST","/v1/accounts:lookup",e)}
2218
+ */function Bf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Vf(t,e,n,i,r={}){return Hf(t,r,(async()=>{let r={},s={};i&&("GET"===e?s=i:r={body:JSON.stringify(i)});const o=w(Object.assign({key:t.config.apiKey},s)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Ff.fetch()(qf(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},r))}))}async function Hf(t,e,n){t._canInitEmulator=!1;const i=Object.assign(Object.assign({},Uf),e);try{const e=new Kf(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await r.json();if("needConfirmation"in s)throw Wf(t,"account-exists-with-different-credential",s);if(r.ok&&!("errorMessage"in s))return s;{const e=r.ok?s.errorMessage:s.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Wf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Wf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Wf(t,"user-disabled",s);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw kf(t,a,o);Tf(t,a)}}catch(e){if(e instanceof p)throw e;Tf(t,"network-request-failed",{message:String(e)})}}async function jf(t,e,n,i,r={}){const s=await Vf(t,e,n,i,r);return"mfaPendingCredential"in s&&Tf(t,"multi-factor-auth-required",{_serverResponse:s}),s}function qf(t,e,n,i){const r=`${e}${n}?${i}`;return t.config.emulator?Mf(t.config,r):`${t.config.apiScheme}://${r}`}function $f(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Kf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(If(this.auth,"network-request-failed"))),zf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Wf(t,e,n){const i={appName:t.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=If(t,e,i);return r.customData._tokenResponse=n,r}function Gf(t){return void 0!==t&&void 0!==t.enterprise}class Qf{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return $f(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Yf(t,e){return Vf(t,"POST","/v1/accounts:lookup",e)}
2219
2219
  /**
2220
2220
  * @license
2221
2221
  * Copyright 2020 Google LLC
@@ -2231,7 +2231,7 @@ class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay
2231
2231
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2232
2232
  * See the License for the specific language governing permissions and
2233
2233
  * limitations under the License.
2234
- */function Jf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Xf(t){return 1e3*Number(t)}function Zf(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return Ef("JWT malformed, contained fewer than 3 sections"),null;try{const t=a(n);return t?JSON.parse(t):(Ef("Failed to decode base64 JWT payload"),null)}catch(t){return Ef("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function tp(t){const e=Zf(t);return Rf(e,"internal-error"),Rf(void 0!==e.exp,"internal-error"),Rf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
2234
+ */function Jf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Xf(t){return 1e3*Number(t)}function Zf(t){const[e,n,i]=t.split(".");if(void 0===e||void 0===n||void 0===i)return _f("JWT malformed, contained fewer than 3 sections"),null;try{const t=a(n);return t?JSON.parse(t):(_f("Failed to decode base64 JWT payload"),null)}catch(t){return _f("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function tp(t){const e=Zf(t);return Rf(e,"internal-error"),Rf(void 0!==e.exp,"internal-error"),Rf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
2235
2235
  /**
2236
2236
  * @license
2237
2237
  * Copyright 2020 Google LLC
@@ -2279,7 +2279,7 @@ class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay
2279
2279
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2280
2280
  * See the License for the specific language governing permissions and
2281
2281
  * limitations under the License.
2282
- */class rp{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Jf(this.lastLoginAt),this.creationTime=Jf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2282
+ */class ip{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Jf(this.lastLoginAt),this.creationTime=Jf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2283
2283
  /**
2284
2284
  * @license
2285
2285
  * Copyright 2019 Google LLC
@@ -2295,7 +2295,7 @@ class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay
2295
2295
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2296
2296
  * See the License for the specific language governing permissions and
2297
2297
  * limitations under the License.
2298
- */async function ip(t){var e;const n=t.auth,r=await t.getIdToken(),i=await ep(t,Yf(n,{idToken:r}));Rf(null==i?void 0:i.users.length,n,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const o=(null===(e=s.providerUserInfo)||void 0===e?void 0:e.length)?sp(s.providerUserInfo):[],a=function(t,e){const n=t.filter((t=>!e.some((e=>e.providerId===t.providerId))));return[...n,...e]}(t.providerData,o),c=t.isAnonymous,l=!(t.email&&s.passwordHash||(null==a?void 0:a.length)),u=!!c&&l,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new rp(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,h)}function sp(t){return t.map((t=>{var{providerId:e}=t,n=yf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}
2298
+ */async function rp(t){var e;const n=t.auth,i=await t.getIdToken(),r=await ep(t,Yf(n,{idToken:i}));Rf(null==r?void 0:r.users.length,n,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const o=(null===(e=s.providerUserInfo)||void 0===e?void 0:e.length)?sp(s.providerUserInfo):[],a=function(t,e){const n=t.filter((t=>!e.some((e=>e.providerId===t.providerId))));return[...n,...e]}(t.providerData,o),c=t.isAnonymous,l=!(t.email&&s.passwordHash||(null==a?void 0:a.length)),u=!!c&&l,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new ip(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,h)}function sp(t){return t.map((t=>{var{providerId:e}=t,n=yf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}
2299
2299
  /**
2300
2300
  * @license
2301
2301
  * Copyright 2020 Google LLC
@@ -2328,7 +2328,7 @@ class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay
2328
2328
  * See the License for the specific language governing permissions and
2329
2329
  * limitations under the License.
2330
2330
  */
2331
- class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Rf(t.idToken,"internal-error"),Rf(void 0!==t.idToken,"internal-error"),Rf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):tp(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Rf(0!==t.length,"internal-error");const e=tp(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Rf(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:i}=await async function(t,e){const n=await Hf(t,{},(async()=>{const n=w({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:i}=t.config,s=$f(t,r,"/v1/token",`key=${i}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Uf.fetch()(s,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:i}=e,s=new op;return n&&(Rf("string"==typeof n,"internal-error",{appName:t}),s.refreshToken=n),r&&(Rf("string"==typeof r,"internal-error",{appName:t}),s.accessToken=r),i&&(Rf("number"==typeof i,"internal-error",{appName:t}),s.expirationTime=i),s}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 op,this.toJSON())}_performRefresh(){return Nf("not implemented")}}
2331
+ class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Rf(t.idToken,"internal-error"),Rf(void 0!==t.idToken,"internal-error"),Rf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):tp(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Rf(0!==t.length,"internal-error");const e=tp(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Rf(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:i,expiresIn:r}=await async function(t,e){const n=await Hf(t,{},(async()=>{const n=w({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:r}=t.config,s=qf(t,i,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Ff.fetch()(s,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,i,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:i,expirationTime:r}=e,s=new op;return n&&(Rf("string"==typeof n,"internal-error",{appName:t}),s.refreshToken=n),i&&(Rf("string"==typeof i,"internal-error",{appName:t}),s.accessToken=i),r&&(Rf("number"==typeof r,"internal-error",{appName:t}),s.expirationTime=r),s}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 op,this.toJSON())}_performRefresh(){return Lf("not implemented")}}
2332
2332
  /**
2333
2333
  * @license
2334
2334
  * Copyright 2020 Google LLC
@@ -2344,7 +2344,7 @@ class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2344
2344
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2345
2345
  * See the License for the specific language governing permissions and
2346
2346
  * limitations under the License.
2347
- */function ap(t,e){Rf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class cp{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,i=yf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new np(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new rp(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const e=await ep(this,this.stsTokenManager.getToken(this.auth,t));return Rf(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=T(t),r=await n.getIdToken(e),i=Zf(r);Rf(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s="object"==typeof i.firebase?i.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:Jf(Xf(i.auth_time)),issuedAtTime:Jf(Xf(i.iat)),expirationTime:Jf(Xf(i.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=T(t);await ip(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Rf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new cp(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Rf(!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 ip(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(xt(this.auth.app))return Promise.reject(Cf(this.auth));const t=await this.getIdToken();return await ep(this,
2347
+ */function ap(t,e){Rf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class cp{constructor(t){var{uid:e,auth:n,stsTokenManager:i}=t,r=yf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new np(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=i,this.accessToken=i.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 ip(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await ep(this,this.stsTokenManager.getToken(this.auth,t));return Rf(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=T(t),i=await n.getIdToken(e),r=Zf(i);Rf(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const s="object"==typeof r.firebase?r.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:r,token:i,authTime:Jf(Xf(r.auth_time)),issuedAtTime:Jf(Xf(r.iat)),expirationTime:Jf(Xf(r.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=T(t);await rp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Rf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new cp(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Rf(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await rp(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pt(this.auth.app))return Promise.reject(Cf(this.auth));const t=await this.getIdToken();return await ep(this,
2348
2348
  /**
2349
2349
  * @license
2350
2350
  * Copyright 2020 Google LLC
@@ -2361,7 +2361,7 @@ class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2361
2361
  * See the License for the specific language governing permissions and
2362
2362
  * limitations under the License.
2363
2363
  */
2364
- async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,i,s,o,a,c,l;const u=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(i=e.phoneNumber)&&void 0!==i?i:void 0,f=null!==(s=e.photoURL)&&void 0!==s?s: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!==(l=e.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:w,isAnonymous:b,providerData:S,stsTokenManager:_}=e;Rf(v&&_,t,"internal-error");const E=op.fromJSON(this.name,_);Rf("string"==typeof v,t,"internal-error"),ap(u,t.name),ap(h,t.name),Rf("boolean"==typeof w,t,"internal-error"),Rf("boolean"==typeof b,t,"internal-error"),ap(d,t.name),ap(f,t.name),ap(p,t.name),ap(g,t.name),ap(m,t.name),ap(y,t.name);const T=new cp({uid:v,auth:t,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return S&&Array.isArray(S)&&(T.providerData=S.map((t=>Object.assign({},t)))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(t,e,n=!1){const r=new op;r.updateFromServerResponse(e);const i=new cp({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await ip(i),i}static async _fromGetAccountInfoResponse(t,e,n){const r=e.users[0];Rf(void 0!==r.localId,"internal-error");const i=void 0!==r.providerUserInfo?sp(r.providerUserInfo):[],s=!(r.email&&r.passwordHash||(null==i?void 0:i.length)),o=new op;o.updateFromIdToken(n);const a=new cp({uid:r.localId,auth:t,stsTokenManager:o,isAnonymous:s}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:i,metadata:new rp(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||(null==i?void 0:i.length))};return Object.assign(a,c),a}}
2364
+ async function(t,e){return Vf(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,i,r,s,o,a,c,l;const u=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(i=e.email)&&void 0!==i?i:void 0,d=null!==(r=e.phoneNumber)&&void 0!==r?r:void 0,f=null!==(s=e.photoURL)&&void 0!==s?s: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!==(l=e.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:w,isAnonymous:b,providerData:S,stsTokenManager:E}=e;Rf(v&&E,t,"internal-error");const _=op.fromJSON(this.name,E);Rf("string"==typeof v,t,"internal-error"),ap(u,t.name),ap(h,t.name),Rf("boolean"==typeof w,t,"internal-error"),Rf("boolean"==typeof b,t,"internal-error"),ap(d,t.name),ap(f,t.name),ap(p,t.name),ap(g,t.name),ap(m,t.name),ap(y,t.name);const T=new cp({uid:v,auth:t,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:_,createdAt:m,lastLoginAt:y});return S&&Array.isArray(S)&&(T.providerData=S.map((t=>Object.assign({},t)))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(t,e,n=!1){const i=new op;i.updateFromServerResponse(e);const r=new cp({uid:e.localId,auth:t,stsTokenManager:i,isAnonymous:n});return await rp(r),r}static async _fromGetAccountInfoResponse(t,e,n){const i=e.users[0];Rf(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?sp(i.providerUserInfo):[],s=!(i.email&&i.passwordHash||(null==r?void 0:r.length)),o=new op;o.updateFromIdToken(n);const a=new cp({uid:i.localId,auth:t,stsTokenManager:o,isAnonymous:s}),c={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:r,metadata:new ip(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||(null==r?void 0:r.length))};return Object.assign(a,c),a}}
2365
2365
  /**
2366
2366
  * @license
2367
2367
  * Copyright 2020 Google LLC
@@ -2377,7 +2377,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2377
2377
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2378
2378
  * See the License for the specific language governing permissions and
2379
2379
  * limitations under the License.
2380
- */const lp=new Map;function up(t){Lf(t instanceof Function,"Expected a class definition");let e=lp.get(t);return e?(Lf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,lp.set(t,e),e)}
2380
+ */const lp=new Map;function up(t){Nf(t instanceof Function,"Expected a class definition");let e=lp.get(t);return e?(Nf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,lp.set(t,e),e)}
2381
2381
  /**
2382
2382
  * @license
2383
2383
  * Copyright 2019 Google LLC
@@ -2409,7 +2409,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2409
2409
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2410
2410
  * See the License for the specific language governing permissions and
2411
2411
  * limitations under the License.
2412
- */function fp(t,e,n){return`firebase:${t}:${e}:${n}`}class pp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=fp(this.userKey,r.apiKey,i),this.fullPersistenceKey=fp("persistence",r.apiKey,i),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?cp._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 pp(up(dp),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let i=r[0]||up(dp);const s=fp(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(s);if(e){const r=cp._fromJSON(t,e);n!==i&&(o=r),i=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],o&&await i._set(s,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==i)try{await t._remove(s)}catch(t){}}))),new pp(i,t,n)):new pp(i,t,n)}}
2412
+ */function fp(t,e,n){return`firebase:${t}:${e}:${n}`}class pp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=fp(this.userKey,i.apiKey,r),this.fullPersistenceKey=fp("persistence",i.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?cp._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 pp(up(dp),t,n);const i=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let r=i[0]||up(dp);const s=fp(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(s);if(e){const i=cp._fromJSON(t,e);n!==r&&(o=i),r=n;break}}catch(t){}const a=i.filter((t=>t._shouldAllowMigration));return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(s,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==r)try{await t._remove(s)}catch(t){}}))),new pp(r,t,n)):new pp(r,t,n)}}
2413
2413
  /**
2414
2414
  * @license
2415
2415
  * Copyright 2020 Google LLC
@@ -2425,7 +2425,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2425
2425
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2426
2426
  * See the License for the specific language governing permissions and
2427
2427
  * limitations under the License.
2428
- */function gp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(wp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(mp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Sp(e))return"Blackberry";if(_p(e))return"Webos";if(yp(e))return"Safari";if((e.includes("chrome/")||vp(e))&&!e.includes("edge/"))return"Chrome";if(bp(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 mp(t=f()){return/firefox\//i.test(t)}function yp(t=f()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function vp(t=f()){return/crios\//i.test(t)}function wp(t=f()){return/iemobile/i.test(t)}function bp(t=f()){return/android/i.test(t)}function Sp(t=f()){return/blackberry/i.test(t)}function _p(t=f()){return/webos/i.test(t)}function Ep(t=f()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Tp(){return function(){const t=f();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function Ip(t=f()){return Ep(t)||bp(t)||_p(t)||Sp(t)||/windows phone/i.test(t)||wp(t)}
2428
+ */function gp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(wp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(mp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Sp(e))return"Blackberry";if(Ep(e))return"Webos";if(yp(e))return"Safari";if((e.includes("chrome/")||vp(e))&&!e.includes("edge/"))return"Chrome";if(bp(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 mp(t=f()){return/firefox\//i.test(t)}function yp(t=f()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function vp(t=f()){return/crios\//i.test(t)}function wp(t=f()){return/iemobile/i.test(t)}function bp(t=f()){return/android/i.test(t)}function Sp(t=f()){return/blackberry/i.test(t)}function Ep(t=f()){return/webos/i.test(t)}function _p(t=f()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Tp(){return function(){const t=f();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function Ip(t=f()){return _p(t)||bp(t)||Ep(t)||Sp(t)||/windows phone/i.test(t)||wp(t)}
2429
2429
  /**
2430
2430
  * @license
2431
2431
  * Copyright 2020 Google LLC
@@ -2441,7 +2441,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2441
2441
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2442
2442
  * See the License for the specific language governing permissions and
2443
2443
  * limitations under the License.
2444
- */function kp(t,e=[]){let n;switch(t){case"Browser":n=gp(f());break;case"Worker":n=`${gp(f())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ft}/${r}`}
2444
+ */function kp(t,e=[]){let n;switch(t){case"Browser":n=gp(f());break;case"Worker":n=`${gp(f())}-${t}`;break;default:n=t}const i=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ut}/${i}`}
2445
2445
  /**
2446
2446
  * @license
2447
2447
  * Copyright 2022 Google LLC
@@ -2457,7 +2457,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2457
2457
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2458
2458
  * See the License for the specific language governing permissions and
2459
2459
  * limitations under the License.
2460
- */class Cp{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
2460
+ */class Cp{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,i)=>{try{n(t(e))}catch(t){i(t)}}));n.onAbort=e,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>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})}}}
2461
2461
  /**
2462
2462
  * @license
2463
2463
  * Copyright 2023 Google LLC
@@ -2473,7 +2473,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2473
2473
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2474
2474
  * See the License for the specific language governing permissions and
2475
2475
  * limitations under the License.
2476
- */class Ap{constructor(t){var e,n,r,i;const s=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=s.minPasswordLength)&&void 0!==e?e:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(i=t.forceUpgradeOnSignin)&&void 0!==i&&i,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,r,i,s,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(i=a.containsUppercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),r&&(e.meetsMaxPasswordLength=t.length<=r)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let r=0;r<t.length;r++)n=t.charAt(r),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=i))}}
2476
+ */class Ap{constructor(t){var e,n,i,r;const s=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=s.minPasswordLength)&&void 0!==e?e:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(r=t.forceUpgradeOnSignin)&&void 0!==r&&r,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,i,r,s,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(i=a.containsLowercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(r=a.containsUppercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),i&&(e.meetsMaxPasswordLength=t.length<=i)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let i=0;i<t.length;i++)n=t.charAt(i),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,i,r){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=r))}}
2477
2477
  /**
2478
2478
  * @license
2479
2479
  * Copyright 2020 Google LLC
@@ -2489,7 +2489,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2489
2489
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2490
2490
  * See the License for the specific language governing permissions and
2491
2491
  * limitations under the License.
2492
- */class Rp{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Lp(this),this.idTokenSubscription=new Lp(this),this.beforeStateQueue=new Cp(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=bf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=up(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await pp.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await Yf(this,{idToken:t}),n=await cp._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var e;if(xt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise((e=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(t).then(e,e)))})):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Rf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await ip(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(xt(this.app))return Promise.reject(Cf(this));const e=t?T(t):null;return e&&Rf(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&&Rf(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 xt(this.app)?Promise.reject(Cf(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return xt(this.app)?Promise.reject(Cf(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(up(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Vf(t,"GET","/v2/passwordPolicy",Bf(t,e))}
2492
+ */class Rp{constructor(t,e,n,i){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Np(this),this.idTokenSubscription=new Np(this),this.beforeStateQueue=new Cp(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=bf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=up(e)),this._initializationPromise=this.queue((async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await pp.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===(i=this.currentUser)||void 0===i?void 0:i.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await Yf(this,{idToken:t}),n=await cp._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var e;if(Pt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise((e=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(t).then(e,e)))})):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let i=n,r=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==i?void 0:i._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(i=o.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(t){i=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return Rf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await rp(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Pt(this.app))return Promise.reject(Cf(this));const e=t?T(t):null;return e&&Rf(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&&Rf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return Pt(this.app)?Promise.reject(Cf(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Pt(this.app)?Promise.reject(Cf(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(up(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Vf(t,"GET","/v2/passwordPolicy",Bf(t,e))}
2493
2493
  /**
2494
2494
  * @license
2495
2495
  * Copyright 2023 Google LLC
@@ -2505,7 +2505,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2505
2505
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2506
2506
  * See the License for the specific language governing permissions and
2507
2507
  * limitations under the License.
2508
- */(this),e=new Ap(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new g("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Vf(t,"POST","/v2/accounts:revokeToken",Bf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&up(t)||this._popupRedirectResolver;Rf(e,this,"argument-error"),this.redirectPersistenceManager=await pp.create(this,[up(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const i="function"==typeof e?e:e.next.bind(e);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Rf(o,this,"internal-error"),o.then((()=>{s||i(this.currentUser)})),"function"==typeof e){const i=t.addObserver(e,n,r);return()=>{s=!0,i()}}{const n=t.addObserver(e);return()=>{s=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Rf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=kp(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){_f.logLevel<=R.WARN&&_f.warn(`Auth (${Ft}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Np(t){return T(t)}class Lp{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 Rf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2508
+ */(this),e=new Ap(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new g("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Vf(t,"POST","/v2/accounts:revokeToken",Bf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&up(t)||this._popupRedirectResolver;Rf(e,this,"argument-error"),this.redirectPersistenceManager=await pp.create(this,[up(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,i){if(this._deleted)return()=>{};const r="function"==typeof e?e:e.next.bind(e);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Rf(o,this,"internal-error"),o.then((()=>{s||r(this.currentUser)})),"function"==typeof e){const r=t.addObserver(e,n,i);return()=>{s=!0,r()}}{const n=t.addObserver(e);return()=>{s=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Rf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=kp(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const i=await this._getAppCheckToken();return i&&(e["X-Firebase-AppCheck"]=i),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){Ef.logLevel<=R.WARN&&Ef.warn(`Auth (${Ut}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Lp(t){return T(t)}class Np{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new E(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Rf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2509
2509
  /**
2510
2510
  * @license
2511
2511
  * Copyright 2020 Google LLC
@@ -2521,7 +2521,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2521
2521
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2522
2522
  * See the License for the specific language governing permissions and
2523
2523
  * limitations under the License.
2524
- */let Op={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Dp(t){return Op.loadJS(t)}class Pp{constructor(t){this.type="recaptcha-enterprise",this.auth=Np(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{(async function(t,e){return Vf(t,"GET","/v2/recaptchaConfig",Bf(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new Qf(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))}function r(e,n,r){const i=window.grecaptcha;Gf(i)?i.enterprise.ready((()=>{i.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,i)=>{n(this.auth).then((n=>{if(!e&&Gf(window.grecaptcha))r(n,t,i);else{if("undefined"==typeof window)return void i(new Error("RecaptchaVerifier is only supported in browser"));let e=Op.recaptchaEnterpriseScript;0!==e.length&&(e+=n),Dp(e).then((()=>{r(n,t,i)})).catch((t=>{i(t)}))}})).catch((t=>{i(t)}))}))}}async function xp(t,e,n,r=!1){const i=new Pp(t);let s;try{s=await i.verify(n)}catch(t){s=await i.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Mp(t,e,n,r){var i;if(null===(i=t._getRecaptchaConfig())||void 0===i?void 0:i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await xp(t,e,n,"getOobCode"===n);return r(t,i)}return r(t,e).catch((async i=>{if("auth/missing-recaptcha-token"===i.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const i=await xp(t,e,n,"getOobCode"===n);return r(t,i)}return Promise.reject(i)}))}
2524
+ */let xp={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Op(t){return xp.loadJS(t)}class Dp{constructor(t){this.type="recaptcha-enterprise",this.auth=Lp(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{(async function(t,e){return Vf(t,"GET","/v2/recaptchaConfig",Bf(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((i=>{if(void 0!==i.recaptchaKey){const n=new Qf(i);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))}function i(e,n,i){const r=window.grecaptcha;Gf(r)?r.enterprise.ready((()=>{r.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):i(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,r)=>{n(this.auth).then((n=>{if(!e&&Gf(window.grecaptcha))i(n,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let e=xp.recaptchaEnterpriseScript;0!==e.length&&(e+=n),Op(e).then((()=>{i(n,t,r)})).catch((t=>{r(t)}))}})).catch((t=>{r(t)}))}))}}async function Pp(t,e,n,i=!1){const r=new Dp(t);let s;try{s=await r.verify(n)}catch(t){s=await r.verify(n,!0)}const o=Object.assign({},e);return i?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Mp(t,e,n,i){var r;if(null===(r=t._getRecaptchaConfig())||void 0===r?void 0:r.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await Pp(t,e,n,"getOobCode"===n);return i(t,r)}return i(t,e).catch((async r=>{if("auth/missing-recaptcha-token"===r.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const r=await Pp(t,e,n,"getOobCode"===n);return i(t,r)}return Promise.reject(r)}))}
2525
2525
  /**
2526
2526
  * @license
2527
2527
  * Copyright 2020 Google LLC
@@ -2537,7 +2537,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2537
2537
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2538
2538
  * See the License for the specific language governing permissions and
2539
2539
  * limitations under the License.
2540
- */function Up(t,e,n){const r=Np(t);Rf(r._canInitEmulator,r,"emulator-config-failed"),Rf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!(null==n?void 0:n.disableWarnings),s=Fp(e),{host:o,port:a}=function(t){const e=Fp(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const t=i[1];return{host:t,port:zp(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:zp(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${s}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||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())}
2540
+ */function Fp(t,e,n){const i=Lp(t);Rf(i._canInitEmulator,i,"emulator-config-failed"),Rf(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");const r=!!(null==n?void 0:n.disableWarnings),s=Up(e),{host:o,port:a}=function(t){const e=Up(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const t=r[1];return{host:t,port:zp(i.substr(t.length+1))}}{const[t,e]=i.split(":");return{host:t,port:zp(e)}}}(e),c=null===a?"":`:${a}`;i.config.emulator={url:`${s}//${o}${c}/`},i.settings.appVerificationDisabledForTesting=!0,i.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.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())}
2541
2541
  /**
2542
2542
  * @license
2543
2543
  * Copyright 2020 Google LLC
@@ -2553,7 +2553,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2553
2553
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2554
2554
  * See the License for the specific language governing permissions and
2555
2555
  * limitations under the License.
2556
- */()}function Fp(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function zp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Bp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Nf("not implemented")}_getIdTokenResponse(t){return Nf("not implemented")}_linkToIdToken(t,e){return Nf("not implemented")}_getReauthenticationResolver(t){return Nf("not implemented")}}
2556
+ */()}function Up(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function zp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Bp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Lf("not implemented")}_getIdTokenResponse(t){return Lf("not implemented")}_linkToIdToken(t,e){return Lf("not implemented")}_getReauthenticationResolver(t){return Lf("not implemented")}}
2557
2557
  /**
2558
2558
  * @license
2559
2559
  * Copyright 2020 Google LLC
@@ -2618,7 +2618,7 @@ async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2618
2618
  * See the License for the specific language governing permissions and
2619
2619
  * limitations under the License.
2620
2620
  */
2621
- class $p extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new $p(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new $p(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return Mp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Hp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{email:this._email,oobCode:this._password});default:Tf(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Mp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Vp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:Tf(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2621
+ class qp extends Bp{constructor(t,e,n,i=null){super("password",n),this._email=t,this._password=e,this._tenantId=i}static _fromEmailAndPassword(t,e){return new qp(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new qp(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return Mp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Hp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{email:this._email,oobCode:this._password});default:Tf(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Mp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Vp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:Tf(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2622
2622
  /**
2623
2623
  * @license
2624
2624
  * Copyright 2020 Google LLC
@@ -2634,7 +2634,7 @@ class $p extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2634
2634
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2635
2635
  * See the License for the specific language governing permissions and
2636
2636
  * limitations under the License.
2637
- */async function qp(t,e){return jf(t,"POST","/v1/accounts:signInWithIdp",Bf(t,e))}
2637
+ */async function $p(t,e){return jf(t,"POST","/v1/accounts:signInWithIdp",Bf(t,e))}
2638
2638
  /**
2639
2639
  * @license
2640
2640
  * Copyright 2020 Google LLC
@@ -2650,7 +2650,7 @@ class $p extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2650
2650
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2651
2651
  * See the License for the specific language governing permissions and
2652
2652
  * limitations under the License.
2653
- */class Wp extends Bp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Wp(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):Tf("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,i=yf(e,["providerId","signInMethod"]);if(!n||!r)return null;const s=new Wp(n,r);return s.idToken=i.idToken||void 0,s.accessToken=i.accessToken||void 0,s.secret=i.secret,s.nonce=i.nonce,s.pendingToken=i.pendingToken||null,s}_getIdTokenResponse(t){return qp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,qp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,qp(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=w(e)}return t}}
2653
+ */class Kp extends Bp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Kp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):Tf("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:i}=e,r=yf(e,["providerId","signInMethod"]);if(!n||!i)return null;const s=new Kp(n,i);return s.idToken=r.idToken||void 0,s.accessToken=r.accessToken||void 0,s.secret=r.secret,s.nonce=r.nonce,s.pendingToken=r.pendingToken||null,s}_getIdTokenResponse(t){return $p(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,$p(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,$p(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=w(e)}return t}}
2654
2654
  /**
2655
2655
  * @license
2656
2656
  * Copyright 2020 Google LLC
@@ -2666,7 +2666,7 @@ class $p extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2666
2666
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2667
2667
  * See the License for the specific language governing permissions and
2668
2668
  * limitations under the License.
2669
- */class Kp{constructor(t){var e,n,r,i,s,o;const a=b(S(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Rf(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=b(S(t)).link,n=e?b(S(e)).deep_link_id:null,r=b(S(t)).deep_link_id;return(r?b(S(r)).link:null)||r||n||e||t}(t);try{return new Kp(e)}catch(t){return null}}}
2669
+ */class Wp{constructor(t){var e,n,i,r,s,o;const a=b(S(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=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!==(i=a.mode)&&void 0!==i?i:null);Rf(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=b(S(t)).link,n=e?b(S(e)).deep_link_id:null,i=b(S(t)).deep_link_id;return(i?b(S(i)).link:null)||i||n||e||t}(t);try{return new Wp(e)}catch(t){return null}}}
2670
2670
  /**
2671
2671
  * @license
2672
2672
  * Copyright 2020 Google LLC
@@ -2682,7 +2682,7 @@ class $p extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2682
2682
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2683
2683
  * See the License for the specific language governing permissions and
2684
2684
  * limitations under the License.
2685
- */class Gp{constructor(){this.providerId=Gp.PROVIDER_ID}static credential(t,e){return $p._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Kp.parseLink(e);return Rf(n,"argument-error"),$p._fromEmailAndCode(t,n.code,n.tenantId)}}Gp.PROVIDER_ID="password",Gp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Gp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2685
+ */class Gp{constructor(){this.providerId=Gp.PROVIDER_ID}static credential(t,e){return qp._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Wp.parseLink(e);return Rf(n,"argument-error"),qp._fromEmailAndCode(t,n.code,n.tenantId)}}Gp.PROVIDER_ID="password",Gp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Gp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2686
2686
  /**
2687
2687
  * @license
2688
2688
  * Copyright 2020 Google LLC
@@ -2731,7 +2731,7 @@ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2731
2731
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2732
2732
  * See the License for the specific language governing permissions and
2733
2733
  * limitations under the License.
2734
- */class Jp extends Yp{constructor(){super("facebook.com")}static credential(t){return Wp._fromParams({providerId:Jp.PROVIDER_ID,signInMethod:Jp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Jp.credentialFromTaggedObject(t)}static credentialFromError(t){return Jp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Jp.credential(t.oauthAccessToken)}catch(t){return null}}}Jp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Jp.PROVIDER_ID="facebook.com";
2734
+ */class Jp extends Yp{constructor(){super("facebook.com")}static credential(t){return Kp._fromParams({providerId:Jp.PROVIDER_ID,signInMethod:Jp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Jp.credentialFromTaggedObject(t)}static credentialFromError(t){return Jp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Jp.credential(t.oauthAccessToken)}catch(t){return null}}}Jp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Jp.PROVIDER_ID="facebook.com";
2735
2735
  /**
2736
2736
  * @license
2737
2737
  * Copyright 2020 Google LLC
@@ -2748,7 +2748,7 @@ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2748
2748
  * See the License for the specific language governing permissions and
2749
2749
  * limitations under the License.
2750
2750
  */
2751
- class Xp extends Yp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Wp._fromParams({providerId:Xp.PROVIDER_ID,signInMethod:Xp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Xp.credentialFromTaggedObject(t)}static credentialFromError(t){return Xp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Xp.credential(e,n)}catch(t){return null}}}Xp.GOOGLE_SIGN_IN_METHOD="google.com",Xp.PROVIDER_ID="google.com";
2751
+ class Xp extends Yp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Kp._fromParams({providerId:Xp.PROVIDER_ID,signInMethod:Xp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Xp.credentialFromTaggedObject(t)}static credentialFromError(t){return Xp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Xp.credential(e,n)}catch(t){return null}}}Xp.GOOGLE_SIGN_IN_METHOD="google.com",Xp.PROVIDER_ID="google.com";
2752
2752
  /**
2753
2753
  * @license
2754
2754
  * Copyright 2020 Google LLC
@@ -2765,7 +2765,7 @@ class Xp extends Yp{constructor(){super("google.com"),this.addScope("profile")}s
2765
2765
  * See the License for the specific language governing permissions and
2766
2766
  * limitations under the License.
2767
2767
  */
2768
- class Zp extends Yp{constructor(){super("github.com")}static credential(t){return Wp._fromParams({providerId:Zp.PROVIDER_ID,signInMethod:Zp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Zp.credentialFromTaggedObject(t)}static credentialFromError(t){return Zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Zp.credential(t.oauthAccessToken)}catch(t){return null}}}Zp.GITHUB_SIGN_IN_METHOD="github.com",Zp.PROVIDER_ID="github.com";
2768
+ class Zp extends Yp{constructor(){super("github.com")}static credential(t){return Kp._fromParams({providerId:Zp.PROVIDER_ID,signInMethod:Zp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Zp.credentialFromTaggedObject(t)}static credentialFromError(t){return Zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Zp.credential(t.oauthAccessToken)}catch(t){return null}}}Zp.GITHUB_SIGN_IN_METHOD="github.com",Zp.PROVIDER_ID="github.com";
2769
2769
  /**
2770
2770
  * @license
2771
2771
  * Copyright 2020 Google LLC
@@ -2782,7 +2782,7 @@ class Zp extends Yp{constructor(){super("github.com")}static credential(t){retur
2782
2782
  * See the License for the specific language governing permissions and
2783
2783
  * limitations under the License.
2784
2784
  */
2785
- class tg extends Yp{constructor(){super("twitter.com")}static credential(t,e){return Wp._fromParams({providerId:tg.PROVIDER_ID,signInMethod:tg.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return tg.credentialFromTaggedObject(t)}static credentialFromError(t){return tg.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return tg.credential(e,n)}catch(t){return null}}}tg.TWITTER_SIGN_IN_METHOD="twitter.com",tg.PROVIDER_ID="twitter.com";
2785
+ class tg extends Yp{constructor(){super("twitter.com")}static credential(t,e){return Kp._fromParams({providerId:tg.PROVIDER_ID,signInMethod:tg.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return tg.credentialFromTaggedObject(t)}static credentialFromError(t){return tg.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return tg.credential(e,n)}catch(t){return null}}}tg.TWITTER_SIGN_IN_METHOD="twitter.com",tg.PROVIDER_ID="twitter.com";
2786
2786
  /**
2787
2787
  * @license
2788
2788
  * Copyright 2020 Google LLC
@@ -2799,7 +2799,7 @@ class tg extends Yp{constructor(){super("twitter.com")}static credential(t,e){re
2799
2799
  * See the License for the specific language governing permissions and
2800
2800
  * limitations under the License.
2801
2801
  */
2802
- class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const i=await cp._fromIdTokenResponse(t,n,r),s=ng(n);return new eg({user:i,providerId:s,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=ng(n);return new eg({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function ng(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2802
+ class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,i=!1){const r=await cp._fromIdTokenResponse(t,n,i),s=ng(n);return new eg({user:r,providerId:s,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const i=ng(n);return new eg({user:t,providerId:i,_tokenResponse:n,operationType:e})}}function ng(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2803
2803
  /**
2804
2804
  * @license
2805
2805
  * Copyright 2020 Google LLC
@@ -2815,7 +2815,7 @@ class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2815
2815
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2816
2816
  * See the License for the specific language governing permissions and
2817
2817
  * limitations under the License.
2818
- */class rg extends p{constructor(t,e,n,r){var i;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,rg.prototype),this.customData={appName:t.name,tenantId:null!==(i=t.tenantId)&&void 0!==i?i:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new rg(t,e,n,r)}}function ig(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw rg._fromErrorAndOperation(t,n,e,r);throw n}))}
2818
+ */class ig extends p{constructor(t,e,n,i){var r;super(e.code,e.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,ig.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,i){return new ig(t,e,n,i)}}function rg(t,e,n,i){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw ig._fromErrorAndOperation(t,n,e,i);throw n}))}
2819
2819
  /**
2820
2820
  * @license
2821
2821
  * Copyright 2020 Google LLC
@@ -2832,7 +2832,7 @@ class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2832
2832
  * See the License for the specific language governing permissions and
2833
2833
  * limitations under the License.
2834
2834
  */
2835
- async function sg(t,e,n=!1){if(xt(t.app))return Promise.reject(Cf(t));const r="signIn",i=await ig(t,r,e),s=await eg._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}
2835
+ async function sg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Cf(t));const i="signIn",r=await rg(t,i,e),s=await eg._fromIdTokenResponse(t,i,r);return n||await t._updateCurrentUser(s.user),s}
2836
2836
  /**
2837
2837
  * @license
2838
2838
  * Copyright 2020 Google LLC
@@ -2849,7 +2849,7 @@ async function sg(t,e,n=!1){if(xt(t.app))return Promise.reject(Cf(t));const r="s
2849
2849
  * See the License for the specific language governing permissions and
2850
2850
  * limitations under the License.
2851
2851
  */
2852
- async function og(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ag(t,e,n){const r=Np(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&
2852
+ async function og(t){const e=Lp(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ag(t,e,n){const i=Lp(t),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&
2853
2853
  /**
2854
2854
  * @license
2855
2855
  * Copyright 2020 Google LLC
@@ -2866,7 +2866,7 @@ async function og(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._upda
2866
2866
  * See the License for the specific language governing permissions and
2867
2867
  * limitations under the License.
2868
2868
  */
2869
- function(t,e,n){var r;Rf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Rf(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&&(Rf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Rf(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,i,n),await Mp(r,i,"getOobCode",jp)}async function cg(t,e,n){await async function(t,e){return Vf(t,"POST","/v1/accounts:resetPassword",Bf(t,e))}(T(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}function lg(t,e,n){return xt(t.app)?Promise.reject(Cf(t)):async function(t,e){return sg(Np(t),e)}(T(t),Gp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}const ug="__sak";
2869
+ function(t,e,n){var i;Rf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"invalid-continue-uri"),Rf(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&&(Rf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Rf(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)}(i,r,n),await Mp(i,r,"getOobCode",jp)}async function cg(t,e,n){await async function(t,e){return Vf(t,"POST","/v1/accounts:resetPassword",Bf(t,e))}(T(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}function lg(t,e,n){return Pt(t.app)?Promise.reject(Cf(t)):async function(t,e){return sg(Lp(t),e)}(T(t),Gp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}const ug="__sak";
2870
2870
  /**
2871
2871
  * @license
2872
2872
  * Copyright 2019 Google LLC
@@ -2898,7 +2898,7 @@ function(t,e,n){var r;Rf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2898
2898
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2899
2899
  * See the License for the specific language governing permissions and
2900
2900
  * limitations under the License.
2901
- */class dg extends hg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ip(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;e?this.detachListener():this.stopPolling();const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},i=this.storage.getItem(n);Tp()&&i!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}dg.type="LOCAL";const fg=dg;
2901
+ */class dg extends hg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ip(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),i=this.localCache[e];n!==i&&t(e,i,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;e?this.detachListener():this.stopPolling();const i=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},r=this.storage.getItem(n);Tp()&&r!==t.newValue&&t.newValue!==t.oldValue?setTimeout(i,10):i()}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]}}dg.type="LOCAL";const fg=dg;
2902
2902
  /**
2903
2903
  * @license
2904
2904
  * Copyright 2020 Google LLC
@@ -2947,7 +2947,7 @@ function(t,e,n){var r;Rf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2947
2947
  * See the License for the specific language governing permissions and
2948
2948
  * limitations under the License.
2949
2949
  */
2950
- class mg{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 mg(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:i}=e.data,s=this.handlersMap[r];if(!(null==s?void 0:s.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(s).map((async t=>t(e.origin,i))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
2950
+ class mg{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 mg(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:i,data:r}=e.data,s=this.handlersMap[i];if(!(null==s?void 0:s.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const o=Array.from(s).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:i,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)}}
2951
2951
  /**
2952
2952
  * @license
2953
2953
  * Copyright 2020 Google LLC
@@ -2980,7 +2980,7 @@ function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2980
2980
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2981
2981
  * See the License for the specific language governing permissions and
2982
2982
  * limitations under the License.
2983
- */mg.receivers=[];class vg{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let i,s;return new Promise(((o,a)=>{const c=yg("",20);r.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(l),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),o(e.data.response);break;default:clearTimeout(l),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(s),r.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}
2983
+ */mg.receivers=[];class vg{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 i="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let r,s;return new Promise(((o,a)=>{const c=yg("",20);i.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:i,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(l),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(l),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(s),i.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[i.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}
2984
2984
  /**
2985
2985
  * @license
2986
2986
  * Copyright 2020 Google LLC
@@ -3030,7 +3030,7 @@ function bg(){return void 0!==wg().WorkerGlobalScope&&"function"==typeof wg().im
3030
3030
  * See the License for the specific language governing permissions and
3031
3031
  * limitations under the License.
3032
3032
  */
3033
- const Sg="firebaseLocalStorageDb",_g="firebaseLocalStorage",Eg="fbase_key";class Tg{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Ig(t,e){return t.transaction([_g],e?"readwrite":"readonly").objectStore(_g)}function kg(){const t=indexedDB.open(Sg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(_g,{keyPath:Eg})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(_g)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Sg);return new Tg(t).toPromise()}(),e(await kg()))}))}))}async function Cg(t,e,n){const r=Ig(t,!0).put({[Eg]:e,value:n});return new Tg(r).toPromise()}function Ag(t,e){const n=Ig(t,!0).delete(e);return new Tg(n).toPromise()}class Rg{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 kg()),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 bg()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=mg._getInstance(bg()?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 vg(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 kg();return await Cg(t,ug,"1"),await Ag(t,ug),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Cg(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=Ig(t,!1).get(e),r=await new Tg(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>Ag(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Ig(t,!1).getAll();return new Tg(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:r,value:i}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Rg.type="LOCAL";const Ng=Rg;new xf(3e4,6e4);
3033
+ const Sg="firebaseLocalStorageDb",Eg="firebaseLocalStorage",_g="fbase_key";class Tg{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Ig(t,e){return t.transaction([Eg],e?"readwrite":"readonly").objectStore(Eg)}function kg(){const t=indexedDB.open(Sg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Eg,{keyPath:_g})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Eg)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Sg);return new Tg(t).toPromise()}(),e(await kg()))}))}))}async function Cg(t,e,n){const i=Ig(t,!0).put({[_g]:e,value:n});return new Tg(i).toPromise()}function Ag(t,e){const n=Ig(t,!0).delete(e);return new Tg(n).toPromise()}class Rg{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 kg()),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 bg()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=mg._getInstance(bg()?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 vg(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 kg();return await Cg(t,ug,"1"),await Ag(t,ug),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Cg(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=Ig(t,!1).get(e),i=await new Tg(n).toPromise();return void 0===i?null:i.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>Ag(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Ig(t,!1).getAll();return new Tg(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:i,value:r}of t)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),e.push(i));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()}}Rg.type="LOCAL";const Lg=Rg;new Pf(3e4,6e4);
3034
3034
  /**
3035
3035
  * @license
3036
3036
  * Copyright 2019 Google LLC
@@ -3047,7 +3047,7 @@ const Sg="firebaseLocalStorageDb",_g="firebaseLocalStorage",Eg="fbase_key";class
3047
3047
  * See the License for the specific language governing permissions and
3048
3048
  * limitations under the License.
3049
3049
  */
3050
- class Lg extends Bp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return qp(t,this._buildIdpRequest())}_linkToIdToken(t,e){return qp(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return qp(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function Og(t){return sg(t.auth,new Lg(t),t.bypassAuthState)}function Dg(t){const{auth:e,user:n}=t;return Rf(n,e,"internal-error"),
3050
+ class Ng extends Bp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return $p(t,this._buildIdpRequest())}_linkToIdToken(t,e){return $p(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return $p(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function xg(t){return sg(t.auth,new Ng(t),t.bypassAuthState)}function Og(t){const{auth:e,user:n}=t;return Rf(n,e,"internal-error"),
3051
3051
  /**
3052
3052
  * @license
3053
3053
  * Copyright 2019 Google LLC
@@ -3064,7 +3064,7 @@ class Lg extends Bp{constructor(t){super("custom","custom"),this.params=t}_getId
3064
3064
  * See the License for the specific language governing permissions and
3065
3065
  * limitations under the License.
3066
3066
  */
3067
- async function(t,e,n=!1){const{auth:r}=t;if(xt(r.app))return Promise.reject(Cf(r));const i="reauthenticate";try{const s=await ep(t,ig(r,i,e,t),n);Rf(s.idToken,r,"internal-error");const o=Zf(s.idToken);Rf(o,r,"internal-error");const{sub:a}=o;return Rf(t.uid===a,r,"user-mismatch"),eg._forOperation(t,i,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&Tf(r,"user-mismatch"),t}}(n,new Lg(t),t.bypassAuthState)}async function Pg(t){const{auth:e,user:n}=t;return Rf(n,e,"internal-error"),async function(t,e,n=!1){const r=await ep(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return eg._forOperation(t,"link",r)}(n,new Lg(t),t.bypassAuthState)}
3067
+ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Cf(i));const r="reauthenticate";try{const s=await ep(t,rg(i,r,e,t),n);Rf(s.idToken,i,"internal-error");const o=Zf(s.idToken);Rf(o,i,"internal-error");const{sub:a}=o;return Rf(t.uid===a,i,"user-mismatch"),eg._forOperation(t,r,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&Tf(i,"user-mismatch"),t}}(n,new Ng(t),t.bypassAuthState)}async function Dg(t){const{auth:e,user:n}=t;return Rf(n,e,"internal-error"),async function(t,e,n=!1){const i=await ep(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return eg._forOperation(t,"link",i)}(n,new Ng(t),t.bypassAuthState)}
3068
3068
  /**
3069
3069
  * @license
3070
3070
  * Copyright 2020 Google LLC
@@ -3080,7 +3080,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(xt(r.app))return Promise.reject(Cf(r
3080
3080
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3081
3081
  * See the License for the specific language governing permissions and
3082
3082
  * limitations under the License.
3083
- */class xg{constructor(t,e,n,r,i=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:i,error:s,type:o}=t;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return Og;case"linkViaPopup":case"linkViaRedirect":return Pg;case"reauthViaPopup":case"reauthViaRedirect":return Dg;default:Tf(this.auth,"internal-error")}}resolve(t){Lf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Lf(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()}}
3083
+ */class Pg{constructor(t,e,n,i,r=!1){this.auth=t,this.resolver=n,this.user=i,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:i,tenantId:r,error:s,type:o}=t;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:r||void 0,postBody:i||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 xg;case"linkViaPopup":case"linkViaRedirect":return Dg;case"reauthViaPopup":case"reauthViaRedirect":return Og;default:Tf(this.auth,"internal-error")}}resolve(t){Nf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Nf(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()}}
3084
3084
  /**
3085
3085
  * @license
3086
3086
  * Copyright 2020 Google LLC
@@ -3096,7 +3096,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(xt(r.app))return Promise.reject(Cf(r
3096
3096
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3097
3097
  * See the License for the specific language governing permissions and
3098
3098
  * limitations under the License.
3099
- */const Mg=new xf(2e3,1e4);class Ug extends xg{constructor(t,e,n,r,i){super(t,e,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Ug.currentPopupAction&&Ug.currentPopupAction.cancel(),Ug.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Rf(t,this.auth,"internal-error"),t}async onExecution(){Lf(1===this.filter.length,"Popup operations only handle one event");const t=yg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(If(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(If(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ug.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(If(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Mg.get())};t()}}Ug.currentPopupAction=null;
3099
+ */const Mg=new Pf(2e3,1e4);class Fg extends Pg{constructor(t,e,n,i,r){super(t,e,i,r),this.provider=n,this.authWindow=null,this.pollId=null,Fg.currentPopupAction&&Fg.currentPopupAction.cancel(),Fg.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Rf(t,this.auth,"internal-error"),t}async onExecution(){Nf(1===this.filter.length,"Popup operations only handle one event");const t=yg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(If(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(If(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Fg.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(If(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Mg.get())};t()}}Fg.currentPopupAction=null;
3100
3100
  /**
3101
3101
  * @license
3102
3102
  * Copyright 2020 Google LLC
@@ -3113,7 +3113,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(xt(r.app))return Promise.reject(Cf(r
3113
3113
  * See the License for the specific language governing permissions and
3114
3114
  * limitations under the License.
3115
3115
  */
3116
- const Fg="pendingRedirect",zg=new Map;class Bg extends xg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=zg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return fp(Fg,t.config.apiKey,t.name)}(e),r=function(t){return up(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}zg.set(this.auth._key(),t)}return this.bypassAuthState||zg.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 Vg(t,e){zg.set(t._key(),e)}async function Hg(t,e,n=!1){if(xt(t.app))return Promise.reject(Cf(t));const r=Np(t),i=
3116
+ const Ug="pendingRedirect",zg=new Map;class Bg extends Pg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=zg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return fp(Ug,t.config.apiKey,t.name)}(e),i=function(t){return up(t._redirectPersistence)}(t);if(!await i._isAvailable())return!1;const r="true"===await i._get(n);return await i._remove(n),r}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}zg.set(this.auth._key(),t)}return this.bypassAuthState||zg.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 Vg(t,e){zg.set(t._key(),e)}async function Hg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Cf(t));const i=Lp(t),r=
3117
3117
  /**
3118
3118
  * @license
3119
3119
  * Copyright 2021 Google LLC
@@ -3130,7 +3130,7 @@ const Fg="pendingRedirect",zg=new Map;class Bg extends xg{constructor(t,e,n=!1){
3130
3130
  * See the License for the specific language governing permissions and
3131
3131
  * limitations under the License.
3132
3132
  */
3133
- function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),s=new Bg(r,i,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
3133
+ function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(i,e),s=new Bg(i,r,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}
3134
3134
  /**
3135
3135
  * @license
3136
3136
  * Copyright 2020 Google LLC
@@ -3146,7 +3146,7 @@ function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t.
3146
3146
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3147
3147
  * See the License for the specific language governing permissions and
3148
3148
  * limitations under the License.
3149
- */class jg{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return qg(t);default:return!1}}
3149
+ */class jg{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return $g(t);default:return!1}}
3150
3150
  /**
3151
3151
  * @license
3152
3152
  * Copyright 2020 Google LLC
@@ -3162,7 +3162,7 @@ function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t.
3162
3162
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3163
3163
  * See the License for the specific language governing permissions and
3164
3164
  * limitations under the License.
3165
- */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!qg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(If(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has($g(t))}saveEventToCache(t){this.cachedEventUids.add($g(t)),this.lastProcessedEventTime=Date.now()}}function $g(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function qg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3165
+ */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!$g(t)){const i=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(If(this.auth,i))}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(qg(t))}saveEventToCache(t){this.cachedEventUids.add(qg(t)),this.lastProcessedEventTime=Date.now()}}function qg(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function $g({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3166
3166
  /**
3167
3167
  * @license
3168
3168
  * Copyright 2020 Google LLC
@@ -3179,7 +3179,7 @@ function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t.
3179
3179
  * See the License for the specific language governing permissions and
3180
3180
  * limitations under the License.
3181
3181
  */
3182
- const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Kg=/^https?/;async function Gg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Vf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Qg(t))return}catch(t){}Tf(t,"unauthorized-domain")}function Qg(t){const e=Of(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const i=new URL(t);return""===i.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!Kg.test(n))return!1;if(Wg.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}
3182
+ const Kg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Wg=/^https?/;async function Gg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Vf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Qg(t))return}catch(t){}Tf(t,"unauthorized-domain")}function Qg(t){const e=xf(),{protocol:n,hostname:i}=new URL(e);if(t.startsWith("chrome-extension://")){const r=new URL(t);return""===r.hostname&&""===i?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===i}if(!Wg.test(n))return!1;if(Kg.test(t))return i===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}
3183
3183
  /**
3184
3184
  * @license
3185
3185
  * Copyright 2020 Google LLC.
@@ -3195,7 +3195,7 @@ const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Kg=/^https?/;async function Gg(t
3195
3195
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3196
3196
  * See the License for the specific language governing permissions and
3197
3197
  * limitations under the License.
3198
- */const Yg=new xf(3e4,6e4);function Jg(){const t=wg().___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 Xg(t){return new Promise(((e,n)=>{var r,i,s;function o(){Jg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Jg(),n(If(t,"network-request-failed"))},timeout:Yg.get()})}if(null===(i=null===(r=wg().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)e(gapi.iframes.getContext());else{if(!(null===(s=wg().gapi)||void 0===s?void 0:s.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return wg()[e]=()=>{gapi.load?o():n(If(t,"network-request-failed"))},Dp(`${Op.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Zg=null,t}))}let Zg=null;
3198
+ */const Yg=new Pf(3e4,6e4);function Jg(){const t=wg().___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 Xg(t){return new Promise(((e,n)=>{var i,r,s;function o(){Jg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Jg(),n(If(t,"network-request-failed"))},timeout:Yg.get()})}if(null===(r=null===(i=wg().gapi)||void 0===i?void 0:i.iframes)||void 0===r?void 0:r.Iframe)e(gapi.iframes.getContext());else{if(!(null===(s=wg().gapi)||void 0===s?void 0:s.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return wg()[e]=()=>{gapi.load?o():n(If(t,"network-request-failed"))},Op(`${xp.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Zg=null,t}))}let Zg=null;
3199
3199
  /**
3200
3200
  * @license
3201
3201
  * Copyright 2020 Google LLC.
@@ -3212,7 +3212,7 @@ const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Kg=/^https?/;async function Gg(t
3212
3212
  * See the License for the specific language governing permissions and
3213
3213
  * limitations under the License.
3214
3214
  */
3215
- const tm=new xf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},im=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function sm(t){const e=t.config;Rf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Mf(e,nm):`https://${t.config.authDomain}/${em}`,r={apiKey:e.apiKey,appName:t.name,v:Ft},i=im.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${w(r).slice(1)}`}async function om(t){const e=await function(t){return Zg=Zg||Xg(t),Zg}(t),n=wg().gapi;return Rf(n,t,"internal-error"),e.open({where:document.body,url:sm(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:rm,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const i=If(t,"network-request-failed"),s=wg().setTimeout((()=>{r(i)}),tm.get());function o(){wg().clearTimeout(s),n(e)}e.ping(o).then(o,(()=>{r(i)}))}))))}
3215
+ const tm=new Pf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",im={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},rm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function sm(t){const e=t.config;Rf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Mf(e,nm):`https://${t.config.authDomain}/${em}`,i={apiKey:e.apiKey,appName:t.name,v:Ut},r=rm.get(t.config.apiHost);r&&(i.eid=r);const s=t._getFrameworks();return s.length&&(i.fw=s.join(",")),`${n}?${w(i).slice(1)}`}async function om(t){const e=await function(t){return Zg=Zg||Xg(t),Zg}(t),n=wg().gapi;return Rf(n,t,"internal-error"),e.open({where:document.body,url:sm(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:im,dontclear:!0},(e=>new Promise((async(n,i)=>{await e.restyle({setHideOnLeave:!1});const r=If(t,"network-request-failed"),s=wg().setTimeout((()=>{i(r)}),tm.get());function o(){wg().clearTimeout(s),n(e)}e.ping(o).then(o,(()=>{i(r)}))}))))}
3216
3216
  /**
3217
3217
  * @license
3218
3218
  * Copyright 2020 Google LLC.
@@ -3228,7 +3228,7 @@ const tm=new xf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={styl
3228
3228
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3229
3229
  * See the License for the specific language governing permissions and
3230
3230
  * limitations under the License.
3231
- */const am={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class cm{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function lm(t,e,n,r=500,i=600){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},am),{width:r.toString(),height:i.toString(),top:s,left:o}),l=f().toLowerCase();n&&(a=vp(l)?"_blank":n),mp(l)&&(e=e||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=f()){var e;return Ep(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(l)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
3231
+ */const am={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class cm{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function lm(t,e,n,i=500,r=600){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const c=Object.assign(Object.assign({},am),{width:i.toString(),height:r.toString(),top:s,left:o}),l=f().toLowerCase();n&&(a=vp(l)?"_blank":n),mp(l)&&(e=e||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=f()){var e;return _p(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(l)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}
3232
3232
  /**
3233
3233
  * @license
3234
3234
  * Copyright 2021 Google LLC
@@ -3244,7 +3244,7 @@ const tm=new xf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={styl
3244
3244
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3245
3245
  * See the License for the specific language governing permissions and
3246
3246
  * limitations under the License.
3247
- */(e||"",a),new cm(null);const h=window.open(e||"",a,u);Rf(h,t,"popup-blocked");try{h.focus()}catch(t){}return new cm(h)}const um="__/auth/handler",hm="emulator/auth/handler",dm=encodeURIComponent("fac");async function fm(t,e,n,r,i,s){Rf(t.config.authDomain,t,"auth-domain-config-required"),Rf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ft,eventId:i};if(e instanceof Qp){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(s||{}))o[t]=e}if(e instanceof Yp){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),l=c?`#${dm}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${um}`;return Mf(t,hm)}
3247
+ */(e||"",a),new cm(null);const h=window.open(e||"",a,u);Rf(h,t,"popup-blocked");try{h.focus()}catch(t){}return new cm(h)}const um="__/auth/handler",hm="emulator/auth/handler",dm=encodeURIComponent("fac");async function fm(t,e,n,i,r,s){Rf(t.config.authDomain,t,"auth-domain-config-required"),Rf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:i,v:Ut,eventId:r};if(e instanceof Qp){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(s||{}))o[t]=e}if(e instanceof Yp){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),l=c?`#${dm}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${um}`;return Mf(t,hm)}
3248
3248
  /**
3249
3249
  * @license
3250
3250
  * Copyright 2020 Google LLC
@@ -3260,7 +3260,7 @@ const tm=new xf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={styl
3260
3260
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3261
3261
  * See the License for the specific language governing permissions and
3262
3262
  * limitations under the License.
3263
- */(t)}?${w(a).slice(1)}${l}`}const pm="webStorageSupport";const gm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=gg,this._completeRedirectFn=Hg,this._overrideRedirectResult=Vg}async _openPopup(t,e,n,r){var i;Lf(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return lm(t,await fm(t,e,n,Of(),r),yg())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){wg().location.href=t}(await fm(t,e,n,Of(),r)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Lf(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 om(t),n=new jg(t);return e.register("authEvent",(e=>{Rf(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(pm,{type:pm},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[pm];void 0!==i&&e(!!i),Tf(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Gg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return Ip()||yp()||Ep()}};var mm="@firebase/auth",ym="1.7.7";
3263
+ */(t)}?${w(a).slice(1)}${l}`}const pm="webStorageSupport";const gm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=gg,this._completeRedirectFn=Hg,this._overrideRedirectResult=Vg}async _openPopup(t,e,n,i){var r;Nf(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return lm(t,await fm(t,e,n,xf(),i),yg())}async _openRedirect(t,e,n,i){await this._originValidation(t);return function(t){wg().location.href=t}(await fm(t,e,n,xf(),i)),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):(Nf(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 om(t),n=new jg(t);return e.register("authEvent",(e=>{Rf(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(pm,{type:pm},(n=>{var i;const r=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[pm];void 0!==r&&e(!!r),Tf(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Gg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return Ip()||yp()||_p()}};var mm="@firebase/auth",ym="1.7.7";
3264
3264
  /**
3265
3265
  * @license
3266
3266
  * Copyright 2020 Google LLC
@@ -3310,4 +3310,4 @@ class vm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3310
3310
  * See the License for the specific language governing permissions and
3311
3311
  * limitations under the License.
3312
3312
  */
3313
- const wm=h("authIdTokenMaxAge")||300;let bm=null;function Sm(t=Bt()){const e=Pt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Pt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;Tf(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gm,persistence:[Ng,fg,gg]}),r=h("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(r,location.origin);if(location.origin===t.origin){const e=(i=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>wm)return;const r=null==e?void 0:e.token;bm!==r&&(bm=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(t=>e(t)))}}var i;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&Up(n,`http://${s}`),n}var _m;!function(t){Op=t}({loadJS:t=>new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=If("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),_m="Browser",Dt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),i=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Rf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:_m,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:kp(_m)},c=new Rp(n,r,i,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(up);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Dt(new I("auth-internal",(t=>(t=>new vm(t))(Np(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(mm,ym,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(_m)),Vt(mm,ym,"esm2017");class Em extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Tm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Im extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class km{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Sm(e),this.auth.setPersistence(fg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&this.logUserLogin(t,e)})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,i,s,o;try{const a=Uh(this.firestore,"user_logging",e.uid),c=await Dd(a),l=new Date,u=c.exists?c.data():null,h=null===(r=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(h&&ff(l).diff(ff(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(i=null==u?void 0:u.brands)||void 0===i?void 0:i[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Md(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return(await Dd(Uh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=bd(Mh(this.firestore,"users"),_d(new Qh("__name__"),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await lg(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await ag(this.auth,t)}async confirmPasswordReset(t,e){await cg(this.auth,t,e)}}class Cm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Ud(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=zt(zd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Pt("object"==typeof t?t:Bt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=oe("firestore");t&&Oh(r,...t)}return r}(t),this.user=new km(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=bd(Mh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return xd(bd(Mh(this.firestore,t),...e))}async getDoc(t,e){const n=Uh(this.firestore,t,e),r=await Dd(n);return r.exists()?r.data():null}}const Am=t=>{if(t.code===Sf)throw new Error("account has been disabled");throw new Error(t.message)};class Rm{static get endpoint(){return zd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,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 Nm{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Tm;try{const r=await Rm.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new Em;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Rm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[_d("brand_id","==",this.brandId)];r.push(_d("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Am(t)}}async getColorwaySizeAssets(t,e){const n=[_d("brand_id","==",this.brandId)];t&&n.push(_d("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(_d("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 Am(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Am(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Am(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Am(t)}}}var Lm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(Lm||(Lm={}));const Om={[Lm.ACROSS_BACK]:"Across back",[Lm.ACROSS_FRONT]:"Across front",[Lm.ACROSS_SHOULDER]:"Across shoulder",[Lm.ANKLE]:"Ankle",[Lm.ARMEYE]:"Armeye",[Lm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Lm.BACK_CROTCH_LENGTH]:"Back crotch length",[Lm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Lm.BELOW_KNEE]:"Below knee",[Lm.BICEP]:"Bicep",[Lm.BUST]:"Chest/Bust",[Lm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Lm.CALF]:"Calf",[Lm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Lm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Lm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Lm.ELBOW]:"Elbow",[Lm.FOREARM]:"Forearm",[Lm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Lm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Lm.HIGH_HIP]:"High hip",[Lm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Lm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Lm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Lm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Lm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Lm.INSEAM]:"Inseam",[Lm.KNEE]:"Knee",[Lm.LOW_HIP]:"Low hip",[Lm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Lm.MID_NECK]:"Mid neck",[Lm.NECK_AT_BASE]:"Neck at base",[Lm.SHOULDER_DROP]:"Shoulder drop",[Lm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Lm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Lm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Lm.THIGH]:"Thigh",[Lm.TOTAL_RISE_LENGTH]:"Total rise length",[Lm.UNDER_BUST]:"Under bust",[Lm.VERTICAL_TRUNK]:"Vertical trunk",[Lm.WAIST]:"Waist",[Lm.WRIST]:"Wrist"};var Dm;!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"}(Dm||(Dm={}));const Pm={[Dm.BLOUSES]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.COATS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.DRESSES]:[Lm.LOW_HIP,Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST],[Dm.JACKETS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.PANTS]:[Lm.LOW_HIP,Lm.WAIST,Lm.THIGH,Lm.INSEAM],[Dm.PUFFERS_AND_PARKAS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.SHORTS]:[Lm.LOW_HIP,Lm.WAIST,Lm.THIGH,Lm.INSEAM],[Dm.SKIRTS]:[Lm.LOW_HIP,Lm.WAIST],[Dm.SWEATERS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.T_SHIRTS_AND_TANKS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP]},xm={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"},Mm={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"},Um={activewear:{leggings:Dm.PANTS,joggers:Dm.PANTS,sweatshirts:Dm.SWEATERS},dresses:{a_line:Dm.DRESSES,bodycon:Dm.DRESSES,fit_and_flare:Dm.DRESSES,knit:Dm.DRESSES,shirt:Dm.DRESSES,slip:Dm.DRESSES,straight:Dm.DRESSES,wrap:Dm.DRESSES},jackets_and_coats:{denim_jackets:Dm.JACKETS,parkas:Dm.PUFFERS_AND_PARKAS,peacoats:Dm.COATS,puffer_jackets:Dm.PUFFERS_AND_PARKAS,raincoats:Dm.COATS,rompers:Dm.COATS,shackets:Dm.JACKETS,trench_coats:Dm.COATS},jeans:{bootcut:Dm.PANTS,flared:Dm.PANTS,mom:Dm.PANTS,relaxed:Dm.PANTS,skinny:Dm.PANTS,slim:Dm.PANTS,straight:Dm.PANTS,tapered:Dm.PANTS,wide_leg:Dm.PANTS},jumpsuits_and_rompers:{boiler_suits:Dm.DRESSES,denim:Dm.DRESSES,jumpsuits:Dm.DRESSES,overalls:Dm.DRESSES,rompers:Dm.DRESSES,unitards:Dm.DRESSES},pants_and_shorts:{cigarette:Dm.PANTS,culottes:Dm.SHORTS,denim_shorts:Dm.SHORTS,flared:Dm.PANTS,joggers:Dm.PANTS,leggings:Dm.PANTS,skinny:Dm.PANTS,wide_leg:Dm.PANTS},skirts:{a_line_flared:Dm.SKIRTS,denim:Dm.SKIRTS,knit:Dm.SKIRTS,pencil:Dm.SKIRTS,pleated:Dm.SKIRTS,skater:Dm.SKIRTS,slip:Dm.SKIRTS,wrap:Dm.SKIRTS},suits_and_tailoring:{blazers:Dm.JACKETS,suit_jackets:Dm.JACKETS,suit_skirts:Dm.SKIRTS,suit_trousers:Dm.PANTS,suit_vests:Dm.SWEATERS,trousers:Dm.PANTS},sweaters:{cardigans:Dm.SWEATERS,crewnecks:Dm.SWEATERS,hoodies_and_zipups:Dm.SWEATERS,sweatshirts:Dm.SWEATERS,turtlenecks:Dm.SWEATERS,v_necks:Dm.SWEATERS},tops:{bodysuits:Dm.BLOUSES,corsets_and_bustiers:Dm.BLOUSES,polos:Dm.T_SHIRTS_AND_TANKS,shirts_and_blouses:Dm.BLOUSES,t_shirts:Dm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Dm.T_SHIRTS_AND_TANKS}};var Fm;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Fm||(Fm={}));const zm={[Fm.TOO_TIGHT]:"Too Tight",[Fm.TIGHT]:"Tight",[Fm.SLIGHTLY_TIGHT]:"Slightly Tight",[Fm.PERFECT_FIT]:"Perfect Fit",[Fm.SLIGHTLY_LOOSE]:"Slightly Loose",[Fm.LOOSE]:"Loose",[Fm.OVERSIZED]:"Oversized",[Fm.TOO_SHORT]:"Too Short",[Fm.SHORT]:"Short",[Fm.SLIGHTLY_SHORT]:"Slightly Short",[Fm.SLIGHTLY_LONG]:"Slightly Long",[Fm.LONG]:"Long",[Fm.TOO_LONG]:"Too Long"};var Bm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Bm||(Bm={}));var Vm=Object.freeze({__proto__:null,get AvatarState(){return Bm},get MeasurementLocation(){return Lm},MeasurementLocationName:Om,get Classification(){return Dm},ClassificationLocations:Pm,CategoryNames:xm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Mm,Taxonomy:Um,get Fit(){return Fm},FitNames:zm}),Hm="Back to sign in",jm="Click here to download the app",$m="Don't have an account?",qm="Whoops! Looks like you don't have an avatar yet.",Wm="Email address",Km="Please enter a valid email address.",Gm="Enter your email address, we will send you a link to reset your password.",Qm="Forgot password?",Ym="Have an account? Sign in",Jm="Your avatar is loading...",Xm="Unfortunately, that size is not available for try on.",Zm="or",ty="Password",ey="Please enter a valid password (at least 7 characters).",ny="Return to Catalog Page",ry="Return to Product Page",iy="Return to site",sy="Please return to The Fitting Room app to create your avatar.",oy="Scan to download the app",ay="Send",cy="Sign back in",ly="Sign in",uy="Something went wrong. Try again!",hy="You have successfully logged out!",dy="The Fitting Room",fy="Username or password is empty.",py="Username or password is incorrect.",gy="End size uncertainty with",my="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var yy=[],vy=[];function wy(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=yy.indexOf(s);-1===o&&(o=yy.push(s)-1,vy[o]={}),n=vy[o]&&vy[o][r]?vy[o][r]:vy[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}wy(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});wy(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:0 auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;max-height:100vh;max-width:850px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:350px;max-width:350px}.tfr-logo-box{margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:200px}.tfr-space-above{margin-top:10px}.tfr-max-w-600{margin:auto;max-width:600px}#tfr-qr-border-box{align-items:center;border:2px solid var(--tfr-brand-color);border-radius:16px;display:flex;flex-direction:column;height:350px;justify-content:center;margin-left:20px;padding:0 30px;width:300px}.tfr-mobile-logo{height:60px}#email-input,#password-input{font-size:16px}.tfr-door-icon,.tfr-user-icon{color:#209da7}",{});wy("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});wy(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});wy("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto;margin:auto;width:100%}}@media screen and (max-width:599px){#tfr-size-recommendations{width:calc(100vw - 30px)!important}.tfr-mobile-hidden{display:none}.tfr-modal-content-container{max-height:none;max-width:100vw;min-height:100vh;min-width:100vw}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{overflow:auto}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}@media screen and (max-width:380){#tfr-size-rec-subtitle{min-width:none}}@media screen and (max-height:800px){.tfr-video-responsive{height:280px!important}}",{});wy("#tfr-size-recommendations{align-items:center;background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;flex-direction:column;font-family:var(--tfr-main-font);justify-content:center;padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations-container{align-items:center;display:none;flex-direction:column;justify-content:center;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column;font-size:13px;width:100%}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);min-width:318px;padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;padding:0 10px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);justify-content:center;min-height:40px}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;padding-left:8px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px;padding-right:8px;text-align:left}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex;width:150px}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img,.tfr-powered-by-logo svg{height:24px;width:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}",{});wy(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px 10px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});wy(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});wy(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}.tfr-24-bold{font-size:24px;font-weight:700}",{});wy(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const by=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Jm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),Sy=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let r;const i=()=>{n.style.overflow="auto",r&&(r.Unhook(),c()),e.style.display="none"},s=t=>{"Escape"===t.key&&i()},o=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),i())},a=()=>{e.querySelector("#tfr-close-container").addEventListener("click",i),document.addEventListener("keydown",s),document.addEventListener("click",o)},c=()=>{var n;const r=e.querySelector("#tfr-close-container");r?r.removeEventListener("click",i):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",s),document.removeEventListener("click",o)};return{open:t=>{var i;n.style.overflow="hidden",r&&r.Unhook(),e.innerHTML=(i=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">&times;</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${gy}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${dy}</div>\n </div>\n </div>\n ${i}\n </div>\n </div>\n </div>\n </div>\n `),a(),t.Hook(),e.style.display="block",r=t},close:i,Content:()=>r}},_y=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")},s="https://assets.dev.thefittingroom.xyz/images/";return{Hook:()=>{var t,s,o;if(e||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),e){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(s=document.getElementById("tfr-app-store"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${my}</div>\n \n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls loop autoplay playsinline>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n\n ${e?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${oy}</div>\n \n <img src="${s}qr.png" class="tfr-qr-code" />\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Ym}</div>\n </div>`}\n </div>\n\n ${e?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${jm}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n <img class="tfr-mobile-logo" src="${s}apple.png" id="tfr-app-store" />\n <img class="tfr-mobile-logo" src="${s}google.png" id="tfr-google-play" />\n </div>\n \n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Ym}</div>\n `:""}\n `}};class Ey{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=Sy(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${hy}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${cy}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${iy}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${qm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${sy}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(by({timeoutMS:1e4}))}toScan(){this.manager.open(_y({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${ly}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Wm}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${ty}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${Qm}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${$m}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${ly}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Gm}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Wm}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Hm}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${ay}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${ry}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||uy}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${ry}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${Xm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Zm} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${ry}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const Ty='<svg class="tfr-user-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_82_11365)">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M4.3125 4.78125C4.3125 3.02084 5.73959 1.59375 7.5 1.59375C9.26041 1.59375 10.6875 3.02084 10.6875 4.78125C10.6875 6.54166 9.26041 7.96875 7.5 7.96875C5.73959 7.96875 4.3125 6.54166 4.3125 4.78125ZM9.625 4.78125C9.625 3.60764 8.6736 2.65625 7.5 2.65625C6.32639 2.65625 5.375 3.60764 5.375 4.78125C5.375 5.95485 6.32639 6.90625 7.5 6.90625C8.6736 6.90625 9.625 5.95485 9.625 4.78125Z"\n fill="currentColor" fill-opacity="0.7" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M2.1875 13.1634C2.1875 10.5693 4.58181 8.5 7.5 8.5C10.4182 8.5 12.8125 10.5693 12.8125 13.1634C12.8125 16.1539 2.1875 16.1539 2.1875 13.1634ZM11.75 13.1634C11.75 11.1933 9.86303 9.5625 7.5 9.5625C5.13697 9.5625 3.25 11.1933 3.25 13.1634C3.25 13.7564 4.45689 14.126 5.96113 14.2721L6.31312 14.3019C7.08543 14.3577 7.91457 14.3577 8.68688 14.3019L9.03887 14.2721C10.5431 14.126 11.75 13.7564 11.75 13.1634Z"\n fill="currentColor" fill-opacity="0.7" />\n </g>\n <defs>\n <clipPath id="clip0_82_11365">\n <rect width="16" height="16" fill="white" />\n </clipPath>\n </defs>\n</svg>';class Iy{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeHowItFits.style.display="block"):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.tfrSizeHowItFits.style.display="none")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeHowItFits=document.getElementById("tfr-size-how-it-fits"),this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=`&nbsp;${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta">${Ty} Sign up to view</div>`}renderGarmentLocations(t){const e=t.map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n ${Ty} Sign up to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Log out</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">\n<svg class="tfr-door-icon" width="68" height="124" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="currentColor">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n</path>\n</svg></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class ky{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Vm.Fit.PERFECT_FIT,Vm.Fit.SLIGHTLY_LOOSE,Vm.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Iy(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:"string"==typeof t.fit_label&&t.fit_label?t.fit_label:Vm.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(t.measurement_location)}))).sort(((t,e)=>t.sortOrder<e.sortOrder?-1:1))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var Cy;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Cy||(Cy={}));class Ay{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",o),this.tfrModal=new Ey(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),zd.getInstance().setEnv(e),new Nm(t,new Cm)))(Number(this.shopId),o),this.tfrSizeRec=new ky(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(fy);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Km);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(ey);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(py)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(uy)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case Cy.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(qm),this.tfrModal.onNotCreated();break;case Cy.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Cy.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(uy),this.tfrModal.onError(uy)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const Ry=async(t,e,n,r={},i={},s="dev")=>{const o=new Ay(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,Ry as initFittingRoom};
3313
+ const wm=h("authIdTokenMaxAge")||300;let bm=null;function Sm(t=Bt()){const e=Dt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Dt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;Tf(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gm,persistence:[Lg,fg,gg]}),i=h("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(i,location.origin);if(location.origin===t.origin){const e=(r=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>wm)return;const i=null==e?void 0:e.token;bm!==i&&(bm=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,i){T(t).onIdTokenChanged(e,n,i)}(n,(t=>e(t)))}}var r;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&Fp(n,`http://${s}`),n}var Em;!function(t){xp=t}({loadJS:t=>new Promise(((e,n)=>{const i=document.createElement("script");i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=If("internal-error");e.customData=t,n(e)},i.type="text/javascript",i.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(i)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Em="Browser",Ot(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),i=t.getProvider("heartbeat"),r=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Rf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:Em,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:kp(Em)},c=new Rp(n,i,r,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],i=(Array.isArray(n)?n:[n]).map(up);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(i,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Ot(new I("auth-internal",(t=>(t=>new vm(t))(Lp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(mm,ym,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Em)),Vt(mm,ym,"esm2017");class _m extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Tm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Im extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class km{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Sm(e),this.auth.setPersistence(fg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&this.logUserLogin(t,e)})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,i,r,s,o;try{const a=Fh(this.firestore,"user_logging",e.uid),c=await Od(a),l=new Date,u=c.exists?c.data():null,h=null===(i=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===i?void 0:i.last_login;if(h&&ff(l).diff(ff(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(r=null==u?void 0:u.brands)||void 0===r?void 0:r[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Md(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return(await Od(Fh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=bd(Mh(this.firestore,"users"),Ed(new Qh("__name__"),"==",this.id));return e=Fd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await lg(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await ag(this.auth,t)}async confirmPasswordReset(t,e){await cg(this.auth,t,e)}}class Cm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((i=>{n=Fd(t,(t=>{i(t),e&&n()}))})),unsubscribe:()=>n()}};const t=zt(zd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",i=Dt("object"==typeof t?t:Bt(),"firestore").getImmediate({identifier:n});if(!i._initialized){const t=oe("firestore");t&&xh(i,...t)}return i}(t),this.user=new km(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const i=bd(Mh(this.firestore,t),e);return this.promisefyOnSnapshot(i,n)}getDocs(t,e){return Pd(bd(Mh(this.firestore,t),...e))}async getDoc(t,e){const n=Fh(this.firestore,t,e),i=await Od(n);return i.exists()?i.data():null}}const Am=t=>{if(t.code===Sf)throw new Error("account has been disabled");throw new Error(t.message)};class Rm{static get endpoint(){return zd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:i,useToken:r=!0}){const s=this.getUrl(e,r),o={method:n,headers:await this.getHeaders(t,r),credentials:"omit"};i&&(o.body=JSON.stringify(i));const a=await fetch(s,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,i){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:i})}static Put(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:i})}static Patch(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:i})}static Delete(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:i})}}class Lm{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Tm;try{const i=await Rm.Get(this.user,`/styles/${t}/recommendation`),r=await i.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("avatar not created"===(null==t?void 0:t.error))throw new _m;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Rm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.measurement_locations.female.filter((t=>e.includes(t))):r.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.measurement_locations.female.filter((t=>e.includes(t))):r.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const i=[Ed("brand_id","==",this.brandId)];i.push(Ed("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",i)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Am(t)}}async getColorwaySizeAssets(t,e){const n=[Ed("brand_id","==",this.brandId)];t&&n.push(Ed("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(Ed("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 Am(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Am(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Am(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Am(t)}}}var Nm;!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"}(Nm||(Nm={}));const xm={[Nm.ACROSS_BACK]:"Across back",[Nm.ACROSS_FRONT]:"Across front",[Nm.ACROSS_SHOULDER]:"Across shoulder",[Nm.ANKLE]:"Ankle",[Nm.ARMEYE]:"Armeye",[Nm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Nm.BACK_CROTCH_LENGTH]:"Back crotch length",[Nm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Nm.BELOW_KNEE]:"Below knee",[Nm.BICEP]:"Bicep",[Nm.BUST]:"Chest/Bust",[Nm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Nm.CALF]:"Calf",[Nm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Nm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Nm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Nm.ELBOW]:"Elbow",[Nm.FOREARM]:"Forearm",[Nm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Nm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Nm.HIGH_HIP]:"High hip",[Nm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Nm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Nm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Nm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Nm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Nm.INSEAM]:"Inseam",[Nm.KNEE]:"Knee",[Nm.LOW_HIP]:"Low hip",[Nm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Nm.MID_NECK]:"Mid neck",[Nm.NECK_AT_BASE]:"Neck at base",[Nm.SHOULDER_DROP]:"Shoulder drop",[Nm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Nm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Nm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Nm.THIGH]:"Thigh",[Nm.TOTAL_RISE_LENGTH]:"Total rise length",[Nm.UNDER_BUST]:"Under bust",[Nm.VERTICAL_TRUNK]:"Vertical trunk",[Nm.WAIST]:"Waist",[Nm.WRIST]:"Wrist"};var Om;!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"}(Om||(Om={}));const Dm={[Om.BLOUSES]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.COATS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.DRESSES]:[Nm.LOW_HIP,Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST],[Om.JACKETS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.PANTS]:[Nm.LOW_HIP,Nm.WAIST,Nm.THIGH,Nm.INSEAM],[Om.PUFFERS_AND_PARKAS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.SHORTS]:[Nm.LOW_HIP,Nm.WAIST,Nm.THIGH,Nm.INSEAM],[Om.SKIRTS]:[Nm.LOW_HIP,Nm.WAIST],[Om.SWEATERS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP],[Om.T_SHIRTS_AND_TANKS]:[Nm.BUST,Nm.ACROSS_SHOULDER,Nm.WAIST,Nm.LOW_HIP,Nm.HIGH_HIP]},Pm={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"},Mm={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"},Fm={activewear:{leggings:Om.PANTS,joggers:Om.PANTS,sweatshirts:Om.SWEATERS},dresses:{a_line:Om.DRESSES,bodycon:Om.DRESSES,fit_and_flare:Om.DRESSES,knit:Om.DRESSES,shirt:Om.DRESSES,slip:Om.DRESSES,straight:Om.DRESSES,wrap:Om.DRESSES},jackets_and_coats:{denim_jackets:Om.JACKETS,parkas:Om.PUFFERS_AND_PARKAS,peacoats:Om.COATS,puffer_jackets:Om.PUFFERS_AND_PARKAS,raincoats:Om.COATS,rompers:Om.COATS,shackets:Om.JACKETS,trench_coats:Om.COATS},jeans:{bootcut:Om.PANTS,flared:Om.PANTS,mom:Om.PANTS,relaxed:Om.PANTS,skinny:Om.PANTS,slim:Om.PANTS,straight:Om.PANTS,tapered:Om.PANTS,wide_leg:Om.PANTS},jumpsuits_and_rompers:{boiler_suits:Om.DRESSES,denim:Om.DRESSES,jumpsuits:Om.DRESSES,overalls:Om.DRESSES,rompers:Om.DRESSES,unitards:Om.DRESSES},pants_and_shorts:{cigarette:Om.PANTS,culottes:Om.SHORTS,denim_shorts:Om.SHORTS,flared:Om.PANTS,joggers:Om.PANTS,leggings:Om.PANTS,skinny:Om.PANTS,wide_leg:Om.PANTS},skirts:{a_line_flared:Om.SKIRTS,denim:Om.SKIRTS,knit:Om.SKIRTS,pencil:Om.SKIRTS,pleated:Om.SKIRTS,skater:Om.SKIRTS,slip:Om.SKIRTS,wrap:Om.SKIRTS},suits_and_tailoring:{blazers:Om.JACKETS,suit_jackets:Om.JACKETS,suit_skirts:Om.SKIRTS,suit_trousers:Om.PANTS,suit_vests:Om.SWEATERS,trousers:Om.PANTS},sweaters:{cardigans:Om.SWEATERS,crewnecks:Om.SWEATERS,hoodies_and_zipups:Om.SWEATERS,sweatshirts:Om.SWEATERS,turtlenecks:Om.SWEATERS,v_necks:Om.SWEATERS},tops:{bodysuits:Om.BLOUSES,corsets_and_bustiers:Om.BLOUSES,polos:Om.T_SHIRTS_AND_TANKS,shirts_and_blouses:Om.BLOUSES,t_shirts:Om.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Om.T_SHIRTS_AND_TANKS}};var Um;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Um||(Um={}));const zm={[Um.TOO_TIGHT]:"Too Tight",[Um.TIGHT]:"Tight",[Um.SLIGHTLY_TIGHT]:"Slightly Tight",[Um.PERFECT_FIT]:"Perfect Fit",[Um.SLIGHTLY_LOOSE]:"Slightly Loose",[Um.LOOSE]:"Loose",[Um.OVERSIZED]:"Oversized",[Um.TOO_SHORT]:"Too Short",[Um.SHORT]:"Short",[Um.SLIGHTLY_SHORT]:"Slightly Short",[Um.SLIGHTLY_LONG]:"Slightly Long",[Um.LONG]:"Long",[Um.TOO_LONG]:"Too Long"};var Bm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Bm||(Bm={}));var Vm=Object.freeze({__proto__:null,get AvatarState(){return Bm},get MeasurementLocation(){return Nm},MeasurementLocationName:xm,get Classification(){return Om},ClassificationLocations:Dm,CategoryNames:Pm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Mm,Taxonomy:Fm,get Fit(){return Um},FitNames:zm}),Hm="Back to sign in",jm="Click here to download the app",qm="Don't have an account?",$m="Whoops! Looks like you don't have an avatar yet.",Km="Email address",Wm="Please enter a valid email address.",Gm="Enter your email address, we will send you a link to reset your password.",Qm="Forgot password?",Ym="Have an account? Sign in",Jm="Your avatar is loading...",Xm="Unfortunately, that size is not available for try on.",Zm="or",ty="Password",ey="Please enter a valid password (at least 7 characters).",ny="Return to Catalog Page",iy="Return to Product Page",ry="Return to site",sy="Please return to The Fitting Room app to create your avatar.",oy="Scan to download the app",ay="Send",cy="Sign back in",ly="Sign in",uy="Something went wrong. Try again!",hy="You have successfully logged out!",dy="The Fitting Room",fy="Username or password is empty.",py="Username or password is incorrect.",gy="End size uncertainty with",my="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var yy=[],vy=[];function wy(t,e){if(t&&"undefined"!=typeof document){var n,i=!0===e.prepend?"prepend":"append",r=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(r){var o=yy.indexOf(s);-1===o&&(o=yy.push(s)-1,vy[o]={}),n=vy[o]&&vy[o][i]?vy[o][i]:vy[o][i]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),r=0;r<n.length;r++)t.setAttribute(n[r],e.attributes[n[r]]);var o="prepend"===i?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}wy(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});wy('#fit-title{margin-bottom:20px;margin-top:-30px}#fit-subtitle,#fit-title{color:#209da7;font-size:24px;font-weight:700}#fit-subtitle{position:absolute;right:17px;top:100px}#fit-subtitle-mobile{color:#7d7d7d;font-size:24px;font-weight:700;margin-top:20px}#fit-outline-container{display:flex;justify-content:center}#fit-outline-inner{position:relative}#fit-outline-inner,#tfr-fit-outline-img{width:184px}#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right,#tfr-fit-outline-img{height:701px}#fit-outline-inner-left,#fit-outline-inner-right{position:relative;width:260px}#fit-outline-container .fit-outline-line{display:block}.fit-outline-line{background:#000;height:1px;position:absolute}.fit-outline-line-text{border-bottom:1px solid #000;font-size:24px;position:absolute}.fit-outline-line-chest-text{left:-11px;text-align:right;top:163px;width:254px}.fit-outline-line-n-waist-text{left:-11px;text-align:right;top:208px;width:254px}.fit-outline-line-p-waist-text{right:-10px;text-align:left;top:233px;width:253px}.fit-outline-line-h-hip-text{left:-3px;text-align:right;top:255px;width:246px}.fit-outline-line-l-hip-text{left:-3px;text-align:right;top:302px;width:246px}.fit-outline-line-thigh-text{right:3px;text-align:left;top:341px;width:240px}.fit-outline-line-chest{left:42px;top:194px;width:99px}.fit-outline-line-n-waist{left:50px;top:239px;width:83px}.fit-outline-line-p-waist{left:45px;top:264px;width:93px}.fit-outline-line-h-hip{left:30px;top:286px;width:122px}.fit-outline-line-l-hip{left:21px;top:333px;width:141px}.fit-outline-line-thigh-l{left:27px;top:372px;width:60px}.fit-outline-line-thigh-r{left:95px;top:372px;width:61px}#fit-line-container{position:relative;width:100%}#fit-line-text-container{align-items:center;display:flex;justify-content:space-between}.fit-line-item{font-weight:700;width:110px}.fit-line-item .light-text{font-weight:500}.fit-line-item-green{color:#209da7}#fit-line{display:flex;justify-content:space-around;margin-bottom:4px;margin-top:30px}#fit-line-1,#fit-line-2,#fit-line-3,#fit-line-4,#fit-line-5,#fit-line-6,#fit-line-7{background:#000;height:2px;position:relative;width:110px}#fit-line-3,#fit-line-4,#fit-line-5{background:#209da7}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before,#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{background:#000;border-radius:50%;content:"";height:12px;position:absolute;top:-5px;width:12px}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before{left:0}#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{right:0}#fit-line-1:before,#fit-line-2:before,#fit-line-6:before,#fit-line-7:before{background:#000}#fit-line-3:before,#fit-line-5:before{background:#209da7}#fit-line-2:before,#fit-line-6:before{display:none}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after{border-left:2px dashed #000;content:"";display:block;height:20px;left:50%;position:absolute;top:-20px}#fit-line-3:after,#fit-line-4:after,#fit-line-5:after{border-left:2px dashed #209da7}#fit-line-texts{display:flex;justify-content:space-between;padding:0 70px}#fit-line-texts div:nth-of-type(2){color:#209da7}.margin-top-10{margin-top:10px}.desktop-hidden{display:none}#cta-link{cursor:pointer;font-size:20px;margin:auto;text-decoration:underline;width:150px}.powered-by{align-items:center;display:flex;justify-content:center;margin-top:10px}@media screen and (max-width:599px){#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right{height:586px}#fit-outline-inner{flex-shrink:0;overflow:hidden}#fit-title{margin-top:0}#fit-outline-container{margin-top:-50px;transform:scale(.85)}.fit-line-item{font-size:11px}.fit-outline-line-text{font-size:16px;line-height:31px}.fit-outline-line-chest-text,.fit-outline-line-n-waist-text{left:-11px;width:auto}.fit-outline-line-p-waist-text{right:-10px;width:auto}.fit-outline-line-h-hip-text,.fit-outline-line-l-hip-text{left:-3px;width:auto}.fit-outline-line-thigh-text{right:3px;width:auto}#fit-line{margin-top:10px}#fit-line-texts{font-size:12px;padding:0 15px}#fit-line-2:before,#fit-line-6:before,.desktop-hidden{display:block}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after,.mobile-hidden{display:none}}',{});wy(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:0 auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;max-height:100vh;max-width:850px;overflow:auto;width:100%}#tfr-close-container{padding-right:10px}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:350px;max-width:350px}.tfr-logo-box{display:flex;margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;justify-content:center}.tfr-qr-code{width:200px}.tfr-space-above{margin-top:10px}.tfr-max-w-600{margin:auto;max-width:600px}#tfr-qr-border-box{align-items:center;border:2px solid var(--tfr-brand-color);border-radius:16px;display:flex;flex-direction:column;height:350px;justify-content:center;margin-left:20px;padding:0 30px;width:300px}.tfr-mobile-logo{height:60px}#email-input,#password-input{font-size:16px}.tfr-door-icon,.tfr-user-icon{color:#209da7}.tfr-logged-in,.tfr-toggle-closed{display:none}.tfr-flex{display:flex}.tfr-gap{gap:4px}.tfr-items-center{align-items:center}.tfr-mb-2{margin-bottom:8px}#tfr-logged-out-overlay-container{position:relative}#tfr-logged-out-overlay{align-items:center;background:hsla(0,0%,100%,.8);bottom:0;display:flex;font-size:16px;font-weight:700;justify-content:center;left:0;line-height:16px;position:absolute;right:0;text-align:center;top:0}",{});wy("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});wy(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});wy("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto;margin:auto;width:100%}}@media screen and (max-width:599px){#tfr-size-recommendations{width:calc(100vw - 30px)!important}.tfr-mobile-hidden{display:none}.tfr-modal-content{overflow:hidden}.tfr-modal-content-container{max-height:none;max-width:100vw;min-height:100vh;min-width:100vw}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{overflow:auto}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}@media screen and (max-height:800px){.tfr-video-responsive{height:280px!important}}",{});wy("#tfr-size-recommendations{align-items:center;background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;flex-direction:column;font-family:var(--tfr-main-font);justify-content:center;padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations-container{align-items:center;display:none;flex-direction:column;justify-content:center;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column;font-size:13px;width:100%}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-info-icon{cursor:pointer}#tfr-size-rec-subtitle{border-bottom:2px solid #000;font-size:18px;font-weight:700;text-align:center;width:100%}#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;padding:0 10px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);justify-content:center;min-height:40px}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;padding-left:8px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px;padding-right:8px;text-align:left}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex;width:150px}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active):not(.tfr-disabled){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img,.tfr-powered-by-logo svg{height:24px;width:12px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}.tfr-disabled{cursor:default}#tfr-login-to-view{cursor:pointer}",{});wy(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px 10px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});wy(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});wy(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}.tfr-24-bold{font-size:24px;font-weight:700}",{});wy(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const by='\n<svg class="tfr-door-icon" width="68" height="124" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="currentColor">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n</path>\n</svg>',Sy='<svg class="tfr-user-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_82_11365)">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M4.3125 4.78125C4.3125 3.02084 5.73959 1.59375 7.5 1.59375C9.26041 1.59375 10.6875 3.02084 10.6875 4.78125C10.6875 6.54166 9.26041 7.96875 7.5 7.96875C5.73959 7.96875 4.3125 6.54166 4.3125 4.78125ZM9.625 4.78125C9.625 3.60764 8.6736 2.65625 7.5 2.65625C6.32639 2.65625 5.375 3.60764 5.375 4.78125C5.375 5.95485 6.32639 6.90625 7.5 6.90625C8.6736 6.90625 9.625 5.95485 9.625 4.78125Z"\n fill="currentColor" fill-opacity="0.7" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M2.1875 13.1634C2.1875 10.5693 4.58181 8.5 7.5 8.5C10.4182 8.5 12.8125 10.5693 12.8125 13.1634C12.8125 16.1539 2.1875 16.1539 2.1875 13.1634ZM11.75 13.1634C11.75 11.1933 9.86303 9.5625 7.5 9.5625C5.13697 9.5625 3.25 11.1933 3.25 13.1634C3.25 13.7564 4.45689 14.126 5.96113 14.2721L6.31312 14.3019C7.08543 14.3577 7.91457 14.3577 8.68688 14.3019L9.03887 14.2721C10.5431 14.126 11.75 13.7564 11.75 13.1634Z"\n fill="currentColor" fill-opacity="0.7" />\n </g>\n <defs>\n <clipPath id="clip0_82_11365">\n <rect width="16" height="16" fill="white" />\n </clipPath>\n </defs>\n</svg>',Ey=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const i=t/200;e.style.width=n+"%";const r=setInterval((()=>{n>=100?clearInterval(r):(n+=.5,e.style.width=n+"%")}),i)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Jm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),_y=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let i;const r=t=>t?`\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${gy}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${dy}</div>\n </div>\n </div>\n `:"",s=()=>{n.style.overflow="auto",i&&(i.Unhook(),l()),e.style.display="none"},o=t=>{"Escape"===t.key&&s()},a=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),s())},c=()=>{e.querySelector("#tfr-close-container").addEventListener("click",s),document.addEventListener("keydown",o),document.addEventListener("click",a)},l=()=>{var n;const i=e.querySelector("#tfr-close-container");i?i.removeEventListener("click",s):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",o),document.removeEventListener("click",a)};return{open:t=>{var s,o;n.style.overflow="hidden",i&&i.Unhook(),e.innerHTML=(s=t.Body(),o=t.useFullModalContent,console.log({useFullModalContent:o}),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">&times;</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n ${r(o)}\n ${s}\n </div>\n </div>\n </div>\n </div>\n `),c(),t.Hook(),e.style.display="block",i=t},close:s,Content:()=>i}},Ty=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},i=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},r=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")},s="https://assets.dev.thefittingroom.xyz/images/";return{Hook:()=>{var t,s,o;if(e||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),e){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(s=document.getElementById("tfr-app-store"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",i),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",r)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${my}</div>\n \n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls loop autoplay playsinline>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n\n ${e?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${oy}</div>\n \n <img src="${s}qr.png" class="tfr-qr-code" />\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Ym}</div>\n </div>`}\n </div>\n\n ${e?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${jm}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n <img class="tfr-mobile-logo" src="${s}apple.png" id="tfr-app-store" />\n <img class="tfr-mobile-logo" src="${s}google.png" id="tfr-google-play" />\n </div>\n \n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Ym}</div>\n `:""}\n `,useFullModalContent:!0}};class Iy{constructor(t,e,n,i){this.signIn=e,this.forgotPassword=n,this.submitTel=i,this.manager=_y(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,i;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${hy}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${cy}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${ry}</span>\n </div>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${$m}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${sy}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}onLoading(){this.manager.open(Ey({timeoutMS:1e4}))}toScan(){this.manager.open(Ty({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,i=document.getElementById("password-input").value;s(),t.onSignIn(n,i,o)},i=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},r=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",r)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${ly}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Km}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${ty}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${Qm}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${qm}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${ly}\n </button>\n </form>\n `,useFullModalContent:!0}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,i;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.addEventListener("click",e)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Gm}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Km}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Hm}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${ay}\n </button>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const i=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",i),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",r)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${iy}</span>\n </div>\n `,useFullModalContent:!0}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",i)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",i)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||uy}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${iy}</span>\n </div>\n `),useFullModalContent:!0}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,i;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>{var e,n,i;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${Xm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Zm} ${null===(i=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===i?void 0:i.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${iy}</span>\n </div>\n `},useFullModalContent:!0}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}toFitInfo(){this.manager.open((t=>{const e=()=>t.onSignInNav();return{Hook:()=>{document.getElementById("cta-link").addEventListener("click",e)},Unhook:()=>{document.getElementById("cta-link").removeEventListener("click",e)},Body:()=>`\n <div>\n <div id="fit-title">Fit Scale</div>\n\n <div id="fit-line-container">\n <div id="fit-line-text-container">\n <div class="fit-line-item mobile-hidden">Too Tight</div>\n\n <div class="fit-line-item">\n <div>Tight <span class="light-text">or</span><br /> More fitted</div>\n\n <div class="desktop-hidden margin-top-10">Too Tight</div>\n </div>\n\n <div class="fit-line-item fit-line-item-green">Slightly tight <br /><span class="light-text">or</span> Fitted</div>\n <div class="fit-line-item fit-line-item-green">Perfect Fit</div>\n <div class="fit-line-item fit-line-item-green">Slightly loose <br /><span class="light-text">or</span> Less fitted</div>\n\n <div class="fit-line-item">\n <div>Loose <span class="light-text">or</span><br /> Not fitted</div>\n\n <div class="desktop-hidden margin-top-10">Oversized</div>\n </div>\n\n <div class="fit-line-item mobile-hidden">Oversized</div>\n </div>\n\n <div id="fit-line">\n <div id="fit-line-1" class="mobile-hidden">&nbsp;</div>\n <div id="fit-line-2">&nbsp;</div>\n <div id="fit-line-3">&nbsp;</div>\n <div id="fit-line-4">&nbsp;</div>\n <div id="fit-line-5">&nbsp;</div>\n <div id="fit-line-6">&nbsp;</div>\n <div id="fit-line-7" class="mobile-hidden">&nbsp;</div>\n </div>\n\n <div id="fit-line-texts">\n <div>Poor Fit</div>\n <div>Acceptable Fit</div>\n <div>Poor Fit</div>\n </div>\n </div>\n\n <div id="fit-subtitle-mobile" class="desktop-hidden">Measurement&nbsp;Points</div>\n\n <div id="fit-outline-container">\n <div id="fit-outline-inner-left">\n <div class="fit-outline-line-text fit-outline-line-p-waist-text">Pant&nbsp;Waist</div>\n <div class="fit-outline-line-text fit-outline-line-thigh-text">Thigh</div>\n </div>\n\n <div id="fit-outline-inner">\n <div class="fit-outline-line fit-outline-line-chest"></div>\n <div class="fit-outline-line fit-outline-line-n-waist"></div>\n <div class="fit-outline-line fit-outline-line-p-waist"></div>\n <div class="fit-outline-line fit-outline-line-h-hip"></div>\n <div class="fit-outline-line fit-outline-line-l-hip"></div>\n <div class="fit-outline-line fit-outline-line-thigh-l"></div>\n <div class="fit-outline-line fit-outline-line-thigh-r"></div>\n\n <img id="tfr-fit-outline-img" src="https://assets.dev.thefittingroom.xyz/images/fit-outline.png" />\n </div>\n\n <div id="fit-outline-inner-right">\n <div id="fit-subtitle" class="mobile-hidden">Measurement&nbsp;Points</div>\n\n <div class="fit-outline-line-text fit-outline-line-chest-text">Chest/Bust</div>\n <div class="fit-outline-line-text fit-outline-line-n-waist-text">Natural&nbsp;Waist</div>\n <div class="fit-outline-line-text fit-outline-line-h-hip-text">High&nbsp;Hip</div>\n <div class="fit-outline-line-text fit-outline-line-l-hip-text">Low&nbsp;Hip</div>\n </div>\n </div>\n </div>\n\n <div id="cta-section">\n <div id="cta-link">Sign Up or Login</div>\n\n <div class="powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${by}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n `,useFullModalContent:!1}})({onSignInNav:()=>this.toScan(),onClose:()=>this.close()}))}navBack(){window.history.back()}}class ky{constructor(t,e,n,i){this.onSignInClick=e,this.onSignOutClick=n,this.onFitInfoClick=i,this._sku="",this.isLoggedIn=!1,this.tfrLoggedInElements=[],this.tfrLoggedOutElements=[],this.tfrToggleOpenElements=[],this.tfrToggleClosedElements=[],this.isCollapsed=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",t?(this.tfrSizeRecSelect.style.opacity="1",this.tfrLoggedInElements.forEach((t=>t.style.display="block")),this.tfrLoggedOutElements.forEach((t=>t.style.display="none")),this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down")):(this.tfrSizeRecSelect.style.opacity="0.4",this.tfrLoggedInElements.forEach((t=>t.style.display="none")),this.tfrLoggedOutElements.forEach((t=>t.style.display="block")),this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.renderSizeRecSelectLoggedOut())}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){t&&t.length?this.renderGarmentLocations(t):this.tfrSizeRecTitle.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e)}setError(){this.tfrSizeRecTitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeHowItFits=document.getElementById("tfr-size-how-it-fits"),this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrInfoIcon=document.getElementById("tfr-info-icon"),this.tfrLoginToView=document.getElementById("tfr-login-to-view"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container"),this.tfrLoggedInElements=document.querySelectorAll(".tfr-logged-in"),this.tfrLoggedOutElements=document.querySelectorAll(".tfr-logged-out"),this.tfrToggleOpenElements=document.querySelectorAll(".tfr-toggle-open"),this.tfrToggleClosedElements=document.querySelectorAll(".tfr-toggle-closed")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this)),this.tfrInfoIcon.addEventListener("click",this.onFitInfoClick),this.tfrLoginToView.addEventListener("click",this.onSignInClick)}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button")||e.classList.contains("tfr-disabled"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const i=document.querySelectorAll(".tfr-size-rec-select-button");i.forEach((t=>t.classList.remove("active"))),i.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=`&nbsp;${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],i=n.map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=i}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecSelectLoggedOut(){const t=['<div class="tfr-size-rec-select-button tfr-disabled">M</div>','<div class="tfr-size-rec-select-button tfr-disabled active">L</div>','<div class="tfr-size-rec-select-button tfr-disabled">XL</div>'].join("");this.tfrSizeRecSelect.innerHTML=t}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderGarmentLocations(t){const e=t.map(((t,e)=>this.renderSizeRecTableRow(t,this.randomFit(e),!0))).join(""),n=`<div id="tfr-logged-out-overlay-container">\n <div id="tfr-logged-out-overlay">\n Login to reveal how this item will fit specifically at each area of your body in different sizes\n </div>\n <div>\n ${e}\n </div>\n </div>`;this.tfrSizeRecTable.innerHTML=n}randomFit(t){const e=["Slightly Tight","Perfect Fit","Perfect Fit","Slightly Loose","Perfect Fit"];return e[t%e.length]}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrToggleOpenElements.forEach((t=>t.style.display="block")),this.tfrToggleClosedElements.forEach((t=>t.style.display="none"))):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrToggleOpenElements.forEach((t=>t.style.display="none")),this.tfrToggleClosedElements.forEach((t=>t.style.display="block")))}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div class="tfr-logged-out">\n <div class="tfr-flex tfr-gap tfr-mb-2">\n <div>Uncertain of your size?</div>\n \n <div class="tfr-toggle-closed">\n <div class="tfr-flex tfr-items-center">\n <div>Try</div>\n <div class="tfr-powered-by-logo">${by}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n\n <div class="tfr-toggle-open">\n <div id="tfr-login-to-view" class="tfr-flex tfr-items-center">\n ${Sy} Login to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-logged-in">\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n ${Sy} Sign up to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-toggle-open" style="width: 100%">\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n\n <div id="tfr-size-rec-subtitle">\n How it fits\n <span id="tfr-info-icon"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<rect width="13" height="13" fill="url(#pattern0_641_1375)"/>\n<defs>\n<pattern id="pattern0_641_1375" patternContentUnits="objectBoundingBox" width="1" height="1">\n<use xlink:href="#image0_641_1375" transform="scale(0.00793651)"/>\n</pattern>\n<image id="image0_641_1375" width="126" height="126" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAB+CAYAAADiI6WIAAAAAXNSR0IArs4c6QAADKtJREFUeF7tnc2S2zYSgLuh9VwzeYJVniDjJ7Asb06p8mhqj6nKDFN7j/wEkp/A4/MeqMllj9L4umWJfgIrT2D5CaK9ZlfATlOkLWn0g8aPCJLSJakxSIL4uhvdjQaIULFfKx42AeCiIcRflYImgDpXAE0E+n8ASP+25YcwUwrmgDAXAHMFOEOE2ULK358AzP8dXU2rNFRY5pdpxcNzAGgJFM8Q1IVScAEA9Dcfv7lCmCLgVCr5AQCmSXQ18/GgY9yzdOD/Fg9bEsWlUqqFkIIu7KcApoiYSCXvk+gqKawjBg8uBfgcNih141GjDYZv7RLS/kSCuiuDEAQLnsz4w1zbBcTrnfOyLSp/189QYH8h5YdQp4PgwC+1O4XdCVi7OSIzkKBehyYAwYAn4AqxpxS0OKNaorZBCUDh4Cn8aiDGFQa+KZtBCEBh4LM5vA+Av5ZIa112tVABKAR8Ox7eAOCbiszhNsKQOoHvry/vbG5icu1RwdfQrOsyObr2Hw18Kx7eiJOW7xOEo2q/d/AFzeWUTJkCpvn2qQScK7n4LM7O/pB//vmfJLqarxJI+3h29k1jsUjz+FKl6d8mKnUhV/P8uvpr1Q5vJUgK/9b6aHXLLRd7BU+mXQBOIF8gcd377H556lQhJkouKGnidNBIMFA0nqFSrSOlimcS1HOfsb838GkiBnDoy4FTAIkQOFpISSlSp6APyWe2AthqAF4/9MNX3oHgR77Sv17At+NhN/PaD40h698VwEwBDgDk22PD3tXRXAgQsPdl6Zf1VvsbZ1m/vsNbprdyDr4dDyk277nsKGk3NER/8vNLWg4N9vf87t2lkLLr2gr4gO8UvGvoZQG+KYk//PbumVzIvksBcA3fGXiX0MsKfJsA/G8hB66mAJfwnYB3CH0uAftJdPk2WHtu0DHKYbjyAVzBtwbvCjppuVp6saUtZ9onE2loi9gDBVRMYvVzAd8KvCPoldTyPVFAVyydX8vaQPVqHF3dmkqQMfgsTqfkjPFvGZ75TVQYd87jhaT9CDixnfuzJI9RrZ8ReEcZuVGWoDhq8sUjT9atl6lsjB9Sy1RpZPqbS1BPTaZHNviswx9t0rCZA/fa9G2rdF07vu89FPvbJGgow0fwWQrEBt+Oh7c2xRMn6I/F1h4+3o6jy1cchWCBzwooyDwZ/U7Qdw+bLXyp8Cb5Rb+gQxu87bx+gn5YVyzhs+Z7bfDtwSg2jUFP0A9Dz1vYwKdcyCTqPNd5mhZ4GxNfJPTmP//VAgHskBPVWfPTP/7+WWcAfbSxgY8Cb3Rq+A6CtzTxo3HUufIxODr3LCt4erd2PKJaBpNQj0z+d4e8/IPgTU18lpxhhxk6QHXblBl8WvUD+NEsyXPYy98LPtP2T7oDvdKO5WgY3F/rkjKDpxfMxp9yJuz0bqb1O9c99oI31faH4sZuCCtsZQefwafcPu1BYP0OOXo7wVto+2AcdSJWLz01rgJ4GpoX8WhiUtSxL5e/E7yJtoe26FIV8KYmf5/WbwVvqu1S4E1SwHagXQajKuBtTP4urd8K3lTbJ1HnO09W2+i2VQJvYfK3Tr2PwJtqu2qIVmhVsFUDb1gDsTWufwTeJEt3yIM0UlcHF1UNvKnWS4H95PpybRl8C/gRxe3bz4LbASNEbaeuVhG8odbPxhvT8Bp4k5uGqu0ODEawtzAJ7zadvDXwRk6dEJ3J9cv7YEepgh0zUVBAvB3ffC3WWAcf88w8xe2hefIV5Lz1lZ7Ho0/MPP58HHW+zW/2BbyJFIUWt9cFOr1n++6+B5JXq7dq7r+Abw/u34BSXc7gHVoI4Nzr1JY3AlnR6x+sq1bM/RfwL+LRR8U4G/bk1LGG3EtjrpNHB0hMos5T6kwK3iRpUwYzn4ZzDWAXh6I8axVZgaMrJS/u7n9VUrF200hQ31KRRgr+RTzsqOXpFdq/Mpj5Ksbxq4BMzL3KorAUPHd+XzUZ2pJSQMOqg88yeawpOg/rlho/GE1YR4puxIQFMNV6ZB3AGyhtWom71Ph4RN6hdnlPbi60Rr/ARnUAbzBNp/E8tuLhhQCkui7tX+4gaF9QUMM6gDeZ5+HsSRO5iZsyZevqAH7po40+cT7mQBYbuSFBmeL3GoEfZh920LKtKLCLXOdgM9mv9aSCGtUHPDPriniL7cGILS3vr8txOFFtwC+PgeckqgbIDeVCLbrYZlTqAp7r2dN0jewcfYC1dbtmkrqAN4jMZmTqWR4hhQLjn34sbCcpx12oEXg6JZyz1W2G7XikOINZlhie3qlG4OkgJdYSLRv8OOoc3GHLESSfbesCPsu+shT4BH6L5BV9MIKJMnAt9wn8CbyenJ1Mvd44HbuVd40/OXfHRnr4eSYLNadwrgKm3qB0jh/HZ8dnTg/LYfEt6uLVG6ywTvkp2xLtnDmB3658acqWu21K9xy14vW9Pgkc7tI6AIxOy7IVmONNltbZhRgkLUUeWsixJHUx9dwV1rQQg7ukBwCP9lpzYByzbV3At7mbXRuiRcWW3JUdKEssXwfwJjE8RWan8uqSz/EGFntZXk3vzd18V5a6uzpoPNexy4tlT1uoSq/xvF3O61uozDZNprsuj+mscZ9VdY038c/WNk2aOAgUEoRebVt18CZH0+W7nCt9MELVwXPj90cHI6SlO2ZHoQRt7qsM3sTMrzrltocfPToxkTsP+2xfZfAmZn51T8TmcWes7dKhZ/GqDd7uaLqNAw6Ze7AAKIv3PImujD5s61Pbq1xebZC0oeFYO8W60keaVlXjuU4dUd/c+vb4EGPuzpqAtb6K4LnVNin0LSeQPgZvcGJiqHvmqwjeRNu3HU237UMFtB2H9mFpn4lDUhXiXF818CbanrGhDxCufYrM5adJtL9r6tupy+9fNfDcdfdsHPQ+TUKNTSULQL0aR1eskxZ9CkGVwJvE7bu0nf6+cwMke6l2STCIL0xWTeMtvu+78xuAO8Gban1Ijl5VNJ5bCZ0L/r5jZ/dueTbUegoggjD5VQDfjoddMPjE6GbCZnNK3QveaCEgIJNfdvCmX5jcN7fnAnDwkIN2fP8GgPcBg+zms2y7VWHFGmUGn9VI0ImjrC+C7fPkV7X+IPisA+y4PntIoTX4ZQbfjkd0jHyHG/Xoft/3IHh6cCse3gjeOWpf+itBvU6iqz73BVy0Lyv4djzsA2DPZAx0PyChBZ46YO7opVm9QuCXEbwN9EMOHcvU541tHI3M2Tg6/LKBt4Gua+K1nbtVKbEx+UXBNzGXRVxjAz0dW+Yn3LVNfT4YFl5+eouizH4RMHWfaQsdAG/H0devSOo8lw2evHwE/Mj8yuFaX07wvw6HLfTMxD/l7nFgg8+8fNpoSTEma+l2QxJHElTE7bCONJehTRYm04nT7JAtfz/uvG7k3G0Opmkuf+M+lOShmr21teIygLPpo8Wiy9pjbU4SN9L4FU+/K8zyyKsvMAdQr0NazrWBeujaLPdOMbqNtQQJ2E+iy9eHnrfr363A003b8X3voarLRYJmkM39ldR+0vIGYsz6zNsOarbQ6bbW4B3Dn6HA/vvryztTSQ7xOldavoyK7DQ9Hx8n4B3Dp9vR3E+OX5D1+rrCRX6QQuy50HKX0J1pfD4QDs1+ekuFkCiVpntLJQCugbuG7hy8B81fFYC3SXQ10tW2Itr5AO4DuhfwvuBnIFMfYCHlh1BCwGU8DlQlc224dr5XRiVgN4ncf/XL2Ry/2XuS/gVgbJPh2zciNA0IxEERQkCwG0Jcg1IdV/P3lnedq4boTH5++cGH9fIGnjpLIQwCTnzBzweENvwjYiKVpEFKXGcDCTS9jkDxTCnVQoALHzBW3memPCe2vILP4J8LEBTrd30O1sa9ZwphhoBTRJgtpPw9nyqoBHxTMDKw508Azv8L0BSUXEHxPYJqKoKsjMqfDF8XbyVIcmi9lqx5B5+/PS3pImDPt/YbjnYIl82lwm7yy3FyGEcDn5t+gdgDBTchjHQofaC9CGqZtzha1vKo4E/a/0jU5lJgNykgU1kI+JP2p5H0UebyXVatMPAr2t+sk/kvwqxvg184+LoIAAGHhuj7isu5/kow4CsqABSSjVRDDEIBno9zcOBXBYCSJiUNAWcScAAgaX3BazzO1fTgwa++0A+/vXu2kPKG0qMB5wHmgDhQAkehaXfQc7yu5C6FgHLk/lOnh/qUp4rLAnv1fYI19YcGPQ8JUTS+RxICpS7S9KplLdue584z0FOFmCi5oBXCIM24ztiVGvy2F2zFw4snjcY3kgSBcuxKNRHgXAKc03/3LJ2mWTMEmFHZMiDOKc8vAWf4l8Z0/NOPn3UGtCxt/g+79EmQczmdsgAAAABJRU5ErkJggg=="/>\n</defs>\n</svg>\n</span>\n </div>\n\n <div id="tfr-size-rec-table"></div>\n </div>\n </div>\n\n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Log out</div>\n </div>\n\n <div class="tfr-toggle-open">\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${by}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Cy{constructor(t,e,n,i,r,s){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.perfectFits=[Vm.Fit.PERFECT_FIT,Vm.Fit.SLIGHTLY_LOOSE,Vm.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new ky(t,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:"string"==typeof t.fit_label&&t.fit_label?t.fit_label:Vm.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(t.measurement_location)}))).sort(((t,e)=>t.sortOrder<e.sortOrder?-1:1))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var Ay;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Ay||(Ay={}));class Ry{constructor(t,e,n,i={},r,s){this.shopId=t,this.hooks=i,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",o),this.tfrModal=new Iy(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),zd.getInstance().setEnv(e),new Lm(t,new Cm)))(Number(this.shopId),o),this.tfrSizeRec=new Cy(n,r,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var i;if(0==t.length||0==e.length)return n(fy);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Wm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(ey);try{await this.tfrShop.user.login(t,e),(null===(i=this.hooks)||void 0===i?void 0:i.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(py)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(uy)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onFitInfoClick(){this.tfrModal.toFitInfo()}onUserProfileChange(t){var e,n,i,r;switch(t.avatar_status){case Ay.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError($m),this.tfrModal.onNotCreated();break;case Ay.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Ay.CREATED:(null===(i=this.hooks)||void 0===i?void 0:i.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(r=this.hooks)||void 0===r?void 0:r.onError)&&this.hooks.onError(uy),this.tfrModal.onError(uy)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),i=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(i)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const Ly=async(t,e,n,i={},r={},s="dev")=>{const o=new Ry(t,e,n,i,r,s);return await o.onInit(),o};export{n as InitImageSlider,Ly as initFittingRoom};