@thefittingroom/sdk 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.1.0 (2024-02-16T20:34:26.286Z)
2
+ * thefittingroom v1.1.1 (2024-04-05T19:08:13.350Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
@@ -198,7 +198,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
198
198
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
199
  * See the License for the specific language governing permissions and
200
200
  * limitations under the License.
201
- */var C;!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"}(C||(C={}));const k={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},N=C.INFO,R={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const s=(new Date).toISOString(),r=R[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${s}] ${t.name}:`,...n)};class O{constructor(t){this.name=t,this._logLevel=N,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in C))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?k[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,C.DEBUG,...t),this._logHandler(this,C.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,C.VERBOSE,...t),this._logHandler(this,C.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,C.INFO,...t),this._logHandler(this,C.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,C.WARN,...t),this._logHandler(this,C.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,C.ERROR,...t),this._logHandler(this,C.ERROR,...t)}}let L,P;const M=new WeakMap,x=new WeakMap,U=new WeakMap,F=new WeakMap,V=new WeakMap;let B={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return x.get(t);if("objectStoreNames"===e)return t.objectStoreNames||U.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return q(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function j(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(P||(P=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(K(this),e),q(M.get(this))}:function(...e){return q(t.apply(K(this),e))}:function(e,...n){const s=t.call(K(this),e,...n);return U.set(s,e.sort?e.sort():[e]),q(s)}}function H(t){return"function"==typeof t?j(t):(t instanceof IDBTransaction&&function(t){if(x.has(t))return;const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)}));x.set(t,e)}(t),e=t,(L||(L=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,B):t);var e}function q(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(q(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&M.set(e,t)})).catch((()=>{})),V.set(e,t),e}(t);if(F.has(t))return F.get(t);const e=H(t);return e!==t&&(F.set(t,e),V.set(e,t)),e}const K=t=>V.get(t);const z=["get","getKey","getAll","getAllKeys","count"],W=["put","add","delete","clear"],G=new Map;function $(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(G.get(e))return G.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=W.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!z.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let o=i.store;return s&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),r&&i.done]))[0]};return G.set(e,i),i}B=(t=>({...t,get:(e,n,s)=>$(e,n)||t.get(e,n,s),has:(e,n)=>!!$(e,n)||t.has(e,n)}))(B);
201
+ */var C;!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"}(C||(C={}));const k={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},N=C.INFO,R={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const s=(new Date).toISOString(),r=R[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${s}] ${t.name}:`,...n)};class O{constructor(t){this.name=t,this._logLevel=N,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in C))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?k[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,C.DEBUG,...t),this._logHandler(this,C.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,C.VERBOSE,...t),this._logHandler(this,C.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,C.INFO,...t),this._logHandler(this,C.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,C.WARN,...t),this._logHandler(this,C.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,C.ERROR,...t),this._logHandler(this,C.ERROR,...t)}}let L,P;const M=new WeakMap,x=new WeakMap,U=new WeakMap,F=new WeakMap,V=new WeakMap;let B={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return x.get(t);if("objectStoreNames"===e)return t.objectStoreNames||U.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return q(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function j(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(P||(P=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(K(this),e),q(M.get(this))}:function(...e){return q(t.apply(K(this),e))}:function(e,...n){const s=t.call(K(this),e,...n);return U.set(s,e.sort?e.sort():[e]),q(s)}}function H(t){return"function"==typeof t?j(t):(t instanceof IDBTransaction&&function(t){if(x.has(t))return;const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("complete",r),t.removeEventListener("error",i),t.removeEventListener("abort",i)},r=()=>{e(),s()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",r),t.addEventListener("error",i),t.addEventListener("abort",i)}));x.set(t,e)}(t),e=t,(L||(L=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,B):t);var e}function q(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const s=()=>{t.removeEventListener("success",r),t.removeEventListener("error",i)},r=()=>{e(q(t.result)),s()},i=()=>{n(t.error),s()};t.addEventListener("success",r),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&M.set(e,t)})).catch((()=>{})),V.set(e,t),e}(t);if(F.has(t))return F.get(t);const e=H(t);return e!==t&&(F.set(t,e),V.set(e,t)),e}const K=t=>V.get(t);const W=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],G=new Map;function $(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(G.get(e))return G.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,r=z.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!r&&!W.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,r?"readwrite":"readonly");let o=i.store;return s&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),r&&i.done]))[0]};return G.set(e,i),i}B=(t=>({...t,get:(e,n,s)=>$(e,n)||t.get(e,n,s),has:(e,n)=>!!$(e,n)||t.has(e,n)}))(B);
202
202
  /**
203
203
  * @license
204
204
  * Copyright 2019 Google LLC
@@ -312,7 +312,7 @@ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
312
312
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313
313
  * See the License for the specific language governing permissions and
314
314
  * limitations under the License.
315
- */var Tt;Tt="",rt(new E("platform-logger",(t=>new Q(t)),"PRIVATE")),rt(new E("heartbeat",(t=>new yt(t)),"PRIVATE")),lt(J,Y,Tt),lt(J,Y,"esm2017"),lt("fire-js","");var It=function(t,e){return It=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])},It(t,e)};function Et(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],s=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function St(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var s,r,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o}var bt,At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ct=Ct||{},kt=At||self;function Nt(){}function Rt(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 Dt(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ot="closure_uid_"+(1e9*Math.random()>>>0),Lt=0;function Pt(t,e,n){return t.call.apply(t.bind,arguments)}function Mt(t,e,n){if(!t)throw Error();if(2<arguments.length){var s=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,s),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function xt(t,e,n){return(xt=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Pt:Mt).apply(null,arguments)}function Ut(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 Ft(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,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}function Vt(){this.s=this.s,this.o=this.o}Vt.prototype.s=!1,Vt.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ot)&&t[Ot]||(t[Ot]=++Lt))},Vt.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Bt=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 jt(t){var e=t.length;if(0<e){for(var n=Array(e),s=0;s<e;s++)n[s]=t[s];return n}return[]}function Ht(t,e){for(var n=1;n<arguments.length;n++){var s=arguments[n];if(Rt(s)){var r=t.length||0,i=s.length||0;t.length=r+i;for(var o=0;o<i;o++)t[r+o]=s[o]}else t.push(s)}}function qt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}qt.prototype.h=function(){this.defaultPrevented=!0};var Kt=function(){if(!kt.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{kt.addEventListener("test",Nt,e),kt.removeEventListener("test",Nt,e)}catch(t){}return t}();function zt(t){return/^[\s\xa0]*$/.test(t)}var Wt=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Gt(t,e){return t<e?-1:t>e?1:0}function $t(){var t=kt.navigator;return t&&(t=t.userAgent)?t:""}function Qt(t){return-1!=$t().indexOf(t)}function Jt(t){return Jt[" "](t),t}Jt[" "]=Nt;var Yt,Xt,Zt=Qt("Opera"),te=Qt("Trident")||Qt("MSIE"),ee=Qt("Edge"),ne=ee||te,se=Qt("Gecko")&&!(-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),re=-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge");function ie(){var t=kt.document;return t?t.documentMode:void 0}t:{var oe="",ae=(Xt=$t(),se?/rv:([^\);]+)(\)|;)/.exec(Xt):ee?/Edge\/([\d\.]+)/.exec(Xt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Xt):re?/WebKit\/(\S+)/.exec(Xt):Zt?/(?:Version)[ \/]?(\S+)/.exec(Xt):void 0);if(ae&&(oe=ae?ae[1]:""),te){var ce=ie();if(null!=ce&&ce>parseFloat(oe)){Yt=String(ce);break t}}Yt=oe}var ue,he={};function le(){return function(t){var e=he;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Wt(String(Yt)).split("."),n=Wt("9").split("."),s=Math.max(e.length,n.length),r=0;0==t&&r<s;r++){var i=e[r]||"",o=n[r]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=Gt(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Gt(0==i[2].length,0==o[2].length)||Gt(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(kt.document&&te){var de=ie();ue=de||(parseInt(Yt,10)||void 0)}else ue=void 0;var fe=ue;function pe(t,e){if(qt.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,s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(se){t:{try{Jt(e.nodeName);var r=!0;break t}catch(t){}r=!1}r||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.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:ge[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&pe.X.h.call(this)}}Ft(pe,qt);var ge={2:"touch",3:"pen",4:"mouse"};pe.prototype.h=function(){pe.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var me="closure_listenable_"+(1e6*Math.random()|0),ye=0;function ve(t,e,n,s,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!s,this.ha=r,this.key=++ye,this.ba=this.ea=!1}function we(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function _e(t,e,n){for(var s in t)e.call(n,t[s],s,t)}function Te(t){var e={};for(var n in t)e[n]=t[n];return e}var Ie="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ee(t,e){for(var n,s,r=1;r<arguments.length;r++){for(n in s=arguments[r])t[n]=s[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}}function Se(t){this.src=t,this.g={},this.h=0}function be(t,e){var n=e.type;if(n in t.g){var s,r=t.g[n],i=Bt(r,e);(s=0<=i)&&Array.prototype.splice.call(r,i,1),s&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,s){for(var r=0;r<t.length;++r){var i=t[r];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==s)return r}return-1}Se.prototype.add=function(t,e,n,s,r){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,s,r);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!s,r)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,s,r){if(s&&s.once)return De(t,e,n,s,r);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,s,r);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Dt(s)?!!s.capture:!!s,r):Re(t,e,n,!1,s,r)}function Re(t,e,n,s,r,i){if(!e)throw Error("Invalid event type");var o=Dt(r)?!!r.capture:!!r,a=xe(t);if(a||(t[Ce]=a=new Se(t)),(n=a.add(e,n,s,o,i)).proxy)return n;if(s=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=s,s.src=t,s.listener=n,t.addEventListener)Kt||(r=o),void 0===r&&(r=!1),t.addEventListener(e.toString(),s,r);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),s);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(s)}return n}function De(t,e,n,s,r){if(Array.isArray(e)){for(var i=0;i<e.length;i++)De(t,e[i],n,s,r);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Dt(s)?!!s.capture:!!s,r):Re(t,e,n,!0,s,r)}function Oe(t,e,n,s,r){if(Array.isArray(e))for(var i=0;i<e.length;i++)Oe(t,e[i],n,s,r);else s=Dt(s)?!!s.capture:!!s,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,s,r))&&(we(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=xe(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Ae(e,n,s,r)),(n=-1<t?e[t]:null)&&Le(n))}function Le(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[me])be(e.i,t);else{var n=t.type,s=t.proxy;e.removeEventListener?e.removeEventListener(n,s,t.capture):e.detachEvent?e.detachEvent(Pe(n),s):e.addListener&&e.removeListener&&e.removeListener(s),(n=xe(e))?(be(n,t),0==n.h&&(n.src=null,e[Ce]=null)):we(t)}}}function Pe(t){return t in ke?ke[t]:ke[t]="on"+t}function Me(t,e){if(t.ba)t=!0;else{e=new pe(e,this);var n=t.listener,s=t.ha||t.src;t.ea&&Le(t),t=n.call(s,e)}return t}function xe(t){return(t=t[Ce])instanceof Se?t:null}var Ue="__closure_events_fn_"+(1e9*Math.random()>>>0);function Fe(t){return"function"==typeof t?t:(t[Ue]||(t[Ue]=function(e){return t.handleEvent(e)}),t[Ue])}function Ve(){Vt.call(this),this.i=new Se(this),this.P=this,this.I=null}function Be(t,e){var n,s=t.I;if(s)for(n=[];s;s=s.I)n.push(s);if(t=t.P,s=e.type||e,"string"==typeof e)e=new qt(e,t);else if(e instanceof qt)e.target=e.target||t;else{var r=e;Ee(e=new qt(s,t),r)}if(r=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];r=je(o,s,!0,e)&&r}if(r=je(o=e.g=t,s,!0,e)&&r,r=je(o,s,!1,e)&&r,n)for(i=0;i<n.length;i++)r=je(o=e.g=n[i],s,!1,e)&&r}function je(t,e,n,s){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var r=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&be(t.i,o),r=!1!==a.call(c,s)&&r}}return r&&!s.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,s){Oe(this,t,e,n,s)},Ve.prototype.M=function(){if(Ve.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],s=0;s<n.length;s++)we(n[s]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,s){return this.i.add(String(t),e,!1,n,s)},Ve.prototype.O=function(t,e,n,s){return this.i.add(String(t),e,!0,n,s)};var He=kt.JSON.stringify;function qe(){var t=Ye,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Ke,ze=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=We.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),We=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 Ge}),(function(t){return t.reset()})),Ge=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 $e(t){kt.setTimeout((function(){throw t}),0)}function Qe(t,e){Ke||function(){var t=kt.Promise.resolve(void 0);Ke=function(){t.then(Xe)}}(),Je||(Ke(),Je=!0),Ye.add(t,e)}var Je=!1,Ye=new ze;function Xe(){for(var t;t=qe();){try{t.h.call(t.g)}catch(t){$e(t)}var e=We;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Je=!1}function Ze(t,e){Ve.call(this),this.h=t||1,this.g=e||kt,this.j=xt(this.lb,this),this.l=Date.now()}function tn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function en(t,e,n){if("function"==typeof t)n&&(t=xt(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=xt(t.handleEvent,t)}return 2147483647<Number(e)?-1:kt.setTimeout(t,e||0)}function nn(t){t.g=en((function(){t.g=null,t.i&&(t.i=!1,nn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ft(Ze,Ve),(bt=Ze.prototype).ca=!1,bt.R=null,bt.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),Be(this,"tick"),this.ca&&(tn(this),this.start()))}},bt.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},bt.M=function(){Ze.X.M.call(this),tn(this),delete this.g};var sn=function(t){function e(e,n){var s=t.call(this)||this;return s.m=e,s.j=n,s.h=null,s.i=!1,s.g=null,s}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}It(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:nn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(kt.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Vt);function rn(t){Vt.call(this),this.h=t,this.g={}}Ft(rn,Vt);var on=[];function an(t,e,n,s){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var r=0;r<n.length;r++){var i=Ne(e,n[r],s||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function cn(t){_e(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Le(t)}),t),t.g={}}function un(){this.g=!0}function hn(t,e,n,s){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 s=n[t];if(!(2>s.length)){var r=s[1];if(Array.isArray(r)&&!(1>r.length)){var i=r[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<r.length;o++)r[o]=""}}}return He(n)}catch(t){return e}}(t,n)+(s?" "+s:"")}))}rn.prototype.M=function(){rn.X.M.call(this),cn(this)},rn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},un.prototype.Aa=function(){this.g=!1},un.prototype.info=function(){};var ln={},dn=null;function fn(){return dn=dn||new Ve}function pn(t){qt.call(this,ln.Pa,t)}function gn(t){var e=fn();Be(e,new pn(e))}function mn(t,e){qt.call(this,ln.STAT_EVENT,t),this.stat=e}function yn(t){var e=fn();Be(e,new mn(e,t))}function vn(t,e){qt.call(this,ln.Qa,t),this.size=e}function wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return kt.setTimeout((function(){t()}),e)}ln.Pa="serverreachability",Ft(pn,qt),ln.STAT_EVENT="statevent",Ft(mn,qt),ln.Qa="timingevent",Ft(vn,qt);var _n={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Tn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function In(){}function En(t){return t.h||(t.h=t.i())}function Sn(){}In.prototype.h=null;var bn,An={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Cn(){qt.call(this,"d")}function kn(){qt.call(this,"c")}function Nn(){}function Rn(t,e,n,s){this.l=t,this.j=e,this.m=n,this.U=s||1,this.S=new rn(this),this.O=On,t=ne?125:void 0,this.T=new Ze(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 Dn}function Dn(){this.i=null,this.g="",this.h=!1}Ft(Cn,qt),Ft(kn,qt),Ft(Nn,In),Nn.prototype.g=function(){return new XMLHttpRequest},Nn.prototype.i=function(){return{}},bn=new Nn;var On=45e3,Ln={},Pn={};function Mn(t,e,n){t.K=1,t.v=ts(Qn(e)),t.s=n,t.P=!0,xn(t,null)}function xn(t,e){t.F=Date.now(),Bn(t),t.A=Qn(t.v);var n=t.A,s=t.U;Array.isArray(s)||(s=[String(s)]),fs(n.i,"t",s),t.C=0,n=t.l.H,t.h=new Dn,t.g=fr(t.l,n?e:null,!t.s),0<t.N&&(t.L=new sn(xt(t.La,t,t.g),t.N)),an(t.S,t.g,"readystatechange",t.ib),e=t.H?Te(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)),gn(),function(t,e,n,s,r,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+s+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Un(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Fn(t,e,n){for(var s,r=!0;!t.I&&t.C<n.length;){if((s=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),r=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(s==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}hn(t.j,t.m,s,null),zn(t,s)}Un(t)&&s!=Pn&&s!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),r=!1),t.i=t.i&&r,r?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),ir(e),e.K=!0,yn(11))):(hn(t.j,t.m,n,"[Invalid Chunked Response]"),Kn(t),qn(t))}function Vn(t,e){var n=t.C,s=e.indexOf("\n",n);return-1==s?Pn:(n=Number(e.substring(n,s)),isNaN(n)?Ln:(s+=1)+n>e.length?Pn:(e=e.substr(s,n),t.C=s+n,e))}function Bn(t){t.V=Date.now()+t.O,jn(t,t.O)}function jn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=wn(xt(t.gb,t),e)}function Hn(t){t.B&&(kt.clearTimeout(t.B),t.B=null)}function qn(t){0==t.l.G||t.I||cr(t.l,t)}function Kn(t){Hn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,tn(t.T),cn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function zn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||_s(n.h,t)))if(!t.J&&_s(n.h,t)&&3==n.G){try{var s=n.Fa.g.parse(e)}catch(i){s=null}if(Array.isArray(s)&&3==s.length){var r=s;if(0==r[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ar(n),Ys(n)}rr(n),yn(18)}}else n.Ba=r[1],0<n.Ba-n.T&&37500>r[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=ws(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hr(n,11)}else if((t.J||n.g==t)&&ar(n),!zt(e))for(r=n.Fa.g.parse(e),e=0;e<r.length;e++){var i=r[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(s=1.5*c,n.J=s,n.j.info("backChannelRequestTimeoutMs_="+s)),s=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=s.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(Ts(l,l.h),l.h=null))}if(s.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(s.za=d,Zn(s.F,s.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((s=n).sa=dr(s,s.H?s.ka:null,s.V),f.J){Is(s.h,f);var p=f,g=s.J;g&&p.setTimeout(g),p.B&&(Hn(p),Bn(p)),s.g=f}else sr(s);0<n.i.length&&Zs(n)}else"stop"!=i[0]&&"close"!=i[0]||hr(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hr(n,7):Js(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}gn()}catch(i){}}function Wn(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Rt(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(Rt(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var s in e=[],n=0,t)e[n++]=s;return e}}}(t),s=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(Rt(t)){for(var e=[],n=t.length,s=0;s<n;s++)e.push(t[s]);return e}for(s in e=[],n=0,t)e[n++]=t[s];return e}(t),r=s.length,i=0;i<r;i++)e.call(void 0,s[i],n&&n[i],t)}(bt=Rn.prototype).setTimeout=function(t){this.O=t},bt.ib=function(t){t=t.target;var e=this.L;e&&3==Ks(t)?e.l():this.La(t)},bt.La=function(t){try{if(t==this.g)t:{var e=Ks(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||zs(this.g)))){this.I||4!=e||7==n||gn(),Hn(this);var s=this.g.aa();this.Y=s;e:if(Un(this)){var r=zs(this.g);t="";var i=r.length,o=4==Ks(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Kn(this),qn(this);var a="";break e}this.h.i=new kt.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(r[n],{stream:o&&n==i-1});r.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==s,function(t,e,n,s,r,i,o){t.info((function(){return"XMLHTTP RESP ("+s+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,s),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!zt(c)){var h=c;break e}}h=null}if(!(s=h)){this.i=!1,this.o=3,yn(12),Kn(this),qn(this);break t}hn(this.j,this.m,s,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,zn(this,s)}this.P?(Fn(this,e,a),ne&&this.i&&3==e&&(an(this.S,this.T,"tick",this.hb),this.T.start())):(hn(this.j,this.m,a,null),zn(this,a)),4==e&&Kn(this),this.i&&!this.I&&(4==e?cr(this.l,this):(this.i=!1,Bn(this)))}else 400==s&&0<a.indexOf("Unknown SID")?(this.o=3,yn(12)):(this.o=0,yn(13)),Kn(this),qn(this)}}}catch(e){}},bt.hb=function(){if(this.g){var t=Ks(this.g),e=this.g.fa();this.C<e.length&&(Hn(this),Fn(this,t,e),this.i&&4!=t&&Bn(this))}},bt.cancel=function(){this.I=!0,Kn(this)},bt.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&&(gn(),yn(17)),Kn(this),this.o=2,qn(this)):jn(this,this.V-t)};var Gn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function $n(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof $n){this.h=void 0!==e?e:t.h,Jn(this,t.j),this.s=t.s,this.g=t.g,Yn(this,t.m),this.l=t.l,e=t.i;var n=new us;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Xn(this,n),this.o=t.o}else t&&(n=String(t).match(Gn))?(this.h=!!e,Jn(this,n[1]||"",!0),this.s=es(n[2]||""),this.g=es(n[3]||"",!0),Yn(this,n[4]),this.l=es(n[5]||"",!0),Xn(this,n[6]||"",!0),this.o=es(n[7]||"")):(this.h=!!e,this.i=new us(null,this.h))}function Qn(t){return new $n(t)}function Jn(t,e,n){t.j=n?es(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Yn(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 Xn(t,e,n){e instanceof us?(t.i=e,function(t,e){e&&!t.j&&(hs(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ls(this,e),fs(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=ns(e,as)),t.i=new us(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function ts(t){return Zn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function es(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ns(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,ss),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function ss(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}$n.prototype.toString=function(){var t=[],e=this.j;e&&t.push(ns(e,rs,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(ns(e,rs,!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(ns(n,"/"==n.charAt(0)?os:is,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",ns(n,cs)),t.join("")};var rs=/[#\/\?@]/g,is=/[#\?:]/g,os=/[#\?]/g,as=/[#\?@]/g,cs=/#/g;function us(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hs(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 s=t[n].indexOf("="),r=null;if(0<=s){var i=t[n].substring(0,s);r=t[n].substring(s+1)}else i=t[n];e(i,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function ls(t,e){hs(t),e=ps(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ds(t,e){return hs(t),e=ps(t,e),t.g.has(e)}function fs(t,e,n){ls(t,e),0<n.length&&(t.i=null,t.g.set(ps(t,e),jt(n)),t.h+=n.length)}function ps(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(bt=us.prototype).add=function(t,e){hs(this),this.i=null,t=ps(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},bt.forEach=function(t,e){hs(this),this.g.forEach((function(n,s){n.forEach((function(n){t.call(e,n,s,this)}),this)}),this)},bt.oa=function(){hs(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],s=0;s<e.length;s++)for(var r=t[s],i=0;i<r.length;i++)n.push(e[s]);return n},bt.W=function(t){hs(this);var e=[];if("string"==typeof t)ds(this,t)&&(e=e.concat(this.g.get(ps(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},bt.set=function(t,e){return hs(this),this.i=null,ds(this,t=ps(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},bt.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},bt.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 s=e[n],r=encodeURIComponent(String(s)),i=this.W(s);for(s=0;s<i.length;s++){var o=r;""!==i[s]&&(o+="="+encodeURIComponent(String(i[s]))),t.push(o)}}return this.i=t.join("&")};var gs=function(t,e){this.h=t,this.g=e};function ms(t){this.l=t||ys,kt.PerformanceNavigationTiming?t=0<(t=kt.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(kt.g&&kt.g.Ga&&kt.g.Ga()&&kt.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 ys=10;function vs(t){return!!t.h||!!t.g&&t.g.size>=t.j}function ws(t){return t.h?1:t.g?t.g.size:0}function _s(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Ts(t,e){t.g?t.g.add(e):t.h=e}function Is(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Es(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var s=t.i;try{for(var r=Et(t.g.values()),i=r.next();!i.done;i=r.next()){var o=i.value;s=s.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return s}return jt(t.i)}function Ss(){}function bs(){this.g=new Ss}function As(t,e,n){var s=n||"";try{Wn(t,(function(t,n){var r=t;Dt(t)&&(r=He(t)),e.push(s+n+"="+encodeURIComponent(r))}))}catch(t){throw e.push(s+"type="+encodeURIComponent("_badmap")),t}}function Cs(t,e,n,s,r){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,r(s)}catch(t){}}function ks(t){this.l=t.ac||null,this.j=t.jb||!1}function Ns(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Rs,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}ms.prototype.cancel=function(){var t,e;if(this.i=Es(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Et(this.g.values()),s=n.next();!s.done;s=n.next()){s.value.cancel()}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Ss.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Ss.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(ks,In),ks.prototype.g=function(){return new Ns(this.l,this.j)},ks.prototype.i=function(t){return function(){return t}}({}),Ft(Ns,Ve);var Rs=0;function Ds(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Os(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ls(t)}function Ls(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(bt=Ns.prototype).open=function(t,e){if(this.readyState!=Rs)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ls(this)},bt.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||kt).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},bt.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,Os(this)),this.readyState=Rs},bt.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,Ls(this)),this.g&&(this.readyState=3,Ls(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==kt.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;Ds(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},bt.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?Os(this):Ls(this),3==this.readyState&&Ds(this)}},bt.Va=function(t){this.g&&(this.response=this.responseText=t,Os(this))},bt.Ua=function(t){this.g&&(this.response=t,Os(this))},bt.ga=function(){this.g&&Os(this)},bt.setRequestHeader=function(t,e){this.v.append(t,e)},bt.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},bt.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(Ns.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Ps=kt.JSON.parse;function Ms(t){Ve.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=xs,this.K=this.L=!1}Ft(Ms,Ve);var xs="",Us=/^https?$/i,Fs=["POST","PUT"];function Vs(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Bs(t),Hs(t)}function Bs(t){t.D||(t.D=!0,Be(t,"complete"),Be(t,"error"))}function js(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=Ks(t)||2!=t.aa()))if(t.v&&4==Ks(t))en(t.Ha,0,t);else if(Be(t,"readystatechange"),4==Ks(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 s=!0;break t;default:s=!1}if(!(e=s)){var r;if(r=0===n){var i=String(t.H).match(Gn)[1]||null;if(!i&&kt.self&&kt.self.location){var o=kt.self.location.protocol;i=o.substr(0,o.length-1)}r=!Us.test(i?i.toLowerCase():"")}e=r}if(e)Be(t,"complete"),Be(t,"success");else{t.m=6;try{var a=2<Ks(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Bs(t)}}finally{Hs(t)}}}function Hs(t,e){if(t.g){qs(t);var n=t.g,s=t.C[0]?Nt:null;t.g=null,t.C=null,e||Be(t,"ready");try{n.onreadystatechange=s}catch(t){}}}function qs(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function Ks(t){return t.g?t.g.readyState:0}function zs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Ws(t){var e="";return _e(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Gs(t,e,n){t:{for(s in n){var s=!1;break t}s=!0}s||(n=Ws(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function $s(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qs(t){this.Ca=0,this.i=[],this.j=new un,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=$s("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=$s("baseRetryDelayMs",5e3,t),this.bb=$s("retryDelaySeedMs",1e4,t),this.$a=$s("forwardChannelMaxRetries",2,t),this.ta=$s("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 ms(t&&t.concurrentRequestLimit),this.Fa=new bs,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 Js(t){if(Xs(t),3==t.G){var e=t.U++,n=Qn(t.F);Zn(n,"SID",t.I),Zn(n,"RID",e),Zn(n,"TYPE","terminate"),er(t,n),(e=new Rn(t,t.j,e,void 0)).K=2,e.v=ts(Qn(n)),n=!1,kt.navigator&&kt.navigator.sendBeacon&&(n=kt.navigator.sendBeacon(e.v.toString(),"")),!n&&kt.Image&&((new Image).src=e.v,n=!0),n||(e.g=fr(e.l,null),e.g.da(e.v)),e.F=Date.now(),Bn(e)}lr(t)}function Ys(t){t.g&&(ir(t),t.g.cancel(),t.g=null)}function Xs(t){Ys(t),t.u&&(kt.clearTimeout(t.u),t.u=null),ar(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zs(t){vs(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function tr(t,e){var n;n=e?e.m:t.U++;var s=Qn(t.F);Zn(s,"SID",t.I),Zn(s,"RID",n),Zn(s,"AID",t.T),er(t,s),t.o&&t.s&&Gs(s,t.o,t.s),n=new Rn(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=nr(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Ts(t.h,n),Mn(n,s,e)}function er(t,e){t.ia&&_e(t.ia,(function(t,n){Zn(e,n,t)})),t.l&&Wn({},(function(t,n){Zn(e,n,t)}))}function nr(t,e,n){n=Math.min(t.i.length,n);var s=t.l?xt(t.l.Ra,t.l,t):null;t:for(var r=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=r[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=r[c].h,h=r[c].g;if(0>(u-=i))i=Math.max(0,r[c].h-100),a=!1;else try{As(h,o,"req"+u+"_")}catch(t){s&&s(h)}}if(a){s=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,s}function sr(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function rr(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),ur(t,t.A)),t.A++,!0)}function ir(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function or(t){t.g=new Rn(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Qn(t.sa);Zn(e,"RID","rpc"),Zn(e,"SID",t.I),Zn(e,"CI",t.L?"0":"1"),Zn(e,"AID",t.T),Zn(e,"TYPE","xmlhttp"),er(t,e),t.o&&t.s&&Gs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=ts(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function ar(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cr(t,e){var n=null;if(t.g==e){ar(t),ir(t),t.g=null;var s=2}else{if(!_s(t.h,e))return;n=e.D,Is(t.h,e),s=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==s){n=e.s?e.s.length:0,e=Date.now()-e.F;var r=t.C;Be(s=fn(),new vn(s,n)),Zs(t)}else sr(t);else if(3==(r=e.o)||0==r&&0<t.pa||!(1==s&&function(t,e){return!(ws(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=wn(xt(t.Ja,t,e),ur(t,t.C)),t.C++,0)))}(t,e)||2==s&&rr(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),r){case 1:hr(t,5);break;case 4:hr(t,10);break;case 3:hr(t,6);break;default:hr(t,2)}}function ur(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hr(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var s=xt(t.kb,t);n||(n=new $n("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Jn(n,"https"),ts(n)),function(t,e){var n=new un;if(kt.Image){var s=new Image;s.onload=Ut(Cs,n,s,"TestLoadImage: loaded",!0,e),s.onerror=Ut(Cs,n,s,"TestLoadImage: error",!1,e),s.onabort=Ut(Cs,n,s,"TestLoadImage: abort",!1,e),s.ontimeout=Ut(Cs,n,s,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){s.ontimeout&&s.ontimeout()}),1e4),s.src=t}else e(!1)}(n.toString(),s)}else yn(2);t.G=0,t.l&&t.l.va(e),lr(t),Xs(t)}function lr(t){if(t.G=0,t.la=[],t.l){var e=Es(t.h);0==e.length&&0==t.i.length||(Ht(t.la,e),Ht(t.la,t.i),t.h.i.length=0,jt(t.i),t.i.length=0),t.l.ua()}}function dr(t,e,n){var s=n instanceof $n?Qn(n):new $n(n,void 0);if(""!=s.g)e&&(s.g=e+"."+s.g),Yn(s,s.m);else{var r=kt.location;s=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;var i=new $n(null,void 0);s&&Jn(i,s),e&&(i.g=e),r&&Yn(i,r),n&&(i.l=n),s=i}return n=t.D,e=t.za,n&&e&&Zn(s,n,e),Zn(s,"VER",t.ma),er(t,s),s}function fr(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 Ms(new ks({jb:!0})):new Ms(t.ra)).Ka(t.H),e}function pr(){}function gr(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function mr(t,e){Ve.call(this),this.g=new Qs(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)&&!zt(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!zt(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new wr(this)}function yr(t){Cn.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 vr(){kn.call(this),this.status=1}function wr(t){this.g=t}(bt=Ms.prototype).Ka=function(t){this.L=t},bt.da=function(t,e,n,s){var r,i,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():bn.g(),this.C=this.u?En(this.u):En(bn),this.g.onreadystatechange=xt(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Vs(this,l)}if(t=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var c in s)n.set(c,s[c]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));try{for(var u=Et(s.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,s.get(l))}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}s=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=Bt(Fs,e))||s||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Et(n),f=d.next();!f.done;f=d.next()){var p=St(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,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{qs(this),0<this.B&&((this.K=function(t){return te&&le()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=xt(this.qa,this)):this.A=en(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Vs(this,l)}},bt.qa=function(){void 0!==Ct&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Be(this,"timeout"),this.abort(8))},bt.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Be(this,"complete"),Be(this,"abort"),Hs(this))},bt.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Hs(this,!0)),Ms.X.M.call(this)},bt.Ha=function(){this.s||(this.F||this.v||this.l?js(this):this.fb())},bt.fb=function(){js(this)},bt.aa=function(){try{return 2<Ks(this)?this.g.status:-1}catch(t){return-1}},bt.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},bt.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Ps(e)}},bt.Ea=function(){return this.m},bt.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(bt=Qs.prototype).ma=8,bt.G=1,bt.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 Rn(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Ee(n=Te(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var s=0,r=0;r<this.i.length;r++){var i=this.i[r];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(s+=i)){s=r;break t}if(4096===s||r===this.i.length-1){s=r+1;break t}}s=1e3}else s=1e3;s=nr(this,e,s),Zn(r=Qn(this.F),"RID",t),Zn(r,"CVER",22),this.D&&Zn(r,"X-HTTP-Session-Id",this.D),er(this,r),n&&(this.N?s="headers="+encodeURIComponent(String(Ws(n)))+"&"+s:this.o&&Gs(r,this.o,n)),Ts(this.h,e),this.Ya&&Zn(r,"TYPE","init"),this.O?(Zn(r,"$req",s),Zn(r,"SID","null"),e.Z=!0,Mn(e,r,null)):Mn(e,r,s),this.G=2}}else 3==this.G&&(t?tr(this,t):0==this.i.length||vs(this.h)||tr(this))},bt.Ia=function(){if(this.u=null,or(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=wn(xt(this.eb,this),t)}},bt.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,yn(10),Ys(this),or(this))},bt.cb=function(){null!=this.v&&(this.v=null,Ys(this),rr(this),yn(19))},bt.kb=function(t){t?(this.j.info("Successfully pinged google.com"),yn(2)):(this.j.info("Failed to ping google.com"),yn(1))},(bt=pr.prototype).xa=function(){},bt.wa=function(){},bt.va=function(){},bt.ua=function(){},bt.Ra=function(){},gr.prototype.g=function(t,e){return new mr(t,e)},Ft(mr,Ve),mr.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;yn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=dr(t,null,t.V),Zs(t)},mr.prototype.close=function(){Js(this.g)},mr.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=He(t),t=n);e.i.push(new gs(e.ab++,t)),3==e.G&&Zs(e)},mr.prototype.M=function(){this.g.l=null,delete this.j,Js(this.g),delete this.g,mr.X.M.call(this)},Ft(yr,Cn),Ft(vr,kn),Ft(wr,pr),wr.prototype.xa=function(){Be(this.g,"a")},wr.prototype.wa=function(t){Be(this.g,new yr(t))},wr.prototype.va=function(t){Be(this.g,new vr)},wr.prototype.ua=function(){Be(this.g,"b")},gr.prototype.createWebChannel=gr.prototype.g,mr.prototype.send=mr.prototype.u,mr.prototype.open=mr.prototype.m,mr.prototype.close=mr.prototype.close,_n.NO_ERROR=0,_n.TIMEOUT=8,_n.HTTP_ERROR=6,Tn.COMPLETE="complete",Sn.EventType=An,An.OPEN="a",An.CLOSE="b",An.ERROR="c",An.MESSAGE="d",Ve.prototype.listen=Ve.prototype.N,Ms.prototype.listenOnce=Ms.prototype.O,Ms.prototype.getLastError=Ms.prototype.Oa,Ms.prototype.getLastErrorCode=Ms.prototype.Ea,Ms.prototype.getStatus=Ms.prototype.aa,Ms.prototype.getResponseJson=Ms.prototype.Sa,Ms.prototype.getResponseText=Ms.prototype.fa,Ms.prototype.send=Ms.prototype.da,Ms.prototype.setWithCredentials=Ms.prototype.Ka;var _r=_n,Tr=Tn,Ir=ln,Er=10,Sr=11,br=ks,Ar=Sn,Cr=Ms;const kr="@firebase/firestore";
315
+ */var Tt;Tt="",rt(new E("platform-logger",(t=>new Q(t)),"PRIVATE")),rt(new E("heartbeat",(t=>new yt(t)),"PRIVATE")),lt(J,Y,Tt),lt(J,Y,"esm2017"),lt("fire-js","");var It=function(t,e){return It=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])},It(t,e)};function Et(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],s=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function St(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var s,r,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return o}var bt,At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ct=Ct||{},kt=At||self;function Nt(){}function Rt(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 Dt(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ot="closure_uid_"+(1e9*Math.random()>>>0),Lt=0;function Pt(t,e,n){return t.call.apply(t.bind,arguments)}function Mt(t,e,n){if(!t)throw Error();if(2<arguments.length){var s=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,s),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function xt(t,e,n){return(xt=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Pt:Mt).apply(null,arguments)}function Ut(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 Ft(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,s){for(var r=Array(arguments.length-2),i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.prototype[n].apply(t,r)}}function Vt(){this.s=this.s,this.o=this.o}Vt.prototype.s=!1,Vt.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ot)&&t[Ot]||(t[Ot]=++Lt))},Vt.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Bt=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 jt(t){var e=t.length;if(0<e){for(var n=Array(e),s=0;s<e;s++)n[s]=t[s];return n}return[]}function Ht(t,e){for(var n=1;n<arguments.length;n++){var s=arguments[n];if(Rt(s)){var r=t.length||0,i=s.length||0;t.length=r+i;for(var o=0;o<i;o++)t[r+o]=s[o]}else t.push(s)}}function qt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}qt.prototype.h=function(){this.defaultPrevented=!0};var Kt=function(){if(!kt.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{kt.addEventListener("test",Nt,e),kt.removeEventListener("test",Nt,e)}catch(t){}return t}();function Wt(t){return/^[\s\xa0]*$/.test(t)}var zt=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Gt(t,e){return t<e?-1:t>e?1:0}function $t(){var t=kt.navigator;return t&&(t=t.userAgent)?t:""}function Qt(t){return-1!=$t().indexOf(t)}function Jt(t){return Jt[" "](t),t}Jt[" "]=Nt;var Yt,Xt,Zt=Qt("Opera"),te=Qt("Trident")||Qt("MSIE"),ee=Qt("Edge"),ne=ee||te,se=Qt("Gecko")&&!(-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),re=-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge");function ie(){var t=kt.document;return t?t.documentMode:void 0}t:{var oe="",ae=(Xt=$t(),se?/rv:([^\);]+)(\)|;)/.exec(Xt):ee?/Edge\/([\d\.]+)/.exec(Xt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Xt):re?/WebKit\/(\S+)/.exec(Xt):Zt?/(?:Version)[ \/]?(\S+)/.exec(Xt):void 0);if(ae&&(oe=ae?ae[1]:""),te){var ce=ie();if(null!=ce&&ce>parseFloat(oe)){Yt=String(ce);break t}}Yt=oe}var ue,he={};function le(){return function(t){var e=he;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=zt(String(Yt)).split("."),n=zt("9").split("."),s=Math.max(e.length,n.length),r=0;0==t&&r<s;r++){var i=e[r]||"",o=n[r]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=Gt(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Gt(0==i[2].length,0==o[2].length)||Gt(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(kt.document&&te){var de=ie();ue=de||(parseInt(Yt,10)||void 0)}else ue=void 0;var fe=ue;function pe(t,e){if(qt.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,s=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(se){t:{try{Jt(e.nodeName);var r=!0;break t}catch(t){}r=!1}r||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,s?(this.clientX=void 0!==s.clientX?s.clientX:s.pageX,this.clientY=void 0!==s.clientY?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.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:ge[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&pe.X.h.call(this)}}Ft(pe,qt);var ge={2:"touch",3:"pen",4:"mouse"};pe.prototype.h=function(){pe.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var me="closure_listenable_"+(1e6*Math.random()|0),ye=0;function ve(t,e,n,s,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!s,this.ha=r,this.key=++ye,this.ba=this.ea=!1}function we(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function _e(t,e,n){for(var s in t)e.call(n,t[s],s,t)}function Te(t){var e={};for(var n in t)e[n]=t[n];return e}var Ie="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ee(t,e){for(var n,s,r=1;r<arguments.length;r++){for(n in s=arguments[r])t[n]=s[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}}function Se(t){this.src=t,this.g={},this.h=0}function be(t,e){var n=e.type;if(n in t.g){var s,r=t.g[n],i=Bt(r,e);(s=0<=i)&&Array.prototype.splice.call(r,i,1),s&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,s){for(var r=0;r<t.length;++r){var i=t[r];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==s)return r}return-1}Se.prototype.add=function(t,e,n,s,r){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,s,r);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!s,r)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,s,r){if(s&&s.once)return De(t,e,n,s,r);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,s,r);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Dt(s)?!!s.capture:!!s,r):Re(t,e,n,!1,s,r)}function Re(t,e,n,s,r,i){if(!e)throw Error("Invalid event type");var o=Dt(r)?!!r.capture:!!r,a=xe(t);if(a||(t[Ce]=a=new Se(t)),(n=a.add(e,n,s,o,i)).proxy)return n;if(s=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=s,s.src=t,s.listener=n,t.addEventListener)Kt||(r=o),void 0===r&&(r=!1),t.addEventListener(e.toString(),s,r);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),s);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(s)}return n}function De(t,e,n,s,r){if(Array.isArray(e)){for(var i=0;i<e.length;i++)De(t,e[i],n,s,r);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Dt(s)?!!s.capture:!!s,r):Re(t,e,n,!0,s,r)}function Oe(t,e,n,s,r){if(Array.isArray(e))for(var i=0;i<e.length;i++)Oe(t,e[i],n,s,r);else s=Dt(s)?!!s.capture:!!s,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,s,r))&&(we(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=xe(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Ae(e,n,s,r)),(n=-1<t?e[t]:null)&&Le(n))}function Le(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[me])be(e.i,t);else{var n=t.type,s=t.proxy;e.removeEventListener?e.removeEventListener(n,s,t.capture):e.detachEvent?e.detachEvent(Pe(n),s):e.addListener&&e.removeListener&&e.removeListener(s),(n=xe(e))?(be(n,t),0==n.h&&(n.src=null,e[Ce]=null)):we(t)}}}function Pe(t){return t in ke?ke[t]:ke[t]="on"+t}function Me(t,e){if(t.ba)t=!0;else{e=new pe(e,this);var n=t.listener,s=t.ha||t.src;t.ea&&Le(t),t=n.call(s,e)}return t}function xe(t){return(t=t[Ce])instanceof Se?t:null}var Ue="__closure_events_fn_"+(1e9*Math.random()>>>0);function Fe(t){return"function"==typeof t?t:(t[Ue]||(t[Ue]=function(e){return t.handleEvent(e)}),t[Ue])}function Ve(){Vt.call(this),this.i=new Se(this),this.P=this,this.I=null}function Be(t,e){var n,s=t.I;if(s)for(n=[];s;s=s.I)n.push(s);if(t=t.P,s=e.type||e,"string"==typeof e)e=new qt(e,t);else if(e instanceof qt)e.target=e.target||t;else{var r=e;Ee(e=new qt(s,t),r)}if(r=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];r=je(o,s,!0,e)&&r}if(r=je(o=e.g=t,s,!0,e)&&r,r=je(o,s,!1,e)&&r,n)for(i=0;i<n.length;i++)r=je(o=e.g=n[i],s,!1,e)&&r}function je(t,e,n,s){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var r=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&be(t.i,o),r=!1!==a.call(c,s)&&r}}return r&&!s.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,s){Oe(this,t,e,n,s)},Ve.prototype.M=function(){if(Ve.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],s=0;s<n.length;s++)we(n[s]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,s){return this.i.add(String(t),e,!1,n,s)},Ve.prototype.O=function(t,e,n,s){return this.i.add(String(t),e,!0,n,s)};var He=kt.JSON.stringify;function qe(){var t=Ye,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Ke,We=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=ze.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),ze=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 Ge}),(function(t){return t.reset()})),Ge=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 $e(t){kt.setTimeout((function(){throw t}),0)}function Qe(t,e){Ke||function(){var t=kt.Promise.resolve(void 0);Ke=function(){t.then(Xe)}}(),Je||(Ke(),Je=!0),Ye.add(t,e)}var Je=!1,Ye=new We;function Xe(){for(var t;t=qe();){try{t.h.call(t.g)}catch(t){$e(t)}var e=ze;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Je=!1}function Ze(t,e){Ve.call(this),this.h=t||1,this.g=e||kt,this.j=xt(this.lb,this),this.l=Date.now()}function tn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function en(t,e,n){if("function"==typeof t)n&&(t=xt(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=xt(t.handleEvent,t)}return 2147483647<Number(e)?-1:kt.setTimeout(t,e||0)}function nn(t){t.g=en((function(){t.g=null,t.i&&(t.i=!1,nn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ft(Ze,Ve),(bt=Ze.prototype).ca=!1,bt.R=null,bt.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),Be(this,"tick"),this.ca&&(tn(this),this.start()))}},bt.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},bt.M=function(){Ze.X.M.call(this),tn(this),delete this.g};var sn=function(t){function e(e,n){var s=t.call(this)||this;return s.m=e,s.j=n,s.h=null,s.i=!1,s.g=null,s}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}It(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:nn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(kt.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Vt);function rn(t){Vt.call(this),this.h=t,this.g={}}Ft(rn,Vt);var on=[];function an(t,e,n,s){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var r=0;r<n.length;r++){var i=Ne(e,n[r],s||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function cn(t){_e(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Le(t)}),t),t.g={}}function un(){this.g=!0}function hn(t,e,n,s){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 s=n[t];if(!(2>s.length)){var r=s[1];if(Array.isArray(r)&&!(1>r.length)){var i=r[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<r.length;o++)r[o]=""}}}return He(n)}catch(t){return e}}(t,n)+(s?" "+s:"")}))}rn.prototype.M=function(){rn.X.M.call(this),cn(this)},rn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},un.prototype.Aa=function(){this.g=!1},un.prototype.info=function(){};var ln={},dn=null;function fn(){return dn=dn||new Ve}function pn(t){qt.call(this,ln.Pa,t)}function gn(t){var e=fn();Be(e,new pn(e))}function mn(t,e){qt.call(this,ln.STAT_EVENT,t),this.stat=e}function yn(t){var e=fn();Be(e,new mn(e,t))}function vn(t,e){qt.call(this,ln.Qa,t),this.size=e}function wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return kt.setTimeout((function(){t()}),e)}ln.Pa="serverreachability",Ft(pn,qt),ln.STAT_EVENT="statevent",Ft(mn,qt),ln.Qa="timingevent",Ft(vn,qt);var _n={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Tn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function In(){}function En(t){return t.h||(t.h=t.i())}function Sn(){}In.prototype.h=null;var bn,An={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Cn(){qt.call(this,"d")}function kn(){qt.call(this,"c")}function Nn(){}function Rn(t,e,n,s){this.l=t,this.j=e,this.m=n,this.U=s||1,this.S=new rn(this),this.O=On,t=ne?125:void 0,this.T=new Ze(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 Dn}function Dn(){this.i=null,this.g="",this.h=!1}Ft(Cn,qt),Ft(kn,qt),Ft(Nn,In),Nn.prototype.g=function(){return new XMLHttpRequest},Nn.prototype.i=function(){return{}},bn=new Nn;var On=45e3,Ln={},Pn={};function Mn(t,e,n){t.K=1,t.v=ts(Qn(e)),t.s=n,t.P=!0,xn(t,null)}function xn(t,e){t.F=Date.now(),Bn(t),t.A=Qn(t.v);var n=t.A,s=t.U;Array.isArray(s)||(s=[String(s)]),fs(n.i,"t",s),t.C=0,n=t.l.H,t.h=new Dn,t.g=fr(t.l,n?e:null,!t.s),0<t.N&&(t.L=new sn(xt(t.La,t,t.g),t.N)),an(t.S,t.g,"readystatechange",t.ib),e=t.H?Te(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)),gn(),function(t,e,n,s,r,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+s+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Un(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Fn(t,e,n){for(var s,r=!0;!t.I&&t.C<n.length;){if((s=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),r=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(s==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}hn(t.j,t.m,s,null),Wn(t,s)}Un(t)&&s!=Pn&&s!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),r=!1),t.i=t.i&&r,r?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),ir(e),e.K=!0,yn(11))):(hn(t.j,t.m,n,"[Invalid Chunked Response]"),Kn(t),qn(t))}function Vn(t,e){var n=t.C,s=e.indexOf("\n",n);return-1==s?Pn:(n=Number(e.substring(n,s)),isNaN(n)?Ln:(s+=1)+n>e.length?Pn:(e=e.substr(s,n),t.C=s+n,e))}function Bn(t){t.V=Date.now()+t.O,jn(t,t.O)}function jn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=wn(xt(t.gb,t),e)}function Hn(t){t.B&&(kt.clearTimeout(t.B),t.B=null)}function qn(t){0==t.l.G||t.I||cr(t.l,t)}function Kn(t){Hn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,tn(t.T),cn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Wn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||_s(n.h,t)))if(!t.J&&_s(n.h,t)&&3==n.G){try{var s=n.Fa.g.parse(e)}catch(i){s=null}if(Array.isArray(s)&&3==s.length){var r=s;if(0==r[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ar(n),Ys(n)}rr(n),yn(18)}}else n.Ba=r[1],0<n.Ba-n.T&&37500>r[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=ws(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hr(n,11)}else if((t.J||n.g==t)&&ar(n),!Wt(e))for(r=n.Fa.g.parse(e),e=0;e<r.length;e++){var i=r[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(s=1.5*c,n.J=s,n.j.info("backChannelRequestTimeoutMs_="+s)),s=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=s.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(Ts(l,l.h),l.h=null))}if(s.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(s.za=d,Zn(s.F,s.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((s=n).sa=dr(s,s.H?s.ka:null,s.V),f.J){Is(s.h,f);var p=f,g=s.J;g&&p.setTimeout(g),p.B&&(Hn(p),Bn(p)),s.g=f}else sr(s);0<n.i.length&&Zs(n)}else"stop"!=i[0]&&"close"!=i[0]||hr(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hr(n,7):Js(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}gn()}catch(i){}}function zn(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Rt(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(Rt(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var s in e=[],n=0,t)e[n++]=s;return e}}}(t),s=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(Rt(t)){for(var e=[],n=t.length,s=0;s<n;s++)e.push(t[s]);return e}for(s in e=[],n=0,t)e[n++]=t[s];return e}(t),r=s.length,i=0;i<r;i++)e.call(void 0,s[i],n&&n[i],t)}(bt=Rn.prototype).setTimeout=function(t){this.O=t},bt.ib=function(t){t=t.target;var e=this.L;e&&3==Ks(t)?e.l():this.La(t)},bt.La=function(t){try{if(t==this.g)t:{var e=Ks(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||Ws(this.g)))){this.I||4!=e||7==n||gn(),Hn(this);var s=this.g.aa();this.Y=s;e:if(Un(this)){var r=Ws(this.g);t="";var i=r.length,o=4==Ks(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Kn(this),qn(this);var a="";break e}this.h.i=new kt.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(r[n],{stream:o&&n==i-1});r.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==s,function(t,e,n,s,r,i,o){t.info((function(){return"XMLHTTP RESP ("+s+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,s),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Wt(c)){var h=c;break e}}h=null}if(!(s=h)){this.i=!1,this.o=3,yn(12),Kn(this),qn(this);break t}hn(this.j,this.m,s,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Wn(this,s)}this.P?(Fn(this,e,a),ne&&this.i&&3==e&&(an(this.S,this.T,"tick",this.hb),this.T.start())):(hn(this.j,this.m,a,null),Wn(this,a)),4==e&&Kn(this),this.i&&!this.I&&(4==e?cr(this.l,this):(this.i=!1,Bn(this)))}else 400==s&&0<a.indexOf("Unknown SID")?(this.o=3,yn(12)):(this.o=0,yn(13)),Kn(this),qn(this)}}}catch(e){}},bt.hb=function(){if(this.g){var t=Ks(this.g),e=this.g.fa();this.C<e.length&&(Hn(this),Fn(this,t,e),this.i&&4!=t&&Bn(this))}},bt.cancel=function(){this.I=!0,Kn(this)},bt.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&&(gn(),yn(17)),Kn(this),this.o=2,qn(this)):jn(this,this.V-t)};var Gn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function $n(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof $n){this.h=void 0!==e?e:t.h,Jn(this,t.j),this.s=t.s,this.g=t.g,Yn(this,t.m),this.l=t.l,e=t.i;var n=new us;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Xn(this,n),this.o=t.o}else t&&(n=String(t).match(Gn))?(this.h=!!e,Jn(this,n[1]||"",!0),this.s=es(n[2]||""),this.g=es(n[3]||"",!0),Yn(this,n[4]),this.l=es(n[5]||"",!0),Xn(this,n[6]||"",!0),this.o=es(n[7]||"")):(this.h=!!e,this.i=new us(null,this.h))}function Qn(t){return new $n(t)}function Jn(t,e,n){t.j=n?es(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Yn(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 Xn(t,e,n){e instanceof us?(t.i=e,function(t,e){e&&!t.j&&(hs(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ls(this,e),fs(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=ns(e,as)),t.i=new us(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function ts(t){return Zn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function es(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function ns(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,ss),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function ss(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}$n.prototype.toString=function(){var t=[],e=this.j;e&&t.push(ns(e,rs,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(ns(e,rs,!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(ns(n,"/"==n.charAt(0)?os:is,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",ns(n,cs)),t.join("")};var rs=/[#\/\?@]/g,is=/[#\?:]/g,os=/[#\?]/g,as=/[#\?@]/g,cs=/#/g;function us(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hs(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 s=t[n].indexOf("="),r=null;if(0<=s){var i=t[n].substring(0,s);r=t[n].substring(s+1)}else i=t[n];e(i,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function ls(t,e){hs(t),e=ps(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ds(t,e){return hs(t),e=ps(t,e),t.g.has(e)}function fs(t,e,n){ls(t,e),0<n.length&&(t.i=null,t.g.set(ps(t,e),jt(n)),t.h+=n.length)}function ps(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(bt=us.prototype).add=function(t,e){hs(this),this.i=null,t=ps(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},bt.forEach=function(t,e){hs(this),this.g.forEach((function(n,s){n.forEach((function(n){t.call(e,n,s,this)}),this)}),this)},bt.oa=function(){hs(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],s=0;s<e.length;s++)for(var r=t[s],i=0;i<r.length;i++)n.push(e[s]);return n},bt.W=function(t){hs(this);var e=[];if("string"==typeof t)ds(this,t)&&(e=e.concat(this.g.get(ps(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},bt.set=function(t,e){return hs(this),this.i=null,ds(this,t=ps(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},bt.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},bt.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 s=e[n],r=encodeURIComponent(String(s)),i=this.W(s);for(s=0;s<i.length;s++){var o=r;""!==i[s]&&(o+="="+encodeURIComponent(String(i[s]))),t.push(o)}}return this.i=t.join("&")};var gs=function(t,e){this.h=t,this.g=e};function ms(t){this.l=t||ys,kt.PerformanceNavigationTiming?t=0<(t=kt.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(kt.g&&kt.g.Ga&&kt.g.Ga()&&kt.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 ys=10;function vs(t){return!!t.h||!!t.g&&t.g.size>=t.j}function ws(t){return t.h?1:t.g?t.g.size:0}function _s(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Ts(t,e){t.g?t.g.add(e):t.h=e}function Is(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Es(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var s=t.i;try{for(var r=Et(t.g.values()),i=r.next();!i.done;i=r.next()){var o=i.value;s=s.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return s}return jt(t.i)}function Ss(){}function bs(){this.g=new Ss}function As(t,e,n){var s=n||"";try{zn(t,(function(t,n){var r=t;Dt(t)&&(r=He(t)),e.push(s+n+"="+encodeURIComponent(r))}))}catch(t){throw e.push(s+"type="+encodeURIComponent("_badmap")),t}}function Cs(t,e,n,s,r){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,r(s)}catch(t){}}function ks(t){this.l=t.ac||null,this.j=t.jb||!1}function Ns(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Rs,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}ms.prototype.cancel=function(){var t,e;if(this.i=Es(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Et(this.g.values()),s=n.next();!s.done;s=n.next()){s.value.cancel()}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Ss.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Ss.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(ks,In),ks.prototype.g=function(){return new Ns(this.l,this.j)},ks.prototype.i=function(t){return function(){return t}}({}),Ft(Ns,Ve);var Rs=0;function Ds(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Os(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ls(t)}function Ls(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(bt=Ns.prototype).open=function(t,e){if(this.readyState!=Rs)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ls(this)},bt.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||kt).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},bt.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,Os(this)),this.readyState=Rs},bt.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,Ls(this)),this.g&&(this.readyState=3,Ls(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==kt.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;Ds(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},bt.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?Os(this):Ls(this),3==this.readyState&&Ds(this)}},bt.Va=function(t){this.g&&(this.response=this.responseText=t,Os(this))},bt.Ua=function(t){this.g&&(this.response=t,Os(this))},bt.ga=function(){this.g&&Os(this)},bt.setRequestHeader=function(t,e){this.v.append(t,e)},bt.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},bt.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(Ns.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Ps=kt.JSON.parse;function Ms(t){Ve.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=xs,this.K=this.L=!1}Ft(Ms,Ve);var xs="",Us=/^https?$/i,Fs=["POST","PUT"];function Vs(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Bs(t),Hs(t)}function Bs(t){t.D||(t.D=!0,Be(t,"complete"),Be(t,"error"))}function js(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=Ks(t)||2!=t.aa()))if(t.v&&4==Ks(t))en(t.Ha,0,t);else if(Be(t,"readystatechange"),4==Ks(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 s=!0;break t;default:s=!1}if(!(e=s)){var r;if(r=0===n){var i=String(t.H).match(Gn)[1]||null;if(!i&&kt.self&&kt.self.location){var o=kt.self.location.protocol;i=o.substr(0,o.length-1)}r=!Us.test(i?i.toLowerCase():"")}e=r}if(e)Be(t,"complete"),Be(t,"success");else{t.m=6;try{var a=2<Ks(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Bs(t)}}finally{Hs(t)}}}function Hs(t,e){if(t.g){qs(t);var n=t.g,s=t.C[0]?Nt:null;t.g=null,t.C=null,e||Be(t,"ready");try{n.onreadystatechange=s}catch(t){}}}function qs(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function Ks(t){return t.g?t.g.readyState:0}function Ws(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function zs(t){var e="";return _e(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Gs(t,e,n){t:{for(s in n){var s=!1;break t}s=!0}s||(n=zs(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function $s(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qs(t){this.Ca=0,this.i=[],this.j=new un,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=$s("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=$s("baseRetryDelayMs",5e3,t),this.bb=$s("retryDelaySeedMs",1e4,t),this.$a=$s("forwardChannelMaxRetries",2,t),this.ta=$s("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 ms(t&&t.concurrentRequestLimit),this.Fa=new bs,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 Js(t){if(Xs(t),3==t.G){var e=t.U++,n=Qn(t.F);Zn(n,"SID",t.I),Zn(n,"RID",e),Zn(n,"TYPE","terminate"),er(t,n),(e=new Rn(t,t.j,e,void 0)).K=2,e.v=ts(Qn(n)),n=!1,kt.navigator&&kt.navigator.sendBeacon&&(n=kt.navigator.sendBeacon(e.v.toString(),"")),!n&&kt.Image&&((new Image).src=e.v,n=!0),n||(e.g=fr(e.l,null),e.g.da(e.v)),e.F=Date.now(),Bn(e)}lr(t)}function Ys(t){t.g&&(ir(t),t.g.cancel(),t.g=null)}function Xs(t){Ys(t),t.u&&(kt.clearTimeout(t.u),t.u=null),ar(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zs(t){vs(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function tr(t,e){var n;n=e?e.m:t.U++;var s=Qn(t.F);Zn(s,"SID",t.I),Zn(s,"RID",n),Zn(s,"AID",t.T),er(t,s),t.o&&t.s&&Gs(s,t.o,t.s),n=new Rn(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=nr(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Ts(t.h,n),Mn(n,s,e)}function er(t,e){t.ia&&_e(t.ia,(function(t,n){Zn(e,n,t)})),t.l&&zn({},(function(t,n){Zn(e,n,t)}))}function nr(t,e,n){n=Math.min(t.i.length,n);var s=t.l?xt(t.l.Ra,t.l,t):null;t:for(var r=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=r[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=r[c].h,h=r[c].g;if(0>(u-=i))i=Math.max(0,r[c].h-100),a=!1;else try{As(h,o,"req"+u+"_")}catch(t){s&&s(h)}}if(a){s=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,s}function sr(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function rr(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),ur(t,t.A)),t.A++,!0)}function ir(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function or(t){t.g=new Rn(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Qn(t.sa);Zn(e,"RID","rpc"),Zn(e,"SID",t.I),Zn(e,"CI",t.L?"0":"1"),Zn(e,"AID",t.T),Zn(e,"TYPE","xmlhttp"),er(t,e),t.o&&t.s&&Gs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=ts(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function ar(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cr(t,e){var n=null;if(t.g==e){ar(t),ir(t),t.g=null;var s=2}else{if(!_s(t.h,e))return;n=e.D,Is(t.h,e),s=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==s){n=e.s?e.s.length:0,e=Date.now()-e.F;var r=t.C;Be(s=fn(),new vn(s,n)),Zs(t)}else sr(t);else if(3==(r=e.o)||0==r&&0<t.pa||!(1==s&&function(t,e){return!(ws(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=wn(xt(t.Ja,t,e),ur(t,t.C)),t.C++,0)))}(t,e)||2==s&&rr(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),r){case 1:hr(t,5);break;case 4:hr(t,10);break;case 3:hr(t,6);break;default:hr(t,2)}}function ur(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hr(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var s=xt(t.kb,t);n||(n=new $n("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Jn(n,"https"),ts(n)),function(t,e){var n=new un;if(kt.Image){var s=new Image;s.onload=Ut(Cs,n,s,"TestLoadImage: loaded",!0,e),s.onerror=Ut(Cs,n,s,"TestLoadImage: error",!1,e),s.onabort=Ut(Cs,n,s,"TestLoadImage: abort",!1,e),s.ontimeout=Ut(Cs,n,s,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){s.ontimeout&&s.ontimeout()}),1e4),s.src=t}else e(!1)}(n.toString(),s)}else yn(2);t.G=0,t.l&&t.l.va(e),lr(t),Xs(t)}function lr(t){if(t.G=0,t.la=[],t.l){var e=Es(t.h);0==e.length&&0==t.i.length||(Ht(t.la,e),Ht(t.la,t.i),t.h.i.length=0,jt(t.i),t.i.length=0),t.l.ua()}}function dr(t,e,n){var s=n instanceof $n?Qn(n):new $n(n,void 0);if(""!=s.g)e&&(s.g=e+"."+s.g),Yn(s,s.m);else{var r=kt.location;s=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;var i=new $n(null,void 0);s&&Jn(i,s),e&&(i.g=e),r&&Yn(i,r),n&&(i.l=n),s=i}return n=t.D,e=t.za,n&&e&&Zn(s,n,e),Zn(s,"VER",t.ma),er(t,s),s}function fr(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 Ms(new ks({jb:!0})):new Ms(t.ra)).Ka(t.H),e}function pr(){}function gr(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function mr(t,e){Ve.call(this),this.g=new Qs(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)&&!Wt(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Wt(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new wr(this)}function yr(t){Cn.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 vr(){kn.call(this),this.status=1}function wr(t){this.g=t}(bt=Ms.prototype).Ka=function(t){this.L=t},bt.da=function(t,e,n,s){var r,i,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():bn.g(),this.C=this.u?En(this.u):En(bn),this.g.onreadystatechange=xt(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Vs(this,l)}if(t=n||"",n=new Map(this.headers),s)if(Object.getPrototypeOf(s)===Object.prototype)for(var c in s)n.set(c,s[c]);else{if("function"!=typeof s.keys||"function"!=typeof s.get)throw Error("Unknown input type for opt_headers: "+String(s));try{for(var u=Et(s.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,s.get(l))}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}s=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=Bt(Fs,e))||s||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Et(n),f=d.next();!f.done;f=d.next()){var p=St(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,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{qs(this),0<this.B&&((this.K=function(t){return te&&le()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=xt(this.qa,this)):this.A=en(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Vs(this,l)}},bt.qa=function(){void 0!==Ct&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Be(this,"timeout"),this.abort(8))},bt.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Be(this,"complete"),Be(this,"abort"),Hs(this))},bt.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Hs(this,!0)),Ms.X.M.call(this)},bt.Ha=function(){this.s||(this.F||this.v||this.l?js(this):this.fb())},bt.fb=function(){js(this)},bt.aa=function(){try{return 2<Ks(this)?this.g.status:-1}catch(t){return-1}},bt.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},bt.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Ps(e)}},bt.Ea=function(){return this.m},bt.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(bt=Qs.prototype).ma=8,bt.G=1,bt.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 Rn(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Ee(n=Te(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var s=0,r=0;r<this.i.length;r++){var i=this.i[r];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(s+=i)){s=r;break t}if(4096===s||r===this.i.length-1){s=r+1;break t}}s=1e3}else s=1e3;s=nr(this,e,s),Zn(r=Qn(this.F),"RID",t),Zn(r,"CVER",22),this.D&&Zn(r,"X-HTTP-Session-Id",this.D),er(this,r),n&&(this.N?s="headers="+encodeURIComponent(String(zs(n)))+"&"+s:this.o&&Gs(r,this.o,n)),Ts(this.h,e),this.Ya&&Zn(r,"TYPE","init"),this.O?(Zn(r,"$req",s),Zn(r,"SID","null"),e.Z=!0,Mn(e,r,null)):Mn(e,r,s),this.G=2}}else 3==this.G&&(t?tr(this,t):0==this.i.length||vs(this.h)||tr(this))},bt.Ia=function(){if(this.u=null,or(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=wn(xt(this.eb,this),t)}},bt.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,yn(10),Ys(this),or(this))},bt.cb=function(){null!=this.v&&(this.v=null,Ys(this),rr(this),yn(19))},bt.kb=function(t){t?(this.j.info("Successfully pinged google.com"),yn(2)):(this.j.info("Failed to ping google.com"),yn(1))},(bt=pr.prototype).xa=function(){},bt.wa=function(){},bt.va=function(){},bt.ua=function(){},bt.Ra=function(){},gr.prototype.g=function(t,e){return new mr(t,e)},Ft(mr,Ve),mr.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;yn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=dr(t,null,t.V),Zs(t)},mr.prototype.close=function(){Js(this.g)},mr.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=He(t),t=n);e.i.push(new gs(e.ab++,t)),3==e.G&&Zs(e)},mr.prototype.M=function(){this.g.l=null,delete this.j,Js(this.g),delete this.g,mr.X.M.call(this)},Ft(yr,Cn),Ft(vr,kn),Ft(wr,pr),wr.prototype.xa=function(){Be(this.g,"a")},wr.prototype.wa=function(t){Be(this.g,new yr(t))},wr.prototype.va=function(t){Be(this.g,new vr)},wr.prototype.ua=function(){Be(this.g,"b")},gr.prototype.createWebChannel=gr.prototype.g,mr.prototype.send=mr.prototype.u,mr.prototype.open=mr.prototype.m,mr.prototype.close=mr.prototype.close,_n.NO_ERROR=0,_n.TIMEOUT=8,_n.HTTP_ERROR=6,Tn.COMPLETE="complete",Sn.EventType=An,An.OPEN="a",An.CLOSE="b",An.ERROR="c",An.MESSAGE="d",Ve.prototype.listen=Ve.prototype.N,Ms.prototype.listenOnce=Ms.prototype.O,Ms.prototype.getLastError=Ms.prototype.Oa,Ms.prototype.getLastErrorCode=Ms.prototype.Ea,Ms.prototype.getStatus=Ms.prototype.aa,Ms.prototype.getResponseJson=Ms.prototype.Sa,Ms.prototype.getResponseText=Ms.prototype.fa,Ms.prototype.send=Ms.prototype.da,Ms.prototype.setWithCredentials=Ms.prototype.Ka;var _r=_n,Tr=Tn,Ir=ln,Er=10,Sr=11,br=ks,Ar=Sn,Cr=Ms;const kr="@firebase/firestore";
316
316
  /**
317
317
  * @license
318
318
  * Copyright 2017 Google LLC
@@ -441,7 +441,7 @@ let Rr="9.15.0";
441
441
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
442
442
  * See the License for the specific language governing permissions and
443
443
  * limitations under the License.
444
- */class qr{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Kr{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Nr.UNAUTHENTICATED)))}shutdown(){}}class zr{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 Wr{constructor(t){this.t=t,this.currentUser=Nr.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const s=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let r=new Hr;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new Hr,t.enqueueRetryable((()=>s(this.currentUser)))};const i=()=>{const e=r;t.enqueueRetryable((async()=>{await e.promise,await s(this.currentUser)}))},o=t=>{Lr("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Lr("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Hr)}}),0),i()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Lr("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Fr("string"==typeof e.accessToken),new qr(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 Fr(null===t||"string"==typeof t),new Nr(t)}}class Gr{constructor(t,e,n,s){this.h=t,this.l=e,this.m=n,this.g=s,this.type="FirstParty",this.user=Nr.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Fr(!("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 $r{constructor(t,e,n,s){this.h=t,this.l=e,this.m=n,this.g=s}getToken(){return Promise.resolve(new Gr(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Nr.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Qr{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 Jr{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Lr("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,Lr("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const s=t=>{Lr("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>s(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?s(t):Lr("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Fr("string"==typeof t.token),this.A=t.token,new Qr(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
444
+ */class qr{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Kr{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Nr.UNAUTHENTICATED)))}shutdown(){}}class Wr{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 zr{constructor(t){this.t=t,this.currentUser=Nr.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const s=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let r=new Hr;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new Hr,t.enqueueRetryable((()=>s(this.currentUser)))};const i=()=>{const e=r;t.enqueueRetryable((async()=>{await e.promise,await s(this.currentUser)}))},o=t=>{Lr("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Lr("FirebaseAuthCredentialsProvider","Auth not yet detected"),r.resolve(),r=new Hr)}}),0),i()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Lr("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Fr("string"==typeof e.accessToken),new qr(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 Fr(null===t||"string"==typeof t),new Nr(t)}}class Gr{constructor(t,e,n,s){this.h=t,this.l=e,this.m=n,this.g=s,this.type="FirstParty",this.user=Nr.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Fr(!("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 $r{constructor(t,e,n,s){this.h=t,this.l=e,this.m=n,this.g=s}getToken(){return Promise.resolve(new Gr(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Nr.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Qr{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 Jr{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Lr("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,Lr("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const s=t=>{Lr("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>s(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?s(t):Lr("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Fr("string"==typeof t.token),this.A=t.token,new Qr(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
445
445
  /**
446
446
  * @license
447
447
  * Copyright 2020 Google LLC
@@ -731,7 +731,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
731
731
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
732
732
  * See the License for the specific language governing permissions and
733
733
  * limitations under the License.
734
- */(t)?9007199254740991:10:Ur()}function Li(t,e){if(t===e)return!0;const n=Oi(t);if(n!==Oi(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ri(t).isEqual(Ri(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=bi(t.timestampValue),s=bi(e.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Ci(t.bytesValue).isEqual(Ci(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ai(t.geoPointValue.latitude)===Ai(e.geoPointValue.latitude)&&Ai(t.geoPointValue.longitude)===Ai(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Ai(t.integerValue)===Ai(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Ai(t.doubleValue),s=Ai(e.doubleValue);return n===s?Ii(n)===Ii(s):isNaN(n)&&isNaN(s)}return!1}(t,e);case 9:return ti(t.arrayValue.values||[],e.arrayValue.values||[],Li);case 10:return function(t,e){const n=t.mapValue.fields||{},s=e.mapValue.fields||{};if(vi(n)!==vi(s))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===s[t]||!Li(n[t],s[t])))return!1;return!0}(t,e);default:return Ur()}}function Pi(t,e){return void 0!==(t.values||[]).find((t=>Li(t,e)))}function Mi(t,e){if(t===e)return 0;const n=Oi(t),s=Oi(e);if(n!==s)return Zr(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return Zr(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ai(t.integerValue||t.doubleValue),s=Ai(e.integerValue||e.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(t,e);case 3:return xi(t.timestampValue,e.timestampValue);case 4:return xi(Ri(t),Ri(e));case 5:return Zr(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Ci(t),s=Ci(e);return n.compareTo(s)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),s=e.split("/");for(let t=0;t<n.length&&t<s.length;t++){const e=Zr(n[t],s[t]);if(0!==e)return e}return Zr(n.length,s.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Zr(Ai(t.latitude),Ai(e.latitude));return 0!==n?n:Zr(Ai(t.longitude),Ai(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],s=e.values||[];for(let t=0;t<n.length&&t<s.length;++t){const e=Mi(n[t],s[t]);if(e)return e}return Zr(n.length,s.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Di&&e===Di)return 0;if(t===Di)return 1;if(e===Di)return-1;const n=t.fields||{},s=Object.keys(n),r=e.fields||{},i=Object.keys(r);s.sort(),i.sort();for(let t=0;t<s.length&&t<i.length;++t){const e=Zr(s[t],i[t]);if(0!==e)return e;const o=Mi(n[s[t]],r[i[t]]);if(0!==o)return o}return Zr(s.length,i.length)}(t.mapValue,e.mapValue);default:throw Ur()}}function xi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Zr(t,e);const n=bi(t),s=bi(e),r=Zr(n.seconds,s.seconds);return 0!==r?r:Zr(n.nanos,s.nanos)}function Ui(t){return Fi(t)}function Fi(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=bi(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Ci(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,ai.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const s of t.values||[])n?n=!1:e+=",",e+=Fi(s);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",s=!0;for(const r of e)s?s=!1:n+=",",n+=`${r}:${Fi(t.fields[r])}`;return n+"}"}(t.mapValue):Ur();var e,n}function Vi(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Bi(t){return!!t&&"integerValue"in t}function ji(t){return!!t&&"arrayValue"in t}function Hi(t){return!!t&&"nullValue"in t}function qi(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Ki(t){return!!t&&"mapValue"in t}function zi(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 wi(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=zi(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=zi(t.arrayValue.values[n]);return e}return Object.assign({},t)}class Wi{constructor(t,e){this.position=t,this.inclusive=e}}function Gi(t,e,n){let s=0;for(let r=0;r<t.position.length;r++){const i=e[r],o=t.position[r];if(s=i.field.isKeyField()?ai.comparator(ai.fromName(o.referenceValue),n.key):Mi(o,n.data.field(i.field)),"desc"===i.dir&&(s*=-1),0!==s)break}return s}function $i(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(!Li(t.position[n],e.position[n]))return!1;return!0}
734
+ */(t)?9007199254740991:10:Ur()}function Li(t,e){if(t===e)return!0;const n=Oi(t);if(n!==Oi(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ri(t).isEqual(Ri(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=bi(t.timestampValue),s=bi(e.timestampValue);return n.seconds===s.seconds&&n.nanos===s.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Ci(t.bytesValue).isEqual(Ci(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ai(t.geoPointValue.latitude)===Ai(e.geoPointValue.latitude)&&Ai(t.geoPointValue.longitude)===Ai(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Ai(t.integerValue)===Ai(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Ai(t.doubleValue),s=Ai(e.doubleValue);return n===s?Ii(n)===Ii(s):isNaN(n)&&isNaN(s)}return!1}(t,e);case 9:return ti(t.arrayValue.values||[],e.arrayValue.values||[],Li);case 10:return function(t,e){const n=t.mapValue.fields||{},s=e.mapValue.fields||{};if(vi(n)!==vi(s))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===s[t]||!Li(n[t],s[t])))return!1;return!0}(t,e);default:return Ur()}}function Pi(t,e){return void 0!==(t.values||[]).find((t=>Li(t,e)))}function Mi(t,e){if(t===e)return 0;const n=Oi(t),s=Oi(e);if(n!==s)return Zr(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return Zr(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ai(t.integerValue||t.doubleValue),s=Ai(e.integerValue||e.doubleValue);return n<s?-1:n>s?1:n===s?0:isNaN(n)?isNaN(s)?0:-1:1}(t,e);case 3:return xi(t.timestampValue,e.timestampValue);case 4:return xi(Ri(t),Ri(e));case 5:return Zr(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Ci(t),s=Ci(e);return n.compareTo(s)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),s=e.split("/");for(let t=0;t<n.length&&t<s.length;t++){const e=Zr(n[t],s[t]);if(0!==e)return e}return Zr(n.length,s.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Zr(Ai(t.latitude),Ai(e.latitude));return 0!==n?n:Zr(Ai(t.longitude),Ai(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],s=e.values||[];for(let t=0;t<n.length&&t<s.length;++t){const e=Mi(n[t],s[t]);if(e)return e}return Zr(n.length,s.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Di&&e===Di)return 0;if(t===Di)return 1;if(e===Di)return-1;const n=t.fields||{},s=Object.keys(n),r=e.fields||{},i=Object.keys(r);s.sort(),i.sort();for(let t=0;t<s.length&&t<i.length;++t){const e=Zr(s[t],i[t]);if(0!==e)return e;const o=Mi(n[s[t]],r[i[t]]);if(0!==o)return o}return Zr(s.length,i.length)}(t.mapValue,e.mapValue);default:throw Ur()}}function xi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Zr(t,e);const n=bi(t),s=bi(e),r=Zr(n.seconds,s.seconds);return 0!==r?r:Zr(n.nanos,s.nanos)}function Ui(t){return Fi(t)}function Fi(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=bi(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Ci(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,ai.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const s of t.values||[])n?n=!1:e+=",",e+=Fi(s);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",s=!0;for(const r of e)s?s=!1:n+=",",n+=`${r}:${Fi(t.fields[r])}`;return n+"}"}(t.mapValue):Ur();var e,n}function Vi(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Bi(t){return!!t&&"integerValue"in t}function ji(t){return!!t&&"arrayValue"in t}function Hi(t){return!!t&&"nullValue"in t}function qi(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Ki(t){return!!t&&"mapValue"in t}function Wi(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 wi(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Wi(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Wi(t.arrayValue.values[n]);return e}return Object.assign({},t)}class zi{constructor(t,e){this.position=t,this.inclusive=e}}function Gi(t,e,n){let s=0;for(let r=0;r<t.position.length;r++){const i=e[r],o=t.position[r];if(s=i.field.isKeyField()?ai.comparator(ai.fromName(o.referenceValue),n.key):Mi(o,n.data.field(i.field)),"desc"===i.dir&&(s*=-1),0!==s)break}return s}function $i(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(!Li(t.position[n],e.position[n]))return!1;return!0}
735
735
  /**
736
736
  * @license
737
737
  * Copyright 2022 Google LLC
@@ -828,7 +828,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
828
828
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
829
829
  * See the License for the specific language governing permissions and
830
830
  * limitations under the License.
831
- */class _o{constructor(t){this.value=t}static empty(){return new _o({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)],!Ki(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=zi(e)}setAll(t){let e=oi.emptyPath(),n={},s=[];t.forEach(((t,r)=>{if(!e.isImmediateParentOf(r)){const t=this.getFieldsMap(e);this.applyChanges(t,n,s),n={},s=[],e=r.popLast()}t?n[r.lastSegment()]=zi(t):s.push(r.lastSegment())}));const r=this.getFieldsMap(e);this.applyChanges(r,n,s)}delete(t){const e=this.field(t.popLast());Ki(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Li(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 s=e.mapValue.fields[t.get(n)];Ki(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=s),e=s}return e.mapValue.fields}applyChanges(t,e,n){wi(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new _o(zi(this.value))}}
831
+ */class _o{constructor(t){this.value=t}static empty(){return new _o({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)],!Ki(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Wi(e)}setAll(t){let e=oi.emptyPath(),n={},s=[];t.forEach(((t,r)=>{if(!e.isImmediateParentOf(r)){const t=this.getFieldsMap(e);this.applyChanges(t,n,s),n={},s=[],e=r.popLast()}t?n[r.lastSegment()]=Wi(t):s.push(r.lastSegment())}));const r=this.getFieldsMap(e);this.applyChanges(r,n,s)}delete(t){const e=this.field(t.popLast());Ki(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Li(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 s=e.mapValue.fields[t.get(n)];Ki(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=s),e=s}return e.mapValue.fields}applyChanges(t,e,n){wi(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new _o(Wi(this.value))}}
832
832
  /**
833
833
  * @license
834
834
  * Copyright 2017 Google LLC
@@ -876,7 +876,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
876
876
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
877
877
  * See the License for the specific language governing permissions and
878
878
  * limitations under the License.
879
- */class Co{constructor(t,e=null,n=[],s=[],r=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=s,this.limit=r,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function ko(t){return new Co(t)}function No(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 Ro(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Do(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Oo(t){return null!==t.collectionGroup}function Lo(t){const e=Vr(t);if(null===e.dt){e.dt=[];const t=Do(e),n=Ro(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new lo(t)),e.dt.push(new lo(oi.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 lo(oi.keyField(),t))}}}return e.dt}function Po(t){const e=Vr(t);if(!e._t)if("F"===e.limitType)e._t=Eo(e.path,e.collectionGroup,Lo(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Lo(e)){const e="desc"===n.dir?"asc":"desc";t.push(new lo(n.field,e))}const n=e.endAt?new Wi(e.endAt.position,e.endAt.inclusive):null,s=e.startAt?new Wi(e.startAt.position,e.startAt.inclusive):null;e._t=Eo(e.path,e.collectionGroup,t,e.filters,e.limit,n,s)}return e._t}function Mo(t,e){e.getFirstInequalityField(),Do(t);const n=t.filters.concat([e]);return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function xo(t,e,n){return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Uo(t,e){return bo(Po(t),Po(e))&&t.limitType===e.limitType}function Fo(t){return`${So(Po(t))}|lt:${t.limitType}`}function Vo(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=>no(t))).join(", ")}]`),Ti(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=>Ui(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Ui(t))).join(",")),`Target(${e})`}(Po(t))}; limitType=${t.limitType})`}function Bo(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):ai.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Lo(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 s=Gi(t,e,n);return t.inclusive?s<=0:s<0}(t.startAt,Lo(t),e))&&!(t.endAt&&!function(t,e,n){const s=Gi(t,e,n);return t.inclusive?s>=0:s>0}(t.endAt,Lo(t),e))}(t,e)}function jo(t){return(e,n)=>{let s=!1;for(const r of Lo(t)){const t=Ho(r,e,n);if(0!==t)return t;s=s||r.field.isKeyField()}return 0}}function Ho(t,e,n){const s=t.field.isKeyField()?ai.comparator(e.key,n.key):function(t,e,n){const s=e.data.field(t),r=n.data.field(t);return null!==s&&null!==r?Mi(s,r):Ur()}(t.field,e,n);switch(t.dir){case"asc":return s;case"desc":return-1*s;default:return Ur()}}
879
+ */class Co{constructor(t,e=null,n=[],s=[],r=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=s,this.limit=r,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function ko(t){return new Co(t)}function No(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 Ro(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Do(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Oo(t){return null!==t.collectionGroup}function Lo(t){const e=Vr(t);if(null===e.dt){e.dt=[];const t=Do(e),n=Ro(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new lo(t)),e.dt.push(new lo(oi.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 lo(oi.keyField(),t))}}}return e.dt}function Po(t){const e=Vr(t);if(!e._t)if("F"===e.limitType)e._t=Eo(e.path,e.collectionGroup,Lo(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Lo(e)){const e="desc"===n.dir?"asc":"desc";t.push(new lo(n.field,e))}const n=e.endAt?new zi(e.endAt.position,e.endAt.inclusive):null,s=e.startAt?new zi(e.startAt.position,e.startAt.inclusive):null;e._t=Eo(e.path,e.collectionGroup,t,e.filters,e.limit,n,s)}return e._t}function Mo(t,e){e.getFirstInequalityField(),Do(t);const n=t.filters.concat([e]);return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function xo(t,e,n){return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Uo(t,e){return bo(Po(t),Po(e))&&t.limitType===e.limitType}function Fo(t){return`${So(Po(t))}|lt:${t.limitType}`}function Vo(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=>no(t))).join(", ")}]`),Ti(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=>Ui(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Ui(t))).join(",")),`Target(${e})`}(Po(t))}; limitType=${t.limitType})`}function Bo(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):ai.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Lo(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 s=Gi(t,e,n);return t.inclusive?s<=0:s<0}(t.startAt,Lo(t),e))&&!(t.endAt&&!function(t,e,n){const s=Gi(t,e,n);return t.inclusive?s>=0:s>0}(t.endAt,Lo(t),e))}(t,e)}function jo(t){return(e,n)=>{let s=!1;for(const r of Lo(t)){const t=Ho(r,e,n);if(0!==t)return t;s=s||r.field.isKeyField()}return 0}}function Ho(t,e,n){const s=t.field.isKeyField()?ai.comparator(e.key,n.key):function(t,e,n){const s=e.data.field(t),r=n.data.field(t);return null!==s&&null!==r?Mi(s,r):Ur()}(t.field,e,n);switch(t.dir){case"asc":return s;case"desc":return-1*s;default:return Ur()}}
880
880
  /**
881
881
  * @license
882
882
  * Copyright 2020 Google LLC
@@ -892,7 +892,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
892
892
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
893
893
  * See the License for the specific language governing permissions and
894
894
  * limitations under the License.
895
- */function qo(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:Ii(e)?"-0":e}}function Ko(t){return{integerValue:""+t}}function zo(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!Ii(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Ko(e):qo(t,e)}
895
+ */function qo(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:Ii(e)?"-0":e}}function Ko(t){return{integerValue:""+t}}function Wo(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!Ii(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Ko(e):qo(t,e)}
896
896
  /**
897
897
  * @license
898
898
  * Copyright 2018 Google LLC
@@ -908,7 +908,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
908
908
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
909
909
  * See the License for the specific language governing permissions and
910
910
  * limitations under the License.
911
- */class Wo{constructor(){this._=void 0}}function Go(t,e,n){return t instanceof Qo?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 Jo?Yo(t,e):t instanceof Xo?Zo(t,e):function(t,e){const n=function(t,e){return t instanceof ta?Bi(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),s=ea(n)+ea(t.gt);return Bi(n)&&Bi(t.gt)?Ko(s):qo(t.yt,s)}(t,e)}function $o(t,e,n){return t instanceof Jo?Yo(t,e):t instanceof Xo?Zo(t,e):n}class Qo extends Wo{}class Jo extends Wo{constructor(t){super(),this.elements=t}}function Yo(t,e){const n=na(e);for(const e of t.elements)n.some((t=>Li(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Xo extends Wo{constructor(t){super(),this.elements=t}}function Zo(t,e){let n=na(e);for(const e of t.elements)n=n.filter((t=>!Li(t,e)));return{arrayValue:{values:n}}}class ta extends Wo{constructor(t,e){super(),this.yt=t,this.gt=e}}function ea(t){return Ai(t.integerValue||t.doubleValue)}function na(t){return ji(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class sa{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new sa}static exists(t){return new sa(void 0,t)}static updateTime(t){return new sa(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 ra(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ia{}function oa(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new ga(t.key,sa.none()):new ha(t.key,t.data,sa.none());{const n=t.data,s=_o.empty();let r=new yo(oi.comparator);for(let t of e.fields)if(!r.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?s.delete(t):s.set(t,e),r=r.add(t)}return new la(t.key,s,new wo(r.toArray()),sa.none())}}function aa(t,e,n){t instanceof ha?function(t,e,n){const s=t.value.clone(),r=fa(t.fieldTransforms,e,n.transformResults);s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):t instanceof la?function(t,e,n){if(!ra(t.precondition,e))return void e.convertToUnknownDocument(n.version);const s=fa(t.fieldTransforms,e,n.transformResults),r=e.data;r.setAll(da(t)),r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ca(t,e,n,s){return t instanceof ha?function(t,e,n,s){if(!ra(t.precondition,e))return n;const r=t.value.clone(),i=pa(t.fieldTransforms,s,e);return r.setAll(i),e.convertToFoundDocument(e.version,r).setHasLocalMutations(),null}(t,e,n,s):t instanceof la?function(t,e,n,s){if(!ra(t.precondition,e))return n;const r=pa(t.fieldTransforms,s,e),i=e.data;return i.setAll(da(t)),i.setAll(r),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,s):function(t,e,n){return ra(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ua(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)&&ti(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Jo&&e instanceof Jo||t instanceof Xo&&e instanceof Xo?ti(t.elements,e.elements,Li):t instanceof ta&&e instanceof ta?Li(t.gt,e.gt):t instanceof Qo&&e instanceof Qo}(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 ha extends ia{constructor(t,e,n,s=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class la extends ia{constructor(t,e,n,s,r=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=s,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function da(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const s=t.data.field(n);e.set(n,s)}})),e}function fa(t,e,n){const s=new Map;Fr(t.length===n.length);for(let r=0;r<n.length;r++){const i=t[r],o=i.transform,a=e.data.field(i.field);s.set(i.field,$o(o,a,n[r]))}return s}function pa(t,e,n){const s=new Map;for(const r of t){const t=r.transform,i=n.data.field(r.field);s.set(r.field,Go(t,i,e))}return s}class ga extends ia{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
911
+ */class zo{constructor(){this._=void 0}}function Go(t,e,n){return t instanceof Qo?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 Jo?Yo(t,e):t instanceof Xo?Zo(t,e):function(t,e){const n=function(t,e){return t instanceof ta?Bi(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),s=ea(n)+ea(t.gt);return Bi(n)&&Bi(t.gt)?Ko(s):qo(t.yt,s)}(t,e)}function $o(t,e,n){return t instanceof Jo?Yo(t,e):t instanceof Xo?Zo(t,e):n}class Qo extends zo{}class Jo extends zo{constructor(t){super(),this.elements=t}}function Yo(t,e){const n=na(e);for(const e of t.elements)n.some((t=>Li(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Xo extends zo{constructor(t){super(),this.elements=t}}function Zo(t,e){let n=na(e);for(const e of t.elements)n=n.filter((t=>!Li(t,e)));return{arrayValue:{values:n}}}class ta extends zo{constructor(t,e){super(),this.yt=t,this.gt=e}}function ea(t){return Ai(t.integerValue||t.doubleValue)}function na(t){return ji(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class sa{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new sa}static exists(t){return new sa(void 0,t)}static updateTime(t){return new sa(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 ra(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ia{}function oa(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new ga(t.key,sa.none()):new ha(t.key,t.data,sa.none());{const n=t.data,s=_o.empty();let r=new yo(oi.comparator);for(let t of e.fields)if(!r.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?s.delete(t):s.set(t,e),r=r.add(t)}return new la(t.key,s,new wo(r.toArray()),sa.none())}}function aa(t,e,n){t instanceof ha?function(t,e,n){const s=t.value.clone(),r=fa(t.fieldTransforms,e,n.transformResults);s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):t instanceof la?function(t,e,n){if(!ra(t.precondition,e))return void e.convertToUnknownDocument(n.version);const s=fa(t.fieldTransforms,e,n.transformResults),r=e.data;r.setAll(da(t)),r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ca(t,e,n,s){return t instanceof ha?function(t,e,n,s){if(!ra(t.precondition,e))return n;const r=t.value.clone(),i=pa(t.fieldTransforms,s,e);return r.setAll(i),e.convertToFoundDocument(e.version,r).setHasLocalMutations(),null}(t,e,n,s):t instanceof la?function(t,e,n,s){if(!ra(t.precondition,e))return n;const r=pa(t.fieldTransforms,s,e),i=e.data;return i.setAll(da(t)),i.setAll(r),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,s):function(t,e,n){return ra(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ua(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)&&ti(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Jo&&e instanceof Jo||t instanceof Xo&&e instanceof Xo?ti(t.elements,e.elements,Li):t instanceof ta&&e instanceof ta?Li(t.gt,e.gt):t instanceof Qo&&e instanceof Qo}(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 ha extends ia{constructor(t,e,n,s=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class la extends ia{constructor(t,e,n,s,r=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=s,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function da(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const s=t.data.field(n);e.set(n,s)}})),e}function fa(t,e,n){const s=new Map;Fr(t.length===n.length);for(let r=0;r<n.length;r++){const i=t[r],o=i.transform,a=e.data.field(i.field);s.set(i.field,$o(o,a,n[r]))}return s}function pa(t,e,n){const s=new Map;for(const r of t){const t=r.transform,i=n.data.field(r.field);s.set(r.field,Go(t,i,e))}return s}class ga extends ia{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
912
912
  /**
913
913
  * @license
914
914
  * Copyright 2017 Google LLC
@@ -1021,7 +1021,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1021
1021
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1022
1022
  * See the License for the specific language governing permissions and
1023
1023
  * limitations under the License.
1024
- */const Ha={asc:"ASCENDING",desc:"DESCENDING"},qa={"<":"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"},Ka={and:"AND",or:"OR"};class za{constructor(t,e){this.databaseId=t,this.wt=e}}function Wa(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 Ga(t,e){return t.wt?e.toBase64():e.toUint8Array()}function $a(t){return Fr(!!t),ni.fromTimestamp(function(t){const e=bi(t);return new ei(e.seconds,e.nanos)}(t))}function Qa(t,e){return function(t){return new ri(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Ja(t){const e=ri.fromString(t);return Fr(lc(e)),e}function Ya(t,e){const n=Ja(e);if(n.get(1)!==t.databaseId.projectId)throw new jr(Br.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 jr(Br.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ai(tc(n))}function Xa(t,e){return Qa(t.databaseId,e)}function Za(t){return new ri(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function tc(t){return Fr(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function ec(t,e){return{documents:[Xa(t,e.path)]}}function nc(t,e){const n={structuredQuery:{}},s=e.path;null!==e.collectionGroup?(n.parent=Xa(t,s),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xa(t,s.popLast()),n.structuredQuery.from=[{collectionId:s.lastSegment()}]);const r=function(t){if(0!==t.length)return hc(Yi.create(t,"and"))}(e.filters);r&&(n.structuredQuery.where=r);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:cc(t.field),direction:ic(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||Ti(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 sc(t){let e=function(t){const e=Ja(t);return 4===e.length?ri.emptyPath():tc(e)}(t.parent);const n=t.structuredQuery,s=n.from?n.from.length:0;let r=null;if(s>0){Fr(1===s);const t=n.from[0];t.allDescendants?r=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=rc(t);return e instanceof Yi&&Zi(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new lo(uc(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,Ti(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Wi(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new Wi(n,e)}(n.endAt)),function(t,e,n,s,r,i,o,a){return new Co(t,e,n,s,r,i,o,a)}(e,r,o,i,a,"F",c,u)}function rc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=uc(t.unaryFilter.field);return Ji.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=uc(t.unaryFilter.field);return Ji.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=uc(t.unaryFilter.field);return Ji.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=uc(t.unaryFilter.field);return Ji.create(r,"!=",{nullValue:"NULL_VALUE"});default:return Ur()}}(t):void 0!==t.fieldFilter?function(t){return Ji.create(uc(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 Ur()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Yi.create(t.compositeFilter.filters.map((t=>rc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Ur()}}(t.compositeFilter.op))}(t):Ur()}function ic(t){return Ha[t]}function oc(t){return qa[t]}function ac(t){return Ka[t]}function cc(t){return{fieldPath:t.canonicalString()}}function uc(t){return oi.fromServerFormat(t.fieldPath)}function hc(t){return t instanceof Ji?function(t){if("=="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NAN"}};if(Hi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NAN"}};if(Hi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:cc(t.field),op:oc(t.op),value:t.value}}}(t):t instanceof Yi?function(t){const e=t.getFilters().map((t=>hc(t)));return 1===e.length?e[0]:{compositeFilter:{op:ac(t.op),filters:e}}}(t):Ur()}function lc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1024
+ */const Ha={asc:"ASCENDING",desc:"DESCENDING"},qa={"<":"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"},Ka={and:"AND",or:"OR"};class Wa{constructor(t,e){this.databaseId=t,this.wt=e}}function za(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 Ga(t,e){return t.wt?e.toBase64():e.toUint8Array()}function $a(t){return Fr(!!t),ni.fromTimestamp(function(t){const e=bi(t);return new ei(e.seconds,e.nanos)}(t))}function Qa(t,e){return function(t){return new ri(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Ja(t){const e=ri.fromString(t);return Fr(lc(e)),e}function Ya(t,e){const n=Ja(e);if(n.get(1)!==t.databaseId.projectId)throw new jr(Br.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 jr(Br.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ai(tc(n))}function Xa(t,e){return Qa(t.databaseId,e)}function Za(t){return new ri(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function tc(t){return Fr(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function ec(t,e){return{documents:[Xa(t,e.path)]}}function nc(t,e){const n={structuredQuery:{}},s=e.path;null!==e.collectionGroup?(n.parent=Xa(t,s),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xa(t,s.popLast()),n.structuredQuery.from=[{collectionId:s.lastSegment()}]);const r=function(t){if(0!==t.length)return hc(Yi.create(t,"and"))}(e.filters);r&&(n.structuredQuery.where=r);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:cc(t.field),direction:ic(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||Ti(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 sc(t){let e=function(t){const e=Ja(t);return 4===e.length?ri.emptyPath():tc(e)}(t.parent);const n=t.structuredQuery,s=n.from?n.from.length:0;let r=null;if(s>0){Fr(1===s);const t=n.from[0];t.allDescendants?r=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=rc(t);return e instanceof Yi&&Zi(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new lo(uc(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,Ti(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new zi(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new zi(n,e)}(n.endAt)),function(t,e,n,s,r,i,o,a){return new Co(t,e,n,s,r,i,o,a)}(e,r,o,i,a,"F",c,u)}function rc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=uc(t.unaryFilter.field);return Ji.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=uc(t.unaryFilter.field);return Ji.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=uc(t.unaryFilter.field);return Ji.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=uc(t.unaryFilter.field);return Ji.create(r,"!=",{nullValue:"NULL_VALUE"});default:return Ur()}}(t):void 0!==t.fieldFilter?function(t){return Ji.create(uc(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 Ur()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Yi.create(t.compositeFilter.filters.map((t=>rc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Ur()}}(t.compositeFilter.op))}(t):Ur()}function ic(t){return Ha[t]}function oc(t){return qa[t]}function ac(t){return Ka[t]}function cc(t){return{fieldPath:t.canonicalString()}}function uc(t){return oi.fromServerFormat(t.fieldPath)}function hc(t){return t instanceof Ji?function(t){if("=="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NAN"}};if(Hi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NAN"}};if(Hi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:cc(t.field),op:oc(t.op),value:t.value}}}(t):t instanceof Yi?function(t){const e=t.getFilters().map((t=>hc(t)));return 1===e.length?e[0]:{compositeFilter:{op:ac(t.op),filters:e}}}(t):Ur()}function lc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1025
1025
  /**
1026
1026
  * @license
1027
1027
  * Copyright 2017 Google LLC
@@ -1373,7 +1373,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1373
1373
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1374
1374
  * See the License for the specific language governing permissions and
1375
1375
  * limitations under the License.
1376
- */class zc{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(){Lr("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Lr("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}}
1376
+ */class Wc{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(){Lr("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Lr("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}}
1377
1377
  /**
1378
1378
  * @license
1379
1379
  * Copyright 2020 Google LLC
@@ -1389,7 +1389,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1389
1389
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1390
1390
  * See the License for the specific language governing permissions and
1391
1391
  * limitations under the License.
1392
- */const Wc={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1392
+ */const zc={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1393
1393
  /**
1394
1394
  * @license
1395
1395
  * Copyright 2017 Google LLC
@@ -1421,7 +1421,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1421
1421
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1422
1422
  * See the License for the specific language governing permissions and
1423
1423
  * limitations under the License.
1424
- */class $c 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,s,r){const i=this.ho(t,e);Lr("RestConnection","Sending: ",i,n);const o={};return this.lo(o,s,r),this.fo(t,i,o,n).then((t=>(Lr("RestConnection","Received: ",t),t)),(e=>{throw Mr("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,s,r,i){return this.ao(t,e,n,s,r)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Rr,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=Wc[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,s){return new Promise(((r,i)=>{const o=new Cr;o.setWithCredentials(!0),o.listenOnce(Tr.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case _r.NO_ERROR:const e=o.getResponseJson();Lr("Connection","XHR received:",JSON.stringify(e)),r(e);break;case _r.TIMEOUT:Lr("Connection",'RPC "'+t+'" timed out'),i(new jr(Br.DEADLINE_EXCEEDED,"Request time out"));break;case _r.HTTP_ERROR:const n=o.getStatus();if(Lr("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(Br).indexOf(e)>=0?e:Br.UNKNOWN}(e.status);i(new jr(t,e.message))}else i(new jr(Br.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new jr(Br.UNAVAILABLE,"Connection failed."));break;default:Ur()}}finally{Lr("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(s);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const s=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new gr,i=fn(),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 br({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=s.join("");Lr("Connection","Creating WebChannel: "+a,o);const c=r.createWebChannel(a,o);let u=!1,h=!1;const l=new Gc({Hr:t=>{h?Lr("Connection","Not sending because WebChannel is closed:",t):(u||(Lr("Connection","Opening WebChannel transport."),c.open(),u=!0),Lr("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,Ar.EventType.OPEN,(()=>{h||Lr("Connection","WebChannel transport opened.")})),d(c,Ar.EventType.CLOSE,(()=>{h||(h=!0,Lr("Connection","WebChannel transport closed"),l.io())})),d(c,Ar.EventType.ERROR,(t=>{h||(h=!0,Mr("Connection","WebChannel transport errored:",t),l.io(new jr(Br.UNAVAILABLE,"The operation could not be completed")))})),d(c,Ar.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Fr(!!n);const s=n,r=s.error||(null===(e=s[0])||void 0===e?void 0:e.error);if(r){Lr("Connection","WebChannel received error:",r);const t=r.status;let e=function(t){const e=ya[t];if(void 0!==e)return wa(e)}(t),n=r.message;void 0===e&&(e=Br.INTERNAL,n="Unknown error status: "+t+" with message "+r.message),h=!0,l.io(new jr(e,n)),c.close()}else Lr("Connection","WebChannel received:",n),l.ro(n)}})),d(i,Ir.STAT_EVENT,(t=>{t.stat===Er?Lr("Connection","Detected buffering proxy"):t.stat===Sr&&Lr("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Qc(){return"undefined"!=typeof document?document:null}
1424
+ */class $c 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,s,r){const i=this.ho(t,e);Lr("RestConnection","Sending: ",i,n);const o={};return this.lo(o,s,r),this.fo(t,i,o,n).then((t=>(Lr("RestConnection","Received: ",t),t)),(e=>{throw Mr("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,s,r,i){return this.ao(t,e,n,s,r)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Rr,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=zc[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,s){return new Promise(((r,i)=>{const o=new Cr;o.setWithCredentials(!0),o.listenOnce(Tr.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case _r.NO_ERROR:const e=o.getResponseJson();Lr("Connection","XHR received:",JSON.stringify(e)),r(e);break;case _r.TIMEOUT:Lr("Connection",'RPC "'+t+'" timed out'),i(new jr(Br.DEADLINE_EXCEEDED,"Request time out"));break;case _r.HTTP_ERROR:const n=o.getStatus();if(Lr("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(Br).indexOf(e)>=0?e:Br.UNKNOWN}(e.status);i(new jr(t,e.message))}else i(new jr(Br.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new jr(Br.UNAVAILABLE,"Connection failed."));break;default:Ur()}}finally{Lr("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(s);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const s=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new gr,i=fn(),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 br({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=s.join("");Lr("Connection","Creating WebChannel: "+a,o);const c=r.createWebChannel(a,o);let u=!1,h=!1;const l=new Gc({Hr:t=>{h?Lr("Connection","Not sending because WebChannel is closed:",t):(u||(Lr("Connection","Opening WebChannel transport."),c.open(),u=!0),Lr("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,Ar.EventType.OPEN,(()=>{h||Lr("Connection","WebChannel transport opened.")})),d(c,Ar.EventType.CLOSE,(()=>{h||(h=!0,Lr("Connection","WebChannel transport closed"),l.io())})),d(c,Ar.EventType.ERROR,(t=>{h||(h=!0,Mr("Connection","WebChannel transport errored:",t),l.io(new jr(Br.UNAVAILABLE,"The operation could not be completed")))})),d(c,Ar.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Fr(!!n);const s=n,r=s.error||(null===(e=s[0])||void 0===e?void 0:e.error);if(r){Lr("Connection","WebChannel received error:",r);const t=r.status;let e=function(t){const e=ya[t];if(void 0!==e)return wa(e)}(t),n=r.message;void 0===e&&(e=Br.INTERNAL,n="Unknown error status: "+t+" with message "+r.message),h=!0,l.io(new jr(e,n)),c.close()}else Lr("Connection","WebChannel received:",n),l.ro(n)}})),d(i,Ir.STAT_EVENT,(t=>{t.stat===Er?Lr("Connection","Detected buffering proxy"):t.stat===Sr&&Lr("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Qc(){return"undefined"!=typeof document?document:null}
1425
1425
  /**
1426
1426
  * @license
1427
1427
  * Copyright 2020 Google LLC
@@ -1437,7 +1437,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1437
1437
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1438
1438
  * See the License for the specific language governing permissions and
1439
1439
  * limitations under the License.
1440
- */function Jc(t){return new za(t,!0)}class Yc{constructor(t,e,n=1e3,s=1.5,r=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=s,this.po=r,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),s=Math.max(0,e-n);s>0&&Lr("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,s,(()=>(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}}
1440
+ */function Jc(t){return new Wa(t,!0)}class Yc{constructor(t,e,n=1e3,s=1.5,r=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=s,this.po=r,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),s=Math.max(0,e-n);s>0&&Lr("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,s,(()=>(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}}
1441
1441
  /**
1442
1442
  * @license
1443
1443
  * Copyright 2017 Google LLC
@@ -1453,7 +1453,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1453
1453
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1454
1454
  * See the License for the specific language governing permissions and
1455
1455
  * limitations under the License.
1456
- */class Xc{constructor(t,e,n,s,r,i,o,a){this.Hs=t,this.vo=n,this.Vo=s,this.connection=r,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new Yc(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===Br.RESOURCE_EXHAUSTED?(Pr(e.toString()),Pr("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Br.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 jr(Br.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 Lr("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Lr("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Zc extends Xc{constructor(t,e,n,s,r,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,s,i),this.yt=r}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const s=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Ur()}(e.targetChange.targetChangeType||"NO_CHANGE"),r=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Fr(void 0===e||"string"==typeof e),Ei.fromBase64String(e||"")):(Fr(void 0===e||e instanceof Uint8Array),Ei.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Br.UNKNOWN:wa(t.code);return new jr(e,t.message||"")}(o);n=new Ua(s,r,i,a||null)}else if("documentChange"in e){e.documentChange;const s=e.documentChange;s.document,s.document.name,s.document.updateTime;const r=Ya(t,s.document.name),i=$a(s.document.updateTime),o=s.document.createTime?$a(s.document.createTime):ni.min(),a=new _o({mapValue:{fields:s.document.fields}}),c=To.newFoundDocument(r,i,o,a),u=s.targetIds||[],h=s.removedTargetIds||[];n=new Ma(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const s=e.documentDelete;s.document;const r=Ya(t,s.document),i=s.readTime?$a(s.readTime):ni.min(),o=To.newNoDocument(r,i),a=s.removedTargetIds||[];n=new Ma([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const s=e.documentRemove;s.document;const r=Ya(t,s.document),i=s.removedTargetIds||[];n=new Ma([],i,r,null)}else{if(!("filter"in e))return Ur();{e.filter;const t=e.filter;t.targetId;const s=t.count||0,r=new ma(s),i=t.targetId;n=new xa(i,r)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return ni.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?ni.min():e.readTime?$a(e.readTime):ni.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Za(this.yt),e.addTarget=function(t,e){let n;const s=e.target;return n=Ao(s)?{documents:ec(t,s)}:{query:nc(t,s)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Ga(t,e.resumeToken):e.snapshotVersion.compareTo(ni.min())>0&&(n.readTime=Wa(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 Ur()}}(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=Za(this.yt),e.removeTarget=t,this.Bo(e)}}
1456
+ */class Xc{constructor(t,e,n,s,r,i,o,a){this.Hs=t,this.vo=n,this.Vo=s,this.connection=r,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new Yc(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===Br.RESOURCE_EXHAUSTED?(Pr(e.toString()),Pr("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Br.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 jr(Br.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 Lr("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Lr("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Zc extends Xc{constructor(t,e,n,s,r,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,s,i),this.yt=r}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const s=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Ur()}(e.targetChange.targetChangeType||"NO_CHANGE"),r=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Fr(void 0===e||"string"==typeof e),Ei.fromBase64String(e||"")):(Fr(void 0===e||e instanceof Uint8Array),Ei.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Br.UNKNOWN:wa(t.code);return new jr(e,t.message||"")}(o);n=new Ua(s,r,i,a||null)}else if("documentChange"in e){e.documentChange;const s=e.documentChange;s.document,s.document.name,s.document.updateTime;const r=Ya(t,s.document.name),i=$a(s.document.updateTime),o=s.document.createTime?$a(s.document.createTime):ni.min(),a=new _o({mapValue:{fields:s.document.fields}}),c=To.newFoundDocument(r,i,o,a),u=s.targetIds||[],h=s.removedTargetIds||[];n=new Ma(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const s=e.documentDelete;s.document;const r=Ya(t,s.document),i=s.readTime?$a(s.readTime):ni.min(),o=To.newNoDocument(r,i),a=s.removedTargetIds||[];n=new Ma([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const s=e.documentRemove;s.document;const r=Ya(t,s.document),i=s.removedTargetIds||[];n=new Ma([],i,r,null)}else{if(!("filter"in e))return Ur();{e.filter;const t=e.filter;t.targetId;const s=t.count||0,r=new ma(s),i=t.targetId;n=new xa(i,r)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return ni.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?ni.min():e.readTime?$a(e.readTime):ni.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Za(this.yt),e.addTarget=function(t,e){let n;const s=e.target;return n=Ao(s)?{documents:ec(t,s)}:{query:nc(t,s)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Ga(t,e.resumeToken):e.snapshotVersion.compareTo(ni.min())>0&&(n.readTime=za(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 Ur()}}(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=Za(this.yt),e.removeTarget=t,this.Bo(e)}}
1457
1457
  /**
1458
1458
  * @license
1459
1459
  * Copyright 2017 Google LLC
@@ -1597,7 +1597,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1597
1597
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1598
1598
  * See the License for the specific language governing permissions and
1599
1599
  * limitations under the License.
1600
- */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==r.length||a?{snapshot:new Eu(this.query,t.Qu,s,r,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Iu,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=Ra(),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 Lu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Ou(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Ra();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Eu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Mu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class xu{constructor(t){this.key=t,this.nc=!1}}class Uu{constructor(t,e,n,s,r,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=s,this.currentUser=r,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new _a((t=>Fo(t)),Uo),this.rc=new Map,this.oc=new Set,this.uc=new po(ai.comparator),this.cc=new Map,this.ac=new bc,this.hc={},this.lc=new Map,this.fc=wc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function Fu(t,e){const n=function(t){const e=Vr(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ju.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Hu.bind(null,e),e.sc.Wo=ku.bind(null,e.eventManager),e.sc.wc=Nu.bind(null,e.eventManager),e}(t);let s,r;const i=n.ic.get(e);if(i)s=i.targetId,n.sharedClientState.addLocalQueryTarget(s),r=i.view.ec();else{const t=await function(t,e){const n=Vr(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let s;return n.Cs.getTargetData(t,e).next((r=>r?(s=r,fi.resolve(s)):n.Cs.allocateTargetId(t).next((r=>(s=new pc(e,r,0,t.currentSequenceNumber),n.Cs.addTargetData(t,s).next((()=>s)))))))})).then((t=>{const s=n.qi.get(t.targetId);return(null===s||t.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Po(e));n.isPrimaryClient&&iu(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);s=t.targetId,r=await async function(t,e,n,s,r){t._c=(e,n,s)=>async function(t,e,n,s){let r=e.view.Wu(n);r.$i&&(r=await jc(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,r))));const i=s&&s.targetChanges.get(e.targetId),o=e.view.applyChanges(r,t.isPrimaryClient,i);return zu(t,e.targetId,o.Xu),o.snapshot}(t,e,n,s);const i=await jc(t.localStore,e,!0),o=new Pu(e,i.Hi),a=o.Wu(i.documents),c=Pa.createSynthesizedTargetChangeForCurrentChange(n,s&&"Offline"!==t.onlineState,r),u=o.applyChanges(a,t.isPrimaryClient,c);zu(t,n,u.Xu);const h=new Mu(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,s,"current"===i,t.resumeToken)}return r}async function Vu(t,e){const n=Vr(t),s=n.ic.get(e),r=n.rc.get(s.targetId);if(r.length>1)return n.rc.set(s.targetId,r.filter((t=>!Uo(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await Bc(n.localStore,s.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(s.targetId),ou(n.remoteStore,s.targetId),qu(n,s.targetId)})).catch(di)):(qu(n,s.targetId),await Bc(n.localStore,s.targetId,!0))}async function Bu(t,e){const n=Vr(t);try{const t=await Vc(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const s=n.cc.get(e);s&&(Fr(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?s.nc=!0:t.modifiedDocuments.size>0?Fr(s.nc):t.removedDocuments.size>0&&(Fr(s.nc),s.nc=!1))})),await $u(n,t,e)}catch(t){await di(t)}}function ju(t,e,n){const s=Vr(t);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const t=[];s.ic.forEach(((n,s)=>{const r=s.view.bu(e);r.snapshot&&t.push(r.snapshot)})),function(t,e){const n=Vr(t);n.onlineState=e;let s=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(s=!0)})),s&&Ru(n)}(s.eventManager,e),t.length&&s.sc.Wo(t),s.onlineState=e,s.isPrimaryClient&&s.sharedClientState.setOnlineState(e)}}async function Hu(t,e,n){const s=Vr(t);s.sharedClientState.updateQueryState(e,"rejected",n);const r=s.cc.get(e),i=r&&r.key;if(i){let t=new po(ai.comparator);t=t.insert(i,To.newNoDocument(i,ni.min()));const n=Ra().add(i),r=new La(ni.min(),new Map,new yo(Zr),t,n);await Bu(s,r),s.uc=s.uc.remove(i),s.cc.delete(e),Gu(s)}else await Bc(s.localStore,e,!1).then((()=>qu(s,e,n))).catch(di)}function qu(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const s of t.rc.get(e))t.ic.delete(s),n&&t.sc.wc(s,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||Ku(t,e)}))}function Ku(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ou(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),Gu(t))}function zu(t,e,n){for(const s of n)s instanceof Ou?(t.ac.addReference(s.key,e),Wu(t,s)):s instanceof Lu?(Lr("SyncEngine","Document no longer in limbo: "+s.key),t.ac.removeReference(s.key,e),t.ac.containsKey(s.key)||Ku(t,s.key)):Ur()}function Wu(t,e){const n=e.key,s=n.path.canonicalString();t.uc.get(n)||t.oc.has(s)||(Lr("SyncEngine","New document in limbo: "+n),t.oc.add(s),Gu(t))}function Gu(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 ai(ri.fromString(e)),s=t.fc.next();t.cc.set(s,new xu(n)),t.uc=t.uc.insert(n,s),iu(t.remoteStore,new pc(Po(ko(n.path)),s,2,gi.at))}}async function $u(t,e,n){const s=Vr(t),r=[],i=[],o=[];s.ic.isEmpty()||(s.ic.forEach(((t,a)=>{o.push(s._c(a,e,n).then((t=>{if((t||n)&&s.isPrimaryClient&&s.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){r.push(t);const e=Pc.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),s.sc.Wo(r),await async function(t,e){const n=Vr(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>fi.forEach(e,(e=>fi.forEach(e.Si,(s=>n.persistence.referenceDelegate.addReference(t,e.targetId,s))).next((()=>fi.forEach(e.Di,(s=>n.persistence.referenceDelegate.removeReference(t,e.targetId,s)))))))))}catch(t){if(!pi(t))throw t;Lr("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),s=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(s);n.qi=n.qi.insert(e,r)}}}(s.localStore,i))}async function Qu(t,e){const n=Vr(t);if(!n.currentUser.isEqual(e)){Lr("SyncEngine","User change. New user:",e.toKey());const t=await Uc(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new jr(Br.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await $u(n,t.ji)}}function Ju(t,e){const n=Vr(t),s=n.cc.get(e);if(s&&s.nc)return Ra().add(s.key);{let t=Ra();const s=n.rc.get(e);if(!s)return t;for(const e of s){const s=n.ic.get(e);t=t.unionWith(s.view.ju)}return t}}class Yu{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=Jc(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,s){return new xc(t,e,n,s)}(this.persistence,new Mc,t.initialUser,this.yt)}yc(t){return new Dc(Lc.Bs,this.yt)}gc(t){return new qc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Xu{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=>ju(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Qu.bind(null,this.syncEngine),await async function(t,e){const n=Vr(t);e?(n._u.delete(2),await su(n)):e||(n._u.add(2),await ru(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new bu}createDatastore(t){const e=Jc(t.databaseInfo.databaseId),n=(s=t.databaseInfo,new $c(s));var s;return function(t,e,n,s){return new tu(t,e,n,s)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,s=t.asyncQueue,r=t=>ju(this.syncEngine,t,0),i=zc.C()?new zc:new Kc,new nu(e,n,s,r,i);var e,n,s,r,i}createSyncEngine(t,e){return function(t,e,n,s,r,i,o){const a=new Uu(t,e,n,s,r,i);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=Vr(t);Lr("RemoteStore","RemoteStore shutting down."),e._u.add(5),await ru(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1600
+ */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==r.length||a?{snapshot:new Eu(this.query,t.Qu,s,r,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Iu,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=Ra(),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 Lu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Ou(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Ra();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Eu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Mu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class xu{constructor(t){this.key=t,this.nc=!1}}class Uu{constructor(t,e,n,s,r,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=s,this.currentUser=r,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new _a((t=>Fo(t)),Uo),this.rc=new Map,this.oc=new Set,this.uc=new po(ai.comparator),this.cc=new Map,this.ac=new bc,this.hc={},this.lc=new Map,this.fc=wc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function Fu(t,e){const n=function(t){const e=Vr(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ju.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Hu.bind(null,e),e.sc.Wo=ku.bind(null,e.eventManager),e.sc.wc=Nu.bind(null,e.eventManager),e}(t);let s,r;const i=n.ic.get(e);if(i)s=i.targetId,n.sharedClientState.addLocalQueryTarget(s),r=i.view.ec();else{const t=await function(t,e){const n=Vr(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let s;return n.Cs.getTargetData(t,e).next((r=>r?(s=r,fi.resolve(s)):n.Cs.allocateTargetId(t).next((r=>(s=new pc(e,r,0,t.currentSequenceNumber),n.Cs.addTargetData(t,s).next((()=>s)))))))})).then((t=>{const s=n.qi.get(t.targetId);return(null===s||t.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Po(e));n.isPrimaryClient&&iu(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);s=t.targetId,r=await async function(t,e,n,s,r){t._c=(e,n,s)=>async function(t,e,n,s){let r=e.view.Wu(n);r.$i&&(r=await jc(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,r))));const i=s&&s.targetChanges.get(e.targetId),o=e.view.applyChanges(r,t.isPrimaryClient,i);return Wu(t,e.targetId,o.Xu),o.snapshot}(t,e,n,s);const i=await jc(t.localStore,e,!0),o=new Pu(e,i.Hi),a=o.Wu(i.documents),c=Pa.createSynthesizedTargetChangeForCurrentChange(n,s&&"Offline"!==t.onlineState,r),u=o.applyChanges(a,t.isPrimaryClient,c);Wu(t,n,u.Xu);const h=new Mu(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,s,"current"===i,t.resumeToken)}return r}async function Vu(t,e){const n=Vr(t),s=n.ic.get(e),r=n.rc.get(s.targetId);if(r.length>1)return n.rc.set(s.targetId,r.filter((t=>!Uo(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(s.targetId),n.sharedClientState.isActiveQueryTarget(s.targetId)||await Bc(n.localStore,s.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(s.targetId),ou(n.remoteStore,s.targetId),qu(n,s.targetId)})).catch(di)):(qu(n,s.targetId),await Bc(n.localStore,s.targetId,!0))}async function Bu(t,e){const n=Vr(t);try{const t=await Vc(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const s=n.cc.get(e);s&&(Fr(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?s.nc=!0:t.modifiedDocuments.size>0?Fr(s.nc):t.removedDocuments.size>0&&(Fr(s.nc),s.nc=!1))})),await $u(n,t,e)}catch(t){await di(t)}}function ju(t,e,n){const s=Vr(t);if(s.isPrimaryClient&&0===n||!s.isPrimaryClient&&1===n){const t=[];s.ic.forEach(((n,s)=>{const r=s.view.bu(e);r.snapshot&&t.push(r.snapshot)})),function(t,e){const n=Vr(t);n.onlineState=e;let s=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(s=!0)})),s&&Ru(n)}(s.eventManager,e),t.length&&s.sc.Wo(t),s.onlineState=e,s.isPrimaryClient&&s.sharedClientState.setOnlineState(e)}}async function Hu(t,e,n){const s=Vr(t);s.sharedClientState.updateQueryState(e,"rejected",n);const r=s.cc.get(e),i=r&&r.key;if(i){let t=new po(ai.comparator);t=t.insert(i,To.newNoDocument(i,ni.min()));const n=Ra().add(i),r=new La(ni.min(),new Map,new yo(Zr),t,n);await Bu(s,r),s.uc=s.uc.remove(i),s.cc.delete(e),Gu(s)}else await Bc(s.localStore,e,!1).then((()=>qu(s,e,n))).catch(di)}function qu(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const s of t.rc.get(e))t.ic.delete(s),n&&t.sc.wc(s,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||Ku(t,e)}))}function Ku(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ou(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),Gu(t))}function Wu(t,e,n){for(const s of n)s instanceof Ou?(t.ac.addReference(s.key,e),zu(t,s)):s instanceof Lu?(Lr("SyncEngine","Document no longer in limbo: "+s.key),t.ac.removeReference(s.key,e),t.ac.containsKey(s.key)||Ku(t,s.key)):Ur()}function zu(t,e){const n=e.key,s=n.path.canonicalString();t.uc.get(n)||t.oc.has(s)||(Lr("SyncEngine","New document in limbo: "+n),t.oc.add(s),Gu(t))}function Gu(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 ai(ri.fromString(e)),s=t.fc.next();t.cc.set(s,new xu(n)),t.uc=t.uc.insert(n,s),iu(t.remoteStore,new pc(Po(ko(n.path)),s,2,gi.at))}}async function $u(t,e,n){const s=Vr(t),r=[],i=[],o=[];s.ic.isEmpty()||(s.ic.forEach(((t,a)=>{o.push(s._c(a,e,n).then((t=>{if((t||n)&&s.isPrimaryClient&&s.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){r.push(t);const e=Pc.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),s.sc.Wo(r),await async function(t,e){const n=Vr(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>fi.forEach(e,(e=>fi.forEach(e.Si,(s=>n.persistence.referenceDelegate.addReference(t,e.targetId,s))).next((()=>fi.forEach(e.Di,(s=>n.persistence.referenceDelegate.removeReference(t,e.targetId,s)))))))))}catch(t){if(!pi(t))throw t;Lr("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),s=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(s);n.qi=n.qi.insert(e,r)}}}(s.localStore,i))}async function Qu(t,e){const n=Vr(t);if(!n.currentUser.isEqual(e)){Lr("SyncEngine","User change. New user:",e.toKey());const t=await Uc(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new jr(Br.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await $u(n,t.ji)}}function Ju(t,e){const n=Vr(t),s=n.cc.get(e);if(s&&s.nc)return Ra().add(s.key);{let t=Ra();const s=n.rc.get(e);if(!s)return t;for(const e of s){const s=n.ic.get(e);t=t.unionWith(s.view.ju)}return t}}class Yu{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=Jc(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,s){return new xc(t,e,n,s)}(this.persistence,new Mc,t.initialUser,this.yt)}yc(t){return new Dc(Lc.Bs,this.yt)}gc(t){return new qc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Xu{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=>ju(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Qu.bind(null,this.syncEngine),await async function(t,e){const n=Vr(t);e?(n._u.delete(2),await su(n)):e||(n._u.add(2),await ru(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new bu}createDatastore(t){const e=Jc(t.databaseInfo.databaseId),n=(s=t.databaseInfo,new $c(s));var s;return function(t,e,n,s){return new tu(t,e,n,s)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,s=t.asyncQueue,r=t=>ju(this.syncEngine,t,0),i=Wc.C()?new Wc:new Kc,new nu(e,n,s,r,i);var e,n,s,r,i}createSyncEngine(t,e){return function(t,e,n,s,r,i,o){const a=new Uu(t,e,n,s,r,i);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=Vr(t);Lr("RemoteStore","RemoteStore shutting down."),e._u.add(5),await ru(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1601
1601
  /**
1602
1602
  * @license
1603
1603
  * Copyright 2017 Google LLC
@@ -1661,7 +1661,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1661
1661
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1662
1662
  * See the License for the specific language governing permissions and
1663
1663
  * limitations under the License.
1664
- */(s.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const o=s.mockUserToken.sub||s.mockUserToken.user_id;if(!o)throw new jr(Br.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Nr(o)}t._authCredentials=new zr(new qr(e,n))}}
1664
+ */(s.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const o=s.mockUserToken.sub||s.mockUserToken.user_id;if(!o)throw new jr(Br.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Nr(o)}t._authCredentials=new Wr(new qr(e,n))}}
1665
1665
  /**
1666
1666
  * @license
1667
1667
  * Copyright 2020 Google LLC
@@ -1870,7 +1870,7 @@ class bh{constructor(t){this._methodName=t}}
1870
1870
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1871
1871
  * See the License for the specific language governing permissions and
1872
1872
  * limitations under the License.
1873
- */const Ch=/^__.*__$/;function kh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ur()}}class Nh{constructor(t,e,n,s,r,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=s,void 0===r&&this.na(),this.fieldTransforms=r||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new Nh(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),s=this.ia({path:n,oa:!1});return s.ua(t),s}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),s=this.ia({path:n,oa:!1});return s.na(),s}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return Ph(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(kh(this.sa)&&Ch.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class Rh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||Jc(t)}da(t,e,n,s=!1){return new Nh({sa:t,methodName:e,fa:n,path:oi.emptyPath(),oa:!1,la:s},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Dh(t,e){if(Oh(t=I(t)))return function(t,e,n){if(!Oh(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const s=nh(n);throw"an object"===s?e.ha(t+" a custom object"):e.ha(t+" "+s)}}("Unsupported field value:",e,t),function(t,e){const n={};return _i(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):wi(t,((t,s)=>{const r=Dh(s,e.ra(t));null!=r&&(n[t]=r)})),{mapValue:{fields:n}}}(t,e);if(t instanceof bh)return function(t,e){if(!kh(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 s=0;for(const r of t){let t=Dh(r,e.aa(s));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),s++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=I(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return zo(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=ei.fromDate(t);return{timestampValue:Wa(e.yt,n)}}if(t instanceof ei){const n=new ei(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Wa(e.yt,n)}}if(t instanceof Ah)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Eh)return{bytesValue:Ga(e.yt,t._byteString)};if(t instanceof ch){const n=e.databaseId,s=t.firestore._databaseId;if(!s.isEqual(n))throw e.ha(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Qa(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${nh(t)}`)}(t,e)}function Oh(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof ei||t instanceof Ah||t instanceof Eh||t instanceof ch||t instanceof bh)}const Lh=new RegExp("[~\\*/\\[\\]]");function Ph(t,e,n,s,r){const i=s&&!s.isEmpty(),o=void 0!==r;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${s}`),o&&(c+=` in document ${r}`),c+=")"),new jr(Br.INVALID_ARGUMENT,a+t+c)
1873
+ */const Ch=/^__.*__$/;function kh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ur()}}class Nh{constructor(t,e,n,s,r,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=s,void 0===r&&this.na(),this.fieldTransforms=r||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new Nh(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),s=this.ia({path:n,oa:!1});return s.ua(t),s}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),s=this.ia({path:n,oa:!1});return s.na(),s}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return Ph(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(kh(this.sa)&&Ch.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class Rh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||Jc(t)}da(t,e,n,s=!1){return new Nh({sa:t,methodName:e,fa:n,path:oi.emptyPath(),oa:!1,la:s},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Dh(t,e){if(Oh(t=I(t)))return function(t,e,n){if(!Oh(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const s=nh(n);throw"an object"===s?e.ha(t+" a custom object"):e.ha(t+" "+s)}}("Unsupported field value:",e,t),function(t,e){const n={};return _i(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):wi(t,((t,s)=>{const r=Dh(s,e.ra(t));null!=r&&(n[t]=r)})),{mapValue:{fields:n}}}(t,e);if(t instanceof bh)return function(t,e){if(!kh(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 s=0;for(const r of t){let t=Dh(r,e.aa(s));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),s++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=I(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Wo(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=ei.fromDate(t);return{timestampValue:za(e.yt,n)}}if(t instanceof ei){const n=new ei(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:za(e.yt,n)}}if(t instanceof Ah)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Eh)return{bytesValue:Ga(e.yt,t._byteString)};if(t instanceof ch){const n=e.databaseId,s=t.firestore._databaseId;if(!s.isEqual(n))throw e.ha(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Qa(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${nh(t)}`)}(t,e)}function Oh(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof ei||t instanceof Ah||t instanceof Eh||t instanceof ch||t instanceof bh)}const Lh=new RegExp("[~\\*/\\[\\]]");function Ph(t,e,n,s,r){const i=s&&!s.isEmpty(),o=void 0!==r;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${s}`),o&&(c+=` in document ${r}`),c+=")"),new jr(Br.INVALID_ARGUMENT,a+t+c)
1874
1874
  /**
1875
1875
  * @license
1876
1876
  * Copyright 2020 Google LLC
@@ -1918,7 +1918,7 @@ class bh{constructor(t){this._methodName=t}}
1918
1918
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1919
1919
  * See the License for the specific language governing permissions and
1920
1920
  * limitations under the License.
1921
- */(s);for(const e of s)t=e._apply(t);return t}class Hh extends Bh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Hh(t,e,n)}_apply(t){const e=this._parse(t);return Gh(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e))}_parse(t){const e=function(t){const e=t._freezeSettings(),n=Jc(t._databaseId);return new Rh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,s,r,i,o){let a;if(r.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Wh(o,i);const e=[];for(const n of o)e.push(zh(s,t,n));a={arrayValue:{values:e}}}else a=zh(s,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Wh(o,i),a=function(t,e,n,s=!1){return Dh(n,t.da(s?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Ji.create(r,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function qh(t,e,n){const s=e,r=Uh("where",t);return Hh._create(r,s,n)}class Kh extends Vh{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Kh(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]:Yi.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const s=e.getFlattenedFilters();for(const t of s)Gh(n,t),n=Mo(n,t)}(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function zh(t,e,n){if("string"==typeof(n=I(n))){if(""===n)throw new jr(Br.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Oo(e)&&-1!==n.indexOf("/"))throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const s=e.path.child(ri.fromString(n));if(!ai.isDocumentKey(s))throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);return Vi(t,new ai(s))}if(n instanceof ch)return Vi(t,n._key);throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${nh(n)}.`)}function Wh(t,e){if(!Array.isArray(t)||0===t.length)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Gh(t,e){if(e.isInequality()){const n=Do(t),s=e.field;if(null!==n&&!n.isEqual(s))throw new jr(Br.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 '${s.toString()}'`);const r=Ro(t);null!==r&&function(t,e,n){if(!n.isEqual(e))throw new jr(Br.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,s,r)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new jr(Br.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new jr(Br.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class $h{convertValue(t,e="none"){switch(Oi(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Ai(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(Ci(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 Ur()}}convertObject(t,e){const n={};return wi(t.fields,((t,s)=>{n[t]=this.convertValue(s,e)})),n}convertGeoPoint(t){return new Ah(Ai(t.latitude),Ai(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Ni(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ri(t));default:return null}}convertTimestamp(t){const e=bi(t);return new ei(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=ri.fromString(t);Fr(lc(n));const s=new yi(n.get(1),n.get(3)),r=new ai(n.popFirst(5));return s.isEqual(e)||Pr(`Document ${r} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),r}}
1921
+ */(s);for(const e of s)t=e._apply(t);return t}class Hh extends Bh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Hh(t,e,n)}_apply(t){const e=this._parse(t);return Gh(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e))}_parse(t){const e=function(t){const e=t._freezeSettings(),n=Jc(t._databaseId);return new Rh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,s,r,i,o){let a;if(r.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){zh(o,i);const e=[];for(const n of o)e.push(Wh(s,t,n));a={arrayValue:{values:e}}}else a=Wh(s,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||zh(o,i),a=function(t,e,n,s=!1){return Dh(n,t.da(s?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Ji.create(r,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function qh(t,e,n){const s=e,r=Uh("where",t);return Hh._create(r,s,n)}class Kh extends Vh{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Kh(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]:Yi.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const s=e.getFlattenedFilters();for(const t of s)Gh(n,t),n=Mo(n,t)}(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Wh(t,e,n){if("string"==typeof(n=I(n))){if(""===n)throw new jr(Br.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Oo(e)&&-1!==n.indexOf("/"))throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const s=e.path.child(ri.fromString(n));if(!ai.isDocumentKey(s))throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);return Vi(t,new ai(s))}if(n instanceof ch)return Vi(t,n._key);throw new jr(Br.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${nh(n)}.`)}function zh(t,e){if(!Array.isArray(t)||0===t.length)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new jr(Br.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Gh(t,e){if(e.isInequality()){const n=Do(t),s=e.field;if(null!==n&&!n.isEqual(s))throw new jr(Br.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 '${s.toString()}'`);const r=Ro(t);null!==r&&function(t,e,n){if(!n.isEqual(e))throw new jr(Br.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,s,r)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new jr(Br.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new jr(Br.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class $h{convertValue(t,e="none"){switch(Oi(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Ai(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(Ci(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 Ur()}}convertObject(t,e){const n={};return wi(t.fields,((t,s)=>{n[t]=this.convertValue(s,e)})),n}convertGeoPoint(t){return new Ah(Ai(t.latitude),Ai(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Ni(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ri(t));default:return null}}convertTimestamp(t){const e=bi(t);return new ei(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=ri.fromString(t);Fr(lc(n));const s=new yi(n.get(1),n.get(3)),r=new ai(n.popFirst(5));return s.isEqual(e)||Pr(`Document ${r} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),r}}
1922
1922
  /**
1923
1923
  * @license
1924
1924
  * Copyright 2020 Google LLC
@@ -1950,7 +1950,7 @@ class bh{constructor(t){this._methodName=t}}
1950
1950
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1951
1951
  * See the License for the specific language governing permissions and
1952
1952
  * limitations under the License.
1953
- */function tl(t){t=sh(t,ch);const e=sh(t.firestore,wh);return function(t,e,n={}){const s=new Hr;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,s,r){const i=new fh({next:i=>{e.enqueueAndForget((()=>Cu(t,o)));const a=i.docs.has(n);!a&&i.fromCache?r.reject(new jr(Br.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&s&&"server"===s.source?r.reject(new jr(Br.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):r.resolve(i)},error:t=>r.reject(t)}),o=new Du(ko(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,s))),s.promise}(Th(e),t._key).then((n=>rl(e,t,n)))}class el extends $h{constructor(t){super(),this.firestore=t}convertBytes(t){return new Eh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new ch(this.firestore,null,e)}}function nl(t){t=sh(t,uh);const e=sh(t.firestore,wh),n=Th(e),s=new el(e);return Fh(t._query),function(t,e,n={}){const s=new Hr;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,s,r){const i=new fh({next:n=>{e.enqueueAndForget((()=>Cu(t,o))),n.fromCache&&"server"===s.source?r.reject(new jr(Br.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):r.resolve(n)},error:t=>r.reject(t)}),o=new Du(n,i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,s))),s.promise}(n,t._query).then((n=>new Xh(e,s,t,n)))}function sl(t,...e){var n,s,r;t=I(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||vh(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(vh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(s=t.error)||void 0===s?void 0:s.bind(t),e[o+2]=null===(r=t.complete)||void 0===r?void 0:r.bind(t)}let c,u,h;if(t instanceof ch)u=sh(t.firestore,wh),h=ko(t._key.path),c={next:n=>{e[o]&&e[o](rl(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=sh(t,uh);u=sh(n.firestore,wh),h=n._query;const s=new el(u);c={next:t=>{e[o]&&e[o](new Xh(u,s,n,t))},error:e[o+1],complete:e[o+2]},Fh(t._query)}return function(t,e,n,s){const r=new fh(s),i=new Du(e,r,n);return t.asyncQueue.enqueueAndForget((async()=>Au(await mh(t),i))),()=>{r.bc(),t.asyncQueue.enqueueAndForget((async()=>Cu(await mh(t),i)))}}(Th(u),h,a,c)}function rl(t,e,n){const s=n.docs.get(e._key),r=new el(t);return new Jh(t,r,e._key,s,new Qh(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Rr=ct,rt(new E("firestore",((t,{instanceIdentifier:n,options:s})=>{const r=t.getProvider("app").getImmediate(),i=new wh(new Wr(t.getProvider("auth-internal")),new Jr(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new jr(Br.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yi(t.options.projectId,e)}(r,n),r);return s=Object.assign({useFetchStreams:e},s),i._setSettings(s),i}),"PUBLIC").setMultipleInstances(!0)),lt(kr,"3.8.0",t),lt(kr,"3.8.0","esm2017")}();
1953
+ */function tl(t){t=sh(t,ch);const e=sh(t.firestore,wh);return function(t,e,n={}){const s=new Hr;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,s,r){const i=new fh({next:i=>{e.enqueueAndForget((()=>Cu(t,o)));const a=i.docs.has(n);!a&&i.fromCache?r.reject(new jr(Br.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&s&&"server"===s.source?r.reject(new jr(Br.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):r.resolve(i)},error:t=>r.reject(t)}),o=new Du(ko(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,s))),s.promise}(Th(e),t._key).then((n=>rl(e,t,n)))}class el extends $h{constructor(t){super(),this.firestore=t}convertBytes(t){return new Eh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new ch(this.firestore,null,e)}}function nl(t){t=sh(t,uh);const e=sh(t.firestore,wh),n=Th(e),s=new el(e);return Fh(t._query),function(t,e,n={}){const s=new Hr;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,s,r){const i=new fh({next:n=>{e.enqueueAndForget((()=>Cu(t,o))),n.fromCache&&"server"===s.source?r.reject(new jr(Br.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):r.resolve(n)},error:t=>r.reject(t)}),o=new Du(n,i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,s))),s.promise}(n,t._query).then((n=>new Xh(e,s,t,n)))}function sl(t,...e){var n,s,r;t=I(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||vh(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(vh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(s=t.error)||void 0===s?void 0:s.bind(t),e[o+2]=null===(r=t.complete)||void 0===r?void 0:r.bind(t)}let c,u,h;if(t instanceof ch)u=sh(t.firestore,wh),h=ko(t._key.path),c={next:n=>{e[o]&&e[o](rl(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=sh(t,uh);u=sh(n.firestore,wh),h=n._query;const s=new el(u);c={next:t=>{e[o]&&e[o](new Xh(u,s,n,t))},error:e[o+1],complete:e[o+2]},Fh(t._query)}return function(t,e,n,s){const r=new fh(s),i=new Du(e,r,n);return t.asyncQueue.enqueueAndForget((async()=>Au(await mh(t),i))),()=>{r.bc(),t.asyncQueue.enqueueAndForget((async()=>Cu(await mh(t),i)))}}(Th(u),h,a,c)}function rl(t,e,n){const s=n.docs.get(e._key),r=new el(t);return new Jh(t,r,e._key,s,new Qh(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Rr=ct,rt(new E("firestore",((t,{instanceIdentifier:n,options:s})=>{const r=t.getProvider("app").getImmediate(),i=new wh(new zr(t.getProvider("auth-internal")),new Jr(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new jr(Br.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yi(t.options.projectId,e)}(r,n),r);return s=Object.assign({useFetchStreams:e},s),i._setSettings(s),i}),"PUBLIC").setMultipleInstances(!0)),lt(kr,"3.8.0",t),lt(kr,"3.8.0","esm2017")}();
1954
1954
  /**
1955
1955
  * @license
1956
1956
  * Copyright 2020 Google LLC
@@ -2244,7 +2244,7 @@ async function jl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
2244
2244
  * See the License for the specific language governing permissions and
2245
2245
  * limitations under the License.
2246
2246
  */
2247
- class zl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){vl(t.idToken,"internal-error"),vl(void 0!==t.idToken,"internal-error"),vl(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=Bl(t);return vl(e,"internal-error"),vl(void 0!==e.exp,"internal-error"),vl(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return vl(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?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:s,expiresIn:r}=await
2247
+ class Wl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){vl(t.idToken,"internal-error"),vl(void 0!==t.idToken,"internal-error"),vl(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=Bl(t);return vl(e,"internal-error"),vl(void 0!==e.exp,"internal-error"),vl(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return vl(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?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:s,expiresIn:r}=await
2248
2248
  /**
2249
2249
  * @license
2250
2250
  * Copyright 2020 Google LLC
@@ -2261,7 +2261,7 @@ class zl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2261
2261
  * See the License for the specific language governing permissions and
2262
2262
  * limitations under the License.
2263
2263
  */
2264
- async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=t.config,i=Ml(t,s,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",kl.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,s,Number(r))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:s,expirationTime:r}=e,i=new zl;return n&&(vl("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),s&&(vl("string"==typeof s,"internal-error",{appName:t}),i.accessToken=s),r&&(vl("number"==typeof r,"internal-error",{appName:t}),i.expirationTime=r),i}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 zl,this.toJSON())}_performRefresh(){return wl("not implemented")}}
2264
+ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:r}=t.config,i=Ml(t,s,"/v1/token",`key=${r}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",kl.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,s,Number(r))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:s,expirationTime:r}=e,i=new Wl;return n&&(vl("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),s&&(vl("string"==typeof s,"internal-error",{appName:t}),i.accessToken=s),r&&(vl("number"==typeof r,"internal-error",{appName:t}),i.expirationTime=r),i}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 Wl,this.toJSON())}_performRefresh(){return wl("not implemented")}}
2265
2265
  /**
2266
2266
  * @license
2267
2267
  * Copyright 2020 Google LLC
@@ -2277,7 +2277,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
2277
2277
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2278
2278
  * See the License for the specific language governing permissions and
2279
2279
  * limitations under the License.
2280
- */function Wl(t,e){vl("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Gl{constructor(t){var{uid:e,auth:n,stsTokenManager:s}=t,r=cl(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Hl(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new ql(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await jl(this,this.stsTokenManager.getToken(this.auth,t));return vl(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=I(t),s=await n.getIdToken(e),r=Bl(s);vl(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const i="object"==typeof r.firebase?r.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:r,token:s,authTime:Fl(Vl(r.auth_time)),issuedAtTime:Fl(Vl(r.iat)),expirationTime:Fl(Vl(r.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=I(t);await Kl(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(vl(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){return new Gl(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){vl(!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 Kl(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await jl(this,async function(t,e){return Ol(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,s,r,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(s=e.email)&&void 0!==s?s:void 0,d=null!==(r=e.phoneNumber)&&void 0!==r?r:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i: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!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:I}=e;vl(v&&I,t,"internal-error");const E=zl.fromJSON(this.name,I);vl("string"==typeof v,t,"internal-error"),Wl(h,t.name),Wl(l,t.name),vl("boolean"==typeof w,t,"internal-error"),vl("boolean"==typeof _,t,"internal-error"),Wl(d,t.name),Wl(f,t.name),Wl(p,t.name),Wl(g,t.name),Wl(m,t.name),Wl(y,t.name);const S=new Gl({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(S.providerData=T.map((t=>Object.assign({},t)))),g&&(S._redirectEventId=g),S}static async _fromIdTokenResponse(t,e,n=!1){const s=new zl;s.updateFromServerResponse(e);const r=new Gl({uid:e.localId,auth:t,stsTokenManager:s,isAnonymous:n});return await Kl(r),r}}
2280
+ */function zl(t,e){vl("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Gl{constructor(t){var{uid:e,auth:n,stsTokenManager:s}=t,r=cl(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Hl(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new ql(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(t){const e=await jl(this,this.stsTokenManager.getToken(this.auth,t));return vl(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=I(t),s=await n.getIdToken(e),r=Bl(s);vl(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const i="object"==typeof r.firebase?r.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:r,token:s,authTime:Fl(Vl(r.auth_time)),issuedAtTime:Fl(Vl(r.iat)),expirationTime:Fl(Vl(r.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=I(t);await Kl(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(vl(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){return new Gl(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){vl(!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 Kl(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await jl(this,async function(t,e){return Ol(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,s,r,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(s=e.email)&&void 0!==s?s:void 0,d=null!==(r=e.phoneNumber)&&void 0!==r?r:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i: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!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:I}=e;vl(v&&I,t,"internal-error");const E=Wl.fromJSON(this.name,I);vl("string"==typeof v,t,"internal-error"),zl(h,t.name),zl(l,t.name),vl("boolean"==typeof w,t,"internal-error"),vl("boolean"==typeof _,t,"internal-error"),zl(d,t.name),zl(f,t.name),zl(p,t.name),zl(g,t.name),zl(m,t.name),zl(y,t.name);const S=new Gl({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(S.providerData=T.map((t=>Object.assign({},t)))),g&&(S._redirectEventId=g),S}static async _fromIdTokenResponse(t,e,n=!1){const s=new Wl;s.updateFromServerResponse(e);const r=new Gl({uid:e.localId,auth:t,stsTokenManager:s,isAnonymous:n});return await Kl(r),r}}
2281
2281
  /**
2282
2282
  * @license
2283
2283
  * Copyright 2019 Google LLC
@@ -2802,7 +2802,7 @@ class Kd{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
2802
2802
  * See the License for the specific language governing permissions and
2803
2803
  * limitations under the License.
2804
2804
  */
2805
- function zd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2805
+ function Wd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2806
2806
  /**
2807
2807
  * @license
2808
2808
  * Copyright 2019 Google LLC
@@ -2818,7 +2818,7 @@ function zd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2818
2818
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2819
2819
  * See the License for the specific language governing permissions and
2820
2820
  * limitations under the License.
2821
- */Kd.receivers=[];class Wd{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 s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,i;return new Promise(((o,a)=>{const c=zd("",20);s.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:s,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(u),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[s.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
2821
+ */Kd.receivers=[];class zd{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 s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let r,i;return new Promise(((o,a)=>{const c=Wd("",20);s.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:s,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),r=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(u),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[s.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
2822
2822
  /**
2823
2823
  * @license
2824
2824
  * Copyright 2020 Google LLC
@@ -2868,7 +2868,7 @@ function $d(){return void 0!==Gd().WorkerGlobalScope&&"function"==typeof Gd().im
2868
2868
  * See the License for the specific language governing permissions and
2869
2869
  * limitations under the License.
2870
2870
  */
2871
- const Qd="firebaseLocalStorageDb",Jd="firebaseLocalStorage",Yd="fbase_key";class Xd{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 Zd(t,e){return t.transaction([Jd],e?"readwrite":"readonly").objectStore(Jd)}function tf(){const t=indexedDB.open(Qd,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Jd,{keyPath:Yd})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Jd)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Qd);return new Xd(t).toPromise()}(),e(await tf()))}))}))}async function ef(t,e,n){const s=Zd(t,!0).put({[Yd]:e,value:n});return new Xd(s).toPromise()}function nf(t,e){const n=Zd(t,!0).delete(e);return new Xd(n).toPromise()}class sf{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 tf()),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 $d()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Kd._getInstance($d()?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 Wd(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 tf();return await ef(t,Fd,"1"),await nf(t,Fd),!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=>ef(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=Zd(t,!1).get(e),s=await new Xd(n).toPromise();return void 0===s?null:s.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>nf(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Zd(t,!1).getAll();return new Xd(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:s,value:r}of t)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),e.push(s));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()}}sf.type="LOCAL";const rf=sf;
2871
+ const Qd="firebaseLocalStorageDb",Jd="firebaseLocalStorage",Yd="fbase_key";class Xd{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 Zd(t,e){return t.transaction([Jd],e?"readwrite":"readonly").objectStore(Jd)}function tf(){const t=indexedDB.open(Qd,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Jd,{keyPath:Yd})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Jd)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Qd);return new Xd(t).toPromise()}(),e(await tf()))}))}))}async function ef(t,e,n){const s=Zd(t,!0).put({[Yd]:e,value:n});return new Xd(s).toPromise()}function nf(t,e){const n=Zd(t,!0).delete(e);return new Xd(n).toPromise()}class sf{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 tf()),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 $d()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Kd._getInstance($d()?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 zd(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 tf();return await ef(t,Fd,"1"),await nf(t,Fd),!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=>ef(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=Zd(t,!1).get(e),s=await new Xd(n).toPromise();return void 0===s?null:s.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>nf(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Zd(t,!1).getAll();return new Xd(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:s,value:r}of t)n.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(r)&&(this.notifyListeners(s,r),e.push(s));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()}}sf.type="LOCAL";const rf=sf;
2872
2872
  /**
2873
2873
  * @license
2874
2874
  * Copyright 2020 Google LLC
@@ -2950,7 +2950,7 @@ async function(t,e,n=!1){const{auth:s}=t,r="reauthenticate";try{const i=await jl
2950
2950
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2951
2951
  * See the License for the specific language governing permissions and
2952
2952
  * limitations under the License.
2953
- */const df=new Al(2e3,1e4);class ff extends lf{constructor(t,e,n,s,r){super(t,e,s,r),this.provider=n,this.authWindow=null,this.pollId=null,ff.currentPopupAction&&ff.currentPopupAction.cancel(),ff.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return vl(t,this.auth,"internal-error"),t}async onExecution(){_l(1===this.filter.length,"Popup operations only handle one event");const t=zd();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(ml(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(ml(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ff.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(ml(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(t,df.get())};t()}}ff.currentPopupAction=null;
2953
+ */const df=new Al(2e3,1e4);class ff extends lf{constructor(t,e,n,s,r){super(t,e,s,r),this.provider=n,this.authWindow=null,this.pollId=null,ff.currentPopupAction&&ff.currentPopupAction.cancel(),ff.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return vl(t,this.auth,"internal-error"),t}async onExecution(){_l(1===this.filter.length,"Popup operations only handle one event");const t=Wd();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(ml(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(ml(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ff.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(ml(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(t,df.get())};t()}}ff.currentPopupAction=null;
2954
2954
  /**
2955
2955
  * @license
2956
2956
  * Copyright 2020 Google LLC
@@ -3114,7 +3114,7 @@ const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px
3114
3114
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3115
3115
  * See the License for the specific language governing permissions and
3116
3116
  * limitations under the License.
3117
- */(t)}?${y(a).slice(1)}`}const jf="webStorageSupport";const Hf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=qd,this._completeRedirectFn=vf,this._overrideRedirectResult=yf}async _openPopup(t,e,n,s){var r;_l(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return Uf(t,Bf(t,e,n,El(),s),zd())}async _openRedirect(t,e,n,s){var r;return await this._originValidation(t),r=Bf(t,e,n,El(),s),Gd().location.href=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):(_l(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 Pf(t),n=new wf(t);return e.register("authEvent",(e=>{vl(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(jf,{type:jf},(n=>{var s;const r=null===(s=null==n?void 0:n[0])||void 0===s?void 0:s[jf];void 0!==r&&e(!!r),gl(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Sf(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return cd()||td()||od()}};var qf="@firebase/auth",Kf="0.21.0";
3117
+ */(t)}?${y(a).slice(1)}`}const jf="webStorageSupport";const Hf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=qd,this._completeRedirectFn=vf,this._overrideRedirectResult=yf}async _openPopup(t,e,n,s){var r;_l(null===(r=this.eventManagers[t._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return Uf(t,Bf(t,e,n,El(),s),Wd())}async _openRedirect(t,e,n,s){var r;return await this._originValidation(t),r=Bf(t,e,n,El(),s),Gd().location.href=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):(_l(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 Pf(t),n=new wf(t);return e.register("authEvent",(e=>{vl(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(jf,{type:jf},(n=>{var s;const r=null===(s=null==n?void 0:n[0])||void 0===s?void 0:s[jf];void 0!==r&&e(!!r),gl(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Sf(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return cd()||td()||od()}};var qf="@firebase/auth",Kf="0.21.0";
3118
3118
  /**
3119
3119
  * @license
3120
3120
  * Copyright 2020 Google LLC
@@ -3131,7 +3131,7 @@ const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px
3131
3131
  * See the License for the specific language governing permissions and
3132
3132
  * limitations under the License.
3133
3133
  */
3134
- class zf{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(){vl(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3134
+ class Wf{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(){vl(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3135
3135
  /**
3136
3136
  * @license
3137
3137
  * Copyright 2020 Google LLC
@@ -3164,5 +3164,5 @@ class zf{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3164
3164
  * See the License for the specific language governing permissions and
3165
3165
  * limitations under the License.
3166
3166
  */
3167
- const Wf=h("authIdTokenMaxAge")||300;let Gf=null;function $f(t=ht()){const e=it(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=it(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(g(n.getOptions(),null!=e?e:{}))return t;gl(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Hf,persistence:[rf,jd,qd]}),s=h("authTokenSyncURL");if(s){const t=(r=s,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Wf)return;const s=null==e?void 0:e.token;Gf!==s&&(Gf=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,s){I(t).onIdTokenChanged(e,n,s)}(n,(e=>t(e)))}var r;const i=u("auth");return i&&pd(n,`http://${i}`),n}var Qf;Qf="Browser",rt(new E("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),{apiKey:r,authDomain:i}=n.options;return((t,n)=>{vl(r&&!r.includes(":"),"invalid-api-key",{appName:t.name}),vl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const s={apiKey:r,authDomain:i,clientPlatform:Qf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ud(Qf)},o=new ld(t,n,s);return function(t,e){const n=(null==e?void 0:e.persistence)||[],s=(Array.isArray(n)?n:[n]).map(Il);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(s,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,s)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),rt(new E("auth-internal",(t=>(t=>new zf(t))(dd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),lt(qf,Kf,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Qf)),lt(qf,Kf,"esm2017");class Jf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Yf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Xf extends Error{constructor(){super("request timeout"),this.name="RequestTimeoutError"}}class Zf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class tp extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class ep extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}class np extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}class sp extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}const rp="avatar not created";var ip=Object.freeze({__proto__:null,AvatarNotCreatedError:Jf,NoFramesFoundError:Yf,RequestTimeoutError:Xf,UserNotLoggedInError:Zf,NoColorwaySizeAssetsFoundError:tp,NoStylesFoundError:ep,RecommendedAvailableSizesError:np,BrandUserIdNotSetError:sp,AvatarNotCreated:rp});class op{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=$f(e),this.auth.setPersistence(jd)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Zf;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Zf;return(await tl(dh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=jh(lh(this.firestore,"users"),qh(new Sh("__name__"),"==",this.id));return e=sl(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Ud(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await Md(this.auth,t)}async confirmPasswordReset(t,e){await xd(this.auth,t,e)}}class ap{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((s=>{n=sl(t,(t=>{s(t),e&&n()}))})),unsubscribe:()=>n()}};const t=ut(il.getInstance().firebase);this.firestore=_h(t),this.user=new op(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const s=jh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(s,n)}getDocs(t,e){return nl(jh(lh(this.firestore,t),...e))}async getDoc(t,e){const n=dh(this.firestore,t,e),s=await tl(n);return s.exists()?s.data():null}}const cp=t=>{if(t.code===dl)throw new Error("account has been disabled");throw new Error(t.message)};var up;!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"}(up||(up={}));const hp={[up.ACROSS_BACK]:"Across back",[up.ACROSS_FRONT]:"Across front",[up.ACROSS_SHOULDER]:"Across shoulder",[up.ANKLE]:"Ankle",[up.ARMEYE]:"Armeye",[up.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[up.BACK_CROTCH_LENGTH]:"Back crotch length",[up.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[up.BELOW_KNEE]:"Below knee",[up.BICEP]:"Bicep",[up.BUST]:"Chest/Bust",[up.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[up.CALF]:"Calf",[up.CB_NECK_TO_WAIST]:"Cb neck to waist",[up.CB_NECK_TO_WRIST]:"Cb neck to wrist",[up.CF_NECK_TO_WAIST]:"Cf neck to waist",[up.ELBOW]:"Elbow",[up.FOREARM]:"Forearm",[up.FRONT_CROTCH_LENGTH]:"Front crotch length",[up.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[up.HIGH_HIP]:"High hip",[up.HSP_TO_ACROSS_BACK]:"Hsp to across back",[up.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[up.HSP_TO_BUST_POINT]:"Hsp to bust point",[up.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[up.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[up.INSEAM]:"Inseam",[up.KNEE]:"Knee",[up.LOW_HIP]:"Low hip",[up.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[up.MID_NECK]:"Mid neck",[up.NECK_AT_BASE]:"Neck at base",[up.SHOULDER_DROP]:"Shoulder drop",[up.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[up.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[up.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[up.THIGH]:"Thigh",[up.TOTAL_RISE_LENGTH]:"Total rise length",[up.UNDER_BUST]:"Under bust",[up.VERTICAL_TRUNK]:"Vertical trunk",[up.WAIST]:"Waist",[up.WRIST]:"Wrist"};var lp;!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"}(lp||(lp={}));const dp={[lp.BLOUSES]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.COATS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.DRESSES]:[up.LOW_HIP,up.BUST,up.ACROSS_SHOULDER,up.WAIST],[lp.JACKETS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.PANTS]:[up.LOW_HIP,up.WAIST,up.THIGH,up.INSEAM],[lp.PUFFERS_AND_PARKAS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.SHORTS]:[up.LOW_HIP,up.WAIST,up.THIGH,up.INSEAM],[lp.SKIRTS]:[up.LOW_HIP,up.WAIST],[lp.SWEATERS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.T_SHIRTS_AND_TANKS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP]},fp={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"},pp={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"},gp={activewear:{leggings:lp.PANTS,joggers:lp.PANTS,sweatshirts:lp.SWEATERS},dresses:{a_line:lp.DRESSES,bodycon:lp.DRESSES,fit_and_flare:lp.DRESSES,knit:lp.DRESSES,shirt:lp.DRESSES,slip:lp.DRESSES,straight:lp.DRESSES,wrap:lp.DRESSES},jackets_and_coats:{denim_jackets:lp.JACKETS,parkas:lp.PUFFERS_AND_PARKAS,peacoats:lp.COATS,puffer_jackets:lp.PUFFERS_AND_PARKAS,raincoats:lp.COATS,rompers:lp.COATS,shackets:lp.JACKETS,trench_coats:lp.COATS},jeans:{bootcut:lp.PANTS,flared:lp.PANTS,mom:lp.PANTS,relaxed:lp.PANTS,skinny:lp.PANTS,slim:lp.PANTS,straight:lp.PANTS,tapered:lp.PANTS,wide_leg:lp.PANTS},jumpsuits_and_rompers:{boiler_suits:lp.DRESSES,denim:lp.DRESSES,jumpsuits:lp.DRESSES,overalls:lp.DRESSES,rompers:lp.DRESSES,unitards:lp.DRESSES},pants_and_shorts:{cigarette:lp.PANTS,culottes:lp.SHORTS,denim_shorts:lp.SHORTS,flared:lp.PANTS,joggers:lp.PANTS,leggings:lp.PANTS,skinny:lp.PANTS,wide_leg:lp.PANTS},skirts:{a_line_flared:lp.SKIRTS,denim:lp.SKIRTS,knit:lp.SKIRTS,pencil:lp.SKIRTS,pleated:lp.SKIRTS,skater:lp.SKIRTS,slip:lp.SKIRTS,wrap:lp.SKIRTS},suits_and_tailoring:{blazers:lp.JACKETS,suit_jackets:lp.JACKETS,suit_skirts:lp.SKIRTS,suit_trousers:lp.PANTS,suit_vests:lp.SWEATERS,trousers:lp.PANTS},sweaters:{cardigans:lp.SWEATERS,crewnecks:lp.SWEATERS,hoodies_and_zipups:lp.SWEATERS,sweatshirts:lp.SWEATERS,turtlenecks:lp.SWEATERS,v_necks:lp.SWEATERS},tops:{bodysuits:lp.BLOUSES,corsets_and_bustiers:lp.BLOUSES,polos:lp.T_SHIRTS_AND_TANKS,shirts_and_blouses:lp.BLOUSES,t_shirts:lp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:lp.T_SHIRTS_AND_TANKS}};var mp;!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"}(mp||(mp={}));const yp={[mp.TOO_TIGHT]:"Too Tight",[mp.TIGHT]:"Tight",[mp.SLIGHTLY_TIGHT]:"Slightly Tight",[mp.PERFECT_FIT]:"Perfect Fit",[mp.SLIGHTLY_LOOSE]:"Slightly Loose",[mp.LOOSE]:"Loose",[mp.OVERSIZED]:"Oversized"};class vp{static get endpoint(){return il.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:s,useToken:r=!0}){const i=this.getUrl(e,r),o={method:n,headers:await this.getHeaders(t,r),credentials:"include"};s&&(o.body=JSON.stringify(s));const a=await fetch(i,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,s){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:s})}static Put(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:s})}static Patch(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:s})}static Delete(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:s})}}class wp{constructor(t,e){this.brandId=t,this.firebase=e}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}onInit(){return this.firebase.onInit()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Zf;try{const s=await vp.Get(this.user,`/styles/${t}/recommendation`),r=await s.json();return(null===(e=null==r?void 0:r.fits)||void 0===e?void 0:e.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(t){if((null==t?void 0:t.error)===rp)throw new Jf;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await vp.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 tp;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t){var e;const n=await this.getColorwaySizeAssetFromSku(t),s=await this.getStyleCategory(n.style_id),r=(null===(e=gp[s.category])||void 0===e?void 0:e[s.sub_category])||null;return r?dp[r].map((t=>hp[t])):null}async getColorwaySizeAssets(t,e){const n=[qh("brand_id","==",this.brandId)];t&&n.push(qh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(qh("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 cp(t)}}async getStyleCategory(t){try{return await this.firebase.getDoc("style_categories",String(t))}catch(t){return cp(t)}}}const _p=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),il.getInstance().setEnv(e),new wp(t,new ap));var Tp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Tp||(Tp={}));var Ip=Object.freeze({__proto__:null,get AvatarState(){return Tp},get MeasurementLocation(){return up},MeasurementLocationName:hp,get Classification(){return lp},ClassificationLocations:dp,CategoryNames:fp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:pp,Taxonomy:gp,get Fit(){return mp},FitNames:yp});export{ip as Errors,_p as initShop,t as requests,e as responses,Ip as types};
3167
+ const zf=h("authIdTokenMaxAge")||300;let Gf=null;function $f(t=ht()){const e=it(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=it(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(g(n.getOptions(),null!=e?e:{}))return t;gl(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Hf,persistence:[rf,jd,qd]}),s=h("authTokenSyncURL");if(s){const t=(r=s,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>zf)return;const s=null==e?void 0:e.token;Gf!==s&&(Gf=s,await fetch(r,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,s){I(t).onIdTokenChanged(e,n,s)}(n,(e=>t(e)))}var r;const i=u("auth");return i&&pd(n,`http://${i}`),n}var Qf;Qf="Browser",rt(new E("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),{apiKey:r,authDomain:i}=n.options;return((t,n)=>{vl(r&&!r.includes(":"),"invalid-api-key",{appName:t.name}),vl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const s={apiKey:r,authDomain:i,clientPlatform:Qf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ud(Qf)},o=new ld(t,n,s);return function(t,e){const n=(null==e?void 0:e.persistence)||[],s=(Array.isArray(n)?n:[n]).map(Il);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(s,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,s)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),rt(new E("auth-internal",(t=>(t=>new Wf(t))(dd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),lt(qf,Kf,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Qf)),lt(qf,Kf,"esm2017");class Jf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Yf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Xf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}const Zf="avatar not created";var tp=Object.freeze({__proto__:null,AvatarNotCreatedError:Jf,UserNotLoggedInError:Yf,NoColorwaySizeAssetsFoundError:Xf,AvatarNotCreated:Zf});class ep{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=$f(e),this.auth.setPersistence(jd)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Yf;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Yf;return(await tl(dh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=jh(lh(this.firestore,"users"),qh(new Sh("__name__"),"==",this.id));return e=sl(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Ud(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await Md(this.auth,t)}async confirmPasswordReset(t,e){await xd(this.auth,t,e)}}class np{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((s=>{n=sl(t,(t=>{s(t),e&&n()}))})),unsubscribe:()=>n()}};const t=ut(il.getInstance().firebase);this.firestore=_h(t),this.user=new ep(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const s=jh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(s,n)}getDocs(t,e){return nl(jh(lh(this.firestore,t),...e))}async getDoc(t,e){const n=dh(this.firestore,t,e),s=await tl(n);return s.exists()?s.data():null}}const sp=t=>{if(t.code===dl)throw new Error("account has been disabled");throw new Error(t.message)};var rp;!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"}(rp||(rp={}));const ip={[rp.ACROSS_BACK]:"Across back",[rp.ACROSS_FRONT]:"Across front",[rp.ACROSS_SHOULDER]:"Across shoulder",[rp.ANKLE]:"Ankle",[rp.ARMEYE]:"Armeye",[rp.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[rp.BACK_CROTCH_LENGTH]:"Back crotch length",[rp.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[rp.BELOW_KNEE]:"Below knee",[rp.BICEP]:"Bicep",[rp.BUST]:"Chest/Bust",[rp.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[rp.CALF]:"Calf",[rp.CB_NECK_TO_WAIST]:"Cb neck to waist",[rp.CB_NECK_TO_WRIST]:"Cb neck to wrist",[rp.CF_NECK_TO_WAIST]:"Cf neck to waist",[rp.ELBOW]:"Elbow",[rp.FOREARM]:"Forearm",[rp.FRONT_CROTCH_LENGTH]:"Front crotch length",[rp.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[rp.HIGH_HIP]:"High hip",[rp.HSP_TO_ACROSS_BACK]:"Hsp to across back",[rp.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[rp.HSP_TO_BUST_POINT]:"Hsp to bust point",[rp.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[rp.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[rp.INSEAM]:"Inseam",[rp.KNEE]:"Knee",[rp.LOW_HIP]:"Low hip",[rp.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[rp.MID_NECK]:"Mid neck",[rp.NECK_AT_BASE]:"Neck at base",[rp.SHOULDER_DROP]:"Shoulder drop",[rp.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[rp.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[rp.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[rp.THIGH]:"Thigh",[rp.TOTAL_RISE_LENGTH]:"Total rise length",[rp.UNDER_BUST]:"Under bust",[rp.VERTICAL_TRUNK]:"Vertical trunk",[rp.WAIST]:"Waist",[rp.WRIST]:"Wrist"};var op;!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"}(op||(op={}));const ap={[op.BLOUSES]:[rp.BUST,rp.ACROSS_SHOULDER,rp.WAIST,rp.LOW_HIP,rp.HIGH_HIP],[op.COATS]:[rp.BUST,rp.ACROSS_SHOULDER,rp.WAIST,rp.LOW_HIP,rp.HIGH_HIP],[op.DRESSES]:[rp.LOW_HIP,rp.BUST,rp.ACROSS_SHOULDER,rp.WAIST],[op.JACKETS]:[rp.BUST,rp.ACROSS_SHOULDER,rp.WAIST,rp.LOW_HIP,rp.HIGH_HIP],[op.PANTS]:[rp.LOW_HIP,rp.WAIST,rp.THIGH,rp.INSEAM],[op.PUFFERS_AND_PARKAS]:[rp.BUST,rp.ACROSS_SHOULDER,rp.WAIST,rp.LOW_HIP,rp.HIGH_HIP],[op.SHORTS]:[rp.LOW_HIP,rp.WAIST,rp.THIGH,rp.INSEAM],[op.SKIRTS]:[rp.LOW_HIP,rp.WAIST],[op.SWEATERS]:[rp.BUST,rp.ACROSS_SHOULDER,rp.WAIST,rp.LOW_HIP,rp.HIGH_HIP],[op.T_SHIRTS_AND_TANKS]:[rp.BUST,rp.ACROSS_SHOULDER,rp.WAIST,rp.LOW_HIP,rp.HIGH_HIP]},cp={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"},up={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"},hp={activewear:{leggings:op.PANTS,joggers:op.PANTS,sweatshirts:op.SWEATERS},dresses:{a_line:op.DRESSES,bodycon:op.DRESSES,fit_and_flare:op.DRESSES,knit:op.DRESSES,shirt:op.DRESSES,slip:op.DRESSES,straight:op.DRESSES,wrap:op.DRESSES},jackets_and_coats:{denim_jackets:op.JACKETS,parkas:op.PUFFERS_AND_PARKAS,peacoats:op.COATS,puffer_jackets:op.PUFFERS_AND_PARKAS,raincoats:op.COATS,rompers:op.COATS,shackets:op.JACKETS,trench_coats:op.COATS},jeans:{bootcut:op.PANTS,flared:op.PANTS,mom:op.PANTS,relaxed:op.PANTS,skinny:op.PANTS,slim:op.PANTS,straight:op.PANTS,tapered:op.PANTS,wide_leg:op.PANTS},jumpsuits_and_rompers:{boiler_suits:op.DRESSES,denim:op.DRESSES,jumpsuits:op.DRESSES,overalls:op.DRESSES,rompers:op.DRESSES,unitards:op.DRESSES},pants_and_shorts:{cigarette:op.PANTS,culottes:op.SHORTS,denim_shorts:op.SHORTS,flared:op.PANTS,joggers:op.PANTS,leggings:op.PANTS,skinny:op.PANTS,wide_leg:op.PANTS},skirts:{a_line_flared:op.SKIRTS,denim:op.SKIRTS,knit:op.SKIRTS,pencil:op.SKIRTS,pleated:op.SKIRTS,skater:op.SKIRTS,slip:op.SKIRTS,wrap:op.SKIRTS},suits_and_tailoring:{blazers:op.JACKETS,suit_jackets:op.JACKETS,suit_skirts:op.SKIRTS,suit_trousers:op.PANTS,suit_vests:op.SWEATERS,trousers:op.PANTS},sweaters:{cardigans:op.SWEATERS,crewnecks:op.SWEATERS,hoodies_and_zipups:op.SWEATERS,sweatshirts:op.SWEATERS,turtlenecks:op.SWEATERS,v_necks:op.SWEATERS},tops:{bodysuits:op.BLOUSES,corsets_and_bustiers:op.BLOUSES,polos:op.T_SHIRTS_AND_TANKS,shirts_and_blouses:op.BLOUSES,t_shirts:op.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:op.T_SHIRTS_AND_TANKS}};var lp;!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"}(lp||(lp={}));const dp={[lp.TOO_TIGHT]:"Too Tight",[lp.TIGHT]:"Tight",[lp.SLIGHTLY_TIGHT]:"Slightly Tight",[lp.PERFECT_FIT]:"Perfect Fit",[lp.SLIGHTLY_LOOSE]:"Slightly Loose",[lp.LOOSE]:"Loose",[lp.OVERSIZED]:"Oversized"};class fp{static get endpoint(){return il.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:s,useToken:r=!0}){const i=this.getUrl(e,r),o={method:n,headers:await this.getHeaders(t,r),credentials:"include"};s&&(o.body=JSON.stringify(s));const a=await fetch(i,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,s){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:s})}static Put(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:s})}static Patch(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:s})}static Delete(t,e,n,s){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:s})}}class pp{constructor(t,e){this.brandId=t,this.firebase=e}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}onInit(){return this.firebase.onInit()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Yf;try{const s=await fp.Get(this.user,`/styles/${t}/recommendation`),r=await s.json();return(null===(e=null==r?void 0:r.fits)||void 0===e?void 0:e.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(t){if((null==t?void 0:t.error)===Zf)throw new Jf;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await fp.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 Xf;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t){var e;const n=await this.getColorwaySizeAssetFromSku(t),s=await this.getStyleCategory(n.style_id),r=await this.getGetTaxonomy(s.style_garment_category_id),i=(null===(e=hp[r.style_category])||void 0===e?void 0:e[r.garment_category])||null;return i?ap[i].map((t=>ip[t])):null}async getColorwaySizeAssets(t,e){const n=[qh("brand_id","==",this.brandId)];t&&n.push(qh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(qh("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 sp(t)}}async getStyleCategory(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return sp(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return sp(t)}}}const gp=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),il.getInstance().setEnv(e),new pp(t,new np));var mp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(mp||(mp={}));var yp=Object.freeze({__proto__:null,get AvatarState(){return mp},get MeasurementLocation(){return rp},MeasurementLocationName:ip,get Classification(){return op},ClassificationLocations:ap,CategoryNames:cp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:up,Taxonomy:hp,get Fit(){return lp},FitNames:dp});export{tp as Errors,gp as initShop,t as requests,e as responses,yp as types};
3168
3168
  //# sourceMappingURL=index.min.js.map