@thefittingroom/sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/api/responses.d.ts +11 -1
- package/dist/esm/index.js +25 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +72 -72
- package/dist/esm/index.min.js.map +1 -1
- package/dist/esm/types/measurement.d.ts +18 -0
- package/package.json +1 -1
package/dist/esm/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom
|
|
2
|
+
* thefittingroom v1.0.1 (2024-02-16T14:45:03.763Z)
|
|
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 r=(new Date).toISOString(),s=R[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${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
|
|
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 r=(new Date).toISOString(),s=R[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${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 H(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 r=t.call(K(this),e,...n);return U.set(r,e.sort?e.sort():[e]),q(r)}}function j(t){return"function"==typeof t?H(t):(t instanceof IDBTransaction&&function(t){if(x.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",i),t.removeEventListener("abort",i)},s=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",s),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 r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",i)},s=()=>{e(q(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),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=j(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$/,""),r=e!==n,s=W.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!z.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),s&&i.done]))[0]};return G.set(e,i),i}B=(t=>({...t,get:(e,n,r)=>$(e,n)||t.get(e,n,r),has:(e,n)=>!!$(e,n)||t.has(e,n)}))(B);
|
|
202
202
|
/**
|
|
203
203
|
* @license
|
|
204
204
|
* Copyright 2019 Google LLC
|
|
@@ -215,7 +215,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
215
215
|
* See the License for the specific language governing permissions and
|
|
216
216
|
* limitations under the License.
|
|
217
217
|
*/
|
|
218
|
-
class Q{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const
|
|
218
|
+
class Q{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Y="@firebase/app",J="0.9.0",X=new O("@firebase/app"),Z="[DEFAULT]",tt={[Y]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},et=new Map,nt=new Map;function rt(t,e){try{t.container.addComponent(e)}catch(n){X.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function st(t){const e=t.name;if(nt.has(e))return X.debug(`There were multiple attempts to register component ${e}.`),!1;nt.set(e,t);for(const e of et.values())rt(e,t);return!0}function it(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
|
|
219
219
|
/**
|
|
220
220
|
* @license
|
|
221
221
|
* 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="",st(new E("platform-logger",(t=>new Q(t)),"PRIVATE")),st(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],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function St(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.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 r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function 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,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}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),r=0;r<e;r++)n[r]=t[r];return n}return[]}function Ht(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Rt(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}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 $t(t,e){return t<e?-1:t>e?1:0}function Gt(){var t=kt.navigator;return t&&(t=t.userAgent)?t:""}function Qt(t){return-1!=Gt().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,re=Qt("Gecko")&&!(-1!=Gt().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),se=-1!=Gt().toLowerCase().indexOf("webkit")&&!Qt("Edge");function ie(){var t=kt.document;return t?t.documentMode:void 0}t:{var oe="",ae=(Xt=Gt(),re?/rv:([^\);]+)(\)|;)/.exec(Xt):ee?/Edge\/([\d\.]+)/.exec(Xt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Xt):se?/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("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=$t(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||$t(0==i[2].length,0==o[2].length)||$t(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,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(re){t:{try{Jt(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType: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,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,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 r in t)e.call(n,t[r],r,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,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[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 r,s=t.g[n],i=Bt(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}Se.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,r,s){if(r&&r.once)return De(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Dt(r)?!!r.capture:!!r,s):Re(t,e,n,!1,r,s)}function Re(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Dt(s)?!!s.capture:!!s,a=xe(t);if(a||(t[Ce]=a=new Se(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Kt||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function De(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)De(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Dt(r)?!!r.capture:!!r,s):Re(t,e,n,!0,r,s)}function Oe(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Oe(t,e[i],n,r,s);else r=Dt(r)?!!r.capture:!!r,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,r,s))&&(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,r,s)),(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,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Pe(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(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,r=t.ha||t.src;t.ea&&Le(t),t=n.call(r,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,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new qt(e,t);else if(e instanceof qt)e.target=e.target||t;else{var s=e;Ee(e=new qt(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=je(o,r,!0,e)&&s}if(s=je(o=e.g=t,r,!0,e)&&s,s=je(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=je(o=e.g=n[i],r,!1,e)&&s}function je(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!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),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,r){Oe(this,t,e,n,r)},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],r=0;r<n.length;r++)we(n[r]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Ve.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};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 $e}),(function(t){return t.reset()})),$e=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 Ge(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){Ge(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 rn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}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 sn(t){Vt.call(this),this.h=t,this.g={}}Ft(sn,Vt);var on=[];function an(t,e,n,r){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var s=0;s<n.length;s++){var i=Ne(e,n[s],r||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,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return He(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}sn.prototype.M=function(){sn.X.M.call(this),cn(this)},sn.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,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new sn(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=tr(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,r=t.U;Array.isArray(r)||(r=[String(r)]),fr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Dn,t.g=fs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new rn(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,r,s,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 ("+r+") [attempt "+s+"]: "+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 r,s=!0;!t.I&&t.C<n.length;){if((r=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),s=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}hn(t.j,t.m,r,null),Wn(t,r)}Un(t)&&r!=Pn&&r!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),s=!1),t.i=t.i&&s,s?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),is(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,r=e.indexOf("\n",n);return-1==r?Pn:(n=Number(e.substring(n,r)),isNaN(n)?Ln:(r+=1)+n>e.length?Pn:(e=e.substr(r,n),t.C=r+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||cs(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||_r(n.h,t)))if(!t.J&&_r(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;as(n),Yr(n)}ss(n),yn(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=wr(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hs(n,11)}else if((t.J||n.g==t)&&as(n),!Wt(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[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&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.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&&(Tr(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Zn(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=ds(r,r.H?r.ka:null,r.V),f.J){Ir(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(Hn(p),Bn(p)),r.g=f}else rs(r);0<n.i.length&&Zr(n)}else"stop"!=i[0]&&"close"!=i[0]||hs(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hs(n,7):Jr(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 r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Rt(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[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==Kr(t)?e.l():this.La(t)},bt.La=function(t){try{if(t==this.g)t:{var e=Kr(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||Wr(this.g)))){this.I||4!=e||7==n||gn(),Hn(this);var r=this.g.aa();this.Y=r;e:if(Un(this)){var s=Wr(this.g);t="";var i=s.length,o=4==Kr(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(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,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(!(r=h)){this.i=!1,this.o=3,yn(12),Kn(this),qn(this);break t}hn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Wn(this,r)}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?cs(this.l,this):(this.i=!1,Bn(this)))}else 400==r&&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=Kr(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 $n=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Gn(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Gn){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 ur;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($n))?(this.h=!!e,Jn(this,n[1]||"",!0),this.s=er(n[2]||""),this.g=er(n[3]||"",!0),Yn(this,n[4]),this.l=er(n[5]||"",!0),Xn(this,n[6]||"",!0),this.o=er(n[7]||"")):(this.h=!!e,this.i=new ur(null,this.h))}function Qn(t){return new Gn(t)}function Jn(t,e,n){t.j=n?er(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 ur?(t.i=e,function(t,e){e&&!t.j&&(hr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(lr(this,e),fr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=nr(e,ar)),t.i=new ur(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function tr(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 er(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function nr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,rr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function rr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Gn.prototype.toString=function(){var t=[],e=this.j;e&&t.push(nr(e,sr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(nr(e,sr,!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(nr(n,"/"==n.charAt(0)?or:ir,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",nr(n,cr)),t.join("")};var sr=/[#\/\?@]/g,ir=/[#\?:]/g,or=/[#\?]/g,ar=/[#\?@]/g,cr=/#/g;function ur(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function lr(t,e){hr(t),e=pr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function dr(t,e){return hr(t),e=pr(t,e),t.g.has(e)}function fr(t,e,n){lr(t,e),0<n.length&&(t.i=null,t.g.set(pr(t,e),jt(n)),t.h+=n.length)}function pr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(bt=ur.prototype).add=function(t,e){hr(this),this.i=null,t=pr(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){hr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},bt.oa=function(){hr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},bt.W=function(t){hr(this);var e=[];if("string"==typeof t)dr(this,t)&&(e=e.concat(this.g.get(pr(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 hr(this),this.i=null,dr(this,t=pr(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 r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var gr=function(t,e){this.h=t,this.g=e};function mr(t){this.l=t||yr,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 yr=10;function vr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function wr(t){return t.h?1:t.g?t.g.size:0}function _r(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Tr(t,e){t.g?t.g.add(e):t.h=e}function Ir(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Er(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=Et(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return jt(t.i)}function Sr(){}function br(){this.g=new Sr}function Ar(t,e,n){var r=n||"";try{zn(t,(function(t,n){var s=t;Dt(t)&&(s=He(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Cr(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function kr(t){this.l=t.ac||null,this.j=t.jb||!1}function Nr(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Rr,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}mr.prototype.cancel=function(){var t,e;if(this.i=Er(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()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Sr.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Sr.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(kr,In),kr.prototype.g=function(){return new Nr(this.l,this.j)},kr.prototype.i=function(t){return function(){return t}}({}),Ft(Nr,Ve);var Rr=0;function Dr(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Or(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Lr(t)}function Lr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(bt=Nr.prototype).open=function(t,e){if(this.readyState!=Rr)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Lr(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,Or(this)),this.readyState=Rr},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,Lr(this)),this.g&&(this.readyState=3,Lr(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;Dr(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?Or(this):Lr(this),3==this.readyState&&Dr(this)}},bt.Va=function(t){this.g&&(this.response=this.responseText=t,Or(this))},bt.Ua=function(t){this.g&&(this.response=t,Or(this))},bt.ga=function(){this.g&&Or(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(Nr.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Pr=kt.JSON.parse;function Mr(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=xr,this.K=this.L=!1}Ft(Mr,Ve);var xr="",Ur=/^https?$/i,Fr=["POST","PUT"];function Vr(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Br(t),Hr(t)}function Br(t){t.D||(t.D=!0,Be(t,"complete"),Be(t,"error"))}function jr(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=Kr(t)||2!=t.aa()))if(t.v&&4==Kr(t))en(t.Ha,0,t);else if(Be(t,"readystatechange"),4==Kr(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match($n)[1]||null;if(!i&&kt.self&&kt.self.location){var o=kt.self.location.protocol;i=o.substr(0,o.length-1)}s=!Ur.test(i?i.toLowerCase():"")}e=s}if(e)Be(t,"complete"),Be(t,"success");else{t.m=6;try{var a=2<Kr(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Br(t)}}finally{Hr(t)}}}function Hr(t,e){if(t.g){qr(t);var n=t.g,r=t.C[0]?Nt:null;t.g=null,t.C=null,e||Be(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function qr(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function Kr(t){return t.g?t.g.readyState:0}function Wr(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function zr(t){var e="";return _e(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function $r(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=zr(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function Gr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qr(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=Gr("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=Gr("baseRetryDelayMs",5e3,t),this.bb=Gr("retryDelaySeedMs",1e4,t),this.$a=Gr("forwardChannelMaxRetries",2,t),this.ta=Gr("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 mr(t&&t.concurrentRequestLimit),this.Fa=new br,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Jr(t){if(Xr(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"),es(t,n),(e=new Rn(t,t.j,e,void 0)).K=2,e.v=tr(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=fs(e.l,null),e.g.da(e.v)),e.F=Date.now(),Bn(e)}ls(t)}function Yr(t){t.g&&(is(t),t.g.cancel(),t.g=null)}function Xr(t){Yr(t),t.u&&(kt.clearTimeout(t.u),t.u=null),as(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zr(t){vr(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function ts(t,e){var n;n=e?e.m:t.U++;var r=Qn(t.F);Zn(r,"SID",t.I),Zn(r,"RID",n),Zn(r,"AID",t.T),es(t,r),t.o&&t.s&&$r(r,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=ns(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Tr(t.h,n),Mn(n,r,e)}function es(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 ns(t,e,n){n=Math.min(t.i.length,n);var r=t.l?xt(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{Ar(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function rs(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function ss(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),us(t,t.A)),t.A++,!0)}function is(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function os(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"),es(t,e),t.o&&t.s&&$r(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=tr(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function as(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cs(t,e){var n=null;if(t.g==e){as(t),is(t),t.g=null;var r=2}else{if(!_r(t.h,e))return;n=e.D,Ir(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;Be(r=fn(),new vn(r,n)),Zr(t)}else rs(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(wr(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),us(t,t.C)),t.C++,0)))}(t,e)||2==r&&ss(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:hs(t,5);break;case 4:hs(t,10);break;case 3:hs(t,6);break;default:hs(t,2)}}function us(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hs(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=xt(t.kb,t);n||(n=new Gn("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Jn(n,"https"),tr(n)),function(t,e){var n=new un;if(kt.Image){var r=new Image;r.onload=Ut(Cr,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Ut(Cr,n,r,"TestLoadImage: error",!1,e),r.onabort=Ut(Cr,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Ut(Cr,n,r,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else yn(2);t.G=0,t.l&&t.l.va(e),ls(t),Xr(t)}function ls(t){if(t.G=0,t.la=[],t.l){var e=Er(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 ds(t,e,n){var r=n instanceof Gn?Qn(n):new Gn(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Yn(r,r.m);else{var s=kt.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Gn(null,void 0);r&&Jn(i,r),e&&(i.g=e),s&&Yn(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&Zn(r,n,e),Zn(r,"VER",t.ma),es(t,r),r}function fs(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 Mr(new kr({jb:!0})):new Mr(t.ra)).Ka(t.H),e}function ps(){}function gs(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function ms(t,e){Ve.call(this),this.g=new Qr(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!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 ws(this)}function ys(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 vs(){kn.call(this),this.status=1}function ws(t){this.g=t}(bt=Mr.prototype).Ka=function(t){this.L=t},bt.da=function(t,e,n,r){var s,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 Vr(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=Et(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=Bt(Fr,e))||r||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{qr(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){Vr(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"),Hr(this))},bt.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Hr(this,!0)),Mr.X.M.call(this)},bt.Ha=function(){this.s||(this.F||this.v||this.l?jr(this):this.fb())},bt.fb=function(){jr(this)},bt.aa=function(){try{return 2<Kr(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)),Pr(e)}},bt.Ea=function(){return this.m},bt.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(bt=Qr.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 r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=ns(this,e,r),Zn(s=Qn(this.F),"RID",t),Zn(s,"CVER",22),this.D&&Zn(s,"X-HTTP-Session-Id",this.D),es(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(zr(n)))+"&"+r:this.o&&$r(s,this.o,n)),Tr(this.h,e),this.Ya&&Zn(s,"TYPE","init"),this.O?(Zn(s,"$req",r),Zn(s,"SID","null"),e.Z=!0,Mn(e,s,null)):Mn(e,s,r),this.G=2}}else 3==this.G&&(t?ts(this,t):0==this.i.length||vr(this.h)||ts(this))},bt.Ia=function(){if(this.u=null,os(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),Yr(this),os(this))},bt.cb=function(){null!=this.v&&(this.v=null,Yr(this),ss(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=ps.prototype).xa=function(){},bt.wa=function(){},bt.va=function(){},bt.ua=function(){},bt.Ra=function(){},gs.prototype.g=function(t,e){return new ms(t,e)},Ft(ms,Ve),ms.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=ds(t,null,t.V),Zr(t)},ms.prototype.close=function(){Jr(this.g)},ms.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 gr(e.ab++,t)),3==e.G&&Zr(e)},ms.prototype.M=function(){this.g.l=null,delete this.j,Jr(this.g),delete this.g,ms.X.M.call(this)},Ft(ys,Cn),Ft(vs,kn),Ft(ws,ps),ws.prototype.xa=function(){Be(this.g,"a")},ws.prototype.wa=function(t){Be(this.g,new ys(t))},ws.prototype.va=function(t){Be(this.g,new vs)},ws.prototype.ua=function(){Be(this.g,"b")},gs.prototype.createWebChannel=gs.prototype.g,ms.prototype.send=ms.prototype.u,ms.prototype.open=ms.prototype.m,ms.prototype.close=ms.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,Mr.prototype.listenOnce=Mr.prototype.O,Mr.prototype.getLastError=Mr.prototype.Oa,Mr.prototype.getLastErrorCode=Mr.prototype.Ea,Mr.prototype.getStatus=Mr.prototype.aa,Mr.prototype.getResponseJson=Mr.prototype.Sa,Mr.prototype.getResponseText=Mr.prototype.fa,Mr.prototype.send=Mr.prototype.da,Mr.prototype.setWithCredentials=Mr.prototype.Ka;var _s=_n,Ts=Tn,Is=ln,Es=10,Ss=11,bs=kr,As=Sn,Cs=Mr;const ks="@firebase/firestore";
|
|
315
|
+
*/var Tt;Tt="",st(new E("platform-logger",(t=>new Q(t)),"PRIVATE")),st(new E("heartbeat",(t=>new yt(t)),"PRIVATE")),lt(Y,J,Tt),lt(Y,J,"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],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function St(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.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 r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function 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,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}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 Ht(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function jt(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Rt(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}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 Yt(t){return Yt[" "](t),t}Yt[" "]=Nt;var Jt,Xt,Zt=Qt("Opera"),te=Qt("Trident")||Qt("MSIE"),ee=Qt("Edge"),ne=ee||te,re=Qt("Gecko")&&!(-1!=$t().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),se=-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(),re?/rv:([^\);]+)(\)|;)/.exec(Xt):ee?/Edge\/([\d\.]+)/.exec(Xt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Xt):se?/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)){Jt=String(ce);break t}}Jt=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(Jt)).split("."),n=Wt("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";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(Jt,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,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(re){t:{try{Yt(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType: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,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,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 r in t)e.call(n,t[r],r,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,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[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 r,s=t.g[n],i=Bt(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}Se.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,r,s){if(r&&r.once)return De(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Dt(r)?!!r.capture:!!r,s):Re(t,e,n,!1,r,s)}function Re(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Dt(s)?!!s.capture:!!s,a=xe(t);if(a||(t[Ce]=a=new Se(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Kt||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function De(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)De(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Dt(r)?!!r.capture:!!r,s):Re(t,e,n,!0,r,s)}function Oe(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Oe(t,e[i],n,r,s);else r=Dt(r)?!!r.capture:!!r,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,r,s))&&(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,r,s)),(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,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Pe(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(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,r=t.ha||t.src;t.ea&&Le(t),t=n.call(r,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,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new qt(e,t);else if(e instanceof qt)e.target=e.target||t;else{var s=e;Ee(e=new qt(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=He(o,r,!0,e)&&s}if(s=He(o=e.g=t,r,!0,e)&&s,s=He(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=He(o=e.g=n[i],r,!1,e)&&s}function He(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!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),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,r){Oe(this,t,e,n,r)},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],r=0;r<n.length;r++)we(n[r]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Ve.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var je=kt.JSON.stringify;function qe(){var t=Je,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)}}(),Ye||(Ke(),Ye=!0),Je.add(t,e)}var Ye=!1,Je=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)}Ye=!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 rn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}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 sn(t){Vt.call(this),this.h=t,this.g={}}Ft(sn,Vt);var on=[];function an(t,e,n,r){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var s=0;s<n.length;s++){var i=Ne(e,n[s],r||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,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return je(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}sn.prototype.M=function(){sn.X.M.call(this),cn(this)},sn.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,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new sn(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=tr(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,r=t.U;Array.isArray(r)||(r=[String(r)]),fr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Dn,t.g=fs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new rn(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,r,s,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 ("+r+") [attempt "+s+"]: "+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 r,s=!0;!t.I&&t.C<n.length;){if((r=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),s=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}hn(t.j,t.m,r,null),zn(t,r)}Un(t)&&r!=Pn&&r!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),s=!1),t.i=t.i&&s,s?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),is(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,r=e.indexOf("\n",n);return-1==r?Pn:(n=Number(e.substring(n,r)),isNaN(n)?Ln:(r+=1)+n>e.length?Pn:(e=e.substr(r,n),t.C=r+n,e))}function Bn(t){t.V=Date.now()+t.O,Hn(t,t.O)}function Hn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=wn(xt(t.gb,t),e)}function jn(t){t.B&&(kt.clearTimeout(t.B),t.B=null)}function qn(t){0==t.l.G||t.I||cs(t.l,t)}function Kn(t){jn(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||_r(n.h,t)))if(!t.J&&_r(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;as(n),Jr(n)}ss(n),yn(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=wr(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hs(n,11)}else if((t.J||n.g==t)&&as(n),!zt(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[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&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.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&&(Tr(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Zn(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=ds(r,r.H?r.ka:null,r.V),f.J){Ir(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(jn(p),Bn(p)),r.g=f}else rs(r);0<n.i.length&&Zr(n)}else"stop"!=i[0]&&"close"!=i[0]||hs(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hs(n,7):Yr(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 r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Rt(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[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==Kr(t)?e.l():this.La(t)},bt.La=function(t){try{if(t==this.g)t:{var e=Kr(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||zr(this.g)))){this.I||4!=e||7==n||gn(),jn(this);var r=this.g.aa();this.Y=r;e:if(Un(this)){var s=zr(this.g);t="";var i=s.length,o=4==Kr(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(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,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(!(r=h)){this.i=!1,this.o=3,yn(12),Kn(this),qn(this);break t}hn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,zn(this,r)}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?cs(this.l,this):(this.i=!1,Bn(this)))}else 400==r&&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=Kr(this.g),e=this.g.fa();this.C<e.length&&(jn(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)):Hn(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,Yn(this,t.j),this.s=t.s,this.g=t.g,Jn(this,t.m),this.l=t.l,e=t.i;var n=new ur;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,Yn(this,n[1]||"",!0),this.s=er(n[2]||""),this.g=er(n[3]||"",!0),Jn(this,n[4]),this.l=er(n[5]||"",!0),Xn(this,n[6]||"",!0),this.o=er(n[7]||"")):(this.h=!!e,this.i=new ur(null,this.h))}function Qn(t){return new $n(t)}function Yn(t,e,n){t.j=n?er(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Jn(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 ur?(t.i=e,function(t,e){e&&!t.j&&(hr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(lr(this,e),fr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=nr(e,ar)),t.i=new ur(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function tr(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 er(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function nr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,rr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function rr(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(nr(e,sr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(nr(e,sr,!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(nr(n,"/"==n.charAt(0)?or:ir,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",nr(n,cr)),t.join("")};var sr=/[#\/\?@]/g,ir=/[#\?:]/g,or=/[#\?]/g,ar=/[#\?@]/g,cr=/#/g;function ur(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function lr(t,e){hr(t),e=pr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function dr(t,e){return hr(t),e=pr(t,e),t.g.has(e)}function fr(t,e,n){lr(t,e),0<n.length&&(t.i=null,t.g.set(pr(t,e),Ht(n)),t.h+=n.length)}function pr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(bt=ur.prototype).add=function(t,e){hr(this),this.i=null,t=pr(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){hr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},bt.oa=function(){hr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},bt.W=function(t){hr(this);var e=[];if("string"==typeof t)dr(this,t)&&(e=e.concat(this.g.get(pr(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 hr(this),this.i=null,dr(this,t=pr(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 r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var gr=function(t,e){this.h=t,this.g=e};function mr(t){this.l=t||yr,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 yr=10;function vr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function wr(t){return t.h?1:t.g?t.g.size:0}function _r(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Tr(t,e){t.g?t.g.add(e):t.h=e}function Ir(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Er(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=Et(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return Ht(t.i)}function Sr(){}function br(){this.g=new Sr}function Ar(t,e,n){var r=n||"";try{Wn(t,(function(t,n){var s=t;Dt(t)&&(s=je(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Cr(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function kr(t){this.l=t.ac||null,this.j=t.jb||!1}function Nr(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Rr,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}mr.prototype.cancel=function(){var t,e;if(this.i=Er(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()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Sr.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Sr.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(kr,In),kr.prototype.g=function(){return new Nr(this.l,this.j)},kr.prototype.i=function(t){return function(){return t}}({}),Ft(Nr,Ve);var Rr=0;function Dr(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Or(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Lr(t)}function Lr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(bt=Nr.prototype).open=function(t,e){if(this.readyState!=Rr)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Lr(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,Or(this)),this.readyState=Rr},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,Lr(this)),this.g&&(this.readyState=3,Lr(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;Dr(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?Or(this):Lr(this),3==this.readyState&&Dr(this)}},bt.Va=function(t){this.g&&(this.response=this.responseText=t,Or(this))},bt.Ua=function(t){this.g&&(this.response=t,Or(this))},bt.ga=function(){this.g&&Or(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(Nr.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Pr=kt.JSON.parse;function Mr(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=xr,this.K=this.L=!1}Ft(Mr,Ve);var xr="",Ur=/^https?$/i,Fr=["POST","PUT"];function Vr(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Br(t),jr(t)}function Br(t){t.D||(t.D=!0,Be(t,"complete"),Be(t,"error"))}function Hr(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=Kr(t)||2!=t.aa()))if(t.v&&4==Kr(t))en(t.Ha,0,t);else if(Be(t,"readystatechange"),4==Kr(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=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)}s=!Ur.test(i?i.toLowerCase():"")}e=s}if(e)Be(t,"complete"),Be(t,"success");else{t.m=6;try{var a=2<Kr(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Br(t)}}finally{jr(t)}}}function jr(t,e){if(t.g){qr(t);var n=t.g,r=t.C[0]?Nt:null;t.g=null,t.C=null,e||Be(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function qr(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function Kr(t){return t.g?t.g.readyState:0}function zr(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Wr(t){var e="";return _e(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Gr(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Wr(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function $r(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qr(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=$r("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=$r("baseRetryDelayMs",5e3,t),this.bb=$r("retryDelaySeedMs",1e4,t),this.$a=$r("forwardChannelMaxRetries",2,t),this.ta=$r("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 mr(t&&t.concurrentRequestLimit),this.Fa=new br,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Yr(t){if(Xr(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"),es(t,n),(e=new Rn(t,t.j,e,void 0)).K=2,e.v=tr(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=fs(e.l,null),e.g.da(e.v)),e.F=Date.now(),Bn(e)}ls(t)}function Jr(t){t.g&&(is(t),t.g.cancel(),t.g=null)}function Xr(t){Jr(t),t.u&&(kt.clearTimeout(t.u),t.u=null),as(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zr(t){vr(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function ts(t,e){var n;n=e?e.m:t.U++;var r=Qn(t.F);Zn(r,"SID",t.I),Zn(r,"RID",n),Zn(r,"AID",t.T),es(t,r),t.o&&t.s&&Gr(r,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=ns(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Tr(t.h,n),Mn(n,r,e)}function es(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 ns(t,e,n){n=Math.min(t.i.length,n);var r=t.l?xt(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{Ar(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function rs(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function ss(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),us(t,t.A)),t.A++,!0)}function is(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function os(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"),es(t,e),t.o&&t.s&&Gr(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=tr(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function as(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cs(t,e){var n=null;if(t.g==e){as(t),is(t),t.g=null;var r=2}else{if(!_r(t.h,e))return;n=e.D,Ir(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;Be(r=fn(),new vn(r,n)),Zr(t)}else rs(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(wr(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),us(t,t.C)),t.C++,0)))}(t,e)||2==r&&ss(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:hs(t,5);break;case 4:hs(t,10);break;case 3:hs(t,6);break;default:hs(t,2)}}function us(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hs(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=xt(t.kb,t);n||(n=new $n("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Yn(n,"https"),tr(n)),function(t,e){var n=new un;if(kt.Image){var r=new Image;r.onload=Ut(Cr,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Ut(Cr,n,r,"TestLoadImage: error",!1,e),r.onabort=Ut(Cr,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Ut(Cr,n,r,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else yn(2);t.G=0,t.l&&t.l.va(e),ls(t),Xr(t)}function ls(t){if(t.G=0,t.la=[],t.l){var e=Er(t.h);0==e.length&&0==t.i.length||(jt(t.la,e),jt(t.la,t.i),t.h.i.length=0,Ht(t.i),t.i.length=0),t.l.ua()}}function ds(t,e,n){var r=n instanceof $n?Qn(n):new $n(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Jn(r,r.m);else{var s=kt.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new $n(null,void 0);r&&Yn(i,r),e&&(i.g=e),s&&Jn(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&Zn(r,n,e),Zn(r,"VER",t.ma),es(t,r),r}function fs(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 Mr(new kr({jb:!0})):new Mr(t.ra)).Ka(t.H),e}function ps(){}function gs(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function ms(t,e){Ve.call(this),this.g=new Qr(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!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 ws(this)}function ys(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 vs(){kn.call(this),this.status=1}function ws(t){this.g=t}(bt=Mr.prototype).Ka=function(t){this.L=t},bt.da=function(t,e,n,r){var s,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 Vr(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=Et(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=Bt(Fr,e))||r||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{qr(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){Vr(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"),jr(this))},bt.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),jr(this,!0)),Mr.X.M.call(this)},bt.Ha=function(){this.s||(this.F||this.v||this.l?Hr(this):this.fb())},bt.fb=function(){Hr(this)},bt.aa=function(){try{return 2<Kr(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)),Pr(e)}},bt.Ea=function(){return this.m},bt.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(bt=Qr.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 r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=ns(this,e,r),Zn(s=Qn(this.F),"RID",t),Zn(s,"CVER",22),this.D&&Zn(s,"X-HTTP-Session-Id",this.D),es(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Wr(n)))+"&"+r:this.o&&Gr(s,this.o,n)),Tr(this.h,e),this.Ya&&Zn(s,"TYPE","init"),this.O?(Zn(s,"$req",r),Zn(s,"SID","null"),e.Z=!0,Mn(e,s,null)):Mn(e,s,r),this.G=2}}else 3==this.G&&(t?ts(this,t):0==this.i.length||vr(this.h)||ts(this))},bt.Ia=function(){if(this.u=null,os(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),Jr(this),os(this))},bt.cb=function(){null!=this.v&&(this.v=null,Jr(this),ss(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=ps.prototype).xa=function(){},bt.wa=function(){},bt.va=function(){},bt.ua=function(){},bt.Ra=function(){},gs.prototype.g=function(t,e){return new ms(t,e)},Ft(ms,Ve),ms.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=ds(t,null,t.V),Zr(t)},ms.prototype.close=function(){Yr(this.g)},ms.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=je(t),t=n);e.i.push(new gr(e.ab++,t)),3==e.G&&Zr(e)},ms.prototype.M=function(){this.g.l=null,delete this.j,Yr(this.g),delete this.g,ms.X.M.call(this)},Ft(ys,Cn),Ft(vs,kn),Ft(ws,ps),ws.prototype.xa=function(){Be(this.g,"a")},ws.prototype.wa=function(t){Be(this.g,new ys(t))},ws.prototype.va=function(t){Be(this.g,new vs)},ws.prototype.ua=function(){Be(this.g,"b")},gs.prototype.createWebChannel=gs.prototype.g,ms.prototype.send=ms.prototype.u,ms.prototype.open=ms.prototype.m,ms.prototype.close=ms.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,Mr.prototype.listenOnce=Mr.prototype.O,Mr.prototype.getLastError=Mr.prototype.Oa,Mr.prototype.getLastErrorCode=Mr.prototype.Ea,Mr.prototype.getStatus=Mr.prototype.aa,Mr.prototype.getResponseJson=Mr.prototype.Sa,Mr.prototype.getResponseText=Mr.prototype.fa,Mr.prototype.send=Mr.prototype.da,Mr.prototype.setWithCredentials=Mr.prototype.Ka;var _s=_n,Ts=Tn,Is=ln,Es=10,Ss=11,bs=kr,As=Sn,Cs=Mr;const ks="@firebase/firestore";
|
|
316
316
|
/**
|
|
317
317
|
* @license
|
|
318
318
|
* Copyright 2017 Google LLC
|
|
@@ -409,7 +409,7 @@ let Rs="9.15.0";
|
|
|
409
409
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
410
410
|
* See the License for the specific language governing permissions and
|
|
411
411
|
* limitations under the License.
|
|
412
|
-
*/const Bs={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class
|
|
412
|
+
*/const Bs={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Hs extends d{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
|
|
413
413
|
/**
|
|
414
414
|
* @license
|
|
415
415
|
* Copyright 2017 Google LLC
|
|
@@ -425,7 +425,7 @@ let Rs="9.15.0";
|
|
|
425
425
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
426
426
|
* See the License for the specific language governing permissions and
|
|
427
427
|
* limitations under the License.
|
|
428
|
-
*/class
|
|
428
|
+
*/class js{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
|
|
429
429
|
/**
|
|
430
430
|
* @license
|
|
431
431
|
* Copyright 2017 Google LLC
|
|
@@ -441,7 +441,7 @@ let Rs="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 qs{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Ks{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Ns.UNAUTHENTICATED)))}shutdown(){}}class
|
|
444
|
+
*/class qs{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Ks{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Ns.UNAUTHENTICATED)))}shutdown(){}}class zs{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 Ws{constructor(t){this.t=t,this.currentUser=Ns.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let s=new js;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new js,t.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const e=s;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Ls("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):(Ls("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new js)}}),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?(Ls("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Fs("string"==typeof e.accessToken),new qs(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 Fs(null===t||"string"==typeof t),new Ns(t)}}class Gs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=Ns.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Fs(!("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 $s{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new Gs(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Ns.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Qs{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Ys{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Ls("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,Ls("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Ls("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):Ls("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Fs("string"==typeof t.token),this.A=t.token,new Qs(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
|
|
445
445
|
/**
|
|
446
446
|
* @license
|
|
447
447
|
* Copyright 2020 Google LLC
|
|
@@ -457,7 +457,7 @@ let Rs="9.15.0";
|
|
|
457
457
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
458
458
|
* See the License for the specific language governing permissions and
|
|
459
459
|
* limitations under the License.
|
|
460
|
-
*/function
|
|
460
|
+
*/function Js(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
|
|
461
461
|
/**
|
|
462
462
|
* @license
|
|
463
463
|
* Copyright 2017 Google LLC
|
|
@@ -473,7 +473,7 @@ let Rs="9.15.0";
|
|
|
473
473
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
474
474
|
* See the License for the specific language governing permissions and
|
|
475
475
|
* limitations under the License.
|
|
476
|
-
*/class Xs{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length;let n="";for(;n.length<20;){const r=
|
|
476
|
+
*/class Xs{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length;let n="";for(;n.length<20;){const r=Js(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%t.length))}return n}}function Zs(t,e){return t<e?-1:t>e?1:0}function ti(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
|
|
477
477
|
/**
|
|
478
478
|
* @license
|
|
479
479
|
* Copyright 2017 Google LLC
|
|
@@ -489,7 +489,7 @@ let Rs="9.15.0";
|
|
|
489
489
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
490
490
|
* See the License for the specific language governing permissions and
|
|
491
491
|
* limitations under the License.
|
|
492
|
-
*/class ei{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new
|
|
492
|
+
*/class ei{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Hs(Bs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Hs(Bs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Hs(Bs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Hs(Bs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return ei.fromMillis(Date.now())}static fromDate(t){return ei.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new ei(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Zs(this.nanoseconds,t.nanoseconds):Zs(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
|
|
493
493
|
/**
|
|
494
494
|
* @license
|
|
495
495
|
* Copyright 2017 Google LLC
|
|
@@ -521,7 +521,7 @@ let Rs="9.15.0";
|
|
|
521
521
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
522
522
|
* See the License for the specific language governing permissions and
|
|
523
523
|
* limitations under the License.
|
|
524
|
-
*/class ri{constructor(t,e,n){void 0===e?e=0:e>t.length&&Us(),void 0===n?n=t.length-e:n>t.length-e&&Us(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===ri.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof ri?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),s=e.get(r);if(n<s)return-1;if(n>s)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class si extends ri{construct(t,e,n){return new si(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new
|
|
524
|
+
*/class ri{constructor(t,e,n){void 0===e?e=0:e>t.length&&Us(),void 0===n?n=t.length-e:n>t.length-e&&Us(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===ri.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof ri?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),s=e.get(r);if(n<s)return-1;if(n>s)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class si extends ri{construct(t,e,n){return new si(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Hs(Bs.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new si(e)}static emptyPath(){return new si([])}}const ii=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class oi extends ri{construct(t,e,n){return new oi(t,e,n)}static isValidIdentifier(t){return ii.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),oi.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new oi(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Hs(Bs.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let i=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new Hs(Bs.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Hs(Bs.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(i=!i,r++):"."!==e||i?(n+=e,r++):(s(),r++)}if(s(),i)throw new Hs(Bs.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new oi(e)}static emptyPath(){return new oi([])}}
|
|
525
525
|
/**
|
|
526
526
|
* @license
|
|
527
527
|
* Copyright 2017 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:Us()}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),r=bi(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return 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),r=Ai(e.doubleValue);return n===r?Ii(n)===Ii(r):isNaN(n)&&isNaN(r)}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||{},r=e.mapValue.fields||{};if(vi(n)!==vi(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Li(n[t],r[t])))return!1;return!0}(t,e);default:return Us()}}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),r=Oi(e);if(n!==r)return Zs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Zs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ai(t.integerValue||t.doubleValue),r=Ai(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return xi(t.timestampValue,e.timestampValue);case 4:return xi(Ri(t),Ri(e));case 5:return Zs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Ci(t),r=Ci(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=Zs(n[t],r[t]);if(0!==e)return e}return Zs(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Zs(Ai(t.latitude),Ai(e.latitude));return 0!==n?n:Zs(Ai(t.longitude),Ai(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Mi(n[t],r[t]);if(e)return e}return Zs(n.length,r.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||{},r=Object.keys(n),s=e.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let t=0;t<r.length&&t<i.length;++t){const e=Zs(r[t],i[t]);if(0!==e)return e;const o=Mi(n[r[t]],s[i[t]]);if(0!==o)return o}return Zs(r.length,i.length)}(t.mapValue,e.mapValue);default:throw Us()}}function xi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Zs(t,e);const n=bi(t),r=bi(e),s=Zs(n.seconds,r.seconds);return 0!==s?s:Zs(n.nanos,r.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 r of t.values||[])n?n=!1:e+=",",e+=Fi(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const s of e)r?r=!1:n+=",",n+=`${s}:${Fi(t.fields[s])}`;return n+"}"}(t.mapValue):Us();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
|
|
734
|
+
*/(t)?9007199254740991:10:Us()}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),r=bi(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return 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),r=Ai(e.doubleValue);return n===r?Ii(n)===Ii(r):isNaN(n)&&isNaN(r)}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||{},r=e.mapValue.fields||{};if(vi(n)!==vi(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Li(n[t],r[t])))return!1;return!0}(t,e);default:return Us()}}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),r=Oi(e);if(n!==r)return Zs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Zs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ai(t.integerValue||t.doubleValue),r=Ai(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return xi(t.timestampValue,e.timestampValue);case 4:return xi(Ri(t),Ri(e));case 5:return Zs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Ci(t),r=Ci(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=Zs(n[t],r[t]);if(0!==e)return e}return Zs(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Zs(Ai(t.latitude),Ai(e.latitude));return 0!==n?n:Zs(Ai(t.longitude),Ai(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Mi(n[t],r[t]);if(e)return e}return Zs(n.length,r.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||{},r=Object.keys(n),s=e.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let t=0;t<r.length&&t<i.length;++t){const e=Zs(r[t],i[t]);if(0!==e)return e;const o=Mi(n[r[t]],s[i[t]]);if(0!==o)return o}return Zs(r.length,i.length)}(t.mapValue,e.mapValue);default:throw Us()}}function xi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Zs(t,e);const n=bi(t),r=bi(e),s=Zs(n.seconds,r.seconds);return 0!==s?s:Zs(n.nanos,r.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 r of t.values||[])n?n=!1:e+=",",e+=Fi(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const s of e)r?r=!1:n+=",",n+=`${s}:${Fi(t.fields[s])}`;return n+"}"}(t.mapValue):Us();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 Hi(t){return!!t&&"arrayValue"in t}function ji(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 r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(r=i.field.isKeyField()?ai.comparator(ai.fromName(o.referenceValue),n.key):Mi(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}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
|
|
@@ -747,7 +747,7 @@ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
747
747
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
748
748
|
* See the License for the specific language governing permissions and
|
|
749
749
|
* limitations under the License.
|
|
750
|
-
*/class Qi{}class
|
|
750
|
+
*/class Qi{}class Yi extends Qi{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new ro(t,e,n):"array-contains"===e?new ao(t,n):"in"===e?new co(t,n):"not-in"===e?new uo(t,n):"array-contains-any"===e?new ho(t,n):new Yi(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new so(t,n):new io(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Mi(e,this.value)):null!==e&&Oi(this.value)===Oi(e)&&this.matchesComparison(Mi(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Us()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Ji extends Qi{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Ji(t,e)}matches(t){return Xi(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Xi(t){return"and"===t.op}function Zi(t){return function(t){for(const e of t.filters)if(e instanceof Ji)return!1;return!0}(t)&&Xi(t)}function to(t){if(t instanceof Yi)return t.field.canonicalString()+t.op.toString()+Ui(t.value);{const e=t.filters.map((t=>to(t))).join(",");return`${t.op}(${e})`}}function eo(t,e){return t instanceof Yi?function(t,e){return e instanceof Yi&&t.op===e.op&&t.field.isEqual(e.field)&&Li(t.value,e.value)}(t,e):t instanceof Ji?function(t,e){return e instanceof Ji&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&eo(n,e.filters[r])),!0)}(t,e):void Us()}function no(t){return t instanceof Yi?function(t){return`${t.field.canonicalString()} ${t.op} ${Ui(t.value)}`}(t):t instanceof Ji?function(t){return t.op.toString()+" {"+t.getFilters().map(no).join(" ,")+"}"}(t):"Filter"}class ro extends Yi{constructor(t,e,n){super(t,e,n),this.key=ai.fromName(n.referenceValue)}matches(t){const e=ai.comparator(t.key,this.key);return this.matchesComparison(e)}}class so extends Yi{constructor(t,e){super(t,"in",e),this.keys=oo("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class io extends Yi{constructor(t,e){super(t,"not-in",e),this.keys=oo("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function oo(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>ai.fromName(t.referenceValue)))}class ao extends Yi{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Hi(e)&&Pi(e.arrayValue,this.value)}}class co extends Yi{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Pi(this.value.arrayValue,e)}}class uo extends Yi{constructor(t,e){super(t,"not-in",e)}matches(t){if(Pi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Pi(this.value.arrayValue,e)}}class ho extends Yi{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Hi(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Pi(this.value.arrayValue,t)))}}
|
|
751
751
|
/**
|
|
752
752
|
* @license
|
|
753
753
|
* 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()]=
|
|
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={},r=[];t.forEach(((t,s)=>{if(!e.isImmediateParentOf(s)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=s.popLast()}t?n[s.lastSegment()]=zi(t):r.push(s.lastSegment())}));const s=this.getFieldsMap(e);this.applyChanges(s,n,r)}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 r=e.mapValue.fields[t.get(n)];Ki(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}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))}}
|
|
832
832
|
/**
|
|
833
833
|
* @license
|
|
834
834
|
* Copyright 2017 Google LLC
|
|
@@ -860,7 +860,7 @@ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(
|
|
|
860
860
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
861
861
|
* See the License for the specific language governing permissions and
|
|
862
862
|
* limitations under the License.
|
|
863
|
-
*/class Io{constructor(t,e=null,n=[],r=[],s=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.ft=null}}function Eo(t,e=null,n=[],r=[],s=null,i=null,o=null){return new Io(t,e,n,r,s,i,o)}function So(t){const e=Vs(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>to(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),Ti(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Ui(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Ui(t))).join(",")),e.ft=t}return e.ft}function bo(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!fo(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!eo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)
|
|
863
|
+
*/class Io{constructor(t,e=null,n=[],r=[],s=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.ft=null}}function Eo(t,e=null,n=[],r=[],s=null,i=null,o=null){return new Io(t,e,n,r,s,i,o)}function So(t){const e=Vs(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>to(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),Ti(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Ui(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Ui(t))).join(",")),e.ft=t}return e.ft}function bo(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!fo(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!eo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!$i(t.startAt,e.startAt)&&$i(t.endAt,e.endAt)}function Ao(t){return ai.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
|
|
864
864
|
/**
|
|
865
865
|
* @license
|
|
866
866
|
* 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=[],r=[],s=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=s,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=Vs(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=Vs(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
|
|
879
|
+
*/class Co{constructor(t,e=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=s,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=Vs(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=Vs(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,r=e.startAt?new Wi(e.startAt.position,e.startAt.inclusive):null;e._t=Eo(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}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 r=Gi(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Lo(t),e))&&!(t.endAt&&!function(t,e,n){const r=Gi(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Lo(t),e))}(t,e)}function Ho(t){return(e,n)=>{let r=!1;for(const s of Lo(t)){const t=jo(s,e,n);if(0!==t)return t;r=r||s.field.isKeyField()}return 0}}function jo(t,e,n){const r=t.field.isKeyField()?ai.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),s=n.data.field(t);return null!==r&&null!==s?Mi(r,s):Us()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Us()}}
|
|
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
|
|
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)}
|
|
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
|
|
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 Yo?Jo(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),r=ea(n)+ea(t.gt);return Bi(n)&&Bi(t.gt)?Ko(r):qo(t.yt,r)}(t,e)}function $o(t,e,n){return t instanceof Yo?Jo(t,e):t instanceof Xo?Zo(t,e):n}class Qo extends Wo{}class Yo extends Wo{constructor(t){super(),this.elements=t}}function Jo(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 Hi(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class ra{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ra}static exists(t){return new ra(void 0,t)}static updateTime(t){return new ra(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 sa(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,ra.none()):new ha(t.key,t.data,ra.none());{const n=t.data,r=_o.empty();let s=new yo(oi.comparator);for(let t of e.fields)if(!s.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),s=s.add(t)}return new la(t.key,r,new wo(s.toArray()),ra.none())}}function aa(t,e,n){t instanceof ha?function(t,e,n){const r=t.value.clone(),s=fa(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof la?function(t,e,n){if(!sa(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=fa(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(da(t)),s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ca(t,e,n,r){return t instanceof ha?function(t,e,n,r){if(!sa(t.precondition,e))return n;const s=t.value.clone(),i=pa(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof la?function(t,e,n,r){if(!sa(t.precondition,e))return n;const s=pa(t.fieldTransforms,r,e),i=e.data;return i.setAll(da(t)),i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return sa(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 Yo&&e instanceof Yo||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,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class la extends ia{constructor(t,e,n,r,s=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function da(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function fa(t,e,n){const r=new Map;Fs(t.length===n.length);for(let s=0;s<n.length;s++){const i=t[s],o=i.transform,a=e.data.field(i.field);r.set(i.field,$o(o,a,n[s]))}return r}function pa(t,e,n){const r=new Map;for(const s of t){const t=s.transform,i=n.data.field(s.field);r.set(s.field,Go(t,i,e))}return r}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
|
|
@@ -1005,7 +1005,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1005
1005
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1006
1006
|
* See the License for the specific language governing permissions and
|
|
1007
1007
|
* limitations under the License.
|
|
1008
|
-
*/class Ma{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class xa{constructor(t,e){this.targetId=t,this.Et=e}}class Ua{constructor(t,e,n=Ei.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Fa{constructor(){this.At=0,this.Rt=
|
|
1008
|
+
*/class Ma{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class xa{constructor(t,e){this.targetId=t,this.Et=e}}class Ua{constructor(t,e,n=Ei.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Fa{constructor(){this.At=0,this.Rt=Ha(),this.bt=Ei.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Ra(),e=Ra(),n=Ra();return this.Rt.forEach(((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Us()}})),new Pa(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=Ha()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Va{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ia(),this.qt=Ba(),this.Ut=new yo(Zs)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:Us()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(Ao(t))if(0===n){const n=new ai(t.path);this.Qt(e,n,To.newNoDocument(n,ni.min()))}else Fs(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const s=this.Yt(r);if(s){if(n.current&&Ao(s.target)){const e=new ai(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,To.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Ra();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new La(t,e,this.Ut,this.Lt,n);return this.Lt=Ia(),this.qt=Ba(),this.Ut=new yo(Zs),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Fa,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new yo(Zs),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Ls("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new Fa),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Ba(){return new po(ai.comparator)}function Ha(){return new po(ai.comparator)}
|
|
1009
1009
|
/**
|
|
1010
1010
|
* @license
|
|
1011
1011
|
* 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
|
|
1024
|
+
*/const ja={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 Fs(!!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 si(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Ya(t){const e=si.fromString(t);return Fs(lc(e)),e}function Ja(t,e){const n=Ya(e);if(n.get(1)!==t.databaseId.projectId)throw new Hs(Bs.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 Hs(Bs.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 si(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function tc(t){return Fs(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:{}},r=e.path;null!==e.collectionGroup?(n.parent=Xa(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xa(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return hc(Ji.create(t,"and"))}(e.filters);s&&(n.structuredQuery.where=s);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 rc(t){let e=function(t){const e=Ya(t);return 4===e.length?si.emptyPath():tc(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Fs(1===r);const t=n.from[0];t.allDescendants?s=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=sc(t);return e instanceof Ji&&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,r,s,i,o,a){return new Co(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function sc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=uc(t.unaryFilter.field);return Yi.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=uc(t.unaryFilter.field);return Yi.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=uc(t.unaryFilter.field);return Yi.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=uc(t.unaryFilter.field);return Yi.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Us()}}(t):void 0!==t.fieldFilter?function(t){return Yi.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 Us()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Ji.create(t.compositeFilter.filters.map((t=>sc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Us()}}(t.compositeFilter.op))}(t):Us()}function ic(t){return ja[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 Yi?function(t){if("=="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NAN"}};if(ji(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(ji(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 Ji?function(t){const e=t.getFilters().map((t=>hc(t)));return 1===e.length?e[0]:{compositeFilter:{op:ac(t.op),filters:e}}}(t):Us()}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
|
|
@@ -1197,7 +1197,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1197
1197
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1198
1198
|
* See the License for the specific language governing permissions and
|
|
1199
1199
|
* limitations under the License.
|
|
1200
|
-
*/class Ec{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return fi.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime
|
|
1200
|
+
*/class Ec{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return fi.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:$a(n.createTime)}),fi.resolve()}getNamedQuery(t,e){return fi.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:mc(t.bundledQuery),readTime:$a(t.readTime)}}(e)),fi.resolve()}}
|
|
1201
1201
|
/**
|
|
1202
1202
|
* @license
|
|
1203
1203
|
* Copyright 2022 Google LLC
|
|
@@ -1325,7 +1325,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1325
1325
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1326
1326
|
* See the License for the specific language governing permissions and
|
|
1327
1327
|
* limitations under the License.
|
|
1328
|
-
*/class Mc{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((s=>s||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(No(e))return fi.resolve(null);let n=Po(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=xo(e,null,"F"),n=Po(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=Ra(...r);return this.Ni.getDocuments(t,s).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Fi(e,r);return this.$i(e,i,s,n.readTime)?this.ki(t,xo(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,r){return No(e)||r.isEqual(ni.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((s=>{const i=this.Fi(e,s);return this.$i(e,i,n,r)?this.Mi(t,e):(Os()<=C.DEBUG&&Ls("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Vo(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=ni.fromTimestamp(1e9===r?new ei(n+1,0):new ei(n,r));return new ui(s,ai.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new yo(
|
|
1328
|
+
*/class Mc{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((s=>s||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(No(e))return fi.resolve(null);let n=Po(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=xo(e,null,"F"),n=Po(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=Ra(...r);return this.Ni.getDocuments(t,s).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Fi(e,r);return this.$i(e,i,s,n.readTime)?this.ki(t,xo(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,r){return No(e)||r.isEqual(ni.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((s=>{const i=this.Fi(e,s);return this.$i(e,i,n,r)?this.Mi(t,e):(Os()<=C.DEBUG&&Ls("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Vo(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=ni.fromTimestamp(1e9===r?new ei(n+1,0):new ei(n,r));return new ui(s,ai.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new yo(Ho(t));return e.forEach(((e,r)=>{Bo(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const s="F"===t.limitType?e.last():e.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}Mi(t,e){return Os()<=C.DEBUG&&Ls("QueryEngine","Using full collection scan to execute query:",Vo(e)),this.Ni.getDocumentsMatchingQuery(t,e,ui.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
|
|
1329
1329
|
/**
|
|
1330
1330
|
* @license
|
|
1331
1331
|
* Copyright 2020 Google LLC
|
|
@@ -1341,7 +1341,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1341
1341
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1342
1342
|
* See the License for the specific language governing permissions and
|
|
1343
1343
|
* limitations under the License.
|
|
1344
|
-
*/class xc{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new po(Zs),this.Ui=new _a((t=>So(t)),bo),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Ic(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function Uc(t,e){const n=Vs(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=Ra();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function Fc(t){const e=Vs(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Vc(t,e){const n=Vs(t),r=e.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(Ei.EMPTY_BYTE_STRING,ni.min()).withLastLimboFreeSnapshotVersion(ni.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ia(),c=Ra();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Ra(),s=Ra();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ia();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(ni.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):Ls("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(ni.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return fi.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}async function Bc(t,e,n){const r=Vs(t),s=r.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!pi(t))throw t;Ls("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function
|
|
1344
|
+
*/class xc{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new po(Zs),this.Ui=new _a((t=>So(t)),bo),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Ic(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function Uc(t,e){const n=Vs(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=Ra();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function Fc(t){const e=Vs(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Vc(t,e){const n=Vs(t),r=e.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(Ei.EMPTY_BYTE_STRING,ni.min()).withLastLimboFreeSnapshotVersion(ni.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ia(),c=Ra();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Ra(),s=Ra();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ia();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(ni.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):Ls("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(ni.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return fi.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}async function Bc(t,e,n){const r=Vs(t),s=r.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!pi(t))throw t;Ls("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function Hc(t,e,n){const r=Vs(t);let s=ni.min(),i=Ra();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Vs(t),s=r.Ui.get(n);return void 0!==s?fi.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Po(e)).next((e=>{if(e)return s=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?s:ni.min(),n?i:Ra()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||ni.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:i})))))}class jc{constructor(){this.activeTargetIds=Oa()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class qc{constructor(){this.Lr=new jc,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new jc,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
|
|
1345
1345
|
/**
|
|
1346
1346
|
* @license
|
|
1347
1347
|
* Copyright 2019 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
|
|
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(){Ls("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Ls("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
|
|
1392
|
+
*/const Wc={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
|
|
1393
1393
|
/**
|
|
1394
1394
|
* @license
|
|
1395
1395
|
* Copyright 2017 Google LLC
|
|
@@ -1405,7 +1405,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1405
1405
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1406
1406
|
* See the License for the specific language governing permissions and
|
|
1407
1407
|
* limitations under the License.
|
|
1408
|
-
*/class
|
|
1408
|
+
*/class Gc{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
|
|
1409
1409
|
/**
|
|
1410
1410
|
* @license
|
|
1411
1411
|
* 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
|
|
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,r,s){const i=this.ho(t,e);Ls("RestConnection","Sending: ",i,n);const o={};return this.lo(o,r,s),this.fo(t,i,o,n).then((t=>(Ls("RestConnection","Received: ",t),t)),(e=>{throw Ms("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,r,s,i){return this.ao(t,e,n,r,s)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Rs,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,r){return new Promise(((s,i)=>{const o=new Cs;o.setWithCredentials(!0),o.listenOnce(Ts.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case _s.NO_ERROR:const e=o.getResponseJson();Ls("Connection","XHR received:",JSON.stringify(e)),s(e);break;case _s.TIMEOUT:Ls("Connection",'RPC "'+t+'" timed out'),i(new Hs(Bs.DEADLINE_EXCEEDED,"Request time out"));break;case _s.HTTP_ERROR:const n=o.getStatus();if(Ls("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(Bs).indexOf(e)>=0?e:Bs.UNKNOWN}(e.status);i(new Hs(t,e.message))}else i(new Hs(Bs.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new Hs(Bs.UNAVAILABLE,"Connection failed."));break;default:Us()}}finally{Ls("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],s=new gs,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 bs({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Ls("Connection","Creating WebChannel: "+a,o);const c=s.createWebChannel(a,o);let u=!1,h=!1;const l=new Gc({Hr:t=>{h?Ls("Connection","Not sending because WebChannel is closed:",t):(u||(Ls("Connection","Opening WebChannel transport."),c.open(),u=!0),Ls("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,As.EventType.OPEN,(()=>{h||Ls("Connection","WebChannel transport opened.")})),d(c,As.EventType.CLOSE,(()=>{h||(h=!0,Ls("Connection","WebChannel transport closed"),l.io())})),d(c,As.EventType.ERROR,(t=>{h||(h=!0,Ms("Connection","WebChannel transport errored:",t),l.io(new Hs(Bs.UNAVAILABLE,"The operation could not be completed")))})),d(c,As.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Fs(!!n);const r=n,s=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(s){Ls("Connection","WebChannel received error:",s);const t=s.status;let e=function(t){const e=ya[t];if(void 0!==e)return wa(e)}(t),n=s.message;void 0===e&&(e=Bs.INTERNAL,n="Unknown error status: "+t+" with message "+s.message),h=!0,l.io(new Hs(e,n)),c.close()}else Ls("Connection","WebChannel received:",n),l.ro(n)}})),d(i,Is.STAT_EVENT,(t=>{t.stat===Es?Ls("Connection","Detected buffering proxy"):t.stat===Ss&&Ls("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
|
|
1440
|
+
*/function Yc(t){return new za(t,!0)}class Jc{constructor(t,e,n=1e3,r=1.5,s=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=r,this.po=s,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,e-n);r>0&&Ls("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
|
|
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,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,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
|
|
1456
|
+
*/class Xc{constructor(t,e,n,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,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 Jc(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===Bs.RESOURCE_EXHAUSTED?(Ps(e.toString()),Ps("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Bs.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 Hs(Bs.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 Ls("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Ls("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Zc extends Xc{constructor(t,e,n,r,s,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,i),this.yt=s}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Us()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Fs(void 0===e||"string"==typeof e),Ei.fromBase64String(e||"")):(Fs(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?Bs.UNKNOWN:wa(t.code);return new Hs(e,t.message||"")}(o);n=new Ua(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Ja(t,r.document.name),i=$a(r.document.updateTime),o=r.document.createTime?$a(r.document.createTime):ni.min(),a=new _o({mapValue:{fields:r.document.fields}}),c=To.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new Ma(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Ja(t,r.document),i=r.readTime?$a(r.readTime):ni.min(),o=To.newNoDocument(s,i),a=r.removedTargetIds||[];n=new Ma([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Ja(t,r.document),i=r.removedTargetIds||[];n=new Ma([],i,s,null)}else{if(!("filter"in e))return Us();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new ma(r),i=t.targetId;n=new xa(i,s)}}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 r=e.target;return n=Ao(r)?{documents:ec(t,r)}:{query:nc(t,r)},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 Us()}}(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
|
|
@@ -1469,7 +1469,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1469
1469
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1470
1470
|
* See the License for the specific language governing permissions and
|
|
1471
1471
|
* limitations under the License.
|
|
1472
|
-
*/class tu extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new
|
|
1472
|
+
*/class tu extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new Hs(Bs.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,s])=>this.connection.ao(t,e,n,r,s))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Bs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Hs(Bs.UNKNOWN,t.toString())}))}_o(t,e,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection._o(t,e,n,s,i,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Bs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Hs(Bs.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class eu{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(t){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.cu("Offline")))}set(t){this.lu(),this.iu=0,"Online"===t&&(this.ou=!1),this.cu(t)}cu(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}au(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.ou?(Ps(e),this.ou=!1):Ls("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
|
|
1473
1473
|
/**
|
|
1474
1474
|
* @license
|
|
1475
1475
|
* Copyright 2017 Google LLC
|
|
@@ -1517,7 +1517,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1517
1517
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1518
1518
|
* See the License for the specific language governing permissions and
|
|
1519
1519
|
* limitations under the License.
|
|
1520
|
-
*/}class wu{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new
|
|
1520
|
+
*/}class wu{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new js,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,s){const i=Date.now()+n,o=new wu(t,e,i,r,s);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Hs(Bs.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function _u(t,e){if(Ps("AsyncQueue",`${e}: ${t}`),pi(t))return new Hs(Bs.UNAVAILABLE,`${e}: ${t}`);throw t}
|
|
1521
1521
|
/**
|
|
1522
1522
|
* @license
|
|
1523
1523
|
* Copyright 2017 Google LLC
|
|
@@ -1581,7 +1581,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1581
1581
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1582
1582
|
* See the License for the specific language governing permissions and
|
|
1583
1583
|
* limitations under the License.
|
|
1584
|
-
*/class Ou{constructor(t){this.key=t}}class Lu{constructor(t){this.key=t}}class Pu{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Ra(),this.mutatedKeys=Ra(),this.Gu=
|
|
1584
|
+
*/class Ou{constructor(t){this.key=t}}class Lu{constructor(t){this.key=t}}class Pu{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Ra(),this.mutatedKeys=Ra(),this.Gu=Ho(t),this.Qu=new Tu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Iu,r=e?e.Qu:this.Qu;let s=e?e.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const u=r.get(t),h=Bo(this.query,e)?e:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.Hu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Gu(h,a)>0||c&&this.Gu(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(t):s.delete(t)):(i=i.delete(t),s=s.delete(t)))})),null!==this.query.limit)for(;i.size>this.query.limit;){const t="F"===this.query.limitType?i.last():i.first();i=i.delete(t.key),s=s.delete(t.key),n.track({type:1,doc:t})}return{Qu:i,zu:n,$i:o,mutatedKeys:s}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const s=t.zu.Eu();s.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Us()}};return n(t)-n(e)}
|
|
1585
1585
|
/**
|
|
1586
1586
|
* @license
|
|
1587
1587
|
* Copyright 2020 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!==s.length||a?{snapshot:new Eu(this.query,t.Qu,r,s,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,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,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=Vs(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=
|
|
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!==s.length||a?{snapshot:new Eu(this.query,t.Qu,r,s,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,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,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=Vs(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Yu.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=ju.bind(null,e),e.sc.Wo=ku.bind(null,e.eventManager),e.sc.wc=Nu.bind(null,e.eventManager),e}(t);let r,s;const i=n.ic.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.ec();else{const t=await function(t,e){const n=Vs(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,fi.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new pc(e,s,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Po(e));n.isPrimaryClient&&iu(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,s=await async function(t,e,n,r,s){t._c=(e,n,r)=>async function(t,e,n,r){let s=e.view.Wu(n);s.$i&&(s=await Hc(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,s))));const i=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(s,t.isPrimaryClient,i);return zu(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await Hc(t.localStore,e,!0),o=new Pu(e,i.Hi),a=o.Wu(i.documents),c=Pa.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),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,r,"current"===i,t.resumeToken)}return s}async function Vu(t,e){const n=Vs(t),r=n.ic.get(e),s=n.rc.get(r.targetId);if(s.length>1)return n.rc.set(r.targetId,s.filter((t=>!Uo(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Bc(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),ou(n.remoteStore,r.targetId),qu(n,r.targetId)})).catch(di)):(qu(n,r.targetId),await Bc(n.localStore,r.targetId,!0))}async function Bu(t,e){const n=Vs(t);try{const t=await Vc(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Fs(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Fs(r.nc):t.removedDocuments.size>0&&(Fs(r.nc),r.nc=!1))})),await $u(n,t,e)}catch(t){await di(t)}}function Hu(t,e,n){const r=Vs(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const s=r.view.bu(e);s.snapshot&&t.push(s.snapshot)})),function(t,e){const n=Vs(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Ru(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function ju(t,e,n){const r=Vs(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new po(ai.comparator);t=t.insert(i,To.newNoDocument(i,ni.min()));const n=Ra().add(i),s=new La(ni.min(),new Map,new yo(Zs),t,n);await Bu(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),Gu(r)}else await Bc(r.localStore,e,!1).then((()=>qu(r,e,n))).catch(di)}function qu(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||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 r of n)r instanceof Ou?(t.ac.addReference(r.key,e),Wu(t,r)):r instanceof Lu?(Ls("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||Ku(t,r.key)):Us()}function Wu(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Ls("SyncEngine","New document in limbo: "+n),t.oc.add(r),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(si.fromString(e)),r=t.fc.next();t.cc.set(r,new xu(n)),t.uc=t.uc.insert(n,r),iu(t.remoteStore,new pc(Po(ko(n.path)),r,2,gi.at))}}async function $u(t,e,n){const r=Vs(t),s=[],i=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){s.push(t);const e=Pc.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Vs(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>fi.forEach(e,(e=>fi.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>fi.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!pi(t))throw t;Ls("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,s)}}}(r.localStore,i))}async function Qu(t,e){const n=Vs(t);if(!n.currentUser.isEqual(e)){Ls("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 Hs(Bs.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 Yu(t,e){const n=Vs(t),r=n.cc.get(e);if(r&&r.nc)return Ra().add(r.key);{let t=Ra();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class Ju{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=Yc(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new xc(t,e,n,r)}(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=>Hu(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Qu.bind(null,this.syncEngine),await async function(t,e){const n=Vs(t);e?(n._u.delete(2),await ru(n)):e||(n._u.add(2),await su(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new bu}createDatastore(t){const e=Yc(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new $c(r));var r;return function(t,e,n,r){return new tu(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>Hu(this.syncEngine,t,0),i=zc.C()?new zc:new Kc,new nu(e,n,r,s,i);var e,n,r,s,i}createSyncEngine(t,e){return function(t,e,n,r,s,i,o){const a=new Uu(t,e,n,r,s,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=Vs(t);Ls("RemoteStore","RemoteStore shutting down."),e._u.add(5),await su(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1601
1601
|
/**
|
|
1602
1602
|
* @license
|
|
1603
1603
|
* Copyright 2017 Google LLC
|
|
@@ -1613,7 +1613,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1613
1613
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1614
1614
|
* See the License for the specific language governing permissions and
|
|
1615
1615
|
* limitations under the License.
|
|
1616
|
-
*/function Zu(t,e,n){if(!n)throw new
|
|
1616
|
+
*/function Zu(t,e,n){if(!n)throw new Hs(Bs.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function th(t){if(!ai.isDocumentKey(t))throw new Hs(Bs.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function eh(t){if(ai.isDocumentKey(t))throw new Hs(Bs.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function nh(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Us()}function rh(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Hs(Bs.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=nh(t);throw new Hs(Bs.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
|
|
1617
1617
|
/**
|
|
1618
1618
|
* @license
|
|
1619
1619
|
* Copyright 2020 Google LLC
|
|
@@ -1629,7 +1629,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1629
1629
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1630
1630
|
* See the License for the specific language governing permissions and
|
|
1631
1631
|
* limitations under the License.
|
|
1632
|
-
*/const sh=new Map;class ih{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new
|
|
1632
|
+
*/const sh=new Map;class ih{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Hs(Bs.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Hs(Bs.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new Hs(Bs.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}
|
|
1633
1633
|
/**
|
|
1634
1634
|
* @license
|
|
1635
1635
|
* Copyright 2020 Google LLC
|
|
@@ -1645,7 +1645,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1645
1645
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1646
1646
|
* See the License for the specific language governing permissions and
|
|
1647
1647
|
* limitations under the License.
|
|
1648
|
-
*/class oh{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new ih({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new
|
|
1648
|
+
*/class oh{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new ih({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Hs(Bs.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Hs(Bs.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new ih(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Ks;switch(t.type){case"gapi":const e=t.client;return new $s(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Hs(Bs.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=sh.get(t);e&&(Ls("ComponentProvider","Removing Datastore"),sh.delete(t),e.terminate())}(this),Promise.resolve()}}function ah(t,e,n,r={}){var i;const o=(t=rh(t,oh))._getSettings();if("firestore.googleapis.com"!==o.host&&o.host!==e&&Ms("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},o),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=Ns.MOCK_USER;else{e=function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[s(JSON.stringify({alg:"none",type:"JWT"})),s(JSON.stringify(o)),""].join(".")}
|
|
1649
1649
|
/**
|
|
1650
1650
|
* @license
|
|
1651
1651
|
* 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
|
-
*/(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const o=r.mockUserToken.sub||r.mockUserToken.user_id;if(!o)throw new
|
|
1664
|
+
*/(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const o=r.mockUserToken.sub||r.mockUserToken.user_id;if(!o)throw new Hs(Bs.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Ns(o)}t._authCredentials=new zs(new qs(e,n))}}
|
|
1665
1665
|
/**
|
|
1666
1666
|
* @license
|
|
1667
1667
|
* Copyright 2020 Google LLC
|
|
@@ -1677,7 +1677,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1677
1677
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1678
1678
|
* See the License for the specific language governing permissions and
|
|
1679
1679
|
* limitations under the License.
|
|
1680
|
-
*/class ch{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new hh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ch(this.firestore,t,this._key)}}class uh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new uh(this.firestore,t,this._query)}}class hh extends uh{constructor(t,e,n){super(t,e,ko(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new ch(this.firestore,null,new ai(t))}withConverter(t){return new hh(this.firestore,t,this._path)}}function lh(t,e,...n){if(t=I(t),Zu("collection","path",e),t instanceof oh){const r=si.fromString(e,...n);return eh(r),new hh(t,null,r)}{if(!(t instanceof ch||t instanceof hh))throw new
|
|
1680
|
+
*/class ch{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new hh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ch(this.firestore,t,this._key)}}class uh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new uh(this.firestore,t,this._query)}}class hh extends uh{constructor(t,e,n){super(t,e,ko(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new ch(this.firestore,null,new ai(t))}withConverter(t){return new hh(this.firestore,t,this._path)}}function lh(t,e,...n){if(t=I(t),Zu("collection","path",e),t instanceof oh){const r=si.fromString(e,...n);return eh(r),new hh(t,null,r)}{if(!(t instanceof ch||t instanceof hh))throw new Hs(Bs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(si.fromString(e,...n));return eh(r),new hh(t.firestore,null,r)}}function dh(t,e,...n){if(t=I(t),1===arguments.length&&(e=Xs.R()),Zu("doc","path",e),t instanceof oh){const r=si.fromString(e,...n);return th(r),new ch(t,null,new ai(r))}{if(!(t instanceof ch||t instanceof hh))throw new Hs(Bs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(si.fromString(e,...n));return th(r),new ch(t.firestore,t instanceof hh?t.converter:null,new ai(r))}}
|
|
1681
1681
|
/**
|
|
1682
1682
|
* @license
|
|
1683
1683
|
* Copyright 2020 Google LLC
|
|
@@ -1725,7 +1725,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1725
1725
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1726
1726
|
* See the License for the specific language governing permissions and
|
|
1727
1727
|
* limitations under the License.
|
|
1728
|
-
*/class ph{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=Ns.UNAUTHENTICATED,this.clientId=Xs.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Ls("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Ls("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new
|
|
1728
|
+
*/class ph{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=Ns.UNAUTHENTICATED,this.clientId=Xs.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Ls("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Ls("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Hs(Bs.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new js;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=_u(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function gh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Ls("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Ls("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await Uc(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Ju)),t.offlineComponents}(t);Ls("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>yu(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>yu(e.remoteStore,n))),t.onlineComponents=e}async function mh(t){const e=await async function(t){return t.onlineComponents||(Ls("FirestoreClient","Using default OnlineComponentProvider"),await gh(t,new Xu)),t.onlineComponents}(t),n=e.eventManager;return n.onListen=Fu.bind(null,e.syncEngine),n.onUnlisten=Vu.bind(null,e.syncEngine),n}class yh{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new Jc(this,"async_queue_retry"),this.Wc=()=>{const t=Qc();t&&Ls("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=Qc();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=Qc();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new js;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!pi(t))throw t;Ls("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
|
|
1729
1729
|
/**
|
|
1730
1730
|
* @license
|
|
1731
1731
|
* Copyright 2017 Google LLC
|
|
@@ -1805,7 +1805,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1805
1805
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1806
1806
|
* See the License for the specific language governing permissions and
|
|
1807
1807
|
* limitations under the License.
|
|
1808
|
-
*/class Eh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Eh(Ei.fromBase64String(t))}catch(t){throw new
|
|
1808
|
+
*/class Eh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Eh(Ei.fromBase64String(t))}catch(t){throw new Hs(Bs.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Eh(Ei.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
|
|
1809
1809
|
/**
|
|
1810
1810
|
* @license
|
|
1811
1811
|
* Copyright 2020 Google LLC
|
|
@@ -1821,7 +1821,7 @@ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1821
1821
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1822
1822
|
* See the License for the specific language governing permissions and
|
|
1823
1823
|
* limitations under the License.
|
|
1824
|
-
*/class Sh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new
|
|
1824
|
+
*/class Sh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Hs(Bs.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new oi(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
|
|
1825
1825
|
/**
|
|
1826
1826
|
* @license
|
|
1827
1827
|
* Copyright 2020 Google LLC
|
|
@@ -1854,7 +1854,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1854
1854
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1855
1855
|
* See the License for the specific language governing permissions and
|
|
1856
1856
|
* limitations under the License.
|
|
1857
|
-
*/class Ah{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new
|
|
1857
|
+
*/class Ah{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Hs(Bs.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Hs(Bs.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return Zs(this._lat,t._lat)||Zs(this._long,t._long)}}
|
|
1858
1858
|
/**
|
|
1859
1859
|
* @license
|
|
1860
1860
|
* Copyright 2017 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 Us()}}class Nh{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],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),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return 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||
|
|
1873
|
+
*/const Ch=/^__.*__$/;function kh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Us()}}class Nh{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],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),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return 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||Yc(t)}da(t,e,n,r=!1){return new Nh({sa:t,methodName:e,fa:n,path:oi.emptyPath(),oa:!1,la:r},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 r=nh(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}("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,r)=>{const s=Dh(r,e.ra(t));null!=s&&(n[t]=s)})),{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 r=0;for(const s of t){let t=Dh(s,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=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,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue: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,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Hs(Bs.INVALID_ARGUMENT,a+t+c)
|
|
1874
1874
|
/**
|
|
1875
1875
|
* @license
|
|
1876
1876
|
* Copyright 2020 Google LLC
|
|
@@ -1902,7 +1902,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1902
1902
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1903
1903
|
* See the License for the specific language governing permissions and
|
|
1904
1904
|
* limitations under the License.
|
|
1905
|
-
*/function Fh(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new
|
|
1905
|
+
*/function Fh(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Hs(Bs.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Vh{}class Bh extends Vh{}function Hh(t,e,...n){let r=[];e instanceof Vh&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof Kh)).length,n=t.filter((t=>t instanceof jh)).length;if(e>1||e>0&&n>0)throw new Hs(Bs.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
|
|
1906
1906
|
/**
|
|
1907
1907
|
* @license
|
|
1908
1908
|
* 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
|
-
*/(r);for(const e of r)t=e._apply(t);return t}class
|
|
1921
|
+
*/(r);for(const e of r)t=e._apply(t);return t}class jh 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 jh(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=Yc(t._databaseId);return new Rh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Hs(Bs.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(r,t,n));a={arrayValue:{values:e}}}else a=zh(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Wh(o,i),a=function(t,e,n,r=!1){return Dh(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Yi.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function qh(t,e,n){const r=e,s=Uh("where",t);return jh._create(s,r,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]:Ji.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)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 Hs(Bs.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 Hs(Bs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(si.fromString(n));if(!ai.isDocumentKey(r))throw new Hs(Bs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Vi(t,new ai(r))}if(n instanceof ch)return Vi(t,n._key);throw new Hs(Bs.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 Hs(Bs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Hs(Bs.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),r=e.field;if(null!==n&&!n.isEqual(r))throw new Hs(Bs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const s=Ro(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new Hs(Bs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,s)}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 Hs(Bs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Hs(Bs.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 Us()}}convertObject(t,e){const n={};return wi(t.fields,((t,r)=>{n[t]=this.convertValue(r,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=si.fromString(t);Fs(lc(n));const r=new yi(n.get(1),n.get(3)),s=new ai(n.popFirst(5));return r.isEqual(e)||Ps(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),s}}
|
|
1922
1922
|
/**
|
|
1923
1923
|
* @license
|
|
1924
1924
|
* Copyright 2020 Google LLC
|
|
@@ -1934,7 +1934,7 @@ class bh{constructor(t){this._methodName=t}}
|
|
|
1934
1934
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1935
1935
|
* See the License for the specific language governing permissions and
|
|
1936
1936
|
* limitations under the License.
|
|
1937
|
-
*/class Qh{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class
|
|
1937
|
+
*/class Qh{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Yh extends Mh{constructor(t,e,n,r,s,i){super(t,e,n,r,i),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Jh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(Uh("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Jh extends Yh{data(t={}){return super.data(t)}}class Xh{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Qh(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Jh(this._firestore,this._userDataWriter,n.key,n,new Qh(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Hs(Bs.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Jh(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Qh(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Jh(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Qh(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,i=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:Zh(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Zh(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Us()}}
|
|
1938
1938
|
/**
|
|
1939
1939
|
* @license
|
|
1940
1940
|
* 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=rh(t,ch);const e=rh(t.firestore,wh);return function(t,e,n={}){const r=new
|
|
1953
|
+
*/function tl(t){t=rh(t,ch);const e=rh(t.firestore,wh);return function(t,e,n={}){const r=new js;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new fh({next:i=>{e.enqueueAndForget((()=>Cu(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Hs(Bs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Hs(Bs.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.)')):s.resolve(i)},error:t=>s.reject(t)}),o=new Du(ko(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,r))),r.promise}(Th(e),t._key).then((n=>sl(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=rh(t,uh);const e=rh(t.firestore,wh),n=Th(e),r=new el(e);return Fh(t._query),function(t,e,n={}){const r=new js;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new fh({next:n=>{e.enqueueAndForget((()=>Cu(t,o))),n.fromCache&&"server"===r.source?s.reject(new Hs(Bs.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.)')):s.resolve(n)},error:t=>s.reject(t)}),o=new Du(n,i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Xh(e,r,t,n)))}function rl(t,...e){var n,r,s;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===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let c,u,h;if(t instanceof ch)u=rh(t.firestore,wh),h=ko(t._key.path),c={next:n=>{e[o]&&e[o](sl(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=rh(t,uh);u=rh(n.firestore,wh),h=n._query;const r=new el(u);c={next:t=>{e[o]&&e[o](new Xh(u,r,n,t))},error:e[o+1],complete:e[o+2]},Fh(t._query)}return function(t,e,n,r){const s=new fh(r),i=new Du(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>Au(await mh(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>Cu(await mh(t),i)))}}(Th(u),h,a,c)}function sl(t,e,n){const r=n.docs.get(e._key),s=new el(t);return new Yh(t,s,e._key,r,new Qh(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Rs=ct,st(new E("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new wh(new Ws(t.getProvider("auth-internal")),new Ys(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Hs(Bs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yi(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),lt(ks,"3.8.0",t),lt(ks,"3.8.0","esm2017")}();
|
|
1954
1954
|
/**
|
|
1955
1955
|
* @license
|
|
1956
1956
|
* Copyright 2020 Google LLC
|
|
@@ -2179,7 +2179,7 @@ function Fl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))retur
|
|
|
2179
2179
|
* See the License for the specific language governing permissions and
|
|
2180
2180
|
* limitations under the License.
|
|
2181
2181
|
*/
|
|
2182
|
-
async function
|
|
2182
|
+
async function Hl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof d&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
|
|
2183
2183
|
/**
|
|
2184
2184
|
* @license
|
|
2185
2185
|
* Copyright 2020 Google LLC
|
|
@@ -2195,7 +2195,7 @@ async function jl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2195
2195
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2196
2196
|
* See the License for the specific language governing permissions and
|
|
2197
2197
|
* limitations under the License.
|
|
2198
|
-
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class
|
|
2198
|
+
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class jl{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
|
|
2199
2199
|
/**
|
|
2200
2200
|
* @license
|
|
2201
2201
|
* Copyright 2020 Google LLC
|
|
@@ -2227,7 +2227,7 @@ async function jl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2227
2227
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2228
2228
|
* See the License for the specific language governing permissions and
|
|
2229
2229
|
* limitations under the License.
|
|
2230
|
-
*/async function Kl(t){var e;const n=t.auth,r=await t.getIdToken(),s=await
|
|
2230
|
+
*/async function Kl(t){var e;const n=t.auth,r=await t.getIdToken(),s=await Hl(t,async function(t,e){return Ol(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:r}));vl(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=(null===(e=i.providerUserInfo)||void 0===e?void 0:e.length)?i.providerUserInfo.map((t=>{var{providerId:e}=t,n=cl(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(c=t.providerData,u=o,[...c.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var c,u;const h=t.isAnonymous,l=!(t.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new ql(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}
|
|
2231
2231
|
/**
|
|
2232
2232
|
* @license
|
|
2233
2233
|
* 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
|
|
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:r,expiresIn:s}=await
|
|
2248
2248
|
/**
|
|
2249
2249
|
* @license
|
|
2250
2250
|
* Copyright 2020 Google LLC
|
|
@@ -2261,7 +2261,7 @@ class Wl{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:r,apiKey:s}=t.config,i=Ml(t,r,"/v1/token",`key=${s}`),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,r,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:s}=e,i=new
|
|
2264
|
+
async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=Ml(t,r,"/v1/token",`key=${s}`),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,r,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:s}=e,i=new zl;return n&&(vl("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(vl("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(vl("number"==typeof s,"internal-error",{appName:t}),i.expirationTime=s),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")}}
|
|
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
|
|
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:r}=t,s=cl(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new jl(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new ql(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await Hl(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),r=await n.getIdToken(e),s=Bl(r);vl(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Fl(Vl(s.auth_time)),issuedAtTime:Fl(Vl(s.iat)),expirationTime:Fl(Vl(s.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 Hl(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,r,s,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(s=e.phoneNumber)&&void 0!==s?s: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 r=new zl;r.updateFromServerResponse(e);const s=new Gl({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await Kl(s),s}}
|
|
2281
2281
|
/**
|
|
2282
2282
|
* @license
|
|
2283
2283
|
* Copyright 2019 Google LLC
|
|
@@ -2293,7 +2293,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2293
2293
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2294
2294
|
* See the License for the specific language governing permissions and
|
|
2295
2295
|
* limitations under the License.
|
|
2296
|
-
*/class
|
|
2296
|
+
*/class $l{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}$l.type="NONE";const Ql=$l;
|
|
2297
2297
|
/**
|
|
2298
2298
|
* @license
|
|
2299
2299
|
* Copyright 2019 Google LLC
|
|
@@ -2309,7 +2309,7 @@ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refr
|
|
|
2309
2309
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2310
2310
|
* See the License for the specific language governing permissions and
|
|
2311
2311
|
* limitations under the License.
|
|
2312
|
-
*/function
|
|
2312
|
+
*/function Yl(t,e,n){return`firebase:${t}:${e}:${n}`}class Jl{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=Yl(this.userKey,r.apiKey,s),this.fullPersistenceKey=Yl("persistence",r.apiKey,s),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?Gl._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new Jl(Il(Ql),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||Il(Ql);const i=Yl(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const r=Gl._fromJSON(t,e);n!==s&&(o=r),s=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==s)try{await t._remove(i)}catch(t){}}))),new Jl(s,t,n)):new Jl(s,t,n)}}
|
|
2313
2313
|
/**
|
|
2314
2314
|
* @license
|
|
2315
2315
|
* Copyright 2020 Google LLC
|
|
@@ -2374,7 +2374,7 @@ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n
|
|
|
2374
2374
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2375
2375
|
* See the License for the specific language governing permissions and
|
|
2376
2376
|
* limitations under the License.
|
|
2377
|
-
*/class ld{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new fd(this),this.idTokenSubscription=new fd(this),this.beforeStateQueue=new hd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ll,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Il(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await
|
|
2377
|
+
*/class ld{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new fd(this),this.idTokenSubscription=new fd(this),this.beforeStateQueue=new hd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ll,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Il(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await Jl.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return vl(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await Kl(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?I(t):null;return e&&vl(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&vl(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Il(t))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new f("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Il(t)||this._popupRedirectResolver;vl(e,this,"argument-error"),this.redirectPersistenceManager=await Jl.create(this,[Il(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e),i=this._isInitialized?Promise.resolve():this._initializationPromise;return vl(i,this,"internal-error"),i.then((()=>s(this.currentUser))),"function"==typeof e?t.addObserver(e,n,r):t.addObserver(e)}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return vl(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=ud(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());return n&&(e["X-Firebase-Client"]=n),e}}function dd(t){return I(t)}class fd{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new _(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return vl(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function pd(t,e,n){const r=dd(t);vl(r._canInitEmulator,r,"emulator-config-failed"),vl(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=gd(e),{host:o,port:a}=function(t){const e=gd(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const t=s[1];return{host:t,port:md(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:md(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
|
|
2378
2378
|
/**
|
|
2379
2379
|
* @license
|
|
2380
2380
|
* Copyright 2020 Google LLC
|
|
@@ -2637,7 +2637,7 @@ class Nd extends bd{constructor(){super("twitter.com")}static credential(t,e){re
|
|
|
2637
2637
|
* See the License for the specific language governing permissions and
|
|
2638
2638
|
* limitations under the License.
|
|
2639
2639
|
*/
|
|
2640
|
-
class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const s=await
|
|
2640
|
+
class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const s=await Gl._fromIdTokenResponse(t,n,r),i=Dd(n);return new Rd({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=Dd(n);return new Rd({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function Dd(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
|
|
2641
2641
|
/**
|
|
2642
2642
|
* @license
|
|
2643
2643
|
* Copyright 2020 Google LLC
|
|
@@ -2736,7 +2736,7 @@ function(t,e,n){var r;vl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2736
2736
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2737
2737
|
* See the License for the specific language governing permissions and
|
|
2738
2738
|
* limitations under the License.
|
|
2739
|
-
*/class Bd extends Vd{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=o();return td(t)||od(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=cd(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(t.newValue!==r)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);ad()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}Bd.type="LOCAL";const
|
|
2739
|
+
*/class Bd extends Vd{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=o();return td(t)||od(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=cd(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(t.newValue!==r)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);ad()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}Bd.type="LOCAL";const Hd=Bd;
|
|
2740
2740
|
/**
|
|
2741
2741
|
* @license
|
|
2742
2742
|
* Copyright 2020 Google LLC
|
|
@@ -2752,7 +2752,7 @@ function(t,e,n){var r;vl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2752
2752
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2753
2753
|
* See the License for the specific language governing permissions and
|
|
2754
2754
|
* limitations under the License.
|
|
2755
|
-
*/class
|
|
2755
|
+
*/class jd extends Vd{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}jd.type="SESSION";const qd=jd;
|
|
2756
2756
|
/**
|
|
2757
2757
|
* @license
|
|
2758
2758
|
* 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
|
|
2805
|
+
function zd(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 Wd(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
|
|
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 r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=zd("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
|
|
2822
2822
|
/**
|
|
2823
2823
|
* @license
|
|
2824
2824
|
* Copyright 2020 Google LLC
|
|
@@ -2834,7 +2834,7 @@ function Wd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2834
2834
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2835
2835
|
* See the License for the specific language governing permissions and
|
|
2836
2836
|
* limitations under the License.
|
|
2837
|
-
*/function
|
|
2837
|
+
*/function Gd(){return window}
|
|
2838
2838
|
/**
|
|
2839
2839
|
* @license
|
|
2840
2840
|
* Copyright 2020 Google LLC.
|
|
@@ -2851,7 +2851,7 @@ function Wd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2851
2851
|
* See the License for the specific language governing permissions and
|
|
2852
2852
|
* limitations under the License.
|
|
2853
2853
|
*/
|
|
2854
|
-
function
|
|
2854
|
+
function $d(){return void 0!==Gd().WorkerGlobalScope&&"function"==typeof Gd().importScripts}
|
|
2855
2855
|
/**
|
|
2856
2856
|
* @license
|
|
2857
2857
|
* Copyright 2019 Google LLC
|
|
@@ -2868,7 +2868,7 @@ function Gd(){return void 0!==$d().WorkerGlobalScope&&"function"==typeof $d().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",
|
|
2871
|
+
const Qd="firebaseLocalStorageDb",Yd="firebaseLocalStorage",Jd="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([Yd],e?"readwrite":"readonly").objectStore(Yd)}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(Yd,{keyPath:Jd})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Yd)?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 r=Zd(t,!0).put({[Jd]:e,value:n});return new Xd(r).toPromise()}function nf(t,e){const n=Zd(t,!0).delete(e);return new Xd(n).toPromise()}class rf{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),r=await new Xd(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>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:r,value:s}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}rf.type="LOCAL";const sf=rf;
|
|
2872
2872
|
/**
|
|
2873
2873
|
* @license
|
|
2874
2874
|
* Copyright 2020 Google LLC
|
|
@@ -2918,7 +2918,7 @@ class af extends yd{constructor(t){super("custom","custom"),this.params=t}_getId
|
|
|
2918
2918
|
* See the License for the specific language governing permissions and
|
|
2919
2919
|
* limitations under the License.
|
|
2920
2920
|
*/
|
|
2921
|
-
async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await
|
|
2921
|
+
async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await Hl(t,Ld(r,s,e,t),n);vl(i.idToken,r,"internal-error");const o=Bl(i.idToken);vl(o,r,"internal-error");const{sub:a}=o;return vl(t.uid===a,r,"user-mismatch"),Rd._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&gl(r,"user-mismatch"),t}}(n,new af(t),t.bypassAuthState)}async function hf(t){const{auth:e,user:n}=t;return vl(n,e,"internal-error"),async function(t,e,n=!1){const r=await Hl(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Rd._forOperation(t,"link",r)}(n,new af(t),t.bypassAuthState)}
|
|
2922
2922
|
/**
|
|
2923
2923
|
* @license
|
|
2924
2924
|
* Copyright 2020 Google LLC
|
|
@@ -2950,7 +2950,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="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,r,s){super(t,e,r,s),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=
|
|
2953
|
+
*/const df=new Al(2e3,1e4);class ff extends lf{constructor(t,e,n,r,s){super(t,e,r,s),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;
|
|
2954
2954
|
/**
|
|
2955
2955
|
* @license
|
|
2956
2956
|
* Copyright 2020 Google LLC
|
|
@@ -2967,7 +2967,7 @@ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await jl
|
|
|
2967
2967
|
* See the License for the specific language governing permissions and
|
|
2968
2968
|
* limitations under the License.
|
|
2969
2969
|
*/
|
|
2970
|
-
const pf="pendingRedirect",gf=new Map;class mf extends lf{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=gf.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return
|
|
2970
|
+
const pf="pendingRedirect",gf=new Map;class mf extends lf{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=gf.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return Yl(pf,t.config.apiKey,t.name)}(e),r=function(t){return Il(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}gf.set(this.auth._key(),t)}return this.bypassAuthState||gf.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function yf(t,e){gf.set(t._key(),e)}async function vf(t,e,n=!1){const r=dd(t),s=
|
|
2971
2971
|
/**
|
|
2972
2972
|
* @license
|
|
2973
2973
|
* Copyright 2021 Google LLC
|
|
@@ -3049,7 +3049,7 @@ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t
|
|
|
3049
3049
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3050
3050
|
* See the License for the specific language governing permissions and
|
|
3051
3051
|
* limitations under the License.
|
|
3052
|
-
*/const Af=new Al(3e4,6e4);function Cf(){const t
|
|
3052
|
+
*/const Af=new Al(3e4,6e4);function Cf(){const t=Gd().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function kf(t){return new Promise(((e,n)=>{var r,s,i;function o(){Cf(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Cf(),n(ml(t,"network-request-failed"))},timeout:Af.get()})}if(null===(s=null===(r=Gd().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=Gd().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Gd()[e]=()=>{gapi.load?o():n(ml(t,"network-request-failed"))},of(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Nf=null,t}))}let Nf=null;
|
|
3053
3053
|
/**
|
|
3054
3054
|
* @license
|
|
3055
3055
|
* Copyright 2020 Google LLC.
|
|
@@ -3066,7 +3066,7 @@ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t
|
|
|
3066
3066
|
* See the License for the specific language governing permissions and
|
|
3067
3067
|
* limitations under the License.
|
|
3068
3068
|
*/
|
|
3069
|
-
const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Of=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Lf(t){const e=t.config;vl(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Cl(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,r={apiKey:e.apiKey,appName:t.name,v:ct},s=Of.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${y(r).slice(1)}`}async function Pf(t){const e=await function(t){return Nf=Nf||kf(t),Nf}(t),n
|
|
3069
|
+
const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Of=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Lf(t){const e=t.config;vl(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Cl(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,r={apiKey:e.apiKey,appName:t.name,v:ct},s=Of.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${y(r).slice(1)}`}async function Pf(t){const e=await function(t){return Nf=Nf||kf(t),Nf}(t),n=Gd().gapi;return vl(n,t,"internal-error"),e.open({where:document.body,url:Lf(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Df,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=ml(t,"network-request-failed"),i=Gd().setTimeout((()=>{r(s)}),Rf.get());function o(){Gd().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
|
|
3070
3070
|
/**
|
|
3071
3071
|
* @license
|
|
3072
3072
|
* 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
|
|
3117
|
+
*/(t)}?${y(a).slice(1)}`}const Hf="webStorageSupport";const jf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=qd,this._completeRedirectFn=vf,this._overrideRedirectResult=yf}async _openPopup(t,e,n,r){var s;_l(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return Uf(t,Bf(t,e,n,El(),r),zd())}async _openRedirect(t,e,n,r){var s;return await this._originValidation(t),s=Bf(t,e,n,El(),r),Gd().location.href=s,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(Hf,{type:Hf},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[Hf];void 0!==s&&e(!!s),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
|
|
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()}}
|
|
3135
3135
|
/**
|
|
3136
3136
|
* @license
|
|
3137
3137
|
* Copyright 2020 Google LLC
|
|
@@ -3164,5 +3164,5 @@ class Wf{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 zf=h("authIdTokenMaxAge")||300;let $f=null;function Gf(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:[sf,jd,qd]}),r=h("authTokenSyncURL");if(r){const t=(s=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>zf)return;const r=null==e?void 0:e.token;$f!==r&&($f=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){I(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var s;const i=u("auth");return i&&pd(n,`http://${i}`),n}var Qf;Qf="Browser",st(new E("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:s,authDomain:i}=n.options;return((t,n)=>{vl(s&&!s.includes(":"),"invalid-api-key",{appName:t.name}),vl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const r={apiKey:s,authDomain:i,clientPlatform:Qf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ud(Qf)},o=new ld(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Il);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),st(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("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 rp extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}const sp="avatar not created";var ip=Object.freeze({__proto__:null,AvatarNotCreatedError:Jf,NoFramesFoundError:Yf,RequestTimeoutError:Xf,UserNotLoggedInError:Zf,NoColorwaySizeAssetsFoundError:tp,NoStylesFoundError:ep,RecommendedAvailableSizesError:np,BrandUserIdNotSetError:rp,AvatarNotCreated:sp});class op{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Gf(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,e){let n;const r=jh(lh(this.firestore,"users"),qh(new Sh("__name__"),"==",this.id)),s=setTimeout((()=>n()),e);return new Promise((e=>{n=rl(r,(async r=>{await t(r)&&(clearTimeout(s),n(),e(r.docs[0].data()))}))}))}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((r=>{n=rl(t,(t=>{r(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 r=jh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return nl(jh(lh(this.firestore,t),...e))}async getDoc(t,e){const n=dh(this.firestore,t,e),r=await tl(n);return r.exists()?r.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:{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}};class pp{static get endpoint(){return il.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"include"};r&&(o.body=JSON.stringify(r));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,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class gp{constructor(t,e){this.brandId=t,this.firebase=e,il.getInstance().config}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}onInit(){return this.firebase.onInit()}async getRecommendedSizes(t){if(!this.isLoggedIn)throw new Zf;try{const e=await pp.Get(this.user,`/styles/${t}/recommendation`);return await e.json()}catch(t){if((null==t?void 0:t.error)===sp)throw new Jf;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await pp.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),r=await this.getStyleCategory(n.style_id),s=(null===(e=fp[r.category])||void 0===e?void 0:e[r.sub_category])||null;return s?dp[s].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 mp=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),il.getInstance().setEnv(e),new gp(t,new ap));var yp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(yp||(yp={}));var vp=Object.freeze({__proto__:null,get AvatarState(){return yp}});export{ip as Errors,mp as initShop,t as requests,e as responses,vp as types};
|
|
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:jf,persistence:[sf,Hd,qd]}),r=h("authTokenSyncURL");if(r){const t=(s=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Wf)return;const r=null==e?void 0:e.token;Gf!==r&&(Gf=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){I(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var s;const i=u("auth");return i&&pd(n,`http://${i}`),n}var Qf;Qf="Browser",st(new E("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:s,authDomain:i}=n.options;return((t,n)=>{vl(s&&!s.includes(":"),"invalid-api-key",{appName:t.name}),vl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const r={apiKey:s,authDomain:i,clientPlatform:Qf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ud(Qf)},o=new ld(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Il);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),st(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 Yf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Jf 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 rp extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}const sp="avatar not created";var ip=Object.freeze({__proto__:null,AvatarNotCreatedError:Yf,NoFramesFoundError:Jf,RequestTimeoutError:Xf,UserNotLoggedInError:Zf,NoColorwaySizeAssetsFoundError:tp,NoStylesFoundError:ep,RecommendedAvailableSizesError:np,BrandUserIdNotSetError:rp,AvatarNotCreated:sp});class op{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=$f(e),this.auth.setPersistence(Hd)}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,e){let n;const r=Hh(lh(this.firestore,"users"),qh(new Sh("__name__"),"==",this.id)),s=setTimeout((()=>n()),e);return new Promise((e=>{n=rl(r,(async r=>{await t(r)&&(clearTimeout(s),n(),e(r.docs[0].data()))}))}))}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((r=>{n=rl(t,(t=>{r(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 r=Hh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return nl(Hh(lh(this.firestore,t),...e))}async getDoc(t,e){const n=dh(this.firestore,t,e),r=await tl(n);return r.exists()?r.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:{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 pp;!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"}(pp||(pp={})),pp.TOO_TIGHT,pp.TIGHT,pp.SLIGHTLY_TIGHT,pp.PERFECT_FIT,pp.SLIGHTLY_LOOSE,pp.LOOSE,pp.OVERSIZED;class gp{static get endpoint(){return il.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"include"};r&&(o.body=JSON.stringify(r));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,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class mp{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 r=await gp.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===sp)throw new Yf;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await gp.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),r=await this.getStyleCategory(n.style_id),s=(null===(e=fp[r.category])||void 0===e?void 0:e[r.sub_category])||null;return s?dp[s].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 yp=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),il.getInstance().setEnv(e),new mp(t,new ap));var vp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(vp||(vp={}));var wp=Object.freeze({__proto__:null,get AvatarState(){return vp}});export{ip as Errors,yp as initShop,t as requests,e as responses,wp as types};
|
|
3168
3168
|
//# sourceMappingURL=index.min.js.map
|