@thefittingroom/shop-ui 3.0.0-alpha-2 → 3.0.0-alpha-4

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 v3.0.0-alpha-2 (2025-01-17T20:01:07.850Z)
2
+ * thefittingroom v3.0.0-alpha-4 (2025-01-20T23:29:36.706Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
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)}}};
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);i.value=(0).toString(),i.max=(t.length-1).toString();const r=()=>{const e=parseInt(i.value);n(i,t[e])};return n(i,t[0]),i.removeEventListener("input",r),i.addEventListener("input",r),()=>{i.removeEventListener("input",r)}}}},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 v2.0.0-alpha-1 (2025-01-17T20:00:16.432Z)
8
8
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
@@ -137,7 +137,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
137
137
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138
138
  * See the License for the specific language governing permissions and
139
139
  * limitations under the License.
140
- */function T(t){return t&&t._delegate?t._delegate:t}class I{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
140
+ */function I(t){return t&&t._delegate?t._delegate:t}class T{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
141
141
  /**
142
142
  * @license
143
143
  * 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 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}
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",It="@firebase/vertexai-preview",Tt="@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",[Tt]:"fire-fst-compat",[It]:"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 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})}}
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 T("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 Ft{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 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"))}
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 T(`${r}-version`,(()=>({library:r,version:e})),"VERSION"))}
271
271
  /**
272
272
  * @license
273
273
  * Copyright 2021 Google LLC
@@ -315,7 +315,7 @@ class Ft{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="",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","");
318
+ */var Zt;Zt="",Ot(new T("platform-logger",(t=>new X(t)),"PRIVATE")),Ot(new T("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
@@ -397,7 +397,7 @@ const ie=()=>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 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";
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 Ie(){}function Te(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function 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(Te(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",Ie,e),_e.removeEventListener("test",Ie,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[" "]=Ie;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),In={};function Tn(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++)Tn(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 In?In[t]:In[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=Tn(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 Ii(){}function Ti(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(Ii,yi),Ii.prototype.g=function(){return new XMLHttpRequest},Ii.prototype.i=function(){return{}},bi=new Ii;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(Te(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Te(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var 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(Te(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=Ti.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 Ir(t,e){Pn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Tr,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 Ir(this.l,this.j)},_r.prototype.i=function(t){return function(){return t}}({}),Oe(Ir,Pn);var Tr=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=Ir.prototype).open=function(t,e){if(this.readyState!=Tr)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=Tr},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(Ir.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]?Ie: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 Ti(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 Ti(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 Ti(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 Ti(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
@@ -413,7 +413,7 @@ const ie=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
413
413
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
414
414
  * See the License for the specific language governing permissions and
415
415
  * limitations under the License.
416
- */class Ts{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}Ts.UNAUTHENTICATED=new Ts(null),Ts.GOOGLE_CREDENTIALS=new Ts("google-credentials-uid"),Ts.FIRST_PARTY=new Ts("first-party-uid"),Ts.MOCK_USER=new Ts("mock-user");
416
+ */class Is{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}Is.UNAUTHENTICATED=new Is(null),Is.GOOGLE_CREDENTIALS=new Is("google-credentials-uid"),Is.FIRST_PARTY=new Is("first-party-uid"),Is.MOCK_USER=new Is("mock-user");
417
417
  /**
418
418
  * @license
419
419
  * Copyright 2017 Google LLC
@@ -430,7 +430,7 @@ const ie=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
430
430
  * See the License for the specific language governing permissions and
431
431
  * limitations under the License.
432
432
  */
433
- let Is="9.15.0";
433
+ let Ts="9.15.0";
434
434
  /**
435
435
  * @license
436
436
  * 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(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}
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 (${Ts}): ${t}`,...n)}}function Rs(t,...e){if(ks.logLevel<=de.ERROR){const n=e.map(Ns);ks.error(`Firestore (${Ts}): ${t}`,...n)}}function Ls(t,...e){if(ks.logLevel<=de.WARN){const n=e.map(Ns);ks.warn(`Firestore (${Ts}): ${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 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}
481
+ */function xs(t="Unexpected state"){const e=`FIRESTORE (${Ts}) 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
@@ -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 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)}}
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(Is.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=Is.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 Is(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=Is.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(Is.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
@@ -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 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)}
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 Io(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=Eo(t.mapValue.fields.__local_write_time__.timestampValue);return new Ys(e.seconds,e.nanos)}
787
+ */function To(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ko(t){const e=t.mapValue.fields.__previous_value__;return To(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
@@ -800,7 +800,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
800
800
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
801
801
  * See the License for the specific language governing permissions and
802
802
  * limitations under the License.
803
- */const Ao={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Ro(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?Io(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
803
+ */const Ao={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Ro(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?To(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
804
804
  /**
805
805
  * @license
806
806
  * Copyright 2022 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: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}
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 Io(t.bytesValue).isEqual(Io(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=Io(t),i=Io(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?Io(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
@@ -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=[],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()}}
964
+ */class Ia{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 Ta(t){return new Ia(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 Ia(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Oa(t,e,n){return new Ia(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
@@ -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 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}
1061
+ */const Ec=new ua(no.comparator);function _c(){return Ec}const Ic=new ua(no.comparator);function Tc(...t){let e=Ic;for(const n of t)e=e.insert(n.key,n);return e}function kc(t){let e=Ic;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
@@ -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 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)}
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 Ia(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
@@ -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(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()}}
1189
+ */class Il{constructor(){this.Je=new Tl}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 Tl{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,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}))}}
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=Tc();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=Tc();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const i=e.collectionGroup;let r=Tc();return this.indexManager.getCollectionParents(t,i).next((s=>lo.forEach(s,(s=>{const o=function(t,e){return new Ia(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=Tc();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
@@ -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 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)])}}
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 Il,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
@@ -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,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}
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/"+Ts,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
@@ -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,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)
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 Iu(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 Tu(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 Tu(t,e)}}async function Tu(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=>Tu(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 Tu(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: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
1589
+ */}(t.datastore,t.asyncQueue,{Yr:Eu.bind(null,t),Zr:_u.bind(null,t),Wo:Iu.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
@@ -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,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}}
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=Tc(),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
@@ -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!==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)}}
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(Ta(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(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}
1701
+ */function Ih(t,e,n){if(!n)throw new Ms(Ps.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Th(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
@@ -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 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=
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=Is.MOCK_USER;else{e=
1734
1734
  /**
1735
1735
  * @license
1736
1736
  * Copyright 2021 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
- */(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))}}
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 Is(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 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))}}
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,Ta(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new 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),Ih("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()),Ih("doc","path",e),t instanceof Nh){const i=Zs.fromString(e,...n);return Th(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 Th(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
@@ -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,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}
1830
+ */class zh{constructor(t,e,n,i){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=i,this.user=Is.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
@@ -2003,7 +2003,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
2003
2003
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2004
2004
  * See the License for the specific language governing permissions and
2005
2005
  * limitations under the License.
2006
- */function vd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Ms(Ps.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class wd{}class bd extends wd{}function Sd(t,e,...n){let i=[];e instanceof wd&&i.push(e),i=i.concat(n),function(t){const e=t.filter((t=>t instanceof Td)).length,n=t.filter((t=>t instanceof Ed)).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(...)))`.")}
2006
+ */function vd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Ms(Ps.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class wd{}class bd extends wd{}function Sd(t,e,...n){let i=[];e instanceof wd&&i.push(e),i=i.concat(n),function(t){const e=t.filter((t=>t instanceof Id)).length,n=t.filter((t=>t instanceof Ed)).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(...)))`.")}
2007
2007
  /**
2008
2008
  * @license
2009
2009
  * Copyright 2020 Google LLC
@@ -2019,7 +2019,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
2019
2019
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2020
2020
  * See the License for the specific language governing permissions and
2021
2021
  * limitations under the License.
2022
- */(i);for(const e of i)t=e._apply(t);return t}class Ed extends bd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Ed(t,e,n)}_apply(t){const e=this._parse(t);return Cd(t._query,e),new Dh(t.firestore,t.converter,xa(t._query,e))}_parse(t){const e=rd(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){kd(o,s);const e=[];for(const n of o)e.push(Id(i,t,n));a={arrayValue:{values:e}}}else a=Id(i,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||kd(o,s),a=function(t,e,n,i=!1){return od(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 _d(t,e,n){const i=e,r=yd("where",t);return Ed._create(r,i,n)}class Td extends wd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Td(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)Cd(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 Id(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 kd(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 Cd(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 Ad{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 Xh(_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}}
2022
+ */(i);for(const e of i)t=e._apply(t);return t}class Ed extends bd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Ed(t,e,n)}_apply(t){const e=this._parse(t);return Cd(t._query,e),new Dh(t.firestore,t.converter,xa(t._query,e))}_parse(t){const e=rd(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){kd(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||kd(o,s),a=function(t,e,n,i=!1){return od(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 _d(t,e,n){const i=e,r=yd("where",t);return Ed._create(r,i,n)}class Id extends wd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Id(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)Cd(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 kd(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 Cd(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 Ad{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(Io(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 Xh(_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}}
2023
2023
  /**
2024
2024
  * @license
2025
2025
  * Copyright 2020 Google LLC
@@ -2068,7 +2068,7 @@ class Rd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2068
2068
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2069
2069
  * See the License for the specific language governing permissions and
2070
2070
  * limitations under the License.
2071
- */function Dd(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=>zd(e,t,n)))}class Pd extends Ad{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 Md(t){t=Ah(t,Dh);const e=Ah(t.firestore,$h),n=Kh(e),i=new Pd(e);return vd(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 xd(e,i,t,n)))}function Fd(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,[sd(rd(i),"setDoc",t._key,r,null!==t.converter,n).toMutation(t._key,nc.none())])}function Ud(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](zd(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 Pd(l);c={next:t=>{e[o]&&e[o](new xd(l,i,n,t))},error:e[o+1],complete:e[o+2]},vd(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 zd(t,e,n){const i=n.docs.get(e._key),r=new Pd(t);return new Ld(t,r,e._key,i,new Rd(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")}();
2071
+ */function Dd(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(Ta(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=>zd(e,t,n)))}class Pd extends Ad{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 Md(t){t=Ah(t,Dh);const e=Ah(t.firestore,$h),n=Kh(e),i=new Pd(e);return vd(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 xd(e,i,t,n)))}function Fd(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,[sd(rd(i),"setDoc",t._key,r,null!==t.converter,n).toMutation(t._key,nc.none())])}function Ud(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=Ta(t._key.path),c={next:n=>{e[o]&&e[o](zd(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 Pd(l);c={next:t=>{e[o]&&e[o](new xd(l,i,n,t))},error:e[o+1],complete:e[o+2]},vd(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 zd(t,e,n){const i=n.docs.get(e._key),r=new Pd(t);return new Ld(t,r,e._key,i,new Rd(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Ts=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")}();
2072
2072
  /**
2073
2073
  * @license
2074
2074
  * Copyright 2020 Google LLC
@@ -2085,7 +2085,7 @@ class Rd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2085
2085
  * See the License for the specific language governing permissions and
2086
2086
  * limitations under the License.
2087
2087
  */
2088
- Vt("firebase","10.13.0","app");class Bd{constructor(){}static getInstance(){return Bd.instance||(Bd.instance=new Bd),Bd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Hd.firebase:Vd.firebase}get api(){return"prod"===this.env?Hd.api:Vd.api}get config(){return"prod"===this.env?Hd.config:Vd.config}}const Vd={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Hd={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 jd=1e3,qd=6e4,$d=36e5,Kd="millisecond",Wd="second",Gd="minute",Qd="hour",Yd="day",Jd="week",Xd="month",Zd="quarter",tf="year",ef="date",nf="Invalid Date",rf=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,sf=/\[([^\]]+)]|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,of={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])+"]"}},af=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},cf={s:af,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+af(i,2,"0")+":"+af(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,Xd),s=n-r<0,o=e.clone().add(i+(s?-1:1),Xd);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:Xd,y:tf,w:Jd,d:Yd,D:ef,h:Qd,m:Gd,s:Wd,ms:Kd,Q:Zd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},lf="en",uf={};uf[lf]=of;var hf="$isDayjsObject",df=function(t){return t instanceof mf||!(!t||!t[hf])},ff=function t(e,n,i){var r;if(!e)return lf;if("string"==typeof e){var s=e.toLowerCase();uf[s]&&(r=s),n&&(uf[s]=n,r=s);var o=e.split("-");if(!r&&o.length>1)return t(o[0])}else{var a=e.name;uf[a]=e,r=a}return!i&&r&&(lf=r),r||!i&&lf},pf=function(t,e){if(df(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new mf(n)},gf=cf;gf.l=ff,gf.i=df,gf.w=function(t,e){return pf(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var mf=function(){function t(t){this.$L=ff(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[hf]=!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(gf.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(rf);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 gf},e.isValid=function(){return!(this.$d.toString()===nf)},e.isSame=function(t,e){var n=pf(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return pf(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<pf(t)},e.$g=function(t,e,n){return gf.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=!!gf.u(e)||e,r=gf.p(t),s=function(t,e){var r=gf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return i?r:r.endOf(Yd)},o=function(t,e){return gf.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 tf:return i?s(1,0):s(31,11);case Xd:return i?s(1,c):s(0,c+1);case Jd:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(i?l-d:l+(6-d),c);case Yd:case ef:return o(u+"Hours",0);case Qd:return o(u+"Minutes",1);case Gd: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,i=gf.p(t),r="set"+(this.$u?"UTC":""),s=(n={},n[Yd]=r+"Date",n[ef]=r+"Date",n[Xd]=r+"Month",n[tf]=r+"FullYear",n[Qd]=r+"Hours",n[Gd]=r+"Minutes",n[Wd]=r+"Seconds",n[Kd]=r+"Milliseconds",n)[i],o=i===Yd?this.$D+(e-this.$W):e;if(i===Xd||i===tf){var a=this.clone().set(ef,1);a.$d[s](o),a.init(),this.$d=a.set(ef,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[gf.p(t)]()},e.add=function(t,e){var n,i=this;t=Number(t);var r=gf.p(e),s=function(e){var n=pf(i);return gf.w(n.date(n.date()+Math.round(e*t)),i)};if(r===Xd)return this.set(Xd,this.$M+t);if(r===tf)return this.set(tf,this.$y+t);if(r===Yd)return s(1);if(r===Jd)return s(7);var o=(n={},n[Gd]=qd,n[Qd]=$d,n[Wd]=jd,n)[r]||1,a=this.$d.getTime()+t*o;return gf.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||nf;var i=t||"YYYY-MM-DDTHH:mm:ssZ",r=gf.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 gf.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(sf,(function(t,i){return i||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return gf.s(e.$y,4,"0");case"M":return a+1;case"MM":return gf.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 gf.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 gf.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 gf.s(o,2,"0");case"s":return String(e.$s);case"ss":return gf.s(e.$s,2,"0");case"SSS":return gf.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=gf.p(e),o=pf(t),a=(o.utcOffset()-this.utcOffset())*qd,c=this-o,l=function(){return gf.m(r,o)};switch(s){case tf:i=l()/12;break;case Xd:i=l();break;case Zd:i=l()/3;break;case Jd:i=(c-a)/6048e5;break;case Yd:i=(c-a)/864e5;break;case Qd:i=c/$d;break;case Gd:i=c/qd;break;case Wd:i=c/jd;break;default:i=c}return n?i:gf.a(i)},e.daysInMonth=function(){return this.endOf(Xd).$D},e.$locale=function(){return uf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),i=ff(t,e,!0);return i&&(n.$L=i),n},e.clone=function(){return gf.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}(),yf=mf.prototype;function vf(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 wf(){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."}}pf.prototype=yf,[["$ms",Kd],["$s",Wd],["$m",Gd],["$H",Qd],["$W",Yd],["$M",Xd],["$y",tf],["$D",ef]].forEach((function(t){yf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),pf.extend=function(t,e){return t.$i||(t(e,mf,pf),t.$i=!0),pf},pf.locale=ff,pf.isDayjs=df,pf.unix=function(t){return pf(1e3*t)},pf.en=uf[lf],pf.Ls=uf,pf.p={},"function"==typeof SuppressedError&&SuppressedError;const bf=wf,Sf=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."}),Ef="auth/user-disabled",_f=new D("@firebase/auth");function Tf(t,...e){_f.logLevel<=R.ERROR&&_f.error(`Auth (${Ut}): ${t}`,...e)}
2088
+ Vt("firebase","10.13.0","app");class Bd{constructor(){}static getInstance(){return Bd.instance||(Bd.instance=new Bd),Bd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Hd.firebase:Vd.firebase}get api(){return"prod"===this.env?Hd.api:Vd.api}get config(){return"prod"===this.env?Hd.config:Vd.config}}const Vd={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Hd={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 jd=1e3,qd=6e4,$d=36e5,Kd="millisecond",Wd="second",Gd="minute",Qd="hour",Yd="day",Jd="week",Xd="month",Zd="quarter",tf="year",ef="date",nf="Invalid Date",rf=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,sf=/\[([^\]]+)]|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,of={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])+"]"}},af=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},cf={s:af,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+af(i,2,"0")+":"+af(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,Xd),s=n-r<0,o=e.clone().add(i+(s?-1:1),Xd);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:Xd,y:tf,w:Jd,d:Yd,D:ef,h:Qd,m:Gd,s:Wd,ms:Kd,Q:Zd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},lf="en",uf={};uf[lf]=of;var hf="$isDayjsObject",df=function(t){return t instanceof mf||!(!t||!t[hf])},ff=function t(e,n,i){var r;if(!e)return lf;if("string"==typeof e){var s=e.toLowerCase();uf[s]&&(r=s),n&&(uf[s]=n,r=s);var o=e.split("-");if(!r&&o.length>1)return t(o[0])}else{var a=e.name;uf[a]=e,r=a}return!i&&r&&(lf=r),r||!i&&lf},pf=function(t,e){if(df(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new mf(n)},gf=cf;gf.l=ff,gf.i=df,gf.w=function(t,e){return pf(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var mf=function(){function t(t){this.$L=ff(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[hf]=!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(gf.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(rf);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 gf},e.isValid=function(){return!(this.$d.toString()===nf)},e.isSame=function(t,e){var n=pf(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return pf(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<pf(t)},e.$g=function(t,e,n){return gf.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=!!gf.u(e)||e,r=gf.p(t),s=function(t,e){var r=gf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return i?r:r.endOf(Yd)},o=function(t,e){return gf.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 tf:return i?s(1,0):s(31,11);case Xd:return i?s(1,c):s(0,c+1);case Jd:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(i?l-d:l+(6-d),c);case Yd:case ef:return o(u+"Hours",0);case Qd:return o(u+"Minutes",1);case Gd: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,i=gf.p(t),r="set"+(this.$u?"UTC":""),s=(n={},n[Yd]=r+"Date",n[ef]=r+"Date",n[Xd]=r+"Month",n[tf]=r+"FullYear",n[Qd]=r+"Hours",n[Gd]=r+"Minutes",n[Wd]=r+"Seconds",n[Kd]=r+"Milliseconds",n)[i],o=i===Yd?this.$D+(e-this.$W):e;if(i===Xd||i===tf){var a=this.clone().set(ef,1);a.$d[s](o),a.init(),this.$d=a.set(ef,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[gf.p(t)]()},e.add=function(t,e){var n,i=this;t=Number(t);var r=gf.p(e),s=function(e){var n=pf(i);return gf.w(n.date(n.date()+Math.round(e*t)),i)};if(r===Xd)return this.set(Xd,this.$M+t);if(r===tf)return this.set(tf,this.$y+t);if(r===Yd)return s(1);if(r===Jd)return s(7);var o=(n={},n[Gd]=qd,n[Qd]=$d,n[Wd]=jd,n)[r]||1,a=this.$d.getTime()+t*o;return gf.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||nf;var i=t||"YYYY-MM-DDTHH:mm:ssZ",r=gf.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 gf.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(sf,(function(t,i){return i||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return gf.s(e.$y,4,"0");case"M":return a+1;case"MM":return gf.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 gf.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 gf.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 gf.s(o,2,"0");case"s":return String(e.$s);case"ss":return gf.s(e.$s,2,"0");case"SSS":return gf.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=gf.p(e),o=pf(t),a=(o.utcOffset()-this.utcOffset())*qd,c=this-o,l=function(){return gf.m(r,o)};switch(s){case tf:i=l()/12;break;case Xd:i=l();break;case Zd:i=l()/3;break;case Jd:i=(c-a)/6048e5;break;case Yd:i=(c-a)/864e5;break;case Qd:i=c/$d;break;case Gd:i=c/qd;break;case Wd:i=c/jd;break;default:i=c}return n?i:gf.a(i)},e.daysInMonth=function(){return this.endOf(Xd).$D},e.$locale=function(){return uf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),i=ff(t,e,!0);return i&&(n.$L=i),n},e.clone=function(){return gf.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}(),yf=mf.prototype;function vf(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 wf(){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."}}pf.prototype=yf,[["$ms",Kd],["$s",Wd],["$m",Gd],["$H",Qd],["$W",Yd],["$M",Xd],["$y",tf],["$D",ef]].forEach((function(t){yf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),pf.extend=function(t,e){return t.$i||(t(e,mf,pf),t.$i=!0),pf},pf.locale=ff,pf.isDayjs=df,pf.unix=function(t){return pf(1e3*t)},pf.en=uf[lf],pf.Ls=uf,pf.p={},"function"==typeof SuppressedError&&SuppressedError;const bf=wf,Sf=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."}),Ef="auth/user-disabled",_f=new D("@firebase/auth");function If(t,...e){_f.logLevel<=R.ERROR&&_f.error(`Auth (${Ut}): ${t}`,...e)}
2089
2089
  /**
2090
2090
  * @license
2091
2091
  * Copyright 2020 Google LLC
@@ -2101,7 +2101,7 @@ Vt("firebase","10.13.0","app");class Bd{constructor(){}static getInstance(){retu
2101
2101
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2102
2102
  * See the License for the specific language governing permissions and
2103
2103
  * limitations under the License.
2104
- */function If(t,...e){throw Rf(t,...e)}function kf(t,...e){return Rf(t,...e)}function Cf(t,e,n){const i=Object.assign(Object.assign({},bf()),{[e]:n});return new g("auth","Firebase",i).create(e,{appName:t.name})}function Af(t){return Cf(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Rf(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 Sf.create(t,...e)}function Lf(t,e,...n){if(!t)throw Rf(e,...n)}function Nf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Tf(e),new Error(e)}function xf(t,e){t||Nf(e)}
2104
+ */function Tf(t,...e){throw Rf(t,...e)}function kf(t,...e){return Rf(t,...e)}function Cf(t,e,n){const i=Object.assign(Object.assign({},bf()),{[e]:n});return new g("auth","Firebase",i).create(e,{appName:t.name})}function Af(t){return Cf(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Rf(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 Sf.create(t,...e)}function Lf(t,e,...n){if(!t)throw Rf(e,...n)}function Nf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw If(e),new Error(e)}function xf(t,e){t||Nf(e)}
2105
2105
  /**
2106
2106
  * @license
2107
2107
  * Copyright 2020 Google LLC
@@ -2214,7 +2214,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
2214
2214
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2215
2215
  * See the License for the specific language governing permissions and
2216
2216
  * limitations under the License.
2217
- */function Vf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Hf(t,e,n,i,r={}){return jf(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),Uf.fetch()($f(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},r))}))}async function jf(t,e,n){t._canInitEmulator=!1;const i=Object.assign(Object.assign({},zf),e);try{const e=new Wf(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await r.json();if("needConfirmation"in s)throw Gf(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 Gf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Gf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Gf(t,"user-disabled",s);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Cf(t,a,o);If(t,a)}}catch(e){if(e instanceof p)throw e;If(t,"network-request-failed",{message:String(e)})}}async function qf(t,e,n,i,r={}){const s=await Hf(t,e,n,i,r);return"mfaPendingCredential"in s&&If(t,"multi-factor-auth-required",{_serverResponse:s}),s}function $f(t,e,n,i){const r=`${e}${n}?${i}`;return t.config.emulator?Ff(t.config,r):`${t.config.apiScheme}://${r}`}function Kf(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(kf(this.auth,"network-request-failed"))),Bf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Gf(t,e,n){const i={appName:t.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=kf(t,e,i);return r.customData._tokenResponse=n,r}function Qf(t){return void 0!==t&&void 0!==t.enterprise}class Yf{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 Kf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Jf(t,e){return Hf(t,"POST","/v1/accounts:lookup",e)}
2217
+ */function Vf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Hf(t,e,n,i,r={}){return jf(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),Uf.fetch()($f(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},r))}))}async function jf(t,e,n){t._canInitEmulator=!1;const i=Object.assign(Object.assign({},zf),e);try{const e=new Wf(t),r=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await r.json();if("needConfirmation"in s)throw Gf(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 Gf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Gf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Gf(t,"user-disabled",s);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Cf(t,a,o);Tf(t,a)}}catch(e){if(e instanceof p)throw e;Tf(t,"network-request-failed",{message:String(e)})}}async function qf(t,e,n,i,r={}){const s=await Hf(t,e,n,i,r);return"mfaPendingCredential"in s&&Tf(t,"multi-factor-auth-required",{_serverResponse:s}),s}function $f(t,e,n,i){const r=`${e}${n}?${i}`;return t.config.emulator?Ff(t.config,r):`${t.config.apiScheme}://${r}`}function Kf(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(kf(this.auth,"network-request-failed"))),Bf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Gf(t,e,n){const i={appName:t.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=kf(t,e,i);return r.customData._tokenResponse=n,r}function Qf(t){return void 0!==t&&void 0!==t.enterprise}class Yf{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 Kf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Jf(t,e){return Hf(t,"POST","/v1/accounts:lookup",e)}
2218
2218
  /**
2219
2219
  * @license
2220
2220
  * Copyright 2020 Google LLC
@@ -2230,7 +2230,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
2230
2230
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2231
2231
  * See the License for the specific language governing permissions and
2232
2232
  * limitations under the License.
2233
- */function Xf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Zf(t){return 1e3*Number(t)}function tp(t){const[e,n,i]=t.split(".");if(void 0===e||void 0===n||void 0===i)return Tf("JWT malformed, contained fewer than 3 sections"),null;try{const t=a(n);return t?JSON.parse(t):(Tf("Failed to decode base64 JWT payload"),null)}catch(t){return Tf("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function ep(t){const e=tp(t);return Lf(e,"internal-error"),Lf(void 0!==e.exp,"internal-error"),Lf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
2233
+ */function Xf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Zf(t){return 1e3*Number(t)}function tp(t){const[e,n,i]=t.split(".");if(void 0===e||void 0===n||void 0===i)return If("JWT malformed, contained fewer than 3 sections"),null;try{const t=a(n);return t?JSON.parse(t):(If("Failed to decode base64 JWT payload"),null)}catch(t){return If("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function ep(t){const e=tp(t);return Lf(e,"internal-error"),Lf(void 0!==e.exp,"internal-error"),Lf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
2234
2234
  /**
2235
2235
  * @license
2236
2236
  * Copyright 2020 Google LLC
@@ -2343,7 +2343,7 @@ class ap{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2343
2343
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2344
2344
  * See the License for the specific language governing permissions and
2345
2345
  * limitations under the License.
2346
- */function cp(t,e){Lf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class lp{constructor(t){var{uid:e,auth:n,stsTokenManager:i}=t,r=vf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ip(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 rp(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await np(this,this.stsTokenManager.getToken(this.auth,t));return Lf(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=tp(i);Lf(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:Xf(Zf(r.auth_time)),issuedAtTime:Xf(Zf(r.iat)),expirationTime:Xf(Zf(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 sp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Lf(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 lp(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Lf(!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 sp(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pt(this.auth.app))return Promise.reject(Af(this.auth));const t=await this.getIdToken();return await np(this,
2346
+ */function cp(t,e){Lf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class lp{constructor(t){var{uid:e,auth:n,stsTokenManager:i}=t,r=vf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ip(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 rp(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await np(this,this.stsTokenManager.getToken(this.auth,t));return Lf(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=I(t),i=await n.getIdToken(e),r=tp(i);Lf(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:Xf(Zf(r.auth_time)),issuedAtTime:Xf(Zf(r.iat)),expirationTime:Xf(Zf(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=I(t);await sp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Lf(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 lp(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Lf(!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 sp(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pt(this.auth.app))return Promise.reject(Af(this.auth));const t=await this.getIdToken();return await np(this,
2347
2347
  /**
2348
2348
  * @license
2349
2349
  * Copyright 2020 Google LLC
@@ -2360,7 +2360,7 @@ class ap{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2360
2360
  * See the License for the specific language governing permissions and
2361
2361
  * limitations under the License.
2362
2362
  */
2363
- async function(t,e){return Hf(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;Lf(v&&E,t,"internal-error");const _=ap.fromJSON(this.name,E);Lf("string"==typeof v,t,"internal-error"),cp(u,t.name),cp(h,t.name),Lf("boolean"==typeof w,t,"internal-error"),Lf("boolean"==typeof b,t,"internal-error"),cp(d,t.name),cp(f,t.name),cp(p,t.name),cp(g,t.name),cp(m,t.name),cp(y,t.name);const T=new lp({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 ap;i.updateFromServerResponse(e);const r=new lp({uid:e.localId,auth:t,stsTokenManager:i,isAnonymous:n});return await sp(r),r}static async _fromGetAccountInfoResponse(t,e,n){const i=e.users[0];Lf(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?op(i.providerUserInfo):[],s=!(i.email&&i.passwordHash||(null==r?void 0:r.length)),o=new ap;o.updateFromIdToken(n);const a=new lp({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 rp(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||(null==r?void 0:r.length))};return Object.assign(a,c),a}}
2363
+ async function(t,e){return Hf(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;Lf(v&&E,t,"internal-error");const _=ap.fromJSON(this.name,E);Lf("string"==typeof v,t,"internal-error"),cp(u,t.name),cp(h,t.name),Lf("boolean"==typeof w,t,"internal-error"),Lf("boolean"==typeof b,t,"internal-error"),cp(d,t.name),cp(f,t.name),cp(p,t.name),cp(g,t.name),cp(m,t.name),cp(y,t.name);const I=new lp({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)&&(I.providerData=S.map((t=>Object.assign({},t)))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(t,e,n=!1){const i=new ap;i.updateFromServerResponse(e);const r=new lp({uid:e.localId,auth:t,stsTokenManager:i,isAnonymous:n});return await sp(r),r}static async _fromGetAccountInfoResponse(t,e,n){const i=e.users[0];Lf(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?op(i.providerUserInfo):[],s=!(i.email&&i.passwordHash||(null==r?void 0:r.length)),o=new ap;o.updateFromIdToken(n);const a=new lp({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 rp(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||(null==r?void 0:r.length))};return Object.assign(a,c),a}}
2364
2364
  /**
2365
2365
  * @license
2366
2366
  * Copyright 2020 Google LLC
@@ -2424,7 +2424,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2424
2424
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2425
2425
  * See the License for the specific language governing permissions and
2426
2426
  * limitations under the License.
2427
- */function mp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(bp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(yp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Ep(e))return"Blackberry";if(_p(e))return"Webos";if(vp(e))return"Safari";if((e.includes("chrome/")||wp(e))&&!e.includes("edge/"))return"Chrome";if(Sp(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 yp(t=f()){return/firefox\//i.test(t)}function vp(t=f()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function wp(t=f()){return/crios\//i.test(t)}function bp(t=f()){return/iemobile/i.test(t)}function Sp(t=f()){return/android/i.test(t)}function Ep(t=f()){return/blackberry/i.test(t)}function _p(t=f()){return/webos/i.test(t)}function Tp(t=f()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Ip(){return function(){const t=f();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function kp(t=f()){return Tp(t)||Sp(t)||_p(t)||Ep(t)||/windows phone/i.test(t)||bp(t)}
2427
+ */function mp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(bp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(yp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Ep(e))return"Blackberry";if(_p(e))return"Webos";if(vp(e))return"Safari";if((e.includes("chrome/")||wp(e))&&!e.includes("edge/"))return"Chrome";if(Sp(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 yp(t=f()){return/firefox\//i.test(t)}function vp(t=f()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function wp(t=f()){return/crios\//i.test(t)}function bp(t=f()){return/iemobile/i.test(t)}function Sp(t=f()){return/android/i.test(t)}function Ep(t=f()){return/blackberry/i.test(t)}function _p(t=f()){return/webos/i.test(t)}function Ip(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 kp(t=f()){return Ip(t)||Sp(t)||_p(t)||Ep(t)||/windows phone/i.test(t)||bp(t)}
2428
2428
  /**
2429
2429
  * @license
2430
2430
  * Copyright 2020 Google LLC
@@ -2488,7 +2488,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2488
2488
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2489
2489
  * See the License for the specific language governing permissions and
2490
2490
  * limitations under the License.
2491
- */class Lp{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 xp(this),this.idTokenSubscription=new xp(this),this.beforeStateQueue=new Ap(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Sf,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=hp(e)),this._initializationPromise=this.queue((async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await gp.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 Jf(this,{idToken:t}),n=await lp._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 Lf(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 sp(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Pt(this.app))return Promise.reject(Af(this));const e=t?T(t):null;return e&&Lf(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&&Lf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return Pt(this.app)?Promise.reject(Af(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Pt(this.app)?Promise.reject(Af(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(hp(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 Hf(t,"GET","/v2/passwordPolicy",Vf(t,e))}
2491
+ */class Lp{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 xp(this),this.idTokenSubscription=new xp(this),this.beforeStateQueue=new Ap(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Sf,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=hp(e)),this._initializationPromise=this.queue((async()=>{var n,i;if(!this._deleted&&(this.persistenceManager=await gp.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 Jf(this,{idToken:t}),n=await lp._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 Lf(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 sp(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Pt(this.app))return Promise.reject(Af(this));const e=t?I(t):null;return e&&Lf(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&&Lf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return Pt(this.app)?Promise.reject(Af(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Pt(this.app)?Promise.reject(Af(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(hp(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 Hf(t,"GET","/v2/passwordPolicy",Vf(t,e))}
2492
2492
  /**
2493
2493
  * @license
2494
2494
  * Copyright 2023 Google LLC
@@ -2504,7 +2504,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2504
2504
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2505
2505
  * See the License for the specific language governing permissions and
2506
2506
  * limitations under the License.
2507
- */(this),e=new Rp(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 Hf(t,"POST","/v2/accounts:revokeToken",Vf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&hp(t)||this._popupRedirectResolver;Lf(e,this,"argument-error"),this.redirectPersistenceManager=await gp.create(this,[hp(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(Lf(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 Lf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Cp(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){_f.logLevel<=R.WARN&&_f.warn(`Auth (${Ut}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Np(t){return T(t)}class xp{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 Lf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2507
+ */(this),e=new Rp(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 Hf(t,"POST","/v2/accounts:revokeToken",Vf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&hp(t)||this._popupRedirectResolver;Lf(e,this,"argument-error"),this.redirectPersistenceManager=await gp.create(this,[hp(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(Lf(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 Lf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Cp(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){_f.logLevel<=R.WARN&&_f.warn(`Auth (${Ut}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Np(t){return I(t)}class xp{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 Lf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2508
2508
  /**
2509
2509
  * @license
2510
2510
  * Copyright 2020 Google LLC
@@ -2617,7 +2617,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2617
2617
  * See the License for the specific language governing permissions and
2618
2618
  * limitations under the License.
2619
2619
  */
2620
- class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,this._password=e,this._tenantId=i}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 Fp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",jp);case"emailLink":return async function(t,e){return qf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{email:this._email,oobCode:this._password});default:If(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Fp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Hp);case"emailLink":return async function(t,e){return qf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:If(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2620
+ class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,this._password=e,this._tenantId=i}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 Fp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",jp);case"emailLink":return async function(t,e){return qf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{email:this._email,oobCode:this._password});default:Tf(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Fp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Hp);case"emailLink":return async function(t,e){return qf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:Tf(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2621
2621
  /**
2622
2622
  * @license
2623
2623
  * Copyright 2020 Google LLC
@@ -2649,7 +2649,7 @@ class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,
2649
2649
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2650
2650
  * See the License for the specific language governing permissions and
2651
2651
  * limitations under the License.
2652
- */class Wp extends Vp{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):If("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=vf(e,["providerId","signInMethod"]);if(!n||!i)return null;const s=new Wp(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 Kp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Kp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Kp(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}}
2652
+ */class Wp extends Vp{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:i}=e,r=vf(e,["providerId","signInMethod"]);if(!n||!i)return null;const s=new Wp(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 Kp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Kp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Kp(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
2653
  /**
2654
2654
  * @license
2655
2655
  * Copyright 2020 Google LLC
@@ -2865,7 +2865,7 @@ async function ag(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._upda
2865
2865
  * See the License for the specific language governing permissions and
2866
2866
  * limitations under the License.
2867
2867
  */
2868
- function(t,e,n){var i;Lf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"invalid-continue-uri"),Lf(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&&(Lf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Lf(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 Fp(i,r,"getOobCode",qp)}async function lg(t,e,n){await async function(t,e){return Hf(t,"POST","/v1/accounts:resetPassword",Vf(t,e))}(T(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ag(t),e}))}function ug(t,e,n){return Pt(t.app)?Promise.reject(Af(t)):async function(t,e){return og(Np(t),e)}(T(t),Qp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ag(t),e}))}const hg="__sak";
2868
+ function(t,e,n){var i;Lf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"invalid-continue-uri"),Lf(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&&(Lf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Lf(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 Fp(i,r,"getOobCode",qp)}async function lg(t,e,n){await async function(t,e){return Hf(t,"POST","/v1/accounts:resetPassword",Vf(t,e))}(I(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ag(t),e}))}function ug(t,e,n){return Pt(t.app)?Promise.reject(Af(t)):async function(t,e){return og(Np(t),e)}(I(t),Qp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ag(t),e}))}const hg="__sak";
2869
2869
  /**
2870
2870
  * @license
2871
2871
  * Copyright 2019 Google LLC
@@ -2897,7 +2897,7 @@ function(t,e,n){var i;Lf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
2897
2897
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2898
2898
  * See the License for the specific language governing permissions and
2899
2899
  * limitations under the License.
2900
- */class fg extends dg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=kp(),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);Ip()&&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]}}fg.type="LOCAL";const pg=fg;
2900
+ */class fg extends dg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=kp(),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]}}fg.type="LOCAL";const pg=fg;
2901
2901
  /**
2902
2902
  * @license
2903
2903
  * Copyright 2020 Google LLC
@@ -3029,7 +3029,7 @@ function Sg(){return void 0!==bg().WorkerGlobalScope&&"function"==typeof bg().im
3029
3029
  * See the License for the specific language governing permissions and
3030
3030
  * limitations under the License.
3031
3031
  */
3032
- const Eg="firebaseLocalStorageDb",_g="firebaseLocalStorage",Tg="fbase_key";class Ig{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 kg(t,e){return t.transaction([_g],e?"readwrite":"readonly").objectStore(_g)}function Cg(){const t=indexedDB.open(Eg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(_g,{keyPath:Tg})}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(Eg);return new Ig(t).toPromise()}(),e(await Cg()))}))}))}async function Ag(t,e,n){const i=kg(t,!0).put({[Tg]:e,value:n});return new Ig(i).toPromise()}function Rg(t,e){const n=kg(t,!0).delete(e);return new Ig(n).toPromise()}class Lg{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 Cg()),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 Sg()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=yg._getInstance(Sg()?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 wg(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 Cg();return await Ag(t,hg,"1"),await Rg(t,hg),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Ag(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=kg(t,!1).get(e),i=await new Ig(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=>Rg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=kg(t,!1).getAll();return new Ig(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()}}Lg.type="LOCAL";const Ng=Lg;new Mf(3e4,6e4);
3032
+ const Eg="firebaseLocalStorageDb",_g="firebaseLocalStorage",Ig="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 kg(t,e){return t.transaction([_g],e?"readwrite":"readonly").objectStore(_g)}function Cg(){const t=indexedDB.open(Eg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(_g,{keyPath:Ig})}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(Eg);return new Tg(t).toPromise()}(),e(await Cg()))}))}))}async function Ag(t,e,n){const i=kg(t,!0).put({[Ig]:e,value:n});return new Tg(i).toPromise()}function Rg(t,e){const n=kg(t,!0).delete(e);return new Tg(n).toPromise()}class Lg{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 Cg()),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 Sg()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=yg._getInstance(Sg()?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 wg(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 Cg();return await Ag(t,hg,"1"),await Rg(t,hg),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Ag(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=kg(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=>Rg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=kg(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()}}Lg.type="LOCAL";const Ng=Lg;new Mf(3e4,6e4);
3033
3033
  /**
3034
3034
  * @license
3035
3035
  * Copyright 2019 Google LLC
@@ -3063,7 +3063,7 @@ class xg extends Vp{constructor(t){super("custom","custom"),this.params=t}_getId
3063
3063
  * See the License for the specific language governing permissions and
3064
3064
  * limitations under the License.
3065
3065
  */
3066
- async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Af(i));const r="reauthenticate";try{const s=await np(t,sg(i,r,e,t),n);Lf(s.idToken,i,"internal-error");const o=tp(s.idToken);Lf(o,i,"internal-error");const{sub:a}=o;return Lf(t.uid===a,i,"user-mismatch"),ng._forOperation(t,r,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&If(i,"user-mismatch"),t}}(n,new xg(t),t.bypassAuthState)}async function Pg(t){const{auth:e,user:n}=t;return Lf(n,e,"internal-error"),async function(t,e,n=!1){const i=await np(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return ng._forOperation(t,"link",i)}(n,new xg(t),t.bypassAuthState)}
3066
+ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Af(i));const r="reauthenticate";try{const s=await np(t,sg(i,r,e,t),n);Lf(s.idToken,i,"internal-error");const o=tp(s.idToken);Lf(o,i,"internal-error");const{sub:a}=o;return Lf(t.uid===a,i,"user-mismatch"),ng._forOperation(t,r,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&Tf(i,"user-mismatch"),t}}(n,new xg(t),t.bypassAuthState)}async function Pg(t){const{auth:e,user:n}=t;return Lf(n,e,"internal-error"),async function(t,e,n=!1){const i=await np(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return ng._forOperation(t,"link",i)}(n,new xg(t),t.bypassAuthState)}
3067
3067
  /**
3068
3068
  * @license
3069
3069
  * Copyright 2020 Google LLC
@@ -3079,7 +3079,7 @@ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Af(i
3079
3079
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3080
3080
  * See the License for the specific language governing permissions and
3081
3081
  * limitations under the License.
3082
- */class Mg{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 Og;case"linkViaPopup":case"linkViaRedirect":return Pg;case"reauthViaPopup":case"reauthViaRedirect":return Dg;default:If(this.auth,"internal-error")}}resolve(t){xf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){xf(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()}}
3082
+ */class Mg{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 Og;case"linkViaPopup":case"linkViaRedirect":return Pg;case"reauthViaPopup":case"reauthViaRedirect":return Dg;default:Tf(this.auth,"internal-error")}}resolve(t){xf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){xf(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
3083
  /**
3084
3084
  * @license
3085
3085
  * Copyright 2020 Google LLC
@@ -3178,7 +3178,7 @@ function(t,e){return e?hp(e):(Lf(t._popupRedirectResolver,t,"argument-error"),t.
3178
3178
  * See the License for the specific language governing permissions and
3179
3179
  * limitations under the License.
3180
3180
  */
3181
- const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Gg=/^https?/;async function Qg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Hf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Yg(t))return}catch(t){}If(t,"unauthorized-domain")}function Yg(t){const e=Of(),{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(!Gg.test(n))return!1;if(Wg.test(t))return i===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}
3181
+ const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Gg=/^https?/;async function Qg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Hf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Yg(t))return}catch(t){}Tf(t,"unauthorized-domain")}function Yg(t){const e=Of(),{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(!Gg.test(n))return!1;if(Wg.test(t))return i===t;const r=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}
3182
3182
  /**
3183
3183
  * @license
3184
3184
  * Copyright 2020 Google LLC.
@@ -3227,7 +3227,7 @@ const em=new Mf(5e3,15e3),nm="__/auth/iframe",im="emulator/auth/iframe",rm={styl
3227
3227
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3228
3228
  * See the License for the specific language governing permissions and
3229
3229
  * limitations under the License.
3230
- */const cm={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class lm{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function um(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({},cm),{width:i.toString(),height:r.toString(),top:s,left:o}),l=f().toLowerCase();n&&(a=wp(l)?"_blank":n),yp(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 Tp(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)}
3230
+ */const cm={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class lm{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function um(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({},cm),{width:i.toString(),height:r.toString(),top:s,left:o}),l=f().toLowerCase();n&&(a=wp(l)?"_blank":n),yp(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 Ip(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)}
3231
3231
  /**
3232
3232
  * @license
3233
3233
  * Copyright 2021 Google LLC
@@ -3259,7 +3259,7 @@ const em=new Mf(5e3,15e3),nm="__/auth/iframe",im="emulator/auth/iframe",rm={styl
3259
3259
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3260
3260
  * See the License for the specific language governing permissions and
3261
3261
  * limitations under the License.
3262
- */(t)}?${w(a).slice(1)}${l}`}const gm="webStorageSupport";const mm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=mg,this._completeRedirectFn=jg,this._overrideRedirectResult=Hg}async _openPopup(t,e,n,i){var r;xf(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return um(t,await pm(t,e,n,Of(),i),vg())}async _openRedirect(t,e,n,i){await this._originValidation(t);return function(t){bg().location.href=t}(await pm(t,e,n,Of(),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):(xf(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 am(t),n=new qg(t);return e.register("authEvent",(e=>{Lf(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(gm,{type:gm},(n=>{var i;const r=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[gm];void 0!==r&&e(!!r),If(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Qg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return kp()||vp()||Tp()}};var ym="@firebase/auth",vm="1.7.7";
3262
+ */(t)}?${w(a).slice(1)}${l}`}const gm="webStorageSupport";const mm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=mg,this._completeRedirectFn=jg,this._overrideRedirectResult=Hg}async _openPopup(t,e,n,i){var r;xf(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return um(t,await pm(t,e,n,Of(),i),vg())}async _openRedirect(t,e,n,i){await this._originValidation(t);return function(t){bg().location.href=t}(await pm(t,e,n,Of(),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):(xf(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 am(t),n=new qg(t);return e.register("authEvent",(e=>{Lf(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(gm,{type:gm},(n=>{var i;const r=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[gm];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]=Qg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return kp()||vp()||Ip()}};var ym="@firebase/auth",vm="1.7.7";
3263
3263
  /**
3264
3264
  * @license
3265
3265
  * Copyright 2020 Google LLC
@@ -3309,4 +3309,4 @@ class wm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3309
3309
  * See the License for the specific language governing permissions and
3310
3310
  * limitations under the License.
3311
3311
  */
3312
- const bm=h("authIdTokenMaxAge")||300;let Sm=null;function Em(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;If(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:mm,persistence:[Ng,pg,mg]}),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>bm)return;const i=null==e?void 0:e.token;Sm!==i&&(Sm=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&&Up(n,`http://${s}`),n}var _m;!function(t){Op=t}({loadJS:t=>new Promise(((e,n)=>{const i=document.createElement("script");i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=kf("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="}),_m="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;Lf(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:Cp(_m)},c=new Lp(n,i,r,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],i=(Array.isArray(n)?n:[n]).map(hp);(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 wm(t))(Np(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(ym,vm,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(ym,vm,"esm2017");class Tm extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Im extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class km extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Cm extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Am extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Rm extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Lm="avatar not created";class Nm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Em(e),this.auth.setPersistence(pg)}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),this.setBrandUserId(e.uid))})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),this.setBrandUserId(null==e?void 0:e.uid),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 Dd(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&&pf(l).diff(pf(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 Fd(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 Im;return await this.user.getIdToken()}get userId(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return this.user.uid}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return(await Dd(Fh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=Sd(Mh(this.firestore,"users"),_d(Yh(),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}watchUserProfileForFrames(t){let e;const n=Sd(Mh(this.firestore,"users"),_d(Yh(),"==",this.id));return new Promise((i=>{e=Ud(n,(async n=>{await t(n)&&(e(),i(n.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await ug(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await cg(this.auth,t)}async confirmPasswordReset(t,e){await lg(this.auth,t,e)}}class xm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((i=>{n=Ud(t,(t=>{i(t),e&&n()}))})),unsubscribe:()=>n()}};const t=zt(Bd.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 Nm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const i=Sd(Mh(this.firestore,t),e);return this.promisefyOnSnapshot(i,n)}getDocs(t,e){return Md(Sd(Mh(this.firestore,t),...e))}async getDoc(t,e){const n=Fh(this.firestore,t,e),i=await Dd(n);return i.exists()?i.data():null}}const Om=t=>{if(t.code===Ef)throw new Error("account has been disabled");throw new Error(t.message)};class Dm{static get endpoint(){return Bd.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})}}const Pm=t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))};class Mm{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 Im;try{const i=await Dm.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((null==t?void 0:t.error)===Lm)throw new Tm;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Dm.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 km;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new km;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){console.log({sku:t});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=[_d("brand_id","==",this.brandId)];i.push(_d("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 Om(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 Om(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Om(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 tryOn(t,e){if(!this.isLoggedIn)throw new Im;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e);try{return await this.getColorwaySizeAssetFrames(n)}catch(t){if(!(t instanceof Am))throw t;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e){var n,i,r;try{const s=[_d("brand_id","==",this.brandId)];s.push(_d("style_id","==",t)),s.push(_d("size_id","==",e));return null===(r=null===(i=null===(n=(await this.firebase.getDocs("colorway_size_assets",s)).docs)||void 0===n?void 0:n[0])||void 0===i?void 0:i.data())||void 0===r?void 0:r.sku}catch(t){return Om(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Om(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 Om(t)}}async requestThenGetColorwaySizeAssetFrames(t){const[e,n]=await(i=this.getColorwaySizeAssetFromSku(t),i.then((t=>[null,t])).catch((t=>[t])));var i;if(e)throw e;try{return await this.requestColorwaySizeAssetFrames(n.id),this.awaitColorwaySizeAssetFrames(t)}catch(e){if((null==e?void 0:e.error)===Lm)throw new Tm;throw new Rm}}async awaitColorwaySizeAssetFrames(t){var e,n,i,r;if(!this.isLoggedIn)throw new Im;const s=await this.user.watchUserProfileForFrames((async e=>{var n,i,r,s;const o=null===(s=null===(r=null===(i=null===(n=e.docs[0].data())||void 0===n?void 0:n.vto)||void 0===i?void 0:i[this.brandId])||void 0===r?void 0:r[t])||void 0===s?void 0:s.frames;return!!(null==o?void 0:o.length)&&Pm(o[0])}));if(!(null===(r=null===(i=null===(n=null===(e=null==s?void 0:s.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===i?void 0:i.frames)||void 0===r?void 0:r.length))throw new Am;return s.vto[this.brandId][t].frames}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Im;if(!this.user.brandUserId)throw new Cm;await Dm.Post(this.user,`/colorway-size-assets/${t}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(t){var e,n,i;const r=await this.user.getUserProfile(),s=(null===(i=null===(n=null===(e=null==r?void 0:r.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===i?void 0:i.frames)||[];if(!s.length)throw new Am;if(!await Pm(s[0]))throw new Am;return s}}var Fm;!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"}(Fm||(Fm={}));const Um={[Fm.ACROSS_BACK]:"Across back",[Fm.ACROSS_FRONT]:"Across front",[Fm.ACROSS_SHOULDER]:"Across shoulder",[Fm.ANKLE]:"Ankle",[Fm.ARMEYE]:"Armeye",[Fm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Fm.BACK_CROTCH_LENGTH]:"Back crotch length",[Fm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Fm.BELOW_KNEE]:"Below knee",[Fm.BICEP]:"Bicep",[Fm.BUST]:"Chest/Bust",[Fm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Fm.CALF]:"Calf",[Fm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Fm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Fm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Fm.ELBOW]:"Elbow",[Fm.FOREARM]:"Forearm",[Fm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Fm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Fm.HIGH_HIP]:"High hip",[Fm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Fm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Fm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Fm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Fm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Fm.INSEAM]:"Inseam",[Fm.KNEE]:"Knee",[Fm.LOW_HIP]:"Low hip",[Fm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Fm.MID_NECK]:"Mid neck",[Fm.NECK_AT_BASE]:"Neck at base",[Fm.SHOULDER_DROP]:"Shoulder drop",[Fm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Fm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Fm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Fm.THIGH]:"Thigh",[Fm.TOTAL_RISE_LENGTH]:"Total rise length",[Fm.UNDER_BUST]:"Under bust",[Fm.VERTICAL_TRUNK]:"Vertical trunk",[Fm.WAIST]:"Waist",[Fm.WRIST]:"Wrist"};var zm;!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"}(zm||(zm={}));const Bm={[zm.BLOUSES]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.COATS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.DRESSES]:[Fm.LOW_HIP,Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST],[zm.JACKETS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.PANTS]:[Fm.LOW_HIP,Fm.WAIST,Fm.THIGH,Fm.INSEAM],[zm.PUFFERS_AND_PARKAS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.SHORTS]:[Fm.LOW_HIP,Fm.WAIST,Fm.THIGH,Fm.INSEAM],[zm.SKIRTS]:[Fm.LOW_HIP,Fm.WAIST],[zm.SWEATERS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.T_SHIRTS_AND_TANKS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP]},Vm={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"},Hm={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"},jm={activewear:{leggings:zm.PANTS,joggers:zm.PANTS,sweatshirts:zm.SWEATERS},dresses:{a_line:zm.DRESSES,bodycon:zm.DRESSES,fit_and_flare:zm.DRESSES,knit:zm.DRESSES,shirt:zm.DRESSES,slip:zm.DRESSES,straight:zm.DRESSES,wrap:zm.DRESSES},jackets_and_coats:{denim_jackets:zm.JACKETS,parkas:zm.PUFFERS_AND_PARKAS,peacoats:zm.COATS,puffer_jackets:zm.PUFFERS_AND_PARKAS,raincoats:zm.COATS,rompers:zm.COATS,shackets:zm.JACKETS,trench_coats:zm.COATS},jeans:{bootcut:zm.PANTS,flared:zm.PANTS,mom:zm.PANTS,relaxed:zm.PANTS,skinny:zm.PANTS,slim:zm.PANTS,straight:zm.PANTS,tapered:zm.PANTS,wide_leg:zm.PANTS},jumpsuits_and_rompers:{boiler_suits:zm.DRESSES,denim:zm.DRESSES,jumpsuits:zm.DRESSES,overalls:zm.DRESSES,rompers:zm.DRESSES,unitards:zm.DRESSES},pants_and_shorts:{cigarette:zm.PANTS,culottes:zm.SHORTS,denim_shorts:zm.SHORTS,flared:zm.PANTS,joggers:zm.PANTS,leggings:zm.PANTS,skinny:zm.PANTS,wide_leg:zm.PANTS},skirts:{a_line_flared:zm.SKIRTS,denim:zm.SKIRTS,knit:zm.SKIRTS,pencil:zm.SKIRTS,pleated:zm.SKIRTS,skater:zm.SKIRTS,slip:zm.SKIRTS,wrap:zm.SKIRTS},suits_and_tailoring:{blazers:zm.JACKETS,suit_jackets:zm.JACKETS,suit_skirts:zm.SKIRTS,suit_trousers:zm.PANTS,suit_vests:zm.SWEATERS,trousers:zm.PANTS},sweaters:{cardigans:zm.SWEATERS,crewnecks:zm.SWEATERS,hoodies_and_zipups:zm.SWEATERS,sweatshirts:zm.SWEATERS,turtlenecks:zm.SWEATERS,v_necks:zm.SWEATERS},tops:{bodysuits:zm.BLOUSES,corsets_and_bustiers:zm.BLOUSES,polos:zm.T_SHIRTS_AND_TANKS,shirts_and_blouses:zm.BLOUSES,t_shirts:zm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:zm.T_SHIRTS_AND_TANKS}};var qm;!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"}(qm||(qm={}));const $m={[qm.TOO_TIGHT]:"Too Tight",[qm.TIGHT]:"Tight",[qm.SLIGHTLY_TIGHT]:"Slightly Tight",[qm.PERFECT_FIT]:"Perfect Fit",[qm.SLIGHTLY_LOOSE]:"Slightly Loose",[qm.LOOSE]:"Loose",[qm.OVERSIZED]:"Oversized",[qm.TOO_SHORT]:"Too Short",[qm.SHORT]:"Short",[qm.SLIGHTLY_SHORT]:"Slightly Short",[qm.SLIGHTLY_LONG]:"Slightly Long",[qm.LONG]:"Long",[qm.TOO_LONG]:"Too Long"};var Km;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Km||(Km={}));var Wm=Object.freeze({__proto__:null,get AvatarState(){return Km},get MeasurementLocation(){return Fm},MeasurementLocationName:Um,get Classification(){return zm},ClassificationLocations:Bm,CategoryNames:Vm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Hm,Taxonomy:jm,get Fit(){return qm},FitNames:$m}),Gm="Back to sign in",Qm="Click here to download the app",Ym="Don't have an account?",Jm="Whoops! Looks like you don't have an avatar yet.",Xm="Email address",Zm="Please enter a valid email address.",ty="Enter your email address, we will send you a link to reset your password.",ey="Forgot password?",ny="Have an account? Sign in",iy="Your avatar is loading...",ry="Unfortunately, that size is not available for try on.",sy="or",oy="Password",ay="Please enter a valid password (at least 7 characters).",cy="Return to Catalog Page",ly="Return to Product Page",uy="Return to site",hy="Please return to The Fitting Room app to create your avatar.",dy="Scan to download the app",fy="Send",py="Sign back in",gy="Sign in",my="Something went wrong. Try again!",yy="You have successfully logged out!",vy="The Fitting Room",wy="Username or password is empty.",by="Username or password is incorrect.",Sy="End size uncertainty with",Ey="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var _y=[],Ty=[];function Iy(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=_y.indexOf(s);-1===o&&(o=_y.push(s)-1,Ty[o]={}),n=Ty[o]&&Ty[o][i]?Ty[o][i]:Ty[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}}Iy(".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)}",{});Iy('#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:400px}#fit-outline-inner{flex-shrink:0;overflow:hidden}#fit-title{margin-top:0}#fit-outline-container{margin-top:-50px;transform:scale(.7)}.fit-line-item{font-size:10px;font-weight:500}.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}#cta-section{margin-top:-30px}#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}}',{});Iy(".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}",{});Iy("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}",{});Iy(".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)}}",{});Iy("@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-small-text{font-size:12px}.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}}",{});Iy("#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}",{});Iy(".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%}",{});Iy(".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}",{});Iy(".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}",{});Iy(":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 ky='\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>',Cy='<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>',Ay=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" > ${iy} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),Ry=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">${Sy}</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">${vy}</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}},Ly=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">${Ey}</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">${dy}</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">${ny}</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">${Qm}</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">${ny}</div>\n `:""}\n `,useFullModalContent:!0}};class Ny{constructor(t,e,n,i){this.signIn=e,this.forgotPassword=n,this.submitTel=i,this.manager=Ry(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">${yy}</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">${py}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${uy}</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">${Jm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${hy}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}onLoading(){this.manager.open(Ay({timeoutMS:1e4}))}toScan(){this.manager.open(Ly({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">${gy}</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">${Xm}</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">${oy}</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">${ey}</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">${Ym}</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 ${gy}\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">${ty}</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">${Xm}</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">${Gm}</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 ${fy}\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 ',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||my}</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">${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" id="returnToSite">${ly}</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${ry} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${sy} ${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">${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">${ly}</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">${ky}</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 xy{constructor(t,e,n,i,r){this.onSignInClick=e,this.onSignOutClick=n,this.onFitInfoClick=i,this.onTryOnClick=r,this._sku="",this._styleId=null,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}get styleId(){return this._styleId}setStyleId(t){this._styleId=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",t?(this.tfrSizeHowItFits.style.opacity="1",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.tfrSizeHowItFits.style.opacity="0.4",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);const r=Number(e.getAttribute("data-size-id"));Number.isNaN(r)||this.onTryOnClick(this.styleId,r)}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);const i=e[n].size_id;this.onTryOnClick(this.styleId,i)}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(((n,i)=>`<div class="tfr-size-rec-select-button ${i===e?"active":""}" data-index="${i}" data-size-id="${t[i].size_id}">${n}</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 tfr-mobile-small-text">\n <div>Uncertain&nbsp;of&nbsp;your&nbsp;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">${ky}</div>\n <div class="tfr-powered-by-text-bold">The&nbsp;Fitting&nbsp;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 ${Cy} 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 ${Cy} 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">${ky}</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 Oy{constructor(t,e,n,i,r,s,o){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.onTryOnClick=o,this.perfectFits=[Wm.Fit.PERFECT_FIT,Wm.Fit.SLIGHTLY_LOOSE,Wm.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new xy(t,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick,this.onTryOnClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}get styleId(){return this.sizeRecComponent.styleId}setStyleId(t){this.sizeRecComponent.setStyleId(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),e=await this.getRecommendedSizes(String(t.style_id));return this.setStyleId(t.style_id),e}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku),e=await this.getRecommendedSizes(String(t.id));return this.setStyleId(t.id),e}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,size_id:t.size_id,locations:t.measurement_location_fits.map((t=>({fit:"string"==typeof t.fit_label&&t.fit_label?t.fit_label:Wm.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 Dy;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Dy||(Dy={}));class Py{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 Ny(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"),Bd.getInstance().setEnv(e),new Mm(t,new xm)))(Number(this.shopId),o),this.tfrSizeRec=new Oy(n,r,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.bind(this),this.onTryOnClick.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(wy);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Zm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(ay);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(by)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(my)}}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()}async onTryOnClick(t,e){const n=await this.shop.tryOn(t,e);this.tfrModal.onTryOn(n)}onUserProfileChange(t){var e,n,i,r;switch(t.avatar_status){case Dy.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Jm),this.tfrModal.onNotCreated();break;case Dy.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Dy.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(my),this.tfrModal.onError(my)}}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 My=async(t,e,n,i={},r={},s="dev")=>{const o=new Py(t,e,n,i,r,s);return await o.onInit(),o};export{n as InitImageSlider,My as initFittingRoom};
3312
+ const bm=h("authIdTokenMaxAge")||300;let Sm=null;function Em(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:mm,persistence:[Ng,pg,mg]}),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>bm)return;const i=null==e?void 0:e.token;Sm!==i&&(Sm=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,i){I(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&&Up(n,`http://${s}`),n}var _m;!function(t){Op=t}({loadJS:t=>new Promise(((e,n)=>{const i=document.createElement("script");i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=kf("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="}),_m="Browser",Ot(new T("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;Lf(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:Cp(_m)},c=new Lp(n,i,r,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],i=(Array.isArray(n)?n:[n]).map(hp);(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 T("auth-internal",(t=>(t=>new wm(t))(Np(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(ym,vm,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(ym,vm,"esm2017");class Im extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Tm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class km extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Cm extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Am extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Rm extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Lm="avatar not created";class Nm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Em(e),this.auth.setPersistence(pg)}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),this.setBrandUserId(e.uid))})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),this.setBrandUserId(null==e?void 0:e.uid),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 Dd(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&&pf(l).diff(pf(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 Fd(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()}get userId(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return this.user.uid}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return(await Dd(Fh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=Sd(Mh(this.firestore,"users"),_d(Yh(),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}watchUserProfileForFrames(t){let e;const n=Sd(Mh(this.firestore,"users"),_d(Yh(),"==",this.id));return new Promise((i=>{e=Ud(n,(async n=>{await t(n)&&(e(),i(n.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await ug(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await cg(this.auth,t)}async confirmPasswordReset(t,e){await lg(this.auth,t,e)}}class xm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((i=>{n=Ud(t,(t=>{i(t),e&&n()}))})),unsubscribe:()=>n()}};const t=zt(Bd.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 Nm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const i=Sd(Mh(this.firestore,t),e);return this.promisefyOnSnapshot(i,n)}getDocs(t,e){return Md(Sd(Mh(this.firestore,t),...e))}async getDoc(t,e){const n=Fh(this.firestore,t,e),i=await Dd(n);return i.exists()?i.data():null}}const Om=t=>{if(t.code===Ef)throw new Error("account has been disabled");throw new Error(t.message)};class Dm{static get endpoint(){return Bd.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})}}const Pm=t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))};class Mm{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 Dm.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((null==t?void 0:t.error)===Lm)throw new Im;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Dm.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 km;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new km;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){console.log({sku:t});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=[_d("brand_id","==",this.brandId)];i.push(_d("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 Om(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 Om(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Om(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 tryOn(t,e){if(!this.isLoggedIn)throw new Tm;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e);try{return await this.getColorwaySizeAssetFrames(n)}catch(t){if(!(t instanceof Am))throw t;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e){var n,i,r;try{const s=[_d("brand_id","==",this.brandId)];s.push(_d("style_id","==",t)),s.push(_d("size_id","==",e));return null===(r=null===(i=null===(n=(await this.firebase.getDocs("colorway_size_assets",s)).docs)||void 0===n?void 0:n[0])||void 0===i?void 0:i.data())||void 0===r?void 0:r.sku}catch(t){return Om(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Om(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 Om(t)}}async requestThenGetColorwaySizeAssetFrames(t){const[e,n]=await(i=this.getColorwaySizeAssetFromSku(t),i.then((t=>[null,t])).catch((t=>[t])));var i;if(e)throw e;try{return await this.requestColorwaySizeAssetFrames(n.id),this.awaitColorwaySizeAssetFrames(t)}catch(e){if((null==e?void 0:e.error)===Lm)throw new Im;throw new Rm}}async awaitColorwaySizeAssetFrames(t){var e,n,i,r;if(!this.isLoggedIn)throw new Tm;const s=await this.user.watchUserProfileForFrames((async e=>{var n,i,r,s;const o=null===(s=null===(r=null===(i=null===(n=e.docs[0].data())||void 0===n?void 0:n.vto)||void 0===i?void 0:i[this.brandId])||void 0===r?void 0:r[t])||void 0===s?void 0:s.frames;return!!(null==o?void 0:o.length)&&Pm(o[0])}));if(!(null===(r=null===(i=null===(n=null===(e=null==s?void 0:s.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===i?void 0:i.frames)||void 0===r?void 0:r.length))throw new Am;return s.vto[this.brandId][t].frames}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Tm;if(!this.user.brandUserId)throw new Cm;await Dm.Post(this.user,`/colorway-size-assets/${t}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(t){var e,n,i;const r=await this.user.getUserProfile(),s=(null===(i=null===(n=null===(e=null==r?void 0:r.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===i?void 0:i.frames)||[];if(!s.length)throw new Am;if(!await Pm(s[0]))throw new Am;return s}}var Fm;!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"}(Fm||(Fm={}));const Um={[Fm.ACROSS_BACK]:"Across back",[Fm.ACROSS_FRONT]:"Across front",[Fm.ACROSS_SHOULDER]:"Across shoulder",[Fm.ANKLE]:"Ankle",[Fm.ARMEYE]:"Armeye",[Fm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Fm.BACK_CROTCH_LENGTH]:"Back crotch length",[Fm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Fm.BELOW_KNEE]:"Below knee",[Fm.BICEP]:"Bicep",[Fm.BUST]:"Chest/Bust",[Fm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Fm.CALF]:"Calf",[Fm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Fm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Fm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Fm.ELBOW]:"Elbow",[Fm.FOREARM]:"Forearm",[Fm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Fm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Fm.HIGH_HIP]:"High hip",[Fm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Fm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Fm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Fm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Fm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Fm.INSEAM]:"Inseam",[Fm.KNEE]:"Knee",[Fm.LOW_HIP]:"Low hip",[Fm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Fm.MID_NECK]:"Mid neck",[Fm.NECK_AT_BASE]:"Neck at base",[Fm.SHOULDER_DROP]:"Shoulder drop",[Fm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Fm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Fm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Fm.THIGH]:"Thigh",[Fm.TOTAL_RISE_LENGTH]:"Total rise length",[Fm.UNDER_BUST]:"Under bust",[Fm.VERTICAL_TRUNK]:"Vertical trunk",[Fm.WAIST]:"Waist",[Fm.WRIST]:"Wrist"};var zm;!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"}(zm||(zm={}));const Bm={[zm.BLOUSES]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.COATS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.DRESSES]:[Fm.LOW_HIP,Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST],[zm.JACKETS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.PANTS]:[Fm.LOW_HIP,Fm.WAIST,Fm.THIGH,Fm.INSEAM],[zm.PUFFERS_AND_PARKAS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.SHORTS]:[Fm.LOW_HIP,Fm.WAIST,Fm.THIGH,Fm.INSEAM],[zm.SKIRTS]:[Fm.LOW_HIP,Fm.WAIST],[zm.SWEATERS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.T_SHIRTS_AND_TANKS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP]},Vm={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"},Hm={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"},jm={activewear:{leggings:zm.PANTS,joggers:zm.PANTS,sweatshirts:zm.SWEATERS},dresses:{a_line:zm.DRESSES,bodycon:zm.DRESSES,fit_and_flare:zm.DRESSES,knit:zm.DRESSES,shirt:zm.DRESSES,slip:zm.DRESSES,straight:zm.DRESSES,wrap:zm.DRESSES},jackets_and_coats:{denim_jackets:zm.JACKETS,parkas:zm.PUFFERS_AND_PARKAS,peacoats:zm.COATS,puffer_jackets:zm.PUFFERS_AND_PARKAS,raincoats:zm.COATS,rompers:zm.COATS,shackets:zm.JACKETS,trench_coats:zm.COATS},jeans:{bootcut:zm.PANTS,flared:zm.PANTS,mom:zm.PANTS,relaxed:zm.PANTS,skinny:zm.PANTS,slim:zm.PANTS,straight:zm.PANTS,tapered:zm.PANTS,wide_leg:zm.PANTS},jumpsuits_and_rompers:{boiler_suits:zm.DRESSES,denim:zm.DRESSES,jumpsuits:zm.DRESSES,overalls:zm.DRESSES,rompers:zm.DRESSES,unitards:zm.DRESSES},pants_and_shorts:{cigarette:zm.PANTS,culottes:zm.SHORTS,denim_shorts:zm.SHORTS,flared:zm.PANTS,joggers:zm.PANTS,leggings:zm.PANTS,skinny:zm.PANTS,wide_leg:zm.PANTS},skirts:{a_line_flared:zm.SKIRTS,denim:zm.SKIRTS,knit:zm.SKIRTS,pencil:zm.SKIRTS,pleated:zm.SKIRTS,skater:zm.SKIRTS,slip:zm.SKIRTS,wrap:zm.SKIRTS},suits_and_tailoring:{blazers:zm.JACKETS,suit_jackets:zm.JACKETS,suit_skirts:zm.SKIRTS,suit_trousers:zm.PANTS,suit_vests:zm.SWEATERS,trousers:zm.PANTS},sweaters:{cardigans:zm.SWEATERS,crewnecks:zm.SWEATERS,hoodies_and_zipups:zm.SWEATERS,sweatshirts:zm.SWEATERS,turtlenecks:zm.SWEATERS,v_necks:zm.SWEATERS},tops:{bodysuits:zm.BLOUSES,corsets_and_bustiers:zm.BLOUSES,polos:zm.T_SHIRTS_AND_TANKS,shirts_and_blouses:zm.BLOUSES,t_shirts:zm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:zm.T_SHIRTS_AND_TANKS}};var qm;!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"}(qm||(qm={}));const $m={[qm.TOO_TIGHT]:"Too Tight",[qm.TIGHT]:"Tight",[qm.SLIGHTLY_TIGHT]:"Slightly Tight",[qm.PERFECT_FIT]:"Perfect Fit",[qm.SLIGHTLY_LOOSE]:"Slightly Loose",[qm.LOOSE]:"Loose",[qm.OVERSIZED]:"Oversized",[qm.TOO_SHORT]:"Too Short",[qm.SHORT]:"Short",[qm.SLIGHTLY_SHORT]:"Slightly Short",[qm.SLIGHTLY_LONG]:"Slightly Long",[qm.LONG]:"Long",[qm.TOO_LONG]:"Too Long"};var Km;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Km||(Km={}));var Wm=Object.freeze({__proto__:null,get AvatarState(){return Km},get MeasurementLocation(){return Fm},MeasurementLocationName:Um,get Classification(){return zm},ClassificationLocations:Bm,CategoryNames:Vm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Hm,Taxonomy:jm,get Fit(){return qm},FitNames:$m});class Gm{constructor(t){this.vtoMainDivId=t,this.isInit=!1}init(){if(this.isInit)return;const t=document.getElementById(this.vtoMainDivId);if(!t)throw new Error(`Element with id ${this.vtoMainDivId} not found`);t.innerHTML='\n <div class="tfr-slider-wrapper">\n <img id="tfr-tryon-image" src="" />\n <input type="range" id="tfr-slider" />\n </div>\n ',this.isInit=!0}onNewFramesReady(t){const e=document.getElementById("tfr-tryon-image"),i=n("tfr-slider",((t,n)=>{console.debug("slider change",t,n),e.src=n}));if(Array.isArray(t)&&t.length>0){const e=i.Load(t);if(e instanceof Error)return void console.error(e)}}}var Qm="Back to sign in",Ym="Click here to download the app",Jm="Don't have an account?",Xm="Whoops! Looks like you don't have an avatar yet.",Zm="Email address",ty="Please enter a valid email address.",ey="Enter your email address, we will send you a link to reset your password.",ny="Forgot password?",iy="Have an account? Sign in",ry="Your avatar is loading...",sy="Unfortunately, that size is not available for try on.",oy="or",ay="Password",cy="Please enter a valid password (at least 7 characters).",ly="Return to Catalog Page",uy="Return to Product Page",hy="Return to site",dy="Please return to The Fitting Room app to create your avatar.",fy="Scan to download the app",py="Send",gy="Sign back in",my="Sign in",yy="Something went wrong. Try again!",vy="You have successfully logged out!",wy="The Fitting Room",by="Username or password is empty.",Sy="Username or password is incorrect.",Ey="End size uncertainty with",_y="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var Iy=[],Ty=[];function ky(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=Iy.indexOf(s);-1===o&&(o=Iy.push(s)-1,Ty[o]={}),n=Ty[o]&&Ty[o][i]?Ty[o][i]:Ty[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}}ky(".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)}",{});ky('#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:400px}#fit-outline-inner{flex-shrink:0;overflow:hidden}#fit-title{margin-top:0}#fit-outline-container{margin-top:-50px;transform:scale(.7)}.fit-line-item{font-size:10px;font-weight:500}.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}#cta-section{margin-top:-30px}#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}}',{});ky(".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}.tfr-slider-wrapper{align-items:center;display:flex;flex-direction:column}#tfr-slider{accent-color:var(--tfr-brand-color)}",{});ky("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}",{});ky(".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)}}",{});ky("@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-small-text{font-size:12px}.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}}",{});ky("#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}",{});ky(".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%}",{});ky(".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}",{});ky(".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}",{});ky(":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 Cy='\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>',Ay='<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>',Ry=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" > ${ry} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),Ly=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">${Ey}</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">${wy}</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}},Ny=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">${_y}</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">${fy}</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">${iy}</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">${Ym}</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">${iy}</div>\n `:""}\n `,useFullModalContent:!0}};class xy{constructor(t,e,n,i){this.signIn=e,this.forgotPassword=n,this.submitTel=i,this.manager=Ly(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">${vy}</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">${gy}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${hy}</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">${Xm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${dy}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}onLoading(){this.manager.open(Ry({timeoutMS:1e4}))}toScan(){this.manager.open(Ny({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">${my}</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">${Zm}</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">${ay}</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">${ny}</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">${Jm}</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 ${my}\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">${ey}</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">${Zm}</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">${Qm}</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 ${py}\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 ',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||yy}</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">${ly}</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">${uy}</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${sy} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${oy} ${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">${ly}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${uy}</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">${Cy}</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 Oy{constructor(t,e,n,i,r){this.onSignInClick=e,this.onSignOutClick=n,this.onFitInfoClick=i,this.onTryOnClick=r,this._sku="",this._styleId=null,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}get styleId(){return this._styleId}setStyleId(t){this._styleId=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",t?(this.tfrSizeHowItFits.style.opacity="1",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.tfrSizeHowItFits.style.opacity="0.4",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);const r=Number(e.getAttribute("data-size-id"));Number.isNaN(r)||this.onTryOnClick(this.styleId,r)}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);const i=e[n].size_id;this.onTryOnClick(this.styleId,i)}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(((n,i)=>`<div class="tfr-size-rec-select-button ${i===e?"active":""}" data-index="${i}" data-size-id="${t[i].size_id}">${n}</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 tfr-mobile-small-text">\n <div>Uncertain&nbsp;of&nbsp;your&nbsp;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">${Cy}</div>\n <div class="tfr-powered-by-text-bold">The&nbsp;Fitting&nbsp;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 ${Ay} 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 ${Ay} 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">${Cy}</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 Dy{constructor(t,e,n,i,r,s,o){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.onTryOnClick=o,this.perfectFits=[Wm.Fit.PERFECT_FIT,Wm.Fit.SLIGHTLY_LOOSE,Wm.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Oy(t,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick,this.onTryOnClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}get styleId(){return this.sizeRecComponent.styleId}setStyleId(t){this.sizeRecComponent.setStyleId(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),e=await this.getRecommendedSizes(String(t.style_id));return this.setStyleId(t.style_id),e}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku),e=await this.getRecommendedSizes(String(t.id));return this.setStyleId(t.id),e}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.size_value.size,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).size_value.size,size_id:t.size_id,locations:t.measurement_location_fits.map((t=>({fit:"string"==typeof t.fit_label&&t.fit_label?t.fit_label:Wm.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 Py;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Py||(Py={}));class My{constructor(t,e,n,i,r={},s,o){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const a=o||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",a),this.tfrModal=new xy(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"),Bd.getInstance().setEnv(e),new Mm(t,new xm)))(Number(this.shopId),a),this.tfrSizeRec=new Dy(n,s,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.bind(this),this.onTryOnClick.bind(this));try{this.vtoComponent=new Gm(i)}catch(t){}}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(by);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(ty);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(cy);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(Sy)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(yy)}}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()}async onTryOnClick(t,e){const n=await this.shop.tryOn(t,e);this.vtoComponent.init(),this.vtoComponent.onNewFramesReady(n)}onUserProfileChange(t){var e,n,i,r;switch(t.avatar_status){case Py.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Xm),this.tfrModal.onNotCreated();break;case Py.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Py.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(yy),this.tfrModal.onError(yy)}}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 Fy=async({shopId:t,modalDivId:e,sizeRecMainDivId:n,vtoMainDivId:i,hooks:r={},cssVariables:s={},env:o="dev"})=>{const a=new My(t,e,n,i,r,s,o);return await a.onInit(),a};export{n as InitImageSlider,Fy as initFittingRoom};