@thefittingroom/shop-ui 3.1.3 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rollup.cache/home/codeliger/code/thefittingroom/shop-sdk-ui/dist/esm/tfr-size-rec.js +2 -2
- package/.rollup.cache/home/codeliger/code/thefittingroom/shop-sdk-ui/dist/esm/tfr-size-rec.js.map +1 -1
- package/.rollup.cache/home/codeliger/code/thefittingroom/shop-sdk-ui/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/index.js +22 -22
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +38 -38
- package/dist/esm/index.min.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/esm/index.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v3.1.
|
|
2
|
+
* thefittingroom v3.1.5 (2025-08-01T22:24:10.440Z)
|
|
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
|
+
* thefittingroom v2.0.7 (2025-08-01T21:17:06.966Z)
|
|
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
|
/**
|
|
@@ -89,7 +89,7 @@ class f{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
89
89
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
90
90
|
* See the License for the specific language governing permissions and
|
|
91
91
|
* limitations under the License.
|
|
92
|
-
*/const m={};let
|
|
92
|
+
*/const m={};let y=!1;function v(e,t){if("undefined"==typeof window||"undefined"==typeof document||!p(window.location.host)||m[e]===t||m[e]||y)return;function n(e){return`__firebase__banner__${e}`}m[e]=t;const i="__firebase__banner",r=function(){const e={prod:[],emulator:[]};for(const t of Object.keys(m))m[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){const e=document.createElement("span");return e.style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" ×",e.onclick=()=>{y=!0,function(){const e=document.getElementById(i);e&&e.remove()}()},e}function o(){const e=function(e){let t=document.getElementById(e),n=!1;return t||(t=document.createElement("div"),t.setAttribute("id",e),n=!0),{created:n,element:t}}(i),t=n("text"),o=document.getElementById(t)||document.createElement("span"),a=n("learnmore"),c=document.getElementById(a)||document.createElement("a"),l=n("preprendIcon"),u=document.getElementById(l)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(e.created){const t=e.element;!function(e){e.style.display="flex",e.style.background="#7faaf0",e.style.position="fixed",e.style.bottom="5px",e.style.left="5px",e.style.padding=".5em",e.style.borderRadius="5px",e.style.alignItems="center"}(t),function(e,t){e.setAttribute("id",t),e.innerText="Learn more",e.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",e.setAttribute("target","__blank"),e.style.paddingLeft="5px",e.style.textDecoration="underline"}(c,a);const n=s();!function(e,t){e.setAttribute("width","24"),e.setAttribute("id",t),e.setAttribute("height","24"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.style.marginLeft="-6px"}(u,l),t.append(u,o,c,n),document.body.appendChild(t)}r?(o.innerText="Preview backend disconnected.",u.innerHTML='<g clip-path="url(#clip0_6013_33858)">\n<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6013_33858">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>'):(u.innerHTML='<g clip-path="url(#clip0_6083_34804)">\n<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6083_34804">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>',o.innerText="Preview backend running in this workspace."),o.setAttribute("id",t)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",o):o()}
|
|
93
93
|
/**
|
|
94
94
|
* @license
|
|
95
95
|
* Copyright 2017 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",
|
|
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}
|
|
222
222
|
/**
|
|
223
223
|
* @license
|
|
224
224
|
* Copyright 2019 Google LLC
|
|
@@ -324,7 +324,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
324
324
|
|
|
325
325
|
Copyright The Closure Library Authors.
|
|
326
326
|
SPDX-License-Identifier: Apache-2.0
|
|
327
|
-
*/function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}function n(e,t,n){n||(n=0);var i=Array(16);if("string"==typeof t)for(var r=0;16>r;++r)i[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;16>r;++r)i[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];var s=e.g[3],o=t+(s^n&(r^s))+i[0]+3614090360&4294967295;o=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=n+(o<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[4]+4118548399&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^s&(n^r))+i[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=t+(n^r^s)+i[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=t+(r^(n|~s))+i[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=t+(r^(n|~s))+i[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=t+(r^(n|~s))+i[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((s=(t=n+((o=t+(r^(n|~s))+i[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((r=s+((o=r+(t^(s|~n))+i[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~t))+i[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(r+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+r&4294967295,e.g[3]=e.g[3]+s&4294967295}function i(e,t){this.h=t;for(var n=[],i=!0,r=e.length-1;0<=r;r--){var s=0|e[r];i&&s==t||(n[r]=s,i=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=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)}}(t,function(){this.blockSize=-1}),t.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var i=t-this.blockSize,r=this.B,s=this.h,o=0;o<t;){if(0==s)for(;o<=i;)n(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(r[s++]=e.charCodeAt(o++),s==this.blockSize){n(this,r),s=0;break}}else for(;o<t;)if(r[s++]=e[o++],s==this.blockSize){n(this,r),s=0;break}}this.h=s,this.o+=t},t.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var i=0;32>i;i+=8)e[n++]=this.g[t]>>>i&255;return e};var r={};function s(e){return-128<=e&&128>e?function(e,t){var n=r;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new i([0|e],0>e?-1:0)}):new i([0|e],0>e?-1:0)}function o(e){if(isNaN(e)||!isFinite(e))return a;if(0>e)return d(o(-e));for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new i(t,0)}var a=s(0),c=s(1),l=s(16777216);function u(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function h(e){return-1==e.h}function d(e){for(var t=e.g.length,n=[],r=0;r<t;r++)n[r]=~e.g[r];return new i(n,~e.h).add(c)}function f(e,t){return e.add(d(t))}function p(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function g(e,t){this.g=e,this.h=t}function m(e,t){if(u(t))throw Error("division by zero");if(u(e))return new g(a,a);if(h(e))return t=m(d(e),t),new g(d(t.g),d(t.h));if(h(t))return t=m(e,d(t)),new g(d(t.g),t.h);if(30<e.g.length){if(h(e)||h(t))throw Error("slowDivide_ only works with positive integers.");for(var n=c,i=t;0>=i.l(e);)n=v(n),i=v(i);var r=y(n,1),s=y(i,1);for(i=y(i,2),n=y(n,2);!u(i);){var l=s.add(i);0>=l.l(e)&&(r=r.add(n),s=l),i=y(i,1),n=y(n,1)}return t=f(e,r.j(t)),new g(r,t)}for(r=a;0<=e.l(t);){for(n=Math.max(1,Math.floor(e.m()/t.m())),i=48>=(i=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,i-48),l=(s=o(n)).j(t);h(l)||0<l.l(e);)l=(s=o(n-=i)).j(t);u(s)&&(s=c),r=r.add(s),e=f(e,l)}return new g(r,e)}function v(e){for(var t=e.g.length+1,n=[],r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new i(n,e.h)}function y(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,s=[],o=0;o<r;o++)s[o]=0<t?e.i(o+n)>>>t|e.i(o+n+1)<<32-t:e.i(o+n);return new i(s,e.h)}(e=i.prototype).m=function(){if(h(this))return-d(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var i=this.i(n);e+=(0<=i?i:4294967296+i)*t,t*=4294967296}return e},e.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(u(this))return"0";if(h(this))return"-"+d(this).toString(e);for(var t=o(Math.pow(e,6)),n=this,i="";;){var r=m(n,t).g,s=((0<(n=f(n,r.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(u(n=r))return s+i;for(;6>s.length;)s="0"+s;i=s+i}},e.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return h(e=f(this,e))?-1:u(e)?0:1},e.abs=function(){return h(this)?d(this):this},e.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0,s=0;s<=t;s++){var o=r+(65535&this.i(s))+(65535&e.i(s)),a=(o>>>16)+(this.i(s)>>>16)+(e.i(s)>>>16);r=a>>>16,o&=65535,a&=65535,n[s]=a<<16|o}return new i(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(u(this)||u(e))return a;if(h(this))return h(e)?d(this).j(d(e)):d(d(this).j(e));if(h(e))return d(this.j(d(e)));if(0>this.l(l)&&0>e.l(l))return o(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var s=0;s<e.g.length;s++){var c=this.i(r)>>>16,f=65535&this.i(r),g=e.i(s)>>>16,m=65535&e.i(s);n[2*r+2*s]+=f*m,p(n,2*r+2*s),n[2*r+2*s+1]+=c*m,p(n,2*r+2*s+1),n[2*r+2*s+1]+=f*g,p(n,2*r+2*s+1),n[2*r+2*s+2]+=c*g,p(n,2*r+2*s+2)}for(r=0;r<t;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=t;r<2*t;r++)n[r]=0;return new i(n,0)},e.A=function(e){return m(this,e).h},e.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new i(n,this.h&e.h)},e.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new i(n,this.h|e.h)},e.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new i(n,this.h^e.h)},t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,ot=t,i.prototype.add=i.prototype.add,i.prototype.multiply=i.prototype.j,i.prototype.modulo=i.prototype.A,i.prototype.compare=i.prototype.l,i.prototype.toNumber=i.prototype.m,i.prototype.toString=i.prototype.toString,i.prototype.getBits=i.prototype.i,i.fromNumber=o,i.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return d(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var i=o(Math.pow(n,8)),r=a,s=0;s<t.length;s+=8){var c=Math.min(8,t.length-s),l=parseInt(t.substring(s,s+c),n);8>c?(c=o(Math.pow(n,c)),r=r.j(c).add(o(l))):r=(r=r.j(i)).add(o(l))}return r},st=i}).apply(void 0!==at?at:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ct,lt,ut,ht,dt,ft,pt,gt,mt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
|
|
327
|
+
*/function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}function n(e,t,n){n||(n=0);var i=Array(16);if("string"==typeof t)for(var r=0;16>r;++r)i[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;16>r;++r)i[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];var s=e.g[3],o=t+(s^n&(r^s))+i[0]+3614090360&4294967295;o=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=n+(o<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[4]+4118548399&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^s&(n^r))+i[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=t+(n^r^s)+i[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=t+(r^(n|~s))+i[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=t+(r^(n|~s))+i[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=t+(r^(n|~s))+i[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((s=(t=n+((o=t+(r^(n|~s))+i[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((r=s+((o=r+(t^(s|~n))+i[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~t))+i[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(r+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+r&4294967295,e.g[3]=e.g[3]+s&4294967295}function i(e,t){this.h=t;for(var n=[],i=!0,r=e.length-1;0<=r;r--){var s=0|e[r];i&&s==t||(n[r]=s,i=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=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)}}(t,function(){this.blockSize=-1}),t.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var i=t-this.blockSize,r=this.B,s=this.h,o=0;o<t;){if(0==s)for(;o<=i;)n(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(r[s++]=e.charCodeAt(o++),s==this.blockSize){n(this,r),s=0;break}}else for(;o<t;)if(r[s++]=e[o++],s==this.blockSize){n(this,r),s=0;break}}this.h=s,this.o+=t},t.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var i=0;32>i;i+=8)e[n++]=this.g[t]>>>i&255;return e};var r={};function s(e){return-128<=e&&128>e?function(e,t){var n=r;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new i([0|e],0>e?-1:0)}):new i([0|e],0>e?-1:0)}function o(e){if(isNaN(e)||!isFinite(e))return a;if(0>e)return d(o(-e));for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new i(t,0)}var a=s(0),c=s(1),l=s(16777216);function u(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function h(e){return-1==e.h}function d(e){for(var t=e.g.length,n=[],r=0;r<t;r++)n[r]=~e.g[r];return new i(n,~e.h).add(c)}function f(e,t){return e.add(d(t))}function p(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function g(e,t){this.g=e,this.h=t}function m(e,t){if(u(t))throw Error("division by zero");if(u(e))return new g(a,a);if(h(e))return t=m(d(e),t),new g(d(t.g),d(t.h));if(h(t))return t=m(e,d(t)),new g(d(t.g),t.h);if(30<e.g.length){if(h(e)||h(t))throw Error("slowDivide_ only works with positive integers.");for(var n=c,i=t;0>=i.l(e);)n=y(n),i=y(i);var r=v(n,1),s=v(i,1);for(i=v(i,2),n=v(n,2);!u(i);){var l=s.add(i);0>=l.l(e)&&(r=r.add(n),s=l),i=v(i,1),n=v(n,1)}return t=f(e,r.j(t)),new g(r,t)}for(r=a;0<=e.l(t);){for(n=Math.max(1,Math.floor(e.m()/t.m())),i=48>=(i=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,i-48),l=(s=o(n)).j(t);h(l)||0<l.l(e);)l=(s=o(n-=i)).j(t);u(s)&&(s=c),r=r.add(s),e=f(e,l)}return new g(r,e)}function y(e){for(var t=e.g.length+1,n=[],r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new i(n,e.h)}function v(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,s=[],o=0;o<r;o++)s[o]=0<t?e.i(o+n)>>>t|e.i(o+n+1)<<32-t:e.i(o+n);return new i(s,e.h)}(e=i.prototype).m=function(){if(h(this))return-d(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var i=this.i(n);e+=(0<=i?i:4294967296+i)*t,t*=4294967296}return e},e.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(u(this))return"0";if(h(this))return"-"+d(this).toString(e);for(var t=o(Math.pow(e,6)),n=this,i="";;){var r=m(n,t).g,s=((0<(n=f(n,r.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(u(n=r))return s+i;for(;6>s.length;)s="0"+s;i=s+i}},e.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return h(e=f(this,e))?-1:u(e)?0:1},e.abs=function(){return h(this)?d(this):this},e.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0,s=0;s<=t;s++){var o=r+(65535&this.i(s))+(65535&e.i(s)),a=(o>>>16)+(this.i(s)>>>16)+(e.i(s)>>>16);r=a>>>16,o&=65535,a&=65535,n[s]=a<<16|o}return new i(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(u(this)||u(e))return a;if(h(this))return h(e)?d(this).j(d(e)):d(d(this).j(e));if(h(e))return d(this.j(d(e)));if(0>this.l(l)&&0>e.l(l))return o(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var s=0;s<e.g.length;s++){var c=this.i(r)>>>16,f=65535&this.i(r),g=e.i(s)>>>16,m=65535&e.i(s);n[2*r+2*s]+=f*m,p(n,2*r+2*s),n[2*r+2*s+1]+=c*m,p(n,2*r+2*s+1),n[2*r+2*s+1]+=f*g,p(n,2*r+2*s+1),n[2*r+2*s+2]+=c*g,p(n,2*r+2*s+2)}for(r=0;r<t;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=t;r<2*t;r++)n[r]=0;return new i(n,0)},e.A=function(e){return m(this,e).h},e.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new i(n,this.h&e.h)},e.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new i(n,this.h|e.h)},e.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new i(n,this.h^e.h)},t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,ot=t,i.prototype.add=i.prototype.add,i.prototype.multiply=i.prototype.j,i.prototype.modulo=i.prototype.A,i.prototype.compare=i.prototype.l,i.prototype.toNumber=i.prototype.m,i.prototype.toString=i.prototype.toString,i.prototype.getBits=i.prototype.i,i.fromNumber=o,i.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return d(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var i=o(Math.pow(n,8)),r=a,s=0;s<t.length;s+=8){var c=Math.min(8,t.length-s),l=parseInt(t.substring(s,s+c),n);8>c?(c=o(Math.pow(n,c)),r=r.j(c).add(o(l))):r=(r=r.j(i)).add(o(l))}return r},st=i}).apply(void 0!==at?at:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ct,lt,ut,ht,dt,ft,pt,gt,mt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
|
|
328
328
|
/** @license
|
|
329
329
|
Copyright The Closure Library Authors.
|
|
330
330
|
SPDX-License-Identifier: Apache-2.0
|
|
@@ -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 v=!(-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 y(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(v){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){y(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 ve(){L.call(this,"c")}h(me,L),h(ve,L);var ye={},we=null;function be(){return we=we||new ee}function _e(e){L.call(this,ye.La,e)}function Se(e){const t=be();te(t,new _e(t))}function Ee(e,t){L.call(this,ye.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,ye.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:"")})}ye.La="serverreachability",h(_e,L),ye.STAT_EVENT="statevent",h(Ee,L),ye.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=yt(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 vn(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,vt(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]||vn(n,7);else 3==n.G&&("stop"==l[0]||"close"==l[0]?"stop"==l[0]?vn(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 vt(e,t,n){e.i.set(t,n)}function yt(e){return vt(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 y(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)):vt(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(vt(n,"SID",e.K),vt(n,"RID",t),vt(n,"TYPE","terminate"),cn(e,n),(t=new Le(e,e.j,t)).L=2,t.v=yt(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)}yn(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);vt(i,"SID",e.K),vt(i,"RID",n),vt(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&&y(e.H,function(e,n){vt(t,n,e)}),e.l&&tt({},function(e,n){vt(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);vt(t,"RID","rpc"),vt(t,"SID",e.K),vt(t,"AID",e.T),vt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&vt(t,"TO",e.ja),vt(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=yt(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:vn(e,5);break;case 4:vn(e,10);break;case 3:vn(e,6);break;default:vn(e,2)}}function mn(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function vn(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"),yt(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),yn(e),sn(e)}function yn(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&&vt(i,n,t),vt(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(){ve.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),vt(n=rt(this.I),"RID",e),vt(n,"CVER",22),this.D&&vt(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&&vt(n,"TYPE","init"),this.P?(vt(n,"$req",t),vt(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,ve),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=ye,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 vt="@firebase/firestore",yt="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 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";
|
|
338
338
|
/**
|
|
339
339
|
* @license
|
|
340
340
|
* Copyright 2017 Google LLC
|
|
@@ -625,7 +625,7 @@ class pn{static fromTimestamp(e){return new pn(e)}static min(){return new pn(new
|
|
|
625
625
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
626
626
|
* See the License for the specific language governing permissions and
|
|
627
627
|
* limitations under the License.
|
|
628
|
-
*/function gn(e){return new mn(e.readTime,e.key,-1)}class mn{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new mn(pn.min(),tn.empty(),-1)}static max(){return new mn(pn.max(),tn.empty(),-1)}}function
|
|
628
|
+
*/function gn(e){return new mn(e.readTime,e.key,-1)}class mn{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new mn(pn.min(),tn.empty(),-1)}static max(){return new mn(pn.max(),tn.empty(),-1)}}function yn(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=tn.comparator(e.documentKey,t.documentKey),0!==n?n:qt(e.largestBatchId,t.largestBatchId)
|
|
629
629
|
/**
|
|
630
630
|
* @license
|
|
631
631
|
* Copyright 2020 Google LLC
|
|
@@ -641,7 +641,7 @@ class pn{static fromTimestamp(e){return new pn(e)}static min(){return new pn(new
|
|
|
641
641
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
642
642
|
* See the License for the specific language governing permissions and
|
|
643
643
|
* limitations under the License.
|
|
644
|
-
*/)}class
|
|
644
|
+
*/)}class vn{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}
|
|
645
645
|
/**
|
|
646
646
|
* @license
|
|
647
647
|
* Copyright 2017 Google LLC
|
|
@@ -866,7 +866,7 @@ class Ln{constructor(e){this.comparator=e,this.data=new xn(this.comparator)}has(
|
|
|
866
866
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
867
867
|
* See the License for the specific language governing permissions and
|
|
868
868
|
* limitations under the License.
|
|
869
|
-
*/(e)?9007199254740991:function(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Xn])||void 0===n?void 0:n.stringValue)===ti}(e)?10:11:kt(28295,{value:e})}function ri(e,t){if(e===t)return!0;const n=ii(e);if(n!==ii(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Wn(e).isEqual(Wn(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=Un(e.timestampValue),i=Un(t.timestampValue);return n.seconds===i.seconds&&n.nanos===i.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Bn(e.bytesValue).isEqual(Bn(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Vn(e.geoPointValue.latitude)===Vn(t.geoPointValue.latitude)&&Vn(e.geoPointValue.longitude)===Vn(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return Vn(e.integerValue)===Vn(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=Vn(e.doubleValue),i=Vn(t.doubleValue);return n===i?Tn(n)===Tn(i):isNaN(n)&&isNaN(i)}return!1}(e,t);case 9:return Qt(e.arrayValue.values||[],t.arrayValue.values||[],ri);case 10:case 11:return function(e,t){const n=e.mapValue.fields||{},i=t.mapValue.fields||{};if(kn(n)!==kn(i))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===i[e]||!ri(n[e],i[e])))return!1;return!0}(e,t);default:return kt(52216,{left:e})}}function si(e,t){return void 0!==(e.values||[]).find(e=>ri(e,t))}function oi(e,t){if(e===t)return 0;const n=ii(e),i=ii(t);if(n!==i)return qt(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return qt(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Vn(e.integerValue||e.doubleValue),i=Vn(t.integerValue||t.doubleValue);return n<i?-1:n>i?1:n===i?0:isNaN(n)?isNaN(i)?0:-1:1}(e,t);case 3:return ai(e.timestampValue,t.timestampValue);case 4:return ai(Wn(e),Wn(t));case 5:return Gt(e.stringValue,t.stringValue);case 6:return function(e,t){const n=Bn(e),i=Bn(t);return n.compareTo(i)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),i=t.split("/");for(let e=0;e<n.length&&e<i.length;e++){const t=qt(n[e],i[e]);if(0!==t)return t}return qt(n.length,i.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=qt(Vn(e.latitude),Vn(t.latitude));return 0!==n?n:qt(Vn(e.longitude),Vn(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return ci(e.arrayValue,t.arrayValue);case 10:return function(e,t){var n,i,r,s;const o=e.fields||{},a=t.fields||{},c=null===(n=o[ni])||void 0===n?void 0:n.arrayValue,l=null===(i=a[ni])||void 0===i?void 0:i.arrayValue,u=qt((null===(r=null==c?void 0:c.values)||void 0===r?void 0:r.length)||0,(null===(s=null==l?void 0:l.values)||void 0===s?void 0:s.length)||0);return 0!==u?u:ci(c,l)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===ei&&t===ei)return 0;if(e===ei)return 1;if(t===ei)return-1;const n=e.fields||{},i=Object.keys(n),r=t.fields||{},s=Object.keys(r);i.sort(),s.sort();for(let e=0;e<i.length&&e<s.length;++e){const t=Gt(i[e],s[e]);if(0!==t)return t;const o=oi(n[i[e]],r[s[e]]);if(0!==o)return o}return qt(i.length,s.length)}(e.mapValue,t.mapValue);default:throw kt(23264,{le:n})}}function ai(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return qt(e,t);const n=Un(e),i=Un(t),r=qt(n.seconds,i.seconds);return 0!==r?r:qt(n.nanos,i.nanos)}function ci(e,t){const n=e.values||[],i=t.values||[];for(let e=0;e<n.length&&e<i.length;++e){const t=oi(n[e],i[e]);if(t)return t}return qt(n.length,i.length)}function li(e){return ui(e)}function ui(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=Un(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return Bn(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return tn.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):"arrayValue"in e?function(e){let t="[",n=!0;for(const i of e.values||[])n?n=!1:t+=",",t+=ui(i);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",i=!0;for(const r of t)i?i=!1:n+=",",n+=`${r}:${ui(e.fields[r])}`;return n+"}"}(e.mapValue):kt(61005,{value:e})}function hi(e){switch(ii(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Kn(e);return t?16+hi(t):16;case 5:return 2*e.stringValue.length;case 6:return Bn(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+hi(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return An(e.fields,(e,n)=>{t+=e.length+hi(n)}),t}(e.mapValue);default:throw kt(13486,{value:e})}}function di(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function fi(e){return!!e&&"integerValue"in e}function pi(e){return!!e&&"arrayValue"in e}function gi(e){return!!e&&"nullValue"in e}function mi(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function
|
|
869
|
+
*/(e)?9007199254740991:function(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Xn])||void 0===n?void 0:n.stringValue)===ti}(e)?10:11:kt(28295,{value:e})}function ri(e,t){if(e===t)return!0;const n=ii(e);if(n!==ii(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Wn(e).isEqual(Wn(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=Un(e.timestampValue),i=Un(t.timestampValue);return n.seconds===i.seconds&&n.nanos===i.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Bn(e.bytesValue).isEqual(Bn(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Vn(e.geoPointValue.latitude)===Vn(t.geoPointValue.latitude)&&Vn(e.geoPointValue.longitude)===Vn(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return Vn(e.integerValue)===Vn(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=Vn(e.doubleValue),i=Vn(t.doubleValue);return n===i?Tn(n)===Tn(i):isNaN(n)&&isNaN(i)}return!1}(e,t);case 9:return Qt(e.arrayValue.values||[],t.arrayValue.values||[],ri);case 10:case 11:return function(e,t){const n=e.mapValue.fields||{},i=t.mapValue.fields||{};if(kn(n)!==kn(i))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===i[e]||!ri(n[e],i[e])))return!1;return!0}(e,t);default:return kt(52216,{left:e})}}function si(e,t){return void 0!==(e.values||[]).find(e=>ri(e,t))}function oi(e,t){if(e===t)return 0;const n=ii(e),i=ii(t);if(n!==i)return qt(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return qt(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Vn(e.integerValue||e.doubleValue),i=Vn(t.integerValue||t.doubleValue);return n<i?-1:n>i?1:n===i?0:isNaN(n)?isNaN(i)?0:-1:1}(e,t);case 3:return ai(e.timestampValue,t.timestampValue);case 4:return ai(Wn(e),Wn(t));case 5:return Gt(e.stringValue,t.stringValue);case 6:return function(e,t){const n=Bn(e),i=Bn(t);return n.compareTo(i)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),i=t.split("/");for(let e=0;e<n.length&&e<i.length;e++){const t=qt(n[e],i[e]);if(0!==t)return t}return qt(n.length,i.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=qt(Vn(e.latitude),Vn(t.latitude));return 0!==n?n:qt(Vn(e.longitude),Vn(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return ci(e.arrayValue,t.arrayValue);case 10:return function(e,t){var n,i,r,s;const o=e.fields||{},a=t.fields||{},c=null===(n=o[ni])||void 0===n?void 0:n.arrayValue,l=null===(i=a[ni])||void 0===i?void 0:i.arrayValue,u=qt((null===(r=null==c?void 0:c.values)||void 0===r?void 0:r.length)||0,(null===(s=null==l?void 0:l.values)||void 0===s?void 0:s.length)||0);return 0!==u?u:ci(c,l)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===ei&&t===ei)return 0;if(e===ei)return 1;if(t===ei)return-1;const n=e.fields||{},i=Object.keys(n),r=t.fields||{},s=Object.keys(r);i.sort(),s.sort();for(let e=0;e<i.length&&e<s.length;++e){const t=Gt(i[e],s[e]);if(0!==t)return t;const o=oi(n[i[e]],r[s[e]]);if(0!==o)return o}return qt(i.length,s.length)}(e.mapValue,t.mapValue);default:throw kt(23264,{le:n})}}function ai(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return qt(e,t);const n=Un(e),i=Un(t),r=qt(n.seconds,i.seconds);return 0!==r?r:qt(n.nanos,i.nanos)}function ci(e,t){const n=e.values||[],i=t.values||[];for(let e=0;e<n.length&&e<i.length;++e){const t=oi(n[e],i[e]);if(t)return t}return qt(n.length,i.length)}function li(e){return ui(e)}function ui(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=Un(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return Bn(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return tn.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):"arrayValue"in e?function(e){let t="[",n=!0;for(const i of e.values||[])n?n=!1:t+=",",t+=ui(i);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",i=!0;for(const r of t)i?i=!1:n+=",",n+=`${r}:${ui(e.fields[r])}`;return n+"}"}(e.mapValue):kt(61005,{value:e})}function hi(e){switch(ii(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Kn(e);return t?16+hi(t):16;case 5:return 2*e.stringValue.length;case 6:return Bn(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+hi(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return An(e.fields,(e,n)=>{t+=e.length+hi(n)}),t}(e.mapValue);default:throw kt(13486,{value:e})}}function di(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function fi(e){return!!e&&"integerValue"in e}function pi(e){return!!e&&"arrayValue"in e}function gi(e){return!!e&&"nullValue"in e}function mi(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function yi(e){return!!e&&"mapValue"in e}function vi(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return An(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=vi(n)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=vi(e.arrayValue.values[n]);return t}return Object.assign({},e)}class wi{constructor(e){this.value=e}static empty(){return new wi({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!yi(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=vi(t)}setAll(e){let t=en.emptyPath(),n={},i=[];e.forEach((e,r)=>{if(!t.isImmediateParentOf(r)){const e=this.getFieldsMap(t);this.applyChanges(e,n,i),n={},i=[],t=r.popLast()}e?n[r.lastSegment()]=vi(e):i.push(r.lastSegment())});const r=this.getFieldsMap(t);this.applyChanges(r,n,i)}delete(e){const t=this.field(e.popLast());yi(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return ri(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let i=t.mapValue.fields[e.get(n)];yi(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,n){An(t,(t,n)=>e[t]=n);for(const t of n)delete e[t]}clone(){return new wi(vi(this.value))}}function bi(e){const t=[];return An(e.fields,(e,n)=>{const i=new en([e]);if(yi(n)){const e=bi(n.mapValue).fields;if(0===e.length)t.push(i);else for(const n of e)t.push(i.child(n))}else t.push(i)}),new Dn(t)
|
|
870
870
|
/**
|
|
871
871
|
* @license
|
|
872
872
|
* Copyright 2017 Google LLC
|
|
@@ -994,7 +994,7 @@ class Ln{constructor(e){this.comparator=e,this.data=new xn(this.comparator)}has(
|
|
|
994
994
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
995
995
|
* See the License for the specific language governing permissions and
|
|
996
996
|
* limitations under the License.
|
|
997
|
-
*/const lr=new xn(tn.comparator);function ur(){return lr}const hr=new xn(tn.comparator);function dr(...e){let t=hr;for(const n of e)t=t.insert(n.key,n);return t}function fr(e){let t=hr;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function pr(){return mr()}function gr(){return mr()}function mr(){return new cr(e=>e.toString(),(e,t)=>e.isEqual(t))}const
|
|
997
|
+
*/const lr=new xn(tn.comparator);function ur(){return lr}const hr=new xn(tn.comparator);function dr(...e){let t=hr;for(const n of e)t=t.insert(n.key,n);return t}function fr(e){let t=hr;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function pr(){return mr()}function gr(){return mr()}function mr(){return new cr(e=>e.toString(),(e,t)=>e.isEqual(t))}const yr=new xn(tn.comparator),vr=new Ln(tn.comparator);function wr(...e){let t=vr;for(const n of e)t=t.add(n);return t}const br=new Ln(qt);
|
|
998
998
|
/**
|
|
999
999
|
* @license
|
|
1000
1000
|
* Copyright 2020 Google LLC
|
|
@@ -1059,7 +1059,7 @@ function _r(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t=
|
|
|
1059
1059
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1060
1060
|
* See the License for the specific language governing permissions and
|
|
1061
1061
|
* limitations under the License.
|
|
1062
|
-
*/class Xr{constructor(e,t,n,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){const i=this.mutations[t];i.key.isEqual(e.key)&&Br(i,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=jr(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=jr(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=gr();return this.mutations.forEach(i=>{const r=e.get(i.key),s=r.overlayedDocument;let o=this.applyToLocalView(s,r.mutatedFields);o=t.has(i.key)?null:o;const a=Vr(s,o);null!==a&&n.set(i.key,a),s.isValidDocument()||s.convertToNoDocument(pn.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),wr())}isEqual(e){return this.batchId===e.batchId&&Qt(this.mutations,e.mutations,(e,t)=>$r(e,t))&&Qt(this.baseMutations,e.baseMutations,(e,t)=>$r(e,t))}}class Zr{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){Rt(e.mutations.length===n.length,58842,{Ve:e.mutations.length,me:n.length});let i=
|
|
1062
|
+
*/class Xr{constructor(e,t,n,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){const i=this.mutations[t];i.key.isEqual(e.key)&&Br(i,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=jr(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=jr(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=gr();return this.mutations.forEach(i=>{const r=e.get(i.key),s=r.overlayedDocument;let o=this.applyToLocalView(s,r.mutatedFields);o=t.has(i.key)?null:o;const a=Vr(s,o);null!==a&&n.set(i.key,a),s.isValidDocument()||s.convertToNoDocument(pn.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),wr())}isEqual(e){return this.batchId===e.batchId&&Qt(this.mutations,e.mutations,(e,t)=>$r(e,t))&&Qt(this.baseMutations,e.baseMutations,(e,t)=>$r(e,t))}}class Zr{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){Rt(e.mutations.length===n.length,58842,{Ve:e.mutations.length,me:n.length});let i=yr;const r=e.mutations;for(let e=0;e<r.length;e++)i=i.insert(r[e].key,n[e].version);return new Zr(e,t,n,i)}}
|
|
1063
1063
|
/**
|
|
1064
1064
|
* @license
|
|
1065
1065
|
* Copyright 2022 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=ys(),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=ys()}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=vs(),this.Je=vs(),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=vs(),this.Je=vs(),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 vs(){return new xn(tn.comparator)}function ys(){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=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)}
|
|
1160
1160
|
/**
|
|
1161
1161
|
* @license
|
|
1162
1162
|
* Copyright 2017 Google LLC
|
|
@@ -1398,7 +1398,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1398
1398
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1399
1399
|
* See the License for the specific language governing permissions and
|
|
1400
1400
|
* limitations under the License.
|
|
1401
|
-
*/class mo{constructor(){this.qr=new Ln(
|
|
1401
|
+
*/class mo{constructor(){this.qr=new Ln(yo.Qr),this.$r=new Ln(yo.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(e,t){const n=new yo(e,t);this.qr=this.qr.add(n),this.$r=this.$r.add(n)}Kr(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.Wr(new yo(e,t))}Gr(e,t){e.forEach(e=>this.removeReference(e,t))}zr(e){const t=new tn(new Xt([])),n=new yo(t,e),i=new yo(t,e+1),r=[];return this.$r.forEachInRange([n,i],e=>{this.Wr(e),r.push(e.key)}),r}jr(){this.qr.forEach(e=>this.Wr(e))}Wr(e){this.qr=this.qr.delete(e),this.$r=this.$r.delete(e)}Jr(e){const t=new tn(new Xt([])),n=new yo(t,e),i=new yo(t,e+1);let r=wr();return this.$r.forEachInRange([n,i],e=>{r=r.add(e.key)}),r}containsKey(e){const t=new yo(e,0),n=this.qr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class yo{constructor(e,t){this.key=e,this.Hr=t}static Qr(e,t){return tn.comparator(e.key,t.key)||qt(e.Hr,t.Hr)}static Ur(e,t){return qt(e.Hr,t.Hr)||tn.comparator(e.key,t.key)}}
|
|
1402
1402
|
/**
|
|
1403
1403
|
* @license
|
|
1404
1404
|
* Copyright 2017 Google LLC
|
|
@@ -1414,7 +1414,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1414
1414
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1415
1415
|
* See the License for the specific language governing permissions and
|
|
1416
1416
|
* limitations under the License.
|
|
1417
|
-
*/class
|
|
1417
|
+
*/class vo{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.er=1,this.Yr=new Ln(yo.Qr)}checkEmpty(e){return bn.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,i){const r=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const s=new Xr(r,t,n,i);this.mutationQueue.push(s);for(const t of i)this.Yr=this.Yr.add(new yo(t.key,r)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return bn.resolve(s)}lookupMutationBatch(e,t){return bn.resolve(this.Zr(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,i=this.Xr(n),r=i<0?0:i;return bn.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return bn.resolve(0===this.mutationQueue.length?-1:this.er-1)}getAllMutationBatches(e){return bn.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new yo(t,0),i=new yo(t,Number.POSITIVE_INFINITY),r=[];return this.Yr.forEachInRange([n,i],e=>{const t=this.Zr(e.Hr);r.push(t)}),bn.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new Ln(qt);return t.forEach(e=>{const t=new yo(e,0),i=new yo(e,Number.POSITIVE_INFINITY);this.Yr.forEachInRange([t,i],e=>{n=n.add(e.Hr)})}),bn.resolve(this.ei(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,i=n.length+1;let r=n;tn.isDocumentKey(r)||(r=r.child(""));const s=new yo(new tn(r),0);let o=new Ln(qt);return this.Yr.forEachWhile(e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===i&&(o=o.add(e.Hr)),!0)},s),bn.resolve(this.ei(o))}ei(e){const t=[];return e.forEach(e=>{const n=this.Zr(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){Rt(0===this.ti(t.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.Yr;return bn.forEach(t.mutations,i=>{const r=new yo(i.key,t.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Yr=n})}rr(e){}containsKey(e,t){const n=new yo(t,0),i=this.Yr.firstAfterOrEqual(n);return bn.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,bn.resolve()}ti(e,t){return this.Xr(e)}Xr(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Zr(e){const t=this.Xr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}
|
|
1418
1418
|
/**
|
|
1419
1419
|
* @license
|
|
1420
1420
|
* Copyright 2017 Google LLC
|
|
@@ -1430,7 +1430,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1430
1430
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1431
1431
|
* See the License for the specific language governing permissions and
|
|
1432
1432
|
* limitations under the License.
|
|
1433
|
-
*/class wo{constructor(e){this.ni=e,this.docs=new xn(tn.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,i=this.docs.get(n),r=i?i.size:0,s=this.ni(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-r,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return bn.resolve(n?n.document.mutableCopy():_i.newInvalidDocument(t))}getEntries(e,t){let n=ur();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():_i.newInvalidDocument(e))}),bn.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let r=ur();const s=t.path,o=new tn(s.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||
|
|
1433
|
+
*/class wo{constructor(e){this.ni=e,this.docs=new xn(tn.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,i=this.docs.get(n),r=i?i.size:0,s=this.ni(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-r,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return bn.resolve(n?n.document.mutableCopy():_i.newInvalidDocument(t))}getEntries(e,t){let n=ur();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():_i.newInvalidDocument(e))}),bn.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let r=ur();const s=t.path,o=new tn(s.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||yn(gn(o),n)<=0||(i.has(o.key)||sr(t,o))&&(r=r.insert(o.key,o.mutableCopy()))}return bn.resolve(r)}getAllFromCollectionGroup(e,t,n,i){kt(9500)}ri(e,t){return bn.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new bo(this)}getSize(e){return bn.resolve(this.size)}}class bo extends lo{constructor(e){super(),this.Or=e}applyChanges(e){const t=[];return this.changes.forEach((n,i)=>{i.isValidDocument()?t.push(this.Or.addEntry(e,i)):this.Or.removeEntry(n)}),bn.waitFor(t)}getFromCache(e,t){return this.Or.getEntry(e,t)}getAllFromCache(e,t){return this.Or.getEntries(e,t)}}
|
|
1434
1434
|
/**
|
|
1435
1435
|
* @license
|
|
1436
1436
|
* Copyright 2017 Google LLC
|
|
@@ -1462,7 +1462,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1462
1462
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1463
1463
|
* See the License for the specific language governing permissions and
|
|
1464
1464
|
* limitations under the License.
|
|
1465
|
-
*/class So{constructor(e,t){this.ai={},this.overlays={},this.ui=new Sn(0),this.ci=!1,this.ci=!0,this.li=new go,this.referenceDelegate=e(this),this.hi=new _o(this),this.indexManager=new Xs,this.remoteDocumentCache=function(e){return new wo(e)}(e=>this.referenceDelegate.Pi(e)),this.serializer=new Js(t),this.Ti=new fo(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new po,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.ai[e.toKey()];return n||(n=new
|
|
1465
|
+
*/class So{constructor(e,t){this.ai={},this.overlays={},this.ui=new Sn(0),this.ci=!1,this.ci=!0,this.li=new go,this.referenceDelegate=e(this),this.hi=new _o(this),this.indexManager=new Xs,this.remoteDocumentCache=function(e){return new wo(e)}(e=>this.referenceDelegate.Pi(e)),this.serializer=new Js(t),this.Ti=new fo(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new po,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.ai[e.toKey()];return n||(n=new vo(t,this.referenceDelegate),this.ai[e.toKey()]=n),n}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(e,t,n){Et("MemoryPersistence","Starting transaction:",e);const i=new Eo(this.ui.next());return this.referenceDelegate.Ii(),n(i).next(e=>this.referenceDelegate.di(i).next(()=>e)).toPromise().then(e=>(i.raiseOnCommittedEvent(),e))}Ei(e,t){return bn.or(Object.values(this.ai).map(n=>()=>n.containsKey(e,t)))}}class Eo extends vn{constructor(e){super(),this.currentSequenceNumber=e}}class To{constructor(e){this.persistence=e,this.Ai=new mo,this.Ri=null}static Vi(e){return new To(e)}get mi(){if(this.Ri)return this.Ri;throw kt(60996)}addReference(e,t,n){return this.Ai.addReference(n,t),this.mi.delete(n.toString()),bn.resolve()}removeReference(e,t,n){return this.Ai.removeReference(n,t),this.mi.add(n.toString()),bn.resolve()}markPotentiallyOrphaned(e,t){return this.mi.add(t.toString()),bn.resolve()}removeTarget(e,t){this.Ai.zr(t.targetId).forEach(e=>this.mi.add(e.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.mi.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}Ii(){this.Ri=new Set}di(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return bn.forEach(this.mi,n=>{const i=tn.fromPath(n);return this.fi(e,i).next(e=>{e||t.removeEntry(i,pn.min())})}).next(()=>(this.Ri=null,t.apply(e)))}updateLimboDocument(e,t){return this.fi(e,t).next(e=>{e?this.mi.delete(t.toString()):this.mi.add(t.toString())})}Pi(e){return 0}fi(e,t){return bn.or([()=>bn.resolve(this.Ai.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ei(e,t)])}}class Io{constructor(e,t){this.persistence=e,this.gi=new cr(e=>function(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=Cn(t)),t=In(e.get(n),t);return Cn(t)}(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=function(e,t){return new co(e,t)}(this,t)}static Vi(e,t){return new Io(e,t)}Ii(){}di(e){return bn.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}mr(e){const t=this.yr(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}yr(e){let t=0;return this.gr(e,e=>{t++}).next(()=>t)}gr(e,t){return bn.forEach(this.gi,(n,i)=>this.Sr(e,n,i).next(e=>e?bn.resolve():t(i)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const i=this.persistence.getRemoteDocumentCache(),r=i.newChangeBuffer();return i.ri(e,i=>this.Sr(e,i,t).next(e=>{e||(n++,r.removeEntry(i,pn.min()))})).next(()=>r.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.gi.set(t,e.currentSequenceNumber),bn.resolve()}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),bn.resolve()}removeReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),bn.resolve()}updateLimboDocument(e,t){return this.gi.set(t,e.currentSequenceNumber),bn.resolve()}Pi(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=hi(e.data.value)),t}Sr(e,t,n){return bn.or([()=>this.persistence.Ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.gi.get(t);return bn.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}
|
|
1466
1466
|
/**
|
|
1467
1467
|
* @license
|
|
1468
1468
|
* 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
|
|
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)
|
|
1706
1706
|
/**
|
|
1707
1707
|
* @license
|
|
1708
1708
|
* Copyright 2018 Google LLC
|
|
@@ -1718,7 +1718,7 @@ class lo{constructor(){this.changes=new cr(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1718
1718
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1719
1719
|
* See the License for the specific language governing permissions and
|
|
1720
1720
|
* limitations under the License.
|
|
1721
|
-
*/}(e.datastore,e.asyncQueue,{Zo:
|
|
1721
|
+
*/}(e.datastore,e.asyncQueue,{Zo:va.bind(null,e),e_:wa.bind(null,e),n_:ba.bind(null,e),J_:_a.bind(null,e)}),e.da.push(async t=>{t?(e.Va.N_(),ga(e)?pa(e):e.Aa.set("Unknown")):(await e.Va.stop(),ya(e))})),e.Va}function Da(e){return e.ma||(e.ma=function(e,t,n){const i=xt(e);return i.ia(),new na(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)}(e.datastore,e.asyncQueue,{Zo:()=>Promise.resolve(),e_:Ra.bind(null,e),n_:Oa.bind(null,e),ea:xa.bind(null,e),ta:Na.bind(null,e)}),e.da.push(async t=>{t?(e.ma.N_(),await Ta(e)):(await e.ma.stop(),e.Pa.length>0&&(Et(oa,`Stopping write stream with ${e.Pa.length} pending writes`),e.Pa=[]))})),e.ma
|
|
1722
1722
|
/**
|
|
1723
1723
|
* @license
|
|
1724
1724
|
* Copyright 2017 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),yc(i,r.targetId)}).catch(wn)):(yc(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(()=>yc(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);vc(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);vc(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 vc(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 yc(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),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};
|
|
1818
1818
|
/**
|
|
1819
1819
|
* @license
|
|
1820
1820
|
* 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}`),
|
|
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))}}
|
|
1932
1932
|
/**
|
|
1933
1933
|
* @license
|
|
1934
1934
|
* Copyright 2020 Google LLC
|
|
@@ -2091,7 +2091,7 @@ class al{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._va
|
|
|
2091
2091
|
* See the License for the specific language governing permissions and
|
|
2092
2092
|
* limitations under the License.
|
|
2093
2093
|
*/
|
|
2094
|
-
const cl=/^__.*__$/;class ll{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new Gr(e,this.data,this.fieldMask,t,this.fieldTransforms):new qr(e,this.data,t,this.fieldTransforms)}}function ul(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw kt(40011,{Ec:e})}}class hl{constructor(e,t,n,i,r,s){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=i,void 0===r&&this.Ac(),this.fieldTransforms=r||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new hl(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Rc({path:n,mc:!1});return i.fc(e),i}gc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Rc({path:n,mc:!1});return i.Ac(),i}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return Sl(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(0===e.length)throw this.wc("Document fields must not be empty");if(ul(this.Ec)&&cl.test(e))throw this.wc('Document fields cannot begin and end with "__"')}}class dl{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Yo(e)}Dc(e,t,n,i=!1){return new hl({Ec:e,methodName:t,bc:n,path:en.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function fl(e){const t=e._freezeSettings(),n=Yo(e._databaseId);return new dl(e._databaseId,!!t.ignoreUndefinedProperties,n)}function pl(e,t,n,i,r,s={}){const o=e.Dc(s.merge||s.mergeFields?2:0,t,n,r);
|
|
2094
|
+
const cl=/^__.*__$/;class ll{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new Gr(e,this.data,this.fieldMask,t,this.fieldTransforms):new qr(e,this.data,t,this.fieldTransforms)}}function ul(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw kt(40011,{Ec:e})}}class hl{constructor(e,t,n,i,r,s){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=i,void 0===r&&this.Ac(),this.fieldTransforms=r||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new hl(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Rc({path:n,mc:!1});return i.fc(e),i}gc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Rc({path:n,mc:!1});return i.Ac(),i}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return Sl(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(0===e.length)throw this.wc("Document fields must not be empty");if(ul(this.Ec)&&cl.test(e))throw this.wc('Document fields cannot begin and end with "__"')}}class dl{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Yo(e)}Dc(e,t,n,i=!1){return new hl({Ec:e,methodName:t,bc:n,path:en.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function fl(e){const t=e._freezeSettings(),n=Yo(e._databaseId);return new dl(e._databaseId,!!t.ignoreUndefinedProperties,n)}function pl(e,t,n,i,r,s={}){const o=e.Dc(s.merge||s.mergeFields?2:0,t,n,r);vl("Data must be an object, but it was:",o,i);const a=ml(i,o);let c,l;if(s.merge)c=new Dn(o.fieldMask),l=o.fieldTransforms;else if(s.mergeFields){const e=[];for(const i of s.mergeFields){const r=wl(t,i,n);if(!o.contains(r))throw new Ot(Nt.INVALID_ARGUMENT,`Field '${r}' is specified in your field mask but missing from your input data.`);El(e,r)||e.push(r)}c=new Dn(e),l=o.fieldTransforms.filter(e=>c.covers(e.field))}else c=null,l=o.fieldTransforms;return new ll(new wi(a),c,l)}function gl(e,t){if(yl(e=N(e)))return vl("Unsupported field value:",t,e),ml(e,t);if(e instanceof sl)return function(e,t){if(!ul(t.Ec))throw t.wc(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.wc(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.mc&&4!==t.Ec)throw t.wc("Nested arrays are not supported");return function(e,t){const n=[];let i=0;for(const r of e){let e=gl(r,t.yc(i));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),i++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=N(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Er(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=fn.fromDate(e);return{timestampValue:Ts(t.serializer,n)}}if(e instanceof fn){const n=new fn(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Ts(t.serializer,n)}}if(e instanceof ol)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof nl)return{bytesValue:Is(t.serializer,e._byteString)};if(e instanceof qc){const n=t.databaseId,i=e.firestore._databaseId;if(!i.isEqual(n))throw t.wc(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:As(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof al)return function(e,t){return{mapValue:{fields:{[Xn]:{stringValue:ti},[ni]:{arrayValue:{values:e.toArray().map(e=>{if("number"!=typeof e)throw t.wc("VectorValues must only contain numeric values.");return _r(t.serializer,e)})}}}}}}(e,t);throw t.wc(`Unsupported field value: ${an(e)}`)}(e,t)}function ml(e,t){const n={};return Rn(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):An(e,(e,i)=>{const r=gl(i,t.Vc(e));null!=r&&(n[e]=r)}),{mapValue:{fields:n}}}function yl(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof fn||e instanceof ol||e instanceof nl||e instanceof qc||e instanceof sl||e instanceof al)}function vl(e,t,n){if(!yl(n)||!on(n)){const i=an(n);throw"an object"===i?t.wc(e+" a custom object"):t.wc(e+" "+i)}}function wl(e,t,n){if((t=N(t))instanceof il)return t._internalPath;if("string"==typeof t)return _l(e,t);throw Sl("Field path arguments must be of type string or ",e,!1,void 0,n)}const bl=new RegExp("[~\\*/\\[\\]]");function _l(e,t,n){if(t.search(bl)>=0)throw Sl(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new il(...t.split("."))._internalPath}catch(i){throw Sl(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function Sl(e,t,n,i,r){const s=i&&!i.isEmpty(),o=void 0!==r;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${i}`),o&&(c+=` in document ${r}`),c+=")"),new Ot(Nt.INVALID_ARGUMENT,a+e+c)}function El(e,t){return e.some(e=>e.isEqual(t))}
|
|
2095
2095
|
/**
|
|
2096
2096
|
* @license
|
|
2097
2097
|
* 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(vt,
|
|
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")}();
|
|
2175
2175
|
/**
|
|
2176
2176
|
* @license
|
|
2177
2177
|
* Copyright 2020 Google LLC
|
|
@@ -2188,7 +2188,7 @@ const cl=/^__.*__$/;class ll{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
|
|
|
2188
2188
|
* See the License for the specific language governing permissions and
|
|
2189
2189
|
* limitations under the License.
|
|
2190
2190
|
*/
|
|
2191
|
-
We("firebase","11.10.0","app");class Ql{constructor(){}static getInstance(){return Ql.instance||(Ql.instance=new Ql),Ql.instance}setEnv(e){switch(e){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Yl.firebase:Jl.firebase}get api(){return"prod"===this.env?Yl.api:Jl.api}get config(){return"prod"===this.env?Yl.config:Jl.config}}const Jl={firebase:{apiKey:
|
|
2191
|
+
We("firebase","11.10.0","app");class Ql{constructor(){}static getInstance(){return Ql.instance||(Ql.instance=new Ql),Ql.instance}setEnv(e){switch(e){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Yl.firebase:Jl.firebase}get api(){return"prod"===this.env?Yl.api:Jl.api}get config(){return"prod"===this.env?Yl.config:Jl.config}}const Jl={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Yl={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var Xl=1e3,Zl=6e4,eu=36e5,tu="millisecond",nu="second",iu="minute",ru="hour",su="day",ou="week",au="month",cu="quarter",lu="year",uu="date",hu="Invalid Date",du=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,fu=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,pu={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},gu=function(e,t,n){var i=String(e);return!i||i.length>=t?e:""+Array(t+1-i.length).join(n)+e},mu={s:gu,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),i=Math.floor(n/60),r=n%60;return(t<=0?"+":"-")+gu(i,2,"0")+":"+gu(r,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var i=12*(n.year()-t.year())+(n.month()-t.month()),r=t.clone().add(i,au),s=n-r<0,o=t.clone().add(i+(s?-1:1),au);return+(-(i+(n-r)/(s?r-o:o-r))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:au,y:lu,w:ou,d:su,D:uu,h:ru,m:iu,s:nu,ms:tu,Q:cu}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},yu="en",vu={};vu[yu]=pu;var wu="$isDayjsObject",bu=function(e){return e instanceof Tu||!(!e||!e[wu])},_u=function e(t,n,i){var r;if(!t)return yu;if("string"==typeof t){var s=t.toLowerCase();vu[s]&&(r=s),n&&(vu[s]=n,r=s);var o=t.split("-");if(!r&&o.length>1)return e(o[0])}else{var a=t.name;vu[a]=t,r=a}return!i&&r&&(yu=r),r||!i&&yu},Su=function(e,t){if(bu(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new Tu(n)},Eu=mu;Eu.l=_u,Eu.i=bu,Eu.w=function(e,t){return Su(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var Tu=function(){function e(e){this.$L=_u(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[wu]=!0}var t=e.prototype;return t.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(Eu.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var i=t.match(du);if(i){var r=i[2]-1||0,s=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(t)}(e),this.init()},t.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},t.$utils=function(){return Eu},t.isValid=function(){return!(this.$d.toString()===hu)},t.isSame=function(e,t){var n=Su(e);return this.startOf(t)<=n&&n<=this.endOf(t)},t.isAfter=function(e,t){return Su(e)<this.startOf(t)},t.isBefore=function(e,t){return this.endOf(t)<Su(e)},t.$g=function(e,t,n){return Eu.u(e)?this[t]:this.set(n,e)},t.unix=function(){return Math.floor(this.valueOf()/1e3)},t.valueOf=function(){return this.$d.getTime()},t.startOf=function(e,t){var n=this,i=!!Eu.u(t)||t,r=Eu.p(e),s=function(e,t){var r=Eu.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return i?r:r.endOf(su)},o=function(e,t){return Eu.w(n.toDate()[e].apply(n.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},a=this.$W,c=this.$M,l=this.$D,u="set"+(this.$u?"UTC":"");switch(r){case lu:return i?s(1,0):s(31,11);case au:return i?s(1,c):s(0,c+1);case ou:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(i?l-d:l+(6-d),c);case su:case uu:return o(u+"Hours",0);case ru:return o(u+"Minutes",1);case iu:return o(u+"Seconds",2);case nu:return o(u+"Milliseconds",3);default:return this.clone()}},t.endOf=function(e){return this.startOf(e,!1)},t.$set=function(e,t){var n,i=Eu.p(e),r="set"+(this.$u?"UTC":""),s=(n={},n[su]=r+"Date",n[uu]=r+"Date",n[au]=r+"Month",n[lu]=r+"FullYear",n[ru]=r+"Hours",n[iu]=r+"Minutes",n[nu]=r+"Seconds",n[tu]=r+"Milliseconds",n)[i],o=i===su?this.$D+(t-this.$W):t;if(i===au||i===lu){var a=this.clone().set(uu,1);a.$d[s](o),a.init(),this.$d=a.set(uu,Math.min(this.$D,a.daysInMonth())).$d}else s&&this.$d[s](o);return this.init(),this},t.set=function(e,t){return this.clone().$set(e,t)},t.get=function(e){return this[Eu.p(e)]()},t.add=function(e,t){var n,i=this;e=Number(e);var r=Eu.p(t),s=function(t){var n=Su(i);return Eu.w(n.date(n.date()+Math.round(t*e)),i)};if(r===au)return this.set(au,this.$M+e);if(r===lu)return this.set(lu,this.$y+e);if(r===su)return s(1);if(r===ou)return s(7);var o=(n={},n[iu]=Zl,n[ru]=eu,n[nu]=Xl,n)[r]||1,a=this.$d.getTime()+e*o;return Eu.w(a,this)},t.subtract=function(e,t){return this.add(-1*e,t)},t.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||hu;var i=e||"YYYY-MM-DDTHH:mm:ssZ",r=Eu.z(this),s=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,h=function(e,n,r,s){return e&&(e[n]||e(t,i))||r[n].slice(0,s)},d=function(e){return Eu.s(s%12||12,e,"0")},f=u||function(e,t,n){var i=e<12?"AM":"PM";return n?i.toLowerCase():i};return i.replace(fu,function(e,i){return i||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return Eu.s(t.$y,4,"0");case"M":return a+1;case"MM":return Eu.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return t.$D;case"DD":return Eu.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return h(n.weekdaysMin,t.$W,c,2);case"ddd":return h(n.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(s);case"HH":return Eu.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(s,o,!0);case"A":return f(s,o,!1);case"m":return String(o);case"mm":return Eu.s(o,2,"0");case"s":return String(t.$s);case"ss":return Eu.s(t.$s,2,"0");case"SSS":return Eu.s(t.$ms,3,"0");case"Z":return r}return null}(e)||r.replace(":","")})},t.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},t.diff=function(e,t,n){var i,r=this,s=Eu.p(t),o=Su(e),a=(o.utcOffset()-this.utcOffset())*Zl,c=this-o,l=function(){return Eu.m(r,o)};switch(s){case lu:i=l()/12;break;case au:i=l();break;case cu:i=l()/3;break;case ou:i=(c-a)/6048e5;break;case su:i=(c-a)/864e5;break;case ru:i=c/eu;break;case iu:i=c/Zl;break;case nu:i=c/Xl;break;default:i=c}return n?i:Eu.a(i)},t.daysInMonth=function(){return this.endOf(au).$D},t.$locale=function(){return vu[this.$L]},t.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),i=_u(e,t,!0);return i&&(n.$L=i),n},t.clone=function(){return Eu.w(this.$d,this)},t.toDate=function(){return new Date(this.valueOf())},t.toJSON=function(){return this.isValid()?this.toISOString():null},t.toISOString=function(){return this.$d.toISOString()},t.toString=function(){return this.$d.toUTCString()},e}(),Iu=Tu.prototype;function Cu(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function ku(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}Su.prototype=Iu,[["$ms",tu],["$s",nu],["$m",iu],["$H",ru],["$W",su],["$M",au],["$y",lu],["$D",uu]].forEach(function(e){Iu[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),Su.extend=function(e,t){return e.$i||(e(t,Tu,Su),e.$i=!0),Su},Su.locale=_u,Su.isDayjs=bu,Su.unix=function(e){return Su(1e3*e)},Su.en=vu[yu],Su.Ls=vu,Su.p={},"function"==typeof SuppressedError&&SuppressedError;const Au=ku,Ru=new S("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),xu="auth/user-disabled",Nu=new B("@firebase/auth");function Ou(e,...t){Nu.logLevel<=M.ERROR&&Nu.error(`Auth (${qe}): ${e}`,...t)}
|
|
2192
2192
|
/**
|
|
2193
2193
|
* @license
|
|
2194
2194
|
* 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
|
|
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,
|
|
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,
|
|
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}}
|
|
2467
2467
|
/**
|
|
2468
2468
|
* @license
|
|
2469
2469
|
* Copyright 2020 Google LLC
|
|
@@ -2511,7 +2511,7 @@ async function(e,t){return Yu(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
|
|
|
2511
2511
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2512
2512
|
* See the License for the specific language governing permissions and
|
|
2513
2513
|
* limitations under the License.
|
|
2514
|
-
*/function Eh(e,t,n){return`firebase:${e}:${t}:${n}`}class Th{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=Eh(this.userKey,i.apiKey,r),this.fullPersistenceKey=Eh("persistence",i.apiKey,r),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){const t=await oh(this.auth,{idToken:e}).catch(()=>{});return t?
|
|
2514
|
+
*/function Eh(e,t,n){return`firebase:${e}:${t}:${n}`}class Th{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=Eh(this.userKey,i.apiKey,r),this.fullPersistenceKey=Eh("persistence",i.apiKey,r),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){const t=await oh(this.auth,{idToken:e}).catch(()=>{});return t?vh._fromGetAccountInfoResponse(this.auth,t,e):null}return vh._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new Th(bh(Sh),e,n);const i=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let r=i[0]||bh(Sh);const s=Eh(n,e.config.apiKey,e.name);let o=null;for(const n of t)try{const t=await n._get(s);if(t){let i;if("string"==typeof t){const n=await oh(e,{idToken:t}).catch(()=>{});if(!n)break;i=await vh._fromGetAccountInfoResponse(e,n,t)}else i=vh._fromJSON(e,t);n!==r&&(o=i),r=n;break}}catch(e){}const a=i.filter(e=>e._shouldAllowMigration);return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(s,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==r)try{await e._remove(s)}catch(e){}})),new Th(r,e,n)):new Th(r,e,n)}}
|
|
2515
2515
|
/**
|
|
2516
2516
|
* @license
|
|
2517
2517
|
* 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
|
|
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))}
|
|
2595
2595
|
/**
|
|
2596
2596
|
* @license
|
|
2597
2597
|
* Copyright 2023 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}`),
|
|
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())}
|
|
2643
2643
|
/**
|
|
2644
2644
|
* @license
|
|
2645
2645
|
* Copyright 2020 Google LLC
|
|
@@ -2901,7 +2901,7 @@ class fd extends ld{constructor(){super("twitter.com")}static credential(e,t){re
|
|
|
2901
2901
|
* See the License for the specific language governing permissions and
|
|
2902
2902
|
* limitations under the License.
|
|
2903
2903
|
*/
|
|
2904
|
-
class pd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,i=!1){const r=await
|
|
2904
|
+
class pd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,i=!1){const r=await vh._fromIdTokenResponse(e,n,i),s=gd(n);return new pd({user:r,providerId:s,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const i=gd(n);return new pd({user:e,providerId:i,_tokenResponse:n,operationType:t})}}function gd(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}
|
|
2905
2905
|
/**
|
|
2906
2906
|
* @license
|
|
2907
2907
|
* Copyright 2020 Google LLC
|
|
@@ -2917,7 +2917,7 @@ class pd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._toke
|
|
|
2917
2917
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2918
2918
|
* See the License for the specific language governing permissions and
|
|
2919
2919
|
* limitations under the License.
|
|
2920
|
-
*/class md extends _{constructor(e,t,n,i){var r;super(t.code,t.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,md.prototype),this.customData={appName:e.name,tenantId:null!==(r=e.tenantId)&&void 0!==r?r:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,i){return new md(e,t,n,i)}}function
|
|
2920
|
+
*/class md extends _{constructor(e,t,n,i){var r;super(t.code,t.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,md.prototype),this.customData={appName:e.name,tenantId:null!==(r=e.tenantId)&&void 0!==r?r:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,i){return new md(e,t,n,i)}}function yd(e,t,n,i){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw md._fromErrorAndOperation(e,n,t,i);throw n})}
|
|
2921
2921
|
/**
|
|
2922
2922
|
* @license
|
|
2923
2923
|
* Copyright 2020 Google LLC
|
|
@@ -2934,7 +2934,7 @@ class pd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._toke
|
|
|
2934
2934
|
* See the License for the specific language governing permissions and
|
|
2935
2935
|
* limitations under the License.
|
|
2936
2936
|
*/
|
|
2937
|
-
async function
|
|
2937
|
+
async function vd(e,t,n=!1){if(je(e.app))return Promise.reject(Mu(e));const i="signIn",r=await yd(e,i,t),s=await pd._fromIdTokenResponse(e,i,r);return n||await e._updateCurrentUser(s.user),s}
|
|
2938
2938
|
/**
|
|
2939
2939
|
* @license
|
|
2940
2940
|
* Copyright 2020 Google LLC
|
|
@@ -2951,7 +2951,7 @@ async function yd(e,t,n=!1){if(je(e.app))return Promise.reject(Mu(e));const i="s
|
|
|
2951
2951
|
* See the License for the specific language governing permissions and
|
|
2952
2952
|
* limitations under the License.
|
|
2953
2953
|
*/
|
|
2954
|
-
async function wd(e){const t=Vh(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function bd(e,t,n){await async function(e,t){return Yu(e,"POST","/v1/accounts:resetPassword",Ju(e,t))}(N(e),{oobCode:t,newPassword:n}).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&wd(e),t})}function _d(e,t,n){return je(e.app)?Promise.reject(Mu(e)):async function(e,t){return
|
|
2954
|
+
async function wd(e){const t=Vh(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function bd(e,t,n){await async function(e,t){return Yu(e,"POST","/v1/accounts:resetPassword",Ju(e,t))}(N(e),{oobCode:t,newPassword:n}).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&wd(e),t})}function _d(e,t,n){return je(e.app)?Promise.reject(Mu(e)):async function(e,t){return vd(Vh(e),t)}(N(e),ad.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&wd(e),t})}const Sd="__sak";
|
|
2955
2955
|
/**
|
|
2956
2956
|
* @license
|
|
2957
2957
|
* 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
|
|
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"),
|
|
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,
|
|
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)}
|
|
3153
3153
|
/**
|
|
3154
3154
|
* @license
|
|
3155
3155
|
* 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
|
|
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)})}))}
|
|
3301
3301
|
/**
|
|
3302
3302
|
* @license
|
|
3303
3303
|
* Copyright 2020 Google LLC.
|
|
@@ -3313,7 +3313,7 @@ const ff=new $u(5e3,15e3),pf={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3313
3313
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3314
3314
|
* See the License for the specific language governing permissions and
|
|
3315
3315
|
* limitations under the License.
|
|
3316
|
-
*/const
|
|
3316
|
+
*/const vf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class wf{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function bf(e,t,n,i=500,r=600){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const c=Object.assign(Object.assign({},vf),{width:i.toString(),height:r.toString(),top:s,left:o}),l=w().toLowerCase();n&&(a=Ah(l)?"_blank":n),Ch(l)&&(t=t||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=w()){var t;return Lh(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(l)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}
|
|
3317
3317
|
/**
|
|
3318
3318
|
* @license
|
|
3319
3319
|
* Copyright 2021 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
|
|
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";
|
|
3349
3349
|
/**
|
|
3350
3350
|
* @license
|
|
3351
3351
|
* 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",vp="Password",yp="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.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">×</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">${vp}</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"> </div>\n <div id="fit-line-2"> </div>\n <div id="fit-line-3"> </div>\n <div id="fit-line-4"> </div>\n <div id="fit-line-5"> </div>\n <div id="fit-line-6"> </div>\n <div id="fit-line-7" class="mobile-hidden"> </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 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 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 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 Waist</div>\n <div class="fit-outline-line-text fit-outline-line-h-hip-text">High Hip</div>\n <div class="fit-outline-line-text fit-outline-line-l-hip-text">Low 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=` ${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 of your size?</div>\n \n <div class="tfr-toggle-closed">\n <div class="tfr-flex tfr-items-center">\n <div>Try</div>\n <div class="tfr-powered-by-logo">${Dp}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n\n <div class="tfr-toggle-open">\n <div id="tfr-login-to-view" class="tfr-flex tfr-items-center">\n ${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=await this.getGarmentLocations(e);console.debug("locations",t),console.debug("filledLocations",e),this.sizeRecComponent.setGarmentLocations(t||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const e=await this.getRecommenedSize();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 getRecommenedSize(){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.size,sizes:t.fits.map(e=>({size:t.available_sizes.find(t=>t.id===e.size_id).size_value.size,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 checkIfPublished(e){const t=await this.getStyle(e);return Boolean(null==t?void 0:t.is_published)}setSku(e){this.tfrSizeRec.setSku(e),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}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.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(yp);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.setRecommendedSize(),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(){var e,t;const n=await this.getStyle(this.sku),i=(null===(t=null===(e=null==n?void 0:n.sizes)||void 0===e?void 0:e[0])||void 0===t?void 0:t.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;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.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">×</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"> </div>\n <div id="fit-line-2"> </div>\n <div id="fit-line-3"> </div>\n <div id="fit-line-4"> </div>\n <div id="fit-line-5"> </div>\n <div id="fit-line-6"> </div>\n <div id="fit-line-7" class="mobile-hidden"> </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 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 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 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 Waist</div>\n <div class="fit-outline-line-text fit-outline-line-h-hip-text">High Hip</div>\n <div class="fit-outline-line-text fit-outline-line-l-hip-text">Low 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=` ${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 of your size?</div>\n \n <div class="tfr-toggle-closed">\n <div class="tfr-flex tfr-items-center">\n <div>Try</div>\n <div class="tfr-powered-by-logo">${Dp}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n\n <div class="tfr-toggle-open">\n <div id="tfr-login-to-view" class="tfr-flex tfr-items-center">\n ${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=await this.getGarmentLocations(e);console.debug("locations",t),console.debug("filledLocations",e),this.sizeRecComponent.setGarmentLocations(t||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const e=await this.getRecommenedSize();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 getRecommenedSize(){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 checkIfPublished(e){const t=await this.getStyle(e);return Boolean(null==t?void 0:t.is_published)}setSku(e){this.tfrSizeRec.setSku(e),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}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.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.setRecommendedSize(),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(){var e,t;const n=await this.getStyle(this.sku),i=(null===(t=null===(e=null==n?void 0:n.sizes)||void 0===e?void 0:e[0])||void 0===t?void 0:t.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
|