!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).firebase)}(this,function(Bf){"use strict";try{(function(){function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u,e=t(Bf),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 y(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 v(n,r){var i,o,s,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"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;for(var r=Array(t),i=0,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;for(var r=Array(t),i=0,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}(Ie=u=u||{})[Ie.DEBUG=0]="DEBUG",Ie[Ie.VERBOSE=1]="VERBOSE",Ie[Ie.INFO=2]="INFO",Ie[Ie.WARN=3]="WARN",Ie[Ie.ERROR=4]="ERROR",Ie[Ie.SILENT=5]="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=c[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={debug:u.DEBUG,verbose:u.VERBOSE,info:u.INFO,warn:u.WARN,error:u.ERROR,silent:u.SILENT},h=u.INFO,c=((Te={})[u.DEBUG]="log",Te[u.VERBOSE]="log",Te[u.INFO]="info",Te[u.WARN]="warn",Te[u.ERROR]="error",Te),l=(Object.defineProperty(f.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in u))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),f.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?a[t]:t},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:!1,configurable:!0}),Object.defineProperty(f.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,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=h,this._logHandler=o,this._userLogHandler=null}function p(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}var d,g="FirebaseError",m=(n(w,d=Error),w);function w(t,e,n){e=d.call(this,e)||this;return e.code=t,e.customData=n,e.name=g,Object.setPrototypeOf(e,w.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,b.prototype.create),e}var b=(E.prototype.create=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r,i=e[0]||{},o=this.service+"/"+t,t=this.errors[t],t=t?(r=i,t.replace(I,function(t,e){var n=r[e];return null!=n?String(n):"<"+e+"?>"})):"Error",t=this.serviceName+": "+t+" ("+o+").";return new m(o,t,i)},E);function E(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var I=/\{\$([^}]+)}/g,T=function(t,e){return(T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)};function A(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 N,O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},S={},P=O||self;function L(){}function k(t){var e=typeof t;return"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}function R(t){var e=k(t);return"array"==e||"object"==e&&"number"==typeof t.length}function D(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var _="closure_uid_"+(1e9*Math.random()>>>0),V=0;function C(t,e,n){return t.call.apply(t.bind,arguments)}function x(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 U(t,e,n){return(U=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?C:x).apply(null,arguments)}function M(e){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 j(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t}function F(){this.j=this.j,this.i=this.i}F.prototype.j=!1,F.prototype.ja=function(){var t;!this.j&&(this.j=!0,this.G(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,_)&&t[_]||(t[_]=++V))},F.prototype.G=function(){if(this.i)for(;this.i.length;)this.i.shift()()};var B=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 W(){return Array.prototype.concat.apply([],arguments)}function H(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 z(t){return/^[\s\xa0]*$/.test(t)}var X,Q=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function $(t,e){return-1!=t.indexOf(e)}function Y(t,e){return t<e?-1:e<t?1:0}t:{var K=P.navigator;if(K){K=K.userAgent;if(K){X=K;break t}}X=""}function Z(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function J(t){var e,n={};for(e in t)n[e]=t[e];return n}var tt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function et(t){for(var e,n,r=1;r<arguments.length;r++){for(e in n=arguments[r])t[e]=n[e];for(var i=0;i<tt.length;i++)e=tt[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function nt(t){return nt[" "](t),t}nt[" "]=L;var rt,it=$(X,"Opera"),ot=$(X,"Trident")||$(X,"MSIE"),st=$(X,"Edge"),ut=st||ot,at=$(X,"Gecko")&&!($(X.toLowerCase(),"webkit")&&!$(X,"Edge"))&&!($(X,"Trident")||$(X,"MSIE"))&&!$(X,"Edge"),ht=$(X.toLowerCase(),"webkit")&&!$(X,"Edge");function ct(){var t=P.document;return t?t.documentMode:void 0}t:{var lt="",ft=(ft=X,at?/rv:([^\);]+)(\)|;)/.exec(ft):st?/Edge\/([\d\.]+)/.exec(ft):ot?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(ft):ht?/WebKit\/(\S+)/.exec(ft):it?/(?:Version)[ \/]?(\S+)/.exec(ft):void 0);if(ft&&(lt=ft?ft[1]:""),ot){ft=ct();if(null!=ft&&ft>parseFloat(lt)){rt=String(ft);break t}}rt=lt}var pt={};function dt(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=Y(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||Y(0==o[2].length,0==s[2].length)||Y(o[2],s[2]),o=o[3],s=s[3]}while(0==t)}return 0<=t},n=pt,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t);var t,e,n}var yt=P.document&&ot?ct()||(parseInt(rt,10)||void 0):void 0,vt=!ot||9<=Number(yt),gt=ot&&!dt("9"),mt=function(){if(!P.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{P.addEventListener("test",L,e),P.removeEventListener("test",L,e)}catch(t){}return t}();function wt(t,e){this.type=t,this.a=this.target=e,this.defaultPrevented=!1}function bt(t,e){if(wt.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(at){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:Et[t.pointerType]||"",(this.c=t).defaultPrevented&&this.b()}}wt.prototype.b=function(){this.defaultPrevented=!0},j(bt,wt);var Et={2:"touch",3:"pen",4:"mouse"};bt.prototype.b=function(){bt.X.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,gt)try{(t.ctrlKey||112<=t.keyCode&&t.keyCode<=123)&&(t.keyCode=-1)}catch(t){}};var It="closure_listenable_"+(1e6*Math.random()|0),Tt=0;function At(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ca=i,this.key=++Tt,this.Y=this.Z=!1}function Nt(t){t.Y=!0,t.listener=null,t.proxy=null,t.src=null,t.ca=null}function Ot(t){this.src=t,this.a={},this.b=0}function St(t,e){var n,r,i,o=e.type;o in t.a&&(n=t.a[o],(i=0<=(r=B(n,e)))&&Array.prototype.splice.call(n,r,1),i&&(Nt(e),0==t.a[o].length&&(delete t.a[o],t.b--)))}function Pt(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.Y&&o.listener==e&&o.capture==!!n&&o.ca==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=Pt(t,e,r,i);return-1<s?(e=t[s],n||(e.Z=!1)):((e=new At(e,this.src,o,!!r,i)).Z=n,t.push(e)),e};var Lt="closure_lm_"+(1e6*Math.random()|0),kt={};function Rt(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=qt(r);return e&&e[It]?e.wa(n,r,D(i)?!!i.capture:!!i,o):Dt(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)Rt(t,e[o],n,r,i);return null}return n=qt(n),t&&t[It]?t.va(e,n,D(r)?!!r.capture:!!r,i):Dt(t,e,n,!1,r,i)}function Dt(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s=D(i)?!!i.capture:!!i;if(s&&!vt)return null;var u,a,h=Ut(t);if(h||(t[Lt]=h=new Ot(t)),(n=h.add(e,n,r,s,o)).proxy)return n;if(u=xt,r=a=vt?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)mt||(i=s),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Vt(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function _t(t){var e,n,r;"number"!=typeof t&&t&&!t.Y&&((e=t.src)&&e[It]?St(e.c,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Vt(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Ut(e))?(St(n,t),0==n.b&&(n.src=null,e[Lt]=null)):Nt(t)))}function Vt(t){return t in kt?kt[t]:kt[t]="on"+t}function Ct(t,e){var n=t.listener,r=t.ca||t.src;return t.Z&&_t(t),n.call(r,e)}function xt(t,e){if(t.Y)return!0;if(vt)return Ct(t,new bt(e,this));if(!e)t:{e=["window","event"];for(var n=P,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}return Ct(t,e=new bt(e,this))}function Ut(t){return(t=t[Lt])instanceof Ot?t:null}var Mt="__closure_events_fn_"+(1e9*Math.random()>>>0);function qt(e){return"function"==k(e)?e:(e[Mt]||(e[Mt]=function(t){return e.handleEvent(t)}),e[Mt])}function jt(){F.call(this),this.c=new Ot(this),(this.J=this).C=null}function Ft(t,e){var n,r=t.C;if(r)for(n=[];r;r=r.C)n.push(r);if(t=t.J,r=e.type||e,"string"==typeof e?e=new wt(e,t):e instanceof wt?e.target=e.target||t:(s=e,et(e=new wt(r,t),s)),s=!0,n)for(var i=n.length-1;0<=i;i--)var o=e.a=n[i],s=Bt(o,r,!0,e)&&s;if(s=Bt(o=e.a=t,r,!0,e)&&s,s=Bt(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=Bt(o=e.a=n[i],r,!1,e)&&s}function Bt(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,u,a=e[o];a&&!a.Y&&a.capture==n&&(s=a.listener,u=a.ca||a.src,a.Z&&St(t.c,a),i=!1!==s.call(u,r)&&i)}return i&&!r.defaultPrevented}j(jt,F),jt.prototype[It]=!0,(N=jt.prototype).addEventListener=function(t,e,n,r){Rt(this,t,e,n,r)},N.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=D(i)?!!i.capture:!!i,r=qt(r),e&&e[It]?(e=e.c,(n=String(n).toString())in e.a&&-1<(r=Pt(s=e.a[n],r,i,o))&&(Nt(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.a[n],e.b--))):(e=e&&Ut(e))&&(n=e.a[n.toString()],e=-1,n&&(e=Pt(n,r,i,o)),(r=-1<e?n[e]:null)&&_t(r))}(this,t,e,n,r)},N.G=function(){if(jt.X.G.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++)Nt(n[r]);delete e.a[t],e.b--}}this.C=null},N.va=function(t,e,n,r){return this.c.add(String(t),e,!1,n,r)},N.wa=function(t,e,n,r){return this.c.add(String(t),e,!0,n,r)};var Gt=P.JSON.stringify;function Wt(){this.b=this.a=null}var Ht,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 Qt},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 Qt(){this.next=this.b=this.a=null}function $t(t,e){var n;Ht||(n=P.Promise.resolve(void 0),Ht=function(){n.then(Zt)}),Yt||(Ht(),Yt=!0),Kt.add(t,e)}Wt.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},Qt.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null};var Yt=!(Qt.prototype.reset=function(){this.next=this.b=this.a=null}),Kt=new Wt;function Zt(){for(var t,e;n=e=void 0,n=null,(e=Kt).a&&(n=e.a,e.a=e.a.next,e.a||(e.b=null),n.next=null),t=n;){try{t.a.call(t.b)}catch(t){!function(t){P.setTimeout(function(){throw t},0)}(t)}var n=zt;n.g(t),n.b<n.f&&(n.b++,t.next=n.a,n.a=t)}Yt=!1}function Jt(t,e){jt.call(this),this.b=t||1,this.a=e||P,this.f=U(this.Xa,this),this.g=q()}function te(t){t.aa=!1,t.M&&(t.a.clearTimeout(t.M),t.M=null)}function ee(t,e,n){if("function"==k(t))n&&(t=U(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=U(t.handleEvent,t)}return 2147483647<Number(e)?-1:P.setTimeout(t,e||0)}j(Jt,jt),(N=Jt.prototype).aa=!1,N.M=null,N.Xa=function(){var t;this.aa&&(0<(t=q()-this.g)&&t<.8*this.b?this.M=this.a.setTimeout(this.f,this.b-t):(this.M&&(this.a.clearTimeout(this.M),this.M=null),Ft(this,"tick"),this.aa&&(te(this),this.start())))},N.start=function(){this.aa=!0,this.M||(this.M=this.a.setTimeout(this.f,this.b),this.g=q())},N.G=function(){Jt.X.G.call(this),te(this),delete this.a};var ne,re,ie,oe=(T(re=ue,ie=ne=F),re.prototype=null===ie?Object.create(ie):(se.prototype=ie.prototype,new se),ue.prototype.f=function(t){this.b=arguments,this.a?this.c=!0:function t(e){e.a=ee(function(){e.a=null,e.c&&(e.c=!1,t(e))},e.h);var n=e.b;e.b=null,e.g.apply(null,n)}(this)},ue.prototype.G=function(){ne.prototype.G.call(this),this.a&&(P.clearTimeout(this.a),this.a=null,this.c=!1,this.b=null)},ue);function se(){this.constructor=re}function ue(t,e,n){var r=ne.call(this)||this;return r.g=null!=n?t.bind(n):t,r.h=e,r.b=null,r.c=!1,r.a=null,r}function ae(t){F.call(this),this.b=t,this.a={}}j(ae,F);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=Rt(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function le(t){Z(t.a,function(t,e){this.a.hasOwnProperty(e)&&_t(t)},t),t.a={}}function fe(){this.a=!0}function pe(t,e,n,r){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.a)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(r.length<2)){var i=r[1];if(Array.isArray(i)&&!(i.length<1)){r=i[0];if("noop"!=r&&"stop"!=r&&"close"!=r)for(var o=1;o<i.length;o++)i[o]=""}}}return Gt(n)}catch(t){return e}}(t,n)+(r?" "+r:"")})}ae.prototype.G=function(){ae.X.G.call(this),le(this)},ae.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},fe.prototype.info=function(){};var de=null;function ye(){return de=de||new jt}function ve(t){wt.call(this,"serverreachability",t)}function ge(t){var e=ye();Ft(e,new ve(e))}function me(t){wt.call(this,"statevent",t)}function we(t){var e=ye();Ft(e,new me(e))}function be(t){wt.call(this,"timingevent",t)}function Ee(t,e){if("function"!=k(t))throw Error("Fn must not be null and must be a function");return P.setTimeout(function(){t()},e)}j(ve,wt),j(me,wt),j(be,wt);var Ie={NO_ERROR:0,Ya:1,fb:2,eb:3,ab:4,cb:5,gb:6,Da:7,TIMEOUT:8,jb:9},Te={$a:"complete",nb:"success",Ea:"error",Da:"abort",lb:"ready",mb:"readystatechange",TIMEOUT:"timeout",hb:"incrementaldata",kb:"progress",bb:"downloadprogress",ob:"uploadprogress"};function Ae(){}function Ne(t){var e;return(e=t.a)||(e=t.a={}),e}function Oe(){}Ae.prototype.a=null;var Se,O={OPEN:"a",Za:"b",Ea:"c",ib:"d"};function Pe(){wt.call(this,"d")}function Le(){wt.call(this,"c")}function ke(){}function Re(t,e,n,r){this.g=t,this.c=e,this.f=n,this.S=r||1,this.J=new ae(this),this.P=De,t=ut?125:void 0,this.R=new Jt(t),this.B=null,this.b=!1,this.j=this.l=this.i=this.H=this.u=this.T=this.o=null,this.s=[],this.a=null,this.D=0,this.h=this.m=null,this.N=-1,this.A=!1,this.O=0,this.F=null,this.V=this.C=this.U=this.I=!1}j(Pe,wt),j(Le,wt),j(ke,Ae),Se=new ke;var De=45e3,_e={},Ve={};function Ce(t,e,n){t.H=1,t.i=nn(Ye(e)),t.j=n,t.I=!0,xe(t,null)}function xe(t,e){t.u=q(),Me(t),t.l=Ye(t.i);var s,u,a,h,c,l,n=t.l,r=t.S;Array.isArray(r)||(r=[String(r)]),vn(n.b,"t",r),t.D=0,t.a=hr(t.g,t.g.C?e:null),0<t.O&&(t.F=new oe(U(t.Ca,t,t.a),t.O)),ce(t.J,t.a,"readystatechange",t.Va),e=t.B?J(t.B):{},t.j?(t.m||(t.m="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.a.ba(t.l,t.m,t.j,e)):(t.m="GET",t.a.ba(t.l,t.m,null,e)),ge(1),s=t.c,u=t.m,a=t.l,h=t.f,c=t.S,l=t.j,s.info(function(){if(s.a)if(l)for(var t="",e=l.split("&"),n=0;n<e.length;n++){var r,i,o=e[n].split("=");1<o.length&&(r=o[0],o=o[1],t=2<=(i=r.split("_")).length&&"type"==i[1]?t+(r+"=")+o+"&":t+(r+"=redacted&"))}else t=null;else t=l;return"XMLHTTP REQ ("+h+") [attempt "+c+"]: "+u+"\n"+a+"\n"+t})}function Ue(t,e,n){for(var r,i,o,s=!0;!t.A&&t.D<n.length;){var u=(u=n,o=i=void 0,i=(r=t).D,-1==(o=u.indexOf("\n",i))?Ve:(i=Number(u.substring(i,o)),isNaN(i)?_e:(o+=1)+i>u.length?Ve:(u=u.substr(o,i),r.D=o+i,u)));if(u==Ve){4==e&&(t.h=4,we(14),s=!1),pe(t.c,t.f,null,"[Incomplete Response]");break}if(u==_e){t.h=4,we(15),pe(t.c,t.f,n,"[Invalid Chunk]"),s=!1;break}pe(t.c,t.f,u,null),Ge(t,u)}4==e&&0==n.length&&(t.h=1,we(16),s=!1),t.b=t.b&&s,s?0<n.length&&!t.V&&(t.V=!0,(e=t.g).a==t&&e.U&&!e.F&&(e.c.info("Great, no buffering proxy detected. Bytes received: "+n.length),er(e),e.F=!0,we(11))):(pe(t.c,t.f,n,"[Invalid Chunked Response]"),Be(t),Fe(t))}function Me(t){t.T=q()+t.P,qe(t,t.P)}function qe(t,e){if(null!=t.o)throw Error("WatchDog timer not null");t.o=Ee(U(t.Ta,t),e)}function je(t){t.o&&(P.clearTimeout(t.o),t.o=null)}function Fe(t){0==t.g.v||t.A||ir(t.g,t)}function Be(t){je(t);var e=t.F;e&&"function"==typeof e.ja&&e.ja(),t.F=null,te(t.R),le(t.J),t.a&&(e=t.a,t.a=null,e.abort(),e.ja())}function Ge(t,e){try{var n,r,i,o,s,u=t.g;if(0!=u.v&&(u.a==t||Tn(u.b,t)))if(u.I=t.N,!t.C&&Tn(u.b,t)&&3==u.v){try{var a=u.ka.a.parse(e)}catch(t){a=null}if(Array.isArray(a)&&3==a.length){var h=a;if(0==h[0]){t:if(!u.j){if(u.a){if(!(u.a.u+3e3<t.u))break t;rr(u),zn(u)}tr(u),we(18)}}else u.oa=h[1],0<u.oa-u.P&&h[2]<37500&&u.H&&0==u.o&&!u.m&&(u.m=Ee(U(u.Qa,u),6e3));if(In(u.b)<=1&&u.ea){try{u.ea()}catch(t){}u.ea=void 0}}else sr(u,11)}else if(!t.C&&u.a!=t||rr(u),!z(e))for(e=a=u.ka.a.parse(e),a=0;a<e.length;a++){h=e[a],u.P=h[0],h=h[1],2==u.v?"c"==h[0]?(u.J=h[1],u.ga=h[2],null!=(r=h[3])&&(u.ha=r,u.c.info("VER="+u.ha)),null!=(o=h[4])&&(u.pa=o,u.c.info("SVER="+u.pa)),null!=(r=h[5])&&"number"==typeof r&&0<r&&(n=1.5*r,u.D=n,u.c.info("backChannelRequestTimeoutMs_="+n)),n=u,(o=t.a)&&(!(r=o.a?o.a.getResponseHeader("X-Client-Wire-Protocol"):null)||!(i=n.b).a&&($(r,"spdy")||$(r,"quic")||$(r,"h2"))&&(i.f=i.g,i.a=new Set,i.b&&(An(i,i.b),i.b=null)),!n.A||(s=o.a?o.a.getResponseHeader("X-HTTP-Session-Id"):null)&&(n.na=s,en(n.B,n.A,s))),u.v=3,u.f&&u.f.ta(),u.U&&(u.N=q()-t.u,u.c.info("Handshake RTT: "+u.N+"ms")),i=t,(n=u).la=ar(n,n.C?n.ga:null,n.fa),i.C?(Nn(n.b,i),o=i,(s=n.D)&&o.setTimeout(s),o.o&&(je(o),Me(o)),n.a=i):Jn(n),0<u.g.length&&$n(u)):"stop"!=h[0]&&"close"!=h[0]||sr(u,7):3==u.v&&("stop"==h[0]||"close"==h[0]?"stop"==h[0]?sr(u,7):Hn(u):"noop"!=h[0]&&u.f&&u.f.sa(h),u.o=0)}ge(4)}catch(t){}}function We(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(R(t)||"string"==typeof t)G(t,e,void 0);else{if(t.L&&"function"==typeof t.L)var n=t.L();else if(t.K&&"function"==typeof t.K)n=void 0;else if(R(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.K&&"function"==typeof t.K)return t.K();if("string"==typeof t)return t.split("");if(R(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 He(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 He)for(n=t.L(),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 ze(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Xe(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){for(var i={},n=e=0;e<t.a.length;)Xe(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function Xe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(N=Re.prototype).setTimeout=function(t){this.P=t},N.Va=function(t){t=t.target;var e=this.F;e&&3==Fn(t)?e.f():this.Ca(t)},N.Ca=function(t){try{if(t==this.a)t:{var e=Fn(this.a),n=this.a.ua(),r=this.a.W();if(!(e<3||3==e&&!ut&&!this.a.$())){this.A||4!=e||7==n||ge(8==n||r<=0?3:2),je(this);var i=this.a.W();this.N=i;n=this.a.$();if(this.b=200==i,r=this.c,u=this.m,a=this.l,h=this.f,c=this.S,l=e,f=i,r.info(function(){return"XMLHTTP RESP ("+h+") [ attempt "+c+"]: "+u+"\n"+a+"\n"+l+" "+f}),this.b){if(this.U&&!this.C){e:{if(this.a){var o=this.a;if((o=o.a?o.a.getResponseHeader("X-HTTP-Initial-Response"):null)&&!z(o)){var s=o;break e}}s=null}if(!s){this.b=!1,this.h=3,we(12),Be(this),Fe(this);break t}pe(this.c,this.f,s,"Initial handshake response via X-HTTP-Initial-Response"),this.C=!0,Ge(this,s)}this.I?(Ue(this,e,n),ut&&this.b&&3==e&&(ce(this.J,this.R,"tick",this.Ua),this.R.start())):(pe(this.c,this.f,n,null),Ge(this,n)),4==e&&Be(this),this.b&&!this.A&&(4==e?ir(this.g,this):(this.b=!1,Me(this)))}else 400==i&&0<n.indexOf("Unknown SID")?(this.h=3,we(12)):(this.h=0,we(13)),Be(this),Fe(this)}}}catch(t){}var u,a,h,c,l,f},N.Ua=function(){var t,e;this.a&&(t=Fn(this.a),e=this.a.$(),this.D<e.length&&(je(this),Ue(this,t,e),this.b&&4!=t&&Me(this)))},N.cancel=function(){this.A=!0,Be(this)},N.Ta=function(){this.o=null;var t,e,n=q();0<=n-this.T?(t=this.c,e=this.l,t.info(function(){return"TIMEOUT: "+e}),2!=this.H&&(ge(3),we(17)),Be(this),this.h=2,Fe(this)):qe(this,this.T-n)},(N=He.prototype).K=function(){ze(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},N.L=function(){return ze(this),this.a.concat()},N.get=function(t,e){return Xe(this.b,t)?this.b[t]:e},N.set=function(t,e){Xe(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},N.forEach=function(t,e){for(var n=this.L(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Qe=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function $e(t,e){var n;this.c=this.j=this.f="",this.h=null,this.i=this.g="",this.a=!1,t instanceof $e?(this.a=void 0!==e?e:t.a,Ke(this,t.f),this.j=t.j,Ze(this,t.c),Je(this,t.h),this.g=t.g,e=t.b,(n=new fn).c=e.c,e.a&&(n.a=new He(e.a),n.b=e.b),tn(this,n),this.i=t.i):t&&(n=String(t).match(Qe))?(this.a=!!e,Ke(this,n[1]||"",!0),this.j=rn(n[2]||""),Ze(this,n[3]||"",!0),Je(this,n[4]),this.g=rn(n[5]||"",!0),tn(this,n[6]||"",!0),this.i=rn(n[7]||"")):(this.a=!!e,this.b=new fn(null,this.a))}function Ye(t){return new $e(t)}function Ke(t,e,n){t.f=n?rn(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function Ze(t,e,n){t.c=n?rn(e,!0):e}function Je(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 tn(t,e,n){var r,i;e instanceof fn?(t.b=e,r=t.b,(i=t.a)&&!r.f&&(pn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(dn(this,e),vn(this,n,t))},r)),r.f=i):(n||(e=on(e,cn)),t.b=new fn(e,t.a))}function en(t,e,n){t.b.set(e,n)}function nn(t){return en(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^q()).toString(36)),t}function rn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function on(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,sn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function sn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}$e.prototype.toString=function(){var t=[],e=this.f;e&&t.push(on(e,un,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(on(e,un,!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(on(n,"/"==n.charAt(0)?hn:an,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",on(n,ln)),t.join("")};var un=/[#\/\?@]/g,an=/[#\?:]/g,hn=/[#\?]/g,cn=/[#\?@]/g,ln=/#/g;function fn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function pn(n){n.a||(n.a=new He,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r,i=t[n].indexOf("="),o=null;0<=i?(r=t[n].substring(0,i),o=t[n].substring(i+1)):r=t[n],e(r,o?decodeURIComponent(o.replace(/\+/g," ")):"")}}}(n.c,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function dn(t,e){pn(t),e=gn(t,e),Xe(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Xe((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&ze(t)))}function yn(t,e){return pn(t),e=gn(t,e),Xe(t.a.b,e)}function vn(t,e,n){dn(t,e),0<n.length&&(t.c=null,t.a.set(gn(t,e),H(n)),t.b+=n.length)}function gn(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function mn(t,e){this.b=t,this.a=e}function wn(t){this.g=t||bn,t=P.PerformanceNavigationTiming?0<(t=P.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(P.ia&&P.ia.ya&&P.ia.ya()&&P.ia.ya().pb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Set),this.b=null,this.c=[]}(N=fn.prototype).add=function(t,e){pn(this),this.c=null,t=gn(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},N.forEach=function(n,r){pn(this),this.a.forEach(function(t,e){G(t,function(t){n.call(r,t,e,this)},this)},this)},N.L=function(){pn(this);for(var t=this.a.K(),e=this.a.L(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},N.K=function(t){pn(this);var e=[];if("string"==typeof t)yn(this,t)&&(e=W(e,this.a.get(gn(this,t))));else{t=this.a.K();for(var n=0;n<t.length;n++)e=W(e,t[n])}return e},N.set=function(t,e){return pn(this),this.c=null,yn(this,t=gn(this,t))&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},N.get=function(t,e){return t&&0<(t=this.K(t)).length?String(t[0]):e},N.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.L(),n=0;n<e.length;n++)for(var r=e[n],i=encodeURIComponent(String(r)),r=this.K(r),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 bn=10;function En(t){return t.b||t.a&&t.a.size>=t.f}function In(t){return t.b?1:t.a?t.a.size:0}function Tn(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function An(t,e){t.a?t.a.add(e):t.b=e}function Nn(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function On(t){var e,n;if(null!=t.b)return t.c.concat(t.b.s);if(null==t.a||0===t.a.size)return H(t.c);var r=t.c;try{for(var i=A(t.a.values()),o=i.next();!o.done;o=i.next())var s=o.value,r=r.concat(s.s)}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 Pn(){this.a=new Sn}function Ln(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}wn.prototype.cancel=function(){var e,t;if(this.c=On(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=A(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 P.JSON.stringify(t,void 0)},Sn.prototype.parse=function(t){return P.JSON.parse(t,void 0)};var kn=P.JSON.parse;function Rn(t){jt.call(this),this.headers=new He,this.H=t||null,this.b=!1,this.s=this.a=null,this.B="",this.h=0,this.f="",this.g=this.A=this.l=this.u=!1,this.o=0,this.m=null,this.I=Dn,this.D=this.F=!1}j(Rn,jt);var Dn="",_n=/^https?$/i,Vn=["POST","PUT"];function Cn(t){return"content-type"==t.toLowerCase()}function xn(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,Un(t),qn(t)}function Un(t){t.u||(t.u=!0,Ft(t,"complete"),Ft(t,"error"))}function Mn(t){if(t.b&&void 0!==S&&(!t.s[1]||4!=Fn(t)||2!=t.W()))if(t.l&&4==Fn(t))ee(t.za,0,t);else if(Ft(t,"readystatechange"),4==Fn(t)){t.b=!1;try{var e,n,r,i,o=t.W();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}if((e=s)||((n=0===o)&&(!(i=String(t.B).match(Qe)[1]||null)&&P.self&&P.self.location&&(i=(r=P.self.location.protocol).substr(0,r.length-1)),n=!_n.test(i?i.toLowerCase():"")),e=n),e)Ft(t,"complete"),Ft(t,"success");else{t.h=6;try{var u=2<Fn(t)?t.a.statusText:""}catch(t){u=""}t.f=u+" ["+t.W()+"]",Un(t)}}finally{qn(t)}}}function qn(t,e){if(t.a){jn(t);var n=t.a,r=t.s[0]?L:null;t.a=null,t.s=null,e||Ft(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function jn(t){t.a&&t.D&&(t.a.ontimeout=null),t.m&&(P.clearTimeout(t.m),t.m=null)}function Fn(t){return t.a?t.a.readyState:0}function Bn(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",Z(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):en(t,e,n))}function Gn(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Wn(t){this.pa=0,this.g=[],this.c=new fe,this.ga=this.la=this.B=this.fa=this.a=this.na=this.A=this.V=this.i=this.O=this.l=null,this.Ma=this.R=0,this.Ja=Gn("failFast",!1,t),this.H=this.m=this.j=this.h=this.f=null,this.S=!0,this.I=this.oa=this.P=-1,this.T=this.o=this.u=0,this.Fa=Gn("baseRetryDelayMs",5e3,t),this.Pa=Gn("retryDelaySeedMs",1e4,t),this.Ka=Gn("forwardChannelMaxRetries",2,t),this.ma=Gn("forwardChannelRequestTimeoutMs",2e4,t),this.La=t&&t.h||void 0,this.D=void 0,this.C=t&&t.supportsCrossDomainXhr||!1,this.J="",this.b=new wn(t&&t.concurrentRequestLimit),this.ka=new Pn,this.da=t&&t.fastHandshake||!1,this.Ga=t&&t.b||!1,t&&t.g&&(this.c.a=!1),t&&t.forceLongPolling&&(this.S=!1),this.U=!this.da&&this.S&&t&&t.c||!1,this.ea=void 0,this.N=0,this.F=!1,this.s=null,(this.Ia=t&&t.f||!1)&&this.c.info("Opt-in to enable Chrome Origin Trials.")}function Hn(t){var e,n;Xn(t),3==t.v&&(e=t.R++,en(n=Ye(t.B),"SID",t.J),en(n,"RID",e),en(n,"TYPE","terminate"),Kn(t,n),(e=new Re(t,t.c,e,void 0)).H=2,e.i=nn(Ye(n)),n=!1,P.navigator&&P.navigator.sendBeacon&&(n=P.navigator.sendBeacon(e.i.toString(),"")),!n&&P.Image&&((new Image).src=e.i,n=!0),n||(e.a=hr(e.g,null),e.a.ba(e.i)),e.u=q(),Me(e)),ur(t)}function zn(t){t.a&&(er(t),t.a.cancel(),t.a=null)}function Xn(t){zn(t),t.j&&(P.clearTimeout(t.j),t.j=null),rr(t),t.b.cancel(),t.h&&("number"==typeof t.h&&P.clearTimeout(t.h),t.h=null)}function Qn(t,e){t.g.push(new mn(t.Ma++,e)),3==t.v&&$n(t)}function $n(t){En(t.b)||t.h||(t.h=!0,$t(t.Ba,t),t.u=0)}function Yn(t,e){var n=e?e.f:t.R++,r=Ye(t.B);en(r,"SID",t.J),en(r,"RID",n),en(r,"AID",t.P),Kn(t,r),t.i&&t.l&&Bn(r,t.i,t.l),n=new Re(t,t.c,n,t.u+1),null===t.i&&(n.B=t.l),e&&(t.g=e.s.concat(t.g)),e=Zn(t,n,1e3),n.setTimeout(Math.round(.5*t.ma)+Math.round(.5*t.ma*Math.random())),An(t.b,n),Ce(n,r,e)}function Kn(t,n){t.f&&We({},function(t,e){en(n,e,t)})}function Zn(t,e,n){n=Math.min(t.g.length,n);var r=t.f?U(t.f.Ha,t.f,t):null;t:for(var i=t.g,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{!function(t,r,e){var i=e||"";try{We(t,function(t,e){var n=t;D(t)&&(n=Gt(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}(c,s,"req"+h+"_")}catch(t){r&&r(c)}}if(u){r=s.join("&");break t}}return t=t.g.splice(0,n),e.s=t,r}function Jn(t){t.a||t.j||(t.T=1,$t(t.Aa,t),t.o=0)}function tr(t){return!(t.a||t.j||3<=t.o)&&(t.T++,t.j=Ee(U(t.Aa,t),or(t,t.o)),t.o++,1)}function er(t){null!=t.s&&(P.clearTimeout(t.s),t.s=null)}function nr(t){t.a=new Re(t,t.c,"rpc",t.T),null===t.i&&(t.a.B=t.l),t.a.O=0;var e=Ye(t.la);en(e,"RID","rpc"),en(e,"SID",t.J),en(e,"CI",t.H?"0":"1"),en(e,"AID",t.P),Kn(t,e),en(e,"TYPE","xmlhttp"),t.i&&t.l&&Bn(e,t.i,t.l),t.D&&t.a.setTimeout(t.D);var n=t.a;t=t.ga,n.H=1,n.i=nn(Ye(e)),n.j=null,n.I=!0,xe(n,t)}function rr(t){null!=t.m&&(P.clearTimeout(t.m),t.m=null)}function ir(t,e){var n,r=null;if(t.a==e){rr(t),er(t),t.a=null;var i=2}else{if(!Tn(t.b,e))return;r=e.s,Nn(t.b,e),i=1}if(t.I=e.N,0!=t.v)if(e.b){1==i?(r=e.j?e.j.length:0,e=q()-e.u,n=t.u,Ft(i=ye(),new be(i)),$n(t)):Jn(t)}else if(3==(n=e.h)||0==n&&0<t.I||!(1==i&&function(t,e){if(!(In(t.b)>=t.b.f-(t.h?1:0))){if(t.h)return t.g=e.s.concat(t.g),1;if(!(1==t.v||2==t.v||t.u>=(t.Ja?0:t.Ka)))return t.h=Ee(U(t.Ba,t,e),or(t,t.u)),t.u++,1}}(t,e)||2==i&&tr(t)))switch(r&&0<r.length&&(e=t.b,e.c=e.c.concat(r)),n){case 1:sr(t,5);break;case 4:sr(t,10);break;case 3:sr(t,6);break;default:sr(t,2)}}function or(t,e){var n=t.Fa+Math.floor(Math.random()*t.Pa);return t.f||(n*=2),n*e}function sr(t,e){var n,r,i,o;t.c.info("Error code "+e),2==e?(r=null,t.f&&(r=null),o=U(t.Wa,t),r||(r=new $e("//www.google.com/images/cleardot.gif"),P.location&&"http"==P.location.protocol||Ke(r,"https"),nn(r)),n=r.toString(),r=o,o=new fe,P.Image?((i=new Image).onload=M(Ln,o,i,"TestLoadImage: loaded",!0,r),i.onerror=M(Ln,o,i,"TestLoadImage: error",!1,r),i.onabort=M(Ln,o,i,"TestLoadImage: abort",!1,r),i.ontimeout=M(Ln,o,i,"TestLoadImage: timeout",!1,r),P.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=n):r(!1)):we(2),t.v=0,t.f&&t.f.ra(e),ur(t),Xn(t)}function ur(t){t.v=0,t.I=-1,t.f&&(0==On(t.b).length&&0==t.g.length||(t.b.c.length=0,H(t.g),t.g.length=0),t.f.qa())}function ar(t,e,n){var r,i,o,s,u,a=(s=n)instanceof $e?Ye(s):new $e(s,void 0);return""!=a.c?(e&&Ze(a,e+"."+a.c),Je(a,a.h)):(u=P.location,r=u.protocol,i=e?e+"."+u.hostname:u.hostname,o=+u.port,s=n,u=new $e(null,void 0),r&&Ke(u,r),i&&Ze(u,i),o&&Je(u,o),s&&(u.g=s),a=u),t.V&&Z(t.V,function(t,e){en(a,e,t)}),e=t.A,n=t.na,e&&n&&en(a,e,n),en(a,"VER",t.ha),Kn(t,a),a}function hr(t,e){if(e&&!t.C)throw Error("Can't create secondary domain capable XhrIo object.");return(e=new Rn(t.La)).F=t.C,e}function cr(){}function lr(){if(ot&&!(10<=Number(yt)))throw Error("Environmental error: no available transport.")}function fr(t,e){jt.call(this),this.a=new Wn(e),this.o=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.l=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.a&&(t?t["X-WebChannel-Client-Profile"]=e.a:t={"X-WebChannel-Client-Profile":e.a}),this.a.O=t,(t=e&&e.httpHeadersOverwriteParam)&&!z(t)&&(this.a.i=t),this.m=e&&e.supportsCrossDomainXhr||!1,this.l=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!z(e)&&(this.a.A=e,null!==(t=this.b)&&e in t&&(e in(t=this.b)&&delete t[e])),this.f=new yr(this)}function pr(t){Pe.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 dr(){Le.call(this),this.status=1}function yr(t){this.a=t}(N=Rn.prototype).ba=function(t,e,n,r){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.B+"; newUri="+t);e=e?e.toUpperCase():"GET",this.B=t,this.f="",this.h=0,this.u=!1,this.b=!0,this.a=new XMLHttpRequest,this.s=this.H?Ne(this.H):Ne(Se),this.a.onreadystatechange=U(this.za,this);try{this.A=!0,this.a.open(e,String(t),!0),this.A=!1}catch(t){return void xn(this,t)}t=n||"";var i,o=new He(this.headers);r&&We(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=Cn,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.L()),n=P.FormData&&t instanceof P.FormData,0<=B(Vn,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.I&&(this.a.responseType=this.I),"withCredentials"in this.a&&this.a.withCredentials!==this.F&&(this.a.withCredentials=this.F);try{jn(this),0<this.o&&((this.D=(i=this.a,ot&&dt(9)&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.a.timeout=this.o,this.a.ontimeout=U(this.xa,this)):this.m=ee(this.xa,this.o,this)),this.l=!0,this.a.send(t),this.l=!1}catch(t){xn(this,t)}},N.xa=function(){void 0!==S&&this.a&&(this.f="Timed out after "+this.o+"ms, aborting",this.h=8,Ft(this,"timeout"),this.abort(8))},N.abort=function(t){this.a&&this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1,this.h=t||7,Ft(this,"complete"),Ft(this,"abort"),qn(this))},N.G=function(){this.a&&(this.b&&(this.b=!1,this.g=!0,this.a.abort(),this.g=!1),qn(this,!0)),Rn.X.G.call(this)},N.za=function(){this.j||(this.A||this.l||this.g?Mn(this):this.Sa())},N.Sa=function(){Mn(this)},N.W=function(){try{return 2<Fn(this)?this.a.status:-1}catch(t){return-1}},N.$=function(){try{return this.a?this.a.responseText:""}catch(t){return""}},N.Na=function(t){if(this.a){var e=this.a.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),kn(e)}},N.ua=function(){return this.h},N.Oa=function(){return"string"==typeof this.f?this.f:String(this.f)},(N=Wn.prototype).ha=8,N.v=1,N.Ba=function(t){if(this.h)if(this.h=null,1==this.v){if(!t){this.R=Math.floor(1e5*Math.random()),t=this.R++;var e,n=new Re(this,this.c,t,void 0),r=this.l;if(this.O&&(r?et(r=J(r),this.O):r=this.O),null===this.i&&(n.B=r),this.da)t:{for(var i=e=0;i<this.g.length;i++){var o=this.g[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.g.length-1){e=i+1;break t}}e=1e3}else e=1e3;e=Zn(this,n,e),en(i=Ye(this.B),"RID",t),en(i,"CVER",22),this.A&&en(i,"X-HTTP-Session-Id",this.A),Kn(this,i),this.i&&r&&Bn(i,this.i,r),An(this.b,n),this.Ga&&en(i,"TYPE","init"),this.da?(en(i,"$req",e),en(i,"SID","null"),n.U=!0,Ce(n,i,null)):Ce(n,i,e),this.v=2}}else 3==this.v&&(t?Yn(this,t):0==this.g.length||En(this.b)||Yn(this))},N.Aa=function(){var t;this.j=null,nr(this),this.U&&!(this.F||null==this.a||this.N<=0)&&(t=2*this.N,this.c.info("BP detection timer enabled: "+t),this.s=Ee(U(this.Ra,this),t))},N.Ra=function(){this.s&&(this.s=null,this.c.info("BP detection timeout reached."),this.c.info("Buffering proxy detected and switch to long-polling!"),this.H=!1,this.F=!0,we(10),zn(this),nr(this))},N.Qa=function(){null!=this.m&&(this.m=null,zn(this),tr(this),we(19))},N.Wa=function(t){t?(this.c.info("Successfully pinged google.com"),we(2)):(this.c.info("Failed to ping google.com"),we(1))},(N=cr.prototype).ta=function(){},N.sa=function(){},N.ra=function(){},N.qa=function(){},N.Ha=function(){},lr.prototype.a=function(t,e){return new fr(t,e)},j(fr,jt),fr.prototype.g=function(){this.a.f=this.f,this.m&&(this.a.C=!0);var t=this.a,e=this.o,n=this.b||void 0;we(0),t.fa=e,t.V=n||{},t.H=t.S,t.B=ar(t,null,t.fa),$n(t)},fr.prototype.close=function(){Hn(this.a)},fr.prototype.h=function(t){var e;"string"==typeof t?((e={}).__data__=t,Qn(this.a,e)):this.l?((e={}).__data__=Gt(t),Qn(this.a,e)):Qn(this.a,t)},fr.prototype.G=function(){this.a.f=null,delete this.f,Hn(this.a),delete this.a,fr.X.G.call(this)},j(pr,Pe),j(dr,Le),j(yr,cr),yr.prototype.ta=function(){Ft(this.a,"a")},yr.prototype.sa=function(t){Ft(this.a,new pr(t))},yr.prototype.ra=function(t){Ft(this.a,new dr)},yr.prototype.qa=function(){Ft(this.a,"b")},lr.prototype.createWebChannel=lr.prototype.a,fr.prototype.send=fr.prototype.h,fr.prototype.open=fr.prototype.g,Ie.NO_ERROR=0,Ie.TIMEOUT=8,Ie.HTTP_ERROR=6,Te.COMPLETE="complete",(Oe.EventType=O).OPEN="a",O.CLOSE="b",O.ERROR="c",O.MESSAGE="d",jt.prototype.listen=jt.prototype.va,Rn.prototype.listenOnce=Rn.prototype.wa,Rn.prototype.getLastError=Rn.prototype.Oa,Rn.prototype.getLastErrorCode=Rn.prototype.ua,Rn.prototype.getStatus=Rn.prototype.W,Rn.prototype.getResponseJson=Rn.prototype.Na,Rn.prototype.getResponseText=Rn.prototype.$,Rn.prototype.send=Rn.prototype.ba;var vr=Ie,gr=Te,mr=Oe,wr=Rn,br=(Er.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},Er.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},Er.prototype.setServiceProps=function(t){return this.serviceProps=t,this},Er);function Er(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var Ir,Tr={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"},Ar=(n(Or,Ir=Error),Or),Nr=new l("@firebase/firestore");function Or(t,e){var n=this;return(n=Ir.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}function Sr(){return Nr.logLevel}function Pr(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Nr.logLevel<=u.DEBUG&&(e=n.map(Rr),Nr.debug.apply(Nr,i(["Firestore (8.0.1): "+t],e)))}function Lr(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Nr.logLevel<=u.ERROR&&(e=n.map(Rr),Nr.error.apply(Nr,i(["Firestore (8.0.1): "+t],e)))}function kr(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];Nr.logLevel<=u.WARN&&(e=n.map(Rr),Nr.warn.apply(Nr,i(["Firestore (8.0.1): "+t],e)))}function Rr(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function Dr(t){void 0===t&&(t="Unexpected state");t="FIRESTORE (8.0.1) INTERNAL ASSERTION FAILED: "+t;throw Lr(t),new Error(t)}function _r(t){t||Dr()}var Vr=(Cr.t=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length,n="";n.length<20;)for(var r=function(t){var e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(var r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}(40),i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%t.length));return n},Cr);function Cr(){}function xr(t,e){return t<e?-1:e<t?1:0}function Ur(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}var Mr=(qr.fromBase64String=function(t){return new qr(atob(t))},qr.fromUint8Array=function(t){return new qr(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},qr.prototype.toBase64=function(){return t=this.i,btoa(t);var t},qr.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.i)},qr.prototype.o=function(){return 2*this.i.length},qr.prototype.u=function(t){return xr(this.i,t.i)},qr.prototype.isEqual=function(t){return this.i===t.i},qr);function qr(t){this.i=t}Mr.h=new Mr("");var jr=(Fr.fromBase64String=function(t){try{return new Fr(Mr.fromBase64String(t))}catch(t){throw new Ar(Tr.INVALID_ARGUMENT,"Failed to construct Bytes from Base64 string: "+t)}},Fr.fromUint8Array=function(t){return new Fr(Mr.fromUint8Array(t))},Fr.prototype.toBase64=function(){return this.l.toBase64()},Fr.prototype.toUint8Array=function(){return this.l.toUint8Array()},Fr.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},Fr.prototype.isEqual=function(t){return this.l.isEqual(t.l)},Fr);function Fr(t){this.l=t}function Br(){if("undefined"==typeof Uint8Array)throw new Ar(Tr.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function Gr(){if("undefined"==typeof atob)throw new Ar(Tr.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var Wr,Hr=(n($r,Wr=jr),$r.fromBase64String=function(t){Gr();try{return new $r(Mr.fromBase64String(t))}catch(t){throw new Ar(Tr.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},$r.fromUint8Array=function(t){return Br(),new $r(Mr.fromUint8Array(t))},$r.prototype.toBase64=function(){return Gr(),Wr.prototype.toBase64.call(this)},$r.prototype.toUint8Array=function(){return Br(),Wr.prototype.toUint8Array.call(this)},$r.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},$r),zr=function(t,e,n,r,i,o){this._=t,this.persistenceKey=e,this.host=n,this.ssl=r,this.forceLongPolling=i,this.m=o},Xr=(Object.defineProperty(Qr.prototype,"T",{get:function(){return"(default)"===this.database},enumerable:!1,configurable:!0}),Qr.prototype.isEqual=function(t){return t instanceof Qr&&t.projectId===this.projectId&&t.database===this.database},Qr.prototype.u=function(t){return xr(this.projectId,t.projectId)||xr(this.database,t.database)},Qr);function Qr(t,e){this.projectId=t,this.database=e||"(default)"}function $r(){return null!==Wr&&Wr.apply(this,arguments)||this}function Yr(t){var e,n=0;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n++;return n}function Kr(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Zr(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var Jr,ti,ei=(di.prototype.get=function(t){var e=this.I(t),e=this.R[e];if(void 0!==e)for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],i=i[1];if(this.A(o,t))return i}},di.prototype.has=function(t){return void 0!==this.get(t)},di.prototype.set=function(t,e){var n=this.I(t),r=this.R[n];if(void 0!==r){for(var i=0;i<r.length;i++)if(this.A(r[i][0],t))return void(r[i]=[t,e]);r.push([t,e])}else this.R[n]=[[t,e]]},di.prototype.delete=function(t){var e=this.I(t),n=this.R[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(this.A(n[r][0],t))return 1===n.length?delete this.R[e]:n.splice(r,1),!0;return!1},di.prototype.forEach=function(s){Kr(this.R,function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n],o=i[0],i=i[1];s(o,i)}})},di.prototype.P=function(){return Zr(this.R)},di),ni=(pi.now=function(){return pi.fromMillis(Date.now())},pi.fromDate=function(t){return pi.fromMillis(t.getTime())},pi.fromMillis=function(t){var e=Math.floor(t/1e3);return new pi(e,1e6*(t-1e3*e))},pi.prototype.toDate=function(){return new Date(this.toMillis())},pi.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},pi.prototype.V=function(t){return this.seconds===t.seconds?xr(this.nanoseconds,t.nanoseconds):xr(this.seconds,t.seconds)},pi.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},pi.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},pi.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},pi.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},pi),ri=(fi.g=function(t){return new fi(t)},fi.min=function(){return new fi(new ni(0,0))},fi.prototype.u=function(t){return this.timestamp.V(t.timestamp)},fi.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},fi.prototype.p=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},fi.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},fi.prototype.v=function(){return this.timestamp},fi),l=(Object.defineProperty(li.prototype,"length",{get:function(){return this.C},enumerable:!1,configurable:!0}),li.prototype.isEqual=function(t){return 0===li.S(this,t)},li.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof li?t.forEach(function(t){e.push(t)}):e.push(t),this.D(e)},li.prototype.limit=function(){return this.offset+this.length},li.prototype.F=function(t){return t=void 0===t?1:t,this.D(this.segments,this.offset+t,this.length-t)},li.prototype.N=function(){return this.D(this.segments,this.offset,this.length-1)},li.prototype.O=function(){return this.segments[this.offset]},li.prototype.k=function(){return this.get(this.length-1)},li.prototype.get=function(t){return this.segments[this.offset+t]},li.prototype.P=function(){return 0===this.length},li.prototype.$=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},li.prototype.M=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},li.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},li.prototype.L=function(){return this.segments.slice(this.offset,this.limit())},li.S=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},li),ii=(n(ci,ti=l),ci.prototype.D=function(t,e,n){return new ci(t,e,n)},ci.prototype.q=function(){return this.L().join("/")},ci.prototype.toString=function(){return this.q()},ci.U=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];if(0<=o.indexOf("//"))throw new Ar(Tr.INVALID_ARGUMENT,"Invalid segment ("+o+"). Paths must not contain // in them.");n.push.apply(n,o.split("/").filter(function(t){return 0<t.length}))}return new ci(n)},ci.B=function(){return new ci([])},ci),oi=/^[_a-zA-Z][_a-zA-Z0-9]*$/,si=(n(hi,Jr=l),hi.prototype.D=function(t,e,n){return new hi(t,e,n)},hi.j=function(t){return oi.test(t)},hi.prototype.q=function(){return this.L().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),hi.j(t)||(t="`"+t+"`"),t}).join(".")},hi.prototype.toString=function(){return this.q()},hi.prototype.W=function(){return 1===this.length&&"__name__"===this.get(0)},hi.K=function(){return new hi(["__name__"])},hi.G=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new Ar(Tr.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 Ar(Tr.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var u=t[r+1];if("\\"!==u&&"."!==u&&"`"!==u)throw new Ar(Tr.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 Ar(Tr.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new hi(e)},hi.B=function(){return new hi([])},hi),ui=(ai.H=function(t){return new ai(ii.U(t))},ai.Y=function(t){return new ai(ii.U(t).F(5))},ai.prototype.J=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},ai.prototype.isEqual=function(t){return null!==t&&0===ii.S(this.path,t.path)},ai.prototype.toString=function(){return this.path.toString()},ai.S=function(t,e){return ii.S(t.path,e.path)},ai.X=function(t){return t.length%2==0},ai.Z=function(t){return new ai(new ii(t.slice()))},ai);function ai(t){this.path=t}function hi(){return null!==Jr&&Jr.apply(this,arguments)||this}function ci(){return null!==ti&&ti.apply(this,arguments)||this}function li(t,e,n){void 0===e?e=0:e>t.length&&Dr(),void 0===n?n=t.length-e:n>t.length-e&&Dr(),this.segments=t,this.offset=e,this.C=n}function fi(t){this.timestamp=t}function pi(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new Ar(Tr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new Ar(Tr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Ar(Tr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new Ar(Tr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function di(t,e){this.I=t,this.A=e,this.R={}}function yi(t){return null==t}function vi(t){return 0===t&&1/t==-1/0}var gi=function(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.tt=null};function mi(t,e,n,r,i,o,s){return 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),new gi(t,e,n,r,i,o,s)}function wi(t){var e=t;return null===e.tt&&(t=e.path.q(),null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(function(t){return(t=t).field.q()+t.op.toString()+wo(t.value)}).join(","),t+="|ob:",t+=e.orderBy.map(function(t){return(t=t).field.q()+t.dir}).join(","),yi(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=Bu(e.startAt)),e.endAt&&(t+="|ub:",t+=Bu(e.endAt)),e.tt=t),e.tt}function bi(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n,r,i=0;i<t.orderBy.length;i++)if(n=t.orderBy[i],r=e.orderBy[i],n.dir!==r.dir||!n.field.isEqual(r.field))return!1;if(t.filters.length!==e.filters.length)return!1;for(var o,s,u=0;u<t.filters.length;u++)if(o=t.filters[u],s=e.filters[u],o.op!==s.op||!o.field.isEqual(s.field)||!yo(o.value,s.value))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Wu(t.startAt,e.startAt)&&Wu(t.endAt,e.endAt)}function Ei(t){return ui.X(t.path)&&null===t.collectionGroup&&0===t.filters.length}function Ii(t){this.count=t}var Ti,Ai=(Ni.prototype.st=function(t){return new Ni(this.target,this.targetId,this.nt,t,this.et,this.lastLimboFreeSnapshotVersion,this.resumeToken)},Ni.prototype.it=function(t,e){return new Ni(this.target,this.targetId,this.nt,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},Ni.prototype.rt=function(t){return new Ni(this.target,this.targetId,this.nt,this.sequenceNumber,this.et,t,this.resumeToken)},Ni);function Ni(t,e,n,r,i,o,s){void 0===i&&(i=ri.min()),void 0===o&&(o=ri.min()),void 0===s&&(s=Mr.h),this.target=t,this.targetId=e,this.nt=n,this.sequenceNumber=r,this.et=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function Oi(t){switch(t){case Tr.OK:return Dr(),0;case Tr.CANCELLED:case Tr.UNKNOWN:case Tr.DEADLINE_EXCEEDED:case Tr.RESOURCE_EXHAUSTED:case Tr.INTERNAL:case Tr.UNAVAILABLE:case Tr.UNAUTHENTICATED:return;case Tr.INVALID_ARGUMENT:case Tr.NOT_FOUND:case Tr.ALREADY_EXISTS:case Tr.PERMISSION_DENIED:case Tr.FAILED_PRECONDITION:case Tr.ABORTED:case Tr.OUT_OF_RANGE:case Tr.UNIMPLEMENTED:case Tr.DATA_LOSS:return 1;default:return Dr(),0}}function Si(t){if(void 0===t)return Lr("GRPC error has no .code"),Tr.UNKNOWN;switch(t){case Ti.OK:return Tr.OK;case Ti.CANCELLED:return Tr.CANCELLED;case Ti.UNKNOWN:return Tr.UNKNOWN;case Ti.DEADLINE_EXCEEDED:return Tr.DEADLINE_EXCEEDED;case Ti.RESOURCE_EXHAUSTED:return Tr.RESOURCE_EXHAUSTED;case Ti.INTERNAL:return Tr.INTERNAL;case Ti.UNAVAILABLE:return Tr.UNAVAILABLE;case Ti.UNAUTHENTICATED:return Tr.UNAUTHENTICATED;case Ti.INVALID_ARGUMENT:return Tr.INVALID_ARGUMENT;case Ti.NOT_FOUND:return Tr.NOT_FOUND;case Ti.ALREADY_EXISTS:return Tr.ALREADY_EXISTS;case Ti.PERMISSION_DENIED:return Tr.PERMISSION_DENIED;case Ti.FAILED_PRECONDITION:return Tr.FAILED_PRECONDITION;case Ti.ABORTED:return Tr.ABORTED;case Ti.OUT_OF_RANGE:return Tr.OUT_OF_RANGE;case Ti.UNIMPLEMENTED:return Tr.UNIMPLEMENTED;case Ti.DATA_LOSS:return Tr.DATA_LOSS;default:return Dr()}}(l=Ti=Ti||{})[l.OK=0]="OK",l[l.CANCELLED=1]="CANCELLED",l[l.UNKNOWN=2]="UNKNOWN",l[l.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",l[l.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",l[l.NOT_FOUND=5]="NOT_FOUND",l[l.ALREADY_EXISTS=6]="ALREADY_EXISTS",l[l.PERMISSION_DENIED=7]="PERMISSION_DENIED",l[l.UNAUTHENTICATED=16]="UNAUTHENTICATED",l[l.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",l[l.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",l[l.ABORTED=10]="ABORTED",l[l.OUT_OF_RANGE=11]="OUT_OF_RANGE",l[l.UNIMPLEMENTED=12]="UNIMPLEMENTED",l[l.INTERNAL=13]="INTERNAL",l[l.UNAVAILABLE=14]="UNAVAILABLE",l[l.DATA_LOSS=15]="DATA_LOSS";var Pi=(_i.prototype.ot=function(t,e){return new _i(this.S,this.root.ot(t,e,this.S).copy(null,null,ki.ut,null,null))},_i.prototype.remove=function(t){return new _i(this.S,this.root.remove(t,this.S).copy(null,null,ki.ut,null,null))},_i.prototype.get=function(t){for(var e=this.root;!e.P();){var n=this.S(t,e.key);if(0===n)return e.value;n<0?e=e.left:0<n&&(e=e.right)}return null},_i.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.P();){var r=this.S(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},_i.prototype.P=function(){return this.root.P()},Object.defineProperty(_i.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),_i.prototype.ct=function(){return this.root.ct()},_i.prototype.ht=function(){return this.root.ht()},_i.prototype.at=function(t){return this.root.at(t)},_i.prototype.forEach=function(n){this.at(function(t,e){return n(t,e),!1})},_i.prototype.toString=function(){var n=[];return this.at(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},_i.prototype.lt=function(t){return this.root.lt(t)},_i.prototype._t=function(){return new Li(this.root,null,this.S,!1)},_i.prototype.ft=function(t){return new Li(this.root,t,this.S,!1)},_i.prototype.dt=function(){return new Li(this.root,null,this.S,!0)},_i.prototype.wt=function(t){return new Li(this.root,t,this.S,!0)},_i),Li=(Di.prototype.It=function(){var t=this.Tt.pop(),e={key:t.key,value:t.value};if(this.Et)for(t=t.left;!t.P();)this.Tt.push(t),t=t.right;else for(t=t.right;!t.P();)this.Tt.push(t),t=t.left;return e},Di.prototype.At=function(){return 0<this.Tt.length},Di.prototype.Rt=function(){if(0===this.Tt.length)return null;var t=this.Tt[this.Tt.length-1];return{key:t.key,value:t.value}},Di),ki=(Ri.prototype.copy=function(t,e,n,r,i){return new Ri(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)},Ri.prototype.P=function(){return!1},Ri.prototype.at=function(t){return this.left.at(t)||t(this.key,this.value)||this.right.at(t)},Ri.prototype.lt=function(t){return this.right.lt(t)||t(this.key,this.value)||this.left.lt(t)},Ri.prototype.min=function(){return this.left.P()?this:this.left.min()},Ri.prototype.ct=function(){return this.min().key},Ri.prototype.ht=function(){return this.right.P()?this.key:this.right.ht()},Ri.prototype.ot=function(t,e,n){var r=this,i=n(t,r.key);return(r=i<0?r.copy(null,null,null,r.left.ot(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.ot(t,e,n))).Pt()},Ri.prototype.yt=function(){if(this.left.P())return Ri.EMPTY;var t=this;return t.left.Vt()||t.left.left.Vt()||(t=t.gt()),(t=t.copy(null,null,null,t.left.yt(),null)).Pt()},Ri.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)<0)r.left.P()||r.left.Vt()||r.left.left.Vt()||(r=r.gt()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.Vt()&&(r=r.vt()),r.right.P()||r.right.Vt()||r.right.left.Vt()||(r=r.bt()),0===e(t,r.key)){if(r.right.P())return Ri.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.yt())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.Pt()},Ri.prototype.Vt=function(){return this.color},Ri.prototype.Pt=function(){var t=this;return t.right.Vt()&&!t.left.Vt()&&(t=t.Ct()),t.left.Vt()&&t.left.left.Vt()&&(t=t.vt()),t.left.Vt()&&t.right.Vt()&&(t=t.St()),t},Ri.prototype.gt=function(){var t=this.St();return t.right.left.Vt()&&(t=(t=(t=t.copy(null,null,null,null,t.right.vt())).Ct()).St()),t},Ri.prototype.bt=function(){var t=this.St();return t.left.left.Vt()&&(t=(t=t.vt()).St()),t},Ri.prototype.Ct=function(){var t=this.copy(null,null,Ri.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},Ri.prototype.vt=function(){var t=this.copy(null,null,Ri.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},Ri.prototype.St=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},Ri.prototype.Dt=function(){var t=this.Ft();return Math.pow(2,t)<=this.size+1},Ri.prototype.Ft=function(){if(this.Vt()&&this.left.Vt())throw Dr();if(this.right.Vt())throw Dr();var t=this.left.Ft();if(t!==this.right.Ft())throw Dr();return t+(this.Vt()?0:1)},Ri);function Ri(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Ri.RED,this.left=null!=r?r:Ri.EMPTY,this.right=null!=i?i:Ri.EMPTY,this.size=this.left.size+1+this.right.size}function Di(t,e,n,r){this.Et=r,this.Tt=[];for(var i=1;!t.P();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.Et?t.left:t.right;else{if(0===i){this.Tt.push(t);break}this.Tt.push(t),t=this.Et?t.right:t.left}}function _i(t,e){this.S=t,this.root=e||ki.EMPTY}function Vi(){this.size=0}ki.EMPTY=null,ki.RED=!0,ki.ut=!1,ki.EMPTY=(Object.defineProperty(Vi.prototype,"key",{get:function(){throw Dr()},enumerable:!1,configurable:!0}),Object.defineProperty(Vi.prototype,"value",{get:function(){throw Dr()},enumerable:!1,configurable:!0}),Object.defineProperty(Vi.prototype,"color",{get:function(){throw Dr()},enumerable:!1,configurable:!0}),Object.defineProperty(Vi.prototype,"left",{get:function(){throw Dr()},enumerable:!1,configurable:!0}),Object.defineProperty(Vi.prototype,"right",{get:function(){throw Dr()},enumerable:!1,configurable:!0}),Vi.prototype.copy=function(t,e,n,r,i){return this},Vi.prototype.ot=function(t,e,n){return new ki(t,e)},Vi.prototype.remove=function(t,e){return this},Vi.prototype.P=function(){return!0},Vi.prototype.at=function(t){return!1},Vi.prototype.lt=function(t){return!1},Vi.prototype.ct=function(){return null},Vi.prototype.ht=function(){return null},Vi.prototype.Vt=function(){return!1},Vi.prototype.Dt=function(){return!0},Vi.prototype.Ft=function(){return 0},new Vi);var Ci=(qi.prototype.has=function(t){return null!==this.data.get(t)},qi.prototype.first=function(){return this.data.ct()},qi.prototype.last=function(){return this.data.ht()},Object.defineProperty(qi.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),qi.prototype.indexOf=function(t){return this.data.indexOf(t)},qi.prototype.forEach=function(n){this.data.at(function(t,e){return n(t),!1})},qi.prototype.Nt=function(t,e){for(var n=this.data.ft(t[0]);n.At();){var r=n.It();if(0<=this.S(r.key,t[1]))return;e(r.key)}},qi.prototype.xt=function(t,e){for(var n=void 0!==e?this.data.ft(e):this.data._t();n.At();)if(!t(n.It().key))return},qi.prototype.Ot=function(t){t=this.data.ft(t);return t.At()?t.It().key:null},qi.prototype._t=function(){return new xi(this.data._t())},qi.prototype.ft=function(t){return new xi(this.data.ft(t))},qi.prototype.add=function(t){return this.copy(this.data.remove(t).ot(t,!0))},qi.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},qi.prototype.P=function(){return this.data.P()},qi.prototype.kt=function(t){var e=this;return e.size<t.size&&(e=t,t=this),t.forEach(function(t){e=e.add(t)}),e},qi.prototype.isEqual=function(t){if(!(t instanceof qi))return!1;if(this.size!==t.size)return!1;for(var e=this.data._t(),n=t.data._t();e.At();){var r=e.It().key,i=n.It().key;if(0!==this.S(r,i))return!1}return!0},qi.prototype.L=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},qi.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},qi.prototype.copy=function(t){var e=new qi(this.S);return e.data=t,e},qi),xi=(Mi.prototype.It=function(){return this.$t.It().key},Mi.prototype.At=function(){return this.$t.At()},Mi),Ui=new Pi(ui.S);function Mi(t){this.$t=t}function qi(t){this.S=t,this.data=new Pi(this.S)}var ji=new Pi(ui.S);var Fi=new Pi(ui.S),Bi=new Ci(ui.S);function Gi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=Bi,r=0,i=t;r<i.length;r++)var o=i[r],n=n.add(o);return n}var Wi=new Ci(xr);var Hi=(uo.qt=function(t){return new uo(t.S)},uo.prototype.has=function(t){return null!=this.Mt.get(t)},uo.prototype.get=function(t){return this.Mt.get(t)},uo.prototype.first=function(){return this.Lt.ct()},uo.prototype.last=function(){return this.Lt.ht()},uo.prototype.P=function(){return this.Lt.P()},uo.prototype.indexOf=function(t){t=this.Mt.get(t);return t?this.Lt.indexOf(t):-1},Object.defineProperty(uo.prototype,"size",{get:function(){return this.Lt.size},enumerable:!1,configurable:!0}),uo.prototype.forEach=function(n){this.Lt.at(function(t,e){return n(t),!1})},uo.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.Mt.ot(t.key,t),e.Lt.ot(t,null))},uo.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.Mt.remove(t),this.Lt.remove(e)):this},uo.prototype.isEqual=function(t){if(!(t instanceof uo))return!1;if(this.size!==t.size)return!1;for(var e=this.Lt._t(),n=t.Lt._t();e.At();){var r=e.It().key,i=n.It().key;if(!r.isEqual(i))return!1}return!0},uo.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n  "+e.join("  \n")+"\n)"},uo.prototype.copy=function(t,e){var n=new uo;return n.S=this.S,n.Mt=t,n.Lt=e,n},uo),zi=(so.prototype.track=function(t){var e=t.doc.key,n=this.Ut.get(e);!n||0!==t.type&&3===n.type?this.Ut=this.Ut.ot(e,t):3===t.type&&1!==n.type?this.Ut=this.Ut.ot(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Ut=this.Ut.ot(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Ut=this.Ut.ot(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Ut=this.Ut.remove(e):1===t.type&&2===n.type?this.Ut=this.Ut.ot(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Ut=this.Ut.ot(e,{type:2,doc:t.doc}):Dr()},so.prototype.Bt=function(){var n=[];return this.Ut.at(function(t,e){n.push(e)}),n},so),Xi=(oo.Gt=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new oo(t,e,Hi.qt(e),i,n,r,!0,!1)},Object.defineProperty(oo.prototype,"hasPendingWrites",{get:function(){return!this.Wt.P()},enumerable:!1,configurable:!0}),oo.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.Qt===t.Qt&&this.Wt.isEqual(t.Wt)&&lu(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.jt.isEqual(t.jt)))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},oo),Qi=(io.Xt=function(t,e){var n=new Map;return n.set(t,$i.Zt(t,e)),new io(ri.min(),n,Wi,Ui,Gi())},io),$i=(ro.Zt=function(t,e){return new ro(Mr.h,e,Gi(),Gi(),Gi())},ro),Yi=function(t,e,n,r){this.rn=t,this.removedTargetIds=e,this.key=n,this.on=r},Ki=function(t,e){this.targetId=t,this.un=e},Zi=function(t,e,n,r){void 0===n&&(n=Mr.h),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r},Ji=(Object.defineProperty(no.prototype,"tn",{get:function(){return this.ln},enumerable:!1,configurable:!0}),Object.defineProperty(no.prototype,"resumeToken",{get:function(){return this.an},enumerable:!1,configurable:!0}),Object.defineProperty(no.prototype,"fn",{get:function(){return 0!==this.cn},enumerable:!1,configurable:!0}),Object.defineProperty(no.prototype,"dn",{get:function(){return this._n},enumerable:!1,configurable:!0}),no.prototype.wn=function(t){0<t.o()&&(this._n=!0,this.an=t)},no.prototype.En=function(){var n=Gi(),r=Gi(),i=Gi();return this.hn.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:Dr()}}),new $i(this.an,this.ln,n,r,i)},no.prototype.mn=function(){this._n=!1,this.hn=ho()},no.prototype.Tn=function(t,e){this._n=!0,this.hn=this.hn.ot(t,e)},no.prototype.In=function(t){this._n=!0,this.hn=this.hn.remove(t)},no.prototype.An=function(){this.cn+=1},no.prototype.Rn=function(){--this.cn},no.prototype.Pn=function(){this._n=!0,this.ln=!0},no),to=(eo.prototype.bn=function(t){for(var e=0,n=t.rn;e<n.length;e++){var r=n[e];t.on instanceof Xs?this.Cn(r,t.on):t.on instanceof Qs&&this.Sn(r,t.key,t.on)}for(var i=0,o=t.removedTargetIds;i<o.length;i++){var s=o[i];this.Sn(s,t.key,t.on)}},eo.prototype.Dn=function(n){var r=this;this.Fn(n,function(t){var e=r.Nn(t);switch(n.state){case 0:r.xn(t)&&e.wn(n.resumeToken);break;case 1:e.Rn(),e.fn||e.mn(),e.wn(n.resumeToken);break;case 2:e.Rn(),e.fn||r.removeTarget(t);break;case 3:r.xn(t)&&(e.Pn(),e.wn(n.resumeToken));break;case 4:r.xn(t)&&(r.On(t),e.wn(n.resumeToken));break;default:Dr()}})},eo.prototype.Fn=function(t,n){var r=this;0<t.targetIds.length?t.targetIds.forEach(n):this.Vn.forEach(function(t,e){r.xn(e)&&n(e)})},eo.prototype.kn=function(t){var e=t.targetId,n=t.un.count,t=this.$n(e);t&&(Ei(t=t.target)?0===n?(t=new ui(t.path),this.Sn(e,t,new Qs(t,ri.min()))):_r(1===n):this.Mn(e)!==n&&(this.On(e),this.vn=this.vn.add(e)))},eo.prototype.Ln=function(r){var i=this,o=new Map;this.Vn.forEach(function(t,e){var n=i.$n(e);n&&(t.tn&&Ei(n.target)&&(n=new ui(n.target.path),null!==i.gn.get(n)||i.qn(e,n)||i.Sn(e,n,new Qs(n,r))),t.dn&&(o.set(e,t.En()),t.mn()))});var s=Gi();this.pn.forEach(function(t,e){var n=!0;e.xt(function(t){t=i.$n(t);return!t||2===t.nt||(n=!1)}),n&&(s=s.add(t))});var t=new Qi(r,o,this.vn,this.gn,s);return this.gn=Ui,this.pn=ao(),this.vn=new Ci(xr),t},eo.prototype.Cn=function(t,e){var n;this.xn(t)&&(n=this.qn(t,e.key)?2:0,this.Nn(t).Tn(e.key,n),this.gn=this.gn.ot(e.key,e),this.pn=this.pn.ot(e.key,this.Un(e.key).add(t)))},eo.prototype.Sn=function(t,e,n){var r;this.xn(t)&&(r=this.Nn(t),this.qn(t,e)?r.Tn(e,1):r.In(e),this.pn=this.pn.ot(e,this.Un(e).delete(t)),n&&(this.gn=this.gn.ot(e,n)))},eo.prototype.removeTarget=function(t){this.Vn.delete(t)},eo.prototype.Mn=function(t){var e=this.Nn(t).En();return this.yn.Bn(t).size+e.nn.size-e.sn.size},eo.prototype.An=function(t){this.Nn(t).An()},eo.prototype.Nn=function(t){var e=this.Vn.get(t);return e||(e=new Ji,this.Vn.set(t,e)),e},eo.prototype.Un=function(t){var e=this.pn.get(t);return e||(e=new Ci(xr),this.pn=this.pn.ot(t,e)),e},eo.prototype.xn=function(t){var e=null!==this.$n(t);return e||Pr("WatchChangeAggregator","Detected inactive target",t),e},eo.prototype.$n=function(t){var e=this.Vn.get(t);return e&&e.fn?null:this.yn.jn(t)},eo.prototype.On=function(e){var n=this;this.Vn.set(e,new Ji),this.yn.Bn(e).forEach(function(t){n.Sn(e,t,null)})},eo.prototype.qn=function(t,e){return this.yn.Bn(t).has(e)},eo);function eo(t){this.yn=t,this.Vn=new Map,this.gn=Ui,this.pn=ao(),this.vn=new Ci(xr)}function no(){this.cn=0,this.hn=ho(),this.an=Mr.h,this.ln=!1,this._n=!0}function ro(t,e,n,r,i){this.resumeToken=t,this.tn=e,this.nn=n,this.en=r,this.sn=i}function io(t,e,n,r,i){this.et=t,this.Ht=e,this.zt=n,this.Yt=r,this.Jt=i}function oo(t,e,n,r,i,o,s,u){this.query=t,this.docs=e,this.jt=n,this.docChanges=r,this.Wt=i,this.fromCache=o,this.Qt=s,this.Kt=u}function so(){this.Ut=new Pi(ui.S)}function uo(n){this.S=n?function(t,e){return n(t,e)||ui.S(t.key,e.key)}:function(t,e){return ui.S(t.key,e.key)},this.Mt=ji,this.Lt=new Pi(this.S)}function ao(){return new Pi(ui.S)}function ho(){return new Pi(ui.S)}function co(t){return"server_timestamp"===(null===(t=((null===(t=null==t?void 0:t.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===t?void 0:t.stringValue)}function lo(t){t=bo(t.mapValue.fields.__local_write_time__.timestampValue);return new ni(t.seconds,t.nanos)}var fo=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function po(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?co(t)?4:10:Dr()}function yo(r,i){var t,e=po(r);if(e!==po(i))return!1;switch(e){case 0:return!0;case 1:return r.booleanValue===i.booleanValue;case 4:return lo(r).isEqual(lo(i));case 3:return function(t){if("string"==typeof r.timestampValue&&"string"==typeof t.timestampValue&&r.timestampValue.length===t.timestampValue.length)return r.timestampValue===t.timestampValue;var e=bo(r.timestampValue),t=bo(t.timestampValue);return e.seconds===t.seconds&&e.nanos===t.nanos}(i);case 5:return r.stringValue===i.stringValue;case 6:return t=i,Io(r.bytesValue).isEqual(Io(t.bytesValue));case 7:return r.referenceValue===i.referenceValue;case 8:return e=i,Eo((t=r).geoPointValue.latitude)===Eo(e.geoPointValue.latitude)&&Eo(t.geoPointValue.longitude)===Eo(e.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Eo(t.integerValue)===Eo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){t=Eo(t.doubleValue),e=Eo(e.doubleValue);return t===e?vi(t)===vi(e):isNaN(t)&&isNaN(e)}return!1}(r,i);case 9:return Ur(r.arrayValue.values||[],i.arrayValue.values||[],yo);case 10:return function(){var t,e=r.mapValue.fields||{},n=i.mapValue.fields||{};if(Yr(e)!==Yr(n))return!1;for(t in e)if(e.hasOwnProperty(t)&&(void 0===n[t]||!yo(e[t],n[t])))return!1;return!0}();default:return Dr()}}function vo(t,e){return void 0!==(t.values||[]).find(function(t){return yo(t,e)})}function go(t,e){var n,r,i=po(t),o=po(e);if(i!==o)return xr(i,o);switch(i){case 0:return 0;case 1:return xr(t.booleanValue,e.booleanValue);case 2:return n=e,r=Eo(t.integerValue||t.doubleValue),n=Eo(n.integerValue||n.doubleValue),r<n?-1:n<r?1:r===n?0:isNaN(r)?isNaN(n)?0:-1:1;case 3:return mo(t.timestampValue,e.timestampValue);case 4:return mo(lo(t),lo(e));case 5:return xr(t.stringValue,e.stringValue);case 6:return function(t,e){t=Io(t),e=Io(e);return t.u(e)}(t.bytesValue,e.bytesValue);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=xr(n[i],r[i]);if(0!==o)return o}return xr(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return i=t.geoPointValue,r=e.geoPointValue,0!==(n=xr(Eo(i.latitude),Eo(r.latitude)))?n:xr(Eo(i.longitude),Eo(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=go(n[i],r[i]);if(o)return o}return xr(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=xr(r[s],o[s]);if(0!==u)return u;u=go(n[r[s]],i[o[s]]);if(0!==u)return u}return xr(r.length,o.length)}(t.mapValue,e.mapValue);default:throw Dr()}}function mo(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return xr(t,e);var n=bo(t),t=bo(e),e=xr(n.seconds,t.seconds);return 0!==e?e:xr(n.nanos,t.nanos)}function wo(t){return function s(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){var t=bo(t);return"time("+t.seconds+","+t.nanos+")"}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Io(t.bytesValue).toBase64():"referenceValue"in t?(e=t.referenceValue,ui.Y(e).toString()):"geoPointValue"in t?"geo("+(e=t.geoPointValue).latitude+","+e.longitude+")":"arrayValue"in t?function(t){for(var e="[",n=!0,r=0,i=t.values||[];r<i.length;r++)n?n=!1:e+=",",e+=s(i[r]);return e+"]"}(t.arrayValue):"mapValue"in t?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+"}"}(t.mapValue):Dr();var e}(t)}function bo(t){if(_r(!!t),"string"!=typeof t)return{seconds:Eo(t.seconds),nanos:Eo(t.nanos)};var e=0,n=fo.exec(t);_r(!!n),n[1]&&(n=((n=n[1])+"000000000").substr(0,9),e=Number(n));t=new Date(t);return{seconds:Math.floor(t.getTime()/1e3),nanos:e}}function Eo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Io(t){return"string"==typeof t?Mr.fromBase64String(t):Mr.fromUint8Array(t)}function To(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.q()}}function Ao(t){return t&&"integerValue"in t}function No(t){return!!t&&"arrayValue"in t}function Oo(t){return t&&"nullValue"in t}function So(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Po(t){return t&&"mapValue"in t}var Lo={asc:"ASCENDING",desc:"DESCENDING"},ko={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Ro=function(t,e){this._=t,this.Wn=e};function Do(t){return{integerValue:""+t}}function _o(t,e){if(t.Wn){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:vi(e)?"-0":e}}function Vo(t,e){return"number"==typeof(n=e)&&Number.isInteger(n)&&!vi(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER?Do(e):_o(t,e);var n}function Co(t,e){return t.Wn?new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+e.nanoseconds).slice(-9)+"Z":{seconds:""+e.seconds,nanos:e.nanoseconds}}function xo(t,e){return t.Wn?e.toBase64():e.toUint8Array()}function Uo(t){return _r(!!t),ri.g((t=bo(t),new ni(t.seconds,t.nanos)))}function Mo(t,e){return new ii(["projects",t.projectId,"databases",t.database]).child("documents").child(e).q()}function qo(t,e){return Mo(t._,e.path)}function jo(t,e){_r(Qo(e=ii.U(e)));return _r(e.get(1)===t._.projectId),_r(!e.get(3)&&!t._.database||e.get(3)===t._.database),new ui((_r(4<(e=e).length&&"documents"===e.get(4)),e.F(5)))}function Fo(t,e){return Mo(t._,e)}function Bo(t){return new ii(["projects",t._.projectId,"databases",t._.database]).q()}function Go(t,e,n){return{name:qo(t,e),fields:n.proto.mapValue.fields}}function Wo(t,e){var n,r,i;if(e instanceof Ns)n={update:Go(t,e.key,e.value)};else if(e instanceof xs)n={delete:qo(t,e.key)};else if(e instanceof Os)n={update:Go(t,e.key,e.data),updateMask:(i=e.Qn,r=[],i.fields.forEach(function(t){return r.push(t.q())}),{fieldPaths:r})};else if(e instanceof Rs)n={transform:{document:qo(t,e.key),fieldTransforms:e.fieldTransforms.map(function(t){var e=t.transform;if(e instanceof Zo)return{fieldPath:t.field.q(),setToServerValue:"REQUEST_TIME"};if(e instanceof Jo)return{fieldPath:t.field.q(),appendMissingElements:{values:e.elements}};if(e instanceof is)return{fieldPath:t.field.q(),removeAllFromArray:{values:e.elements}};if(e instanceof as)return{fieldPath:t.field.q(),increment:e.Kn};throw Dr()})}};else{if(!(e instanceof Us))return Dr();n={verify:qo(t,e.key)}}return e.Hn.Gn||(n.currentDocument=void 0!==(i=e.Hn).updateTime?{updateTime:(e=t,t=i.updateTime,Co(e,t.v()))}:void 0!==i.exists?{exists:i.exists}:Dr()),n}function Ho(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Fo(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Fo(t,r.N()),n.structuredQuery.from=[{collectionId:r.k()}]);r=function(t){if(0!==t.length){t=t.map(function(t){if("=="===t.op){if(So(t.value))return{unaryFilter:{field:Xo(t.field),op:"IS_NAN"}};if(Oo(t.value))return{unaryFilter:{field:Xo(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(So(t.value))return{unaryFilter:{field:Xo(t.field),op:"IS_NOT_NAN"}};if(Oo(t.value))return{unaryFilter:{field:Xo(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Xo(t.field),op:(e=t.op,ko[e]),value:t.value}};var e});return 1===t.length?t[0]:{compositeFilter:{op:"AND",filters:t}}}}(e.filters);r&&(n.structuredQuery.where=r);r=function(t){if(0!==t.length)return t.map(function(t){return{field:Xo((t=t).field),direction:(t=t.dir,Lo[t])}})}(e.orderBy);r&&(n.structuredQuery.orderBy=r);r=e.limit,r=t.Wn||yi(r)?r:{value:r};return null!==r&&(n.structuredQuery.limit=r),e.startAt&&(n.structuredQuery.startAt=zo(e.startAt)),e.endAt&&(n.structuredQuery.endAt=zo(e.endAt)),n}function zo(t){return{before:t.before,values:t.position}}function Xo(t){return{fieldPath:t.q()}}function Qo(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}l=function(){this.zn=void 0};function $o(t,e){return t instanceof as?Ao(t=e)||t&&"doubleValue"in t?e:{integerValue:0}:null}var Yo,Ko,Zo=(n(es,Ko=l),es),Jo=(n(ts,Yo=l),ts);function ts(t){var e=this;return(e=Yo.call(this)||this).elements=t,e}function es(){return null!==Ko&&Ko.apply(this,arguments)||this}function ns(t,e){for(var n=ls(e),r=0,i=t.elements;r<i.length;r++)!function(e){n.some(function(t){return yo(t,e)})||n.push(e)}(i[r]);return{arrayValue:{values:n}}}var rs,is=(n(os,rs=l),os);function os(t){var e=this;return(e=rs.call(this)||this).elements=t,e}function ss(t,e){for(var n=ls(e),r=0,i=t.elements;r<i.length;r++)!function(e){n=n.filter(function(t){return!yo(t,e)})}(i[r]);return{arrayValue:{values:n}}}var us,as=(n(hs,us=l),hs);function hs(t,e){var n=this;return(n=us.call(this)||this).serializer=t,n.Kn=e,n}function cs(t){return Eo(t.integerValue||t.doubleValue)}function ls(t){return No(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function fs(t,e){this.field=t,this.transform=e}var ps=(ds.prototype.Yn=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].$(t))return!0;return!1},ds.prototype.isEqual=function(t){return Ur(this.fields,t.fields,function(t,e){return t.isEqual(e)})},ds);function ds(t){(this.fields=t).sort(si.S)}function ys(t,e){this.version=t,this.transformResults=e}var vs=(gs.Jn=function(){return new gs},gs.exists=function(t){return new gs(void 0,t)},gs.updateTime=function(t){return new gs(t)},Object.defineProperty(gs.prototype,"Gn",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),gs.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},gs);function gs(t,e){this.updateTime=t,this.exists=e}function ms(t,e){return void 0!==t.updateTime?e instanceof Xs&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e instanceof Xs}l=function(){};function ws(t,e,n){return t instanceof Ns?new Xs(t.key,n.version,t.value,{hasCommittedMutations:!0}):t instanceof Os?function(t,e,n){if(!ms(t.Hn,e))return new $s(t.key,n.version);e=Ls(t,e);return new Xs(t.key,n.version,e,{hasCommittedMutations:!0})}(t,e,n):t instanceof Rs?function(t,e,n){if(_r(null!=n.transformResults),!ms(t.Hn,e))return new $s(t.key,n.version);var r=e,e=function(t,e,n){var r=[];_r(t.length===n.length);for(var i=0;i<n.length;i++){var o=t[i],s=o.transform,u=null;e instanceof Xs&&(u=e.field(o.field)),r.push((o=s,s=u,u=n[i],o instanceof Jo?ns(o,s):o instanceof is?ss(o,s):u))}return r}(t.fieldTransforms,e,n.transformResults),n=n.version,e=_s(t,r.data(),e);return new Xs(t.key,n,e,{hasCommittedMutations:!0})}(t,e,n):new Qs(t.key,n.version,{hasCommittedMutations:!0})}function bs(t,e,n,r){return t instanceof Ns?function(t,e){if(!ms(t.Hn,e))return e;e=Is(e);return new Xs(t.key,e,t.value,{Xn:!0})}(t,e):t instanceof Os?function(t,e){if(!ms(t.Hn,e))return e;var n=Is(e),e=Ls(t,e);return new Xs(t.key,n,e,{Xn:!0})}(t,e):t instanceof Rs?function(t,e,n,r){if(!ms(t.Hn,e))return e;var i=e,r=function(t,e,n,r){for(var i,o=[],s=0,u=t;s<u.length;s++){var a=u[s],h=a.transform,c=null;n instanceof Xs&&(c=n.field(a.field)),null===c&&r instanceof Xs&&(c=r.field(a.field)),o.push((i=c,a=e,c=void 0,(h=h)instanceof Zo?(c={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:a.seconds,nanos:a.nanoseconds}}}},i&&(c.fields.__previous_value__=i),{mapValue:c}):h instanceof Jo?ns(h,i):h instanceof is?ss(h,i):(h=$o(c=h,i),i=cs(h)+cs(c.Kn),Ao(h)&&Ao(c.Kn)?Do(i):_o(c.serializer,i))))}return o}(t.fieldTransforms,n,e,r),r=_s(t,i.data(),r);return new Xs(t.key,i.version,r,{Xn:!0})}(t,e,r,n):(e=e,ms((t=t).Hn,e)?new Qs(t.key,ri.min()):e)}function Es(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.Hn.isEqual(e.Hn)&&(0===t.type?t.value.isEqual(e.value):1===t.type?t.data.isEqual(e.data)&&t.Qn.isEqual(e.Qn):2!==t.type||Ur(t.fieldTransforms,t.fieldTransforms,function(t,e){return e=e,(t=t).field.isEqual(e.field)&&(t=t.transform,e=e.transform,t instanceof Jo&&e instanceof Jo||t instanceof is&&e instanceof is?Ur(t.elements,e.elements,yo):t instanceof as&&e instanceof as?yo(t.Kn,e.Kn):t instanceof Zo&&e instanceof Zo)}))}function Is(t){return t instanceof Xs?t.version:ri.min()}var Ts,As,Ns=(n(Ps,As=l),Ps),Os=(n(Ss,Ts=l),Ss);function Ss(t,e,n,r){var i=this;return(i=Ts.call(this)||this).key=t,i.data=e,i.Qn=n,i.Hn=r,i.type=1,i}function Ps(t,e,n){var r=this;return(r=As.call(this)||this).key=t,r.value=e,r.Hn=n,r.type=0,r}function Ls(t,e){return n=t,e=e instanceof Xs?e.data():Ms.empty(),r=new qs(e),n.Qn.fields.forEach(function(t){var e;t.P()||(null!==(e=n.data.field(t))?r.set(t,e):r.delete(t))}),r.Zn();var n,r}var ks,Rs=(n(Ds,ks=l),Ds);function Ds(t,e){var n=this;return(n=ks.call(this)||this).key=t,n.fieldTransforms=e,n.type=2,n.Hn=vs.exists(!0),n}function _s(t,e,n){for(var r=new qs(e),i=0;i<t.fieldTransforms.length;i++){var o=t.fieldTransforms[i];r.set(o.field,n[i])}return r.Zn()}var Vs,Cs,xs=(n(Gs,Cs=l),Gs),Us=(n(Bs,Vs=l),Bs),Ms=(Fs.empty=function(){return new Fs({mapValue:{}})},Fs.prototype.field=function(t){if(t.P())return this.proto;for(var e=this.proto,n=0;n<t.length-1;++n){if(!e.mapValue.fields)return null;if(!Po(e=e.mapValue.fields[t.get(n)]))return null}return(e=(e.mapValue.fields||{})[t.k()])||null},Fs.prototype.isEqual=function(t){return yo(this.proto,t.proto)},Fs),qs=(js.prototype.set=function(t,e){return this.ee(t,e),this},js.prototype.delete=function(t){return this.ee(t,null),this},js.prototype.ee=function(t,e){for(var n=this.ne,r=0;r<t.length-1;++r)var i=t.get(r),o=n.get(i),n=(o instanceof Map||(o=o&&10===po(o)?new Map(Object.entries(o.mapValue.fields||{})):new Map,n.set(i,o)),o);n.set(t.k(),e)},js.prototype.Zn=function(){var t=this.se(si.B(),this.ne);return null!=t?new Ms(t):this.te},js.prototype.se=function(r,t){var i=this,o=!1,e=this.te.field(r),s=Po(e)?Object.assign({},e.mapValue.fields):{};return t.forEach(function(t,e){var n;t instanceof Map?null!=(n=i.se(r.child(e),t))&&(s[e]=n,o=!0):null!==t?(s[e]=t,o=!0):s.hasOwnProperty(e)&&(delete s[e],o=!0)}),o?{mapValue:{fields:s}}:null},js);function js(t){void 0===t&&(t=Ms.empty()),this.te=t,this.ne=new Map}function Fs(t){this.proto=t}function Bs(t,e){var n=this;return(n=Vs.call(this)||this).key=t,n.Hn=e,n.type=4,n}function Gs(t,e){var n=this;return(n=Cs.call(this)||this).key=t,n.Hn=e,n.type=3,n}var Ws,Hs,zs,l=function(t,e){this.key=t,this.version=e},Xs=(n(Js,zs=l),Js.prototype.field=function(t){return this.ie.field(t)},Js.prototype.data=function(){return this.ie},Js.prototype.re=function(){return this.ie.proto},Js.prototype.isEqual=function(t){return t instanceof Js&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.Xn===t.Xn&&this.hasCommittedMutations===t.hasCommittedMutations&&this.ie.isEqual(t.ie)},Js.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.ie.toString()+", {hasLocalMutations: "+this.Xn+"}), {hasCommittedMutations: "+this.hasCommittedMutations+"})"},Object.defineProperty(Js.prototype,"hasPendingWrites",{get:function(){return this.Xn||this.hasCommittedMutations},enumerable:!1,configurable:!0}),Js),Qs=(n(Zs,Hs=l),Zs.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},Object.defineProperty(Zs.prototype,"hasPendingWrites",{get:function(){return this.hasCommittedMutations},enumerable:!1,configurable:!0}),Zs.prototype.isEqual=function(t){return t instanceof Zs&&t.hasCommittedMutations===this.hasCommittedMutations&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Zs),$s=(n(Ks,Ws=l),Ks.prototype.toString=function(){return"UnknownDocument("+this.key+", "+this.version+")"},Object.defineProperty(Ks.prototype,"hasPendingWrites",{get:function(){return!0},enumerable:!1,configurable:!0}),Ks.prototype.isEqual=function(t){return t instanceof Ks&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},Ks),Ys=function(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.oe=n,this.filters=r,this.limit=i,this.ue=o,this.startAt=s,this.endAt=u,this.ce=null,this.he=null,this.startAt,this.endAt};function Ks(){return null!==Ws&&Ws.apply(this,arguments)||this}function Zs(t,e,n){var r=this;return(r=Hs.call(this,t,e)||this).hasCommittedMutations=!(!n||!n.hasCommittedMutations),r}function Js(t,e,n,r){var i=this;return(i=zs.call(this,t,e)||this).ie=n,i.Xn=!!r.Xn,i.hasCommittedMutations=!!r.hasCommittedMutations,i}function tu(t){return new Ys(t)}function eu(t){return!yi(t.limit)&&"F"===t.ue}function nu(t){return!yi(t.limit)&&"L"===t.ue}function ru(t){return 0<t.oe.length?t.oe[0].field:null}function iu(t){for(var e=0,n=t.filters;e<n.length;e++){var r=n[e];if(r.ae())return r.field}return null}function ou(t){return null!==t.collectionGroup}function su(t){var e=t;if(null===e.ce){e.ce=[];var n=iu(e),t=ru(e);if(null!==n&&null===t)n.W()||e.ce.push(new Hu(n)),e.ce.push(new Hu(si.K(),"asc"));else{for(var r=!1,i=0,o=e.oe;i<o.length;i++){var s=o[i];e.ce.push(s),s.field.W()&&(r=!0)}r||(n=0<e.oe.length?e.oe[e.oe.length-1].dir:"asc",e.ce.push(new Hu(si.K(),n)))}}return e.ce}function uu(t){var e=t;if(!e.he)if("F"===e.ue)e.he=mi(e.path,e.collectionGroup,su(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=su(e);r<i.length;r++){var o=i[r],s="desc"===o.dir?"asc":"desc";n.push(new Hu(o.field,s))}var u=e.endAt?new Uu(e.endAt.position,!e.endAt.before):null,t=e.startAt?new Uu(e.startAt.position,!e.startAt.before):null;e.he=mi(e.path,e.collectionGroup,n,e.filters,e.limit,u,t)}return e.he}function au(t,e,n){return new Ys(t.path,t.collectionGroup,t.oe.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function hu(t,e){return new Ys(t.path,t.collectionGroup,t.oe.slice(),t.filters.slice(),t.limit,t.ue,e,t.endAt)}function cu(t,e){return new Ys(t.path,t.collectionGroup,t.oe.slice(),t.filters.slice(),t.limit,t.ue,t.startAt,e)}function lu(t,e){return bi(uu(t),uu(e))&&t.ue===e.ue}function fu(t){return wi(uu(t))+"|lt:"+t.ue}function pu(t){return"Query(target="+(e=uu(t),n=e.path.q(),null!==e.collectionGroup&&(n+=" collectionGroup="+e.collectionGroup),0<e.filters.length&&(n+=", filters: ["+e.filters.map(function(t){return(t=t).field.q()+" "+t.op+" "+wo(t.value)}).join(", ")+"]"),yi(e.limit)||(n+=", limit: "+e.limit),0<e.orderBy.length&&(n+=", orderBy: ["+e.orderBy.map(function(t){return(t=t).field.q()+" ("+t.dir+")"}).join(", ")+"]"),e.startAt&&(n+=", startAt: "+Bu(e.startAt)),e.endAt&&(n+=", endAt: "+Bu(e.endAt)),"Target("+n+")")+"; limitType="+t.ue+")";var e,n}function du(i,t){return e=i,n=t.key.path,(null!==e.collectionGroup?t.key.J(e.collectionGroup)&&e.path.$(n):ui.X(e.path)?e.path.isEqual(n):e.path.M(n))&&function(t){for(var e=0,n=i.oe;e<n.length;e++){var r=n[e];if(!r.field.W()&&null===t.field(r.field))return}return 1}(t)&&function(t){for(var e=0,n=i.filters;e<n.length;e++)if(!n[e].matches(t))return;return 1}(t)&&(n=t,(!(t=i).startAt||Gu(t.startAt,su(t),n))&&(!t.endAt||!Gu(t.endAt,su(t),n)));var e,n}function yu(u){return function(t,e){for(var n=!1,r=0,i=su(u);r<i.length;r++){var o=i[r],s=function(t,r,e){e=t.field.W()?ui.S(r.key,e.key):function(t,e){var n=r.field(t),t=e.field(t);return null!==n&&null!==t?go(n,t):Dr()}(t.field,e);switch(t.dir){case"asc":return e;case"desc":return-1*e;default:return Dr()}}(o,t,e);if(0!==s)return s;n=n||o.field.W()}return 0}}var vu,gu=(n(mu,vu=function(){}),mu.create=function(t,e,n){return t.W()?"in"===e||"not-in"===e?this.le(t,e,n):new Iu(t,e,n):"array-contains"===e?new _u(t,n):"in"===e?new Vu(t,n):"not-in"===e?new Cu(t,n):"array-contains-any"===e?new xu(t,n):new mu(t,e,n)},mu.le=function(t,e,n){return new("in"===e?Tu:Au)(t,n)},mu.prototype.matches=function(t){t=t.field(this.field);return"!="===this.op?null!==t&&this._e(go(t,this.value)):null!==t&&po(this.value)===po(t)&&this._e(go(t,this.value))},mu.prototype._e=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;case">=":return 0<=t;default:return Dr()}},mu.prototype.ae=function(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)},mu);function mu(t,e,n){var r=this;return(r=vu.call(this)||this).field=t,r.op=e,r.value=n,r}var wu,bu,Eu,Iu=(n(Su,Eu=gu),Su.prototype.matches=function(t){t=ui.S(t.key,this.key);return this._e(t)},Su),Tu=(n(Ou,bu=gu),Ou.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},Ou),Au=(n(Nu,wu=gu),Nu.prototype.matches=function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})},Nu);function Nu(t,e){var n=this;return(n=wu.call(this,t,"not-in",e)||this).keys=Pu(0,e),n}function Ou(t,e){var n=this;return(n=bu.call(this,t,"in",e)||this).keys=Pu(0,e),n}function Su(t,e,n){var r=this;return(r=Eu.call(this,t,e,n)||this).key=ui.Y(n.referenceValue),r}function Pu(t,e){return((null===(e=e.arrayValue)||void 0===e?void 0:e.values)||[]).map(function(t){return ui.Y(t.referenceValue)})}var Lu,ku,Ru,Du,_u=(n(Fu,Du=gu),Fu.prototype.matches=function(t){t=t.field(this.field);return No(t)&&vo(t.arrayValue,this.value)},Fu),Vu=(n(ju,Ru=gu),ju.prototype.matches=function(t){t=t.field(this.field);return null!==t&&vo(this.value.arrayValue,t)},ju),Cu=(n(qu,ku=gu),qu.prototype.matches=function(t){if(vo(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;t=t.field(this.field);return null!==t&&!vo(this.value.arrayValue,t)},qu),xu=(n(Mu,Lu=gu),Mu.prototype.matches=function(t){var e=this,t=t.field(this.field);return!(!No(t)||!t.arrayValue.values)&&t.arrayValue.values.some(function(t){return vo(e.value.arrayValue,t)})},Mu),Uu=function(t,e){this.position=t,this.before=e};function Mu(t,e){return Lu.call(this,t,"array-contains-any",e)||this}function qu(t,e){return ku.call(this,t,"not-in",e)||this}function ju(t,e){return Ru.call(this,t,"in",e)||this}function Fu(t,e){return Du.call(this,t,"array-contains",e)||this}function Bu(t){return(t.before?"b":"a")+":"+t.position.map(wo).join(",")}function Gu(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],s=t.position[i],r=o.field.W()?ui.S(ui.Y(s.referenceValue),n.key):go(s,n.field(o.field));if("desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function Wu(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.before!==e.before||t.position.length!==e.position.length)return!1;for(var n=0;n<t.position.length;n++)if(!yo(t.position[n],e.position[n]))return!1;return!0}var Hu=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function zu(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}var Xu=(Yu.prototype.reset=function(){this.Te=0},Yu.prototype.Re=function(){this.Te=this.me},Yu.prototype.Pe=function(t){var e=this;this.cancel();var n=Math.floor(this.Te+this.ye()),r=Math.max(0,Date.now()-this.Ae),i=Math.max(0,n-r);0<i&&Pr("ExponentialBackoff","Backing off for "+i+" ms (base delay: "+this.Te+" ms, delay with jitter: "+n+" ms, last attempt: "+r+" ms ago)"),this.Ie=this.fe.Ve(this.de,i,function(){return e.Ae=Date.now(),t()}),this.Te*=this.Ee,this.Te<this.we&&(this.Te=this.we),this.Te>this.me&&(this.Te=this.me)},Yu.prototype.ge=function(){null!==this.Ie&&(this.Ie.pe(),this.Ie=null)},Yu.prototype.cancel=function(){null!==this.Ie&&(this.Ie.cancel(),this.Ie=null)},Yu.prototype.ye=function(){return(Math.random()-.5)*this.Te},Yu),Qu=($u.prototype.catch=function(t){return this.next(void 0,t)},$u.prototype.next=function(r,i){var o=this;return this.Se&&Dr(),this.Se=!0,this.Ce?this.error?this.De(i,this.error):this.Fe(r,this.result):new $u(function(e,n){o.ve=function(t){o.Fe(r,t).next(e,n)},o.be=function(t){o.De(i,t).next(e,n)}})},$u.prototype.Ne=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},$u.prototype.xe=function(t){try{var e=t();return e instanceof $u?e:$u.resolve(e)}catch(t){return $u.reject(t)}},$u.prototype.Fe=function(t,e){return t?this.xe(function(){return t(e)}):$u.resolve(e)},$u.prototype.De=function(t,e){return t?this.xe(function(){return t(e)}):$u.reject(e)},$u.resolve=function(n){return new $u(function(t,e){t(n)})},$u.reject=function(n){return new $u(function(t,e){e(n)})},$u.Oe=function(t){return new $u(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()})},$u.ke=function(t){for(var n=$u.resolve(!1),e=0,r=t;e<r.length;e++)!function(e){n=n.next(function(t){return t?$u.resolve(t):e()})}(r[e]);return n},$u.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.Oe(i)},$u);function $u(t){var e=this;this.ve=null,this.be=null,this.result=void 0,this.error=void 0,this.Ce=!1,this.Se=!1,t(function(t){e.Ce=!0,e.result=t,e.ve&&e.ve(t)},function(t){e.Ce=!0,e.error=t,e.be&&e.be(t)})}function Yu(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.fe=t,this.de=e,this.we=n,this.Ee=r,this.me=i,this.Te=0,this.Ie=null,this.Ae=Date.now(),this.reset()}function Ku(t){return"IndexedDbTransactionError"===t.name}function Zu(){return"undefined"!=typeof document?document:null}var Ju=(na.Ue=function(t,e,n,r,i){i=new na(t,e,Date.now()+n,r,i);return i.start(n),i},na.prototype.start=function(t){var e=this;this.Be=setTimeout(function(){return e.je()},t)},na.prototype.pe=function(){return this.je()},na.prototype.cancel=function(t){null!==this.Be&&(this.clearTimeout(),this.qe.reject(new Ar(Tr.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},na.prototype.je=function(){var e=this;this.$e.We(function(){return null!==e.Be?(e.clearTimeout(),e.op().then(function(t){return e.qe.resolve(t)})):Promise.resolve()})},na.prototype.clearTimeout=function(){null!==this.Be&&(this.Le(this),clearTimeout(this.Be),this.Be=null)},na),ta=(Object.defineProperty(ea.prototype,"ts",{get:function(){return this.Ge},enumerable:!1,configurable:!0}),ea.prototype.We=function(t){this.enqueue(t)},ea.prototype.ns=function(t){this.es(),this.ss(t)},ea.prototype.rs=function(){var t;this.Ge||(this.Ge=!0,(t=Zu())&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Ze))},ea.prototype.enqueue=function(t){return this.es(),this.Ge?new Promise(function(t){}):this.ss(t)},ea.prototype.os=function(t){var e=this;this.We(function(){return e.Ke.push(t),e.us()})},ea.prototype.us=function(){return y(this,void 0,void 0,function(){var e,n=this;return v(this,function(t){switch(t.label){case 0:if(0===this.Ke.length)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.Ke[0]()];case 2:return t.sent(),this.Ke.shift(),this.Xe.reset(),[3,4];case 3:if(!Ku(e=t.sent()))throw e;return Pr("AsyncQueue","Operation failed with retryable error: "+e),[3,4];case 4:0<this.Ke.length&&this.Xe.Pe(function(){return n.us()}),t.label=5;case 5:return[2]}})})},ea.prototype.ss=function(t){var r=this,e=this.Qe.then(function(){return r.Ye=!0,t().catch(function(t){throw r.ze=t,r.Ye=!1,Lr("INTERNAL UNHANDLED ERROR: ",(n=(e=t).message||"",e.stack&&(n=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),n)),t;var e,n}).then(function(t){return r.Ye=!1,t})});return this.Qe=e},ea.prototype.Ve=function(t,e,n){var r=this;this.es(),-1<this.Je.indexOf(t)&&(e=0);n=Ju.Ue(this,t,e,n,function(t){return r.cs(t)});return this.He.push(n),n},ea.prototype.es=function(){this.ze&&Dr()},ea.prototype.hs=function(){},ea.prototype.ls=function(){return y(this,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return[4,e=this.Qe];case 1:t.sent(),t.label=2;case 2:if(e!==this.Qe)return[3,0];t.label=3;case 3:return[2]}})})},ea.prototype._s=function(t){for(var e=0,n=this.He;e<n.length;e++)if(n[e].de===t)return!0;return!1},ea.prototype.fs=function(r){var i=this;return this.ls().then(function(){i.He.sort(function(t,e){return t.Me-e.Me});for(var t=0,e=i.He;t<e.length;t++){var n=e[t];if(n.pe(),"all"!==r&&n.de===r)break}return i.ls()})},ea.prototype.ds=function(t){this.Je.push(t)},ea.prototype.cs=function(t){t=this.He.indexOf(t);this.He.splice(t,1)},ea);function ea(){var e=this;this.Qe=Promise.resolve(),this.Ke=[],this.Ge=!1,this.He=[],this.ze=null,this.Ye=!1,this.Je=[],this.Xe=new Xu(this,"async_queue_retry"),this.Ze=function(){var t=Zu();t&&Pr("AsyncQueue","Visibility state changed to "+t.visibilityState),e.Xe.ge()};var t=Zu();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Ze)}function na(t,e,n,r,i){this.$e=t,this.de=e,this.Me=n,this.op=r,this.Le=i,this.qe=new zu,this.then=this.qe.promise.then.bind(this.qe.promise),this.qe.promise.catch(function(t){})}function ra(t,e){if(Lr("AsyncQueue",e+": "+t),Ku(t))return new Ar(Tr.UNAVAILABLE,e+": "+t);throw t}function ia(){this.Es=new ei(fu,lu),this.onlineState="Unknown",this.Ts=new Set}var oa=function(){this.ws=void 0,this.listeners=[]};function sa(s,u){return y(this,void 0,void 0,function(){var e,n,r,i,o;return v(this,function(t){switch(t.label){case 0:if(e=s,n=u.query,r=!1,(i=e.Es.get(n))||(r=!0,i=new oa),!r)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),o=i,[4,e.Is(n)];case 2:return o.ws=t.sent(),[3,4];case 3:return o=t.sent(),o=ra(o,"Initialization of query '"+pu(u.query)+"' failed"),[2,void u.onError(o)];case 4:return e.Es.set(n,i),i.listeners.push(u),u.As(e.onlineState),i.ws&&u.Rs(i.ws)&&aa(e),[2]}})})}function ua(s,u){return y(this,void 0,void 0,function(){var e,n,r,i,o;return v(this,function(t){return e=s,n=u.query,r=!1,(i=e.Es.get(n))&&0<=(o=i.listeners.indexOf(u))&&(i.listeners.splice(o,1),r=0===i.listeners.length),r?[2,(e.Es.delete(n),e.Ps(n))]:[2]})})}function aa(t){t.Ts.forEach(function(t){t.next()})}var ha=(fa.prototype.Rs=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 Xi(t.query,t.docs,t.jt,e,t.Wt,t.fromCache,t.Qt,!0)}var o=!1;return this.Vs?this.ps(t)&&(this.ys.next(t),o=!0):this.vs(t,this.onlineState)&&(this.bs(t),o=!0),this.gs=t,o},fa.prototype.onError=function(t){this.ys.error(t)},fa.prototype.As=function(t){this.onlineState=t;var e=!1;return this.gs&&!this.Vs&&this.vs(this.gs,t)&&(this.bs(this.gs),e=!0),e},fa.prototype.vs=function(t,e){if(!t.fromCache)return!0;var n="Offline"!==e;return!(this.options.Cs&&n||t.docs.P()&&"Offline"!==e)},fa.prototype.ps=function(t){if(0<t.docChanges.length)return!0;var e=this.gs&&this.gs.hasPendingWrites!==t.hasPendingWrites;return!(!t.Qt&&!e)&&!0===this.options.includeMetadataChanges},fa.prototype.bs=function(t){t=Xi.Gt(t.query,t.docs,t.Wt,t.fromCache),this.Vs=!0,this.ys.next(t)},fa),ca=(la.prototype.Ss=function(){return null!=this.uid},la.prototype.Ds=function(){return this.Ss()?"uid:"+this.uid:"anonymous-user"},la.prototype.isEqual=function(t){return t.uid===this.uid},la);function la(t){this.uid=t}function fa(t,e,n){this.query=t,this.ys=e,this.Vs=!1,this.gs=null,this.onlineState="Unknown",this.options=n||{}}ca.UNAUTHENTICATED=new ca(null),ca.Fs=new ca("google-credentials-uid"),ca.Ns=new ca("first-party-uid");function pa(t,e){this.user=e,this.type="OAuth",this.xs={},this.xs.Authorization="Bearer "+t}var da=(Ra.prototype.getToken=function(){return Promise.resolve(null)},Ra.prototype.ks=function(){},Ra.prototype.$s=function(t){(this.Os=t)(ca.UNAUTHENTICATED)},Ra.prototype.Ms=function(){this.Os=null},Ra),ya=(ka.prototype.getToken=function(){var e=this,n=this.Us,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(function(t){return e.Us!==n?(Pr("FirebaseCredentialsProvider","getToken aborted due to token change."),e.getToken()):t?(_r("string"==typeof t.accessToken),new pa(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},ka.prototype.ks=function(){this.forceRefresh=!0},ka.prototype.$s=function(t){this.Os=t,this.qs&&t(this.currentUser)},ka.prototype.Ms=function(){this.auth&&this.auth.removeAuthTokenListener(this.Ls),this.Ls=null,this.Os=null},ka.prototype.Bs=function(){var t=this.auth&&this.auth.getUid();return _r(null===t||"string"==typeof t),new ca(t)},ka),va=(Object.defineProperty(La.prototype,"xs",{get:function(){var t={"X-Goog-AuthUser":this.Ws},e=this.js.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),t},enumerable:!1,configurable:!0}),La),ga=(Pa.prototype.getToken=function(){return Promise.resolve(new va(this.js,this.Ws))},Pa.prototype.$s=function(t){t(ca.Ns)},Pa.prototype.Ms=function(){},Pa.prototype.ks=function(){},Pa),ma=(Sa.prototype.Ks=function(t,e,n){for(var r=n.Gs,i=0;i<this.mutations.length;i++){var o=this.mutations[i];o.key.isEqual(t)&&(e=ws(o,e,r[i]))}return e},Sa.prototype.Hs=function(t,e){for(var n=0,r=this.baseMutations;n<r.length;n++){var i=r[n];i.key.isEqual(t)&&(e=bs(i,e,e,this.Qs))}for(var o=e,s=0,u=this.mutations;s<u.length;s++){var a=u[s];a.key.isEqual(t)&&(e=bs(a,e,o,this.Qs))}return e},Sa.prototype.zs=function(n){var r=this,i=n;return this.mutations.forEach(function(t){var e=r.Hs(t.key,n.get(t.key));e&&(i=i.ot(t.key,e))}),i},Sa.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},Gi())},Sa.prototype.isEqual=function(t){return this.batchId===t.batchId&&Ur(this.mutations,t.mutations,Es)&&Ur(this.baseMutations,t.baseMutations,Es)},Sa),wa=(Oa.from=function(t,e,n){_r(t.mutations.length===n.length);for(var r=Fi,i=t.mutations,o=0;o<i.length;o++)r=r.ot(i[o].key,n[o].version);return new Oa(t,e,n,r)},Oa),ba=(Na.prototype.ni=function(e,n){var r=this;return this.Zs.ei(e,n).next(function(t){return r.si(e,n,t)})},Na.prototype.si=function(t,r,i){return this.Xs.ii(t,r).next(function(t){for(var e=0,n=i;e<n.length;e++)t=n[e].Hs(r,t);return t})},Na.prototype.ri=function(t,e,i){var o=Ui;return e.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)e=r[n].Hs(t,e);o=o.ot(t,e)}),o},Na.prototype.oi=function(e,t){var n=this;return this.Xs.getEntries(e,t).next(function(t){return n.ui(e,t)})},Na.prototype.ui=function(e,r){var i=this;return this.Zs.ci(e,r).next(function(t){var t=i.ri(e,r,t),n=Ui;return t.forEach(function(t,e){e=e||new Qs(t,ri.min()),n=n.ot(t,e)}),n})},Na.prototype.hi=function(t,e,n){return r=e,ui.X(r.path)&&null===r.collectionGroup&&0===r.filters.length?this.ai(t,e.path):ou(e)?this.li(t,e,n):this._i(t,e,n);var r},Na.prototype.ai=function(t,e){return this.ni(t,new ui(e)).next(function(t){var e=ji;return t instanceof Xs&&(e=e.ot(t.key,t)),e})},Na.prototype.li=function(n,r,i){var o=this,s=r.collectionGroup,u=ji;return this.ti.fi(n,s).next(function(t){return Qu.forEach(t,function(t){var e,e=(e=r,t=t.child(s),new Ys(t,null,e.oe.slice(),e.filters.slice(),e.limit,e.ue,e.startAt,e.endAt));return o._i(n,e,i).next(function(t){t.forEach(function(t,e){u=u.ot(t,e)})})}).next(function(){return u})})},Na.prototype._i=function(e,n,t){var h,c,r=this;return this.Xs.hi(e,n,t).next(function(t){return h=t,r.Zs.di(e,n)}).next(function(t){return c=t,r.wi(e,c,h).next(function(t){h=t;for(var e=0,n=c;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=h.get(u),a=bs(s,a,a,r.Qs);h=a instanceof Xs?h.ot(u,a):h.remove(u)}})}).next(function(){return h.forEach(function(t,e){du(n,e)||(h=h.remove(t))}),h})},Na.prototype.wi=function(t,e,n){for(var r=Gi(),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 Os&&null===n.get(a.key)&&(r=r.add(a.key))}var h=n;return this.Xs.getEntries(t,r).next(function(t){return t.forEach(function(t,e){null!==e&&e instanceof Xs&&(h=h.ot(t,e))}),h})},Na),Ea=(Aa.Ti=function(t,e){for(var n=Gi(),r=Gi(),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 Aa(t,e.fromCache,n,r)},Aa),Ia=(Ta.prototype.Ai=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},Ta.prototype.next=function(){var t=++this.previousValue;return this.Ri&&this.Ri(t),t},Ta);function Ta(t,e){var n=this;this.previousValue=t,e&&(e.Ii=function(t){return n.Ai(t)},this.Ri=function(t){return e.Pi(t)})}function Aa(t,e,n,r){this.targetId=t,this.fromCache=e,this.Ei=n,this.mi=r}function Na(t,e,n){this.Xs=t,this.Zs=e,this.ti=n}function Oa(t,e,n,r){this.batch=t,this.Ys=e,this.Gs=n,this.Js=r}function Sa(t,e,n,r){this.batchId=t,this.Qs=e,this.baseMutations=n,this.mutations=r}function Pa(t,e){this.js=t,this.Ws=e}function La(t,e){this.js=t,this.Ws=e,this.type="FirstParty",this.user=ca.Ns}function ka(t){var e=this;this.Ls=null,this.currentUser=ca.UNAUTHENTICATED,this.qs=!1,this.Us=0,this.Os=null,this.forceRefresh=!1,this.Ls=function(){e.Us++,e.currentUser=e.Bs(),e.qs=!0,e.Os&&e.Os(e.currentUser)},this.Us=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.Ls):(this.Ls(null),t.get().then(function(t){e.auth=t,e.Ls&&e.auth.addAuthTokenListener(e.Ls)},function(){}))}function Ra(){this.Os=null}Ia.yi=-1;var Da=(qa.prototype.gi=function(t,e){return this.Vi.add(e),Qu.resolve()},qa.prototype.fi=function(t,e){return Qu.resolve(this.Vi.getEntries(e))},qa),_a=(Ma.prototype.add=function(t){var e=t.k(),n=t.N(),r=this.index[e]||new Ci(ii.S),t=!r.has(n);return this.index[e]=r.add(n),t},Ma.prototype.has=function(t){var e=t.k(),t=t.N(),e=this.index[e];return e&&e.has(t)},Ma.prototype.getEntries=function(t){return(this.index[t]||new Ci(ii.S)).L()},Ma),Va=(Ua.prototype.next=function(){return this.pi+=2,this.pi},Ua.vi=function(){return new Ua(0)},Ua.bi=function(){return new Ua(-1)},Ua),Ca=(xa.prototype.Ui=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.Bi(t,n.Si)})},xa);function xa(t,e,n){this.persistence=t,this.Ci=e,this.Si=new Pi(xr),this.Di=new ei(wi,bi),this.Fi=ri.min(),this.Zs=t.Ni(n),this.xi=t.Oi(),this.ki=t.$i(),this.Mi=new ba(this.xi,this.Zs,this.persistence.Li()),this.Ci.qi(this.Mi)}function Ua(t){this.pi=t}function Ma(){this.index={}}function qa(){this.Vi=new _a}function ja(i,o){return y(this,void 0,void 0,function(){var e,n,m,r;return v(this,function(t){switch(t.label){case 0:return n=(e=i).Zs,m=e.Mi,[4,e.persistence.runTransaction("Handle user change","readonly",function(v){var g;return e.Zs.ji(v).next(function(t){return g=t,n=e.persistence.Ni(o),m=new ba(e.xi,n,e.persistence.Li()),n.ji(v)}).next(function(t){for(var e=[],n=[],r=Gi(),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,l=t;c<l.length;c++){var f=l[c];n.push(f.batchId);for(var p=0,d=f.mutations;p<d.length;p++){var y=d[p];r=r.add(y.key)}}return m.oi(v,r).next(function(t){return{Wi:t,Qi:e,Ki:n}})})})];case 1:return r=t.sent(),[2,(e.Zs=n,e.Mi=m,e.Ci.qi(e.Mi),r)]}})})}function Fa(t,c){var l=t;return l.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e,r,i,o,s,n,u,a=c.batch.keys(),h=l.xi.Gi({Hi:!0});return e=l,r=t,o=h,s=(i=c).batch,n=s.keys(),u=Qu.resolve(),n.forEach(function(n){u=u.next(function(){return o.ii(r,n)}).next(function(t){var e=t,t=i.Js.get(n);_r(null!==t),(!e||e.version.u(t)<0)&&(e=s.Ks(n,e,i))&&o.zi(e,i.Ys)})}),u.next(function(){return e.Zs.Yi(r,s)}).next(function(){return h.apply(t)}).next(function(){return l.Zs.Ji(t)}).next(function(){return l.Mi.oi(t,a)})})}function Ba(t){var e=t;return e.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.ki.Xi(t)})}function Ga(t,a){var h=t,c=a.et,l=h.Si;return h.persistence.runTransaction("Apply remote event","readwrite-primary",function(s){var i=h.xi.Gi({Hi:!0});l=h.Si;var u=[];a.Ht.forEach(function(t,e){var n,r,i,o=l.get(e);o&&(u.push(h.ki.Zi(s,t.sn,e).next(function(){return h.ki.tr(s,t.nn,e)})),0<(i=t.resumeToken).o()&&(n=o.it(i,c).st(s.nr),l=l.ot(e,n),r=o,i=t,_r(0<(o=n).resumeToken.o()),(0===r.resumeToken.o()||3e8<=o.et.p()-r.et.p()||0<i.nn.size+i.en.size+i.sn.size)&&u.push(h.ki.er(s,n))))});var t,o=Ui,n=Gi();return a.Yt.forEach(function(t,e){n=n.add(t)}),u.push(i.getEntries(s,n).next(function(r){a.Yt.forEach(function(t,e){var n=r.get(t);e instanceof Qs&&e.version.isEqual(ri.min())?(i.sr(t,c),o=o.ot(t,e)):null==n||0<e.version.u(n.version)||0===e.version.u(n.version)&&n.hasPendingWrites?(i.zi(e,c),o=o.ot(t,e)):Pr("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version),a.Jt.has(t)&&u.push(h.persistence.rr.ir(s,t))})})),c.isEqual(ri.min())||(t=h.ki.Xi(s).next(function(t){return h.ki.ur(s,s.nr,c)}),u.push(t)),Qu.Oe(u).next(function(){return i.apply(s)}).next(function(){return h.Mi.ui(s,o)})}).then(function(t){return h.Si=l,t})}function Wa(i,o,s){return y(this,void 0,void 0,function(){var e,n,r;return v(this,function(t){switch(t.label){case 0:n=(e=i).Si.get(o),r=s?"readwrite":"readwrite-primary",t.label=1;case 1:return t.trys.push([1,4,,5]),s?[3,3]:[4,e.persistence.runTransaction("Release target",r,function(t){return e.persistence.rr.removeTarget(t,n)})];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:if(!Ku(r=t.sent()))throw r;return Pr("LocalStore","Failed to update sequence numbers for target "+o+": "+r),[3,5];case 5:return e.Si=e.Si.remove(o),e.Di.delete(n.target),[2]}})})}function Ha(t,o,s){var u=t,a=ri.min(),h=Gi();return u.persistence.runTransaction("Execute query","readonly",function(e){return t=u,n=e,r=uu(o),(void 0!==(t=(i=t).Di.get(r))?Qu.resolve(i.Si.get(t)):i.ki.hr(n,r)).next(function(t){if(t)return a=t.lastLimboFreeSnapshotVersion,u.ki.ar(e,t.targetId).next(function(t){h=t})}).next(function(){return u.Ci.hi(e,o,s?a:ri.min(),s?h:Gi())}).next(function(t){return{documents:t,lr:h}});var t,n,r,i})}function za(e){return y(this,void 0,void 0,function(){return v(this,function(t){if(e.code!==Tr.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 Pr("LocalStore","Unexpectedly lost primary lease"),[2]})})}function Xa(t,e,n,r,i){var o=this;this.io=t,this.ro=e,this.$e=n,this.oo={},this.uo=[],this.co=new Map,this.ho=new Set,this.ao=[],this.lo=i,this.lo._o(function(t){n.We(function(){return y(o,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return dh(this)?(Pr("RemoteStore","Restarting streams for network reachability change."),[4,function(n){return y(this,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return(e=n).ho.add(4),[4,uh(e)];case 1:return t.sent(),e.fo.set("Unknown"),e.ho.delete(4),[4,sh(e)];case 2:return t.sent(),[2]}})})}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.fo=new th(n,r)}var Qa,$a,Ya,l=(oh.prototype.Tr=function(){return 1===this.state||2===this.state||4===this.state},oh.prototype.Ir=function(){return 2===this.state},oh.prototype.start=function(){3!==this.state?this.auth():this.Ar()},oh.prototype.stop=function(){return y(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return this.Tr()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},oh.prototype.Rr=function(){this.state=0,this.Xe.reset()},oh.prototype.Pr=function(){var t=this;this.Ir()&&null===this.mr&&(this.mr=this.fe.Ve(this._r,6e4,function(){return t.yr()}))},oh.prototype.Vr=function(t){this.gr(),this.stream.send(t)},oh.prototype.yr=function(){return y(this,void 0,void 0,function(){return v(this,function(t){return this.Ir()?[2,this.close(0)]:[2]})})},oh.prototype.gr=function(){this.mr&&(this.mr.cancel(),this.mr=null)},oh.prototype.close=function(e,n){return y(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return this.gr(),this.Xe.cancel(),this.Er++,3!==e?this.Xe.reset():n&&n.code===Tr.RESOURCE_EXHAUSTED?(Lr(n.toString()),Lr("Using maximum backoff delay to prevent overloading the backend."),this.Xe.Re()):n&&n.code===Tr.UNAUTHENTICATED&&this.wr.ks(),null!==this.stream&&(this.pr(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.vr(n)];case 1:return t.sent(),[2]}})})},oh.prototype.pr=function(){},oh.prototype.auth=function(){var n=this;this.state=1;var t=this.br(this.Er),e=this.Er;this.wr.getToken().then(function(t){n.Er===e&&n.Cr(t)},function(e){t(function(){var t=new Ar(Tr.UNKNOWN,"Fetching auth token failed: "+e.message);return n.Sr(t)})})},oh.prototype.Cr=function(t){var e=this,n=this.br(this.Er);this.stream=this.Dr(t),this.stream.Fr(function(){n(function(){return e.state=2,e.listener.Fr()})}),this.stream.vr(function(t){n(function(){return e.Sr(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},oh.prototype.Ar=function(){var t=this;this.state=4,this.Xe.Pe(function(){return y(t,void 0,void 0,function(){return v(this,function(t){return this.state=0,this.start(),[2]})})})},oh.prototype.Sr=function(t){return Pr("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},oh.prototype.br=function(e){var n=this;return function(t){n.fe.We(function(){return n.Er===e?t():(Pr("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},oh),Ka=(n(ih,Ya=l),ih.prototype.Dr=function(t){return this.dr.Nr("Listen",t)},ih.prototype.onMessage=function(t){this.Xe.reset();var e=function(t,e){if("targetChange"in e){e.targetChange;var n="NO_CHANGE"===(i=e.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===i?1:"REMOVE"===i?2:"CURRENT"===i?3:"RESET"===i?4:Dr(),r=e.targetChange.targetIds||[],i=(o=e.targetChange.resumeToken,t.Wn?(_r(void 0===o||"string"==typeof o),Mr.fromBase64String(o||"")):(_r(void 0===o||o instanceof Uint8Array),Mr.fromUint8Array(o||new Uint8Array))),o=e.targetChange.cause,s=o&&(o=void 0===(s=o).code?Tr.UNKNOWN:Si(s.code),new Ar(o,s.message||"")),r=new Zi(n,r,i,s||null)}else if("documentChange"in e){e.documentChange;var u=e.documentChange;u.document,u.document.name,u.document.updateTime;var i=jo(t,u.document.name),a=Uo(u.document.updateTime),s=new Ms({mapValue:{fields:u.document.fields}}),a=new Xs(i,a,s,{}),s=u.targetIds||[],u=u.removedTargetIds||[];r=new Yi(s,u,a.key,a)}else if("documentDelete"in e){e.documentDelete;u=e.documentDelete;u.document;var a=jo(t,u.document),h=u.readTime?Uo(u.readTime):ri.min(),h=new Qs(a,h),u=u.removedTargetIds||[];r=new Yi([],u,h.key,h)}else if("documentRemove"in e){e.documentRemove;h=e.documentRemove;h.document;var c=jo(t,h.document),h=h.removedTargetIds||[];r=new Yi([],h,c,null)}else{if(!("filter"in e))return Dr();e.filter;c=e.filter;c.targetId;e=c.count||0,e=new Ii(e),c=c.targetId;r=new Ki(c,e)}return r}(this.serializer,t),t=function(t){if(!("targetChange"in t))return ri.min();t=t.targetChange;return(!t.targetIds||!t.targetIds.length)&&t.readTime?Uo(t.readTime):ri.min()}(t);return this.listener.Or(e,t)},ih.prototype.kr=function(t){var e,n,r,i={};i.database=Bo(this.serializer),i.addTarget=(e=this.serializer,(r=Ei(r=(n=t).target)?{documents:{documents:[Fo(e,r.path)]}}:{query:Ho(e,r)}).targetId=n.targetId,0<n.resumeToken.o()&&(r.resumeToken=xo(e,n.resumeToken)),r);var o,t=(this.serializer,o=t,null==(t=function(){switch(o.nt){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Dr()}}())?null:{"goog-listen-tags":t});t&&(i.labels=t),this.Vr(i)},ih.prototype.$r=function(t){var e={};e.database=Bo(this.serializer),e.removeTarget=t,this.Vr(e)},ih),Za=(n(rh,$a=l),Object.defineProperty(rh.prototype,"Lr",{get:function(){return this.Mr},enumerable:!1,configurable:!0}),rh.prototype.start=function(){this.Mr=!1,this.lastStreamToken=void 0,$a.prototype.start.call(this)},rh.prototype.pr=function(){this.Mr&&this.qr([])},rh.prototype.Dr=function(t){return this.dr.Nr("Write",t)},rh.prototype.onMessage=function(t){if(_r(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Mr){this.Xe.reset();var e=(n=t.writeResults,r=t.commitTime,n&&0<n.length?(_r(void 0!==r),n.map(function(t){return function(t,e){var n=t.updateTime?Uo(t.updateTime):Uo(e);n.isEqual(ri.min())&&(n=Uo(e));e=null;return t.transformResults&&0<t.transformResults.length&&(e=t.transformResults),new ys(n,e)}(t,r)})):[]),n=Uo(t.commitTime);return this.listener.Ur(n,e)}var n,r;return _r(!t.writeResults||0===t.writeResults.length),this.Mr=!0,this.listener.Br()},rh.prototype.jr=function(){var t={};t.database=Bo(this.serializer),this.Vr(t)},rh.prototype.qr=function(t){var e=this,t={streamToken:this.lastStreamToken,writes:t.map(function(t){return Wo(e.serializer,t)})};this.Vr(t)},rh),Ja=(n(nh,Qa=function(){}),nh.prototype.Qr=function(){if(this.Wr)throw new Ar(Tr.FAILED_PRECONDITION,"The client has already been terminated.")},nh.prototype.Kr=function(e,n,r){var i=this;return this.Qr(),this.credentials.getToken().then(function(t){return i.dr.Kr(e,n,r,t)}).catch(function(t){throw t.code===Tr.UNAUTHENTICATED&&i.credentials.ks(),t})},nh.prototype.Gr=function(e,n,r){var i=this;return this.Qr(),this.credentials.getToken().then(function(t){return i.dr.Gr(e,n,r,t)}).catch(function(t){throw t.code===Tr.UNAUTHENTICATED&&i.credentials.ks(),t})},nh.prototype.terminate=function(){this.Wr=!1},nh),th=(eh.prototype.Xr=function(){var t=this;0===this.zr&&(this.Zr("Unknown"),this.Yr=this.$e.Ve("online_state_timeout",1e4,function(){return t.Yr=null,t.no("Backend didn't respond within 10 seconds."),t.Zr("Offline"),Promise.resolve()}))},eh.prototype.eo=function(t){"Online"===this.state?this.Zr("Unknown"):(this.zr++,1<=this.zr&&(this.so(),this.no("Connection failed 1 times. Most recent error: "+t.toString()),this.Zr("Offline")))},eh.prototype.set=function(t){this.so(),this.zr=0,"Online"===t&&(this.Jr=!1),this.Zr(t)},eh.prototype.Zr=function(t){t!==this.state&&(this.state=t,this.Hr(t))},eh.prototype.no=function(t){t="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.Jr?(Lr(t),this.Jr=!1):Pr("OnlineStateTracker",t)},eh.prototype.so=function(){null!==this.Yr&&(this.Yr.cancel(),this.Yr=null)},eh);function eh(t,e){this.$e=t,this.Hr=e,this.state="Unknown",this.zr=0,this.Yr=null,this.Jr=!0}function nh(t,e,n){var r=this;return(r=Qa.call(this)||this).credentials=t,r.dr=e,r.serializer=n,r.Wr=!1,r}function rh(t,e,n,r,i){var o=this;return(o=$a.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).serializer=r,o.Mr=!1,o}function ih(t,e,n,r,i){var o=this;return(o=Ya.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).serializer=r,o}function oh(t,e,n,r,i,o){this.fe=t,this._r=n,this.dr=r,this.wr=i,this.listener=o,this.state=0,this.Er=0,this.mr=null,this.stream=null,this.Xe=new Xu(t,e)}function sh(r){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:if(!dh(r))return[3,4];e=0,n=r.ao,t.label=1;case 1:return e<n.length?[4,(0,n[e])(!0)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})}function uh(r){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:e=0,n=r.ao,t.label=1;case 1:return e<n.length?[4,(0,n[e])(!1)]:[3,4];case 2:t.sent(),t.label=3;case 3:return e++,[3,1];case 4:return[2]}})})}function ah(t,e){t.co.has(e.targetId)||(t.co.set(e.targetId,e),ph(t)?fh(t):Ih(t).Ir()&&ch(t,e))}function hh(t,e){var n=t,t=Ih(n);n.co.delete(e),t.Ir()&&lh(n,e),0===n.co.size&&(t.Ir()?t.Pr():dh(n)&&n.fo.set("Unknown"))}function ch(t,e){t.do.An(e.targetId),Ih(t).kr(e)}function lh(t,e){t.do.An(e),Ih(t).$r(e)}function fh(e){e.do=new to({Bn:function(t){return e.oo.Bn(t)},jn:function(t){return e.co.get(t)||null}}),Ih(e).start(),e.fo.Xr()}function ph(t){return dh(t)&&!Ih(t).Tr()&&0<t.co.size}function dh(t){return 0===t.ho.size}function yh(t){t.do=void 0}function vh(s,u,a){return y(this,void 0,void 0,function(){var n,o;return v(this,function(t){switch(t.label){case 0:if(s.fo.set("Online"),!(u instanceof Zi&&2===u.state&&u.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,function(o,s){return y(this,void 0,void 0,function(){var e,n,r,i;return v(this,function(t){switch(t.label){case 0:e=s.cause,n=0,r=s.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],o.co.has(i)?[4,o.oo.wo(i,e)]:[3,3]):[3,5];case 2:t.sent(),o.co.delete(i),o.do.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})}(s,u)];case 2:return t.sent(),[3,5];case 3:return n=t.sent(),Pr("RemoteStore","Failed to remove targets %s: %s ",u.targetIds.join(","),n),[4,gh(s,n)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(u instanceof Yi?s.do.bn(u):u instanceof Ki?s.do.kn(u):s.do.Dn(u),a.isEqual(ri.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,Ba(s.io)];case 8:return o=t.sent(),0<=a.u(o)?[4,(i=a,(e=(r=s).do.Ln(i)).Ht.forEach(function(t,e){var n;0<t.resumeToken.o()&&((n=r.co.get(e))&&r.co.set(e,n.it(t.resumeToken,i)))}),e.zt.forEach(function(t){var e=r.co.get(t);e&&(r.co.set(t,e.it(Mr.h,e.et)),lh(r,t),e=new Ai(e.target,t,1,e.sequenceNumber),ch(r,e))}),r.oo.Eo(e))]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return Pr("RemoteStore","Failed to raise snapshot:",o=t.sent()),[4,gh(s,o)];case 12:return t.sent(),[3,13];case 13:return[2]}var r,i,e})})}function gh(n,r,i){return y(this,void 0,void 0,function(){var e=this;return v(this,function(t){switch(t.label){case 0:if(!Ku(r))throw r;return n.ho.add(1),[4,uh(n)];case 1:return t.sent(),n.fo.set("Offline"),i=i||function(){return Ba(n.io)},n.$e.os(function(){return y(e,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return Pr("RemoteStore","Retrying IndexedDB access"),[4,i()];case 1:return t.sent(),n.ho.delete(1),[4,sh(n)];case 2:return t.sent(),[2]}})})}),[2]}})})}function mh(e,n){return n().catch(function(t){return gh(e,t,n)})}function wh(a){return y(this,void 0,void 0,function(){var i,o,s,u;return v(this,function(t){switch(t.label){case 0:o=Th(i=a),s=0<i.uo.length?i.uo[i.uo.length-1].batchId:-1,t.label=1;case 1:if(!(dh(i)&&i.uo.length<10))return[3,7];t.label=2;case 2:return t.trys.push([2,4,,6]),[4,(e=i.io,n=s,(r=e).persistence.runTransaction("Get next mutation batch","readonly",function(t){return void 0===n&&(n=-1),r.Zs.cr(t,n)}))];case 3:return null===(u=t.sent())?(0===i.uo.length&&o.Pr(),[3,7]):(s=u.batchId,function(t,e){t.uo.push(e);t=Th(t);t.Ir()&&t.Lr&&t.qr(e.mutations)}(i,u),[3,6]);case 4:return u=t.sent(),[4,gh(i,u)];case 5:return t.sent(),[3,6];case 6:return[3,1];case 7:return bh(i)&&Eh(i),[2]}var e,n,r})})}function bh(t){return dh(t)&&!Th(t).Tr()&&0<t.uo.length}function Eh(t){Th(t).start()}function Ih(n){var t,e,r,i=this;return n.Io||(n.Io=(t=n.ro,e=n.$e,r={Fr:function(n){return y(this,void 0,void 0,function(){return v(this,function(t){return n.co.forEach(function(t,e){ch(n,t)}),[2]})})}.bind(null,n),vr:function(e,n){return y(this,void 0,void 0,function(){return v(this,function(t){return yh(e),ph(e)?(e.fo.eo(n),fh(e)):e.fo.set("Unknown"),[2]})})}.bind(null,n),Or:vh.bind(null,n)},t.Qr(),new Ka(e,t.dr,t.credentials,t.serializer,r)),n.ao.push(function(e){return y(i,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return e?(n.Io.Rr(),ph(n)?fh(n):n.fo.set("Unknown"),[3,3]):[3,1];case 1:return[4,n.Io.stop()];case 2:t.sent(),yh(n),t.label=3;case 3:return[2]}})})})),n.Io}function Th(n){var t,e,r,i=this;return n.Ao||(n.Ao=(t=n.ro,e=n.$e,r={Fr:function(e){return y(this,void 0,void 0,function(){return v(this,function(t){return Th(e).jr(),[2]})})}.bind(null,n),vr:function(e,n){return y(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return n&&Th(e).Lr?[4,function(r,i){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return Oi(n=i.code)&&n!==Tr.ABORTED?(e=r.uo.shift(),Th(r).Rr(),[4,mh(r,function(){return r.oo.To(e.batchId,i)})]):[3,3];case 1:return t.sent(),[4,wh(r)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}(e,n)]:[3,2];case 1:t.sent(),t.label=2;case 2:return bh(e)&&Eh(e),[2]}})})}.bind(null,n),Br:function(o){return y(this,void 0,void 0,function(){var e,n,r,i;return v(this,function(t){for(e=Th(o),n=0,r=o.uo;n<r.length;n++)i=r[n],e.qr(i.mutations);return[2]})})}.bind(null,n),Ur:function(r,i,o){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return e=r.uo.shift(),n=wa.from(e,i,o),[4,mh(r,function(){return r.oo.mo(n)})];case 1:return t.sent(),[4,wh(r)];case 2:return t.sent(),[2]}})})}.bind(null,n)},t.Qr(),new Za(e,t.dr,t.credentials,t.serializer,r)),n.ao.push(function(e){return y(i,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return e?(n.Ao.Rr(),[4,wh(n)]):[3,2];case 1:return t.sent(),[3,4];case 2:return[4,n.Ao.stop()];case 3:t.sent(),0<n.uo.length&&(Pr("RemoteStore","Stopping write stream with "+n.uo.length+" pending writes"),n.uo=[]),t.label=4;case 4:return[2]}})})})),n.Ao}var Ah=(qh.prototype.P=function(){return this.Ro.P()},qh.prototype.po=function(t,e){e=new Nh(t,e);this.Ro=this.Ro.add(e),this.yo=this.yo.add(e)},qh.prototype.vo=function(t,e){var n=this;t.forEach(function(t){return n.po(t,e)})},qh.prototype.bo=function(t,e){this.Co(new Nh(t,e))},qh.prototype.So=function(t,e){var n=this;t.forEach(function(t){return n.bo(t,e)})},qh.prototype.Do=function(t){var e=this,n=new ui(new ii([])),r=new Nh(n,t),t=new Nh(n,t+1),i=[];return this.yo.Nt([r,t],function(t){e.Co(t),i.push(t.key)}),i},qh.prototype.Fo=function(){var e=this;this.Ro.forEach(function(t){return e.Co(t)})},qh.prototype.Co=function(t){this.Ro=this.Ro.delete(t),this.yo=this.yo.delete(t)},qh.prototype.No=function(t){var e=new ui(new ii([])),n=new Nh(e,t),t=new Nh(e,t+1),r=Gi();return this.yo.Nt([n,t],function(t){r=r.add(t.key)}),r},qh.prototype.xo=function(t){var e=new Nh(t,0),e=this.Ro.Ot(e);return null!==e&&t.isEqual(e.key)},qh),Nh=(Mh.Po=function(t,e){return ui.S(t.key,e.key)||xr(t.Oo,e.Oo)},Mh.Vo=function(t,e){return xr(t.Oo,e.Oo)||ui.S(t.key,e.key)},Mh),Oh=(Uh.prototype.ko=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},Uh.prototype.$o=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},Uh.prototype.Mo=function(){var t={activeTargetIds:this.activeTargetIds.L(),updateTimeMs:Date.now()};return JSON.stringify(t)},Uh),Sh=(xh.prototype.Uo=function(t){},xh.prototype.Bo=function(t,e,n){},xh.prototype.jo=function(t){return this.Lo.ko(t),this.qo[t]||"not-current"},xh.prototype.Wo=function(t,e,n){this.qo[t]=e},xh.prototype.Qo=function(t){this.Lo.$o(t)},xh.prototype.Ko=function(t){return this.Lo.activeTargetIds.has(t)},xh.prototype.Go=function(t){delete this.qo[t]},xh.prototype.Ho=function(){return this.Lo.activeTargetIds},xh.prototype.zo=function(t){return this.Lo.activeTargetIds.has(t)},xh.prototype.start=function(){return this.Lo=new Oh,Promise.resolve()},xh.prototype.Yo=function(t,e,n){},xh.prototype.Jo=function(t){},xh.prototype.Xo=function(){},xh.prototype.Pi=function(t){},xh),Ph=function(t){this.key=t},Lh=function(t){this.key=t},kh=(Object.defineProperty(Ch.prototype,"iu",{get:function(){return this.Zo},enumerable:!1,configurable:!0}),Ch.prototype.ru=function(t,e){var s=this,u=e?e.ou:new zi,a=(e||this).su,h=(e||this).Wt,c=a,l=!1,f=eu(this.query)&&a.size===this.query.limit?a.last():null,p=nu(this.query)&&a.size===this.query.limit?a.first():null;if(t.at(function(t,e){var n=a.get(t),r=(r=e instanceof Xs?e:null)&&(du(s.query,r)?r:null),i=!!n&&s.Wt.has(n.key),o=!!r&&(r.Xn||s.Wt.has(r.key)&&r.hasCommittedMutations),e=!1;n&&r?n.data().isEqual(r.data())?i!==o&&(u.track({type:3,doc:r}),e=!0):s.uu(n,r)||(u.track({type:2,doc:r}),e=!0,(f&&0<s.eu(r,f)||p&&s.eu(r,p)<0)&&(l=!0)):!n&&r?(u.track({type:0,doc:r}),e=!0):n&&!r&&(u.track({type:1,doc:n}),e=!0,(f||p)&&(l=!0)),e&&(h=r?(c=c.add(r),o?h.add(t):h.delete(t)):(c=c.delete(t),h.delete(t)))}),eu(this.query)||nu(this.query))for(;c.size>this.query.limit;){var n=eu(this.query)?c.last():c.first(),c=c.delete(n.key),h=h.delete(n.key);u.track({type:1,doc:n})}return{su:c,ou:u,cu:l,Wt:h}},Ch.prototype.uu=function(t,e){return t.Xn&&e.hasCommittedMutations&&!e.Xn},Ch.prototype.hu=function(t,e,n){var o=this,r=this.su;this.su=t.su,this.Wt=t.Wt;var i=t.ou.Bt();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.eu(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 Dr()}}var r,i}),this.au(n);var s=e?this.lu():[],n=0===this.nu.size&&this.tn?1:0,e=n!==this.tu;return this.tu=n,0!==i.length||e?{snapshot:new Xi(this.query,t.su,r,i,t.Wt,0==n,e,!1),_u:s}:{_u:s}},Ch.prototype.As=function(t){return this.tn&&"Offline"===t?(this.tn=!1,this.hu({su:this.su,ou:new zi,Wt:this.Wt,cu:!1},!1)):{_u:[]}},Ch.prototype.fu=function(t){return!this.Zo.has(t)&&!!this.su.has(t)&&!this.su.get(t).Xn},Ch.prototype.au=function(t){var e=this;t&&(t.nn.forEach(function(t){return e.Zo=e.Zo.add(t)}),t.en.forEach(function(t){}),t.sn.forEach(function(t){return e.Zo=e.Zo.delete(t)}),this.tn=t.tn)},Ch.prototype.lu=function(){var e=this;if(!this.tn)return[];var n=this.nu;this.nu=Gi(),this.su.forEach(function(t){e.fu(t.key)&&(e.nu=e.nu.add(t.key))});var r=[];return n.forEach(function(t){e.nu.has(t)||r.push(new Lh(t))}),this.nu.forEach(function(t){n.has(t)||r.push(new Ph(t))}),r},Ch.prototype.du=function(t){this.Zo=t.lr,this.nu=Gi();t=this.ru(t.documents);return this.hu(t,!0)},Ch.prototype.wu=function(){return Xi.Gt(this.query,this.su,this.Wt,0===this.tu)},Ch),Rh=function(t,e,n){this.query=t,this.targetId=e,this.view=n},Dh=function(t){this.key=t,this.Eu=!1},_h=(Object.defineProperty(Vh.prototype,"Fu",{get:function(){return!0===this.Du},enumerable:!1,configurable:!0}),Vh);function Vh(t,e,n,r,i,o){this.io=t,this.mu=e,this.Tu=n,this.Iu=r,this.currentUser=i,this.Au=o,this.Ru={},this.Pu=new ei(fu,lu),this.yu=new Map,this.Vu=[],this.gu=new Pi(ui.S),this.pu=new Map,this.vu=new Ah,this.bu={},this.Cu=new Map,this.Su=Va.bi(),this.onlineState="Unknown",this.Du=void 0}function Ch(t,e){this.query=t,this.Zo=e,this.tu=null,this.tn=!1,this.nu=Gi(),this.Wt=Gi(),this.eu=yu(t),this.su=new Hi(this.eu)}function xh(){this.Lo=new Oh,this.qo={},this.Hr=null,this.Ii=null}function Uh(){this.activeTargetIds=Wi}function Mh(t,e){this.key=t,this.Oo=e}function qh(){this.Ro=new Ci(Nh.Po),this.yo=new Ci(Nh.Vo)}function jh(h,c){return y(this,void 0,void 0,function(){var n,o,s,u,a;return v(this,function(t){switch(t.label){case 0:return(e=h).mu.oo.Eo=Bh.bind(null,e),e.mu.oo.Bn=function(t,e){var n=t,t=n.pu.get(e);if(t&&t.Eu)return Gi().add(t.key);var r=Gi(),e=n.yu.get(e);if(!e)return r;for(var i=0,o=e;i<o.length;i++){var s=o[i],s=n.Pu.get(s);r=r.kt(s.view.iu)}return r}.bind(null,e),e.mu.oo.wo=function(o,s,u){return y(this,void 0,void 0,function(){var e,n,r,i;return v(this,function(t){switch(t.label){case 0:return(e=o).Iu.Wo(s,"rejected",u),i=e.pu.get(s),(n=i&&i.key)?(r=(r=new Pi(ui.S)).ot(n,new Qs(n,ri.min())),i=Gi().add(n),i=new Qi(ri.min(),new Map,new Ci(xr),r,i),[4,Bh(e,i)]):[3,2];case 1:return t.sent(),e.gu=e.gu.remove(n),e.pu.delete(s),Yh(e),[3,4];case 2:return[4,Wa(e.io,s,!1).then(function(){return Xh(e,s,u)}).catch(za)];case 3:t.sent(),t.label=4;case 4:return[2]}})})}.bind(null,e),e.Ru.Or=function(t,e){for(var n=t,r=!1,i=0,o=e;i<o.length;i++){var s=o[i],u=s.query,u=n.Es.get(u);if(u){for(var a=0,h=u.listeners;a<h.length;a++)h[a].Rs(s)&&(r=!0);u.ws=s}}r&&aa(n)}.bind(null,e.Tu),e.Ru.Nu=function(t,e,n){var r=t;if(t=r.Es.get(e))for(var i=0,o=t.listeners;i<o.length;i++)o[i].onError(n);r.Es.delete(e)}.bind(null,e.Tu),(a=(n=e).Pu.get(c))?(o=a.targetId,n.Iu.jo(o),s=a.view.wu(),[3,4]):[3,1];case 1:return[4,(e=n.io,r=uu(c),(i=e).persistence.runTransaction("Allocate target","readwrite",function(e){var n;return i.ki.hr(e,r).next(function(t){return t?(n=t,Qu.resolve(n)):i.ki.xu(e).next(function(t){return n=new Ai(r,t,0,e.nr),i.ki.Ou(e,n).next(function(){return n})})})}).then(function(t){var e=i.Si.get(t.targetId);return(null===e||0<t.et.u(e.et))&&(i.Si=i.Si.ot(t.targetId,t),i.Di.set(r,t.targetId)),t}))];case 2:return u=t.sent(),a=n.Iu.jo(u.targetId),o=u.targetId,[4,function(i,o,s,u){return y(this,void 0,void 0,function(){var e,n,r;return v(this,function(t){switch(t.label){case 0:return i.ku=function(t,e,n){return function(r,i,o,s){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return(e=i.view.ru(o)).cu?[4,Ha(r.io,i.query,!1).then(function(t){t=t.documents;return i.view.ru(t,e)})]:[3,2];case 1:e=t.sent(),t.label=2;case 2:return n=s&&s.Ht.get(i.targetId),n=i.view.hu(e,r.Fu,n),[2,($h(r,i.targetId,n._u),n.snapshot)]}})})}(i,t,e,n)},[4,Ha(i.io,o,!0)];case 1:return n=t.sent(),r=new kh(o,n.lr),e=r.ru(n.documents),n=$i.Zt(s,u&&"Offline"!==i.onlineState),n=r.hu(e,i.Fu,n),$h(i,s,n._u),r=new Rh(o,s,r),i.Pu.set(o,r),i.yu.has(s)?i.yu.get(s).push(o):i.yu.set(s,[o]),[2,n.snapshot]}})})}(n,c,o,"current"===a)];case 3:s=t.sent(),n.Fu&&ah(n.mu,u),t.label=4;case 4:return[2,s]}var r,i,e})})}function Fh(f,p,d){return y(this,void 0,void 0,function(){var s,u;return v(this,function(t){switch(t.label){case 0:(o=f).mu.oo.mo=function(i,o){return y(this,void 0,void 0,function(){var e,n,r;return v(this,function(t){switch(t.label){case 0:e=i,n=o.batch.batchId,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,Fa(e.io,o)];case 2:return r=t.sent(),zh(e,n,null),Hh(e,n),e.Iu.Bo(n,"acknowledged"),[4,Kh(e,r)];case 3:return t.sent(),[3,6];case 4:return[4,za(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}.bind(null,o),o.mu.oo.To=function(s,u,a){return y(this,void 0,void 0,function(){var n,o;return v(this,function(t){switch(t.label){case 0:n=s,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,(e=n.io,r=u,(i=e).persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return i.Zs.Lu(e,r).next(function(t){return _r(null!==t),n=t.keys(),i.Zs.Yi(e,t)}).next(function(){return i.Zs.Ji(e)}).next(function(){return i.Mi.oi(e,n)})}))];case 2:return o=t.sent(),zh(n,u,a),Hh(n,u),n.Iu.Bo(u,"rejected",a),[4,Kh(n,o)];case 3:return t.sent(),[3,6];case 4:return[4,za(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}var e,r,i})})}.bind(null,o),u=o,t.label=1;case 1:return t.trys.push([1,5,,6]),[4,(r=u.io,a=p,c=r,l=ni.now(),i=a.reduce(function(t,e){return t.add(e.key)},Gi()),c.persistence.runTransaction("Locally write mutations","readwrite",function(u){return c.Mi.oi(u,i).next(function(t){h=t;for(var s,e=[],n=0,r=a;n<r.length;n++){var i=r[n],o=(s=i,o=h.get(i.key),s instanceof Rs?function(t){for(var e=null,n=0,r=s.fieldTransforms;n<r.length;n++){var i=r[n],o=t instanceof Xs?t.field(i.field):void 0,o=$o(i.transform,o||null);null!=o&&(e=(null==e?new qs:e).set(i.field,o))}return e?e.Zn():null}(o):null);null!=o&&e.push(new Os(i.key,o,function s(t){var u=[];return Kr(t.fields||{},function(t,e){var n=new si([t]);if(Po(e))if(0===(e=s(e.mapValue).fields).length)u.push(n);else for(var r=0,i=e;r<i.length;r++){var o=i[r];u.push(n.child(o))}else u.push(n)}),new ps(u)}(o.proto.mapValue),vs.exists(!0)))}return c.Zs.$u(u,l,e,a)})}).then(function(t){var e=t.zs(h);return{batchId:t.batchId,Mu:e}}))];case 2:return s=t.sent(),u.Iu.Uo(s.batchId),e=u,n=s.batchId,o=d,r=(r=(r=e.bu[e.currentUser.Ds()])||new Pi(xr)).ot(n,o),e.bu[e.currentUser.Ds()]=r,[4,Kh(u,s.Mu)];case 3:return t.sent(),[4,wh(u.mu)];case 4:return t.sent(),[3,6];case 5:return u=t.sent(),u=ra(u,"Failed to persist write"),d.reject(u),[3,6];case 6:return[2]}var e,n,r,a,h,c,l,i,o})})}function Bh(r,i){return y(this,void 0,void 0,function(){var n,e;return v(this,function(t){switch(t.label){case 0:n=r,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,Ga(n.io,i)];case 2:return e=t.sent(),i.Ht.forEach(function(t,e){e=n.pu.get(e);e&&(_r(t.nn.size+t.en.size+t.sn.size<=1),0<t.nn.size?e.Eu=!0:0<t.en.size?_r(e.Eu):0<t.sn.size&&(_r(e.Eu),e.Eu=!1))}),[4,Kh(n,e,i)];case 3:return t.sent(),[3,6];case 4:return[4,za(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}function Gh(t,n,e){var r,t=t;(t.Fu&&0===e||!t.Fu&&1===e)&&(r=[],t.Pu.forEach(function(t,e){e=e.view.As(n);e.snapshot&&r.push(e.snapshot)}),function(t,i){t.onlineState=i;var o=!1;t.Es.forEach(function(t,e){for(var n=0,r=e.listeners;n<r.length;n++)r[n].As(i)&&(o=!0)}),o&&aa(t)}(t.Tu,n),r.length&&t.Ru.Or(r),t.onlineState=n,t.Fu&&t.Iu.Jo(n))}function Wh(o,s){return y(this,void 0,void 0,function(){var n,r,i;return v(this,function(t){switch(t.label){case 0:dh((n=o).mu)||Pr("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,(e=n.io).persistence.runTransaction("Get highest unacknowledged batch id","readonly",function(t){return e.Zs.qu(t)})];case 2:return-1===(r=t.sent())?[2,void s.resolve()]:((i=n.Cu.get(r)||[]).push(s),n.Cu.set(r,i),[3,4]);case 3:return i=t.sent(),i=ra(i,"Initialization of waitForPendingWrites() operation failed"),s.reject(i),[3,4];case 4:return[2]}var e})})}function Hh(t,e){(t.Cu.get(e)||[]).forEach(function(t){t.resolve()}),t.Cu.delete(e)}function zh(t,e,n){var r=t,i=r.bu[r.currentUser.Ds()];i&&((t=i.get(e))&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.bu[r.currentUser.Ds()]=i)}function Xh(e,t,n){void 0===n&&(n=null),e.Iu.Qo(t);for(var r=0,i=e.yu.get(t);r<i.length;r++){var o=i[r];e.Pu.delete(o),n&&e.Ru.Nu(o,n)}e.yu.delete(t),e.Fu&&e.vu.Do(t).forEach(function(t){e.vu.xo(t)||Qh(e,t)})}function Qh(t,e){var n=t.gu.get(e);null!==n&&(hh(t.mu,n),t.gu=t.gu.remove(e),t.pu.delete(n),Yh(t))}function $h(t,e,n){for(var r=0,i=n;r<i.length;r++){var o=i[r];o instanceof Ph?(t.vu.po(o.key,e),function(t,e){e=e.key;t.gu.get(e)||(Pr("SyncEngine","New document in limbo: "+e),t.Vu.push(e),Yh(t))}(t,o)):o instanceof Lh?(Pr("SyncEngine","Document no longer in limbo: "+o.key),t.vu.bo(o.key,e),t.vu.xo(o.key)||Qh(t,o.key)):Dr()}}function Yh(t){for(;0<t.Vu.length&&t.gu.size<t.Au;){var e=t.Vu.shift(),n=t.Su.next();t.pu.set(n,new Dh(e)),t.gu=t.gu.ot(e,n),ah(t.mu,new Ai(uu(tu(e.path)),n,2,Ia.yi))}}function Kh(e,s,u){return y(this,void 0,void 0,function(){var n,r,i,o;return v(this,function(t){switch(t.label){case 0:return r=[],i=[],o=[],(n=e).Pu.P()?[3,3]:(n.Pu.forEach(function(t,e){o.push(n.ku(e,s,u).then(function(t){t&&(n.Fu&&n.Iu.Wo(e.targetId,t.fromCache?"not-current":"current"),r.push(t),t=Ea.Ti(e.targetId,t),i.push(t))}))}),[4,Promise.all(o)]);case 1:return t.sent(),n.Ru.Or(r),[4,function(a,h){return y(this,void 0,void 0,function(){var r,e,n,i,o,s,u;return v(this,function(t){switch(t.label){case 0:r=a,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,r.persistence.runTransaction("notifyLocalViewChanges","readwrite",function(n){return Qu.forEach(h,function(e){return Qu.forEach(e.Ei,function(t){return r.persistence.rr.po(n,e.targetId,t)}).next(function(){return Qu.forEach(e.mi,function(t){return r.persistence.rr.bo(n,e.targetId,t)})})})})];case 2:return t.sent(),[3,4];case 3:if(!Ku(e=t.sent()))throw e;return Pr("LocalStore","Failed to update sequence numbers: "+e),[3,4];case 4:for(n=0,i=h;n<i.length;n++)u=i[n],o=u.targetId,u.fromCache||(s=r.Si.get(o),u=s.et,u=s.rt(u),r.Si=r.Si.ot(o,u));return[2]}})})}(n.io,i)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}function Zh(i,o){return y(this,void 0,void 0,function(){var n,r;return v(this,function(t){switch(t.label){case 0:return(n=i).currentUser.isEqual(o)?[3,3]:(Pr("SyncEngine","User change. New user:",o.Ds()),[4,ja(n.io,o)]);case 1:return r=t.sent(),n.currentUser=o,(e=n).Cu.forEach(function(t){t.forEach(function(t){t.reject(new Ar(Tr.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.Cu.clear(),n.Iu.Yo(o,r.Qi,r.Ki),[4,Kh(n,r.Wi)];case 2:t.sent(),t.label=3;case 3:return[2]}var e})})}var Jh,tc,ec,nc=(Lc.prototype.qi=function(t){this.Uu=t},Lc.prototype.hi=function(e,r,i,o){var s=this;return 0===r.filters.length&&null===r.limit&&null==r.startAt&&null==r.endAt&&(0===r.oe.length||1===r.oe.length&&r.oe[0].field.W())||i.isEqual(ri.min())?this.Bu(e,r):this.Uu.oi(e,o).next(function(t){var n=s.ju(r,t);return(eu(r)||nu(r))&&s.cu(r.ue,n,o,i)?s.Bu(e,r):(Sr()<=u.DEBUG&&Pr("IndexFreeQueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),pu(r)),s.Uu.hi(e,r,i).next(function(e){return n.forEach(function(t){e=e.ot(t.key,t)}),e}))})},Lc.prototype.ju=function(n,t){var r=new Ci(yu(n));return t.forEach(function(t,e){e instanceof Xs&&du(n,e)&&(r=r.add(e))}),r},Lc.prototype.cu=function(t,e,n,r){if(n.size!==e.size)return!0;e="F"===t?e.last():e.first();return!!e&&(e.hasPendingWrites||0<e.version.u(r))},Lc.prototype.Bu=function(t,e){return Sr()<=u.DEBUG&&Pr("IndexFreeQueryEngine","Using full collection scan to execute query:",pu(e)),this.Uu.hi(t,e,ri.min())},Lc),rc=(Pc.prototype.Ku=function(t){return Qu.resolve(0===this.Zs.length)},Pc.prototype.$u=function(t,e,n,r){var i=this.Wu;this.Wu++,0<this.Zs.length&&this.Zs[this.Zs.length-1];n=new ma(i,e,n,r);this.Zs.push(n);for(var o=0,s=r;o<s.length;o++){var u=s[o];this.Qu=this.Qu.add(new Nh(u.key,i)),this.ti.gi(t,u.key.path.N())}return Qu.resolve(n)},Pc.prototype.Lu=function(t,e){return Qu.resolve(this.Gu(e))},Pc.prototype.cr=function(t,e){e+=1,e=this.Hu(e),e=e<0?0:e;return Qu.resolve(this.Zs.length>e?this.Zs[e]:null)},Pc.prototype.qu=function(){return Qu.resolve(0===this.Zs.length?-1:this.Wu-1)},Pc.prototype.ji=function(t){return Qu.resolve(this.Zs.slice())},Pc.prototype.ei=function(t,e){var n=this,r=new Nh(e,0),e=new Nh(e,Number.POSITIVE_INFINITY),i=[];return this.Qu.Nt([r,e],function(t){t=n.Gu(t.Oo);i.push(t)}),Qu.resolve(i)},Pc.prototype.ci=function(t,e){var n=this,r=new Ci(xr);return e.forEach(function(t){var e=new Nh(t,0),t=new Nh(t,Number.POSITIVE_INFINITY);n.Qu.Nt([e,t],function(t){r=r.add(t.Oo)})}),Qu.resolve(this.zu(r))},Pc.prototype.di=function(t,e){var n=e.path,r=n.length+1,e=n;ui.X(e)||(e=e.child(""));var e=new Nh(new ui(e),0),i=new Ci(xr);return this.Qu.xt(function(t){var e=t.key.path;return!!n.$(e)&&(e.length===r&&(i=i.add(t.Oo)),!0)},e),Qu.resolve(this.zu(i))},Pc.prototype.zu=function(t){var e=this,n=[];return t.forEach(function(t){t=e.Gu(t);null!==t&&n.push(t)}),n},Pc.prototype.Yi=function(n,r){var i=this;_r(0===this.Yu(r.batchId,"removed")),this.Zs.shift();var o=this.Qu;return Qu.forEach(r.mutations,function(t){var e=new Nh(t.key,r.batchId);return o=o.delete(e),i.rr.Ju(n,t.key)}).next(function(){i.Qu=o})},Pc.prototype.Xu=function(t){},Pc.prototype.xo=function(t,e){var n=new Nh(e,0),n=this.Qu.Ot(n);return Qu.resolve(e.isEqual(n&&n.key))},Pc.prototype.Ji=function(t){return this.Zs.length,Qu.resolve()},Pc.prototype.Yu=function(t,e){return this.Hu(t)},Pc.prototype.Hu=function(t){return 0===this.Zs.length?0:t-this.Zs[0].batchId},Pc.prototype.Gu=function(t){t=this.Hu(t);return t<0||t>=this.Zs.length?null:this.Zs[t]},Pc),ic=(Sc.prototype.zi=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,i=this.Zu(e);return this.docs=this.docs.ot(r,{tc:e,size:i,readTime:n}),this.size+=i-o,this.ti.gi(t,r.path.N())},Sc.prototype.sr=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},Sc.prototype.ii=function(t,e){e=this.docs.get(e);return Qu.resolve(e?e.tc:null)},Sc.prototype.getEntries=function(t,e){var n=this,r=Ui;return e.forEach(function(t){var e=n.docs.get(t);r=r.ot(t,e?e.tc:null)}),Qu.resolve(r)},Sc.prototype.hi=function(t,e,n){for(var r=ji,i=new ui(e.path.child("")),o=this.docs.ft(i);o.At();){var s=o.It(),u=s.key,a=s.value,s=a.tc,a=a.readTime;if(!e.path.$(u.path))break;a.u(n)<=0||s instanceof Xs&&du(e,s)&&(r=r.ot(s.key,s))}return Qu.resolve(r)},Sc.prototype.nc=function(t,e){return Qu.forEach(this.docs,function(t){return e(t)})},Sc.prototype.Gi=function(t){return new oc(this)},Sc.prototype.ec=function(t){return Qu.resolve(this.size)},Sc),oc=(Object.defineProperty(Oc.prototype,"readTime",{get:function(){return this.ic},set:function(t){this.ic=t},enumerable:!1,configurable:!0}),Oc.prototype.zi=function(t,e){this.rc(),this.readTime=e,this.Mu.set(t.key,t)},Oc.prototype.sr=function(t,e){this.rc(),e&&(this.readTime=e),this.Mu.set(t,null)},Oc.prototype.ii=function(t,e){this.rc();var n=this.Mu.get(e);return void 0!==n?Qu.resolve(n):this.oc(t,e)},Oc.prototype.getEntries=function(t,e){return this.uc(t,e)},Oc.prototype.apply=function(t){return this.rc(),this.sc=!0,this.hu(t)},Oc.prototype.rc=function(){},n(Nc,ec=Oc),Nc.prototype.hu=function(n){var r=this,i=[];return this.Mu.forEach(function(t,e){e?i.push(r.cc.zi(n,e,r.readTime)):r.cc.sr(t)}),Qu.Oe(i)},Nc.prototype.oc=function(t,e){return this.cc.ii(t,e)},Nc.prototype.uc=function(t,e){return this.cc.getEntries(t,e)},Nc),sc=(Ac.prototype.Fn=function(t,n){return this.hc.forEach(function(t,e){return n(e)}),Qu.resolve()},Ac.prototype.Xi=function(t){return Qu.resolve(this.lastRemoteSnapshotVersion)},Ac.prototype.fc=function(t){return Qu.resolve(this.ac)},Ac.prototype.xu=function(t){return this.highestTargetId=this._c.next(),Qu.resolve(this.highestTargetId)},Ac.prototype.ur=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ac&&(this.ac=e),Qu.resolve()},Ac.prototype.dc=function(t){this.hc.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this._c=new Va(e),this.highestTargetId=e),t.sequenceNumber>this.ac&&(this.ac=t.sequenceNumber)},Ac.prototype.Ou=function(t,e){return this.dc(e),this.targetCount+=1,Qu.resolve()},Ac.prototype.er=function(t,e){return this.dc(e),Qu.resolve()},Ac.prototype.wc=function(t,e){return this.hc.delete(e.target),this.lc.Do(e.targetId),--this.targetCount,Qu.resolve()},Ac.prototype.Ec=function(n,r,i){var o=this,s=0,u=[];return this.hc.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.hc.delete(t),u.push(o.mc(n,e.targetId)),s++)}),Qu.Oe(u).next(function(){return s})},Ac.prototype.Tc=function(t){return Qu.resolve(this.targetCount)},Ac.prototype.hr=function(t,e){e=this.hc.get(e)||null;return Qu.resolve(e)},Ac.prototype.tr=function(t,e,n){return this.lc.vo(e,n),Qu.resolve()},Ac.prototype.Zi=function(e,t,n){this.lc.So(t,n);var r=this.persistence.rr,i=[];return r&&t.forEach(function(t){i.push(r.Ju(e,t))}),Qu.Oe(i)},Ac.prototype.mc=function(t,e){return this.lc.Do(e),Qu.resolve()},Ac.prototype.ar=function(t,e){e=this.lc.No(e);return Qu.resolve(e)},Ac.prototype.xo=function(t,e){return Qu.resolve(this.lc.xo(e))},Ac),uc=(Tc.prototype.start=function(){return Promise.resolve()},Tc.prototype.Xo=function(){return this.Rc=!1,Promise.resolve()},Object.defineProperty(Tc.prototype,"yc",{get:function(){return this.Rc},enumerable:!1,configurable:!0}),Tc.prototype.Vc=function(){},Tc.prototype.gc=function(){},Tc.prototype.Li=function(){return this.ti},Tc.prototype.Ni=function(t){var e=this.Ic[t.Ds()];return e||(e=new rc(this.ti,this.rr),this.Ic[t.Ds()]=e),e},Tc.prototype.$i=function(){return this.ki},Tc.prototype.Oi=function(){return this.Xs},Tc.prototype.runTransaction=function(t,e,n){var r=this;Pr("MemoryPersistence","Starting transaction:",t);var i=new ac(this.Ac.next());return this.rr.vc(),n(i).next(function(t){return r.rr.bc(i).next(function(){return t})}).Ne().then(function(t){return i.Cc(),t})},Tc.prototype.Sc=function(e,n){return Qu.ke(Object.values(this.Ic).map(function(t){return function(){return t.xo(e,n)}}))},Tc),ac=(Ic.prototype.Fc=function(t){this.Dc.push(t)},Ic.prototype.Cc=function(){this.Dc.forEach(function(t){return t()})},n(Ec,tc=Ic),Ec),hc=(bc.Oc=function(t){return new bc(t)},Object.defineProperty(bc.prototype,"kc",{get:function(){if(this.xc)return this.xc;throw Dr()},enumerable:!1,configurable:!0}),bc.prototype.po=function(t,e,n){return this.Nc.po(n,e),this.kc.delete(n.toString()),Qu.resolve()},bc.prototype.bo=function(t,e,n){return this.Nc.bo(n,e),this.kc.add(n.toString()),Qu.resolve()},bc.prototype.Ju=function(t,e){return this.kc.add(e.toString()),Qu.resolve()},bc.prototype.removeTarget=function(t,e){var n=this;this.Nc.Do(e.targetId).forEach(function(t){return n.kc.add(t.toString())});var r=this.persistence.$i();return r.ar(t,e.targetId).next(function(t){t.forEach(function(t){return n.kc.add(t.toString())})}).next(function(){return r.wc(t,e)})},bc.prototype.vc=function(){this.xc=new Set},bc.prototype.bc=function(n){var r=this,i=this.persistence.Oi().Gi();return Qu.forEach(this.kc,function(t){var e=ui.H(t);return r.$c(n,e).next(function(t){t||i.sr(e)})}).next(function(){return r.xc=null,i.apply(n)})},bc.prototype.ir=function(t,e){var n=this;return this.$c(t,e).next(function(t){t?n.kc.delete(e.toString()):n.kc.add(e.toString())})},bc.prototype.Pc=function(t){return 0},bc.prototype.$c=function(t,e){var n=this;return Qu.ke([function(){return Qu.resolve(n.Nc.xo(e))},function(){return n.persistence.$i().xo(t,e)},function(){return n.persistence.Sc(t,e)}])},bc),cc=(wc.prototype.Fr=function(t){this.qc=t},wc.prototype.vr=function(t){this.Uc=t},wc.prototype.onMessage=function(t){this.Bc=t},wc.prototype.close=function(){this.Lc()},wc.prototype.send=function(t){this.Mc(t)},wc.prototype.jc=function(){this.qc()},wc.prototype.Wc=function(t){this.Uc(t)},wc.prototype.Qc=function(t){this.Bc(t)},wc),lc={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},fc=(mc.prototype.Kr=function(e,t,n,r){var i=this.zc(e,t);Pr("RestConnection","Sending: ",i,n);t={};return this.Yc(t,r),this.Jc(e,i,t,n).then(function(t){return Pr("RestConnection","Received: ",t),t},function(t){throw kr("RestConnection",e+" failed with error: ",t,"url: ",i,"request:",n),t})},mc.prototype.Gr=function(t,e,n,r){return this.Kr(t,e,n,r)},mc.prototype.Yc=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/8.0.1",t["Content-Type"]="text/plain",e)for(var n in e.xs)e.xs.hasOwnProperty(n)&&(t[n]=e.xs[n])},mc.prototype.zc=function(t,e){t=lc[t];return this.Gc+"/v1/"+e+":"+t},n(gc,Jh=mc),gc.prototype.Jc=function(o,e,s,u){return new Promise(function(n,r){var i=new wr;i.listenOnce(gr.COMPLETE,function(){try{switch(i.getLastErrorCode()){case vr.NO_ERROR:var t=i.getResponseJson();Pr("Connection","XHR received:",JSON.stringify(t)),n(t);break;case vr.TIMEOUT:Pr("Connection",'RPC "'+o+'" timed out'),r(new Ar(Tr.DEADLINE_EXCEEDED,"Request time out"));break;case vr.HTTP_ERROR:var e=i.getStatus();Pr("Connection",'RPC "'+o+'" failed with status:',e,"response text:",i.getResponseText()),0<e?(t=i.getResponseJson().error)&&t.status&&t.message?(e=t.status.toLowerCase().replace("_","-"),e=0<=Object.values(Tr).indexOf(e)?e:Tr.UNKNOWN,r(new Ar(e,t.message))):r(new Ar(Tr.UNKNOWN,"Server responded with status "+i.getStatus())):r(new Ar(Tr.UNAVAILABLE,"Connection failed."));break;default:Dr()}}finally{Pr("Connection",'RPC "'+o+'" completed.')}});var t=JSON.stringify(u);i.send(e,"POST",t,s,15)})},gc.prototype.Nr=function(t,e){var n,r=[this.Gc,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=new lr,t={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this._.projectId+"/databases/"+this._.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.m};this.Yc(t.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<=(n=p()).indexOf("MSIE ")||0<=n.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||(t.httpHeadersOverwriteParam="$httpHeaders");r=r.join("");Pr("Connection","Creating WebChannel: "+r,t);var o=i.createWebChannel(r,t),s=!1,u=!1,a=new cc({Mc:function(t){u?Pr("Connection","Not sending because WebChannel is closed:",t):(s||(Pr("Connection","Opening WebChannel transport."),o.open(),s=!0),Pr("Connection","WebChannel sending:",t),o.send(t))},Lc:function(){return o.close()}}),t=function(t,e){o.listen(t,function(t){try{e(t)}catch(t){setTimeout(function(){throw t},0)}})};return t(mr.EventType.OPEN,function(){u||Pr("Connection","WebChannel transport opened.")}),t(mr.EventType.CLOSE,function(){u||(u=!0,Pr("Connection","WebChannel transport closed"),a.Wc())}),t(mr.EventType.ERROR,function(t){u||(u=!0,kr("Connection","WebChannel transport errored:",t),a.Wc(new Ar(Tr.UNAVAILABLE,"The operation could not be completed")))}),t(mr.EventType.MESSAGE,function(t){var e,n,r,i;u||(_r(!!(e=t.data[0])),(n=e.error||(null===(i=e[0])||void 0===i?void 0:i.error))?(Pr("Connection","WebChannel received error:",n),r=n.status,t=function(){var t=Ti[r];if(void 0!==t)return Si(t)}(),i=n.message,void 0===t&&(t=Tr.INTERNAL,i="Unknown error status: "+r+" with message "+n.message),u=!0,a.Wc(new Ar(t,i)),o.close()):(Pr("Connection","WebChannel received:",e),a.Qc(e)))}),setTimeout(function(){a.jc()},0),a},gc),pc=(vc.prototype._o=function(t){this.eh.push(t)},vc.prototype.Xo=function(){window.removeEventListener("online",this.Xc),window.removeEventListener("offline",this.th)},vc.prototype.sh=function(){window.addEventListener("online",this.Xc),window.addEventListener("offline",this.th)},vc.prototype.Zc=function(){Pr("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.eh;t<e.length;t++)(0,e[t])(0)},vc.prototype.nh=function(){Pr("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.eh;t<e.length;t++)(0,e[t])(1)},vc.ih=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},vc),dc=(yc.prototype._o=function(t){},yc.prototype.Xo=function(){},yc);function yc(){}function vc(){var t=this;this.Xc=function(){return t.Zc()},this.th=function(){return t.nh()},this.eh=[],this.sh()}function gc(t){var e=this;return(e=Jh.call(this,t)||this).forceLongPolling=t.forceLongPolling,e.m=t.m,e}function mc(t){this.Kc=t,this._=t._;var e=t.ssl?"https":"http";this.Gc=e+"://"+t.host,this.Hc="projects/"+this._.projectId+"/databases/"+this._.database+"/documents"}function wc(t){this.Mc=t.Mc,this.Lc=t.Lc}function bc(t){this.persistence=t,this.Nc=new Ah,this.xc=null}function Ec(t){var e=this;return(e=tc.call(this)||this).nr=t,e}function Ic(){this.Dc=[]}function Tc(t){var e=this;this.Ic={},this.Ac=new Ia(0),this.Rc=!1,this.Rc=!0,this.rr=t(this),this.ki=new sc(this),this.ti=new Da,this.Xs=(t=this.ti,new ic(t,function(t){return e.rr.Pc(t)}))}function Ac(t){this.persistence=t,this.hc=new ei(wi,bi),this.lastRemoteSnapshotVersion=ri.min(),this.highestTargetId=0,this.ac=0,this.lc=new Ah,this.targetCount=0,this._c=Va.vi()}function Nc(t){var e=this;return(e=ec.call(this)||this).cc=t,e}function Oc(){this.Mu=new ei(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),this.sc=!1}function Sc(t,e){this.ti=t,this.Zu=e,this.docs=new Pi(ui.S),this.size=0}function Pc(t,e){this.ti=t,this.rr=e,this.Zs=[],this.Wu=1,this.Qu=new Ci(Nh.Po)}function Lc(){}function kc(t){return new Ro(t,!0)}var Rc=(xc.prototype.initialize=function(e){return y(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return this.Iu=this.rh(e),this.persistence=this.oh(e),[4,this.persistence.start()];case 1:return t.sent(),this.uh=this.hh(e),this.io=this.ah(e),[2]}})})},xc.prototype.hh=function(t){return null},xc.prototype.ah=function(t){return e=this.persistence,n=new nc,t=t.lh,new Ca(e,n,t);var e,n},xc.prototype.oh=function(t){return new uc(hc.Oc)},xc.prototype.rh=function(t){return new Sh},xc.prototype.terminate=function(){return y(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return this.uh&&this.uh.stop(),[4,this.Iu.Xo()];case 1:return t.sent(),[4,this.persistence.Xo()];case 2:return t.sent(),[2]}})})},xc),Dc=(Cc.prototype.initialize=function(n,r){return y(this,void 0,void 0,function(){var e=this;return v(this,function(t){switch(t.label){case 0:return this.io?[3,2]:(this.io=n.io,this.Iu=n.Iu,this.ro=this._h(r),this.mu=this.fh(r),this.Tu=this.dh(r),this.wh=this.Eh(r,!n.synchronizeTabs),this.Iu.Hr=function(t){return Gh(e.wh,t,1)},this.mu.oo.mh=Zh.bind(null,this.wh),[4,function(n,r){return y(this,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=n,r?(e.ho.delete(2),[4,sh(e)]):[3,2];case 1:return t.sent(),[3,5];case 2:return r?[3,4]:(e.ho.add(2),[4,uh(e)]);case 3:t.sent(),e.fo.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})}(this.mu,this.wh.Fu)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},Cc.prototype.dh=function(t){return new ia},Cc.prototype._h=function(t){var e=kc(t.Kc._),n=(n=t.Kc,new fc(n));return t=t.credentials,new Ja(t,n,e)},Cc.prototype.fh=function(t){var e=this,n=this.io,r=this.ro,i=t.$e,o=function(t){return Gh(e.wh,t,0)},t=new(pc.ih()?pc:dc);return new Xa(n,r,i,o,t)},Cc.prototype.Eh=function(t,e){return function(t,e,n,r,i,o,s){o=new _h(t,e,n,r,i,o);return s&&(o.Du=!0),o}(this.io,this.mu,this.Tu,this.Iu,t.lh,t.Au,e)},Cc.prototype.terminate=function(){return function(n){return y(this,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=n,Pr("RemoteStore","RemoteStore shutting down."),e.ho.add(5),[4,uh(e)];case 1:return t.sent(),e.lo.Xo(),e.fo.set("Unknown"),[2]}})})}(this.mu)},Cc),_c=(Vc.prototype.next=function(t){this.observer.next&&this.Th(this.observer.next,t)},Vc.prototype.error=function(t){this.observer.error?this.Th(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},Vc.prototype.Ih=function(){this.muted=!0},Vc.prototype.Th=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},Vc);function Vc(t){this.observer=t,this.muted=!1}function Cc(){}function xc(){this.synchronizeTabs=!1}function Uc(t,e,n){if(!n)throw new Ar(Tr.INVALID_ARGUMENT,"Function "+t+"() cannot be called with an empty "+e+".")}function Mc(t,e){if(void 0===e)return{merge:!1};if(void 0!==e.mergeFields&&void 0!==e.merge)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function qc(t,e,n,r){if(!0===e&&!0===r)throw new Ar(Tr.INVALID_ARGUMENT,t+" and "+n+" cannot be used together.")}function jc(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":Dr();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 Fc(t,e){if(e<=0)throw new Ar(Tr.INVALID_ARGUMENT,"Function "+t+"() requires a positive number, but it was: "+e+".")}var Bc,Gc,Wc=function(t){for(var e=0;e<t.length;++e)if(0===t[e].length)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this.Ah=new si(t)},Hc=(n(Yc,Gc=Wc),Yc.documentId=function(){return new Yc(si.K().q())},Yc.prototype.isEqual=function(t){return t instanceof Yc&&this.Ah.isEqual(t.Ah)},Yc),zc=new RegExp("[~\\*/\\[\\]]"),Xc=function(t){this.Rh=t},Qc=(n($c,Bc=Xc),$c.prototype.Ph=function(t){if(2!==t.yh)throw 1===t.yh?t.Vh(this.Rh+"() can only appear at the top level of your update data"):t.Vh(this.Rh+"() cannot be used with set() unless you pass {merge:true}");return t.Qn.push(t.path),null},$c.prototype.isEqual=function(t){return t instanceof $c},$c);function $c(){return null!==Bc&&Bc.apply(this,arguments)||this}function Yc(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Gc.call(this,t)||this}function Kc(t,e,n){return new bl({yh:3,gh:e.settings.gh,methodName:t.Rh,ph:n},e._,e.serializer,e.ignoreUndefinedProperties)}var Zc,Jc,tl,el,nl=(n(ml,el=Xc),ml.prototype.Ph=function(t){return new fs(t.path,new Zo)},ml.prototype.isEqual=function(t){return t instanceof ml},ml),rl=(n(gl,tl=Xc),gl.prototype.Ph=function(t){var e=Kc(this,t,!0),n=this.bh.map(function(t){return Pl(t,e)}),n=new Jo(n);return new fs(t.path,n)},gl.prototype.isEqual=function(t){return this===t},gl),il=(n(vl,Jc=Xc),vl.prototype.Ph=function(t){var e=Kc(this,t,!0),n=this.bh.map(function(t){return Pl(t,e)}),n=new is(n);return new fs(t.path,n)},vl.prototype.isEqual=function(t){return this===t},vl),ol=(n(yl,Zc=Xc),yl.prototype.Ph=function(t){var e=new as(t.serializer,Vo(t.serializer,this.Ch));return new fs(t.path,e)},yl.prototype.isEqual=function(t){return this===t},yl),sl=(Object.defineProperty(dl.prototype,"latitude",{get:function(){return this.Sh},enumerable:!1,configurable:!0}),Object.defineProperty(dl.prototype,"longitude",{get:function(){return this.Dh},enumerable:!1,configurable:!0}),dl.prototype.isEqual=function(t){return this.Sh===t.Sh&&this.Dh===t.Dh},dl.prototype.toJSON=function(){return{latitude:this.Sh,longitude:this.Dh}},dl.prototype.V=function(t){return xr(this.Sh,t.Sh)||xr(this.Dh,t.Dh)},dl),ul=function(t){this.Fh=t},al=/^__.*__$/,hl=function(t,e,n){this.Nh=t,this.xh=e,this.Oh=n},cl=(pl.prototype.kh=function(t,e){var n=[];return null!==this.Qn?n.push(new Os(t,this.data,this.Qn,e)):n.push(new Ns(t,this.data,e)),0<this.fieldTransforms.length&&n.push(new Rs(t,this.fieldTransforms)),n},pl),ll=(fl.prototype.kh=function(t,e){e=[new Os(t,this.data,this.Qn,e)];return 0<this.fieldTransforms.length&&e.push(new Rs(t,this.fieldTransforms)),e},fl);function fl(t,e,n){this.data=t,this.Qn=e,this.fieldTransforms=n}function pl(t,e,n){this.data=t,this.Qn=e,this.fieldTransforms=n}function dl(t,e){if(!isFinite(t)||t<-90||90<t)throw new Ar(Tr.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new Ar(Tr.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this.Sh=t,this.Dh=e}function yl(t,e){var n=this;return(n=Zc.call(this,t)||this).Ch=e,n}function vl(t,e){var n=this;return(n=Jc.call(this,t)||this).bh=e,n}function gl(t,e){var n=this;return(n=tl.call(this,t)||this).bh=e,n}function ml(){return null!==el&&el.apply(this,arguments)||this}function wl(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw Dr()}}var bl=(Object.defineProperty(Tl.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(Tl.prototype,"yh",{get:function(){return this.settings.yh},enumerable:!1,configurable:!0}),Tl.prototype.Mh=function(t){return new Tl(Object.assign(Object.assign({},this.settings),t),this._,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.Qn)},Tl.prototype.Lh=function(t){var e=null===(e=this.path)||void 0===e?void 0:e.child(t),e=this.Mh({path:e,ph:!1});return e.qh(t),e},Tl.prototype.Uh=function(t){var e,t=null===(e=this.path)||void 0===e?void 0:e.child(t),t=this.Mh({path:t,ph:!1});return t.$h(),t},Tl.prototype.Bh=function(t){return this.Mh({path:void 0,ph:!0})},Tl.prototype.Vh=function(t){return Vl(t,this.settings.methodName,this.settings.jh||!1,this.path,this.settings.gh)},Tl.prototype.contains=function(e){return void 0!==this.Qn.find(function(t){return e.$(t)})||void 0!==this.fieldTransforms.find(function(t){return e.$(t.field)})},Tl.prototype.$h=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.qh(this.path.get(t))},Tl.prototype.qh=function(t){if(0===t.length)throw this.Vh("Document fields must not be empty");if(wl(this.yh)&&al.test(t))throw this.Vh('Document fields cannot begin and end with "__"')},Tl),El=(Il.prototype.Wh=function(t,e,n,r){return void 0===r&&(r=!1),new bl({yh:t,methodName:e,gh:n,path:si.B(),ph:!1,jh:r},this._,this.serializer,this.ignoreUndefinedProperties)},Il);function Il(t,e,n){this._=t,this.ignoreUndefinedProperties=e,this.serializer=n||kc(t)}function Tl(t,e,n,r,i,o){this.settings=t,this._=e,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===i&&this.$h(),this.fieldTransforms=i||[],this.Qn=o||[]}function Al(t,e,n,r,i,o){void 0===o&&(o={});var s=t.Wh(o.merge||o.mergeFields?2:0,e,n,i);Rl("Data must be an object, but it was:",s,r);var u,a,r=Ll(r,s);if(o.merge)u=new ps(s.Qn),a=s.fieldTransforms;else if(o.mergeFields){for(var h=[],c=0,l=o.mergeFields;c<l.length;c++){var f=l[c],p=void 0;if(f instanceof Wc)p=f.Ah;else{if("string"!=typeof f)throw Dr();p=_l(e,f,n)}if(!s.contains(p))throw new Ar(Tr.INVALID_ARGUMENT,"Field '"+p+"' is specified in your field mask but missing from your input data.");Cl(h,p)||h.push(p)}u=new ps(h),a=s.fieldTransforms.filter(function(t){return u.Yn(t.field)})}else u=null,a=s.fieldTransforms;return new cl(new Ms(r),u,a)}function Nl(t,r,i,e){var o=t.Wh(1,r,i);Rl("Data must be an object, but it was:",o,e);var s=[],u=new qs;Kr(e,function(t,e){var n=_l(r,t,i),t=o.Uh(n);e instanceof Qc||e instanceof ul&&e.Fh instanceof Qc?s.push(n):null!=(t=Pl(e,t))&&(s.push(n),u.set(n,t))});e=new ps(s);return new ll(u.Zn(),e,o.fieldTransforms)}function Ol(t,e,n,r,i,o){var s=t.Wh(1,e,n),u=[Dl(e,r,n)],a=[i];if(o.length%2!=0)throw new Ar(Tr.INVALID_ARGUMENT,"Function "+e+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var h=0;h<o.length;h+=2)u.push(Dl(e,o[h])),a.push(o[h+1]);for(var c,l,f,p=[],d=new qs,y=u.length-1;0<=y;--y){Cl(p,u[y])||(c=u[y],l=a[y],f=s.Uh(c),l instanceof Qc||l instanceof ul&&l.Fh instanceof Qc?p.push(c):null!=(f=Pl(l,f))&&(p.push(c),d.set(c,f)))}i=new ps(p);return new ll(d.Zn(),i,s.fieldTransforms)}function Sl(t,e,n,r){return void 0===r&&(r=!1),Pl(n,t.Wh(r?4:3,e))}function Pl(s,t){if(s instanceof ul&&(s=s.Fh),kl(s))return Rl("Unsupported field value:",t,s),Ll(s,t);if(s instanceof Xc)return function(t,e){if(!wl(e.yh))throw e.Vh(t.Rh+"() can only be used with update() and set()");if(!e.path)throw e.Vh(t.Rh+"() is not currently supported inside arrays");t=t.Ph(e);t&&e.fieldTransforms.push(t)}(s,t),null;if(t.path&&t.Qn.push(t.path),s instanceof Array){if(t.settings.ph&&4!==t.yh)throw t.Vh("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=s;r<i.length;r++){var o=Pl(i[r],t.Bh(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 Vo(e.serializer,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=ni.fromDate(t);return{timestampValue:Co(e.serializer,n)}}if(t instanceof ni){var r=new ni(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Co(e.serializer,r)}}if(t instanceof sl)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof jr)return{bytesValue:xo(e.serializer,t.l)};if(t instanceof hl){n=e._,r=t.Nh;if(!r.isEqual(n))throw e.Vh("Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return{referenceValue:Mo(t.Nh||e._,t.xh.path)}}if(void 0===t&&e.ignoreUndefinedProperties)return null;throw e.Vh("Unsupported field value: "+jc(t))}(s,t)}function Ll(t,n){var r={};return Zr(t)?n.path&&0<n.path.length&&n.Qn.push(n.path):Kr(t,function(t,e){e=Pl(e,n.Lh(t));null!=e&&(r[t]=e)}),{mapValue:{fields:r}}}function kl(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof ni||t instanceof sl||t instanceof jr||t instanceof hl||t instanceof Xc)}function Rl(t,e,n){if(!kl(n)||("object"!=typeof(r=n)||null===r||Object.getPrototypeOf(r)!==Object.prototype&&null!==Object.getPrototypeOf(r))){n=jc(n);throw"an object"===n?e.Vh(t+" a custom object"):e.Vh(t+" "+n)}var r}function Dl(t,e,n){if(e instanceof Wc)return e.Ah;if("string"==typeof e)return _l(t,e);throw Vl("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}function _l(t,e,n){try{return function(e){if(0<=e.search(zc))throw new Ar(Tr.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(Hc.bind.apply(Hc,i([void 0],e.split("."))))}catch(t){throw new Ar(Tr.INVALID_ARGUMENT,"Invalid field path ("+e+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}(e).Ah}catch(e){throw Vl(e instanceof Error?e.message:e.toString(),t,!1,void 0,n)}}function Vl(t,e,n,r,i){var o=r&&!r.P(),s=void 0!==i,e="Function "+e+"() called with invalid data";n&&(e+=" (via `toFirestore()`)");n="";return(o||s)&&(n+=" (found",o&&(n+=" in field "+r),s&&(n+=" in document "+i),n+=")"),new Ar(Tr.INVALID_ARGUMENT,(e+=". ")+t+n)}function Cl(t,e){return t.some(function(t){return t.isEqual(e)})}var xl=(Fl.prototype.zh=function(r){return y(this,void 0,void 0,function(){var e,n=this;return v(this,function(t){switch(t.label){case 0:if(this.Yh(),0<this.mutations.length)throw new Ar(Tr.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(s,u){return y(this,void 0,void 0,function(){var n,e,r,i,o;return v(this,function(t){switch(t.label){case 0:return e=Bo((n=s).serializer)+"/documents",r={documents:u.map(function(t){return qo(n.serializer,t)})},[4,n.Gr("BatchGetDocuments",e,r)];case 1:return r=t.sent(),i=new Map,r.forEach(function(t){var e,t=(e=n.serializer,"found"in(t=t)?function(t,e){_r(!!e.found),e.found.name,e.found.updateTime;var n=jo(t,e.found.name),t=Uo(e.found.updateTime),e=new Ms({mapValue:{fields:e.found.fields}});return new Xs(n,t,e,{})}(e,t):"missing"in t?function(t,e){_r(!!e.missing),_r(!!e.readTime);t=jo(t,e.missing),e=Uo(e.readTime);return new Qs(t,e)}(e,t):Dr());i.set(t.key.toString(),t)}),o=[],[2,(u.forEach(function(t){t=i.get(t.toString());_r(!!t),o.push(t)}),o)]}})})}(this.ro,r)];case 1:return[2,((e=t.sent()).forEach(function(t){t instanceof Qs||t instanceof Xs?n.Jh(t):Dr()}),e)]}})})},Fl.prototype.set=function(t,e){this.write(e.kh(t,this.Hn(t))),this.Hh.add(t.toString())},Fl.prototype.update=function(t,e){try{this.write(e.kh(t,this.Xh(t)))}catch(t){this.Gh=t}this.Hh.add(t.toString())},Fl.prototype.delete=function(t){this.write([new xs(t,this.Hn(t))]),this.Hh.add(t.toString())},Fl.prototype.commit=function(){return y(this,void 0,void 0,function(){var e,n=this;return v(this,function(t){switch(t.label){case 0:if(this.Yh(),this.Gh)throw this.Gh;return e=this.Qh,this.mutations.forEach(function(t){e.delete(t.key.toString())}),e.forEach(function(t,e){e=ui.H(e);n.mutations.push(new Us(e,n.Hn(e)))}),[4,function(i,o){return y(this,void 0,void 0,function(){var e,n,r;return v(this,function(t){switch(t.label){case 0:return n=Bo((e=i).serializer)+"/documents",r={writes:o.map(function(t){return Wo(e.serializer,t)})},[4,e.Kr("Commit",n,r)];case 1:return t.sent(),[2]}})})}(this.ro,this.mutations)];case 1:return t.sent(),this.Kh=!0,[2]}})})},Fl.prototype.Jh=function(t){var e;if(t instanceof Xs)e=t.version;else{if(!(t instanceof Qs))throw Dr();e=ri.min()}var n=this.Qh.get(t.key.toString());if(n){if(!e.isEqual(n))throw new Ar(Tr.ABORTED,"Document version changed between two reads.")}else this.Qh.set(t.key.toString(),e)},Fl.prototype.Hn=function(t){var e=this.Qh.get(t.toString());return!this.Hh.has(t.toString())&&e?vs.updateTime(e):vs.Jn()},Fl.prototype.Xh=function(t){var e=this.Qh.get(t.toString());if(this.Hh.has(t.toString())||!e)return vs.exists(!0);if(e.isEqual(ri.min()))throw new Ar(Tr.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return vs.updateTime(e)},Fl.prototype.write=function(t){this.Yh(),this.mutations=this.mutations.concat(t)},Fl.prototype.Yh=function(){},Fl),Ul=(jl.prototype.run=function(){this.ta()},jl.prototype.ta=function(){var t=this;this.Xe.Pe(function(){return y(t,void 0,void 0,function(){var e,n,r=this;return v(this,function(t){return e=new xl(this.ro),(n=this.na(e))&&n.then(function(t){r.$e.We(function(){return e.commit().then(function(){r.qe.resolve(t)}).catch(function(t){r.ea(t)})})}).catch(function(t){r.ea(t)}),[2]})})})},jl.prototype.na=function(t){try{var e=this.updateFunction(t);return!yi(e)&&e.catch&&e.then?e:(this.qe.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.qe.reject(t),null}},jl.prototype.ea=function(t){var e=this;0<this.Zh&&this.sa(t)?(--this.Zh,this.$e.We(function(){return e.ta(),Promise.resolve()})):this.qe.reject(t)},jl.prototype.sa=function(t){if("FirebaseError"!==t.name)return!1;t=t.code;return"aborted"===t||"failed-precondition"===t||!Oi(t)},jl),Ml=(ql.prototype.getConfiguration=function(){return y(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return[4,this.qs.promise];case 1:return[2,(t.sent(),{$e:this.$e,Kc:this.Kc,clientId:this.clientId,credentials:this.credentials,lh:this.user,Au:100})]}})})},ql.prototype.ra=function(t){var e=this;this.ia=t,this.qs.promise.then(function(){return e.ia(e.user)})},ql.prototype.oa=function(){if(this.$e.ts)throw new Ar(Tr.FAILED_PRECONDITION,"The client has already been terminated.")},ql.prototype.terminate=function(){var t=this;this.$e.rs();var n=new zu;return this.$e.ns(function(){return y(t,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return t.trys.push([0,5,,6]),this.ua?[4,this.ua.terminate()]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.ca?[4,this.ca.terminate()]:[3,4];case 3:t.sent(),t.label=4;case 4:return this.credentials.Ms(),n.resolve(),[3,6];case 5:return e=t.sent(),e=ra(e,"Failed to shutdown persistence"),n.reject(e),[3,6];case 6:return[2]}})})}),n.promise},ql);function ql(t,e,n){var r=this;this.credentials=t,this.$e=e,this.Kc=n,this.user=ca.UNAUTHENTICATED,this.clientId=Vr.t(),this.ia=function(){},this.qs=new zu,this.credentials.$s(function(t){Pr("FirestoreClient","Received user=",t.uid),r.user.isEqual(t)||(r.user=t,r.ia(t)),r.qs.resolve()})}function jl(t,e,n,r){this.$e=t,this.ro=e,this.updateFunction=n,this.qe=r,this.Zh=5,this.Xe=new Xu(this.$e,"transaction_retry")}function Fl(t){this.ro=t,this.Qh=new Map,this.mutations=[],this.Kh=!1,this.Gh=null,this.Hh=new Set}function Bl(e){return y(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return e.ca?[3,2]:(Pr("FirestoreClient","Using default OfflineComponentProvider"),[4,function(r,i){return y(this,void 0,void 0,function(){var e,n=this;return v(this,function(t){switch(t.label){case 0:return r.$e.hs(),Pr("FirestoreClient","Initializing OfflineComponentProvider"),[4,r.getConfiguration()];case 1:return e=t.sent(),[4,i.initialize(e)];case 2:return t.sent(),r.ra(function(e){return r.$e.os(function(){return y(n,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return[4,ja(i.io,e)];case 1:return t.sent(),[2]}})})})}),i.persistence.Vc(function(){return r.terminate()}),r.ca=i,[2]}})})}(e,new Rc)]);case 1:t.sent(),t.label=2;case 2:return[2,e.ca]}})})}function Gl(e){return y(this,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return e.ua?[3,2]:(Pr("FirestoreClient","Using default OnlineComponentProvider"),[4,function(r,i){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return r.$e.hs(),[4,Bl(r)];case 1:return e=t.sent(),Pr("FirestoreClient","Initializing OnlineComponentProvider"),[4,r.getConfiguration()];case 2:return n=t.sent(),[4,i.initialize(e,n)];case 3:return t.sent(),r.ra(function(t){return r.$e.os(function(){return function(r,i){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return(e=r).$e.hs(),Pr("RemoteStore","RemoteStore received new credentials"),n=dh(e),e.ho.add(3),[4,uh(e)];case 1:return t.sent(),n&&e.fo.set("Unknown"),[4,e.oo.mh(i)];case 2:return t.sent(),e.ho.delete(3),[4,sh(e)];case 3:return t.sent(),[2]}})})}(i.mu,t)})}),r.ua=i,[2]}})})}(e,new Dc)]);case 1:t.sent(),t.label=2;case 2:return[2,e.ua]}})})}function Wl(t){return Bl(t).then(function(t){return t.persistence})}function Hl(t){return Bl(t).then(function(t){return t.io})}function zl(t){return Gl(t).then(function(t){return t.mu})}function Xl(t){return Gl(t).then(function(t){return t.wh})}function Ql(r){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return[4,Gl(r)];case 1:return e=t.sent(),[2,((n=e.Tu).Is=jh.bind(null,e.wh),n.Ps=function(i,o){return y(this,void 0,void 0,function(){var e,n,r;return v(this,function(t){switch(t.label){case 0:return n=(e=i).Pu.get(o),1<(r=e.yu.get(n.targetId)).length?[2,(e.yu.set(n.targetId,r.filter(function(t){return!lu(t,o)})),void e.Pu.delete(o))]:e.Fu?(e.Iu.Qo(n.targetId),e.Iu.zo(n.targetId)?[3,2]:[4,Wa(e.io,n.targetId,!1).then(function(){e.Iu.Go(n.targetId),hh(e.mu,n.targetId),Xh(e,n.targetId)}).catch(za)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return Xh(e,n.targetId),[4,Wa(e.io,n.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})}.bind(null,e.wh),n)]}})})}function $l(n,t,e,r){var i=this,o=new _c(r),s=new ha(t,o,e);return n.$e.We(function(){return y(i,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=sa,[4,Ql(n)];case 1:return[2,e.apply(void 0,[t.sent(),s])]}})})}),function(){o.Ih(),n.$e.We(function(){return y(i,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=ua,[4,Ql(n)];case 1:return[2,e.apply(void 0,[t.sent(),s])]}})})})}}function Yl(n,r){var t=this,i=new zu;return n.$e.We(function(){return y(t,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=Fh,[4,Xl(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}function Kl(n,t){var e=this,r=new _c(t);return n.$e.We(function(){return y(e,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=function(t,e){t.Ts.add(e),e.next()},[4,Ql(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})}),function(){r.Ih(),n.$e.We(function(){return y(e,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=function(t,e){t.Ts.delete(e)},[4,Ql(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})})}}function Zl(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 Jl=(af.prototype._a=function(t){switch(po(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Eo(t.integerValue||t.doubleValue);case 3:return this.fa(t.timestampValue);case 4:return this.da(t);case 5:return t.stringValue;case 6:return this.la(Io(t.bytesValue));case 7:return this.wa(t.referenceValue);case 8:return this.Ea(t.geoPointValue);case 9:return this.ma(t.arrayValue);case 10:return this.Ta(t.mapValue);default:throw Dr()}},af.prototype.Ta=function(t){var n=this,r={};return Kr(t.fields||{},function(t,e){r[t]=n._a(e)}),r},af.prototype.Ea=function(t){return new sl(Eo(t.latitude),Eo(t.longitude))},af.prototype.ma=function(t){var e=this;return(t.values||[]).map(function(t){return e._a(t)})},af.prototype.da=function(t){switch(this.ha){case"previous":var e=function t(e){e=e.mapValue.fields.__previous_value__;return co(e)?t(e):e}(t);return null==e?null:this._a(e);case"estimate":return this.fa(lo(t));default:return null}},af.prototype.fa=function(t){t=bo(t);return new ni(t.seconds,t.nanos)},af.prototype.wa=function(t){var e=ii.U(t);_r(Qo(e));t=new Xr(e.get(1),e.get(3)),e=new ui(e.F(5));return t.isEqual(this._)||Lr("Document "+e+" contains a document reference within a different database ("+t.projectId+"/"+t.database+") which is not supported. It will be treated as a reference in the current database ("+this._.projectId+"/"+this._.database+") instead."),this.aa(e)},af),tf=(uf.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties},uf),ef="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.",nf=(sf.prototype.enableIndexedDbPersistence=function(t,e){throw new Ar(Tr.FAILED_PRECONDITION,ef)},sf.prototype.enableMultiTabIndexedDbPersistence=function(t){throw new Ar(Tr.FAILED_PRECONDITION,ef)},sf.prototype.clearIndexedDbPersistence=function(t){throw new Ar(Tr.FAILED_PRECONDITION,ef)},sf),rf=(Object.defineProperty(of.prototype,"va",{get:function(){return!!this.Pa},enumerable:!1,configurable:!0}),Object.defineProperty(of.prototype,"ba",{get:function(){return this.Ra.ts},enumerable:!1,configurable:!0}),Object.defineProperty(of.prototype,"Ca",{get:function(){return this.Sa||(this.Sa=new El(this.Nh,this.pa.ignoreUndefinedProperties)),this.Sa},enumerable:!1,configurable:!0}),of.prototype.settings=function(t){t.merge&&delete(t=Object.assign(Object.assign({},this.pa),t)).merge;t=new tf(t);if(this.Pa&&!this.pa.isEqual(t))throw new Ar(Tr.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");void 0!==(this.pa=t).credentials&&(this.ga=function(t){if(!t)return new da;switch(t.type){case"gapi":var e=t.client;return _r(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new ga(e,t.sessionIndex||"0");case"provider":return t.client;default:throw new Ar(Tr.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(t.credentials))},of.prototype.useEmulator=function(t,e){"firestore.googleapis.com"!==this.pa.host&&kr("Host has been set in both settings() and useEmulator(), emulator host will be used"),this.settings({host:t+":"+e,ssl:!1,merge:!0})},of.prototype.enableNetwork=function(){return hf(this),function(r){var t=this;return r.$e.enqueue(function(){return y(t,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return[4,Wl(r)];case 1:return e=t.sent(),[4,zl(r)];case 2:return n=t.sent(),[2,(e.gc(!0),(t=n).ho.delete(0),sh(t))]}})})})}(this.Pa)},of.prototype.disableNetwork=function(){return hf(this),function(r){var t=this;return r.$e.enqueue(function(){return y(t,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return[4,Wl(r)];case 1:return e=t.sent(),[4,zl(r)];case 2:return n=t.sent(),[2,(e.gc(!1),function(n){return y(this,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return(e=n).ho.add(0),[4,uh(e)];case 1:return t.sent(),e.fo.set("Offline"),[2]}})})}(n))]}})})})}(this.Pa)},of.prototype.enablePersistence=function(t){if(this.Pa)throw new Ar(Tr.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 e=!1,n=!1;return t&&qc("synchronizeTabs",e=!!t.synchronizeTabs,"experimentalForceOwningTab",n=!!t.experimentalForceOwningTab),e?this.Ia.enableMultiTabIndexedDbPersistence(this):this.Ia.enableIndexedDbPersistence(this,n)},of.prototype.clearPersistence=function(){return y(this,void 0,void 0,function(){return v(this,function(t){return[2,this.Ia.clearIndexedDbPersistence(this)]})})},of.prototype.terminate=function(){return this.app._removeServiceInstance("firestore"),this.INTERNAL.delete()},of.prototype.waitForPendingWrites=function(){return hf(this),function(n){var t=this,r=new zu;return n.$e.We(function(){return y(t,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=Wh,[4,Xl(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})}),r.promise}(this.Pa)},of.prototype.onSnapshotsInSync=function(t){if(hf(this),Zl(t))return Kl(this.Pa,t);t={next:t};return Kl(this.Pa,t)},of.ya=function(t){if(e=t.options,!Object.prototype.hasOwnProperty.call(e,"projectId"))throw new Ar(Tr.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');var e,t=t.options.projectId;if(!t||"string"!=typeof t)throw new Ar(Tr.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new Xr(t)},Object.defineProperty(of.prototype,"app",{get:function(){if(!this.Aa)throw new Ar(Tr.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.Aa},enumerable:!1,configurable:!0}),of.prototype.collection=function(t){return Uc("Firestore.collection","path",t),hf(this),new Df(ii.U(t),this,null)},of.prototype.doc=function(t){return Uc("Firestore.doc","path",t),hf(this),yf.Da(ii.U(t),this,null)},of.prototype.collectionGroup=function(t){if(Uc("Firestore.collectionGroup","collectionId",t),0<=t.indexOf("/"))throw new Ar(Tr.INVALID_ARGUMENT,"Invalid collection ID '"+t+"' passed to function Firestore.collectionGroup(). Collection IDs must not contain '/'.");return hf(this),new kf((t=t,new Ys(ii.B(),t)),this,null)},of.prototype.runTransaction=function(e){var n=this;return function(n,r){var t=this,i=new zu;return n.$e.We(function(){return y(t,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return[4,Gl(n).then(function(t){return t.ro})];case 1:return e=t.sent(),new Ul(n.$e,e,r,i).run(),[2]}})})}),i.promise}(hf(this),function(t){return e(new pf(n,t))})},of.prototype.batch=function(){return hf(this),new df(this)},of.prototype.Fa=function(){return this.pa},of);function of(t,e,n){var r=this;if(void 0===n&&(n=new nf),this.Ia=n,this.Aa=null,this.Ra=new ta,this.INTERNAL={delete:function(){return y(r,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return this.Pa||cf(this),[4,this.Pa.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){n=t;this.Aa=n,this.Nh=of.ya(n),this.Va=n.name,this.ga=new ya(e)}else{t=t;if(!t.projectId)throw new Ar(Tr.INVALID_ARGUMENT,"Must provide projectId");this.Nh=new Xr(t.projectId,t.database),this.Va="[DEFAULT]",this.ga=new da}this.pa=new tf({})}function sf(){}function uf(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Ar(Tr.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Ar(Tr.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,qc("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}function af(t,e,n,r){this._=t,this.ha=e,this.aa=n,this.la=r}function hf(t){return t.Pa||cf(t),t.Pa.oa(),t.Pa}function cf(t){var e,n,r=t.Fa(),r=(e=t.Nh,n=t.Va,new zr(e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling));t.Pa=new Ml(t.ga,t.Ra,r)}var lf,ff,pf=(Af.prototype.get=function(t){var e=this,n=xf(0,t,this.Na);return this.xa.zh([n.xh]).then(function(t){if(!t||1!==t.length)return Dr();t=t[0];if(t instanceof Qs)return new gf(e.Na,n.xh,null,!1,!1,n.Oh);if(t instanceof Xs)return new gf(e.Na,n.xh,t,!1,!1,n.Oh);throw Dr()})},Af.prototype.set=function(t,e,n){t=xf(0,t,this.Na);n=Mc("Transaction.set",n);e=Uf(t.Oh,e,n),n=Al(this.Na.Ca,"Transaction.set",t.xh,e,null!==t.Oh,n);return this.xa.set(t.xh,n),this},Af.prototype.update=function(t,e,n){for(var r,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return e="string"==typeof e||e instanceof Hc?(r=xf(0,t,this.Na),Ol(this.Na.Ca,"Transaction.update",r.xh,e,n,i)):(r=xf(0,t,this.Na),Nl(this.Na.Ca,"Transaction.update",r.xh,e)),this.xa.update(r.xh,e),this},Af.prototype.delete=function(t){t=xf(0,t,this.Na);return this.xa.delete(t.xh),this},Af),df=(Tf.prototype.set=function(t,e,n){this.$a();t=xf(0,t,this.Na);n=Mc("WriteBatch.set",n);e=Uf(t.Oh,e,n),n=Al(this.Na.Ca,"WriteBatch.set",t.xh,e,null!==t.Oh,n);return this.Oa=this.Oa.concat(n.kh(t.xh,vs.Jn())),this},Tf.prototype.update=function(t,e,n){for(var r,i=[],o=3;o<arguments.length;o++)i[o-3]=arguments[o];return this.$a(),e="string"==typeof e||e instanceof Hc?(r=xf(0,t,this.Na),Ol(this.Na.Ca,"WriteBatch.update",r.xh,e,n,i)):(r=xf(0,t,this.Na),Nl(this.Na.Ca,"WriteBatch.update",r.xh,e)),this.Oa=this.Oa.concat(e.kh(r.xh,vs.exists(!0))),this},Tf.prototype.delete=function(t){this.$a();t=xf(0,t,this.Na);return this.Oa=this.Oa.concat(new xs(t.xh,vs.Jn())),this},Tf.prototype.commit=function(){return this.$a(),this.ka=!0,0<this.Oa.length?Yl(hf(this.Na),this.Oa):Promise.resolve()},Tf.prototype.$a=function(){if(this.ka)throw new Ar(Tr.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},Tf),yf=(n(If,ff=hl),If.Da=function(t,e,n){if(t.length%2!=0)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.q()+" has "+t.length);return new If(new ui(t),e,n)},Object.defineProperty(If.prototype,"id",{get:function(){return this.xh.path.k()},enumerable:!1,configurable:!0}),Object.defineProperty(If.prototype,"parent",{get:function(){return new Df(this.xh.path.N(),this.firestore,this.Oh)},enumerable:!1,configurable:!0}),Object.defineProperty(If.prototype,"path",{get:function(){return this.xh.path.q()},enumerable:!1,configurable:!0}),If.prototype.collection=function(t){if(Uc("DocumentReference.collection","path",t),!t)throw new Ar(Tr.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");t=ii.U(t);return new Df(this.xh.path.child(t),this.firestore,null)},If.prototype.isEqual=function(t){return t instanceof If&&this.firestore===t.firestore&&this.xh.isEqual(t.xh)&&this.Oh===t.Oh},If.prototype.set=function(t,e){e=Mc("DocumentReference.set",e);t=Uf(this.Oh,t,e),e=Al(this.firestore.Ca,"DocumentReference.set",this.xh,t,null!==this.Oh,e);return Yl(this.Pa,e.kh(this.xh,vs.Jn()))},If.prototype.update=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return t="string"==typeof t||t instanceof Hc?Ol(this.firestore.Ca,"DocumentReference.update",this.xh,t,e,n):Nl(this.firestore.Ca,"DocumentReference.update",this.xh,t),Yl(this.Pa,t.kh(this.xh,vs.exists(!0)))},If.prototype.delete=function(){return Yl(this.Pa,[new xs(this.xh,vs.Jn())])},If.prototype.onSnapshot=function(){for(var e=this,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];var r={includeMetadataChanges:!1},i=0;"object"!=typeof n[i]||Zl(n[i])||(r=n[i],i++);var o={includeMetadataChanges:r.includeMetadataChanges};Zl(n[i])&&(s=n[i],n[i]=null===(r=s.next)||void 0===r?void 0:r.bind(s),n[i+1]=null===(r=s.error)||void 0===r?void 0:r.bind(s),n[i+2]=null===(r=s.complete)||void 0===r?void 0:r.bind(s));var s={next:function(t){n[i]&&n[i](e.Ma(t))},error:n[i+1],complete:n[i+2]};return $l(this.Pa,tu(this.xh.path),o,s)},If.prototype.get=function(t){var e=this;return t&&"cache"===t.source?function(n,r){var t=this,i=new zu;return n.$e.We(function(){return y(t,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=function(i,o,s){return y(this,void 0,void 0,function(){var r;return v(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(e=o,(n=i).persistence.runTransaction("read document","readonly",function(t){return n.Mi.ni(t,e)}))];case 1:return(r=t.sent())instanceof Xs?s.resolve(r):r instanceof Qs?s.resolve(null):s.reject(new Ar(Tr.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 r=t.sent(),r=ra(r,"Failed to get document '"+o+" from cache"),s.reject(r),[3,3];case 3:return[2]}var e,n})})},[4,Hl(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(this.Pa,this.xh).then(function(t){return new gf(e.firestore,e.xh,t,!0,t instanceof Xs&&t.Xn,e.Oh)}):function(n,r,i){var t=this;void 0===i&&(i={});var o=new zu;return n.$e.We(function(){return y(t,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=function(n,r,i,o,s){var t=new _c({next:function(t){r.We(function(){return ua(n,u)});var e=t.docs.has(i);!e&&t.fromCache?s.reject(new Ar(Tr.UNAVAILABLE,"Failed to get document because the client is offline.")):e&&t.fromCache&&o&&"server"===o.source?s.reject(new Ar(Tr.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(t)},error:function(t){return s.reject(t)}}),u=new ha(tu(i.path),t,{includeMetadataChanges:!0,Cs:!0});return sa(n,u)},[4,Ql(n)];case 1:return[2,e.apply(void 0,[t.sent(),n.$e,r,i,o])]}})})}),o.promise}(this.Pa,this.xh,t).then(function(t){return e.Ma(t)})},If.prototype.withConverter=function(t){return new If(this.xh,this.firestore,t)},If.prototype.Ma=function(t){var e=t.docs.get(this.xh);return new gf(this.firestore,this.xh,e,t.fromCache,t.hasPendingWrites,this.Oh)},If),vf=(Ef.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},Ef),gf=(bf.prototype.data=function(t){var e=this;if(void 0===t&&(t={}),this.La){if(this.Oh){var n=new mf(this.Na,this.xh,this.La,this.qa,this.Ua,null);return this.Oh.fromFirestore(n,t)}return new Jl(this.Na.Nh,t.serverTimestamps||"none",function(t){return new yf(t,e.Na,null)},function(t){return new Hr(t)})._a(this.La.re())}},bf.prototype.get=function(t,e){var n=this;if(void 0===e&&(e={}),this.La){t=this.La.data().field(Dl("DocumentSnapshot.get",t,this.xh));if(null!==t)return new Jl(this.Na.Nh,e.serverTimestamps||"none",function(t){return new yf(t,n.Na,n.Oh)},function(t){return new Hr(t)})._a(t)}},Object.defineProperty(bf.prototype,"id",{get:function(){return this.xh.path.k()},enumerable:!1,configurable:!0}),Object.defineProperty(bf.prototype,"ref",{get:function(){return new yf(this.xh,this.Na,this.Oh)},enumerable:!1,configurable:!0}),Object.defineProperty(bf.prototype,"exists",{get:function(){return null!==this.La},enumerable:!1,configurable:!0}),Object.defineProperty(bf.prototype,"metadata",{get:function(){return new vf(this.Ua,this.qa)},enumerable:!1,configurable:!0}),bf.prototype.isEqual=function(t){return t instanceof bf&&this.Na===t.Na&&this.qa===t.qa&&this.xh.isEqual(t.xh)&&(null===this.La?null===t.La:this.La.isEqual(t.La))&&this.Oh===t.Oh},bf),mf=(n(wf,lf=gf),wf.prototype.data=function(t){return lf.prototype.data.call(this,t)},wf);function wf(){return null!==lf&&lf.apply(this,arguments)||this}function bf(t,e,n,r,i,o){this.Na=t,this.xh=e,this.La=n,this.qa=r,this.Ua=i,this.Oh=o}function Ef(t,e){this.hasPendingWrites=t,this.fromCache=e}function If(t,e,n){var r=this;return(r=ff.call(this,e.Nh,t,n)||this).xh=t,r.firestore=e,r.Oh=n,r.Pa=hf(e),r}function Tf(t){this.Na=t,this.Oa=[],this.ka=!1}function Af(t,e){this.Na=t,this.xa=e}function Nf(t,e,n){if("string"==typeof n){if(""===n)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!ou(e)&&-1!==n.indexOf("/"))throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '"+n+"' contains a '/' character.");e=e.path.child(ii.U(n));if(!ui.X(e))throw new Ar(Tr.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 To(t,new ui(e))}if(n instanceof hl)return To(t,n.xh);throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+jc(n)+".")}function Of(t,e){if(!Array.isArray(t)||0===t.length)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.")}function Sf(t,e,n){if(!n.isEqual(e))throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+e.toString()+"' and so you must also use '"+e.toString()+"' as your first orderBy(), but your first orderBy() is on field '"+n.toString()+"' instead.")}function Pf(t){if(nu(t)&&0===t.oe.length)throw new Ar(Tr.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var Lf,kf=(Cf.prototype.where=function(t,e,n){t=Dl("Query.where",t),e=function(t,e,n,r,i,o){if(r.W()){if("array-contains"===i||"array-contains-any"===i)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i||"not-in"===i){Of(o,i);for(var s=[],u=0,a=o;u<a.length;u++){var h=a[u];s.push(Nf(n,t,h))}c={arrayValue:{values:s}}}else c=Nf(n,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Of(o,i),c=Sl(e,"Query.where",o,"in"===i||"not-in"===i);var c=gu.create(r,i,c);return function(t,e){if(e.ae()){var n=iu(t);if(null!==n&&!n.isEqual(e.field))throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+n.toString()+"' and '"+e.field.toString()+"'");n=ru(t);null!==n&&Sf(0,e.field,n)}t=function(t,e){for(var n=0,r=t.filters;n<r.length;n++){var i=r[n];if(0<=e.indexOf(i.op))return i.op}return null}(t,function(){switch(e.op){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}());if(null!==t)throw t===e.op?new Ar(Tr.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new Ar(Tr.INVALID_ARGUMENT,"Invalid query. You cannot use '"+e.op.toString()+"' filters with '"+t.toString()+"' filters.")}(t,c),c}(this.Ba,this.firestore.Ca,this.firestore.Nh,t,e,n);return new Cf((n=this.Ba,e=n.filters.concat([e]),new Ys(n.path,n.collectionGroup,n.oe.slice(),e,n.limit,n.ue,n.startAt,n.endAt)),this.firestore,this.Oh)},Cf.prototype.orderBy=function(t,e){if(void 0===e||"asc"===e)n="asc";else{if("desc"!==e)throw new Ar(Tr.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+e+"', expected 'asc' or 'desc'.");n="desc"}var n,t=Dl("Query.orderBy",t),t=function(t,e,n){if(null!==t.startAt)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");e=new Hu(e,n);return n=e,null!==ru(t)||null!==(t=iu(t))&&Sf(0,t,n.field),e}(this.Ba,t,n);return new Cf((n=this.Ba,t=n.oe.concat([t]),new Ys(n.path,n.collectionGroup,t,n.filters.slice(),n.limit,n.ue,n.startAt,n.endAt)),this.firestore,this.Oh)},Cf.prototype.limit=function(t){return Fc("Query.limit",t),new Cf(au(this.Ba,t,"F"),this.firestore,this.Oh)},Cf.prototype.limitToLast=function(t){return Fc("Query.limitToLast",t),new Cf(au(this.Ba,t,"L"),this.firestore,this.Oh)},Cf.prototype.startAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t=this.ja("Query.startAt",t,e,!0);return new Cf(hu(this.Ba,t),this.firestore,this.Oh)},Cf.prototype.startAfter=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t=this.ja("Query.startAfter",t,e,!1);return new Cf(hu(this.Ba,t),this.firestore,this.Oh)},Cf.prototype.endBefore=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t=this.ja("Query.endBefore",t,e,!0);return new Cf(cu(this.Ba,t),this.firestore,this.Oh)},Cf.prototype.endAt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];t=this.ja("Query.endAt",t,e,!1);return new Cf(cu(this.Ba,t),this.firestore,this.Oh)},Cf.prototype.isEqual=function(t){return t instanceof Cf&&this.firestore===t.firestore&&lu(this.Ba,t.Ba)&&this.Oh===t.Oh},Cf.prototype.withConverter=function(t){return new Cf(this.Ba,this.firestore,t)},Cf.prototype.ja=function(h,t,e,n){if(t instanceof gf)return function(t,e,n,r){if(!n)throw new Ar(Tr.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+h+"().");for(var i=[],o=0,s=su(t);o<s.length;o++){var u=s[o];if(u.field.W())i.push(To(e,n.key));else{var a=n.field(u.field);if(co(a))throw new Ar(Tr.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+u.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===a){u=u.field.q();throw new Ar(Tr.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.")}i.push(a)}}return new Uu(i,r)}(this.Ba,this.firestore.Nh,t.La,n);e=[t].concat(e);return function(t,e,n,r,i,o){var s=t.oe;if(i.length>s.length)throw new Ar(Tr.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var u=[],a=0;a<i.length;a++){var h=i[a];if(s[a].field.W()){if("string"!=typeof h)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof h);if(!ou(t)&&-1!==h.indexOf("/"))throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to "+r+"() must be a plain document ID, but '"+h+"' contains a slash.");var c=t.path.child(ii.U(h));if(!ui.X(c))throw new Ar(Tr.INVALID_ARGUMENT,"Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to "+r+"() must result in a valid document path, but '"+c+"' is not because it contains an odd number of segments.");c=new ui(c);u.push(To(e,c))}else{h=Sl(n,r,h);u.push(h)}}return new Uu(u,o)}(this.Ba,this.firestore.Nh,this.firestore.Ca,h,e,n)},Cf.prototype.onSnapshot=function(){for(var t,e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i={},o=0;"object"!=typeof n[o]||Zl(n[o])||(i=n[o],o++),Zl(n[o])&&(s=n[o],n[o]=null===(t=s.next)||void 0===t?void 0:t.bind(s),n[o+1]=null===(t=s.error)||void 0===t?void 0:t.bind(s),n[o+2]=null===(t=s.complete)||void 0===t?void 0:t.bind(s));var s={next:function(t){n[o]&&n[o](new Rf(e.firestore,e.Ba,t,e.Oh))},error:n[o+1],complete:n[o+2]};return Pf(this.Ba),$l(hf(this.firestore),this.Ba,i,s)},Cf.prototype.get=function(t){var e=this;Pf(this.Ba);var n=hf(this.firestore);return(t&&"cache"===t.source?function(n,r){var t=this,i=new zu;return n.$e.We(function(){return y(t,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=function(r,i,o){return y(this,void 0,void 0,function(){var e,n;return v(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,Ha(r,i,!0)];case 1:return n=t.sent(),e=new kh(i,n.lr),n=e.ru(n.documents),n=e.hu(n,!1),o.resolve(n.snapshot),[3,3];case 2:return n=t.sent(),n=ra(n,"Failed to execute query '"+i+" against cache"),o.reject(n),[3,3];case 3:return[2]}})})},[4,Hl(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(n,this.Ba):function(n,r,i){var t=this;void 0===i&&(i={});var o=new zu;return n.$e.We(function(){return y(t,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return e=function(e,n,t,r,i){var o=new _c({next:function(t){n.We(function(){return ua(e,s)}),t.fromCache&&"server"===r.source?i.reject(new Ar(Tr.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(t)},error:function(t){return i.reject(t)}}),s=new ha(t,o,{includeMetadataChanges:!0,Cs:!0});return sa(e,s)},[4,Ql(n)];case 1:return[2,e.apply(void 0,[t.sent(),n.$e,r,i,o])]}})})}),o.promise}(n,this.Ba,t)).then(function(t){return new Rf(e.firestore,e.Ba,t,e.Oh)})},Cf),Rf=(Object.defineProperty(Vf.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!1,configurable:!0}),Object.defineProperty(Vf.prototype,"empty",{get:function(){return this.Qa.docs.P()},enumerable:!1,configurable:!0}),Object.defineProperty(Vf.prototype,"size",{get:function(){return this.Qa.docs.size},enumerable:!1,configurable:!0}),Vf.prototype.forEach=function(e,n){var r=this;this.Qa.docs.forEach(function(t){e.call(n,r.Ha(t,r.metadata.fromCache,r.Qa.Wt.has(t.key)))})},Object.defineProperty(Vf.prototype,"query",{get:function(){return new kf(this.Wa,this.Na,this.Oh)},enumerable:!1,configurable:!0}),Vf.prototype.docChanges=function(t){t=!(!t||!t.includeMetadataChanges);if(t&&this.Qa.Kt)throw new Ar(Tr.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.Ka&&this.Ga===t||(this.Ka=function(i,e,o){if(i.jt.P()){var n=0;return i.docChanges.map(function(t){var e=o(t.doc,i.fromCache,i.Wt.has(t.doc.key));return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var s=i.jt;return i.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=o(t.doc,i.fromCache,i.Wt.has(t.doc.key)),n=-1,r=-1;return 0!==t.type&&(n=s.indexOf(t.doc.key),s=s.delete(t.doc.key)),1!==t.type&&(r=(s=s.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 Dr()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.Qa,t,this.Ha.bind(this)),this.Ga=t),this.Ka},Vf.prototype.isEqual=function(t){return t instanceof Vf&&this.Na===t.Na&&lu(this.Wa,t.Wa)&&this.Qa.isEqual(t.Qa)&&this.Oh===t.Oh},Vf.prototype.Ha=function(t,e,n){return new mf(this.Na,t.key,t,e,n,this.Oh)},Vf),Df=(n(_f,Lf=kf),Object.defineProperty(_f.prototype,"id",{get:function(){return this.Ba.path.k()},enumerable:!1,configurable:!0}),Object.defineProperty(_f.prototype,"parent",{get:function(){var t=this.Ba.path.N();return t.P()?null:new yf(new ui(t),this.firestore,null)},enumerable:!1,configurable:!0}),Object.defineProperty(_f.prototype,"path",{get:function(){return this.Ba.path.q()},enumerable:!1,configurable:!0}),_f.prototype.doc=function(t){0===arguments.length&&(t=Vr.t()),Uc("CollectionReference.doc","path",t);t=ii.U(t);return yf.Da(this.Ba.path.child(t),this.firestore,this.Oh)},_f.prototype.add=function(t){var t=this.Oh?this.Oh.toFirestore(t):t,e=this.doc();return new yf(e.xh,this.firestore,null).set(t).then(function(){return e})},_f.prototype.withConverter=function(t){return new _f(this.za,this.firestore,t)},_f);function _f(t,e,n){var r=this;if(((r=Lf.call(this,tu(t),e,n)||this).za=t).length%2!=1)throw new Ar(Tr.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.q()+" has "+t.length);return r}function Vf(t,e,n,r){this.Na=t,this.Wa=e,this.Qa=n,this.Oh=r,this.Ka=null,this.Ga=null,this.metadata=new vf(n.hasPendingWrites,n.fromCache)}function Cf(t,e,n){this.Ba=t,this.firestore=e,this.Oh=n}function xf(t,e,n){e=function(t,e){if(t instanceof e)return t;if(e.name===t.constructor.name)throw new Ar(Tr.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");t=jc(t);throw new Ar(Tr.INVALID_ARGUMENT,"Expected type '"+e.name+"', but it was: "+t)}(e,yf);if(e.firestore!==n)throw new Ar(Tr.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}function Uf(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var Mf,qf,l=(n(Ff,Mf=ul),Ff.serverTimestamp=function(){var t=new nl("serverTimestamp");return t.Rh="FieldValue.serverTimestamp",new Ff(t)},Ff.delete=function(){var t=new Qc("deleteField");return t.Rh="FieldValue.delete",new Ff(t)},Ff.arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new rl("arrayUnion",t)}.apply(void 0,t);return n.Rh="FieldValue.arrayUnion",new Ff(n)},Ff.arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new il("arrayRemove",t)}.apply(void 0,t);return n.Rh="FieldValue.arrayRemove",new Ff(n)},Ff.increment=function(t){t=new ol("increment",t);return t.Rh="FieldValue.increment",new Ff(t)},Ff.prototype.isEqual=function(t){return this.Fh.isEqual(t.Fh)},Ff),jf={Firestore:rf,GeoPoint:sl,Timestamp:ni,Blob:Hr,Transaction:pf,WriteBatch:df,DocumentReference:yf,DocumentSnapshot:gf,Query:kf,QueryDocumentSnapshot:mf,QuerySnapshot:Rf,CollectionReference:Df,FieldPath:Hc,FieldValue:l,setLogLevel:function(t){Nr.setLogLevel(t)},CACHE_SIZE_UNLIMITED:-1};function Ff(){return null!==Mf&&Mf.apply(this,arguments)||this}(qf=e.default).INTERNAL.registerComponent(new br("firestore",function(t){return e=t.getProvider("app").getImmediate(),t=t.getProvider("auth-internal"),new rf(e,t,new nf);var e},"PUBLIC").setServiceProps(Object.assign({},jf))),qf.registerVersion("@firebase/firestore","2.0.1")}).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
