@thefittingroom/shop-ui 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +987 -492
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +222 -192
- package/package.json +2 -2
package/dist/esm/index.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.5.
|
|
2
|
+
* thefittingroom v1.5.3 (2024-09-03T15:46:41.127Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var i=new Image;i.onload=r,i.onerror=r,i.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const r=document.getElementById(t);if(!r)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const i=(null==t?void 0:t.length)-2;r.value=i.toString(),r.max=(t.length-1).toString();const s=()=>{const e=parseInt(r.value);n(r,t[e])};return n(r,t[i]),r.removeEventListener("input",s),r.addEventListener("input",s),()=>{r.removeEventListener("input",s)}}}},r=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(r(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],o=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==o||null==a||null==c)throw new s;const l=i<<2|o>>4;if(r.push(l),64!==a){const t=o<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};
|
|
6
6
|
/*!
|
|
7
|
-
* thefittingroom v1.5.
|
|
7
|
+
* thefittingroom v1.5.2 (2024-09-03T15:43:56.403Z)
|
|
8
8
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
@@ -121,7 +121,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
121
121
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
122
122
|
* See the License for the specific language governing permissions and
|
|
123
123
|
* limitations under the License.
|
|
124
|
-
*/function w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function
|
|
124
|
+
*/function w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function S(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class _{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),i}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function E(){}
|
|
125
125
|
/**
|
|
126
126
|
* @license
|
|
127
127
|
* Copyright 2021 Google LLC
|
|
@@ -201,7 +201,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
201
201
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
202
|
* See the License for the specific language governing permissions and
|
|
203
203
|
* limitations under the License.
|
|
204
|
-
*/var R;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(R||(R={}));const N={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},L=R.INFO,O={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=O[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};class
|
|
204
|
+
*/var R;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(R||(R={}));const N={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},L=R.INFO,O={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=O[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};class P{constructor(t){this.name=t,this._logLevel=L,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in R))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,R.DEBUG,...t),this._logHandler(this,R.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,R.VERBOSE,...t),this._logHandler(this,R.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,R.INFO,...t),this._logHandler(this,R.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,R.WARN,...t),this._logHandler(this,R.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,R.ERROR,...t),this._logHandler(this,R.ERROR,...t)}}const x=(t,e)=>e.some((e=>t instanceof e));let M,U;const F=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return z.get(t);if("objectStoreNames"===e)return t.objectStoreNames||B.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return W(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function $(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(U||(U=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(K(this),e),W(F.get(this))}:function(...e){return W(t.apply(K(this),e))}:function(e,...n){const r=t.call(K(this),e,...n);return B.set(r,e.sort?e.sort():[e]),W(r)}}function q(t){return"function"==typeof t?$(t):(t instanceof IDBTransaction&&function(t){if(z.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",s),t.removeEventListener("abort",s)},i=()=>{e(),r()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",i),t.addEventListener("error",s),t.addEventListener("abort",s)}));z.set(t,e)}(t),x(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function W(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",i),t.removeEventListener("error",s)},i=()=>{e(W(t.result)),r()},s=()=>{n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",s)}));return e.then((e=>{e instanceof IDBCursor&&F.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(V.has(t))return V.get(t);const e=q(t);return e!==t&&(V.set(t,e),H.set(e,t)),e}const K=t=>H.get(t);const G=["get","getKey","getAll","getAllKeys","count"],Q=["put","add","delete","clear"],Y=new Map;function J(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Y.get(e))return Y.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=Q.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!G.includes(n))return;const s=async function(t,...e){const s=this.transaction(t,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),i&&s.done]))[0]};return Y.set(e,s),s}j=(t=>({...t,get:(e,n,r)=>J(e,n)||t.get(e,n,r),has:(e,n)=>!!J(e,n)||t.has(e,n)}))(j);
|
|
205
205
|
/**
|
|
206
206
|
* @license
|
|
207
207
|
* Copyright 2019 Google LLC
|
|
@@ -218,7 +218,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
218
218
|
* See the License for the specific language governing permissions and
|
|
219
219
|
* limitations under the License.
|
|
220
220
|
*/
|
|
221
|
-
class X{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Z="@firebase/app",tt="0.9
|
|
221
|
+
class X{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Z="@firebase/app",tt="0.10.9",et=new P("@firebase/app"),nt="@firebase/app-compat",rt="@firebase/analytics-compat",it="@firebase/analytics",st="@firebase/app-check-compat",ot="@firebase/app-check",at="@firebase/auth",ct="@firebase/auth-compat",lt="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",dt="@firebase/functions-compat",ft="@firebase/installations",pt="@firebase/installations-compat",gt="@firebase/messaging",mt="@firebase/messaging-compat",yt="@firebase/performance",vt="@firebase/performance-compat",wt="@firebase/remote-config",bt="@firebase/remote-config-compat",St="@firebase/storage",_t="@firebase/storage-compat",Et="@firebase/firestore",Tt="@firebase/vertexai-preview",It="@firebase/firestore-compat",kt="firebase",Ct="[DEFAULT]",At={[Z]:"fire-core",[nt]:"fire-core-compat",[it]:"fire-analytics",[rt]:"fire-analytics-compat",[ot]:"fire-app-check",[st]:"fire-app-check-compat",[at]:"fire-auth",[ct]:"fire-auth-compat",[lt]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[dt]:"fire-fn-compat",[ft]:"fire-iid",[pt]:"fire-iid-compat",[gt]:"fire-fcm",[mt]:"fire-fcm-compat",[yt]:"fire-perf",[vt]:"fire-perf-compat",[wt]:"fire-rc",[bt]:"fire-rc-compat",[St]:"fire-gcs",[_t]:"fire-gcs-compat",[Et]:"fire-fst",[It]:"fire-fst-compat",[Tt]:"fire-vertex","fire-js":"fire-js",[kt]:"fire-js-all"},Rt=new Map,Nt=new Map,Lt=new Map;function Ot(t,e){try{t.container.addComponent(e)}catch(n){et.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Dt(t){const e=t.name;if(Lt.has(e))return et.debug(`There were multiple attempts to register component ${e}.`),!1;Lt.set(e,t);for(const e of Rt.values())Ot(e,t);for(const e of Nt.values())Ot(e,t);return!0}function Pt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function xt(t){return void 0!==t.settings}
|
|
222
222
|
/**
|
|
223
223
|
* @license
|
|
224
224
|
* Copyright 2019 Google LLC
|
|
@@ -234,7 +234,7 @@ class X{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
|
|
|
234
234
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
235
235
|
* See the License for the specific language governing permissions and
|
|
236
236
|
* limitations under the License.
|
|
237
|
-
*/const
|
|
237
|
+
*/const Mt=new g("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});
|
|
238
238
|
/**
|
|
239
239
|
* @license
|
|
240
240
|
* Copyright 2019 Google LLC
|
|
@@ -251,7 +251,7 @@ class X{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
|
|
|
251
251
|
* See the License for the specific language governing permissions and
|
|
252
252
|
* limitations under the License.
|
|
253
253
|
*/
|
|
254
|
-
class
|
|
254
|
+
class Ut{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new I("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Mt.create("app-deleted",{appName:this._name})}}
|
|
255
255
|
/**
|
|
256
256
|
* @license
|
|
257
257
|
* Copyright 2019 Google LLC
|
|
@@ -267,7 +267,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
267
267
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
268
268
|
* See the License for the specific language governing permissions and
|
|
269
269
|
* limitations under the License.
|
|
270
|
-
*/const
|
|
270
|
+
*/const Ft="10.13.0";function zt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:Ct,automaticDataCollectionEnabled:!1},e),i=r.name;if("string"!=typeof i||!i)throw Mt.create("bad-app-name",{appName:String(i)});if(n||(n=u()),!n)throw Mt.create("no-options");const s=Rt.get(i);if(s){if(y(n,s.options)&&y(r,s.config))return s;throw Mt.create("duplicate-app",{appName:i})}const o=new A(i);for(const t of Lt.values())o.addComponent(t);const a=new Ut(n,r,o);return Rt.set(i,a),a}function Bt(t=Ct){const e=Rt.get(t);if(!e&&t===Ct&&u())return zt();if(!e)throw Mt.create("no-app",{appName:t});return e}function Vt(t,e,n){var r;let i=null!==(r=At[t])&&void 0!==r?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const t=[`Unable to register library "${i}" with version "${e}":`];return s&&t.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void et.warn(t.join(" "))}Dt(new I(`${i}-version`,(()=>({library:i,version:e})),"VERSION"))}
|
|
271
271
|
/**
|
|
272
272
|
* @license
|
|
273
273
|
* Copyright 2021 Google LLC
|
|
@@ -283,7 +283,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
283
283
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
284
284
|
* See the License for the specific language governing permissions and
|
|
285
285
|
* limitations under the License.
|
|
286
|
-
*/const
|
|
286
|
+
*/const Ht="firebase-heartbeat-database",jt=1,$t="firebase-heartbeat-store";let qt=null;function Wt(){return qt||(qt=function(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=W(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(W(o.result),t.oldVersion,t.newVersion,W(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{s&&t.addEventListener("close",(()=>s())),i&&t.addEventListener("versionchange",(t=>i(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ht,jt,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore($t)}catch(t){console.warn(t)}}}).catch((t=>{throw Mt.create("idb-open",{originalErrorMessage:t.message})}))),qt}async function Kt(t,e){try{const n=(await Wt()).transaction($t,"readwrite"),r=n.objectStore($t);await r.put(e,Gt(t)),await n.done}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Mt.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}function Gt(t){return`${t.name}!${t.options.appId}`}
|
|
287
287
|
/**
|
|
288
288
|
* @license
|
|
289
289
|
* Copyright 2021 Google LLC
|
|
@@ -299,7 +299,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
299
299
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
300
300
|
* See the License for the specific language governing permissions and
|
|
301
301
|
* limitations under the License.
|
|
302
|
-
*/class
|
|
302
|
+
*/class Qt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Jt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){var t,e,n;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Yt();if(console.log("heartbeats",null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats),null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some((t=>t.date===i)))return;return this._heartbeatsCache.heartbeats.push({date:i,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(t){et.warn(t)}}async getHeartbeatsHeader(){var t;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const e=Yt(),{heartbeatsToSend:n,unsentEntries:r}=function(t,e=1024){const n=[];let r=t.slice();for(const i of t){const t=n.find((t=>t.agent===i.agent));if(t){if(t.dates.push(i.date),Xt(n)>e){t.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Xt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=o(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return et.warn(t),""}}}function Yt(){return(new Date).toISOString().substring(0,10)}class Jt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await Wt()).transaction($t),n=await e.objectStore($t).get(Gt(t));return await e.done,n}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Mt.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}(this.app);return(null==t?void 0:t.heartbeats)?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Kt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Kt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Xt(t){return o(JSON.stringify({version:2,heartbeats:t})).length}
|
|
303
303
|
/**
|
|
304
304
|
* @license
|
|
305
305
|
* Copyright 2019 Google LLC
|
|
@@ -315,7 +315,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
315
315
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
316
316
|
* See the License for the specific language governing permissions and
|
|
317
317
|
* limitations under the License.
|
|
318
|
-
*/var
|
|
318
|
+
*/var Zt;Zt="",Dt(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Dt(new I("heartbeat",(t=>new Qt(t)),"PRIVATE")),Vt(Z,tt,Zt),Vt(Z,tt,"esm2017"),Vt("fire-js","");
|
|
319
319
|
/**
|
|
320
320
|
* @license
|
|
321
321
|
* Copyright 2017 Google LLC
|
|
@@ -348,7 +348,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
348
348
|
* See the License for the specific language governing permissions and
|
|
349
349
|
* limitations under the License.
|
|
350
350
|
*/
|
|
351
|
-
const
|
|
351
|
+
const te=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},ee={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(te(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],s=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==s||null==o||null==a)throw Error();const c=i<<2|s>>4;if(r.push(c),64!==o){const t=s<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},ne=function(t){return function(t){const e=te(t);return ee.encodeByteArray(e,!0)}(t).replace(/\./g,"")};
|
|
352
352
|
/**
|
|
353
353
|
* @license
|
|
354
354
|
* Copyright 2022 Google LLC
|
|
@@ -365,7 +365,7 @@ const Jt=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.char
|
|
|
365
365
|
* See the License for the specific language governing permissions and
|
|
366
366
|
* limitations under the License.
|
|
367
367
|
*/
|
|
368
|
-
const
|
|
368
|
+
const re=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,ie=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return ee.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},se=()=>{try{return re()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||ie()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},oe=t=>{const e=(t=>{var e,n;return null===(n=null===(e=se())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]};class ae extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,ae.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ce.prototype.create)}}class ce{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,i=this.errors[t],s=i?function(t,e){return t.replace(le,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`;return new ae(r,o,n)}}const le=/\{\$([^}]+)}/g;
|
|
369
369
|
/**
|
|
370
370
|
* @license
|
|
371
371
|
* Copyright 2021 Google LLC
|
|
@@ -381,7 +381,7 @@ const te=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
381
381
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
382
382
|
* See the License for the specific language governing permissions and
|
|
383
383
|
* limitations under the License.
|
|
384
|
-
*/function
|
|
384
|
+
*/function ue(t){return t&&t._delegate?t._delegate:t}class he{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
|
|
385
385
|
/**
|
|
386
386
|
* @license
|
|
387
387
|
* Copyright 2017 Google LLC
|
|
@@ -397,7 +397,7 @@ const te=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
397
397
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
398
398
|
* See the License for the specific language governing permissions and
|
|
399
399
|
* limitations under the License.
|
|
400
|
-
*/var le;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(le||(le={}));const ue={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},he=le.INFO,de={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},fe=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=de[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};var pe=function(t,e){return pe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},pe(t,e)};function ge(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function me(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var ye,ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},we=we||{},be=ve||self;function _e(){}function Se(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function Ee(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Te="closure_uid_"+(1e9*Math.random()>>>0),Ie=0;function ke(t,e,n){return t.call.apply(t.bind,arguments)}function Ce(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Ae(t,e,n){return(Ae=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ke:Ce).apply(null,arguments)}function Re(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function Ne(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function Le(){this.s=this.s,this.o=this.o}Le.prototype.s=!1,Le.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Te)&&t[Te]||(t[Te]=++Ie))},Le.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Oe=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function De(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function xe(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Se(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function Pe(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Pe.prototype.h=function(){this.defaultPrevented=!0};var Me=function(){if(!be.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{be.addEventListener("test",_e,e),be.removeEventListener("test",_e,e)}catch(t){}return t}();function Ue(t){return/^[\s\xa0]*$/.test(t)}var Fe=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function ze(t,e){return t<e?-1:t>e?1:0}function Be(){var t=be.navigator;return t&&(t=t.userAgent)?t:""}function Ve(t){return-1!=Be().indexOf(t)}function He(t){return He[" "](t),t}He[" "]=_e;var $e,je,qe=Ve("Opera"),We=Ve("Trident")||Ve("MSIE"),Ke=Ve("Edge"),Ge=Ke||We,Qe=Ve("Gecko")&&!(-1!=Be().toLowerCase().indexOf("webkit")&&!Ve("Edge"))&&!(Ve("Trident")||Ve("MSIE"))&&!Ve("Edge"),Ye=-1!=Be().toLowerCase().indexOf("webkit")&&!Ve("Edge");function Je(){var t=be.document;return t?t.documentMode:void 0}t:{var Xe="",Ze=(je=Be(),Qe?/rv:([^\);]+)(\)|;)/.exec(je):Ke?/Edge\/([\d\.]+)/.exec(je):We?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(je):Ye?/WebKit\/(\S+)/.exec(je):qe?/(?:Version)[ \/]?(\S+)/.exec(je):void 0);if(Ze&&(Xe=Ze?Ze[1]:""),We){var tn=Je();if(null!=tn&&tn>parseFloat(Xe)){$e=String(tn);break t}}$e=Xe}var en,nn={};function rn(){return function(t){var e=nn;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Fe(String($e)).split("."),n=Fe("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=ze(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||ze(0==s[2].length,0==o[2].length)||ze(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(be.document&&We){var sn=Je();en=sn||(parseInt($e,10)||void 0)}else en=void 0;var on=en;function an(t,e){if(Pe.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Qe){t:{try{He(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:cn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&an.X.h.call(this)}}Ne(an,Pe);var cn={2:"touch",3:"pen",4:"mouse"};an.prototype.h=function(){an.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var ln="closure_listenable_"+(1e6*Math.random()|0),un=0;function hn(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++un,this.ba=this.ea=!1}function dn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function fn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function pn(t){var e={};for(var n in t)e[n]=t[n];return e}var gn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function mn(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<gn.length;s++)n=gn[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function yn(t){this.src=t,this.g={},this.h=0}function vn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=Oe(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(dn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function wn(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}yn.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=wn(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new hn(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var bn="closure_lm_"+(1e6*Math.random()|0),_n={};function Sn(t,e,n,r,i){if(r&&r.once)return Tn(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)Sn(t,e[s],n,r,i);return null}return n=Ln(n),t&&t[ln]?t.N(e,n,Ee(r)?!!r.capture:!!r,i):En(t,e,n,!1,r,i)}function En(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=Ee(i)?!!i.capture:!!i,a=Rn(t);if(a||(t[bn]=a=new yn(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=An;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Me||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Cn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Tn(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Tn(t,e[s],n,r,i);return null}return n=Ln(n),t&&t[ln]?t.O(e,n,Ee(r)?!!r.capture:!!r,i):En(t,e,n,!0,r,i)}function In(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)In(t,e[s],n,r,i);else r=Ee(r)?!!r.capture:!!r,n=Ln(n),t&&t[ln]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=wn(s=t.g[e],n,r,i))&&(dn(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=Rn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=wn(e,n,r,i)),(n=-1<t?e[t]:null)&&kn(n))}function kn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[ln])vn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Cn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Rn(e))?(vn(n,t),0==n.h&&(n.src=null,e[bn]=null)):dn(t)}}}function Cn(t){return t in _n?_n[t]:_n[t]="on"+t}function An(t,e){if(t.ba)t=!0;else{e=new an(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&kn(t),t=n.call(r,e)}return t}function Rn(t){return(t=t[bn])instanceof yn?t:null}var Nn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ln(t){return"function"==typeof t?t:(t[Nn]||(t[Nn]=function(e){return t.handleEvent(e)}),t[Nn])}function On(){Le.call(this),this.i=new yn(this),this.P=this,this.I=null}function Dn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Pe(e,t);else if(e instanceof Pe)e.target=e.target||t;else{var i=e;mn(e=new Pe(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=xn(o,r,!0,e)&&i}if(i=xn(o=e.g=t,r,!0,e)&&i,i=xn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=xn(o=e.g=n[s],r,!1,e)&&i}function xn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&vn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}Ne(On,Le),On.prototype[ln]=!0,On.prototype.removeEventListener=function(t,e,n,r){In(this,t,e,n,r)},On.prototype.M=function(){if(On.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)dn(n[r]);delete e.g[t],e.h--}}this.I=null},On.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},On.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Pn=be.JSON.stringify;function Mn(){var t=jn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Un,Fn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=zn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),zn=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new Bn}),(function(t){return t.reset()})),Bn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function Vn(t){be.setTimeout((function(){throw t}),0)}function Hn(t,e){Un||function(){var t=be.Promise.resolve(void 0);Un=function(){t.then(qn)}}(),$n||(Un(),$n=!0),jn.add(t,e)}var $n=!1,jn=new Fn;function qn(){for(var t;t=Mn();){try{t.h.call(t.g)}catch(t){Vn(t)}var e=zn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}$n=!1}function Wn(t,e){On.call(this),this.h=t||1,this.g=e||be,this.j=Ae(this.lb,this),this.l=Date.now()}function Kn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Gn(t,e,n){if("function"==typeof t)n&&(t=Ae(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Ae(t.handleEvent,t)}return 2147483647<Number(e)?-1:be.setTimeout(t,e||0)}function Qn(t){t.g=Gn((function(){t.g=null,t.i&&(t.i=!1,Qn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ne(Wn,On),(ye=Wn.prototype).ca=!1,ye.R=null,ye.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Dn(this,"tick"),this.ca&&(Kn(this),this.start()))}},ye.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},ye.M=function(){Wn.X.M.call(this),Kn(this),delete this.g};var Yn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}pe(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:Qn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(be.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Le);function Jn(t){Le.call(this),this.h=t,this.g={}}Ne(Jn,Le);var Xn=[];function Zn(t,e,n,r){Array.isArray(n)||(n&&(Xn[0]=n.toString()),n=Xn);for(var i=0;i<n.length;i++){var s=Sn(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function tr(t){fn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&kn(t)}),t),t.g={}}function er(){this.g=!0}function nr(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return Pn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Jn.prototype.M=function(){Jn.X.M.call(this),tr(this)},Jn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},er.prototype.Aa=function(){this.g=!1},er.prototype.info=function(){};var rr={},ir=null;function sr(){return ir=ir||new On}function or(t){Pe.call(this,rr.Pa,t)}function ar(t){var e=sr();Dn(e,new or(e))}function cr(t,e){Pe.call(this,rr.STAT_EVENT,t),this.stat=e}function lr(t){var e=sr();Dn(e,new cr(e,t))}function ur(t,e){Pe.call(this,rr.Qa,t),this.size=e}function hr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return be.setTimeout((function(){t()}),e)}rr.Pa="serverreachability",Ne(or,Pe),rr.STAT_EVENT="statevent",Ne(cr,Pe),rr.Qa="timingevent",Ne(ur,Pe);var dr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},fr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function pr(){}function gr(t){return t.h||(t.h=t.i())}function mr(){}pr.prototype.h=null;var yr,vr={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function wr(){Pe.call(this,"d")}function br(){Pe.call(this,"c")}function _r(){}function Sr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Jn(this),this.O=Tr,t=Ge?125:void 0,this.T=new Wn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new Er}function Er(){this.i=null,this.g="",this.h=!1}Ne(wr,Pe),Ne(br,Pe),Ne(_r,pr),_r.prototype.g=function(){return new XMLHttpRequest},_r.prototype.i=function(){return{}},yr=new _r;var Tr=45e3,Ir={},kr={};function Cr(t,e,n){t.K=1,t.v=Wr(Vr(e)),t.s=n,t.P=!0,Ar(t,null)}function Ar(t,e){t.F=Date.now(),Or(t),t.A=Vr(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),si(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Er,t.g=ss(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Yn(Ae(t.La,t,t.g),t.N)),Zn(t.S,t.g,"readystatechange",t.ib),e=t.H?pn(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),ar(),function(t,e,n,r,i,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Rr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Nr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=Lr(t,n))==kr){4==e&&(t.o=4,lr(14),i=!1),nr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ir){t.o=4,lr(15),nr(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}nr(t.j,t.m,r,null),Ur(t,r)}Rr(t)&&r!=kr&&r!=Ir&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,lr(16),i=!1),t.i=t.i&&i,i?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Ji(e),e.K=!0,lr(11))):(nr(t.j,t.m,n,"[Invalid Chunked Response]"),Mr(t),Pr(t))}function Lr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?kr:(n=Number(e.substring(n,r)),isNaN(n)?Ir:(r+=1)+n>e.length?kr:(e=e.substr(r,n),t.C=r+n,e))}function Or(t){t.V=Date.now()+t.O,Dr(t,t.O)}function Dr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=hr(Ae(t.gb,t),e)}function xr(t){t.B&&(be.clearTimeout(t.B),t.B=null)}function Pr(t){0==t.l.G||t.I||ts(t.l,t)}function Mr(t){xr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Kn(t.T),tr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Ur(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||di(n.h,t)))if(!t.J&&di(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Zi(n),$i(n)}Yi(n),lr(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=hr(Ae(n.cb,n),6e3));if(1>=hi(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else ns(n,11)}else if((t.J||n.g==t)&&Zi(n),!Ue(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(fi(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,qr(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=is(r,r.H?r.ka:null,r.V),f.J){pi(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(xr(p),Or(p)),r.g=f}else Qi(r);0<n.i.length&&qi(n)}else"stop"!=s[0]&&"close"!=s[0]||ns(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?ns(n,7):Hi(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}ar()}catch(s){}}function Fr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Se(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Se(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Se(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(ye=Sr.prototype).setTimeout=function(t){this.O=t},ye.ib=function(t){t=t.target;var e=this.L;e&&3==Mi(t)?e.l():this.La(t)},ye.La=function(t){try{if(t==this.g)t:{var e=Mi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ge||this.g&&(this.h.h||this.g.fa()||Ui(this.g)))){this.I||4!=e||7==n||ar(),xr(this);var r=this.g.aa();this.Y=r;e:if(Rr(this)){var i=Ui(this.g);t="";var s=i.length,o=4==Mi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Mr(this),Pr(this);var a="";break e}this.h.i=new be.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Ue(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,lr(12),Mr(this),Pr(this);break t}nr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Ur(this,r)}this.P?(Nr(this,e,a),Ge&&this.i&&3==e&&(Zn(this.S,this.T,"tick",this.hb),this.T.start())):(nr(this.j,this.m,a,null),Ur(this,a)),4==e&&Mr(this),this.i&&!this.I&&(4==e?ts(this.l,this):(this.i=!1,Or(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,lr(12)):(this.o=0,lr(13)),Mr(this),Pr(this)}}}catch(e){}},ye.hb=function(){if(this.g){var t=Mi(this.g),e=this.g.fa();this.C<e.length&&(xr(this),Nr(this,t,e),this.i&&4!=t&&Or(this))}},ye.cancel=function(){this.I=!0,Mr(this)},ye.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(ar(),lr(17)),Mr(this),this.o=2,Pr(this)):Dr(this,this.V-t)};var zr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Br(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Br){this.h=void 0!==e?e:t.h,Hr(this,t.j),this.s=t.s,this.g=t.g,$r(this,t.m),this.l=t.l,e=t.i;var n=new ei;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),jr(this,n),this.o=t.o}else t&&(n=String(t).match(zr))?(this.h=!!e,Hr(this,n[1]||"",!0),this.s=Kr(n[2]||""),this.g=Kr(n[3]||"",!0),$r(this,n[4]),this.l=Kr(n[5]||"",!0),jr(this,n[6]||"",!0),this.o=Kr(n[7]||"")):(this.h=!!e,this.i=new ei(null,this.h))}function Vr(t){return new Br(t)}function Hr(t,e,n){t.j=n?Kr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function $r(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function jr(t,e,n){e instanceof ei?(t.i=e,function(t,e){e&&!t.j&&(ni(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ri(this,e),si(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Gr(e,Zr)),t.i=new ei(e,t.h))}function qr(t,e,n){t.i.set(e,n)}function Wr(t){return qr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Kr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Gr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Qr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Qr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Br.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Gr(e,Yr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Gr(e,Yr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Gr(n,"/"==n.charAt(0)?Xr:Jr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Gr(n,ti)),t.join("")};var Yr=/[#\/\?@]/g,Jr=/[#\?:]/g,Xr=/[#\?]/g,Zr=/[#\?@]/g,ti=/#/g;function ei(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ni(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function ri(t,e){ni(t),e=oi(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ii(t,e){return ni(t),e=oi(t,e),t.g.has(e)}function si(t,e,n){ri(t,e),0<n.length&&(t.i=null,t.g.set(oi(t,e),De(n)),t.h+=n.length)}function oi(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(ye=ei.prototype).add=function(t,e){ni(this),this.i=null,t=oi(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},ye.forEach=function(t,e){ni(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},ye.oa=function(){ni(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},ye.W=function(t){ni(this);var e=[];if("string"==typeof t)ii(this,t)&&(e=e.concat(this.g.get(oi(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},ye.set=function(t,e){return ni(this),this.i=null,ii(this,t=oi(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},ye.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},ye.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var ai=function(t,e){this.h=t,this.g=e};function ci(t){this.l=t||li,be.PerformanceNavigationTiming?t=0<(t=be.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(be.g&&be.g.Ga&&be.g.Ga()&&be.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var li=10;function ui(t){return!!t.h||!!t.g&&t.g.size>=t.j}function hi(t){return t.h?1:t.g?t.g.size:0}function di(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function fi(t,e){t.g?t.g.add(e):t.h=e}function pi(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function gi(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=ge(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return De(t.i)}function mi(){}function yi(){this.g=new mi}function vi(t,e,n){var r=n||"";try{Fr(t,(function(t,n){var i=t;Ee(t)&&(i=Pn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function wi(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function bi(t){this.l=t.ac||null,this.j=t.jb||!1}function _i(t,e){On.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Si,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}ci.prototype.cancel=function(){var t,e;if(this.i=gi(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ge(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},mi.prototype.stringify=function(t){return be.JSON.stringify(t,void 0)},mi.prototype.parse=function(t){return be.JSON.parse(t,void 0)},Ne(bi,pr),bi.prototype.g=function(){return new _i(this.l,this.j)},bi.prototype.i=function(t){return function(){return t}}({}),Ne(_i,On);var Si=0;function Ei(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ti(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ii(t)}function Ii(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(ye=_i.prototype).open=function(t,e){if(this.readyState!=Si)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ii(this)},ye.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||be).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},ye.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Ti(this)),this.readyState=Si},ye.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Ii(this)),this.g&&(this.readyState=3,Ii(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==be.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Ei(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},ye.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Ti(this):Ii(this),3==this.readyState&&Ei(this)}},ye.Va=function(t){this.g&&(this.response=this.responseText=t,Ti(this))},ye.Ua=function(t){this.g&&(this.response=t,Ti(this))},ye.ga=function(){this.g&&Ti(this)},ye.setRequestHeader=function(t,e){this.v.append(t,e)},ye.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},ye.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(_i.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var ki=be.JSON.parse;function Ci(t){On.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Ai,this.K=this.L=!1}Ne(Ci,On);var Ai="",Ri=/^https?$/i,Ni=["POST","PUT"];function Li(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Oi(t),xi(t)}function Oi(t){t.D||(t.D=!0,Dn(t,"complete"),Dn(t,"error"))}function Di(t){if(t.h&&void 0!==we&&(!t.C[1]||4!=Mi(t)||2!=t.aa()))if(t.v&&4==Mi(t))Gn(t.Ha,0,t);else if(Dn(t,"readystatechange"),4==Mi(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(zr)[1]||null;if(!s&&be.self&&be.self.location){var o=be.self.location.protocol;s=o.substr(0,o.length-1)}i=!Ri.test(s?s.toLowerCase():"")}e=i}if(e)Dn(t,"complete"),Dn(t,"success");else{t.m=6;try{var a=2<Mi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Oi(t)}}finally{xi(t)}}}function xi(t,e){if(t.g){Pi(t);var n=t.g,r=t.C[0]?_e:null;t.g=null,t.C=null,e||Dn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Pi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(be.clearTimeout(t.A),t.A=null)}function Mi(t){return t.g?t.g.readyState:0}function Ui(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Ai:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Fi(t){var e="";return fn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function zi(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Fi(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):qr(t,e,n))}function Bi(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Vi(t){this.Ca=0,this.i=[],this.j=new er,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Bi("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Bi("baseRetryDelayMs",5e3,t),this.bb=Bi("retryDelaySeedMs",1e4,t),this.$a=Bi("forwardChannelMaxRetries",2,t),this.ta=Bi("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new ci(t&&t.concurrentRequestLimit),this.Fa=new yi,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Hi(t){if(ji(t),3==t.G){var e=t.U++,n=Vr(t.F);qr(n,"SID",t.I),qr(n,"RID",e),qr(n,"TYPE","terminate"),Ki(t,n),(e=new Sr(t,t.j,e,void 0)).K=2,e.v=Wr(Vr(n)),n=!1,be.navigator&&be.navigator.sendBeacon&&(n=be.navigator.sendBeacon(e.v.toString(),"")),!n&&be.Image&&((new Image).src=e.v,n=!0),n||(e.g=ss(e.l,null),e.g.da(e.v)),e.F=Date.now(),Or(e)}rs(t)}function $i(t){t.g&&(Ji(t),t.g.cancel(),t.g=null)}function ji(t){$i(t),t.u&&(be.clearTimeout(t.u),t.u=null),Zi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&be.clearTimeout(t.m),t.m=null)}function qi(t){ui(t.h)||t.m||(t.m=!0,Hn(t.Ja,t),t.C=0)}function Wi(t,e){var n;n=e?e.m:t.U++;var r=Vr(t.F);qr(r,"SID",t.I),qr(r,"RID",n),qr(r,"AID",t.T),Ki(t,r),t.o&&t.s&&zi(r,t.o,t.s),n=new Sr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Gi(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),fi(t.h,n),Cr(n,r,e)}function Ki(t,e){t.ia&&fn(t.ia,(function(t,n){qr(e,n,t)})),t.l&&Fr({},(function(t,n){qr(e,n,t)}))}function Gi(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Ae(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{vi(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Qi(t){t.g||t.u||(t.Z=1,Hn(t.Ia,t),t.A=0)}function Yi(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=hr(Ae(t.Ia,t),es(t,t.A)),t.A++,!0)}function Ji(t){null!=t.B&&(be.clearTimeout(t.B),t.B=null)}function Xi(t){t.g=new Sr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Vr(t.sa);qr(e,"RID","rpc"),qr(e,"SID",t.I),qr(e,"CI",t.L?"0":"1"),qr(e,"AID",t.T),qr(e,"TYPE","xmlhttp"),Ki(t,e),t.o&&t.s&&zi(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Wr(Vr(e)),n.s=null,n.P=!0,Ar(n,t)}function Zi(t){null!=t.v&&(be.clearTimeout(t.v),t.v=null)}function ts(t,e){var n=null;if(t.g==e){Zi(t),Ji(t),t.g=null;var r=2}else{if(!di(t.h,e))return;n=e.D,pi(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;Dn(r=sr(),new ur(r,n)),qi(t)}else Qi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(hi(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=hr(Ae(t.Ja,t,e),es(t,t.C)),t.C++,0)))}(t,e)||2==r&&Yi(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:ns(t,5);break;case 4:ns(t,10);break;case 3:ns(t,6);break;default:ns(t,2)}}function es(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ns(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Ae(t.kb,t);n||(n=new Br("//www.google.com/images/cleardot.gif"),be.location&&"http"==be.location.protocol||Hr(n,"https"),Wr(n)),function(t,e){var n=new er;if(be.Image){var r=new Image;r.onload=Re(wi,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Re(wi,n,r,"TestLoadImage: error",!1,e),r.onabort=Re(wi,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Re(wi,n,r,"TestLoadImage: timeout",!1,e),be.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else lr(2);t.G=0,t.l&&t.l.va(e),rs(t),ji(t)}function rs(t){if(t.G=0,t.la=[],t.l){var e=gi(t.h);0==e.length&&0==t.i.length||(xe(t.la,e),xe(t.la,t.i),t.h.i.length=0,De(t.i),t.i.length=0),t.l.ua()}}function is(t,e,n){var r=n instanceof Br?Vr(n):new Br(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),$r(r,r.m);else{var i=be.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Br(null,void 0);r&&Hr(s,r),e&&(s.g=e),i&&$r(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&qr(r,n,e),qr(r,"VER",t.ma),Ki(t,r),r}function ss(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Ci(new bi({jb:!0})):new Ci(t.ra)).Ka(t.H),e}function os(){}function as(){if(We&&!(10<=Number(on)))throw Error("Environmental error: no available transport.")}function cs(t,e){On.call(this),this.g=new Vi(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Ue(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Ue(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new hs(this)}function ls(t){wr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function us(){br.call(this),this.status=1}function hs(t){this.g=t}(ye=Ci.prototype).Ka=function(t){this.L=t},ye.da=function(t,e,n,r){var i,s,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():yr.g(),this.C=this.u?gr(this.u):gr(yr),this.g.onreadystatechange=Ae(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void Li(this,h)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var l=ge(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=be.FormData&&t instanceof be.FormData,!(0<=Oe(Ni,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ge(n),f=d.next();!f.done;f=d.next()){var p=me(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{Pi(this),0<this.B&&((this.K=function(t){return We&&rn()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ae(this.qa,this)):this.A=Gn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){Li(this,h)}},ye.qa=function(){void 0!==we&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Dn(this,"timeout"),this.abort(8))},ye.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Dn(this,"complete"),Dn(this,"abort"),xi(this))},ye.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),xi(this,!0)),Ci.X.M.call(this)},ye.Ha=function(){this.s||(this.F||this.v||this.l?Di(this):this.fb())},ye.fb=function(){Di(this)},ye.aa=function(){try{return 2<Mi(this)?this.g.status:-1}catch(t){return-1}},ye.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},ye.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),ki(e)}},ye.Ea=function(){return this.m},ye.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(ye=Vi.prototype).ma=8,ye.G=1,ye.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Sr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?mn(n=pn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Gi(this,e,r),qr(i=Vr(this.F),"RID",t),qr(i,"CVER",22),this.D&&qr(i,"X-HTTP-Session-Id",this.D),Ki(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Fi(n)))+"&"+r:this.o&&zi(i,this.o,n)),fi(this.h,e),this.Ya&&qr(i,"TYPE","init"),this.O?(qr(i,"$req",r),qr(i,"SID","null"),e.Z=!0,Cr(e,i,null)):Cr(e,i,r),this.G=2}}else 3==this.G&&(t?Wi(this,t):0==this.i.length||ui(this.h)||Wi(this))},ye.Ia=function(){if(this.u=null,Xi(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=hr(Ae(this.eb,this),t)}},ye.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,lr(10),$i(this),Xi(this))},ye.cb=function(){null!=this.v&&(this.v=null,$i(this),Yi(this),lr(19))},ye.kb=function(t){t?(this.j.info("Successfully pinged google.com"),lr(2)):(this.j.info("Failed to ping google.com"),lr(1))},(ye=os.prototype).xa=function(){},ye.wa=function(){},ye.va=function(){},ye.ua=function(){},ye.Ra=function(){},as.prototype.g=function(t,e){return new cs(t,e)},Ne(cs,On),cs.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;lr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=is(t,null,t.V),qi(t)},cs.prototype.close=function(){Hi(this.g)},cs.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Pn(t),t=n);e.i.push(new ai(e.ab++,t)),3==e.G&&qi(e)},cs.prototype.M=function(){this.g.l=null,delete this.j,Hi(this.g),delete this.g,cs.X.M.call(this)},Ne(ls,wr),Ne(us,br),Ne(hs,os),hs.prototype.xa=function(){Dn(this.g,"a")},hs.prototype.wa=function(t){Dn(this.g,new ls(t))},hs.prototype.va=function(t){Dn(this.g,new us)},hs.prototype.ua=function(){Dn(this.g,"b")},as.prototype.createWebChannel=as.prototype.g,cs.prototype.send=cs.prototype.u,cs.prototype.open=cs.prototype.m,cs.prototype.close=cs.prototype.close,dr.NO_ERROR=0,dr.TIMEOUT=8,dr.HTTP_ERROR=6,fr.COMPLETE="complete",mr.EventType=vr,vr.OPEN="a",vr.CLOSE="b",vr.ERROR="c",vr.MESSAGE="d",On.prototype.listen=On.prototype.N,Ci.prototype.listenOnce=Ci.prototype.O,Ci.prototype.getLastError=Ci.prototype.Oa,Ci.prototype.getLastErrorCode=Ci.prototype.Ea,Ci.prototype.getStatus=Ci.prototype.aa,Ci.prototype.getResponseJson=Ci.prototype.Sa,Ci.prototype.getResponseText=Ci.prototype.fa,Ci.prototype.send=Ci.prototype.da,Ci.prototype.setWithCredentials=Ci.prototype.Ka;var ds=dr,fs=fr,ps=rr,gs=10,ms=11,ys=bi,vs=mr,ws=Ci;const bs="@firebase/firestore";
|
|
400
|
+
*/var de;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(de||(de={}));const fe={debug:de.DEBUG,verbose:de.VERBOSE,info:de.INFO,warn:de.WARN,error:de.ERROR,silent:de.SILENT},pe=de.INFO,ge={[de.DEBUG]:"log",[de.VERBOSE]:"log",[de.INFO]:"info",[de.WARN]:"warn",[de.ERROR]:"error"},me=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=ge[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};var ye=function(t,e){return ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},ye(t,e)};function ve(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function we(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var be,Se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_e=_e||{},Ee=Se||self;function Te(){}function Ie(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function ke(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ce="closure_uid_"+(1e9*Math.random()>>>0),Ae=0;function Re(t,e,n){return t.call.apply(t.bind,arguments)}function Ne(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Le(t,e,n){return(Le=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Re:Ne).apply(null,arguments)}function Oe(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function De(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function Pe(){this.s=this.s,this.o=this.o}Pe.prototype.s=!1,Pe.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ce)&&t[Ce]||(t[Ce]=++Ae))},Pe.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var xe=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function Ue(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Ie(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function Fe(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Fe.prototype.h=function(){this.defaultPrevented=!0};var ze=function(){if(!Ee.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Ee.addEventListener("test",Te,e),Ee.removeEventListener("test",Te,e)}catch(t){}return t}();function Be(t){return/^[\s\xa0]*$/.test(t)}var Ve=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function He(t,e){return t<e?-1:t>e?1:0}function je(){var t=Ee.navigator;return t&&(t=t.userAgent)?t:""}function $e(t){return-1!=je().indexOf(t)}function qe(t){return qe[" "](t),t}qe[" "]=Te;var We,Ke,Ge=$e("Opera"),Qe=$e("Trident")||$e("MSIE"),Ye=$e("Edge"),Je=Ye||Qe,Xe=$e("Gecko")&&!(-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge"))&&!($e("Trident")||$e("MSIE"))&&!$e("Edge"),Ze=-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge");function tn(){var t=Ee.document;return t?t.documentMode:void 0}t:{var en="",nn=(Ke=je(),Xe?/rv:([^\);]+)(\)|;)/.exec(Ke):Ye?/Edge\/([\d\.]+)/.exec(Ke):Qe?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ke):Ze?/WebKit\/(\S+)/.exec(Ke):Ge?/(?:Version)[ \/]?(\S+)/.exec(Ke):void 0);if(nn&&(en=nn?nn[1]:""),Qe){var rn=tn();if(null!=rn&&rn>parseFloat(en)){We=String(rn);break t}}We=en}var sn,on={};function an(){return function(t){var e=on;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Ve(String(We)).split("."),n=Ve("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=He(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||He(0==s[2].length,0==o[2].length)||He(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(Ee.document&&Qe){var cn=tn();sn=cn||(parseInt(We,10)||void 0)}else sn=void 0;var ln=sn;function un(t,e){if(Fe.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Xe){t:{try{qe(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:hn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&un.X.h.call(this)}}De(un,Fe);var hn={2:"touch",3:"pen",4:"mouse"};un.prototype.h=function(){un.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var dn="closure_listenable_"+(1e6*Math.random()|0),fn=0;function pn(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++fn,this.ba=this.ea=!1}function gn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function mn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function yn(t){var e={};for(var n in t)e[n]=t[n];return e}var vn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function wn(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<vn.length;s++)n=vn[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function bn(t){this.src=t,this.g={},this.h=0}function Sn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=xe(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(gn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function _n(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}bn.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=_n(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new pn(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var En="closure_lm_"+(1e6*Math.random()|0),Tn={};function In(t,e,n,r,i){if(r&&r.once)return Cn(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)In(t,e[s],n,r,i);return null}return n=Pn(n),t&&t[dn]?t.N(e,n,ke(r)?!!r.capture:!!r,i):kn(t,e,n,!1,r,i)}function kn(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=ke(i)?!!i.capture:!!i,a=On(t);if(a||(t[En]=a=new bn(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Ln;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)ze||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Nn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Cn(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Cn(t,e[s],n,r,i);return null}return n=Pn(n),t&&t[dn]?t.O(e,n,ke(r)?!!r.capture:!!r,i):kn(t,e,n,!0,r,i)}function An(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)An(t,e[s],n,r,i);else r=ke(r)?!!r.capture:!!r,n=Pn(n),t&&t[dn]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=_n(s=t.g[e],n,r,i))&&(gn(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=On(t))&&(e=t.g[e.toString()],t=-1,e&&(t=_n(e,n,r,i)),(n=-1<t?e[t]:null)&&Rn(n))}function Rn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[dn])Sn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Nn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=On(e))?(Sn(n,t),0==n.h&&(n.src=null,e[En]=null)):gn(t)}}}function Nn(t){return t in Tn?Tn[t]:Tn[t]="on"+t}function Ln(t,e){if(t.ba)t=!0;else{e=new un(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&Rn(t),t=n.call(r,e)}return t}function On(t){return(t=t[En])instanceof bn?t:null}var Dn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Pn(t){return"function"==typeof t?t:(t[Dn]||(t[Dn]=function(e){return t.handleEvent(e)}),t[Dn])}function xn(){Pe.call(this),this.i=new bn(this),this.P=this,this.I=null}function Mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Fe(e,t);else if(e instanceof Fe)e.target=e.target||t;else{var i=e;wn(e=new Fe(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=Un(o,r,!0,e)&&i}if(i=Un(o=e.g=t,r,!0,e)&&i,i=Un(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=Un(o=e.g=n[s],r,!1,e)&&i}function Un(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&Sn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}De(xn,Pe),xn.prototype[dn]=!0,xn.prototype.removeEventListener=function(t,e,n,r){An(this,t,e,n,r)},xn.prototype.M=function(){if(xn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)gn(n[r]);delete e.g[t],e.h--}}this.I=null},xn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},xn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Fn=Ee.JSON.stringify;function zn(){var t=Kn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Bn,Vn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Hn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Hn=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new jn}),(function(t){return t.reset()})),jn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function $n(t){Ee.setTimeout((function(){throw t}),0)}function qn(t,e){Bn||function(){var t=Ee.Promise.resolve(void 0);Bn=function(){t.then(Gn)}}(),Wn||(Bn(),Wn=!0),Kn.add(t,e)}var Wn=!1,Kn=new Vn;function Gn(){for(var t;t=zn();){try{t.h.call(t.g)}catch(t){$n(t)}var e=Hn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Wn=!1}function Qn(t,e){xn.call(this),this.h=t||1,this.g=e||Ee,this.j=Le(this.lb,this),this.l=Date.now()}function Yn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Jn(t,e,n){if("function"==typeof t)n&&(t=Le(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Le(t.handleEvent,t)}return 2147483647<Number(e)?-1:Ee.setTimeout(t,e||0)}function Xn(t){t.g=Jn((function(){t.g=null,t.i&&(t.i=!1,Xn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}De(Qn,xn),(be=Qn.prototype).ca=!1,be.R=null,be.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Mn(this,"tick"),this.ca&&(Yn(this),this.start()))}},be.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},be.M=function(){Qn.X.M.call(this),Yn(this),delete this.g};var Zn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}ye(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:Xn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(Ee.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Pe);function tr(t){Pe.call(this),this.h=t,this.g={}}De(tr,Pe);var er=[];function nr(t,e,n,r){Array.isArray(n)||(n&&(er[0]=n.toString()),n=er);for(var i=0;i<n.length;i++){var s=In(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function rr(t){mn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Rn(t)}),t),t.g={}}function ir(){this.g=!0}function sr(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return Fn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}tr.prototype.M=function(){tr.X.M.call(this),rr(this)},tr.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},ir.prototype.Aa=function(){this.g=!1},ir.prototype.info=function(){};var or={},ar=null;function cr(){return ar=ar||new xn}function lr(t){Fe.call(this,or.Pa,t)}function ur(t){var e=cr();Mn(e,new lr(e))}function hr(t,e){Fe.call(this,or.STAT_EVENT,t),this.stat=e}function dr(t){var e=cr();Mn(e,new hr(e,t))}function fr(t,e){Fe.call(this,or.Qa,t),this.size=e}function pr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return Ee.setTimeout((function(){t()}),e)}or.Pa="serverreachability",De(lr,Fe),or.STAT_EVENT="statevent",De(hr,Fe),or.Qa="timingevent",De(fr,Fe);var gr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},mr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function yr(){}function vr(t){return t.h||(t.h=t.i())}function wr(){}yr.prototype.h=null;var br,Sr={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function _r(){Fe.call(this,"d")}function Er(){Fe.call(this,"c")}function Tr(){}function Ir(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new tr(this),this.O=Cr,t=Je?125:void 0,this.T=new Qn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new kr}function kr(){this.i=null,this.g="",this.h=!1}De(_r,Fe),De(Er,Fe),De(Tr,yr),Tr.prototype.g=function(){return new XMLHttpRequest},Tr.prototype.i=function(){return{}},br=new Tr;var Cr=45e3,Ar={},Rr={};function Nr(t,e,n){t.K=1,t.v=Qr($r(e)),t.s=n,t.P=!0,Lr(t,null)}function Lr(t,e){t.F=Date.now(),xr(t),t.A=$r(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),ci(n.i,"t",r),t.C=0,n=t.l.H,t.h=new kr,t.g=cs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Zn(Le(t.La,t,t.g),t.N)),nr(t.S,t.g,"readystatechange",t.ib),e=t.H?yn(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),ur(),function(t,e,n,r,i,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Or(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Dr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=Pr(t,n))==Rr){4==e&&(t.o=4,dr(14),i=!1),sr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ar){t.o=4,dr(15),sr(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}sr(t.j,t.m,r,null),Br(t,r)}Or(t)&&r!=Rr&&r!=Ar&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,dr(16),i=!1),t.i=t.i&&i,i?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),ts(e),e.K=!0,dr(11))):(sr(t.j,t.m,n,"[Invalid Chunked Response]"),zr(t),Fr(t))}function Pr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?Rr:(n=Number(e.substring(n,r)),isNaN(n)?Ar:(r+=1)+n>e.length?Rr:(e=e.substr(r,n),t.C=r+n,e))}function xr(t){t.V=Date.now()+t.O,Mr(t,t.O)}function Mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=pr(Le(t.gb,t),e)}function Ur(t){t.B&&(Ee.clearTimeout(t.B),t.B=null)}function Fr(t){0==t.l.G||t.I||rs(t.l,t)}function zr(t){Ur(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Yn(t.T),rr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Br(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||gi(n.h,t)))if(!t.J&&gi(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ns(n),Wi(n)}Zi(n),dr(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=pr(Le(n.cb,n),6e3));if(1>=pi(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else ss(n,11)}else if((t.J||n.g==t)&&ns(n),!Be(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(mi(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Gr(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=as(r,r.H?r.ka:null,r.V),f.J){yi(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(Ur(p),xr(p)),r.g=f}else Xi(r);0<n.i.length&&Gi(n)}else"stop"!=s[0]&&"close"!=s[0]||ss(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?ss(n,7):qi(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}ur()}catch(s){}}function Vr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Ie(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Ie(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Ie(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(be=Ir.prototype).setTimeout=function(t){this.O=t},be.ib=function(t){t=t.target;var e=this.L;e&&3==zi(t)?e.l():this.La(t)},be.La=function(t){try{if(t==this.g)t:{var e=zi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Je||this.g&&(this.h.h||this.g.fa()||Bi(this.g)))){this.I||4!=e||7==n||ur(),Ur(this);var r=this.g.aa();this.Y=r;e:if(Or(this)){var i=Bi(this.g);t="";var s=i.length,o=4==zi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){zr(this),Fr(this);var a="";break e}this.h.i=new Ee.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Be(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,dr(12),zr(this),Fr(this);break t}sr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Br(this,r)}this.P?(Dr(this,e,a),Je&&this.i&&3==e&&(nr(this.S,this.T,"tick",this.hb),this.T.start())):(sr(this.j,this.m,a,null),Br(this,a)),4==e&&zr(this),this.i&&!this.I&&(4==e?rs(this.l,this):(this.i=!1,xr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,dr(12)):(this.o=0,dr(13)),zr(this),Fr(this)}}}catch(e){}},be.hb=function(){if(this.g){var t=zi(this.g),e=this.g.fa();this.C<e.length&&(Ur(this),Dr(this,t,e),this.i&&4!=t&&xr(this))}},be.cancel=function(){this.I=!0,zr(this)},be.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(ur(),dr(17)),zr(this),this.o=2,Fr(this)):Mr(this,this.V-t)};var Hr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function jr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof jr){this.h=void 0!==e?e:t.h,qr(this,t.j),this.s=t.s,this.g=t.g,Wr(this,t.m),this.l=t.l,e=t.i;var n=new ii;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Kr(this,n),this.o=t.o}else t&&(n=String(t).match(Hr))?(this.h=!!e,qr(this,n[1]||"",!0),this.s=Yr(n[2]||""),this.g=Yr(n[3]||"",!0),Wr(this,n[4]),this.l=Yr(n[5]||"",!0),Kr(this,n[6]||"",!0),this.o=Yr(n[7]||"")):(this.h=!!e,this.i=new ii(null,this.h))}function $r(t){return new jr(t)}function qr(t,e,n){t.j=n?Yr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Wr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Kr(t,e,n){e instanceof ii?(t.i=e,function(t,e){e&&!t.j&&(si(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(oi(this,e),ci(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Jr(e,ni)),t.i=new ii(e,t.h))}function Gr(t,e,n){t.i.set(e,n)}function Qr(t){return Gr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Yr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Jr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Xr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Xr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}jr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Jr(e,Zr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Jr(e,Zr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Jr(n,"/"==n.charAt(0)?ei:ti,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Jr(n,ri)),t.join("")};var Zr=/[#\/\?@]/g,ti=/[#\?:]/g,ei=/[#\?]/g,ni=/[#\?@]/g,ri=/#/g;function ii(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function si(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function oi(t,e){si(t),e=li(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ai(t,e){return si(t),e=li(t,e),t.g.has(e)}function ci(t,e,n){oi(t,e),0<n.length&&(t.i=null,t.g.set(li(t,e),Me(n)),t.h+=n.length)}function li(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(be=ii.prototype).add=function(t,e){si(this),this.i=null,t=li(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},be.forEach=function(t,e){si(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},be.oa=function(){si(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},be.W=function(t){si(this);var e=[];if("string"==typeof t)ai(this,t)&&(e=e.concat(this.g.get(li(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},be.set=function(t,e){return si(this),this.i=null,ai(this,t=li(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},be.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},be.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var ui=function(t,e){this.h=t,this.g=e};function hi(t){this.l=t||di,Ee.PerformanceNavigationTiming?t=0<(t=Ee.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(Ee.g&&Ee.g.Ga&&Ee.g.Ga()&&Ee.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var di=10;function fi(t){return!!t.h||!!t.g&&t.g.size>=t.j}function pi(t){return t.h?1:t.g?t.g.size:0}function gi(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function mi(t,e){t.g?t.g.add(e):t.h=e}function yi(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function vi(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=ve(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return Me(t.i)}function wi(){}function bi(){this.g=new wi}function Si(t,e,n){var r=n||"";try{Vr(t,(function(t,n){var i=t;ke(t)&&(i=Fn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function _i(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function Ei(t){this.l=t.ac||null,this.j=t.jb||!1}function Ti(t,e){xn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Ii,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}hi.prototype.cancel=function(){var t,e;if(this.i=vi(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ve(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},wi.prototype.stringify=function(t){return Ee.JSON.stringify(t,void 0)},wi.prototype.parse=function(t){return Ee.JSON.parse(t,void 0)},De(Ei,yr),Ei.prototype.g=function(){return new Ti(this.l,this.j)},Ei.prototype.i=function(t){return function(){return t}}({}),De(Ti,xn);var Ii=0;function ki(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ci(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ai(t)}function Ai(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(be=Ti.prototype).open=function(t,e){if(this.readyState!=Ii)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ai(this)},be.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||Ee).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},be.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Ci(this)),this.readyState=Ii},be.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Ai(this)),this.g&&(this.readyState=3,Ai(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==Ee.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;ki(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},be.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Ci(this):Ai(this),3==this.readyState&&ki(this)}},be.Va=function(t){this.g&&(this.response=this.responseText=t,Ci(this))},be.Ua=function(t){this.g&&(this.response=t,Ci(this))},be.ga=function(){this.g&&Ci(this)},be.setRequestHeader=function(t,e){this.v.append(t,e)},be.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},be.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Ti.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Ri=Ee.JSON.parse;function Ni(t){xn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Li,this.K=this.L=!1}De(Ni,xn);var Li="",Oi=/^https?$/i,Di=["POST","PUT"];function Pi(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,xi(t),Ui(t)}function xi(t){t.D||(t.D=!0,Mn(t,"complete"),Mn(t,"error"))}function Mi(t){if(t.h&&void 0!==_e&&(!t.C[1]||4!=zi(t)||2!=t.aa()))if(t.v&&4==zi(t))Jn(t.Ha,0,t);else if(Mn(t,"readystatechange"),4==zi(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(Hr)[1]||null;if(!s&&Ee.self&&Ee.self.location){var o=Ee.self.location.protocol;s=o.substr(0,o.length-1)}i=!Oi.test(s?s.toLowerCase():"")}e=i}if(e)Mn(t,"complete"),Mn(t,"success");else{t.m=6;try{var a=2<zi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",xi(t)}}finally{Ui(t)}}}function Ui(t,e){if(t.g){Fi(t);var n=t.g,r=t.C[0]?Te:null;t.g=null,t.C=null,e||Mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Fi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(Ee.clearTimeout(t.A),t.A=null)}function zi(t){return t.g?t.g.readyState:0}function Bi(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Li:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Vi(t){var e="";return mn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Hi(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Vi(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Gr(t,e,n))}function ji(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function $i(t){this.Ca=0,this.i=[],this.j=new ir,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=ji("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=ji("baseRetryDelayMs",5e3,t),this.bb=ji("retryDelaySeedMs",1e4,t),this.$a=ji("forwardChannelMaxRetries",2,t),this.ta=ji("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new hi(t&&t.concurrentRequestLimit),this.Fa=new bi,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function qi(t){if(Ki(t),3==t.G){var e=t.U++,n=$r(t.F);Gr(n,"SID",t.I),Gr(n,"RID",e),Gr(n,"TYPE","terminate"),Yi(t,n),(e=new Ir(t,t.j,e,void 0)).K=2,e.v=Qr($r(n)),n=!1,Ee.navigator&&Ee.navigator.sendBeacon&&(n=Ee.navigator.sendBeacon(e.v.toString(),"")),!n&&Ee.Image&&((new Image).src=e.v,n=!0),n||(e.g=cs(e.l,null),e.g.da(e.v)),e.F=Date.now(),xr(e)}os(t)}function Wi(t){t.g&&(ts(t),t.g.cancel(),t.g=null)}function Ki(t){Wi(t),t.u&&(Ee.clearTimeout(t.u),t.u=null),ns(t),t.h.cancel(),t.m&&("number"==typeof t.m&&Ee.clearTimeout(t.m),t.m=null)}function Gi(t){fi(t.h)||t.m||(t.m=!0,qn(t.Ja,t),t.C=0)}function Qi(t,e){var n;n=e?e.m:t.U++;var r=$r(t.F);Gr(r,"SID",t.I),Gr(r,"RID",n),Gr(r,"AID",t.T),Yi(t,r),t.o&&t.s&&Hi(r,t.o,t.s),n=new Ir(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Ji(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),mi(t.h,n),Nr(n,r,e)}function Yi(t,e){t.ia&&mn(t.ia,(function(t,n){Gr(e,n,t)})),t.l&&Vr({},(function(t,n){Gr(e,n,t)}))}function Ji(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Le(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{Si(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Xi(t){t.g||t.u||(t.Z=1,qn(t.Ia,t),t.A=0)}function Zi(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=pr(Le(t.Ia,t),is(t,t.A)),t.A++,!0)}function ts(t){null!=t.B&&(Ee.clearTimeout(t.B),t.B=null)}function es(t){t.g=new Ir(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=$r(t.sa);Gr(e,"RID","rpc"),Gr(e,"SID",t.I),Gr(e,"CI",t.L?"0":"1"),Gr(e,"AID",t.T),Gr(e,"TYPE","xmlhttp"),Yi(t,e),t.o&&t.s&&Hi(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Qr($r(e)),n.s=null,n.P=!0,Lr(n,t)}function ns(t){null!=t.v&&(Ee.clearTimeout(t.v),t.v=null)}function rs(t,e){var n=null;if(t.g==e){ns(t),ts(t),t.g=null;var r=2}else{if(!gi(t.h,e))return;n=e.D,yi(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;Mn(r=cr(),new fr(r,n)),Gi(t)}else Xi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(pi(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=pr(Le(t.Ja,t,e),is(t,t.C)),t.C++,0)))}(t,e)||2==r&&Zi(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:ss(t,5);break;case 4:ss(t,10);break;case 3:ss(t,6);break;default:ss(t,2)}}function is(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ss(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Le(t.kb,t);n||(n=new jr("//www.google.com/images/cleardot.gif"),Ee.location&&"http"==Ee.location.protocol||qr(n,"https"),Qr(n)),function(t,e){var n=new ir;if(Ee.Image){var r=new Image;r.onload=Oe(_i,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Oe(_i,n,r,"TestLoadImage: error",!1,e),r.onabort=Oe(_i,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Oe(_i,n,r,"TestLoadImage: timeout",!1,e),Ee.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else dr(2);t.G=0,t.l&&t.l.va(e),os(t),Ki(t)}function os(t){if(t.G=0,t.la=[],t.l){var e=vi(t.h);0==e.length&&0==t.i.length||(Ue(t.la,e),Ue(t.la,t.i),t.h.i.length=0,Me(t.i),t.i.length=0),t.l.ua()}}function as(t,e,n){var r=n instanceof jr?$r(n):new jr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Wr(r,r.m);else{var i=Ee.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new jr(null,void 0);r&&qr(s,r),e&&(s.g=e),i&&Wr(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&Gr(r,n,e),Gr(r,"VER",t.ma),Yi(t,r),r}function cs(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Ni(new Ei({jb:!0})):new Ni(t.ra)).Ka(t.H),e}function ls(){}function us(){if(Qe&&!(10<=Number(ln)))throw Error("Environmental error: no available transport.")}function hs(t,e){xn.call(this),this.g=new $i(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Be(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Be(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ps(this)}function ds(t){_r.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function fs(){Er.call(this),this.status=1}function ps(t){this.g=t}(be=Ni.prototype).Ka=function(t){this.L=t},be.da=function(t,e,n,r){var i,s,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():br.g(),this.C=this.u?vr(this.u):vr(br),this.g.onreadystatechange=Le(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void Pi(this,h)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var l=ve(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=Ee.FormData&&t instanceof Ee.FormData,!(0<=xe(Di,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ve(n),f=d.next();!f.done;f=d.next()){var p=we(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{Fi(this),0<this.B&&((this.K=function(t){return Qe&&an()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Le(this.qa,this)):this.A=Jn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){Pi(this,h)}},be.qa=function(){void 0!==_e&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Mn(this,"timeout"),this.abort(8))},be.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Mn(this,"complete"),Mn(this,"abort"),Ui(this))},be.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Ui(this,!0)),Ni.X.M.call(this)},be.Ha=function(){this.s||(this.F||this.v||this.l?Mi(this):this.fb())},be.fb=function(){Mi(this)},be.aa=function(){try{return 2<zi(this)?this.g.status:-1}catch(t){return-1}},be.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},be.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Ri(e)}},be.Ea=function(){return this.m},be.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(be=$i.prototype).ma=8,be.G=1,be.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Ir(this,this.j,t,void 0),n=this.s;if(this.S&&(n?wn(n=yn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Ji(this,e,r),Gr(i=$r(this.F),"RID",t),Gr(i,"CVER",22),this.D&&Gr(i,"X-HTTP-Session-Id",this.D),Yi(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Vi(n)))+"&"+r:this.o&&Hi(i,this.o,n)),mi(this.h,e),this.Ya&&Gr(i,"TYPE","init"),this.O?(Gr(i,"$req",r),Gr(i,"SID","null"),e.Z=!0,Nr(e,i,null)):Nr(e,i,r),this.G=2}}else 3==this.G&&(t?Qi(this,t):0==this.i.length||fi(this.h)||Qi(this))},be.Ia=function(){if(this.u=null,es(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=pr(Le(this.eb,this),t)}},be.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,dr(10),Wi(this),es(this))},be.cb=function(){null!=this.v&&(this.v=null,Wi(this),Zi(this),dr(19))},be.kb=function(t){t?(this.j.info("Successfully pinged google.com"),dr(2)):(this.j.info("Failed to ping google.com"),dr(1))},(be=ls.prototype).xa=function(){},be.wa=function(){},be.va=function(){},be.ua=function(){},be.Ra=function(){},us.prototype.g=function(t,e){return new hs(t,e)},De(hs,xn),hs.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;dr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=as(t,null,t.V),Gi(t)},hs.prototype.close=function(){qi(this.g)},hs.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Fn(t),t=n);e.i.push(new ui(e.ab++,t)),3==e.G&&Gi(e)},hs.prototype.M=function(){this.g.l=null,delete this.j,qi(this.g),delete this.g,hs.X.M.call(this)},De(ds,_r),De(fs,Er),De(ps,ls),ps.prototype.xa=function(){Mn(this.g,"a")},ps.prototype.wa=function(t){Mn(this.g,new ds(t))},ps.prototype.va=function(t){Mn(this.g,new fs)},ps.prototype.ua=function(){Mn(this.g,"b")},us.prototype.createWebChannel=us.prototype.g,hs.prototype.send=hs.prototype.u,hs.prototype.open=hs.prototype.m,hs.prototype.close=hs.prototype.close,gr.NO_ERROR=0,gr.TIMEOUT=8,gr.HTTP_ERROR=6,mr.COMPLETE="complete",wr.EventType=Sr,Sr.OPEN="a",Sr.CLOSE="b",Sr.ERROR="c",Sr.MESSAGE="d",xn.prototype.listen=xn.prototype.N,Ni.prototype.listenOnce=Ni.prototype.O,Ni.prototype.getLastError=Ni.prototype.Oa,Ni.prototype.getLastErrorCode=Ni.prototype.Ea,Ni.prototype.getStatus=Ni.prototype.aa,Ni.prototype.getResponseJson=Ni.prototype.Sa,Ni.prototype.getResponseText=Ni.prototype.fa,Ni.prototype.send=Ni.prototype.da,Ni.prototype.setWithCredentials=Ni.prototype.Ka;var gs=gr,ms=mr,ys=or,vs=10,ws=11,bs=Ei,Ss=wr,_s=Ni;const Es="@firebase/firestore";
|
|
401
401
|
/**
|
|
402
402
|
* @license
|
|
403
403
|
* Copyright 2017 Google LLC
|
|
@@ -413,7 +413,7 @@ const te=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
413
413
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
414
414
|
* See the License for the specific language governing permissions and
|
|
415
415
|
* limitations under the License.
|
|
416
|
-
*/class
|
|
416
|
+
*/class Ts{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}Ts.UNAUTHENTICATED=new Ts(null),Ts.GOOGLE_CREDENTIALS=new Ts("google-credentials-uid"),Ts.FIRST_PARTY=new Ts("first-party-uid"),Ts.MOCK_USER=new Ts("mock-user");
|
|
417
417
|
/**
|
|
418
418
|
* @license
|
|
419
419
|
* Copyright 2017 Google LLC
|
|
@@ -430,7 +430,7 @@ const te=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
430
430
|
* See the License for the specific language governing permissions and
|
|
431
431
|
* limitations under the License.
|
|
432
432
|
*/
|
|
433
|
-
let
|
|
433
|
+
let Is="9.15.0";
|
|
434
434
|
/**
|
|
435
435
|
* @license
|
|
436
436
|
* Copyright 2017 Google LLC
|
|
@@ -446,7 +446,7 @@ let Ss="9.15.0";
|
|
|
446
446
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
447
447
|
* See the License for the specific language governing permissions and
|
|
448
448
|
* limitations under the License.
|
|
449
|
-
*/const
|
|
449
|
+
*/const ks=new class{constructor(t){this.name=t,this._logLevel=pe,this._logHandler=me,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in de))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?fe[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,de.DEBUG,...t),this._logHandler(this,de.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,de.VERBOSE,...t),this._logHandler(this,de.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,de.INFO,...t),this._logHandler(this,de.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,de.WARN,...t),this._logHandler(this,de.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,de.ERROR,...t),this._logHandler(this,de.ERROR,...t)}}("@firebase/firestore");function Cs(){return ks.logLevel}function As(t,...e){if(ks.logLevel<=de.DEBUG){const n=e.map(Ls);ks.debug(`Firestore (${Is}): ${t}`,...n)}}function Rs(t,...e){if(ks.logLevel<=de.ERROR){const n=e.map(Ls);ks.error(`Firestore (${Is}): ${t}`,...n)}}function Ns(t,...e){if(ks.logLevel<=de.WARN){const n=e.map(Ls);ks.warn(`Firestore (${Is}): ${t}`,...n)}}function Ls(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
|
|
450
450
|
/**
|
|
451
451
|
* @license
|
|
452
452
|
* Copyright 2020 Google LLC
|
|
@@ -478,7 +478,7 @@ let Ss="9.15.0";
|
|
|
478
478
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
479
479
|
* See the License for the specific language governing permissions and
|
|
480
480
|
* limitations under the License.
|
|
481
|
-
*/function
|
|
481
|
+
*/function Os(t="Unexpected state"){const e=`FIRESTORE (${Is}) INTERNAL ASSERTION FAILED: `+t;throw Rs(e),new Error(e)}function Ds(t,e){t||Os()}function Ps(t,e){return t}
|
|
482
482
|
/**
|
|
483
483
|
* @license
|
|
484
484
|
* Copyright 2017 Google LLC
|
|
@@ -494,7 +494,7 @@ let Ss="9.15.0";
|
|
|
494
494
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
495
495
|
* See the License for the specific language governing permissions and
|
|
496
496
|
* limitations under the License.
|
|
497
|
-
*/const
|
|
497
|
+
*/const xs={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Ms extends ae{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
|
|
498
498
|
/**
|
|
499
499
|
* @license
|
|
500
500
|
* Copyright 2017 Google LLC
|
|
@@ -510,7 +510,7 @@ let Ss="9.15.0";
|
|
|
510
510
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
511
511
|
* See the License for the specific language governing permissions and
|
|
512
512
|
* limitations under the License.
|
|
513
|
-
*/class
|
|
513
|
+
*/class Us{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
|
|
514
514
|
/**
|
|
515
515
|
* @license
|
|
516
516
|
* Copyright 2017 Google LLC
|
|
@@ -526,7 +526,7 @@ let Ss="9.15.0";
|
|
|
526
526
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
527
527
|
* See the License for the specific language governing permissions and
|
|
528
528
|
* limitations under the License.
|
|
529
|
-
*/class
|
|
529
|
+
*/class Fs{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class zs{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Ts.UNAUTHENTICATED)))}shutdown(){}}class Bs{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class Vs{constructor(t){this.t=t,this.currentUser=Ts.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let i=new Us;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Us,t.enqueueRetryable((()=>r(this.currentUser)))};const s=()=>{const e=i;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{As("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),s()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(As("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Us)}}),0),s()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(As("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Ds("string"==typeof e.accessToken),new Fs(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return Ds(null===t||"string"==typeof t),new Ts(t)}}class Hs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=Ts.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Ds(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class js{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new Hs(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Ts.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class $s{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class qs{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&As("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,As("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{As("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):As("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Ds("string"==typeof t.token),this.A=t.token,new $s(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
|
|
530
530
|
/**
|
|
531
531
|
* @license
|
|
532
532
|
* Copyright 2020 Google LLC
|
|
@@ -542,7 +542,7 @@ let Ss="9.15.0";
|
|
|
542
542
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
543
543
|
* See the License for the specific language governing permissions and
|
|
544
544
|
* limitations under the License.
|
|
545
|
-
*/function
|
|
545
|
+
*/function Ws(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
|
|
546
546
|
/**
|
|
547
547
|
* @license
|
|
548
548
|
* Copyright 2017 Google LLC
|
|
@@ -558,7 +558,7 @@ let Ss="9.15.0";
|
|
|
558
558
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
559
559
|
* See the License for the specific language governing permissions and
|
|
560
560
|
* limitations under the License.
|
|
561
|
-
*/class
|
|
561
|
+
*/class Ks{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=Ws(40);for(let i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%62))}return n}}function Gs(t,e){return t<e?-1:t>e?1:0}function Qs(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
|
|
562
562
|
/**
|
|
563
563
|
* @license
|
|
564
564
|
* Copyright 2017 Google LLC
|
|
@@ -574,7 +574,7 @@ let Ss="9.15.0";
|
|
|
574
574
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
575
575
|
* See the License for the specific language governing permissions and
|
|
576
576
|
* limitations under the License.
|
|
577
|
-
*/class
|
|
577
|
+
*/class Ys{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Ms(xs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Ms(xs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Ms(xs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Ms(xs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Ys.fromMillis(Date.now())}static fromDate(t){return Ys.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Ys(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Gs(this.nanoseconds,t.nanoseconds):Gs(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
|
|
578
578
|
/**
|
|
579
579
|
* @license
|
|
580
580
|
* Copyright 2017 Google LLC
|
|
@@ -590,7 +590,7 @@ let Ss="9.15.0";
|
|
|
590
590
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
591
591
|
* See the License for the specific language governing permissions and
|
|
592
592
|
* limitations under the License.
|
|
593
|
-
*/class
|
|
593
|
+
*/class Js{constructor(t){this.timestamp=t}static fromTimestamp(t){return new Js(t)}static min(){return new Js(new Ys(0,0))}static max(){return new Js(new Ys(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}
|
|
594
594
|
/**
|
|
595
595
|
* @license
|
|
596
596
|
* Copyright 2017 Google LLC
|
|
@@ -606,7 +606,7 @@ let Ss="9.15.0";
|
|
|
606
606
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
607
607
|
* See the License for the specific language governing permissions and
|
|
608
608
|
* limitations under the License.
|
|
609
|
-
*/class
|
|
609
|
+
*/class Xs{constructor(t,e,n){void 0===e?e=0:e>t.length&&Os(),void 0===n?n=t.length-e:n>t.length-e&&Os(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===Xs.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof Xs?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),i=e.get(r);if(n<i)return-1;if(n>i)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class Zs extends Xs{construct(t,e,n){return new Zs(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Ms(xs.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new Zs(e)}static emptyPath(){return new Zs([])}}const to=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class eo extends Xs{construct(t,e,n){return new eo(t,e,n)}static isValidIdentifier(t){return to.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),eo.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new eo(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const i=()=>{if(0===n.length)throw new Ms(xs.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let s=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new Ms(xs.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Ms(xs.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(s=!s,r++):"."!==e||s?(n+=e,r++):(i(),r++)}if(i(),s)throw new Ms(xs.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new eo(e)}static emptyPath(){return new eo([])}}
|
|
610
610
|
/**
|
|
611
611
|
* @license
|
|
612
612
|
* Copyright 2017 Google LLC
|
|
@@ -622,7 +622,7 @@ let Ss="9.15.0";
|
|
|
622
622
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
623
623
|
* See the License for the specific language governing permissions and
|
|
624
624
|
* limitations under the License.
|
|
625
|
-
*/class
|
|
625
|
+
*/class no{constructor(t){this.path=t}static fromPath(t){return new no(Zs.fromString(t))}static fromName(t){return new no(Zs.fromString(t).popFirst(5))}static empty(){return new no(Zs.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Zs.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Zs.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new no(new Zs(t.slice()))}}function ro(t){return new io(t.readTime,t.key,-1)}class io{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new io(Js.min(),no.empty(),-1)}static max(){return new io(Js.max(),no.empty(),-1)}}function so(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=no.comparator(t.documentKey,e.documentKey),0!==n?n:Gs(t.largestBatchId,e.largestBatchId)
|
|
626
626
|
/**
|
|
627
627
|
* @license
|
|
628
628
|
* Copyright 2020 Google LLC
|
|
@@ -638,7 +638,7 @@ let Ss="9.15.0";
|
|
|
638
638
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
639
639
|
* See the License for the specific language governing permissions and
|
|
640
640
|
* limitations under the License.
|
|
641
|
-
*/)}const
|
|
641
|
+
*/)}const oo="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class ao{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
|
|
642
642
|
/**
|
|
643
643
|
* @license
|
|
644
644
|
* Copyright 2017 Google LLC
|
|
@@ -654,7 +654,7 @@ let Ss="9.15.0";
|
|
|
654
654
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
655
655
|
* See the License for the specific language governing permissions and
|
|
656
656
|
* limitations under the License.
|
|
657
|
-
*/async function
|
|
657
|
+
*/async function co(t){if(t.code!==xs.FAILED_PRECONDITION||t.message!==oo)throw t;As("LocalStore","Unexpectedly lost primary lease")}
|
|
658
658
|
/**
|
|
659
659
|
* @license
|
|
660
660
|
* Copyright 2017 Google LLC
|
|
@@ -670,7 +670,7 @@ let Ss="9.15.0";
|
|
|
670
670
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
671
671
|
* See the License for the specific language governing permissions and
|
|
672
672
|
* limitations under the License.
|
|
673
|
-
*/class
|
|
673
|
+
*/class lo{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&Os(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new lo(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof lo?e:lo.resolve(e)}catch(t){return lo.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):lo.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):lo.reject(e)}static resolve(t){return new lo(((e,n)=>{e(t)}))}static reject(t){return new lo(((e,n)=>{n(t)}))}static waitFor(t){return new lo(((e,n)=>{let r=0,i=0,s=!1;t.forEach((t=>{++r,t.next((()=>{++i,s&&i===r&&e()}),(t=>n(t)))})),s=!0,i===r&&e()}))}static or(t){let e=lo.resolve(!1);for(const n of t)e=e.next((t=>t?lo.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}static mapArray(t,e){return new lo(((n,r)=>{const i=t.length,s=new Array(i);let o=0;for(let a=0;a<i;a++){const c=a;e(t[c]).next((t=>{s[c]=t,++o,o===i&&n(s)}),(t=>r(t)))}}))}static doWhile(t,e){return new lo(((n,r)=>{const i=()=>{!0===t()?e().next((()=>{i()}),r):n()};i()}))}}function uo(t){return"IndexedDbTransactionError"===t.name}
|
|
674
674
|
/**
|
|
675
675
|
* @license
|
|
676
676
|
* Copyright 2018 Google LLC
|
|
@@ -686,7 +686,7 @@ let Ss="9.15.0";
|
|
|
686
686
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
687
687
|
* See the License for the specific language governing permissions and
|
|
688
688
|
* limitations under the License.
|
|
689
|
-
*/class
|
|
689
|
+
*/class ho{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.ut(t),this.ct=t=>e.writeSequenceNumber(t))}ut(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ct&&this.ct(t),t}}ho.at=-1;
|
|
690
690
|
/**
|
|
691
691
|
* @license
|
|
692
692
|
* Copyright 2017 Google LLC
|
|
@@ -703,7 +703,7 @@ let Ss="9.15.0";
|
|
|
703
703
|
* See the License for the specific language governing permissions and
|
|
704
704
|
* limitations under the License.
|
|
705
705
|
*/
|
|
706
|
-
class
|
|
706
|
+
class fo{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class po{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new po("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof po&&t.projectId===this.projectId&&t.database===this.database}}
|
|
707
707
|
/**
|
|
708
708
|
* @license
|
|
709
709
|
* Copyright 2017 Google LLC
|
|
@@ -719,7 +719,7 @@ class lo{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
719
719
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
720
720
|
* See the License for the specific language governing permissions and
|
|
721
721
|
* limitations under the License.
|
|
722
|
-
*/function
|
|
722
|
+
*/function go(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function mo(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function yo(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
|
|
723
723
|
/**
|
|
724
724
|
* @license
|
|
725
725
|
* Copyright 2017 Google LLC
|
|
@@ -735,7 +735,7 @@ class lo{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
735
735
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
736
736
|
* See the License for the specific language governing permissions and
|
|
737
737
|
* limitations under the License.
|
|
738
|
-
*/function
|
|
738
|
+
*/function vo(t){return null==t}function wo(t){return 0===t&&1/t==-1/0}
|
|
739
739
|
/**
|
|
740
740
|
* @license
|
|
741
741
|
* Copyright 2020 Google LLC
|
|
@@ -752,7 +752,7 @@ class lo{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
752
752
|
* See the License for the specific language governing permissions and
|
|
753
753
|
* limitations under the License.
|
|
754
754
|
*/
|
|
755
|
-
class
|
|
755
|
+
class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new bo(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new bo(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return t=this.binaryString,btoa(t);var t}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}
|
|
756
756
|
/**
|
|
757
757
|
* @license
|
|
758
758
|
* Copyright 2020 Google LLC
|
|
@@ -768,7 +768,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
768
768
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
769
769
|
* See the License for the specific language governing permissions and
|
|
770
770
|
* limitations under the License.
|
|
771
|
-
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return
|
|
771
|
+
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Gs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}bo.EMPTY_BYTE_STRING=new bo("");const So=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function _o(t){if(Ds(!!t),"string"==typeof t){let e=0;const n=So.exec(t);if(Ds(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Eo(t.seconds),nanos:Eo(t.nanos)}}function Eo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function To(t){return"string"==typeof t?bo.fromBase64String(t):bo.fromUint8Array(t)}
|
|
772
772
|
/**
|
|
773
773
|
* @license
|
|
774
774
|
* Copyright 2020 Google LLC
|
|
@@ -784,7 +784,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
784
784
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
785
785
|
* See the License for the specific language governing permissions and
|
|
786
786
|
* limitations under the License.
|
|
787
|
-
*/function
|
|
787
|
+
*/function Io(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ko(t){const e=t.mapValue.fields.__previous_value__;return Io(e)?ko(e):e}function Co(t){const e=_o(t.mapValue.fields.__local_write_time__.timestampValue);return new Ys(e.seconds,e.nanos)}
|
|
788
788
|
/**
|
|
789
789
|
* @license
|
|
790
790
|
* Copyright 2020 Google LLC
|
|
@@ -800,7 +800,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
800
800
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
801
801
|
* See the License for the specific language governing permissions and
|
|
802
802
|
* limitations under the License.
|
|
803
|
-
*/const
|
|
803
|
+
*/const Ao={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Ro(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?Io(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
|
|
804
804
|
/**
|
|
805
805
|
* @license
|
|
806
806
|
* Copyright 2022 Google LLC
|
|
@@ -816,7 +816,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
816
816
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
817
817
|
* See the License for the specific language governing permissions and
|
|
818
818
|
* limitations under the License.
|
|
819
|
-
*/(t)?9007199254740991:10:
|
|
819
|
+
*/(t)?9007199254740991:10:Os()}function No(t,e){if(t===e)return!0;const n=Ro(t);if(n!==Ro(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Co(t).isEqual(Co(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=_o(t.timestampValue),r=_o(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return To(t.bytesValue).isEqual(To(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Eo(t.geoPointValue.latitude)===Eo(e.geoPointValue.latitude)&&Eo(t.geoPointValue.longitude)===Eo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Eo(t.integerValue)===Eo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Eo(t.doubleValue),r=Eo(e.doubleValue);return n===r?wo(n)===wo(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Qs(t.arrayValue.values||[],e.arrayValue.values||[],No);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(go(n)!==go(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!No(n[t],r[t])))return!1;return!0}(t,e);default:return Os()}}function Lo(t,e){return void 0!==(t.values||[]).find((t=>No(t,e)))}function Oo(t,e){if(t===e)return 0;const n=Ro(t),r=Ro(e);if(n!==r)return Gs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Gs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Eo(t.integerValue||t.doubleValue),r=Eo(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return Do(t.timestampValue,e.timestampValue);case 4:return Do(Co(t),Co(e));case 5:return Gs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=To(t),r=To(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=Gs(n[t],r[t]);if(0!==e)return e}return Gs(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Gs(Eo(t.latitude),Eo(e.latitude));return 0!==n?n:Gs(Eo(t.longitude),Eo(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Oo(n[t],r[t]);if(e)return e}return Gs(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Ao.mapValue&&e===Ao.mapValue)return 0;if(t===Ao.mapValue)return 1;if(e===Ao.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),i=e.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let t=0;t<r.length&&t<s.length;++t){const e=Gs(r[t],s[t]);if(0!==e)return e;const o=Oo(n[r[t]],i[s[t]]);if(0!==o)return o}return Gs(r.length,s.length)}(t.mapValue,e.mapValue);default:throw Os()}}function Do(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Gs(t,e);const n=_o(t),r=_o(e),i=Gs(n.seconds,r.seconds);return 0!==i?i:Gs(n.nanos,r.nanos)}function Po(t){return xo(t)}function xo(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=_o(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?To(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,no.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=xo(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const i of e)r?r=!1:n+=",",n+=`${i}:${xo(t.fields[i])}`;return n+"}"}(t.mapValue):Os();var e,n}function Mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Uo(t){return!!t&&"integerValue"in t}function Fo(t){return!!t&&"arrayValue"in t}function zo(t){return!!t&&"nullValue"in t}function Bo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Vo(t){return!!t&&"mapValue"in t}function Ho(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return mo(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Ho(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ho(t.arrayValue.values[n]);return e}return Object.assign({},t)}class jo{constructor(t,e){this.position=t,this.inclusive=e}}function $o(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(r=s.field.isKeyField()?no.comparator(no.fromName(o.referenceValue),n.key):Oo(o,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return r}function qo(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!No(t.position[n],e.position[n]))return!1;return!0}
|
|
820
820
|
/**
|
|
821
821
|
* @license
|
|
822
822
|
* Copyright 2022 Google LLC
|
|
@@ -832,7 +832,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
832
832
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
833
833
|
* See the License for the specific language governing permissions and
|
|
834
834
|
* limitations under the License.
|
|
835
|
-
*/class
|
|
835
|
+
*/class Wo{}class Ko extends Wo{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new ta(t,e,n):"array-contains"===e?new ia(t,n):"in"===e?new sa(t,n):"not-in"===e?new oa(t,n):"array-contains-any"===e?new aa(t,n):new Ko(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ea(t,n):new na(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Oo(e,this.value)):null!==e&&Ro(this.value)===Ro(e)&&this.matchesComparison(Oo(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Os()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Go extends Wo{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Go(t,e)}matches(t){return Qo(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Qo(t){return"and"===t.op}function Yo(t){return function(t){for(const e of t.filters)if(e instanceof Go)return!1;return!0}(t)&&Qo(t)}function Jo(t){if(t instanceof Ko)return t.field.canonicalString()+t.op.toString()+Po(t.value);{const e=t.filters.map((t=>Jo(t))).join(",");return`${t.op}(${e})`}}function Xo(t,e){return t instanceof Ko?function(t,e){return e instanceof Ko&&t.op===e.op&&t.field.isEqual(e.field)&&No(t.value,e.value)}(t,e):t instanceof Go?function(t,e){return e instanceof Go&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Xo(n,e.filters[r])),!0)}(t,e):void Os()}function Zo(t){return t instanceof Ko?function(t){return`${t.field.canonicalString()} ${t.op} ${Po(t.value)}`}(t):t instanceof Go?function(t){return t.op.toString()+" {"+t.getFilters().map(Zo).join(" ,")+"}"}(t):"Filter"}class ta extends Ko{constructor(t,e,n){super(t,e,n),this.key=no.fromName(n.referenceValue)}matches(t){const e=no.comparator(t.key,this.key);return this.matchesComparison(e)}}class ea extends Ko{constructor(t,e){super(t,"in",e),this.keys=ra("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class na extends Ko{constructor(t,e){super(t,"not-in",e),this.keys=ra("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function ra(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>no.fromName(t.referenceValue)))}class ia extends Ko{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Fo(e)&&Lo(e.arrayValue,this.value)}}class sa extends Ko{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Lo(this.value.arrayValue,e)}}class oa extends Ko{constructor(t,e){super(t,"not-in",e)}matches(t){if(Lo(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Lo(this.value.arrayValue,e)}}class aa extends Ko{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Fo(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Lo(this.value.arrayValue,t)))}}
|
|
836
836
|
/**
|
|
837
837
|
* @license
|
|
838
838
|
* Copyright 2022 Google LLC
|
|
@@ -848,7 +848,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
848
848
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
849
849
|
* See the License for the specific language governing permissions and
|
|
850
850
|
* limitations under the License.
|
|
851
|
-
*/class
|
|
851
|
+
*/class ca{constructor(t,e="asc"){this.field=t,this.dir=e}}function la(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
|
|
852
852
|
/**
|
|
853
853
|
* @license
|
|
854
854
|
* Copyright 2017 Google LLC
|
|
@@ -864,7 +864,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
864
864
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
865
865
|
* See the License for the specific language governing permissions and
|
|
866
866
|
* limitations under the License.
|
|
867
|
-
*/class
|
|
867
|
+
*/class ua{constructor(t,e){this.comparator=t,this.root=e||da.EMPTY}insert(t,e){return new ua(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,da.BLACK,null,null))}remove(t){return new ua(this.comparator,this.root.remove(t,this.comparator).copy(null,null,da.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new ha(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new ha(this.root,t,this.comparator,!1)}getReverseIterator(){return new ha(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new ha(this.root,t,this.comparator,!0)}}class ha{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!t.isEmpty();)if(i=e?n(t.key,e):1,e&&r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class da{constructor(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:da.RED,this.left=null!=r?r:da.EMPTY,this.right=null!=i?i:da.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,i){return new da(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const i=n(t,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return da.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return da.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,da.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,da.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Os();if(this.right.isRed())throw Os();const t=this.left.check();if(t!==this.right.check())throw Os();return t+(this.isRed()?0:1)}}da.EMPTY=null,da.RED=!0,da.BLACK=!1,da.EMPTY=new class{constructor(){this.size=0}get key(){throw Os()}get value(){throw Os()}get color(){throw Os()}get left(){throw Os()}get right(){throw Os()}copy(t,e,n,r,i){return this}insert(t,e,n){return new da(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
|
|
868
868
|
/**
|
|
869
869
|
* @license
|
|
870
870
|
* Copyright 2017 Google LLC
|
|
@@ -881,7 +881,7 @@ class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
881
881
|
* See the License for the specific language governing permissions and
|
|
882
882
|
* limitations under the License.
|
|
883
883
|
*/
|
|
884
|
-
class
|
|
884
|
+
class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new pa(this.data.getIterator())}getIteratorFrom(t){return new pa(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach((t=>{e=e.add(t)})),e}isEqual(t){if(!(t instanceof fa))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new fa(this.comparator);return e.data=t,e}}class pa{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
|
|
885
885
|
/**
|
|
886
886
|
* @license
|
|
887
887
|
* Copyright 2020 Google LLC
|
|
@@ -897,7 +897,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
897
897
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
898
898
|
* See the License for the specific language governing permissions and
|
|
899
899
|
* limitations under the License.
|
|
900
|
-
*/class
|
|
900
|
+
*/class ga{constructor(t){this.fields=t,t.sort(eo.comparator)}static empty(){return new ga([])}unionWith(t){let e=new fa(eo.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new ga(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return Qs(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
|
|
901
901
|
/**
|
|
902
902
|
* @license
|
|
903
903
|
* Copyright 2017 Google LLC
|
|
@@ -913,7 +913,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
913
913
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
914
914
|
* See the License for the specific language governing permissions and
|
|
915
915
|
* limitations under the License.
|
|
916
|
-
*/class
|
|
916
|
+
*/class ma{constructor(t){this.value=t}static empty(){return new ma({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!Vo(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Ho(e)}setAll(t){let e=eo.emptyPath(),n={},r=[];t.forEach(((t,i)=>{if(!e.isImmediateParentOf(i)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=i.popLast()}t?n[i.lastSegment()]=Ho(t):r.push(i.lastSegment())}));const i=this.getFieldsMap(e);this.applyChanges(i,n,r)}delete(t){const e=this.field(t.popLast());Vo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return No(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let r=e.mapValue.fields[t.get(n)];Vo(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){mo(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new ma(Ho(this.value))}}function ya(t){const e=[];return mo(t.fields,((t,n)=>{const r=new eo([t]);if(Vo(n)){const t=ya(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new ga(e)
|
|
917
917
|
/**
|
|
918
918
|
* @license
|
|
919
919
|
* Copyright 2017 Google LLC
|
|
@@ -929,7 +929,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
929
929
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
930
930
|
* See the License for the specific language governing permissions and
|
|
931
931
|
* limitations under the License.
|
|
932
|
-
*/}class
|
|
932
|
+
*/}class va{constructor(t,e,n,r,i,s,o){this.key=t,this.documentType=e,this.version=n,this.readTime=r,this.createTime=i,this.data=s,this.documentState=o}static newInvalidDocument(t){return new va(t,0,Js.min(),Js.min(),Js.min(),ma.empty(),0)}static newFoundDocument(t,e,n,r){return new va(t,1,e,Js.min(),n,r,0)}static newNoDocument(t,e){return new va(t,2,e,Js.min(),Js.min(),ma.empty(),0)}static newUnknownDocument(t,e){return new va(t,3,e,Js.min(),Js.min(),ma.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Js.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=ma.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=ma.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Js.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof va&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new va(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
|
|
933
933
|
/**
|
|
934
934
|
* @license
|
|
935
935
|
* Copyright 2019 Google LLC
|
|
@@ -945,7 +945,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
945
945
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
946
946
|
* See the License for the specific language governing permissions and
|
|
947
947
|
* limitations under the License.
|
|
948
|
-
*/class
|
|
948
|
+
*/class wa{constructor(t,e=null,n=[],r=[],i=null,s=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=s,this.endAt=o,this.ft=null}}function ba(t,e=null,n=[],r=[],i=null,s=null,o=null){return new wa(t,e,n,r,i,s,o)}function Sa(t){const e=Ps(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Jo(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),vo(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Po(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Po(t))).join(",")),e.ft=t}return e.ft}function _a(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!la(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!Xo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!qo(t.startAt,e.startAt)&&qo(t.endAt,e.endAt)}function Ea(t){return no.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
|
|
949
949
|
/**
|
|
950
950
|
* @license
|
|
951
951
|
* Copyright 2017 Google LLC
|
|
@@ -961,7 +961,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
961
961
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
962
962
|
* See the License for the specific language governing permissions and
|
|
963
963
|
* limitations under the License.
|
|
964
|
-
*/class
|
|
964
|
+
*/class Ta{constructor(t,e=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function Ia(t){return new Ta(t)}function ka(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Ca(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Aa(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Ra(t){return null!==t.collectionGroup}function Na(t){const e=Ps(t);if(null===e.dt){e.dt=[];const t=Aa(e),n=Ca(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new ca(t)),e.dt.push(new ca(eo.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new ca(eo.keyField(),t))}}}return e.dt}function La(t){const e=Ps(t);if(!e._t)if("F"===e.limitType)e._t=ba(e.path,e.collectionGroup,Na(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Na(e)){const e="desc"===n.dir?"asc":"desc";t.push(new ca(n.field,e))}const n=e.endAt?new jo(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new jo(e.startAt.position,e.startAt.inclusive):null;e._t=ba(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function Oa(t,e){e.getFirstInequalityField(),Aa(t);const n=t.filters.concat([e]);return new Ta(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Da(t,e,n){return new Ta(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Pa(t,e){return _a(La(t),La(e))&&t.limitType===e.limitType}function xa(t){return`${Sa(La(t))}|lt:${t.limitType}`}function Ma(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Zo(t))).join(", ")}]`),vo(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>Po(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Po(t))).join(",")),`Target(${e})`}(La(t))}; limitType=${t.limitType})`}function Ua(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):no.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Na(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=$o(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Na(t),e))&&!(t.endAt&&!function(t,e,n){const r=$o(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Na(t),e))}(t,e)}function Fa(t){return(e,n)=>{let r=!1;for(const i of Na(t)){const t=za(i,e,n);if(0!==t)return t;r=r||i.field.isKeyField()}return 0}}function za(t,e,n){const r=t.field.isKeyField()?no.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),i=n.data.field(t);return null!==r&&null!==i?Oo(r,i):Os()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Os()}}
|
|
965
965
|
/**
|
|
966
966
|
* @license
|
|
967
967
|
* Copyright 2020 Google LLC
|
|
@@ -977,7 +977,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
977
977
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
978
978
|
* See the License for the specific language governing permissions and
|
|
979
979
|
* limitations under the License.
|
|
980
|
-
*/function
|
|
980
|
+
*/function Ba(t,e){if(t.wt){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:wo(e)?"-0":e}}function Va(t){return{integerValue:""+t}}function Ha(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!wo(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Va(e):Ba(t,e)}
|
|
981
981
|
/**
|
|
982
982
|
* @license
|
|
983
983
|
* Copyright 2018 Google LLC
|
|
@@ -993,7 +993,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
993
993
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
994
994
|
* See the License for the specific language governing permissions and
|
|
995
995
|
* limitations under the License.
|
|
996
|
-
*/class
|
|
996
|
+
*/class ja{constructor(){this._=void 0}}function $a(t,e,n){return t instanceof Ka?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Ga?Qa(t,e):t instanceof Ya?Ja(t,e):function(t,e){const n=Wa(t,e),r=Za(n)+Za(t.gt);return Uo(n)&&Uo(t.gt)?Va(r):Ba(t.yt,r)}(t,e)}function qa(t,e,n){return t instanceof Ga?Qa(t,e):t instanceof Ya?Ja(t,e):n}function Wa(t,e){return t instanceof Xa?Uo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class Ka extends ja{}class Ga extends ja{constructor(t){super(),this.elements=t}}function Qa(t,e){const n=tc(e);for(const e of t.elements)n.some((t=>No(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Ya extends ja{constructor(t){super(),this.elements=t}}function Ja(t,e){let n=tc(e);for(const e of t.elements)n=n.filter((t=>!No(t,e)));return{arrayValue:{values:n}}}class Xa extends ja{constructor(t,e){super(),this.yt=t,this.gt=e}}function Za(t){return Eo(t.integerValue||t.doubleValue)}function tc(t){return Fo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class ec{constructor(t,e){this.version=t,this.transformResults=e}}class nc{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new nc}static exists(t){return new nc(void 0,t)}static updateTime(t){return new nc(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function rc(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ic{}function sc(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new gc(t.key,nc.none()):new uc(t.key,t.data,nc.none());{const n=t.data,r=ma.empty();let i=new fa(eo.comparator);for(let t of e.fields)if(!i.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),i=i.add(t)}return new hc(t.key,r,new ga(i.toArray()),nc.none())}}function oc(t,e,n){t instanceof uc?function(t,e,n){const r=t.value.clone(),i=fc(t.fieldTransforms,e,n.transformResults);r.setAll(i),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof hc?function(t,e,n){if(!rc(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=fc(t.fieldTransforms,e,n.transformResults),i=e.data;i.setAll(dc(t)),i.setAll(r),e.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ac(t,e,n,r){return t instanceof uc?function(t,e,n,r){if(!rc(t.precondition,e))return n;const i=t.value.clone(),s=pc(t.fieldTransforms,r,e);return i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null}(t,e,n,r):t instanceof hc?function(t,e,n,r){if(!rc(t.precondition,e))return n;const i=pc(t.fieldTransforms,r,e),s=e.data;return s.setAll(dc(t)),s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return rc(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function cc(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),i=Wa(r.transform,t||null);null!=i&&(null===n&&(n=ma.empty()),n.set(r.field,i))}return n||null}function lc(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&Qs(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Ga&&e instanceof Ga||t instanceof Ya&&e instanceof Ya?Qs(t.elements,e.elements,No):t instanceof Xa&&e instanceof Xa?No(t.gt,e.gt):t instanceof Ka&&e instanceof Ka}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class uc extends ic{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class hc extends ic{constructor(t,e,n,r,i=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function dc(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function fc(t,e,n){const r=new Map;Ds(t.length===n.length);for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,qa(o,a,n[i]))}return r}function pc(t,e,n){const r=new Map;for(const i of t){const t=i.transform,s=n.data.field(i.field);r.set(i.field,$a(t,s,e))}return r}class gc extends ic{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class mc extends ic{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
|
|
997
997
|
/**
|
|
998
998
|
* @license
|
|
999
999
|
* Copyright 2017 Google LLC
|
|
@@ -1009,7 +1009,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
1009
1009
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1010
1010
|
* See the License for the specific language governing permissions and
|
|
1011
1011
|
* limitations under the License.
|
|
1012
|
-
*/class
|
|
1012
|
+
*/class yc{constructor(t){this.count=t}}
|
|
1013
1013
|
/**
|
|
1014
1014
|
* @license
|
|
1015
1015
|
* Copyright 2017 Google LLC
|
|
@@ -1025,7 +1025,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
1025
1025
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1026
1026
|
* See the License for the specific language governing permissions and
|
|
1027
1027
|
* limitations under the License.
|
|
1028
|
-
*/var
|
|
1028
|
+
*/var vc,wc;function bc(t){if(void 0===t)return Rs("GRPC error has no .code"),xs.UNKNOWN;switch(t){case vc.OK:return xs.OK;case vc.CANCELLED:return xs.CANCELLED;case vc.UNKNOWN:return xs.UNKNOWN;case vc.DEADLINE_EXCEEDED:return xs.DEADLINE_EXCEEDED;case vc.RESOURCE_EXHAUSTED:return xs.RESOURCE_EXHAUSTED;case vc.INTERNAL:return xs.INTERNAL;case vc.UNAVAILABLE:return xs.UNAVAILABLE;case vc.UNAUTHENTICATED:return xs.UNAUTHENTICATED;case vc.INVALID_ARGUMENT:return xs.INVALID_ARGUMENT;case vc.NOT_FOUND:return xs.NOT_FOUND;case vc.ALREADY_EXISTS:return xs.ALREADY_EXISTS;case vc.PERMISSION_DENIED:return xs.PERMISSION_DENIED;case vc.FAILED_PRECONDITION:return xs.FAILED_PRECONDITION;case vc.ABORTED:return xs.ABORTED;case vc.OUT_OF_RANGE:return xs.OUT_OF_RANGE;case vc.UNIMPLEMENTED:return xs.UNIMPLEMENTED;case vc.DATA_LOSS:return xs.DATA_LOSS;default:return Os()}}(wc=vc||(vc={}))[wc.OK=0]="OK",wc[wc.CANCELLED=1]="CANCELLED",wc[wc.UNKNOWN=2]="UNKNOWN",wc[wc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",wc[wc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",wc[wc.NOT_FOUND=5]="NOT_FOUND",wc[wc.ALREADY_EXISTS=6]="ALREADY_EXISTS",wc[wc.PERMISSION_DENIED=7]="PERMISSION_DENIED",wc[wc.UNAUTHENTICATED=16]="UNAUTHENTICATED",wc[wc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",wc[wc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",wc[wc.ABORTED=10]="ABORTED",wc[wc.OUT_OF_RANGE=11]="OUT_OF_RANGE",wc[wc.UNIMPLEMENTED=12]="UNIMPLEMENTED",wc[wc.INTERNAL=13]="INTERNAL",wc[wc.UNAVAILABLE=14]="UNAVAILABLE",wc[wc.DATA_LOSS=15]="DATA_LOSS";
|
|
1029
1029
|
/**
|
|
1030
1030
|
* @license
|
|
1031
1031
|
* Copyright 2017 Google LLC
|
|
@@ -1042,7 +1042,7 @@ class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(
|
|
|
1042
1042
|
* See the License for the specific language governing permissions and
|
|
1043
1043
|
* limitations under the License.
|
|
1044
1044
|
*/
|
|
1045
|
-
class
|
|
1045
|
+
class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],t))return void(r[n]=[t,e]);r.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(t){mo(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return yo(this.inner)}size(){return this.innerSize}}
|
|
1046
1046
|
/**
|
|
1047
1047
|
* @license
|
|
1048
1048
|
* Copyright 2017 Google LLC
|
|
@@ -1058,7 +1058,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1058
1058
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1059
1059
|
* See the License for the specific language governing permissions and
|
|
1060
1060
|
* limitations under the License.
|
|
1061
|
-
*/const
|
|
1061
|
+
*/const _c=new ua(no.comparator);function Ec(){return _c}const Tc=new ua(no.comparator);function Ic(...t){let e=Tc;for(const n of t)e=e.insert(n.key,n);return e}function kc(t){let e=Tc;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Cc(){return Rc()}function Ac(){return Rc()}function Rc(){return new Sc((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Nc=new ua(no.comparator),Lc=new fa(no.comparator);function Oc(...t){let e=Lc;for(const n of t)e=e.add(n);return e}const Dc=new fa(Gs);function Pc(){return Dc}
|
|
1062
1062
|
/**
|
|
1063
1063
|
* @license
|
|
1064
1064
|
* Copyright 2017 Google LLC
|
|
@@ -1074,7 +1074,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1074
1074
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1075
1075
|
* See the License for the specific language governing permissions and
|
|
1076
1076
|
* limitations under the License.
|
|
1077
|
-
*/class
|
|
1077
|
+
*/class xc{constructor(t,e,n,r,i){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const r=new Map;return r.set(t,Mc.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new xc(Js.min(),r,Pc(),Ec(),Oc())}}class Mc{constructor(t,e,n,r,i){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Mc(n,e,Oc(),Oc(),Oc())}}
|
|
1078
1078
|
/**
|
|
1079
1079
|
* @license
|
|
1080
1080
|
* Copyright 2017 Google LLC
|
|
@@ -1090,7 +1090,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1090
1090
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1091
1091
|
* See the License for the specific language governing permissions and
|
|
1092
1092
|
* limitations under the License.
|
|
1093
|
-
*/class
|
|
1093
|
+
*/class Uc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Fc{constructor(t,e){this.targetId=t,this.Et=e}}class zc{constructor(t,e,n=bo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Bc{constructor(){this.At=0,this.Rt=jc(),this.bt=bo.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Oc(),e=Oc(),n=Oc();return this.Rt.forEach(((r,i)=>{switch(i){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Os()}})),new Mc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=jc()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Vc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ec(),this.qt=Hc(),this.Ut=new fa(Gs)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:Os()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(Ea(t))if(0===n){const n=new no(t.path);this.Qt(e,n,va.newNoDocument(n,Js.min()))}else Ds(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const i=this.Yt(r);if(i){if(n.current&&Ea(i.target)){const e=new no(i.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,va.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Oc();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new xc(t,e,this.Ut,this.Lt,n);return this.Lt=Ec(),this.qt=Hc(),this.Ut=new fa(Gs),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Bc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new fa(Gs),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||As("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new Bc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Hc(){return new ua(no.comparator)}function jc(){return new ua(no.comparator)}
|
|
1094
1094
|
/**
|
|
1095
1095
|
* @license
|
|
1096
1096
|
* Copyright 2017 Google LLC
|
|
@@ -1106,7 +1106,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1106
1106
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1107
1107
|
* See the License for the specific language governing permissions and
|
|
1108
1108
|
* limitations under the License.
|
|
1109
|
-
*/const
|
|
1109
|
+
*/const $c={asc:"ASCENDING",desc:"DESCENDING"},qc={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Wc={and:"AND",or:"OR"};class Kc{constructor(t,e){this.databaseId=t,this.wt=e}}function Gc(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Qc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Yc(t,e){return Gc(t,e.toTimestamp())}function Jc(t){return Ds(!!t),Js.fromTimestamp(function(t){const e=_o(t);return new Ys(e.seconds,e.nanos)}(t))}function Xc(t,e){return function(t){return new Zs(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Zc(t){const e=Zs.fromString(t);return Ds(yl(e)),e}function tl(t,e){return Xc(t.databaseId,e.path)}function el(t,e){const n=Zc(e);if(n.get(1)!==t.databaseId.projectId)throw new Ms(xs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Ms(xs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new no(il(n))}function nl(t,e){return Xc(t.databaseId,e)}function rl(t){return new Zs(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function il(t){return Ds(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function sl(t,e,n){return{name:tl(t,e),fields:n.value.mapValue.fields}}function ol(t,e){return{documents:[nl(t,e.path)]}}function al(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=nl(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=nl(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0!==t.length)return gl(Go.create(t,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const s=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:fl(t.field),direction:ul(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.wt||vo(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function cl(t){let e=function(t){const e=Zc(t);return 4===e.length?Zs.emptyPath():il(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ds(1===r);const t=n.from[0];t.allDescendants?i=t.collectionId:e=e.child(t.collectionId)}let s=[];n.where&&(s=function(t){const e=ll(t);return e instanceof Go&&Yo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new ca(pl(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,vo(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new jo(n,e)}(n.startAt));let l=null;return n.endAt&&(l=function(t){const e=!t.before,n=t.values||[];return new jo(n,e)}(n.endAt)),function(t,e,n,r,i,s,o,a){return new Ta(t,e,n,r,i,s,o,a)}(e,i,o,s,a,"F",c,l)}function ll(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=pl(t.unaryFilter.field);return Ko.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=pl(t.unaryFilter.field);return Ko.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=pl(t.unaryFilter.field);return Ko.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=pl(t.unaryFilter.field);return Ko.create(i,"!=",{nullValue:"NULL_VALUE"});default:return Os()}}(t):void 0!==t.fieldFilter?function(t){return Ko.create(pl(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Os()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Go.create(t.compositeFilter.filters.map((t=>ll(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Os()}}(t.compositeFilter.op))}(t):Os()}function ul(t){return $c[t]}function hl(t){return qc[t]}function dl(t){return Wc[t]}function fl(t){return{fieldPath:t.canonicalString()}}function pl(t){return eo.fromServerFormat(t.fieldPath)}function gl(t){return t instanceof Ko?function(t){if("=="===t.op){if(Bo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NAN"}};if(zo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Bo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NOT_NAN"}};if(zo(t.value))return{unaryFilter:{field:fl(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:fl(t.field),op:hl(t.op),value:t.value}}}(t):t instanceof Go?function(t){const e=t.getFilters().map((t=>gl(t)));return 1===e.length?e[0]:{compositeFilter:{op:dl(t.op),filters:e}}}(t):Os()}function ml(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function yl(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
|
|
1110
1110
|
/**
|
|
1111
1111
|
* @license
|
|
1112
1112
|
* Copyright 2017 Google LLC
|
|
@@ -1122,7 +1122,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1122
1122
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1123
1123
|
* See the License for the specific language governing permissions and
|
|
1124
1124
|
* limitations under the License.
|
|
1125
|
-
*/class
|
|
1125
|
+
*/class vl{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&oc(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=ac(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=ac(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ac();return this.mutations.forEach((r=>{const i=t.get(r.key),s=i.overlayedDocument;let o=this.applyToLocalView(s,i.mutatedFields);o=e.has(r.key)?null:o;const a=sc(s,o);null!==a&&n.set(r.key,a),s.isValidDocument()||s.convertToNoDocument(Js.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Oc())}isEqual(t){return this.batchId===t.batchId&&Qs(this.mutations,t.mutations,((t,e)=>lc(t,e)))&&Qs(this.baseMutations,t.baseMutations,((t,e)=>lc(t,e)))}}class wl{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Ds(t.mutations.length===n.length);let r=Nc;const i=t.mutations;for(let t=0;t<i.length;t++)r=r.insert(i[t].key,n[t].version);return new wl(t,e,n,r)}}
|
|
1126
1126
|
/**
|
|
1127
1127
|
* @license
|
|
1128
1128
|
* Copyright 2022 Google LLC
|
|
@@ -1138,7 +1138,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1138
1138
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1139
1139
|
* See the License for the specific language governing permissions and
|
|
1140
1140
|
* limitations under the License.
|
|
1141
|
-
*/class
|
|
1141
|
+
*/class bl{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
|
|
1142
1142
|
/**
|
|
1143
1143
|
* @license
|
|
1144
1144
|
* Copyright 2017 Google LLC
|
|
@@ -1154,7 +1154,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1154
1154
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1155
1155
|
* See the License for the specific language governing permissions and
|
|
1156
1156
|
* limitations under the License.
|
|
1157
|
-
*/class
|
|
1157
|
+
*/class Sl{constructor(t,e,n,r,i=Js.min(),s=Js.min(),o=bo.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o}withSequenceNumber(t){return new Sl(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new Sl(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new Sl(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
|
|
1158
1158
|
/**
|
|
1159
1159
|
* @license
|
|
1160
1160
|
* Copyright 2017 Google LLC
|
|
@@ -1170,7 +1170,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1170
1170
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1171
1171
|
* See the License for the specific language governing permissions and
|
|
1172
1172
|
* limitations under the License.
|
|
1173
|
-
*/class
|
|
1173
|
+
*/class _l{constructor(t){this.ie=t}}function El(t){const e=cl({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Da(e,e.limit,"L"):e}
|
|
1174
1174
|
/**
|
|
1175
1175
|
* @license
|
|
1176
1176
|
* Copyright 2019 Google LLC
|
|
@@ -1186,7 +1186,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1186
1186
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1187
1187
|
* See the License for the specific language governing permissions and
|
|
1188
1188
|
* limitations under the License.
|
|
1189
|
-
*/class
|
|
1189
|
+
*/class Tl{constructor(){this.Je=new Il}addToCollectionParentIndex(t,e){return this.Je.add(e),lo.resolve()}getCollectionParents(t,e){return lo.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return lo.resolve()}deleteFieldIndex(t,e){return lo.resolve()}getDocumentsMatchingTarget(t,e){return lo.resolve(null)}getIndexType(t,e){return lo.resolve(0)}getFieldIndexes(t,e){return lo.resolve([])}getNextCollectionGroupToUpdate(t){return lo.resolve(null)}getMinOffset(t,e){return lo.resolve(io.min())}getMinOffsetFromCollectionGroup(t,e){return lo.resolve(io.min())}updateCollectionGroup(t,e,n){return lo.resolve()}updateIndexEntries(t,e){return lo.resolve()}}class Il{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new fa(Zs.comparator),i=!r.has(n);return this.index[e]=r.add(n),i}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new fa(Zs.comparator)).toArray()}}
|
|
1190
1190
|
/**
|
|
1191
1191
|
* @license
|
|
1192
1192
|
* Copyright 2017 Google LLC
|
|
@@ -1202,7 +1202,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1202
1202
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1203
1203
|
* See the License for the specific language governing permissions and
|
|
1204
1204
|
* limitations under the License.
|
|
1205
|
-
*/class
|
|
1205
|
+
*/class kl{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new kl(0)}static vn(){return new kl(-1)}}
|
|
1206
1206
|
/**
|
|
1207
1207
|
* @license
|
|
1208
1208
|
* Copyright 2017 Google LLC
|
|
@@ -1218,7 +1218,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1218
1218
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1219
1219
|
* See the License for the specific language governing permissions and
|
|
1220
1220
|
* limitations under the License.
|
|
1221
|
-
*/class
|
|
1221
|
+
*/class Cl{constructor(){this.changes=new Sc((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,va.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?lo.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}
|
|
1222
1222
|
/**
|
|
1223
1223
|
* @license
|
|
1224
1224
|
* Copyright 2017 Google LLC
|
|
@@ -1250,7 +1250,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1250
1250
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1251
1251
|
* See the License for the specific language governing permissions and
|
|
1252
1252
|
* limitations under the License.
|
|
1253
|
-
*/class
|
|
1253
|
+
*/class Al{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
|
|
1254
1254
|
/**
|
|
1255
1255
|
* @license
|
|
1256
1256
|
* Copyright 2017 Google LLC
|
|
@@ -1266,7 +1266,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1266
1266
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1267
1267
|
* See the License for the specific language governing permissions and
|
|
1268
1268
|
* limitations under the License.
|
|
1269
|
-
*/class
|
|
1269
|
+
*/class Rl{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&ac(n.mutation,t,ga.empty(),Ys.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Oc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Oc()){const r=Cc();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Ic();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Cc();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Oc())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let i=Ec();const s=Rc(),o=Rc();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof hc)?i=i.insert(e.key,e):void 0!==o&&(s.set(e.key,o.mutation.getFieldMask()),ac(o.mutation,e,o.mutation.getFieldMask(),Ys.now()))})),this.recalculateAndSaveOverlays(t,i).next((t=>(t.forEach(((t,e)=>s.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Al(e,null!==(n=s.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=Rc();let r=new ua(((t,e)=>t-e)),i=Oc();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const i of t)i.keys().forEach((t=>{const s=e.get(t);if(null===s)return;let o=n.get(t)||ga.empty();o=i.applyToLocalView(s,o),n.set(t,o);const a=(r.get(i.batchId)||Oc()).add(t);r=r.insert(i.batchId,a)}))})).next((()=>{const s=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,l=Ac();c.forEach((t=>{if(!i.has(t)){const r=sc(e.get(t),n.get(t));null!==r&&l.set(t,r),i=i.add(t)}})),s.push(this.documentOverlayCache.saveOverlays(t,a,l))}return lo.waitFor(s)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n){return function(t){return no.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Ra(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((i=>{const s=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-i.size):lo.resolve(Cc());let o=-1,a=i;return s.next((e=>lo.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(e)?lo.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,i))).next((()=>this.computeViews(t,a,e,Oc()))).next((t=>({batchId:o,changes:kc(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new no(e)).next((t=>{let e=Ic();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let i=Ic();return this.indexManager.getCollectionParents(t,r).next((s=>lo.forEach(s,(s=>{const o=function(t,e){return new Ta(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,s.child(r));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{i=i.insert(t,e)}))}))})).next((()=>i))))}getDocumentsMatchingCollectionQuery(t,e,n){let r;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((i=>(r=i,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===r.get(n)&&(r=r.insert(n,va.newInvalidDocument(n)))}));let n=Ic();return r.forEach(((r,i)=>{const s=t.get(r);void 0!==s&&ac(s.mutation,i,ga.empty(),Ys.now()),Ua(e,i)&&(n=n.insert(r,i))})),n}))}}
|
|
1270
1270
|
/**
|
|
1271
1271
|
* @license
|
|
1272
1272
|
* Copyright 2020 Google LLC
|
|
@@ -1282,7 +1282,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1282
1282
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1283
1283
|
* See the License for the specific language governing permissions and
|
|
1284
1284
|
* limitations under the License.
|
|
1285
|
-
*/class
|
|
1285
|
+
*/class Nl{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return lo.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Jc(n.createTime)}),lo.resolve()}getNamedQuery(t,e){return lo.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:El(t.bundledQuery),readTime:Jc(t.readTime)}}(e)),lo.resolve()}}
|
|
1286
1286
|
/**
|
|
1287
1287
|
* @license
|
|
1288
1288
|
* Copyright 2022 Google LLC
|
|
@@ -1298,7 +1298,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1298
1298
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1299
1299
|
* See the License for the specific language governing permissions and
|
|
1300
1300
|
* limitations under the License.
|
|
1301
|
-
*/class
|
|
1301
|
+
*/class Ll{constructor(){this.overlays=new ua(no.comparator),this.es=new Map}getOverlay(t,e){return lo.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Cc();return lo.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,r)=>{this.oe(t,e,r)})),lo.resolve()}removeOverlaysForBatchId(t,e,n){const r=this.es.get(n);return void 0!==r&&(r.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),lo.resolve()}getOverlaysForCollection(t,e,n){const r=Cc(),i=e.length+1,s=new no(e.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){const t=o.getNext().value,s=t.getKey();if(!e.isPrefixOf(s.path))break;s.path.length===i&&t.largestBatchId>n&&r.set(t.getKey(),t)}return lo.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let i=new ua(((t,e)=>t-e));const s=this.overlays.getIterator();for(;s.hasNext();){const t=s.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=i.get(t.largestBatchId);null===e&&(e=Cc(),i=i.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Cc(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return lo.resolve(o)}oe(t,e,n){const r=this.overlays.get(n.key);if(null!==r){const t=this.es.get(r.largestBatchId).delete(n.key);this.es.set(r.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new bl(e,n));let i=this.es.get(e);void 0===i&&(i=Oc(),this.es.set(e,i)),this.es.set(e,i.add(n.key))}}
|
|
1302
1302
|
/**
|
|
1303
1303
|
* @license
|
|
1304
1304
|
* Copyright 2017 Google LLC
|
|
@@ -1314,7 +1314,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1314
1314
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1315
1315
|
* See the License for the specific language governing permissions and
|
|
1316
1316
|
* limitations under the License.
|
|
1317
|
-
*/class
|
|
1317
|
+
*/class Ol{constructor(){this.ns=new fa(Dl.ss),this.rs=new fa(Dl.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Dl(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new Dl(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new no(new Zs([])),n=new Dl(e,t),r=new Dl(e,t+1),i=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),i.push(t.key)})),i}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new no(new Zs([])),n=new Dl(e,t),r=new Dl(e,t+1);let i=Oc();return this.rs.forEachInRange([n,r],(t=>{i=i.add(t.key)})),i}containsKey(t){const e=new Dl(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Dl{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return no.comparator(t.key,e.key)||Gs(t._s,e._s)}static os(t,e){return Gs(t._s,e._s)||no.comparator(t.key,e.key)}}
|
|
1318
1318
|
/**
|
|
1319
1319
|
* @license
|
|
1320
1320
|
* Copyright 2017 Google LLC
|
|
@@ -1330,7 +1330,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1330
1330
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1331
1331
|
* See the License for the specific language governing permissions and
|
|
1332
1332
|
* limitations under the License.
|
|
1333
|
-
*/class
|
|
1333
|
+
*/class Pl{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new fa(Dl.ss)}checkEmpty(t){return lo.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const i=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const s=new vl(i,e,n,r);this.mutationQueue.push(s);for(const e of r)this.gs=this.gs.add(new Dl(e.key,i)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return lo.resolve(s)}lookupMutationBatch(t,e){return lo.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),i=r<0?0:r;return lo.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return lo.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return lo.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Dl(e,0),r=new Dl(e,Number.POSITIVE_INFINITY),i=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);i.push(e)})),lo.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new fa(Gs);return e.forEach((t=>{const e=new Dl(t,0),r=new Dl(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),lo.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let i=n;no.isDocumentKey(i)||(i=i.child(""));const s=new Dl(new no(i),0);let o=new fa(Gs);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),s),lo.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Ds(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return lo.forEach(e.mutations,(r=>{const i=new Dl(r.key,e.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Dl(e,0),r=this.gs.firstAfterOrEqual(n);return lo.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,lo.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
|
|
1334
1334
|
/**
|
|
1335
1335
|
* @license
|
|
1336
1336
|
* Copyright 2017 Google LLC
|
|
@@ -1346,7 +1346,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1346
1346
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1347
1347
|
* See the License for the specific language governing permissions and
|
|
1348
1348
|
* limitations under the License.
|
|
1349
|
-
*/class
|
|
1349
|
+
*/class xl{constructor(t){this.Es=t,this.docs=new ua(no.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),i=r?r.size:0,s=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:s}),this.size+=s-i,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return lo.resolve(n?n.document.mutableCopy():va.newInvalidDocument(e))}getEntries(t,e){let n=Ec();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():va.newInvalidDocument(t))})),lo.resolve(n)}getAllFromCollection(t,e,n){let r=Ec();const i=new no(e.child("")),s=this.docs.getIteratorFrom(i);for(;s.hasNext();){const{key:t,value:{document:i}}=s.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||so(ro(i),n)<=0||(r=r.insert(i.key,i.mutableCopy()))}return lo.resolve(r)}getAllFromCollectionGroup(t,e,n,r){Os()}As(t,e){return lo.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Ml(this)}getSize(t){return lo.resolve(this.size)}}class Ml extends Cl{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.Yn.addEntry(t,r)):this.Yn.removeEntry(n)})),lo.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
|
|
1350
1350
|
/**
|
|
1351
1351
|
* @license
|
|
1352
1352
|
* Copyright 2017 Google LLC
|
|
@@ -1362,7 +1362,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1362
1362
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1363
1363
|
* See the License for the specific language governing permissions and
|
|
1364
1364
|
* limitations under the License.
|
|
1365
|
-
*/class
|
|
1365
|
+
*/class Ul{constructor(t){this.persistence=t,this.Rs=new Sc((t=>Sa(t)),_a),this.lastRemoteSnapshotVersion=Js.min(),this.highestTargetId=0,this.bs=0,this.Ps=new Ol,this.targetCount=0,this.vs=kl.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),lo.resolve()}getLastRemoteSnapshotVersion(t){return lo.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return lo.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),lo.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),lo.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new kl(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,lo.resolve()}updateTargetData(t,e){return this.Dn(e),lo.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,lo.resolve()}removeTargets(t,e,n){let r=0;const i=[];return this.Rs.forEach(((s,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(s),i.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),lo.waitFor(i).next((()=>r))}getTargetCount(t){return lo.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return lo.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),lo.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const r=this.persistence.referenceDelegate,i=[];return r&&e.forEach((e=>{i.push(r.markPotentiallyOrphaned(t,e))})),lo.waitFor(i)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),lo.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return lo.resolve(n)}containsKey(t,e){return lo.resolve(this.Ps.containsKey(e))}}
|
|
1366
1366
|
/**
|
|
1367
1367
|
* @license
|
|
1368
1368
|
* Copyright 2017 Google LLC
|
|
@@ -1378,7 +1378,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1378
1378
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1379
1379
|
* See the License for the specific language governing permissions and
|
|
1380
1380
|
* limitations under the License.
|
|
1381
|
-
*/class
|
|
1381
|
+
*/class Fl{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new ho(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Ul(this),this.indexManager=new Tl,this.remoteDocumentCache=function(t){return new xl(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new _l(e),this.Ns=new Nl(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Ll,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Pl(e,this.referenceDelegate),this.Vs[t.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(t,e,n){As("MemoryPersistence","Starting transaction:",t);const r=new zl(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((t=>this.referenceDelegate.Os(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Ms(t,e){return lo.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class zl extends ao{constructor(t){super(),this.currentSequenceNumber=t}}class Bl{constructor(t){this.persistence=t,this.Fs=new Ol,this.$s=null}static Bs(t){return new Bl(t)}get Ls(){if(this.$s)return this.$s;throw Os()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),lo.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),lo.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),lo.resolve()}removeTarget(t,e){this.Fs.ls(e.targetId).forEach((t=>this.Ls.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Ls.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}ks(){this.$s=new Set}Os(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return lo.forEach(this.Ls,(n=>{const r=no.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,Js.min())}))})).next((()=>(this.$s=null,e.apply(t))))}updateLimboDocument(t,e){return this.qs(t,e).next((t=>{t?this.Ls.delete(e.toString()):this.Ls.add(e.toString())}))}xs(t){return 0}qs(t,e){return lo.or([()=>lo.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
|
|
1382
1382
|
/**
|
|
1383
1383
|
* @license
|
|
1384
1384
|
* Copyright 2017 Google LLC
|
|
@@ -1394,7 +1394,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1394
1394
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1395
1395
|
* See the License for the specific language governing permissions and
|
|
1396
1396
|
* limitations under the License.
|
|
1397
|
-
*/class
|
|
1397
|
+
*/class Vl{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=Oc(),r=Oc();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new Vl(t,e.fromCache,n,r)}}
|
|
1398
1398
|
/**
|
|
1399
1399
|
* @license
|
|
1400
1400
|
* Copyright 2019 Google LLC
|
|
@@ -1410,7 +1410,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1410
1410
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1411
1411
|
* See the License for the specific language governing permissions and
|
|
1412
1412
|
* limitations under the License.
|
|
1413
|
-
*/class
|
|
1413
|
+
*/class Hl{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((i=>i||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(ka(e))return lo.resolve(null);let n=La(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=Da(e,null,"F"),n=La(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const i=Oc(...r);return this.Ni.getDocuments(t,i).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const s=this.Fi(e,r);return this.$i(e,s,i,n.readTime)?this.ki(t,Da(e,null,"F")):this.Bi(t,s,e,n)}))))})))))}Oi(t,e,n,r){return ka(e)||r.isEqual(Js.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((i=>{const s=this.Fi(e,i);return this.$i(e,s,n,r)?this.Mi(t,e):(Cs()<=de.DEBUG&&As("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Ma(e)),this.Bi(t,s,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Js.fromTimestamp(1e9===r?new Ys(n+1,0):new Ys(n,r));return new io(i,no.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new fa(Fa(t));return e.forEach(((e,r)=>{Ua(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const i="F"===t.limitType?e.last():e.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Mi(t,e){return Cs()<=de.DEBUG&&As("QueryEngine","Using full collection scan to execute query:",Ma(e)),this.Ni.getDocumentsMatchingQuery(t,e,io.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
|
|
1414
1414
|
/**
|
|
1415
1415
|
* @license
|
|
1416
1416
|
* Copyright 2020 Google LLC
|
|
@@ -1426,7 +1426,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1426
1426
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1427
1427
|
* See the License for the specific language governing permissions and
|
|
1428
1428
|
* limitations under the License.
|
|
1429
|
-
*/class
|
|
1429
|
+
*/class jl{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new ua(Gs),this.Ui=new Sc((t=>Sa(t)),_a),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Rl(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function $l(t,e){const n=Ps(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((i=>(r=i,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const i=[],s=[];let o=Oc();for(const t of r){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:i,addedBatchIds:s})))}))}))}function ql(t){const e=Ps(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Wl(t,e){const n=Ps(t),r=e.snapshotVersion;let i=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const s=n.Gi.newChangeBuffer({trackRemovals:!0});i=n.qi;const o=[];e.targetChanges.forEach(((s,a)=>{const c=i.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,s.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,s.addedDocuments,a))));let l=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?l=l.withResumeToken(bo.EMPTY_BYTE_STRING,Js.min()).withLastLimboFreeSnapshotVersion(Js.min()):s.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(s.resumeToken,r)),i=i.insert(a,l),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,l,s)&&o.push(n.Cs.updateTargetData(t,l))}));let a=Ec(),c=Oc();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Oc(),i=Oc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ec();return n.forEach(((n,s)=>{const o=t.get(n);s.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),s.isNoDocument()&&s.version.isEqual(Js.min())?(e.removeEntry(n,s.readTime),r=r.insert(n,s)):!o.isValidDocument()||s.version.compareTo(o.version)>0||0===s.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(s),r=r.insert(n,s)):As("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",s.version)})),{Wi:r,zi:i}}))}(t,s,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(Js.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return lo.waitFor(o).next((()=>s.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=i,t)))}function Kl(t,e){const n=Ps(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function Gl(t,e,n){const r=Ps(t),i=r.qi.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,(t=>r.persistence.referenceDelegate.removeTarget(t,i)))}catch(t){if(!uo(t))throw t;As("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(i.target)}function Ql(t,e,n){const r=Ps(t);let i=Js.min(),s=Oc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Ps(t),i=r.Ui.get(n);return void 0!==i?lo.resolve(r.qi.get(i)):r.Cs.getTargetData(e,n)}(r,t,La(e)).next((e=>{if(e)return i=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{s=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?i:Js.min(),n?s:Oc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Js.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:s})))))}class Yl{constructor(){this.activeTargetIds=Pc()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class Jl{constructor(){this.Lr=new Yl,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new Yl,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
|
|
1430
1430
|
/**
|
|
1431
1431
|
* @license
|
|
1432
1432
|
* Copyright 2019 Google LLC
|
|
@@ -1442,7 +1442,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1442
1442
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1443
1443
|
* See the License for the specific language governing permissions and
|
|
1444
1444
|
* limitations under the License.
|
|
1445
|
-
*/class
|
|
1445
|
+
*/class Xl{Ur(t){}shutdown(){}}
|
|
1446
1446
|
/**
|
|
1447
1447
|
* @license
|
|
1448
1448
|
* Copyright 2019 Google LLC
|
|
@@ -1458,7 +1458,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1458
1458
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1459
1459
|
* See the License for the specific language governing permissions and
|
|
1460
1460
|
* limitations under the License.
|
|
1461
|
-
*/class
|
|
1461
|
+
*/class Zl{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){As("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){As("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.Wr)t(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
|
|
1462
1462
|
/**
|
|
1463
1463
|
* @license
|
|
1464
1464
|
* Copyright 2020 Google LLC
|
|
@@ -1474,7 +1474,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1474
1474
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1475
1475
|
* See the License for the specific language governing permissions and
|
|
1476
1476
|
* limitations under the License.
|
|
1477
|
-
*/const
|
|
1477
|
+
*/const tu={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
|
|
1478
1478
|
/**
|
|
1479
1479
|
* @license
|
|
1480
1480
|
* Copyright 2017 Google LLC
|
|
@@ -1490,7 +1490,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1490
1490
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1491
1491
|
* See the License for the specific language governing permissions and
|
|
1492
1492
|
* limitations under the License.
|
|
1493
|
-
*/class
|
|
1493
|
+
*/class eu{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
|
|
1494
1494
|
/**
|
|
1495
1495
|
* @license
|
|
1496
1496
|
* Copyright 2017 Google LLC
|
|
@@ -1506,7 +1506,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1506
1506
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1507
1507
|
* See the License for the specific language governing permissions and
|
|
1508
1508
|
* limitations under the License.
|
|
1509
|
-
*/class
|
|
1509
|
+
*/class nu extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,i){const s=this.ho(t,e);As("RestConnection","Sending: ",s,n);const o={};return this.lo(o,r,i),this.fo(t,s,o,n).then((t=>(As("RestConnection","Received: ",t),t)),(e=>{throw Ns("RestConnection",`${t} failed with error: `,e,"url: ",s,"request:",n),e}))}_o(t,e,n,r,i,s){return this.ao(t,e,n,r,i)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Is,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=tu[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((i,s)=>{const o=new _s;o.setWithCredentials(!0),o.listenOnce(ms.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case gs.NO_ERROR:const e=o.getResponseJson();As("Connection","XHR received:",JSON.stringify(e)),i(e);break;case gs.TIMEOUT:As("Connection",'RPC "'+t+'" timed out'),s(new Ms(xs.DEADLINE_EXCEEDED,"Request time out"));break;case gs.HTTP_ERROR:const n=o.getStatus();if(As("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(xs).indexOf(e)>=0?e:xs.UNKNOWN}(e.status);s(new Ms(t,e.message))}else s(new Ms(xs.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new Ms(xs.UNAVAILABLE,"Connection failed."));break;default:Os()}}finally{As("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=new us,s=cr(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new bs({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");As("Connection","Creating WebChannel: "+a,o);const c=i.createWebChannel(a,o);let l=!1,u=!1;const h=new eu({Hr:t=>{u?As("Connection","Not sending because WebChannel is closed:",t):(l||(As("Connection","Opening WebChannel transport."),c.open(),l=!0),As("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,Ss.EventType.OPEN,(()=>{u||As("Connection","WebChannel transport opened.")})),d(c,Ss.EventType.CLOSE,(()=>{u||(u=!0,As("Connection","WebChannel transport closed"),h.io())})),d(c,Ss.EventType.ERROR,(t=>{u||(u=!0,Ns("Connection","WebChannel transport errored:",t),h.io(new Ms(xs.UNAVAILABLE,"The operation could not be completed")))})),d(c,Ss.EventType.MESSAGE,(t=>{var e;if(!u){const n=t.data[0];Ds(!!n);const r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){As("Connection","WebChannel received error:",i);const t=i.status;let e=function(t){const e=vc[t];if(void 0!==e)return bc(e)}(t),n=i.message;void 0===e&&(e=xs.INTERNAL,n="Unknown error status: "+t+" with message "+i.message),u=!0,h.io(new Ms(e,n)),c.close()}else As("Connection","WebChannel received:",n),h.ro(n)}})),d(s,ys.STAT_EVENT,(t=>{t.stat===vs?As("Connection","Detected buffering proxy"):t.stat===ws&&As("Connection","Detected no buffering proxy")})),setTimeout((()=>{h.so()}),0),h}}function ru(){return"undefined"!=typeof document?document:null}
|
|
1510
1510
|
/**
|
|
1511
1511
|
* @license
|
|
1512
1512
|
* Copyright 2020 Google LLC
|
|
@@ -1522,7 +1522,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1522
1522
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1523
1523
|
* See the License for the specific language governing permissions and
|
|
1524
1524
|
* limitations under the License.
|
|
1525
|
-
*/function
|
|
1525
|
+
*/function iu(t){return new Kc(t,!0)}class su{constructor(t,e,n=1e3,r=1.5,i=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=r,this.po=i,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,e-n);r>0&&As("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
|
|
1526
1526
|
/**
|
|
1527
1527
|
* @license
|
|
1528
1528
|
* Copyright 2017 Google LLC
|
|
@@ -1538,7 +1538,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1538
1538
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1539
1539
|
* See the License for the specific language governing permissions and
|
|
1540
1540
|
* limitations under the License.
|
|
1541
|
-
*/class
|
|
1541
|
+
*/class ou{constructor(t,e,n,r,i,s,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new su(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===xs.RESOURCE_EXHAUSTED?(Rs(e.toString()),Rs("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===xs.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new Ms(xs.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return As("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(As("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class au extends ou{constructor(t,e,n,r,i,s){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,s),this.yt=i}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Os()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(t,e){return t.wt?(Ds(void 0===e||"string"==typeof e),bo.fromBase64String(e||"")):(Ds(void 0===e||e instanceof Uint8Array),bo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?xs.UNKNOWN:bc(t.code);return new Ms(e,t.message||"")}(o);n=new zc(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=el(t,r.document.name),s=Jc(r.document.updateTime),o=r.document.createTime?Jc(r.document.createTime):Js.min(),a=new ma({mapValue:{fields:r.document.fields}}),c=va.newFoundDocument(i,s,o,a),l=r.targetIds||[],u=r.removedTargetIds||[];n=new Uc(l,u,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=el(t,r.document),s=r.readTime?Jc(r.readTime):Js.min(),o=va.newNoDocument(i,s),a=r.removedTargetIds||[];n=new Uc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=el(t,r.document),s=r.removedTargetIds||[];n=new Uc([],s,i,null)}else{if(!("filter"in e))return Os();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,i=new yc(r),s=t.targetId;n=new Fc(s,i)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Js.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Js.min():e.readTime?Jc(e.readTime):Js.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=rl(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=Ea(r)?{documents:ol(t,r)}:{query:al(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Qc(t,e.resumeToken):e.snapshotVersion.compareTo(Js.min())>0&&(n.readTime=Gc(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Os()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=rl(this.yt),e.removeTarget=t,this.Bo(e)}}class cu extends ou{constructor(t,e,n,r,i,s){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,s),this.yt=i,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Ds(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Ds(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Jc(t.updateTime):Jc(e);return n.isEqual(Js.min())&&(n=Jc(e)),new ec(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Jc(t.commitTime);return this.listener.Zo(n,e)}return Ds(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=rl(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof uc)n={update:sl(t,e.key,e.value)};else if(e instanceof gc)n={delete:tl(t,e.key)};else if(e instanceof hc)n={update:sl(t,e.key,e.data),updateMask:ml(e.fieldMask)};else{if(!(e instanceof mc))return Os();n={verify:tl(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Ka)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ga)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Ya)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Xa)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw Os()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Yc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Os()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
|
|
1542
1542
|
/**
|
|
1543
1543
|
* @license
|
|
1544
1544
|
* Copyright 2017 Google LLC
|
|
@@ -1554,7 +1554,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1554
1554
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1555
1555
|
* See the License for the specific language governing permissions and
|
|
1556
1556
|
* limitations under the License.
|
|
1557
|
-
*/class
|
|
1557
|
+
*/class lu extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new Ms(xs.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,i])=>this.connection.ao(t,e,n,r,i))).catch((t=>{throw"FirebaseError"===t.name?(t.code===xs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Ms(xs.UNKNOWN,t.toString())}))}_o(t,e,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,s])=>this.connection._o(t,e,n,i,s,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===xs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Ms(xs.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class uu{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(t){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.cu("Offline")))}set(t){this.lu(),this.iu=0,"Online"===t&&(this.ou=!1),this.cu(t)}cu(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}au(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.ou?(Rs(e),this.ou=!1):As("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
|
|
1558
1558
|
/**
|
|
1559
1559
|
* @license
|
|
1560
1560
|
* Copyright 2017 Google LLC
|
|
@@ -1570,7 +1570,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1570
1570
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1571
1571
|
* See the License for the specific language governing permissions and
|
|
1572
1572
|
* limitations under the License.
|
|
1573
|
-
*/class
|
|
1573
|
+
*/class hu{constructor(t,e,n,r,i){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=i,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{bu(this)&&(As("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Ps(t);e._u.add(4),await fu(e),e.gu.set("Unknown"),e._u.delete(4),await du(e)}(this))}))})),this.gu=new uu(n,r)}}async function du(t){if(bu(t))for(const e of t.wu)await e(!0)}async function fu(t){for(const e of t.wu)await e(!1)}function pu(t,e){const n=Ps(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),wu(n)?vu(n):Uu(n).ko()&&mu(n,e))}function gu(t,e){const n=Ps(t),r=Uu(n);n.du.delete(e),r.ko()&&yu(n,e),0===n.du.size&&(r.ko()?r.Fo():bu(n)&&n.gu.set("Unknown"))}function mu(t,e){t.yu.Ot(e.targetId),Uu(t).zo(e)}function yu(t,e){t.yu.Ot(e),Uu(t).Ho(e)}function vu(t){t.yu=new Vc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),Uu(t).start(),t.gu.uu()}function wu(t){return bu(t)&&!Uu(t).No()&&t.du.size>0}function bu(t){return 0===Ps(t)._u.size}function Su(t){t.yu=void 0}async function _u(t){t.du.forEach(((e,n)=>{mu(t,e)}))}async function Eu(t,e){Su(t),wu(t)?(t.gu.hu(e),vu(t)):t.gu.set("Unknown")}async function Tu(t,e,n){if(t.gu.set("Online"),e instanceof zc&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.du.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.du.delete(r),t.yu.removeTarget(r))}(t,e)}catch(n){As("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Iu(t,n)}else if(e instanceof Uc?t.yu.Kt(e):e instanceof Fc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Js.min()))try{const e=await ql(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const i=t.du.get(r);i&&t.du.set(r,i.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(bo.EMPTY_BYTE_STRING,n.snapshotVersion)),yu(t,e);const r=new Sl(n.target,e,1,n.sequenceNumber);mu(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){As("RemoteStore","Failed to raise snapshot:",e),await Iu(t,e)}}async function Iu(t,e,n){if(!uo(e))throw e;t._u.add(1),await fu(t),t.gu.set("Offline"),n||(n=()=>ql(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{As("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await du(t)}))}function ku(t,e){return e().catch((n=>Iu(t,n,e)))}async function Cu(t){const e=Ps(t),n=Fu(e);let r=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Au(e);)try{const t=await Kl(e.localStore,r);if(null===t){0===e.fu.length&&n.Fo();break}r=t.batchId,Ru(e,t)}catch(t){await Iu(e,t)}Nu(e)&&Lu(e)}function Au(t){return bu(t)&&t.fu.length<10}function Ru(t,e){t.fu.push(e);const n=Fu(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Nu(t){return bu(t)&&!Fu(t).No()&&t.fu.length>0}function Lu(t){Fu(t).start()}async function Ou(t){Fu(t).eu()}async function Du(t){const e=Fu(t);for(const n of t.fu)e.Xo(n.mutations)}async function Pu(t,e,n){const r=t.fu.shift(),i=wl.from(r,e,n);await ku(t,(()=>t.remoteSyncer.applySuccessfulWrite(i))),await Cu(t)}async function xu(t,e){e&&Fu(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return Os();case xs.CANCELLED:case xs.UNKNOWN:case xs.DEADLINE_EXCEEDED:case xs.RESOURCE_EXHAUSTED:case xs.INTERNAL:case xs.UNAVAILABLE:case xs.UNAUTHENTICATED:return!1;case xs.INVALID_ARGUMENT:case xs.NOT_FOUND:case xs.ALREADY_EXISTS:case xs.PERMISSION_DENIED:case xs.FAILED_PRECONDITION:case xs.ABORTED:case xs.OUT_OF_RANGE:case xs.UNIMPLEMENTED:case xs.DATA_LOSS:return!0}}(n=e.code)&&n!==xs.ABORTED){const n=t.fu.shift();Fu(t).Mo(),await ku(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Cu(t)}var n}(t,e),Nu(t)&&Lu(t)}async function Mu(t,e){const n=Ps(t);n.asyncQueue.verifyOperationInProgress(),As("RemoteStore","RemoteStore received new credentials");const r=bu(n);n._u.add(3),await fu(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await du(n)}function Uu(t){return t.pu||(t.pu=function(t,e,n){const r=Ps(t);return r.su(),new au(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
|
|
1574
1574
|
/**
|
|
1575
1575
|
* @license
|
|
1576
1576
|
* Copyright 2018 Google LLC
|
|
@@ -1586,7 +1586,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1586
1586
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1587
1587
|
* See the License for the specific language governing permissions and
|
|
1588
1588
|
* limitations under the License.
|
|
1589
|
-
*/}(t.datastore,t.asyncQueue,{Yr:
|
|
1589
|
+
*/}(t.datastore,t.asyncQueue,{Yr:_u.bind(null,t),Zr:Eu.bind(null,t),Wo:Tu.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),wu(t)?vu(t):t.gu.set("Unknown")):(await t.pu.stop(),Su(t))}))),t.pu}function Fu(t){return t.Iu||(t.Iu=function(t,e,n){const r=Ps(t);return r.su(),new cu(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)}(t.datastore,t.asyncQueue,{Yr:Ou.bind(null,t),Zr:xu.bind(null,t),tu:Du.bind(null,t),Zo:Pu.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Cu(t)):(await t.Iu.stop(),t.fu.length>0&&(As("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
|
|
1590
1590
|
/**
|
|
1591
1591
|
* @license
|
|
1592
1592
|
* Copyright 2017 Google LLC
|
|
@@ -1602,7 +1602,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1602
1602
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1603
1603
|
* See the License for the specific language governing permissions and
|
|
1604
1604
|
* limitations under the License.
|
|
1605
|
-
*/}class
|
|
1605
|
+
*/}class zu{constructor(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new Us,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,i){const s=Date.now()+n,o=new zu(t,e,s,r,i);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Ms(xs.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Bu(t,e){if(Rs("AsyncQueue",`${e}: ${t}`),uo(t))return new Ms(xs.UNAVAILABLE,`${e}: ${t}`);throw t}
|
|
1606
1606
|
/**
|
|
1607
1607
|
* @license
|
|
1608
1608
|
* Copyright 2017 Google LLC
|
|
@@ -1618,7 +1618,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1618
1618
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1619
1619
|
* See the License for the specific language governing permissions and
|
|
1620
1620
|
* limitations under the License.
|
|
1621
|
-
*/class
|
|
1621
|
+
*/class Vu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||no.comparator(e.key,n.key):(t,e)=>no.comparator(t.key,e.key),this.keyedMap=Ic(),this.sortedSet=new ua(this.comparator)}static emptySet(t){return new Vu(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Vu))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Vu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
|
|
1622
1622
|
/**
|
|
1623
1623
|
* @license
|
|
1624
1624
|
* Copyright 2017 Google LLC
|
|
@@ -1634,7 +1634,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1634
1634
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1635
1635
|
* See the License for the specific language governing permissions and
|
|
1636
1636
|
* limitations under the License.
|
|
1637
|
-
*/class
|
|
1637
|
+
*/class Hu{constructor(){this.Tu=new ua(no.comparator)}track(t){const e=t.doc.key,n=this.Tu.get(e);n?0!==t.type&&3===n.type?this.Tu=this.Tu.insert(e,t):3===t.type&&1!==n.type?this.Tu=this.Tu.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Tu=this.Tu.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Tu=this.Tu.remove(e):1===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):Os():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class ju{constructor(t,e,n,r,i,s,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,r,i){const s=[];return e.forEach((t=>{s.push({type:0,doc:t})})),new ju(t,e,Vu.emptySet(e),s,n,r,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&Pa(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}
|
|
1638
1638
|
/**
|
|
1639
1639
|
* @license
|
|
1640
1640
|
* Copyright 2017 Google LLC
|
|
@@ -1650,7 +1650,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1650
1650
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1651
1651
|
* See the License for the specific language governing permissions and
|
|
1652
1652
|
* limitations under the License.
|
|
1653
|
-
*/class
|
|
1653
|
+
*/class $u{constructor(){this.Au=void 0,this.listeners=[]}}class qu{constructor(){this.queries=new Sc((t=>xa(t)),Pa),this.onlineState="Unknown",this.Ru=new Set}}async function Wu(t,e){const n=Ps(t),r=e.query;let i=!1,s=n.queries.get(r);if(s||(i=!0,s=new $u),i)try{s.Au=await n.onListen(r)}catch(t){const n=Bu(t,`Initialization of query '${Ma(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,s),s.listeners.push(e),e.bu(n.onlineState),s.Au&&e.Pu(s.Au)&&Yu(n)}async function Ku(t,e){const n=Ps(t),r=e.query;let i=!1;const s=n.queries.get(r);if(s){const t=s.listeners.indexOf(e);t>=0&&(s.listeners.splice(t,1),i=0===s.listeners.length)}if(i)return n.queries.delete(r),n.onUnlisten(r)}function Gu(t,e){const n=Ps(t);let r=!1;for(const t of e){const e=t.query,i=n.queries.get(e);if(i){for(const e of i.listeners)e.Pu(t)&&(r=!0);i.Au=t}}r&&Yu(n)}function Qu(t,e,n){const r=Ps(t),i=r.queries.get(e);if(i)for(const t of i.listeners)t.onError(n);r.queries.delete(e)}function Yu(t){t.Ru.forEach((t=>{t.next()}))}class Ju{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new ju(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=ju.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
|
|
1654
1654
|
/**
|
|
1655
1655
|
* @license
|
|
1656
1656
|
* Copyright 2017 Google LLC
|
|
@@ -1666,7 +1666,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1666
1666
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1667
1667
|
* See the License for the specific language governing permissions and
|
|
1668
1668
|
* limitations under the License.
|
|
1669
|
-
*/class
|
|
1669
|
+
*/class Xu{constructor(t){this.key=t}}class Zu{constructor(t){this.key=t}}class th{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Oc(),this.mutatedKeys=Oc(),this.Gu=Fa(t),this.Qu=new Vu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Hu,r=e?e.Qu:this.Qu;let i=e?e.mutatedKeys:this.mutatedKeys,s=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const l=r.get(t),u=Ua(this.query,e)?e:null,h=!!l&&this.mutatedKeys.has(l.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let f=!1;l&&u?l.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),f=!0):this.Hu(l,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.Gu(u,a)>0||c&&this.Gu(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),f=!0):l&&!u&&(n.track({type:1,doc:l}),f=!0,(a||c)&&(o=!0)),f&&(u?(s=s.add(u),i=d?i.add(t):i.delete(t)):(s=s.delete(t),i=i.delete(t)))})),null!==this.query.limit)for(;s.size>this.query.limit;){const t="F"===this.query.limitType?s.last():s.first();s=s.delete(t.key),i=i.delete(t.key),n.track({type:1,doc:t})}return{Qu:s,zu:n,$i:o,mutatedKeys:i}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const i=t.zu.Eu();i.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Os()}};return n(t)-n(e)}
|
|
1670
1670
|
/**
|
|
1671
1671
|
* @license
|
|
1672
1672
|
* Copyright 2020 Google LLC
|
|
@@ -1682,7 +1682,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1682
1682
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1683
1683
|
* See the License for the specific language governing permissions and
|
|
1684
1684
|
* limitations under the License.
|
|
1685
|
-
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==i.length||a?{snapshot:new Bu(this.query,t.Qu,r,i,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new zu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Rc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Yu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Qu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Rc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Bu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Xu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class Zu{constructor(t){this.key=t,this.nc=!1}}class th{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new vc((t=>Oa(t)),La),this.rc=new Map,this.oc=new Set,this.uc=new aa(Zs.comparator),this.cc=new Map,this.ac=new Rl,this.hc={},this.lc=new Map,this.fc=El.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function eh(t,e){const n=function(t){const e=Ls(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ih.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=vh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=oh.bind(null,e),e.sc.Wo=qu.bind(null,e.eventManager),e.sc.wc=Wu.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,oo.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new vl(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Aa(e));n.isPrimaryClient&&hu(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await Wl(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return fh(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await Wl(t.localStore,e,!0),o=new Ju(e,s.Hi),a=o.Wu(s.documents),c=Dc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);fh(t,n,l.Xu);const u=new Xu(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,r,"current"===s,t.resumeToken)}return i}async function nh(t,e){const n=Ls(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!La(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ql(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),du(n.remoteStore,r.targetId),hh(n,r.targetId)})).catch(so)):(hh(n,r.targetId),await ql(n.localStore,r.targetId,!0))}async function rh(t,e,n){const r=function(t){const e=Ls(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ah.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=ch.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ls(t),r=Ks.now(),i=e.reduce(((t,e)=>t.add(e.key)),Rc());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=bc(),c=Rc();return n.Gi.getEntries(t,i).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((i=>{s=i;const o=[];for(const t of e){const e=sc(t,s.get(t.key).overlayedDocument);null!=e&&o.push(new cc(t.key,e,pa(e.value.mapValue),Za.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:Ec(s)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new aa(qs)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await mh(r,t.changes),await Tu(r.remoteStore)}catch(t){const e=Uu(t,"Failed to persist write");n.reject(e)}}async function ih(t,e){const n=Ls(t);try{const t=await $l(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Ns(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Ns(r.nc):t.removedDocuments.size>0&&(Ns(r.nc),r.nc=!1))})),await mh(n,t,e)}catch(t){await so(t)}}function sh(t,e,n){const r=Ls(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const i=r.view.bu(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=Ls(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Ku(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function oh(t,e,n){const r=Ls(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.cc.get(e),s=i&&i.key;if(s){let t=new aa(Zs.comparator);t=t.insert(s,ga.newNoDocument(s,Gs.min()));const n=Rc().add(s),i=new Oc(Gs.min(),new Map,new ua(qs),t,n);await ih(r,i),r.uc=r.uc.remove(s),r.cc.delete(e),gh(r)}else await ql(r.localStore,e,!1).then((()=>hh(r,e,n))).catch(so)}async function ah(t,e){const n=Ls(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),i=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const i=n.batch,s=i.keys();let o=oo.resolve();return s.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);Ns(null!==s),e.version.compareTo(s)<0&&(i.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,i)))}(n,t,e,i).next((()=>i.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Rc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);uh(n,r,null),lh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await mh(n,t)}catch(t){await so(t)}}async function ch(t,e,n){const r=Ls(t);try{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Ns(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);uh(r,e,n),lh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await mh(r,t)}catch(n){await so(n)}}function lh(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function uh(t,e,n){const r=Ls(t);let i=r.hc[r.currentUser.toKey()];if(i){const t=i.get(e);t&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.hc[r.currentUser.toKey()]=i}}function hh(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||dh(t,e)}))}function dh(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(du(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),gh(t))}function fh(t,e,n){for(const r of n)r instanceof Qu?(t.ac.addReference(r.key,e),ph(t,r)):r instanceof Yu?(Is("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||dh(t,r.key)):Rs()}function ph(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Is("SyncEngine","New document in limbo: "+n),t.oc.add(r),gh(t))}function gh(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new Zs(Ys.fromString(e)),r=t.fc.next();t.cc.set(r,new Zu(n)),t.uc=t.uc.insert(n,r),hu(t.remoteStore,new vl(Aa(Sa(n.path)),r,2,co.at))}}async function mh(t,e,n){const r=Ls(t),i=[],s=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);const e=Fl.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.sc.Wo(i),await async function(t,e){const n=Ls(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>oo.forEach(e,(e=>oo.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>oo.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!ao(t))throw t;Is("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,i)}}}(r.localStore,s))}async function yh(t,e){const n=Ls(t);if(!n.currentUser.isEqual(e)){Is("SyncEngine","User change. New user:",e.toKey());const t=await Vl(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Ds(Os.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await mh(n,t.ji)}}function vh(t,e){const n=Ls(t),r=n.cc.get(e);if(r&&r.nc)return Rc().add(r.key);{let t=Rc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class wh{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=eu(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new Bl(t,e,n,r)}(this.persistence,new zl,t.initialUser,this.yt)}yc(t){return new Pl(Ul.Bs,this.yt)}gc(t){return new Gl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class bh{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>sh(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=yh.bind(null,this.syncEngine),await async function(t,e){const n=Ls(t);e?(n._u.delete(2),await lu(n)):e||(n._u.add(2),await uu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Hu}createDatastore(t){const e=eu(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new Zl(r));var r;return function(t,e,n,r){return new ou(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>sh(this.syncEngine,t,0),s=Yl.C()?new Yl:new Ql,new cu(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new th(t,e,n,r,i,s);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Ls(t);Is("RemoteStore","RemoteStore shutting down."),e._u.add(5),await uu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1685
|
+
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==i.length||a?{snapshot:new ju(this.query,t.Qu,r,i,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Hu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Oc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Zu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Xu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return ju.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class eh{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class nh{constructor(t){this.key=t,this.nc=!1}}class rh{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new Sc((t=>xa(t)),Pa),this.rc=new Map,this.oc=new Set,this.uc=new ua(no.comparator),this.cc=new Map,this.ac=new Ol,this.hc={},this.lc=new Map,this.fc=kl.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function ih(t,e){const n=function(t){const e=Ps(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ah.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Sh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=lh.bind(null,e),e.sc.Wo=Gu.bind(null,e.eventManager),e.sc.wc=Qu.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=Ps(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,lo.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new Sl(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,La(e));n.isPrimaryClient&&pu(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await Ql(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return mh(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await Ql(t.localStore,e,!0),o=new th(e,s.Hi),a=o.Wu(s.documents),c=Mc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);mh(t,n,l.Xu);const u=new eh(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,r,"current"===s,t.resumeToken)}return i}async function sh(t,e){const n=Ps(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!Pa(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Gl(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),gu(n.remoteStore,r.targetId),ph(n,r.targetId)})).catch(co)):(ph(n,r.targetId),await Gl(n.localStore,r.targetId,!0))}async function oh(t,e,n){const r=function(t){const e=Ps(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=uh.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hh.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ps(t),r=Ys.now(),i=e.reduce(((t,e)=>t.add(e.key)),Oc());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=Ec(),c=Oc();return n.Gi.getEntries(t,i).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((i=>{s=i;const o=[];for(const t of e){const e=cc(t,s.get(t.key).overlayedDocument);null!=e&&o.push(new hc(t.key,e,ya(e.value.mapValue),nc.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:kc(s)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new ua(Gs)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await wh(r,t.changes),await Cu(r.remoteStore)}catch(t){const e=Bu(t,"Failed to persist write");n.reject(e)}}async function ah(t,e){const n=Ps(t);try{const t=await Wl(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Ds(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Ds(r.nc):t.removedDocuments.size>0&&(Ds(r.nc),r.nc=!1))})),await wh(n,t,e)}catch(t){await co(t)}}function ch(t,e,n){const r=Ps(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const i=r.view.bu(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=Ps(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Yu(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function lh(t,e,n){const r=Ps(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.cc.get(e),s=i&&i.key;if(s){let t=new ua(no.comparator);t=t.insert(s,va.newNoDocument(s,Js.min()));const n=Oc().add(s),i=new xc(Js.min(),new Map,new fa(Gs),t,n);await ah(r,i),r.uc=r.uc.remove(s),r.cc.delete(e),vh(r)}else await Gl(r.localStore,e,!1).then((()=>ph(r,e,n))).catch(co)}async function uh(t,e){const n=Ps(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Ps(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),i=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const i=n.batch,s=i.keys();let o=lo.resolve();return s.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);Ds(null!==s),e.version.compareTo(s)<0&&(i.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,i)))}(n,t,e,i).next((()=>i.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Oc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);fh(n,r,null),dh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await wh(n,t)}catch(t){await co(t)}}async function hh(t,e,n){const r=Ps(t);try{const t=await function(t,e){const n=Ps(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Ds(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);fh(r,e,n),dh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await wh(r,t)}catch(n){await co(n)}}function dh(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function fh(t,e,n){const r=Ps(t);let i=r.hc[r.currentUser.toKey()];if(i){const t=i.get(e);t&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.hc[r.currentUser.toKey()]=i}}function ph(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||gh(t,e)}))}function gh(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(gu(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),vh(t))}function mh(t,e,n){for(const r of n)r instanceof Xu?(t.ac.addReference(r.key,e),yh(t,r)):r instanceof Zu?(As("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||gh(t,r.key)):Os()}function yh(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(As("SyncEngine","New document in limbo: "+n),t.oc.add(r),vh(t))}function vh(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new no(Zs.fromString(e)),r=t.fc.next();t.cc.set(r,new nh(n)),t.uc=t.uc.insert(n,r),pu(t.remoteStore,new Sl(La(Ia(n.path)),r,2,ho.at))}}async function wh(t,e,n){const r=Ps(t),i=[],s=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);const e=Vl.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.sc.Wo(i),await async function(t,e){const n=Ps(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>lo.forEach(e,(e=>lo.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>lo.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!uo(t))throw t;As("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,i)}}}(r.localStore,s))}async function bh(t,e){const n=Ps(t);if(!n.currentUser.isEqual(e)){As("SyncEngine","User change. New user:",e.toKey());const t=await $l(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Ms(xs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await wh(n,t.ji)}}function Sh(t,e){const n=Ps(t),r=n.cc.get(e);if(r&&r.nc)return Oc().add(r.key);{let t=Oc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class _h{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=iu(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new jl(t,e,n,r)}(this.persistence,new Hl,t.initialUser,this.yt)}yc(t){return new Fl(Bl.Bs,this.yt)}gc(t){return new Jl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Eh{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>ch(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=bh.bind(null,this.syncEngine),await async function(t,e){const n=Ps(t);e?(n._u.delete(2),await du(n)):e||(n._u.add(2),await fu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new qu}createDatastore(t){const e=iu(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new nu(r));var r;return function(t,e,n,r){return new lu(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>ch(this.syncEngine,t,0),s=Zl.C()?new Zl:new Xl,new hu(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new rh(t,e,n,r,i,s);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Ps(t);As("RemoteStore","RemoteStore shutting down."),e._u.add(5),await fu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1686
1686
|
/**
|
|
1687
1687
|
* @license
|
|
1688
1688
|
* Copyright 2017 Google LLC
|
|
@@ -1698,7 +1698,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1698
1698
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1699
1699
|
* See the License for the specific language governing permissions and
|
|
1700
1700
|
* limitations under the License.
|
|
1701
|
-
*/function
|
|
1701
|
+
*/function Th(t,e,n){if(!n)throw new Ms(xs.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Ih(t){if(!no.isDocumentKey(t))throw new Ms(xs.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function kh(t){if(no.isDocumentKey(t))throw new Ms(xs.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Ch(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Os()}function Ah(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Ms(xs.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Ch(t);throw new Ms(xs.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
|
|
1702
1702
|
/**
|
|
1703
1703
|
* @license
|
|
1704
1704
|
* Copyright 2020 Google LLC
|
|
@@ -1714,7 +1714,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1714
1714
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1715
1715
|
* See the License for the specific language governing permissions and
|
|
1716
1716
|
* limitations under the License.
|
|
1717
|
-
*/const
|
|
1717
|
+
*/const Rh=new Map;class Nh{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Ms(xs.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Ms(xs.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new Ms(xs.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}
|
|
1718
1718
|
/**
|
|
1719
1719
|
* @license
|
|
1720
1720
|
* Copyright 2020 Google LLC
|
|
@@ -1730,7 +1730,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1730
1730
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1731
1731
|
* See the License for the specific language governing permissions and
|
|
1732
1732
|
* limitations under the License.
|
|
1733
|
-
*/class
|
|
1733
|
+
*/class Lh{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Nh({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Ms(xs.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Ms(xs.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Nh(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new zs;switch(t.type){case"gapi":const e=t.client;return new js(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Ms(xs.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=Rh.get(t);e&&(As("ComponentProvider","Removing Datastore"),Rh.delete(t),e.terminate())}(this),Promise.resolve()}}function Oh(t,e,n,r={}){var i;const s=(t=Ah(t,Lh))._getSettings();if("firestore.googleapis.com"!==s.host&&s.host!==e&&Ns("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},s),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=Ts.MOCK_USER;else{e=
|
|
1734
1734
|
/**
|
|
1735
1735
|
* @license
|
|
1736
1736
|
* Copyright 2021 Google LLC
|
|
@@ -1747,7 +1747,7 @@ class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1747
1747
|
* See the License for the specific language governing permissions and
|
|
1748
1748
|
* limitations under the License.
|
|
1749
1749
|
*/
|
|
1750
|
-
function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[
|
|
1750
|
+
function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[ne(JSON.stringify({alg:"none",type:"JWT"})),ne(JSON.stringify(s)),""].join(".")}
|
|
1751
1751
|
/**
|
|
1752
1752
|
* @license
|
|
1753
1753
|
* Copyright 2017 Google LLC
|
|
@@ -1763,7 +1763,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1763
1763
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1764
1764
|
* See the License for the specific language governing permissions and
|
|
1765
1765
|
* limitations under the License.
|
|
1766
|
-
*/(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new
|
|
1766
|
+
*/(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new Ms(xs.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Ts(s)}t._authCredentials=new Bs(new Fs(e,n))}}
|
|
1767
1767
|
/**
|
|
1768
1768
|
* @license
|
|
1769
1769
|
* Copyright 2020 Google LLC
|
|
@@ -1779,7 +1779,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1779
1779
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1780
1780
|
* See the License for the specific language governing permissions and
|
|
1781
1781
|
* limitations under the License.
|
|
1782
|
-
*/class
|
|
1782
|
+
*/class Dh{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new xh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Dh(this.firestore,t,this._key)}}class Ph{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Ph(this.firestore,t,this._query)}}class xh extends Ph{constructor(t,e,n){super(t,e,Ia(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Dh(this.firestore,null,new no(t))}withConverter(t){return new xh(this.firestore,t,this._path)}}function Mh(t,e,...n){if(t=ue(t),Th("collection","path",e),t instanceof Lh){const r=Zs.fromString(e,...n);return kh(r),new xh(t,null,r)}{if(!(t instanceof Dh||t instanceof xh))throw new Ms(xs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Zs.fromString(e,...n));return kh(r),new xh(t.firestore,null,r)}}function Uh(t,e,...n){if(t=ue(t),1===arguments.length&&(e=Ks.R()),Th("doc","path",e),t instanceof Lh){const r=Zs.fromString(e,...n);return Ih(r),new Dh(t,null,new no(r))}{if(!(t instanceof Dh||t instanceof xh))throw new Ms(xs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Zs.fromString(e,...n));return Ih(r),new Dh(t.firestore,t instanceof xh?t.converter:null,new no(r))}}
|
|
1783
1783
|
/**
|
|
1784
1784
|
* @license
|
|
1785
1785
|
* Copyright 2020 Google LLC
|
|
@@ -1811,7 +1811,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1811
1811
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1812
1812
|
* See the License for the specific language governing permissions and
|
|
1813
1813
|
* limitations under the License.
|
|
1814
|
-
*/class
|
|
1814
|
+
*/class Fh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next&&this.Rc(this.observer.next,t)}error(t){this.observer.error?this.Rc(this.observer.error,t):Rs("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
|
|
1815
1815
|
/**
|
|
1816
1816
|
* @license
|
|
1817
1817
|
* Copyright 2017 Google LLC
|
|
@@ -1827,7 +1827,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1827
1827
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1828
1828
|
* See the License for the specific language governing permissions and
|
|
1829
1829
|
* limitations under the License.
|
|
1830
|
-
*/class
|
|
1830
|
+
*/class zh{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=Ts.UNAUTHENTICATED,this.clientId=Ks.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{As("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(As("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Ms(xs.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Us;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Bu(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function Bh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(As("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),As("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await $l(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new _h)),t.offlineComponents}(t);As("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>Mu(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Mu(e.remoteStore,n))),t.onlineComponents=e}async function Vh(t){return t.onlineComponents||(As("FirestoreClient","Using default OnlineComponentProvider"),await Bh(t,new Eh)),t.onlineComponents}async function Hh(t){const e=await Vh(t),n=e.eventManager;return n.onListen=ih.bind(null,e.syncEngine),n.onUnlisten=sh.bind(null,e.syncEngine),n}class jh{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new su(this,"async_queue_retry"),this.Wc=()=>{const t=ru();t&&As("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=ru();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=ru();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new Us;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!uo(t))throw t;As("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
|
|
1831
1831
|
/**
|
|
1832
1832
|
* @license
|
|
1833
1833
|
* Copyright 2017 Google LLC
|
|
@@ -1843,7 +1843,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1843
1843
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1844
1844
|
* See the License for the specific language governing permissions and
|
|
1845
1845
|
* limitations under the License.
|
|
1846
|
-
*/(t);throw
|
|
1846
|
+
*/(t);throw Rs("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.Gc=!1,t))))));return this.Bc=e,e}enqueueAfterDelay(t,e,n){this.zc(),this.jc.indexOf(t)>-1&&(e=0);const r=zu.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&Os()}verifyOperationInProgress(){}async Xc(){let t;do{t=this.Bc,await t}while(t!==this.Bc)}Zc(t){for(const e of this.Uc)if(e.timerId===t)return!0;return!1}ta(t){return this.Xc().then((()=>{this.Uc.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.Uc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.Xc()}))}ea(t){this.jc.push(t)}Yc(t){const e=this.Uc.indexOf(t);this.Uc.splice(e,1)}}function $h(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of["next","error","complete"])if(t in n&&"function"==typeof n[t])return!0;return!1}
|
|
1847
1847
|
/**
|
|
1848
1848
|
* @license
|
|
1849
1849
|
* Copyright 2020 Google LLC
|
|
@@ -1859,7 +1859,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1859
1859
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1860
1860
|
* See the License for the specific language governing permissions and
|
|
1861
1861
|
* limitations under the License.
|
|
1862
|
-
*/(t)}class
|
|
1862
|
+
*/(t)}class qh extends Lh{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new jh,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Kh(this),this._firestoreClient.terminate()}}function Wh(t){return t._firestoreClient||Kh(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Kh(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new fo(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
|
|
1863
1863
|
/**
|
|
1864
1864
|
* @license
|
|
1865
1865
|
* Copyright 2020 Google LLC
|
|
@@ -1875,7 +1875,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1875
1875
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1876
1876
|
* See the License for the specific language governing permissions and
|
|
1877
1877
|
* limitations under the License.
|
|
1878
|
-
*/(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new
|
|
1878
|
+
*/(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new zh(t._authCredentials,t._appCheckCredentials,t._queue,r)}
|
|
1879
1879
|
/**
|
|
1880
1880
|
* @license
|
|
1881
1881
|
* Copyright 2020 Google LLC
|
|
@@ -1907,7 +1907,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1907
1907
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1908
1908
|
* See the License for the specific language governing permissions and
|
|
1909
1909
|
* limitations under the License.
|
|
1910
|
-
*/class
|
|
1910
|
+
*/class Gh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Gh(bo.fromBase64String(t))}catch(t){throw new Ms(xs.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Gh(bo.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
|
|
1911
1911
|
/**
|
|
1912
1912
|
* @license
|
|
1913
1913
|
* Copyright 2020 Google LLC
|
|
@@ -1923,7 +1923,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1923
1923
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1924
1924
|
* See the License for the specific language governing permissions and
|
|
1925
1925
|
* limitations under the License.
|
|
1926
|
-
*/class
|
|
1926
|
+
*/class Qh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Ms(xs.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new eo(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
|
|
1927
1927
|
/**
|
|
1928
1928
|
* @license
|
|
1929
1929
|
* Copyright 2020 Google LLC
|
|
@@ -1940,7 +1940,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1940
1940
|
* See the License for the specific language governing permissions and
|
|
1941
1941
|
* limitations under the License.
|
|
1942
1942
|
*/
|
|
1943
|
-
class
|
|
1943
|
+
class Yh{constructor(t){this._methodName=t}}
|
|
1944
1944
|
/**
|
|
1945
1945
|
* @license
|
|
1946
1946
|
* Copyright 2017 Google LLC
|
|
@@ -1956,7 +1956,7 @@ class Kh{constructor(t){this._methodName=t}}
|
|
|
1956
1956
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1957
1957
|
* See the License for the specific language governing permissions and
|
|
1958
1958
|
* limitations under the License.
|
|
1959
|
-
*/class
|
|
1959
|
+
*/class Jh{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Ms(xs.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Ms(xs.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return Gs(this._lat,t._lat)||Gs(this._long,t._long)}}
|
|
1960
1960
|
/**
|
|
1961
1961
|
* @license
|
|
1962
1962
|
* Copyright 2017 Google LLC
|
|
@@ -1972,7 +1972,7 @@ class Kh{constructor(t){this._methodName=t}}
|
|
|
1972
1972
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1973
1973
|
* See the License for the specific language governing permissions and
|
|
1974
1974
|
* limitations under the License.
|
|
1975
|
-
*/const
|
|
1975
|
+
*/const Xh=/^__.*__$/;class Zh{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new hc(t,this.data,this.fieldMask,e,this.fieldTransforms):new uc(t,this.data,e,this.fieldTransforms)}}function td(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Os()}}class ed{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===i&&this.na(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new ed(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return dd(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(td(this.sa)&&Xh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class nd{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||iu(t)}da(t,e,n,r=!1){return new ed({sa:t,methodName:e,fa:n,path:eo.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function rd(t){const e=t._freezeSettings(),n=iu(t._databaseId);return new nd(t._databaseId,!!e.ignoreUndefinedProperties,n)}function id(t,e,n,r,i,s={}){const o=t.da(s.merge||s.mergeFields?2:0,e,n,i);cd("Data must be an object, but it was:",o,r);const a=od(r,o);let c,l;if(s.merge)c=new ga(o.fieldMask),l=o.fieldTransforms;else if(s.mergeFields){const t=[];for(const r of s.mergeFields){const i=ld(e,r,n);if(!o.contains(i))throw new Ms(xs.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);fd(t,i)||t.push(i)}c=new ga(t),l=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,l=o.fieldTransforms;return new Zh(new ma(a),c,l)}function sd(t,e){if(ad(t=ue(t)))return cd("Unsupported field value:",e,t),od(t,e);if(t instanceof Yh)return function(t,e){if(!td(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const i of t){let t=sd(i,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=ue(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ha(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Ys.fromDate(t);return{timestampValue:Gc(e.yt,n)}}if(t instanceof Ys){const n=new Ys(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Gc(e.yt,n)}}if(t instanceof Jh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Gh)return{bytesValue:Qc(e.yt,t._byteString)};if(t instanceof Dh){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Xc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Ch(t)}`)}(t,e)}function od(t,e){const n={};return yo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):mo(t,((t,r)=>{const i=sd(r,e.ra(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}function ad(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ys||t instanceof Jh||t instanceof Gh||t instanceof Dh||t instanceof Yh)}function cd(t,e,n){if(!ad(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Ch(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function ld(t,e,n){if((e=ue(e))instanceof Qh)return e._internalPath;if("string"==typeof e)return hd(t,e);throw dd("Field path arguments must be of type string or ",t,!1,void 0,n)}const ud=new RegExp("[~\\*/\\[\\]]");function hd(t,e,n){if(e.search(ud)>=0)throw dd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Qh(...e.split("."))._internalPath}catch(r){throw dd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function dd(t,e,n,r,i){const s=r&&!r.isEmpty(),o=void 0!==i;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=")"),new Ms(xs.INVALID_ARGUMENT,a+t+c)}function fd(t,e){return t.some((t=>t.isEqual(e)))}
|
|
1976
1976
|
/**
|
|
1977
1977
|
* @license
|
|
1978
1978
|
* Copyright 2020 Google LLC
|
|
@@ -1988,7 +1988,7 @@ class Kh{constructor(t){this._methodName=t}}
|
|
|
1988
1988
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1989
1989
|
* See the License for the specific language governing permissions and
|
|
1990
1990
|
* limitations under the License.
|
|
1991
|
-
*/class
|
|
1991
|
+
*/class pd{constructor(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Dh(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new gd(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(md("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class gd extends pd{data(){return super.data()}}function md(t,e){return"string"==typeof e?hd(t,e):e instanceof Qh?e._internalPath:e._delegate._internalPath}
|
|
1992
1992
|
/**
|
|
1993
1993
|
* @license
|
|
1994
1994
|
* Copyright 2020 Google LLC
|
|
@@ -2004,7 +2004,7 @@ class Kh{constructor(t){this._methodName=t}}
|
|
|
2004
2004
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2005
2005
|
* See the License for the specific language governing permissions and
|
|
2006
2006
|
* limitations under the License.
|
|
2007
|
-
*/function
|
|
2007
|
+
*/function yd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Ms(xs.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class vd{}class wd extends vd{}function bd(t,e,...n){let r=[];e instanceof vd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof Ed)).length,n=t.filter((t=>t instanceof Sd)).length;if(e>1||e>0&&n>0)throw new Ms(xs.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
|
|
2008
2008
|
/**
|
|
2009
2009
|
* @license
|
|
2010
2010
|
* Copyright 2020 Google LLC
|
|
@@ -2020,7 +2020,7 @@ class Kh{constructor(t){this._methodName=t}}
|
|
|
2020
2020
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2021
2021
|
* See the License for the specific language governing permissions and
|
|
2022
2022
|
* limitations under the License.
|
|
2023
|
-
*/(r);for(const e of r)t=e._apply(t);return t}class
|
|
2023
|
+
*/(r);for(const e of r)t=e._apply(t);return t}class Sd extends wd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Sd(t,e,n)}_apply(t){const e=this._parse(t);return kd(t._query,e),new Ph(t.firestore,t.converter,Oa(t._query,e))}_parse(t){const e=rd(t.firestore),n=function(t,e,n,r,i,s,o){let a;if(i.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new Ms(xs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){Id(o,s);const e=[];for(const n of o)e.push(Td(r,t,n));a={arrayValue:{values:e}}}else a=Td(r,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||Id(o,s),a=function(t,e,n,r=!1){return sd(n,t.da(r?4:3,e))}(n,"where",o,"in"===s||"not-in"===s);return Ko.create(i,s,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function _d(t,e,n){const r=e,i=md("where",t);return Sd._create(i,r,n)}class Ed extends vd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Ed(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Go.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)kd(n,t),n=Oa(n,t)}(t._query,e),new Ph(t.firestore,t.converter,Oa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Td(t,e,n){if("string"==typeof(n=ue(n))){if(""===n)throw new Ms(xs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Ra(e)&&-1!==n.indexOf("/"))throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Zs.fromString(n));if(!no.isDocumentKey(r))throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Mo(t,new no(r))}if(n instanceof Dh)return Mo(t,n._key);throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ch(n)}.`)}function Id(t,e){if(!Array.isArray(t)||0===t.length)throw new Ms(xs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Ms(xs.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function kd(t,e){if(e.isInequality()){const n=Aa(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const i=Ca(t);null!==i&&function(t,e,n){if(!n.isEqual(e))throw new Ms(xs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,i)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Ms(xs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Ms(xs.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Cd{convertValue(t,e="none"){switch(Ro(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Eo(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(To(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Os()}}convertObject(t,e){const n={};return mo(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Jh(Eo(t.latitude),Eo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=ko(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Co(t));default:return null}}convertTimestamp(t){const e=_o(t);return new Ys(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Zs.fromString(t);Ds(yl(n));const r=new po(n.get(1),n.get(3)),i=new no(n.popFirst(5));return r.isEqual(e)||Rs(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),i}}
|
|
2024
2024
|
/**
|
|
2025
2025
|
* @license
|
|
2026
2026
|
* Copyright 2020 Google LLC
|
|
@@ -2053,7 +2053,7 @@ class Kh{constructor(t){this._methodName=t}}
|
|
|
2053
2053
|
* See the License for the specific language governing permissions and
|
|
2054
2054
|
* limitations under the License.
|
|
2055
2055
|
*/
|
|
2056
|
-
class
|
|
2056
|
+
class Ad{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Rd extends pd{constructor(t,e,n,r,i,s){super(t,e,n,r,s),this._firestore=t,this._firestoreImpl=t,this.metadata=i}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Nd(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(md("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Nd extends Rd{data(t={}){return super.data(t)}}class Ld{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Ad(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Nd(this._firestore,this._userDataWriter,n.key,n,new Ad(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Ms(xs.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Nd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Ad(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Nd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Ad(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let i=-1,s=-1;return 0!==e.type&&(i=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),s=n.indexOf(e.doc.key)),{type:Od(e.type),doc:r,oldIndex:i,newIndex:s}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Od(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Os()}}
|
|
2057
2057
|
/**
|
|
2058
2058
|
* @license
|
|
2059
2059
|
* Copyright 2020 Google LLC
|
|
@@ -2069,7 +2069,7 @@ class Id{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
|
|
|
2069
2069
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2070
2070
|
* See the License for the specific language governing permissions and
|
|
2071
2071
|
* limitations under the License.
|
|
2072
|
-
*/function
|
|
2072
|
+
*/function Dd(t){t=Ah(t,Dh);const e=Ah(t.firestore,qh);return function(t,e,n={}){const r=new Us;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Fh({next:s=>{e.enqueueAndForget((()=>Ku(t,o)));const a=s.docs.has(n);!a&&s.fromCache?i.reject(new Ms(xs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&r&&"server"===r.source?i.reject(new Ms(xs.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):i.resolve(s)},error:t=>i.reject(t)}),o=new Ju(Ia(n.path),s,{includeMetadataChanges:!0,Nu:!0});return Wu(t,o)}(await Hh(t),t.asyncQueue,e,n,r))),r.promise}(Wh(e),t._key).then((n=>Fd(e,t,n)))}class Pd extends Cd{constructor(t){super(),this.firestore=t}convertBytes(t){return new Gh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Dh(this.firestore,null,e)}}function xd(t){t=Ah(t,Ph);const e=Ah(t.firestore,qh),n=Wh(e),r=new Pd(e);return yd(t._query),function(t,e,n={}){const r=new Us;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Fh({next:n=>{e.enqueueAndForget((()=>Ku(t,o))),n.fromCache&&"server"===r.source?i.reject(new Ms(xs.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(n)},error:t=>i.reject(t)}),o=new Ju(n,s,{includeMetadataChanges:!0,Nu:!0});return Wu(t,o)}(await Hh(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Ld(e,r,t,n)))}function Md(t,e,n){t=Ah(t,Dh);const r=Ah(t.firestore,qh),i=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new Us;return t.asyncQueue.enqueueAndForget((async()=>oh(await function(t){return Vh(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(Wh(t),e)}(r,[id(rd(r),"setDoc",t._key,i,null!==t.converter,n).toMutation(t._key,nc.none())])}function Ud(t,...e){var n,r,i;t=ue(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||$h(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if($h(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(i=t.complete)||void 0===i?void 0:i.bind(t)}let c,l,u;if(t instanceof Dh)l=Ah(t.firestore,qh),u=Ia(t._key.path),c={next:n=>{e[o]&&e[o](Fd(l,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Ah(t,Ph);l=Ah(n.firestore,qh),u=n._query;const r=new Pd(l);c={next:t=>{e[o]&&e[o](new Ld(l,r,n,t))},error:e[o+1],complete:e[o+2]},yd(t._query)}return function(t,e,n,r){const i=new Fh(r),s=new Ju(e,i,n);return t.asyncQueue.enqueueAndForget((async()=>Wu(await Hh(t),s))),()=>{i.bc(),t.asyncQueue.enqueueAndForget((async()=>Ku(await Hh(t),s)))}}(Wh(l),u,a,c)}function Fd(t,e,n){const r=n.docs.get(e._key),i=new Pd(t);return new Rd(t,i,e._key,r,new Ad(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Is=Ft,Dt(new he("firestore",((t,{instanceIdentifier:n,options:r})=>{const i=t.getProvider("app").getImmediate(),s=new qh(new Vs(t.getProvider("auth-internal")),new qs(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Ms(xs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new po(t.options.projectId,e)}(i,n),i);return r=Object.assign({useFetchStreams:e},r),s._setSettings(r),s}),"PUBLIC").setMultipleInstances(!0)),Vt(Es,"3.8.0",t),Vt(Es,"3.8.0","esm2017")}();
|
|
2073
2073
|
/**
|
|
2074
2074
|
* @license
|
|
2075
2075
|
* Copyright 2020 Google LLC
|
|
@@ -2086,7 +2086,7 @@ class Id{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
|
|
|
2086
2086
|
* See the License for the specific language governing permissions and
|
|
2087
2087
|
* limitations under the License.
|
|
2088
2088
|
*/
|
|
2089
|
-
|
|
2089
|
+
Vt("firebase","10.13.0","app");class zd{constructor(){}static getInstance(){return zd.instance||(zd.instance=new zd),zd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Vd.firebase:Bd.firebase}get api(){return"prod"===this.env?Vd.api:Bd.api}get config(){return"prod"===this.env?Vd.config:Bd.config}}const Bd={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Vd={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var Hd=1e3,jd=6e4,$d=36e5,qd="millisecond",Wd="second",Kd="minute",Gd="hour",Qd="day",Yd="week",Jd="month",Xd="quarter",Zd="year",tf="date",ef="Invalid Date",nf=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rf=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,sf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},of=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},af={s:of,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+of(r,2,"0")+":"+of(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,Jd),s=n-i<0,o=e.clone().add(r+(s?-1:1),Jd);return+(-(r+(n-i)/(s?i-o:o-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Jd,y:Zd,w:Yd,d:Qd,D:tf,h:Gd,m:Kd,s:Wd,ms:qd,Q:Xd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},cf="en",lf={};lf[cf]=sf;var uf="$isDayjsObject",hf=function(t){return t instanceof gf||!(!t||!t[uf])},df=function t(e,n,r){var i;if(!e)return cf;if("string"==typeof e){var s=e.toLowerCase();lf[s]&&(i=s),n&&(lf[s]=n,i=s);var o=e.split("-");if(!i&&o.length>1)return t(o[0])}else{var a=e.name;lf[a]=e,i=a}return!r&&i&&(cf=i),i||!r&&cf},ff=function(t,e){if(hf(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new gf(n)},pf=af;pf.l=df,pf.i=hf,pf.w=function(t,e){return ff(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var gf=function(){function t(t){this.$L=df(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[uf]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(pf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(nf);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return pf},e.isValid=function(){return!(this.$d.toString()===ef)},e.isSame=function(t,e){var n=ff(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return ff(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<ff(t)},e.$g=function(t,e,n){return pf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!pf.u(e)||e,i=pf.p(t),s=function(t,e){var i=pf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(Qd)},o=function(t,e){return pf.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,l=this.$D,u="set"+(this.$u?"UTC":"");switch(i){case Zd:return r?s(1,0):s(31,11);case Jd:return r?s(1,c):s(0,c+1);case Yd:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(r?l-d:l+(6-d),c);case Qd:case tf:return o(u+"Hours",0);case Gd:return o(u+"Minutes",1);case Kd:return o(u+"Seconds",2);case Wd:return o(u+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=pf.p(t),i="set"+(this.$u?"UTC":""),s=(n={},n[Qd]=i+"Date",n[tf]=i+"Date",n[Jd]=i+"Month",n[Zd]=i+"FullYear",n[Gd]=i+"Hours",n[Kd]=i+"Minutes",n[Wd]=i+"Seconds",n[qd]=i+"Milliseconds",n)[r],o=r===Qd?this.$D+(e-this.$W):e;if(r===Jd||r===Zd){var a=this.clone().set(tf,1);a.$d[s](o),a.init(),this.$d=a.set(tf,Math.min(this.$D,a.daysInMonth())).$d}else s&&this.$d[s](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[pf.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var i=pf.p(e),s=function(e){var n=ff(r);return pf.w(n.date(n.date()+Math.round(e*t)),r)};if(i===Jd)return this.set(Jd,this.$M+t);if(i===Zd)return this.set(Zd,this.$y+t);if(i===Qd)return s(1);if(i===Yd)return s(7);var o=(n={},n[Kd]=jd,n[Gd]=$d,n[Wd]=Hd,n)[i]||1,a=this.$d.getTime()+t*o;return pf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||ef;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=pf.z(this),s=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return pf.s(s%12||12,t,"0")},f=u||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(rf,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return pf.s(e.$y,4,"0");case"M":return a+1;case"MM":return pf.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return e.$D;case"DD":return pf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,c,2);case"ddd":return h(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(s);case"HH":return pf.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(s,o,!0);case"A":return f(s,o,!1);case"m":return String(o);case"mm":return pf.s(o,2,"0");case"s":return String(e.$s);case"ss":return pf.s(e.$s,2,"0");case"SSS":return pf.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,i=this,s=pf.p(e),o=ff(t),a=(o.utcOffset()-this.utcOffset())*jd,c=this-o,l=function(){return pf.m(i,o)};switch(s){case Zd:r=l()/12;break;case Jd:r=l();break;case Xd:r=l()/3;break;case Yd:r=(c-a)/6048e5;break;case Qd:r=(c-a)/864e5;break;case Gd:r=c/$d;break;case Kd:r=c/jd;break;case Wd:r=c/Hd;break;default:r=c}return n?r:pf.a(r)},e.daysInMonth=function(){return this.endOf(Jd).$D},e.$locale=function(){return lf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=df(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return pf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),mf=gf.prototype;function yf(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function vf(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}ff.prototype=mf,[["$ms",qd],["$s",Wd],["$m",Kd],["$H",Gd],["$W",Qd],["$M",Jd],["$y",Zd],["$D",tf]].forEach((function(t){mf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),ff.extend=function(t,e){return t.$i||(t(e,gf,ff),t.$i=!0),ff},ff.locale=df,ff.isDayjs=hf,ff.unix=function(t){return ff(1e3*t)},ff.en=lf[cf],ff.Ls=lf,ff.p={},"function"==typeof SuppressedError&&SuppressedError;const wf=vf,bf=new g("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Sf="auth/user-disabled",_f=new P("@firebase/auth");function Ef(t,...e){_f.logLevel<=R.ERROR&&_f.error(`Auth (${Ft}): ${t}`,...e)}
|
|
2090
2090
|
/**
|
|
2091
2091
|
* @license
|
|
2092
2092
|
* Copyright 2020 Google LLC
|
|
@@ -2102,7 +2102,7 @@ Ft("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
|
|
|
2102
2102
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2103
2103
|
* See the License for the specific language governing permissions and
|
|
2104
2104
|
* limitations under the License.
|
|
2105
|
-
*/function
|
|
2105
|
+
*/function Tf(t,...e){throw Af(t,...e)}function If(t,...e){return Af(t,...e)}function kf(t,e,n){const r=Object.assign(Object.assign({},wf()),{[e]:n});return new g("auth","Firebase",r).create(e,{appName:t.name})}function Cf(t){return kf(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Af(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return bf.create(t,...e)}function Rf(t,e,...n){if(!t)throw Af(e,...n)}function Nf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Ef(e),new Error(e)}function Lf(t,e){t||Nf(e)}
|
|
2106
2106
|
/**
|
|
2107
2107
|
* @license
|
|
2108
2108
|
* Copyright 2020 Google LLC
|
|
@@ -2118,7 +2118,7 @@ Ft("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
|
|
|
2118
2118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2119
2119
|
* See the License for the specific language governing permissions and
|
|
2120
2120
|
* limitations under the License.
|
|
2121
|
-
*/function
|
|
2121
|
+
*/function Of(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Df(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
|
|
2122
2122
|
/**
|
|
2123
2123
|
* @license
|
|
2124
2124
|
* Copyright 2020 Google LLC
|
|
@@ -2134,7 +2134,7 @@ Ft("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
|
|
|
2134
2134
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2135
2135
|
* See the License for the specific language governing permissions and
|
|
2136
2136
|
* limitations under the License.
|
|
2137
|
-
*/function
|
|
2137
|
+
*/function Pf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Df()&&"https:"!==Df()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
|
|
2138
2138
|
/**
|
|
2139
2139
|
* @license
|
|
2140
2140
|
* Copyright 2020 Google LLC
|
|
@@ -2151,7 +2151,7 @@ Ft("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){retur
|
|
|
2151
2151
|
* See the License for the specific language governing permissions and
|
|
2152
2152
|
* limitations under the License.
|
|
2153
2153
|
*/
|
|
2154
|
-
class
|
|
2154
|
+
class xf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Lf(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(f())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Pf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
|
|
2155
2155
|
/**
|
|
2156
2156
|
* @license
|
|
2157
2157
|
* Copyright 2020 Google LLC
|
|
@@ -2167,7 +2167,7 @@ class Nf{constructor(t,e){this.shortDelay=t,this.longDelay=e,kf(e>t,"Short delay
|
|
|
2167
2167
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2168
2168
|
* See the License for the specific language governing permissions and
|
|
2169
2169
|
* limitations under the License.
|
|
2170
|
-
*/function
|
|
2170
|
+
*/function Mf(t,e){Lf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
|
|
2171
2171
|
/**
|
|
2172
2172
|
* @license
|
|
2173
2173
|
* Copyright 2020 Google LLC
|
|
@@ -2183,7 +2183,7 @@ class Nf{constructor(t,e){this.shortDelay=t,this.longDelay=e,kf(e>t,"Short delay
|
|
|
2183
2183
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2184
2184
|
* See the License for the specific language governing permissions and
|
|
2185
2185
|
* limitations under the License.
|
|
2186
|
-
*/class
|
|
2186
|
+
*/class Uf{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Nf("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Nf("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Nf("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
|
|
2187
2187
|
/**
|
|
2188
2188
|
* @license
|
|
2189
2189
|
* Copyright 2020 Google LLC
|
|
@@ -2199,7 +2199,7 @@ class Nf{constructor(t,e){this.shortDelay=t,this.longDelay=e,kf(e>t,"Short delay
|
|
|
2199
2199
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2200
2200
|
* See the License for the specific language governing permissions and
|
|
2201
2201
|
* limitations under the License.
|
|
2202
|
-
*/const
|
|
2202
|
+
*/const Ff={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},zf=new xf(3e4,6e4);
|
|
2203
2203
|
/**
|
|
2204
2204
|
* @license
|
|
2205
2205
|
* Copyright 2020 Google LLC
|
|
@@ -2215,7 +2215,7 @@ class Nf{constructor(t,e){this.shortDelay=t,this.longDelay=e,kf(e>t,"Short delay
|
|
|
2215
2215
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2216
2216
|
* See the License for the specific language governing permissions and
|
|
2217
2217
|
* limitations under the License.
|
|
2218
|
-
*/function
|
|
2218
|
+
*/function Bf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Vf(t,e,n,r,i={}){return Hf(t,i,(async()=>{let i={},s={};r&&("GET"===e?s=r:i={body:JSON.stringify(r)});const o=w(Object.assign({key:t.config.apiKey},s)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Uf.fetch()($f(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},i))}))}async function Hf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Ff),e);try{const e=new Wf(t),i=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw Kf(t,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const e=i.ok?s.errorMessage:s.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Kf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Kf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Kf(t,"user-disabled",s);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw kf(t,a,o);Tf(t,a)}}catch(e){if(e instanceof p)throw e;Tf(t,"network-request-failed",{message:String(e)})}}async function jf(t,e,n,r,i={}){const s=await Vf(t,e,n,r,i);return"mfaPendingCredential"in s&&Tf(t,"multi-factor-auth-required",{_serverResponse:s}),s}function $f(t,e,n,r){const i=`${e}${n}?${r}`;return t.config.emulator?Mf(t.config,i):`${t.config.apiScheme}://${i}`}function qf(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Wf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(If(this.auth,"network-request-failed"))),zf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Kf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=If(t,e,r);return i.customData._tokenResponse=n,i}function Gf(t){return void 0!==t&&void 0!==t.enterprise}class Qf{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return qf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Yf(t,e){return Vf(t,"POST","/v1/accounts:lookup",e)}
|
|
2219
2219
|
/**
|
|
2220
2220
|
* @license
|
|
2221
2221
|
* Copyright 2020 Google LLC
|
|
@@ -2231,7 +2231,7 @@ class Nf{constructor(t,e){this.shortDelay=t,this.longDelay=e,kf(e>t,"Short delay
|
|
|
2231
2231
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2232
2232
|
* See the License for the specific language governing permissions and
|
|
2233
2233
|
* limitations under the License.
|
|
2234
|
-
*/
|
|
2234
|
+
*/function Jf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Xf(t){return 1e3*Number(t)}function Zf(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return Ef("JWT malformed, contained fewer than 3 sections"),null;try{const t=a(n);return t?JSON.parse(t):(Ef("Failed to decode base64 JWT payload"),null)}catch(t){return Ef("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function tp(t){const e=Zf(t);return Rf(e,"internal-error"),Rf(void 0!==e.exp,"internal-error"),Rf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
|
|
2235
2235
|
/**
|
|
2236
2236
|
* @license
|
|
2237
2237
|
* Copyright 2020 Google LLC
|
|
@@ -2247,8 +2247,7 @@ class Nf{constructor(t,e){this.shortDelay=t,this.longDelay=e,kf(e>t,"Short delay
|
|
|
2247
2247
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2248
2248
|
* See the License for the specific language governing permissions and
|
|
2249
2249
|
* limitations under the License.
|
|
2250
|
-
*/
|
|
2251
|
-
function Hf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function $f(t){return 1e3*Number(t)}function jf(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return bf("JWT malformed, contained fewer than 3 sections"),null;try{const t=a(n);return t?JSON.parse(t):(bf("Failed to decode base64 JWT payload"),null)}catch(t){return bf("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}
|
|
2250
|
+
*/async function ep(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof p&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
|
|
2252
2251
|
/**
|
|
2253
2252
|
* @license
|
|
2254
2253
|
* Copyright 2020 Google LLC
|
|
@@ -2264,8 +2263,7 @@ function Hf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))retur
|
|
|
2264
2263
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2265
2264
|
* See the License for the specific language governing permissions and
|
|
2266
2265
|
* limitations under the License.
|
|
2267
|
-
*/
|
|
2268
|
-
async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof p&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
|
|
2266
|
+
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class np{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
|
|
2269
2267
|
/**
|
|
2270
2268
|
* @license
|
|
2271
2269
|
* Copyright 2020 Google LLC
|
|
@@ -2281,10 +2279,10 @@ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2281
2279
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2282
2280
|
* See the License for the specific language governing permissions and
|
|
2283
2281
|
* limitations under the License.
|
|
2284
|
-
*/
|
|
2282
|
+
*/class rp{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Jf(this.lastLoginAt),this.creationTime=Jf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
|
|
2285
2283
|
/**
|
|
2286
2284
|
* @license
|
|
2287
|
-
* Copyright
|
|
2285
|
+
* Copyright 2019 Google LLC
|
|
2288
2286
|
*
|
|
2289
2287
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2290
2288
|
* you may not use this file except in compliance with the License.
|
|
@@ -2297,10 +2295,10 @@ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2297
2295
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2298
2296
|
* See the License for the specific language governing permissions and
|
|
2299
2297
|
* limitations under the License.
|
|
2300
|
-
*/
|
|
2298
|
+
*/async function ip(t){var e;const n=t.auth,r=await t.getIdToken(),i=await ep(t,Yf(n,{idToken:r}));Rf(null==i?void 0:i.users.length,n,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const o=(null===(e=s.providerUserInfo)||void 0===e?void 0:e.length)?sp(s.providerUserInfo):[],a=function(t,e){const n=t.filter((t=>!e.some((e=>e.providerId===t.providerId))));return[...n,...e]}(t.providerData,o),c=t.isAnonymous,l=!(t.email&&s.passwordHash||(null==a?void 0:a.length)),u=!!c&&l,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new rp(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,h)}function sp(t){return t.map((t=>{var{providerId:e}=t,n=yf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}
|
|
2301
2299
|
/**
|
|
2302
2300
|
* @license
|
|
2303
|
-
* Copyright
|
|
2301
|
+
* Copyright 2020 Google LLC
|
|
2304
2302
|
*
|
|
2305
2303
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2306
2304
|
* you may not use this file except in compliance with the License.
|
|
@@ -2313,7 +2311,7 @@ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2313
2311
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2314
2312
|
* See the License for the specific language governing permissions and
|
|
2315
2313
|
* limitations under the License.
|
|
2316
|
-
*/
|
|
2314
|
+
*/
|
|
2317
2315
|
/**
|
|
2318
2316
|
* @license
|
|
2319
2317
|
* Copyright 2020 Google LLC
|
|
@@ -2330,7 +2328,7 @@ async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2330
2328
|
* See the License for the specific language governing permissions and
|
|
2331
2329
|
* limitations under the License.
|
|
2332
2330
|
*/
|
|
2333
|
-
class
|
|
2331
|
+
class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Rf(t.idToken,"internal-error"),Rf(void 0!==t.idToken,"internal-error"),Rf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):tp(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Rf(0!==t.length,"internal-error");const e=tp(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Rf(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:i}=await async function(t,e){const n=await Hf(t,{},(async()=>{const n=w({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:i}=t.config,s=$f(t,r,"/v1/token",`key=${i}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Uf.fetch()(s,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:i}=e,s=new op;return n&&(Rf("string"==typeof n,"internal-error",{appName:t}),s.refreshToken=n),r&&(Rf("string"==typeof r,"internal-error",{appName:t}),s.accessToken=r),i&&(Rf("number"==typeof i,"internal-error",{appName:t}),s.expirationTime=i),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new op,this.toJSON())}_performRefresh(){return Nf("not implemented")}}
|
|
2334
2332
|
/**
|
|
2335
2333
|
* @license
|
|
2336
2334
|
* Copyright 2020 Google LLC
|
|
@@ -2346,7 +2344,7 @@ class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2346
2344
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2347
2345
|
* See the License for the specific language governing permissions and
|
|
2348
2346
|
* limitations under the License.
|
|
2349
|
-
*/
|
|
2347
|
+
*/function ap(t,e){Rf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class cp{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,i=yf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new np(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new rp(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const e=await ep(this,this.stsTokenManager.getToken(this.auth,t));return Rf(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=T(t),r=await n.getIdToken(e),i=Zf(r);Rf(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s="object"==typeof i.firebase?i.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:Jf(Xf(i.auth_time)),issuedAtTime:Jf(Xf(i.iat)),expirationTime:Jf(Xf(i.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=T(t);await ip(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Rf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new cp(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Rf(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await ip(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(xt(this.auth.app))return Promise.reject(Cf(this.auth));const t=await this.getIdToken();return await ep(this,
|
|
2350
2348
|
/**
|
|
2351
2349
|
* @license
|
|
2352
2350
|
* Copyright 2020 Google LLC
|
|
@@ -2362,7 +2360,8 @@ class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2362
2360
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2363
2361
|
* See the License for the specific language governing permissions and
|
|
2364
2362
|
* limitations under the License.
|
|
2365
|
-
*/
|
|
2363
|
+
*/
|
|
2364
|
+
async function(t,e){return Vf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,i,s,o,a,c,l;const u=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(i=e.phoneNumber)&&void 0!==i?i:void 0,f=null!==(s=e.photoURL)&&void 0!==s?s:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(l=e.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:w,isAnonymous:b,providerData:S,stsTokenManager:_}=e;Rf(v&&_,t,"internal-error");const E=op.fromJSON(this.name,_);Rf("string"==typeof v,t,"internal-error"),ap(u,t.name),ap(h,t.name),Rf("boolean"==typeof w,t,"internal-error"),Rf("boolean"==typeof b,t,"internal-error"),ap(d,t.name),ap(f,t.name),ap(p,t.name),ap(g,t.name),ap(m,t.name),ap(y,t.name);const T=new cp({uid:v,auth:t,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return S&&Array.isArray(S)&&(T.providerData=S.map((t=>Object.assign({},t)))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(t,e,n=!1){const r=new op;r.updateFromServerResponse(e);const i=new cp({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await ip(i),i}static async _fromGetAccountInfoResponse(t,e,n){const r=e.users[0];Rf(void 0!==r.localId,"internal-error");const i=void 0!==r.providerUserInfo?sp(r.providerUserInfo):[],s=!(r.email&&r.passwordHash||(null==i?void 0:i.length)),o=new op;o.updateFromIdToken(n);const a=new cp({uid:r.localId,auth:t,stsTokenManager:o,isAnonymous:s}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:i,metadata:new rp(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||(null==i?void 0:i.length))};return Object.assign(a,c),a}}
|
|
2366
2365
|
/**
|
|
2367
2366
|
* @license
|
|
2368
2367
|
* Copyright 2020 Google LLC
|
|
@@ -2378,7 +2377,7 @@ class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2378
2377
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2379
2378
|
* See the License for the specific language governing permissions and
|
|
2380
2379
|
* limitations under the License.
|
|
2381
|
-
*/const
|
|
2380
|
+
*/const lp=new Map;function up(t){Lf(t instanceof Function,"Expected a class definition");let e=lp.get(t);return e?(Lf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,lp.set(t,e),e)}
|
|
2382
2381
|
/**
|
|
2383
2382
|
* @license
|
|
2384
2383
|
* Copyright 2019 Google LLC
|
|
@@ -2394,7 +2393,7 @@ class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2394
2393
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2395
2394
|
* See the License for the specific language governing permissions and
|
|
2396
2395
|
* limitations under the License.
|
|
2397
|
-
*/class
|
|
2396
|
+
*/class hp{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}hp.type="NONE";const dp=hp;
|
|
2398
2397
|
/**
|
|
2399
2398
|
* @license
|
|
2400
2399
|
* Copyright 2019 Google LLC
|
|
@@ -2410,7 +2409,7 @@ class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2410
2409
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2411
2410
|
* See the License for the specific language governing permissions and
|
|
2412
2411
|
* limitations under the License.
|
|
2413
|
-
*/function
|
|
2412
|
+
*/function fp(t,e,n){return`firebase:${t}:${e}:${n}`}class pp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=fp(this.userKey,r.apiKey,i),this.fullPersistenceKey=fp("persistence",r.apiKey,i),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?cp._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new pp(up(dp),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let i=r[0]||up(dp);const s=fp(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(s);if(e){const r=cp._fromJSON(t,e);n!==i&&(o=r),i=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],o&&await i._set(s,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==i)try{await t._remove(s)}catch(t){}}))),new pp(i,t,n)):new pp(i,t,n)}}
|
|
2414
2413
|
/**
|
|
2415
2414
|
* @license
|
|
2416
2415
|
* Copyright 2020 Google LLC
|
|
@@ -2426,7 +2425,7 @@ class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2426
2425
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2427
2426
|
* See the License for the specific language governing permissions and
|
|
2428
2427
|
* limitations under the License.
|
|
2429
|
-
*/function
|
|
2428
|
+
*/function gp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(wp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(mp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Sp(e))return"Blackberry";if(_p(e))return"Webos";if(yp(e))return"Safari";if((e.includes("chrome/")||vp(e))&&!e.includes("edge/"))return"Chrome";if(bp(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function mp(t=f()){return/firefox\//i.test(t)}function yp(t=f()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function vp(t=f()){return/crios\//i.test(t)}function wp(t=f()){return/iemobile/i.test(t)}function bp(t=f()){return/android/i.test(t)}function Sp(t=f()){return/blackberry/i.test(t)}function _p(t=f()){return/webos/i.test(t)}function Ep(t=f()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Tp(){return function(){const t=f();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function Ip(t=f()){return Ep(t)||bp(t)||_p(t)||Sp(t)||/windows phone/i.test(t)||wp(t)}
|
|
2430
2429
|
/**
|
|
2431
2430
|
* @license
|
|
2432
2431
|
* Copyright 2020 Google LLC
|
|
@@ -2442,8 +2441,39 @@ class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2442
2441
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2443
2442
|
* See the License for the specific language governing permissions and
|
|
2444
2443
|
* limitations under the License.
|
|
2445
|
-
*/
|
|
2446
|
-
|
|
2444
|
+
*/function kp(t,e=[]){let n;switch(t){case"Browser":n=gp(f());break;case"Worker":n=`${gp(f())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ft}/${r}`}
|
|
2445
|
+
/**
|
|
2446
|
+
* @license
|
|
2447
|
+
* Copyright 2022 Google LLC
|
|
2448
|
+
*
|
|
2449
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2450
|
+
* you may not use this file except in compliance with the License.
|
|
2451
|
+
* You may obtain a copy of the License at
|
|
2452
|
+
*
|
|
2453
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2454
|
+
*
|
|
2455
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2456
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2457
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2458
|
+
* See the License for the specific language governing permissions and
|
|
2459
|
+
* limitations under the License.
|
|
2460
|
+
*/class Cp{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
|
|
2461
|
+
/**
|
|
2462
|
+
* @license
|
|
2463
|
+
* Copyright 2023 Google LLC
|
|
2464
|
+
*
|
|
2465
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2466
|
+
* you may not use this file except in compliance with the License.
|
|
2467
|
+
* You may obtain a copy of the License at
|
|
2468
|
+
*
|
|
2469
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2470
|
+
*
|
|
2471
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2472
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2473
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2474
|
+
* See the License for the specific language governing permissions and
|
|
2475
|
+
* limitations under the License.
|
|
2476
|
+
*/class Ap{constructor(t){var e,n,r,i;const s=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=s.minPasswordLength)&&void 0!==e?e:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(i=t.forceUpgradeOnSignin)&&void 0!==i&&i,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,r,i,s,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(i=a.containsUppercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),r&&(e.meetsMaxPasswordLength=t.length<=r)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let r=0;r<t.length;r++)n=t.charAt(r),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=i))}}
|
|
2447
2477
|
/**
|
|
2448
2478
|
* @license
|
|
2449
2479
|
* Copyright 2020 Google LLC
|
|
@@ -2459,10 +2489,10 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2459
2489
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2460
2490
|
* See the License for the specific language governing permissions and
|
|
2461
2491
|
* limitations under the License.
|
|
2462
|
-
*/
|
|
2492
|
+
*/class Rp{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Lp(this),this.idTokenSubscription=new Lp(this),this.beforeStateQueue=new Cp(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=bf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=up(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await pp.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await Yf(this,{idToken:t}),n=await cp._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var e;if(xt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise((e=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(t).then(e,e)))})):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Rf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await ip(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(xt(this.app))return Promise.reject(Cf(this));const e=t?T(t):null;return e&&Rf(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Rf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return xt(this.app)?Promise.reject(Cf(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return xt(this.app)?Promise.reject(Cf(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(up(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Vf(t,"GET","/v2/passwordPolicy",Bf(t,e))}
|
|
2463
2493
|
/**
|
|
2464
2494
|
* @license
|
|
2465
|
-
* Copyright
|
|
2495
|
+
* Copyright 2023 Google LLC
|
|
2466
2496
|
*
|
|
2467
2497
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2468
2498
|
* you may not use this file except in compliance with the License.
|
|
@@ -2475,7 +2505,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2475
2505
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2476
2506
|
* See the License for the specific language governing permissions and
|
|
2477
2507
|
* limitations under the License.
|
|
2478
|
-
*/
|
|
2508
|
+
*/(this),e=new Ap(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new g("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Vf(t,"POST","/v2/accounts:revokeToken",Bf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&up(t)||this._popupRedirectResolver;Rf(e,this,"argument-error"),this.redirectPersistenceManager=await pp.create(this,[up(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const i="function"==typeof e?e:e.next.bind(e);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Rf(o,this,"internal-error"),o.then((()=>{s||i(this.currentUser)})),"function"==typeof e){const i=t.addObserver(e,n,r);return()=>{s=!0,i()}}{const n=t.addObserver(e);return()=>{s=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Rf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=kp(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){_f.logLevel<=R.WARN&&_f.warn(`Auth (${Ft}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Np(t){return T(t)}class Lp{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new _(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Rf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
|
|
2479
2509
|
/**
|
|
2480
2510
|
* @license
|
|
2481
2511
|
* Copyright 2020 Google LLC
|
|
@@ -2491,7 +2521,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2491
2521
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2492
2522
|
* See the License for the specific language governing permissions and
|
|
2493
2523
|
* limitations under the License.
|
|
2494
|
-
*/
|
|
2524
|
+
*/let Op={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Dp(t){return Op.loadJS(t)}class Pp{constructor(t){this.type="recaptcha-enterprise",this.auth=Np(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{(async function(t,e){return Vf(t,"GET","/v2/recaptchaConfig",Bf(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new Qf(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))}function r(e,n,r){const i=window.grecaptcha;Gf(i)?i.enterprise.ready((()=>{i.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,i)=>{n(this.auth).then((n=>{if(!e&&Gf(window.grecaptcha))r(n,t,i);else{if("undefined"==typeof window)return void i(new Error("RecaptchaVerifier is only supported in browser"));let e=Op.recaptchaEnterpriseScript;0!==e.length&&(e+=n),Dp(e).then((()=>{r(n,t,i)})).catch((t=>{i(t)}))}})).catch((t=>{i(t)}))}))}}async function xp(t,e,n,r=!1){const i=new Pp(t);let s;try{s=await i.verify(n)}catch(t){s=await i.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Mp(t,e,n,r){var i;if(null===(i=t._getRecaptchaConfig())||void 0===i?void 0:i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await xp(t,e,n,"getOobCode"===n);return r(t,i)}return r(t,e).catch((async i=>{if("auth/missing-recaptcha-token"===i.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const i=await xp(t,e,n,"getOobCode"===n);return r(t,i)}return Promise.reject(i)}))}
|
|
2495
2525
|
/**
|
|
2496
2526
|
* @license
|
|
2497
2527
|
* Copyright 2020 Google LLC
|
|
@@ -2507,7 +2537,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2507
2537
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2508
2538
|
* See the License for the specific language governing permissions and
|
|
2509
2539
|
* limitations under the License.
|
|
2510
|
-
*/function
|
|
2540
|
+
*/function Up(t,e,n){const r=Np(t);Rf(r._canInitEmulator,r,"emulator-config-failed"),Rf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!(null==n?void 0:n.disableWarnings),s=Fp(e),{host:o,port:a}=function(t){const e=Fp(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const t=i[1];return{host:t,port:zp(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:zp(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${s}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
|
|
2511
2541
|
/**
|
|
2512
2542
|
* @license
|
|
2513
2543
|
* Copyright 2020 Google LLC
|
|
@@ -2523,7 +2553,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2523
2553
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2524
2554
|
* See the License for the specific language governing permissions and
|
|
2525
2555
|
* limitations under the License.
|
|
2526
|
-
*/()}function
|
|
2556
|
+
*/()}function Fp(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function zp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Bp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Nf("not implemented")}_getIdTokenResponse(t){return Nf("not implemented")}_linkToIdToken(t,e){return Nf("not implemented")}_getReauthenticationResolver(t){return Nf("not implemented")}}
|
|
2527
2557
|
/**
|
|
2528
2558
|
* @license
|
|
2529
2559
|
* Copyright 2020 Google LLC
|
|
@@ -2539,7 +2569,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2539
2569
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2540
2570
|
* See the License for the specific language governing permissions and
|
|
2541
2571
|
* limitations under the License.
|
|
2542
|
-
*/
|
|
2572
|
+
*/async function Vp(t,e){return Vf(t,"POST","/v1/accounts:signUp",e)}
|
|
2543
2573
|
/**
|
|
2544
2574
|
* @license
|
|
2545
2575
|
* Copyright 2020 Google LLC
|
|
@@ -2555,8 +2585,7 @@ function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n
|
|
|
2555
2585
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2556
2586
|
* See the License for the specific language governing permissions and
|
|
2557
2587
|
* limitations under the License.
|
|
2558
|
-
*/
|
|
2559
|
-
async function Np(t,e){return Ff(t,"POST","/v1/accounts:signInWithPassword",Pf(t,e))}async function Lp(t,e){return async function(t,e){return Mf(t,"POST","/v1/accounts:sendOobCode",Pf(t,e))}(t,e)}
|
|
2588
|
+
*/async function Hp(t,e){return jf(t,"POST","/v1/accounts:signInWithPassword",Bf(t,e))}async function jp(t,e){return async function(t,e){return Vf(t,"POST","/v1/accounts:sendOobCode",Bf(t,e))}(t,e)}
|
|
2560
2589
|
/**
|
|
2561
2590
|
* @license
|
|
2562
2591
|
* Copyright 2020 Google LLC
|
|
@@ -2589,7 +2618,7 @@ async function Np(t,e){return Ff(t,"POST","/v1/accounts:signInWithPassword",Pf(t
|
|
|
2589
2618
|
* See the License for the specific language governing permissions and
|
|
2590
2619
|
* limitations under the License.
|
|
2591
2620
|
*/
|
|
2592
|
-
class
|
|
2621
|
+
class $p extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new $p(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new $p(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return Mp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Hp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{email:this._email,oobCode:this._password});default:Tf(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Mp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Vp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:Tf(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
|
|
2593
2622
|
/**
|
|
2594
2623
|
* @license
|
|
2595
2624
|
* Copyright 2020 Google LLC
|
|
@@ -2605,7 +2634,7 @@ class Op extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2605
2634
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2606
2635
|
* See the License for the specific language governing permissions and
|
|
2607
2636
|
* limitations under the License.
|
|
2608
|
-
*/async function
|
|
2637
|
+
*/async function qp(t,e){return jf(t,"POST","/v1/accounts:signInWithIdp",Bf(t,e))}
|
|
2609
2638
|
/**
|
|
2610
2639
|
* @license
|
|
2611
2640
|
* Copyright 2020 Google LLC
|
|
@@ -2621,7 +2650,7 @@ class Op extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2621
2650
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2622
2651
|
* See the License for the specific language governing permissions and
|
|
2623
2652
|
* limitations under the License.
|
|
2624
|
-
*/class
|
|
2653
|
+
*/class Wp extends Bp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Wp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):Tf("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,i=yf(e,["providerId","signInMethod"]);if(!n||!r)return null;const s=new Wp(n,r);return s.idToken=i.idToken||void 0,s.accessToken=i.accessToken||void 0,s.secret=i.secret,s.nonce=i.nonce,s.pendingToken=i.pendingToken||null,s}_getIdTokenResponse(t){return qp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,qp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,qp(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=w(e)}return t}}
|
|
2625
2654
|
/**
|
|
2626
2655
|
* @license
|
|
2627
2656
|
* Copyright 2020 Google LLC
|
|
@@ -2637,7 +2666,7 @@ class Op extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2637
2666
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2638
2667
|
* See the License for the specific language governing permissions and
|
|
2639
2668
|
* limitations under the License.
|
|
2640
|
-
*/class
|
|
2669
|
+
*/class Kp{constructor(t){var e,n,r,i,s,o;const a=b(S(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Rf(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=b(S(t)).link,n=e?b(S(e)).deep_link_id:null,r=b(S(t)).deep_link_id;return(r?b(S(r)).link:null)||r||n||e||t}(t);try{return new Kp(e)}catch(t){return null}}}
|
|
2641
2670
|
/**
|
|
2642
2671
|
* @license
|
|
2643
2672
|
* Copyright 2020 Google LLC
|
|
@@ -2653,7 +2682,7 @@ class Op extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2653
2682
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2654
2683
|
* See the License for the specific language governing permissions and
|
|
2655
2684
|
* limitations under the License.
|
|
2656
|
-
*/class
|
|
2685
|
+
*/class Gp{constructor(){this.providerId=Gp.PROVIDER_ID}static credential(t,e){return $p._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Kp.parseLink(e);return Rf(n,"argument-error"),$p._fromEmailAndCode(t,n.code,n.tenantId)}}Gp.PROVIDER_ID="password",Gp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Gp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
|
|
2657
2686
|
/**
|
|
2658
2687
|
* @license
|
|
2659
2688
|
* Copyright 2020 Google LLC
|
|
@@ -2670,7 +2699,7 @@ class Op extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2670
2699
|
* See the License for the specific language governing permissions and
|
|
2671
2700
|
* limitations under the License.
|
|
2672
2701
|
*/
|
|
2673
|
-
class
|
|
2702
|
+
class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
|
|
2674
2703
|
/**
|
|
2675
2704
|
* @license
|
|
2676
2705
|
* Copyright 2019 Google LLC
|
|
@@ -2686,7 +2715,7 @@ class Up{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2686
2715
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2687
2716
|
* See the License for the specific language governing permissions and
|
|
2688
2717
|
* limitations under the License.
|
|
2689
|
-
*/class
|
|
2718
|
+
*/class Yp extends Qp{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
|
|
2690
2719
|
/**
|
|
2691
2720
|
* @license
|
|
2692
2721
|
* Copyright 2020 Google LLC
|
|
@@ -2702,7 +2731,7 @@ class Up{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2702
2731
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2703
2732
|
* See the License for the specific language governing permissions and
|
|
2704
2733
|
* limitations under the License.
|
|
2705
|
-
*/class
|
|
2734
|
+
*/class Jp extends Yp{constructor(){super("facebook.com")}static credential(t){return Wp._fromParams({providerId:Jp.PROVIDER_ID,signInMethod:Jp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Jp.credentialFromTaggedObject(t)}static credentialFromError(t){return Jp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Jp.credential(t.oauthAccessToken)}catch(t){return null}}}Jp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Jp.PROVIDER_ID="facebook.com";
|
|
2706
2735
|
/**
|
|
2707
2736
|
* @license
|
|
2708
2737
|
* Copyright 2020 Google LLC
|
|
@@ -2719,7 +2748,7 @@ class Up{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2719
2748
|
* See the License for the specific language governing permissions and
|
|
2720
2749
|
* limitations under the License.
|
|
2721
2750
|
*/
|
|
2722
|
-
class
|
|
2751
|
+
class Xp extends Yp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Wp._fromParams({providerId:Xp.PROVIDER_ID,signInMethod:Xp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Xp.credentialFromTaggedObject(t)}static credentialFromError(t){return Xp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Xp.credential(e,n)}catch(t){return null}}}Xp.GOOGLE_SIGN_IN_METHOD="google.com",Xp.PROVIDER_ID="google.com";
|
|
2723
2752
|
/**
|
|
2724
2753
|
* @license
|
|
2725
2754
|
* Copyright 2020 Google LLC
|
|
@@ -2736,7 +2765,7 @@ class Bp extends Fp{constructor(){super("google.com"),this.addScope("profile")}s
|
|
|
2736
2765
|
* See the License for the specific language governing permissions and
|
|
2737
2766
|
* limitations under the License.
|
|
2738
2767
|
*/
|
|
2739
|
-
class
|
|
2768
|
+
class Zp extends Yp{constructor(){super("github.com")}static credential(t){return Wp._fromParams({providerId:Zp.PROVIDER_ID,signInMethod:Zp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Zp.credentialFromTaggedObject(t)}static credentialFromError(t){return Zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Zp.credential(t.oauthAccessToken)}catch(t){return null}}}Zp.GITHUB_SIGN_IN_METHOD="github.com",Zp.PROVIDER_ID="github.com";
|
|
2740
2769
|
/**
|
|
2741
2770
|
* @license
|
|
2742
2771
|
* Copyright 2020 Google LLC
|
|
@@ -2753,7 +2782,7 @@ class Vp extends Fp{constructor(){super("github.com")}static credential(t){retur
|
|
|
2753
2782
|
* See the License for the specific language governing permissions and
|
|
2754
2783
|
* limitations under the License.
|
|
2755
2784
|
*/
|
|
2756
|
-
class
|
|
2785
|
+
class tg extends Yp{constructor(){super("twitter.com")}static credential(t,e){return Wp._fromParams({providerId:tg.PROVIDER_ID,signInMethod:tg.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return tg.credentialFromTaggedObject(t)}static credentialFromError(t){return tg.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return tg.credential(e,n)}catch(t){return null}}}tg.TWITTER_SIGN_IN_METHOD="twitter.com",tg.PROVIDER_ID="twitter.com";
|
|
2757
2786
|
/**
|
|
2758
2787
|
* @license
|
|
2759
2788
|
* Copyright 2020 Google LLC
|
|
@@ -2770,7 +2799,7 @@ class Hp extends Fp{constructor(){super("twitter.com")}static credential(t,e){re
|
|
|
2770
2799
|
* See the License for the specific language governing permissions and
|
|
2771
2800
|
* limitations under the License.
|
|
2772
2801
|
*/
|
|
2773
|
-
class
|
|
2802
|
+
class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const i=await cp._fromIdTokenResponse(t,n,r),s=ng(n);return new eg({user:i,providerId:s,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=ng(n);return new eg({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function ng(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
|
|
2774
2803
|
/**
|
|
2775
2804
|
* @license
|
|
2776
2805
|
* Copyright 2020 Google LLC
|
|
@@ -2786,7 +2815,7 @@ class $p{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2786
2815
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2787
2816
|
* See the License for the specific language governing permissions and
|
|
2788
2817
|
* limitations under the License.
|
|
2789
|
-
*/class
|
|
2818
|
+
*/class rg extends p{constructor(t,e,n,r){var i;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,rg.prototype),this.customData={appName:t.name,tenantId:null!==(i=t.tenantId)&&void 0!==i?i:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new rg(t,e,n,r)}}function ig(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw rg._fromErrorAndOperation(t,n,e,r);throw n}))}
|
|
2790
2819
|
/**
|
|
2791
2820
|
* @license
|
|
2792
2821
|
* Copyright 2020 Google LLC
|
|
@@ -2803,7 +2832,7 @@ class $p{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2803
2832
|
* See the License for the specific language governing permissions and
|
|
2804
2833
|
* limitations under the License.
|
|
2805
2834
|
*/
|
|
2806
|
-
async function
|
|
2835
|
+
async function sg(t,e,n=!1){if(xt(t.app))return Promise.reject(Cf(t));const r="signIn",i=await ig(t,r,e),s=await eg._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}
|
|
2807
2836
|
/**
|
|
2808
2837
|
* @license
|
|
2809
2838
|
* Copyright 2020 Google LLC
|
|
@@ -2820,7 +2849,7 @@ async function Kp(t,e,n=!1){const r="signIn",i=await Wp(t,r,e),s=await $p._fromI
|
|
|
2820
2849
|
* See the License for the specific language governing permissions and
|
|
2821
2850
|
* limitations under the License.
|
|
2822
2851
|
*/
|
|
2823
|
-
function
|
|
2852
|
+
async function og(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ag(t,e,n){const r=Np(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&
|
|
2824
2853
|
/**
|
|
2825
2854
|
* @license
|
|
2826
2855
|
* Copyright 2020 Google LLC
|
|
@@ -2836,7 +2865,8 @@ function Gp(t,e,n){var r;Tf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
|
|
|
2836
2865
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2837
2866
|
* See the License for the specific language governing permissions and
|
|
2838
2867
|
* limitations under the License.
|
|
2839
|
-
*/
|
|
2868
|
+
*/
|
|
2869
|
+
function(t,e,n){var r;Rf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Rf(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Rf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Rf(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,i,n),await Mp(r,i,"getOobCode",jp)}async function cg(t,e,n){await async function(t,e){return Vf(t,"POST","/v1/accounts:resetPassword",Bf(t,e))}(T(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}function lg(t,e,n){return xt(t.app)?Promise.reject(Cf(t)):async function(t,e){return sg(Np(t),e)}(T(t),Gp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}const ug="__sak";
|
|
2840
2870
|
/**
|
|
2841
2871
|
* @license
|
|
2842
2872
|
* Copyright 2019 Google LLC
|
|
@@ -2852,7 +2882,7 @@ function Gp(t,e,n){var r;Tf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
|
|
|
2852
2882
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2853
2883
|
* See the License for the specific language governing permissions and
|
|
2854
2884
|
* limitations under the License.
|
|
2855
|
-
*/class
|
|
2885
|
+
*/class hg{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(ug,"1"),this.storage.removeItem(ug),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
|
|
2856
2886
|
/**
|
|
2857
2887
|
* @license
|
|
2858
2888
|
* Copyright 2020 Google LLC
|
|
@@ -2868,7 +2898,7 @@ function Gp(t,e,n){var r;Tf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
|
|
|
2868
2898
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2869
2899
|
* See the License for the specific language governing permissions and
|
|
2870
2900
|
* limitations under the License.
|
|
2871
|
-
*/class
|
|
2901
|
+
*/class dg extends hg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ip(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;e?this.detachListener():this.stopPolling();const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},i=this.storage.getItem(n);Tp()&&i!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}dg.type="LOCAL";const fg=dg;
|
|
2872
2902
|
/**
|
|
2873
2903
|
* @license
|
|
2874
2904
|
* Copyright 2020 Google LLC
|
|
@@ -2884,7 +2914,7 @@ function Gp(t,e,n){var r;Tf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
|
|
|
2884
2914
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2885
2915
|
* See the License for the specific language governing permissions and
|
|
2886
2916
|
* limitations under the License.
|
|
2887
|
-
*/class
|
|
2917
|
+
*/class pg extends hg{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}pg.type="SESSION";const gg=pg;
|
|
2888
2918
|
/**
|
|
2889
2919
|
* @license
|
|
2890
2920
|
* Copyright 2019 Google LLC
|
|
@@ -2917,7 +2947,7 @@ function Gp(t,e,n){var r;Tf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"
|
|
|
2917
2947
|
* See the License for the specific language governing permissions and
|
|
2918
2948
|
* limitations under the License.
|
|
2919
2949
|
*/
|
|
2920
|
-
class
|
|
2950
|
+
class mg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new mg(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:i}=e.data,s=this.handlersMap[r];if(!(null==s?void 0:s.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(s).map((async t=>t(e.origin,i))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
|
|
2921
2951
|
/**
|
|
2922
2952
|
* @license
|
|
2923
2953
|
* Copyright 2020 Google LLC
|
|
@@ -2934,7 +2964,7 @@ class rg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
|
|
|
2934
2964
|
* See the License for the specific language governing permissions and
|
|
2935
2965
|
* limitations under the License.
|
|
2936
2966
|
*/
|
|
2937
|
-
function
|
|
2967
|
+
function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
|
|
2938
2968
|
/**
|
|
2939
2969
|
* @license
|
|
2940
2970
|
* Copyright 2019 Google LLC
|
|
@@ -2950,7 +2980,7 @@ function ig(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2950
2980
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2951
2981
|
* See the License for the specific language governing permissions and
|
|
2952
2982
|
* limitations under the License.
|
|
2953
|
-
*/
|
|
2983
|
+
*/mg.receivers=[];class vg{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let i,s;return new Promise(((o,a)=>{const c=yg("",20);r.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(l),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),o(e.data.response);break;default:clearTimeout(l),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(s),r.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}
|
|
2954
2984
|
/**
|
|
2955
2985
|
* @license
|
|
2956
2986
|
* Copyright 2020 Google LLC
|
|
@@ -2966,7 +2996,7 @@ function ig(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2966
2996
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2967
2997
|
* See the License for the specific language governing permissions and
|
|
2968
2998
|
* limitations under the License.
|
|
2969
|
-
*/function
|
|
2999
|
+
*/function wg(){return window}
|
|
2970
3000
|
/**
|
|
2971
3001
|
* @license
|
|
2972
3002
|
* Copyright 2020 Google LLC.
|
|
@@ -2983,7 +3013,7 @@ function ig(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2983
3013
|
* See the License for the specific language governing permissions and
|
|
2984
3014
|
* limitations under the License.
|
|
2985
3015
|
*/
|
|
2986
|
-
function
|
|
3016
|
+
function bg(){return void 0!==wg().WorkerGlobalScope&&"function"==typeof wg().importScripts}
|
|
2987
3017
|
/**
|
|
2988
3018
|
* @license
|
|
2989
3019
|
* Copyright 2019 Google LLC
|
|
@@ -3000,7 +3030,7 @@ function ag(){return void 0!==og().WorkerGlobalScope&&"function"==typeof og().im
|
|
|
3000
3030
|
* See the License for the specific language governing permissions and
|
|
3001
3031
|
* limitations under the License.
|
|
3002
3032
|
*/
|
|
3003
|
-
const
|
|
3033
|
+
const Sg="firebaseLocalStorageDb",_g="firebaseLocalStorage",Eg="fbase_key";class Tg{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Ig(t,e){return t.transaction([_g],e?"readwrite":"readonly").objectStore(_g)}function kg(){const t=indexedDB.open(Sg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(_g,{keyPath:Eg})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(_g)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Sg);return new Tg(t).toPromise()}(),e(await kg()))}))}))}async function Cg(t,e,n){const r=Ig(t,!0).put({[Eg]:e,value:n});return new Tg(r).toPromise()}function Ag(t,e){const n=Ig(t,!0).delete(e);return new Tg(n).toPromise()}class Rg{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await kg()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return bg()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=mg._getInstance(bg()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new vg(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await kg();return await Cg(t,ug,"1"),await Ag(t,ug),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Cg(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=Ig(t,!1).get(e),r=await new Tg(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>Ag(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Ig(t,!1).getAll();return new Tg(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:r,value:i}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Rg.type="LOCAL";const Ng=Rg;new xf(3e4,6e4);
|
|
3004
3034
|
/**
|
|
3005
3035
|
* @license
|
|
3006
3036
|
* Copyright 2019 Google LLC
|
|
@@ -3017,7 +3047,7 @@ const cg="firebaseLocalStorageDb",lg="firebaseLocalStorage",ug="fbase_key";class
|
|
|
3017
3047
|
* See the License for the specific language governing permissions and
|
|
3018
3048
|
* limitations under the License.
|
|
3019
3049
|
*/
|
|
3020
|
-
class
|
|
3050
|
+
class Lg extends Bp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return qp(t,this._buildIdpRequest())}_linkToIdToken(t,e){return qp(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return qp(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function Og(t){return sg(t.auth,new Lg(t),t.bypassAuthState)}function Dg(t){const{auth:e,user:n}=t;return Rf(n,e,"internal-error"),
|
|
3021
3051
|
/**
|
|
3022
3052
|
* @license
|
|
3023
3053
|
* Copyright 2019 Google LLC
|
|
@@ -3034,7 +3064,7 @@ class vg extends Rp{constructor(t){super("custom","custom"),this.params=t}_getId
|
|
|
3034
3064
|
* See the License for the specific language governing permissions and
|
|
3035
3065
|
* limitations under the License.
|
|
3036
3066
|
*/
|
|
3037
|
-
async function(t,e,n=!1){const{auth:r}=t
|
|
3067
|
+
async function(t,e,n=!1){const{auth:r}=t;if(xt(r.app))return Promise.reject(Cf(r));const i="reauthenticate";try{const s=await ep(t,ig(r,i,e,t),n);Rf(s.idToken,r,"internal-error");const o=Zf(s.idToken);Rf(o,r,"internal-error");const{sub:a}=o;return Rf(t.uid===a,r,"user-mismatch"),eg._forOperation(t,i,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&Tf(r,"user-mismatch"),t}}(n,new Lg(t),t.bypassAuthState)}async function Pg(t){const{auth:e,user:n}=t;return Rf(n,e,"internal-error"),async function(t,e,n=!1){const r=await ep(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return eg._forOperation(t,"link",r)}(n,new Lg(t),t.bypassAuthState)}
|
|
3038
3068
|
/**
|
|
3039
3069
|
* @license
|
|
3040
3070
|
* Copyright 2020 Google LLC
|
|
@@ -3050,7 +3080,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf
|
|
|
3050
3080
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3051
3081
|
* See the License for the specific language governing permissions and
|
|
3052
3082
|
* limitations under the License.
|
|
3053
|
-
*/class
|
|
3083
|
+
*/class xg{constructor(t,e,n,r,i=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:i,error:s,type:o}=t;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return Og;case"linkViaPopup":case"linkViaRedirect":return Pg;case"reauthViaPopup":case"reauthViaRedirect":return Dg;default:Tf(this.auth,"internal-error")}}resolve(t){Lf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Lf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
|
|
3054
3084
|
/**
|
|
3055
3085
|
* @license
|
|
3056
3086
|
* Copyright 2020 Google LLC
|
|
@@ -3066,7 +3096,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf
|
|
|
3066
3096
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3067
3097
|
* See the License for the specific language governing permissions and
|
|
3068
3098
|
* limitations under the License.
|
|
3069
|
-
*/const
|
|
3099
|
+
*/const Mg=new xf(2e3,1e4);class Ug extends xg{constructor(t,e,n,r,i){super(t,e,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Ug.currentPopupAction&&Ug.currentPopupAction.cancel(),Ug.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Rf(t,this.auth,"internal-error"),t}async onExecution(){Lf(1===this.filter.length,"Popup operations only handle one event");const t=yg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(If(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(If(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ug.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(If(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Mg.get())};t()}}Ug.currentPopupAction=null;
|
|
3070
3100
|
/**
|
|
3071
3101
|
* @license
|
|
3072
3102
|
* Copyright 2020 Google LLC
|
|
@@ -3083,7 +3113,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf
|
|
|
3083
3113
|
* See the License for the specific language governing permissions and
|
|
3084
3114
|
* limitations under the License.
|
|
3085
3115
|
*/
|
|
3086
|
-
const
|
|
3116
|
+
const Fg="pendingRedirect",zg=new Map;class Bg extends xg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=zg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return fp(Fg,t.config.apiKey,t.name)}(e),r=function(t){return up(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}zg.set(this.auth._key(),t)}return this.bypassAuthState||zg.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Vg(t,e){zg.set(t._key(),e)}async function Hg(t,e,n=!1){if(xt(t.app))return Promise.reject(Cf(t));const r=Np(t),i=
|
|
3087
3117
|
/**
|
|
3088
3118
|
* @license
|
|
3089
3119
|
* Copyright 2021 Google LLC
|
|
@@ -3100,7 +3130,7 @@ const Ig="pendingRedirect",kg=new Map;class Cg extends Sg{constructor(t,e,n=!1){
|
|
|
3100
3130
|
* See the License for the specific language governing permissions and
|
|
3101
3131
|
* limitations under the License.
|
|
3102
3132
|
*/
|
|
3103
|
-
function(t,e){return e?
|
|
3133
|
+
function(t,e){return e?up(e):(Rf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),s=new Bg(r,i,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
|
|
3104
3134
|
/**
|
|
3105
3135
|
* @license
|
|
3106
3136
|
* Copyright 2020 Google LLC
|
|
@@ -3116,7 +3146,7 @@ function(t,e){return e?Zf(e):(Tf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3116
3146
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3117
3147
|
* See the License for the specific language governing permissions and
|
|
3118
3148
|
* limitations under the License.
|
|
3119
|
-
*/class
|
|
3149
|
+
*/class jg{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return qg(t);default:return!1}}
|
|
3120
3150
|
/**
|
|
3121
3151
|
* @license
|
|
3122
3152
|
* Copyright 2020 Google LLC
|
|
@@ -3132,7 +3162,7 @@ function(t,e){return e?Zf(e):(Tf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3132
3162
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3133
3163
|
* See the License for the specific language governing permissions and
|
|
3134
3164
|
* limitations under the License.
|
|
3135
|
-
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!
|
|
3165
|
+
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!qg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(If(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has($g(t))}saveEventToCache(t){this.cachedEventUids.add($g(t)),this.lastProcessedEventTime=Date.now()}}function $g(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function qg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
|
|
3136
3166
|
/**
|
|
3137
3167
|
* @license
|
|
3138
3168
|
* Copyright 2020 Google LLC
|
|
@@ -3149,7 +3179,7 @@ function(t,e){return e?Zf(e):(Tf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3149
3179
|
* See the License for the specific language governing permissions and
|
|
3150
3180
|
* limitations under the License.
|
|
3151
3181
|
*/
|
|
3152
|
-
const
|
|
3182
|
+
const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Kg=/^https?/;async function Gg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Vf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Qg(t))return}catch(t){}Tf(t,"unauthorized-domain")}function Qg(t){const e=Of(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const i=new URL(t);return""===i.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!Kg.test(n))return!1;if(Wg.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}
|
|
3153
3183
|
/**
|
|
3154
3184
|
* @license
|
|
3155
3185
|
* Copyright 2020 Google LLC.
|
|
@@ -3165,7 +3195,7 @@ const Dg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,xg=/^https?/;async function Pg(t
|
|
|
3165
3195
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3166
3196
|
* See the License for the specific language governing permissions and
|
|
3167
3197
|
* limitations under the License.
|
|
3168
|
-
*/const
|
|
3198
|
+
*/const Yg=new xf(3e4,6e4);function Jg(){const t=wg().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Xg(t){return new Promise(((e,n)=>{var r,i,s;function o(){Jg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Jg(),n(If(t,"network-request-failed"))},timeout:Yg.get()})}if(null===(i=null===(r=wg().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)e(gapi.iframes.getContext());else{if(!(null===(s=wg().gapi)||void 0===s?void 0:s.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return wg()[e]=()=>{gapi.load?o():n(If(t,"network-request-failed"))},Dp(`${Op.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Zg=null,t}))}let Zg=null;
|
|
3169
3199
|
/**
|
|
3170
3200
|
* @license
|
|
3171
3201
|
* Copyright 2020 Google LLC.
|
|
@@ -3182,7 +3212,7 @@ const Dg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,xg=/^https?/;async function Pg(t
|
|
|
3182
3212
|
* See the License for the specific language governing permissions and
|
|
3183
3213
|
* limitations under the License.
|
|
3184
3214
|
*/
|
|
3185
|
-
const
|
|
3215
|
+
const tm=new xf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},im=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function sm(t){const e=t.config;Rf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Mf(e,nm):`https://${t.config.authDomain}/${em}`,r={apiKey:e.apiKey,appName:t.name,v:Ft},i=im.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${w(r).slice(1)}`}async function om(t){const e=await function(t){return Zg=Zg||Xg(t),Zg}(t),n=wg().gapi;return Rf(n,t,"internal-error"),e.open({where:document.body,url:sm(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:rm,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const i=If(t,"network-request-failed"),s=wg().setTimeout((()=>{r(i)}),tm.get());function o(){wg().clearTimeout(s),n(e)}e.ping(o).then(o,(()=>{r(i)}))}))))}
|
|
3186
3216
|
/**
|
|
3187
3217
|
* @license
|
|
3188
3218
|
* Copyright 2020 Google LLC.
|
|
@@ -3198,7 +3228,7 @@ const Vg=new Nf(5e3,15e3),Hg="__/auth/iframe",$g="emulator/auth/iframe",jg={styl
|
|
|
3198
3228
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3199
3229
|
* See the License for the specific language governing permissions and
|
|
3200
3230
|
* limitations under the License.
|
|
3201
|
-
*/const
|
|
3231
|
+
*/const am={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class cm{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function lm(t,e,n,r=500,i=600){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},am),{width:r.toString(),height:i.toString(),top:s,left:o}),l=f().toLowerCase();n&&(a=vp(l)?"_blank":n),mp(l)&&(e=e||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=f()){var e;return Ep(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(l)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
|
|
3202
3232
|
/**
|
|
3203
3233
|
* @license
|
|
3204
3234
|
* Copyright 2021 Google LLC
|
|
@@ -3214,7 +3244,7 @@ const Vg=new Nf(5e3,15e3),Hg="__/auth/iframe",$g="emulator/auth/iframe",jg={styl
|
|
|
3214
3244
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3215
3245
|
* See the License for the specific language governing permissions and
|
|
3216
3246
|
* limitations under the License.
|
|
3217
|
-
*/(e||"",a),new
|
|
3247
|
+
*/(e||"",a),new cm(null);const h=window.open(e||"",a,u);Rf(h,t,"popup-blocked");try{h.focus()}catch(t){}return new cm(h)}const um="__/auth/handler",hm="emulator/auth/handler",dm=encodeURIComponent("fac");async function fm(t,e,n,r,i,s){Rf(t.config.authDomain,t,"auth-domain-config-required"),Rf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ft,eventId:i};if(e instanceof Qp){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(s||{}))o[t]=e}if(e instanceof Yp){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),l=c?`#${dm}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${um}`;return Mf(t,hm)}
|
|
3218
3248
|
/**
|
|
3219
3249
|
* @license
|
|
3220
3250
|
* Copyright 2020 Google LLC
|
|
@@ -3230,7 +3260,7 @@ const Vg=new Nf(5e3,15e3),Hg="__/auth/iframe",$g="emulator/auth/iframe",jg={styl
|
|
|
3230
3260
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3231
3261
|
* See the License for the specific language governing permissions and
|
|
3232
3262
|
* limitations under the License.
|
|
3233
|
-
*/(t)}?${w(a).slice(1)}${l}`}const
|
|
3263
|
+
*/(t)}?${w(a).slice(1)}${l}`}const pm="webStorageSupport";const gm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=gg,this._completeRedirectFn=Hg,this._overrideRedirectResult=Vg}async _openPopup(t,e,n,r){var i;Lf(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return lm(t,await fm(t,e,n,Of(),r),yg())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){wg().location.href=t}(await fm(t,e,n,Of(),r)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Lf(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await om(t),n=new jg(t);return e.register("authEvent",(e=>{Rf(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(pm,{type:pm},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[pm];void 0!==i&&e(!!i),Tf(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Gg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return Ip()||yp()||Ep()}};var mm="@firebase/auth",ym="1.7.7";
|
|
3234
3264
|
/**
|
|
3235
3265
|
* @license
|
|
3236
3266
|
* Copyright 2020 Google LLC
|
|
@@ -3247,7 +3277,7 @@ const Vg=new Nf(5e3,15e3),Hg="__/auth/iframe",$g="emulator/auth/iframe",jg={styl
|
|
|
3247
3277
|
* See the License for the specific language governing permissions and
|
|
3248
3278
|
* limitations under the License.
|
|
3249
3279
|
*/
|
|
3250
|
-
class
|
|
3280
|
+
class vm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Rf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
|
|
3251
3281
|
/**
|
|
3252
3282
|
* @license
|
|
3253
3283
|
* Copyright 2020 Google LLC
|
|
@@ -3280,4 +3310,4 @@ class sm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3280
3310
|
* See the License for the specific language governing permissions and
|
|
3281
3311
|
* limitations under the License.
|
|
3282
3312
|
*/
|
|
3283
|
-
const om=h("authIdTokenMaxAge")||300;let am=null;function cm(t=Ut()){const e=Ot(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Ot(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;_f(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:nm,persistence:[yg,tg,ng]}),r=h("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>om)return;const r=null==e?void 0:e.token;am!==r&&(am=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&kp(n,`http://${s}`),n}var lm;lm="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),i=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Tf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:lm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:gp(lm)},c=new Ep(n,r,i,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Zf);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new sm(t))(Tp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ft(rm,im,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(lm)),Ft(rm,im,"esm2017");class um extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class hm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class dm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class fm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=cm(e),this.auth.setPersistence(tg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(t){return new Promise((e=>{const n=this.auth.onAuthStateChanged((r=>{this.setUser(r),e(Boolean(r)),n(),r&&this.logUserLogin(t,r)}))}))}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,i,s,o;try{const a=xh(this.firestore,"user_logging",e.uid),c=await Nd(a),l=new Date,u=c.exists?c.data():null,h=null===(r=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(h&&uf(l).diff(uf(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(i=null==u?void 0:u.brands)||void 0===i?void 0:i[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Dd(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return(await Nd(xh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yd(Dh(this.firestore,"users"),wd(new Wh("__name__"),"==",this.id));return e=xd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Yp(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await async function(t,e,n){var r;const i=Tp(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}else n&&Gp(i,s,n),await Lp(i,s).catch((async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}}))}(this.auth,t)}async confirmPasswordReset(t,e){await Qp(this.auth,t,e)}}class pm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=xd(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Md.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Ot("object"==typeof t?t:Ut(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=re("firestore");t&&Rh(r,...t)}return r}(t),this.user=new fm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=yd(Dh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Od(yd(Dh(this.firestore,t),...e))}async getDoc(t,e){const n=xh(this.firestore,t,e),r=await Nd(n);return r.exists()?r.data():null}}const gm=t=>{if(t.code===vf)throw new Error("account has been disabled");throw new Error(t.message)};class mm{static get endpoint(){return Md.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class ym{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new hm;try{const r=await mm.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new um;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await mm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wd("brand_id","==",this.brandId)];r.push(wd("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return gm(t)}}async getColorwaySizeAssets(t,e){const n=[wd("brand_id","==",this.brandId)];t&&n.push(wd("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wd("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return gm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return gm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return gm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return gm(t)}}}var vm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(vm||(vm={}));const wm={[vm.ACROSS_BACK]:"Across back",[vm.ACROSS_FRONT]:"Across front",[vm.ACROSS_SHOULDER]:"Across shoulder",[vm.ANKLE]:"Ankle",[vm.ARMEYE]:"Armeye",[vm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[vm.BACK_CROTCH_LENGTH]:"Back crotch length",[vm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[vm.BELOW_KNEE]:"Below knee",[vm.BICEP]:"Bicep",[vm.BUST]:"Chest/Bust",[vm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[vm.CALF]:"Calf",[vm.CB_NECK_TO_WAIST]:"Cb neck to waist",[vm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[vm.CF_NECK_TO_WAIST]:"Cf neck to waist",[vm.ELBOW]:"Elbow",[vm.FOREARM]:"Forearm",[vm.FRONT_CROTCH_LENGTH]:"Front crotch length",[vm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[vm.HIGH_HIP]:"High hip",[vm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[vm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[vm.HSP_TO_BUST_POINT]:"Hsp to bust point",[vm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[vm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[vm.INSEAM]:"Inseam",[vm.KNEE]:"Knee",[vm.LOW_HIP]:"Low hip",[vm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[vm.MID_NECK]:"Mid neck",[vm.NECK_AT_BASE]:"Neck at base",[vm.SHOULDER_DROP]:"Shoulder drop",[vm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[vm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[vm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[vm.THIGH]:"Thigh",[vm.TOTAL_RISE_LENGTH]:"Total rise length",[vm.UNDER_BUST]:"Under bust",[vm.VERTICAL_TRUNK]:"Vertical trunk",[vm.WAIST]:"Waist",[vm.WRIST]:"Wrist"};var bm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(bm||(bm={}));const _m={[bm.BLOUSES]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.COATS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.DRESSES]:[vm.LOW_HIP,vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST],[bm.JACKETS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.PANTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.PUFFERS_AND_PARKAS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.SHORTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.SKIRTS]:[vm.LOW_HIP,vm.WAIST],[bm.SWEATERS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.T_SHIRTS_AND_TANKS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP]},Sm={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"},Em={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"},Tm={activewear:{leggings:bm.PANTS,joggers:bm.PANTS,sweatshirts:bm.SWEATERS},dresses:{a_line:bm.DRESSES,bodycon:bm.DRESSES,fit_and_flare:bm.DRESSES,knit:bm.DRESSES,shirt:bm.DRESSES,slip:bm.DRESSES,straight:bm.DRESSES,wrap:bm.DRESSES},jackets_and_coats:{denim_jackets:bm.JACKETS,parkas:bm.PUFFERS_AND_PARKAS,peacoats:bm.COATS,puffer_jackets:bm.PUFFERS_AND_PARKAS,raincoats:bm.COATS,rompers:bm.COATS,shackets:bm.JACKETS,trench_coats:bm.COATS},jeans:{bootcut:bm.PANTS,flared:bm.PANTS,mom:bm.PANTS,relaxed:bm.PANTS,skinny:bm.PANTS,slim:bm.PANTS,straight:bm.PANTS,tapered:bm.PANTS,wide_leg:bm.PANTS},jumpsuits_and_rompers:{boiler_suits:bm.DRESSES,denim:bm.DRESSES,jumpsuits:bm.DRESSES,overalls:bm.DRESSES,rompers:bm.DRESSES,unitards:bm.DRESSES},pants_and_shorts:{cigarette:bm.PANTS,culottes:bm.SHORTS,denim_shorts:bm.SHORTS,flared:bm.PANTS,joggers:bm.PANTS,leggings:bm.PANTS,skinny:bm.PANTS,wide_leg:bm.PANTS},skirts:{a_line_flared:bm.SKIRTS,denim:bm.SKIRTS,knit:bm.SKIRTS,pencil:bm.SKIRTS,pleated:bm.SKIRTS,skater:bm.SKIRTS,slip:bm.SKIRTS,wrap:bm.SKIRTS},suits_and_tailoring:{blazers:bm.JACKETS,suit_jackets:bm.JACKETS,suit_skirts:bm.SKIRTS,suit_trousers:bm.PANTS,suit_vests:bm.SWEATERS,trousers:bm.PANTS},sweaters:{cardigans:bm.SWEATERS,crewnecks:bm.SWEATERS,hoodies_and_zipups:bm.SWEATERS,sweatshirts:bm.SWEATERS,turtlenecks:bm.SWEATERS,v_necks:bm.SWEATERS},tops:{bodysuits:bm.BLOUSES,corsets_and_bustiers:bm.BLOUSES,polos:bm.T_SHIRTS_AND_TANKS,shirts_and_blouses:bm.BLOUSES,t_shirts:bm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:bm.T_SHIRTS_AND_TANKS}};var Im;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Im||(Im={}));const km={[Im.TOO_TIGHT]:"Too Tight",[Im.TIGHT]:"Tight",[Im.SLIGHTLY_TIGHT]:"Slightly Tight",[Im.PERFECT_FIT]:"Perfect Fit",[Im.SLIGHTLY_LOOSE]:"Slightly Loose",[Im.LOOSE]:"Loose",[Im.OVERSIZED]:"Oversized",[Im.TOO_SHORT]:"Too Short",[Im.SHORT]:"Short",[Im.SLIGHTLY_SHORT]:"Slightly Short",[Im.SLIGHTLY_LONG]:"Slightly Long",[Im.LONG]:"Long",[Im.TOO_LONG]:"Too Long"};var Cm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Cm||(Cm={}));var Am=Object.freeze({__proto__:null,get AvatarState(){return Cm},get MeasurementLocation(){return vm},MeasurementLocationName:wm,get Classification(){return bm},ClassificationLocations:_m,CategoryNames:Sm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Em,Taxonomy:Tm,get Fit(){return Im},FitNames:km}),Rm="Back to sign in",Nm="Click here to download the app",Lm="Don't have an account?",Om="Whoops! Looks like you don't have an avatar yet.",Dm="Email address",xm="Please enter a valid email address.",Pm="Enter your email address, we will send you a link to reset your password.",Mm="Forgot password?",Um="Have an account? Sign in",Fm="Your avatar is loading...",zm="Unfortunately, that size is not available for try on.",Bm="or",Vm="Password",Hm="Please enter a valid password (at least 7 characters).",$m="Return to Catalog Page",jm="Return to Product Page",qm="Return to site",Wm="Please return to The Fitting Room app to create your avatar.",Km="Scan to download the app",Gm="Send",Qm="Sign back in",Ym="Sign in",Jm="Something went wrong. Try again!",Xm="You have successfully logged out!",Zm="The Fitting Room",ty="Username or password is empty.",ey="Username or password is incorrect.",ny="End size uncertainty with",ry="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var iy=[],sy=[];function oy(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=iy.indexOf(s);-1===o&&(o=iy.push(s)-1,sy[o]={}),n=sy[o]&&sy[o][r]?sy[o][r]:sy[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}oy(".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)}",{});oy(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:0 auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;max-height:100vh;max-width:850px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:350px;max-width:350px}.tfr-logo-box{margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:200px}.tfr-space-above{margin-top:10px}.tfr-max-w-600{margin:auto;max-width:600px}#tfr-qr-border-box{align-items:center;border:2px solid var(--tfr-brand-color);border-radius:16px;display:flex;flex-direction:column;height:350px;justify-content:center;margin-left:20px;padding:0 30px;width:300px}.tfr-mobile-logo{height:60px}#email-input,#password-input{font-size:16px}",{});oy("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}",{});oy(".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)}}",{});oy("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto;margin:auto;width:100%}}@media screen and (max-width:599px){#tfr-size-recommendations{width:calc(100vw - 30px)!important}.tfr-mobile-hidden{display:none}.tfr-modal-content-container{max-height:none;max-width:100vw;min-height:100vh;min-width:100vw}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{overflow:auto}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}@media screen and (max-width:380){#tfr-size-rec-subtitle{min-width:none}}@media screen and (max-height:800px){.tfr-video-responsive{height:280px!important}}",{});oy("#tfr-size-recommendations{align-items:center;background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;flex-direction:column;font-family:var(--tfr-main-font);justify-content:center;padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations-container{align-items:center;display:none;flex-direction:column;justify-content:center;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column;font-size:13px;width:100%}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);min-width:318px;padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;padding:0 10px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);justify-content:center;min-height:40px}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;padding-left:8px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px;padding-right:8px}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex;width:150px}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}",{});oy(".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%}",{});oy(".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}",{});oy(".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}",{});oy(":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 ay=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Fm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),cy=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let r;const i=()=>{n.style.overflow="auto",r&&(r.Unhook(),c()),e.style.display="none"},s=t=>{"Escape"===t.key&&i()},o=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),i())},a=()=>{e.querySelector("#tfr-close-container").addEventListener("click",i),document.addEventListener("keydown",s),document.addEventListener("click",o)},c=()=>{var n;const r=e.querySelector("#tfr-close-container");r?r.removeEventListener("click",i):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",s),document.removeEventListener("click",o)};return{open:t=>{var i;n.style.overflow="hidden",r&&r.Unhook(),e.innerHTML=(i=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${ny}</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">${Zm}</div>\n </div>\n </div>\n ${i}\n </div>\n </div>\n </div>\n </div>\n `),a(),t.Hook(),e.style.display="block",r=t},close:i,Content:()=>r}},ly=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")},s="https://assets.dev.thefittingroom.xyz/images/";return{Hook:()=>{var t,s,o;if(e||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),e){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(s=document.getElementById("tfr-app-store"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${ry}</div>\n \n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls loop autoplay playsinline>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n\n ${e?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${Km}</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">${Um}</div>\n </div>`}\n </div>\n\n ${e?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${Nm}</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">${Um}</div>\n `:""}\n `}};class uy{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=cy(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${Xm}</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">${Qm}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${qm}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Om}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Wm}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(ay({timeoutMS:1e4}))}toScan(){this.manager.open(ly({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${Ym}</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">${Dm}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Vm}</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">${Mm}</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">${Lm}</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 ${Ym}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Pm}</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">${Dm}</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">${Rm}</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 ${Gm}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</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">${jm}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||Jm}</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">${$m}</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">${jm}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${zm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Bm} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${jm}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const hy="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class dy{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeHowItFits.style.display="block"):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.tfrSizeHowItFits.style.display="none")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeHowItFits=document.getElementById("tfr-size-how-it-fits"),this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${hy}" /> Sign up or login to view</div>`}renderGarmentLocations(t){const e=t.map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${hy}" /> Sign up or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Log out</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class fy{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Am.Fit.PERFECT_FIT,Am.Fit.SLIGHTLY_LOOSE,Am.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new dy(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Am.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(t.measurement_location)}))).sort(((t,e)=>t.sortOrder<e.sortOrder?-1:1))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var py;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(py||(py={}));class gy{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",o),this.tfrModal=new uy(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Md.getInstance().setEnv(e),new ym(t,new pm)))(Number(this.shopId),o),this.tfrSizeRec=new fy(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(ty);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(xm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(Hm);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(ey)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(Jm)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case py.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Om),this.tfrModal.onNotCreated();break;case py.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case py.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(Jm),this.tfrModal.onError(Jm)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const my=async(t,e,n,r={},i={},s="dev")=>{const o=new gy(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,my as initFittingRoom};
|
|
3313
|
+
const wm=h("authIdTokenMaxAge")||300;let bm=null;function Sm(t=Bt()){const e=Pt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Pt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;Tf(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gm,persistence:[Ng,fg,gg]}),r=h("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(r,location.origin);if(location.origin===t.origin){const e=(i=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>wm)return;const r=null==e?void 0:e.token;bm!==r&&(bm=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(t=>e(t)))}}var i;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&Up(n,`http://${s}`),n}var _m;!function(t){Op=t}({loadJS:t=>new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=If("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),_m="Browser",Dt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),i=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Rf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:_m,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:kp(_m)},c=new Rp(n,r,i,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(up);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Dt(new I("auth-internal",(t=>(t=>new vm(t))(Np(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(mm,ym,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(_m)),Vt(mm,ym,"esm2017");class Em extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Tm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Im extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class km{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Sm(e),this.auth.setPersistence(fg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&this.logUserLogin(t,e)})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,i,s,o;try{const a=Uh(this.firestore,"user_logging",e.uid),c=await Dd(a),l=new Date,u=c.exists?c.data():null,h=null===(r=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(h&&ff(l).diff(ff(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(i=null==u?void 0:u.brands)||void 0===i?void 0:i[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Md(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return(await Dd(Uh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=bd(Mh(this.firestore,"users"),_d(new Qh("__name__"),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await lg(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await ag(this.auth,t)}async confirmPasswordReset(t,e){await cg(this.auth,t,e)}}class Cm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Ud(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=zt(zd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Pt("object"==typeof t?t:Bt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=oe("firestore");t&&Oh(r,...t)}return r}(t),this.user=new km(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=bd(Mh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return xd(bd(Mh(this.firestore,t),...e))}async getDoc(t,e){const n=Uh(this.firestore,t,e),r=await Dd(n);return r.exists()?r.data():null}}const Am=t=>{if(t.code===Sf)throw new Error("account has been disabled");throw new Error(t.message)};class Rm{static get endpoint(){return zd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(s,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class Nm{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Tm;try{const r=await Rm.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new Em;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Rm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.measurement_locations.female.filter((t=>e.includes(t))):i.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[_d("brand_id","==",this.brandId)];r.push(_d("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Am(t)}}async getColorwaySizeAssets(t,e){const n=[_d("brand_id","==",this.brandId)];t&&n.push(_d("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(_d("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return Am(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Am(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Am(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Am(t)}}}var Lm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(Lm||(Lm={}));const Om={[Lm.ACROSS_BACK]:"Across back",[Lm.ACROSS_FRONT]:"Across front",[Lm.ACROSS_SHOULDER]:"Across shoulder",[Lm.ANKLE]:"Ankle",[Lm.ARMEYE]:"Armeye",[Lm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Lm.BACK_CROTCH_LENGTH]:"Back crotch length",[Lm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Lm.BELOW_KNEE]:"Below knee",[Lm.BICEP]:"Bicep",[Lm.BUST]:"Chest/Bust",[Lm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Lm.CALF]:"Calf",[Lm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Lm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Lm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Lm.ELBOW]:"Elbow",[Lm.FOREARM]:"Forearm",[Lm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Lm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Lm.HIGH_HIP]:"High hip",[Lm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Lm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Lm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Lm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Lm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Lm.INSEAM]:"Inseam",[Lm.KNEE]:"Knee",[Lm.LOW_HIP]:"Low hip",[Lm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Lm.MID_NECK]:"Mid neck",[Lm.NECK_AT_BASE]:"Neck at base",[Lm.SHOULDER_DROP]:"Shoulder drop",[Lm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Lm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Lm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Lm.THIGH]:"Thigh",[Lm.TOTAL_RISE_LENGTH]:"Total rise length",[Lm.UNDER_BUST]:"Under bust",[Lm.VERTICAL_TRUNK]:"Vertical trunk",[Lm.WAIST]:"Waist",[Lm.WRIST]:"Wrist"};var Dm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Dm||(Dm={}));const Pm={[Dm.BLOUSES]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.COATS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.DRESSES]:[Lm.LOW_HIP,Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST],[Dm.JACKETS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.PANTS]:[Lm.LOW_HIP,Lm.WAIST,Lm.THIGH,Lm.INSEAM],[Dm.PUFFERS_AND_PARKAS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.SHORTS]:[Lm.LOW_HIP,Lm.WAIST,Lm.THIGH,Lm.INSEAM],[Dm.SKIRTS]:[Lm.LOW_HIP,Lm.WAIST],[Dm.SWEATERS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Dm.T_SHIRTS_AND_TANKS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP]},xm={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},Mm={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Um={activewear:{leggings:Dm.PANTS,joggers:Dm.PANTS,sweatshirts:Dm.SWEATERS},dresses:{a_line:Dm.DRESSES,bodycon:Dm.DRESSES,fit_and_flare:Dm.DRESSES,knit:Dm.DRESSES,shirt:Dm.DRESSES,slip:Dm.DRESSES,straight:Dm.DRESSES,wrap:Dm.DRESSES},jackets_and_coats:{denim_jackets:Dm.JACKETS,parkas:Dm.PUFFERS_AND_PARKAS,peacoats:Dm.COATS,puffer_jackets:Dm.PUFFERS_AND_PARKAS,raincoats:Dm.COATS,rompers:Dm.COATS,shackets:Dm.JACKETS,trench_coats:Dm.COATS},jeans:{bootcut:Dm.PANTS,flared:Dm.PANTS,mom:Dm.PANTS,relaxed:Dm.PANTS,skinny:Dm.PANTS,slim:Dm.PANTS,straight:Dm.PANTS,tapered:Dm.PANTS,wide_leg:Dm.PANTS},jumpsuits_and_rompers:{boiler_suits:Dm.DRESSES,denim:Dm.DRESSES,jumpsuits:Dm.DRESSES,overalls:Dm.DRESSES,rompers:Dm.DRESSES,unitards:Dm.DRESSES},pants_and_shorts:{cigarette:Dm.PANTS,culottes:Dm.SHORTS,denim_shorts:Dm.SHORTS,flared:Dm.PANTS,joggers:Dm.PANTS,leggings:Dm.PANTS,skinny:Dm.PANTS,wide_leg:Dm.PANTS},skirts:{a_line_flared:Dm.SKIRTS,denim:Dm.SKIRTS,knit:Dm.SKIRTS,pencil:Dm.SKIRTS,pleated:Dm.SKIRTS,skater:Dm.SKIRTS,slip:Dm.SKIRTS,wrap:Dm.SKIRTS},suits_and_tailoring:{blazers:Dm.JACKETS,suit_jackets:Dm.JACKETS,suit_skirts:Dm.SKIRTS,suit_trousers:Dm.PANTS,suit_vests:Dm.SWEATERS,trousers:Dm.PANTS},sweaters:{cardigans:Dm.SWEATERS,crewnecks:Dm.SWEATERS,hoodies_and_zipups:Dm.SWEATERS,sweatshirts:Dm.SWEATERS,turtlenecks:Dm.SWEATERS,v_necks:Dm.SWEATERS},tops:{bodysuits:Dm.BLOUSES,corsets_and_bustiers:Dm.BLOUSES,polos:Dm.T_SHIRTS_AND_TANKS,shirts_and_blouses:Dm.BLOUSES,t_shirts:Dm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Dm.T_SHIRTS_AND_TANKS}};var Fm;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Fm||(Fm={}));const zm={[Fm.TOO_TIGHT]:"Too Tight",[Fm.TIGHT]:"Tight",[Fm.SLIGHTLY_TIGHT]:"Slightly Tight",[Fm.PERFECT_FIT]:"Perfect Fit",[Fm.SLIGHTLY_LOOSE]:"Slightly Loose",[Fm.LOOSE]:"Loose",[Fm.OVERSIZED]:"Oversized",[Fm.TOO_SHORT]:"Too Short",[Fm.SHORT]:"Short",[Fm.SLIGHTLY_SHORT]:"Slightly Short",[Fm.SLIGHTLY_LONG]:"Slightly Long",[Fm.LONG]:"Long",[Fm.TOO_LONG]:"Too Long"};var Bm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Bm||(Bm={}));var Vm=Object.freeze({__proto__:null,get AvatarState(){return Bm},get MeasurementLocation(){return Lm},MeasurementLocationName:Om,get Classification(){return Dm},ClassificationLocations:Pm,CategoryNames:xm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Mm,Taxonomy:Um,get Fit(){return Fm},FitNames:zm}),Hm="Back to sign in",jm="Click here to download the app",$m="Don't have an account?",qm="Whoops! Looks like you don't have an avatar yet.",Wm="Email address",Km="Please enter a valid email address.",Gm="Enter your email address, we will send you a link to reset your password.",Qm="Forgot password?",Ym="Have an account? Sign in",Jm="Your avatar is loading...",Xm="Unfortunately, that size is not available for try on.",Zm="or",ty="Password",ey="Please enter a valid password (at least 7 characters).",ny="Return to Catalog Page",ry="Return to Product Page",iy="Return to site",sy="Please return to The Fitting Room app to create your avatar.",oy="Scan to download the app",ay="Send",cy="Sign back in",ly="Sign in",uy="Something went wrong. Try again!",hy="You have successfully logged out!",dy="The Fitting Room",fy="Username or password is empty.",py="Username or password is incorrect.",gy="End size uncertainty with",my="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var yy=[],vy=[];function wy(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=yy.indexOf(s);-1===o&&(o=yy.push(s)-1,vy[o]={}),n=vy[o]&&vy[o][r]?vy[o][r]:vy[o][r]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}wy(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});wy(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:0 auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;max-height:100vh;max-width:850px;overflow:auto;width:100%}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:350px;max-width:350px}.tfr-logo-box{margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:200px}.tfr-space-above{margin-top:10px}.tfr-max-w-600{margin:auto;max-width:600px}#tfr-qr-border-box{align-items:center;border:2px solid var(--tfr-brand-color);border-radius:16px;display:flex;flex-direction:column;height:350px;justify-content:center;margin-left:20px;padding:0 30px;width:300px}.tfr-mobile-logo{height:60px}#email-input,#password-input{font-size:16px}",{});wy("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});wy(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});wy("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto;margin:auto;width:100%}}@media screen and (max-width:599px){#tfr-size-recommendations{width:calc(100vw - 30px)!important}.tfr-mobile-hidden{display:none}.tfr-modal-content-container{max-height:none;max-width:100vw;min-height:100vh;min-width:100vw}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{overflow:auto}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}@media screen and (max-width:380){#tfr-size-rec-subtitle{min-width:none}}@media screen and (max-height:800px){.tfr-video-responsive{height:280px!important}}",{});wy("#tfr-size-recommendations{align-items:center;background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;flex-direction:column;font-family:var(--tfr-main-font);justify-content:center;padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations-container{align-items:center;display:none;flex-direction:column;justify-content:center;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column;font-size:13px;width:100%}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);min-width:318px;padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;padding:0 10px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);justify-content:center;min-height:40px}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;padding-left:8px;text-align:right}.tfr-size-rec-table-cell-right{margin-left:16px;padding-right:8px}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex;width:150px}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}",{});wy(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px 10px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});wy(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});wy(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}.tfr-24-bold{font-size:24px;font-weight:700}",{});wy(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const by=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Jm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),Sy=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let r;const i=()=>{n.style.overflow="auto",r&&(r.Unhook(),c()),e.style.display="none"},s=t=>{"Escape"===t.key&&i()},o=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),i())},a=()=>{e.querySelector("#tfr-close-container").addEventListener("click",i),document.addEventListener("keydown",s),document.addEventListener("click",o)},c=()=>{var n;const r=e.querySelector("#tfr-close-container");r?r.removeEventListener("click",i):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",s),document.removeEventListener("click",o)};return{open:t=>{var i;n.style.overflow="hidden",r&&r.Unhook(),e.innerHTML=(i=t.Body(),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${gy}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${dy}</div>\n </div>\n </div>\n ${i}\n </div>\n </div>\n </div>\n </div>\n `),a(),t.Hook(),e.style.display="block",r=t},close:i,Content:()=>r}},_y=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")},s="https://assets.dev.thefittingroom.xyz/images/";return{Hook:()=>{var t,s,o;if(e||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),e){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(s=document.getElementById("tfr-app-store"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${my}</div>\n \n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls loop autoplay playsinline>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n\n ${e?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${oy}</div>\n \n <img src="${s}qr.png" class="tfr-qr-code" />\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Ym}</div>\n </div>`}\n </div>\n\n ${e?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${jm}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n <img class="tfr-mobile-logo" src="${s}apple.png" id="tfr-app-store" />\n <img class="tfr-mobile-logo" src="${s}google.png" id="tfr-google-play" />\n </div>\n \n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${Ym}</div>\n `:""}\n `}};class Ey{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=Sy(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${hy}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${cy}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${iy}</span>\n </div>\n `}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${qm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${sy}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(by({timeoutMS:1e4}))}toScan(){this.manager.open(_y({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${ly}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Wm}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${ty}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${Qm}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${$m}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${ly}\n </button>\n </form>\n `}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${Gm}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Wm}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Hm}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${ay}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},Body:()=>`\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n\t\t\t\t<div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${ry}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",r)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",r)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||uy}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${ry}</span>\n </div>\n `)}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${Xm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Zm} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ny}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${ry}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const Ty="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class Iy{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeHowItFits.style.display="block"):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.tfrSizeHowItFits.style.display="none")}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeHowItFits=document.getElementById("tfr-size-how-it-fits"),this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],r=n.map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${Ty}" /> Sign up or login to view</div>`}renderGarmentLocations(t){const e=t.map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n <img src="${Ty}" /> Sign up or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></div>\n </div>\n \n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Log out</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class ky{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Vm.Fit.PERFECT_FIT,Vm.Fit.SLIGHTLY_LOOSE,Vm.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Iy(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:"string"==typeof t.fit_label&&t.fit_label?t.fit_label:Vm.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(t.measurement_location)}))).sort(((t,e)=>t.sortOrder<e.sortOrder?-1:1))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var Cy;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Cy||(Cy={}));class Ay{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",o),this.tfrModal=new Ey(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),zd.getInstance().setEnv(e),new Nm(t,new Cm)))(Number(this.shopId),o),this.tfrSizeRec=new ky(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var r;if(0==t.length||0==e.length)return n(fy);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Km);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(ey);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(py)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(uy)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case Cy.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(qm),this.tfrModal.onNotCreated();break;case Cy.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Cy.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(uy),this.tfrModal.onError(uy)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),r=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const Ry=async(t,e,n,r={},i={},s="dev")=>{const o=new Ay(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,Ry as initFittingRoom};
|