VUE_GabenParadise/node_modules/firebase/firebase-firestore.memory.js

3 lines
226 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],e):e((t=t||self).firebase)}(this,function(cf){"use strict";try{(function(){cf=cf&&Object.prototype.hasOwnProperty.call(cf,"default")?cf.default:cf;var t,u,e,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function d(t,s,u,a){return new(u=u||Promise)(function(n,e){function r(t){try{o(a.next(t))}catch(t){e(t)}}function i(t){try{o(a.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(r,i)}o((a=a.apply(t,s||[])).next())})}function y(n,r){var i,o,s,t,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,o=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){u.label=e[1];break}if(6===e[0]&&u.label<s[1]){u.label=s[1],s=e;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(e);break}s[2]&&u.ops.pop(),u.trys.pop();continue}e=r.call(n,u)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function i(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,u=o.length;s<u;s++,i++)r[i]=o[s];return r}function s(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,u=o.length;s<u;s++,i++)r[i]=o[s];return r}(e=u=u||{})[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT";u.DEBUG,u.VERBOSE,u.INFO,u.WARN,u.ERROR,u.SILENT;function o(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(e<t.logLevel)){var i=(new Date).toISOString(),o=h[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,s(["["+i+"] "+t.name+":"],n))}}var a=u.INFO,h=((t={})[u.DEBUG]="log",t[u.VERBOSE]="log",t[u.INFO]="info",t[u.WARN]="warn",t[u.ERROR]="error",t),c=(Object.defineProperty(f.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in u))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!0,configurable:!0}),f.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,s([this,u.DEBUG],t)),this._logHandler.apply(this,s([this,u.DEBUG],t))},f.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,s([this,u.VERBOSE],t)),this._logHandler.apply(this,s([this,u.VERBOSE],t))},f.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,s([this,u.INFO],t)),this._logHandler.apply(this,s([this,u.INFO],t))},f.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,s([this,u.WARN],t)),this._logHandler.apply(this,s([this,u.WARN],t))},f.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,s([this,u.ERROR],t)),this._logHandler.apply(this,s([this,u.ERROR],t))},f);function f(t){this.name=t,this._logLevel=a,this._logHandler=o,this._userLogHandler=null}function p(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}var l,v=(n(g,l=Error),g);function g(t,e){var n=l.call(this,e)||this;return n.code=t,n.name="FirebaseError",Object.setPrototypeOf(n,g.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,m.prototype.create),n}var m=(w.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r,i=e[0]||{},o=this.service+"/"+t,s=this.errors[t],u=s?(r=i,s.replace(b,function(t,e){var n=r[e];return null!=n?n.toString():"<"+e+"?>"})):"Error",a=this.serviceName+": "+u+" ("+o+").",h=new v(o,a),c=0,f=Object.keys(i);c<f.length;c++){var l=f[c];"_"!==l.slice(-1)&&(l in h&&console.warn('Overwriting FirebaseError base field "'+l+'" can cause unexpected behavior.'),h[l]=i[l])}return h},w);function w(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var b=/\{\$([^}]+)}/g,E=(I.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},I.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},I.prototype.setServiceProps=function(t){return this.serviceProps=t,this},I);function I(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}function T(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.")}var A,N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_=_||{},R=N||self;function S(){}function D(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function O(t){var e=D(t);return"array"==e||"object"==e&&"number"==typeof t.length}function P(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var k="closure_uid_"+(1e9*Math.random()>>>0),L=0;function V(t,e,n){return t.call.apply(t.bind,arguments)}function C(e,n,t){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var t=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(t,r),e.apply(n,t)}}return function(){return e.apply(n,arguments)}}function M(t,e,n){return(M=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?V:C).apply(null,arguments)}function U(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}var q=Date.now||function(){return+new Date};function x(t,e){function n(){}n.prototype=e.prototype,t.M=e.prototype,t.prototype=new n,t.prototype.constructor=t}function j(){this.j=this.j,this.i=this.i}j.prototype.j=!1,j.prototype.da=function(){if(!this.j&&(this.j=!0,this.C(),0))t=this,Object.prototype.hasOwnProperty.call(t,k)&&t[k]||(t[k]=++L);var t},j.prototype.C=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var F=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},G=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i="string"==typeof t?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)};function B(t){return Array.prototype.concat.apply([],arguments)}function z(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 H(t){return/^[\s\xa0]*$/.test(t)}var W,Q=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Y(t,e){return-1!=t.indexOf(e)}function Z(t,e){return t<e?-1:e<t?1:0}t:{var X=R.navigator;if(X){var K=X.userAgent;if(K){W=K;break t}}W=""}function J(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function $(t){var e={};for(var n in t)e[n]=t[n];return e}var tt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function et(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var o=0;o<tt.length;o++)n=tt[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function nt(t){return nt[" "](t),t}nt[" "]=S;var rt,it,ot=Y(W,"Opera"),st=Y(W,"Trident")||Y(W,"MSIE"),ut=Y(W,"Edge"),at=ut||st,ht=Y(W,"Gecko")&&!(Y(W.toLowerCase(),"webkit")&&!Y(W,"Edge"))&&!(Y(W,"Trident")||Y(W,"MSIE"))&&!Y(W,"Edge"),ct=Y(W.toLowerCase(),"webkit")&&!Y(W,"Edge");function ft(){var t=R.document;return t?t.documentMode:void 0}t:{var lt="",pt=(it=W,ht?/rv:([^\);]+)(\)|;)/.exec(it):ut?/Edge\/([\d\.]+)/.exec(it):st?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(it):ct?/WebKit\/(\S+)/.exec(it):ot?/(?:Version)[ \/]?(\S+)/.exec(it):void 0);if(pt&&(lt=pt?pt[1]:""),st){var dt=ft();if(null!=dt&&dt>parseFloat(lt)){rt=String(dt);break t}}rt=lt}var yt,vt={};function gt(u){return t=u,e=function(){for(var t=0,e=Q(String(rt)).split("."),n=Q(String(u)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var o=e[i]||"",s=n[i]||"";do{if(o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==o[0].length&&0==s[0].length)break;t=Z(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||Z(0==o[2].length,0==s[2].length)||Z(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t},n=vt,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}if(R.document&&st){var mt=ft();yt=mt||(parseInt(rt,10)||void 0)}else yt=void 0;var wt=yt,bt=!st||9<=Number(wt),Et=st&&!gt("9"),It=function(){if(!R.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{R.addEventListener("test",S,e),R.removeEventListener("test",S,e)}catch(t){}return t}();function Tt(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function At(t,e){if(Tt.call(this,t?t.type:""),this.relatedTarget=this.a=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.pointerId=0,this.pointerType="",this.c=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.a=e,e=t.relatedTarget){if(ht){t:{try{nt(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:Nt[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}Tt.prototype.b=function(){this.defaultPrevented=!0},x(At,Tt);var Nt={2:"touch",3:"pen",4:"mouse"};At.prototype.b=function(){At.M.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,Et)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}};var _t="closure_listenable_"+(1e6*Math.random()|0),Rt=0;function St(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.aa=i,this.key=++Rt,this.V=this.X=!1}function Dt(t){t.V=!0,t.listener=null,t.proxy=null,t.src=null,t.aa=null}function Ot(t){this.src=t,this.a={},this.b=0}function Pt(t,e){var n=e.type;if(n in t.a){var r,i=t.a[n],o=F(i,e);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(Dt(e),0==t.a[n].length&&(delete t.a[n],t.b--))}}function kt(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.V&&o.listener==e&&o.capture==!!n&&o.aa==r)return i}return-1}Ot.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=kt(t,e,r,i);return-1<s?(e=t[s],n||(e.X=!1)):((e=new St(e,this.src,o,!!r,i)).X=n,t.push(e)),e};var Lt="closure_lm_"+(1e6*Math.random()|0),Vt={};function Ct(t,e,n,r,i){if(r&&r.once)return function t(e,n,r,i,o){if(Array.isArray(n)){for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);return null}r=Bt(r);return e&&e[_t]?e.sa(n,r,P(i)?!!i.capture:!!i,o):Mt(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)Ct(t,e[o],n,r,i);return null}return n=Bt(n),t&&t[_t]?t.ra(e,n,P(r)?!!r.capture:!!r,i):Mt(t,e,n,!1,r,i)}function Mt(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=P(i)?!!i.capture:!!i;if(s&&!bt)return null;var u,a,h=Ft(t);if(h||(t[Lt]=h=new Ot(t)),(n=h.add(e,n,r,s,o)).proxy)return n;if(u=jt,r=a=bt?function(t){return u.call(a.src,a.listener,t)}:function(t){if(!(t=u.call(a.src,a.listener,t)))return t},(n.proxy=r).src=t,r.listener=n,t.addEventListener)It||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(qt(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Ut(t){if("number"!=typeof t&&t&&!t.V){var e=t.src;if(e&&e[_t])Pt(e.c,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(qt(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Ft(e))?(Pt(n,t),0==n.b&&(n.src=null,e[Lt]=null)):Dt(t)}}}function qt(t){return t in Vt?Vt[t]:Vt[t]="on"+t}function xt(t,e){var n=t.listener,r=t.aa||t.src;return t.X&&Ut(t),n.call(r,e)}function jt(t,e){if(t.V)return!0;if(bt)return xt(t,new At(e,this));if(!e)t:{e=["window","event"];for(var n=R,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return xt(t,e=new At(e,this))}function Ft(t){return(t=t[Lt])instanceof Ot?t:null}var Gt="__closure_events_fn_"+(1e9*Math.random()>>>0);function Bt(e){return"function"==D(e)?e:(e[Gt]||(e[Gt]=function(t){return e.handleEvent(t)}),e[Gt])}function zt(){j.call(this),this.c=new Ot(this),(this.J=this).A=null}function Ht(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s=e[o];if(s&&!s.V&&s.capture==n){var u=s.listener,a=s.aa||s.src;s.X&&Pt(t.c,s),i=!1!==u.call(a,r)&&i}}return i&&!r.defaultPrevented}x(zt,j),zt.prototype[_t]=!0,(A=zt.prototype).addEventListener=function(t,e,n,r){Ct(this,t,e,n,r)},A.removeEventListener=function(t,e,n,r){!function t(e,n,r,i,o){if(Array.isArray(n))for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);else i=P(i)?!!i.capture:!!i,r=Bt(r),e&&e[_t]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=kt(s=e.a[n],r,i,o))&&(Dt(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.a[n],e.b--))):(e=e&&Ft(e))&&(n=e.a[n.toString()],e=-1,n&&(e=kt(n,r,i,o)),(r=-1<e?n[e]:null)&&Ut(r))}(this,t,e,n,r)},A.dispatchEvent=function(t){var e,n=this.A;if(n)for(e=[];n;n=n.A)e.push(n);n=this.J;var r=t.type||t;if("string"==typeof t)t=new Tt(t,n);else if(t instanceof Tt)t.target=t.target||n;else{var i=t;et(t=new Tt(r,n),i)}if(i=!0,e)for(var o=e.length-1;0<=o;o--){var s=t.a=e[o];i=Ht(s,r,!0,t)&&i}if(i=Ht(s=t.a=n,r,!0,t)&&i,i=Ht(s,r,!1,t)&&i,e)for(o=0;o<e.length;o++)i=Ht(s=t.a=e[o],r,!1,t)&&i;return i},A.C=function(){if(zt.M.C.call(this),this.c){var t,e=this.c;for(t in e.a){for(var n=e.a[t],r=0;r<n.length;r++)Dt(n[r]);delete e.a[t],e.b--}}this.A=null},A.ra=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},A.sa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var Wt=R.JSON.stringify;function Qt(){this.b=this.a=null}var Yt,Zt=(Xt.prototype.get=function(){var t;return 0<this.b?(this.b--,t=this.a,this.a=t.next,t.next=null):t=this.c(),t},new Xt(function(){return new Kt},function(t){t.reset()},100));function Xt(t,e,n){this.f=n,this.c=t,this.g=e,this.b=0,this.a=null}function Kt(){this.next=this.b=this.a=null}function Jt(t){R.setTimeout(function(){throw t},0)}function $t(t,e){var n;Yt||(n=R.Promise.resolve(void 0),Yt=function(){n.then(ne)}),te||(Yt(),te=!0),ee.add(t,e)}Qt.prototype.add=function(t,e){var n=Zt.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},Kt.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var te=!(Kt.prototype.reset=function(){this.next=this.b=this.a=null}),ee=new Qt;function ne(){for(var t;r=n=void 0,r=null,(n=ee).a&&(r=n.a,n.a=n.a.next,n.a||(n.b=null),r.next=null),t=r;){try{t.a.call(t.b)}catch(t){Jt(t)}var e=Zt;e.g(t),e.b<e.f&&(e.b++,t.next=e.a,e.a=t)}var n,r;te=!1}function re(t,e){zt.call(this),this.b=t||1,this.a=e||R,this.f=M(this.Ua,this),this.g=q()}function ie(t){t.Z=!1,t.L&&(t.a.clearTimeout(t.L),t.L=null)}function oe(t,e,n){if("function"==D(t))n&&(t=M(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=M(t.handleEvent,t)}return 2147483647<Number(e)?-1:R.setTimeout(t,e||0)}function se(t,e,n){j.call(this),this.f=null!=n?M(t,n):t,this.c=e,this.b=M(this.Pa,this),this.a=[]}function ue(t){t.T=oe(t.b,t.c),t.f.apply(null,t.a)}function ae(t){j.call(this),this.b=t,this.a={}}x(re,zt),(A=re.prototype).Z=!1,A.L=null,A.Ua=function(){if(this.Z){var t=q()-this.g;0<t&&t<.8*this.b?this.L=this.a.setTimeout(this.f,this.b-t):(this.L&&(this.a.clearTimeout(this.L),this.L=null),this.dispatchEvent("tick"),this.Z&&(ie(this),this.start()))}},A.start=function(){this.Z=!0,this.L||(this.L=this.a.setTimeout(this.f,this.b),this.g=q())},A.C=function(){re.M.C.call(this),ie(this),delete this.a},x(se,j),(A=se.prototype).ba=!1,A.T=null,A.Ia=function(t){this.a=arguments,this.T?this.ba=!0:ue(this)},A.C=function(){se.M.C.call(this),this.T&&(R.clearTimeout(this.T),this.T=null,this.ba=!1,this.a=[])},A.Pa=function(){this.T=null,this.ba&&(this.ba=!1,ue(this))},x(ae,j);var he=[];function ce(t,e,n,r){Array.isArray(n)||(n&&(he[0]=n.toString()),n=he);for(var i=0;i<n.length;i++){var o=Ct(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function fe(t){J(t.a,function(t,e){this.a.hasOwnProperty(e)&&Ut(t)},t),t.a={}}function le(){}ae.prototype.C=function(){ae.M.C.call(this),fe(this)},ae.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var pe=null;function de(){return pe=pe||new zt}function ye(t){Tt.call(this,"serverreachability",t)}function ve(t){var e=de();e.dispatchEvent(new ye(e))}function ge(t){Tt.call(this,"statevent",t)}function me(t){var e=de();e.dispatchEvent(new ge(e))}function we(t){Tt.call(this,"timingevent",t)}function be(t,e){if("function"!=D(t))throw Error("Fn must not be null and must be a function");return R.setTimeout(function(){t()},e)}x(ye,Tt),x(ge,Tt),x(we,Tt);var Ee={NO_ERROR:0,Va:1,bb:2,ab:3,Ya:4,$a:5,cb:6,za:7,TIMEOUT:8,gb:9},Ie={Xa:"complete",kb:"success",Aa:"error",za:"abort",ib:"ready",jb:"readystatechange",TIMEOUT:"timeout",eb:"incrementaldata",hb:"progress",Za:"downloadprogress",lb:"uploadprogress"};function Te(){}function Ae(t){var e;return(e=t.a)||(e=t.a={}),e}function Ne(){}Te.prototype.a=null;var _e,Re={OPEN:"a",Wa:"b",Aa:"c",fb:"d"};function Se(){Tt.call(this,"d")}function De(){Tt.call(this,"c")}function Oe(){}function Pe(t,e,n){this.g=t,this.W=e,this.U=n||1,this.G=new ae(this),this.N=ke,t=at?125:void 0,this.O=new re(t),this.m=null,this.b=!1,this.j=this.A=this.f=this.B=this.s=this.P=this.h=null,this.i=[],this.a=null,this.w=0,this.c=this.v=null,this.H=-1,this.l=!1,this.J=0,this.D=null,this.o=this.R=this.F=!1}x(Se,Tt),x(De,Tt),x(Oe,Te),_e=new Oe;var ke=45e3,Le={},Ve={};function Ce(t,e,n){t.B=1,t.f=rn(Ke(e)),t.j=n,t.F=!0,Me(t,null)}function Me(t,e){t.s=q(),xe(t),t.A=Ke(t.f);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),gn(n.b,"t",r),t.w=0,t.a=ar(t.g,t.g.w?e:null),0<t.J&&(t.D=new se(M(t.ya,t,t.a),t.J)),ce(t.G,t.a,"readystatechange",t.Sa),e=t.m?$(t.m):{},t.j?(t.v||(t.v="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.$(t.A,t.v,t.j,e)):(t.v="GET",t.a.$(t.A,t.v,null,e)),ve(1)}function Ue(t,e,n){for(var r=!0;!t.l&&t.w<n.length;){var i=qe(t,n);if(i==Ve){4==e&&(t.c=4,me(14),r=!1);break}if(i==Le){t.c=4,me(15),r=!1;break}ze(t,i)}4==e&&0==n.length&&(t.c=1,me(16),r=!1),t.b=t.b&&r,r||(Be(t),Ge(t))}function qe(t,e){var n=t.w,r=e.indexOf("\n",n);return-1==r?Ve:(n=Number(e.substring(n,r)),isNaN(n)?Le:(r+=1)+n>e.length?Ve:(e=e.substr(r,n),t.w=r+n,e))}function xe(t){t.P=q()+t.N,je(t,t.N)}function je(t,e){if(null!=t.h)throw Error("WatchDog timer not null");t.h=be(M(t.Qa,t),e)}function Fe(t){t.h&&(R.clearTimeout(t.h),t.h=null)}function Ge(t){0==t.g.u||t.l||rr(t.g,t)}function Be(t){Fe(t);var e=t.D;e&&"function"==typeof e.da&&e.da(),t.D=null,ie(t.O),fe(t.G),t.a&&(e=t.a,t.a=null,e.abort(),e.da())}function ze(t,e){try{var n=t.g;if(0!=n.u&&(n.a==t||An(n.b,t)))if(n.A=t.H,!t.o&&An(n.b,t)&&3==n.u){try{var r=n.ja.a.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.i){if(n.a){if(!(n.a.s+3e3<t.s))break t;nr(n),n.a.cancel(),n.a=null}er(n),me(18)}}else n.ia=i[1],0<n.ia-n.G&&i[2]<37500&&n.U&&0==n.m&&!n.l&&(n.l=be(M(n.Na,n),6e3));if(Tn(n.b)<=1&&n.O){try{n.O()}catch(t){}n.O=void 0}}else or(n,11)}else if(!t.o&&n.a!=t||nr(n),!H(e))for(e=r=n.ja.a.parse(e),r=0;r<e.length;r++)if(i=e[r],n.G=i[0],i=i[1],2==n.u)if("c"==i[0]){n.B=i[1],n.R=i[2];var o=i[3];null!=o&&(n.oa=o);var s=i[5];null!=s&&"number"==typeof s&&0<s&&(n.D=1.5*s);var u=n,a=t.a;if(a){var h=a.a?a.a.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var c=u.b;!c.a&&(Y(h,"spdy")||Y(h,"quic")||Y(h,"h2"))&&(c.f=c.g,c.a=new Set,c.b&&(Nn(c,c.b),c.b=null))}if(u.s){var f=a.a?a.a.getResponseHeader("X-HTTP-Session-Id"):null;f&&(u.ha=f,nn(u.v,u.s,f))}}n.u=3,n.c&&n.c.na();var l=t;if((u=n).ea=ur(u,u.w?u.R:null,u.P),l.o){_n(u.b,l);var p=l,d=u.D;d&&p.setTimeout(d),p.h&&(Fe(p),xe(p)),u.a=l}else tr(u);0<n.f.length&&Xn(n)}else"stop"!=i[0]&&"close"!=i[0]||or(n,7);else 3==n.u&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?or(n,7):Qn(n):"noop"!=i[0]&&n.c&&n.c.ma(i),n.m=0);ve(4)}catch(t){}}function He(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(O(t)||"string"==typeof t)G(t,e,void 0);else{if(t.K&&"function"==typeof t.K)var n=t.K();else if(t.I&&"function"==typeof t.I)n=void 0;else if(O(t)||"string"==typeof t){n=[];for(var r=t.length,i=0;i<r;i++)n.push(i)}else for(i in n=[],r=0,t)n[r++]=i;i=(r=function(t){if(t.I&&"function"==typeof t.I)return t.I();if("string"==typeof t)return t.split("");if(O(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)).length;for(var o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}}function We(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof We)for(n=t.K(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function Qe(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Ye(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)Ye(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function Ye(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(A=Pe.prototype).setTimeout=function(t){this.N=t},A.Sa=function(t){t=t.target;var e=this.D;e&&3==Bn(t)?e.Ia():this.ya(t)},A.ya=function(t){try{if(t==this.a)t:{var e=Bn(this.a),n=this.a.qa(),r=this.a.S();if(!(e<3||3==e&&!at&&!this.a.Y())){this.l||4!=e||7==n||ve(8==n||r<=0?3:2),Fe(this);var i=this.a.S();this.H=i;var o=this.a.Y();if(this.b=200==i){if(this.R&&!this.o){e:{if(this.a){var s,u=this.a;if((s=u.a?u.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!H(s)){var a=s;break e}}a=null}if(!a){this.b=!1,this.c=3,me(12),Be(this),Ge(this);break t}this.o=!0,ze(this,a)}this.F?(Ue(this,e,o),at&&this.b&&3==e&&(ce(this.G,this.O,"tick",this.Ra),this.O.start())):ze(this,o),4==e&&Be(this),this.b&&!this.l&&(4==e?rr(this.g,this):(this.b=!1,xe(this)))}else 400==i&&0<o.indexOf("Unknown SID")?(this.c=3,me(12)):(this.c=0,me(13)),Be(this),Ge(this)}}}catch(t){}},A.Ra=function(){if(this.a){var t=Bn(this.a),e=this.a.Y();this.w<e.length&&(Fe(this),Ue(this,t,e),this.b&&4!=t&&xe(this))}},A.cancel=function(){this.l=!0,Be(this)},A.Qa=function(){this.h=null;var t=q();0<=t-this.P?(2!=this.B&&(ve(3),me(17)),Be(this),this.c=2,Ge(this)):je(this,this.P-t)},(A=We.prototype).I=function(){Qe(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},A.K=function(){return Qe(this),this.a.concat()},A.get=function(t,e){return Ye(this.b,t)?this.b[t]:e},A.set=function(t,e){Ye(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},A.forEach=function(t,e){for(var n=this.K(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Ze=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function Xe(t,e){if(this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof Xe){this.a=void 0!==e?e:t.a,Je(this,t.f),this.j=t.j,$e(this,t.c),tn(this,t.h),this.g=t.g,e=t.b;var n=new pn;n.c=e.c,e.a&&(n.a=new We(e.a),n.b=e.b),en(this,n),this.i=t.i}else t&&(n=String(t).match(Ze))?(this.a=!!e,Je(this,n[1]||"",!0),this.j=on(n[2]||""),$e(this,n[3]||"",!0),tn(this,n[4]),this.g=on(n[5]||"",!0),en(this,n[6]||"",!0),this.i=on(n[7]||"")):(this.a=!!e,this.b=new pn(null,this.a))}function Ke(t){return new Xe(t)}function Je(t,e,n){t.f=n?on(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function $e(t,e,n){t.c=n?on(e,!0):e}function tn(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.h=e}else t.h=null}function en(t,e,n){var r,i;e instanceof pn?(t.b=e,r=t.b,(i=t.a)&&!r.f&&(dn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(yn(this,e),gn(this,n,t))},r)),r.f=i):(n||(e=sn(e,fn)),t.b=new pn(e,t.a))}function nn(t,e,n){t.b.set(e,n)}function rn(t){return nn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^q()).toString(36)),t}function on(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function sn(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,un),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function un(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Xe.prototype.toString=function(){var t=[],e=this.f;e&&t.push(sn(e,an,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(sn(e,an,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(sn(n,"/"==n.charAt(0)?cn:hn,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",sn(n,ln)),t.join("")};var an=/[#\/\?@]/g,hn=/[#\?:]/g,cn=/[#\?]/g,fn=/[#\?@]/g,ln=/#/g;function pn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function dn(n){n.a||(n.a=new We,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function yn(t,e){dn(t),e=mn(t,e),Ye(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Ye((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&Qe(t)))}function vn(t,e){return dn(t),e=mn(t,e),Ye(t.a.b,e)}function gn(t,e,n){yn(t,e),0<n.length&&(t.c=null,t.a.set(mn(t,e),z(n)),t.b+=n.length)}function mn(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function wn(t,e){this.b=t,this.a=e}function bn(t){this.g=t||En,t=R.PerformanceNavigationTiming?0<(t=R.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(R.ca&&R.ca.ua&&R.ca.ua()&&R.ca.ua().mb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}(A=pn.prototype).add=function(t,e){dn(this),this.c=null,t=mn(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},A.forEach=function(n,r){dn(this),this.a.forEach(function(t,e){G(t,function(t){n.call(r,t,e,this)},this)},this)},A.K=function(){dn(this);for(var t=this.a.I(),e=this.a.K(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},A.I=function(t){dn(this);var e=[];if("string"==typeof t)vn(this,t)&&(e=B(e,this.a.get(mn(this,t))));else{t=this.a.I();for(var n=0;n<t.length;n++)e=B(e,t[n])}return e},A.set=function(t,e){return dn(this),this.c=null,vn(this,t=mn(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},A.get=function(t,e){return t&&0<(t=this.I(t)).length?String(t[0]):e},A.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.K(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.I(r);for(var o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}}return this.c=t.join("&")};var En=10;function In(t){return t.b||t.a&&t.a.size>=t.f}function Tn(t){return t.b?1:t.a?t.a.size:0}function An(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function Nn(t,e){t.a?t.a.add(e):t.b=e}function _n(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function Rn(t){var e,n;if(null!=t.b)return t.c.concat(t.b.i);if(null==t.a||0===t.a.size)return z(t.c);var r=t.c;try{for(var i=T(t.a.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r.concat(s.i)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function Sn(){}function Dn(){this.a=new Sn}function On(t,r,e){var i=e||"";try{He(t,function(t,e){var n=t;P(t)&&(n=Wt(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}function Pn(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}bn.prototype.cancel=function(){var e,t;if(this.c=Rn(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=T(this.a.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.a.clear()}},Sn.prototype.stringify=function(t){return R.JSON.stringify(t,void 0)},Sn.prototype.parse=function(t){return R.JSON.parse(t,void 0)};var kn=R.JSON.parse;function Ln(t){zt.call(this),this.headers=new We,this.G=t||null,this.b=!1,this.s=this.a=null,this.D="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.H=Vn,this.B=this.F=!1}x(Ln,zt);var Vn="",Cn=/^https?$/i,Mn=["POST","PUT"];function Un(t){return"content-type"==t.toLowerCase()}function qn(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,xn(t),Fn(t)}function xn(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function jn(t){if(t.b&&void 0!==_&&(!t.s[1]||4!=Bn(t)||2!=t.S()))if(t.l&&4==Bn(t))oe(t.va,0,t);else if(t.dispatchEvent("readystatechange"),4==Bn(t)){t.b=!1;try{var e,n=t.S();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.D).match(Ze)[1]||null;if(!o&&R.self&&R.self.location){var s=R.self.location.protocol;o=s.substr(0,s.length-1)}i=!Cn.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var u=2<Bn(t)?t.a.statusText:""}catch(t){u=""}t.f=u+" ["+t.S()+"]",xn(t)}}finally{Fn(t)}}}function Fn(t,e){if(t.a){Gn(t);var n=t.a,r=t.s[0]?S:null;t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function Gn(t){t.a&&t.B&&(t.a.ontimeout=null),t.m&&(R.clearTimeout(t.m),t.m=null)}function Bn(t){return t.a?t.a.readyState:0}function zn(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",J(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):nn(t,e,n))}function Hn(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Wn(t){this.f=[],this.R=this.ea=this.v=this.P=this.a=this.ha=this.s=this.N=this.h=this.F=this.j=null,this.Fa=this.H=0,this.Ca=Hn("failFast",!1,t),this.U=this.l=this.i=this.g=this.c=null,this.W=!0,this.A=this.ia=this.G=-1,this.J=this.m=this.o=0,this.Ba=Hn("baseRetryDelayMs",5e3,t),this.Ga=Hn("retryDelaySeedMs",1e4,t),this.Da=Hn("forwardChannelMaxRetries",2,t),this.ga=Hn("forwardChannelRequestTimeoutMs",2e4,t),this.Ea=t&&t.nb||void 0,this.D=void 0,this.w=t&&t.supportsCrossDomainXhr||!1,this.B="",this.b=new bn(t&&t.concurrentRequestLimit),this.ja=new Dn,this.fa=t&&t.fastHandshake||!1,t&&t.forceLongPolling&&(this.W=!1),this.O=void 0}function Qn(t){if(Yn(t),3==t.u){var e=t.H++,n=Ke(t.v);nn(n,"SID",t.B),nn(n,"RID",e),nn(n,"TYPE","terminate"),Jn(t,n),(e=new Pe(t,e,void 0)).B=2,e.f=rn(Ke(n)),n=!1,R.navigator&&R.navigator.sendBeacon&&(n=R.navigator.sendBeacon(e.f.toString(),"")),!n&&R.Image&&((new Image).src=e.f,n=!0),n||(e.a=ar(e.g,null),e.a.$(e.f)),e.s=q(),xe(e)}sr(t)}function Yn(t){t.a&&(t.a.cancel(),t.a=null),t.i&&(R.clearTimeout(t.i),t.i=null),nr(t),t.b.cancel(),t.g&&("number"==typeof t.g&&R.clearTimeout(t.g),t.g=null)}function Zn(t,e){t.f.push(new wn(t.Fa++,e)),3==t.u&&Xn(t)}function Xn(t){In(t.b)||t.g||(t.g=!0,$t(t.xa,t),t.o=0)}function Kn(t,e){var n;n=e?e.W:t.H++;var r=Ke(t.v);nn(r,"SID",t.B),nn(r,"RID",n),nn(r,"AID",t.G),Jn(t,r),t.h&&t.j&&zn(r,t.h,t.j),n=new Pe(t,n,t.o+1),null===t.h&&(n.m=t.j),e&&(t.f=e.i.concat(t.f)),e=$n(t,n,1e3),n.setTimeout(Math.round(.5*t.ga)+Math.round(.5*t.ga*Math.random())),Nn(t.b,n),Ce(n,r,e)}function Jn(t,n){t.c&&He({},function(t,e){nn(n,e,t)})}function $n(t,e,n){n=Math.min(t.f.length,n);var r=t.c?M(t.c.Ha,t.c,t):null;t:for(var i=t.f,o=-1;;){var s=["count="+n];-1==o?0<n?(o=i[0].b,s.push("ofs="+o)):o=0:s.push("ofs="+o);for(var u=!0,a=0;a<n;a++){var h=i[a].b,c=i[a].a;if((h-=o)<0)o=Math.max(0,i[a].b-100),u=!1;else try{On(c,s,"req"+h+"_")}catch(t){r&&r(c)}}if(u){r=s.join("&");break t}}return t=t.f.splice(0,n),e.i=t,r}function tr(t){t.a||t.i||(t.J=1,$t(t.wa,t),t.m=0)}function er(t){return!(t.a||t.i||3<=t.m)&&(t.J++,t.i=be(M(t.wa,t),ir(t,t.m)),t.m++,1)}function nr(t){null!=t.l&&(R.clearTimeout(t.l),t.l=null)}function rr(t,e){var n=null;if(t.a==e){nr(t),t.a=null;var r=2}else{if(!An(t.b,e))return;n=e.i,_n(t.b,e),r=1}if(t.A=e.H,0!=t.u)if(e.b)if(1==r){n=e.j?e.j.length:0,e=q()-e.s;var i=t.o;(r=de()).dispatchEvent(new we(r)),Xn(t)}else tr(t);else if(3==(i=e.c)||0==i&&0<t.A||!(1==r&&function(t,e){if(!(Tn(t.b)>=t.b.f-(t.g?1:0))){if(t.g)return t.f=e.i.concat(t.f),1;if(!(1==t.u||2==t.u||t.o>=(t.Ca?0:t.Da)))return t.g=be(M(t.xa,t,e),ir(t,t.o)),t.o++,1}}(t,e)||2==r&&er(t)))switch(n&&0<n.length&&(e=t.b,e.c=e.c.concat(n)),i){case 1:or(t,5);break;case 4:or(t,10);break;case 3:or(t,6);break;default:or(t,2)}}function ir(t,e){var n=t.Ba+Math.floor(Math.random()*t.Ga);return t.c||(n*=2),n*e}function or(t,e){if(2==e){var n=null;t.c&&(n=null);var r=M(t.Ta,t);n||(n=new Xe("//www.google.com/images/cleardot.gif"),R.location&&"http"==R.location.protocol||Je(n,"https"),rn(n)),function(t,e){var n=new le;if(R.Image){var r=new Image;r.onload=U(Pn,n,r,"TestLoadImage: loaded",!0,e),r.onerror=U(Pn,n,r,"TestLoadImage: error",!1,e),r.onabort=U(Pn,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=U(Pn,n,r,"TestLoadImage: timeout",!1,e),R.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}else e(!1)}(n.toString(),r)}else me(2);t.u=0,t.c&&t.c.la(e),sr(t),Yn(t)}function sr(t){t.u=0,t.A=-1,t.c&&(0==Rn(t.b).length&&0==t.f.length||(t.b.c.length=0,z(t.f),t.f.length=0),t.c.ka())}function ur(t,e,n){var r,i,o,s,u,a,h=(r=n)instanceof Xe?Ke(r):new Xe(r,void 0);if(""!=h.c)e&&$e(h,e+"."+h.c),tn(h,h.h);else{var c=R.location;i=c.protocol,o=e?e+"."+c.hostname:c.hostname,s=+c.port,u=n,a=new Xe(null,void 0),i&&Je(a,i),o&&$e(a,o),s&&tn(a,s),u&&(a.g=u),h=a}return t.N&&J(t.N,function(t,e){nn(h,e,t)}),e=t.s,n=t.ha,e&&n&&nn(h,e,n),nn(h,"VER",t.oa),Jn(t,h),h}function ar(t,e){if(e&&!t.w)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new Ln(t.Ea)).F=t.w,e}function hr(){}function cr(){if(st&&!(10<=Number(wt)))throw Error("Environmental error: no available transport.")}function fr(t,e){zt.call(this),this.a=new Wn(e),this.l=t,this.b=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.a.j=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.pa&&(t?t["X-WebChannel-Client-Profile"]=e.pa:t={"X-WebChannel-Client-Profile":e.pa}),this.a.F=t,(t=e&&e.httpHeadersOverwriteParam)&&!H(t)&&(this.a.h=t),this.h=e&&e.supportsCrossDomainXhr||!1,this.g=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!H(e)&&(this.a.s=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new dr(this)}function lr(t){Se.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.c=t)?(t=this.c,this.data=null!==e&&t in e?e[t]:void 0):this.data=e}else this.data=t}function pr(){De.call(this),this.status=1}function dr(t){this.a=t}(A=Ln.prototype).$=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);e=e?e.toUpperCase():"GET",this.D=t,this.f="",this.h=0,this.v=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.G?Ae(this.G):Ae(_e),this.a.onreadystatechange=M(this.va,this);try{this.w=!0,this.a.open(e,String(t),!0),this.w=!1}catch(t){return void qn(this,t)}t=n||"";var i,o=new We(this.headers);r&&He(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=Un,n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return e<0?null:"string"==typeof t?t.charAt(e):t[e]}(o.K()),n=R.FormData&&t instanceof R.FormData,0<=F(Mn,e)&&!r&&!n&&o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},this),this.H&&(this.a.responseType=this.H),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{Gn(this),0<this.o&&((this.B=(i=this.a,st&&gt(9)&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.a.timeout=this.o,this.a.ontimeout=M(this.ta,this)):this.m=oe(this.ta,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){qn(this,t)}},A.ta=function(){void 0!==_&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,this.dispatchEvent("timeout"),this.abort(8))},A.abort=function(t){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=t||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),Fn(this))},A.C=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),Fn(this,!0)),Ln.M.C.call(this)},A.va=function(){this.j||(this.w||this.l||this.g?jn(this):this.Oa())},A.Oa=function(){jn(this)},A.S=function(){try{return 2<Bn(this)?this.a.status:-1}catch(t){return-1}},A.Y=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},A.Ja=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),kn(e)}},A.qa=function(){return this.h},A.Ma=function(){return"string"==typeof this.f?this.f:String(this.f)},(A=Wn.prototype).oa=8,A.u=1,A.xa=function(t){if(this.g)if(this.g=null,1==this.u){if(!t){this.H=Math.floor(1e5*Math.random()),t=this.H++;var e,n=new Pe(this,t,void 0),r=this.j;if(this.F&&(r?et(r=$(r),this.F):r=this.F),null===this.h&&(n.m=r),this.fa)t:{for(var i=e=0;i<this.f.length;i++){var o=this.f[i];if("__data__"in o.a&&"string"==typeof(o=o.a.__data__)?o=o.length:o=void 0,void 0===o)break;if(4096<(e+=o)){e=i;break t}if(4096===e||i===this.f.length-1){e=i+1;break t}}e=1e3}else e=1e3;e=$n(this,n,e),nn(i=Ke(this.v),"RID",t),nn(i,"CVER",22),this.s&&nn(i,"X-HTTP-Session-Id",this.s),Jn(this,i),this.h&&r&&zn(i,this.h,r),Nn(this.b,n),this.fa?(nn(i,"$req",e),nn(i,"SID","null"),n.R=!0,Ce(n,i,null)):Ce(n,i,e),this.u=2}}else 3==this.u&&(t?Kn(this,t):0==this.f.length||In(this.b)||Kn(this))},A.wa=function(){this.i=null,this.a=new Pe(this,"rpc",this.J),null===this.h&&(this.a.m=this.j),this.a.J=0;var t=Ke(this.ea);nn(t,"RID","rpc"),nn(t,"SID",this.B),nn(t,"CI",this.U?"0":"1"),nn(t,"AID",this.G),Jn(this,t),nn(t,"TYPE","xmlhttp"),this.h&&this.j&&zn(t,this.h,this.j),this.D&&this.a.setTimeout(this.D);var e=this.a,n=this.R;e.B=1,e.f=rn(Ke(t)),e.j=null,e.F=!0,Me(e,n)},A.Na=function(){null!=this.l&&(this.l=null,this.a.cancel(),this.a=null,er(this),me(19))},A.Ta=function(t){me(t?2:1)},(A=hr.prototype).na=function(){},A.ma=function(){},A.la=function(){},A.ka=function(){},A.Ha=function(){},cr.prototype.a=function(t,e){return new fr(t,e)},x(fr,zt),(A=fr.prototype).addEventListener=function(t,e,n,r){fr.M.addEventListener.call(this,t,e,n,r)},A.removeEventListener=function(t,e,n,r){fr.M.removeEventListener.call(this,t,e,n,r)},A.Ka=function(){this.a.c=this.f,this.h&&(this.a.w=!0);var t=this.a,e=this.l,n=this.b||void 0;me(0),t.P=e,t.N=n||{},t.U=t.W,t.v=ur(t,null,t.P),Xn(t)},A.close=function(){Qn(this.a)},A.La=function(t){if("string"==typeof t){var e={};e.__data__=t,Zn(this.a,e)}else this.g?((e={}).__data__=Wt(t),Zn(this.a,e)):Zn(this.a,t)},A.C=function(){this.a.c=null,delete this.f,Qn(this.a),delete this.a,fr.M.C.call(this)},x(lr,Se),x(pr,De),x(dr,hr),dr.prototype.na=function(){this.a.dispatchEvent("a")},dr.prototype.ma=function(t){this.a.dispatchEvent(new lr(t))},dr.prototype.la=function(t){this.a.dispatchEvent(new pr)},dr.prototype.ka=function(){this.a.dispatchEvent("b")},cr.prototype.createWebChannel=cr.prototype.a,fr.prototype.send=fr.prototype.La,fr.prototype.open=fr.prototype.Ka,fr.prototype.close=fr.prototype.close,Ee.NO_ERROR=0,Ee.TIMEOUT=8,Ee.HTTP_ERROR=6,Ie.COMPLETE="complete",(Ne.EventType=Re).OPEN="a",Re.CLOSE="b",Re.ERROR="c",Re.MESSAGE="d",zt.prototype.listen=zt.prototype.ra,Ln.prototype.listenOnce=Ln.prototype.sa,Ln.prototype.getLastError=Ln.prototype.Ma,Ln.prototype.getLastErrorCode=Ln.prototype.qa,Ln.prototype.getStatus=Ln.prototype.S,Ln.prototype.getResponseJson=Ln.prototype.Ja,Ln.prototype.getResponseText=Ln.prototype.Y,Ln.prototype.send=Ln.prototype.$;var yr={createWebChannelTransport:function(){return new cr},ErrorCode:Ee,EventType:Ie,WebChannel:Ne,XhrIo:Ln},vr=yr.createWebChannelTransport,gr=yr.ErrorCode,mr=yr.EventType,wr=yr.WebChannel,br=yr.XhrIo,Er=cf.SDK_VERSION,Ir=(Tr.prototype.t=function(){return null!=this.uid},Tr.prototype.s=function(){return this.t()?"uid:"+this.uid:"anonymous-user"},Tr.prototype.isEqual=function(t){return t.uid===this.uid},Tr);function Tr(t){this.uid=t}Ir.UNAUTHENTICATED=new Ir(null),Ir.i=new Ir("google-credentials-uid"),Ir.h=new Ir("first-party-uid");function Ar(t,e){this.user=e,this.type="OAuth",this.o={},this.o.Authorization="Bearer "+t}var Nr,_r,Rr={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"},Sr=(n(Hr,_r=Error),Hr),Dr=(zr.prototype.getToken=function(){return Promise.resolve(null)},zr.prototype.l=function(){},zr.prototype._=function(t){(this.u=t)(Ir.UNAUTHENTICATED)},zr.prototype.T=function(){this.u=null},zr),Or=(Br.prototype.getToken=function(){var e=this,n=this.R,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){if(e.R!==n)throw new Sr(Rr.ABORTED,"getToken aborted due to token change.");return t?(Js("string"==typeof t.accessToken),new Ar(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},Br.prototype.l=function(){this.forceRefresh=!0},Br.prototype._=function(t){this.u=t,this.I&&t(this.currentUser)},Br.prototype.T=function(){this.auth&&this.auth.removeAuthTokenListener(this.m),this.m=null,this.u=null},Br.prototype.A=function(){var t=this.auth&&this.auth.getUid();return Js(null===t||"string"==typeof t),new Ir(t)},Br),Pr=(Object.defineProperty(Gr.prototype,"o",{get:function(){var t={"X-Goog-AuthUser":this.V},e=this.P.auth.p([]);return e&&(t.Authorization=e),t},enumerable:!0,configurable:!0}),Gr),kr=(Fr.prototype.getToken=function(){return Promise.resolve(new Pr(this.P,this.V))},Fr.prototype._=function(t){t(Ir.h)},Fr.prototype.T=function(){},Fr.prototype.l=function(){},Fr),Lr=(jr.now=function(){return jr.fromMillis(Date.now())},jr.fromDate=function(t){return jr.fromMillis(t.getTime())},jr.fromMillis=function(t){var e=Math.floor(t/1e3);return new jr(e,1e6*(t-1e3*e))},jr.prototype.toDate=function(){return new Date(this.toMillis())},jr.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},jr.prototype.g=function(t){return this.seconds===t.seconds?nu(this.nanoseconds,t.nanoseconds):nu(this.seconds,t.seconds)},jr.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},jr.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},jr.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},jr),Vr=(xr.v=function(t){return new xr(t)},xr.min=function(){return new xr(new Lr(0,0))},xr.prototype.S=function(t){return this.timestamp.g(t.timestamp)},xr.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},xr.prototype.C=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},xr.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},xr.prototype.D=function(){return this.timestamp},xr),Cr=(Object.defineProperty(qr.prototype,"length",{get:function(){return this.F},enumerable:!0,configurable:!0}),qr.prototype.isEqual=function(t){return 0===qr.N(this,t)},qr.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof qr?t.forEach(function(t){e.push(t)}):e.push(t),this.$(e)},qr.prototype.limit=function(){return this.offset+this.length},qr.prototype.k=function(t){return t=void 0===t?1:t,this.$(this.segments,this.offset+t,this.length-t)},qr.prototype.L=function(){return this.$(this.segments,this.offset,this.length-1)},qr.prototype.O=function(){return this.segments[this.offset]},qr.prototype.q=function(){return this.get(this.length-1)},qr.prototype.get=function(t){return this.segments[this.offset+t]},qr.prototype.M=function(){return 0===this.length},qr.prototype.B=function(t){if(t.length<this.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},qr.prototype.U=function(t){if(this.length+1!==t.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},qr.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},qr.prototype.W=function(){return this.segments.slice(this.offset,this.limit())},qr.N=function(t,e){for(var n=Math.min(t.length,e.length),r=0;r<n;r++){var i=t.get(r),o=e.get(r);if(i<o)return-1;if(o<i)return 1}return t.length<e.length?-1:t.length>e.length?1:0},qr),Mr=(n(Ur,Nr=Cr),Ur.prototype.$=function(t,e,n){return new Ur(t,e,n)},Ur.prototype.j=function(){return this.W().join("/")},Ur.prototype.toString=function(){return this.j()},Ur.G=function(t){if(0<=t.indexOf("//"))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new Ur(t.split("/").filter(function(t){return 0<t.length}))},Ur);function Ur(){return null!==Nr&&Nr.apply(this,arguments)||this}function qr(t,e,n){void 0===e?e=0:e>t.length&&Ks(),void 0===n?n=t.length-e:n>t.length-e&&Ks(),this.segments=t,this.offset=e,this.F=n}function xr(t){this.timestamp=t}function jr(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new Sr(Rr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new Sr(Rr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Sr(Rr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new Sr(Rr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function Fr(t,e){this.P=t,this.V=e}function Gr(t,e){this.P=t,this.V=e,this.type="FirstParty",this.user=Ir.h}function Br(t){var e=this;this.m=null,this.currentUser=Ir.UNAUTHENTICATED,this.I=!1,this.R=0,this.u=null,this.forceRefresh=!1,this.m=function(){e.R++,e.currentUser=e.A(),e.I=!0,e.u&&e.u(e.currentUser)},this.R=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.m):(this.m(null),t.get().then(function(t){e.auth=t,e.m&&e.auth.addAuthTokenListener(e.m)},function(){}))}function zr(){this.u=null}function Hr(t,e){var n=this;return(n=_r.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}Mr.H=new Mr([]);var Wr,Qr=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Yr=(n(Zr,Wr=Cr),Zr.prototype.$=function(t,e,n){return new Zr(t,e,n)},Zr.K=function(t){return Qr.test(t)},Zr.prototype.j=function(){return this.W().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),Zr.K(t)||(t="`"+t+"`"),t}).join(".")},Zr.prototype.toString=function(){return this.j()},Zr.prototype.Y=function(){return 1===this.length&&"__name__"===this.get(0)},Zr.X=function(){return new Zr(["__name__"])},Zr.J=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");e.push(n),n=""},o=!1;r<t.length;){var s=t[r];if("\\"===s){if(r+1===t.length)throw new Sr(Rr.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var u=t[r+1];if("\\"!==u&&"."!==u&&"`"!==u)throw new Sr(Rr.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=u,r+=2}else"`"===s?o=!o:"."!==s||o?n+=s:i(),r++}if(i(),o)throw new Sr(Rr.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Zr(e)},Zr);function Zr(){return null!==Wr&&Wr.apply(this,arguments)||this}Yr.H=new Yr([]);var Xr=(Kr.Z=function(t){return new Kr(Mr.G(t).k(5))},Kr.prototype.tt=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},Kr.prototype.isEqual=function(t){return null!==t&&0===Mr.N(this.path,t.path)},Kr.prototype.toString=function(){return this.path.toString()},Kr.N=function(t,e){return Mr.N(t.path,e.path)},Kr.et=function(t){return t.length%2==0},Kr.st=function(t){return new Kr(new Mr(t.slice()))},Kr);function Kr(t){this.path=t}function Jr(t){var e=0;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function $r(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function ti(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}Xr.EMPTY=new Xr(new Mr([]));var ei=(ni.fromBase64String=function(t){return new ni(Bs.nt().atob(t))},ni.fromUint8Array=function(t){return new ni(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},ni.prototype.toBase64=function(){return Bs.nt().btoa(this.it)},ni.prototype.toUint8Array=function(){return function(t){for(var e=new Uint8Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(this.it)},ni.prototype.rt=function(){return 2*this.it.length},ni.prototype.S=function(t){return nu(this.it,t.it)},ni.prototype.isEqual=function(t){return this.it===t.it},ni);function ni(t){this.it=t}function ri(t){return null==t}function ii(t){return-0===t&&1/t==-1/0}function oi(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function si(t){var e=di(t.mapValue.fields.__local_write_time__.timestampValue);return new Lr(e.seconds,e.nanos)}ei.ht=new ei("");var ui=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function ai(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?oi(t)?4:10:Ks()}function hi(i,t){var e,n,r,o=ai(i);if(o!==ai(t))return!1;switch(o){case 0:return!0;case 1:return i.booleanValue===t.booleanValue;case 4:return si(i).isEqual(si(t));case 3:return function(t){if("string"==typeof i.timestampValue&&"string"==typeof t.timestampValue&&i.timestampValue.length===t.timestampValue.length)return i.timestampValue===t.timestampValue;var e=di(i.timestampValue),n=di(t.timestampValue);return e.seconds===n.seconds&&e.nanos===n.nanos}(t);case 5:return i.stringValue===t.stringValue;case 6:return r=t,vi(i.bytesValue).isEqual(vi(r.bytesValue));case 7:return i.referenceValue===t.referenceValue;case 8:return n=t,yi((e=i).geoPointValue.latitude)===yi(n.geoPointValue.latitude)&&yi(e.geoPointValue.longitude)===yi(n.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return yi(t.integerValue)===yi(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=yi(t.doubleValue),r=yi(e.doubleValue);return n===r?ii(n)===ii(r):isNaN(n)&&isNaN(r)}return!1}(i,t);case 9:return ru(i.arrayValue.values||[],t.arrayValue.values||[],hi);case 10:return function(t){var e=i.mapValue.fields||{},n=t.mapValue.fields||{};if(Jr(e)!==Jr(n))return!1;for(var r in e)if(e.hasOwnProperty(r)&&(void 0===n[r]||!hi(e[r],n[r])))return!1;return!0}(t);default:return Ks()}}function ci(t,e){return void 0!==(t.values||[]).find(function(t){return hi(t,e)})}function fi(t,e){var n,r,i,o,s,u,a,h,c,f,l=ai(t),p=ai(e);if(l!==p)return nu(l,p);switch(l){case 0:return 0;case 1:return nu(t.booleanValue,e.booleanValue);case 2:return h=e,c=yi(t.integerValue||t.doubleValue),f=yi(h.integerValue||h.doubleValue),c<f?-1:f<c?1:c===f?0:isNaN(c)?isNaN(f)?0:-1:1;case 3:return li(t.timestampValue,e.timestampValue);case 4:return li(si(t),si(e));case 5:return nu(t.stringValue,e.stringValue);case 6:return o=t.bytesValue,s=e.bytesValue,u=vi(o),a=vi(s),u.S(a);case 7:return function(t,e){for(var n=t.split("/"),r=e.split("/"),i=0;i<n.length&&i<r.length;i++){var o=nu(n[i],r[i]);if(0!==o)return o}return nu(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return n=t.geoPointValue,r=e.geoPointValue,0!==(i=nu(yi(n.latitude),yi(r.latitude)))?i:nu(yi(n.longitude),yi(r.longitude));case 9:return function(t,e){for(var n=t.values||[],r=e.values||[],i=0;i<n.length&&i<r.length;++i){var o=fi(n[i],r[i]);if(o)return o}return nu(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){var n=t.fields||{},r=Object.keys(n),i=e.fields||{},o=Object.keys(i);r.sort(),o.sort();for(var s=0;s<r.length&&s<o.length;++s){var u=nu(r[s],o[s]);if(0!==u)return u;var a=fi(n[r[s]],i[o[s]]);if(0!==a)return a}return nu(r.length,o.length)}(t.mapValue,e.mapValue);default:throw Ks()}}function li(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return nu(t,e);var n=di(t),r=di(e),i=nu(n.seconds,r.seconds);return 0!==i?i:nu(n.nanos,r.nanos)}function pi(t){return function s(i){return"nullValue"in i?"null":"booleanValue"in i?""+i.booleanValue:"integerValue"in i?""+i.integerValue:"doubleValue"in i?""+i.doubleValue:"timestampValue"in i?"time("+(t=di(i.timestampValue)).seconds+","+t.nanos+")":"stringValue"in i?i.stringValue:"bytesValue"in i?vi(i.bytesValue).toBase64():"referenceValue"in i?(n=i.referenceValue,Xr.Z(n).toString()):"geoPointValue"in i?"geo("+(e=i.geoPointValue).latitude+","+e.longitude+")":"arrayValue"in i?function(){for(var t="[",e=!0,n=0,r=i.arrayValue.values||[];n<r.length;n++){e?e=!1:t+=",",t+=s(r[n])}return t+"]"}():"mapValue"in i?function(t){for(var e="{",n=!0,r=0,i=Object.keys(t.fields||{}).sort();r<i.length;r++){var o=i[r];n?n=!1:e+=",",e+=o+":"+s(t.fields[o])}return e+"}"}(i.mapValue):Ks();var t,e,n}(t)}function di(t){if(Js(!!t),"string"!=typeof t)return{seconds:yi(t.seconds),nanos:yi(t.nanos)};var e=0,n=ui.exec(t);if(Js(!!n),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),e=Number(r)}var i=new Date(t);return{seconds:Math.floor(i.getTime()/1e3),nanos:e}}function yi(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function vi(t){return"string"==typeof t?ei.fromBase64String(t):ei.fromUint8Array(t)}function gi(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.j()}}function mi(t){return t&&"integerValue"in t}function wi(t){return!!t&&"arrayValue"in t}function bi(t){return t&&"nullValue"in t}function Ei(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Ii(t){return t&&"mapValue"in t}var Ti=(Ai.prototype.ot=function(t,e){return n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}},t&&(n.fields.__previous_value__=t),{mapValue:n};var n},Ai.prototype.at=function(t,e){return e},Ai.prototype.ut=function(t){return null},Ai.prototype.isEqual=function(t){return t instanceof Ai},Ai);function Ai(){}Ti.instance=new Ti;var Ni=(Oi.prototype.ot=function(t,e){return this.apply(t)},Oi.prototype.at=function(t,e){return this.apply(t)},Oi.prototype.apply=function(t){for(var n=Pi(t),e=function(e){n.some(function(t){return hi(t,e)})||n.push(e)},r=0,i=this.elements;r<i.length;r++)e(i[r]);return{arrayValue:{values:n}}},Oi.prototype.ut=function(t){return null},Oi.prototype.isEqual=function(t){return t instanceof Oi&&ru(this.elements,t.elements,hi)},Oi),_i=(Di.prototype.ot=function(t,e){return this.apply(t)},Di.prototype.at=function(t,e){return this.apply(t)},Di.prototype.apply=function(t){for(var n=Pi(t),e=function(e){n=n.filter(function(t){return!hi(t,e)})},r=0,i=this.elements;r<i.length;r++)e(i[r]);return{arrayValue:{values:n}}},Di.prototype.ut=function(t){return null},Di.prototype.isEqual=function(t){return t instanceof Di&&ru(this.elements,t.elements,hi)},Di),Ri=(Si.prototype.ot=function(t,e){var n=this.ut(t),r=this.asNumber(n)+this.asNumber(this.ct);return mi(n)&&mi(this.ct)?this.serializer.lt(r):this.serializer._t(r)},Si.prototype.at=function(t,e){return e},Si.prototype.ut=function(t){return mi(e=t)||e&&"doubleValue"in e?t:{integerValue:0};var e},Si.prototype.isEqual=function(t){return t instanceof Si&&hi(this.ct,t.ct)},Si.prototype.asNumber=function(t){return yi(t.integerValue||t.doubleValue)},Si);function Si(t,e){this.serializer=t,this.ct=e}function Di(t){this.elements=t}function Oi(t){this.elements=t}function Pi(t){return wi(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function ki(t,e){this.version=t,this.transformResults=e}var Li,Vi,Ci,Mi,Ui,qi=(oo.prototype.ft=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].B(t))return!0;return!1},oo.prototype.isEqual=function(t){return ru(this.fields,t.fields,function(t,e){return t.isEqual(e)})},oo),xi=(io.prototype.isEqual=function(t){return this.field.isEqual(t.field)&&this.transform.isEqual(t.transform)},io),ji=(ro.dt=function(){return new ro},ro.exists=function(t){return new ro(void 0,t)},ro.updateTime=function(t){return new ro(t)},Object.defineProperty(ro.prototype,"wt",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!0,configurable:!0}),ro.prototype.Tt=function(t){return void 0!==this.updateTime?t instanceof Eo&&t.version.isEqual(this.updateTime):void 0===this.exists||this.exists===t instanceof Eo},ro.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},ro),Fi=(no.prototype.Et=function(t){},no.It=function(t){return t instanceof Eo?t.version:Vr.min()},no),Gi=(n(eo,Ui=Fi),eo.prototype.at=function(t,e){this.Et(t);var n=e.version;return new Eo(this.key,n,this.value,{hasCommittedMutations:!0})},eo.prototype.ot=function(t,e,n){if(this.Et(t),!this.Rt.Tt(t))return t;var r=Fi.It(t);return new Eo(this.key,r,this.value,{At:!0})},eo.prototype.Pt=function(t){return null},eo.prototype.isEqual=function(t){return t instanceof eo&&this.key.isEqual(t.key)&&this.value.isEqual(t.value)&&this.Rt.isEqual(t.Rt)},eo),Bi=(n(to,Mi=Fi),to.prototype.at=function(t,e){if(this.Et(t),!this.Rt.Tt(t))return new To(this.key,e.version);var n=this.pt(t);return new Eo(this.key,e.version,n,{hasCommittedMutations:!0})},to.prototype.ot=function(t,e,n){if(this.Et(t),!this.Rt.Tt(t))return t;var r=Fi.It(t),i=this.pt(t);return new Eo(this.key,r,i,{At:!0})},to.prototype.Pt=function(t){return null},to.prototype.isEqual=function(t){return t instanceof to&&this.key.isEqual(t.key)&&this.Vt.isEqual(t.Vt)&&this.Rt.isEqual(t.Rt)},to.prototype.pt=function(t){var e;return e=t instanceof Eo?t.data():Qi.empty(),this.yt(e)},to.prototype.yt=function(t){var n=this,r=new Yi(t);return this.Vt.fields.forEach(function(t){if(!t.M()){var e=n.data.field(t);null!==e?r.set(t,e):r.delete(t)}}),r.gt()},to),zi=(n($i,Ci=Fi),$i.prototype.at=function(t,e){if(this.Et(t),Js(null!=e.transformResults),!this.Rt.Tt(t))return new To(this.key,e.version);var n=this.bt(t),r=this.vt(t,e.transformResults),i=e.version,o=this.St(n.data(),r);return new Eo(this.key,i,o,{hasCommittedMutations:!0})},$i.prototype.ot=function(t,e,n){if(this.Et(t),!this.Rt.Tt(t))return t;var r=this.bt(t),i=this.Ct(n,t,e),o=this.St(r.data(),i);return new Eo(this.key,r.version,o,{At:!0})},$i.prototype.Pt=function(t){for(var e=null,n=0,r=this.fieldTransforms;n<r.length;n++){var i=r[n],o=t instanceof Eo?t.field(i.field):void 0,s=i.transform.ut(o||null);null!=s&&(e=null==e?(new Yi).set(i.field,s):e.set(i.field,s))}return e?e.gt():null},$i.prototype.isEqual=function(t){return t instanceof $i&&this.key.isEqual(t.key)&&ru(this.fieldTransforms,t.fieldTransforms,function(t,e){return t.isEqual(e)})&&this.Rt.isEqual(t.Rt)},$i.prototype.bt=function(t){return t},$i.prototype.vt=function(t,e){var n=[];Js(this.fieldTransforms.length===e.length);for(var r=0;r<e.length;r++){var i=this.fieldTransforms[r],o=i.transform,s=null;t instanceof Eo&&(s=t.field(i.field)),n.push(o.at(s,e[r]))}return n},$i.prototype.Ct=function(t,e,n){for(var r=[],i=0,o=this.fieldTransforms;i<o.length;i++){var s=o[i],u=s.transform,a=null;e instanceof Eo&&(a=e.field(s.field)),null===a&&n instanceof Eo&&(a=n.field(s.field)),r.push(u.ot(a,t))}return r},$i.prototype.St=function(t,e){for(var n=new Yi(t),r=0;r<this.fieldTransforms.length;r++){var i=this.fieldTransforms[r].field;n.set(i,e[r])}return n.gt()},$i),Hi=(n(Ji,Vi=Fi),Ji.prototype.at=function(t,e){return this.Et(t),new Io(this.key,e.version,{hasCommittedMutations:!0})},Ji.prototype.ot=function(t,e,n){return this.Et(t),this.Rt.Tt(t)?new Io(this.key,Vr.min()):t},Ji.prototype.Pt=function(t){return null},Ji.prototype.isEqual=function(t){return t instanceof Ji&&this.key.isEqual(t.key)&&this.Rt.isEqual(t.Rt)},Ji),Wi=(n(Ki,Li=Fi),Ki.prototype.at=function(t,e){Ks()},Ki.prototype.ot=function(t,e,n){Ks()},Ki.prototype.Pt=function(t){Ks()},Ki.prototype.isEqual=function(t){return t instanceof Ki&&this.key.isEqual(t.key)&&this.Rt.isEqual(t.Rt)},Ki),Qi=(Xi.empty=function(){return new Xi({mapValue:{}})},Xi.prototype.field=function(t){if(t.M())return this.proto;for(var e=this.proto,n=0;n<t.length-1;++n){if(!e.mapValue.fields)return null;if(!Ii(e=e.mapValue.fields[t.get(n)]))return null}return(e=(e.mapValue.fields||{})[t.q()])||null},Xi.prototype.isEqual=function(t){return hi(this.proto,t.proto)},Xi),Yi=(Zi.prototype.set=function(t,e){return this.Nt(t,e),this},Zi.prototype.delete=function(t){return this.Nt(t,null),this},Zi.prototype.Nt=function(t,e){for(var n=this.Ft,r=0;r<t.length-1;++r){var i=t.get(r),o=n.get(i);o instanceof Map||(o=o&&10===ai(o)?new Map(Object.entries(o.mapValue.fields||{})):new Map,n.set(i,o)),n=o}n.set(t.q(),e)},Zi.prototype.gt=function(){var t=this.$t(Yr.H,this.Ft);return null!=t?new Qi(t):this.Dt},Zi.prototype.$t=function(r,t){var i=this,o=!1,e=this.Dt.field(r),s=Ii(e)?Object.assign({},e.mapValue.fields):{};return t.forEach(function(t,e){if(t instanceof Map){var n=i.$t(r.child(e),t);null!=n&&(s[e]=n,o=!0)}else null!==t?(s[e]=t,o=!0):s.hasOwnProperty(e)&&(delete s[e],o=!0)}),o?{mapValue:{fields:s}}:null},Zi);function Zi(t){void 0===t&&(t=Qi.empty()),this.Dt=t,this.Ft=new Map}function Xi(t){this.proto=t}function Ki(t,e){var n=this;return(n=Li.call(this)||this).key=t,n.Rt=e,n.type=4,n}function Ji(t,e){var n=this;return(n=Vi.call(this)||this).key=t,n.Rt=e,n.type=3,n}function $i(t,e){var n=this;return(n=Ci.call(this)||this).key=t,n.fieldTransforms=e,n.type=2,n.Rt=ji.exists(!0),n}function to(t,e,n,r){var i=this;return(i=Mi.call(this)||this).key=t,i.data=e,i.Vt=n,i.Rt=r,i.type=1,i}function eo(t,e,n){var r=this;return(r=Ui.call(this)||this).key=t,r.value=e,r.Rt=n,r.type=0,r}function no(){}function ro(t,e){this.updateTime=t,this.exists=e}function io(t,e){this.field=t,this.transform=e}function oo(t){(this.fields=t).sort(Yr.N)}function so(t){var u=[];return $r(t.fields||{},function(t,e){var n=new Yr([t]);if(Ii(e)){var r=so(e.mapValue).fields;if(0===r.length)u.push(n);else for(var i=0,o=r;i<o.length;i++){var s=o[i];u.push(n.child(s))}}else u.push(n)}),new qi(u)}function uo(t,e){this.key=t,this.version=e}function ao(t){this.count=t}var ho,co,fo,lo,po,yo,vo,go,mo,wo,bo,Eo=(n(Yo,bo=uo),Yo.prototype.field=function(t){return this.kt.field(t)},Yo.prototype.data=function(){return this.kt},Yo.prototype.Lt=function(){return this.kt.proto},Yo.prototype.isEqual=function(t){return t instanceof Yo&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.At===t.At&&this.hasCommittedMutations===t.hasCommittedMutations&&this.kt.isEqual(t.kt)},Yo.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.kt.toString()+", {hasLocalMutations: "+this.At+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(Yo.prototype,"hasPendingWrites",{get:function(){return this.At||this.hasCommittedMutations},enumerable:!0,configurable:!0}),Yo),Io=(n(Qo,wo=uo),Qo.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(Qo.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!0,configurable:!0}),Qo.prototype.isEqual=function(t){return t instanceof Qo&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Qo),To=(n(Wo,mo=uo),Wo.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(Wo.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!0,configurable:!0}),Wo.prototype.isEqual=function(t){return t instanceof Wo&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Wo),Ao=(Ho.prototype.canonicalId=function(){if(null===this.Ot){var t=this.path.j();null!==this.collectionGroup&&(t+="|cg:"+this.collectionGroup),t+="|f:",t+=this.filters.map(function(t){return t.canonicalId()}).join(","),t+="|ob:",t+=this.orderBy.map(function(t){return t.canonicalId()}).join(","),ri(this.limit)||(t+="|l:",t+=this.limit),this.startAt&&(t+="|lb:",t+=this.startAt.canonicalId()),this.endAt&&(t+="|ub:",t+=this.endAt.canonicalId()),this.Ot=t}return this.Ot},Ho.prototype.toString=function(){var t=this.path.j();return null!==this.collectionGroup&&(t+=" collectionGroup="+this.collectionGroup),0<this.filters.length&&(t+=", filters: ["+this.filters.join(", ")+"]"),ri(this.limit)||(t+=", limit: "+this.limit),0<this.orderBy.length&&(t+=", orderBy: ["+this.orderBy.join(", ")+"]"),this.startAt&&(t+=", startAt: "+this.startAt.canonicalId()),this.endAt&&(t+=", endAt: "+this.endAt.canonicalId()),"Target("+t+")"},Ho.prototype.isEqual=function(t){if(this.limit!==t.limit)return!1;if(this.orderBy.length!==t.orderBy.length)return!1;for(var e=0;e<this.orderBy.length;e++)if(!this.orderBy[e].isEqual(t.orderBy[e]))return!1;if(this.filters.length!==t.filters.length)return!1;for(var n=0;n<this.filters.length;n++)if(!this.filters[n].isEqual(t.filters[n]))return!1;return this.collectionGroup===t.collectionGroup&&!!this.path.isEqual(t.path)&&!!(null!==this.startAt?this.startAt.isEqual(t.startAt):null===t.startAt)&&(null!==this.endAt?this.endAt.isEqual(t.endAt):null===t.endAt)},Ho.prototype.qt=function(){return Xr.et(this.path)&&null===this.collectionGroup&&0===this.filters.length},Ho),No=(zo.Wt=function(t){return new zo(t)},Object.defineProperty(zo.prototype,"orderBy",{get:function(){if(null===this.Bt){this.Bt=[];var t=this.jt(),e=this.Gt();if(null!==t&&null===e)t.Y()||this.Bt.push(new Lo(t)),this.Bt.push(new Lo(Yr.X(),"asc"));else{for(var n=!1,r=0,i=this.Mt;r<i.length;r++){var o=i[r];this.Bt.push(o),o.field.Y()&&(n=!0)}if(!n){var s=0<this.Mt.length?this.Mt[this.Mt.length-1].dir:"asc";this.Bt.push(new Lo(Yr.X(),s))}}}return this.Bt},enumerable:!0,configurable:!0}),zo.prototype.Ht=function(t){var e=this.filters.concat([t]);return new zo(this.path,this.collectionGroup,this.Mt.slice(),e,this.limit,this.xt,this.startAt,this.endAt)},zo.prototype.Kt=function(t){var e=this.Mt.concat([t]);return new zo(this.path,this.collectionGroup,e,this.filters.slice(),this.limit,this.xt,this.startAt,this.endAt)},zo.prototype.zt=function(t){return new zo(this.path,this.collectionGroup,this.Mt.slice(),this.filters.slice(),t,"F",this.startAt,this.endAt)},zo.prototype.Yt=function(t){return new zo(this.path,this.collectionGroup,this.Mt.slice(),this.filters.slice(),t,"L",this.startAt,this.endAt)},zo.prototype.Xt=function(t){return new zo(this.path,this.collectionGroup,this.Mt.slice(),this.filters.slice(),this.limit,this.xt,t,this.endAt)},zo.prototype.Jt=function(t){return new zo(this.path,this.collectionGroup,this.Mt.slice(),this.filters.slice(),this.limit,this.xt,this.startAt,t)},zo.prototype.Zt=function(t){return new zo(t,null,this.Mt.slice(),this.filters.slice(),this.limit,this.xt,this.startAt,this.endAt)},zo.prototype.te=function(){return 0===this.filters.length&&null===this.limit&&null==this.startAt&&null==this.endAt&&(0===this.Mt.length||1===this.Mt.length&&this.Mt[0].field.Y())},zo.prototype.canonicalId=function(){return this.ee().canonicalId()+"|lt:"+this.xt},zo.prototype.toString=function(){return"Query(target="+this.ee().toString()+"; limitType="+this.xt+")"},zo.prototype.isEqual=function(t){return this.ee().isEqual(t.ee())&&this.xt===t.xt},zo.prototype.se=function(t,e){for(var n=!1,r=0,i=this.orderBy;r<i.length;r++){var o=i[r],s=o.compare(t,e);if(0!==s)return s;n=n||o.field.Y()}return 0},zo.prototype.matches=function(t){return this.ie(t)&&this.ne(t)&&this.re(t)&&this.he(t)},zo.prototype.oe=function(){return!ri(this.limit)&&"F"===this.xt},zo.prototype.ae=function(){return!ri(this.limit)&&"L"===this.xt},zo.prototype.Gt=function(){return 0<this.Mt.length?this.Mt[0].field:null},zo.prototype.jt=function(){for(var t=0,e=this.filters;t<e.length;t++){var n=e[t];if(n instanceof _o&&n.ue())return n.field}return null},zo.prototype.ce=function(t){for(var e=0,n=this.filters;e<n.length;e++){var r=n[e];if(r instanceof _o&&0<=t.indexOf(r.op))return r.op}return null},zo.prototype.qt=function(){return this.ee().qt()},zo.prototype.le=function(){return null!==this.collectionGroup},zo.prototype.ee=function(){if(!this.Ut)if("F"===this.xt)this.Ut=new Ao(this.path,this.collectionGroup,this.orderBy,this.filters,this.limit,this.startAt,this.endAt);else{for(var t=[],e=0,n=this.orderBy;e<n.length;e++){var r=n[e],i="desc"===r.dir?"asc":"desc";t.push(new Lo(r.field,i))}var o=this.endAt?new ko(this.endAt.position,!this.endAt.before):null,s=this.startAt?new ko(this.startAt.position,!this.startAt.before):null;this.Ut=new Ao(this.path,this.collectionGroup,t,this.filters,this.limit,o,s)}return this.Ut},zo.prototype.ie=function(t){var e=t.key.path;return null!==this.collectionGroup?t.key.tt(this.collectionGroup)&&this.path.B(e):Xr.et(this.path)?this.path.isEqual(e):this.path.U(e)},zo.prototype.ne=function(t){for(var e=0,n=this.Mt;e<n.length;e++){var r=n[e];if(!r.field.Y()&&null===t.field(r.field))return!1}return!0},zo.prototype.re=function(t){for(var e=0,n=this.filters;e<n.length;e++)if(!n[e].matches(t))return!1;return!0},zo.prototype.he=function(t){return!(this.startAt&&!this.startAt._e(this.orderBy,t)||this.endAt&&this.endAt._e(this.orderBy,t))},zo.prototype.Qt=function(t){},zo),_o=(n(Bo,go=function(){}),Bo.create=function(t,e,n){if(t.Y())return"in"===e?new So(t,n):new Ro(t,e,n);if(bi(n)){if("=="!==e)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. Null supports only equality comparisons.");return new Bo(t,e,n)}if(Ei(n)){if("=="!==e)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. NaN supports only equality comparisons.");return new Bo(t,e,n)}return"array-contains"===e?new Do(t,n):"in"===e?new Oo(t,n):"array-contains-any"===e?new Po(t,n):new Bo(t,e,n)},Bo.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&ai(this.value)===ai(e)&&this.fe(fi(e,this.value))},Bo.prototype.fe=function(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case">":return 0<t;case">=":return 0<=t;default:return Ks()}},Bo.prototype.ue=function(){return 0<=["<","<=",">",">="].indexOf(this.op)},Bo.prototype.canonicalId=function(){return this.field.j()+this.op.toString()+pi(this.value)},Bo.prototype.isEqual=function(t){return t instanceof Bo&&this.op===t.op&&this.field.isEqual(t.field)&&hi(this.value,t.value)},Bo.prototype.toString=function(){return this.field.j()+" "+this.op+" "+pi(this.value)},Bo),Ro=(n(Go,vo=_o),Go.prototype.matches=function(t){var e=Xr.N(t.key,this.key);return this.fe(e)},Go),So=(n(Fo,yo=_o),Fo.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},Fo),Do=(n(jo,po=_o),jo.prototype.matches=function(t){var e=t.field(this.field);return wi(e)&&ci(e.arrayValue,this.value)},jo),Oo=(n(xo,lo=_o),xo.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&ci(this.value.arrayValue,e)},xo),Po=(n(qo,fo=_o),qo.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!wi(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(t){return ci(e.value.arrayValue,t)})},qo),ko=(Uo.prototype.canonicalId=function(){return(this.before?"b":"a")+":"+this.position.map(function(t){return pi(t)}).join(",")},Uo.prototype._e=function(t,e){for(var n=0,r=0;r<this.position.length;r++){var i=t[r],o=this.position[r];if(n=i.field.Y()?Xr.N(Xr.Z(o.referenceValue),e.key):fi(o,e.field(i.field)),"desc"===i.dir&&(n*=-1),0!==n)break}return this.before?n<=0:n<0},Uo.prototype.isEqual=function(t){if(null===t)return!1;if(this.before!==t.before||this.position.length!==t.position.length)return!1;for(var e=0;e<this.position.length;e++)if(!hi(this.position[e],t.position[e]))return!1;return!0},Uo),Lo=(Mo.prototype.compare=function(t,e){var n,r,i,o,s=this.de?Xr.N(t.key,e.key):(n=this.field,r=e,i=t.field(n),o=r.field(n),null!==i&&null!==o?fi(i,o):Ks());switch(this.dir){case"asc":return s;case"desc":return-1*s;default:return Ks()}},Mo.prototype.canonicalId=function(){return this.field.j()+this.dir.toString()},Mo.prototype.toString=function(){return this.field.j()+" ("+this.dir+")"},Mo.prototype.isEqual=function(t){return this.dir===t.dir&&this.field.isEqual(t.field)},Mo),Vo=(Co.prototype.Ee=function(t){return new Co(this.target,this.targetId,this.we,t,this.Te,this.lastLimboFreeSnapshotVersion,this.resumeToken)},Co.prototype.me=function(t,e){return new Co(this.target,this.targetId,this.we,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},Co.prototype.Ie=function(t){return new Co(this.target,this.targetId,this.we,this.sequenceNumber,this.Te,t,this.resumeToken)},Co);function Co(t,e,n,r,i,o,s){void 0===i&&(i=Vr.min()),void 0===o&&(o=Vr.min()),void 0===s&&(s=ei.ht),this.target=t,this.targetId=e,this.we=n,this.sequenceNumber=r,this.Te=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function Mo(t,e){this.field=t,void 0===e&&(e="asc"),this.dir=e,this.de=t.Y()}function Uo(t,e){this.position=t,this.before=e}function qo(t,e){return fo.call(this,t,"array-contains-any",e)||this}function xo(t,e){return lo.call(this,t,"in",e)||this}function jo(t,e){return po.call(this,t,"array-contains",e)||this}function Fo(t,e){var n=this;return(n=yo.call(this,t,"in",e)||this).keys=(e.arrayValue.values||[]).map(function(t){return Xr.Z(t.referenceValue)}),n}function Go(t,e,n){var r=this;return(r=vo.call(this,t,e,n)||this).key=Xr.Z(n.referenceValue),r}function Bo(t,e,n){var r=this;return(r=go.call(this)||this).field=t,r.op=e,r.value=n,r}function zo(t,e,n,r,i,o,s,u){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o="F"),void 0===s&&(s=null),void 0===u&&(u=null),this.path=t,this.collectionGroup=e,this.Mt=n,this.filters=r,this.limit=i,this.xt=o,this.startAt=s,this.endAt=u,this.Bt=null,this.Ut=null,this.startAt&&this.Qt(this.startAt),this.endAt&&this.Qt(this.endAt)}function Ho(t,e,n,r,i,o,s){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.Ot=null}function Wo(){return null!==mo&&mo.apply(this,arguments)||this}function Qo(t,e,n){var r=this;return(r=wo.call(this,t,e)||this).hasCommittedMutations=!(!n||!n.hasCommittedMutations),r}function Yo(t,e,n,r){var i=this;return(i=bo.call(this,t,e)||this).kt=n,i.At=!!r.At,i.hasCommittedMutations=!!r.hasCommittedMutations,i}function Zo(t){switch(t){case Rr.OK:return Ks();case Rr.CANCELLED:case Rr.UNKNOWN:case Rr.DEADLINE_EXCEEDED:case Rr.RESOURCE_EXHAUSTED:case Rr.INTERNAL:case Rr.UNAVAILABLE:case Rr.UNAUTHENTICATED:return;case Rr.INVALID_ARGUMENT:case Rr.NOT_FOUND:case Rr.ALREADY_EXISTS:case Rr.PERMISSION_DENIED:case Rr.FAILED_PRECONDITION:case Rr.ABORTED:case Rr.OUT_OF_RANGE:case Rr.UNIMPLEMENTED:case Rr.DATA_LOSS:return 1;default:return Ks()}}function Xo(t){if(void 0===t)return Zs("GRPC error has no .code"),Rr.UNKNOWN;switch(t){case ho.OK:return Rr.OK;case ho.CANCELLED:return Rr.CANCELLED;case ho.UNKNOWN:return Rr.UNKNOWN;case ho.DEADLINE_EXCEEDED:return Rr.DEADLINE_EXCEEDED;case ho.RESOURCE_EXHAUSTED:return Rr.RESOURCE_EXHAUSTED;case ho.INTERNAL:return Rr.INTERNAL;case ho.UNAVAILABLE:return Rr.UNAVAILABLE;case ho.UNAUTHENTICATED:return Rr.UNAUTHENTICATED;case ho.INVALID_ARGUMENT:return Rr.INVALID_ARGUMENT;case ho.NOT_FOUND:return Rr.NOT_FOUND;case ho.ALREADY_EXISTS:return Rr.ALREADY_EXISTS;case ho.PERMISSION_DENIED:return Rr.PERMISSION_DENIED;case ho.FAILED_PRECONDITION:return Rr.FAILED_PRECONDITION;case ho.ABORTED:return Rr.ABORTED;case ho.OUT_OF_RANGE:return Rr.OUT_OF_RANGE;case ho.UNIMPLEMENTED:return Rr.UNIMPLEMENTED;case ho.DATA_LOSS:return Rr.DATA_LOSS;default:return Ks()}}(co=ho=ho||{})[co.OK=0]="OK",co[co.CANCELLED=1]="CANCELLED",co[co.UNKNOWN=2]="UNKNOWN",co[co.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",co[co.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",co[co.NOT_FOUND=5]="NOT_FOUND",co[co.ALREADY_EXISTS=6]="ALREADY_EXISTS",co[co.PERMISSION_DENIED=7]="PERMISSION_DENIED",co[co.UNAUTHENTICATED=16]="UNAUTHENTICATED",co[co.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",co[co.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",co[co.ABORTED=10]="ABORTED",co[co.OUT_OF_RANGE=11]="OUT_OF_RANGE",co[co.UNIMPLEMENTED=12]="UNIMPLEMENTED",co[co.INTERNAL=13]="INTERNAL",co[co.UNAVAILABLE=14]="UNAVAILABLE",co[co.DATA_LOSS=15]="DATA_LOSS";var Ko=(ns.prototype.Re=function(t,e){return new ns(this.N,this.root.Re(t,e,this.N).Ae(null,null,$o.Pe,null,null))},ns.prototype.remove=function(t){return new ns(this.N,this.root.remove(t,this.N).Ae(null,null,$o.Pe,null,null))},ns.prototype.get=function(t){for(var e=this.root;!e.M();){var n=this.N(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},ns.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.M();){var r=this.N(t,n.key);if(0===r)return e+n.left.size;n=r<0?n.left:(e+=n.left.size+1,n.right)}return-1},ns.prototype.M=function(){return this.root.M()},Object.defineProperty(ns.prototype,"size",{get:function(){return this.root.size},enumerable:!0,configurable:!0}),ns.prototype.Ve=function(){return this.root.Ve()},ns.prototype.pe=function(){return this.root.pe()},ns.prototype.ye=function(t){return this.root.ye(t)},ns.prototype.forEach=function(n){this.ye(function(t,e){return n(t,e),!1})},ns.prototype.toString=function(){var n=[];return this.ye(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},ns.prototype.ge=function(t){return this.root.ge(t)},ns.prototype.be=function(){return new Jo(this.root,null,this.N,!1)},ns.prototype.ve=function(t){return new Jo(this.root,t,this.N,!1)},ns.prototype.Se=function(){return new Jo(this.root,null,this.N,!0)},ns.prototype.Ce=function(t){return new Jo(this.root,t,this.N,!0)},ns),Jo=(es.prototype.Ne=function(){var t=this.Fe.pop(),e={key:t.key,value:t.value};if(this.De)for(t=t.left;!t.M();)this.Fe.push(t),t=t.right;else for(t=t.right;!t.M();)this.Fe.push(t),t=t.left;return e},es.prototype.$e=function(){return 0<this.Fe.length},es.prototype.ke=function(){if(0===this.Fe.length)return null;var t=this.Fe[this.Fe.length-1];return{key:t.key,value:t.value}},es),$o=(ts.prototype.Ae=function(t,e,n,r,i){return new ts(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)},ts.prototype.M=function(){return!1},ts.prototype.ye=function(t){return this.left.ye(t)||t(this.key,this.value)||this.right.ye(t)},ts.prototype.ge=function(t){return this.right.ge(t)||t(this.key,this.value)||this.left.ge(t)},ts.prototype.min=function(){return this.left.M()?this:this.left.min()},ts.prototype.Ve=function(){return this.min().key},ts.prototype.pe=function(){return this.right.M()?this.key:this.right.pe()},ts.prototype.Re=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.Ae(null,null,null,r.left.Re(t,e,n),null):0===i?r.Ae(null,e,null,null,null):r.Ae(null,null,null,null,r.right.Re(t,e,n))).Le()},ts.prototype.Oe=function(){if(this.left.M())return ts.EMPTY;var t=this;return t.left.qe()||t.left.left.qe()||(t=t.Me()),(t=t.Ae(null,null,null,t.left.Oe(),null)).Le()},ts.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r.left.M()||r.left.qe()||r.left.left.qe()||(r=r.Me()),r=r.Ae(null,null,null,r.left.remove(t,e),null);else{if(r.left.qe()&&(r=r.xe()),r.right.M()||r.right.qe()||r.right.left.qe()||(r=r.Be()),0===e(t,r.key)){if(r.right.M())return ts.EMPTY;n=r.right.min(),r=r.Ae(n.key,n.value,null,null,r.right.Oe())}r=r.Ae(null,null,null,null,r.right.remove(t,e))}return r.Le()},ts.prototype.qe=function(){return this.color},ts.prototype.Le=function(){var t=this;return t.right.qe()&&!t.left.qe()&&(t=t.Ue()),t.left.qe()&&t.left.left.qe()&&(t=t.xe()),t.left.qe()&&t.right.qe()&&(t=t.Qe()),t},ts.prototype.Me=function(){var t=this.Qe();return t.right.left.qe()&&(t=(t=(t=t.Ae(null,null,null,null,t.right.xe())).Ue()).Qe()),t},ts.prototype.Be=function(){var t=this.Qe();return t.left.left.qe()&&(t=(t=t.xe()).Qe()),t},ts.prototype.Ue=function(){var t=this.Ae(null,null,ts.RED,null,this.right.left);return this.right.Ae(null,null,this.color,t,null)},ts.prototype.xe=function(){var t=this.Ae(null,null,ts.RED,this.left.right,null);return this.left.Ae(null,null,this.color,null,t)},ts.prototype.Qe=function(){var t=this.left.Ae(null,null,!this.left.color,null,null),e=this.right.Ae(null,null,!this.right.color,null,null);return this.Ae(null,null,!this.color,t,e)},ts.prototype.We=function(){var t=this.je();return Math.pow(2,t)<=this.size+1},ts.prototype.je=function(){if(this.qe()&&this.left.qe())throw Ks();if(this.right.qe())throw Ks();var t=this.left.je();if(t!==this.right.je())throw Ks();return t+(this.qe()?0:1)},ts);function ts(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:ts.RED,this.left=null!=r?r:ts.EMPTY,this.right=null!=i?i:ts.EMPTY,this.size=this.left.size+1+this.right.size}function es(t,e,n,r){this.De=r,this.Fe=[];for(var i=1;!t.M();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.De?t.left:t.right;else{if(0===i){this.Fe.push(t);break}this.Fe.push(t),t=this.De?t.right:t.left}}function ns(t,e){this.N=t,this.root=e||$o.EMPTY}function rs(){this.size=0}$o.EMPTY=null,$o.RED=!0,$o.Pe=!1,$o.EMPTY=(Object.defineProperty(rs.prototype,"key",{get:function(){throw Ks()},enumerable:!0,configurable:!0}),Object.defineProperty(rs.prototype,"value",{get:function(){throw Ks()},enumerable:!0,configurable:!0}),Object.defineProperty(rs.prototype,"color",{get:function(){throw Ks()},enumerable:!0,configurable:!0}),Object.defineProperty(rs.prototype,"left",{get:function(){throw Ks()},enumerable:!0,configurable:!0}),Object.defineProperty(rs.prototype,"right",{get:function(){throw Ks()},enumerable:!0,configurable:!0}),rs.prototype.Ae=function(t,e,n,r,i){return this},rs.prototype.Re=function(t,e,n){return new $o(t,e)},rs.prototype.remove=function(t,e){return this},rs.prototype.M=function(){return!0},rs.prototype.ye=function(t){return!1},rs.prototype.ge=function(t){return!1},rs.prototype.Ve=function(){return null},rs.prototype.pe=function(){return null},rs.prototype.qe=function(){return!1},rs.prototype.We=function(){return!0},rs.prototype.je=function(){return 0},new rs);var is=(as.prototype.has=function(t){return null!==this.data.get(t)},as.prototype.first=function(){return this.data.Ve()},as.prototype.last=function(){return this.data.pe()},Object.defineProperty(as.prototype,"size",{get:function(){return this.data.size},enumerable:!0,configurable:!0}),as.prototype.indexOf=function(t){return this.data.indexOf(t)},as.prototype.forEach=function(n){this.data.ye(function(t,e){return n(t),!1})},as.prototype.Ge=function(t,e){for(var n=this.data.ve(t[0]);n.$e();){var r=n.Ne();if(0<=this.N(r.key,t[1]))return;e(r.key)}},as.prototype.He=function(t,e){var n;for(n=void 0!==e?this.data.ve(e):this.data.be();n.$e();)if(!t(n.Ne().key))return},as.prototype.Ke=function(t){var e=this.data.ve(t);return e.$e()?e.Ne().key:null},as.prototype.be=function(){return new os(this.data.be())},as.prototype.ve=function(t){return new os(this.data.ve(t))},as.prototype.add=function(t){return this.Ae(this.data.remove(t).Re(t,!0))},as.prototype.delete=function(t){return this.has(t)?this.Ae(this.data.remove(t)):this},as.prototype.M=function(){return this.data.M()},as.prototype.ze=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},as.prototype.isEqual=function(t){if(!(t instanceof as))return!1;if(this.size!==t.size)return!1;for(var e=this.data.be(),n=t.data.be();e.$e();){var r=e.Ne().key,i=n.Ne().key;if(0!==this.N(r,i))return!1}return!0},as.prototype.W=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},as.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},as.prototype.Ae=function(t){var e=new as(this.N);return e.data=t,e},as),os=(us.prototype.Ne=function(){return this.Ye.Ne().key},us.prototype.$e=function(){return this.Ye.$e()},us),ss=new Ko(Xr.N);function us(t){this.Ye=t}function as(t){this.N=t,this.data=new Ko(this.N)}function hs(){return ss}function cs(){return hs()}var fs=new Ko(Xr.N);function ls(){return fs}var ps=new Ko(Xr.N);function ds(){return ps}var ys=new is(Xr.N);function vs(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=ys,r=0,i=t;r<i.length;r++){var o=i[r];n=n.add(o)}return n}var gs=new is(nu);function ms(){return gs}function ws(t,e,n,r){this.ms=t,this.removedTargetIds=e,this.key=n,this.Is=r}function bs(t,e){this.targetId=t,this.Rs=e}function Es(t,e,n,r){void 0===n&&(n=ei.ht),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}var Is=(Cs.Ze=function(t){return new Cs(t.N)},Cs.prototype.has=function(t){return null!=this.Xe.get(t)},Cs.prototype.get=function(t){return this.Xe.get(t)},Cs.prototype.first=function(){return this.Je.Ve()},Cs.prototype.last=function(){return this.Je.pe()},Cs.prototype.M=function(){return this.Je.M()},Cs.prototype.indexOf=function(t){var e=this.Xe.get(t);return e?this.Je.indexOf(e):-1},Object.defineProperty(Cs.prototype,"size",{get:function(){return this.Je.size},enumerable:!0,configurable:!0}),Cs.prototype.forEach=function(n){this.Je.ye(function(t,e){return n(t),!1})},Cs.prototype.add=function(t){var e=this.delete(t.key);return e.Ae(e.Xe.Re(t.key,t),e.Je.Re(t,null))},Cs.prototype.delete=function(t){var e=this.get(t);return e?this.Ae(this.Xe.remove(t),this.Je.remove(e)):this},Cs.prototype.isEqual=function(t){if(!(t instanceof Cs))return!1;if(this.size!==t.size)return!1;for(var e=this.Je.be(),n=t.Je.be();e.$e();){var r=e.Ne().key,i=n.Ne().key;if(!r.isEqual(i))return!1}return!0},Cs.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"},Cs.prototype.Ae=function(t,e){var n=new Cs;return n.N=this.N,n.Xe=t,n.Je=e,n},Cs),Ts=(Vs.prototype.track=function(t){var e=t.doc.key,n=this.ts.get(e);!n||0!==t.type&&3===n.type?this.ts=this.ts.Re(e,t):3===t.type&&1!==n.type?this.ts=this.ts.Re(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.ts=this.ts.Re(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.ts=this.ts.Re(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.ts=this.ts.remove(e):1===t.type&&2===n.type?this.ts=this.ts.Re(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.ts=this.ts.Re(e,{type:2,doc:t.doc}):Ks()},Vs.prototype.es=function(){var n=[];return this.ts.ye(function(t,e){n.push(e)}),n},Vs),As=(Ls.os=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new Ls(t,e,Is.Ze(e),i,n,r,!0,!1)},Object.defineProperty(Ls.prototype,"hasPendingWrites",{get:function(){return!this.ns.M()},enumerable:!0,configurable:!0}),Ls.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.rs===t.rs&&this.ns.isEqual(t.ns)&&this.query.isEqual(t.query)&&this.docs.isEqual(t.docs)&&this.ss.isEqual(t.ss)))return!1;var e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(var r=0;r<e.length;r++)if(e[r].type!==n[r].type||!e[r].doc.isEqual(n[r].doc))return!1;return!0},Ls),Ns=(ks._s=function(t,e){var n=new Map;return n.set(t,_s.fs(t,e)),new ks(Vr.min(),n,ms(),hs(),vs())},ks),_s=(Ps.fs=function(t,e){return new Ps(ei.ht,e,vs(),vs(),vs())},Ps),Rs=(Object.defineProperty(Os.prototype,"ds",{get:function(){return this.ps},enumerable:!0,configurable:!0}),Object.defineProperty(Os.prototype,"resumeToken",{get:function(){return this.Vs},enumerable:!0,configurable:!0}),Object.defineProperty(Os.prototype,"gs",{get:function(){return 0!==this.As},enumerable:!0,configurable:!0}),Object.defineProperty(Os.prototype,"bs",{get:function(){return this.ys},enumerable:!0,configurable:!0}),Os.prototype.vs=function(t){0<t.rt()&&(this.ys=!0,this.Vs=t)},Os.prototype.Ss=function(){var n=vs(),r=vs(),i=vs();return this.Ps.forEach(function(t,e){switch(e){case 0:n=n.add(t);break;case 2:r=r.add(t);break;case 1:i=i.add(t);break;default:Ks()}}),new _s(this.Vs,this.ps,n,r,i)},Os.prototype.Cs=function(){this.ys=!1,this.Ps=Us()},Os.prototype.Ds=function(t,e){this.ys=!0,this.Ps=this.Ps.Re(t,e)},Os.prototype.Fs=function(t){this.ys=!0,this.Ps=this.Ps.remove(t)},Os.prototype.Ns=function(){this.As+=1},Os.prototype.$s=function(){--this.As},Os.prototype.ks=function(){this.ys=!0,this.ps=!0},Os),Ss=(Ds.prototype.Bs=function(t){for(var e=0,n=t.ms;e<n.length;e++){var r=n[e];t.Is instanceof Eo?this.Us(r,t.Is):t.Is instanceof Io&&this.Qs(r,t.key,t.Is)}for(var i=0,o=t.removedTargetIds;i<o.length;i++){var s=o[i];this.Qs(s,t.key,t.Is)}},Ds.prototype.Ws=function(n){var r=this;this.js(n,function(t){var e=r.Gs(t);switch(n.state){case 0:r.Hs(t)&&e.vs(n.resumeToken);break;case 1:e.$s(),e.gs||e.Cs(),e.vs(n.resumeToken);break;case 2:e.$s(),e.gs||r.removeTarget(t);break;case 3:r.Hs(t)&&(e.ks(),e.vs(n.resumeToken));break;case 4:r.Hs(t)&&(r.Ks(t),e.vs(n.resumeToken));break;default:Ks()}})},Ds.prototype.js=function(t,n){var r=this;0<t.targetIds.length?t.targetIds.forEach(n):this.Os.forEach(function(t,e){r.Hs(e)&&n(e)})},Ds.prototype.zs=function(t){var e=t.targetId,n=t.Rs.count,r=this.Ys(e);if(r){var i=r.target;if(i.qt())if(0===n){var o=new Xr(i.path);this.Qs(e,o,new Io(o,Vr.min()))}else Js(1===n);else this.Xs(e)!==n&&(this.Ks(e),this.xs=this.xs.add(e))}},Ds.prototype.Js=function(i){var o=this,s=new Map;this.Os.forEach(function(t,e){var n=o.Ys(e);if(n){if(t.ds&&n.target.qt()){var r=new Xr(n.target.path);null!==o.qs.get(r)||o.Zs(e,r)||o.Qs(e,r,new Io(r,i))}t.bs&&(s.set(e,t.Ss()),t.Cs())}});var r=vs();this.Ms.forEach(function(t,e){var n=!0;e.He(function(t){var e=o.Ys(t);return!e||2===e.we||(n=!1)}),n&&(r=r.add(t))});var t=new Ns(i,s,this.xs,this.qs,r);return this.qs=hs(),this.Ms=Ms(),this.xs=new is(nu),t},Ds.prototype.Us=function(t,e){if(this.Hs(t)){var n=this.Zs(t,e.key)?2:0;this.Gs(t).Ds(e.key,n),this.qs=this.qs.Re(e.key,e),this.Ms=this.Ms.Re(e.key,this.ti(e.key).add(t))}},Ds.prototype.Qs=function(t,e,n){if(this.Hs(t)){var r=this.Gs(t);this.Zs(t,e)?r.Ds(e,1):r.Fs(e),this.Ms=this.Ms.Re(e,this.ti(e).delete(t)),n&&(this.qs=this.qs.Re(e,n))}},Ds.prototype.removeTarget=function(t){this.Os.delete(t)},Ds.prototype.Xs=function(t){var e=this.Gs(t).Ss();return this.Ls.ei(t).size+e.ws.size-e.Es.size},Ds.prototype.Ns=function(t){this.Gs(t).Ns()},Ds.prototype.Gs=function(t){var e=this.Os.get(t);return e||(e=new Rs,this.Os.set(t,e)),e},Ds.prototype.ti=function(t){var e=this.Ms.get(t);return e||(e=new is(nu),this.Ms=this.Ms.Re(t,e)),e},Ds.prototype.Hs=function(t){var e=null!==this.Ys(t);return e||Ys("WatchChangeAggregator","Detected inactive target",t),e},Ds.prototype.Ys=function(t){var e=this.Os.get(t);return e&&e.gs?null:this.Ls.si(t)},Ds.prototype.Ks=function(e){var n=this;this.Os.set(e,new Rs),this.Ls.ei(e).forEach(function(t){n.Qs(e,t,null)})},Ds.prototype.Zs=function(t,e){return this.Ls.ei(t).has(e)},Ds);function Ds(t){this.Ls=t,this.Os=new Map,this.qs=hs(),this.Ms=Ms(),this.xs=new is(nu)}function Os(){this.As=0,this.Ps=Us(),this.Vs=ei.ht,this.ps=!1,this.ys=!0}function Ps(t,e,n,r,i){this.resumeToken=t,this.ds=e,this.ws=n,this.Ts=r,this.Es=i}function ks(t,e,n,r,i){this.Te=t,this.as=e,this.us=n,this.cs=r,this.ls=i}function Ls(t,e,n,r,i,o,s,u){this.query=t,this.docs=e,this.ss=n,this.docChanges=r,this.ns=i,this.fromCache=o,this.rs=s,this.hs=u}function Vs(){this.ts=new Ko(Xr.N)}function Cs(n){this.N=n?function(t,e){return n(t,e)||Xr.N(t.key,e.key)}:function(t,e){return Xr.N(t.key,e.key)},this.Xe=ls(),this.Je=new Ko(this.N)}function Ms(){return new Ko(Xr.N)}function Us(){return new Ko(Xr.N)}var qs={asc:"ASCENDING",desc:"DESCENDING"},xs={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","array-contains-any":"ARRAY_CONTAINS_ANY"},js=(Fs.prototype.ni=function(t){var e=void 0===t.code?Rr.UNKNOWN:Xo(t.code);return new Sr(e,t.message||"")},Fs.prototype.ri=function(t){return this.options.hi||ri(t)?t:{value:t}},Fs.prototype.oi=function(t){var e;return ri(e="object"==typeof t?t.value:t)?null:e},Fs.prototype.lt=function(t){return{integerValue:""+t}},Fs.prototype._t=function(t){if(this.options.hi){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:ii(t)?"-0":t}},Fs.prototype.ai=function(t){return"number"==typeof(e=t)&&Number.isInteger(e)&&!ii(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER?this.lt(t):this._t(t);var e},Fs.prototype.D=function(t){return this.options.hi?new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+t.nanoseconds).slice(-9)+"Z":{seconds:""+t.seconds,nanos:t.nanoseconds}},Fs.prototype.v=function(t){var e=di(t);return new Lr(e.seconds,e.nanos)},Fs.prototype.ui=function(t){return this.options.hi?t.toBase64():t.toUint8Array()},Fs.prototype.ci=function(t){return this.options.hi?(Js(void 0===t||"string"==typeof t),ei.fromBase64String(t||"")):(Js(void 0===t||t instanceof Uint8Array),ei.fromUint8Array(t||new Uint8Array))},Fs.prototype.toVersion=function(t){return this.D(t.D())},Fs.prototype.fromVersion=function(t){return Js(!!t),Vr.v(this.v(t))},Fs.prototype.li=function(t,e){return this._i(e||this.ii).child("documents").child(t).j()},Fs.prototype.fi=function(t){var e=Mr.G(t);return Js(Gs(e)),e},Fs.prototype.di=function(t){return this.li(t.path)},Fs.prototype.Z=function(t){var e=this.fi(t);return Js(e.get(1)===this.ii.projectId),Js(!e.get(3)&&!this.ii.database||e.get(3)===this.ii.database),new Xr(this.wi(e))},Fs.prototype.Ti=function(t){return this.li(t)},Fs.prototype.Ei=function(t){var e=this.fi(t);return 4===e.length?Mr.H:this.wi(e)},Object.defineProperty(Fs.prototype,"mi",{get:function(){return new Mr(["projects",this.ii.projectId,"databases",this.ii.database]).j()},enumerable:!0,configurable:!0}),Fs.prototype._i=function(t){return new Mr(["projects",t.projectId,"databases",t.database])},Fs.prototype.wi=function(t){return Js(4<t.length&&"documents"===t.get(4)),t.k(5)},Fs.prototype.Ii=function(t,e){return{name:this.di(t),fields:e.proto.mapValue.fields}},Fs.prototype.Ri=function(t){return{name:this.di(t.key),fields:t.Lt().mapValue.fields,updateTime:this.D(t.version.D())}},Fs.prototype.Ai=function(t,e){var n=this.Z(t.name),r=this.fromVersion(t.updateTime),i=new Qi({mapValue:{fields:t.fields}});return new Eo(n,r,i,{hasCommittedMutations:!!e})},Fs.prototype.Pi=function(t){Js(!!t.found),t.found.name,t.found.updateTime;var e=this.Z(t.found.name),n=this.fromVersion(t.found.updateTime),r=new Qi({mapValue:{fields:t.found.fields}});return new Eo(e,n,r,{})},Fs.prototype.Vi=function(t){Js(!!t.missing),Js(!!t.readTime);var e=this.Z(t.missing),n=this.fromVersion(t.readTime);return new Io(e,n)},Fs.prototype.pi=function(t){return"found"in t?this.Pi(t):"missing"in t?this.Vi(t):Ks()},Fs.prototype.yi=function(t){var e;if("targetChange"in t){t.targetChange;var n=this.gi(t.targetChange.targetChangeType||"NO_CHANGE"),r=t.targetChange.targetIds||[],i=this.ci(t.targetChange.resumeToken),o=t.targetChange.cause,s=o&&this.ni(o);e=new Es(n,r,i,s||null)}else if("documentChange"in t){t.documentChange;var u=t.documentChange;u.document,u.document.name,u.document.updateTime;var a=this.Z(u.document.name),h=this.fromVersion(u.document.updateTime),c=new Qi({mapValue:{fields:u.document.fields}}),f=new Eo(a,h,c,{}),l=u.targetIds||[],p=u.removedTargetIds||[];e=new ws(l,p,f.key,f)}else if("documentDelete"in t){t.documentDelete;var d=t.documentDelete;d.document;var y=this.Z(d.document),v=d.readTime?this.fromVersion(d.readTime):Vr.min(),g=new Io(y,v),m=d.removedTargetIds||[];e=new ws([],m,g.key,g)}else if("documentRemove"in t){t.documentRemove;var w=t.documentRemove;w.document;var b=this.Z(w.document),E=w.removedTargetIds||[];e=new ws([],E,b,null)}else{if(!("filter"in t))return Ks();t.filter;var I=t.filter;I.targetId;var T=I.count||0,A=new ao(T),N=I.targetId;e=new bs(N,A)}return e},Fs.prototype.gi=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Ks()},Fs.prototype.bi=function(t){if(!("targetChange"in t))return Vr.min();var e=t.targetChange;return e.targetIds&&e.targetIds.length||!e.readTime?Vr.min():this.fromVersion(e.readTime)},Fs.prototype.vi=function(t){var e,n=this;if(t instanceof Gi)e={update:this.Ii(t.key,t.value)};else if(t instanceof Hi)e={delete:this.di(t.key)};else if(t instanceof Bi)e={update:this.Ii(t.key,t.data),updateMask:this.Si(t.Vt)};else if(t instanceof zi)e={transform:{document:this.di(t.key),fieldTransforms:t.fieldTransforms.map(function(t){return n.Ci(t)})}};else{if(!(t instanceof Wi))return Ks();e={verify:this.di(t.key)}}return t.Rt.wt||(e.currentDocument=this.Di(t.Rt)),e},Fs.prototype.Fi=function(t){var e=this,n=t.currentDocument?this.Ni(t.currentDocument):ji.dt();if(t.update){t.update.name;var r=this.Z(t.update.name),i=new Qi({mapValue:{fields:t.update.fields}});if(t.updateMask){var o=this.$i(t.updateMask);return new Bi(r,i,o,n)}return new Gi(r,i,n)}if(t.delete){var s=this.Z(t.delete);return new Hi(s,n)}if(t.transform){var u=this.Z(t.transform.document),a=t.transform.fieldTransforms.map(function(t){return e.ki(t)});return Js(!0===n.exists),new zi(u,a)}if(t.verify){var h=this.Z(t.verify);return new Wi(h,n)}return Ks()},Fs.prototype.Di=function(t){return void 0!==t.updateTime?{updateTime:this.toVersion(t.updateTime)}:void 0!==t.exists?{exists:t.exists}:Ks()},Fs.prototype.Ni=function(t){return void 0!==t.updateTime?ji.updateTime(this.fromVersion(t.updateTime)):void 0!==t.exists?ji.exists(t.exists):ji.dt()},Fs.prototype.Li=function(t,e){var n=t.updateTime?this.fromVersion(t.updateTime):this.fromVersion(e);n.isEqual(Vr.min())&&(n=this.fromVersion(e));var r=null;return t.transformResults&&0<t.transformResults.length&&(r=t.transformResults),new ki(n,r)},Fs.prototype.Oi=function(t,e){var n=this;return t&&0<t.length?(Js(void 0!==e),t.map(function(t){return n.Li(t,e)})):[]},Fs.prototype.Ci=function(t){var e=t.transform;if(e instanceof Ti)return{fieldPath:t.field.j(),setToServerValue:"REQUEST_TIME"};if(e instanceof Ni)return{fieldPath:t.field.j(),appendMissingElements:{values:e.elements}};if(e instanceof _i)return{fieldPath:t.field.j(),removeAllFromArray:{values:e.elements}};if(e instanceof Ri)return{fieldPath:t.field.j(),increment:e.ct};throw Ks()},Fs.prototype.ki=function(t){var e=null;if("setToServerValue"in t)Js("REQUEST_TIME"===t.setToServerValue),e=Ti.instance;else if("appendMissingElements"in t){var n=t.appendMissingElements.values||[];e=new Ni(n)}else if("removeAllFromArray"in t){var r=t.removeAllFromArray.values||[];e=new _i(r)}else"increment"in t?e=new Ri(this,t.increment):Ks();var i=Yr.J(t.fieldPath);return new xi(i,e)},Fs.prototype.qi=function(t){return{documents:[this.Ti(t.path)]}},Fs.prototype.Mi=function(t){Js(1===t.documents.length);var e=t.documents[0];return No.Wt(this.Ei(e)).ee()},Fs.prototype.xi=function(t){var e={structuredQuery:{}},n=t.path;null!==t.collectionGroup?(e.parent=this.Ti(n),e.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(e.parent=this.Ti(n.L()),e.structuredQuery.from=[{collectionId:n.q()}]);var r=this.Bi(t.filters);r&&(e.structuredQuery.where=r);var i=this.Ui(t.orderBy);i&&(e.structuredQuery.orderBy=i);var o=this.ri(t.limit);return null!==o&&(e.structuredQuery.limit=o),t.startAt&&(e.structuredQuery.startAt=this.Qi(t.startAt)),t.endAt&&(e.structuredQuery.endAt=this.Qi(t.endAt)),e},Fs.prototype.Wi=function(t){var e=this.Ei(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;if(0<r){Js(1===r);var o=n.from[0];o.allDescendants?i=o.collectionId:e=e.child(o.collectionId)}var s=[];n.where&&(s=this.ji(n.where));var u=[];n.orderBy&&(u=this.Gi(n.orderBy));var a=null;n.limit&&(a=this.oi(n.limit));var h=null;n.startAt&&(h=this.Hi(n.startAt));var c=null;return n.endAt&&(c=this.Hi(n.endAt)),new No(e,i,u,s,a,"F",h,c).ee()},Fs.prototype.Ki=function(t){var e=this.zi(t.we);return null==e?null:{"goog-listen-tags":e}},Fs.prototype.zi=function(t){switch(t){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Ks()}},Fs.prototype.ee=function(t){var e,n=t.target;return(e=n.qt()?{documents:this.qi(n)}:{query:this.xi(n)}).targetId=t.targetId,0<t.resumeToken.rt()&&(e.resumeToken=this.ui(t.resumeToken)),e},Fs.prototype.Bi=function(t){var e=this;if(0!==t.length){var n=t.map(function(t){return t instanceof _o?e.Yi(t):Ks()});return 1===n.length?n[0]:{compositeFilter:{op:"AND",filters:n}}}},Fs.prototype.ji=function(t){var e=this;return t?void 0!==t.unaryFilter?[this.Xi(t)]:void 0!==t.fieldFilter?[this.Ji(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e.ji(t)}).reduce(function(t,e){return t.concat(e)}):Ks():[]},Fs.prototype.Ui=function(t){var e=this;if(0!==t.length)return t.map(function(t){return e.Zi(t)})},Fs.prototype.Gi=function(t){var e=this;return t.map(function(t){return e.tn(t)})},Fs.prototype.Qi=function(t){return{before:t.before,values:t.position}},Fs.prototype.Hi=function(t){var e=!!t.before,n=t.values||[];return new ko(n,e)},Fs.prototype.en=function(t){return qs[t]},Fs.prototype.sn=function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}},Fs.prototype.nn=function(t){return xs[t]},Fs.prototype.rn=function(t){switch(t){case"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"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return Ks()}},Fs.prototype.hn=function(t){return{fieldPath:t.j()}},Fs.prototype.on=function(t){return Yr.J(t.fieldPath)},Fs.prototype.Zi=function(t){return{field:this.hn(t.field),direction:this.en(t.dir)}},Fs.prototype.tn=function(t){return new Lo(this.on(t.field),this.sn(t.direction))},Fs.prototype.Ji=function(t){return _o.create(this.on(t.fieldFilter.field),this.rn(t.fieldFilter.op),t.fieldFilter.value)},Fs.prototype.Yi=function(t){if("=="===t.op){if(Ei(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NAN"}};if(bi(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NULL"}}}return{fieldFilter:{field:this.hn(t.field),op:this.nn(t.op),value:t.value}}},Fs.prototype.Xi=function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=this.on(t.unaryFilter.field);return _o.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=this.on(t.unaryFilter.field);return _o.create(n,"==",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return Ks()}},Fs.prototype.Si=function(t){var e=[];return t.fields.forEach(function(t){return e.push(t.j())}),{fieldPaths:e}},Fs.prototype.$i=function(t){var e=t.fieldPaths||[];return new qi(e.map(function(t){return Yr.J(t)}))},Fs);function Fs(t,e){this.ii=t,this.options=e}function Gs(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}var Bs=(Hs.an=function(t){Hs.platform&&Ks(),Hs.platform=t},Hs.nt=function(){return Hs.platform||Ks(),Hs.platform},Hs),zs=new c("@firebase/firestore");function Hs(){}function Ws(){return zs.logLevel}function Qs(t){zs.logLevel=t}function Ys(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(zs.logLevel<=u.DEBUG){var r=e.map(Xs);zs.debug.apply(zs,i(["Firestore ("+Er+"): "+t],r))}}function Zs(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(zs.logLevel<=u.ERROR){var r=e.map(Xs);zs.error.apply(zs,i(["Firestore ("+Er+"): "+t],r))}}function Xs(t){if("string"==typeof t)return t;var e=Bs.nt();try{return e.un(t)}catch(e){return t}}function Ks(t){void 0===t&&(t="Unexpected state");var e="FIRESTORE ("+Er+") INTERNAL ASSERTION FAILED: "+t;throw Zs(e),new Error(e)}function Js(t){t||Ks()}function $s(t){return t}var tu=(eu.cn=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length,n="";n.length<20;)for(var r=Bs.nt().ln(40),i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length));return n},eu);function eu(){}function nu(t,e){return t<e?-1:e<t?1:0}function ru(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}function iu(t,e,n,r,i){this.ii=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i}var ou=(Object.defineProperty(bu.prototype,"_n",{get:function(){return"(default)"===this.database},enumerable:!0,configurable:!0}),bu.prototype.isEqual=function(t){return t instanceof bu&&t.projectId===this.projectId&&t.database===this.database},bu.prototype.S=function(t){return nu(this.projectId,t.projectId)||nu(this.database,t.database)},bu),su=(wu.prototype.get=function(t){var e=this.fn(t),n=this.dn[e];if(void 0!==n)for(var r=0,i=n;r<i.length;r++){var o=i[r],s=o[0],u=o[1];if(s.isEqual(t))return u}},wu.prototype.has=function(t){return void 0!==this.get(t)},wu.prototype.set=function(t,e){var n=this.fn(t),r=this.dn[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(r[i][0].isEqual(t))return void(r[i]=[t,e]);r.push([t,e])}else this.dn[n]=[[t,e]]},wu.prototype.delete=function(t){var e=this.fn(t),n=this.dn[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(n[r][0].isEqual(t))return 1===n.length?delete this.dn[e]:n.splice(r,1),!0;return!1},wu.prototype.forEach=function(u){$r(this.dn,function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],s=i[1];u(o,s)}})},wu.prototype.M=function(){return ti(this.dn)},wu),uu=(mu.prototype.at=function(t,e,n){for(var r=n.Tn,i=0;i<this.mutations.length;i++){var o=this.mutations[i];if(o.key.isEqual(t)){var s=r[i];e=o.at(e,s)}}return e},mu.prototype.ot=function(t,e){for(var n=0,r=this.baseMutations;n<r.length;n++){var i=r[n];i.key.isEqual(t)&&(e=i.ot(e,e,this.wn))}for(var o=e,s=0,u=this.mutations;s<u.length;s++){var a=u[s];a.key.isEqual(t)&&(e=a.ot(e,o,this.wn))}return e},mu.prototype.En=function(n){var r=this,i=n;return this.mutations.forEach(function(t){var e=r.ot(t.key,n.get(t.key));e&&(i=i.Re(t.key,e))}),i},mu.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},vs())},mu.prototype.isEqual=function(t){return this.batchId===t.batchId&&ru(this.mutations,t.mutations,function(t,e){return t.isEqual(e)})&&ru(this.baseMutations,t.baseMutations,function(t,e){return t.isEqual(e)})},mu),au=(gu.from=function(t,e,n,r){Js(t.mutations.length===n.length);for(var i=ds(),o=t.mutations,s=0;s<o.length;s++)i=i.Re(o[s].key,n[s].version);return new gu(t,e,n,r,i)},gu),hu=(vu.prototype.catch=function(t){return this.next(void 0,t)},vu.prototype.next=function(r,i){var o=this;return this.Vn&&Ks(),this.Vn=!0,this.Pn?this.error?this.pn(i,this.error):this.yn(r,this.result):new vu(function(e,n){o.Rn=function(t){o.yn(r,t).next(e,n)},o.An=function(t){o.pn(i,t).next(e,n)}})},vu.prototype.gn=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},vu.prototype.bn=function(t){try{var e=t();return e instanceof vu?e:vu.resolve(e)}catch(t){return vu.reject(t)}},vu.prototype.yn=function(t,e){return t?this.bn(function(){return t(e)}):vu.resolve(e)},vu.prototype.pn=function(t,e){return t?this.bn(function(){return t(e)}):vu.reject(e)},vu.resolve=function(n){return new vu(function(t,e){t(n)})},vu.reject=function(n){return new vu(function(t,e){e(n)})},vu.vn=function(t){return new vu(function(e,n){var r=0,i=0,o=!1;t.forEach(function(t){++r,t.next(function(){++i,o&&i===r&&e()},function(t){return n(t)})}),o=!0,i===r&&e()})},vu.Sn=function(t){for(var n=vu.resolve(!1),e=function(e){n=n.next(function(t){return t?vu.resolve(t):e()})},r=0,i=t;r<i.length;r++)e(i[r]);return n},vu.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.vn(i)},vu),cu=(yu.prototype.Nn=function(e,n){var r=this;return this.Dn.$n(e,n).next(function(t){return r.kn(e,n,t)})},yu.prototype.kn=function(t,r,i){return this.Cn.Ln(t,r).next(function(t){for(var e=0,n=i;e<n.length;e++)t=n[e].ot(r,t);return t})},yu.prototype.On=function(t,e,i){var o=cs();return e.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)e=r[n].ot(t,e);o=o.Re(t,e)}),o},yu.prototype.qn=function(e,t){var n=this;return this.Cn.getEntries(e,t).next(function(t){return n.Mn(e,t)})},yu.prototype.Mn=function(r,i){var o=this;return this.Dn.xn(r,i).next(function(t){var e=o.On(r,i,t),n=hs();return e.forEach(function(t,e){e=e||new Io(t,Vr.min()),n=n.Re(t,e)}),n})},yu.prototype.Bn=function(t,e,n){return e.qt()?this.Un(t,e.path):e.le()?this.Qn(t,e,n):this.Wn(t,e,n)},yu.prototype.Un=function(t,e){return this.Nn(t,new Xr(e)).next(function(t){var e=ls();return t instanceof Eo&&(e=e.Re(t.key,t)),e})},yu.prototype.Qn=function(n,r,i){var o=this,s=r.collectionGroup,u=ls();return this.Fn.jn(n,s).next(function(t){return hu.forEach(t,function(t){var e=r.Zt(t.child(s));return o.Wn(n,e,i).next(function(t){t.forEach(function(t,e){u=u.Re(t,e)})})}).next(function(){return u})})},yu.prototype.Wn=function(e,n,t){var c,f,r=this;return this.Cn.Bn(e,n,t).next(function(t){return c=t,r.Dn.Gn(e,n)}).next(function(t){return f=t,r.Hn(e,f,c).next(function(t){c=t;for(var e=0,n=f;e<n.length;e++)for(var r=n[e],i=0,o=r.mutations;i<o.length;i++){var s=o[i],u=s.key,a=c.get(u),h=s.ot(a,a,r.wn);c=h instanceof Eo?c.Re(u,h):c.remove(u)}})}).next(function(){return c.forEach(function(t,e){n.matches(e)||(c=c.remove(t))}),c})},yu.prototype.Hn=function(t,e,n){for(var r=vs(),i=0,o=e;i<o.length;i++)for(var s=0,u=o[i].mutations;s<u.length;s++){var a=u[s];a instanceof Bi&&null===n.get(a.key)&&(r=r.add(a.key))}var h=n;return this.Cn.getEntries(t,r).next(function(t){return t.forEach(function(t,e){null!==e&&e instanceof Eo&&(h=h.Re(t,e))}),h})},yu),fu=(du.Yn=function(t,e){for(var n=vs(),r=vs(),i=0,o=e.docChanges;i<o.length;i++){var s=o[i];switch(s.type){case 0:n=n.add(s.doc.key);break;case 1:r=r.add(s.doc.key)}}return new du(t,e.fromCache,n,r)},du),lu=(pu.prototype.Jn=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},pu.prototype.next=function(){var t=++this.previousValue;return this.Zn&&this.Zn(t),t},pu);function pu(t,e){var n=this;this.previousValue=t,e&&(e.Xn=function(t){return n.Jn(t)},this.Zn=function(t){return e.tr(t)})}function du(t,e,n,r){this.targetId=t,this.fromCache=e,this.Kn=n,this.zn=r}function yu(t,e,n){this.Cn=t,this.Dn=e,this.Fn=n}function vu(t){var e=this;this.Rn=null,this.An=null,this.result=void 0,this.error=void 0,this.Pn=!1,this.Vn=!1,t(function(t){e.Pn=!0,e.result=t,e.Rn&&e.Rn(t)},function(t){e.Pn=!0,e.error=t,e.An&&e.An(t)})}function gu(t,e,n,r,i){this.batch=t,this.mn=e,this.Tn=n,this.streamToken=r,this.In=i}function mu(t,e,n,r){this.batchId=t,this.wn=e,this.baseMutations=n,this.mutations=r}function wu(t){this.fn=t,this.dn={}}function bu(t,e){this.projectId=t,this.database=e||"(default)"}lu.er=-1;function Eu(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}var Iu=(Du.prototype.reset=function(){this.or=0},Du.prototype.cr=function(){this.or=this.hr},Du.prototype.lr=function(t){var e=this;this.cancel();var n=Math.floor(this.or+this._r()),r=Math.max(0,Date.now()-this.ur),i=Math.max(0,n-r);0<i&&Ys("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.or+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.ar=this.sr.dr(this.ir,i,function(){return e.ur=Date.now(),t()}),this.or*=this.rr,this.or<this.nr&&(this.or=this.nr),this.or>this.hr&&(this.or=this.hr)},Du.prototype.wr=function(){null!==this.ar&&(this.ar.Tr(),this.ar=null)},Du.prototype.cancel=function(){null!==this.ar&&(this.ar.cancel(),this.ar=null)},Du.prototype._r=function(){return(Math.random()-.5)*this.or},Du),Tu=(Su.prototype.mr=function(t,e){return this.Er.add(e),hu.resolve()},Su.prototype.jn=function(t,e){return hu.resolve(this.Er.getEntries(e))},Su),Au=(Ru.prototype.add=function(t){var e=t.q(),n=t.L(),r=this.index[e]||new is(Mr.N),i=!r.has(n);return this.index[e]=r.add(n),i},Ru.prototype.has=function(t){var e=t.q(),n=t.L(),r=this.index[e];return r&&r.has(n)},Ru.prototype.getEntries=function(t){return(this.index[t]||new is(Mr.N)).W()},Ru),Nu=(_u.prototype.next=function(){return this.Ir+=2,this.Ir},_u.Rr=function(){return new _u(0)},_u.Ar=function(){return new _u(-1)},_u);function _u(t){this.Ir=t}function Ru(){this.index={}}function Su(){this.Er=new Au}function Du(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.sr=t,this.ir=e,this.nr=n,this.rr=r,this.hr=i,this.or=0,this.ar=null,this.ur=Date.now(),this.reset()}function Ou(t){return"IndexedDbTransactionError"===t.name}var Pu=(Vu.gr=function(t,e,n,r,i){var o=new Vu(t,e,Date.now()+n,r,i);return o.start(n),o},Vu.prototype.start=function(t){var e=this;this.br=setTimeout(function(){return e.vr()},t)},Vu.prototype.Tr=function(){return this.vr()},Vu.prototype.cancel=function(t){null!==this.br&&(this.clearTimeout(),this.yr.reject(new Sr(Rr.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},Vu.prototype.vr=function(){var e=this;this.Pr.Sr(function(){return null!==e.br?(e.clearTimeout(),e.op().then(function(t){return e.yr.resolve(t)})):Promise.resolve()})},Vu.prototype.clearTimeout=function(){null!==this.br&&(this.pr(this),clearTimeout(this.br),this.br=null)},Vu),ku=(Object.defineProperty(Lu.prototype,"Mr",{get:function(){return this.Fr},enumerable:!0,configurable:!0}),Lu.prototype.Sr=function(t){this.enqueue(t)},Lu.prototype.xr=function(t){this.Br(),this.Ur(t)},Lu.prototype.Qr=function(t){return this.Br(),this.Ur(t)},Lu.prototype.Wr=function(n){return d(this,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:return this.Br(),this.Fr?[3,2]:(this.Fr=!0,(e=Bs.nt().window)&&e.removeEventListener("visibilitychange",this.qr),[4,this.Qr(n)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},Lu.prototype.enqueue=function(t){return this.Br(),this.Fr?new Promise(function(t){}):this.Ur(t)},Lu.prototype.jr=function(i){var t=this;this.Br(),this.Fr||(this.Dr=this.Dr.then(function(){var n=new Eu,r=function(){return d(t,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,i()];case 1:return t.sent(),n.resolve(),this.Or.reset(),[3,3];case 2:if(!Ou(e=t.sent()))throw n.resolve(),e;return Ys("AsyncQueue","Operation failed with retryable error: "+e),this.Or.lr(r),[3,3];case 3:return[2]}})})};return t.Sr(r),n.promise}))},Lu.prototype.Ur=function(t){var e=this,n=this.Cr.then(function(){return e.kr=!0,t().catch(function(t){throw e.$r=t,e.kr=!1,Zs("INTERNAL UNHANDLED ERROR: ",t.stack||t.message||""),t}).then(function(t){return e.kr=!1,t})});return this.Cr=n},Lu.prototype.dr=function(t,e,n){var r=this;this.Br(),-1<this.Lr.indexOf(t)&&(e=0);var i=Pu.gr(this,t,e,n,function(t){return r.Gr(t)});return this.Nr.push(i),i},Lu.prototype.Br=function(){this.$r&&Ks()},Lu.prototype.Hr=function(){},Lu.prototype.Kr=function(){return d(this,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,e=this.Cr];case 1:t.sent(),t.label=2;case 2:if(e!==this.Cr)return[3,0];t.label=3;case 3:return[2]}})})},Lu.prototype.zr=function(t){for(var e=0,n=this.Nr;e<n.length;e++)if(n[e].ir===t)return!0;return!1},Lu.prototype.Yr=function(r){var i=this;return this.Kr().then(function(){i.Nr.sort(function(t,e){return t.Vr-e.Vr});for(var t=0,e=i.Nr;t<e.length;t++){var n=e[t];if(n.Tr(),"all"!==r&&n.ir===r)break}return i.Kr()})},Lu.prototype.Xr=function(t){this.Lr.push(t)},Lu.prototype.Gr=function(t){var e=this.Nr.indexOf(t);this.Nr.splice(e,1)},Lu);function Lu(){var t=this;this.Cr=Promise.resolve(),this.Dr=Promise.resolve(),this.Fr=!1,this.Nr=[],this.$r=null,this.kr=!1,this.Lr=[],this.Or=new Iu(this,"async_queue_retry"),this.qr=function(){return t.Or.wr()};var e=Bs.nt().window;e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.qr)}function Vu(t,e,n,r,i){this.Pr=t,this.ir=e,this.Vr=n,this.op=r,this.pr=i,this.yr=new Eu,this.then=this.yr.promise.then.bind(this.yr.promise),this.yr.promise.catch(function(t){})}function Cu(t,e){if(Zs("AsyncQueue",e+": "+t),Ou(t))return new Sr(Rr.UNAVAILABLE,e+": "+t);throw t}var Mu=(Uu.eh=function(t){return new Uu(t,Uu.sh,Uu.ih)},Uu);function Uu(t,e,n){this.Jr=t,this.Zr=e,this.th=n}Mu.nh=-1,Mu.rh=1048576,Mu.hh=41943040,Mu.sh=10,Mu.ih=1e3,Mu.oh=new Mu(Mu.hh,Mu.sh,Mu.ih),Mu.DISABLED=new Mu(Mu.nh,0,0);var qu=(xu.prototype.start=function(){return Promise.resolve()},xu.prototype.Ah=function(i){return d(this,void 0,void 0,function(){var e,m,n,r=this;return y(this,function(t){switch(t.label){case 0:return e=this.Dn,m=this.mh,[4,this.persistence.runTransaction("Handle user change","readonly",function(v){var g;return r.Dn.Ph(v).next(function(t){return g=t,e=r.persistence.fh(i),m=new cu(r.dh,e,r.persistence.Ih()),e.Ph(v)}).next(function(t){for(var e=[],n=[],r=vs(),i=0,o=g;i<o.length;i++){var s=o[i];e.push(s.batchId);for(var u=0,a=s.mutations;u<a.length;u++){var h=a[u];r=r.add(h.key)}}for(var c=0,f=t;c<f.length;c++){var l=f[c];n.push(l.batchId);for(var p=0,d=l.mutations;p<d.length;p++){var y=d[p];r=r.add(y.key)}}return m.qn(v,r).next(function(t){return{Vh:t,ph:e,yh:n}})})})];case 1:return n=t.sent(),[2,(this.Dn=e,this.mh=m,this.ah.Rh(this.mh),n)]}})})},xu.prototype.gh=function(u){var a,h=this,c=Lr.now(),t=u.reduce(function(t,e){return t.add(e.key)},vs());return this.persistence.runTransaction("Locally write mutations","readwrite",function(s){return h.mh.qn(s,t).next(function(t){a=t;for(var e=[],n=0,r=u;n<r.length;n++){var i=r[n],o=i.Pt(a.get(i.key));null!=o&&e.push(new Bi(i.key,o,so(o.proto.mapValue),ji.exists(!0)))}return h.Dn.bh(s,c,e,u)})}).then(function(t){var e=t.En(a);return{batchId:t.batchId,vh:e}})},xu.prototype.Sh=function(r){var i=this;return this.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e=r.batch.keys(),n=i.dh.Ch({Dh:!0});return i.Dn.Sh(t,r.batch,r.streamToken).next(function(){return i.Fh(t,r,n)}).next(function(){return n.apply(t)}).next(function(){return i.Dn.Nh(t)}).next(function(){return i.mh.qn(t,e)})})},xu.prototype.$h=function(t){var r=this;return this.persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return r.Dn.kh(e,t).next(function(t){return Js(null!==t),n=t.keys(),r.Dn.Lh(e,t)}).next(function(){return r.Dn.Nh(e)}).next(function(){return r.mh.qn(e,n)})})},xu.prototype.Oh=function(){var e=this;return this.persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e.Dn.Oh(t)})},xu.prototype.qh=function(){var e=this;return this.persistence.runTransaction("Get last stream token","readonly",function(t){return e.Dn.qh(t)})},xu.prototype.Mh=function(e){var n=this;return this.persistence.runTransaction("Set last stream token","readwrite-primary",function(t){return n.Dn.Mh(t,e)})},xu.prototype.xh=function(){var e=this;return this.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.Th.xh(t)})},xu.prototype.Bh=function(a){var h=this,c=a.Te,f=this.uh;return this.persistence.runTransaction("Apply remote event","readwrite-primary",function(o){var i=h.dh.Ch({Dh:!0});f=h.uh;var s=[];a.as.forEach(function(t,e){var n=f.get(e);if(n){s.push(h.Th.Uh(o,t.Es,e).next(function(){return h.Th.Qh(o,t.ws,e)}));var r=t.resumeToken;if(0<r.rt()){var i=n.me(r,c).Ee(o.Wh);f=f.Re(e,i),xu.jh(n,i,t)&&s.push(h.Th.Gh(o,i))}}});var u=hs(),n=vs();if(a.cs.forEach(function(t,e){n=n.add(t)}),s.push(i.getEntries(o,n).next(function(r){a.cs.forEach(function(t,e){var n=r.get(t);e instanceof Io&&e.version.isEqual(Vr.min())?(i.Hh(t,c),u=u.Re(t,e)):null==n||0<e.version.S(n.version)||0===e.version.S(n.version)&&n.hasPendingWrites?(i.Kh(e,c),u=u.Re(t,e)):Ys("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version),a.ls.has(t)&&s.push(h.persistence.Yh.zh(o,t))})})),!c.isEqual(Vr.min())){var t=h.Th.xh(o).next(function(t){return h.Th.Xh(o,o.Wh,c)});s.push(t)}return hu.vn(s).next(function(){return i.apply(o)}).next(function(){return h.mh.Mn(o,u)})}).then(function(t){return h.uh=f,t})},xu.jh=function(t,e,n){return Js(0<e.resumeToken.rt()),0===t.resumeToken.rt()||e.Te.C()-t.Te.C()>=this.Jh||0<n.ws.size+n.Ts.size+n.Es.size},xu.prototype.Zh=function(c){return d(this,void 0,void 0,function(){var e,n,r,i,o,s,u,a,h=this;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(n){return hu.forEach(c,function(e){return hu.forEach(e.Kn,function(t){return h.persistence.Yh.to(n,e.targetId,t)}).next(function(){return hu.forEach(e.zn,function(t){return h.persistence.Yh.eo(n,e.targetId,t)})})})})];case 1:return t.sent(),[3,3];case 2:if(!Ou(e=t.sent()))throw e;return Ys("LocalStore","Failed to update sequence numbers: "+e),[3,3];case 3:for(n=0,r=c;n<r.length;n++)i=r[n],o=i.targetId,i.fromCache||(s=this.uh.get(o),u=s.Te,a=s.Ie(u),this.uh=this.uh.Re(o,a));return[2]}})})},xu.prototype.so=function(e){var n=this;return this.persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===e&&(e=-1),n.Dn.io(t,e)})},xu.prototype.no=function(e){var n=this;return this.persistence.runTransaction("read document","readonly",function(t){return n.mh.Nn(t,e)})},xu.prototype.ro=function(r){var i=this;return this.persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.Th.ho(e,r).next(function(t){return t?(n=t,hu.resolve(n)):i.Th.oo(e).next(function(t){return n=new Vo(r,t,0,e.Wh),i.Th.ao(e,n).next(function(){return n})})})}).then(function(t){return null===i.uh.get(t.targetId)&&(i.uh=i.uh.Re(t.targetId,t),i.lh.set(r,t.targetId)),t})},xu.prototype.ho=function(t,e){var n=this.lh.get(e);return void 0!==n?hu.resolve(this.uh.get(n)):this.Th.ho(t,e)},xu.prototype.uo=function(t,e){var n=this,r=this.uh.get(t),i=e?"readwrite":"readwrite-primary";return this.persistence.runTransaction("Release target",i,function(t){return e?hu.resolve():n.persistence.Yh.removeTarget(t,r)}).then(function(){n.uh=n.uh.remove(t),n.lh.delete(r.target)})},xu.prototype.co=function(t,n){var r=this,i=Vr.min(),o=vs();return this.persistence.runTransaction("Execute query","readonly",function(e){return r.ho(e,t.ee()).next(function(t){if(t)return i=t.lastLimboFreeSnapshotVersion,r.Th.lo(e,t.targetId).next(function(t){o=t})}).next(function(){return r.ah.Bn(e,t,n?i:Vr.min(),n?o:vs())}).next(function(t){return{documents:t,_o:o}})})},xu.prototype.Fh=function(t,i,o){var e=this,s=i.batch,n=s.keys(),u=hu.resolve();return n.forEach(function(r){u=u.next(function(){return o.Ln(t,r)}).next(function(t){var e=t,n=i.In.get(r);Js(null!==n),(!e||e.version.S(n)<0)&&(e=s.at(r,e,i))&&o.Kh(e,i.mn)})}),u.next(function(){return e.Dn.Lh(t,s)})},xu.prototype.fo=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.do(t,n.uh)})},xu);function xu(t,e,n){this.persistence=t,this.ah=e,this.uh=new Ko(nu),this.lh=new su(function(t){return t.canonicalId()}),this._h=Vr.min(),this.Dn=t.fh(n),this.dh=t.wh(),this.Th=t.Eh(),this.mh=new cu(this.dh,this.Dn,this.persistence.Ih()),this.ah.Rh(this.mh)}function ju(e){return d(this,void 0,void 0,function(){return y(this,function(t){if(e.code!==Rr.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;return Ys("LocalStore","Unexpectedly lost primary lease"),[2]})})}qu.Jh=3e8;var Fu=(zu.prototype.M=function(){return this.wo.M()},zu.prototype.to=function(t,e){var n=new Gu(t,e);this.wo=this.wo.add(n),this.Eo=this.Eo.add(n)},zu.prototype.Io=function(t,e){var n=this;t.forEach(function(t){return n.to(t,e)})},zu.prototype.eo=function(t,e){this.Ro(new Gu(t,e))},zu.prototype.Ao=function(t,e){var n=this;t.forEach(function(t){return n.eo(t,e)})},zu.prototype.Po=function(t){var e=this,n=Xr.EMPTY,r=new Gu(n,t),i=new Gu(n,t+1),o=[];return this.Eo.Ge([r,i],function(t){e.Ro(t),o.push(t.key)}),o},zu.prototype.Vo=function(){var e=this;this.wo.forEach(function(t){return e.Ro(t)})},zu.prototype.Ro=function(t){this.wo=this.wo.delete(t),this.Eo=this.Eo.delete(t)},zu.prototype.po=function(t){var e=Xr.EMPTY,n=new Gu(e,t),r=new Gu(e,t+1),i=vs();return this.Eo.Ge([n,r],function(t){i=i.add(t.key)}),i},zu.prototype.yo=function(t){var e=new Gu(t,0),n=this.wo.Ke(e);return null!==n&&t.isEqual(n.key)},zu),Gu=(Bu.To=function(t,e){return Xr.N(t.key,e.key)||nu(t.bo,e.bo)},Bu.mo=function(t,e){return nu(t.bo,e.bo)||Xr.N(t.key,e.key)},Bu);function Bu(t,e){this.key=t,this.bo=e}function zu(){this.wo=new is(Gu.To),this.Eo=new is(Gu.mo)}function Hu(t,e){if(0!==e.length)throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() does not support arguments, but was called with "+aa(e.length,"argument")+".")}function Wu(t,e,n){if(e.length!==n)throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires "+aa(n,"argument")+", but was called with "+aa(e.length,"argument")+".")}function Qu(t,e,n){if(e.length<n)throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires at least "+aa(n,"argument")+", but was called with "+aa(e.length,"argument")+".")}function Yu(t,e,n,r){if(e.length<n||e.length>r)throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+aa(e.length,"argument")+".")}function Zu(t,e,n,r){ta(t,e,ua(n)+" argument",r)}function Xu(t,e,n,r){void 0!==r&&Zu(t,e,n,r)}function Ku(t,e,n,r){ta(t,e,n+" option",r)}function Ju(t,e,n,r){void 0!==r&&Ku(t,e,n,r)}function $u(t,e,n,r,a){void 0!==r&&function(t,e,n){for(var r=[],i=0,o=a;i<o.length;i++){var s=o[i];if(s===n)return;r.push(na(s))}var u=na(n);throw new Sr(Rr.INVALID_ARGUMENT,"Invalid value "+u+" provided to function "+t+'() for option "'+e+'". Acceptable values: '+r.join(", "))}(t,n,r)}function ta(t,e,n,r){if(!("object"===e?ea(r):"non-empty string"===e?"string"==typeof r&&""!==r:typeof r===e)){var i=na(r);throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" to be of type "+e+", but it was: "+i)}}function ea(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function na(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return 20<e.length&&(e=e.substring(0,20)+"..."),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"!=typeof e)return"function"==typeof e?"a function":Ks();if(e instanceof Array)return"an array";var t=function(){if(e.constructor){var t=/function\s+([^\s(]+)\s*\(/.exec(e.constructor.toString());if(t&&1<t.length)return t[1]}return null}();return t?"a custom "+t+" object":"an object"}function ra(t,e,n){if(void 0===n)throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+ua(e)+" argument, but it was undefined.")}function ia(n,t,r){$r(t,function(t,e){if(r.indexOf(t)<0)throw new Sr(Rr.INVALID_ARGUMENT,"Unknown option '"+t+"' passed to function "+n+"(). Available options: "+r.join(", "))})}function oa(t,e,n,r){var i=na(r);return new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires its "+ua(n)+" argument to be a "+e+", but it was: "+i)}function sa(t,e,n){if(n<=0)throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires its "+ua(e)+" argument to be a positive number, but it was: "+n+".")}function ua(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function aa(t,e){return t+" "+e+(1===t?"":"s")}function ha(){if("undefined"==typeof Uint8Array)throw new Sr(Rr.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function ca(){if(!Bs.nt().vo)throw new Sr(Rr.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var fa=(da.fromBase64String=function(t){Wu("Blob.fromBase64String",arguments,1),Zu("Blob.fromBase64String","string",1,t),ca();try{return new da(ei.fromBase64String(t))}catch(t){throw new Sr(Rr.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},da.fromUint8Array=function(t){if(Wu("Blob.fromUint8Array",arguments,1),ha(),!(t instanceof Uint8Array))throw oa("Blob.fromUint8Array","Uint8Array",1,t);return new da(ei.fromUint8Array(t))},da.prototype.toBase64=function(){return Wu("Blob.toBase64",arguments,0),ca(),this.So.toBase64()},da.prototype.toUint8Array=function(){return Wu("Blob.toUint8Array",arguments,0),ha(),this.So.toUint8Array()},da.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},da.prototype.isEqual=function(t){return this.So.isEqual(t.So)},da),la=(pa.documentId=function(){return pa.Do},pa.prototype.isEqual=function(t){if(!(t instanceof pa))throw oa("isEqual","FieldPath",1,t);return this.Co.isEqual(t.Co)},pa);function pa(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(){if(!(t instanceof Array)||t.length<1)throw new Sr(Rr.INVALID_ARGUMENT,"Function FieldPath() requires its fieldNames argument to be an array with at least 1 element.")}();for(var n=0;n<t.length;++n)if(Zu("FieldPath","string",n,t[n]),0===t[n].length)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.Co=new Yr(t)}function da(t){ca(),this.So=t}la.Do=new la(Yr.X().j());var ya,va,ga,ma,wa,ba=new RegExp("[~\\*/\\[\\]]"),Ea=function(t){this.Fo=t},Ia=(n(qa,wa=Ea),qa.prototype.Ci=function(t){if(2!==t.No)throw 1===t.No?t.$o("FieldValue.delete() can only appear at the top level of your update data"):t.$o("FieldValue.delete() cannot be used with set() unless you pass {merge:true}");return t.Vt.push(t.path),null},qa.prototype.isEqual=function(t){return t instanceof qa},qa),Ta=(n(Ua,ma=Ea),Ua.prototype.Ci=function(t){return new xi(t.path,Ti.instance)},Ua.prototype.isEqual=function(t){return t instanceof Ua},Ua),Aa=(n(Ma,ga=Ea),Ma.prototype.Ci=function(t){var e=new ja({No:3,methodName:this.Fo,Lo:!0},t.ii,t.serializer,t.ignoreUndefinedProperties),n=this.ko.map(function(t){return za(t,e)}),r=new Ni(n);return new xi(t.path,r)},Ma.prototype.isEqual=function(t){return this===t},Ma),Na=(n(Ca,va=Ea),Ca.prototype.Ci=function(t){var e=new ja({No:3,methodName:this.Fo,Lo:!0},t.ii,t.serializer,t.ignoreUndefinedProperties),n=this.ko.map(function(t){return za(t,e)}),r=new _i(n);return new xi(t.path,r)},Ca.prototype.isEqual=function(t){return this===t},Ca),_a=(n(Va,ya=Ea),Va.prototype.Ci=function(t){var e=new ja({No:3,methodName:this.Fo},t.ii,t.serializer,t.ignoreUndefinedProperties),n=za(this.Oo,e),r=new Ri(t.serializer,n);return new xi(t.path,r)},Va.prototype.isEqual=function(t){return this===t},Va),Ra=(Object.defineProperty(La.prototype,"latitude",{get:function(){return this.qo},enumerable:!0,configurable:!0}),Object.defineProperty(La.prototype,"longitude",{get:function(){return this.Mo},enumerable:!0,configurable:!0}),La.prototype.isEqual=function(t){return this.qo===t.qo&&this.Mo===t.Mo},La.prototype.g=function(t){return nu(this.qo,t.qo)||nu(this.Mo,t.Mo)},La),Sa=/^__.*__$/,Da=(ka.prototype.xo=function(t,e){var n=[];return null!==this.Vt?n.push(new Bi(t,this.data,this.Vt,e)):n.push(new Gi(t,this.data,e)),0<this.fieldTransforms.length&&n.push(new zi(t,this.fieldTransforms)),n},ka),Oa=(Pa.prototype.xo=function(t,e){var n=[new Bi(t,this.data,this.Vt,e)];return 0<this.fieldTransforms.length&&n.push(new zi(t,this.fieldTransforms)),n},Pa);function Pa(t,e,n){this.data=t,this.Vt=e,this.fieldTransforms=n}function ka(t,e,n){this.data=t,this.Vt=e,this.fieldTransforms=n}function La(t,e){if(Wu("GeoPoint",arguments,2),Zu("GeoPoint","number",1,t),Zu("GeoPoint","number",2,e),!isFinite(t)||t<-90||90<t)throw new Sr(Rr.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new Sr(Rr.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.qo=t,this.Mo=e}function Va(t){var e=this;return(e=ya.call(this,"FieldValue.increment")||this).Oo=t,e}function Ca(t){var e=this;return(e=va.call(this,"FieldValue.arrayRemove")||this).ko=t,e}function Ma(t){var e=this;return(e=ga.call(this,"FieldValue.arrayUnion")||this).ko=t,e}function Ua(){return ma.call(this,"FieldValue.serverTimestamp")||this}function qa(){return wa.call(this,"FieldValue.delete")||this}function xa(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw Ks()}}var ja=(Object.defineProperty(Ba.prototype,"path",{get:function(){return this.settings.path},enumerable:!0,configurable:!0}),Object.defineProperty(Ba.prototype,"No",{get:function(){return this.settings.No},enumerable:!0,configurable:!0}),Ba.prototype.Uo=function(t){return new Ba(Object.assign(Object.assign({},this.settings),t),this.ii,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.Vt)},Ba.prototype.Qo=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.Uo({path:n,Lo:!1});return r.Wo(t),r},Ba.prototype.jo=function(t){var e,n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.Uo({path:n,Lo:!1});return r.Bo(),r},Ba.prototype.Go=function(t){return this.Uo({path:void 0,Lo:!0})},Ba.prototype.$o=function(t){var e=!this.path||this.path.M()?"":" (found in field "+this.path.toString()+")";return new Sr(Rr.INVALID_ARGUMENT,"Function "+this.settings.methodName+"() called with invalid data. "+t+e)},Ba.prototype.contains=function(e){return void 0!==this.Vt.find(function(t){return e.B(t)})||void 0!==this.fieldTransforms.find(function(t){return e.B(t.field)})},Ba.prototype.Bo=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.Wo(this.path.get(t))},Ba.prototype.Wo=function(t){if(0===t.length)throw this.$o("Document fields must not be empty");if(xa(this.No)&&Sa.test(t))throw this.$o('Document fields cannot begin and end with "__"')},Ba),Fa=(Ga.prototype.Ko=function(t,e){var n=this.zo(0,t);Qa("Data must be an object, but it was:",n,e);var r=Ha(e,n);return new Da(new Qi(r),null,n.fieldTransforms)},Ga.prototype.Yo=function(t,e,n){var r=this.zo(2,t);Qa("Data must be an object, but it was:",r,e);var i,o,s=Ha(e,r);if(n){for(var u=[],a=0,h=n;a<h.length;a++){var c=h[a],f=void 0;if(c instanceof la)f=c.Co;else{if("string"!=typeof c)throw Ks();f=Za(t,c)}if(!r.contains(f))throw new Sr(Rr.INVALID_ARGUMENT,"Field '"+f+"' is specified in your field mask but missing from your input data.");Xa(u,f)||u.push(f)}i=new qi(u),o=r.fieldTransforms.filter(function(t){return i.ft(t.field)})}else i=new qi(r.Vt),o=r.fieldTransforms;return new Da(new Qi(s),i,o)},Ga.prototype.Xo=function(o,t){var s=this.zo(1,o);Qa("Data must be an object, but it was:",s,t);var u=[],a=new Yi;$r(t,function(t,e){var n=Za(o,t),r=s.jo(n);if(e instanceof Ia)u.push(n);else{var i=za(e,r);null!=i&&(u.push(n),a.set(n,i))}});var e=new qi(u);return new Oa(a.gt(),e,s.fieldTransforms)},Ga.prototype.Jo=function(t,e,n,r){var i=this.zo(1,t),o=[Ya(t,e)],s=[n];if(r.length%2!=0)throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var u=0;u<r.length;u+=2)o.push(Ya(t,r[u])),s.push(r[u+1]);for(var a=[],h=new Yi,c=o.length-1;0<=c;--c)if(!Xa(a,o[c])){var f=o[c],l=s[c],p=i.jo(f);if(l instanceof Ia)a.push(f);else{var d=za(l,p);null!=d&&(a.push(f),h.set(f,d))}}var y=new qi(a);return new Oa(h.gt(),y,i.fieldTransforms)},Ga.prototype.zo=function(t,e){return new ja({No:t,methodName:e,path:Yr.H,Lo:!1},this.ii,this.serializer,this.ignoreUndefinedProperties)},Ga.prototype.Zo=function(t,e,n){return void 0===n&&(n=!1),za(e,this.zo(n?4:3,t))},Ga);function Ga(t,e,n){this.ii=t,this.ignoreUndefinedProperties=e,this.serializer=n||Bs.nt().Ho(t)}function Ba(t,e,n,r,i,o){this.settings=t,this.ii=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.Bo(),this.fieldTransforms=i||[],this.Vt=o||[]}function za(s,t){if(Wa(s))return Qa("Unsupported field value:",t,s),Ha(s,t);if(s instanceof Ea)return function(t,e){if(!xa(e.No))throw e.$o(t.Fo+"() can only be used with update() and set()");if(null===e.path)throw e.$o(t.Fo+"() is not currently supported inside arrays");var n=t.Ci(e);n&&e.fieldTransforms.push(n)}(s,t),null;if(t.path&&t.Vt.push(t.path),s instanceof Array){if(t.settings.Lo&&4!==t.No)throw t.$o("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=s;r<i.length;r++){var o=za(i[r],t.Go(n));null==o&&(o={nullValue:"NULL_VALUE"}),e.push(o),n++}return{arrayValue:{values:e}}}(t)}return function(t,e){if(null===t)return{nullValue:"NULL_VALUE"};if("number"==typeof t)return e.serializer.ai(t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=Lr.fromDate(t);return{timestampValue:e.serializer.D(n)}}if(t instanceof Lr){var r=new Lr(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:e.serializer.D(r)}}if(t instanceof Ra)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof fa)return{bytesValue:e.serializer.ui(t)};if(t instanceof pc){var i=e.ii,o=t.firestore.ta;if(!o.isEqual(i))throw e.$o("Document reference is for database "+o.projectId+"/"+o.database+" but should be for database "+i.projectId+"/"+i.database);return{referenceValue:e.serializer.li(t.ea.path,t.firestore.ta)}}if(void 0===t&&e.ignoreUndefinedProperties)return null;throw e.$o("Unsupported field value: "+na(t))}(s,t)}function Ha(t,r){var i={};return ti(t)?r.path&&0<r.path.length&&r.Vt.push(r.path):$r(t,function(t,e){var n=za(e,r.Qo(t));null!=n&&(i[t]=n)}),{mapValue:{fields:i}}}function Wa(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Lr||t instanceof Ra||t instanceof fa||t instanceof pc||t instanceof Ea)}function Qa(t,e,n){if(!Wa(n)||!ea(n)){var r=na(n);throw"an object"===r?e.$o(t+" a custom object"):e.$o(t+" "+r)}}function Ya(t,e){if(e instanceof la)return e.Co;if("string"==typeof e)return Za(t,e);throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. Field path arguments must be of type string or FieldPath.")}function Za(t,e){try{return function(e){if(0<=e.search(ba))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(la.bind.apply(la,i([void 0],e.split("."))))}catch(t){throw new Sr(Rr.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).Co}catch(e){var n=e instanceof Error?e.message:e.toString();throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. "+n)}}function Xa(t,e){return t.some(function(t){return t.isEqual(e)})}function Ka(t){this.key=t}function Ja(t){this.key=t}function $a(t,e,n){this.query=t,this.targetId=e,this.view=n}function th(t){this.key=t,this.Sc=!1}function eh(){this.hl=void 0,this.ol=[]}var nh,rh,ih,oh,sh=(xh.prototype.oa=function(){return 1===this.state||2===this.state||4===this.state},xh.prototype.aa=function(){return 2===this.state},xh.prototype.start=function(){3!==this.state?this.auth():this.ua()},xh.prototype.stop=function(){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.oa()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},xh.prototype.ca=function(){this.state=0,this.Or.reset()},xh.prototype.la=function(){var t=this;this.aa()&&null===this.ha&&(this.ha=this.sr.dr(this.sa,6e4,function(){return t._a()}))},xh.prototype.fa=function(t){this.da(),this.stream.send(t)},xh.prototype._a=function(){return d(this,void 0,void 0,function(){return y(this,function(t){return this.aa()?[2,this.close(0)]:[2]})})},xh.prototype.da=function(){this.ha&&(this.ha.cancel(),this.ha=null)},xh.prototype.close=function(e,n){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.da(),this.Or.cancel(),this.ra++,3!==e?this.Or.reset():n&&n.code===Rr.RESOURCE_EXHAUSTED?(Zs(n.toString()),Zs("Using maximum backoff delay to prevent overloading the backend."),this.Or.cr()):n&&n.code===Rr.UNAUTHENTICATED&&this.na.l(),null!==this.stream&&(this.wa(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.Ta(n)];case 1:return t.sent(),[2]}})})},xh.prototype.wa=function(){},xh.prototype.auth=function(){var n=this;this.state=1;var t=this.Ea(this.ra),e=this.ra;this.na.getToken().then(function(t){n.ra===e&&n.ma(t)},function(e){t(function(){var t=new Sr(Rr.UNKNOWN,"Fetching auth token failed: "+e.message);return n.Ia(t)})})},xh.prototype.ma=function(t){var e=this,n=this.Ea(this.ra);this.stream=this.Ra(t),this.stream.Aa(function(){n(function(){return e.state=2,e.listener.Aa()})}),this.stream.Ta(function(t){n(function(){return e.Ia(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},xh.prototype.ua=function(){var t=this;this.state=4,this.Or.lr(function(){return d(t,void 0,void 0,function(){return y(this,function(t){return this.state=0,this.start(),[2]})})})},xh.prototype.Ia=function(t){return Ys("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},xh.prototype.Ea=function(e){var n=this;return function(t){n.sr.Sr(function(){return n.ra===e?t():(Ys("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},xh),uh=(n(qh,ih=sh),qh.prototype.Ra=function(t){return this.ia.Pa("Listen",t)},qh.prototype.onMessage=function(t){this.Or.reset();var e=this.serializer.yi(t),n=this.serializer.bi(t);return this.listener.Va(e,n)},qh.prototype.pa=function(t){var e={};e.database=this.serializer.mi,e.addTarget=this.serializer.ee(t);var n=this.serializer.Ki(t);n&&(e.labels=n),this.fa(e)},qh.prototype.ya=function(t){var e={};e.database=this.serializer.mi,e.removeTarget=t,this.fa(e)},qh),ah=(n(Uh,rh=sh),Object.defineProperty(Uh.prototype,"ba",{get:function(){return this.ga},enumerable:!0,configurable:!0}),Uh.prototype.start=function(){this.ga=!1,rh.prototype.start.call(this)},Uh.prototype.wa=function(){this.ga&&this.va([])},Uh.prototype.Ra=function(t){return this.ia.Pa("Write",t)},Uh.prototype.onMessage=function(t){if(Js(!!t.streamToken),this.lastStreamToken=this.serializer.ci(t.streamToken),this.ga){this.Or.reset();var e=this.serializer.Oi(t.writeResults,t.commitTime),n=this.serializer.fromVersion(t.commitTime);return this.listener.Sa(n,e)}return Js(!t.writeResults||0===t.writeResults.length),this.ga=!0,this.listener.Ca()},Uh.prototype.Da=function(){var t={};t.database=this.serializer.mi,this.fa(t)},Uh.prototype.va=function(t){var e=this,n={streamToken:this.serializer.ui(this.lastStreamToken),writes:t.map(function(t){return e.serializer.vi(t)})};this.fa(n)},Uh),hh=(n(Mh,nh=function(){this.Fa=void 0}),Mh.prototype.Na=function(e,n){var r=this;return this.credentials.getToken().then(function(t){return r.ia.Na(e,n,t)}).catch(function(t){throw t.code===Rr.UNAUTHENTICATED&&r.credentials.l(),t})},Mh.prototype.$a=function(e,n){var r=this;return this.credentials.getToken().then(function(t){return r.ia.$a(e,n,t)}).catch(function(t){throw t.code===Rr.UNAUTHENTICATED&&r.credentials.l(),t})},Mh),ch=(Ch.prototype.xa=function(r){return d(this,void 0,void 0,function(){var e,n=this;return y(this,function(t){switch(t.label){case 0:if(this.Ba(),0<this.mutations.length)throw new Sr(Rr.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(s,u){return d(this,void 0,void 0,function(){var n,e,r,i,o;return y(this,function(t){switch(t.label){case 0:return n=$s(s),e={database:n.serializer.mi,documents:u.map(function(t){return n.serializer.di(t)})},[4,n.$a("BatchGetDocuments",e)];case 1:return r=t.sent(),i=new Map,r.forEach(function(t){var e=n.serializer.pi(t);i.set(e.key.toString(),e)}),o=[],[2,(u.forEach(function(t){var e=i.get(t.toString());Js(!!e),o.push(e)}),o)]}})})}(this.ka,r)];case 1:return[2,((e=t.sent()).forEach(function(t){t instanceof Io||t instanceof Eo?n.Ua(t):Ks()}),e)]}})})},Ch.prototype.set=function(t,e){this.write(e.xo(t,this.Rt(t))),this.Ma.add(t)},Ch.prototype.update=function(t,e){try{this.write(e.xo(t,this.Qa(t)))}catch(t){this.qa=t}this.Ma.add(t)},Ch.prototype.delete=function(t){this.write([new Hi(t,this.Rt(t))]),this.Ma.add(t)},Ch.prototype.commit=function(){return d(this,void 0,void 0,function(){var e,n=this;return y(this,function(t){switch(t.label){case 0:if(this.Ba(),this.qa)throw this.qa;return e=this.La,this.mutations.forEach(function(t){e=e.remove(t.key)}),e.forEach(function(t,e){n.mutations.push(new Wi(t,n.Rt(t)))}),[4,function(i,o){return d(this,void 0,void 0,function(){var e,n,r;return y(this,function(t){switch(t.label){case 0:return e=$s(i),n={database:e.serializer.mi,writes:o.map(function(t){return e.serializer.vi(t)})},[4,e.Na("Commit",n)];case 1:return r=t.sent(),[2,e.serializer.Oi(r.writeResults,r.commitTime)]}})})}(this.ka,this.mutations)];case 1:return t.sent(),this.Oa=!0,[2]}})})},Ch.prototype.Ua=function(t){var e;if(t instanceof Eo)e=t.version;else{if(!(t instanceof Io))throw Ks();e=Vr.min()}var n=this.La.get(t.key);if(null!==n){if(!e.isEqual(n))throw new Sr(Rr.ABORTED,"Document version changed between two reads.")}else this.La=this.La.Re(t.key,e)},Ch.prototype.Rt=function(t){var e=this.La.get(t);return!this.Ma.has(t)&&e?ji.updateTime(e):ji.dt()},Ch.prototype.Qa=function(t){var e=this.La.get(t);if(this.Ma.has(t)||!e)return ji.exists(!0);if(e.isEqual(Vr.min()))throw new Sr(Rr.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return ji.updateTime(e)},Ch.prototype.write=function(t){this.Ba(),this.mutations=this.mutations.concat(t)},Ch.prototype.Ba=function(){},Ch),fh=(Vh.prototype.Ka=function(){var t=this;0===this.ja&&(this.za("Unknown"),this.Ga=this.Pr.dr("online_state_timeout",1e4,function(){return t.Ga=null,t.Ya("Backend didn't respond within 10 seconds."),t.za("Offline"),Promise.resolve()}))},Vh.prototype.Xa=function(t){"Online"===this.state?this.za("Unknown"):(this.ja++,1<=this.ja&&(this.Ja(),this.Ya("Connection failed 1 times. Most recent error: "+t.toString()),this.za("Offline")))},Vh.prototype.set=function(t){this.Ja(),this.ja=0,"Online"===t&&(this.Ha=!1),this.za(t)},Vh.prototype.za=function(t){t!==this.state&&(this.state=t,this.Wa(t))},Vh.prototype.Ya=function(t){var 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.Ha?(Zs(e),this.Ha=!1):Ys("OnlineStateTracker",e)},Vh.prototype.Ja=function(){null!==this.Ga&&(this.Ga.cancel(),this.Ga=null)},Vh),lh=(Lh.prototype.start=function(){return this.enableNetwork()},Lh.prototype.enableNetwork=function(){return this.networkEnabled=!0,this.Eu()},Lh.prototype.Eu=function(){return d(this,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:return this.hu()?(e=this.fu,[4,this.Za.qh()]):[3,3];case 1:return e.lastStreamToken=t.sent(),this.mu()?this.Iu():this.au.set("Unknown"),[4,this.Ru()];case 2:t.sent(),t.label=3;case 3:return[2]}})})},Lh.prototype.disableNetwork=function(){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.networkEnabled=!1,[4,this.Au()];case 1:return t.sent(),this.au.set("Offline"),[2]}})})},Lh.prototype.Au=function(){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return[4,this.fu.stop()];case 1:return t.sent(),[4,this.uu.stop()];case 2:return t.sent(),0<this.tu.length&&(Ys("RemoteStore","Stopping write stream with "+this.tu.length+" pending writes"),this.tu=[]),this.Pu(),[2]}})})},Lh.prototype.Vu=function(){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return Ys("RemoteStore","RemoteStore shutting down."),this.networkEnabled=!1,[4,this.Au()];case 1:return t.sent(),this.nu.Vu(),this.au.set("Unknown"),[2]}})})},Lh.prototype.listen=function(t){this.eu.has(t.targetId)||(this.eu.set(t.targetId,t),this.mu()?this.Iu():this.uu.aa()&&this.pu(t))},Lh.prototype.yu=function(t){this.eu.delete(t),this.uu.aa()&&this.gu(t),0===this.eu.size&&(this.uu.aa()?this.uu.la():this.hu()&&this.au.set("Unknown"))},Lh.prototype.si=function(t){return this.eu.get(t)||null},Lh.prototype.ei=function(t){return this.bu.ei(t)},Lh.prototype.pu=function(t){this.su.Ns(t.targetId),this.uu.pa(t)},Lh.prototype.gu=function(t){this.su.Ns(t),this.uu.ya(t)},Lh.prototype.Iu=function(){this.su=new Ss(this),this.uu.start(),this.au.Ka()},Lh.prototype.mu=function(){return this.hu()&&!this.uu.oa()&&0<this.eu.size},Lh.prototype.hu=function(){return!this.iu&&this.isPrimary&&this.networkEnabled},Lh.prototype.Pu=function(){this.su=null},Lh.prototype.cu=function(){return d(this,void 0,void 0,function(){var n=this;return y(this,function(t){return this.eu.forEach(function(t,e){n.pu(t)}),[2]})})},Lh.prototype.lu=function(e){return d(this,void 0,void 0,function(){return y(this,function(t){return this.Pu(),this.mu()?(this.au.Xa(e),this.Iu()):this.au.set("Unknown"),[2]})})},Lh.prototype._u=function(i,o){return d(this,void 0,void 0,function(){var e,n,r;return y(this,function(t){switch(t.label){case 0:if(this.au.set("Online"),!(i instanceof Es&&2===i.state&&i.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,this.vu(i)];case 2:return t.sent(),[3,5];case 3:return e=t.sent(),Ys("RemoteStore","Failed to remove targets %s: %s ",i.targetIds.join(","),e),[4,this.Su(e)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(i instanceof ws?this.su.Bs(i):i instanceof bs?this.su.zs(i):this.su.Ws(i),o.isEqual(Vr.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,this.Za.xh()];case 8:return n=t.sent(),0<=o.S(n)?[4,this.Cu(o)]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return Ys("RemoteStore","Failed to raise snapshot:",r=t.sent()),[4,this.Su(r)];case 12:return t.sent(),[3,13];case 13:return[2]}})})},Lh.prototype.Su=function(n){return d(this,void 0,void 0,function(){var e=this;return y(this,function(t){switch(t.label){case 0:if(!Ou(n))throw n;return this.iu=!0,[4,this.Au()];case 1:return t.sent(),this.au.set("Offline"),this.Pr.jr(function(){return d(e,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return Ys("RemoteStore","Retrying IndexedDB access"),[4,this.Za.xh()];case 1:return t.sent(),this.iu=!1,[4,this.Eu()];case 2:return t.sent(),[2]}})})}),[2]}})})},Lh.prototype.Cu=function(r){var i=this,t=this.su.Js(r);return t.as.forEach(function(t,e){if(0<t.resumeToken.rt()){var n=i.eu.get(e);n&&i.eu.set(e,n.me(t.resumeToken,r))}}),t.us.forEach(function(t){var e=i.eu.get(t);if(e){i.eu.set(t,e.me(ei.ht,e.Te)),i.gu(t);var n=new Vo(e.target,t,1,e.sequenceNumber);i.pu(n)}}),this.bu.Bh(t)},Lh.prototype.vu=function(o){return d(this,void 0,void 0,function(){var e,n,r,i;return y(this,function(t){switch(t.label){case 0:e=o.cause,n=0,r=o.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],this.eu.has(i)?[4,this.bu.Du(i,e)]:[3,3]):[3,5];case 2:t.sent(),this.eu.delete(i),this.su.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})},Lh.prototype.Ru=function(){return d(this,void 0,void 0,function(){var e,n;return y(this,function(t){switch(t.label){case 0:return this.Fu()?(e=0<this.tu.length?this.tu[this.tu.length-1].batchId:-1,[4,this.Za.so(e)]):[3,5];case 1:return null!==(n=t.sent())?[3,2]:(0===this.tu.length&&this.fu.la(),[3,4]);case 2:return this.Nu(n),[4,this.Ru()];case 3:t.sent(),t.label=4;case 4:t.label=5;case 5:return this.$u()&&this.ku(),[2]}})})},Lh.prototype.Fu=function(){return this.hu()&&this.tu.length<10},Lh.prototype.Lu=function(){return this.tu.length},Lh.prototype.Nu=function(t){this.tu.push(t),this.fu.aa()&&this.fu.ba&&this.fu.va(t.mutations)},Lh.prototype.$u=function(){return this.hu()&&!this.fu.oa()&&0<this.tu.length},Lh.prototype.ku=function(){this.fu.start()},Lh.prototype.du=function(){return d(this,void 0,void 0,function(){return y(this,function(t){return this.fu.Da(),[2]})})},Lh.prototype.Tu=function(){var r=this;return this.Za.Mh(this.fu.lastStreamToken).then(function(){for(var t=0,e=r.tu;t<e.length;t++){var n=e[t];r.fu.va(n.mutations)}}).catch(ju)},Lh.prototype.Sa=function(t,e){var n=this,r=this.tu.shift(),i=au.from(r,t,e,this.fu.lastStreamToken);return this.bu.Ou(i).then(function(){return n.Ru()})},Lh.prototype.wu=function(e){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return e&&0<this.tu.length?this.fu.ba?[4,this.qu(e)]:[3,2]:[3,5];case 1:return t.sent(),[3,4];case 2:return[4,this.Mu(e)];case 3:t.sent(),t.label=4;case 4:this.$u()&&this.ku(),t.label=5;case 5:return[2]}})})},Lh.prototype.Mu=function(e){return d(this,void 0,void 0,function(){return y(this,function(t){return Zo(e.code)?[2,(Ys("RemoteStore","RemoteStore error before completed handshake; resetting stream token: ",this.fu.lastStreamToken),this.fu.lastStreamToken=ei.ht,this.Za.Mh(ei.ht).catch(ju))]:[2]})})},Lh.prototype.qu=function(i){return d(this,void 0,void 0,function(){var e,n,r=this;return y(this,function(t){return Zo(n=i.code)&&n!==Rr.ABORTED?(e=this.tu.shift(),[2,(this.fu.ca(),this.bu.xu(e.batchId,i).then(function(){return r.Ru()}))]):[2]})})},Lh.prototype.Bu=function(){return new ch(this.ka)},Lh.prototype.ou=function(){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.networkEnabled=!1,[4,this.Au()];case 1:return t.sent(),this.au.set("Unknown"),[4,this.enableNetwork()];case 2:return t.sent(),[2]}})})},Lh.prototype.Uu=function(){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.hu()?(Ys("RemoteStore","RemoteStore restarting streams for new credential"),[4,this.ou()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},Lh.prototype.Qu=function(e){return d(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return(this.isPrimary=e)&&this.networkEnabled?[4,this.enableNetwork()]:[3,2];case 1:return t.sent(),[3,5];case 2:return e?[3,4]:[4,this.Au()];case 3:t.sent(),this.au.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})},Lh),ph=(kh.prototype.Wu=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},kh.prototype.ju=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},kh.prototype.Gu=function(){var t={activeTargetIds:this.activeTargetIds.W(),updateTimeMs:Date.now()};return JSON.stringify(t)},kh),dh=(Ph.prototype.zu=function(t){},Ph.prototype.Yu=function(t,e,n){},Ph.prototype.Xu=function(t){return this.Hu.Wu(t),this.Ku[t]||"not-current"},Ph.prototype.Ju=function(t,e,n){this.Ku[t]=e},Ph.prototype.Zu=function(t){this.Hu.ju(t)},Ph.prototype.tc=function(t){return this.Hu.activeTargetIds.has(t)},Ph.prototype.ec=function(t){delete this.Ku[t]},Ph.prototype.sc=function(){return this.Hu.activeTargetIds},Ph.prototype.ic=function(t){return this.Hu.activeTargetIds.has(t)},Ph.prototype.start=function(){return this.Hu=new ph,Promise.resolve()},Ph.prototype.Ah=function(t,e,n){},Ph.prototype.nc=function(t){},Ph.prototype.Vu=function(){},Ph.prototype.tr=function(t){},Ph),yh=(Object.defineProperty(Oh.prototype,"uc",{get:function(){return this.rc},enumerable:!0,configurable:!0}),Oh.prototype.cc=function(t,e){var u=this,a=e?e.lc:new Ts,h=e?e.ac:this.ac,c=e?e.ns:this.ns,f=h,l=!1,p=this.query.oe()&&h.size===this.query.limit?h.last():null,d=this.query.ae()&&h.size===this.query.limit?h.first():null;if(t.ye(function(t,e){var n=h.get(t),r=e instanceof Eo?e:null;r=r&&(u.query.matches(r)?r:null);var i=!!n&&u.ns.has(n.key),o=!!r&&(r.At||u.ns.has(r.key)&&r.hasCommittedMutations),s=!1;n&&r?n.data().isEqual(r.data())?i!==o&&(a.track({type:3,doc:r}),s=!0):u._c(n,r)||(a.track({type:2,doc:r}),s=!0,(p&&0<u.query.se(r,p)||d&&u.query.se(r,d)<0)&&(l=!0)):!n&&r?(a.track({type:0,doc:r}),s=!0):n&&!r&&(a.track({type:1,doc:n}),s=!0,(p||d)&&(l=!0)),s&&(c=r?(f=f.add(r),o?c.add(t):c.delete(t)):(f=f.delete(t),c.delete(t)))}),this.query.oe()||this.query.ae())for(;f.size>this.query.limit;){var n=this.query.oe()?f.last():f.first();f=f.delete(n.key),c=c.delete(n.key),a.track({type:1,doc:n})}return{ac:f,lc:a,fc:l,ns:c}},Oh.prototype._c=function(t,e){return t.At&&e.hasCommittedMutations&&!e.At},Oh.prototype.dc=function(t,e,n){var o=this,r=this.ac;this.ac=t.ac,this.ns=t.ns;var i=t.lc.es();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.query.se(t.doc,e.doc);function n(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ks()}}var r,i}),this.wc(n);var s=e?this.Tc():[],u=0===this.oc.size&&this.ds?1:0,a=u!==this.hc;return this.hc=u,0!==i.length||a?{snapshot:new As(this.query,t.ac,r,i,t.ns,0==u,a,!1),Ec:s}:{Ec:s}},Oh.prototype.mc=function(t){return this.ds&&"Offline"===t?(this.ds=!1,this.dc({ac:this.ac,lc:new Ts,ns:this.ns,fc:!1},!1)):{Ec:[]}},Oh.prototype.Ic=function(t){return!this.rc.has(t)&&!!this.ac.has(t)&&!this.ac.get(t).At},Oh.prototype.wc=function(t){var e=this;t&&(t.ws.forEach(function(t){return e.rc=e.rc.add(t)}),t.Ts.forEach(function(t){}),t.Es.forEach(function(t){return e.rc=e.rc.delete(t)}),this.ds=t.ds)},Oh.prototype.Tc=function(){var e=this;if(!this.ds)return[];var n=this.oc;this.oc=vs(),this.ac.forEach(function(t){e.Ic(t.key)&&(e.oc=e.oc.add(t.key))});var r=[];return n.forEach(function(t){e.oc.has(t)||r.push(new Ja(t))}),this.oc.forEach(function(t){n.has(t)||r.push(new Ka(t))}),r},Oh.prototype.Rc=function(t){this.rc=t._o,this.oc=vs();var e=this.cc(t.documents);return this.dc(e,!0)},Oh.prototype.Ac=function(){return As.os(this.query,this.ac,this.ns,0===this.hc)},Oh),vh=(Dh.prototype.pc=function(){this.yc()},Dh.prototype.yc=function(){var t=this;this.Or.lr(function(){return d(t,void 0,void 0,function(){var e,n,r=this;return y(this,function(t){return e=this.Pc.Bu(),(n=this.gc(e))&&n.then(function(t){r.Pr.Sr(function(){return e.commit().then(function(){r.yr.resolve(t)}).catch(function(t){r.bc(t)})})}).catch(function(t){r.bc(t)}),[2]})})})},Dh.prototype.gc=function(t){try{var e=this.updateFunction(t);return!ri(e)&&e.catch&&e.then?e:(this.yr.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.yr.reject(t),null}},Dh.prototype.bc=function(t){var e=this;0<this.Vc&&this.vc(t)?(--this.Vc,this.Pr.Sr(function(){return e.yc(),Promise.resolve()})):this.yr.reject(t)},Dh.prototype.vc=function(t){if("FirebaseError"!==t.name)return!1;var e=t.code;return"aborted"===e||"failed-precondition"===e||!Zo(e)},Dh),gh=(Object.defineProperty(Sh.prototype,"Uc",{get:function(){return!0},enumerable:!0,configurable:!0}),Sh.prototype.subscribe=function(t){this.Fc=t},Sh.prototype.listen=function(s){return d(this,void 0,void 0,function(){var e,n,r,i,o;return y(this,function(t){switch(t.label){case 0:return this.Qc("listen()"),(r=this.Nc.get(s))?(e=r.targetId,this.Cc.Xu(e),n=r.view.Ac(),[3,4]):[3,1];case 1:return[4,this.Za.ro(s.ee())];case 2:return i=t.sent(),o=this.Cc.Xu(i.targetId),e=i.targetId,[4,this.Wc(s,e,"current"===o)];case 3:n=t.sent(),this.Uc&&this.Pc.listen(i),t.label=4;case 4:return[2,n]}})})},Sh.prototype.Wc=function(u,a,h){return d(this,void 0,void 0,function(){var e,n,r,i,o,s;return y(this,function(t){switch(t.label){case 0:return[4,this.Za.co(u,!0)];case 1:return e=t.sent(),n=new yh(u,e._o),r=n.cc(e.documents),i=_s.fs(a,h&&"Offline"!==this.onlineState),o=n.dc(r,this.Uc,i),this.jc(a,o.Ec),s=new $a(u,a,n),[2,(this.Nc.set(u,s),this.$c.has(a)?this.$c.get(a).push(u):this.$c.set(a,[u]),o.snapshot)]}})})},Sh.prototype.yu=function(i){return d(this,void 0,void 0,function(){var e,n,r=this;return y(this,function(t){switch(t.label){case 0:return this.Qc("unlisten()"),e=this.Nc.get(i),1<(n=this.$c.get(e.targetId)).length?[2,(this.$c.set(e.targetId,n.filter(function(t){return!t.isEqual(i)})),void this.Nc.delete(i))]:this.Uc?(this.Cc.Zu(e.targetId),this.Cc.ic(e.targetId)?[3,2]:[4,this.Za.uo(e.targetId,!1).then(function(){r.Cc.ec(e.targetId),r.Pc.yu(e.targetId),r.Gc(e.targetId)}).catch(ju)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return this.Gc(e.targetId),[4,this.Za.uo(e.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})},Sh.prototype.write=function(i,o){return d(this,void 0,void 0,function(){var e,n,r;return y(this,function(t){switch(t.label){case 0:this.Qc("write()"),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.Za.gh(i)];case 2:return e=t.sent(),this.Cc.zu(e.batchId),this.Hc(e.batchId,o),[4,this.Kc(e.vh)];case 3:return t.sent(),[4,this.Pc.Ru()];case 4:return t.sent(),[3,6];case 5:return n=t.sent(),r=Cu(n,"Failed to persist write"),o.reject(r),[3,6];case 6:return[2]}})})},Sh.prototype.runTransaction=function(t,e,n){new vh(t,this.Pc,e,n).pc()},Sh.prototype.Bh=function(n){return d(this,void 0,void 0,function(){var e,r=this;return y(this,function(t){switch(t.label){case 0:this.Qc("applyRemoteEvent()"),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.Za.Bh(n)];case 2:return e=t.sent(),n.as.forEach(function(t,e){var n=r.Oc.get(e);n&&(Js(t.ws.size+t.Ts.size+t.Es.size<=1),0<t.ws.size?n.Sc=!0:0<t.Ts.size?Js(n.Sc):0<t.Es.size&&(Js(n.Sc),n.Sc=!1))}),[4,this.Kc(e,n)];case 3:return t.sent(),[3,6];case 4:return[4,ju(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},Sh.prototype.mc=function(r,t){this.Qc("applyOnlineStateChange()");var i=[];this.Nc.forEach(function(t,e){var n=e.view.mc(r);n.snapshot&&i.push(n.snapshot)}),this.Fc.zc(r),this.Fc.Va(i),this.onlineState=r},Sh.prototype.Du=function(u,a){return d(this,void 0,void 0,function(){var e,n,r,i,o,s=this;return y(this,function(t){switch(t.label){case 0:return this.Qc("rejectListens()"),this.Cc.Ju(u,"rejected",a),e=this.Oc.get(u),(n=e&&e.key)?(r=(r=new Ko(Xr.N)).Re(n,new Io(n,Vr.min())),i=vs().add(n),o=new Ns(Vr.min(),new Map,new is(nu),r,i),[4,this.Bh(o)]):[3,2];case 1:return t.sent(),this.Lc=this.Lc.remove(n),this.Oc.delete(u),this.Yc(),[3,4];case 2:return[4,this.Za.uo(u,!1).then(function(){return s.Gc(u,a)}).catch(ju)];case 3:t.sent(),t.label=4;case 4:return[2]}})})},Sh.prototype.Ou=function(r){return d(this,void 0,void 0,function(){var e,n;return y(this,function(t){switch(t.label){case 0:this.Qc("applySuccessfulWrite()"),e=r.batch.batchId,this.Xc(e,null),this.Jc(e),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.Za.Sh(r)];case 2:return n=t.sent(),this.Cc.Yu(e,"acknowledged"),[4,this.Kc(n)];case 3:return t.sent(),[3,6];case 4:return[4,ju(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},Sh.prototype.xu=function(n,r){return d(this,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:this.Qc("rejectFailedWrite()"),this.Xc(n,r),this.Jc(n),t.label=1;case 1:return t.trys.push([1,4,,6]),[4,this.Za.$h(n)];case 2:return e=t.sent(),this.Cc.Yu(n,"rejected",r),[4,this.Kc(e)];case 3:return t.sent(),[3,6];case 4:return[4,ju(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})},Sh.prototype.Zc=function(o){return d(this,void 0,void 0,function(){var e,n,r,i;return y(this,function(t){switch(t.label){case 0:this.Pc.hu()||Ys("SyncEngine","The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled."),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.Za.Oh()];case 2:return-1===(e=t.sent())?[2,void o.resolve()]:((n=this.xc.get(e)||[]).push(o),this.xc.set(e,n),[3,4]);case 3:return r=t.sent(),i=Cu(r,"Initialization of waitForPendingWrites() operation failed"),o.reject(i),[3,4];case 4:return[2]}})})},Sh.prototype.Jc=function(t){(this.xc.get(t)||[]).forEach(function(t){t.resolve()}),this.xc.delete(t)},Sh.prototype.tl=function(e){this.xc.forEach(function(t){t.forEach(function(t){t.reject(new Sr(Rr.CANCELLED,e))})}),this.xc.clear()},Sh.prototype.Hc=function(t,e){var n=this.Mc[this.currentUser.s()];n=(n=n||new Ko(nu)).Re(t,e),this.Mc[this.currentUser.s()]=n},Sh.prototype.Xc=function(t,e){var n=this.Mc[this.currentUser.s()];if(n){var r=n.get(t);r&&(e?r.reject(e):r.resolve(),n=n.remove(t)),this.Mc[this.currentUser.s()]=n}},Sh.prototype.Gc=function(t,e){var n=this;void 0===e&&(e=null),this.Cc.Zu(t);for(var r=0,i=this.$c.get(t);r<i.length;r++){var o=i[r];this.Nc.delete(o),e&&this.Fc.el(o,e)}this.$c.delete(t),this.Uc&&this.qc.Po(t).forEach(function(t){n.qc.yo(t)||n.sl(t)})},Sh.prototype.sl=function(t){var e=this.Lc.get(t);null!==e&&(this.Pc.yu(e),this.Lc=this.Lc.remove(t),this.Oc.delete(e),this.Yc())},Sh.prototype.jc=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n];i instanceof Ka?(this.qc.to(i.key,t),this.il(i)):i instanceof Ja?(Ys("SyncEngine","Document no longer in limbo: "+i.key),this.qc.eo(i.key,t),this.qc.yo(i.key)||this.sl(i.key)):Ks()}},Sh.prototype.il=function(t){var e=t.key;this.Lc.get(e)||(Ys("SyncEngine","New document in limbo: "+e),this.kc.push(e),this.Yc())},Sh.prototype.Yc=function(){for(;0<this.kc.length&&this.Lc.size<this.Dc;){var t=this.kc.shift(),e=this.Bc.next();this.Oc.set(e,new th(t)),this.Lc=this.Lc.Re(t,e),this.Pc.listen(new Vo(No.Wt(t.path).ee(),e,2,lu.er))}},Sh.prototype.nl=function(){return this.Lc},Sh.prototype.rl=function(){return this.kc},Sh.prototype.Kc=function(r,a){return d(this,void 0,void 0,function(){var o,s,e,u=this;return y(this,function(t){switch(t.label){case 0:return o=[],s=[],e=[],this.Nc.forEach(function(t,i){e.push(Promise.resolve().then(function(){var n=i.view.cc(r);return n.fc?u.Za.co(i.query,!1).then(function(t){var e=t.documents;return i.view.cc(e,n)}):n}).then(function(t){var e=a&&a.as.get(i.targetId),n=i.view.dc(t,u.Uc,e);if(u.jc(i.targetId,n.Ec),n.snapshot){u.Uc&&u.Cc.Ju(i.targetId,n.snapshot.fromCache?"not-current":"current"),o.push(n.snapshot);var r=fu.Yn(i.targetId,n.snapshot);s.push(r)}}))}),[4,Promise.all(e)];case 1:return t.sent(),this.Fc.Va(o),[4,this.Za.Zh(s)];case 2:return t.sent(),[2]}})})},Sh.prototype.Qc=function(t){},Sh.prototype.Uu=function(n){return d(this,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:return this.currentUser.isEqual(n)?[3,3]:[4,this.Za.Ah(n)];case 1:return e=t.sent(),this.currentUser=n,this.tl("'waitForPendingWrites' promise is rejected due to a user change."),this.Cc.Ah(n,e.ph,e.yh),[4,this.Kc(e.Vh)];case 2:t.sent(),t.label=3;case 3:return[4,this.Pc.Uu()];case 4:return t.sent(),[2]}})})},Sh.prototype.enableNetwork=function(){return this.Pc.enableNetwork()},Sh.prototype.disableNetwork=function(){return this.Pc.disableNetwork()},Sh.prototype.ei=function(t){var e=this.Oc.get(t);if(e&&e.Sc)return vs().add(e.key);var n=vs(),r=this.$c.get(t);if(!r)return n;for(var i=0,o=r;i<o.length;i++){var s=o[i],u=this.Nc.get(s);n=n.ze(u.view.uc)}return n},Sh),mh=(Rh.prototype.listen=function(u){return d(this,void 0,void 0,function(){var e,n,r,i,o,s;return y(this,function(t){switch(t.label){case 0:if(e=u.query,n=!1,(r=this.al.get(e))||(n=!0,r=new eh),!n)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),i=r,[4,this.bu.listen(e)];case 2:return i.hl=t.sent(),[3,4];case 3:return o=t.sent(),s=Cu(o,"Initialization of query '"+u.query+"' failed"),[2,void u.onError(s)];case 4:return this.al.set(e,r),r.ol.push(u),u.mc(this.onlineState),r.hl&&u.cl(r.hl)&&this.ll(),[2]}})})},Rh.prototype.yu=function(o){return d(this,void 0,void 0,function(){var e,n,r,i;return y(this,function(t){return e=o.query,n=!1,(r=this.al.get(e))&&0<=(i=r.ol.indexOf(o))&&(r.ol.splice(i,1),n=0===r.ol.length),n?[2,(this.al.delete(e),this.bu.yu(e))]:[2]})})},Rh.prototype.Va=function(t){for(var e=!1,n=0,r=t;n<r.length;n++){var i=r[n],o=i.query,s=this.al.get(o);if(s){for(var u=0,a=s.ol;u<a.length;u++)a[u].cl(i)&&(e=!0);s.hl=i}}e&&this.ll()},Rh.prototype.el=function(t,e){var n=this.al.get(t);if(n)for(var r=0,i=n.ol;r<i.length;r++)i[r].onError(e);this.al.delete(t)},Rh.prototype.zc=function(i){this.onlineState=i;var o=!1;this.al.forEach(function(t,e){for(var n=0,r=e.ol;n<r.length;n++)r[n].mc(i)&&(o=!0)}),o&&this.ll()},Rh.prototype._l=function(t){this.ul.add(t),t.next()},Rh.prototype.fl=function(t){this.ul.delete(t)},Rh.prototype.ll=function(){this.ul.forEach(function(t){t.next()})},Rh),wh=(_h.prototype.cl=function(t){if(!this.options.includeMetadataChanges){for(var e=[],n=0,r=t.docChanges;n<r.length;n++){var i=r[n];3!==i.type&&e.push(i)}t=new As(t.query,t.docs,t.ss,e,t.ns,t.fromCache,t.rs,!0)}var o=!1;return this.wl?this.El(t)&&(this.dl.next(t),o=!0):this.ml(t,this.onlineState)&&(this.Il(t),o=!0),this.Tl=t,o},_h.prototype.onError=function(t){this.dl.error(t)},_h.prototype.mc=function(t){this.onlineState=t;var e=!1;return this.Tl&&!this.wl&&this.ml(this.Tl,t)&&(this.Il(this.Tl),e=!0),e},_h.prototype.ml=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.Rl&&n||t.docs.M()&&"Offline"!==e)},_h.prototype.El=function(t){if(0<t.docChanges.length)return!0;var e=this.Tl&&this.Tl.hasPendingWrites!==t.hasPendingWrites;return!(!t.rs&&!e)&&!0===this.options.includeMetadataChanges},_h.prototype.Il=function(t){t=As.os(t.query,t.docs,t.ns,t.fromCache),this.wl=!0,this.dl.next(t)},_h),bh=(Nh.prototype.Rh=function(t){this.Al=t},Nh.prototype.Bn=function(e,r,i,o){var s=this;return r.te()||i.isEqual(Vr.min())?this.Pl(e,r):this.Al.qn(e,o).next(function(t){var n=s.Vl(r,t);return(r.oe()||r.ae())&&s.fc(r.xt,n,o,i)?s.Pl(e,r):(Ws()<=u.DEBUG&&Ys("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),r.toString()),s.Al.Bn(e,r,i).next(function(e){return n.forEach(function(t){e=e.Re(t.key,t)}),e}))})},Nh.prototype.Vl=function(n,t){var r=new is(function(t,e){return n.se(t,e)});return t.forEach(function(t,e){e instanceof Eo&&n.matches(e)&&(r=r.add(e))}),r},Nh.prototype.fc=function(t,e,n,r){if(n.size!==e.size)return!0;var i="F"===t?e.last():e.first();return!!i&&(i.hasPendingWrites||0<i.version.S(r))},Nh.prototype.Pl=function(t,e){return Ws()<=u.DEBUG&&Ys("IndexFreeQueryEngine","Using full collection scan to execute query:",e.toString()),this.Al.Bn(t,e,Vr.min())},Nh),Eh=(Ah.prototype.gl=function(t){return hu.resolve(0===this.Dn.length)},Ah.prototype.Sh=function(t,e,n){var r=e.batchId,i=this.bl(r,"acknowledged");return Js(0===i),this.Dn[i],this.lastStreamToken=n,hu.resolve()},Ah.prototype.qh=function(t){return hu.resolve(this.lastStreamToken)},Ah.prototype.Mh=function(t,e){return this.lastStreamToken=e,hu.resolve()},Ah.prototype.bh=function(t,e,n,r){var i=this.pl;this.pl++,0<this.Dn.length&&this.Dn[this.Dn.length-1];var o=new uu(i,e,n,r);this.Dn.push(o);for(var s=0,u=r;s<u.length;s++){var a=u[s];this.yl=this.yl.add(new Gu(a.key,i)),this.Fn.mr(t,a.key.path.L())}return hu.resolve(o)},Ah.prototype.kh=function(t,e){return hu.resolve(this.vl(e))},Ah.prototype.io=function(t,e){var n=e+1,r=this.Sl(n),i=r<0?0:r;return hu.resolve(this.Dn.length>i?this.Dn[i]:null)},Ah.prototype.Oh=function(){return hu.resolve(0===this.Dn.length?-1:this.pl-1)},Ah.prototype.Ph=function(t){return hu.resolve(this.Dn.slice())},Ah.prototype.$n=function(t,e){var n=this,r=new Gu(e,0),i=new Gu(e,Number.POSITIVE_INFINITY),o=[];return this.yl.Ge([r,i],function(t){var e=n.vl(t.bo);o.push(e)}),hu.resolve(o)},Ah.prototype.xn=function(t,e){var r=this,i=new is(nu);return e.forEach(function(t){var e=new Gu(t,0),n=new Gu(t,Number.POSITIVE_INFINITY);r.yl.Ge([e,n],function(t){i=i.add(t.bo)})}),hu.resolve(this.Cl(i))},Ah.prototype.Gn=function(t,e){var n=e.path,r=n.length+1,i=n;Xr.et(i)||(i=i.child(""));var o=new Gu(new Xr(i),0),s=new is(nu);return this.yl.He(function(t){var e=t.key.path;return!!n.B(e)&&(e.length===r&&(s=s.add(t.bo)),!0)},o),hu.resolve(this.Cl(s))},Ah.prototype.Cl=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.vl(t);null!==e&&r.push(e)}),r},Ah.prototype.Lh=function(n,r){var i=this;Js(0===this.bl(r.batchId,"removed")),this.Dn.shift();var o=this.yl;return hu.forEach(r.mutations,function(t){var e=new Gu(t.key,r.batchId);return o=o.delete(e),i.Yh.Dl(n,t.key)}).next(function(){i.yl=o})},Ah.prototype.Fl=function(t){},Ah.prototype.yo=function(t,e){var n=new Gu(e,0),r=this.yl.Ke(n);return hu.resolve(e.isEqual(r&&r.key))},Ah.prototype.Nh=function(t){return this.Dn.length,hu.resolve()},Ah.prototype.bl=function(t,e){return this.Sl(t)},Ah.prototype.Sl=function(t){return 0===this.Dn.length?0:t-this.Dn[0].batchId},Ah.prototype.vl=function(t){var e=this.Sl(t);return e<0||e>=this.Dn.length?null:this.Dn[e]},Ah),Ih=(Th.prototype.Kh=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.Nl(e);return this.docs=this.docs.Re(r,{$l:e,size:s,readTime:n}),this.size+=s-o,this.Fn.mr(t,r.path.L())},Th.prototype.Hh=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},Th.prototype.Ln=function(t,e){var n=this.docs.get(e);return hu.resolve(n?n.$l:null)},Th.prototype.getEntries=function(t,e){var n=this,r=cs();return e.forEach(function(t){var e=n.docs.get(t);r=r.Re(t,e?e.$l:null)}),hu.resolve(r)},Th.prototype.Bn=function(t,e,n){for(var r=ls(),i=new Xr(e.path.child("")),o=this.docs.ve(i);o.$e();){var s=o.Ne(),u=s.key,a=s.value,h=a.$l,c=a.readTime;if(!e.path.B(u.path))break;c.S(n)<=0||h instanceof Eo&&e.matches(h)&&(r=r.Re(h.key,h))}return hu.resolve(r)},Th.prototype.kl=function(t,e){return hu.forEach(this.docs,function(t){return e(t)})},Th.prototype.Ch=function(t){return new Th.Ll(this)},Th.prototype.Ol=function(t){return hu.resolve(this.size)},Th);function Th(t,e){this.Fn=t,this.Nl=e,this.docs=new Ko(Xr.N),this.size=0}function Ah(t,e){this.Fn=t,this.Yh=e,this.Dn=[],this.pl=1,this.lastStreamToken=ei.ht,this.yl=new is(Gu.To)}function Nh(){}function _h(t,e,n){this.query=t,this.dl=e,this.wl=!1,this.Tl=null,this.onlineState="Unknown",this.options=n||{}}function Rh(t){this.bu=t,this.al=new su(function(t){return t.canonicalId()}),this.onlineState="Unknown",this.ul=new Set,this.bu.subscribe(this)}function Sh(t,e,n,r,i){this.Za=t,this.Pc=e,this.Cc=n,this.currentUser=r,this.Dc=i,this.Fc=null,this.Nc=new su(function(t){return t.canonicalId()}),this.$c=new Map,this.kc=[],this.Lc=new Ko(Xr.N),this.Oc=new Map,this.qc=new Fu,this.Mc={},this.xc=new Map,this.Bc=Nu.Ar(),this.onlineState="Unknown"}function Dh(t,e,n,r){this.Pr=t,this.Pc=e,this.updateFunction=n,this.yr=r,this.Vc=5,this.Or=new Iu(this.Pr,"transaction_retry")}function Oh(t,e){this.query=t,this.rc=e,this.hc=null,this.ds=!1,this.oc=vs(),this.ns=vs(),this.ac=new Is(t.se.bind(t))}function Ph(){this.Hu=new ph,this.Ku={},this.bu=null,this.Wa=null,this.Xn=null}function kh(){this.activeTargetIds=ms()}function Lh(t,e,n,r,i){var o,s,u,a,h,c,f,l,p=this;this.Za=t,this.ka=e,this.Pr=n,this.tu=[],this.eu=new Map,this.su=null,this.networkEnabled=!1,this.isPrimary=!1,this.iu=!1,this.nu=i,this.nu.ru(function(t){n.Sr(function(){return d(p,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.hu()?(Ys("RemoteStore","Restarting streams for network reachability change."),[4,this.ou()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.au=new fh(n,r),this.uu=(h=this.ka,c=n,f={Aa:this.cu.bind(this),Ta:this.lu.bind(this),Va:this._u.bind(this)},l=$s(h),new uh(c,l.ia,l.credentials,l.serializer,f)),this.fu=(o=this.ka,s=n,u={Aa:this.du.bind(this),Ta:this.wu.bind(this),Ca:this.Tu.bind(this),Sa:this.Sa.bind(this)},a=$s(o),new ah(s,a.ia,a.credentials,a.serializer,u))}function Vh(t,e){this.Pr=t,this.Wa=e,this.state="Unknown",this.ja=0,this.Ga=null,this.Ha=!0}function Ch(t){this.ka=t,this.La=ds(),this.mutations=[],this.Oa=!1,this.qa=null,this.Ma=new Set}function Mh(t,e,n){var r=this;return(r=nh.call(this)||this).ia=t,r.credentials=e,r.serializer=n,r}function Uh(t,e,n,r,i){var o=this;return(o=rh.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).serializer=r,o.ga=!1,o.lastStreamToken=ei.ht,o}function qh(t,e,n,r,i){var o=this;return(o=ih.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).serializer=r,o}function xh(t,e,n,r,i,o){this.sr=t,this.sa=n,this.ia=r,this.na=i,this.listener=o,this.state=0,this.ra=0,this.ha=null,this.stream=null,this.Or=new Iu(t,e)}function jh(t){var e=this;return(e=oh.call(this)||this).Ql=t,e}function Fh(){this.vh=new su(function(t){return t.toString()}),this.ql=!1}Ih.Ll=(Object.defineProperty(Fh.prototype,"readTime",{get:function(){return this.Ml},set:function(t){this.Ml=t},enumerable:!0,configurable:!0}),Fh.prototype.Kh=function(t,e){this.xl(),this.readTime=e,this.vh.set(t.key,t)},Fh.prototype.Hh=function(t,e){this.xl(),e&&(this.readTime=e),this.vh.set(t,null)},Fh.prototype.Ln=function(t,e){this.xl();var n=this.vh.get(e);return void 0!==n?hu.resolve(n):this.Bl(t,e)},Fh.prototype.getEntries=function(t,e){return this.Ul(t,e)},Fh.prototype.apply=function(t){return this.xl(),this.ql=!0,this.dc(t)},Fh.prototype.xl=function(){},n(jh,oh=Fh),jh.prototype.dc=function(n){var r=this,i=[];return this.vh.forEach(function(t,e){e?i.push(r.Ql.Kh(n,e,r.readTime)):r.Ql.Hh(t)}),hu.vn(i)},jh.prototype.Bl=function(t,e){return this.Ql.Ln(t,e)},jh.prototype.Ul=function(t,e){return this.Ql.getEntries(t,e)},jh);var Gh,Bh=(rc.prototype.js=function(t,n){return this.Wl.forEach(function(t,e){return n(e)}),hu.resolve()},rc.prototype.xh=function(t){return hu.resolve(this.lastRemoteSnapshotVersion)},rc.prototype.Kl=function(t){return hu.resolve(this.jl)},rc.prototype.oo=function(t){return this.highestTargetId=this.Hl.next(),hu.resolve(this.highestTargetId)},rc.prototype.Xh=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.jl&&(this.jl=e),hu.resolve()},rc.prototype.zl=function(t){this.Wl.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.Hl=new Nu(e),this.highestTargetId=e),t.sequenceNumber>this.jl&&(this.jl=t.sequenceNumber)},rc.prototype.ao=function(t,e){return this.zl(e),this.targetCount+=1,hu.resolve()},rc.prototype.Gh=function(t,e){return this.zl(e),hu.resolve()},rc.prototype.Yl=function(t,e){return this.Wl.delete(e.target),this.Gl.Po(e.targetId),--this.targetCount,hu.resolve()},rc.prototype.Xl=function(n,r,i){var o=this,s=0,u=[];return this.Wl.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.Wl.delete(t),u.push(o.Jl(n,e.targetId)),s++)}),hu.vn(u).next(function(){return s})},rc.prototype.Zl=function(t){return hu.resolve(this.targetCount)},rc.prototype.ho=function(t,e){var n=this.Wl.get(e)||null;return hu.resolve(n)},rc.prototype.Qh=function(t,e,n){return this.Gl.Io(e,n),hu.resolve()},rc.prototype.Uh=function(e,t,n){this.Gl.Ao(t,n);var r=this.persistence.Yh,i=[];return r&&t.forEach(function(t){i.push(r.Dl(e,t))}),hu.vn(i)},rc.prototype.Jl=function(t,e){return this.Gl.Po(e),hu.resolve()},rc.prototype.lo=function(t,e){var n=this.Gl.po(e);return hu.resolve(n)},rc.prototype.yo=function(t,e){return hu.resolve(this.Gl.yo(e))},rc),zh=(nc.prototype.start=function(){return Promise.resolve()},nc.prototype.Vu=function(){return this.s_=!1,Promise.resolve()},Object.defineProperty(nc.prototype,"n_",{get:function(){return this.s_},enumerable:!0,configurable:!0}),nc.prototype.r_=function(){},nc.prototype.Ih=function(){return this.Fn},nc.prototype.fh=function(t){var e=this.t_[t.s()];return e||(e=new Eh(this.Fn,this.Yh),this.t_[t.s()]=e),e},nc.prototype.Eh=function(){return this.Th},nc.prototype.wh=function(){return this.Cn},nc.prototype.runTransaction=function(t,e,n){var r=this;Ys("MemoryPersistence","Starting transaction:",t);var i=new Hh(this.e_.next());return this.Yh.h_(),n(i).next(function(t){return r.Yh.o_(i).next(function(){return t})}).gn().then(function(t){return i.a_(),t})},nc.prototype.u_=function(e,n){return hu.Sn(Object.values(this.t_).map(function(t){return function(){return t.yo(e,n)}}))},nc),Hh=(ec.prototype.l_=function(t){this.c_.push(t)},ec.prototype.a_=function(){this.c_.forEach(function(t){return t()})},n(tc,Gh=ec),tc),Wh=($h.d_=function(t){return new $h(t)},Object.defineProperty($h.prototype,"w_",{get:function(){if(this.f_)return this.f_;throw Ks()},enumerable:!0,configurable:!0}),$h.prototype.to=function(t,e,n){return this.__.to(n,e),this.w_.delete(n),hu.resolve()},$h.prototype.eo=function(t,e,n){return this.__.eo(n,e),this.w_.add(n),hu.resolve()},$h.prototype.Dl=function(t,e){return this.w_.add(e),hu.resolve()},$h.prototype.removeTarget=function(t,e){var n=this;this.__.Po(e.targetId).forEach(function(t){return n.w_.add(t)});var r=this.persistence.Eh();return r.lo(t,e.targetId).next(function(t){t.forEach(function(t){return n.w_.add(t)})}).next(function(){return r.Yl(t,e)})},$h.prototype.h_=function(){this.f_=new Set},$h.prototype.o_=function(t){var n=this,r=this.persistence.wh().Ch();return hu.forEach(this.w_,function(e){return n.T_(t,e).next(function(t){t||r.Hh(e)})}).next(function(){return n.f_=null,r.apply(t)})},$h.prototype.zh=function(t,e){var n=this;return this.T_(t,e).next(function(t){t?n.w_.delete(e):n.w_.add(e)})},$h.prototype.i_=function(t){return 0},$h.prototype.T_=function(t,e){var n=this;return hu.Sn([function(){return hu.resolve(n.__.yo(e))},function(){return n.persistence.Eh().yo(t,e)},function(){return n.persistence.u_(t,e)}])},$h),Qh=(Jh.prototype.initialize=function(n){return d(this,void 0,void 0,function(){var e=this;return y(this,function(t){switch(t.label){case 0:return this.Cc=this.E_(n),this.persistence=this.m_(n),[4,this.persistence.start()];case 1:return t.sent(),this.I_=this.R_(n),this.Za=this.A_(n),this.Pc=this.P_(n),this.bu=this.V_(n),this.p_=this.y_(n),this.Cc.Wa=function(t){return e.bu.mc(t,1)},this.Pc.bu=this.bu,[4,this.Za.start()];case 2:return t.sent(),[4,this.Cc.start()];case 3:return t.sent(),[4,this.Pc.start()];case 4:return t.sent(),[4,this.Pc.Qu(this.bu.Uc)];case 5:return t.sent(),[2]}})})},Jh.prototype.y_=function(t){return new mh(this.bu)},Jh.prototype.R_=function(t){return null},Jh.prototype.A_=function(t){return new qu(this.persistence,new bh,t.g_)},Jh.prototype.m_=function(t){return new zh(Wh.d_)},Jh.prototype.P_=function(t){var e=this;return new lh(this.Za,t.ka,t.Pr,function(t){return e.bu.mc(t,0)},t.platform.b_())},Jh.prototype.E_=function(t){return new dh},Jh.prototype.V_=function(t){return new gh(this.Za,this.Pc,this.Cc,t.g_,t.Dc)},Jh.prototype.clearPersistence=function(t){throw new Sr(Rr.FAILED_PRECONDITION,"You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.")},Jh),Yh=(Kh.prototype.start=function(e,n){var r=this;this.S_();var i=new Eu,o=new Eu,s=!1;return this.credentials._(function(t){if(!s)return s=!0,Ys("FirestoreClient","Initializing. user=",t.uid),r.C_(e,n,t,o).then(i.resolve,i.reject);r.Pr.jr(function(){return r.Uu(t)})}),this.Pr.Sr(function(){return i.promise}),o.promise},Kh.prototype.enableNetwork=function(){var t=this;return this.S_(),this.Pr.enqueue(function(){return t.bu.enableNetwork()})},Kh.prototype.C_=function(a,h,c,f){return d(this,void 0,void 0,function(){var r,i,o,s,u=this;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.platform.D_(this.v_)];case 1:return r=t.sent(),i=this.platform.Ho(this.v_.ii),e=r,n=this.credentials,o=new hh(e,n,i),[4,a.initialize({Pr:this.Pr,v_:this.v_,platform:this.platform,ka:o,clientId:this.clientId,g_:c,Dc:100,F_:h})];case 2:return t.sent(),this.persistence=a.persistence,this.Cc=a.Cc,this.Za=a.Za,this.Pc=a.Pc,this.bu=a.bu,this.I_=a.I_,this.N_=a.p_,this.persistence.r_(function(){return d(u,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})}),f.resolve(),[3,4];case 3:if(s=t.sent(),f.reject(s),!this.k_(s))throw s;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+s),this.C_(new Qh,{L_:!1},c,f))];case 4:return[2]}var e,n})})},Kh.prototype.k_=function(t){return"FirebaseError"===t.name?t.code===Rr.FAILED_PRECONDITION||t.code===Rr.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},Kh.prototype.S_=function(){if(this.Pr.Mr)throw new Sr(Rr.FAILED_PRECONDITION,"The client has already been terminated.")},Kh.prototype.Uu=function(t){return this.Pr.Hr(),Ys("FirestoreClient","Credential Changed. Current user: "+t.uid),this.bu.Uu(t)},Kh.prototype.disableNetwork=function(){var t=this;return this.S_(),this.Pr.enqueue(function(){return t.bu.disableNetwork()})},Kh.prototype.terminate=function(){var t=this;return this.Pr.Wr(function(){return d(t,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.I_&&this.I_.stop(),[4,this.Pc.Vu()];case 1:return t.sent(),[4,this.Cc.Vu()];case 2:return t.sent(),[4,this.persistence.Vu()];case 3:return t.sent(),this.credentials.T(),[2]}})})})},Kh.prototype.waitForPendingWrites=function(){var t=this;this.S_();var e=new Eu;return this.Pr.Sr(function(){return t.bu.Zc(e)}),e.promise},Kh.prototype.listen=function(t,e,n){var r=this;this.S_();var i=new wh(t,e,n);return this.Pr.Sr(function(){return r.N_.listen(i)}),i},Kh.prototype.yu=function(t){var e=this;this.O_||this.Pr.Sr(function(){return e.N_.yu(t)})},Kh.prototype.q_=function(o){return d(this,void 0,void 0,function(){var i,e=this;return y(this,function(t){switch(t.label){case 0:return this.S_(),i=new Eu,[4,this.Pr.enqueue(function(){return d(e,void 0,void 0,function(){var e,n,r;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.Za.no(o)];case 1:return(e=t.sent())instanceof Eo?i.resolve(e):e instanceof Io?i.resolve(null):i.reject(new Sr(Rr.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")),[3,3];case 2:return n=t.sent(),r=Cu(n,"Failed to get document '"+o+" from cache"),i.reject(r),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),i.promise)]}})})},Kh.prototype.M_=function(a){return d(this,void 0,void 0,function(){var u,e=this;return y(this,function(t){switch(t.label){case 0:return this.S_(),u=new Eu,[4,this.Pr.enqueue(function(){return d(e,void 0,void 0,function(){var e,n,r,i,o,s;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.Za.co(a,!0)];case 1:return e=t.sent(),n=new yh(a,e._o),r=n.cc(e.documents),i=n.dc(r,!1),u.resolve(i.snapshot),[3,3];case 2:return o=t.sent(),s=Cu(o,"Failed to execute query '"+a+" against cache"),u.reject(s),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),u.promise)]}})})},Kh.prototype.write=function(t){var e=this;this.S_();var n=new Eu;return this.Pr.Sr(function(){return e.bu.write(t,n)}),n.promise},Kh.prototype.ii=function(){return this.v_.ii},Kh.prototype._l=function(t){var e=this;this.S_(),this.Pr.Sr(function(){return e.N_._l(t),Promise.resolve()})},Kh.prototype.fl=function(t){var e=this;this.O_||this.Pr.Sr(function(){return e.N_.fl(t),Promise.resolve()})},Object.defineProperty(Kh.prototype,"O_",{get:function(){return this.Pr.Mr},enumerable:!0,configurable:!0}),Kh.prototype.transaction=function(t){var e=this;this.S_();var n=new Eu;return this.Pr.Sr(function(){return e.bu.runTransaction(e.Pr,t,n),Promise.resolve()}),n.promise},Kh),Zh=(Xh.prototype.next=function(t){this.x_(this.observer.next,t)},Xh.prototype.error=function(t){this.x_(this.observer.error,t)},Xh.prototype.B_=function(){this.muted=!0},Xh.prototype.x_=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},Xh);function Xh(t){this.observer=t,this.muted=!1}function Kh(t,e,n,r){this.platform=t,this.v_=e,this.credentials=n,this.Pr=r,this.clientId=tu.cn()}function Jh(){}function $h(t){this.persistence=t,this.__=new Fu,this.f_=null}function tc(t){var e=this;return(e=Gh.call(this)||this).Wh=t,e}function ec(){this.c_=[]}function nc(t){var e=this;this.t_={},this.e_=new lu(0),this.s_=!1,this.s_=!0,this.Yh=t(this),this.Th=new Bh(this),this.Fn=new Tu,this.Cn=new Ih(this.Fn,function(t){return e.Yh.i_(t)})}function rc(t){this.persistence=t,this.Wl=new su(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=Vr.min(),this.highestTargetId=0,this.jl=0,this.Gl=new Fu,this.targetCount=0,this.Hl=Nu.Rr()}function ic(i){return function(){if("object"==typeof i&&null!==i)for(var t=i,e=0,n=["next","error","complete"];e<n.length;e++){var r=n[e];if(r in t&&"function"==typeof t[r])return 1}}()}var oc,sc,uc=(Pc.prototype.Q_=function(t){switch(ai(t)){case 0:return null;case 1:return t.booleanValue;case 2:return yi(t.integerValue||t.doubleValue);case 3:return this.W_(t.timestampValue);case 4:return this.j_(t);case 5:return t.stringValue;case 6:return new fa(vi(t.bytesValue));case 7:return this.G_(t.referenceValue);case 8:return this.H_(t.geoPointValue);case 9:return this.K_(t.arrayValue);case 10:return this.z_(t.mapValue);default:throw Ks()}},Pc.prototype.z_=function(t){var n=this,r={};return $r(t.fields||{},function(t,e){r[t]=n.Q_(e)}),r},Pc.prototype.H_=function(t){return new Ra(yi(t.latitude),yi(t.longitude))},Pc.prototype.K_=function(t){var e=this;return(t.values||[]).map(function(t){return e.Q_(t)})},Pc.prototype.j_=function(t){switch(this.U_){case"previous":var e=function t(e){var n=e.mapValue.fields.__previous_value__;return oi(n)?t(n):n}(t);return null==e?null:this.Q_(e);case"estimate":return this.W_(si(t));default:return null}},Pc.prototype.W_=function(t){var e=di(t),n=new Lr(e.seconds,e.nanos);return this.timestampsInSnapshots?n:n.toDate()},Pc.prototype.G_=function(t){var e=Mr.G(t);Js(Gs(e));var n=new ou(e.get(1),e.get(3)),r=new Xr(e.k(5));return n.isEqual(this.firestore.ta)||Zs("Document "+r+" contains a document reference within a different database ("+n.projectId+"/"+n.database+") which is not supported. It will be treated as a reference in the current database ("+this.firestore.ta.projectId+"/"+this.firestore.ta.database+") instead."),new pc(r,this.firestore,this.converter)},Pc),ac=Mu.nh,hc=(Oc.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.timestampsInSnapshots===t.timestampsInSnapshots&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.forceLongPolling===t.forceLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},Oc),cc=(Object.defineProperty(Dc.prototype,"rf",{get:function(){return this.hf||(this.hf=new Fa(this.ta,this.nf.ignoreUndefinedProperties)),this.hf},enumerable:!0,configurable:!0}),Dc.prototype.settings=function(t){Wu("Firestore.settings",arguments,1),Zu("Firestore.settings","object",1,t);var e=new hc(t);if(this.Z_&&!this.nf.isEqual(e))throw new Sr(Rr.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");void 0!==(this.nf=e).credentials&&(this.sf=function(t){if(!t)return new Dr;switch(t.type){case"gapi":var e=t.af;return Js(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new kr(e,t.V||"0");case"provider":return t.af;default:throw new Sr(Rr.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(e.credentials))},Dc.prototype.enableNetwork=function(){return this.J_(),this.Z_.enableNetwork()},Dc.prototype.disableNetwork=function(){return this.J_(),this.Z_.disableNetwork()},Dc.prototype.enablePersistence=function(t){var e,n;if(this.Z_)throw new Sr(Rr.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");var r=!1;return t&&(void 0!==t.experimentalTabSynchronization&&Zs("The 'experimentalTabSynchronization' setting will be removed. Use 'synchronizeTabs' instead."),r=null!==(n=null!==(e=t.synchronizeTabs)&&void 0!==e?e:t.experimentalTabSynchronization)&&void 0!==n&&n),this.uf(this.if,{L_:!0,cacheSizeBytes:this.nf.cacheSizeBytes,synchronizeTabs:r})},Dc.prototype.clearPersistence=function(){return d(this,void 0,void 0,function(){var r,e=this;return y(this,function(t){if(void 0!==this.Z_&&!this.Z_.O_)throw new Sr(Rr.FAILED_PRECONDITION,"Persistence cannot be cleared after this Firestore instance is initialized.");return r=new Eu,[2,(this.X_.xr(function(){return d(e,void 0,void 0,function(){var e,n;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=this.cf(),[4,this.if.clearPersistence(e)];case 1:return t.sent(),r.resolve(),[3,3];case 2:return n=t.sent(),r.reject(n),[3,3];case 3:return[2]}})})}),r.promise)]})})},Dc.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},Object.defineProperty(Dc.prototype,"lf",{get:function(){return this.J_(),this.Z_.O_},enumerable:!0,configurable:!0}),Dc.prototype.waitForPendingWrites=function(){return this.J_(),this.Z_.waitForPendingWrites()},Dc.prototype.onSnapshotsInSync=function(t){if(this.J_(),ic(t))return this._f(t);Zu("Firestore.onSnapshotsInSync","function",1,t);var e={next:t};return this._f(e)},Dc.prototype._f=function(t){var e=this,n=new Zh({next:function(){t.next&&t.next()},error:function(t){throw Ks()}});return this.Z_._l(n),function(){n.B_(),e.Z_.fl(n)}},Dc.prototype.J_=function(){return this.Z_||this.uf(new Qh,{L_:!1}),this.Z_},Dc.prototype.cf=function(){return new iu(this.ta,this.ef,this.nf.host,this.nf.ssl,this.nf.forceLongPolling)},Dc.prototype.uf=function(t,e){var n=this.cf();return this.Z_=new Yh(Bs.nt(),n,this.sf,this.X_),this.Z_.start(t,e)},Dc.tf=function(t){if(e=t.options,!Object.prototype.hasOwnProperty.call(e,"projectId"))throw new Sr(Rr.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var e,n=t.options.projectId;if(!n||"string"!=typeof n)throw new Sr(Rr.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new ou(n)},Object.defineProperty(Dc.prototype,"app",{get:function(){if(!this.Y_)throw new Sr(Rr.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.Y_},enumerable:!0,configurable:!0}),Dc.prototype.collection=function(t){return Wu("Firestore.collection",arguments,1),Zu("Firestore.collection","non-empty string",1,t),this.J_(),new wc(Mr.G(t),this)},Dc.prototype.doc=function(t){return Wu("Firestore.doc",arguments,1),Zu("Firestore.doc","non-empty string",1,t),this.J_(),pc.ff(Mr.G(t),this)},Dc.prototype.collectionGroup=function(t){if(Wu("Firestore.collectionGroup",arguments,1),Zu("Firestore.collectionGroup","non-empty string",1,t),0<=t.indexOf("/"))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return this.J_(),new gc(new No(Mr.H,t),this)},Dc.prototype.runTransaction=function(e){var n=this;return Wu("Firestore.runTransaction",arguments,1),Zu("Firestore.runTransaction","function",1,e),this.J_().transaction(function(t){return e(new fc(n,t))})},Dc.prototype.batch=function(){return this.J_(),new lc(this)},Object.defineProperty(Dc,"logLevel",{get:function(){switch(Ws()){case u.DEBUG:return"debug";case u.SILENT:return"silent";default:return"error"}},enumerable:!0,configurable:!0}),Dc.setLogLevel=function(t){switch(Wu("Firestore.setLogLevel",arguments,1),Zu("Firestore.setLogLevel","non-empty string",1,t),t){case"debug":Qs(u.DEBUG);break;case"error":Qs(u.ERROR);break;case"silent":Qs(u.SILENT);break;default:throw new Sr(Rr.INVALID_ARGUMENT,"Invalid log level: "+t)}},Dc.prototype.df=function(){return this.nf.timestampsInSnapshots},Dc),fc=(Sc.prototype.get=function(t){var n=this;Wu("Transaction.get",arguments,1);var r=Cc("Transaction.get",t,this.wf);return this.Tf.xa([r.ea]).then(function(t){if(!t||1!==t.length)return Ks();var e=t[0];if(e instanceof Io)return new yc(n.wf,r.ea,null,!1,!1,r.Ef);if(e instanceof Eo)return new yc(n.wf,r.ea,e,!1,!1,r.Ef);throw Ks()})},Sc.prototype.set=function(t,e,n){Yu("Transaction.set",arguments,2,3);var r=Cc("Transaction.set",t,this.wf);n=kc("Transaction.set",n);var i=Mc(r.Ef,e,"Transaction.set"),o=i[0],s=i[1],u=n.merge||n.mergeFields?this.wf.rf.Yo(s,o,n.mergeFields):this.wf.rf.Ko(s,o);return this.Tf.set(r.ea,u),this},Sc.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return i="string"==typeof e||e instanceof la?(Qu("Transaction.update",arguments,3),r=Cc("Transaction.update",t,this.wf),this.wf.rf.Jo("Transaction.update",e,n,o)):(Wu("Transaction.update",arguments,2),r=Cc("Transaction.update",t,this.wf),this.wf.rf.Xo("Transaction.update",e)),this.Tf.update(r.ea,i),this},Sc.prototype.delete=function(t){Wu("Transaction.delete",arguments,1);var e=Cc("Transaction.delete",t,this.wf);return this.Tf.delete(e.ea),this},Sc),lc=(Rc.prototype.set=function(t,e,n){Yu("WriteBatch.set",arguments,2,3),this.Rf();var r=Cc("WriteBatch.set",t,this.wf);n=kc("WriteBatch.set",n);var i=Mc(r.Ef,e,"WriteBatch.set"),o=i[0],s=i[1],u=n.merge||n.mergeFields?this.wf.rf.Yo(s,o,n.mergeFields):this.wf.rf.Ko(s,o);return this.mf=this.mf.concat(u.xo(r.ea,ji.dt())),this},Rc.prototype.update=function(t,e,n){for(var r,i,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return this.Rf(),i="string"==typeof e||e instanceof la?(Qu("WriteBatch.update",arguments,3),r=Cc("WriteBatch.update",t,this.wf),this.wf.rf.Jo("WriteBatch.update",e,n,o)):(Wu("WriteBatch.update",arguments,2),r=Cc("WriteBatch.update",t,this.wf),this.wf.rf.Xo("WriteBatch.update",e)),this.mf=this.mf.concat(i.xo(r.ea,ji.exists(!0))),this},Rc.prototype.delete=function(t){Wu("WriteBatch.delete",arguments,1),this.Rf();var e=Cc("WriteBatch.delete",t,this.wf);return this.mf=this.mf.concat(new Hi(e.ea,ji.dt())),this},Rc.prototype.commit=function(){return this.Rf(),this.If=!0,0<this.mf.length?this.wf.J_().write(this.mf):Promise.resolve()},Rc.prototype.Rf=function(){if(this.If)throw new Sr(Rr.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},Rc),pc=(_c.ff=function(t,e,n){if(t.length%2!=0)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.j()+" has "+t.length);return new _c(new Xr(t),e,n)},Object.defineProperty(_c.prototype,"id",{get:function(){return this.ea.path.q()},enumerable:!0,configurable:!0}),Object.defineProperty(_c.prototype,"parent",{get:function(){return new wc(this.ea.path.L(),this.firestore,this.Ef)},enumerable:!0,configurable:!0}),Object.defineProperty(_c.prototype,"path",{get:function(){return this.ea.path.j()},enumerable:!0,configurable:!0}),_c.prototype.collection=function(t){if(Wu("DocumentReference.collection",arguments,1),Zu("DocumentReference.collection","non-empty string",1,t),!t)throw new Sr(Rr.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=Mr.G(t);return new wc(this.ea.path.child(e),this.firestore)},_c.prototype.isEqual=function(t){if(!(t instanceof _c))throw oa("isEqual","DocumentReference",1,t);return this.firestore===t.firestore&&this.ea.isEqual(t.ea)&&this.Ef===t.Ef},_c.prototype.set=function(t,e){Yu("DocumentReference.set",arguments,1,2),e=kc("DocumentReference.set",e);var n=Mc(this.Ef,t,"DocumentReference.set"),r=n[0],i=n[1],o=e.merge||e.mergeFields?this.firestore.rf.Yo(i,r,e.mergeFields):this.firestore.rf.Ko(i,r);return this.Z_.write(o.xo(this.ea,ji.dt()))},_c.prototype.update=function(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return n="string"==typeof t||t instanceof la?(Qu("DocumentReference.update",arguments,2),this.firestore.rf.Jo("DocumentReference.update",t,e,r)):(Wu("DocumentReference.update",arguments,1),this.firestore.rf.Xo("DocumentReference.update",t)),this.Z_.write(n.xo(this.ea,ji.exists(!0)))},_c.prototype.delete=function(){return Wu("DocumentReference.delete",arguments,0),this.Z_.write([new Hi(this.ea,ji.dt())])},_c.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Yu("DocumentReference.onSnapshot",arguments,1,4);var n,r={includeMetadataChanges:!1},i=0;"object"!=typeof t[i]||ic(t[i])||(ia("DocumentReference.onSnapshot",r=t[i],["includeMetadataChanges"]),Ju("DocumentReference.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++);var o={includeMetadataChanges:r.includeMetadataChanges};return n=ic(t[i])?t[i]:(Zu("DocumentReference.onSnapshot","function",i,t[i]),Xu("DocumentReference.onSnapshot","function",i+1,t[i+1]),Xu("DocumentReference.onSnapshot","function",i+2,t[i+2]),{next:t[i],error:t[i+1],complete:t[i+2]}),this.Af(o,n)},_c.prototype.Af=function(t,n){var r=this,e=function(t){console.error("Uncaught Error in onSnapshot:",t)};n.error&&(e=n.error.bind(n));var i=new Zh({next:function(t){if(n.next){var e=t.docs.get(r.ea);n.next(new yc(r.firestore,r.ea,e,t.fromCache,t.hasPendingWrites,r.Ef))}},error:e}),o=this.Z_.listen(No.Wt(this.ea.path),i,t);return function(){i.B_(),r.Z_.yu(o)}},_c.prototype.get=function(n){var r=this;return Yu("DocumentReference.get",arguments,0,1),Vc("DocumentReference.get",n),new Promise(function(e,t){n&&"cache"===n.source?r.firestore.J_().q_(r.ea).then(function(t){e(new yc(r.firestore,r.ea,t,!0,t instanceof Eo&&t.At,r.Ef))},t):r.Pf(e,t,n)})},_c.prototype.Pf=function(e,n,r){var i=this.Af({includeMetadataChanges:!0,Rl:!0},{next:function(t){i(),!t.exists&&t.metadata.fromCache?n(new Sr(Rr.UNAVAILABLE,"Failed to get document because the client is offline.")):t.exists&&t.metadata.fromCache&&r&&"server"===r.source?n(new Sr(Rr.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.)')):e(t)},error:n})},_c.prototype.withConverter=function(t){return new _c(this.ea,this.firestore,t)},_c),dc=(Nc.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},Nc),yc=(Ac.prototype.data=function(t){if(Yu("DocumentSnapshot.data",arguments,0,1),t=Lc("DocumentSnapshot.data",t),this.Vf){if(this.Ef){var e=new vc(this.wf,this.ea,this.Vf,this.pf,this.yf);return this.Ef.fromFirestore(e,t)}return new uc(this.wf,this.wf.df(),t.serverTimestamps,void 0).Q_(this.Vf.Lt())}},Ac.prototype.get=function(t,e){if(Yu("DocumentSnapshot.get",arguments,1,2),e=Lc("DocumentSnapshot.get",e),this.Vf){var n=this.Vf.data().field(Ya("DocumentSnapshot.get",t));if(null!==n)return new uc(this.wf,this.wf.df(),e.serverTimestamps,this.Ef).Q_(n)}},Object.defineProperty(Ac.prototype,"id",{get:function(){return this.ea.path.q()},enumerable:!0,configurable:!0}),Object.defineProperty(Ac.prototype,"ref",{get:function(){return new pc(this.ea,this.wf,this.Ef)},enumerable:!0,configurable:!0}),Object.defineProperty(Ac.prototype,"exists",{get:function(){return null!==this.Vf},enumerable:!0,configurable:!0}),Object.defineProperty(Ac.prototype,"metadata",{get:function(){return new dc(this.yf,this.pf)},enumerable:!0,configurable:!0}),Ac.prototype.isEqual=function(t){if(!(t instanceof Ac))throw oa("isEqual","DocumentSnapshot",1,t);return this.wf===t.wf&&this.pf===t.pf&&this.ea.isEqual(t.ea)&&(null===this.Vf?null===t.Vf:this.Vf.isEqual(t.Vf))&&this.Ef===t.Ef},Ac),vc=(n(Tc,sc=yc),Tc.prototype.data=function(t){return sc.prototype.data.call(this,t)},Tc),gc=(Ic.prototype.where=function(t,e,n){Wu("Query.where",arguments,3),ra("Query.where",3,n);var r,i=function(t,e){if(!t.some(function(t){return t===e}))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid value "+na(e)+" provided to function Query.where() for its "+ua(2)+" argument. Acceptable values: "+t.join(", "));return e}(["<","<=","==",">=",">","array-contains","in","array-contains-any"],e),o=Ya("Query.where",t);if(o.Y()){if("array-contains"===i||"array-contains-any"===i)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i){this.bf(n,i);for(var s=[],u=0,a=n;u<a.length;u++){var h=a[u];s.push(this.vf(h))}r={arrayValue:{values:s}}}else r=this.vf(n)}else"in"!==i&&"array-contains-any"!==i||this.bf(n,i),r=this.firestore.rf.Zo("Query.where",n,"in"===i);var c=_o.create(o,i,r);return this.Sf(c),new Ic(this.gf.Ht(c),this.firestore,this.Ef)},Ic.prototype.orderBy=function(t,e){var n;if(Yu("Query.orderBy",arguments,1,2),Xu("Query.orderBy","non-empty string",2,e),void 0===e||"asc"===e)n="asc";else{if("desc"!==e)throw new Sr(Rr.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+e+"', expected 'asc' or 'desc'.");n="desc"}if(null!==this.gf.startAt)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");if(null!==this.gf.endAt)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");var r=Ya("Query.orderBy",t),i=new Lo(r,n);return this.Cf(i),new Ic(this.gf.Kt(i),this.firestore,this.Ef)},Ic.prototype.limit=function(t){return Wu("Query.limit",arguments,1),Zu("Query.limit","number",1,t),sa("Query.limit",1,t),new Ic(this.gf.zt(t),this.firestore,this.Ef)},Ic.prototype.limitToLast=function(t){return Wu("Query.limitToLast",arguments,1),Zu("Query.limitToLast","number",1,t),sa("Query.limitToLast",1,t),new Ic(this.gf.Yt(t),this.firestore,this.Ef)},Ic.prototype.startAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];Qu("Query.startAt",arguments,1);var r=this.Df("Query.startAt",t,e,!0);return new Ic(this.gf.Xt(r),this.firestore,this.Ef)},Ic.prototype.startAfter=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];Qu("Query.startAfter",arguments,1);var r=this.Df("Query.startAfter",t,e,!1);return new Ic(this.gf.Xt(r),this.firestore,this.Ef)},Ic.prototype.endBefore=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];Qu("Query.endBefore",arguments,1);var r=this.Df("Query.endBefore",t,e,!0);return new Ic(this.gf.Jt(r),this.firestore,this.Ef)},Ic.prototype.endAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];Qu("Query.endAt",arguments,1);var r=this.Df("Query.endAt",t,e,!1);return new Ic(this.gf.Jt(r),this.firestore,this.Ef)},Ic.prototype.isEqual=function(t){if(!(t instanceof Ic))throw oa("isEqual","Query",1,t);return this.firestore===t.firestore&&this.gf.isEqual(t.gf)},Ic.prototype.withConverter=function(t){return new Ic(this.gf,this.firestore,t)},Ic.prototype.Df=function(t,e,n,r){if(ra(t,1,e),e instanceof yc){if(0<n.length)throw new Sr(Rr.INVALID_ARGUMENT,"Too many arguments provided to "+t+"().");var i=e;if(!i.exists)throw new Sr(Rr.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+t+"().");return this.Ff(i.Vf,r)}var o=[e].concat(n);return this.Nf(t,o,r)},Ic.prototype.Ff=function(t,e){for(var n=[],r=0,i=this.gf.orderBy;r<i.length;r++){var o=i[r];if(o.field.Y())n.push(gi(this.firestore.ta,t.key));else{var s=t.field(o.field);if(oi(s))throw new Sr(Rr.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+o.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===s){var u=o.field.j();throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+u+"' (used as the orderBy) does not exist.")}n.push(s)}}return new ko(n,e)},Ic.prototype.Nf=function(t,e,n){var r=this.gf.Mt;if(e.length>r.length)throw new Sr(Rr.INVALID_ARGUMENT,"Too many arguments provided to "+t+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var i=[],o=0;o<e.length;o++){var s=e[o];if(r[o].field.Y()){if("string"!=typeof s)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+t+"(), but got a "+typeof s);if(!this.gf.le()&&-1!==s.indexOf("/"))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+t+"() must be a plain document ID, but '"+s+"' contains a slash.");var u=this.gf.path.child(Mr.G(s));if(!Xr.et(u))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+t+"() must result in a valid document path, but '"+u+"' is not because it contains an odd number of segments.");var a=new Xr(u);i.push(gi(this.firestore.ta,a))}else{var h=this.firestore.rf.Zo(t,s);i.push(h)}}return new ko(i,n)},Ic.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Yu("Query.onSnapshot",arguments,1,4);var n,r={},i=0;return"object"!=typeof t[i]||ic(t[i])||(ia("Query.onSnapshot",r=t[i],["includeMetadataChanges"]),Ju("Query.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++),n=ic(t[i])?t[i]:(Zu("Query.onSnapshot","function",i,t[i]),Xu("Query.onSnapshot","function",i+1,t[i+1]),Xu("Query.onSnapshot","function",i+2,t[i+2]),{next:t[i],error:t[i+1],complete:t[i+2]}),this.$f(this.gf),this.Af(r,n)},Ic.prototype.Af=function(t,e){var n=this,r=function(t){console.error("Uncaught Error in onSnapshot:",t)};e.error&&(r=e.error.bind(e));var i=new Zh({next:function(t){e.next&&e.next(new mc(n.firestore,n.gf,t,n.Ef))},error:r}),o=this.firestore.J_(),s=o.listen(this.gf,i,t);return function(){i.B_(),o.yu(s)}},Ic.prototype.$f=function(t){if(t.ae()&&0===t.Mt.length)throw new Sr(Rr.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")},Ic.prototype.get=function(n){var r=this;return Yu("Query.get",arguments,0,1),Vc("Query.get",n),this.$f(this.gf),new Promise(function(e,t){n&&"cache"===n.source?r.firestore.J_().M_(r.gf).then(function(t){e(new mc(r.firestore,r.gf,t,r.Ef))},t):r.Pf(e,t,n)})},Ic.prototype.Pf=function(e,n,r){var i=this.Af({includeMetadataChanges:!0,Rl:!0},{next:function(t){i(),t.metadata.fromCache&&r&&"server"===r.source?n(new Sr(Rr.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.)')):e(t)},error:n})},Ic.prototype.vf=function(t){if("string"==typeof t){if(""===t)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!this.gf.le()&&-1!==t.indexOf("/"))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+t+"' contains a '/' character.");var e=this.gf.path.child(Mr.G(t));if(!Xr.et(e))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '"+e+"' is not because it has an odd number of segments ("+e.length+").");return gi(this.firestore.ta,new Xr(e))}if(t instanceof pc){var n=t;return gi(this.firestore.ta,n.ea)}throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+na(t)+".")},Ic.prototype.bf=function(t,e){if(!Array.isArray(t)||0===t.length)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.");if(0<=t.indexOf(null))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'null' in the value array.");if(0<t.filter(function(t){return Number.isNaN(t)}).length)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters cannot contain 'NaN' in the value array.")},Ic.prototype.Sf=function(t){if(t instanceof _o){var e=["array-contains","array-contains-any"],n=["in","array-contains-any"],r=0<=e.indexOf(t.op),i=0<=n.indexOf(t.op);if(t.ue()){var o=this.gf.jt();if(null!==o&&!o.isEqual(t.field))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+o.toString()+"' and '"+t.field.toString()+"'");var s=this.gf.Gt();null!==s&&this.kf(t.field,s)}else if(i||r){var u=null;if(i&&(u=this.gf.ce(n)),null===u&&r&&(u=this.gf.ce(e)),null!=u)throw u===t.op?new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+t.op.toString()+"' filter."):new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You cannot use '"+t.op.toString()+"' filters with '"+u.toString()+"' filters.")}}},Ic.prototype.Cf=function(t){if(null===this.gf.Gt()){var e=this.gf.jt();null!==e&&this.kf(e,t.field)}},Ic.prototype.kf=function(t,e){if(!e.isEqual(t))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+t.toString()+"' and so you must also use '"+t.toString()+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+e.toString()+"' instead.")},Ic),mc=(Object.defineProperty(Ec.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),Object.defineProperty(Ec.prototype,"empty",{get:function(){return this.Of.docs.M()},enumerable:!0,configurable:!0}),Object.defineProperty(Ec.prototype,"size",{get:function(){return this.Of.docs.size},enumerable:!0,configurable:!0}),Ec.prototype.forEach=function(e,n){var r=this;Yu("QuerySnapshot.forEach",arguments,1,2),Zu("QuerySnapshot.forEach","function",1,e),this.Of.docs.forEach(function(t){e.call(n,r.xf(t))})},Object.defineProperty(Ec.prototype,"query",{get:function(){return new gc(this.Lf,this.wf,this.Ef)},enumerable:!0,configurable:!0}),Ec.prototype.docChanges=function(t){t&&(ia("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),Ju("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.Of.hs)throw new Sr(Rr.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.qf&&this.Mf===e||(this.qf=function(i,e,o,s){if(o.ss.M()){var n=0;return o.docChanges.map(function(t){var e=new vc(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s);return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var u=o.ss;return o.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new vc(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s),n=-1,r=-1;return 0!==t.type&&(n=u.indexOf(t.doc.key),u=u.delete(t.doc.key)),1!==t.type&&(r=(u=u.add(t.doc)).indexOf(t.doc.key)),{type:function(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ks()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.wf,e,this.Of,this.Ef),this.Mf=e),this.qf},Ec.prototype.isEqual=function(t){if(!(t instanceof Ec))throw oa("isEqual","QuerySnapshot",1,t);return this.wf===t.wf&&this.Lf.isEqual(t.Lf)&&this.Of.isEqual(t.Of)&&this.Ef===t.Ef},Ec.prototype.xf=function(t){return new vc(this.wf,t.key,t,this.metadata.fromCache,this.Of.ns.has(t.key),this.Ef)},Ec),wc=(n(bc,oc=gc),Object.defineProperty(bc.prototype,"id",{get:function(){return this.gf.path.q()},enumerable:!0,configurable:!0}),Object.defineProperty(bc.prototype,"parent",{get:function(){var t=this.gf.path.L();return t.M()?null:new pc(new Xr(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(bc.prototype,"path",{get:function(){return this.gf.path.j()},enumerable:!0,configurable:!0}),bc.prototype.doc=function(t){if(Yu("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=tu.cn()),Zu("CollectionReference.doc","non-empty string",1,t),""===t)throw new Sr(Rr.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=Mr.G(t);return pc.ff(this.gf.path.child(e),this.firestore,this.Ef)},bc.prototype.add=function(t){Wu("CollectionReference.add",arguments,1),Zu("CollectionReference.add","object",1,this.Ef?this.Ef.toFirestore(t):t);var e=this.doc();return e.set(t).then(function(){return e})},bc.prototype.withConverter=function(t){return new bc(this.Bf,this.firestore,t)},bc);function bc(t,e,n){var r=this;if(((r=oc.call(this,No.Wt(t),e,n)||this).Bf=t).length%2!=1)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.j()+" has "+t.length);return r}function Ec(t,e,n,r){this.wf=t,this.Lf=e,this.Of=n,this.Ef=r,this.qf=null,this.Mf=null,this.metadata=new dc(n.hasPendingWrites,n.fromCache)}function Ic(t,e,n){this.gf=t,this.firestore=e,this.Ef=n}function Tc(){return null!==sc&&sc.apply(this,arguments)||this}function Ac(t,e,n,r,i,o){this.wf=t,this.ea=e,this.Vf=n,this.pf=r,this.yf=i,this.Ef=o}function Nc(t,e){this.hasPendingWrites=t,this.fromCache=e}function _c(t,e,n){this.ea=t,this.firestore=e,this.Ef=n,this.Z_=this.firestore.J_()}function Rc(t){this.wf=t,this.mf=[],this.If=!1}function Sc(t,e){this.wf=t,this.Tf=e}function Dc(t,e,n){var r=this;if(void 0===n&&(n=new Qh),this.Y_=null,this.X_=new ku,this.INTERNAL={delete:function(){return d(r,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.J_(),[4,this.Z_.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var i=t;this.Y_=i,this.ta=Dc.tf(i),this.ef=i.name,this.sf=new Or(e)}else{var o=t;if(!o.projectId)throw new Sr(Rr.INVALID_ARGUMENT,"Must provide projectId");this.ta=new ou(o.projectId,o.database),this.ef="[DEFAULT]",this.sf=new Dr}this.if=n,this.nf=new hc({})}function Oc(t){var e,n,r,i;if(void 0===t.host){if(void 0!==t.ssl)throw new Sr(Rr.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else Ku("settings","non-empty string","host",t.host),this.host=t.host,Ju("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(ia("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","ignoreUndefinedProperties"]),Ju("settings","object","credentials",t.credentials),this.credentials=t.credentials,Ju("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),Ju("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),!0===t.timestampsInSnapshots?Zs("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&Zs("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(n=t.timestampsInSnapshots)||void 0===n||n,this.ignoreUndefinedProperties=null!==(r=t.ignoreUndefinedProperties)&&void 0!==r&&r,Ju("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=Mu.hh;else{if(t.cacheSizeBytes!==ac&&t.cacheSizeBytes<Mu.rh)throw new Sr(Rr.INVALID_ARGUMENT,"cacheSizeBytes must be at least "+Mu.rh);this.cacheSizeBytes=t.cacheSizeBytes}Ju("settings","boolean","experimentalForceLongPolling",t.experimentalForceLongPolling),this.forceLongPolling=null!==(i=t.experimentalForceLongPolling)&&void 0!==i&&i}function Pc(t,e,n,r){this.firestore=t,this.timestampsInSnapshots=e,this.U_=n,this.converter=r}function kc(t,e){if(void 0===e)return{merge:!1};if(ia(t,e,["merge","mergeFields"]),Ju(t,"boolean","merge",e.merge),n=t,void 0!==(r=e.mergeFields)&&function(t,e,n,r){if(!(n instanceof Array))throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+na(n));for(var i=0;i<n.length;++i)if(!r(n[i]))throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires all "+e+" elements to be a string or a FieldPath, but the value at index "+i+" was: "+na(n[i]))}(n,"mergeFields",r,function(t){return"string"==typeof t||t instanceof la}),void 0!==e.mergeFields&&void 0!==e.merge)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');var n,r;return e}function Lc(t,e){return void 0===e?{}:(ia(t,e,["serverTimestamps"]),$u(t,0,"serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function Vc(t,e){Xu(t,"object",1,e),e&&(ia(t,e,["source"]),$u(t,0,"source",e.source,["default","server","cache"]))}function Cc(t,e,n){if(e instanceof pc){if(e.firestore!==n)throw new Sr(Rr.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw oa(t,"DocumentReference",1,e)}function Mc(t,e,n){var r;return t?(r=t.toFirestore(e),n="toFirestore() in "+n):r=e,[r,n]}function Uc(t,e){function n(){var t="This constructor is private.";throw e&&(t+=" ",t+=e),new Sr(Rr.INVALID_ARGUMENT,t)}return n.prototype=t.prototype,Object.assign(n,t),n}var qc,xc=Uc(cc,"Use firebase.firestore() instead."),jc=Uc(fc,"Use firebase.firestore().runTransaction() instead."),Fc=Uc(lc,"Use firebase.firestore().batch() instead."),Gc=Uc(pc,"Use firebase.firestore().doc() instead."),Bc=Uc(yc),zc=Uc(vc),Hc=Uc(gc),Wc=Uc(mc),Qc=Uc(wc,"Use firebase.firestore().collection() instead."),Yc=Uc((af.delete=function(){return Hu("FieldValue.delete",arguments),new Ia},af.serverTimestamp=function(){return Hu("FieldValue.serverTimestamp",arguments),new Ta},af.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Qu("FieldValue.arrayUnion",arguments,1),new Aa(t)},af.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Qu("FieldValue.arrayRemove",arguments,1),new Na(t)},af.increment=function(t){return Zu("FieldValue.increment","number",1,t),Wu("FieldValue.increment",arguments,1),new _a(t)},af.prototype.isEqual=function(t){return this===t},af),"Use FieldValue.<field>() instead."),Zc=Uc(fa,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),Xc={Firestore:xc,GeoPoint:Ra,Timestamp:Lr,Blob:Zc,Transaction:jc,WriteBatch:Fc,DocumentReference:Gc,DocumentSnapshot:Bc,Query:Hc,QueryDocumentSnapshot:zc,QuerySnapshot:Wc,CollectionReference:Qc,FieldPath:la,FieldValue:Yc,setLogLevel:cc.setLogLevel,CACHE_SIZE_UNLIMITED:ac},Kc=(uf.prototype.ru=function(t){},uf.prototype.Vu=function(){},uf),Jc=(sf.prototype.ru=function(t){this.Gf.push(t)},sf.prototype.Vu=function(){window.removeEventListener("online",this.Uf),window.removeEventListener("offline",this.Wf)},sf.prototype.Hf=function(){window.addEventListener("online",this.Uf),window.addEventListener("offline",this.Wf)},sf.prototype.Qf=function(){Ys("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.Gf;t<e.length;t++)(0,e[t])(0)},sf.prototype.jf=function(){Ys("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.Gf;t<e.length;t++)(0,e[t])(1)},sf.Kf=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},sf),$c=(of.prototype.Aa=function(t){this.Xf=t},of.prototype.Ta=function(t){this.Jf=t},of.prototype.onMessage=function(t){this.Zf=t},of.prototype.close=function(){this.Yf()},of.prototype.send=function(t){this.zf(t)},of.prototype.td=function(){this.Xf()},of.prototype.ed=function(t){this.Jf(t)},of.prototype.sd=function(t){this.Zf(t)},of),tf={BatchGetDocuments:"batchGet",Commit:"commit"},ef="gl-js/ fire/"+Er,nf=(rf.prototype.rd=function(t,e){if(e)for(var n in e.o)e.o.hasOwnProperty(n)&&(t[n]=e.o[n]);t["X-Goog-Api-Client"]=ef},rf.prototype.Na=function(a,r,i){var h=this,c=this.hd(a);return new Promise(function(o,s){var u=new br;u.listenOnce(mr.COMPLETE,function(){try{switch(u.getLastErrorCode()){case gr.NO_ERROR:var t=u.getResponseJson();Ys("Connection","XHR received:",JSON.stringify(t)),o(t);break;case gr.TIMEOUT:Ys("Connection",'RPC "'+a+'" timed out'),s(new Sr(Rr.DEADLINE_EXCEEDED,"Request time out"));break;case gr.HTTP_ERROR:var e=u.getStatus();if(Ys("Connection",'RPC "'+a+'" failed with status:',e,"response text:",u.getResponseText()),0<e){var n=u.getResponseJson().error;if(n&&n.status&&n.message){var r=(i=n.status.toLowerCase().replace("_","-"),0<=Object.values(Rr).indexOf(i)?i:Rr.UNKNOWN);s(new Sr(r,n.message))}else s(new Sr(Rr.UNKNOWN,"Server responded with status "+u.getStatus()))}else Ys("Connection",'RPC "'+a+'" failed'),s(new Sr(Rr.UNAVAILABLE,"Connection failed."));break;default:Ks()}}finally{Ys("Connection",'RPC "'+a+'" completed.')}var i});var t=Object.assign({},r);delete t.database;var e=JSON.stringify(t);Ys("Connection","XHR sending: ",c+" "+e);var n={"Content-Type":"text/plain"};h.rd(n,i),u.send(c,"POST",e,n,15)})},rf.prototype.$a=function(t,e,n){return this.Na(t,e,n)},rf.prototype.Pa=function(t,e){var n,r,i=[this.nd,"/","google.firestore.v1.Firestore","/",t,"/channel"],o=vr(),s={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.ii.projectId+"/databases/"+this.ii.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this.rd(s.initMessageHeaders,e),"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(p())||"object"==typeof navigator&&"ReactNative"===navigator.product||0<=p().indexOf("Electron/")||0<=(r=p()).indexOf("MSIE ")||0<=r.indexOf("Trident/")||0<=p().indexOf("MSAppHost/")||"object"==typeof(n="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==n.id||(s.httpHeadersOverwriteParam="$httpHeaders");var u=i.join("");function a(t,e){h.listen(t,function(t){try{e(t)}catch(t){setTimeout(function(){throw t},0)}})}Ys("Connection","Creating WebChannel: "+u+" "+s);var h=o.createWebChannel(u,s),c=!1,f=!1,l=new $c({zf:function(t){f?Ys("Connection","Not sending because WebChannel is closed:",t):(c||(Ys("Connection","Opening WebChannel transport."),h.open(),c=!0),Ys("Connection","WebChannel sending:",t),h.send(t))},Yf:function(){return h.close()}});return a(wr.EventType.OPEN,function(){f||Ys("Connection","WebChannel transport opened.")}),a(wr.EventType.CLOSE,function(){f||(f=!0,Ys("Connection","WebChannel transport closed"),l.ed())}),a(wr.EventType.ERROR,function(t){f||(f=!0,Ys("Connection","WebChannel transport errored:",t),l.ed(new Sr(Rr.UNAVAILABLE,"The operation could not be completed")))}),a(wr.EventType.MESSAGE,function(t){var e;if(!f){var n=t.data[0];Js(!!n);var r=n.error||(null===(e=n[0])||void 0===e?void 0:e.error);if(r){Ys("Connection","WebChannel received error:",r);var i=r.status,o=function(){var t=ho[i];if(void 0!==t)return Xo(t)}(),s=r.message;void 0===o&&(o=Rr.INTERNAL,s="Unknown error status: "+i+" with message "+r.message),f=!0,l.ed(new Sr(o,s)),h.close()}else Ys("Connection","WebChannel received:",n),l.sd(n)}}),setTimeout(function(){l.td()},0),l},rf.prototype.hd=function(t){var e=tf[t];return this.nd+"/v1/projects/"+this.ii.projectId+"/databases/"+this.ii.database+"/documents:"+e},rf);function rf(t){this.ii=t.ii;var e=t.ssl?"https":"http";this.nd=e+"://"+t.host,this.forceLongPolling=t.forceLongPolling}function of(t){this.zf=t.zf,this.Yf=t.Yf}function sf(){var t=this;this.Uf=function(){return t.Qf()},this.Wf=function(){return t.jf()},this.Gf=[],this.Hf()}function uf(){}function af(){}function hf(){this.vo="undefined"!=typeof atob}Bs.an((Object.defineProperty(hf.prototype,"document",{get:function(){return"undefined"!=typeof document?document:null},enumerable:!0,configurable:!0}),Object.defineProperty(hf.prototype,"window",{get:function(){return"undefined"!=typeof window?window:null},enumerable:!0,configurable:!0}),hf.prototype.D_=function(t){return Promise.resolve(new nf(t))},hf.prototype.b_=function(){return new(Jc.Kf()?Jc:Kc)},hf.prototype.Ho=function(t){return new js(t,{hi:!0})},hf.prototype.un=function(t){return JSON.stringify(t)},hf.prototype.atob=function(t){return atob(t)},hf.prototype.btoa=function(t){return btoa(t)},hf.prototype.ln=function(t){var e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e)e.getRandomValues(n);else for(var r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n},new hf)),(qc=cf).INTERNAL.registerComponent(new E("firestore",function(t){return e=t.getProvider("app").getImmediate(),n=t.getProvider("auth-internal"),new cc(e,n,new Qh);var e,n},"PUBLIC").setServiceProps(Object.assign({},Xc))),qc.registerVersion("@firebase/firestore","1.14.6")}).apply(this,arguments)}catch(t){throw console.error(t),new Error("Cannot instantiate firebase-firestore.memory.js - be sure to load firebase-app.js first.")}});
//# sourceMappingURL=firebase-firestore.memory.js.map