@thefittingroom/shop-ui 3.2.0 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/SizeRec.js +11 -0
  2. package/.rollup.cache/Users/supagoku/projects/fit/shop-sdk-ui/dist/esm/components/SizeRec.js.map +1 -0
  3. package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/tfr-size-rec.js +17 -4
  4. package/.rollup.cache/Users/supagoku/projects/fit/shop-sdk-ui/dist/esm/tfr-size-rec.js.map +1 -0
  5. package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/tfr.js +6 -2
  6. package/.rollup.cache/Users/supagoku/projects/fit/shop-sdk-ui/dist/esm/tfr.js.map +1 -0
  7. package/.rollup.cache/Users/supagoku/projects/fit/shop-sdk-ui/dist/tsconfig.tsbuildinfo +1 -0
  8. package/dist/esm/index.js +36 -8
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/esm/index.min.js +56 -56
  11. package/dist/esm/index.min.js.map +1 -1
  12. package/dist/tsconfig.tsbuildinfo +1 -1
  13. package/package.json +2 -2
  14. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/components/SizeRec.js.map +0 -1
  15. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/tfr-size-rec.js.map +0 -1
  16. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/esm/tfr.js.map +0 -1
  17. package/.rollup.cache/home/runner/work/shop-sdk-ui/shop-sdk-ui/dist/tsconfig.tsbuildinfo +0 -1
  18. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ErrorModal.js +0 -0
  19. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ErrorModal.js.map +0 -0
  20. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/FitModal.js +0 -0
  21. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/FitModal.js.map +0 -0
  22. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ForgotPasswordModal.js +0 -0
  23. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ForgotPasswordModal.js.map +0 -0
  24. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/LoadingAvatarModal.js +0 -0
  25. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/LoadingAvatarModal.js.map +0 -0
  26. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/LoggedOutModal.js +0 -0
  27. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/LoggedOutModal.js.map +0 -0
  28. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ModalManager.js +0 -0
  29. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ModalManager.js.map +0 -0
  30. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/NoAvatarModal.js +0 -0
  31. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/NoAvatarModal.js.map +0 -0
  32. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ResetLinkModal.js +0 -0
  33. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ResetLinkModal.js.map +0 -0
  34. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ScanCodeModal.js +0 -0
  35. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/ScanCodeModal.js.map +0 -0
  36. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/SignInModal.js +0 -0
  37. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/SignInModal.js.map +0 -0
  38. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/SizeErrorModal.js +0 -0
  39. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/SizeErrorModal.js.map +0 -0
  40. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/TryOnModal.js +0 -0
  41. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Modals/TryOnModal.js.map +0 -0
  42. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Vto.js +0 -0
  43. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/Vto.js.map +0 -0
  44. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/index.js +0 -0
  45. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/index.js.map +0 -0
  46. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/locale.js +0 -0
  47. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/locale.js.map +0 -0
  48. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/slider.js +0 -0
  49. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/slider.js.map +0 -0
  50. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/svgs.js +0 -0
  51. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/svgs.js.map +0 -0
  52. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/uiError.js +0 -0
  53. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/components/uiError.js.map +0 -0
  54. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/helpers/telephone.js +0 -0
  55. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/helpers/telephone.js.map +0 -0
  56. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/helpers/validations.js +0 -0
  57. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/helpers/validations.js.map +0 -0
  58. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/index.js +0 -0
  59. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/index.js.map +0 -0
  60. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/init.js +0 -0
  61. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/init.js.map +0 -0
  62. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/styles/index.js +0 -0
  63. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/styles/index.js.map +0 -0
  64. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/tfr-modal.js +0 -0
  65. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/tfr-modal.js.map +0 -0
  66. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/types/index.js +0 -0
  67. /package/.rollup.cache/{home/runner/work/shop-sdk-ui → Users/supagoku/projects/fit}/shop-sdk-ui/dist/esm/types/index.js.map +0 -0
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * thefittingroom v3.2.0 (2025-08-26T01:37:18.866Z)
2
+ * thefittingroom v3.2.2 (2025-09-09T16:44:32.203Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  function e(t,n){let i=function(){0!==n.length&&e(n.slice(-1),n.slice(0,-1))};var r=new Image;r.onload=i,r.onerror=i,r.src=t}function t(t){e(t.slice(-1),t.slice(0,-1))}const n=(e,n)=>{const i=document.getElementById(e);if(!i)throw new Error(`Slider with id ${e} not found`);return{Load(e,r){if(!Array.isArray(e)||!e.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");t(e);const s=void 0!==r?r:0;i.value=s.toString(),i.max=(e.length-1).toString();const o=()=>{const t=parseInt(i.value);n(i,e[t])};return n(i,e[s]),i.removeEventListener("input",o),i.addEventListener("input",o),()=>{i.removeEventListener("input",o)}}}},i=function(e){const t=[];let n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&i+1<e.length&&56320==(64512&e.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++i)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|128)}return t},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(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let t=0;t<e.length;t+=3){const r=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,c=a?e[t+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(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,i=0;for(;n<e.length;){const r=e[n++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=e[n++];t[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{const s=e[n++],o=e[n++];t[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let t=0;t<e.length;){const r=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==r||null==o||null==a||null==c)throw new s;const l=r<<2|o>>4;if(i.push(l),64!==a){const e=o<<4&240|a>>2;if(i.push(e),64!==c){const e=a<<6&192|c;i.push(e)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};
6
6
  /*!
7
- * thefittingroom v2.0.7 (2025-08-01T21:17:06.966Z)
7
+ * thefittingroom v2.0.8 (2025-08-04T16:23:04.367Z)
8
8
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
9
9
  */class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const o=function(e){return function(e){const t=i(e);return r.encodeByteArray(t,!0)}(e).replace(/\./g,"")},a=function(e){try{return r.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
10
10
  /**
@@ -201,7 +201,7 @@ class f{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
201
201
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
202
  * See the License for the specific language governing permissions and
203
203
  * limitations under the License.
204
- */var M;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(M||(M={}));const F={debug:M.DEBUG,verbose:M.VERBOSE,info:M.INFO,warn:M.WARN,error:M.ERROR,silent:M.SILENT},z=M.INFO,U={[M.DEBUG]:"log",[M.VERBOSE]:"log",[M.INFO]:"info",[M.WARN]:"warn",[M.ERROR]:"error"},V=(e,t,...n)=>{if(t<e.logLevel)return;const i=(new Date).toISOString(),r=U[t];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[r](`[${i}] ${e.name}:`,...n)};class B{constructor(e){this.name=e,this._logLevel=z,this._logHandler=V,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in M))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?F[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,M.DEBUG,...e),this._logHandler(this,M.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,M.VERBOSE,...e),this._logHandler(this,M.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,M.INFO,...e),this._logHandler(this,M.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,M.WARN,...e),this._logHandler(this,M.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,M.ERROR,...e),this._logHandler(this,M.ERROR,...e)}}let j,H;const $=new WeakMap,q=new WeakMap,G=new WeakMap,K=new WeakMap,W=new WeakMap;let Q={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return q.get(e);if("objectStoreNames"===t)return e.objectStoreNames||G.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return X(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function J(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(H||(H=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Z(this),t),X($.get(this))}:function(...t){return X(e.apply(Z(this),t))}:function(t,...n){const i=e.call(Z(this),t,...n);return G.set(i,t.sort?t.sort():[t]),X(i)}}function Y(e){return"function"==typeof e?J(e):(e instanceof IDBTransaction&&function(e){if(q.has(e))return;const t=new Promise((t,n)=>{const i=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",s),e.removeEventListener("abort",s)},r=()=>{t(),i()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",r),e.addEventListener("error",s),e.addEventListener("abort",s)});q.set(e,t)}(e),t=e,(j||(j=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,Q):e);var t}function X(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const i=()=>{e.removeEventListener("success",r),e.removeEventListener("error",s)},r=()=>{t(X(e.result)),i()},s=()=>{n(e.error),i()};e.addEventListener("success",r),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&$.set(t,e)}).catch(()=>{}),W.set(t,e),t}(e);if(K.has(e))return K.get(e);const t=Y(e);return t!==e&&(K.set(e,t),W.set(t,e)),t}const Z=e=>W.get(e);const ee=["get","getKey","getAll","getAllKeys","count"],te=["put","add","delete","clear"],ne=new Map;function ie(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ne.get(t))return ne.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,r=te.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!ee.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,r?"readwrite":"readonly");let o=s.store;return i&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),r&&s.done]))[0]};return ne.set(t,s),s}Q=(e=>({...e,get:(t,n,i)=>ie(t,n)||e.get(t,n,i),has:(t,n)=>!!ie(t,n)||e.has(t,n)}))(Q);
204
+ */var M;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(M||(M={}));const z={debug:M.DEBUG,verbose:M.VERBOSE,info:M.INFO,warn:M.WARN,error:M.ERROR,silent:M.SILENT},F=M.INFO,U={[M.DEBUG]:"log",[M.VERBOSE]:"log",[M.INFO]:"info",[M.WARN]:"warn",[M.ERROR]:"error"},V=(e,t,...n)=>{if(t<e.logLevel)return;const i=(new Date).toISOString(),r=U[t];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[r](`[${i}] ${e.name}:`,...n)};class B{constructor(e){this.name=e,this._logLevel=F,this._logHandler=V,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in M))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?z[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,M.DEBUG,...e),this._logHandler(this,M.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,M.VERBOSE,...e),this._logHandler(this,M.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,M.INFO,...e),this._logHandler(this,M.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,M.WARN,...e),this._logHandler(this,M.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,M.ERROR,...e),this._logHandler(this,M.ERROR,...e)}}let j,H;const $=new WeakMap,q=new WeakMap,G=new WeakMap,K=new WeakMap,W=new WeakMap;let Q={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return q.get(e);if("objectStoreNames"===t)return e.objectStoreNames||G.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return X(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function J(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(H||(H=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Z(this),t),X($.get(this))}:function(...t){return X(e.apply(Z(this),t))}:function(t,...n){const i=e.call(Z(this),t,...n);return G.set(i,t.sort?t.sort():[t]),X(i)}}function Y(e){return"function"==typeof e?J(e):(e instanceof IDBTransaction&&function(e){if(q.has(e))return;const t=new Promise((t,n)=>{const i=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",s),e.removeEventListener("abort",s)},r=()=>{t(),i()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",r),e.addEventListener("error",s),e.addEventListener("abort",s)});q.set(e,t)}(e),t=e,(j||(j=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,Q):e);var t}function X(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const i=()=>{e.removeEventListener("success",r),e.removeEventListener("error",s)},r=()=>{t(X(e.result)),i()},s=()=>{n(e.error),i()};e.addEventListener("success",r),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&$.set(t,e)}).catch(()=>{}),W.set(t,e),t}(e);if(K.has(e))return K.get(e);const t=Y(e);return t!==e&&(K.set(e,t),W.set(t,e)),t}const Z=e=>W.get(e);const ee=["get","getKey","getAll","getAllKeys","count"],te=["put","add","delete","clear"],ne=new Map;function ie(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ne.get(t))return ne.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,r=te.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!ee.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,r?"readwrite":"readonly");let o=s.store;return i&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),r&&s.done]))[0]};return ne.set(t,s),s}Q=(e=>({...e,get:(t,n,i)=>ie(t,n)||e.get(t,n,i),has:(t,n)=>!!ie(t,n)||e.has(t,n)}))(Q);
205
205
  /**
206
206
  * @license
207
207
  * Copyright 2019 Google LLC
@@ -218,7 +218,7 @@ class f{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 re{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const se="@firebase/app",oe="0.13.2",ae=new B("@firebase/app"),ce="@firebase/app-compat",le="@firebase/analytics-compat",ue="@firebase/analytics",he="@firebase/app-check-compat",de="@firebase/app-check",fe="@firebase/auth",pe="@firebase/auth-compat",ge="@firebase/database",me="@firebase/data-connect",ye="@firebase/database-compat",ve="@firebase/functions",we="@firebase/functions-compat",be="@firebase/installations",_e="@firebase/installations-compat",Se="@firebase/messaging",Ee="@firebase/messaging-compat",Te="@firebase/performance",Ie="@firebase/performance-compat",Ce="@firebase/remote-config",ke="@firebase/remote-config-compat",Ae="@firebase/storage",Re="@firebase/storage-compat",xe="@firebase/firestore",Ne="@firebase/ai",Oe="@firebase/firestore-compat",Le="firebase",Pe="[DEFAULT]",De={[se]:"fire-core",[ce]:"fire-core-compat",[ue]:"fire-analytics",[le]:"fire-analytics-compat",[de]:"fire-app-check",[he]:"fire-app-check-compat",[fe]:"fire-auth",[pe]:"fire-auth-compat",[ge]:"fire-rtdb",[me]:"fire-data-connect",[ye]:"fire-rtdb-compat",[ve]:"fire-fn",[we]:"fire-fn-compat",[be]:"fire-iid",[_e]:"fire-iid-compat",[Se]:"fire-fcm",[Ee]:"fire-fcm-compat",[Te]:"fire-perf",[Ie]:"fire-perf-compat",[Ce]:"fire-rc",[ke]:"fire-rc-compat",[Ae]:"fire-gcs",[Re]:"fire-gcs-compat",[xe]:"fire-fst",[Oe]:"fire-fst-compat",[Ne]:"fire-vertex","fire-js":"fire-js",[Le]:"fire-js-all"},Me=new Map,Fe=new Map,ze=new Map;function Ue(e,t){try{e.container.addComponent(t)}catch(n){ae.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Ve(e){const t=e.name;if(ze.has(t))return ae.debug(`There were multiple attempts to register component ${t}.`),!1;ze.set(t,e);for(const t of Me.values())Ue(t,e);for(const t of Fe.values())Ue(t,e);return!0}function Be(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function je(e){return null!=e&&void 0!==e.settings}
221
+ class re{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const se="@firebase/app",oe="0.13.2",ae=new B("@firebase/app"),ce="@firebase/app-compat",le="@firebase/analytics-compat",ue="@firebase/analytics",he="@firebase/app-check-compat",de="@firebase/app-check",fe="@firebase/auth",pe="@firebase/auth-compat",ge="@firebase/database",me="@firebase/data-connect",ye="@firebase/database-compat",ve="@firebase/functions",we="@firebase/functions-compat",be="@firebase/installations",_e="@firebase/installations-compat",Se="@firebase/messaging",Ee="@firebase/messaging-compat",Te="@firebase/performance",Ie="@firebase/performance-compat",Ce="@firebase/remote-config",ke="@firebase/remote-config-compat",Ae="@firebase/storage",Re="@firebase/storage-compat",xe="@firebase/firestore",Ne="@firebase/ai",Oe="@firebase/firestore-compat",Le="firebase",Pe="[DEFAULT]",De={[se]:"fire-core",[ce]:"fire-core-compat",[ue]:"fire-analytics",[le]:"fire-analytics-compat",[de]:"fire-app-check",[he]:"fire-app-check-compat",[fe]:"fire-auth",[pe]:"fire-auth-compat",[ge]:"fire-rtdb",[me]:"fire-data-connect",[ye]:"fire-rtdb-compat",[ve]:"fire-fn",[we]:"fire-fn-compat",[be]:"fire-iid",[_e]:"fire-iid-compat",[Se]:"fire-fcm",[Ee]:"fire-fcm-compat",[Te]:"fire-perf",[Ie]:"fire-perf-compat",[Ce]:"fire-rc",[ke]:"fire-rc-compat",[Ae]:"fire-gcs",[Re]:"fire-gcs-compat",[xe]:"fire-fst",[Oe]:"fire-fst-compat",[Ne]:"fire-vertex","fire-js":"fire-js",[Le]:"fire-js-all"},Me=new Map,ze=new Map,Fe=new Map;function Ue(e,t){try{e.container.addComponent(t)}catch(n){ae.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Ve(e){const t=e.name;if(Fe.has(t))return ae.debug(`There were multiple attempts to register component ${t}.`),!1;Fe.set(t,e);for(const t of Me.values())Ue(t,e);for(const t of ze.values())Ue(t,e);return!0}function Be(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function je(e){return null!=e&&void 0!==e.settings}
222
222
  /**
223
223
  * @license
224
224
  * Copyright 2019 Google LLC
@@ -267,7 +267,7 @@ class $e{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
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 qe="11.10.0";function Ge(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const i=Object.assign({name:Pe,automaticDataCollectionEnabled:!0},t),r=i.name;if("string"!=typeof r||!r)throw He.create("bad-app-name",{appName:String(r)});if(n||(n=h()),!n)throw He.create("no-options");const s=Me.get(r);if(s){if(T(n,s.options)&&T(i,s.config))return s;throw He.create("duplicate-app",{appName:r})}const o=new D(r);for(const e of ze.values())o.addComponent(e);const a=new $e(n,i,o);return Me.set(r,a),a}function Ke(e=Pe){const t=Me.get(e);if(!t&&e===Pe&&h())return Ge();if(!t)throw He.create("no-app",{appName:e});return t}function We(e,t,n){var i;let r=null!==(i=De[e])&&void 0!==i?i:e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const e=[`Unable to register library "${r}" with version "${t}":`];return s&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void ae.warn(e.join(" "))}Ve(new O(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}
270
+ */const qe="11.10.0";function Ge(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const i=Object.assign({name:Pe,automaticDataCollectionEnabled:!0},t),r=i.name;if("string"!=typeof r||!r)throw He.create("bad-app-name",{appName:String(r)});if(n||(n=h()),!n)throw He.create("no-options");const s=Me.get(r);if(s){if(T(n,s.options)&&T(i,s.config))return s;throw He.create("duplicate-app",{appName:r})}const o=new D(r);for(const e of Fe.values())o.addComponent(e);const a=new $e(n,i,o);return Me.set(r,a),a}function Ke(e=Pe){const t=Me.get(e);if(!t&&e===Pe&&h())return Ge();if(!t)throw He.create("no-app",{appName:e});return t}function We(e,t,n){var i;let r=null!==(i=De[e])&&void 0!==i?i:e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const e=[`Unable to register library "${r}" with version "${t}":`];return s&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void ae.warn(e.join(" "))}Ve(new O(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}
271
271
  /**
272
272
  * @license
273
273
  * Copyright 2021 Google LLC
@@ -334,7 +334,7 @@ SPDX-License-Identifier: Apache-2.0
334
334
  Copyright The Closure Library Authors.
335
335
  SPDX-License-Identifier: Apache-2.0
336
336
  */
337
- var i=i||{},r=this||self;function s(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function o(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function a(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){if(!e)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),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function l(e,t,n){return(l=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?a:c).apply(null,arguments)}function u(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function h(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}function d(e){const t=e.length;if(0<t){const n=Array(t);for(let i=0;i<t;i++)n[i]=e[i];return n}return[]}function f(e,t){for(let t=1;t<arguments.length;t++){const n=arguments[t];if(s(n)){const t=e.length||0,i=n.length||0;e.length=t+i;for(let r=0;r<i;r++)e[t+r]=n[r]}else e.push(n)}}function p(e){return/^[\s\xa0]*$/.test(e)}function g(){var e=r.navigator;return e&&(e=e.userAgent)?e:""}function m(e){return m[" "](e),e}m[" "]=function(){};var y=!(-1==g().indexOf("Gecko")||-1!=g().toLowerCase().indexOf("webkit")&&-1==g().indexOf("Edge")||-1!=g().indexOf("Trident")||-1!=g().indexOf("MSIE")||-1!=g().indexOf("Edge"));function v(e,t,n){for(const i in e)t.call(n,e[i],i,e)}function w(e){const t={};for(const n in e)t[n]=e[n];return t}const b="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function _(e,t){let n,i;for(let t=1;t<arguments.length;t++){for(n in i=arguments[t],i)e[n]=i[n];for(let t=0;t<b.length;t++)n=b[t],Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}}function S(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function E(e){r.setTimeout(()=>{throw e},0)}function T(){var e=R;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var I=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new C,e=>e.reset());class C{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let k,A=!1,R=new class{constructor(){this.h=this.g=null}add(e,t){const n=I.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},x=()=>{const e=r.Promise.resolve(void 0);k=()=>{e.then(N)}};var N=()=>{for(var e;e=T();){try{e.h.call(e.g)}catch(e){E(e)}var t=I;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}A=!1};function O(){this.s=this.s,this.C=this.C}function L(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}O.prototype.s=!1,O.prototype.ma=function(){this.s||(this.s=!0,this.N())},O.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},L.prototype.h=function(){this.defaultPrevented=!0};var P=function(){if(!r.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};r.addEventListener("test",e,t),r.removeEventListener("test",e,t)}catch(e){}return e}();function D(e,t){if(L.call(this,e?e.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,e){var n=this.type=e.type,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(y){e:{try{m(t.nodeName);var r=!0;break e}catch(e){}r=!1}r||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,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!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:M[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&D.aa.h.call(this)}}h(D,L);var M={2:"touch",3:"pen",4:"mouse"};D.prototype.h=function(){D.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var F="closure_listenable_"+(1e6*Math.random()|0),z=0;function U(e,t,n,i,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.ha=r,this.key=++z,this.da=this.fa=!1}function V(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function B(e){this.src=e,this.g={},this.h=0}function j(e,t){var n=t.type;if(n in e.g){var i,r=e.g[n],s=Array.prototype.indexOf.call(r,t,void 0);(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(V(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function H(e,t,n,i){for(var r=0;r<e.length;++r){var s=e[r];if(!s.da&&s.listener==t&&s.capture==!!n&&s.ha==i)return r}return-1}B.prototype.add=function(e,t,n,i,r){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var o=H(e,t,i,r);return-1<o?(t=e[o],n||(t.fa=!1)):((t=new U(t,this.src,s,!!i,r)).fa=n,e.push(t)),t};var $="closure_lm_"+(1e6*Math.random()|0),q={};function G(e,t,n,i,r){if(Array.isArray(t)){for(var s=0;s<t.length;s++)G(e,t[s],n,i,r);return null}return n=Z(n),e&&e[F]?e.K(t,n,!!o(i)&&!!i.capture,r):function(e,t,n,i,r,s){if(!t)throw Error("Invalid event type");var a=o(r)?!!r.capture:!!r,c=Y(e);if(c||(e[$]=c=new B(e)),n=c.add(t,n,i,a,s),n.proxy)return n;if(i=function(){function e(n){return t.call(e.src,e.listener,n)}const t=J;return e}(),n.proxy=i,i.src=e,i.listener=n,e.addEventListener)P||(r=a),void 0===r&&(r=!1),e.addEventListener(t.toString(),i,r);else if(e.attachEvent)e.attachEvent(Q(t.toString()),i);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(i)}return n}(e,t,n,!1,i,r)}function K(e,t,n,i,r){if(Array.isArray(t))for(var s=0;s<t.length;s++)K(e,t[s],n,i,r);else i=o(i)?!!i.capture:!!i,n=Z(n),e&&e[F]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=H(s=e.g[t],n,i,r))&&(V(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete e.g[t],e.h--)))):e&&(e=Y(e))&&(t=e.g[t.toString()],e=-1,t&&(e=H(t,n,i,r)),(n=-1<e?t[e]:null)&&W(n))}function W(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[F])j(t.i,e);else{var n=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(n,i,e.capture):t.detachEvent?t.detachEvent(Q(n),i):t.addListener&&t.removeListener&&t.removeListener(i),(n=Y(t))?(j(n,e),0==n.h&&(n.src=null,t[$]=null)):V(e)}}}function Q(e){return e in q?q[e]:q[e]="on"+e}function J(e,t){if(e.da)e=!0;else{t=new D(t,this);var n=e.listener,i=e.ha||e.src;e.fa&&W(e),e=n.call(i,t)}return e}function Y(e){return(e=e[$])instanceof B?e:null}var X="__closure_events_fn_"+(1e9*Math.random()>>>0);function Z(e){return"function"==typeof e?e:(e[X]||(e[X]=function(t){return e.handleEvent(t)}),e[X])}function ee(){O.call(this),this.i=new B(this),this.M=this,this.F=null}function te(e,t){var n,i=e.F;if(i)for(n=[];i;i=i.F)n.push(i);if(e=e.M,i=t.type||t,"string"==typeof t)t=new L(t,e);else if(t instanceof L)t.target=t.target||e;else{var r=t;_(t=new L(i,e),r)}if(r=!0,n)for(var s=n.length-1;0<=s;s--){var o=t.g=n[s];r=ne(o,i,!0,t)&&r}if(r=ne(o=t.g=e,i,!0,t)&&r,r=ne(o,i,!1,t)&&r,n)for(s=0;s<n.length;s++)r=ne(o=t.g=n[s],i,!1,t)&&r}function ne(e,t,n,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var r=!0,s=0;s<t.length;++s){var o=t[s];if(o&&!o.da&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.fa&&j(e.i,o),r=!1!==a.call(c,i)&&r}}return r&&!i.defaultPrevented}function ie(e,t,n){if("function"==typeof e)n&&(e=l(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=l(e.handleEvent,e)}return 2147483647<Number(t)?-1:r.setTimeout(e,t||0)}function re(e){e.g=ie(()=>{e.g=null,e.i&&(e.i=!1,re(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}h(ee,O),ee.prototype[F]=!0,ee.prototype.removeEventListener=function(e,t,n,i){K(this,e,t,n,i)},ee.prototype.N=function(){if(ee.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],i=0;i<n.length;i++)V(n[i]);delete t.g[e],t.h--}}this.F=null},ee.prototype.K=function(e,t,n,i){return this.i.add(String(e),t,!1,n,i)},ee.prototype.L=function(e,t,n,i){return this.i.add(String(e),t,!0,n,i)};class se extends O{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:re(this)}N(){super.N(),this.g&&(r.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function oe(e){O.call(this),this.h=e,this.g={}}h(oe,O);var ae=[];function ce(e){v(e.g,function(e,t){this.g.hasOwnProperty(t)&&W(e)},e),e.g={}}oe.prototype.N=function(){oe.aa.N.call(this),ce(this)},oe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var le=r.JSON.stringify,ue=r.JSON.parse,he=class{stringify(e){return r.JSON.stringify(e,void 0)}parse(e){return r.JSON.parse(e,void 0)}};function de(){}function fe(e){return e.h||(e.h=e.i())}function pe(){}de.prototype.h=null;var ge={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function me(){L.call(this,"d")}function ye(){L.call(this,"c")}h(me,L),h(ye,L);var ve={},we=null;function be(){return we=we||new ee}function _e(e){L.call(this,ve.La,e)}function Se(e){const t=be();te(t,new _e(t))}function Ee(e,t){L.call(this,ve.STAT_EVENT,e),this.stat=t}function Te(e){const t=be();te(t,new Ee(t,e))}function Ie(e,t){L.call(this,ve.Ma,e),this.size=t}function Ce(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return r.setTimeout(function(){e()},t)}function ke(){this.g=!0}function Ae(e,t,n,i){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var i=n[e];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 le(n)}catch(e){return t}}(e,n)+(i?" "+i:"")})}ve.La="serverreachability",h(_e,L),ve.STAT_EVENT="statevent",h(Ee,L),ve.Ma="timingevent",h(Ie,L),ke.prototype.xa=function(){this.g=!1},ke.prototype.info=function(){};var Re,xe={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Ne={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function Oe(){}function Le(e,t,n,i){this.j=e,this.i=t,this.l=n,this.R=i||1,this.U=new oe(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Pe}function Pe(){this.i=null,this.g="",this.h=!1}h(Oe,de),Oe.prototype.g=function(){return new XMLHttpRequest},Oe.prototype.i=function(){return{}},Re=new Oe;var De={},Me={};function Fe(e,t,n){e.L=1,e.v=vt(rt(t)),e.m=n,e.P=!0,ze(e,null)}function ze(e,t){e.F=Date.now(),Be(e),e.A=rt(e.v);var n=e.A,i=e.R;Array.isArray(i)||(i=[String(i)]),Ot(n.i,"t",i),e.C=0,n=e.j.J,e.h=new Pe,e.g=bn(e.j,n?t:null,!e.m),0<e.O&&(e.M=new se(l(e.Y,e,e.g),e.O)),t=e.U,n=e.g,i=e.ca;var r="readystatechange";Array.isArray(r)||(r&&(ae[0]=r.toString()),r=ae);for(var s=0;s<r.length;s++){var o=G(n,r[s],i||t.handleEvent,!1,t.h||t);if(!o)break;t.g[o.key]=o}t=e.H?w(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),Se(),function(e,t,n,i,r,s){e.info(function(){if(e.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+"]: "+t+"\n"+n+"\n"+o})}(e.i,e.u,e.A,e.l,e.R,e.m)}function Ue(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function Ve(e,t){var n=e.C,i=t.indexOf("\n",n);return-1==i?Me:(n=Number(t.substring(n,i)),isNaN(n)?De:(i+=1)+n>t.length?Me:(t=t.slice(i,i+n),e.C=i+n,t))}function Be(e){e.S=Date.now()+e.I,je(e,e.I)}function je(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ce(l(e.ba,e),t)}function He(e){e.B&&(r.clearTimeout(e.B),e.B=null)}function $e(e){0==e.j.G||e.J||gn(e.j,e)}function qe(e){He(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ce(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function Ge(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||Ye(n.h,e)))if(!e.K&&Ye(n.h,e)&&3==n.G){try{var i=n.Da.g.parse(t)}catch(e){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;pn(n),rn(n)}hn(n),Te(18)}}else n.za=r[1],0<n.za-n.T&&37500>r[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ce(l(n.Za,n),6e3));if(1>=Je(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else yn(n,11)}else if((e.K||n.g==e)&&pn(n),!p(t))for(r=n.Da.g.parse(t),t=0;t<r.length;t++){let l=r[t];if(n.T=l[0],l=l[1],2==n.G)if("c"==l[0]){n.K=l[1],n.ia=l[2];const t=l[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));const r=l[4];null!=r&&(n.Aa=r,n.j.info("SVER="+n.Aa));const u=l[5];null!=u&&"number"==typeof u&&0<u&&(i=1.5*u,n.L=i,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;const h=e.g;if(h){const e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=i.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(Xe(s,s.h),s.h=null))}if(i.D){const e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.ya=e,yt(i.I,i.D,e))}}n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms"));var o=e;if((i=n).qa=wn(i,i.J?i.ia:null,i.W),o.K){Ze(i.h,o);var a=o,c=i.L;c&&(a.I=c),a.B&&(He(a),Be(a)),i.g=o}else un(i);0<n.i.length&&on(n)}else"stop"!=l[0]&&"close"!=l[0]||yn(n,7);else 3==n.G&&("stop"==l[0]||"close"==l[0]?"stop"==l[0]?yn(n,7):nn(n):"noop"!=l[0]&&n.l&&n.l.ta(l),n.v=0)}Se()}catch(e){}}Le.prototype.ca=function(e){e=e.target;const t=this.M;t&&3==Xt(e)?t.j():this.Y(e)},Le.prototype.Y=function(e){try{if(e==this.g)e:{const d=Xt(this.g);var t=this.g.Ba();this.g.Z();if(!(3>d)&&(3!=d||this.g&&(this.h.h||this.g.oa()||Zt(this.g)))){this.J||4!=d||7==t||Se(),He(this);var n=this.g.Z();this.X=n;t:if(Ue(this)){var i=Zt(this.g);e="";var s=i.length,o=4==Xt(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){qe(this),$e(this);var a="";break t}this.h.i=new r.TextDecoder}for(t=0;t<s;t++)this.h.h=!0,e+=this.h.i.decode(i[t],{stream:!(o&&t==s-1)});i.length=0,this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.oa();if(this.o=200==n,function(e,t,n,i,r,s,o){e.info(function(){return"XMLHTTP RESP ("+i+") [ attempt "+r+"]: "+t+"\n"+n+"\n"+s+" "+o})}(this.i,this.u,this.A,this.l,this.R,d,n),this.o){if(this.T&&!this.K){t:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!p(c)){var u=c;break t}}u=null}if(!(n=u)){this.o=!1,this.s=3,Te(12),qe(this),$e(this);break e}Ae(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Ge(this,n)}if(this.P){let e;for(n=!0;!this.J&&this.C<a.length;){if(e=Ve(this,a),e==Me){4==d&&(this.s=4,Te(14),n=!1),Ae(this.i,this.l,null,"[Incomplete Response]");break}if(e==De){this.s=4,Te(15),Ae(this.i,this.l,a,"[Invalid Chunk]"),n=!1;break}Ae(this.i,this.l,e,null),Ge(this,e)}if(Ue(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=d||0!=a.length||this.h.h||(this.s=1,Te(16),n=!1),this.o=this.o&&n,n){if(0<a.length&&!this.W){this.W=!0;var h=this.j;h.g==this&&h.ba&&!h.M&&(h.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),dn(h),h.M=!0,Te(11))}}else Ae(this.i,this.l,a,"[Invalid Chunked Response]"),qe(this),$e(this)}else Ae(this.i,this.l,a,null),Ge(this,a);4==d&&qe(this),this.o&&!this.J&&(4==d?gn(this.j,this):(this.o=!1,Be(this)))}else(function(e){const t={};e=(e.g&&2<=Xt(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let i=0;i<e.length;i++){if(p(e[i]))continue;var n=S(e[i]);const r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const s=t[r]||[];t[r]=s,s.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==n&&0<a.indexOf("Unknown SID")?(this.s=3,Te(12)):(this.s=0,Te(13)),qe(this),$e(this)}}}catch(e){}},Le.prototype.cancel=function(){this.J=!0,qe(this)},Le.prototype.ba=function(){this.B=null;const e=Date.now();0<=e-this.S?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.A),2!=this.L&&(Se(),Te(17)),qe(this),this.s=2,$e(this)):je(this,this.S-e)};var Ke=class{constructor(e,t){this.g=e,this.map=t}};function We(e){this.l=e||10,r.PerformanceNavigationTiming?e=0<(e=r.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(r.chrome&&r.chrome.loadTimes&&r.chrome.loadTimes()&&r.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Qe(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Je(e){return e.h?1:e.g?e.g.size:0}function Ye(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Xe(e,t){e.g?e.g.add(t):e.h=t}function Ze(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function et(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.D);return t}return d(e.i)}function tt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(s(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(s(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const i in e)t[n++]=i;return t}}}(e),i=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(s(e)){for(var t=[],n=e.length,i=0;i<n;i++)t.push(e[i]);return t}for(i in t=[],n=0,e)t[n++]=e[i];return t}(e),r=i.length,o=0;o<r;o++)t.call(void 0,i[o],n&&n[o],e)}We.prototype.cancel=function(){if(this.i=et(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var nt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function it(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof it){this.h=e.h,st(this,e.j),this.o=e.o,this.g=e.g,ot(this,e.s),this.l=e.l;var t=e.i,n=new At;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),at(this,n),this.m=e.m}else e&&(t=String(e).match(nt))?(this.h=!1,st(this,t[1]||"",!0),this.o=wt(t[2]||""),this.g=wt(t[3]||"",!0),ot(this,t[4]),this.l=wt(t[5]||"",!0),at(this,t[6]||"",!0),this.m=wt(t[7]||"")):(this.h=!1,this.i=new At(null,this.h))}function rt(e){return new it(e)}function st(e,t,n){e.j=n?wt(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function ot(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function at(e,t,n){t instanceof At?(e.i=t,function(e,t){t&&!e.j&&(Rt(e),e.i=null,e.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(xt(this,t),Ot(this,n,e))},e)),e.j=t}(e.i,e.h)):(n||(t=bt(t,Ct)),e.i=new At(t,e.h))}function yt(e,t,n){e.i.set(t,n)}function vt(e){return yt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function wt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function bt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,_t),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function _t(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}it.prototype.toString=function(){var e=[],t=this.j;t&&e.push(bt(t,Et,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(bt(t,Et,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(bt(n,"/"==n.charAt(0)?It:Tt,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",bt(n,kt)),e.join("")};var St,Et=/[#\/\?@]/g,Tt=/[#\?:]/g,It=/[#\?]/g,Ct=/[#\?@]/g,kt=/#/g;function At(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Rt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var i=e[n].indexOf("="),r=null;if(0<=i){var s=e[n].substring(0,i);r=e[n].substring(i+1)}else s=e[n];t(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function xt(e,t){Rt(e),t=Lt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Nt(e,t){return Rt(e),t=Lt(e,t),e.g.has(t)}function Ot(e,t,n){xt(e,t),0<n.length&&(e.i=null,e.g.set(Lt(e,t),d(n)),e.h+=n.length)}function Lt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Pt(e,t,n,i,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),i(n)}catch(e){}}function Dt(){this.g=new he}function Mt(e,t,n){const i=n||"";try{tt(e,function(e,n){let r=e;o(e)&&(r=le(e)),t.push(i+n+"="+encodeURIComponent(r))})}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}function Ft(e){this.l=e.Ub||null,this.j=e.eb||!1}function zt(e,t){ee.call(this),this.D=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function Ut(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function Vt(e){e.readyState=4,e.l=null,e.j=null,e.v=null,Bt(e)}function Bt(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function jt(e){let t="";return v(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function Ht(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=jt(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):yt(e,t,n))}function $t(e){ee.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(e=At.prototype).add=function(e,t){Rt(this),this.i=null,e=Lt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){Rt(this),this.g.forEach(function(n,i){n.forEach(function(n){e.call(t,n,i,this)},this)},this)},e.na=function(){Rt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let i=0;i<t.length;i++){const r=e[i];for(let e=0;e<r.length;e++)n.push(t[i])}return n},e.V=function(e){Rt(this);let t=[];if("string"==typeof e)Nt(this,e)&&(t=t.concat(this.g.get(Lt(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},e.set=function(e,t){return Rt(this),this.i=null,Nt(this,e=Lt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var i=t[n];const s=encodeURIComponent(String(i)),o=this.V(i);for(i=0;i<o.length;i++){var r=s;""!==o[i]&&(r+="="+encodeURIComponent(String(o[i]))),e.push(r)}}return this.i=e.join("&")},h(Ft,de),Ft.prototype.g=function(){return new zt(this.l,this.j)},Ft.prototype.i=(St={},function(){return St}),h(zt,ee),(e=zt.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,Bt(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||r).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Vt(this)),this.readyState=0},e.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Bt(this)),this.g&&(this.readyState=3,Bt(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==r.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Ut(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},e.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?Vt(this):Bt(this),3==this.readyState&&Ut(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,Vt(this))},e.Qa=function(e){this.g&&(this.response=e,Vt(this))},e.ga=function(){this.g&&Vt(this)},e.setRequestHeader=function(e,t){this.u.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(zt.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),h($t,ee);var qt=/^https?$/i,Gt=["POST","PUT"];function Kt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,Wt(e),Jt(e)}function Wt(e){e.A||(e.A=!0,te(e,"complete"),te(e,"error"))}function Qt(e){if(e.h&&void 0!==i&&(!e.v[1]||4!=Xt(e)||2!=e.Z()))if(e.u&&4==Xt(e))ie(e.Ea,0,e);else if(te(e,"readystatechange"),4==Xt(e)){e.h=!1;try{const i=e.Z();e:switch(i){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var s;if(s=0===i){var o=String(e.D).match(nt)[1]||null;!o&&r.self&&r.self.location&&(o=r.self.location.protocol.slice(0,-1)),s=!qt.test(o?o.toLowerCase():"")}n=s}if(n)te(e,"complete"),te(e,"success");else{e.m=6;try{var a=2<Xt(e)?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.Z()+"]",Wt(e)}}finally{Jt(e)}}}function Jt(e,t){if(e.g){Yt(e);const n=e.g,i=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||te(e,"ready");try{n.onreadystatechange=i}catch(e){}}}function Yt(e){e.I&&(r.clearTimeout(e.I),e.I=null)}function Xt(e){return e.g?e.g.readyState:0}function Zt(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function en(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function tn(e){this.Aa=0,this.i=[],this.j=new ke,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=en("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=en("baseRetryDelayMs",5e3,e),this.cb=en("retryDelaySeedMs",1e4,e),this.Wa=en("forwardChannelMaxRetries",2,e),this.wa=en("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new We(e&&e.concurrentRequestLimit),this.Da=new Dt,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function nn(e){if(sn(e),3==e.G){var t=e.U++,n=rt(e.I);if(yt(n,"SID",e.K),yt(n,"RID",t),yt(n,"TYPE","terminate"),cn(e,n),(t=new Le(e,e.j,t)).L=2,t.v=vt(rt(n)),n=!1,r.navigator&&r.navigator.sendBeacon)try{n=r.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&r.Image&&((new Image).src=t.v,n=!0),n||(t.g=bn(t.j,null),t.g.ea(t.v)),t.F=Date.now(),Be(t)}vn(e)}function rn(e){e.g&&(dn(e),e.g.cancel(),e.g=null)}function sn(e){rn(e),e.u&&(r.clearTimeout(e.u),e.u=null),pn(e),e.h.cancel(),e.s&&("number"==typeof e.s&&r.clearTimeout(e.s),e.s=null)}function on(e){if(!Qe(e.h)&&!e.s){e.s=!0;var t=e.Ga;k||x(),A||(k(),A=!0),R.add(t,e),e.B=0}}function an(e,t){var n;n=t?t.l:e.U++;const i=rt(e.I);yt(i,"SID",e.K),yt(i,"RID",n),yt(i,"AID",e.T),cn(e,i),e.m&&e.o&&Ht(i,e.m,e.o),n=new Le(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=ln(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),Xe(e.h,n),Fe(n,i,t)}function cn(e,t){e.H&&v(e.H,function(e,n){yt(t,n,e)}),e.l&&tt({},function(e,n){yt(t,n,e)})}function ln(e,t,n){n=Math.min(e.i.length,n);var i=e.l?l(e.l.Na,e.l,e):null;e:{var r=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=r[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let s=!0;for(let o=0;o<n;o++){let n=r[o].g;const a=r[o].map;if(n-=t,0>n)t=Math.max(0,r[o].g-100),s=!1;else try{Mt(a,e,"req"+n+"_")}catch(e){i&&i(a)}}if(s){i=e.join("&");break e}}}return e=e.i.splice(0,n),t.D=e,i}function un(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;k||x(),A||(k(),A=!0),R.add(t,e),e.v=0}}function hn(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ce(l(e.Fa,e),mn(e,e.v)),e.v++,!0)}function dn(e){null!=e.A&&(r.clearTimeout(e.A),e.A=null)}function fn(e){e.g=new Le(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=rt(e.qa);yt(t,"RID","rpc"),yt(t,"SID",e.K),yt(t,"AID",e.T),yt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&yt(t,"TO",e.ja),yt(t,"TYPE","xmlhttp"),cn(e,t),e.m&&e.o&&Ht(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=vt(rt(t)),n.m=null,n.P=!0,ze(n,e)}function pn(e){null!=e.C&&(r.clearTimeout(e.C),e.C=null)}function gn(e,t){var n=null;if(e.g==t){pn(e),dn(e),e.g=null;var i=2}else{if(!Ye(e.h,t))return;n=t.D,Ze(e.h,t),i=1}if(0!=e.G)if(t.o)if(1==i){n=t.m?t.m.length:0,t=Date.now()-t.F;var r=e.B;te(i=be(),new Ie(i,n)),on(e)}else un(e);else if(3==(r=t.s)||0==r&&0<t.X||!(1==i&&function(e,t){return!(Je(e.h)>=e.h.j-(e.s?1:0)||(e.s?(e.i=t.D.concat(e.i),0):1==e.G||2==e.G||e.B>=(e.Va?0:e.Wa)||(e.s=Ce(l(e.Ga,e,t),mn(e,e.B)),e.B++,0)))}(e,t)||2==i&&hn(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),r){case 1:yn(e,5);break;case 4:yn(e,10);break;case 3:yn(e,6);break;default:yn(e,2)}}function mn(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function yn(e,t){if(e.j.info("Error code "+t),2==t){var n=l(e.fb,e),i=e.Xa;const t=!i;i=new it(i||"//www.google.com/images/cleardot.gif"),r.location&&"http"==r.location.protocol||st(i,"https"),vt(i),t?function(e,t){const n=new ke;if(r.Image){const i=new Image;i.onload=u(Pt,n,"TestLoadImage: loaded",!0,t,i),i.onerror=u(Pt,n,"TestLoadImage: error",!1,t,i),i.onabort=u(Pt,n,"TestLoadImage: abort",!1,t,i),i.ontimeout=u(Pt,n,"TestLoadImage: timeout",!1,t,i),r.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=e}else t(!1)}(i.toString(),n):function(e,t){new ke;const n=new AbortController,i=setTimeout(()=>{n.abort(),Pt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(i),e.ok?Pt(0,0,!0,t):Pt(0,0,!1,t)}).catch(()=>{clearTimeout(i),Pt(0,0,!1,t)})}(i.toString(),n)}else Te(2);e.G=0,e.l&&e.l.sa(t),vn(e),sn(e)}function vn(e){if(e.G=0,e.ka=[],e.l){const t=et(e.h);0==t.length&&0==e.i.length||(f(e.ka,t),f(e.ka,e.i),e.h.i.length=0,d(e.i),e.i.length=0),e.l.ra()}}function wn(e,t,n){var i=n instanceof it?rt(n):new it(n);if(""!=i.g)t&&(i.g=t+"."+i.g),ot(i,i.s);else{var s=r.location;i=s.protocol,t=t?t+"."+s.hostname:s.hostname,s=+s.port;var o=new it(null);i&&st(o,i),t&&(o.g=t),s&&ot(o,s),n&&(o.l=n),i=o}return n=e.D,t=e.ya,n&&t&&yt(i,n,t),yt(i,"VER",e.la),cn(e,i),i}function bn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new $t(new Ft({eb:n})):new $t(e.pa)).Ha(e.J),t}function _n(){}function Sn(){}function En(e,t){ee.call(this),this.g=new tn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!p(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!p(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new Cn(this)}function Tn(e){me.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function In(){ye.call(this),this.status=1}function Cn(e){this.g=e}(e=$t.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Re.g(),this.v=this.o?fe(this.o):fe(Re),this.g.onreadystatechange=l(this.Ea,this);try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Kt(this,e)}if(e=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)n.set(s,i[s]);else{if("function"!=typeof i.keys||"function"!=typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));for(const e of i.keys())n.set(e,i.get(e))}i=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),s=r.FormData&&e instanceof r.FormData,!(0<=Array.prototype.indexOf.call(Gt,t,void 0))||i||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Yt(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){Kt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,te(this,"complete"),te(this,"abort"),Jt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Jt(this,!0)),$t.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?Qt(this):this.bb())},e.bb=function(){Qt(this)},e.isActive=function(){return!!this.g},e.Z=function(){try{return 2<Xt(this)?this.g.status:-1}catch(e){return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),ue(t)}},e.Ba=function(){return this.m},e.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=tn.prototype).la=8,e.G=1,e.connect=function(e,t,n,i){Te(0),this.W=e,this.H=t||{},n&&void 0!==i&&(this.H.OSID=n,this.H.OAID=i),this.F=this.X,this.I=wn(this,null,this.W),on(this)},e.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;const r=new Le(this,this.j,e);let s=this.o;if(this.S&&(s?(s=w(s),_(s,this.S)):s=this.S),null!==this.m||this.O||(r.H=s,s=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){var i=this.i[n];if(void 0===(i="__data__"in i.map&&"string"==typeof(i=i.map.__data__)?i.length:void 0))break;if(4096<(t+=i)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=ln(this,r,t),yt(n=rt(this.I),"RID",e),yt(n,"CVER",22),this.D&&yt(n,"X-HTTP-Session-Id",this.D),cn(this,n),s&&(this.O?t="headers="+encodeURIComponent(String(jt(s)))+"&"+t:this.m&&Ht(n,this.m,s)),Xe(this.h,r),this.Ua&&yt(n,"TYPE","init"),this.P?(yt(n,"$req",t),yt(n,"SID","null"),r.T=!0,Fe(r,n,null)):Fe(r,n,t),this.G=2}}else 3==this.G&&(e?an(this,e):0==this.i.length||Qe(this.h)||an(this))},e.Fa=function(){if(this.u=null,fn(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=Ce(l(this.ab,this),e)}},e.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Te(10),rn(this),fn(this))},e.Za=function(){null!=this.C&&(this.C=null,rn(this),hn(this),Te(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),Te(2)):(this.j.info("Failed to ping google.com"),Te(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=_n.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},Sn.prototype.g=function(e,t){return new En(e,t)},h(En,ee),En.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},En.prototype.close=function(){nn(this.g)},En.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=le(e),e=n);t.i.push(new Ke(t.Ya++,e)),3==t.G&&on(t)},En.prototype.N=function(){this.g.l=null,delete this.j,nn(this.g),delete this.g,En.aa.N.call(this)},h(Tn,me),h(In,ye),h(Cn,_n),Cn.prototype.ua=function(){te(this.g,"a")},Cn.prototype.ta=function(e){te(this.g,new Tn(e))},Cn.prototype.sa=function(e){te(this.g,new In)},Cn.prototype.ra=function(){te(this.g,"b")},Sn.prototype.createWebChannel=Sn.prototype.g,En.prototype.send=En.prototype.o,En.prototype.open=En.prototype.m,En.prototype.close=En.prototype.close,gt=function(){return new Sn},pt=function(){return be()},ft=ve,dt={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},xe.NO_ERROR=0,xe.TIMEOUT=8,xe.HTTP_ERROR=6,ht=xe,Ne.COMPLETE="complete",ut=Ne,pe.EventType=ge,ge.OPEN="a",ge.CLOSE="b",ge.ERROR="c",ge.MESSAGE="d",ee.prototype.listen=ee.prototype.K,lt=pe,$t.prototype.listenOnce=$t.prototype.L,$t.prototype.getLastError=$t.prototype.Ka,$t.prototype.getLastErrorCode=$t.prototype.Ba,$t.prototype.getStatus=$t.prototype.Z,$t.prototype.getResponseJson=$t.prototype.Oa,$t.prototype.getResponseText=$t.prototype.oa,$t.prototype.send=$t.prototype.ea,$t.prototype.setWithCredentials=$t.prototype.Ha,ct=$t}).apply(void 0!==mt?mt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const yt="@firebase/firestore",vt="4.8.0";
337
+ var i=i||{},r=this||self;function s(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function o(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function a(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){if(!e)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),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function l(e,t,n){return(l=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?a:c).apply(null,arguments)}function u(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function h(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}function d(e){const t=e.length;if(0<t){const n=Array(t);for(let i=0;i<t;i++)n[i]=e[i];return n}return[]}function f(e,t){for(let t=1;t<arguments.length;t++){const n=arguments[t];if(s(n)){const t=e.length||0,i=n.length||0;e.length=t+i;for(let r=0;r<i;r++)e[t+r]=n[r]}else e.push(n)}}function p(e){return/^[\s\xa0]*$/.test(e)}function g(){var e=r.navigator;return e&&(e=e.userAgent)?e:""}function m(e){return m[" "](e),e}m[" "]=function(){};var y=!(-1==g().indexOf("Gecko")||-1!=g().toLowerCase().indexOf("webkit")&&-1==g().indexOf("Edge")||-1!=g().indexOf("Trident")||-1!=g().indexOf("MSIE")||-1!=g().indexOf("Edge"));function v(e,t,n){for(const i in e)t.call(n,e[i],i,e)}function w(e){const t={};for(const n in e)t[n]=e[n];return t}const b="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function _(e,t){let n,i;for(let t=1;t<arguments.length;t++){for(n in i=arguments[t],i)e[n]=i[n];for(let t=0;t<b.length;t++)n=b[t],Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}}function S(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function E(e){r.setTimeout(()=>{throw e},0)}function T(){var e=R;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var I=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new C,e=>e.reset());class C{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let k,A=!1,R=new class{constructor(){this.h=this.g=null}add(e,t){const n=I.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},x=()=>{const e=r.Promise.resolve(void 0);k=()=>{e.then(N)}};var N=()=>{for(var e;e=T();){try{e.h.call(e.g)}catch(e){E(e)}var t=I;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}A=!1};function O(){this.s=this.s,this.C=this.C}function L(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}O.prototype.s=!1,O.prototype.ma=function(){this.s||(this.s=!0,this.N())},O.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},L.prototype.h=function(){this.defaultPrevented=!0};var P=function(){if(!r.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};r.addEventListener("test",e,t),r.removeEventListener("test",e,t)}catch(e){}return e}();function D(e,t){if(L.call(this,e?e.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,e){var n=this.type=e.type,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(y){e:{try{m(t.nodeName);var r=!0;break e}catch(e){}r=!1}r||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,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!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:M[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&D.aa.h.call(this)}}h(D,L);var M={2:"touch",3:"pen",4:"mouse"};D.prototype.h=function(){D.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var z="closure_listenable_"+(1e6*Math.random()|0),F=0;function U(e,t,n,i,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.ha=r,this.key=++F,this.da=this.fa=!1}function V(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function B(e){this.src=e,this.g={},this.h=0}function j(e,t){var n=t.type;if(n in e.g){var i,r=e.g[n],s=Array.prototype.indexOf.call(r,t,void 0);(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(V(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function H(e,t,n,i){for(var r=0;r<e.length;++r){var s=e[r];if(!s.da&&s.listener==t&&s.capture==!!n&&s.ha==i)return r}return-1}B.prototype.add=function(e,t,n,i,r){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var o=H(e,t,i,r);return-1<o?(t=e[o],n||(t.fa=!1)):((t=new U(t,this.src,s,!!i,r)).fa=n,e.push(t)),t};var $="closure_lm_"+(1e6*Math.random()|0),q={};function G(e,t,n,i,r){if(Array.isArray(t)){for(var s=0;s<t.length;s++)G(e,t[s],n,i,r);return null}return n=Z(n),e&&e[z]?e.K(t,n,!!o(i)&&!!i.capture,r):function(e,t,n,i,r,s){if(!t)throw Error("Invalid event type");var a=o(r)?!!r.capture:!!r,c=Y(e);if(c||(e[$]=c=new B(e)),n=c.add(t,n,i,a,s),n.proxy)return n;if(i=function(){function e(n){return t.call(e.src,e.listener,n)}const t=J;return e}(),n.proxy=i,i.src=e,i.listener=n,e.addEventListener)P||(r=a),void 0===r&&(r=!1),e.addEventListener(t.toString(),i,r);else if(e.attachEvent)e.attachEvent(Q(t.toString()),i);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(i)}return n}(e,t,n,!1,i,r)}function K(e,t,n,i,r){if(Array.isArray(t))for(var s=0;s<t.length;s++)K(e,t[s],n,i,r);else i=o(i)?!!i.capture:!!i,n=Z(n),e&&e[z]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=H(s=e.g[t],n,i,r))&&(V(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete e.g[t],e.h--)))):e&&(e=Y(e))&&(t=e.g[t.toString()],e=-1,t&&(e=H(t,n,i,r)),(n=-1<e?t[e]:null)&&W(n))}function W(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[z])j(t.i,e);else{var n=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(n,i,e.capture):t.detachEvent?t.detachEvent(Q(n),i):t.addListener&&t.removeListener&&t.removeListener(i),(n=Y(t))?(j(n,e),0==n.h&&(n.src=null,t[$]=null)):V(e)}}}function Q(e){return e in q?q[e]:q[e]="on"+e}function J(e,t){if(e.da)e=!0;else{t=new D(t,this);var n=e.listener,i=e.ha||e.src;e.fa&&W(e),e=n.call(i,t)}return e}function Y(e){return(e=e[$])instanceof B?e:null}var X="__closure_events_fn_"+(1e9*Math.random()>>>0);function Z(e){return"function"==typeof e?e:(e[X]||(e[X]=function(t){return e.handleEvent(t)}),e[X])}function ee(){O.call(this),this.i=new B(this),this.M=this,this.F=null}function te(e,t){var n,i=e.F;if(i)for(n=[];i;i=i.F)n.push(i);if(e=e.M,i=t.type||t,"string"==typeof t)t=new L(t,e);else if(t instanceof L)t.target=t.target||e;else{var r=t;_(t=new L(i,e),r)}if(r=!0,n)for(var s=n.length-1;0<=s;s--){var o=t.g=n[s];r=ne(o,i,!0,t)&&r}if(r=ne(o=t.g=e,i,!0,t)&&r,r=ne(o,i,!1,t)&&r,n)for(s=0;s<n.length;s++)r=ne(o=t.g=n[s],i,!1,t)&&r}function ne(e,t,n,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var r=!0,s=0;s<t.length;++s){var o=t[s];if(o&&!o.da&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.fa&&j(e.i,o),r=!1!==a.call(c,i)&&r}}return r&&!i.defaultPrevented}function ie(e,t,n){if("function"==typeof e)n&&(e=l(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=l(e.handleEvent,e)}return 2147483647<Number(t)?-1:r.setTimeout(e,t||0)}function re(e){e.g=ie(()=>{e.g=null,e.i&&(e.i=!1,re(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}h(ee,O),ee.prototype[z]=!0,ee.prototype.removeEventListener=function(e,t,n,i){K(this,e,t,n,i)},ee.prototype.N=function(){if(ee.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],i=0;i<n.length;i++)V(n[i]);delete t.g[e],t.h--}}this.F=null},ee.prototype.K=function(e,t,n,i){return this.i.add(String(e),t,!1,n,i)},ee.prototype.L=function(e,t,n,i){return this.i.add(String(e),t,!0,n,i)};class se extends O{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:re(this)}N(){super.N(),this.g&&(r.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function oe(e){O.call(this),this.h=e,this.g={}}h(oe,O);var ae=[];function ce(e){v(e.g,function(e,t){this.g.hasOwnProperty(t)&&W(e)},e),e.g={}}oe.prototype.N=function(){oe.aa.N.call(this),ce(this)},oe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var le=r.JSON.stringify,ue=r.JSON.parse,he=class{stringify(e){return r.JSON.stringify(e,void 0)}parse(e){return r.JSON.parse(e,void 0)}};function de(){}function fe(e){return e.h||(e.h=e.i())}function pe(){}de.prototype.h=null;var ge={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function me(){L.call(this,"d")}function ye(){L.call(this,"c")}h(me,L),h(ye,L);var ve={},we=null;function be(){return we=we||new ee}function _e(e){L.call(this,ve.La,e)}function Se(e){const t=be();te(t,new _e(t))}function Ee(e,t){L.call(this,ve.STAT_EVENT,e),this.stat=t}function Te(e){const t=be();te(t,new Ee(t,e))}function Ie(e,t){L.call(this,ve.Ma,e),this.size=t}function Ce(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return r.setTimeout(function(){e()},t)}function ke(){this.g=!0}function Ae(e,t,n,i){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var i=n[e];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 le(n)}catch(e){return t}}(e,n)+(i?" "+i:"")})}ve.La="serverreachability",h(_e,L),ve.STAT_EVENT="statevent",h(Ee,L),ve.Ma="timingevent",h(Ie,L),ke.prototype.xa=function(){this.g=!1},ke.prototype.info=function(){};var Re,xe={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Ne={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function Oe(){}function Le(e,t,n,i){this.j=e,this.i=t,this.l=n,this.R=i||1,this.U=new oe(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Pe}function Pe(){this.i=null,this.g="",this.h=!1}h(Oe,de),Oe.prototype.g=function(){return new XMLHttpRequest},Oe.prototype.i=function(){return{}},Re=new Oe;var De={},Me={};function ze(e,t,n){e.L=1,e.v=vt(rt(t)),e.m=n,e.P=!0,Fe(e,null)}function Fe(e,t){e.F=Date.now(),Be(e),e.A=rt(e.v);var n=e.A,i=e.R;Array.isArray(i)||(i=[String(i)]),Ot(n.i,"t",i),e.C=0,n=e.j.J,e.h=new Pe,e.g=bn(e.j,n?t:null,!e.m),0<e.O&&(e.M=new se(l(e.Y,e,e.g),e.O)),t=e.U,n=e.g,i=e.ca;var r="readystatechange";Array.isArray(r)||(r&&(ae[0]=r.toString()),r=ae);for(var s=0;s<r.length;s++){var o=G(n,r[s],i||t.handleEvent,!1,t.h||t);if(!o)break;t.g[o.key]=o}t=e.H?w(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),Se(),function(e,t,n,i,r,s){e.info(function(){if(e.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+"]: "+t+"\n"+n+"\n"+o})}(e.i,e.u,e.A,e.l,e.R,e.m)}function Ue(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function Ve(e,t){var n=e.C,i=t.indexOf("\n",n);return-1==i?Me:(n=Number(t.substring(n,i)),isNaN(n)?De:(i+=1)+n>t.length?Me:(t=t.slice(i,i+n),e.C=i+n,t))}function Be(e){e.S=Date.now()+e.I,je(e,e.I)}function je(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ce(l(e.ba,e),t)}function He(e){e.B&&(r.clearTimeout(e.B),e.B=null)}function $e(e){0==e.j.G||e.J||gn(e.j,e)}function qe(e){He(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ce(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function Ge(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||Ye(n.h,e)))if(!e.K&&Ye(n.h,e)&&3==n.G){try{var i=n.Da.g.parse(t)}catch(e){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;pn(n),rn(n)}hn(n),Te(18)}}else n.za=r[1],0<n.za-n.T&&37500>r[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ce(l(n.Za,n),6e3));if(1>=Je(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else yn(n,11)}else if((e.K||n.g==e)&&pn(n),!p(t))for(r=n.Da.g.parse(t),t=0;t<r.length;t++){let l=r[t];if(n.T=l[0],l=l[1],2==n.G)if("c"==l[0]){n.K=l[1],n.ia=l[2];const t=l[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));const r=l[4];null!=r&&(n.Aa=r,n.j.info("SVER="+n.Aa));const u=l[5];null!=u&&"number"==typeof u&&0<u&&(i=1.5*u,n.L=i,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;const h=e.g;if(h){const e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=i.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(Xe(s,s.h),s.h=null))}if(i.D){const e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.ya=e,yt(i.I,i.D,e))}}n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms"));var o=e;if((i=n).qa=wn(i,i.J?i.ia:null,i.W),o.K){Ze(i.h,o);var a=o,c=i.L;c&&(a.I=c),a.B&&(He(a),Be(a)),i.g=o}else un(i);0<n.i.length&&on(n)}else"stop"!=l[0]&&"close"!=l[0]||yn(n,7);else 3==n.G&&("stop"==l[0]||"close"==l[0]?"stop"==l[0]?yn(n,7):nn(n):"noop"!=l[0]&&n.l&&n.l.ta(l),n.v=0)}Se()}catch(e){}}Le.prototype.ca=function(e){e=e.target;const t=this.M;t&&3==Xt(e)?t.j():this.Y(e)},Le.prototype.Y=function(e){try{if(e==this.g)e:{const d=Xt(this.g);var t=this.g.Ba();this.g.Z();if(!(3>d)&&(3!=d||this.g&&(this.h.h||this.g.oa()||Zt(this.g)))){this.J||4!=d||7==t||Se(),He(this);var n=this.g.Z();this.X=n;t:if(Ue(this)){var i=Zt(this.g);e="";var s=i.length,o=4==Xt(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){qe(this),$e(this);var a="";break t}this.h.i=new r.TextDecoder}for(t=0;t<s;t++)this.h.h=!0,e+=this.h.i.decode(i[t],{stream:!(o&&t==s-1)});i.length=0,this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.oa();if(this.o=200==n,function(e,t,n,i,r,s,o){e.info(function(){return"XMLHTTP RESP ("+i+") [ attempt "+r+"]: "+t+"\n"+n+"\n"+s+" "+o})}(this.i,this.u,this.A,this.l,this.R,d,n),this.o){if(this.T&&!this.K){t:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!p(c)){var u=c;break t}}u=null}if(!(n=u)){this.o=!1,this.s=3,Te(12),qe(this),$e(this);break e}Ae(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Ge(this,n)}if(this.P){let e;for(n=!0;!this.J&&this.C<a.length;){if(e=Ve(this,a),e==Me){4==d&&(this.s=4,Te(14),n=!1),Ae(this.i,this.l,null,"[Incomplete Response]");break}if(e==De){this.s=4,Te(15),Ae(this.i,this.l,a,"[Invalid Chunk]"),n=!1;break}Ae(this.i,this.l,e,null),Ge(this,e)}if(Ue(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=d||0!=a.length||this.h.h||(this.s=1,Te(16),n=!1),this.o=this.o&&n,n){if(0<a.length&&!this.W){this.W=!0;var h=this.j;h.g==this&&h.ba&&!h.M&&(h.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),dn(h),h.M=!0,Te(11))}}else Ae(this.i,this.l,a,"[Invalid Chunked Response]"),qe(this),$e(this)}else Ae(this.i,this.l,a,null),Ge(this,a);4==d&&qe(this),this.o&&!this.J&&(4==d?gn(this.j,this):(this.o=!1,Be(this)))}else(function(e){const t={};e=(e.g&&2<=Xt(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let i=0;i<e.length;i++){if(p(e[i]))continue;var n=S(e[i]);const r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const s=t[r]||[];t[r]=s,s.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==n&&0<a.indexOf("Unknown SID")?(this.s=3,Te(12)):(this.s=0,Te(13)),qe(this),$e(this)}}}catch(e){}},Le.prototype.cancel=function(){this.J=!0,qe(this)},Le.prototype.ba=function(){this.B=null;const e=Date.now();0<=e-this.S?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.A),2!=this.L&&(Se(),Te(17)),qe(this),this.s=2,$e(this)):je(this,this.S-e)};var Ke=class{constructor(e,t){this.g=e,this.map=t}};function We(e){this.l=e||10,r.PerformanceNavigationTiming?e=0<(e=r.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(r.chrome&&r.chrome.loadTimes&&r.chrome.loadTimes()&&r.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Qe(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Je(e){return e.h?1:e.g?e.g.size:0}function Ye(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Xe(e,t){e.g?e.g.add(t):e.h=t}function Ze(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function et(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.D);return t}return d(e.i)}function tt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(s(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(s(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const i in e)t[n++]=i;return t}}}(e),i=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(s(e)){for(var t=[],n=e.length,i=0;i<n;i++)t.push(e[i]);return t}for(i in t=[],n=0,e)t[n++]=e[i];return t}(e),r=i.length,o=0;o<r;o++)t.call(void 0,i[o],n&&n[o],e)}We.prototype.cancel=function(){if(this.i=et(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var nt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function it(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof it){this.h=e.h,st(this,e.j),this.o=e.o,this.g=e.g,ot(this,e.s),this.l=e.l;var t=e.i,n=new At;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),at(this,n),this.m=e.m}else e&&(t=String(e).match(nt))?(this.h=!1,st(this,t[1]||"",!0),this.o=wt(t[2]||""),this.g=wt(t[3]||"",!0),ot(this,t[4]),this.l=wt(t[5]||"",!0),at(this,t[6]||"",!0),this.m=wt(t[7]||"")):(this.h=!1,this.i=new At(null,this.h))}function rt(e){return new it(e)}function st(e,t,n){e.j=n?wt(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function ot(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function at(e,t,n){t instanceof At?(e.i=t,function(e,t){t&&!e.j&&(Rt(e),e.i=null,e.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(xt(this,t),Ot(this,n,e))},e)),e.j=t}(e.i,e.h)):(n||(t=bt(t,Ct)),e.i=new At(t,e.h))}function yt(e,t,n){e.i.set(t,n)}function vt(e){return yt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function wt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function bt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,_t),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function _t(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}it.prototype.toString=function(){var e=[],t=this.j;t&&e.push(bt(t,Et,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(bt(t,Et,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(bt(n,"/"==n.charAt(0)?It:Tt,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",bt(n,kt)),e.join("")};var St,Et=/[#\/\?@]/g,Tt=/[#\?:]/g,It=/[#\?]/g,Ct=/[#\?@]/g,kt=/#/g;function At(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Rt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var i=e[n].indexOf("="),r=null;if(0<=i){var s=e[n].substring(0,i);r=e[n].substring(i+1)}else s=e[n];t(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function xt(e,t){Rt(e),t=Lt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Nt(e,t){return Rt(e),t=Lt(e,t),e.g.has(t)}function Ot(e,t,n){xt(e,t),0<n.length&&(e.i=null,e.g.set(Lt(e,t),d(n)),e.h+=n.length)}function Lt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Pt(e,t,n,i,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),i(n)}catch(e){}}function Dt(){this.g=new he}function Mt(e,t,n){const i=n||"";try{tt(e,function(e,n){let r=e;o(e)&&(r=le(e)),t.push(i+n+"="+encodeURIComponent(r))})}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}function zt(e){this.l=e.Ub||null,this.j=e.eb||!1}function Ft(e,t){ee.call(this),this.D=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function Ut(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function Vt(e){e.readyState=4,e.l=null,e.j=null,e.v=null,Bt(e)}function Bt(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function jt(e){let t="";return v(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function Ht(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=jt(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):yt(e,t,n))}function $t(e){ee.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(e=At.prototype).add=function(e,t){Rt(this),this.i=null,e=Lt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){Rt(this),this.g.forEach(function(n,i){n.forEach(function(n){e.call(t,n,i,this)},this)},this)},e.na=function(){Rt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let i=0;i<t.length;i++){const r=e[i];for(let e=0;e<r.length;e++)n.push(t[i])}return n},e.V=function(e){Rt(this);let t=[];if("string"==typeof e)Nt(this,e)&&(t=t.concat(this.g.get(Lt(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},e.set=function(e,t){return Rt(this),this.i=null,Nt(this,e=Lt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var i=t[n];const s=encodeURIComponent(String(i)),o=this.V(i);for(i=0;i<o.length;i++){var r=s;""!==o[i]&&(r+="="+encodeURIComponent(String(o[i]))),e.push(r)}}return this.i=e.join("&")},h(zt,de),zt.prototype.g=function(){return new Ft(this.l,this.j)},zt.prototype.i=(St={},function(){return St}),h(Ft,ee),(e=Ft.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,Bt(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||r).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Vt(this)),this.readyState=0},e.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Bt(this)),this.g&&(this.readyState=3,Bt(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==r.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Ut(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},e.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?Vt(this):Bt(this),3==this.readyState&&Ut(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,Vt(this))},e.Qa=function(e){this.g&&(this.response=e,Vt(this))},e.ga=function(){this.g&&Vt(this)},e.setRequestHeader=function(e,t){this.u.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Ft.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),h($t,ee);var qt=/^https?$/i,Gt=["POST","PUT"];function Kt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,Wt(e),Jt(e)}function Wt(e){e.A||(e.A=!0,te(e,"complete"),te(e,"error"))}function Qt(e){if(e.h&&void 0!==i&&(!e.v[1]||4!=Xt(e)||2!=e.Z()))if(e.u&&4==Xt(e))ie(e.Ea,0,e);else if(te(e,"readystatechange"),4==Xt(e)){e.h=!1;try{const i=e.Z();e:switch(i){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var s;if(s=0===i){var o=String(e.D).match(nt)[1]||null;!o&&r.self&&r.self.location&&(o=r.self.location.protocol.slice(0,-1)),s=!qt.test(o?o.toLowerCase():"")}n=s}if(n)te(e,"complete"),te(e,"success");else{e.m=6;try{var a=2<Xt(e)?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.Z()+"]",Wt(e)}}finally{Jt(e)}}}function Jt(e,t){if(e.g){Yt(e);const n=e.g,i=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||te(e,"ready");try{n.onreadystatechange=i}catch(e){}}}function Yt(e){e.I&&(r.clearTimeout(e.I),e.I=null)}function Xt(e){return e.g?e.g.readyState:0}function Zt(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function en(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function tn(e){this.Aa=0,this.i=[],this.j=new ke,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=en("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=en("baseRetryDelayMs",5e3,e),this.cb=en("retryDelaySeedMs",1e4,e),this.Wa=en("forwardChannelMaxRetries",2,e),this.wa=en("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new We(e&&e.concurrentRequestLimit),this.Da=new Dt,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function nn(e){if(sn(e),3==e.G){var t=e.U++,n=rt(e.I);if(yt(n,"SID",e.K),yt(n,"RID",t),yt(n,"TYPE","terminate"),cn(e,n),(t=new Le(e,e.j,t)).L=2,t.v=vt(rt(n)),n=!1,r.navigator&&r.navigator.sendBeacon)try{n=r.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&r.Image&&((new Image).src=t.v,n=!0),n||(t.g=bn(t.j,null),t.g.ea(t.v)),t.F=Date.now(),Be(t)}vn(e)}function rn(e){e.g&&(dn(e),e.g.cancel(),e.g=null)}function sn(e){rn(e),e.u&&(r.clearTimeout(e.u),e.u=null),pn(e),e.h.cancel(),e.s&&("number"==typeof e.s&&r.clearTimeout(e.s),e.s=null)}function on(e){if(!Qe(e.h)&&!e.s){e.s=!0;var t=e.Ga;k||x(),A||(k(),A=!0),R.add(t,e),e.B=0}}function an(e,t){var n;n=t?t.l:e.U++;const i=rt(e.I);yt(i,"SID",e.K),yt(i,"RID",n),yt(i,"AID",e.T),cn(e,i),e.m&&e.o&&Ht(i,e.m,e.o),n=new Le(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=ln(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),Xe(e.h,n),ze(n,i,t)}function cn(e,t){e.H&&v(e.H,function(e,n){yt(t,n,e)}),e.l&&tt({},function(e,n){yt(t,n,e)})}function ln(e,t,n){n=Math.min(e.i.length,n);var i=e.l?l(e.l.Na,e.l,e):null;e:{var r=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=r[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let s=!0;for(let o=0;o<n;o++){let n=r[o].g;const a=r[o].map;if(n-=t,0>n)t=Math.max(0,r[o].g-100),s=!1;else try{Mt(a,e,"req"+n+"_")}catch(e){i&&i(a)}}if(s){i=e.join("&");break e}}}return e=e.i.splice(0,n),t.D=e,i}function un(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;k||x(),A||(k(),A=!0),R.add(t,e),e.v=0}}function hn(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ce(l(e.Fa,e),mn(e,e.v)),e.v++,!0)}function dn(e){null!=e.A&&(r.clearTimeout(e.A),e.A=null)}function fn(e){e.g=new Le(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=rt(e.qa);yt(t,"RID","rpc"),yt(t,"SID",e.K),yt(t,"AID",e.T),yt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&yt(t,"TO",e.ja),yt(t,"TYPE","xmlhttp"),cn(e,t),e.m&&e.o&&Ht(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=vt(rt(t)),n.m=null,n.P=!0,Fe(n,e)}function pn(e){null!=e.C&&(r.clearTimeout(e.C),e.C=null)}function gn(e,t){var n=null;if(e.g==t){pn(e),dn(e),e.g=null;var i=2}else{if(!Ye(e.h,t))return;n=t.D,Ze(e.h,t),i=1}if(0!=e.G)if(t.o)if(1==i){n=t.m?t.m.length:0,t=Date.now()-t.F;var r=e.B;te(i=be(),new Ie(i,n)),on(e)}else un(e);else if(3==(r=t.s)||0==r&&0<t.X||!(1==i&&function(e,t){return!(Je(e.h)>=e.h.j-(e.s?1:0)||(e.s?(e.i=t.D.concat(e.i),0):1==e.G||2==e.G||e.B>=(e.Va?0:e.Wa)||(e.s=Ce(l(e.Ga,e,t),mn(e,e.B)),e.B++,0)))}(e,t)||2==i&&hn(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),r){case 1:yn(e,5);break;case 4:yn(e,10);break;case 3:yn(e,6);break;default:yn(e,2)}}function mn(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function yn(e,t){if(e.j.info("Error code "+t),2==t){var n=l(e.fb,e),i=e.Xa;const t=!i;i=new it(i||"//www.google.com/images/cleardot.gif"),r.location&&"http"==r.location.protocol||st(i,"https"),vt(i),t?function(e,t){const n=new ke;if(r.Image){const i=new Image;i.onload=u(Pt,n,"TestLoadImage: loaded",!0,t,i),i.onerror=u(Pt,n,"TestLoadImage: error",!1,t,i),i.onabort=u(Pt,n,"TestLoadImage: abort",!1,t,i),i.ontimeout=u(Pt,n,"TestLoadImage: timeout",!1,t,i),r.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=e}else t(!1)}(i.toString(),n):function(e,t){new ke;const n=new AbortController,i=setTimeout(()=>{n.abort(),Pt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(i),e.ok?Pt(0,0,!0,t):Pt(0,0,!1,t)}).catch(()=>{clearTimeout(i),Pt(0,0,!1,t)})}(i.toString(),n)}else Te(2);e.G=0,e.l&&e.l.sa(t),vn(e),sn(e)}function vn(e){if(e.G=0,e.ka=[],e.l){const t=et(e.h);0==t.length&&0==e.i.length||(f(e.ka,t),f(e.ka,e.i),e.h.i.length=0,d(e.i),e.i.length=0),e.l.ra()}}function wn(e,t,n){var i=n instanceof it?rt(n):new it(n);if(""!=i.g)t&&(i.g=t+"."+i.g),ot(i,i.s);else{var s=r.location;i=s.protocol,t=t?t+"."+s.hostname:s.hostname,s=+s.port;var o=new it(null);i&&st(o,i),t&&(o.g=t),s&&ot(o,s),n&&(o.l=n),i=o}return n=e.D,t=e.ya,n&&t&&yt(i,n,t),yt(i,"VER",e.la),cn(e,i),i}function bn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new $t(new zt({eb:n})):new $t(e.pa)).Ha(e.J),t}function _n(){}function Sn(){}function En(e,t){ee.call(this),this.g=new tn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!p(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!p(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new Cn(this)}function Tn(e){me.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function In(){ye.call(this),this.status=1}function Cn(e){this.g=e}(e=$t.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Re.g(),this.v=this.o?fe(this.o):fe(Re),this.g.onreadystatechange=l(this.Ea,this);try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Kt(this,e)}if(e=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)n.set(s,i[s]);else{if("function"!=typeof i.keys||"function"!=typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));for(const e of i.keys())n.set(e,i.get(e))}i=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),s=r.FormData&&e instanceof r.FormData,!(0<=Array.prototype.indexOf.call(Gt,t,void 0))||i||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Yt(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){Kt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,te(this,"complete"),te(this,"abort"),Jt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Jt(this,!0)),$t.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?Qt(this):this.bb())},e.bb=function(){Qt(this)},e.isActive=function(){return!!this.g},e.Z=function(){try{return 2<Xt(this)?this.g.status:-1}catch(e){return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),ue(t)}},e.Ba=function(){return this.m},e.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=tn.prototype).la=8,e.G=1,e.connect=function(e,t,n,i){Te(0),this.W=e,this.H=t||{},n&&void 0!==i&&(this.H.OSID=n,this.H.OAID=i),this.F=this.X,this.I=wn(this,null,this.W),on(this)},e.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;const r=new Le(this,this.j,e);let s=this.o;if(this.S&&(s?(s=w(s),_(s,this.S)):s=this.S),null!==this.m||this.O||(r.H=s,s=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){var i=this.i[n];if(void 0===(i="__data__"in i.map&&"string"==typeof(i=i.map.__data__)?i.length:void 0))break;if(4096<(t+=i)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=ln(this,r,t),yt(n=rt(this.I),"RID",e),yt(n,"CVER",22),this.D&&yt(n,"X-HTTP-Session-Id",this.D),cn(this,n),s&&(this.O?t="headers="+encodeURIComponent(String(jt(s)))+"&"+t:this.m&&Ht(n,this.m,s)),Xe(this.h,r),this.Ua&&yt(n,"TYPE","init"),this.P?(yt(n,"$req",t),yt(n,"SID","null"),r.T=!0,ze(r,n,null)):ze(r,n,t),this.G=2}}else 3==this.G&&(e?an(this,e):0==this.i.length||Qe(this.h)||an(this))},e.Fa=function(){if(this.u=null,fn(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=Ce(l(this.ab,this),e)}},e.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Te(10),rn(this),fn(this))},e.Za=function(){null!=this.C&&(this.C=null,rn(this),hn(this),Te(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),Te(2)):(this.j.info("Failed to ping google.com"),Te(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=_n.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},Sn.prototype.g=function(e,t){return new En(e,t)},h(En,ee),En.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},En.prototype.close=function(){nn(this.g)},En.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=le(e),e=n);t.i.push(new Ke(t.Ya++,e)),3==t.G&&on(t)},En.prototype.N=function(){this.g.l=null,delete this.j,nn(this.g),delete this.g,En.aa.N.call(this)},h(Tn,me),h(In,ye),h(Cn,_n),Cn.prototype.ua=function(){te(this.g,"a")},Cn.prototype.ta=function(e){te(this.g,new Tn(e))},Cn.prototype.sa=function(e){te(this.g,new In)},Cn.prototype.ra=function(){te(this.g,"b")},Sn.prototype.createWebChannel=Sn.prototype.g,En.prototype.send=En.prototype.o,En.prototype.open=En.prototype.m,En.prototype.close=En.prototype.close,gt=function(){return new Sn},pt=function(){return be()},ft=ve,dt={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},xe.NO_ERROR=0,xe.TIMEOUT=8,xe.HTTP_ERROR=6,ht=xe,Ne.COMPLETE="complete",ut=Ne,pe.EventType=ge,ge.OPEN="a",ge.CLOSE="b",ge.ERROR="c",ge.MESSAGE="d",ee.prototype.listen=ee.prototype.K,lt=pe,$t.prototype.listenOnce=$t.prototype.L,$t.prototype.getLastError=$t.prototype.Ka,$t.prototype.getLastErrorCode=$t.prototype.Ba,$t.prototype.getStatus=$t.prototype.Z,$t.prototype.getResponseJson=$t.prototype.Oa,$t.prototype.getResponseText=$t.prototype.oa,$t.prototype.send=$t.prototype.ea,$t.prototype.setWithCredentials=$t.prototype.Ha,ct=$t}).apply(void 0!==mt?mt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const yt="@firebase/firestore",vt="4.8.0";
338
338
  /**
339
339
  * @license
340
340
  * Copyright 2017 Google LLC
@@ -464,7 +464,7 @@ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
464
464
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
465
465
  * See the License for the specific language governing permissions and
466
466
  * limitations under the License.
467
- */class Pt{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Dt{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(wt.UNAUTHENTICATED))}shutdown(){}}class Mt{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class Ft{constructor(e){this.t=e,this.currentUser=wt.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Rt(void 0===this.o,42304);let n=this.i;const i=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let r=new Lt;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new Lt,e.enqueueRetryable(()=>i(this.currentUser))};const s=()=>{const t=r;e.enqueueRetryable(async()=>{await t.promise,await i(this.currentUser)})},o=e=>{Et("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>o(e)),setTimeout(()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(Et("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Lt)}},0),s()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(Et("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(Rt("string"==typeof t.accessToken,31837,{l:t}),new Pt(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Rt(null===e||"string"==typeof e,2055,{h:e}),new wt(e)}}class zt{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=wt.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class Ut{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new zt(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(wt.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Vt{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Bt{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,je(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){Rt(void 0===this.o,3512);const n=e=>{null!=e.error&&Et("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.m;return this.m=e.token,Et("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};const i=e=>{Et("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>i(e)),setTimeout(()=>{if(!this.appCheck){const e=this.V.getImmediate({optional:!0});e?i(e):Et("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Vt(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(Rt("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new Vt(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}
467
+ */class Pt{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Dt{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(wt.UNAUTHENTICATED))}shutdown(){}}class Mt{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class zt{constructor(e){this.t=e,this.currentUser=wt.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Rt(void 0===this.o,42304);let n=this.i;const i=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let r=new Lt;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new Lt,e.enqueueRetryable(()=>i(this.currentUser))};const s=()=>{const t=r;e.enqueueRetryable(async()=>{await t.promise,await i(this.currentUser)})},o=e=>{Et("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>o(e)),setTimeout(()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(Et("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Lt)}},0),s()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(Et("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(Rt("string"==typeof t.accessToken,31837,{l:t}),new Pt(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Rt(null===e||"string"==typeof e,2055,{h:e}),new wt(e)}}class Ft{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=wt.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class Ut{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new Ft(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(wt.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Vt{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Bt{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,je(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){Rt(void 0===this.o,3512);const n=e=>{null!=e.error&&Et("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.m;return this.m=e.token,Et("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};const i=e=>{Et("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>i(e)),setTimeout(()=>{if(!this.appCheck){const e=this.V.getImmediate({optional:!0});e?i(e):Et("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Vt(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(Rt("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new Vt(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}
468
468
  /**
469
469
  * @license
470
470
  * Copyright 2020 Google LLC
@@ -786,7 +786,7 @@ class Ln{constructor(e){this.comparator=e,this.data=new xn(this.comparator)}has(
786
786
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
787
787
  * See the License for the specific language governing permissions and
788
788
  * limitations under the License.
789
- */class Fn{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Mn("Invalid base64 string: "+e):e}}(e);return new Fn(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new Fn(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){return function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}
789
+ */class zn{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Mn("Invalid base64 string: "+e):e}}(e);return new zn(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new zn(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){return function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}
790
790
  /**
791
791
  * @license
792
792
  * Copyright 2020 Google LLC
@@ -802,7 +802,7 @@ class Ln{constructor(e){this.comparator=e,this.data=new xn(this.comparator)}has(
802
802
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
803
803
  * See the License for the specific language governing permissions and
804
804
  * limitations under the License.
805
- */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return qt(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Fn.EMPTY_BYTE_STRING=new Fn("");const zn=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Un(e){if(Rt(!!e,39018),"string"==typeof e){let t=0;const n=zn.exec(e);if(Rt(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:Vn(e.seconds),nanos:Vn(e.nanos)}}function Vn(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function Bn(e){return"string"==typeof e?Fn.fromBase64String(e):Fn.fromUint8Array(e)}
805
+ */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return qt(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}zn.EMPTY_BYTE_STRING=new zn("");const Fn=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Un(e){if(Rt(!!e,39018),"string"==typeof e){let t=0;const n=Fn.exec(e);if(Rt(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const i=new Date(e);return{seconds:Math.floor(i.getTime()/1e3),nanos:t}}return{seconds:Vn(e.seconds),nanos:Vn(e.nanos)}}function Vn(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function Bn(e){return"string"==typeof e?zn.fromBase64String(e):zn.fromUint8Array(e)}
806
806
  /**
807
807
  * @license
808
808
  * Copyright 2020 Google LLC
@@ -930,7 +930,7 @@ class Ln{constructor(e){this.comparator=e,this.data=new xn(this.comparator)}has(
930
930
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
931
931
  * See the License for the specific language governing permissions and
932
932
  * limitations under the License.
933
- */class ki{}class Ai extends ki{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new Di(e,t,n):"array-contains"===t?new Ui(e,n):"in"===t?new Vi(e,n):"not-in"===t?new Bi(e,n):"array-contains-any"===t?new ji(e,n):new Ai(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new Mi(e,n):new Fi(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(oi(t,this.value)):null!==t&&ii(this.value)===ii(t)&&this.matchesComparison(oi(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return kt(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ri extends ki{constructor(e,t){super(),this.filters=e,this.op=t,this.he=null}static create(e,t){return new Ri(e,t)}matches(e){return xi(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.he||(this.he=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}}function xi(e){return"and"===e.op}function Ni(e){return function(e){for(const t of e.filters)if(t instanceof Ri)return!1;return!0}(e)&&xi(e)}function Oi(e){if(e instanceof Ai)return e.field.canonicalString()+e.op.toString()+li(e.value);if(Ni(e))return e.filters.map(e=>Oi(e)).join(",");{const t=e.filters.map(e=>Oi(e)).join(",");return`${e.op}(${t})`}}function Li(e,t){return e instanceof Ai?function(e,t){return t instanceof Ai&&e.op===t.op&&e.field.isEqual(t.field)&&ri(e.value,t.value)}(e,t):e instanceof Ri?function(e,t){return t instanceof Ri&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,i)=>e&&Li(n,t.filters[i]),!0)}(e,t):void kt(19439)}function Pi(e){return e instanceof Ai?function(e){return`${e.field.canonicalString()} ${e.op} ${li(e.value)}`}(e):e instanceof Ri?function(e){return e.op.toString()+" {"+e.getFilters().map(Pi).join(" ,")+"}"}(e):"Filter"}class Di extends Ai{constructor(e,t,n){super(e,t,n),this.key=tn.fromName(n.referenceValue)}matches(e){const t=tn.comparator(e.key,this.key);return this.matchesComparison(t)}}class Mi extends Ai{constructor(e,t){super(e,"in",t),this.keys=zi("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class Fi extends Ai{constructor(e,t){super(e,"not-in",t),this.keys=zi("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function zi(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(e=>tn.fromName(e.referenceValue))}class Ui extends Ai{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return pi(t)&&si(t.arrayValue,this.value)}}class Vi extends Ai{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&si(this.value.arrayValue,t)}}class Bi extends Ai{constructor(e,t){super(e,"not-in",t)}matches(e){if(si(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!si(this.value.arrayValue,t)}}class ji extends Ai{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!pi(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>si(this.value.arrayValue,e))}}
933
+ */class ki{}class Ai extends ki{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new Di(e,t,n):"array-contains"===t?new Ui(e,n):"in"===t?new Vi(e,n):"not-in"===t?new Bi(e,n):"array-contains-any"===t?new ji(e,n):new Ai(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new Mi(e,n):new zi(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(oi(t,this.value)):null!==t&&ii(this.value)===ii(t)&&this.matchesComparison(oi(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return kt(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ri extends ki{constructor(e,t){super(),this.filters=e,this.op=t,this.he=null}static create(e,t){return new Ri(e,t)}matches(e){return xi(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.he||(this.he=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}}function xi(e){return"and"===e.op}function Ni(e){return function(e){for(const t of e.filters)if(t instanceof Ri)return!1;return!0}(e)&&xi(e)}function Oi(e){if(e instanceof Ai)return e.field.canonicalString()+e.op.toString()+li(e.value);if(Ni(e))return e.filters.map(e=>Oi(e)).join(",");{const t=e.filters.map(e=>Oi(e)).join(",");return`${e.op}(${t})`}}function Li(e,t){return e instanceof Ai?function(e,t){return t instanceof Ai&&e.op===t.op&&e.field.isEqual(t.field)&&ri(e.value,t.value)}(e,t):e instanceof Ri?function(e,t){return t instanceof Ri&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,i)=>e&&Li(n,t.filters[i]),!0)}(e,t):void kt(19439)}function Pi(e){return e instanceof Ai?function(e){return`${e.field.canonicalString()} ${e.op} ${li(e.value)}`}(e):e instanceof Ri?function(e){return e.op.toString()+" {"+e.getFilters().map(Pi).join(" ,")+"}"}(e):"Filter"}class Di extends Ai{constructor(e,t,n){super(e,t,n),this.key=tn.fromName(n.referenceValue)}matches(e){const t=tn.comparator(e.key,this.key);return this.matchesComparison(t)}}class Mi extends Ai{constructor(e,t){super(e,"in",t),this.keys=Fi("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class zi extends Ai{constructor(e,t){super(e,"not-in",t),this.keys=Fi("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Fi(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(e=>tn.fromName(e.referenceValue))}class Ui extends Ai{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return pi(t)&&si(t.arrayValue,this.value)}}class Vi extends Ai{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&si(this.value.arrayValue,t)}}class Bi extends Ai{constructor(e,t){super(e,"not-in",t)}matches(e){if(si(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!si(this.value.arrayValue,t)}}class ji extends Ai{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!pi(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>si(this.value.arrayValue,e))}}
934
934
  /**
935
935
  * @license
936
936
  * Copyright 2019 Google LLC
@@ -1043,7 +1043,7 @@ function _r(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t=
1043
1043
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1044
1044
  * See the License for the specific language governing permissions and
1045
1045
  * limitations under the License.
1046
- */class Tr{constructor(){this._=void 0}}function Ir(e,t,n){return e instanceof Ar?function(e,t){const n={fields:{[Hn]:{stringValue:jn},[qn]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Gn(t)&&(t=Kn(t)),t&&(n.fields[$n]=t),{mapValue:n}}(n,t):e instanceof Rr?xr(e,t):e instanceof Nr?Or(e,t):function(e,t){const n=kr(e,t),i=Pr(n)+Pr(e.Ee);return fi(n)&&fi(e.Ee)?Sr(i):_r(e.serializer,i)}(e,t)}function Cr(e,t,n){return e instanceof Rr?xr(e,t):e instanceof Nr?Or(e,t):n}function kr(e,t){return e instanceof Lr?function(e){return fi(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}class Ar extends Tr{}class Rr extends Tr{constructor(e){super(),this.elements=e}}function xr(e,t){const n=Dr(t);for(const t of e.elements)n.some(e=>ri(e,t))||n.push(t);return{arrayValue:{values:n}}}class Nr extends Tr{constructor(e){super(),this.elements=e}}function Or(e,t){let n=Dr(t);for(const t of e.elements)n=n.filter(e=>!ri(e,t));return{arrayValue:{values:n}}}class Lr extends Tr{constructor(e,t){super(),this.serializer=e,this.Ee=t}}function Pr(e){return Vn(e.integerValue||e.doubleValue)}function Dr(e){return pi(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Mr{constructor(e,t){this.version=e,this.transformResults=t}}class Fr{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Fr}static exists(e){return new Fr(void 0,e)}static updateTime(e){return new Fr(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function zr(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Ur{}function Vr(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new Jr(e.key,Fr.none()):new qr(e.key,e.data,Fr.none());{const n=e.data,i=wi.empty();let r=new Ln(en.comparator);for(let e of t.fields)if(!r.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),r=r.add(e)}return new Gr(e.key,i,new Dn(r.toArray()),Fr.none())}}function Br(e,t,n){e instanceof qr?function(e,t,n){const i=e.value.clone(),r=Wr(e.fieldTransforms,t,n.transformResults);i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):e instanceof Gr?function(e,t,n){if(!zr(e.precondition,t))return void t.convertToUnknownDocument(n.version);const i=Wr(e.fieldTransforms,t,n.transformResults),r=t.data;r.setAll(Kr(e)),r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function jr(e,t,n,i){return e instanceof qr?function(e,t,n,i){if(!zr(e.precondition,t))return n;const r=e.value.clone(),s=Qr(e.fieldTransforms,i,t);return r.setAll(s),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null}(e,t,n,i):e instanceof Gr?function(e,t,n,i){if(!zr(e.precondition,t))return n;const r=Qr(e.fieldTransforms,i,t),s=t.data;return s.setAll(Kr(e)),s.setAll(r),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,i):function(e,t,n){return zr(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Hr(e,t){let n=null;for(const i of e.fieldTransforms){const e=t.data.field(i.field),r=kr(i.transform,e||null);null!=r&&(null===n&&(n=wi.empty()),n.set(i.field,r))}return n||null}function $r(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Qt(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Rr&&t instanceof Rr||e instanceof Nr&&t instanceof Nr?Qt(e.elements,t.elements,ri):e instanceof Lr&&t instanceof Lr?ri(e.Ee,t.Ee):e instanceof Ar&&t instanceof Ar}(e.transform,t.transform)}(e,t))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class qr extends Ur{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Gr extends Ur{constructor(e,t,n,i,r=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function Kr(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const i=e.data.field(n);t.set(n,i)}}),t}function Wr(e,t,n){const i=new Map;Rt(e.length===n.length,32656,{Ae:n.length,Re:e.length});for(let r=0;r<n.length;r++){const s=e[r],o=s.transform,a=t.data.field(s.field);i.set(s.field,Cr(o,a,n[r]))}return i}function Qr(e,t,n){const i=new Map;for(const r of e){const e=r.transform,s=n.data.field(r.field);i.set(r.field,Ir(e,s,t))}return i}class Jr extends Ur{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Yr extends Ur{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
1046
+ */class Tr{constructor(){this._=void 0}}function Ir(e,t,n){return e instanceof Ar?function(e,t){const n={fields:{[Hn]:{stringValue:jn},[qn]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Gn(t)&&(t=Kn(t)),t&&(n.fields[$n]=t),{mapValue:n}}(n,t):e instanceof Rr?xr(e,t):e instanceof Nr?Or(e,t):function(e,t){const n=kr(e,t),i=Pr(n)+Pr(e.Ee);return fi(n)&&fi(e.Ee)?Sr(i):_r(e.serializer,i)}(e,t)}function Cr(e,t,n){return e instanceof Rr?xr(e,t):e instanceof Nr?Or(e,t):n}function kr(e,t){return e instanceof Lr?function(e){return fi(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}class Ar extends Tr{}class Rr extends Tr{constructor(e){super(),this.elements=e}}function xr(e,t){const n=Dr(t);for(const t of e.elements)n.some(e=>ri(e,t))||n.push(t);return{arrayValue:{values:n}}}class Nr extends Tr{constructor(e){super(),this.elements=e}}function Or(e,t){let n=Dr(t);for(const t of e.elements)n=n.filter(e=>!ri(e,t));return{arrayValue:{values:n}}}class Lr extends Tr{constructor(e,t){super(),this.serializer=e,this.Ee=t}}function Pr(e){return Vn(e.integerValue||e.doubleValue)}function Dr(e){return pi(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Mr{constructor(e,t){this.version=e,this.transformResults=t}}class zr{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new zr}static exists(e){return new zr(void 0,e)}static updateTime(e){return new zr(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Fr(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Ur{}function Vr(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new Jr(e.key,zr.none()):new qr(e.key,e.data,zr.none());{const n=e.data,i=wi.empty();let r=new Ln(en.comparator);for(let e of t.fields)if(!r.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),r=r.add(e)}return new Gr(e.key,i,new Dn(r.toArray()),zr.none())}}function Br(e,t,n){e instanceof qr?function(e,t,n){const i=e.value.clone(),r=Wr(e.fieldTransforms,t,n.transformResults);i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):e instanceof Gr?function(e,t,n){if(!Fr(e.precondition,t))return void t.convertToUnknownDocument(n.version);const i=Wr(e.fieldTransforms,t,n.transformResults),r=t.data;r.setAll(Kr(e)),r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function jr(e,t,n,i){return e instanceof qr?function(e,t,n,i){if(!Fr(e.precondition,t))return n;const r=e.value.clone(),s=Qr(e.fieldTransforms,i,t);return r.setAll(s),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null}(e,t,n,i):e instanceof Gr?function(e,t,n,i){if(!Fr(e.precondition,t))return n;const r=Qr(e.fieldTransforms,i,t),s=t.data;return s.setAll(Kr(e)),s.setAll(r),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,i):function(e,t,n){return Fr(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Hr(e,t){let n=null;for(const i of e.fieldTransforms){const e=t.data.field(i.field),r=kr(i.transform,e||null);null!=r&&(null===n&&(n=wi.empty()),n.set(i.field,r))}return n||null}function $r(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Qt(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Rr&&t instanceof Rr||e instanceof Nr&&t instanceof Nr?Qt(e.elements,t.elements,ri):e instanceof Lr&&t instanceof Lr?ri(e.Ee,t.Ee):e instanceof Ar&&t instanceof Ar}(e.transform,t.transform)}(e,t))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class qr extends Ur{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Gr extends Ur{constructor(e,t,n,i,r=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function Kr(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const i=e.data.field(n);t.set(n,i)}}),t}function Wr(e,t,n){const i=new Map;Rt(e.length===n.length,32656,{Ae:n.length,Re:e.length});for(let r=0;r<n.length;r++){const s=e[r],o=s.transform,a=t.data.field(s.field);i.set(s.field,Cr(o,a,n[r]))}return i}function Qr(e,t,n){const i=new Map;for(const r of e){const e=r.transform,s=n.data.field(r.field);i.set(r.field,Ir(e,s,t))}return i}class Jr extends Ur{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Yr extends Ur{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
1047
1047
  /**
1048
1048
  * @license
1049
1049
  * Copyright 2017 Google LLC
@@ -1156,7 +1156,7 @@ const ss=new st([4294967295,4294967295],0);function os(e){const t=Ht().encode(e)
1156
1156
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1157
1157
  * See the License for the specific language governing permissions and
1158
1158
  * limitations under the License.
1159
- */class ds{constructor(e,t,n,i){this.Se=e,this.removedTargetIds=t,this.key=n,this.be=i}}class fs{constructor(e,t){this.targetId=e,this.De=t}}class ps{constructor(e,t,n=Fn.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}}class gs{constructor(){this.ve=0,this.Ce=vs(),this.Fe=Fn.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return 0!==this.ve}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=wr(),t=wr(),n=wr();return this.Ce.forEach((i,r)=>{switch(r){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:n=n.add(i);break;default:kt(38017,{changeType:r})}}),new hs(this.Fe,this.Me,e,t,n)}ke(){this.xe=!1,this.Ce=vs()}qe(e,t){this.xe=!0,this.Ce=this.Ce.insert(e,t)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,Rt(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class ms{constructor(e){this.We=e,this.Ge=new Map,this.ze=ur(),this.je=ys(),this.Je=ys(),this.He=new xn(qt)}Ye(e){for(const t of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(t,e.be):this.Xe(t,e.key,e.be);for(const t of e.removedTargetIds)this.Xe(t,e.key,e.be)}et(e){this.forEachTarget(e,t=>{const n=this.tt(t);switch(e.state){case 0:this.nt(t)&&n.Be(e.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(e.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(t);break;case 3:this.nt(t)&&(n.Ke(),n.Be(e.resumeToken));break;case 4:this.nt(t)&&(this.rt(t),n.Be(e.resumeToken));break;default:kt(56790,{state:e.state})}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Ge.forEach((e,n)=>{this.nt(n)&&t(n)})}it(e){const t=e.targetId,n=e.De.count,i=this.st(t);if(i){const r=i.target;if(Ki(r))if(0===n){const e=new tn(r.path);this.Xe(t,e,_i.newNoDocument(e,pn.min()))}else Rt(1===n,20013,{expectedCount:n});else{const i=this.ot(t);if(i!==n){const n=this._t(e),r=n?this.ut(n,e,i):1;if(0!==r){this.rt(t);const e=2===r?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(t,e)}}}}}_t(e){const t=e.De.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:i=0},hashCount:r=0}=t;let s,o;try{s=Bn(n).toUint8Array()}catch(e){if(e instanceof Mn)return It("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{o=new cs(s,i,r)}catch(e){return It(e instanceof ls?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===o.fe?null:o}ut(e,t,n){return t.De.count===n-this.ht(e,t.targetId)?0:2}ht(e,t){const n=this.We.getRemoteKeysForTarget(t);let i=0;return n.forEach(n=>{const r=this.We.lt(),s=`projects/${r.projectId}/databases/${r.database}/documents/${n.path.canonicalString()}`;e.mightContain(s)||(this.Xe(t,n,null),i++)}),i}Pt(e){const t=new Map;this.Ge.forEach((n,i)=>{const r=this.st(i);if(r){if(n.current&&Ki(r.target)){const t=new tn(r.target.path);this.Tt(t).has(i)||this.It(i,t)||this.Xe(i,t,_i.newNoDocument(t,e))}n.Ne&&(t.set(i,n.Le()),n.ke())}});let n=wr();this.Je.forEach((e,t)=>{let i=!0;t.forEachWhile(e=>{const t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)}),i&&(n=n.add(e))}),this.ze.forEach((t,n)=>n.setReadTime(e));const i=new us(e,t,this.He,this.ze,n);return this.ze=ur(),this.je=ys(),this.Je=ys(),this.He=new xn(qt),i}Ze(e,t){if(!this.nt(e))return;const n=this.It(e,t.key)?2:0;this.tt(e).qe(t.key,n),this.ze=this.ze.insert(t.key,t),this.je=this.je.insert(t.key,this.Tt(t.key).add(e)),this.Je=this.Je.insert(t.key,this.dt(t.key).add(e))}Xe(e,t,n){if(!this.nt(e))return;const i=this.tt(e);this.It(e,t)?i.qe(t,1):i.Qe(t),this.Je=this.Je.insert(t,this.dt(t).delete(e)),this.Je=this.Je.insert(t,this.dt(t).add(e)),n&&(this.ze=this.ze.insert(t,n))}removeTarget(e){this.Ge.delete(e)}ot(e){const t=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let t=this.Ge.get(e);return t||(t=new gs,this.Ge.set(e,t)),t}dt(e){let t=this.Je.get(e);return t||(t=new Ln(qt),this.Je=this.Je.insert(e,t)),t}Tt(e){let t=this.je.get(e);return t||(t=new Ln(qt),this.je=this.je.insert(e,t)),t}nt(e){const t=null!==this.st(e);return t||Et("WatchChangeAggregator","Detected inactive target",e),t}st(e){const t=this.Ge.get(e);return t&&t.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new gs),this.We.getRemoteKeysForTarget(e).forEach(t=>{this.Xe(e,t,null)})}It(e,t){return this.We.getRemoteKeysForTarget(e).has(t)}}function ys(){return new xn(tn.comparator)}function vs(){return new xn(tn.comparator)}const ws={asc:"ASCENDING",desc:"DESCENDING"},bs={"<":"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"},_s={and:"AND",or:"OR"};class Ss{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Es(e,t){return e.useProto3Json||En(t)?t:{value:t}}function Ts(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Is(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Cs(e,t){return Ts(e,t.toTimestamp())}function ks(e){return Rt(!!e,49232),pn.fromTimestamp(function(e){const t=Un(e);return new fn(t.seconds,t.nanos)}(e))}function As(e,t){return Rs(e,t).canonicalString()}function Rs(e,t){const n=function(e){return new Xt(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function xs(e){const t=Xt.fromString(e);return Rt(Ws(t),10190,{key:t.toString()}),t}function Ns(e,t){return As(e.databaseId,t.path)}function Os(e,t){const n=xs(t);if(n.get(1)!==e.databaseId.projectId)throw new Ot(Nt.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Ot(Nt.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new tn(Ds(n))}function Ls(e,t){return As(e.databaseId,t)}function Ps(e){return new Xt(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Ds(e){return Rt(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function Ms(e,t,n){return{name:Ns(e,t),fields:n.value.mapValue.fields}}function Fs(e,t){return{documents:[Ls(e,t.path)]}}function zs(e,t){const n={structuredQuery:{}},i=t.path;let r;null!==t.collectionGroup?(r=i,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(r=i.popLast(),n.structuredQuery.from=[{collectionId:i.lastSegment()}]),n.parent=Ls(e,r);const s=function(e){if(0!==e.length)return Gs(Ri.create(e,"and"))}(t.filters);s&&(n.structuredQuery.where=s);const o=function(e){if(0!==e.length)return e.map(e=>function(e){return{field:$s(e.field),direction:Bs(e.dir)}}(e))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Es(e,t.limit);return null!==a&&(n.structuredQuery.limit=a),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{Vt:n,parent:r}}function Us(e){let t=function(e){const t=xs(e);return 4===t.length?Xt.emptyPath():Ds(t)}(e.parent);const n=e.structuredQuery,i=n.from?n.from.length:0;let r=null;if(i>0){Rt(1===i,65062);const e=n.from[0];e.allDescendants?r=e.collectionId:t=t.child(e.collectionId)}let s=[];n.where&&(s=function(e){const t=Vs(e);return t instanceof Ri&&Ni(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map(e=>function(e){return new Ii(qs(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,En(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new Si(n,t)}(n.startAt));let l=null;return n.endAt&&(l=function(e){const t=!e.before,n=e.values||[];return new Si(n,t)}(n.endAt)),function(e,t,n,i,r,s,o,a){return new Wi(e,t,n,i,r,s,o,a)}(t,r,o,s,a,"F",c,l)}function Vs(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=qs(e.unaryFilter.field);return Ai.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=qs(e.unaryFilter.field);return Ai.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=qs(e.unaryFilter.field);return Ai.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=qs(e.unaryFilter.field);return Ai.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return kt(61313);default:return kt(60726)}}(e):void 0!==e.fieldFilter?function(e){return Ai.create(qs(e.fieldFilter.field),function(e){switch(e){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";case"OPERATOR_UNSPECIFIED":return kt(58110);default:return kt(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return Ri.create(e.compositeFilter.filters.map(e=>Vs(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return kt(1026)}}(e.compositeFilter.op))}(e):kt(30097,{filter:e})}function Bs(e){return ws[e]}function js(e){return bs[e]}function Hs(e){return _s[e]}function $s(e){return{fieldPath:e.canonicalString()}}function qs(e){return en.fromServerFormat(e.fieldPath)}function Gs(e){return e instanceof Ai?function(e){if("=="===e.op){if(mi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NAN"}};if(gi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(mi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NOT_NAN"}};if(gi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$s(e.field),op:js(e.op),value:e.value}}}(e):e instanceof Ri?function(e){const t=e.getFilters().map(e=>Gs(e));return 1===t.length?t[0]:{compositeFilter:{op:Hs(e.op),filters:t}}}(e):kt(54877,{filter:e})}function Ks(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Ws(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}
1159
+ */class ds{constructor(e,t,n,i){this.Se=e,this.removedTargetIds=t,this.key=n,this.be=i}}class fs{constructor(e,t){this.targetId=e,this.De=t}}class ps{constructor(e,t,n=zn.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}}class gs{constructor(){this.ve=0,this.Ce=vs(),this.Fe=zn.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return 0!==this.ve}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=wr(),t=wr(),n=wr();return this.Ce.forEach((i,r)=>{switch(r){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:n=n.add(i);break;default:kt(38017,{changeType:r})}}),new hs(this.Fe,this.Me,e,t,n)}ke(){this.xe=!1,this.Ce=vs()}qe(e,t){this.xe=!0,this.Ce=this.Ce.insert(e,t)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,Rt(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class ms{constructor(e){this.We=e,this.Ge=new Map,this.ze=ur(),this.je=ys(),this.Je=ys(),this.He=new xn(qt)}Ye(e){for(const t of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(t,e.be):this.Xe(t,e.key,e.be);for(const t of e.removedTargetIds)this.Xe(t,e.key,e.be)}et(e){this.forEachTarget(e,t=>{const n=this.tt(t);switch(e.state){case 0:this.nt(t)&&n.Be(e.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(e.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(t);break;case 3:this.nt(t)&&(n.Ke(),n.Be(e.resumeToken));break;case 4:this.nt(t)&&(this.rt(t),n.Be(e.resumeToken));break;default:kt(56790,{state:e.state})}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Ge.forEach((e,n)=>{this.nt(n)&&t(n)})}it(e){const t=e.targetId,n=e.De.count,i=this.st(t);if(i){const r=i.target;if(Ki(r))if(0===n){const e=new tn(r.path);this.Xe(t,e,_i.newNoDocument(e,pn.min()))}else Rt(1===n,20013,{expectedCount:n});else{const i=this.ot(t);if(i!==n){const n=this._t(e),r=n?this.ut(n,e,i):1;if(0!==r){this.rt(t);const e=2===r?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(t,e)}}}}}_t(e){const t=e.De.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:i=0},hashCount:r=0}=t;let s,o;try{s=Bn(n).toUint8Array()}catch(e){if(e instanceof Mn)return It("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{o=new cs(s,i,r)}catch(e){return It(e instanceof ls?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===o.fe?null:o}ut(e,t,n){return t.De.count===n-this.ht(e,t.targetId)?0:2}ht(e,t){const n=this.We.getRemoteKeysForTarget(t);let i=0;return n.forEach(n=>{const r=this.We.lt(),s=`projects/${r.projectId}/databases/${r.database}/documents/${n.path.canonicalString()}`;e.mightContain(s)||(this.Xe(t,n,null),i++)}),i}Pt(e){const t=new Map;this.Ge.forEach((n,i)=>{const r=this.st(i);if(r){if(n.current&&Ki(r.target)){const t=new tn(r.target.path);this.Tt(t).has(i)||this.It(i,t)||this.Xe(i,t,_i.newNoDocument(t,e))}n.Ne&&(t.set(i,n.Le()),n.ke())}});let n=wr();this.Je.forEach((e,t)=>{let i=!0;t.forEachWhile(e=>{const t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)}),i&&(n=n.add(e))}),this.ze.forEach((t,n)=>n.setReadTime(e));const i=new us(e,t,this.He,this.ze,n);return this.ze=ur(),this.je=ys(),this.Je=ys(),this.He=new xn(qt),i}Ze(e,t){if(!this.nt(e))return;const n=this.It(e,t.key)?2:0;this.tt(e).qe(t.key,n),this.ze=this.ze.insert(t.key,t),this.je=this.je.insert(t.key,this.Tt(t.key).add(e)),this.Je=this.Je.insert(t.key,this.dt(t.key).add(e))}Xe(e,t,n){if(!this.nt(e))return;const i=this.tt(e);this.It(e,t)?i.qe(t,1):i.Qe(t),this.Je=this.Je.insert(t,this.dt(t).delete(e)),this.Je=this.Je.insert(t,this.dt(t).add(e)),n&&(this.ze=this.ze.insert(t,n))}removeTarget(e){this.Ge.delete(e)}ot(e){const t=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let t=this.Ge.get(e);return t||(t=new gs,this.Ge.set(e,t)),t}dt(e){let t=this.Je.get(e);return t||(t=new Ln(qt),this.Je=this.Je.insert(e,t)),t}Tt(e){let t=this.je.get(e);return t||(t=new Ln(qt),this.je=this.je.insert(e,t)),t}nt(e){const t=null!==this.st(e);return t||Et("WatchChangeAggregator","Detected inactive target",e),t}st(e){const t=this.Ge.get(e);return t&&t.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new gs),this.We.getRemoteKeysForTarget(e).forEach(t=>{this.Xe(e,t,null)})}It(e,t){return this.We.getRemoteKeysForTarget(e).has(t)}}function ys(){return new xn(tn.comparator)}function vs(){return new xn(tn.comparator)}const ws={asc:"ASCENDING",desc:"DESCENDING"},bs={"<":"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"},_s={and:"AND",or:"OR"};class Ss{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Es(e,t){return e.useProto3Json||En(t)?t:{value:t}}function Ts(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Is(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Cs(e,t){return Ts(e,t.toTimestamp())}function ks(e){return Rt(!!e,49232),pn.fromTimestamp(function(e){const t=Un(e);return new fn(t.seconds,t.nanos)}(e))}function As(e,t){return Rs(e,t).canonicalString()}function Rs(e,t){const n=function(e){return new Xt(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function xs(e){const t=Xt.fromString(e);return Rt(Ws(t),10190,{key:t.toString()}),t}function Ns(e,t){return As(e.databaseId,t.path)}function Os(e,t){const n=xs(t);if(n.get(1)!==e.databaseId.projectId)throw new Ot(Nt.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Ot(Nt.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new tn(Ds(n))}function Ls(e,t){return As(e.databaseId,t)}function Ps(e){return new Xt(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Ds(e){return Rt(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function Ms(e,t,n){return{name:Ns(e,t),fields:n.value.mapValue.fields}}function zs(e,t){return{documents:[Ls(e,t.path)]}}function Fs(e,t){const n={structuredQuery:{}},i=t.path;let r;null!==t.collectionGroup?(r=i,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(r=i.popLast(),n.structuredQuery.from=[{collectionId:i.lastSegment()}]),n.parent=Ls(e,r);const s=function(e){if(0!==e.length)return Gs(Ri.create(e,"and"))}(t.filters);s&&(n.structuredQuery.where=s);const o=function(e){if(0!==e.length)return e.map(e=>function(e){return{field:$s(e.field),direction:Bs(e.dir)}}(e))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Es(e,t.limit);return null!==a&&(n.structuredQuery.limit=a),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{Vt:n,parent:r}}function Us(e){let t=function(e){const t=xs(e);return 4===t.length?Xt.emptyPath():Ds(t)}(e.parent);const n=e.structuredQuery,i=n.from?n.from.length:0;let r=null;if(i>0){Rt(1===i,65062);const e=n.from[0];e.allDescendants?r=e.collectionId:t=t.child(e.collectionId)}let s=[];n.where&&(s=function(e){const t=Vs(e);return t instanceof Ri&&Ni(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map(e=>function(e){return new Ii(qs(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,En(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new Si(n,t)}(n.startAt));let l=null;return n.endAt&&(l=function(e){const t=!e.before,n=e.values||[];return new Si(n,t)}(n.endAt)),function(e,t,n,i,r,s,o,a){return new Wi(e,t,n,i,r,s,o,a)}(t,r,o,s,a,"F",c,l)}function Vs(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=qs(e.unaryFilter.field);return Ai.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=qs(e.unaryFilter.field);return Ai.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=qs(e.unaryFilter.field);return Ai.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=qs(e.unaryFilter.field);return Ai.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return kt(61313);default:return kt(60726)}}(e):void 0!==e.fieldFilter?function(e){return Ai.create(qs(e.fieldFilter.field),function(e){switch(e){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";case"OPERATOR_UNSPECIFIED":return kt(58110);default:return kt(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return Ri.create(e.compositeFilter.filters.map(e=>Vs(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return kt(1026)}}(e.compositeFilter.op))}(e):kt(30097,{filter:e})}function Bs(e){return ws[e]}function js(e){return bs[e]}function Hs(e){return _s[e]}function $s(e){return{fieldPath:e.canonicalString()}}function qs(e){return en.fromServerFormat(e.fieldPath)}function Gs(e){return e instanceof Ai?function(e){if("=="===e.op){if(mi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NAN"}};if(gi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(mi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NOT_NAN"}};if(gi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$s(e.field),op:js(e.op),value:e.value}}}(e):e instanceof Ri?function(e){const t=e.getFilters().map(e=>Gs(e));return 1===t.length?t[0]:{compositeFilter:{op:Hs(e.op),filters:t}}}(e):kt(54877,{filter:e})}function Ks(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Ws(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}
1160
1160
  /**
1161
1161
  * @license
1162
1162
  * Copyright 2017 Google LLC
@@ -1172,7 +1172,7 @@ const ss=new st([4294967295,4294967295],0);function os(e){const t=Ht().encode(e)
1172
1172
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1173
1173
  * See the License for the specific language governing permissions and
1174
1174
  * limitations under the License.
1175
- */class Qs{constructor(e,t,n,i,r=pn.min(),s=pn.min(),o=Fn.EMPTY_BYTE_STRING,a=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(e){return new Qs(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}
1175
+ */class Qs{constructor(e,t,n,i,r=pn.min(),s=pn.min(),o=zn.EMPTY_BYTE_STRING,a=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(e){return new Qs(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}
1176
1176
  /**
1177
1177
  * @license
1178
1178
  * Copyright 2017 Google LLC
@@ -1382,7 +1382,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1382
1382
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1383
1383
  * See the License for the specific language governing permissions and
1384
1384
  * limitations under the License.
1385
- */class go{constructor(){this.sessionToken=Fn.EMPTY_BYTE_STRING}getSessionToken(e){return bn.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,bn.resolve()}}
1385
+ */class go{constructor(){this.sessionToken=zn.EMPTY_BYTE_STRING}getSessionToken(e){return bn.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,bn.resolve()}}
1386
1386
  /**
1387
1387
  * @license
1388
1388
  * Copyright 2017 Google LLC
@@ -1526,7 +1526,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1526
1526
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1527
1527
  * See the License for the specific language governing permissions and
1528
1528
  * limitations under the License.
1529
- */const Ro="LocalStore";class xo{constructor(e,t,n,i){this.persistence=e,this.Cs=t,this.serializer=i,this.Fs=new xn(qt),this.Ms=new cr(e=>qi(e),Gi),this.xs=new Map,this.Os=e.getRemoteDocumentCache(),this.hi=e.getTargetCache(),this.Ti=e.getBundleCache(),this.Ns(n)}Ns(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new ho(this.Os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Os.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Fs))}}async function No(e,t){const n=xt(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let i;return n.mutationQueue.getAllMutationBatches(e).next(r=>(i=r,n.Ns(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const r=[],s=[];let o=wr();for(const e of i){r.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){s.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next(e=>({Bs:e,removedBatchIds:r,addedBatchIds:s}))})})}function Oo(e){const t=xt(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.hi.getLastRemoteSnapshotVersion(e))}function Lo(e,t){const n=xt(e),i=t.snapshotVersion;let r=n.Fs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{const s=n.Os.newChangeBuffer({trackRemovals:!0});r=n.Fs;const o=[];t.targetChanges.forEach((s,a)=>{const c=r.get(a);if(!c)return;o.push(n.hi.removeMatchingKeys(e,s.removedDocuments,a).next(()=>n.hi.addMatchingKeys(e,s.addedDocuments,a)));let l=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?l=l.withResumeToken(Fn.EMPTY_BYTE_STRING,pn.min()).withLastLimboFreeSnapshotVersion(pn.min()):s.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(s.resumeToken,i)),r=r.insert(a,l),function(e,t,n){if(0===e.resumeToken.approximateByteSize())return!0;if(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8)return!0;return n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,l,s)&&o.push(n.hi.updateTargetData(e,l))});let a=ur(),c=wr();if(t.documentUpdates.forEach(i=>{t.resolvedLimboDocuments.has(i)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,i))}),o.push(function(e,t,n){let i=wr(),r=wr();return n.forEach(e=>i=i.add(e)),t.getEntries(e,i).next(e=>{let i=ur();return n.forEach((n,s)=>{const o=e.get(n);s.isFoundDocument()!==o.isFoundDocument()&&(r=r.add(n)),s.isNoDocument()&&s.version.isEqual(pn.min())?(t.removeEntry(n,s.readTime),i=i.insert(n,s)):!o.isValidDocument()||s.version.compareTo(o.version)>0||0===s.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(s),i=i.insert(n,s)):Et(Ro,"Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",s.version)}),{Ls:i,ks:r}})}(e,s,t.documentUpdates).next(e=>{a=e.Ls,c=e.ks})),!i.isEqual(pn.min())){const t=n.hi.getLastRemoteSnapshotVersion(e).next(t=>n.hi.setTargetsMetadata(e,e.currentSequenceNumber,i));o.push(t)}return bn.waitFor(o).next(()=>s.apply(e)).next(()=>n.localDocuments.getLocalViewOfDocuments(e,a,c)).next(()=>a)}).then(e=>(n.Fs=r,e))}function Po(e,t){const n=xt(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}async function Do(e,t,n){const i=xt(e),r=i.Fs.get(t),s=n?"readwrite":"readwrite-primary";try{n||await i.persistence.runTransaction("Release target",s,e=>i.persistence.referenceDelegate.removeTarget(e,r))}catch(e){if(!_n(e))throw e;Et(Ro,`Failed to update sequence numbers for target ${t}: ${e}`)}i.Fs=i.Fs.remove(t),i.Ms.delete(r.target)}function Mo(e,t,n){const i=xt(e);let r=pn.min(),s=wr();return i.persistence.runTransaction("Execute query","readwrite",e=>function(e,t,n){const i=xt(e),r=i.Ms.get(n);return void 0!==r?bn.resolve(i.Fs.get(r)):i.hi.getTargetData(t,n)}(i,e,Zi(t)).next(t=>{if(t)return r=t.lastLimboFreeSnapshotVersion,i.hi.getMatchingKeysForTargetId(e,t.targetId).next(e=>{s=e})}).next(()=>i.Cs.getDocumentsMatchingQuery(e,t,n?r:pn.min(),n?s:wr())).next(e=>(function(e,t,n){let i=e.xs.get(t)||pn.min();n.forEach((e,t)=>{t.readTime.compareTo(i)>0&&(i=t.readTime)}),e.xs.set(t,i)}(i,function(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}(t),e),{documents:e,qs:s})))}class Fo{constructor(){this.activeTargetIds=br}Gs(e){this.activeTargetIds=this.activeTargetIds.add(e)}zs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class zo{constructor(){this.Fo=new Fo,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Fo.Gs(e),this.Mo[e]||"not-current"}updateQueryState(e,t,n){this.Mo[e]=t}removeLocalQueryTarget(e){this.Fo.zs(e)}isLocalQueryTarget(e){return this.Fo.activeTargetIds.has(e)}clearQueryState(e){delete this.Mo[e]}getAllActiveQueryTargets(){return this.Fo.activeTargetIds}isActiveQueryTarget(e){return this.Fo.activeTargetIds.has(e)}start(){return this.Fo=new Fo,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}
1529
+ */const Ro="LocalStore";class xo{constructor(e,t,n,i){this.persistence=e,this.Cs=t,this.serializer=i,this.Fs=new xn(qt),this.Ms=new cr(e=>qi(e),Gi),this.xs=new Map,this.Os=e.getRemoteDocumentCache(),this.hi=e.getTargetCache(),this.Ti=e.getBundleCache(),this.Ns(n)}Ns(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new ho(this.Os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Os.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Fs))}}async function No(e,t){const n=xt(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let i;return n.mutationQueue.getAllMutationBatches(e).next(r=>(i=r,n.Ns(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const r=[],s=[];let o=wr();for(const e of i){r.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){s.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next(e=>({Bs:e,removedBatchIds:r,addedBatchIds:s}))})})}function Oo(e){const t=xt(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.hi.getLastRemoteSnapshotVersion(e))}function Lo(e,t){const n=xt(e),i=t.snapshotVersion;let r=n.Fs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{const s=n.Os.newChangeBuffer({trackRemovals:!0});r=n.Fs;const o=[];t.targetChanges.forEach((s,a)=>{const c=r.get(a);if(!c)return;o.push(n.hi.removeMatchingKeys(e,s.removedDocuments,a).next(()=>n.hi.addMatchingKeys(e,s.addedDocuments,a)));let l=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?l=l.withResumeToken(zn.EMPTY_BYTE_STRING,pn.min()).withLastLimboFreeSnapshotVersion(pn.min()):s.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(s.resumeToken,i)),r=r.insert(a,l),function(e,t,n){if(0===e.resumeToken.approximateByteSize())return!0;if(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8)return!0;return n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,l,s)&&o.push(n.hi.updateTargetData(e,l))});let a=ur(),c=wr();if(t.documentUpdates.forEach(i=>{t.resolvedLimboDocuments.has(i)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,i))}),o.push(function(e,t,n){let i=wr(),r=wr();return n.forEach(e=>i=i.add(e)),t.getEntries(e,i).next(e=>{let i=ur();return n.forEach((n,s)=>{const o=e.get(n);s.isFoundDocument()!==o.isFoundDocument()&&(r=r.add(n)),s.isNoDocument()&&s.version.isEqual(pn.min())?(t.removeEntry(n,s.readTime),i=i.insert(n,s)):!o.isValidDocument()||s.version.compareTo(o.version)>0||0===s.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(s),i=i.insert(n,s)):Et(Ro,"Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",s.version)}),{Ls:i,ks:r}})}(e,s,t.documentUpdates).next(e=>{a=e.Ls,c=e.ks})),!i.isEqual(pn.min())){const t=n.hi.getLastRemoteSnapshotVersion(e).next(t=>n.hi.setTargetsMetadata(e,e.currentSequenceNumber,i));o.push(t)}return bn.waitFor(o).next(()=>s.apply(e)).next(()=>n.localDocuments.getLocalViewOfDocuments(e,a,c)).next(()=>a)}).then(e=>(n.Fs=r,e))}function Po(e,t){const n=xt(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}async function Do(e,t,n){const i=xt(e),r=i.Fs.get(t),s=n?"readwrite":"readwrite-primary";try{n||await i.persistence.runTransaction("Release target",s,e=>i.persistence.referenceDelegate.removeTarget(e,r))}catch(e){if(!_n(e))throw e;Et(Ro,`Failed to update sequence numbers for target ${t}: ${e}`)}i.Fs=i.Fs.remove(t),i.Ms.delete(r.target)}function Mo(e,t,n){const i=xt(e);let r=pn.min(),s=wr();return i.persistence.runTransaction("Execute query","readwrite",e=>function(e,t,n){const i=xt(e),r=i.Ms.get(n);return void 0!==r?bn.resolve(i.Fs.get(r)):i.hi.getTargetData(t,n)}(i,e,Zi(t)).next(t=>{if(t)return r=t.lastLimboFreeSnapshotVersion,i.hi.getMatchingKeysForTargetId(e,t.targetId).next(e=>{s=e})}).next(()=>i.Cs.getDocumentsMatchingQuery(e,t,n?r:pn.min(),n?s:wr())).next(e=>(function(e,t,n){let i=e.xs.get(t)||pn.min();n.forEach((e,t)=>{t.readTime.compareTo(i)>0&&(i=t.readTime)}),e.xs.set(t,i)}(i,function(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}(t),e),{documents:e,qs:s})))}class zo{constructor(){this.activeTargetIds=br}Gs(e){this.activeTargetIds=this.activeTargetIds.add(e)}zs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Fo{constructor(){this.Fo=new zo,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Fo.Gs(e),this.Mo[e]||"not-current"}updateQueryState(e,t,n){this.Mo[e]=t}removeLocalQueryTarget(e){this.Fo.zs(e)}isLocalQueryTarget(e){return this.Fo.activeTargetIds.has(e)}clearQueryState(e){delete this.Mo[e]}getAllActiveQueryTargets(){return this.Fo.activeTargetIds}isActiveQueryTarget(e){return this.Fo.activeTargetIds.has(e)}start(){return this.Fo=new zo,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}
1530
1530
  /**
1531
1531
  * @license
1532
1532
  * Copyright 2019 Google LLC
@@ -1670,7 +1670,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1670
1670
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1671
1671
  * See the License for the specific language governing permissions and
1672
1672
  * limitations under the License.
1673
- */const Zo="PersistentStream";class ea{constructor(e,t,n,i,r,s,o,a){this.Fi=e,this.w_=n,this.S_=i,this.connection=r,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new Xo(e,t)}M_(){return 1===this.state||5===this.state||this.x_()}x_(){return 2===this.state||3===this.state}start(){this.C_=0,4!==this.state?this.auth():this.O_()}async stop(){this.M_()&&await this.close(0)}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&null===this.D_&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,()=>this.L_()))}k_(e){this.q_(),this.stream.send(e)}async L_(){if(this.x_())return this.close(0)}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,4!==e?this.F_.reset():t&&t.code===Nt.RESOURCE_EXHAUSTED?(Tt(t.toString()),Tt("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):t&&t.code===Nt.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.U_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.n_(t)}U_(){}auth(){this.state=1;const e=this.K_(this.b_),t=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.b_===t&&this.W_(e,n)},t=>{e(()=>{const e=new Ot(Nt.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(e)})})}W_(e,t){const n=this.K_(this.b_);this.stream=this.z_(e,t),this.stream.Zo(()=>{n(()=>this.listener.Zo())}),this.stream.e_(()=>{n(()=>(this.state=2,this.v_=this.Fi.enqueueAfterDelay(this.S_,1e4,()=>(this.x_()&&(this.state=3),Promise.resolve())),this.listener.e_()))}),this.stream.n_(e=>{n(()=>this.G_(e))}),this.stream.onMessage(e=>{n(()=>1==++this.C_?this.j_(e):this.onNext(e))})}O_(){this.state=5,this.F_.g_(async()=>{this.state=0,this.start()})}G_(e){return Et(Zo,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return t=>{this.Fi.enqueueAndForget(()=>this.b_===e?t():(Et(Zo,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class ta extends ea{constructor(e,t,n,i,r,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,s),this.serializer=r}z_(e,t){return this.connection.P_("Listen",e,t)}j_(e){return this.onNext(e)}onNext(e){this.F_.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const i=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:kt(39313,{state:e})}(t.targetChange.targetChangeType||"NO_CHANGE"),r=t.targetChange.targetIds||[],s=function(e,t){return e.useProto3Json?(Rt(void 0===t||"string"==typeof t,58123),Fn.fromBase64String(t||"")):(Rt(void 0===t||t instanceof Buffer||t instanceof Uint8Array,16193),Fn.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?Nt.UNKNOWN:rs(e.code);return new Ot(t,e.message||"")}(o);n=new ps(i,r,s,a||null)}else if("documentChange"in t){t.documentChange;const i=t.documentChange;i.document,i.document.name,i.document.updateTime;const r=Os(e,i.document.name),s=ks(i.document.updateTime),o=i.document.createTime?ks(i.document.createTime):pn.min(),a=new wi({mapValue:{fields:i.document.fields}}),c=_i.newFoundDocument(r,s,o,a),l=i.targetIds||[],u=i.removedTargetIds||[];n=new ds(l,u,c.key,c)}else if("documentDelete"in t){t.documentDelete;const i=t.documentDelete;i.document;const r=Os(e,i.document),s=i.readTime?ks(i.readTime):pn.min(),o=_i.newNoDocument(r,s),a=i.removedTargetIds||[];n=new ds([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const i=t.documentRemove;i.document;const r=Os(e,i.document),s=i.removedTargetIds||[];n=new ds([],s,r,null)}else{if(!("filter"in t))return kt(11601,{At:t});{t.filter;const e=t.filter;e.targetId;const{count:i=0,unchangedNames:r}=e,s=new ts(i,r),o=e.targetId;n=new fs(o,s)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return pn.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?pn.min():t.readTime?ks(t.readTime):pn.min()}(e);return this.listener.J_(t,n)}H_(e){const t={};t.database=Ps(this.serializer),t.addTarget=function(e,t){let n;const i=t.target;if(n=Ki(i)?{documents:Fs(e,i)}:{query:zs(e,i).Vt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Is(e,t.resumeToken);const i=Es(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(pn.min())>0){n.readTime=Ts(e,t.snapshotVersion.toTimestamp());const i=Es(e,t.expectedCount);null!==i&&(n.expectedCount=i)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return kt(28987,{purpose:e})}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.k_(t)}Y_(e){const t={};t.database=Ps(this.serializer),t.removeTarget=e,this.k_(t)}}class na extends ea{constructor(e,t,n,i,r,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,s),this.serializer=r}get Z_(){return this.C_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.Z_&&this.X_([])}z_(e,t){return this.connection.P_("Write",e,t)}j_(e){return Rt(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Rt(!e.writeResults||0===e.writeResults.length,55816),this.listener.ea()}onNext(e){Rt(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();const t=function(e,t){return e&&e.length>0?(Rt(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?ks(e.updateTime):ks(t);return n.isEqual(pn.min())&&(n=ks(t)),new Mr(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=ks(e.commitTime);return this.listener.ta(n,t)}na(){const e={};e.database=Ps(this.serializer),this.k_(e)}X_(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>function(e,t){let n;if(t instanceof qr)n={update:Ms(e,t.key,t.value)};else if(t instanceof Jr)n={delete:Ns(e,t.key)};else if(t instanceof Gr)n={update:Ms(e,t.key,t.data),updateMask:Ks(t.fieldMask)};else{if(!(t instanceof Yr))return kt(16599,{Rt:t.type});n={verify:Ns(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof Ar)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Rr)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Nr)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Lr)return{fieldPath:t.field.canonicalString(),increment:n.Ee};throw kt(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:Cs(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:kt(27497)}(e,t.precondition)),n}(this.serializer,e))};this.k_(t)}}
1673
+ */const Zo="PersistentStream";class ea{constructor(e,t,n,i,r,s,o,a){this.Fi=e,this.w_=n,this.S_=i,this.connection=r,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new Xo(e,t)}M_(){return 1===this.state||5===this.state||this.x_()}x_(){return 2===this.state||3===this.state}start(){this.C_=0,4!==this.state?this.auth():this.O_()}async stop(){this.M_()&&await this.close(0)}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&null===this.D_&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,()=>this.L_()))}k_(e){this.q_(),this.stream.send(e)}async L_(){if(this.x_())return this.close(0)}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,4!==e?this.F_.reset():t&&t.code===Nt.RESOURCE_EXHAUSTED?(Tt(t.toString()),Tt("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):t&&t.code===Nt.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.U_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.n_(t)}U_(){}auth(){this.state=1;const e=this.K_(this.b_),t=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.b_===t&&this.W_(e,n)},t=>{e(()=>{const e=new Ot(Nt.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(e)})})}W_(e,t){const n=this.K_(this.b_);this.stream=this.z_(e,t),this.stream.Zo(()=>{n(()=>this.listener.Zo())}),this.stream.e_(()=>{n(()=>(this.state=2,this.v_=this.Fi.enqueueAfterDelay(this.S_,1e4,()=>(this.x_()&&(this.state=3),Promise.resolve())),this.listener.e_()))}),this.stream.n_(e=>{n(()=>this.G_(e))}),this.stream.onMessage(e=>{n(()=>1==++this.C_?this.j_(e):this.onNext(e))})}O_(){this.state=5,this.F_.g_(async()=>{this.state=0,this.start()})}G_(e){return Et(Zo,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return t=>{this.Fi.enqueueAndForget(()=>this.b_===e?t():(Et(Zo,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class ta extends ea{constructor(e,t,n,i,r,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,s),this.serializer=r}z_(e,t){return this.connection.P_("Listen",e,t)}j_(e){return this.onNext(e)}onNext(e){this.F_.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const i=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:kt(39313,{state:e})}(t.targetChange.targetChangeType||"NO_CHANGE"),r=t.targetChange.targetIds||[],s=function(e,t){return e.useProto3Json?(Rt(void 0===t||"string"==typeof t,58123),zn.fromBase64String(t||"")):(Rt(void 0===t||t instanceof Buffer||t instanceof Uint8Array,16193),zn.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?Nt.UNKNOWN:rs(e.code);return new Ot(t,e.message||"")}(o);n=new ps(i,r,s,a||null)}else if("documentChange"in t){t.documentChange;const i=t.documentChange;i.document,i.document.name,i.document.updateTime;const r=Os(e,i.document.name),s=ks(i.document.updateTime),o=i.document.createTime?ks(i.document.createTime):pn.min(),a=new wi({mapValue:{fields:i.document.fields}}),c=_i.newFoundDocument(r,s,o,a),l=i.targetIds||[],u=i.removedTargetIds||[];n=new ds(l,u,c.key,c)}else if("documentDelete"in t){t.documentDelete;const i=t.documentDelete;i.document;const r=Os(e,i.document),s=i.readTime?ks(i.readTime):pn.min(),o=_i.newNoDocument(r,s),a=i.removedTargetIds||[];n=new ds([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const i=t.documentRemove;i.document;const r=Os(e,i.document),s=i.removedTargetIds||[];n=new ds([],s,r,null)}else{if(!("filter"in t))return kt(11601,{At:t});{t.filter;const e=t.filter;e.targetId;const{count:i=0,unchangedNames:r}=e,s=new ts(i,r),o=e.targetId;n=new fs(o,s)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return pn.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?pn.min():t.readTime?ks(t.readTime):pn.min()}(e);return this.listener.J_(t,n)}H_(e){const t={};t.database=Ps(this.serializer),t.addTarget=function(e,t){let n;const i=t.target;if(n=Ki(i)?{documents:zs(e,i)}:{query:Fs(e,i).Vt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Is(e,t.resumeToken);const i=Es(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(pn.min())>0){n.readTime=Ts(e,t.snapshotVersion.toTimestamp());const i=Es(e,t.expectedCount);null!==i&&(n.expectedCount=i)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return kt(28987,{purpose:e})}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.k_(t)}Y_(e){const t={};t.database=Ps(this.serializer),t.removeTarget=e,this.k_(t)}}class na extends ea{constructor(e,t,n,i,r,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,s),this.serializer=r}get Z_(){return this.C_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.Z_&&this.X_([])}z_(e,t){return this.connection.P_("Write",e,t)}j_(e){return Rt(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Rt(!e.writeResults||0===e.writeResults.length,55816),this.listener.ea()}onNext(e){Rt(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();const t=function(e,t){return e&&e.length>0?(Rt(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?ks(e.updateTime):ks(t);return n.isEqual(pn.min())&&(n=ks(t)),new Mr(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=ks(e.commitTime);return this.listener.ta(n,t)}na(){const e={};e.database=Ps(this.serializer),this.k_(e)}X_(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>function(e,t){let n;if(t instanceof qr)n={update:Ms(e,t.key,t.value)};else if(t instanceof Jr)n={delete:Ns(e,t.key)};else if(t instanceof Gr)n={update:Ms(e,t.key,t.data),updateMask:Ks(t.fieldMask)};else{if(!(t instanceof Yr))return kt(16599,{Rt:t.type});n={verify:Ns(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof Ar)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Rr)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Nr)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Lr)return{fieldPath:t.field.canonicalString(),increment:n.Ee};throw kt(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:Cs(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:kt(27497)}(e,t.precondition)),n}(this.serializer,e))};this.k_(t)}}
1674
1674
  /**
1675
1675
  * @license
1676
1676
  * Copyright 2017 Google LLC
@@ -1702,7 +1702,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1702
1702
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1703
1703
  * See the License for the specific language governing permissions and
1704
1704
  * limitations under the License.
1705
- */const oa="RemoteStore";class aa{constructor(e,t,n,i,r){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=r,this.Ea.xo(e=>{n.enqueueAndForget(async()=>{ma(this)&&(Et(oa,"Restarting streams for network reachability change."),await async function(e){const t=xt(e);t.Ia.add(4),await la(t),t.Aa.set("Unknown"),t.Ia.delete(4),await ca(t)}(this))})}),this.Aa=new sa(n,i)}}async function ca(e){if(ma(e))for(const t of e.da)await t(!0)}async function la(e){for(const t of e.da)await t(!1)}function ua(e,t){const n=xt(e);n.Ta.has(t.targetId)||(n.Ta.set(t.targetId,t),ga(n)?pa(n):Pa(n).x_()&&da(n,t))}function ha(e,t){const n=xt(e),i=Pa(n);n.Ta.delete(t),i.x_()&&fa(n,t),0===n.Ta.size&&(i.x_()?i.B_():ma(n)&&n.Aa.set("Unknown"))}function da(e,t){if(e.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(pn.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Pa(e).H_(t)}function fa(e,t){e.Ra.$e(t),Pa(e).Y_(t)}function pa(e){e.Ra=new ms({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),Et:t=>e.Ta.get(t)||null,lt:()=>e.datastore.serializer.databaseId}),Pa(e).start(),e.Aa.aa()}function ga(e){return ma(e)&&!Pa(e).M_()&&e.Ta.size>0}function ma(e){return 0===xt(e).Ia.size}function ya(e){e.Ra=void 0}async function va(e){e.Aa.set("Online")}async function wa(e){e.Ta.forEach((t,n)=>{da(e,t)})}async function ba(e,t){ya(e),ga(e)?(e.Aa.la(t),pa(e)):e.Aa.set("Unknown")}async function _a(e,t,n){if(e.Aa.set("Online"),t instanceof ps&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const i of t.targetIds)e.Ta.has(i)&&(await e.remoteSyncer.rejectListen(i,n),e.Ta.delete(i),e.Ra.removeTarget(i))}(e,t)}catch(n){Et(oa,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await Sa(e,n)}else if(t instanceof ds?e.Ra.Ye(t):t instanceof fs?e.Ra.it(t):e.Ra.et(t),!n.isEqual(pn.min()))try{const t=await Oo(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.Ra.Pt(t);return n.targetChanges.forEach((n,i)=>{if(n.resumeToken.approximateByteSize()>0){const r=e.Ta.get(i);r&&e.Ta.set(i,r.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{const i=e.Ta.get(t);if(!i)return;e.Ta.set(t,i.withResumeToken(Fn.EMPTY_BYTE_STRING,i.snapshotVersion)),fa(e,t);const r=new Qs(i.target,t,n,i.sequenceNumber);da(e,r)}),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){Et(oa,"Failed to raise snapshot:",t),await Sa(e,t)}}async function Sa(e,t,n){if(!_n(t))throw t;e.Ia.add(1),await la(e),e.Aa.set("Offline"),n||(n=()=>Oo(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{Et(oa,"Retrying IndexedDB access"),await n(),e.Ia.delete(1),await ca(e)})}function Ea(e,t){return t().catch(n=>Sa(e,n,t))}async function Ta(e){const t=xt(e),n=Da(t);let i=t.Pa.length>0?t.Pa[t.Pa.length-1].batchId:-1;for(;Ia(t);)try{const e=await Po(t.localStore,i);if(null===e){0===t.Pa.length&&n.B_();break}i=e.batchId,Ca(t,e)}catch(e){await Sa(t,e)}ka(t)&&Aa(t)}function Ia(e){return ma(e)&&e.Pa.length<10}function Ca(e,t){e.Pa.push(t);const n=Da(e);n.x_()&&n.Z_&&n.X_(t.mutations)}function ka(e){return ma(e)&&!Da(e).M_()&&e.Pa.length>0}function Aa(e){Da(e).start()}async function Ra(e){Da(e).na()}async function xa(e){const t=Da(e);for(const n of e.Pa)t.X_(n.mutations)}async function Na(e,t,n){const i=e.Pa.shift(),r=Zr.from(i,t,n);await Ea(e,()=>e.remoteSyncer.applySuccessfulWrite(r)),await Ta(e)}async function Oa(e,t){t&&Da(e).Z_&&await async function(e,t){if(function(e){return function(e){switch(e){case Nt.OK:return kt(64938);case Nt.CANCELLED:case Nt.UNKNOWN:case Nt.DEADLINE_EXCEEDED:case Nt.RESOURCE_EXHAUSTED:case Nt.INTERNAL:case Nt.UNAVAILABLE:case Nt.UNAUTHENTICATED:return!1;case Nt.INVALID_ARGUMENT:case Nt.NOT_FOUND:case Nt.ALREADY_EXISTS:case Nt.PERMISSION_DENIED:case Nt.FAILED_PRECONDITION:case Nt.ABORTED:case Nt.OUT_OF_RANGE:case Nt.UNIMPLEMENTED:case Nt.DATA_LOSS:return!0;default:return kt(15467,{code:e})}}(e)&&e!==Nt.ABORTED}(t.code)){const n=e.Pa.shift();Da(e).N_(),await Ea(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await Ta(e)}}(e,t),ka(e)&&Aa(e)}async function La(e,t){const n=xt(e);n.asyncQueue.verifyOperationInProgress(),Et(oa,"RemoteStore received new credentials");const i=ma(n);n.Ia.add(3),await la(n),i&&n.Aa.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.Ia.delete(3),await ca(n)}function Pa(e){return e.Va||(e.Va=function(e,t,n){const i=xt(e);return i.ia(),new ta(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)
1705
+ */const oa="RemoteStore";class aa{constructor(e,t,n,i,r){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=r,this.Ea.xo(e=>{n.enqueueAndForget(async()=>{ma(this)&&(Et(oa,"Restarting streams for network reachability change."),await async function(e){const t=xt(e);t.Ia.add(4),await la(t),t.Aa.set("Unknown"),t.Ia.delete(4),await ca(t)}(this))})}),this.Aa=new sa(n,i)}}async function ca(e){if(ma(e))for(const t of e.da)await t(!0)}async function la(e){for(const t of e.da)await t(!1)}function ua(e,t){const n=xt(e);n.Ta.has(t.targetId)||(n.Ta.set(t.targetId,t),ga(n)?pa(n):Pa(n).x_()&&da(n,t))}function ha(e,t){const n=xt(e),i=Pa(n);n.Ta.delete(t),i.x_()&&fa(n,t),0===n.Ta.size&&(i.x_()?i.B_():ma(n)&&n.Aa.set("Unknown"))}function da(e,t){if(e.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(pn.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Pa(e).H_(t)}function fa(e,t){e.Ra.$e(t),Pa(e).Y_(t)}function pa(e){e.Ra=new ms({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),Et:t=>e.Ta.get(t)||null,lt:()=>e.datastore.serializer.databaseId}),Pa(e).start(),e.Aa.aa()}function ga(e){return ma(e)&&!Pa(e).M_()&&e.Ta.size>0}function ma(e){return 0===xt(e).Ia.size}function ya(e){e.Ra=void 0}async function va(e){e.Aa.set("Online")}async function wa(e){e.Ta.forEach((t,n)=>{da(e,t)})}async function ba(e,t){ya(e),ga(e)?(e.Aa.la(t),pa(e)):e.Aa.set("Unknown")}async function _a(e,t,n){if(e.Aa.set("Online"),t instanceof ps&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const i of t.targetIds)e.Ta.has(i)&&(await e.remoteSyncer.rejectListen(i,n),e.Ta.delete(i),e.Ra.removeTarget(i))}(e,t)}catch(n){Et(oa,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await Sa(e,n)}else if(t instanceof ds?e.Ra.Ye(t):t instanceof fs?e.Ra.it(t):e.Ra.et(t),!n.isEqual(pn.min()))try{const t=await Oo(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.Ra.Pt(t);return n.targetChanges.forEach((n,i)=>{if(n.resumeToken.approximateByteSize()>0){const r=e.Ta.get(i);r&&e.Ta.set(i,r.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{const i=e.Ta.get(t);if(!i)return;e.Ta.set(t,i.withResumeToken(zn.EMPTY_BYTE_STRING,i.snapshotVersion)),fa(e,t);const r=new Qs(i.target,t,n,i.sequenceNumber);da(e,r)}),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){Et(oa,"Failed to raise snapshot:",t),await Sa(e,t)}}async function Sa(e,t,n){if(!_n(t))throw t;e.Ia.add(1),await la(e),e.Aa.set("Offline"),n||(n=()=>Oo(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{Et(oa,"Retrying IndexedDB access"),await n(),e.Ia.delete(1),await ca(e)})}function Ea(e,t){return t().catch(n=>Sa(e,n,t))}async function Ta(e){const t=xt(e),n=Da(t);let i=t.Pa.length>0?t.Pa[t.Pa.length-1].batchId:-1;for(;Ia(t);)try{const e=await Po(t.localStore,i);if(null===e){0===t.Pa.length&&n.B_();break}i=e.batchId,Ca(t,e)}catch(e){await Sa(t,e)}ka(t)&&Aa(t)}function Ia(e){return ma(e)&&e.Pa.length<10}function Ca(e,t){e.Pa.push(t);const n=Da(e);n.x_()&&n.Z_&&n.X_(t.mutations)}function ka(e){return ma(e)&&!Da(e).M_()&&e.Pa.length>0}function Aa(e){Da(e).start()}async function Ra(e){Da(e).na()}async function xa(e){const t=Da(e);for(const n of e.Pa)t.X_(n.mutations)}async function Na(e,t,n){const i=e.Pa.shift(),r=Zr.from(i,t,n);await Ea(e,()=>e.remoteSyncer.applySuccessfulWrite(r)),await Ta(e)}async function Oa(e,t){t&&Da(e).Z_&&await async function(e,t){if(function(e){return function(e){switch(e){case Nt.OK:return kt(64938);case Nt.CANCELLED:case Nt.UNKNOWN:case Nt.DEADLINE_EXCEEDED:case Nt.RESOURCE_EXHAUSTED:case Nt.INTERNAL:case Nt.UNAVAILABLE:case Nt.UNAUTHENTICATED:return!1;case Nt.INVALID_ARGUMENT:case Nt.NOT_FOUND:case Nt.ALREADY_EXISTS:case Nt.PERMISSION_DENIED:case Nt.FAILED_PRECONDITION:case Nt.ABORTED:case Nt.OUT_OF_RANGE:case Nt.UNIMPLEMENTED:case Nt.DATA_LOSS:return!0;default:return kt(15467,{code:e})}}(e)&&e!==Nt.ABORTED}(t.code)){const n=e.Pa.shift();Da(e).N_(),await Ea(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await Ta(e)}}(e,t),ka(e)&&Aa(e)}async function La(e,t){const n=xt(e);n.asyncQueue.verifyOperationInProgress(),Et(oa,"RemoteStore received new credentials");const i=ma(n);n.Ia.add(3),await la(n),i&&n.Aa.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.Ia.delete(3),await ca(n)}function Pa(e){return e.Va||(e.Va=function(e,t,n){const i=xt(e);return i.ia(),new ta(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)
1706
1706
  /**
1707
1707
  * @license
1708
1708
  * Copyright 2018 Google LLC
@@ -1734,7 +1734,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1734
1734
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1735
1735
  * See the License for the specific language governing permissions and
1736
1736
  * limitations under the License.
1737
- */}class Ma{constructor(e,t,n,i,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new Lt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,i,r){const s=Date.now()+n,o=new Ma(e,t,s,i,r);return o.start(n),o}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Ot(Nt.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Fa(e,t){if(Tt("AsyncQueue",`${t}: ${e}`),_n(e))return new Ot(Nt.UNAVAILABLE,`${t}: ${e}`);throw e}
1737
+ */}class Ma{constructor(e,t,n,i,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new Lt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,i,r){const s=Date.now()+n,o=new Ma(e,t,s,i,r);return o.start(n),o}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Ot(Nt.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function za(e,t){if(Tt("AsyncQueue",`${t}: ${e}`),_n(e))return new Ot(Nt.UNAVAILABLE,`${t}: ${e}`);throw e}
1738
1738
  /**
1739
1739
  * @license
1740
1740
  * Copyright 2017 Google LLC
@@ -1750,7 +1750,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1750
1750
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1751
1751
  * See the License for the specific language governing permissions and
1752
1752
  * limitations under the License.
1753
- */class za{static emptySet(e){return new za(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||tn.comparator(t.key,n.key):(e,t)=>tn.comparator(e.key,t.key),this.keyedMap=dr(),this.sortedSet=new xn(this.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof za))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,i=n.getNext().key;if(!e.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new za;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}
1753
+ */class Fa{static emptySet(e){return new Fa(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||tn.comparator(t.key,n.key):(e,t)=>tn.comparator(e.key,t.key),this.keyedMap=dr(),this.sortedSet=new xn(this.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof Fa))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,i=n.getNext().key;if(!e.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new Fa;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}
1754
1754
  /**
1755
1755
  * @license
1756
1756
  * Copyright 2017 Google LLC
@@ -1766,7 +1766,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1766
1766
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1767
1767
  * See the License for the specific language governing permissions and
1768
1768
  * limitations under the License.
1769
- */class Ua{constructor(){this.fa=new xn(tn.comparator)}track(e){const t=e.doc.key,n=this.fa.get(t);n?0!==e.type&&3===n.type?this.fa=this.fa.insert(t,e):3===e.type&&1!==n.type?this.fa=this.fa.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.fa=this.fa.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.fa=this.fa.remove(t):1===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):kt(63341,{At:e,ga:n}):this.fa=this.fa.insert(t,e)}pa(){const e=[];return this.fa.inorderTraversal((t,n)=>{e.push(n)}),e}}class Va{constructor(e,t,n,i,r,s,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=r,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,i,r){const s=[];return t.forEach(e=>{s.push({type:0,doc:e})}),new Va(e,t,za.emptySet(t),s,n,i,!0,!1,r)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&nr(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}
1769
+ */class Ua{constructor(){this.fa=new xn(tn.comparator)}track(e){const t=e.doc.key,n=this.fa.get(t);n?0!==e.type&&3===n.type?this.fa=this.fa.insert(t,e):3===e.type&&1!==n.type?this.fa=this.fa.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.fa=this.fa.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.fa=this.fa.remove(t):1===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):kt(63341,{At:e,ga:n}):this.fa=this.fa.insert(t,e)}pa(){const e=[];return this.fa.inorderTraversal((t,n)=>{e.push(n)}),e}}class Va{constructor(e,t,n,i,r,s,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=r,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,i,r){const s=[];return t.forEach(e=>{s.push({type:0,doc:e})}),new Va(e,t,Fa.emptySet(t),s,n,i,!0,!1,r)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&nr(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}
1770
1770
  /**
1771
1771
  * @license
1772
1772
  * Copyright 2017 Google LLC
@@ -1782,7 +1782,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1782
1782
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1783
1783
  * See the License for the specific language governing permissions and
1784
1784
  * limitations under the License.
1785
- */class Ba{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}}class ja{constructor(){this.queries=Ha(),this.onlineState="Unknown",this.Da=new Set}terminate(){!function(e,t){const n=xt(e),i=n.queries;n.queries=Ha(),i.forEach((e,n)=>{for(const e of n.wa)e.onError(t)})}(this,new Ot(Nt.ABORTED,"Firestore shutting down"))}}function Ha(){return new cr(e=>ir(e),nr)}async function $a(e,t){const n=xt(e);let i=3;const r=t.query;let s=n.queries.get(r);s?!s.Sa()&&t.ba()&&(i=2):(s=new Ba,i=t.ba()?0:1);try{switch(i){case 0:s.ya=await n.onListen(r,!0);break;case 1:s.ya=await n.onListen(r,!1);break;case 2:await n.onFirstRemoteStoreListen(r)}}catch(e){const n=Fa(e,`Initialization of query '${rr(t.query)}' failed`);return void t.onError(n)}n.queries.set(r,s),s.wa.push(t),t.va(n.onlineState),s.ya&&t.Ca(s.ya)&&Wa(n)}async function qa(e,t){const n=xt(e),i=t.query;let r=3;const s=n.queries.get(i);if(s){const e=s.wa.indexOf(t);e>=0&&(s.wa.splice(e,1),0===s.wa.length?r=t.ba()?0:1:!s.Sa()&&t.ba()&&(r=2))}switch(r){case 0:return n.queries.delete(i),n.onUnlisten(i,!0);case 1:return n.queries.delete(i),n.onUnlisten(i,!1);case 2:return n.onLastRemoteStoreUnlisten(i);default:return}}function Ga(e,t){const n=xt(e);let i=!1;for(const e of t){const t=e.query,r=n.queries.get(t);if(r){for(const t of r.wa)t.Ca(e)&&(i=!0);r.ya=e}}i&&Wa(n)}function Ka(e,t,n){const i=xt(e),r=i.queries.get(t);if(r)for(const e of r.wa)e.onError(n);i.queries.delete(t)}function Wa(e){e.Da.forEach(e=>{e.next()})}var Qa,Ja;(Ja=Qa||(Qa={})).Fa="default",Ja.Cache="cache";class Ya{constructor(e,t,n){this.query=e,this.Ma=t,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=n||{}}Ca(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new Va(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),t=!0):this.Ba(e,this.onlineState)&&(this.La(e),t=!0),this.Oa=e,t}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let t=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),t=!0),t}Ba(e,t){if(!e.fromCache)return!0;if(!this.ba())return!0;const n="Offline"!==t;return(!this.options.ka||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Na(e){if(e.docChanges.length>0)return!0;const t=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}La(e){e=Va.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==Qa.Cache}}
1785
+ */class Ba{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}}class ja{constructor(){this.queries=Ha(),this.onlineState="Unknown",this.Da=new Set}terminate(){!function(e,t){const n=xt(e),i=n.queries;n.queries=Ha(),i.forEach((e,n)=>{for(const e of n.wa)e.onError(t)})}(this,new Ot(Nt.ABORTED,"Firestore shutting down"))}}function Ha(){return new cr(e=>ir(e),nr)}async function $a(e,t){const n=xt(e);let i=3;const r=t.query;let s=n.queries.get(r);s?!s.Sa()&&t.ba()&&(i=2):(s=new Ba,i=t.ba()?0:1);try{switch(i){case 0:s.ya=await n.onListen(r,!0);break;case 1:s.ya=await n.onListen(r,!1);break;case 2:await n.onFirstRemoteStoreListen(r)}}catch(e){const n=za(e,`Initialization of query '${rr(t.query)}' failed`);return void t.onError(n)}n.queries.set(r,s),s.wa.push(t),t.va(n.onlineState),s.ya&&t.Ca(s.ya)&&Wa(n)}async function qa(e,t){const n=xt(e),i=t.query;let r=3;const s=n.queries.get(i);if(s){const e=s.wa.indexOf(t);e>=0&&(s.wa.splice(e,1),0===s.wa.length?r=t.ba()?0:1:!s.Sa()&&t.ba()&&(r=2))}switch(r){case 0:return n.queries.delete(i),n.onUnlisten(i,!0);case 1:return n.queries.delete(i),n.onUnlisten(i,!1);case 2:return n.onLastRemoteStoreUnlisten(i);default:return}}function Ga(e,t){const n=xt(e);let i=!1;for(const e of t){const t=e.query,r=n.queries.get(t);if(r){for(const t of r.wa)t.Ca(e)&&(i=!0);r.ya=e}}i&&Wa(n)}function Ka(e,t,n){const i=xt(e),r=i.queries.get(t);if(r)for(const e of r.wa)e.onError(n);i.queries.delete(t)}function Wa(e){e.Da.forEach(e=>{e.next()})}var Qa,Ja;(Ja=Qa||(Qa={})).Fa="default",Ja.Cache="cache";class Ya{constructor(e,t,n){this.query=e,this.Ma=t,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=n||{}}Ca(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new Va(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),t=!0):this.Ba(e,this.onlineState)&&(this.La(e),t=!0),this.Oa=e,t}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let t=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),t=!0),t}Ba(e,t){if(!e.fromCache)return!0;if(!this.ba())return!0;const n="Offline"!==t;return(!this.options.ka||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Na(e){if(e.docChanges.length>0)return!0;const t=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}La(e){e=Va.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==Qa.Cache}}
1786
1786
  /**
1787
1787
  * @license
1788
1788
  * Copyright 2017 Google LLC
@@ -1798,7 +1798,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1798
1798
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1799
1799
  * See the License for the specific language governing permissions and
1800
1800
  * limitations under the License.
1801
- */class Xa{constructor(e){this.key=e}}class Za{constructor(e){this.key=e}}class ec{constructor(e,t){this.query=e,this.Ha=t,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=wr(),this.mutatedKeys=wr(),this.Xa=or(e),this.eu=new za(this.Xa)}get tu(){return this.Ha}nu(e,t){const n=t?t.ru:new Ua,i=t?t.eu:this.eu;let r=t?t.mutatedKeys:this.mutatedKeys,s=i,o=!1;const a="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((e,t)=>{const l=i.get(e),u=sr(this.query,t)?t:null,h=!!l&&this.mutatedKeys.has(l.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let f=!1;l&&u?l.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),f=!0):this.iu(l,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.Xa(u,a)>0||c&&this.Xa(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),f=!0):l&&!u&&(n.track({type:1,doc:l}),f=!0,(a||c)&&(o=!0)),f&&(u?(s=s.add(u),r=d?r.add(e):r.delete(e)):(s=s.delete(e),r=r.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){const e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),r=r.delete(e.key),n.track({type:1,doc:e})}return{eu:s,ru:n,Ds:o,mutatedKeys:r}}iu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,i){const r=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;const s=e.ru.pa();s.sort((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return kt(20277,{At:e})}};return n(e)-n(t)}
1801
+ */class Xa{constructor(e){this.key=e}}class Za{constructor(e){this.key=e}}class ec{constructor(e,t){this.query=e,this.Ha=t,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=wr(),this.mutatedKeys=wr(),this.Xa=or(e),this.eu=new Fa(this.Xa)}get tu(){return this.Ha}nu(e,t){const n=t?t.ru:new Ua,i=t?t.eu:this.eu;let r=t?t.mutatedKeys:this.mutatedKeys,s=i,o=!1;const a="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((e,t)=>{const l=i.get(e),u=sr(this.query,t)?t:null,h=!!l&&this.mutatedKeys.has(l.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let f=!1;l&&u?l.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),f=!0):this.iu(l,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.Xa(u,a)>0||c&&this.Xa(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),f=!0):l&&!u&&(n.track({type:1,doc:l}),f=!0,(a||c)&&(o=!0)),f&&(u?(s=s.add(u),r=d?r.add(e):r.delete(e)):(s=s.delete(e),r=r.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){const e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),r=r.delete(e.key),n.track({type:1,doc:e})}return{eu:s,ru:n,Ds:o,mutatedKeys:r}}iu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,i){const r=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;const s=e.ru.pa();s.sort((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return kt(20277,{At:e})}};return n(e)-n(t)}
1802
1802
  /**
1803
1803
  * @license
1804
1804
  * Copyright 2020 Google LLC
@@ -1814,7 +1814,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
1814
1814
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1815
1815
  * See the License for the specific language governing permissions and
1816
1816
  * limitations under the License.
1817
- */(e.type,t.type)||this.Xa(e.doc,t.doc)),this.su(n),i=null!=i&&i;const o=t&&!i?this.ou():[],a=0===this.Za.size&&this.current&&!i?1:0,c=a!==this.Ya;return this.Ya=a,0!==s.length||c?{snapshot:new Va(this.query,e.eu,r,s,e.mutatedKeys,0===a,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:o}:{_u:o}}va(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({eu:this.eu,ru:new Ua,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(e=>this.Ha=this.Ha.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ha=this.Ha.delete(e)),this.current=e.current)}ou(){if(!this.current)return[];const e=this.Za;this.Za=wr(),this.eu.forEach(e=>{this.au(e.key)&&(this.Za=this.Za.add(e.key))});const t=[];return e.forEach(e=>{this.Za.has(e)||t.push(new Za(e))}),this.Za.forEach(n=>{e.has(n)||t.push(new Xa(n))}),t}uu(e){this.Ha=e.qs,this.Za=wr();const t=this.nu(e.documents);return this.applyChanges(t,!0)}cu(){return Va.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,0===this.Ya,this.hasCachedResults)}}const tc="SyncEngine";class nc{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class ic{constructor(e){this.key=e,this.lu=!1}}class rc{constructor(e,t,n,i,r,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new cr(e=>ir(e),nr),this.Tu=new Map,this.Iu=new Set,this.du=new xn(tn.comparator),this.Eu=new Map,this.Au=new mo,this.Ru={},this.Vu=new Map,this.mu=io.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return!0===this.fu}}async function sc(e,t,n=!0){const i=Cc(e);let r;const s=i.Pu.get(t);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),r=s.view.cu()):r=await ac(i,t,n,!0),r}async function oc(e,t){const n=Cc(e);await ac(n,t,!0,!1)}async function ac(e,t,n,i){const r=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Allocate target","readwrite",e=>{let i;return n.hi.getTargetData(e,t).next(r=>r?(i=r,bn.resolve(i)):n.hi.allocateTargetId(e).next(r=>(i=new Qs(t,r,"TargetPurposeListen",e.currentSequenceNumber),n.hi.addTargetData(e,i).next(()=>i))))}).then(e=>{const i=n.Fs.get(e.targetId);return(null===i||e.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.Fs=n.Fs.insert(e.targetId,e),n.Ms.set(t,e.targetId)),e})}(e.localStore,Zi(t)),s=r.targetId,o=e.sharedClientState.addLocalQueryTarget(s,n);let a;return i&&(a=await async function(e,t,n,i,r){e.gu=(t,n,i)=>async function(e,t,n,i){let r=t.view.nu(n);r.Ds&&(r=await Mo(e.localStore,t.query,!1).then(({documents:e})=>t.view.nu(e,r)));const s=i&&i.targetChanges.get(t.targetId),o=i&&null!=i.targetMismatches.get(t.targetId),a=t.view.applyChanges(r,e.isPrimaryClient,s,o);return bc(e,t.targetId,a._u),a.snapshot}(e,t,n,i);const s=await Mo(e.localStore,t,!0),o=new ec(t,s.qs),a=o.nu(s.documents),c=hs.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==e.onlineState,r),l=o.applyChanges(a,e.isPrimaryClient,c);bc(e,n,l._u);const u=new nc(t,n,o);return e.Pu.set(t,u),e.Tu.has(n)?e.Tu.get(n).push(t):e.Tu.set(n,[t]),l.snapshot}(e,t,s,"current"===o,r.resumeToken)),e.isPrimaryClient&&n&&ua(e.remoteStore,r),a}async function cc(e,t,n){const i=xt(e),r=i.Pu.get(t),s=i.Tu.get(r.targetId);if(s.length>1)return i.Tu.set(r.targetId,s.filter(e=>!nr(e,t))),void i.Pu.delete(t);i.isPrimaryClient?(i.sharedClientState.removeLocalQueryTarget(r.targetId),i.sharedClientState.isActiveQueryTarget(r.targetId)||await Do(i.localStore,r.targetId,!1).then(()=>{i.sharedClientState.clearQueryState(r.targetId),n&&ha(i.remoteStore,r.targetId),vc(i,r.targetId)}).catch(wn)):(vc(i,r.targetId),await Do(i.localStore,r.targetId,!0))}async function lc(e,t){const n=xt(e),i=n.Pu.get(t),r=n.Tu.get(i.targetId);n.isPrimaryClient&&1===r.length&&(n.sharedClientState.removeLocalQueryTarget(i.targetId),ha(n.remoteStore,i.targetId))}async function uc(e,t,n){const i=function(e){const t=xt(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=pc.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=gc.bind(null,t),t}(e);try{const e=await function(e,t){const n=xt(e),i=fn.now(),r=t.reduce((e,t)=>e.add(t.key),wr());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let a=ur(),c=wr();return n.Os.getEntries(e,r).next(e=>{a=e,a.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,a)).next(r=>{s=r;const o=[];for(const e of t){const t=Hr(e,s.get(e.key).overlayedDocument);null!=t&&o.push(new Gr(e.key,t,bi(t.value.mapValue),Fr.exists(!0)))}return n.mutationQueue.addMutationBatch(e,i,o,t)}).next(t=>{o=t;const i=t.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,i)})}).then(()=>({batchId:o.batchId,changes:fr(s)}))}(i.localStore,t);i.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let i=e.Ru[e.currentUser.toKey()];i||(i=new xn(qt)),i=i.insert(t,n),e.Ru[e.currentUser.toKey()]=i}(i,e.batchId,n),await Ec(i,e.changes),await Ta(i.remoteStore)}catch(e){const t=Fa(e,"Failed to persist write");n.reject(t)}}async function hc(e,t){const n=xt(e);try{const e=await Lo(n.localStore,t);t.targetChanges.forEach((e,t)=>{const i=n.Eu.get(t);i&&(Rt(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?i.lu=!0:e.modifiedDocuments.size>0?Rt(i.lu,14607):e.removedDocuments.size>0&&(Rt(i.lu,42227),i.lu=!1))}),await Ec(n,e,t)}catch(e){await wn(e)}}function dc(e,t,n){const i=xt(e);if(i.isPrimaryClient&&0===n||!i.isPrimaryClient&&1===n){const e=[];i.Pu.forEach((n,i)=>{const r=i.view.va(t);r.snapshot&&e.push(r.snapshot)}),function(e,t){const n=xt(e);n.onlineState=t;let i=!1;n.queries.forEach((e,n)=>{for(const e of n.wa)e.va(t)&&(i=!0)}),i&&Wa(n)}(i.eventManager,t),e.length&&i.hu.J_(e),i.onlineState=t,i.isPrimaryClient&&i.sharedClientState.setOnlineState(t)}}async function fc(e,t,n){const i=xt(e);i.sharedClientState.updateQueryState(t,"rejected",n);const r=i.Eu.get(t),s=r&&r.key;if(s){let e=new xn(tn.comparator);e=e.insert(s,_i.newNoDocument(s,pn.min()));const n=wr().add(s),r=new us(pn.min(),new Map,new xn(qt),e,n);await hc(i,r),i.du=i.du.remove(s),i.Eu.delete(t),Sc(i)}else await Do(i.localStore,t,!1).then(()=>vc(i,t,n)).catch(wn)}async function pc(e,t){const n=xt(e),i=t.batch.batchId;try{const e=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const i=t.batch.keys(),r=n.Os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,i){const r=n.batch,s=r.keys();let o=bn.resolve();return s.forEach(e=>{o=o.next(()=>i.getEntry(t,e)).next(t=>{const s=n.docVersions.get(e);Rt(null!==s,48541),t.version.compareTo(s)<0&&(r.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),i.addEntry(t)))})}),o.next(()=>e.mutationQueue.removeMutationBatch(t,r))}(n,e,t,r).next(()=>r.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=wr();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,i))})}(n.localStore,t);yc(n,i,null),mc(n,i),n.sharedClientState.updateMutationState(i,"acknowledged"),await Ec(n,e)}catch(e){await wn(e)}}async function gc(e,t,n){const i=xt(e);try{const e=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let i;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(Rt(null!==t,37113),i=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,i)).next(()=>n.localDocuments.getDocuments(e,i))})}(i.localStore,t);yc(i,t,n),mc(i,t),i.sharedClientState.updateMutationState(t,"rejected",n),await Ec(i,e)}catch(n){await wn(n)}}function mc(e,t){(e.Vu.get(t)||[]).forEach(e=>{e.resolve()}),e.Vu.delete(t)}function yc(e,t,n){const i=xt(e);let r=i.Ru[i.currentUser.toKey()];if(r){const e=r.get(t);e&&(n?e.reject(n):e.resolve(),r=r.remove(t)),i.Ru[i.currentUser.toKey()]=r}}function vc(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const i of e.Tu.get(t))e.Pu.delete(i),n&&e.hu.pu(i,n);e.Tu.delete(t),e.isPrimaryClient&&e.Au.zr(t).forEach(t=>{e.Au.containsKey(t)||wc(e,t)})}function wc(e,t){e.Iu.delete(t.path.canonicalString());const n=e.du.get(t);null!==n&&(ha(e.remoteStore,n),e.du=e.du.remove(t),e.Eu.delete(n),Sc(e))}function bc(e,t,n){for(const i of n)i instanceof Xa?(e.Au.addReference(i.key,t),_c(e,i)):i instanceof Za?(Et(tc,"Document no longer in limbo: "+i.key),e.Au.removeReference(i.key,t),e.Au.containsKey(i.key)||wc(e,i.key)):kt(19791,{yu:i})}function _c(e,t){const n=t.key,i=n.path.canonicalString();e.du.get(n)||e.Iu.has(i)||(Et(tc,"New document in limbo: "+n),e.Iu.add(i),Sc(e))}function Sc(e){for(;e.Iu.size>0&&e.du.size<e.maxConcurrentLimboResolutions;){const t=e.Iu.values().next().value;e.Iu.delete(t);const n=new tn(Xt.fromString(t)),i=e.mu.next();e.Eu.set(i,new ic(n)),e.du=e.du.insert(n,i),ua(e.remoteStore,new Qs(Zi(Qi(n.path)),i,"TargetPurposeLimboResolution",Sn.ue))}}async function Ec(e,t,n){const i=xt(e),r=[],s=[],o=[];i.Pu.isEmpty()||(i.Pu.forEach((e,a)=>{o.push(i.gu(a,t,n).then(e=>{var t;if((e||n)&&i.isPrimaryClient){const r=e?!e.fromCache:null===(t=null==n?void 0:n.targetChanges.get(a.targetId))||void 0===t?void 0:t.current;i.sharedClientState.updateQueryState(a.targetId,r?"current":"not-current")}if(e){r.push(e);const t=Co.Es(a.targetId,e);s.push(t)}}))}),await Promise.all(o),i.hu.J_(r),await async function(e,t){const n=xt(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>bn.forEach(t,t=>bn.forEach(t.Is,i=>n.persistence.referenceDelegate.addReference(e,t.targetId,i)).next(()=>bn.forEach(t.ds,i=>n.persistence.referenceDelegate.removeReference(e,t.targetId,i)))))}catch(e){if(!_n(e))throw e;Et(Ro,"Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Fs.get(t),i=e.snapshotVersion,r=e.withLastLimboFreeSnapshotVersion(i);n.Fs=n.Fs.insert(t,r)}}}(i.localStore,s))}async function Tc(e,t){const n=xt(e);if(!n.currentUser.isEqual(t)){Et(tc,"User change. New user:",t.toKey());const e=await No(n.localStore,t);n.currentUser=t,function(e,t){e.Vu.forEach(e=>{e.forEach(e=>{e.reject(new Ot(Nt.CANCELLED,t))})}),e.Vu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Ec(n,e.Bs)}}function Ic(e,t){const n=xt(e),i=n.Eu.get(t);if(i&&i.lu)return wr().add(i.key);{let e=wr();const i=n.Tu.get(t);if(!i)return e;for(const t of i){const i=n.Pu.get(t);e=e.unionWith(i.view.tu)}return e}}function Cc(e){const t=xt(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=hc.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ic.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=fc.bind(null,t),t.hu.J_=Ga.bind(null,t.eventManager),t.hu.pu=Ka.bind(null,t.eventManager),t}class kc{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Yo(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Du(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Cu(e,this.localStore),this.indexBackfillerScheduler=this.Fu(e,this.localStore)}Cu(e,t){return null}Fu(e,t){return null}vu(e){return function(e,t,n,i){return new xo(e,t,n,i)}(this.persistence,new Ao,e.initialUser,this.serializer)}Du(e){return new So(To.Vi,this.serializer)}bu(e){return new zo}async terminate(){var e,t;null===(e=this.gcScheduler)||void 0===e||e.stop(),null===(t=this.indexBackfillerScheduler)||void 0===t||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}kc.provider={build:()=>new kc};class Ac extends kc{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,t){Rt(this.persistence.referenceDelegate instanceof Io,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new ao(n,e.asyncQueue,t)}Du(e){const t=void 0!==this.cacheSizeBytes?no.withCacheSize(this.cacheSizeBytes):no.DEFAULT;return new So(e=>Io.Vi(e,t),this.serializer)}}class Rc{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>dc(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Tc.bind(null,this.syncEngine),await async function(e,t){const n=xt(e);t?(n.Ia.delete(2),await ca(n)):t||(n.Ia.add(2),await la(n),n.Aa.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new ja}createDatastore(e){const t=Yo(e.databaseInfo.databaseId),n=function(e){return new Qo(e)}(e.databaseInfo);return function(e,t,n,i){return new ra(e,t,n,i)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,i,r){return new aa(e,t,n,i,r)}(this.localStore,this.datastore,e.asyncQueue,e=>dc(this.syncEngine,e,0),Bo.C()?new Bo:new Uo)}createSyncEngine(e,t){return function(e,t,n,i,r,s,o){const a=new rc(e,t,n,i,r,s);return o&&(a.fu=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(e){const t=xt(e);Et(oa,"RemoteStore shutting down."),t.Ia.add(5),await la(t),t.Ea.shutdown(),t.Aa.set("Unknown")}(this.remoteStore),null===(e=this.datastore)||void 0===e||e.terminate(),null===(t=this.eventManager)||void 0===t||t.terminate()}}Rc.provider={build:()=>new Rc};
1817
+ */(e.type,t.type)||this.Xa(e.doc,t.doc)),this.su(n),i=null!=i&&i;const o=t&&!i?this.ou():[],a=0===this.Za.size&&this.current&&!i?1:0,c=a!==this.Ya;return this.Ya=a,0!==s.length||c?{snapshot:new Va(this.query,e.eu,r,s,e.mutatedKeys,0===a,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:o}:{_u:o}}va(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({eu:this.eu,ru:new Ua,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(e=>this.Ha=this.Ha.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ha=this.Ha.delete(e)),this.current=e.current)}ou(){if(!this.current)return[];const e=this.Za;this.Za=wr(),this.eu.forEach(e=>{this.au(e.key)&&(this.Za=this.Za.add(e.key))});const t=[];return e.forEach(e=>{this.Za.has(e)||t.push(new Za(e))}),this.Za.forEach(n=>{e.has(n)||t.push(new Xa(n))}),t}uu(e){this.Ha=e.qs,this.Za=wr();const t=this.nu(e.documents);return this.applyChanges(t,!0)}cu(){return Va.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,0===this.Ya,this.hasCachedResults)}}const tc="SyncEngine";class nc{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class ic{constructor(e){this.key=e,this.lu=!1}}class rc{constructor(e,t,n,i,r,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new cr(e=>ir(e),nr),this.Tu=new Map,this.Iu=new Set,this.du=new xn(tn.comparator),this.Eu=new Map,this.Au=new mo,this.Ru={},this.Vu=new Map,this.mu=io.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return!0===this.fu}}async function sc(e,t,n=!0){const i=Cc(e);let r;const s=i.Pu.get(t);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),r=s.view.cu()):r=await ac(i,t,n,!0),r}async function oc(e,t){const n=Cc(e);await ac(n,t,!0,!1)}async function ac(e,t,n,i){const r=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Allocate target","readwrite",e=>{let i;return n.hi.getTargetData(e,t).next(r=>r?(i=r,bn.resolve(i)):n.hi.allocateTargetId(e).next(r=>(i=new Qs(t,r,"TargetPurposeListen",e.currentSequenceNumber),n.hi.addTargetData(e,i).next(()=>i))))}).then(e=>{const i=n.Fs.get(e.targetId);return(null===i||e.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.Fs=n.Fs.insert(e.targetId,e),n.Ms.set(t,e.targetId)),e})}(e.localStore,Zi(t)),s=r.targetId,o=e.sharedClientState.addLocalQueryTarget(s,n);let a;return i&&(a=await async function(e,t,n,i,r){e.gu=(t,n,i)=>async function(e,t,n,i){let r=t.view.nu(n);r.Ds&&(r=await Mo(e.localStore,t.query,!1).then(({documents:e})=>t.view.nu(e,r)));const s=i&&i.targetChanges.get(t.targetId),o=i&&null!=i.targetMismatches.get(t.targetId),a=t.view.applyChanges(r,e.isPrimaryClient,s,o);return bc(e,t.targetId,a._u),a.snapshot}(e,t,n,i);const s=await Mo(e.localStore,t,!0),o=new ec(t,s.qs),a=o.nu(s.documents),c=hs.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==e.onlineState,r),l=o.applyChanges(a,e.isPrimaryClient,c);bc(e,n,l._u);const u=new nc(t,n,o);return e.Pu.set(t,u),e.Tu.has(n)?e.Tu.get(n).push(t):e.Tu.set(n,[t]),l.snapshot}(e,t,s,"current"===o,r.resumeToken)),e.isPrimaryClient&&n&&ua(e.remoteStore,r),a}async function cc(e,t,n){const i=xt(e),r=i.Pu.get(t),s=i.Tu.get(r.targetId);if(s.length>1)return i.Tu.set(r.targetId,s.filter(e=>!nr(e,t))),void i.Pu.delete(t);i.isPrimaryClient?(i.sharedClientState.removeLocalQueryTarget(r.targetId),i.sharedClientState.isActiveQueryTarget(r.targetId)||await Do(i.localStore,r.targetId,!1).then(()=>{i.sharedClientState.clearQueryState(r.targetId),n&&ha(i.remoteStore,r.targetId),vc(i,r.targetId)}).catch(wn)):(vc(i,r.targetId),await Do(i.localStore,r.targetId,!0))}async function lc(e,t){const n=xt(e),i=n.Pu.get(t),r=n.Tu.get(i.targetId);n.isPrimaryClient&&1===r.length&&(n.sharedClientState.removeLocalQueryTarget(i.targetId),ha(n.remoteStore,i.targetId))}async function uc(e,t,n){const i=function(e){const t=xt(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=pc.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=gc.bind(null,t),t}(e);try{const e=await function(e,t){const n=xt(e),i=fn.now(),r=t.reduce((e,t)=>e.add(t.key),wr());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let a=ur(),c=wr();return n.Os.getEntries(e,r).next(e=>{a=e,a.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,a)).next(r=>{s=r;const o=[];for(const e of t){const t=Hr(e,s.get(e.key).overlayedDocument);null!=t&&o.push(new Gr(e.key,t,bi(t.value.mapValue),zr.exists(!0)))}return n.mutationQueue.addMutationBatch(e,i,o,t)}).next(t=>{o=t;const i=t.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,i)})}).then(()=>({batchId:o.batchId,changes:fr(s)}))}(i.localStore,t);i.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let i=e.Ru[e.currentUser.toKey()];i||(i=new xn(qt)),i=i.insert(t,n),e.Ru[e.currentUser.toKey()]=i}(i,e.batchId,n),await Ec(i,e.changes),await Ta(i.remoteStore)}catch(e){const t=za(e,"Failed to persist write");n.reject(t)}}async function hc(e,t){const n=xt(e);try{const e=await Lo(n.localStore,t);t.targetChanges.forEach((e,t)=>{const i=n.Eu.get(t);i&&(Rt(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?i.lu=!0:e.modifiedDocuments.size>0?Rt(i.lu,14607):e.removedDocuments.size>0&&(Rt(i.lu,42227),i.lu=!1))}),await Ec(n,e,t)}catch(e){await wn(e)}}function dc(e,t,n){const i=xt(e);if(i.isPrimaryClient&&0===n||!i.isPrimaryClient&&1===n){const e=[];i.Pu.forEach((n,i)=>{const r=i.view.va(t);r.snapshot&&e.push(r.snapshot)}),function(e,t){const n=xt(e);n.onlineState=t;let i=!1;n.queries.forEach((e,n)=>{for(const e of n.wa)e.va(t)&&(i=!0)}),i&&Wa(n)}(i.eventManager,t),e.length&&i.hu.J_(e),i.onlineState=t,i.isPrimaryClient&&i.sharedClientState.setOnlineState(t)}}async function fc(e,t,n){const i=xt(e);i.sharedClientState.updateQueryState(t,"rejected",n);const r=i.Eu.get(t),s=r&&r.key;if(s){let e=new xn(tn.comparator);e=e.insert(s,_i.newNoDocument(s,pn.min()));const n=wr().add(s),r=new us(pn.min(),new Map,new xn(qt),e,n);await hc(i,r),i.du=i.du.remove(s),i.Eu.delete(t),Sc(i)}else await Do(i.localStore,t,!1).then(()=>vc(i,t,n)).catch(wn)}async function pc(e,t){const n=xt(e),i=t.batch.batchId;try{const e=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const i=t.batch.keys(),r=n.Os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,i){const r=n.batch,s=r.keys();let o=bn.resolve();return s.forEach(e=>{o=o.next(()=>i.getEntry(t,e)).next(t=>{const s=n.docVersions.get(e);Rt(null!==s,48541),t.version.compareTo(s)<0&&(r.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),i.addEntry(t)))})}),o.next(()=>e.mutationQueue.removeMutationBatch(t,r))}(n,e,t,r).next(()=>r.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=wr();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,i))})}(n.localStore,t);yc(n,i,null),mc(n,i),n.sharedClientState.updateMutationState(i,"acknowledged"),await Ec(n,e)}catch(e){await wn(e)}}async function gc(e,t,n){const i=xt(e);try{const e=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let i;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(Rt(null!==t,37113),i=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,i)).next(()=>n.localDocuments.getDocuments(e,i))})}(i.localStore,t);yc(i,t,n),mc(i,t),i.sharedClientState.updateMutationState(t,"rejected",n),await Ec(i,e)}catch(n){await wn(n)}}function mc(e,t){(e.Vu.get(t)||[]).forEach(e=>{e.resolve()}),e.Vu.delete(t)}function yc(e,t,n){const i=xt(e);let r=i.Ru[i.currentUser.toKey()];if(r){const e=r.get(t);e&&(n?e.reject(n):e.resolve(),r=r.remove(t)),i.Ru[i.currentUser.toKey()]=r}}function vc(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const i of e.Tu.get(t))e.Pu.delete(i),n&&e.hu.pu(i,n);e.Tu.delete(t),e.isPrimaryClient&&e.Au.zr(t).forEach(t=>{e.Au.containsKey(t)||wc(e,t)})}function wc(e,t){e.Iu.delete(t.path.canonicalString());const n=e.du.get(t);null!==n&&(ha(e.remoteStore,n),e.du=e.du.remove(t),e.Eu.delete(n),Sc(e))}function bc(e,t,n){for(const i of n)i instanceof Xa?(e.Au.addReference(i.key,t),_c(e,i)):i instanceof Za?(Et(tc,"Document no longer in limbo: "+i.key),e.Au.removeReference(i.key,t),e.Au.containsKey(i.key)||wc(e,i.key)):kt(19791,{yu:i})}function _c(e,t){const n=t.key,i=n.path.canonicalString();e.du.get(n)||e.Iu.has(i)||(Et(tc,"New document in limbo: "+n),e.Iu.add(i),Sc(e))}function Sc(e){for(;e.Iu.size>0&&e.du.size<e.maxConcurrentLimboResolutions;){const t=e.Iu.values().next().value;e.Iu.delete(t);const n=new tn(Xt.fromString(t)),i=e.mu.next();e.Eu.set(i,new ic(n)),e.du=e.du.insert(n,i),ua(e.remoteStore,new Qs(Zi(Qi(n.path)),i,"TargetPurposeLimboResolution",Sn.ue))}}async function Ec(e,t,n){const i=xt(e),r=[],s=[],o=[];i.Pu.isEmpty()||(i.Pu.forEach((e,a)=>{o.push(i.gu(a,t,n).then(e=>{var t;if((e||n)&&i.isPrimaryClient){const r=e?!e.fromCache:null===(t=null==n?void 0:n.targetChanges.get(a.targetId))||void 0===t?void 0:t.current;i.sharedClientState.updateQueryState(a.targetId,r?"current":"not-current")}if(e){r.push(e);const t=Co.Es(a.targetId,e);s.push(t)}}))}),await Promise.all(o),i.hu.J_(r),await async function(e,t){const n=xt(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>bn.forEach(t,t=>bn.forEach(t.Is,i=>n.persistence.referenceDelegate.addReference(e,t.targetId,i)).next(()=>bn.forEach(t.ds,i=>n.persistence.referenceDelegate.removeReference(e,t.targetId,i)))))}catch(e){if(!_n(e))throw e;Et(Ro,"Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Fs.get(t),i=e.snapshotVersion,r=e.withLastLimboFreeSnapshotVersion(i);n.Fs=n.Fs.insert(t,r)}}}(i.localStore,s))}async function Tc(e,t){const n=xt(e);if(!n.currentUser.isEqual(t)){Et(tc,"User change. New user:",t.toKey());const e=await No(n.localStore,t);n.currentUser=t,function(e,t){e.Vu.forEach(e=>{e.forEach(e=>{e.reject(new Ot(Nt.CANCELLED,t))})}),e.Vu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Ec(n,e.Bs)}}function Ic(e,t){const n=xt(e),i=n.Eu.get(t);if(i&&i.lu)return wr().add(i.key);{let e=wr();const i=n.Tu.get(t);if(!i)return e;for(const t of i){const i=n.Pu.get(t);e=e.unionWith(i.view.tu)}return e}}function Cc(e){const t=xt(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=hc.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ic.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=fc.bind(null,t),t.hu.J_=Ga.bind(null,t.eventManager),t.hu.pu=Ka.bind(null,t.eventManager),t}class kc{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Yo(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Du(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Cu(e,this.localStore),this.indexBackfillerScheduler=this.Fu(e,this.localStore)}Cu(e,t){return null}Fu(e,t){return null}vu(e){return function(e,t,n,i){return new xo(e,t,n,i)}(this.persistence,new Ao,e.initialUser,this.serializer)}Du(e){return new So(To.Vi,this.serializer)}bu(e){return new Fo}async terminate(){var e,t;null===(e=this.gcScheduler)||void 0===e||e.stop(),null===(t=this.indexBackfillerScheduler)||void 0===t||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}kc.provider={build:()=>new kc};class Ac extends kc{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,t){Rt(this.persistence.referenceDelegate instanceof Io,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new ao(n,e.asyncQueue,t)}Du(e){const t=void 0!==this.cacheSizeBytes?no.withCacheSize(this.cacheSizeBytes):no.DEFAULT;return new So(e=>Io.Vi(e,t),this.serializer)}}class Rc{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>dc(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Tc.bind(null,this.syncEngine),await async function(e,t){const n=xt(e);t?(n.Ia.delete(2),await ca(n)):t||(n.Ia.add(2),await la(n),n.Aa.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new ja}createDatastore(e){const t=Yo(e.databaseInfo.databaseId),n=function(e){return new Qo(e)}(e.databaseInfo);return function(e,t,n,i){return new ra(e,t,n,i)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,i,r){return new aa(e,t,n,i,r)}(this.localStore,this.datastore,e.asyncQueue,e=>dc(this.syncEngine,e,0),Bo.C()?new Bo:new Uo)}createSyncEngine(e,t){return function(e,t,n,i,r,s,o){const a=new rc(e,t,n,i,r,s);return o&&(a.fu=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(e){const t=xt(e);Et(oa,"RemoteStore shutting down."),t.Ia.add(5),await la(t),t.Ea.shutdown(),t.Aa.set("Unknown")}(this.remoteStore),null===(e=this.datastore)||void 0===e||e.terminate(),null===(t=this.eventManager)||void 0===t||t.terminate()}}Rc.provider={build:()=>new Rc};
1818
1818
  /**
1819
1819
  * @license
1820
1820
  * Copyright 2020 Google LLC
@@ -1863,7 +1863,7 @@ class xc{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.o
1863
1863
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1864
1864
  * See the License for the specific language governing permissions and
1865
1865
  * limitations under the License.
1866
- */const Nc="FirestoreClient";class Oc{constructor(e,t,n,i,r){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=wt.UNAUTHENTICATED,this.clientId=$t.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=r,this.authCredentials.start(n,async e=>{Et(Nc,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(Et(Nc,"Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Lt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const n=Fa(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function Lc(e,t){e.asyncQueue.verifyOperationInProgress(),Et(Nc,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let i=n.initialUser;e.setCredentialChangeListener(async e=>{i.isEqual(e)||(await No(t.localStore,e),i=e)}),t.persistence.setDatabaseDeletedListener(()=>{It("Terminating Firestore due to IndexedDb database deletion"),e.terminate().then(()=>{Et("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(e=>{It("Terminating Firestore due to IndexedDb database deletion failed",e)})}),e._offlineComponents=t}async function Pc(e,t){e.asyncQueue.verifyOperationInProgress();const n=await async function(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Et(Nc,"Using user provided OfflineComponentProvider");try{await Lc(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===Nt.FAILED_PRECONDITION||e.code===Nt.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;It("Error using user provided cache. Falling back to memory cache: "+n),await Lc(e,new kc)}}else Et(Nc,"Using default OfflineComponentProvider"),await Lc(e,new Ac(void 0));return e._offlineComponents}(e);Et(Nc,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>La(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>La(t.remoteStore,n)),e._onlineComponents=t}async function Dc(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Et(Nc,"Using user provided OnlineComponentProvider"),await Pc(e,e._uninitializedComponentsProvider._online)):(Et(Nc,"Using default OnlineComponentProvider"),await Pc(e,new Rc))),e._onlineComponents}async function Mc(e){const t=await Dc(e),n=t.eventManager;return n.onListen=sc.bind(null,t.syncEngine),n.onUnlisten=cc.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=oc.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=lc.bind(null,t.syncEngine),n}
1866
+ */const Nc="FirestoreClient";class Oc{constructor(e,t,n,i,r){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=wt.UNAUTHENTICATED,this.clientId=$t.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=r,this.authCredentials.start(n,async e=>{Et(Nc,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(Et(Nc,"Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Lt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const n=za(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function Lc(e,t){e.asyncQueue.verifyOperationInProgress(),Et(Nc,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let i=n.initialUser;e.setCredentialChangeListener(async e=>{i.isEqual(e)||(await No(t.localStore,e),i=e)}),t.persistence.setDatabaseDeletedListener(()=>{It("Terminating Firestore due to IndexedDb database deletion"),e.terminate().then(()=>{Et("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(e=>{It("Terminating Firestore due to IndexedDb database deletion failed",e)})}),e._offlineComponents=t}async function Pc(e,t){e.asyncQueue.verifyOperationInProgress();const n=await async function(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Et(Nc,"Using user provided OfflineComponentProvider");try{await Lc(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===Nt.FAILED_PRECONDITION||e.code===Nt.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;It("Error using user provided cache. Falling back to memory cache: "+n),await Lc(e,new kc)}}else Et(Nc,"Using default OfflineComponentProvider"),await Lc(e,new Ac(void 0));return e._offlineComponents}(e);Et(Nc,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>La(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>La(t.remoteStore,n)),e._onlineComponents=t}async function Dc(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Et(Nc,"Using user provided OnlineComponentProvider"),await Pc(e,e._uninitializedComponentsProvider._online)):(Et(Nc,"Using default OnlineComponentProvider"),await Pc(e,new Rc))),e._onlineComponents}async function Mc(e){const t=await Dc(e),n=t.eventManager;return n.onListen=sc.bind(null,t.syncEngine),n.onUnlisten=cc.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=oc.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=lc.bind(null,t.syncEngine),n}
1867
1867
  /**
1868
1868
  * @license
1869
1869
  * Copyright 2023 Google LLC
@@ -1880,7 +1880,7 @@ class xc{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.o
1880
1880
  * See the License for the specific language governing permissions and
1881
1881
  * limitations under the License.
1882
1882
  */
1883
- function Fc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t
1883
+ function zc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t
1884
1884
  /**
1885
1885
  * @license
1886
1886
  * Copyright 2020 Google LLC
@@ -1896,7 +1896,7 @@ function Fc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
1896
1896
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1897
1897
  * See the License for the specific language governing permissions and
1898
1898
  * limitations under the License.
1899
- */}const zc=new Map,Uc="firestore.googleapis.com",Vc=!0;
1899
+ */}const Fc=new Map,Uc="firestore.googleapis.com",Vc=!0;
1900
1900
  /**
1901
1901
  * @license
1902
1902
  * Copyright 2020 Google LLC
@@ -1912,7 +1912,7 @@ function Fc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
1912
1912
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1913
1913
  * See the License for the specific language governing permissions and
1914
1914
  * limitations under the License.
1915
- */class Bc{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new Ot(Nt.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Uc,this.ssl=Vc}else this.host=e.host,this.ssl=null!==(t=e.ssl)&&void 0!==t?t:Vc;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=to;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new Ot(Nt.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new Ot(Nt.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Fc(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}
1915
+ */class Bc{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new Ot(Nt.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Uc,this.ssl=Vc}else this.host=e.host,this.ssl=null!==(t=e.ssl)&&void 0!==t?t:Vc;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=to;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new Ot(Nt.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new Ot(Nt.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=zc(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}
1916
1916
  /**
1917
1917
  * @license
1918
1918
  * Copyright 2020 Google LLC
@@ -1928,7 +1928,7 @@ function Fc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
1928
1928
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1929
1929
  * See the License for the specific language governing permissions and
1930
1930
  * limitations under the License.
1931
- */(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class jc{constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Bc({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Ot(Nt.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"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new Ot(Nt.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 Bc(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new Dt;switch(e.type){case"firstParty":return new Ut(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Ot(Nt.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=zc.get(e);t&&(Et("ComponentProvider","Removing Datastore"),zc.delete(e),t.terminate())}(this),Promise.resolve()}}function Hc(e,t,n,i={}){var r;e=cn(e,jc);const s=p(t),a=e._getSettings(),c=Object.assign(Object.assign({},a),{emulatorOptions:e._getEmulatorOptions()}),l=`${t}:${n}`;s&&(g(`https://${l}`),v("Firestore",!0)),a.host!==Uc&&a.host!==l&&It("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u=Object.assign(Object.assign({},a),{host:l,ssl:s,emulatorOptions:i});if(!T(u,c)&&(e._setSettings(u),i.mockUserToken)){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=wt.MOCK_USER;else{t=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",i=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[o(JSON.stringify({alg:"none",type:"JWT"})),o(JSON.stringify(s)),""].join(".")}(i.mockUserToken,null===(r=e._app)||void 0===r?void 0:r.options.projectId);const s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new Ot(Nt.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new wt(s)}e._authCredentials=new Mt(new Pt(t,n))}}
1931
+ */(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class jc{constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Bc({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Ot(Nt.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"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new Ot(Nt.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 Bc(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new Dt;switch(e.type){case"firstParty":return new Ut(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Ot(Nt.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=Fc.get(e);t&&(Et("ComponentProvider","Removing Datastore"),Fc.delete(e),t.terminate())}(this),Promise.resolve()}}function Hc(e,t,n,i={}){var r;e=cn(e,jc);const s=p(t),a=e._getSettings(),c=Object.assign(Object.assign({},a),{emulatorOptions:e._getEmulatorOptions()}),l=`${t}:${n}`;s&&(g(`https://${l}`),v("Firestore",!0)),a.host!==Uc&&a.host!==l&&It("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u=Object.assign(Object.assign({},a),{host:l,ssl:s,emulatorOptions:i});if(!T(u,c)&&(e._setSettings(u),i.mockUserToken)){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=wt.MOCK_USER;else{t=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",i=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[o(JSON.stringify({alg:"none",type:"JWT"})),o(JSON.stringify(s)),""].join(".")}(i.mockUserToken,null===(r=e._app)||void 0===r?void 0:r.options.projectId);const s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new Ot(Nt.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new wt(s)}e._authCredentials=new Mt(new Pt(t,n))}}
1932
1932
  /**
1933
1933
  * @license
1934
1934
  * Copyright 2020 Google LLC
@@ -1992,7 +1992,7 @@ function Fc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
1992
1992
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1993
1993
  * See the License for the specific language governing permissions and
1994
1994
  * limitations under the License.
1995
- */(e,["next","error","complete"])}class Zc extends jc{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new Jc,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Jc(e),this._firestoreClient=void 0,await e}}}function el(e,t){const n="object"==typeof e?e:Ke(),i="string"==typeof e?e:Jn,r=Be(n,"firestore").getImmediate({identifier:i});if(!r._initialized){const e=(e=>{const t=u(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const i=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),i]:[t.substring(0,n),i]})("firestore");e&&Hc(r,...e)}return r}function tl(e){if(e._terminated)throw new Ot(Nt.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,n,i;const r=e._freezeSettings(),s=function(e,t,n,i){return new Qn(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,Fc(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,r);e._componentsProvider||(null===(n=r.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(i=r.localCache)||void 0===i?void 0:i._onlineComponentProvider)&&(e._componentsProvider={_offline:r.localCache._offlineComponentProvider,_online:r.localCache._onlineComponentProvider}),e._firestoreClient=new Oc(e._authCredentials,e._appCheckCredentials,e._queue,s,e._componentsProvider&&function(e){const t=null==e?void 0:e._online.build();return{_offline:null==e?void 0:e._offline.build(t),_online:t}}(e._componentsProvider))}
1995
+ */(e,["next","error","complete"])}class Zc extends jc{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new Jc,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Jc(e),this._firestoreClient=void 0,await e}}}function el(e,t){const n="object"==typeof e?e:Ke(),i="string"==typeof e?e:Jn,r=Be(n,"firestore").getImmediate({identifier:i});if(!r._initialized){const e=(e=>{const t=u(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const i=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),i]:[t.substring(0,n),i]})("firestore");e&&Hc(r,...e)}return r}function tl(e){if(e._terminated)throw new Ot(Nt.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,n,i;const r=e._freezeSettings(),s=function(e,t,n,i){return new Qn(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,zc(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,r);e._componentsProvider||(null===(n=r.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(i=r.localCache)||void 0===i?void 0:i._onlineComponentProvider)&&(e._componentsProvider={_offline:r.localCache._offlineComponentProvider,_online:r.localCache._onlineComponentProvider}),e._firestoreClient=new Oc(e._authCredentials,e._appCheckCredentials,e._queue,s,e._componentsProvider&&function(e){const t=null==e?void 0:e._online.build();return{_offline:null==e?void 0:e._offline.build(t),_online:t}}(e._componentsProvider))}
1996
1996
  /**
1997
1997
  * @license
1998
1998
  * Copyright 2020 Google LLC
@@ -2008,7 +2008,7 @@ function Fc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
2008
2008
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2009
2009
  * See the License for the specific language governing permissions and
2010
2010
  * limitations under the License.
2011
- */(e),e._firestoreClient}class nl{constructor(e){this._byteString=e}static fromBase64String(e){try{return new nl(Fn.fromBase64String(e))}catch(e){throw new Ot(Nt.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new nl(Fn.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:nl._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(un(e,nl._jsonSchema))return nl.fromBase64String(e.bytes)}}nl._jsonSchemaVersion="firestore/bytes/1.0",nl._jsonSchema={type:ln("string",nl._jsonSchemaVersion),bytes:ln("string")};
2011
+ */(e),e._firestoreClient}class nl{constructor(e){this._byteString=e}static fromBase64String(e){try{return new nl(zn.fromBase64String(e))}catch(e){throw new Ot(Nt.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new nl(zn.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:nl._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(un(e,nl._jsonSchema))return nl.fromBase64String(e.bytes)}}nl._jsonSchemaVersion="firestore/bytes/1.0",nl._jsonSchema={type:ln("string",nl._jsonSchemaVersion),bytes:ln("string")};
2012
2012
  /**
2013
2013
  * @license
2014
2014
  * Copyright 2020 Google LLC
@@ -2139,7 +2139,7 @@ const cl=/^__.*__$/;class ll{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
2139
2139
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2140
2140
  * See the License for the specific language governing permissions and
2141
2141
  * limitations under the License.
2142
- */(i);for(const t of i)e=t._apply(e);return e}class Nl extends Rl{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Nl(e,t,n)}_apply(e){const t=this._parse(e);return Ml(e._query,t),new $c(e.firestore,e.converter,er(e._query,t))}_parse(e){const t=fl(e.firestore),n=function(e,t,n,i,r,s,o){let a;if(r.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new Ot(Nt.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){Dl(o,s);const t=[];for(const n of o)t.push(Pl(i,e,n));a={arrayValue:{values:t}}}else a=Pl(i,e,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||Dl(o,s),a=function(e,t,n,i=!1){return gl(n,e.Dc(i?4:3,t))}(n,t,o,"in"===s||"not-in"===s);return Ai.create(r,s,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function Ol(e,t,n){const i=t,r=Cl("where",e);return Nl._create(r,i,n)}class Ll extends Al{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Ll(e,t)}_parse(e){const t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:Ri.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const i=t.getFlattenedFilters();for(const e of i)Ml(n,e),n=er(n,e)}(e._query,t),new $c(e.firestore,e.converter,er(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Pl(e,t,n){if("string"==typeof(n=N(n))){if(""===n)throw new Ot(Nt.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Yi(t)&&-1!==n.indexOf("/"))throw new Ot(Nt.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const i=t.path.child(Xt.fromString(n));if(!tn.isDocumentKey(i))throw new Ot(Nt.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 di(e,new tn(i))}if(n instanceof qc)return di(e,n._key);throw new Ot(Nt.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${an(n)}.`)}function Dl(e,t){if(!Array.isArray(e)||0===e.length)throw new Ot(Nt.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Ml(e,t){const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new Ot(Nt.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new Ot(Nt.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class Fl{convertValue(e,t="none"){switch(ii(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Vn(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Bn(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw kt(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return An(e,(e,i)=>{n[e]=this.convertValue(i,t)}),n}convertVectorValue(e){var t,n,i;const r=null===(i=null===(n=null===(t=e.fields)||void 0===t?void 0:t[ni].arrayValue)||void 0===n?void 0:n.values)||void 0===i?void 0:i.map(e=>Vn(e.doubleValue));return new al(r)}convertGeoPoint(e){return new ol(Vn(e.latitude),Vn(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Kn(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Wn(e));default:return null}}convertTimestamp(e){const t=Un(e);return new fn(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=Xt.fromString(e);Rt(Ws(n),9688,{name:e});const i=new Yn(n.get(1),n.get(3)),r=new tn(n.popFirst(5));return i.isEqual(t)||Tt(`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 (${t.projectId}/${t.database}) instead.`),r}}
2142
+ */(i);for(const t of i)e=t._apply(e);return e}class Nl extends Rl{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Nl(e,t,n)}_apply(e){const t=this._parse(e);return Ml(e._query,t),new $c(e.firestore,e.converter,er(e._query,t))}_parse(e){const t=fl(e.firestore),n=function(e,t,n,i,r,s,o){let a;if(r.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new Ot(Nt.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){Dl(o,s);const t=[];for(const n of o)t.push(Pl(i,e,n));a={arrayValue:{values:t}}}else a=Pl(i,e,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||Dl(o,s),a=function(e,t,n,i=!1){return gl(n,e.Dc(i?4:3,t))}(n,t,o,"in"===s||"not-in"===s);return Ai.create(r,s,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function Ol(e,t,n){const i=t,r=Cl("where",e);return Nl._create(r,i,n)}class Ll extends Al{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Ll(e,t)}_parse(e){const t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:Ri.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const i=t.getFlattenedFilters();for(const e of i)Ml(n,e),n=er(n,e)}(e._query,t),new $c(e.firestore,e.converter,er(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Pl(e,t,n){if("string"==typeof(n=N(n))){if(""===n)throw new Ot(Nt.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Yi(t)&&-1!==n.indexOf("/"))throw new Ot(Nt.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const i=t.path.child(Xt.fromString(n));if(!tn.isDocumentKey(i))throw new Ot(Nt.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 di(e,new tn(i))}if(n instanceof qc)return di(e,n._key);throw new Ot(Nt.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${an(n)}.`)}function Dl(e,t){if(!Array.isArray(e)||0===e.length)throw new Ot(Nt.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Ml(e,t){const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new Ot(Nt.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new Ot(Nt.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class zl{convertValue(e,t="none"){switch(ii(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Vn(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Bn(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw kt(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return An(e,(e,i)=>{n[e]=this.convertValue(i,t)}),n}convertVectorValue(e){var t,n,i;const r=null===(i=null===(n=null===(t=e.fields)||void 0===t?void 0:t[ni].arrayValue)||void 0===n?void 0:n.values)||void 0===i?void 0:i.map(e=>Vn(e.doubleValue));return new al(r)}convertGeoPoint(e){return new ol(Vn(e.latitude),Vn(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Kn(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Wn(e));default:return null}}convertTimestamp(e){const t=Un(e);return new fn(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=Xt.fromString(e);Rt(Ws(n),9688,{name:e});const i=new Yn(n.get(1),n.get(3)),r=new tn(n.popFirst(5));return i.isEqual(t)||Tt(`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 (${t.projectId}/${t.database}) instead.`),r}}
2143
2143
  /**
2144
2144
  * @license
2145
2145
  * Copyright 2020 Google LLC
@@ -2155,7 +2155,7 @@ const cl=/^__.*__$/;class ll{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
2155
2155
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2156
2156
  * See the License for the specific language governing permissions and
2157
2157
  * limitations under the License.
2158
- */class zl{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Ul extends Tl{constructor(e,t,n,i,r,s){super(e,t,n,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=r}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Vl(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const n=this._document.data.field(Cl("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Ot(Nt.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Ul._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()?(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t):t}}Ul._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ul._jsonSchema={type:ln("string",Ul._jsonSchemaVersion),bundleSource:ln("string","DocumentSnapshot"),bundleName:ln("string"),bundle:ln("string")};class Vl extends Ul{data(e={}){return super.data(e)}}class Bl{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new zl(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new Vl(this._firestore,this._userDataWriter,n.key,n,new zl(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new Ot(Nt.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{const i=new Vl(e._firestore,e._userDataWriter,n.doc.key,n.doc,new zl(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{const i=new Vl(e._firestore,e._userDataWriter,t.doc.key,t.doc,new zl(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let r=-1,s=-1;return 0!==t.type&&(r=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),s=n.indexOf(t.doc.key)),{type:jl(t.type),doc:i,oldIndex:r,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Ot(Nt.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Bl._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=$t.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],i=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),i.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function jl(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return kt(61501,{type:e})}}
2158
+ */class Fl{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Ul extends Tl{constructor(e,t,n,i,r,s){super(e,t,n,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=r}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Vl(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const n=this._document.data.field(Cl("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Ot(Nt.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Ul._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()?(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t):t}}Ul._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ul._jsonSchema={type:ln("string",Ul._jsonSchemaVersion),bundleSource:ln("string","DocumentSnapshot"),bundleName:ln("string"),bundle:ln("string")};class Vl extends Ul{data(e={}){return super.data(e)}}class Bl{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new Fl(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new Vl(this._firestore,this._userDataWriter,n.key,n,new Fl(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new Ot(Nt.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{const i=new Vl(e._firestore,e._userDataWriter,n.doc.key,n.doc,new Fl(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{const i=new Vl(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Fl(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let r=-1,s=-1;return 0!==t.type&&(r=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),s=n.indexOf(t.doc.key)),{type:jl(t.type),doc:i,oldIndex:r,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Ot(Nt.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Bl._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=$t.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],i=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),i.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function jl(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return kt(61501,{type:e})}}
2159
2159
  /**
2160
2160
  * @license
2161
2161
  * Copyright 2020 Google LLC
@@ -2171,7 +2171,7 @@ const cl=/^__.*__$/;class ll{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
2171
2171
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2172
2172
  * See the License for the specific language governing permissions and
2173
2173
  * limitations under the License.
2174
- */function Hl(e){e=cn(e,qc);const t=cn(e.firestore,Zc);return function(e,t,n={}){const i=new Lt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,i,r){const s=new xc({next:a=>{s.Ou(),t.enqueueAndForget(()=>qa(e,o));const c=a.docs.has(n);!c&&a.fromCache?r.reject(new Ot(Nt.UNAVAILABLE,"Failed to get document because the client is offline.")):c&&a.fromCache&&i&&"server"===i.source?r.reject(new Ot(Nt.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(a)},error:e=>r.reject(e)}),o=new Ya(Qi(n.path),s,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,i)),i.promise}(tl(t),e._key).then(n=>Wl(t,e,n))}Bl._jsonSchemaVersion="firestore/querySnapshot/1.0",Bl._jsonSchema={type:ln("string",Bl._jsonSchemaVersion),bundleSource:ln("string","QuerySnapshot"),bundleName:ln("string"),bundle:ln("string")};class $l extends Fl{constructor(e){super(),this.firestore=e}convertBytes(e){return new nl(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new qc(this.firestore,null,t)}}function ql(e){e=cn(e,$c);const t=cn(e.firestore,Zc),n=tl(t),i=new $l(t);return kl(e._query),function(e,t,n={}){const i=new Lt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,i,r){const s=new xc({next:n=>{s.Ou(),t.enqueueAndForget(()=>qa(e,o)),n.fromCache&&"server"===i.source?r.reject(new Ot(Nt.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:e=>r.reject(e)}),o=new Ya(n,s,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,i)),i.promise}(n,e._query).then(n=>new Bl(t,i,e,n))}function Gl(e,t,n){e=cn(e,qc);const i=cn(e.firestore,Zc),r=function(e,t,n){let i;return i=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,i}(e.converter,t,n);return function(e,t){return function(e,t){const n=new Lt;return e.asyncQueue.enqueueAndForget(async()=>uc(await function(e){return Dc(e).then(e=>e.syncEngine)}(e),t,n)),n.promise}(tl(e),t)}(i,[pl(fl(i),"setDoc",e._key,r,null!==e.converter,n).toMutation(e._key,Fr.none())])}function Kl(e,...t){var n,i,r;e=N(e);let s={includeMetadataChanges:!1,source:"default"},o=0;"object"!=typeof t[o]||Xc(t[o])||(s=t[o++]);const a={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(Xc(t[o])){const e=t[o];t[o]=null===(n=e.next)||void 0===n?void 0:n.bind(e),t[o+1]=null===(i=e.error)||void 0===i?void 0:i.bind(e),t[o+2]=null===(r=e.complete)||void 0===r?void 0:r.bind(e)}let c,l,u;if(e instanceof qc)l=cn(e.firestore,Zc),u=Qi(e._key.path),c={next:n=>{t[o]&&t[o](Wl(l,e,n))},error:t[o+1],complete:t[o+2]};else{const n=cn(e,$c);l=cn(n.firestore,Zc),u=n._query;const i=new $l(l);c={next:e=>{t[o]&&t[o](new Bl(l,i,n,e))},error:t[o+1],complete:t[o+2]},kl(e._query)}return function(e,t,n,i){const r=new xc(i),s=new Ya(t,r,n);return e.asyncQueue.enqueueAndForget(async()=>$a(await Mc(e),s)),()=>{r.Ou(),e.asyncQueue.enqueueAndForget(async()=>qa(await Mc(e),s))}}(tl(l),u,a,c)}function Wl(e,t,n){const i=n.docs.get(t._key),r=new $l(e);return new Ul(e,r,t._key,i,new zl(n.hasPendingWrites,n.fromCache),t.converter)}!function(e,t=!0){!function(e){bt=e}(qe),Ve(new O("firestore",(e,{instanceIdentifier:n,options:i})=>{const r=e.getProvider("app").getImmediate(),s=new Zc(new Ft(e.getProvider("auth-internal")),new Bt(r,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Ot(Nt.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Yn(e.options.projectId,t)}(r,n),r);return i=Object.assign({useFetchStreams:t},i),s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),We(yt,vt,e),We(yt,vt,"esm2017")}();
2174
+ */function Hl(e){e=cn(e,qc);const t=cn(e.firestore,Zc);return function(e,t,n={}){const i=new Lt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,i,r){const s=new xc({next:a=>{s.Ou(),t.enqueueAndForget(()=>qa(e,o));const c=a.docs.has(n);!c&&a.fromCache?r.reject(new Ot(Nt.UNAVAILABLE,"Failed to get document because the client is offline.")):c&&a.fromCache&&i&&"server"===i.source?r.reject(new Ot(Nt.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(a)},error:e=>r.reject(e)}),o=new Ya(Qi(n.path),s,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,i)),i.promise}(tl(t),e._key).then(n=>Wl(t,e,n))}Bl._jsonSchemaVersion="firestore/querySnapshot/1.0",Bl._jsonSchema={type:ln("string",Bl._jsonSchemaVersion),bundleSource:ln("string","QuerySnapshot"),bundleName:ln("string"),bundle:ln("string")};class $l extends zl{constructor(e){super(),this.firestore=e}convertBytes(e){return new nl(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new qc(this.firestore,null,t)}}function ql(e){e=cn(e,$c);const t=cn(e.firestore,Zc),n=tl(t),i=new $l(t);return kl(e._query),function(e,t,n={}){const i=new Lt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,i,r){const s=new xc({next:n=>{s.Ou(),t.enqueueAndForget(()=>qa(e,o)),n.fromCache&&"server"===i.source?r.reject(new Ot(Nt.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:e=>r.reject(e)}),o=new Ya(n,s,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,i)),i.promise}(n,e._query).then(n=>new Bl(t,i,e,n))}function Gl(e,t,n){e=cn(e,qc);const i=cn(e.firestore,Zc),r=function(e,t,n){let i;return i=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,i}(e.converter,t,n);return function(e,t){return function(e,t){const n=new Lt;return e.asyncQueue.enqueueAndForget(async()=>uc(await function(e){return Dc(e).then(e=>e.syncEngine)}(e),t,n)),n.promise}(tl(e),t)}(i,[pl(fl(i),"setDoc",e._key,r,null!==e.converter,n).toMutation(e._key,zr.none())])}function Kl(e,...t){var n,i,r;e=N(e);let s={includeMetadataChanges:!1,source:"default"},o=0;"object"!=typeof t[o]||Xc(t[o])||(s=t[o++]);const a={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(Xc(t[o])){const e=t[o];t[o]=null===(n=e.next)||void 0===n?void 0:n.bind(e),t[o+1]=null===(i=e.error)||void 0===i?void 0:i.bind(e),t[o+2]=null===(r=e.complete)||void 0===r?void 0:r.bind(e)}let c,l,u;if(e instanceof qc)l=cn(e.firestore,Zc),u=Qi(e._key.path),c={next:n=>{t[o]&&t[o](Wl(l,e,n))},error:t[o+1],complete:t[o+2]};else{const n=cn(e,$c);l=cn(n.firestore,Zc),u=n._query;const i=new $l(l);c={next:e=>{t[o]&&t[o](new Bl(l,i,n,e))},error:t[o+1],complete:t[o+2]},kl(e._query)}return function(e,t,n,i){const r=new xc(i),s=new Ya(t,r,n);return e.asyncQueue.enqueueAndForget(async()=>$a(await Mc(e),s)),()=>{r.Ou(),e.asyncQueue.enqueueAndForget(async()=>qa(await Mc(e),s))}}(tl(l),u,a,c)}function Wl(e,t,n){const i=n.docs.get(t._key),r=new $l(e);return new Ul(e,r,t._key,i,new Fl(n.hasPendingWrites,n.fromCache),t.converter)}!function(e,t=!0){!function(e){bt=e}(qe),Ve(new O("firestore",(e,{instanceIdentifier:n,options:i})=>{const r=e.getProvider("app").getImmediate(),s=new Zc(new zt(e.getProvider("auth-internal")),new Bt(r,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Ot(Nt.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Yn(e.options.projectId,t)}(r,n),r);return i=Object.assign({useFetchStreams:t},i),s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),We(yt,vt,e),We(yt,vt,"esm2017")}();
2175
2175
  /**
2176
2176
  * @license
2177
2177
  * Copyright 2020 Google LLC
@@ -2204,7 +2204,7 @@ We("firebase","11.10.0","app");class Ql{constructor(){}static getInstance(){retu
2204
2204
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2205
2205
  * See the License for the specific language governing permissions and
2206
2206
  * limitations under the License.
2207
- */function Lu(e,...t){throw Fu(e,...t)}function Pu(e,...t){return Fu(e,...t)}function Du(e,t,n){const i=Object.assign(Object.assign({},Au()),{[t]:n});return new S("auth","Firebase",i).create(t,{appName:e.name})}function Mu(e){return Du(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Fu(e,...t){if("string"!=typeof e){const n=t[0],i=[...t.slice(1)];return i[0]&&(i[0].appName=e.name),e._errorFactory.create(n,...i)}return Ru.create(e,...t)}function zu(e,t,...n){if(!e)throw Fu(t,...n)}function Uu(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ou(t),new Error(t)}function Vu(e,t){e||Uu(t)}
2207
+ */function Lu(e,...t){throw zu(e,...t)}function Pu(e,...t){return zu(e,...t)}function Du(e,t,n){const i=Object.assign(Object.assign({},Au()),{[t]:n});return new S("auth","Firebase",i).create(t,{appName:e.name})}function Mu(e){return Du(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function zu(e,...t){if("string"!=typeof e){const n=t[0],i=[...t.slice(1)];return i[0]&&(i[0].appName=e.name),e._errorFactory.create(n,...i)}return Ru.create(e,...t)}function Fu(e,t,...n){if(!e)throw zu(t,...n)}function Uu(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ou(t),new Error(t)}function Vu(e,t){e||Uu(t)}
2208
2208
  /**
2209
2209
  * @license
2210
2210
  * Copyright 2020 Google LLC
@@ -2333,7 +2333,7 @@ class $u{constructor(e,t){this.shortDelay=e,this.longDelay=t,Vu(t>e,"Short delay
2333
2333
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2334
2334
  * See the License for the specific language governing permissions and
2335
2335
  * limitations under the License.
2336
- */function ah(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function ch(e){return 1e3*Number(e)}function lh(e){const[t,n,i]=e.split(".");if(void 0===t||void 0===n||void 0===i)return Ou("JWT malformed, contained fewer than 3 sections"),null;try{const e=a(n);return e?JSON.parse(e):(Ou("Failed to decode base64 JWT payload"),null)}catch(e){return Ou("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function uh(e){const t=lh(e);return zu(t,"internal-error"),zu(void 0!==t.exp,"internal-error"),zu(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}
2336
+ */function ah(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function ch(e){return 1e3*Number(e)}function lh(e){const[t,n,i]=e.split(".");if(void 0===t||void 0===n||void 0===i)return Ou("JWT malformed, contained fewer than 3 sections"),null;try{const e=a(n);return e?JSON.parse(e):(Ou("Failed to decode base64 JWT payload"),null)}catch(e){return Ou("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function uh(e){const t=lh(e);return Fu(t,"internal-error"),Fu(void 0!==t.exp,"internal-error"),Fu(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}
2337
2337
  /**
2338
2338
  * @license
2339
2339
  * Copyright 2020 Google LLC
@@ -2397,7 +2397,7 @@ class $u{constructor(e,t){this.shortDelay=e,this.longDelay=t,Vu(t>e,"Short delay
2397
2397
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2398
2398
  * See the License for the specific language governing permissions and
2399
2399
  * limitations under the License.
2400
- */async function ph(e){var t;const n=e.auth,i=await e.getIdToken(),r=await hh(e,oh(n,{idToken:i}));zu(null==r?void 0:r.users.length,n,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(null===(t=s.providerUserInfo)||void 0===t?void 0:t.length)?gh(s.providerUserInfo):[],a=(c=e.providerData,l=o,[...c.filter(e=>!l.some(t=>t.providerId===e.providerId)),...l]);var c,l;const u=e.isAnonymous,h=!(e.email&&s.passwordHash||(null==a?void 0:a.length)),d=!!u&&h,f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new fh(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(e,f)}function gh(e){return e.map(e=>{var{providerId:t}=e,n=Cu(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})}
2400
+ */async function ph(e){var t;const n=e.auth,i=await e.getIdToken(),r=await hh(e,oh(n,{idToken:i}));Fu(null==r?void 0:r.users.length,n,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(null===(t=s.providerUserInfo)||void 0===t?void 0:t.length)?gh(s.providerUserInfo):[],a=(c=e.providerData,l=o,[...c.filter(e=>!l.some(t=>t.providerId===e.providerId)),...l]);var c,l;const u=e.isAnonymous,h=!(e.email&&s.passwordHash||(null==a?void 0:a.length)),d=!!u&&h,f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new fh(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(e,f)}function gh(e){return e.map(e=>{var{providerId:t}=e,n=Cu(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})}
2401
2401
  /**
2402
2402
  * @license
2403
2403
  * Copyright 2020 Google LLC
@@ -2430,7 +2430,7 @@ class $u{constructor(e,t){this.shortDelay=e,this.longDelay=t,Vu(t>e,"Short delay
2430
2430
  * See the License for the specific language governing permissions and
2431
2431
  * limitations under the License.
2432
2432
  */
2433
- class mh{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){zu(e.idToken,"internal-error"),zu(void 0!==e.idToken,"internal-error"),zu(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):uh(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){zu(0!==e.length,"internal-error");const t=uh(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(zu(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:i,expiresIn:r}=await async function(e,t){const n=await Xu(e,{},async()=>{const n=C({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:r}=e.config,s=await eh(e,i,"/v1/token",`key=${r}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return e.emulatorConfig&&p(e.emulatorConfig.host)&&(a.credentials="include"),Gu.fetch()(s,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,i,Number(r))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:i,expirationTime:r}=t,s=new mh;return n&&(zu("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),i&&(zu("string"==typeof i,"internal-error",{appName:e}),s.accessToken=i),r&&(zu("number"==typeof r,"internal-error",{appName:e}),s.expirationTime=r),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new mh,this.toJSON())}_performRefresh(){return Uu("not implemented")}}
2433
+ class mh{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Fu(e.idToken,"internal-error"),Fu(void 0!==e.idToken,"internal-error"),Fu(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):uh(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Fu(0!==e.length,"internal-error");const t=uh(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(Fu(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:i,expiresIn:r}=await async function(e,t){const n=await Xu(e,{},async()=>{const n=C({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:r}=e.config,s=await eh(e,i,"/v1/token",`key=${r}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return e.emulatorConfig&&p(e.emulatorConfig.host)&&(a.credentials="include"),Gu.fetch()(s,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,i,Number(r))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:i,expirationTime:r}=t,s=new mh;return n&&(Fu("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),i&&(Fu("string"==typeof i,"internal-error",{appName:e}),s.accessToken=i),r&&(Fu("number"==typeof r,"internal-error",{appName:e}),s.expirationTime=r),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new mh,this.toJSON())}_performRefresh(){return Uu("not implemented")}}
2434
2434
  /**
2435
2435
  * @license
2436
2436
  * Copyright 2020 Google LLC
@@ -2446,7 +2446,7 @@ class mh{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2446
2446
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2447
2447
  * See the License for the specific language governing permissions and
2448
2448
  * limitations under the License.
2449
- */function yh(e,t){zu("string"==typeof e||void 0===e,"internal-error",{appName:t})}class vh{constructor(e){var{uid:t,auth:n,stsTokenManager:i}=e,r=Cu(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new dh(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,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 fh(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await hh(this,this.stsTokenManager.getToken(this.auth,e));return zu(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=N(e),i=await n.getIdToken(t),r=lh(i);zu(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:ah(ch(r.auth_time)),issuedAtTime:ah(ch(r.iat)),expirationTime:ah(ch(r.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=N(e);await ph(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(zu(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new vh(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){zu(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await ph(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(je(this.auth.app))return Promise.reject(Mu(this.auth));const e=await this.getIdToken();return await hh(this,
2449
+ */function yh(e,t){Fu("string"==typeof e||void 0===e,"internal-error",{appName:t})}class vh{constructor(e){var{uid:t,auth:n,stsTokenManager:i}=e,r=Cu(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new dh(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,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 fh(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await hh(this,this.stsTokenManager.getToken(this.auth,e));return Fu(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=N(e),i=await n.getIdToken(t),r=lh(i);Fu(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:ah(ch(r.auth_time)),issuedAtTime:ah(ch(r.iat)),expirationTime:ah(ch(r.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=N(e);await ph(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Fu(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new vh(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){Fu(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await ph(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(je(this.auth.app))return Promise.reject(Mu(this.auth));const e=await this.getIdToken();return await hh(this,
2450
2450
  /**
2451
2451
  * @license
2452
2452
  * Copyright 2020 Google LLC
@@ -2463,7 +2463,7 @@ class mh{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2463
2463
  * See the License for the specific language governing permissions and
2464
2464
  * limitations under the License.
2465
2465
  */
2466
- async function(e,t){return Yu(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),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(e=>Object.assign({},e)),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(e,t){var n,i,r,s,o,a,c,l;const u=null!==(n=t.displayName)&&void 0!==n?n:void 0,h=null!==(i=t.email)&&void 0!==i?i:void 0,d=null!==(r=t.phoneNumber)&&void 0!==r?r:void 0,f=null!==(s=t.photoURL)&&void 0!==s?s:void 0,p=null!==(o=t.tenantId)&&void 0!==o?o:void 0,g=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=t.createdAt)&&void 0!==c?c:void 0,y=null!==(l=t.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:w,isAnonymous:b,providerData:_,stsTokenManager:S}=t;zu(v&&S,e,"internal-error");const E=mh.fromJSON(this.name,S);zu("string"==typeof v,e,"internal-error"),yh(u,e.name),yh(h,e.name),zu("boolean"==typeof w,e,"internal-error"),zu("boolean"==typeof b,e,"internal-error"),yh(d,e.name),yh(f,e.name),yh(p,e.name),yh(g,e.name),yh(m,e.name),yh(y,e.name);const T=new vh({uid:v,auth:e,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return _&&Array.isArray(_)&&(T.providerData=_.map(e=>Object.assign({},e))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(e,t,n=!1){const i=new mh;i.updateFromServerResponse(t);const r=new vh({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:n});return await ph(r),r}static async _fromGetAccountInfoResponse(e,t,n){const i=t.users[0];zu(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?gh(i.providerUserInfo):[],s=!(i.email&&i.passwordHash||(null==r?void 0:r.length)),o=new mh;o.updateFromIdToken(n);const a=new vh({uid:i.localId,auth:e,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 fh(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||(null==r?void 0:r.length))};return Object.assign(a,c),a}}
2466
+ async function(e,t){return Yu(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),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(e=>Object.assign({},e)),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(e,t){var n,i,r,s,o,a,c,l;const u=null!==(n=t.displayName)&&void 0!==n?n:void 0,h=null!==(i=t.email)&&void 0!==i?i:void 0,d=null!==(r=t.phoneNumber)&&void 0!==r?r:void 0,f=null!==(s=t.photoURL)&&void 0!==s?s:void 0,p=null!==(o=t.tenantId)&&void 0!==o?o:void 0,g=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=t.createdAt)&&void 0!==c?c:void 0,y=null!==(l=t.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:w,isAnonymous:b,providerData:_,stsTokenManager:S}=t;Fu(v&&S,e,"internal-error");const E=mh.fromJSON(this.name,S);Fu("string"==typeof v,e,"internal-error"),yh(u,e.name),yh(h,e.name),Fu("boolean"==typeof w,e,"internal-error"),Fu("boolean"==typeof b,e,"internal-error"),yh(d,e.name),yh(f,e.name),yh(p,e.name),yh(g,e.name),yh(m,e.name),yh(y,e.name);const T=new vh({uid:v,auth:e,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return _&&Array.isArray(_)&&(T.providerData=_.map(e=>Object.assign({},e))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(e,t,n=!1){const i=new mh;i.updateFromServerResponse(t);const r=new vh({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:n});return await ph(r),r}static async _fromGetAccountInfoResponse(e,t,n){const i=t.users[0];Fu(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?gh(i.providerUserInfo):[],s=!(i.email&&i.passwordHash||(null==r?void 0:r.length)),o=new mh;o.updateFromIdToken(n);const a=new vh({uid:i.localId,auth:e,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 fh(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||(null==r?void 0:r.length))};return Object.assign(a,c),a}}
2467
2467
  /**
2468
2468
  * @license
2469
2469
  * Copyright 2020 Google LLC
@@ -2559,7 +2559,7 @@ async function(e,t){return Yu(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
2559
2559
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2560
2560
  * See the License for the specific language governing permissions and
2561
2561
  * limitations under the License.
2562
- */class Fh{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise((n,i)=>{try{n(e(t))}catch(e){i(e)}});n.onAbort=t,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}
2562
+ */class zh{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise((n,i)=>{try{n(e(t))}catch(e){i(e)}});n.onAbort=t,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}
2563
2563
  /**
2564
2564
  * @license
2565
2565
  * Copyright 2023 Google LLC
@@ -2575,7 +2575,7 @@ async function(e,t){return Yu(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
2575
2575
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2576
2576
  * See the License for the specific language governing permissions and
2577
2577
  * limitations under the License.
2578
- */class zh{constructor(e){var t,n,i,r;const s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=s.minPasswordLength)&&void 0!==t?t:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(r=e.forceUpgradeOnSignin)&&void 0!==r&&r,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,i,r,s,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(i=a.containsLowercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(r=a.containsUppercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let i=0;i<e.length;i++)n=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,i,r){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=r))}}
2578
+ */class Fh{constructor(e){var t,n,i,r;const s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=s.minPasswordLength)&&void 0!==t?t:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(r=e.forceUpgradeOnSignin)&&void 0!==r&&r,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,i,r,s,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(i=a.containsLowercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(r=a.containsUppercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let i=0;i<e.length;i++)n=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,i,r){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=r))}}
2579
2579
  /**
2580
2580
  * @license
2581
2581
  * Copyright 2020 Google LLC
@@ -2591,7 +2591,7 @@ async function(e,t){return Yu(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
2591
2591
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2592
2592
  * See the License for the specific language governing permissions and
2593
2593
  * limitations under the License.
2594
- */class Uh{constructor(e,t,n,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Bh(this),this.idTokenSubscription=new Bh(this),this.beforeStateQueue=new Fh(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=Ru,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=bh(t)),this._initializationPromise=this.queue(async()=>{var n,i,r;if(!this._deleted&&(this.persistenceManager=await Th.create(this,e),null===(n=this._resolvePersistenceManagerAvailable)||void 0===n||n.call(this),!this._deleted)){if(null===(i=this._popupRedirectResolver)||void 0===i?void 0:i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await oh(this,{idToken:e}),n=await vh._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(je(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let i=n,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,s=null==i?void 0:i._redirectEventId,o=await this.tryRedirectSignIn(e);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(e){i=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return zu(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await ph(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(je(this.app))return Promise.reject(Mu(this));const t=e?N(e):null;return t&&zu(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&zu(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return je(this.app)?Promise.reject(Mu(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return je(this.app)?Promise.reject(Mu(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(bh(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e,t={}){return Yu(e,"GET","/v2/passwordPolicy",Ju(e,t))}
2594
+ */class Uh{constructor(e,t,n,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Bh(this),this.idTokenSubscription=new Bh(this),this.beforeStateQueue=new zh(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=Ru,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=bh(t)),this._initializationPromise=this.queue(async()=>{var n,i,r;if(!this._deleted&&(this.persistenceManager=await Th.create(this,e),null===(n=this._resolvePersistenceManagerAvailable)||void 0===n||n.call(this),!this._deleted)){if(null===(i=this._popupRedirectResolver)||void 0===i?void 0:i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await oh(this,{idToken:e}),n=await vh._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(je(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let i=n,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,s=null==i?void 0:i._redirectEventId,o=await this.tryRedirectSignIn(e);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(e){i=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return Fu(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await ph(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(je(this.app))return Promise.reject(Mu(this));const t=e?N(e):null;return t&&Fu(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&Fu(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return je(this.app)?Promise.reject(Mu(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return je(this.app)?Promise.reject(Mu(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(bh(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e,t={}){return Yu(e,"GET","/v2/passwordPolicy",Ju(e,t))}
2595
2595
  /**
2596
2596
  * @license
2597
2597
  * Copyright 2023 Google LLC
@@ -2607,7 +2607,7 @@ async function(e,t){return Yu(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
2607
2607
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2608
2608
  * See the License for the specific language governing permissions and
2609
2609
  * limitations under the License.
2610
- */(this),t=new zh(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new S("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return Yu(e,"POST","/v2/accounts:revokeToken",Ju(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&bh(e)||this._popupRedirectResolver;zu(t,this,"argument-error"),this.redirectPersistenceManager=await Th.create(this,[bh(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===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 e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,i){if(this._deleted)return()=>{};const r="function"==typeof t?t:t.next.bind(t);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(zu(o,this,"internal-error"),o.then(()=>{s||r(this.currentUser)}),"function"==typeof t){const r=e.addObserver(t,n,i);return()=>{s=!0,r()}}{const n=e.addObserver(t);return()=>{s=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return zu(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Mh(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;if(je(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){Nu.logLevel<=M.WARN&&Nu.warn(`Auth (${qe}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function Vh(e){return N(e)}class Bh{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new R(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return zu(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2610
+ */(this),t=new Fh(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new S("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return Yu(e,"POST","/v2/accounts:revokeToken",Ju(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&bh(e)||this._popupRedirectResolver;Fu(t,this,"argument-error"),this.redirectPersistenceManager=await Th.create(this,[bh(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===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 e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,i){if(this._deleted)return()=>{};const r="function"==typeof t?t:t.next.bind(t);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Fu(o,this,"internal-error"),o.then(()=>{s||r(this.currentUser)}),"function"==typeof t){const r=e.addObserver(t,n,i);return()=>{s=!0,r()}}{const n=e.addObserver(t);return()=>{s=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Fu(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Mh(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;if(je(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){Nu.logLevel<=M.WARN&&Nu.warn(`Auth (${qe}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function Vh(e){return N(e)}class Bh{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new R(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return Fu(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2611
2611
  /**
2612
2612
  * @license
2613
2613
  * Copyright 2020 Google LLC
@@ -2639,7 +2639,7 @@ async function(e,t){return Yu(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
2639
2639
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2640
2640
  * See the License for the specific language governing permissions and
2641
2641
  * limitations under the License.
2642
- */function Jh(e,t,n){const i=Vh(e);zu(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");const r=Yh(t),{host:s,port:o}=function(e){const t=Yh(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const e=r[1];return{host:e,port:Xh(i.substr(e.length+1))}}{const[e,t]=i.split(":");return{host:e,port:Xh(t)}}}(t),a=null===o?"":`:${o}`,c={url:`${r}//${s}${a}/`},l=Object.freeze({host:s,port:o,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!i._canInitEmulator)return zu(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),void zu(T(c,i.config.emulator)&&T(l,i.emulatorConfig),i,"emulator-config-failed");i.config.emulator=c,i.emulatorConfig=l,i.settings.appVerificationDisabledForTesting=!0,p(s)?(g(`${r}//${s}${a}`),v("Auth",!0)):function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}
2642
+ */function Jh(e,t,n){const i=Vh(e);Fu(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");const r=Yh(t),{host:s,port:o}=function(e){const t=Yh(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const e=r[1];return{host:e,port:Xh(i.substr(e.length+1))}}{const[e,t]=i.split(":");return{host:e,port:Xh(t)}}}(t),a=null===o?"":`:${o}`,c={url:`${r}//${s}${a}/`},l=Object.freeze({host:s,port:o,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!i._canInitEmulator)return Fu(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),void Fu(T(c,i.config.emulator)&&T(l,i.emulatorConfig),i,"emulator-config-failed");i.config.emulator=c,i.emulatorConfig=l,i.settings.appVerificationDisabledForTesting=!0,p(s)?(g(`${r}//${s}${a}`),v("Auth",!0)):function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}
2643
2643
  /**
2644
2644
  * @license
2645
2645
  * Copyright 2020 Google LLC
@@ -2768,7 +2768,7 @@ class id extends Zh{constructor(e,t,n,i=null){super("password",n),this._email=e,
2768
2768
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2769
2769
  * See the License for the specific language governing permissions and
2770
2770
  * limitations under the License.
2771
- */class od{constructor(e){var t,n,i,r,s,o;const a=k(A(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(i=a.mode)&&void 0!==i?i:null);zu(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(s=a.lang)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(e){const t=function(e){const t=k(A(e)).link,n=t?k(A(t)).deep_link_id:null,i=k(A(e)).deep_link_id;return(i?k(A(i)).link:null)||i||n||t||e}(e);try{return new od(t)}catch(e){return null}}}
2771
+ */class od{constructor(e){var t,n,i,r,s,o;const a=k(A(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(i=a.mode)&&void 0!==i?i:null);Fu(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(s=a.lang)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(e){const t=function(e){const t=k(A(e)).link,n=t?k(A(t)).deep_link_id:null,i=k(A(e)).deep_link_id;return(i?k(A(i)).link:null)||i||n||t||e}(e);try{return new od(t)}catch(e){return null}}}
2772
2772
  /**
2773
2773
  * @license
2774
2774
  * Copyright 2020 Google LLC
@@ -2784,7 +2784,7 @@ class id extends Zh{constructor(e,t,n,i=null){super("password",n),this._email=e,
2784
2784
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2785
2785
  * See the License for the specific language governing permissions and
2786
2786
  * limitations under the License.
2787
- */class ad{constructor(){this.providerId=ad.PROVIDER_ID}static credential(e,t){return id._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=od.parseLink(t);return zu(n,"argument-error"),id._fromEmailAndCode(e,n.code,n.tenantId)}}ad.PROVIDER_ID="password",ad.EMAIL_PASSWORD_SIGN_IN_METHOD="password",ad.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2787
+ */class ad{constructor(){this.providerId=ad.PROVIDER_ID}static credential(e,t){return id._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=od.parseLink(t);return Fu(n,"argument-error"),id._fromEmailAndCode(e,n.code,n.tenantId)}}ad.PROVIDER_ID="password",ad.EMAIL_PASSWORD_SIGN_IN_METHOD="password",ad.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2788
2788
  /**
2789
2789
  * @license
2790
2790
  * Copyright 2020 Google LLC
@@ -3115,7 +3115,7 @@ function Od(){return void 0!==Nd().WorkerGlobalScope&&"function"==typeof Nd().im
3115
3115
  * See the License for the specific language governing permissions and
3116
3116
  * limitations under the License.
3117
3117
  */
3118
- const Ld="firebaseLocalStorageDb",Pd="firebaseLocalStorage",Dd="fbase_key";class Md{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function Fd(e,t){return e.transaction([Pd],t?"readwrite":"readonly").objectStore(Pd)}function zd(){const e=indexedDB.open(Ld,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Pd,{keyPath:Dd})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Pd)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Ld);return new Md(e).toPromise()}(),t(await zd()))})})}async function Ud(e,t,n){const i=Fd(e,!0).put({[Dd]:t,value:n});return new Md(i).toPromise()}function Vd(e,t){const n=Fd(e,!0).delete(t);return new Md(n).toPromise()}class Bd{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 zd()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Od()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ad._getInstance(Od()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;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(e){return null}}(),!this.activeServiceWorker)return;this.sender=new xd(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((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:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await zd();return await Ud(e,Sd,"1"),await Vd(e,Sd),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Ud(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(t=>async function(e,t){const n=Fd(e,!1).get(t),i=await new Md(n).toPromise();return void 0===i?null:i.value}(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Vd(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(e=>{const t=Fd(e,!1).getAll();return new Md(t).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:i,value:r}of e)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),t.push(i));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Bd.type="LOCAL";const jd=Bd;new $u(3e4,6e4);
3118
+ const Ld="firebaseLocalStorageDb",Pd="firebaseLocalStorage",Dd="fbase_key";class Md{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function zd(e,t){return e.transaction([Pd],t?"readwrite":"readonly").objectStore(Pd)}function Fd(){const e=indexedDB.open(Ld,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Pd,{keyPath:Dd})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Pd)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Ld);return new Md(e).toPromise()}(),t(await Fd()))})})}async function Ud(e,t,n){const i=zd(e,!0).put({[Dd]:t,value:n});return new Md(i).toPromise()}function Vd(e,t){const n=zd(e,!0).delete(t);return new Md(n).toPromise()}class Bd{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 Fd()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Od()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ad._getInstance(Od()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;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(e){return null}}(),!this.activeServiceWorker)return;this.sender=new xd(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((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:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Fd();return await Ud(e,Sd,"1"),await Vd(e,Sd),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Ud(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(t=>async function(e,t){const n=zd(e,!1).get(t),i=await new Md(n).toPromise();return void 0===i?null:i.value}(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Vd(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(e=>{const t=zd(e,!1).getAll();return new Md(t).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:i,value:r}of e)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),t.push(i));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Bd.type="LOCAL";const jd=Bd;new $u(3e4,6e4);
3119
3119
  /**
3120
3120
  * @license
3121
3121
  * Copyright 2019 Google LLC
@@ -3132,7 +3132,7 @@ const Ld="firebaseLocalStorageDb",Pd="firebaseLocalStorage",Dd="fbase_key";class
3132
3132
  * See the License for the specific language governing permissions and
3133
3133
  * limitations under the License.
3134
3134
  */
3135
- class Hd extends Zh{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return rd(e,this._buildIdpRequest())}_linkToIdToken(e,t){return rd(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return rd(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function $d(e){return vd(e.auth,new Hd(e),e.bypassAuthState)}function qd(e){const{auth:t,user:n}=e;return zu(n,t,"internal-error"),
3135
+ class Hd extends Zh{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return rd(e,this._buildIdpRequest())}_linkToIdToken(e,t){return rd(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return rd(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function $d(e){return vd(e.auth,new Hd(e),e.bypassAuthState)}function qd(e){const{auth:t,user:n}=e;return Fu(n,t,"internal-error"),
3136
3136
  /**
3137
3137
  * @license
3138
3138
  * Copyright 2019 Google LLC
@@ -3149,7 +3149,7 @@ class Hd extends Zh{constructor(e){super("custom","custom"),this.params=e}_getId
3149
3149
  * See the License for the specific language governing permissions and
3150
3150
  * limitations under the License.
3151
3151
  */
3152
- async function(e,t,n=!1){const{auth:i}=e;if(je(i.app))return Promise.reject(Mu(i));const r="reauthenticate";try{const s=await hh(e,yd(i,r,t,e),n);zu(s.idToken,i,"internal-error");const o=lh(s.idToken);zu(o,i,"internal-error");const{sub:a}=o;return zu(e.uid===a,i,"user-mismatch"),pd._forOperation(e,r,s)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&Lu(i,"user-mismatch"),e}}(n,new Hd(e),e.bypassAuthState)}async function Gd(e){const{auth:t,user:n}=e;return zu(n,t,"internal-error"),async function(e,t,n=!1){const i=await hh(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return pd._forOperation(e,"link",i)}(n,new Hd(e),e.bypassAuthState)}
3152
+ async function(e,t,n=!1){const{auth:i}=e;if(je(i.app))return Promise.reject(Mu(i));const r="reauthenticate";try{const s=await hh(e,yd(i,r,t,e),n);Fu(s.idToken,i,"internal-error");const o=lh(s.idToken);Fu(o,i,"internal-error");const{sub:a}=o;return Fu(e.uid===a,i,"user-mismatch"),pd._forOperation(e,r,s)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&Lu(i,"user-mismatch"),e}}(n,new Hd(e),e.bypassAuthState)}async function Gd(e){const{auth:t,user:n}=e;return Fu(n,t,"internal-error"),async function(e,t,n=!1){const i=await hh(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return pd._forOperation(e,"link",i)}(n,new Hd(e),e.bypassAuthState)}
3153
3153
  /**
3154
3154
  * @license
3155
3155
  * Copyright 2020 Google LLC
@@ -3181,7 +3181,7 @@ async function(e,t,n=!1){const{auth:i}=e;if(je(i.app))return Promise.reject(Mu(i
3181
3181
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3182
3182
  * See the License for the specific language governing permissions and
3183
3183
  * limitations under the License.
3184
- */const Wd=new $u(2e3,1e4);class Qd extends Kd{constructor(e,t,n,i,r){super(e,t,i,r),this.provider=n,this.authWindow=null,this.pollId=null,Qd.currentPopupAction&&Qd.currentPopupAction.cancel(),Qd.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return zu(e,this.auth,"internal-error"),e}async onExecution(){Vu(1===this.filter.length,"Popup operations only handle one event");const e=Rd();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(Pu(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(Pu(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Qd.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Pu(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,Wd.get())};e()}}Qd.currentPopupAction=null;
3184
+ */const Wd=new $u(2e3,1e4);class Qd extends Kd{constructor(e,t,n,i,r){super(e,t,i,r),this.provider=n,this.authWindow=null,this.pollId=null,Qd.currentPopupAction&&Qd.currentPopupAction.cancel(),Qd.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Fu(e,this.auth,"internal-error"),e}async onExecution(){Vu(1===this.filter.length,"Popup operations only handle one event");const e=Rd();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(Pu(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(Pu(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Qd.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Pu(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,Wd.get())};e()}}Qd.currentPopupAction=null;
3185
3185
  /**
3186
3186
  * @license
3187
3187
  * Copyright 2020 Google LLC
@@ -3215,7 +3215,7 @@ const Jd="pendingRedirect",Yd=new Map;class Xd extends Kd{constructor(e,t,n=!1){
3215
3215
  * See the License for the specific language governing permissions and
3216
3216
  * limitations under the License.
3217
3217
  */
3218
- function(e,t){return t?bh(t):(zu(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(i,t),s=new Xd(i,r,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,t)),o}
3218
+ function(e,t){return t?bh(t):(Fu(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(i,t),s=new Xd(i,r,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,t)),o}
3219
3219
  /**
3220
3220
  * @license
3221
3221
  * Copyright 2020 Google LLC
@@ -3297,7 +3297,7 @@ const sf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,of=/^https?/;async function af(e
3297
3297
  * See the License for the specific language governing permissions and
3298
3298
  * limitations under the License.
3299
3299
  */
3300
- const ff=new $u(5e3,15e3),pf={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},gf=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function mf(e){const t=e.config;zu(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?qu(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,i={apiKey:t.apiKey,appName:e.name,v:qe},r=gf.get(e.config.apiHost);r&&(i.eid=r);const s=e._getFrameworks();return s.length&&(i.fw=s.join(",")),`${n}?${C(i).slice(1)}`}async function yf(e){const t=await function(e){return df=df||hf(e),df}(e),n=Nd().gapi;return zu(n,e,"internal-error"),t.open({where:document.body,url:mf(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pf,dontclear:!0},t=>new Promise(async(n,i)=>{await t.restyle({setHideOnLeave:!1});const r=Pu(e,"network-request-failed"),s=Nd().setTimeout(()=>{i(r)},ff.get());function o(){Nd().clearTimeout(s),n(t)}t.ping(o).then(o,()=>{i(r)})}))}
3300
+ const ff=new $u(5e3,15e3),pf={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},gf=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function mf(e){const t=e.config;Fu(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?qu(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,i={apiKey:t.apiKey,appName:e.name,v:qe},r=gf.get(e.config.apiHost);r&&(i.eid=r);const s=e._getFrameworks();return s.length&&(i.fw=s.join(",")),`${n}?${C(i).slice(1)}`}async function yf(e){const t=await function(e){return df=df||hf(e),df}(e),n=Nd().gapi;return Fu(n,e,"internal-error"),t.open({where:document.body,url:mf(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pf,dontclear:!0},t=>new Promise(async(n,i)=>{await t.restyle({setHideOnLeave:!1});const r=Pu(e,"network-request-failed"),s=Nd().setTimeout(()=>{i(r)},ff.get());function o(){Nd().clearTimeout(s),n(t)}t.ping(o).then(o,()=>{i(r)})}))}
3301
3301
  /**
3302
3302
  * @license
3303
3303
  * Copyright 2020 Google LLC.
@@ -3329,7 +3329,7 @@ const ff=new $u(5e3,15e3),pf={style:{position:"absolute",top:"-100px",width:"1px
3329
3329
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3330
3330
  * See the License for the specific language governing permissions and
3331
3331
  * limitations under the License.
3332
- */(t||"",a),new wf(null);const h=window.open(t||"",a,u);zu(h,e,"popup-blocked");try{h.focus()}catch(e){}return new wf(h)}const _f="__/auth/handler",Sf="emulator/auth/handler",Ef=encodeURIComponent("fac");async function Tf(e,t,n,i,r,s){zu(e.config.authDomain,e,"auth-domain-config-required"),zu(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:qe,eventId:r};if(t instanceof cd){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries({}))o[e]=t}if(t instanceof ld){const e=t.getScopes().filter(e=>""!==e);e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];const c=await e._getAppCheckToken(),l=c?`#${Ef}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${_f}`;return qu(e,Sf)}
3332
+ */(t||"",a),new wf(null);const h=window.open(t||"",a,u);Fu(h,e,"popup-blocked");try{h.focus()}catch(e){}return new wf(h)}const _f="__/auth/handler",Sf="emulator/auth/handler",Ef=encodeURIComponent("fac");async function Tf(e,t,n,i,r,s){Fu(e.config.authDomain,e,"auth-domain-config-required"),Fu(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:qe,eventId:r};if(t instanceof cd){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries({}))o[e]=t}if(t instanceof ld){const e=t.getScopes().filter(e=>""!==e);e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];const c=await e._getAppCheckToken(),l=c?`#${Ef}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${_f}`;return qu(e,Sf)}
3333
3333
  /**
3334
3334
  * @license
3335
3335
  * Copyright 2020 Google LLC
@@ -3345,7 +3345,7 @@ const ff=new $u(5e3,15e3),pf={style:{position:"absolute",top:"-100px",width:"1px
3345
3345
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3346
3346
  * See the License for the specific language governing permissions and
3347
3347
  * limitations under the License.
3348
- */(e)}?${C(a).slice(1)}${l}`}const If="webStorageSupport";const Cf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=kd,this._completeRedirectFn=ef,this._overrideRedirectResult=Zd}async _openPopup(e,t,n,i){var r;Vu(null===(r=this.eventManagers[e._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return bf(e,await Tf(e,t,n,Bu(),i),Rd())}async _openRedirect(e,t,n,i){await this._originValidation(e);return function(e){Nd().location.href=e}(await Tf(e,t,n,Bu(),i)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Vu(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await yf(e),n=new tf(e);return t.register("authEvent",t=>{zu(null==t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(If,{type:If},n=>{var i;const r=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[If];void 0!==r&&t(!!r),Lu(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=af(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Dh()||kh()||Lh()}};var kf="@firebase/auth",Af="1.10.8";
3348
+ */(e)}?${C(a).slice(1)}${l}`}const If="webStorageSupport";const Cf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=kd,this._completeRedirectFn=ef,this._overrideRedirectResult=Zd}async _openPopup(e,t,n,i){var r;Vu(null===(r=this.eventManagers[e._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return bf(e,await Tf(e,t,n,Bu(),i),Rd())}async _openRedirect(e,t,n,i){await this._originValidation(e);return function(e){Nd().location.href=e}(await Tf(e,t,n,Bu(),i)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Vu(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await yf(e),n=new tf(e);return t.register("authEvent",t=>{Fu(null==t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(If,{type:If},n=>{var i;const r=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[If];void 0!==r&&t(!!r),Lu(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=af(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Dh()||kh()||Lh()}};var kf="@firebase/auth",Af="1.10.8";
3349
3349
  /**
3350
3350
  * @license
3351
3351
  * Copyright 2020 Google LLC
@@ -3362,7 +3362,7 @@ const ff=new $u(5e3,15e3),pf={style:{position:"absolute",top:"-100px",width:"1px
3362
3362
  * See the License for the specific language governing permissions and
3363
3363
  * limitations under the License.
3364
3364
  */
3365
- class Rf{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){zu(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3365
+ class Rf{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Fu(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3366
3366
  /**
3367
3367
  * @license
3368
3368
  * Copyright 2020 Google LLC
@@ -3395,5 +3395,5 @@ class Rf{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var
3395
3395
  * See the License for the specific language governing permissions and
3396
3396
  * limitations under the License.
3397
3397
  */
3398
- const xf=d("authIdTokenMaxAge")||300;let Nf=null;function Of(e=Ke()){const t=Be(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=Be(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(T(n.getOptions(),null!=t?t:{}))return e;Lu(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Cf,persistence:[jd,Id,kd]}),i=d("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(i,location.origin);if(location.origin===e.origin){const t=(r=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>xf)return;const i=null==t?void 0:t.token;Nf!==i&&(Nf=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(e,t,n){N(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,i){N(e).onIdTokenChanged(t,n,i)}(n,e=>t(e))}}var r;const s=u("auth");return s&&Jh(n,`http://${s}`),n}var Lf;jh={loadJS:e=>new Promise((t,n)=>{const i=document.createElement("script");var r,s;i.setAttribute("src",e),i.onload=t,i.onerror=e=>{const t=Pu("internal-error");t.customData=e,n(t)},i.type="text/javascript",i.charset="UTF-8",(null!==(s=null===(r=document.getElementsByTagName("head"))||void 0===r?void 0:r[0])&&void 0!==s?s: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="},Lf="Browser",Ve(new O("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),r=e.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;zu(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:Lf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Mh(Lf)},c=new Uh(n,i,r,a);return function(e,t){const n=(null==t?void 0:t.persistence)||[],i=(Array.isArray(n)?n:[n]).map(bh);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,null==t?void 0:t.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Ve(new O("auth-internal",e=>(e=>new Rf(e))(Vh(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),We(kf,Af,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Lf)),We(kf,Af,"esm2017");class Pf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Df extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Mf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Ff extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class zf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Uf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Vf="avatar not created";class Bf{constructor(e,t){this.firestore=e,this.brandUserId=null,this.auth=Of(t),this.auth.setPersistence(Id)}get id(){var e;return null===(e=this.user)||void 0===e?void 0:e.uid}async onInit(e){this.auth.onAuthStateChanged(t=>{this.setUser(t),t&&(this.logUserLogin(e,t),this.setBrandUserId(t.uid))}),await this.auth.authStateReady();const t=this.auth.currentUser;return this.setUser(t),this.setBrandUserId(null==t?void 0:t.uid),Boolean(t)}setUser(e){this.user=e}async logUserLogin(e,t){var n,i,r,s,o;try{const a=Wc(this.firestore,"user_logging",t.uid),c=await Hl(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[e])||void 0===i?void 0:i.last_login;if(h&&Su(l).diff(Su(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[e])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[e]:{brand_id:e,last_login:l,logins:d}},last_brand_id:e,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Gl(a,f,{merge:!0})}catch(e){console.error("LOGGING ERROR:",e)}}setBrandUserId(e){this.brandUserId=e}async getToken(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Df;return await this.user.getIdToken()}get userId(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Df;return this.user.uid}async getUserProfile(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Df;return(await Hl(Wc(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(e){let t;const n=xl(Kc(this.firestore,"users"),Ol(rl(),"==",this.id));return t=Kl(n,t=>e(t.docs[0].data())),()=>t()}watchUserProfileForFrames(e){let t;const n=xl(Kc(this.firestore,"users"),Ol(rl(),"==",this.id));return new Promise(i=>{t=Kl(n,async n=>{await e(n)&&(t(),i(n.docs[0].data()))})})}async login(e,t){this.auth.currentUser&&await this.auth.signOut();const n=await _d(this.auth,e,t);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(e){await async function(e,t){const n=Vh(e),i={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await Qh(n,i,"getOobCode",nd)}(this.auth,e)}async confirmPasswordReset(e,t){await bd(this.auth,e,t)}}class jf{constructor(){this.promisefyOnSnapshot=(e,t)=>{let n;return{promise:new Promise(i=>{n=Kl(e,e=>{i(e),t&&n()})}),unsubscribe:()=>n()}};const e=Ge(Ql.getInstance().firebase);this.firestore=el(e),this.user=new Bf(this.firestore,e)}onInit(e){return this.user.onInit(e)}query(e,t,n=!0){const i=xl(Kc(this.firestore,e),t);return this.promisefyOnSnapshot(i,n)}getDocs(e,t){return ql(xl(Kc(this.firestore,e),...t))}async getDoc(e,t){const n=Wc(this.firestore,e,t),i=await Hl(n);return i.exists()?i.data():null}}const Hf=e=>{if(e.code===xu)throw new Error("account has been disabled");throw new Error(e.message)};class $f{static get endpoint(){return Ql.getInstance().api.url}static async Fetch({user:e,endpointPath:t,method:n,body:i,useToken:r=!0}){const s=this.getUrl(t,r),o={method:n,headers:await this.getHeaders(e,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(e,t){return t?`${this.endpoint}/v1${e}`:this.endpoint+e}static async getHeaders(e,t){if(!t)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await e.getToken()}`}}static Get(e,t,n){return this.Fetch({user:e,endpointPath:t,method:"GET",body:null,useToken:n})}static Post(e,t,n=null,i){return this.Fetch({user:e,endpointPath:t,method:"POST",body:n,useToken:i})}static Put(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"PUT",body:n,useToken:i})}static Patch(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"PATCH",body:n,useToken:i})}static Delete(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"DELETE",body:n,useToken:i})}}const qf=e=>{const t=new Image;return t.src=e,new Promise(e=>{t.onerror=()=>e(!1),t.onload=()=>e(!0)})};class Gf{constructor(e,t){this.brandId=e,this.firebase=t,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(e){var t,n;if(!this.isLoggedIn)throw new Df;try{const i=await $f.Get(this.user,`/styles/${e}/recommendation`),r=await i.json();return(null===(t=null==r?void 0:r.fits)||void 0===t?void 0:t.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(e){if((null==e?void 0:e.error)===Vf)throw new Pf;throw e}}async submitTelephoneNumber(e){const t=e.replace(/[^\+0-9]/g,""),n=await $f.Post(this.user,"/ios-app-link",{phone_number:t},!1);console.log(n)}async getColorwaySizeAssetFromSku(e){const t=await this.getColorwaySizeAssets(null,[e]);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getColorwaySizeAssetFromBrandStyleId(e){const t=await this.getColorwaySizeAssets(e);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getMeasurementLocationsFromSku(e,t=[]){console.log({sku:e});const n=await this.getColorwaySizeAssetFromSku(e);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(t.length?r.measurement_locations.female.filter(e=>t.includes(e)):r.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getMeasurementLocationsFromBrandStyleId(e,t=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(e);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(t.length?r.measurement_locations.female.filter(e=>t.includes(e)):r.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getStyleByBrandStyleId(e){var t,n;try{const i=[Ol("brand_id","==",this.brandId)];i.push(Ol("brand_style_id","==",e));return null===(n=null===(t=(await this.firebase.getDocs("styles",i)).docs)||void 0===t?void 0:t[0])||void 0===n?void 0:n.data()}catch(e){return Hf(e)}}async getColorwaySizeAssets(e,t){const n=[Ol("brand_id","==",this.brandId)];e&&n.push(Ol("style_id","==",e)),(null==t?void 0:t.length)>0&&n.push(Ol("sku","in",t));try{const e=await this.firebase.getDocs("colorway_size_assets",n),t=new Map;return e.forEach(e=>{const n=e.data();t.set(n.id,n)}),t}catch(e){return Hf(e)}}async getStyle(e){try{return await this.firebase.getDoc("styles",String(e))}catch(e){return Hf(e)}}getMeasurementLocationName(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).name:e}getMeasurementLocationSortOrder(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).sort_order:1/0}async tryOn(e,t){if(!this.isLoggedIn)throw new Df;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t);try{return await this.getColorwaySizeAssetFrames(n)}catch(e){if(!(e instanceof zf))throw e;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t){var n,i,r;try{const s=[Ol("brand_id","==",this.brandId)];s.push(Ol("style_id","==",e)),s.push(Ol("size_id","==",t));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(e){return Hf(e)}}async getGetTaxonomy(e){try{return await this.firebase.getDoc("style_garment_categories",String(e))}catch(e){return Hf(e)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach(e=>{this.measurementLocations.set(e.name,{name:e.garment_label,sort_order:e.sort_order})})}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map(e=>e.data())}catch(e){return Hf(e)}}async requestThenGetColorwaySizeAssetFrames(e){const[t,n]=await(i=this.getColorwaySizeAssetFromSku(e),i.then(e=>[null,e]).catch(e=>[e]));var i;if(t)throw t;try{try{this.requestColorwaySizeAssetFrames(n.id)}catch(e){}return this.awaitColorwaySizeAssetFrames(e)}catch(t){if((null==t?void 0:t.error)===Vf)throw new Pf;throw new Uf}}async awaitColorwaySizeAssetFrames(e){var t,n,i,r;if(!this.isLoggedIn)throw new Df;const s=await this.user.watchUserProfileForFrames(async t=>{var n,i,r,s;const o=null===(s=null===(r=null===(i=null===(n=t.docs[0].data())||void 0===n?void 0:n.vto)||void 0===i?void 0:i[this.brandId])||void 0===r?void 0:r[e])||void 0===s?void 0:s.frames;return!!(null==o?void 0:o.length)&&qf(o[0])});if(!(null===(r=null===(i=null===(n=null===(t=null==s?void 0:s.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===i?void 0:i.frames)||void 0===r?void 0:r.length))throw new zf;return s.vto[this.brandId][e].frames}async requestColorwaySizeAssetFrames(e){if(!this.isLoggedIn)throw new Df;if(!this.user.brandUserId)throw new Ff;await $f.Post(this.user,`/colorway-size-assets/${e}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(e){var t,n,i;const r=await this.user.getUserProfile(),s=(null===(i=null===(n=null===(t=null==r?void 0:r.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===i?void 0:i.frames)||[];if(!s.length)throw new zf;if(!await qf(s[0]))throw new zf;return s}}var Kf;!function(e){e.ACROSS_BACK="across_back",e.ACROSS_FRONT="across_front",e.ACROSS_SHOULDER="across_shoulder",e.ANKLE="ankle",e.ARMEYE="arm_eye",e.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",e.BACK_CROTCH_LENGTH="back_crotch_length",e.BACK_NECK_TO_EBLOW="back_neck_to_elbow",e.BELOW_KNEE="below_knee",e.BICEP="bicep",e.BUST="bust",e.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",e.CALF="calf",e.CB_NECK_TO_WAIST="cb_neck_to_waist",e.CB_NECK_TO_WRIST="cb_neck_to_wrist",e.CF_NECK_TO_WAIST="cf_neck_to_waist",e.ELBOW="elbow",e.FOREARM="forearm",e.FRONT_CROTCH_LENGTH="front_crotch_length",e.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",e.HIGH_HIP="high_hip",e.HSP_TO_ACROSS_BACK="hsp_to_across_back",e.HSP_TO_ACROSS_FRONT="hsp_to_across_front",e.HSP_TO_BUST_POINT="hsp_to_bust_point",e.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",e.HSP_TO_WAIST_POSITION="hsp_to_waist_position",e.INSEAM="inseam",e.KNEE="knee",e.LOW_HIP="low_hip",e.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",e.MID_NECK="mid_neck",e.NECK_AT_BASE="neck_base",e.SHOULDER_DROP="shoulder_drop",e.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",e.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",e.SIDE_WAIST_TO_KNEE="side_waist_to_knee",e.THIGH="thigh",e.TOTAL_RISE_LENGTH="total_rise_length",e.UNDER_BUST="under_bust",e.VERTICAL_TRUNK="vertical_trunk",e.WAIST="waist",e.WRIST="wrist"}(Kf||(Kf={}));const Wf={[Kf.ACROSS_BACK]:"Across back",[Kf.ACROSS_FRONT]:"Across front",[Kf.ACROSS_SHOULDER]:"Across shoulder",[Kf.ANKLE]:"Ankle",[Kf.ARMEYE]:"Armeye",[Kf.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Kf.BACK_CROTCH_LENGTH]:"Back crotch length",[Kf.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Kf.BELOW_KNEE]:"Below knee",[Kf.BICEP]:"Bicep",[Kf.BUST]:"Chest/Bust",[Kf.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Kf.CALF]:"Calf",[Kf.CB_NECK_TO_WAIST]:"Cb neck to waist",[Kf.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Kf.CF_NECK_TO_WAIST]:"Cf neck to waist",[Kf.ELBOW]:"Elbow",[Kf.FOREARM]:"Forearm",[Kf.FRONT_CROTCH_LENGTH]:"Front crotch length",[Kf.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Kf.HIGH_HIP]:"High hip",[Kf.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Kf.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Kf.HSP_TO_BUST_POINT]:"Hsp to bust point",[Kf.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Kf.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Kf.INSEAM]:"Inseam",[Kf.KNEE]:"Knee",[Kf.LOW_HIP]:"Low hip",[Kf.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Kf.MID_NECK]:"Mid neck",[Kf.NECK_AT_BASE]:"Neck at base",[Kf.SHOULDER_DROP]:"Shoulder drop",[Kf.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Kf.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Kf.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Kf.THIGH]:"Thigh",[Kf.TOTAL_RISE_LENGTH]:"Total rise length",[Kf.UNDER_BUST]:"Under bust",[Kf.VERTICAL_TRUNK]:"Vertical trunk",[Kf.WAIST]:"Waist",[Kf.WRIST]:"Wrist"};var Qf;!function(e){e.BLOUSES="blouses",e.COATS="coats",e.DRESSES="dresses",e.JACKETS="jackets",e.PANTS="pants",e.PUFFERS_AND_PARKAS="puffer_and_parkas",e.SHORTS="shorts",e.SKIRTS="skirts",e.SWEATERS="sweaters",e.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Qf||(Qf={}));const Jf={[Qf.BLOUSES]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.COATS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.DRESSES]:[Kf.LOW_HIP,Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST],[Qf.JACKETS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.PANTS]:[Kf.LOW_HIP,Kf.WAIST,Kf.THIGH,Kf.INSEAM],[Qf.PUFFERS_AND_PARKAS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.SHORTS]:[Kf.LOW_HIP,Kf.WAIST,Kf.THIGH,Kf.INSEAM],[Qf.SKIRTS]:[Kf.LOW_HIP,Kf.WAIST],[Qf.SWEATERS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.T_SHIRTS_AND_TANKS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP]},Yf={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"},Xf={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"},Zf={activewear:{leggings:Qf.PANTS,joggers:Qf.PANTS,sweatshirts:Qf.SWEATERS},dresses:{a_line:Qf.DRESSES,bodycon:Qf.DRESSES,fit_and_flare:Qf.DRESSES,knit:Qf.DRESSES,shirt:Qf.DRESSES,slip:Qf.DRESSES,straight:Qf.DRESSES,wrap:Qf.DRESSES},jackets_and_coats:{denim_jackets:Qf.JACKETS,parkas:Qf.PUFFERS_AND_PARKAS,peacoats:Qf.COATS,puffer_jackets:Qf.PUFFERS_AND_PARKAS,raincoats:Qf.COATS,rompers:Qf.COATS,shackets:Qf.JACKETS,trench_coats:Qf.COATS},jeans:{bootcut:Qf.PANTS,flared:Qf.PANTS,mom:Qf.PANTS,relaxed:Qf.PANTS,skinny:Qf.PANTS,slim:Qf.PANTS,straight:Qf.PANTS,tapered:Qf.PANTS,wide_leg:Qf.PANTS},jumpsuits_and_rompers:{boiler_suits:Qf.DRESSES,denim:Qf.DRESSES,jumpsuits:Qf.DRESSES,overalls:Qf.DRESSES,rompers:Qf.DRESSES,unitards:Qf.DRESSES},pants_and_shorts:{cigarette:Qf.PANTS,culottes:Qf.SHORTS,denim_shorts:Qf.SHORTS,flared:Qf.PANTS,joggers:Qf.PANTS,leggings:Qf.PANTS,skinny:Qf.PANTS,wide_leg:Qf.PANTS},skirts:{a_line_flared:Qf.SKIRTS,denim:Qf.SKIRTS,knit:Qf.SKIRTS,pencil:Qf.SKIRTS,pleated:Qf.SKIRTS,skater:Qf.SKIRTS,slip:Qf.SKIRTS,wrap:Qf.SKIRTS},suits_and_tailoring:{blazers:Qf.JACKETS,suit_jackets:Qf.JACKETS,suit_skirts:Qf.SKIRTS,suit_trousers:Qf.PANTS,suit_vests:Qf.SWEATERS,trousers:Qf.PANTS},sweaters:{cardigans:Qf.SWEATERS,crewnecks:Qf.SWEATERS,hoodies_and_zipups:Qf.SWEATERS,sweatshirts:Qf.SWEATERS,turtlenecks:Qf.SWEATERS,v_necks:Qf.SWEATERS},tops:{bodysuits:Qf.BLOUSES,corsets_and_bustiers:Qf.BLOUSES,polos:Qf.T_SHIRTS_AND_TANKS,shirts_and_blouses:Qf.BLOUSES,t_shirts:Qf.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Qf.T_SHIRTS_AND_TANKS}};var ep;!function(e){e.TOO_TIGHT="too_tight",e.TIGHT="tight",e.SLIGHTLY_TIGHT="slightly_tight",e.PERFECT_FIT="perfect_fit",e.SLIGHTLY_LOOSE="slightly_loose",e.LOOSE="loose",e.OVERSIZED="oversized",e.TOO_SHORT="too_short",e.SHORT="short",e.SLIGHTLY_SHORT="slightly_short",e.SLIGHTLY_LONG="slightly_long",e.LONG="long",e.TOO_LONG="too_long"}(ep||(ep={}));const tp={[ep.TOO_TIGHT]:"Too Tight",[ep.TIGHT]:"Tight",[ep.SLIGHTLY_TIGHT]:"Slightly Tight",[ep.PERFECT_FIT]:"Perfect Fit",[ep.SLIGHTLY_LOOSE]:"Slightly Loose",[ep.LOOSE]:"Loose",[ep.OVERSIZED]:"Oversized",[ep.TOO_SHORT]:"Too Short",[ep.SHORT]:"Short",[ep.SLIGHTLY_SHORT]:"Slightly Short",[ep.SLIGHTLY_LONG]:"Slightly Long",[ep.LONG]:"Long",[ep.TOO_LONG]:"Too Long"};var np;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(np||(np={}));var ip=Object.freeze({__proto__:null,get AvatarState(){return np},Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],CategoryNames:Yf,get Classification(){return Qf},ClassificationLocations:Jf,get Fit(){return ep},FitNames:tp,get MeasurementLocation(){return Kf},MeasurementLocationName:Wf,SubcategoryNames:Xf,Taxonomy:Zf});class rp{constructor(e){this.vtoMainDivId=e,this.isInit=!1,this.currentSliderValue=0,this.slider=null}init(){if(this.isInit)return;const e=document.getElementById(this.vtoMainDivId);if(!e)throw new Error(`Element with id ${this.vtoMainDivId} not found`);e.innerHTML='\n <div class="tfr-slider-wrapper">\n <img id="tfr-tryon-image" src="" />\n <input type="range" id="tfr-slider" />\n </div>\n ';const t=document.getElementById("tfr-tryon-image");this.slider=n("tfr-slider",(e,n)=>{console.debug("slider change",e,n),t.src=n,this.currentSliderValue=parseInt(e.value)}),this.isInit=!0}onNewFramesReady(e){if(this.isInit||this.init(),Array.isArray(e)&&e.length>0){const t=Math.min(this.currentSliderValue,e.length-1),n=this.slider.Load(e,t);if(n instanceof Error)return void console.error(n);const i=document.getElementById("tfr-slider");if(i&&this.currentSliderValue<e.length){i.value=this.currentSliderValue.toString();document.getElementById("tfr-tryon-image").src=e[this.currentSliderValue]}}}}var sp="Back to sign in",op="Click here to download the app",ap="Don't have an account?",cp="Whoops! Looks like you don't have an avatar yet.",lp="Email address",up="Please enter a valid email address.",hp="Enter your email address, we will send you a link to reset your password.",dp="Forgot password?",fp="Have an account? Sign in",pp="Your avatar is loading...",gp="Unfortunately, that size is not available for try on.",mp="or",yp="Password",vp="Please enter a valid password (at least 7 characters).",wp="Return to Catalog Page",bp="Return to Product Page",_p="Return to site",Sp="Please return to The Fitting Room app to create your avatar.",Ep="Scan to download the app",Tp="Send",Ip="Sign back in",Cp="Sign in",kp="Something went wrong. Try again!",Ap="You have successfully logged out!",Rp="The Fitting Room",xp="Username or password is empty.",Np="Username or password is incorrect.",Op="End size uncertainty with",Lp="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";function Pp(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}Pp(".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)}");Pp('#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}}');Pp(".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)}");Pp("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}");Pp(".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)}}");Pp("@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}}");Pp('#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;padding-right:8px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:1;padding-left:8px;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}.tfr-try-on-button{align-items:center;background-color:var(--tfr-size-selector-bg-color-active);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);cursor:pointer;display:flex;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);height:var(--tfr-size-selector-button-height);justify-content:center;margin-bottom:10px;margin-top:20px;max-width:200px;position:relative;transition:all .15s ease-in;width:100%}.tfr-try-on-button.loading,.tfr-try-on-button:disabled{cursor:not-allowed;opacity:.7}.tfr-try-on-button.hide{display:none}.tfr-try-on-button.loading:after{animation:spin 1s linear infinite;border:2px solid var(--tfr-size-selector-text-color);border-radius:50%;border-top:2px solid transparent;content:"";height:16px;margin-left:8px;position:absolute;width:16px}@keyframes spin{to{transform:rotate(1turn)}}');Pp(".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%}");Pp(".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}");Pp(".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}");Pp(":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 Dp='\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>',Mp='<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>',Fp=e=>({Hook:()=>{const t=document.querySelector(".progress-bar-fill");!function(e,t){let n=0;const i=e/200;t.style.width=n+"%";const r=setInterval(()=>{n>=100?clearInterval(r):(n+=.5,t.style.width=n+"%")},i)}(e.timeoutMS,t)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${pp} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),zp=e=>{const t=document.getElementById(e),n=document.querySelector("body");if(!t)throw new Error(`element with id ${e} not found`);let i;const r=e=>e?`\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">${Op}</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">${Rp}</div>\n </div>\n </div>\n `:"",s=()=>{n.style.overflow="auto",i&&(i.Unhook(),l()),t.style.display="none"},o=e=>{"Escape"===e.key&&s()},a=e=>{const n=t.querySelector("#tfr-modal-background");e.target===n&&(console.debug("container close"),s())},c=()=>{t.querySelector("#tfr-close-container").addEventListener("click",s),document.addEventListener("keydown",o),document.addEventListener("click",a)},l=()=>{var n;const i=t.querySelector("#tfr-close-container");i?i.removeEventListener("click",s):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(e))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",o),document.removeEventListener("click",a)};return{open:e=>{var s,o;n.style.overflow="hidden",i&&i.Unhook(),t.innerHTML=(s=e.Body(),o=e.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(),e.Hook(),t.style.display="block",i=e},close:s,Content:()=>i}},Up=e=>{const t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{e.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 e,s,o;if(t||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),t){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(e=document.getElementById("tfr-sign-in-nav"))||void 0===e||e.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 e,t,s;null===(e=document.getElementById("tfr-sign-in-nav"))||void 0===e||e.removeEventListener("click",n),null===(t=document.getElementById("tfr-app-store"))||void 0===t||t.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">${Lp}</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 ${t?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${Ep}</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">${fp}</div>\n </div>`}\n </div>\n\n ${t?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${op}</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">${fp}</div>\n `:""}\n `,useFullModalContent:!0}};class Vp{constructor(e,t,n,i){this.signIn=t,this.forgotPassword=n,this.submitTel=i,this.manager=zp(e)}close(){this.manager.close()}onSignOut(){this.manager.open((e=>{const t=()=>{e.onNavSignIn("")},n=()=>{e.onClose()};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",t),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">${Ap}</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">${Ip}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${_p}</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">${cp}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Sp}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}onLoading(){this.manager.open(Fp({timeoutMS:1e4}))}toScan(){this.manager.open(Up({onSignInNav:()=>this.toSignIn(),onTelSubmit:e=>this.submitTel(e)}))}toSignIn(){this.manager.open((e=>{const{email:t}=e,n=t=>{t.preventDefault();const n=document.getElementById("email-input").value,i=document.getElementById("password-input").value;s(),e.onSignIn(n,i,o)},i=()=>{const t=document.getElementById("email-input").value;e.onNavForgotPassword(t)},r=()=>{e.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach(e=>{e.classList.remove("tfr-fieldset-err")}),document.querySelectorAll(".tfr-label-element").forEach(e=>{e.classList.remove("tfr-c-red")});const e=document.querySelector("#tfr-form-error");e.classList.remove("tfr-d-block"),e.innerHTML=""},o=e=>{document.querySelectorAll(".tfr-fieldset-element").forEach(e=>{e.classList.add("tfr-fieldset-err")}),document.querySelectorAll(".tfr-label-element").forEach(e=>{e.classList.add("tfr-c-red")});const t=document.querySelector("#tfr-form-error");t.innerHTML=e||"Something went wrong",t.classList.add("tfr-d-block")};return{Hook:()=>{var e,t,s,o;null===(e=document.getElementById("tfr-sign-in-form"))||void 0===e||e.addEventListener("submit",n),null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.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 e,t,s,o;null===(e=document.getElementById("tfr-sign-in-form"))||void 0===e||e.removeEventListener("submit",n),null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.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">${Cp}</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">${lp}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${t||""}" />\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">${yp}</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">${dp}</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">${ap}</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 ${Cp}\n </button>\n </form>\n `,useFullModalContent:!0}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((e=>{const t=()=>{const t=document.getElementById("tfr-email").value;e.onNavSignIn(t)},n=()=>{const t=document.getElementById("tfr-email").value;e.onPasswordReset(t)};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-send-password-reset"))||void 0===e||e.addEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.addEventListener("click",t)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-send-password-reset"))||void 0===e||e.removeEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.removeEventListener("click",t)},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">${hp}</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">${lp}</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">${sp}</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 ${Tp}\n </button>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(e){this.manager.open((e=>{let t=()=>{};const i=()=>{e.onNavBack()},r=()=>{e.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",(e,t)=>{console.debug("slider change",e,t),a.src=t});if(Array.isArray(e.frames)&&e.frames.length>0){const n=c.Load(e.frames);if(n instanceof Error)return void console.error(n);t=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 e,n;t(),null===(e=document.getElementById("tfr-back"))||void 0===e||e.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:e,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(e){this.manager.open((e=>{const{error:t}=e,n=()=>{e.onNavBack()},i=()=>{e.onClose()};return{Hook:()=>{var e,t;null===(e=document.getElementById("tfr-back"))||void 0===e||e.addEventListener("click",n),null===(t=document.getElementById("tfr-close"))||void 0===t||t.addEventListener("click",i)},Unhook:()=>{var e,t;null===(e=document.getElementById("tfr-back"))||void 0===e||e.removeEventListener("click",n),null===(t=document.getElementById("tfr-close"))||void 0===t||t.removeEventListener("click",i)},Body:()=>(t||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">${t||kp}</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">${wp}</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">${bp}</span>\n </div>\n `),useFullModalContent:!0}})({error:e,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(e,t){this.manager.open((e=>{const t=()=>{e.onNavBack()},n=()=>{e.onClose()};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-back"))||void 0===e||e.addEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-back"))||void 0===e||e.removeEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>{var t,n,i;return console.debug("rendering size error modal",e),`\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${gp} ${null===(t=e.sizes)||void 0===t?void 0:t.recommended} ${mp} ${null===(i=null===(n=e.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">${wp}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${bp}</span>\n </div>\n `},useFullModalContent:!0}})({sizes:{recommended:e,available:t},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}toFitInfo(){this.manager.open((e=>{const t=()=>e.onSignInNav();return{Hook:()=>{document.getElementById("cta-link").addEventListener("click",t)},Unhook:()=>{document.getElementById("cta-link").removeEventListener("click",t)},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">${Dp}</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 Bp{constructor(e,t,n,i,r){this.onSignInClick=t,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(e)}get sku(){return this._sku}setSku(e){this._sku=e}get styleId(){return this._styleId}setStyleId(e){this._styleId=e}setIsLoggedIn(e){this.isLoggedIn=e,this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",e?(this.tfrSizeHowItFits.style.opacity="1",this.tfrSizeRecSelect.style.opacity="1",this.tfrLoggedInElements.forEach(e=>e.style.display="block"),this.tfrLoggedOutElements.forEach(e=>e.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.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelectContainer.style.opacity="1"):(this.tfrSizeHowItFits.style.opacity="0.4",this.tfrSizeRecSelect.style.opacity="0.4",this.tfrLoggedInElements.forEach(e=>e.style.display="none"),this.tfrLoggedOutElements.forEach(e=>e.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(e){e?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(e){e&&e.length?this.renderGarmentLocations(e):this.tfrSizeRecTitle.style.display="none"}setRecommendedSize({recommended:e,sizes:t}){this.renderSizeRec(e,t)}setError(){this.tfrSizeRecTitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(e){const t=document.getElementById(e);if(!t)throw new Error("Size rec main div not found");this.render(t),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);const e=document.getElementById("tfr-try-on-button");e&&e.addEventListener("click",async()=>{if(e.classList.contains("loading"))return;const t=document.querySelector(".tfr-size-rec-select-button.active");if(!t)return;const n=Number(t.getAttribute("data-size-id"));if(Number.isNaN(n))return;e.classList.add("loading");const i=e.textContent;e.textContent=" ",e.setAttribute("disabled","true");try{const e=Array.from(document.querySelectorAll(".tfr-size-rec-select-button")),i=e.indexOf(t);if(null!==this.styleId){try{await this.onTryOnClick(this.styleId,n,!0)}catch(e){console.error(`Error trying on active size ${n}:`,e)}if(i>0){const t=e[i-1];await this._preloadNeighborVTO(t)}if(i>=0&&i<e.length-1){const t=e[i+1];await this._preloadNeighborVTO(t)}}}catch(e){console.error("Error during sequential try-on process:",e)}finally{e.classList.remove("loading"),e.textContent=i,e.removeAttribute("disabled")}})}async _preloadNeighborVTO(e){var t;const n=Number(e.getAttribute("data-size-id"));if(!Number.isNaN(n))try{await this.onTryOnClick(this.styleId,n,!1)}catch(i){const r=(null===(t=e.textContent)||void 0===t?void 0:t.trim())||"N/A";console.error(`Error pre-loading try-on for size ${n} (button: ${r}):`,i)}}onSizeRecSelectClick(e){const t=e.target;if(!t.classList.contains("tfr-size-rec-select-button")||t.classList.contains("tfr-disabled"))return;e.preventDefault();const n=Number(t.getAttribute("data-index"));if(Number.isNaN(n))return;const i=document.querySelectorAll(".tfr-size-rec-select-button");i.forEach(e=>e.classList.remove("active")),i.item(n).classList.add("active"),this.redraw(n);const r=Number(t.getAttribute("data-size-id"));Number.isNaN(r)||this.onTryOnClick(this.styleId,r,!0)}renderSizeRec(e,t){this.tfrSizeRecSize.innerHTML=`&nbsp;${e}`;const n=t.findIndex(({size:t})=>t===e);this.redraw=e=>this.renderSizeRecTable(t,e),this.redraw(n),this.renderSizeRecSelect(t,n)}renderSizeRecTable(e,t){const{locations:n}=e[t],i=n.map(({location:e,fit:t,isPerfect:n})=>this.renderSizeRecTableRow(e,t,n)).join("");this.tfrSizeRecTable.innerHTML=i}renderSizeRecSelect(e,t){const n=e.map(({size:e})=>e).map((n,i)=>`<div class="tfr-size-rec-select-button ${i===t?"active":""}" data-index="${i}" data-size-id="${e[i].size_id}">${n}</div>`).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecSelectLoggedOut(){const e=['<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=e}renderSizeRecTableRow(e,t,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${e}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${t}\n </div>\n </div>`}renderGarmentLocations(e){const t=e.map((e,t)=>this.renderSizeRecTableRow(e,this.randomFit(t),!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 ${t}\n </div>\n </div>`;this.tfrSizeRecTable.innerHTML=n}randomFit(e){const t=["Slightly Tight","Perfect Fit","Perfect Fit","Slightly Loose","Perfect Fit"];return t[e%t.length]}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrToggleOpenElements.forEach(e=>e.style.display="block"),this.tfrToggleClosedElements.forEach(e=>e.style.display="none")):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrToggleOpenElements.forEach(e=>e.style.display="none"),this.tfrToggleClosedElements.forEach(e=>e.style.display="block"))}render(e){const t=`<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">${Dp}</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 ${Mp} 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 ${Mp} 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\n <div id="tfr-try-on-button" class="tfr-try-on-button">Try On</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">${Dp}</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>`;e.innerHTML=t}}class jp{constructor(e,t,n,i,r,s,o){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.onTryOnClick=o,this.perfectFits=[ip.Fit.PERFECT_FIT,ip.Fit.SLIGHTLY_LOOSE,ip.Fit.SLIGHTLY_TIGHT],this.setCssVariables(t),this.sizeRecComponent=new Bp(e,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick,this.onTryOnClick)}get sku(){return this.sizeRecComponent.sku}setSku(e){this.sizeRecComponent.setSku(e)}get styleId(){return this.sizeRecComponent.styleId}setStyleId(e){this.sizeRecComponent.setStyleId(e)}setIsLoggedIn(e){this.sizeRecComponent.setIsLoggedIn(e)}async setGarmentLocations(e=[]){this.sizeRecComponent.setLoading(!0);const t=e.length>0?e:await this.getGarmentLocations(e);console.debug("locations",t),console.debug("filledLocations",e),this.sizeRecComponent.setGarmentLocations(t||[]),this.sizeRecComponent.setLoading(!1)}async recommendSize(){this.sizeRecComponent.setLoading(!0);const e=await this.getRecommendedSize();if(!e)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(e),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(e){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,e)}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(t.id,e)}catch(e){return console.error(e),this.sizeRecComponent.setError(),null}}}async getRecommendedSize(){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku),t=await this.getRecommendedSizes(String(e.style_id));return this.setStyleId(e.style_id),t}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku),t=await this.getRecommendedSizes(String(e.id));return this.setStyleId(e.id),t}catch(e){return console.error(e),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(e){const t=await this.tfrShop.getRecommendedSizes(e);return t?{recommended:t.recommended_size.size_value.name,sizes:t.fits.map(e=>({size:t.available_sizes.find(t=>t.id===e.size_id).size_value.name,size_id:e.size_id,locations:e.measurement_location_fits.map(e=>({fit:"string"==typeof e.fit_label&&e.fit_label?e.fit_label:ip.FitNames[e.fit],isPerfect:this.perfectFits.includes(e.fit),location:this.tfrShop.getMeasurementLocationName(e.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(e.measurement_location)})).sort((e,t)=>e.sortOrder<t.sortOrder?-1:1)}))}:null}setCssVariables(e){const t=document.querySelector(":root");e.brandColor&&t.style.setProperty("--tfr-brand-color",e.brandColor),e.black&&t.style.setProperty("--tfr-black",e.black),e.red&&t.style.setProperty("--tfr-red",e.red),e.white&&t.style.setProperty("--tfr-white",e.white),e.muted&&t.style.setProperty("--tfr-muted",e.muted),e.dark&&t.style.setProperty("--tfr-dark",e.dark),e.grey&&t.style.setProperty("--tfr-grey",e.grey),e.lightGrey&&t.style.setProperty("--tfr-light-grey",e.lightGrey),e.mainBorderColor&&t.style.setProperty("--tfr-main-border-color",e.mainBorderColor),e.mainBorderRadius&&t.style.setProperty("--tfr-main-border-radius",e.mainBorderRadius),e.mainBorderWidth&&t.style.setProperty("--tfr-main-border-width",e.mainBorderWidth),e.mainBgColor&&t.style.setProperty("--tfr-main-bg-color",e.mainBgColor),e.mainWidth&&t.style.setProperty("--tfr-main-width",e.mainWidth),e.mainVPadding&&t.style.setProperty("--tfr-main-v-padding",e.mainVPadding),e.mainHPadding&&t.style.setProperty("--tfr-main-h-padding",e.mainHPadding),e.mainFont&&t.style.setProperty("--tfr-main-font",e.mainFont),e.titleFont&&t.style.setProperty("--tfr-title-font",e.titleFont),e.subtitleFont&&t.style.setProperty("--tfr-subtitle-font",e.subtitleFont),e.rowFont&&t.style.setProperty("--tfr-row-font",e.rowFont),e.ctaFont&&t.style.setProperty("--tfr-cta-font",e.ctaFont),e.sizeSelectorTextColor&&t.style.setProperty("--tfr-size-selector-text-color",e.sizeSelectorTextColor),e.sizeSelectorFontSize&&t.style.setProperty("--tfr-size-selector-font-size",e.sizeSelectorFontSize),e.sizeSelectorFontWeight&&t.style.setProperty("--tfr-size-selector-font-weight",e.sizeSelectorFontWeight),e.sizeSelectorBgColor&&t.style.setProperty("--tfr-size-selector-bg-color",e.sizeSelectorBgColor),e.sizeSelectorBorderColor&&t.style.setProperty("--tfr-size-selector-border-color",e.sizeSelectorBorderColor),e.sizeSelectorBorderWidth&&t.style.setProperty("--tfr-size-selector-border-width",e.sizeSelectorBorderWidth),e.sizeSelectorBgColorHover&&t.style.setProperty("--tfr-size-selector-bg-color-hover",e.sizeSelectorBgColorHover),e.sizeSelectorBgColorActive&&t.style.setProperty("--tfr-size-selector-bg-color-active",e.sizeSelectorBgColorActive),e.sizeSelectorButtonHeight&&t.style.setProperty("--tfr-size-selector-button-height",e.sizeSelectorButtonHeight),e.sizeSelectorButtonActiveHeight&&t.style.setProperty("--tfr-size-selector-button-active-height",e.sizeSelectorButtonActiveHeight),e.sizeSelectorButtonActiveBorderColor&&t.style.setProperty("--tfr-size-selector-button-active-border-color",e.sizeSelectorButtonActiveBorderColor),e.sizeSelectorButtonActiveBorderWidth&&t.style.setProperty("--tfr-size-selector-button-active-border-width",e.sizeSelectorButtonActiveBorderWidth),e.sizeSelectorButtonRadius&&t.style.setProperty("--tfr-size-selector-button-radius",e.sizeSelectorButtonRadius),e.sizeSelectorButtonShadow&&t.style.setProperty("--tfr-size-selector-button-shadow",e.sizeSelectorButtonShadow)}}var Hp;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(Hp||(Hp={}));class $p{constructor(e,t,n,i,r={},s,o){this.shopId=e,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 Vp(t,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((e,t="dev")=>("dev"!==t&&"development"!==t||console.warn("TfrShop is in development mode"),Ql.getInstance().setEnv(t),new Gf(e,new jf)))(Number(this.shopId),a),this.tfrSizeRec=new jp(n,s,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.bind(this),this.onTryOnClick.bind(this)),i&&(this.vtoComponent=new rp(i))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async setSku(e){var t,n;this.tfrSizeRec.setSku(e);const i=await this.getStyle(this.sku);this.style=i,i.is_published?console.log(`style ${i.id} is published`):(document.getElementById("tfr-size-recommendations").style.display="none",console.log(`style ${i.id} is not published`)),console.log(`style ${i.id} virtual try on is disabled`),i.is_vto?null===(t=document.getElementById("tfr-try-on-button"))||void 0===t||t.classList.remove("hide"):null===(n=document.getElementById("tfr-try-on-button"))||void 0===n||n.classList.add("hide"),this.isLoggedIn?this.tfrSizeRec.recommendSize():this.setGarmentLocations(i)}async onInit(){var e,t;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(e=this.hooks)||void 0===e?void 0:e.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var e;await this.tfrShop.user.logout(),(null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(this.style),this.unsubscribeFromProfileChanges()}async signIn(e,t,n){var i;if(0==e.length||0==t.length)return n(xp);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(e))return n(up);if(!(e=>!!e.match(/^.{7,}$/))(t))return n(vp);try{await this.tfrShop.user.login(e,t),(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.recommendSize(),this.subscribeToProfileChanges()}catch(e){return n(Np)}}setBrandUserId(e){this.tfrShop.user.setBrandUserId(e)}async submitTel(e){try{await this.tfrShop.submitTelephoneNumber(e),this.tfrModal.toSignIn()}catch(e){this.tfrModal.onError(kp)}}async forgotPassword(e){await this.tfrShop.user.sendPasswordResetEmail(e),this.tfrModal.toSignIn()}async passwordReset(e,t){await this.tfrShop.user.confirmPasswordReset(e,t),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(e){return this.tfrShop.getMeasurementLocationsFromSku(e)}onSignInClick(){this.tfrModal.toScan()}onFitInfoClick(){this.tfrModal.toFitInfo()}async onTryOnClick(e,t,n=!0){if(!this.vtoComponent)return console.error("VtoComponent is not initialized. Please check if the vtoMainDivId is correct.");const i=await this.shop.tryOn(e,t);if(n)try{this.vtoComponent.init(),this.vtoComponent.onNewFramesReady(i)}catch(e){console.error("Error initializing VTO:",e),this.tfrModal.onError(kp)}}onUserProfileChange(e){var t,n,i,r;switch(e.avatar_status){case Hp.NOT_CREATED:(null===(t=this.hooks)||void 0===t?void 0:t.onError)&&this.hooks.onError(cp),this.tfrModal.onNotCreated();break;case Hp.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Hp.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(kp),this.tfrModal.onError(kp)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges(e=>this.onUserProfileChange(e)))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(e){var t,n;const i=(null===(n=null===(t=null==e?void 0:e.sizes)||void 0===t?void 0:t[0])||void 0===n?void 0:n.garment_measurements.map(e=>e.measurement_location))||[];this.tfrSizeRec.setGarmentLocations(i)}async getStyle(e){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(e);return await this.tfrShop.getStyle(t.style_id)}catch(t){try{return await this.tfrShop.getStyleByBrandStyleId(e)}catch(e){return null}}}}const qp=async({shopId:e,modalDivId:t,sizeRecMainDivId:n,vtoMainDivId:i,hooks:r={},cssVariables:s={},env:o="dev"})=>{const a=new $p(e,t,n,i,r,s,o);return await a.onInit(),a};export{n as InitImageSlider,qp as initFittingRoom};
3398
+ const xf=d("authIdTokenMaxAge")||300;let Nf=null;function Of(e=Ke()){const t=Be(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=Be(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(T(n.getOptions(),null!=t?t:{}))return e;Lu(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Cf,persistence:[jd,Id,kd]}),i=d("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(i,location.origin);if(location.origin===e.origin){const t=(r=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>xf)return;const i=null==t?void 0:t.token;Nf!==i&&(Nf=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(e,t,n){N(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,i){N(e).onIdTokenChanged(t,n,i)}(n,e=>t(e))}}var r;const s=u("auth");return s&&Jh(n,`http://${s}`),n}var Lf;jh={loadJS:e=>new Promise((t,n)=>{const i=document.createElement("script");var r,s;i.setAttribute("src",e),i.onload=t,i.onerror=e=>{const t=Pu("internal-error");t.customData=e,n(t)},i.type="text/javascript",i.charset="UTF-8",(null!==(s=null===(r=document.getElementsByTagName("head"))||void 0===r?void 0:r[0])&&void 0!==s?s: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="},Lf="Browser",Ve(new O("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),r=e.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Fu(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:Lf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Mh(Lf)},c=new Uh(n,i,r,a);return function(e,t){const n=(null==t?void 0:t.persistence)||[],i=(Array.isArray(n)?n:[n]).map(bh);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,null==t?void 0:t.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Ve(new O("auth-internal",e=>(e=>new Rf(e))(Vh(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),We(kf,Af,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Lf)),We(kf,Af,"esm2017");class Pf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Df extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Mf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class zf extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Ff extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Uf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Vf="avatar not created";class Bf{constructor(e,t){this.firestore=e,this.brandUserId=null,this.auth=Of(t),this.auth.setPersistence(Id)}get id(){var e;return null===(e=this.user)||void 0===e?void 0:e.uid}async onInit(e){this.auth.onAuthStateChanged(t=>{this.setUser(t),t&&(this.logUserLogin(e,t),this.setBrandUserId(t.uid))}),await this.auth.authStateReady();const t=this.auth.currentUser;return this.setUser(t),this.setBrandUserId(null==t?void 0:t.uid),Boolean(t)}setUser(e){this.user=e}async logUserLogin(e,t){var n,i,r,s,o;try{const a=Wc(this.firestore,"user_logging",t.uid),c=await Hl(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[e])||void 0===i?void 0:i.last_login;if(h&&Su(l).diff(Su(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[e])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[e]:{brand_id:e,last_login:l,logins:d}},last_brand_id:e,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Gl(a,f,{merge:!0})}catch(e){console.error("LOGGING ERROR:",e)}}setBrandUserId(e){this.brandUserId=e}async getToken(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Df;return await this.user.getIdToken()}get userId(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Df;return this.user.uid}async getUserProfile(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Df;return(await Hl(Wc(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(e){let t;const n=xl(Kc(this.firestore,"users"),Ol(rl(),"==",this.id));return t=Kl(n,t=>e(t.docs[0].data())),()=>t()}watchUserProfileForFrames(e){let t;const n=xl(Kc(this.firestore,"users"),Ol(rl(),"==",this.id));return new Promise(i=>{t=Kl(n,async n=>{await e(n)&&(t(),i(n.docs[0].data()))})})}async login(e,t){this.auth.currentUser&&await this.auth.signOut();const n=await _d(this.auth,e,t);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(e){await async function(e,t){const n=Vh(e),i={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await Qh(n,i,"getOobCode",nd)}(this.auth,e)}async confirmPasswordReset(e,t){await bd(this.auth,e,t)}}class jf{constructor(){this.promisefyOnSnapshot=(e,t)=>{let n;return{promise:new Promise(i=>{n=Kl(e,e=>{i(e),t&&n()})}),unsubscribe:()=>n()}};const e=Ge(Ql.getInstance().firebase);this.firestore=el(e),this.user=new Bf(this.firestore,e)}onInit(e){return this.user.onInit(e)}query(e,t,n=!0){const i=xl(Kc(this.firestore,e),t);return this.promisefyOnSnapshot(i,n)}getDocs(e,t){return ql(xl(Kc(this.firestore,e),...t))}async getDoc(e,t){const n=Wc(this.firestore,e,t),i=await Hl(n);return i.exists()?i.data():null}}const Hf=e=>{if(e.code===xu)throw new Error("account has been disabled");throw new Error(e.message)};class $f{static get endpoint(){return Ql.getInstance().api.url}static async Fetch({user:e,endpointPath:t,method:n,body:i,useToken:r=!0}){const s=this.getUrl(t,r),o={method:n,headers:await this.getHeaders(e,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(e,t){return t?`${this.endpoint}/v1${e}`:this.endpoint+e}static async getHeaders(e,t){if(!t)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await e.getToken()}`}}static Get(e,t,n){return this.Fetch({user:e,endpointPath:t,method:"GET",body:null,useToken:n})}static Post(e,t,n=null,i){return this.Fetch({user:e,endpointPath:t,method:"POST",body:n,useToken:i})}static Put(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"PUT",body:n,useToken:i})}static Patch(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"PATCH",body:n,useToken:i})}static Delete(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"DELETE",body:n,useToken:i})}}const qf=e=>{const t=new Image;return t.src=e,new Promise(e=>{t.onerror=()=>e(!1),t.onload=()=>e(!0)})};class Gf{constructor(e,t){this.brandId=e,this.firebase=t,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(e){var t,n;if(!this.isLoggedIn)throw new Df;try{const i=await $f.Get(this.user,`/styles/${e}/recommendation`),r=await i.json();return(null===(t=null==r?void 0:r.fits)||void 0===t?void 0:t.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(e){if((null==e?void 0:e.error)===Vf)throw new Pf;throw e}}async submitTelephoneNumber(e){const t=e.replace(/[^\+0-9]/g,""),n=await $f.Post(this.user,"/ios-app-link",{phone_number:t},!1);console.log(n)}async getColorwaySizeAssetFromSku(e){const t=await this.getColorwaySizeAssets(null,[e]);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getColorwaySizeAssetFromBrandStyleId(e){const t=await this.getColorwaySizeAssets(e);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getMeasurementLocationsFromSku(e,t=[]){console.log({sku:e});const n=await this.getColorwaySizeAssetFromSku(e);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(t.length?r.measurement_locations.female.filter(e=>t.includes(e)):r.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getMeasurementLocationsFromBrandStyleId(e,t=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(e);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(t.length?r.measurement_locations.female.filter(e=>t.includes(e)):r.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getStyleByBrandStyleId(e){var t,n;try{const i=[Ol("brand_id","==",this.brandId)];i.push(Ol("brand_style_id","==",e));return null===(n=null===(t=(await this.firebase.getDocs("styles",i)).docs)||void 0===t?void 0:t[0])||void 0===n?void 0:n.data()}catch(e){return Hf(e)}}async getColorwaySizeAssets(e,t){const n=[Ol("brand_id","==",this.brandId)];e&&n.push(Ol("style_id","==",e)),(null==t?void 0:t.length)>0&&n.push(Ol("sku","in",t));try{const e=await this.firebase.getDocs("colorway_size_assets",n),t=new Map;return e.forEach(e=>{const n=e.data();t.set(n.id,n)}),t}catch(e){return Hf(e)}}async getStyle(e){try{return await this.firebase.getDoc("styles",String(e))}catch(e){return Hf(e)}}getMeasurementLocationName(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).name:e}getMeasurementLocationSortOrder(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).sort_order:1/0}async tryOn(e,t){if(!this.isLoggedIn)throw new Df;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t);try{return await this.getColorwaySizeAssetFrames(n)}catch(e){if(!(e instanceof Ff))throw e;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t){var n,i,r;try{const s=[Ol("brand_id","==",this.brandId)];s.push(Ol("style_id","==",e)),s.push(Ol("size_id","==",t));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(e){return Hf(e)}}async getGetTaxonomy(e){try{return await this.firebase.getDoc("style_garment_categories",String(e))}catch(e){return Hf(e)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach(e=>{this.measurementLocations.set(e.name,{name:e.garment_label,sort_order:e.sort_order})})}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map(e=>e.data())}catch(e){return Hf(e)}}async requestThenGetColorwaySizeAssetFrames(e){const[t,n]=await(i=this.getColorwaySizeAssetFromSku(e),i.then(e=>[null,e]).catch(e=>[e]));var i;if(t)throw t;try{try{this.requestColorwaySizeAssetFrames(n.id)}catch(e){}return this.awaitColorwaySizeAssetFrames(e)}catch(t){if((null==t?void 0:t.error)===Vf)throw new Pf;throw new Uf}}async awaitColorwaySizeAssetFrames(e){var t,n,i,r;if(!this.isLoggedIn)throw new Df;const s=await this.user.watchUserProfileForFrames(async t=>{var n,i,r,s;const o=null===(s=null===(r=null===(i=null===(n=t.docs[0].data())||void 0===n?void 0:n.vto)||void 0===i?void 0:i[this.brandId])||void 0===r?void 0:r[e])||void 0===s?void 0:s.frames;return!!(null==o?void 0:o.length)&&qf(o[0])});if(!(null===(r=null===(i=null===(n=null===(t=null==s?void 0:s.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===i?void 0:i.frames)||void 0===r?void 0:r.length))throw new Ff;return s.vto[this.brandId][e].frames}async requestColorwaySizeAssetFrames(e){if(!this.isLoggedIn)throw new Df;if(!this.user.brandUserId)throw new zf;await $f.Post(this.user,`/colorway-size-assets/${e}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(e){var t,n,i;const r=await this.user.getUserProfile(),s=(null===(i=null===(n=null===(t=null==r?void 0:r.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===i?void 0:i.frames)||[];if(!s.length)throw new Ff;if(!await qf(s[0]))throw new Ff;return s}}var Kf;!function(e){e.ACROSS_BACK="across_back",e.ACROSS_FRONT="across_front",e.ACROSS_SHOULDER="across_shoulder",e.ANKLE="ankle",e.ARMEYE="arm_eye",e.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",e.BACK_CROTCH_LENGTH="back_crotch_length",e.BACK_NECK_TO_EBLOW="back_neck_to_elbow",e.BELOW_KNEE="below_knee",e.BICEP="bicep",e.BUST="bust",e.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",e.CALF="calf",e.CB_NECK_TO_WAIST="cb_neck_to_waist",e.CB_NECK_TO_WRIST="cb_neck_to_wrist",e.CF_NECK_TO_WAIST="cf_neck_to_waist",e.ELBOW="elbow",e.FOREARM="forearm",e.FRONT_CROTCH_LENGTH="front_crotch_length",e.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",e.HIGH_HIP="high_hip",e.HSP_TO_ACROSS_BACK="hsp_to_across_back",e.HSP_TO_ACROSS_FRONT="hsp_to_across_front",e.HSP_TO_BUST_POINT="hsp_to_bust_point",e.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",e.HSP_TO_WAIST_POSITION="hsp_to_waist_position",e.INSEAM="inseam",e.KNEE="knee",e.LOW_HIP="low_hip",e.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",e.MID_NECK="mid_neck",e.NECK_AT_BASE="neck_base",e.SHOULDER_DROP="shoulder_drop",e.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",e.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",e.SIDE_WAIST_TO_KNEE="side_waist_to_knee",e.THIGH="thigh",e.TOTAL_RISE_LENGTH="total_rise_length",e.UNDER_BUST="under_bust",e.VERTICAL_TRUNK="vertical_trunk",e.WAIST="waist",e.WRIST="wrist"}(Kf||(Kf={}));const Wf={[Kf.ACROSS_BACK]:"Across back",[Kf.ACROSS_FRONT]:"Across front",[Kf.ACROSS_SHOULDER]:"Across shoulder",[Kf.ANKLE]:"Ankle",[Kf.ARMEYE]:"Armeye",[Kf.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Kf.BACK_CROTCH_LENGTH]:"Back crotch length",[Kf.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Kf.BELOW_KNEE]:"Below knee",[Kf.BICEP]:"Bicep",[Kf.BUST]:"Chest/Bust",[Kf.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Kf.CALF]:"Calf",[Kf.CB_NECK_TO_WAIST]:"Cb neck to waist",[Kf.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Kf.CF_NECK_TO_WAIST]:"Cf neck to waist",[Kf.ELBOW]:"Elbow",[Kf.FOREARM]:"Forearm",[Kf.FRONT_CROTCH_LENGTH]:"Front crotch length",[Kf.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Kf.HIGH_HIP]:"High hip",[Kf.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Kf.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Kf.HSP_TO_BUST_POINT]:"Hsp to bust point",[Kf.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Kf.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Kf.INSEAM]:"Inseam",[Kf.KNEE]:"Knee",[Kf.LOW_HIP]:"Low hip",[Kf.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Kf.MID_NECK]:"Mid neck",[Kf.NECK_AT_BASE]:"Neck at base",[Kf.SHOULDER_DROP]:"Shoulder drop",[Kf.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Kf.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Kf.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Kf.THIGH]:"Thigh",[Kf.TOTAL_RISE_LENGTH]:"Total rise length",[Kf.UNDER_BUST]:"Under bust",[Kf.VERTICAL_TRUNK]:"Vertical trunk",[Kf.WAIST]:"Waist",[Kf.WRIST]:"Wrist"};var Qf;!function(e){e.BLOUSES="blouses",e.COATS="coats",e.DRESSES="dresses",e.JACKETS="jackets",e.PANTS="pants",e.PUFFERS_AND_PARKAS="puffer_and_parkas",e.SHORTS="shorts",e.SKIRTS="skirts",e.SWEATERS="sweaters",e.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Qf||(Qf={}));const Jf={[Qf.BLOUSES]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.COATS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.DRESSES]:[Kf.LOW_HIP,Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST],[Qf.JACKETS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.PANTS]:[Kf.LOW_HIP,Kf.WAIST,Kf.THIGH,Kf.INSEAM],[Qf.PUFFERS_AND_PARKAS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.SHORTS]:[Kf.LOW_HIP,Kf.WAIST,Kf.THIGH,Kf.INSEAM],[Qf.SKIRTS]:[Kf.LOW_HIP,Kf.WAIST],[Qf.SWEATERS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP],[Qf.T_SHIRTS_AND_TANKS]:[Kf.BUST,Kf.ACROSS_SHOULDER,Kf.WAIST,Kf.LOW_HIP,Kf.HIGH_HIP]},Yf={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"},Xf={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"},Zf={activewear:{leggings:Qf.PANTS,joggers:Qf.PANTS,sweatshirts:Qf.SWEATERS},dresses:{a_line:Qf.DRESSES,bodycon:Qf.DRESSES,fit_and_flare:Qf.DRESSES,knit:Qf.DRESSES,shirt:Qf.DRESSES,slip:Qf.DRESSES,straight:Qf.DRESSES,wrap:Qf.DRESSES},jackets_and_coats:{denim_jackets:Qf.JACKETS,parkas:Qf.PUFFERS_AND_PARKAS,peacoats:Qf.COATS,puffer_jackets:Qf.PUFFERS_AND_PARKAS,raincoats:Qf.COATS,rompers:Qf.COATS,shackets:Qf.JACKETS,trench_coats:Qf.COATS},jeans:{bootcut:Qf.PANTS,flared:Qf.PANTS,mom:Qf.PANTS,relaxed:Qf.PANTS,skinny:Qf.PANTS,slim:Qf.PANTS,straight:Qf.PANTS,tapered:Qf.PANTS,wide_leg:Qf.PANTS},jumpsuits_and_rompers:{boiler_suits:Qf.DRESSES,denim:Qf.DRESSES,jumpsuits:Qf.DRESSES,overalls:Qf.DRESSES,rompers:Qf.DRESSES,unitards:Qf.DRESSES},pants_and_shorts:{cigarette:Qf.PANTS,culottes:Qf.SHORTS,denim_shorts:Qf.SHORTS,flared:Qf.PANTS,joggers:Qf.PANTS,leggings:Qf.PANTS,skinny:Qf.PANTS,wide_leg:Qf.PANTS},skirts:{a_line_flared:Qf.SKIRTS,denim:Qf.SKIRTS,knit:Qf.SKIRTS,pencil:Qf.SKIRTS,pleated:Qf.SKIRTS,skater:Qf.SKIRTS,slip:Qf.SKIRTS,wrap:Qf.SKIRTS},suits_and_tailoring:{blazers:Qf.JACKETS,suit_jackets:Qf.JACKETS,suit_skirts:Qf.SKIRTS,suit_trousers:Qf.PANTS,suit_vests:Qf.SWEATERS,trousers:Qf.PANTS},sweaters:{cardigans:Qf.SWEATERS,crewnecks:Qf.SWEATERS,hoodies_and_zipups:Qf.SWEATERS,sweatshirts:Qf.SWEATERS,turtlenecks:Qf.SWEATERS,v_necks:Qf.SWEATERS},tops:{bodysuits:Qf.BLOUSES,corsets_and_bustiers:Qf.BLOUSES,polos:Qf.T_SHIRTS_AND_TANKS,shirts_and_blouses:Qf.BLOUSES,t_shirts:Qf.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Qf.T_SHIRTS_AND_TANKS}};var ep;!function(e){e.TOO_TIGHT="too_tight",e.TIGHT="tight",e.SLIGHTLY_TIGHT="slightly_tight",e.PERFECT_FIT="perfect_fit",e.SLIGHTLY_LOOSE="slightly_loose",e.LOOSE="loose",e.OVERSIZED="oversized",e.TOO_SHORT="too_short",e.SHORT="short",e.SLIGHTLY_SHORT="slightly_short",e.SLIGHTLY_LONG="slightly_long",e.LONG="long",e.TOO_LONG="too_long"}(ep||(ep={}));const tp={[ep.TOO_TIGHT]:"Too Tight",[ep.TIGHT]:"Tight",[ep.SLIGHTLY_TIGHT]:"Slightly Tight",[ep.PERFECT_FIT]:"Perfect Fit",[ep.SLIGHTLY_LOOSE]:"Slightly Loose",[ep.LOOSE]:"Loose",[ep.OVERSIZED]:"Oversized",[ep.TOO_SHORT]:"Too Short",[ep.SHORT]:"Short",[ep.SLIGHTLY_SHORT]:"Slightly Short",[ep.SLIGHTLY_LONG]:"Slightly Long",[ep.LONG]:"Long",[ep.TOO_LONG]:"Too Long"};var np;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(np||(np={}));var ip=Object.freeze({__proto__:null,get AvatarState(){return np},Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],CategoryNames:Yf,get Classification(){return Qf},ClassificationLocations:Jf,get Fit(){return ep},FitNames:tp,get MeasurementLocation(){return Kf},MeasurementLocationName:Wf,SubcategoryNames:Xf,Taxonomy:Zf});class rp{constructor(e){this.vtoMainDivId=e,this.isInit=!1,this.currentSliderValue=0,this.slider=null}init(){if(this.isInit)return;const e=document.getElementById(this.vtoMainDivId);if(!e)throw new Error(`Element with id ${this.vtoMainDivId} not found`);e.innerHTML='\n <div class="tfr-slider-wrapper">\n <img id="tfr-tryon-image" src="" />\n <input type="range" id="tfr-slider" />\n </div>\n ';const t=document.getElementById("tfr-tryon-image");this.slider=n("tfr-slider",(e,n)=>{console.debug("slider change",e,n),t.src=n,this.currentSliderValue=parseInt(e.value)}),this.isInit=!0}onNewFramesReady(e){if(this.isInit||this.init(),Array.isArray(e)&&e.length>0){const t=Math.min(this.currentSliderValue,e.length-1),n=this.slider.Load(e,t);if(n instanceof Error)return void console.error(n);const i=document.getElementById("tfr-slider");if(i&&this.currentSliderValue<e.length){i.value=this.currentSliderValue.toString();document.getElementById("tfr-tryon-image").src=e[this.currentSliderValue]}}}}var sp="Back to sign in",op="Click here to download the app",ap="Don't have an account?",cp="Whoops! Looks like you don't have an avatar yet.",lp="Email address",up="Please enter a valid email address.",hp="Enter your email address, we will send you a link to reset your password.",dp="Forgot password?",fp="Have an account? Sign in",pp="Your avatar is loading...",gp="Unfortunately, that size is not available for try on.",mp="or",yp="Password",vp="Please enter a valid password (at least 7 characters).",wp="Return to Catalog Page",bp="Return to Product Page",_p="Return to site",Sp="Please return to The Fitting Room app to create your avatar.",Ep="Scan to download the app",Tp="Send",Ip="Sign back in",Cp="Sign in",kp="Something went wrong. Try again!",Ap="You have successfully logged out!",Rp="The Fitting Room",xp="Username or password is empty.",Np="Username or password is incorrect.",Op="End size uncertainty with",Lp="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";function Pp(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===n&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}Pp(".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)}");Pp('#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}}');Pp(".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)}");Pp("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}");Pp(".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)}}");Pp("@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}}");Pp('#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;padding-right:8px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:1;padding-left:8px;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}.tfr-try-on-button{align-items:center;background-color:var(--tfr-size-selector-bg-color-active);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);cursor:pointer;display:flex;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);height:var(--tfr-size-selector-button-height);justify-content:center;margin-bottom:10px;margin-top:20px;max-width:200px;position:relative;transition:all .15s ease-in;width:100%}.tfr-try-on-button.loading,.tfr-try-on-button:disabled{cursor:not-allowed;opacity:.7}.tfr-try-on-button.hide{display:none}.tfr-try-on-button.loading:after{animation:spin 1s linear infinite;border:2px solid var(--tfr-size-selector-text-color);border-radius:50%;border-top:2px solid transparent;content:"";height:16px;margin-left:8px;position:absolute;width:16px}@keyframes spin{to{transform:rotate(1turn)}}');Pp(".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%}");Pp(".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}");Pp(".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}");Pp(":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 Dp='\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>',Mp='<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>',zp=e=>({Hook:()=>{const t=document.querySelector(".progress-bar-fill");!function(e,t){let n=0;const i=e/200;t.style.width=n+"%";const r=setInterval(()=>{n>=100?clearInterval(r):(n+=.5,t.style.width=n+"%")},i)}(e.timeoutMS,t)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${pp} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),Fp=e=>{const t=document.getElementById(e),n=document.querySelector("body");if(!t)throw new Error(`element with id ${e} not found`);let i;const r=e=>e?`\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">${Op}</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">${Rp}</div>\n </div>\n </div>\n `:"",s=()=>{n.style.overflow="auto",i&&(i.Unhook(),l()),t.style.display="none"},o=e=>{"Escape"===e.key&&s()},a=e=>{const n=t.querySelector("#tfr-modal-background");e.target===n&&(console.debug("container close"),s())},c=()=>{t.querySelector("#tfr-close-container").addEventListener("click",s),document.addEventListener("keydown",o),document.addEventListener("click",a)},l=()=>{var n;const i=t.querySelector("#tfr-close-container");i?i.removeEventListener("click",s):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(e))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",o),document.removeEventListener("click",a)};return{open:e=>{var s,o;n.style.overflow="hidden",i&&i.Unhook(),t.innerHTML=(s=e.Body(),o=e.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(),e.Hook(),t.style.display="block",i=e},close:s,Content:()=>i}},Up=e=>{const t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{e.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 e,s,o;if(t||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),t){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(e=document.getElementById("tfr-sign-in-nav"))||void 0===e||e.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 e,t,s;null===(e=document.getElementById("tfr-sign-in-nav"))||void 0===e||e.removeEventListener("click",n),null===(t=document.getElementById("tfr-app-store"))||void 0===t||t.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">${Lp}</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 ${t?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${Ep}</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">${fp}</div>\n </div>`}\n </div>\n\n ${t?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${op}</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">${fp}</div>\n `:""}\n `,useFullModalContent:!0}};class Vp{constructor(e,t,n,i){this.signIn=t,this.forgotPassword=n,this.submitTel=i,this.manager=Fp(e)}close(){this.manager.close()}onSignOut(){this.manager.open((e=>{const t=()=>{e.onNavSignIn("")},n=()=>{e.onClose()};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",t),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">${Ap}</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">${Ip}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${_p}</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">${cp}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Sp}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}onLoading(){this.manager.open(zp({timeoutMS:1e4}))}toScan(){this.manager.open(Up({onSignInNav:()=>this.toSignIn(),onTelSubmit:e=>this.submitTel(e)}))}toSignIn(){this.manager.open((e=>{const{email:t}=e,n=t=>{t.preventDefault();const n=document.getElementById("email-input").value,i=document.getElementById("password-input").value;s(),e.onSignIn(n,i,o)},i=()=>{const t=document.getElementById("email-input").value;e.onNavForgotPassword(t)},r=()=>{e.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach(e=>{e.classList.remove("tfr-fieldset-err")}),document.querySelectorAll(".tfr-label-element").forEach(e=>{e.classList.remove("tfr-c-red")});const e=document.querySelector("#tfr-form-error");e.classList.remove("tfr-d-block"),e.innerHTML=""},o=e=>{document.querySelectorAll(".tfr-fieldset-element").forEach(e=>{e.classList.add("tfr-fieldset-err")}),document.querySelectorAll(".tfr-label-element").forEach(e=>{e.classList.add("tfr-c-red")});const t=document.querySelector("#tfr-form-error");t.innerHTML=e||"Something went wrong",t.classList.add("tfr-d-block")};return{Hook:()=>{var e,t,s,o;null===(e=document.getElementById("tfr-sign-in-form"))||void 0===e||e.addEventListener("submit",n),null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.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 e,t,s,o;null===(e=document.getElementById("tfr-sign-in-form"))||void 0===e||e.removeEventListener("submit",n),null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.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">${Cp}</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">${lp}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${t||""}" />\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">${yp}</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">${dp}</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">${ap}</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 ${Cp}\n </button>\n </form>\n `,useFullModalContent:!0}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((e=>{const t=()=>{const t=document.getElementById("tfr-email").value;e.onNavSignIn(t)},n=()=>{const t=document.getElementById("tfr-email").value;e.onPasswordReset(t)};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-send-password-reset"))||void 0===e||e.addEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.addEventListener("click",t)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-send-password-reset"))||void 0===e||e.removeEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.removeEventListener("click",t)},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">${hp}</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">${lp}</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">${sp}</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 ${Tp}\n </button>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(e){this.manager.open((e=>{let t=()=>{};const i=()=>{e.onNavBack()},r=()=>{e.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",(e,t)=>{console.debug("slider change",e,t),a.src=t});if(Array.isArray(e.frames)&&e.frames.length>0){const n=c.Load(e.frames);if(n instanceof Error)return void console.error(n);t=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 e,n;t(),null===(e=document.getElementById("tfr-back"))||void 0===e||e.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:e,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(e){this.manager.open((e=>{const{error:t}=e,n=()=>{e.onNavBack()},i=()=>{e.onClose()};return{Hook:()=>{var e,t;null===(e=document.getElementById("tfr-back"))||void 0===e||e.addEventListener("click",n),null===(t=document.getElementById("tfr-close"))||void 0===t||t.addEventListener("click",i)},Unhook:()=>{var e,t;null===(e=document.getElementById("tfr-back"))||void 0===e||e.removeEventListener("click",n),null===(t=document.getElementById("tfr-close"))||void 0===t||t.removeEventListener("click",i)},Body:()=>(t||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">${t||kp}</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">${wp}</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">${bp}</span>\n </div>\n `),useFullModalContent:!0}})({error:e,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(e,t){this.manager.open((e=>{const t=()=>{e.onNavBack()},n=()=>{e.onClose()};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-back"))||void 0===e||e.addEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-back"))||void 0===e||e.removeEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>{var t,n,i;return console.debug("rendering size error modal",e),`\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${gp} ${null===(t=e.sizes)||void 0===t?void 0:t.recommended} ${mp} ${null===(i=null===(n=e.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">${wp}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${bp}</span>\n </div>\n `},useFullModalContent:!0}})({sizes:{recommended:e,available:t},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}toFitInfo(){this.manager.open((e=>{const t=()=>e.onSignInNav();return{Hook:()=>{document.getElementById("cta-link").addEventListener("click",t)},Unhook:()=>{document.getElementById("cta-link").removeEventListener("click",t)},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">${Dp}</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 Bp{constructor(e,t,n,i,r){this.onSignInClick=t,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(e)}get sku(){return this._sku}setSku(e){this._sku=e}get styleId(){return this._styleId}setStyleId(e){this._styleId=e}setIsLoggedIn(e){this.isLoggedIn=e,this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",e?(this.tfrSizeHowItFits.style.opacity="1",this.tfrSizeRecSelect.style.opacity="1",this.tfrLoggedInElements.forEach(e=>e.style.display="block"),this.tfrLoggedOutElements.forEach(e=>e.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.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelectContainer.style.opacity="1"):(this.tfrSizeHowItFits.style.opacity="0.4",this.tfrSizeRecSelect.style.opacity="0.4",this.tfrLoggedInElements.forEach(e=>e.style.display="none"),this.tfrLoggedOutElements.forEach(e=>e.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(e){e?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(e){e&&e.length?this.renderGarmentLocations(e):this.tfrSizeRecTitle.style.display="none"}setRecommendedSize({recommended:e,sizes:t}){this.renderSizeRec(e,t)}setError(){this.tfrSizeRecTitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}hide(){this.sizeRecMainDiv&&(this.sizeRecMainDiv.style.display="none")}show(){this.sizeRecMainDiv&&(this.sizeRecMainDiv.style.display="block")}init(e){const t=document.getElementById(e);if(!t)throw new Error("Size rec main div not found");this.sizeRecMainDiv=t,this.render(t),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);const e=document.getElementById("tfr-try-on-button");e&&e.addEventListener("click",async()=>{if(e.classList.contains("loading"))return;const t=document.querySelector(".tfr-size-rec-select-button.active");if(!t)return;const n=Number(t.getAttribute("data-size-id"));if(Number.isNaN(n))return;e.classList.add("loading");const i=e.textContent;e.textContent=" ",e.setAttribute("disabled","true");try{const e=Array.from(document.querySelectorAll(".tfr-size-rec-select-button")),i=e.indexOf(t);if(null!==this.styleId){try{await this.onTryOnClick(this.styleId,n,!0)}catch(e){console.error(`Error trying on active size ${n}:`,e)}if(i>0){const t=e[i-1];await this._preloadNeighborVTO(t)}if(i>=0&&i<e.length-1){const t=e[i+1];await this._preloadNeighborVTO(t)}}}catch(e){console.error("Error during sequential try-on process:",e)}finally{e.classList.remove("loading"),e.textContent=i,e.removeAttribute("disabled")}})}async _preloadNeighborVTO(e){var t;const n=Number(e.getAttribute("data-size-id"));if(!Number.isNaN(n))try{await this.onTryOnClick(this.styleId,n,!1)}catch(i){const r=(null===(t=e.textContent)||void 0===t?void 0:t.trim())||"N/A";console.error(`Error pre-loading try-on for size ${n} (button: ${r}):`,i)}}onSizeRecSelectClick(e){const t=e.target;if(!t.classList.contains("tfr-size-rec-select-button")||t.classList.contains("tfr-disabled"))return;e.preventDefault();const n=Number(t.getAttribute("data-index"));if(Number.isNaN(n))return;const i=document.querySelectorAll(".tfr-size-rec-select-button");i.forEach(e=>e.classList.remove("active")),i.item(n).classList.add("active"),this.redraw(n);const r=Number(t.getAttribute("data-size-id"));Number.isNaN(r)||this.onTryOnClick(this.styleId,r,!0)}renderSizeRec(e,t){this.tfrSizeRecSize.innerHTML=`&nbsp;${e}`;const n=t.findIndex(({size:t})=>t===e);this.redraw=e=>this.renderSizeRecTable(t,e),this.redraw(n),this.renderSizeRecSelect(t,n)}renderSizeRecTable(e,t){const{locations:n}=e[t],i=n.map(({location:e,fit:t,isPerfect:n})=>this.renderSizeRecTableRow(e,t,n)).join("");this.tfrSizeRecTable.innerHTML=i}renderSizeRecSelect(e,t){const n=e.map(({size:e})=>e).map((n,i)=>`<div class="tfr-size-rec-select-button ${i===t?"active":""}" data-index="${i}" data-size-id="${e[i].size_id}">${n}</div>`).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecSelectLoggedOut(){const e=['<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=e}renderSizeRecTableRow(e,t,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${e}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${t}\n </div>\n </div>`}renderGarmentLocations(e){const t=e.map((e,t)=>this.renderSizeRecTableRow(e,this.randomFit(t),!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 ${t}\n </div>\n </div>`;this.tfrSizeRecTable.innerHTML=n}randomFit(e){const t=["Slightly Tight","Perfect Fit","Perfect Fit","Slightly Loose","Perfect Fit"];return t[e%t.length]}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrToggleOpenElements.forEach(e=>e.style.display="block"),this.tfrToggleClosedElements.forEach(e=>e.style.display="none")):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrToggleOpenElements.forEach(e=>e.style.display="none"),this.tfrToggleClosedElements.forEach(e=>e.style.display="block"))}render(e){const t=`<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">${Dp}</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 ${Mp} 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 ${Mp} 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\n <div id="tfr-try-on-button" class="tfr-try-on-button">Try On</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">${Dp}</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>`;e.innerHTML=t}}class jp{constructor(e,t,n,i,r,s,o){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.onTryOnClick=o,this.perfectFits=[ip.Fit.PERFECT_FIT,ip.Fit.SLIGHTLY_LOOSE,ip.Fit.SLIGHTLY_TIGHT],this.setCssVariables(t),this.sizeRecComponent=new Bp(e,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick,this.onTryOnClick)}get sku(){return this.sizeRecComponent.sku}setSku(e){this.sizeRecComponent.setSku(e)}get styleId(){return this.sizeRecComponent.styleId}setStyleId(e){this.sizeRecComponent.setStyleId(e)}setIsLoggedIn(e){this.sizeRecComponent.setIsLoggedIn(e)}async setGarmentLocations(e=[]){this.sizeRecComponent.setLoading(!0);const t=e.length>0?e:await this.getGarmentLocations(e);console.debug("locations",t),console.debug("filledLocations",e),t&&t.length>0&&(this.sizeRecComponent.show(),this.sizeRecComponent.setGarmentLocations(t)),this.sizeRecComponent.setLoading(!1)}async recommendSize(){this.sizeRecComponent.setLoading(!0);const e=await this.getRecommendedSize();if(!e)return console.error("No sizes found for sku"),void this.sizeRecComponent.setLoading(!1);this.sizeRecComponent.show(),this.sizeRecComponent.setRecommendedSize(e),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(e){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,e)}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);if(!t)return console.error("Style not found for brand style ID:",this.sku),this.sizeRecComponent.hide(),null;return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(t.id,e)}catch(e){return console.error(e),this.sizeRecComponent.hide(),null}}}async getRecommendedSize(){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku),t=await this.getRecommendedSizes(String(e.style_id));return this.setStyleId(e.style_id),t}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);if(!e)return console.error("Style not found for brand style ID:",this.sku),this.sizeRecComponent.hide(),null;const t=await this.getRecommendedSizes(String(e.id));return this.setStyleId(e.id),t}catch(e){return console.error(e),this.sizeRecComponent.hide(),null}}}async getRecommendedSizes(e){const t=await this.tfrShop.getRecommendedSizes(e);return t?{recommended:t.recommended_size.size_value.name,sizes:t.fits.map(e=>({size:t.available_sizes.find(t=>t.id===e.size_id).size_value.name,size_id:e.size_id,locations:e.measurement_location_fits.map(e=>({fit:"string"==typeof e.fit_label&&e.fit_label?e.fit_label:ip.FitNames[e.fit],isPerfect:this.perfectFits.includes(e.fit),location:this.tfrShop.getMeasurementLocationName(e.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(e.measurement_location)})).sort((e,t)=>e.sortOrder<t.sortOrder?-1:1)}))}:null}setCssVariables(e){const t=document.querySelector(":root");e.brandColor&&t.style.setProperty("--tfr-brand-color",e.brandColor),e.black&&t.style.setProperty("--tfr-black",e.black),e.red&&t.style.setProperty("--tfr-red",e.red),e.white&&t.style.setProperty("--tfr-white",e.white),e.muted&&t.style.setProperty("--tfr-muted",e.muted),e.dark&&t.style.setProperty("--tfr-dark",e.dark),e.grey&&t.style.setProperty("--tfr-grey",e.grey),e.lightGrey&&t.style.setProperty("--tfr-light-grey",e.lightGrey),e.mainBorderColor&&t.style.setProperty("--tfr-main-border-color",e.mainBorderColor),e.mainBorderRadius&&t.style.setProperty("--tfr-main-border-radius",e.mainBorderRadius),e.mainBorderWidth&&t.style.setProperty("--tfr-main-border-width",e.mainBorderWidth),e.mainBgColor&&t.style.setProperty("--tfr-main-bg-color",e.mainBgColor),e.mainWidth&&t.style.setProperty("--tfr-main-width",e.mainWidth),e.mainVPadding&&t.style.setProperty("--tfr-main-v-padding",e.mainVPadding),e.mainHPadding&&t.style.setProperty("--tfr-main-h-padding",e.mainHPadding),e.mainFont&&t.style.setProperty("--tfr-main-font",e.mainFont),e.titleFont&&t.style.setProperty("--tfr-title-font",e.titleFont),e.subtitleFont&&t.style.setProperty("--tfr-subtitle-font",e.subtitleFont),e.rowFont&&t.style.setProperty("--tfr-row-font",e.rowFont),e.ctaFont&&t.style.setProperty("--tfr-cta-font",e.ctaFont),e.sizeSelectorTextColor&&t.style.setProperty("--tfr-size-selector-text-color",e.sizeSelectorTextColor),e.sizeSelectorFontSize&&t.style.setProperty("--tfr-size-selector-font-size",e.sizeSelectorFontSize),e.sizeSelectorFontWeight&&t.style.setProperty("--tfr-size-selector-font-weight",e.sizeSelectorFontWeight),e.sizeSelectorBgColor&&t.style.setProperty("--tfr-size-selector-bg-color",e.sizeSelectorBgColor),e.sizeSelectorBorderColor&&t.style.setProperty("--tfr-size-selector-border-color",e.sizeSelectorBorderColor),e.sizeSelectorBorderWidth&&t.style.setProperty("--tfr-size-selector-border-width",e.sizeSelectorBorderWidth),e.sizeSelectorBgColorHover&&t.style.setProperty("--tfr-size-selector-bg-color-hover",e.sizeSelectorBgColorHover),e.sizeSelectorBgColorActive&&t.style.setProperty("--tfr-size-selector-bg-color-active",e.sizeSelectorBgColorActive),e.sizeSelectorButtonHeight&&t.style.setProperty("--tfr-size-selector-button-height",e.sizeSelectorButtonHeight),e.sizeSelectorButtonActiveHeight&&t.style.setProperty("--tfr-size-selector-button-active-height",e.sizeSelectorButtonActiveHeight),e.sizeSelectorButtonActiveBorderColor&&t.style.setProperty("--tfr-size-selector-button-active-border-color",e.sizeSelectorButtonActiveBorderColor),e.sizeSelectorButtonActiveBorderWidth&&t.style.setProperty("--tfr-size-selector-button-active-border-width",e.sizeSelectorButtonActiveBorderWidth),e.sizeSelectorButtonRadius&&t.style.setProperty("--tfr-size-selector-button-radius",e.sizeSelectorButtonRadius),e.sizeSelectorButtonShadow&&t.style.setProperty("--tfr-size-selector-button-shadow",e.sizeSelectorButtonShadow)}}var Hp;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(Hp||(Hp={}));class $p{constructor(e,t,n,i,r={},s,o){this.shopId=e,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 Vp(t,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((e,t="dev")=>("dev"!==t&&"development"!==t||console.warn("TfrShop is in development mode"),Ql.getInstance().setEnv(t),new Gf(e,new jf)))(Number(this.shopId),a),this.tfrSizeRec=new jp(n,s,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.bind(this),this.onTryOnClick.bind(this)),i&&(this.vtoComponent=new rp(i))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async setSku(e){var t,n;this.tfrSizeRec.setSku(e);const i=await this.getStyle(this.sku);i?(this.style=i,i.is_published?console.log(`style ${i.id} is published`):(document.getElementById("tfr-size-recommendations").style.display="none",console.log(`style ${i.id} is not published`)),console.log(`style ${i.id} virtual try on is disabled`),i.is_vto?null===(t=document.getElementById("tfr-try-on-button"))||void 0===t||t.classList.remove("hide"):null===(n=document.getElementById("tfr-try-on-button"))||void 0===n||n.classList.add("hide"),this.isLoggedIn?this.tfrSizeRec.recommendSize():this.setGarmentLocations(i)):document.getElementById("tfr-size-recommendations").style.display="none"}async onInit(){var e,t;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(e=this.hooks)||void 0===e?void 0:e.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var e;await this.tfrShop.user.logout(),(null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(this.style),this.unsubscribeFromProfileChanges()}async signIn(e,t,n){var i;if(0==e.length||0==t.length)return n(xp);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(e))return n(up);if(!(e=>!!e.match(/^.{7,}$/))(t))return n(vp);try{await this.tfrShop.user.login(e,t),(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.recommendSize(),this.subscribeToProfileChanges()}catch(e){return n(Np)}}setBrandUserId(e){this.tfrShop.user.setBrandUserId(e)}async submitTel(e){try{await this.tfrShop.submitTelephoneNumber(e),this.tfrModal.toSignIn()}catch(e){this.tfrModal.onError(kp)}}async forgotPassword(e){await this.tfrShop.user.sendPasswordResetEmail(e),this.tfrModal.toSignIn()}async passwordReset(e,t){await this.tfrShop.user.confirmPasswordReset(e,t),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(e){return this.tfrShop.getMeasurementLocationsFromSku(e)}onSignInClick(){this.tfrModal.toScan()}onFitInfoClick(){this.tfrModal.toFitInfo()}async onTryOnClick(e,t,n=!0){if(!this.vtoComponent)return console.error("VtoComponent is not initialized. Please check if the vtoMainDivId is correct.");const i=await this.shop.tryOn(e,t);if(n)try{this.vtoComponent.init(),this.vtoComponent.onNewFramesReady(i)}catch(e){console.error("Error initializing VTO:",e),this.tfrModal.onError(kp)}}onUserProfileChange(e){var t,n,i,r;switch(e.avatar_status){case Hp.NOT_CREATED:(null===(t=this.hooks)||void 0===t?void 0:t.onError)&&this.hooks.onError(cp),this.tfrModal.onNotCreated();break;case Hp.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Hp.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(kp),this.tfrModal.onError(kp)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges(e=>this.onUserProfileChange(e)))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(e){var t,n;const i=(null===(n=null===(t=null==e?void 0:e.sizes)||void 0===t?void 0:t[0])||void 0===n?void 0:n.garment_measurements.map(e=>e.measurement_location))||[];this.tfrSizeRec.setGarmentLocations(i)}async getStyle(e){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(e);return await this.tfrShop.getStyle(t.style_id)}catch(t){try{return await this.tfrShop.getStyleByBrandStyleId(e)}catch(e){return null}}}}const qp=async({shopId:e,modalDivId:t,sizeRecMainDivId:n,vtoMainDivId:i,hooks:r={},cssVariables:s={},env:o="dev"})=>{const a=new $p(e,t,n,i,r,s,o);return await a.onInit(),a};export{n as InitImageSlider,qp as initFittingRoom};
3399
3399
  //# sourceMappingURL=index.min.js.map