!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],e):e((t=t||self).firebase)}(this,function(mp){"use strict";try{(function(){mp=mp&&Object.prototype.hasOwnProperty.call(mp,"default")?mp.default:mp;var t,l,e,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function f(t,s,u,a){return new(u=u||Promise)(function(n,e){function r(t){try{o(a.next(t))}catch(t){e(t)}}function i(t){try{o(a.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(r,i)}o((a=a.apply(t,s||[])).next())})}function y(n,r){var i,o,s,t,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,o=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]"})):"Error",a=this.serviceName+": "+u+" ("+o+").",h=new v(o,a),c=0,f=Object.keys(i);c>>0),C=0;function U(t,e,n){return t.call.apply(t.bind,arguments)}function M(e,n,t){if(!e)throw Error();if(2parseFloat(yt)){st=String(mt);break t}}st=yt}var gt,wt={};function bt(u){return t=u,e=function(){for(var t=0,e=J(String(st)).split("."),n=J(String(u)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i>>0);function Kt(e){return"function"==R(e)?e:(e[zt]||(e[zt]=function(t){return e.handleEvent(t)}),e[zt])}function Wt(){B.call(this),this.c=new Lt(this),(this.J=this).B=null}function Ht(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;oe.length?Pe:(e=e.substr(r,n),t.A=r+n,e))}function qe(t){t.R=q()+t.O,Ge(t,t.O)}function Ge(t,e){if(null!=t.i)throw Error("WatchDog timer not null");t.i=Ee(F(t.ab,t),e)}function Be(t){t.i&&(_.clearTimeout(t.i),t.i=null)}function ze(t){t.g.Ca()||t.m||t.g.na(t)}function Ke(t){Be(t);var e=t.B;e&&"function"==typeof e.la&&e.la(),t.B=null,se(t.P),pe(t.I),t.a&&(e=t.a,t.a=null,e.abort(),e.la())}function We(t,e){try{t.g.Fa(t,e),me(4)}catch(t){}}function He(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(O(t)||S(t))K(t,e,void 0);else{if(t.K&&"function"==typeof t.K)var n=t.K();else if(t.C&&"function"==typeof t.C)n=void 0;else if(O(t)||S(t)){n=[];for(var r=t.length,i=0;i2*t.c&&Je(t))}function Je(t){if(t.c!=t.a.length){for(var e=0,n=0;e>4&15).toString(16)+(15&t).toString(16)}$e.prototype.toString=function(){var t=[],e=this.f;e&&t.push(cn(e,ln,!0),":");var n=this.b;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(cn(e,ln,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.i)&&t.push(":",String(n))),(n=this.a)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(cn(n,"/"==n.charAt(0)?dn:pn,!0))),(n=this.c.toString())&&t.push("?",n),(n=this.g)&&t.push("#",cn(n,vn)),t.join("")},$e.prototype.resolve=function(t){var e=tn(this),n=!!t.f;n?en(e,t.f):n=!!t.j,n?e.j=t.j:n=!!t.b,n?nn(e,t.b):n=null!=t.i;var r=t.a;if(n)rn(e,t.i);else if(n=!!t.a){if("/"!=r.charAt(0))if(this.b&&!this.a)r="/"+r;else{var i=e.a.lastIndexOf("/");-1!=i&&(r=e.a.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(Q(i,"./")||Q(i,"/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],s=0;s=t.f}function Vn(t){return t.b?1:t.a?t.a.a.c:0}function Pn(t,e){return t=t.b?t.b==e:!!t.a&&(e=Dn(e),Qe(t.a.a.b,e))}function Cn(t,e){t.a?t.a.add(e):t.b=e}function Un(t,e){var n;t.b&&t.b==e?t.b=null:((n=t.a)&&(n=Dn(e),n=Qe(t.a.a.b,n)),n&&Xe(t.a.a,Dn(e)))}function Mn(t){if(null!=t.b)return t.c.concat(t.b.j);if(null==t.a||0==t.a.a.c)return H(t.c);var e=t.c;return K(t.a.C(),function(t){e=e.concat(t.j)}),e}function Fn(){}function jn(){this.a=new Fn}function qn(t,r,e){var i=e||"";try{He(t,function(t,e){var n=t;V(t)&&(n=Yt(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}function Gn(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}xn.prototype.cancel=function(){var t;this.c=Mn(this),this.b?(this.b.cancel(),this.b=null):this.a&&0!=this.a.a.c&&(K(this.a.C(),function(t){t.cancel()}),(t=this.a.a).b={},t.a.length=0,t.c=0)},Fn.prototype.stringify=function(t){return _.JSON.stringify(t,void 0)},Fn.prototype.parse=function(t){return _.JSON.parse(t,void 0)};var Bn=_.JSON.parse;function zn(t){Wt.call(this),this.headers=new Ye,this.H=t||null,this.b=!1,this.s=this.a=null,this.A="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.I=Kn,this.D=this.F=!1}G(zn,Wt);var Kn="",Wn=/^https?$/i,Hn=["POST","PUT"];function Yn(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,Jn(t),Zn(t)}function Jn(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function Qn(t){if(t.b&&void 0!==A&&(!t.s[1]||4!=tr(t)||2!=t.T()))if(t.l&&4==tr(t))ue(t.Ea,0,t);else if(t.dispatchEvent("readystatechange"),4==tr(t)){t.b=!1;try{var e,n=t.T();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.A).match(Ze)[1]||null;if(!o&&_.self&&_.self.location){var s=_.self.location.protocol;o=s.substr(0,s.length-1)}i=!Wn.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var u=2=t.b.f-(t.h?1:0))){if(t.h)return t.f=e.j.concat(t.f),1;if(!(1==t.u||2==t.u||t.A>=(t.Oa?0:t.Pa)))return t.h=Ee(F(t.Ha,t,e),yr(t,t.A)),t.A++,1}}(this,t)||2==n&&lr(this)))switch(e&&0e.length?1:0},ni),ti=(n(ei,Zr=$r),ei.prototype.$=function(t,e,n){return new ei(t,e,n)},ei.prototype.K=function(){return this.j().join("/")},ei.prototype.toString=function(){return this.K()},ei.G=function(t){if(0<=t.indexOf("//"))throw new Mr(Ur.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new ei(t.split("/").filter(function(t){return 0t.length&&mu("offset "+e+" out of range "+t.length),void 0===n?n=t.length-e:n>t.length-e&&mu("length "+n+" out of range "+(t.length-e)),this.segments=t,this.offset=e,this.N=n}ti.H=new ti([]);var ri,ii=/^[_a-zA-Z][_a-zA-Z0-9]*$/,oi=(n(si,ri=$r),si.prototype.$=function(t,e,n){return new si(t,e,n)},si.J=function(t){return ii.test(t)},si.prototype.K=function(){return this.j().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),si.J(t)||(t="`"+t+"`"),t}).join(".")},si.prototype.toString=function(){return this.K()},si.prototype.Y=function(){return 1===this.length&&"__name__"===this.get(0)},si.X=function(){return new si(["__name__"])},si.Z=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new Mr(Ur.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");e.push(n),n=""},o=!1;r=Number.MIN_SAFE_INTEGER}function Di(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function ki(t){var e=Ui(t.mapValue.fields.__local_write_time__.timestampValue);return new Br(e.seconds,e.nanos)}Ii.xt=new Ii("");var xi=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Ri(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?Di(t)?4:10:mu("Invalid value type: "+JSON.stringify(t))}function Li(i,t){var e,n,r,o=Ri(i);if(o!==Ri(t))return!1;switch(o){case 0:return!0;case 1:return i.booleanValue===t.booleanValue;case 4:return ki(i).isEqual(ki(t));case 3:return function(t){if("string"==typeof i.timestampValue&&"string"==typeof t.timestampValue&&i.timestampValue.length===t.timestampValue.length)return i.timestampValue===t.timestampValue;var e=Ui(i.timestampValue),n=Ui(t.timestampValue);return e.seconds===n.seconds&&e.nanos===n.nanos}(t);case 5:return i.stringValue===t.stringValue;case 6:return r=t,Fi(i.bytesValue).isEqual(Fi(r.bytesValue));case 7:return i.referenceValue===t.referenceValue;case 8:return n=t,Mi((e=i).geoPointValue.latitude)===Mi(n.geoPointValue.latitude)&&Mi(e.geoPointValue.longitude)===Mi(n.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Mi(t.integerValue)===Mi(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=Mi(t.doubleValue),r=Mi(e.doubleValue);return n===r?_i(n)===_i(r):isNaN(n)&&isNaN(r)}return!1}(i,t);case 9:return Tu(i.arrayValue.values||[],t.arrayValue.values||[],Li);case 10:return function(t){var e=i.mapValue.fields||{},n=t.mapValue.fields||{};if(bi(e)!==bi(n))return!1;for(var r in e)if(e.hasOwnProperty(r)&&(void 0===n[r]||!Li(e[r],n[r])))return!1;return!0}(t);default:return mu("Unexpected value type: "+JSON.stringify(i))}}function Oi(t,e){return void 0!==(t.values||[]).find(function(t){return Li(t,e)})}function Vi(t,e){var n,r,i,o,s,u,a,h,c,f,l=Ri(t),p=Ri(e);if(l!==p)return Eu(l,p);switch(l){case 0:return 0;case 1:return Eu(t.booleanValue,e.booleanValue);case 2:return h=e,c=Mi(t.integerValue||t.doubleValue),f=Mi(h.integerValue||h.doubleValue),c=":return Fo.GREATER_THAN_OR_EQUAL;case">":return Fo.GREATER_THAN;case"array-contains":return Fo.ARRAY_CONTAINS;case"in":return Fo.IN;case"array-contains-any":return Fo.ARRAY_CONTAINS_ANY;default:return mu("Unknown FieldFilter operator: "+t)}},Fo.prototype.toString=function(){return this.name},Fo.prototype.isEqual=function(t){return this.name===t.name},Fo);function Fo(t){this.name=t}function jo(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.Ve=n,this.filters=r,this.limit=i,this.ge=o,this.startAt=s,this.endAt=u,this.pe=null,this.ye=null,this.startAt&&this.be(this.startAt),this.endAt&&this.be(this.endAt)}function qo(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.Ae=null}function Go(){return null!==Do&&Do.apply(this,arguments)||this}function Bo(t,e,n){var r=this;return(r=ko.call(this,t,e)||this).hasCommittedMutations=!(!n||!n.hasCommittedMutations),r}function zo(t,e,n,r){var i=this;return(i=xo.call(this,t,e)||this).we=n,i.te=!!r.te,i.hasCommittedMutations=!!r.hasCommittedMutations,i}function Ko(t,e){this.key=t,this.version=e}function Wo(t){this.de=t,this.fe=new Map}Mo.LESS_THAN=new Mo("<"),Mo.LESS_THAN_OR_EQUAL=new Mo("<="),Mo.EQUAL=new Mo("=="),Mo.GREATER_THAN=new Mo(">"),Mo.GREATER_THAN_OR_EQUAL=new Mo(">="),Mo.ARRAY_CONTAINS=new Mo("array-contains"),Mo.IN=new Mo("in"),Mo.ARRAY_CONTAINS_ANY=new Mo("array-contains-any");var Ho,Yo,Xo,Jo,Qo,Zo,$o=(n(ls,Zo=function(){}),ls.create=function(t,e,n){if(t.Y())return e===Mo.IN?new es(t,n):new ts(t,e,n);if(Bi(n)){if(e!==Mo.EQUAL)throw new Mr(Ur.INVALID_ARGUMENT,"Invalid query. Null supports only equality comparisons.");return new ls(t,e,n)}if(zi(n)){if(e!==Mo.EQUAL)throw new Mr(Ur.INVALID_ARGUMENT,"Invalid query. NaN supports only equality comparisons.");return new ls(t,e,n)}return e===Mo.ARRAY_CONTAINS?new ns(t,n):e===Mo.IN?new rs(t,n):e===Mo.ARRAY_CONTAINS_ANY?new is(t,n):new ls(t,e,n)},ls.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&Ri(this.value)===Ri(e)&&this.Ye(Vi(e,this.value))},ls.prototype.Ye=function(t){switch(this.op){case Mo.LESS_THAN:return t<0;case Mo.LESS_THAN_OR_EQUAL:return t<=0;case Mo.EQUAL:return 0===t;case Mo.GREATER_THAN:return 0c.Do.wo?(du("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+c.Do.wo+" from "+t),c.Do.wo):t,s=Date.now(),c.Lo(e,i)}).next(function(t){return r=t,u=Date.now(),c.xo(e,r,n)}).next(function(t){return o=t,a=Date.now(),c.Bo(e,r)}).next(function(t){return h=Date.now(),lu()<=l.DEBUG&&du("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-f)+"ms\n\tDetermined least recently used "+i+" in "+(u-s)+"ms\n\tRemoved "+o+" targets in "+(a-u)+"ms\n\tRemoved "+t+" documents in "+(h-a)+"ms\nTotal Duration: "+(h-f)+"ms"),Ru.resolve({lo:!0,do:i,fo:o,To:t})})},fa),ha=(ca.prototype.start=function(){return this.rh()},ca.prototype.oh=function(i){return f(this,void 0,void 0,function(){var e,g,n,r=this;return y(this,function(t){switch(t.label){case 0:return e=this.ar,g=this.sh,[4,this.persistence.runTransaction("Handle user change","readonly",function(v){var m;return r.ar.hh(v).next(function(t){return m=t,e=r.persistence.Yo(i),g=new Pu(r.Xo,e,r.persistence.nh()),e.hh(v)}).next(function(t){for(var e=[],n=[],r=Vs(),i=0,o=m;i=this.Mh||0r)throw new Mr(Ur.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+Ra(e.length,"argument")+".")}function ga(t,e,n,r){Ia(t,e,xa(n)+" argument",r)}function wa(t,e,n,r){void 0!==r&&ga(t,e,n,r)}function ba(t,e,n,r){Ia(t,e,n+" option",r)}function Ea(t,e,n,r){void 0!==r&&ba(t,e,n,r)}function Ta(t,e,n,r,a){void 0!==r&&function(t,e,n){for(var r=[],i=0,o=a;i() instead."),nh=(Object.defineProperty(ah.prototype,"latitude",{get:function(){return this._a},enumerable:!0,configurable:!0}),Object.defineProperty(ah.prototype,"longitude",{get:function(){return this.la},enumerable:!0,configurable:!0}),ah.prototype.isEqual=function(t){return this._a===t._a&&this.la===t.la},ah.prototype.p=function(t){return Eu(this._a,t._a)||Eu(this.la,t.la)},ah),rh=/^__.*__$/,ih=(uh.prototype.da=function(t,e){var n=[];return null!==this.se?n.push(new vo(t,this.data,this.se,e)):n.push(new yo(t,this.data,e)),0this.Oa&&(this.xa=this.Oa)},jh.prototype.cancel=function(){null!==this.Ba&&(this.Ba.cancel(),this.Ba=null)},jh.prototype.Wa=function(){return(Math.random()-.5)*this.xa},jh),_h=(Fh.prototype.Ya=function(){return 1===this.state||2===this.state||4===this.state},Fh.prototype.Xa=function(){return 2===this.state},Fh.prototype.start=function(){3!==this.state?this.auth():this.Za()},Fh.prototype.stop=function(){return f(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.Ya()?[4,this.close(0)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},Fh.prototype.tu=function(){this.state=0,this.Ja.reset()},Fh.prototype.eu=function(){var t=this;this.Xa()&&null===this.Ha&&(this.Ha=this.$a.eo(this.ja,6e4,function(){return t.su()}))},Fh.prototype.nu=function(t){this.iu(),this.stream.send(t)},Fh.prototype.su=function(){return f(this,void 0,void 0,function(){return y(this,function(t){return this.Xa()?[2,this.close(0)]:[2]})})},Fh.prototype.iu=function(){this.Ha&&(this.Ha.cancel(),this.Ha=null)},Fh.prototype.close=function(e,n){return f(this,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.iu(),this.Ja.cancel(),this.za++,3!==e?this.Ja.reset():n&&n.code===Ur.RESOURCE_EXHAUSTED?(yu(n.toString()),yu("Using maximum backoff delay to prevent overloading the backend."),this.Ja.qa()):n&&n.code===Ur.UNAUTHENTICATED&&this.Ga._(),null!==this.stream&&(this.ru(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.ou(n)];case 1:return t.sent(),[2]}})})},Fh.prototype.ru=function(){},Fh.prototype.auth=function(){var n=this;this.state=1;var t=this.hu(this.za),e=this.za;this.Ga.getToken().then(function(t){n.za===e&&n.au(t)},function(e){t(function(){var t=new Mr(Ur.UNKNOWN,"Fetching auth token failed: "+e.message);return n.uu(t)})})},Fh.prototype.au=function(t){var e=this,n=this.hu(this.za);this.stream=this.cu(t),this.stream._u(function(){n(function(){return e.state=2,e.listener._u()})}),this.stream.ou(function(t){n(function(){return e.uu(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},Fh.prototype.Za=function(){var t=this;this.state=4,this.Ja.Qa(function(){return f(t,void 0,void 0,function(){return y(this,function(t){return this.state=0,this.start(),[2]})})})},Fh.prototype.uu=function(t){return du("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},Fh.prototype.hu=function(e){var n=this;return function(t){n.$a.qr(function(){return n.za===e?t():(du("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},Fh),Sh=(n(Mh,Nh=_h),Mh.prototype.cu=function(t){return this.Ka.lu("Listen",t)},Mh.prototype.onMessage=function(t){this.Ja.reset();var e=this.serializer.kn(t),n=this.serializer.Fn(t);return this.listener.du(e,n)},Mh.prototype.fu=function(t){var e={};e.database=this.serializer.pn,e.addTarget=this.serializer.xe(t);var n=this.serializer.ei(t);n&&(e.labels=n),this.nu(e)},Mh.prototype.Tu=function(t){var e={};e.database=this.serializer.pn,e.removeTarget=t,this.nu(e)},Mh),Dh=(n(Uh,Ih=_h),Object.defineProperty(Uh.prototype,"Eu",{get:function(){return this.mu},enumerable:!0,configurable:!0}),Uh.prototype.start=function(){this.mu=!1,Ih.prototype.start.call(this)},Uh.prototype.ru=function(){this.mu&&this.wu([])},Uh.prototype.cu=function(t){return this.Ka.lu("Write",t)},Uh.prototype.onMessage=function(t){if(gu(!!t.streamToken,"Got a write response without a stream token"),this.lastStreamToken=this.serializer.En(t.streamToken),this.mu){this.Ja.reset();var e=this.serializer.Wn(t.writeResults,t.commitTime),n=this.serializer.fromVersion(t.commitTime);return this.listener.Iu(n,e)}return gu(!t.writeResults||0===t.writeResults.length,"Got mutation results for handshake"),this.mu=!0,this.listener.Ru()},Uh.prototype.Au=function(){var t={};t.database=this.serializer.pn,this.nu(t)},Uh.prototype.wu=function(t){var e=this,n={streamToken:this.serializer.mn(this.lastStreamToken),writes:t.map(function(t){return e.serializer.$n(t)})};this.nu(n)},Uh),kh=(Ch.prototype.Pu=function(t){return new Dh(this.$a,this.Ka,this.credentials,this.serializer,t)},Ch.prototype.Vu=function(t){return new Sh(this.$a,this.Ka,this.credentials,this.serializer,t)},Ch.prototype.commit=function(t){var e=this,n={database:this.serializer.pn,writes:t.map(function(t){return e.serializer.$n(t)})};return this.gu("Commit",n).then(function(t){return e.serializer.Wn(t.writeResults,t.commitTime)})},Ch.prototype.pu=function(e){var i=this,t={database:this.serializer.pn,documents:e.map(function(t){return i.serializer.An(t)})};return this.yu("BatchGetDocuments",t).then(function(t){var n=Ss();t.forEach(function(t){var e=i.serializer.Cn(t);n=n.it(e.key,e)});var r=[];return e.forEach(function(t){var e=n.get(t);gu(!!e,"Missing entity in write response for "+t),r.push(e)}),r})},Ch.prototype.gu=function(e,n){var r=this;return this.credentials.getToken().then(function(t){return r.Ka.gu(e,n,t)}).catch(function(t){throw t.code===Ur.UNAUTHENTICATED&&r.credentials._(),t})},Ch.prototype.yu=function(e,n){var r=this;return this.credentials.getToken().then(function(t){return r.Ka.yu(e,n,t)}).catch(function(t){throw t.code===Ur.UNAUTHENTICATED&&r.credentials._(),t})},Ch),xh=(Ph.prototype.pu=function(r){return f(this,void 0,void 0,function(){var e,n=this;return y(this,function(t){switch(t.label){case 0:if(this.ku(),0this.query.limit;){var n=this.query.je()?f.last():f.first();f=f.delete(n.key),c=c.delete(n.key),a.track({type:1,doc:n})}return{D_:f,N_:a,M_:l,_s:c}},dc.prototype.F_=function(t,e){return t.te&&e.hasCommittedMutations&&!e.te},dc.prototype.nr=function(t,e,n){var o=this,r=this.D_;this.D_=t.D_,this._s=t._s;var i=t.N_.us();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.query.Be(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 mu("Unknown ChangeType: "+t)}}var r,i}),this.L_(n);var s=e?this.O_():[],u=0===this.S_.size&&this.As?1:0,a=u!==this.v_;return this.v_=u,0!==i.length||a?{snapshot:new Gs(this.query,t.D_,r,i,t._s,0==u,a,!1),x_:s}:{x_:s}},dc.prototype.B_=function(t){return this.As&&"Offline"===t?(this.As=!1,this.nr({D_:this.D_,N_:new qs,_s:this._s,M_:!1},!1)):{x_:[]}},dc.prototype.U_=function(t){return!this.b_.has(t)&&!!this.D_.has(t)&&!this.D_.get(t).te},dc.prototype.L_=function(t){var e=this;t&&(t.Ps.forEach(function(t){return e.b_=e.b_.add(t)}),t.Vs.forEach(function(t){}),t.gs.forEach(function(t){return e.b_=e.b_.delete(t)}),this.As=t.As)},dc.prototype.O_=function(){var e=this;if(!this.As)return[];var n=this.S_;this.S_=Vs(),this.D_.forEach(function(t){e.U_(t.key)&&(e.S_=e.S_.add(t.key))});var r=[];return n.forEach(function(t){e.S_.has(t)||r.push(new Kh(t))}),this.S_.forEach(function(t){n.has(t)||r.push(new zh(t))}),r},dc.prototype.q_=function(t){this.b_=t.zh,this.S_=Vs();var e=this.k_(t.documents);return this.nr(e,!0)},dc.prototype.Q_=function(){return Gs.fs(this.query,this.D_,this._s,0===this.v_)},dc),ic=(pc.prototype.K_=function(){this.G_()},pc.prototype.G_=function(){var t=this;this.Ja.Qa(function(){return f(t,void 0,void 0,function(){var e,n,r=this;return y(this,function(t){return e=this.W_.Sc(),(n=this.z_(e))&&n.then(function(t){r.Nr.qr(function(){return e.commit().then(function(){r.Lr.resolve(t)}).catch(function(t){r.H_(t)})})}).catch(function(t){r.H_(t)}),[2]})})})},pc.prototype.z_=function(t){try{var e=this.updateFunction(t);return!Ai(e)&&e.catch&&e.then?e:(this.Lr.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.Lr.reject(t),null}},pc.prototype.H_=function(t){var e=this;0",t),this.store.put(t)))},Rc.prototype.add=function(t){return du("SimpleDb","ADD",this.store.name,t,t),Pc(this.store.add(t))},Rc.prototype.get=function(e){var n=this;return Pc(this.store.get(e)).next(function(t){return void 0===t&&(t=null),du("SimpleDb","GET",n.store.name,e,t),t})},Rc.prototype.delete=function(t){return du("SimpleDb","DELETE",this.store.name,t),Pc(this.store.delete(t))},Rc.prototype.count=function(){return du("SimpleDb","COUNT",this.store.name),Pc(this.store.count())},Rc.prototype.ld=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.dd(n,function(t,e){r.push(e)}).next(function(){return r})},Rc.prototype.fd=function(t,e){du("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.Td=!1;var r=this.cursor(n);return this.dd(r,function(t,e,n){return n.delete()})},Rc.prototype.md=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.dd(r,e)},Rc.prototype.Ed=function(i){var t=this.cursor({});return new Ru(function(n,r){t.onerror=function(t){var e=Uc(t.target.error);r(e)},t.onsuccess=function(t){var e=t.target.result;e?i(e.primaryKey,e.value).next(function(t){t?e.continue():n()}):n()}})},Rc.prototype.dd=function(t,s){var u=[];return new Ru(function(o,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e=t.target.result;if(e){var n=new Dc(e),r=s(e.primaryKey,e.value,n);if(r instanceof Ru){var i=r.catch(function(t){return n.done(),Ru.reject(t)});u.push(i)}n.Bi?o():null===n.ad?e.continue():e.continue(n.ad)}else o()}}).next(function(){return Ru.Ki(u)})},Rc.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},Rc.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.Td?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},Rc);function Rc(t){this.store=t}function Lc(t){var n=this;this.transaction=t,this.aborted=!1,this._d=new Ju,this.transaction.oncomplete=function(){n._d.resolve()},this.transaction.onabort=function(){t.error?n._d.reject(t.error):n._d.resolve()},this.transaction.onerror=function(t){var e=Uc(t.target.error);n._d.reject(e)}}function Oc(t){this.rd=t,this.od=!1,this.hd=null}function Vc(t){this.db=t,12.2===Vc.Jl(p())&&yu("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}function Pc(t){return new Ru(function(n,r){t.onsuccess=function(t){var e=t.target.result;n(e)},t.onerror=function(t){var e=Uc(t.target.error);r(e)}})}var Cc=!1;function Uc(t){var e=Sc.Jl(p());if(12.2<=e&&e<13){var n="An internal error was encountered in the Indexed Database server";if(0<=t.message.indexOf(n)){var r=new Mr("internal","IOS_INDEXEDDB_BUG1: IndexedDb has thrown '"+n+"'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");return Cc||(Cc=!0,setTimeout(function(){throw r},0)),r}}return t}var Mc=(Fc.Id=function(t,e,n,r){return gu(""!==t.uid,"UserID must not be an empty string."),new Fc(t.t()?t.uid:"",e,n,r)},Fc.prototype.Rd=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return Gc(t).md({index:vf.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},Fc.prototype.mh=function(e,t,n){return this.Ad(e).next(function(t){return t.lastStreamToken=n.toBase64(),zc(e).put(t)})},Fc.prototype.ph=function(t){return this.Ad(t).next(function(t){return Ii.fromBase64String(t.lastStreamToken)})},Fc.prototype.yh=function(e,n){return this.Ad(e).next(function(t){return t.lastStreamToken=n.toBase64(),zc(e).put(t)})},Fc.prototype.dh=function(h,c,f,l){var p=this,d=Bc(h),y=Gc(h);return y.add({}).next(function(t){gu("number"==typeof t,"Auto-generated key is not a number");for(var e=new Su(t,c,f,l),n=p.serializer.Pd(p.userId,e),r=[],i=new vi(function(t,e){return Eu(t.K(),e.K())}),o=0,s=l;o=i,"Should have found mutation after "+i),o=r.serializer.gd(e)),n.done()}).next(function(){return o})},Fc.prototype.gh=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return Gc(t).md({index:vf.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},Fc.prototype.hh=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return Gc(t).ld(vf.userMutationsIndex,n).next(function(t){return t.map(function(t){return e.serializer.gd(t)})})},Fc.prototype._r=function(u,a){var h=this,t=mf.prefixForPath(this.userId,a.path),e=IDBKeyRange.lowerBound(t),c=[];return Bc(u).md({range:e},function(e,t,n){var r=e[0],i=e[1],o=e[2],s=_c(i);if(r===h.userId&&a.path.isEqual(s))return Gc(u).get(o).next(function(t){if(!t)throw mu("Dangling document-mutation reference found: "+e+" which points to "+o);gu(t.userId===h.userId,"Unexpected user '"+t.userId+"' for mutation batch "+o),c.push(h.serializer.gd(t))});n.done()}).next(function(){return c})},Fc.prototype.Er=function(r,t){var a=this,h=new vi(Eu),i=[];return t.forEach(function(u){var t=mf.prefixForPath(a.userId,u.path),e=IDBKeyRange.lowerBound(t),n=Bc(r).md({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=_c(i);r===a.userId&&u.path.isEqual(s)?h=h.add(o):n.done()});i.push(n)}),Ru.Ki(i).next(function(){return a.pd(r,h)})},Fc.prototype.Vr=function(t,e){var u=this,a=e.path,h=a.length+1,n=mf.prefixForPath(this.userId,a),r=IDBKeyRange.lowerBound(n),c=new vi(Eu);return Bc(t).md({range:r},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=_c(i);r===u.userId&&a.q(s)?s.length===h&&(c=c.add(o)):n.done()}).next(function(){return u.pd(t,c)})},Fc.prototype.pd=function(t,e){var n=this,r=[],i=[];return e.forEach(function(e){i.push(Gc(t).get(e).next(function(t){if(null===t)throw mu("Dangling document-mutation reference found, which points to "+e);gu(t.userId===n.userId,"Unexpected user '"+t.userId+"' for mutation batch "+e),r.push(n.serializer.gd(t))}))}),Ru.Ki(i).next(function(){return r})},Fc.prototype.Vh=function(e,n){var r=this;return qc(e.yd,this.userId,n).next(function(t){return e.rr(function(){r.Xh(n.batchId)}),Ru.forEach(t,function(t){return r.Jo.bd(e,t)})})},Fc.prototype.Xh=function(t){delete this.wd[t]},Fc.prototype.Rh=function(n){var o=this;return this.Rd(n).next(function(t){if(!t)return Ru.resolve();var e=IDBKeyRange.lowerBound(mf.prefixForUser(o.userId)),i=[];return Bc(n).md({range:e},function(t,e,n){if(t[0]===o.userId){var r=_c(t[1]);i.push(r)}else n.done()}).next(function(){gu(0===i.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+i.map(function(t){return t.K()}))})})},Fc.prototype.Mi=function(t,e){return jc(t,this.userId,e)},Fc.prototype.Ad=function(t){var e=this;return zc(t).get(this.userId).next(function(t){return t||new yf(e.userId,-1,"")})},Fc);function Fc(t,e,n,r){this.userId=t,this.serializer=e,this.ur=n,this.Jo=r,this.wd={}}function jc(t,o,e){var n=mf.prefixForPath(o,e.path),s=n[1],r=IDBKeyRange.lowerBound(n),u=!1;return Bc(t).md({range:r,Td:!0},function(t,e,n){var r=t[0],i=t[1];t[2],r===o&&i===s&&(u=!0),n.done()}).next(function(){return u})}function qc(t,e,n){var r=t.store(vf.store),i=t.store(mf.store),o=[],s=IDBKeyRange.only(n.batchId),u=0,a=r.md({range:s},function(t,e,n){return u++,n.delete()});o.push(a.next(function(){gu(1===u,"Dangling document-mutation reference found: Missing batch "+n.batchId)}));for(var h=[],c=0,f=n.mutations;ct.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.Sd(e,t)})},Wc.prototype.Wh=function(e,n){var r=this;return this.Cd(e,n).next(function(){return r.vd(e).next(function(t){return t.targetCount+=1,r.kd(n,t),r.Sd(e,t)})})},Wc.prototype.Nh=function(t,e){return this.Cd(t,e)},Wc.prototype.Nd=function(e,t){var n=this;return this.Fd(e,t.targetId).next(function(){return Hc(e).delete(t.targetId)}).next(function(){return n.vd(e)}).next(function(t){return gu(0e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},Wc.prototype.Ld=function(t){return this.vd(t).next(function(t){return t.targetCount})},Wc.prototype.qh=function(t,i){var o=this,e=i.canonicalId(),n=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),s=null;return Hc(t).md({range:n,index:If.queryTargetsIndexName},function(t,e,n){var r=o.serializer.$d(e);i.isEqual(r.target)&&(s=r,n.done())}).next(function(){return s})},Wc.prototype.Dh=function(n,t,r){var i=this,o=[],s=Jc(n);return t.forEach(function(t){var e=Ic(t.path);o.push(s.put(new Nf(r,e))),o.push(i.Jo.vi(n,t))}),Ru.Ki(o)},Wc.prototype.Sh=function(n,t,r){var i=this,o=Jc(n);return Ru.forEach(t,function(t){var e=Ic(t.path);return Ru.Ki([o.delete([r,e]),i.Jo.Di(n,t)])})},Wc.prototype.Fd=function(t,e){var n=Jc(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},Wc.prototype.Gh=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=Jc(t),o=Vs();return r.md({range:n,Td:!0},function(t,e,n){var r=_c(t[1]),i=new ui(r);o=o.add(i)}).next(function(){return o})},Wc.prototype.Mi=function(t,e){var n=Ic(e.path),r=IDBKeyRange.bound([n],[Iu(n)],!1,!0),i=0;return Jc(t).md({index:Nf.documentTargetsIndex,Td:!0,range:r},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0 "+n),1))},Mf.prototype.Rf=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.uf=function(){t.$a.qr(function(){return t.inForeground="visible"===t.document.visibilityState,t.If()})},this.document.addEventListener("visibilitychange",this.uf),this.inForeground="visible"===this.document.visibilityState)},Mf.prototype.Of=function(){this.uf&&(this.document.removeEventListener("visibilitychange",this.uf),this.uf=null)},Mf.prototype.Af=function(){var t=this;"function"==typeof this.window.addEventListener&&(this.af=function(){t.Lf(),t.$a.qr(function(){return t.lc()})},this.window.addEventListener("unload",this.af))},Mf.prototype.xf=function(){this.af&&(this.window.removeEventListener("unload",this.af),this.af=null)},Mf.prototype.Mf=function(t){try{var e=null!==this.Tf.getItem(this.$f(t));return du("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return yu("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},Mf.prototype.Lf=function(){try{this.Tf.setItem(this.$f(this.clientId),String(Date.now()))}catch(t){yu("Failed to set zombie client id.",t)}},Mf.prototype.Bf=function(){try{this.Tf.removeItem(this.$f(this.clientId))}catch(t){}},Mf.prototype.$f=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},Mf);function Mf(t,e,n,r,i,o,s,u){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.$a=o,this.rf=u,this.hf=!1,this.isPrimary=!1,this.networkEnabled=!0,this.af=null,this.inForeground=!1,this.uf=null,this.cf=null,this._f=Number.NEGATIVE_INFINITY,this.lf=function(t){return Promise.resolve()},this.Jo=new Bf(this,i),this.df=e+Mf.ff,this.serializer=new Vf(s),this.document=r.document,this.th=new Kc(this.Jo,this.serializer),this.ur=new xf,this.hr=new Zc(this.serializer,this.ur),!r.window||!r.window.localStorage)throw new Mr(Ur.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");this.window=r.window,this.Tf=this.window.localStorage}function Ff(t,e){var n=this;return(n=Of.call(this)||this).yd=t,n.Ch=e,n}function jf(t){this.sf=t}function qf(t){return t.store(ff.store)}function Gf(t){return t.store(Df.store)}Uf.ff="main";var Bf=(zf.prototype.Mo=function(t){var n=this.Wf(t);return this.db.eh().Ld(t).next(function(e){return n.next(function(t){return e+t})})},zf.prototype.Wf=function(t){var e=0;return this.Oo(t,function(t){e++}).next(function(){return e})},zf.prototype.Xs=function(t,e){return this.db.eh().Xs(t,e)},zf.prototype.Oo=function(t,n){return this.jf(t,function(t,e){return n(e)})},zf.prototype.Ho=function(t){this.Qf=t},zf.prototype.vi=function(t,e){return Kf(t,e)},zf.prototype.Di=function(t,e){return Kf(t,e)},zf.prototype.xo=function(t,e,n){return this.db.eh().xo(t,e,n)},zf.prototype.bd=function(t,e){return Kf(t,e)},zf.prototype.Kf=function(t,e){return this.Qf.Mi(e)?Ru.resolve(!0):(r=e,i=!1,zc(n=t).Ed(function(t){return jc(n,t,r).next(function(t){return t&&(i=!0),Ru.resolve(!t)})}).next(function(){return i}));var n,r,i},zf.prototype.Bo=function(r,i){var o=this,s=this.db.Zo().Eh(),u=[],a=0;return this.jf(r,function(e,t){if(t<=i){var n=o.Kf(r,e).next(function(t){if(!t)return a++,s.tr(r,e).next(function(){return s.Zi(e),Jc(r).delete([0,Ic(e.path)])})});u.push(n)}}).next(function(){return Ru.Ki(u)}).next(function(){return s.apply(r)}).next(function(){return a})},zf.prototype.removeTarget=function(t,e){var n=e.es(t.Ch);return this.db.eh().Nh(t,n)},zf.prototype.Fh=function(t,e){return Kf(t,e)},zf.prototype.jf=function(t,o){var s,e=Jc(t),u=Uu.kr;return e.md({index:Nf.documentTargetsIndex},function(t,e){var n=t[0],r=(t[1],e.path),i=e.sequenceNumber;0===n?(u!==Uu.kr&&o(new ui(_c(s)),u),u=i,s=r):u=Uu.kr}).next(function(){u!==Uu.kr&&o(new ui(_c(s)),u)})},zf.prototype.qo=function(t){return this.db.Zo().Jd(t)},zf);function zf(t,e){this.db=t,this.Qf=null,this.bo=new aa(this,e)}function Kf(t,e){return Jc(t).put((n=e,r=t.Ch,new Nf(0,Ic(n.path),r)));var n,r}var Wf,Hf=(Jf.prototype.Rd=function(t){return Ru.resolve(0===this.ar.length)},Jf.prototype.mh=function(t,e,n){var r=e.batchId,i=this.Hf(r,"acknowledged");return gu(0===i,"Can only acknowledge the first batch in the mutation queue"),this.ar[i],this.lastStreamToken=n,Ru.resolve()},Jf.prototype.ph=function(t){return Ru.resolve(this.lastStreamToken)},Jf.prototype.yh=function(t,e){return this.lastStreamToken=e,Ru.resolve()},Jf.prototype.dh=function(t,e,n,r){var i=this.Gf;this.Gf++,0i?this.ar[i]:null)},Jf.prototype.gh=function(){return Ru.resolve(0===this.ar.length?-1:this.Gf-1)},Jf.prototype.hh=function(t){return Ru.resolve(this.ar.slice())},Jf.prototype._r=function(t,e){var n=this,r=new xu(e,0),i=new xu(e,Number.POSITIVE_INFINITY),o=[];return this.zf.Ct([r,i],function(t){var e=n.Jf(t.Li);o.push(e)}),Ru.resolve(o)},Jf.prototype.Er=function(t,e){var r=this,i=new vi(Eu);return e.forEach(function(t){var e=new xu(t,0),n=new xu(t,Number.POSITIVE_INFINITY);r.zf.Ct([e,n],function(t){i=i.add(t.Li)})}),Ru.resolve(this.Xf(i))},Jf.prototype.Vr=function(t,e){var n=e.path,r=n.length+1,i=n;ui.st(i)||(i=i.child(""));var o=new xu(new ui(i),0),s=new vi(Eu);return this.zf.kt(function(t){var e=t.key.path;return!!n.q(e)&&(e.length===r&&(s=s.add(t.Li)),!0)},o),Ru.resolve(this.Xf(s))},Jf.prototype.Xf=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.Jf(t);null!==e&&r.push(e)}),r},Jf.prototype.Vh=function(n,r){var i=this;gu(0===this.Hf(r.batchId,"removed"),"Can only remove the first entry of the mutation queue"),this.ar.shift();var o=this.zf;return Ru.forEach(r.mutations,function(t){var e=new xu(t.key,r.batchId);return o=o.delete(e),i.Jo.bd(n,t.key)}).next(function(){i.zf=o})},Jf.prototype.Xh=function(t){},Jf.prototype.Mi=function(t,e){var n=new xu(e,0),r=this.zf.Nt(n);return Ru.resolve(e.isEqual(r&&r.key))},Jf.prototype.Rh=function(t){return this.ar.length,Ru.resolve()},Jf.prototype.Hf=function(t,e){return this.Yf(t)},Jf.prototype.Yf=function(t){return 0===this.ar.length?0:t-this.ar[0].batchId},Jf.prototype.Jf=function(t){var e=this.Yf(t);return e<0||e>=this.ar.length?null:this.ar[e]},Jf),Yf=(Xf.prototype.Yi=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.Zf(e);return this.docs=this.docs.it(r,{Ud:e,size:s,readTime:n}),this.size+=s-o,this.ur.Vd(t,r.path.L())},Xf.prototype.Zi=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},Xf.prototype.tr=function(t,e){var n=this.docs.get(e);return Ru.resolve(n?n.Ud:null)},Xf.prototype.getEntries=function(t,e){var n=this,r=Ds();return e.forEach(function(t){var e=n.docs.get(t);r=r.it(t,e?e.Ud:null)}),Ru.resolve(r)},Xf.prototype.wr=function(t,e,n){for(var r=xs(),i=new ui(e.path.child("")),o=this.docs.lt(i);o.It();){var s=o.wt(),u=s.key,a=s.value,h=a.Ud,c=a.readTime;if(!e.path.q(u.path))break;c.D(n)<=0||h instanceof Oo&&e.matches(h)&&(r=r.it(h.key,h))}return Ru.resolve(r)},Xf.prototype.tT=function(t,e){return Ru.forEach(this.docs,function(t){return e(t)})},Xf.prototype.ea=function(t,e){throw new Error("getNewDocumentChanges() is not supported with MemoryPersistence")},Xf.prototype.na=function(t){return Ru.resolve(zr.MIN)},Xf.prototype.Eh=function(t){return new Xf.Hd(this)},Xf.prototype.Jd=function(t){return Ru.resolve(this.size)},Xf);function Xf(t,e){this.ur=t,this.Zf=e,this.docs=new hi(ui.F),this.size=0}function Jf(t,e){this.ur=t,this.Jo=e,this.ar=[],this.Gf=1,this.lastStreamToken=Ii.xt,this.zf=new vi(xu.Ee)}function Qf(t){var e=this;return(e=Wf.call(this)||this).Yd=t,e}Yf.Hd=(n(Qf,Wf=Lu),Qf.prototype.nr=function(n){var r=this,i=[];return this.zi.forEach(function(t,e){e?i.push(r.Yd.Yi(n,e,r.readTime)):r.Yd.Zi(t)}),Ru.Ki(i)},Qf.prototype.er=function(t,e){return this.Yd.tr(t,e)},Qf.prototype.sr=function(t,e){return this.Yd.getEntries(t,e)},Qf);var Zf,$f,tl=(yl.prototype.Xs=function(t,n){return this.eT.forEach(function(t,e){return n(e)}),Ru.resolve()},yl.prototype.bh=function(t){return Ru.resolve(this.lastRemoteSnapshotVersion)},yl.prototype.Dd=function(t){return Ru.resolve(this.sT)},yl.prototype.Qh=function(t){return this.highestTargetId=this.iT.next(),Ru.resolve(this.highestTargetId)},yl.prototype.$h=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.sT&&(this.sT=e),Ru.resolve()},yl.prototype.Cd=function(t){this.eT.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.iT=new nc(e),this.highestTargetId=e),t.sequenceNumber>this.sT&&(this.sT=t.sequenceNumber)},yl.prototype.Wh=function(t,e){return this.Cd(e),this.targetCount+=1,Ru.resolve()},yl.prototype.Nh=function(t,e){return this.Cd(e),Ru.resolve()},yl.prototype.Nd=function(t,e){return this.eT.delete(e.target),this.nT.Ni(e.targetId),--this.targetCount,Ru.resolve()},yl.prototype.xo=function(n,r,i){var o=this,s=0,u=[];return this.eT.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.eT.delete(t),u.push(o.Fd(n,e.targetId)),s++)}),Ru.Ki(u).next(function(){return s})},yl.prototype.Ld=function(t){return Ru.resolve(this.targetCount)},yl.prototype.qh=function(t,e){var n=this.eT.get(e)||null;return Ru.resolve(n)},yl.prototype.un=function(t,e){return mu("Not yet implemented.")},yl.prototype.Dh=function(e,t,n){this.nT.Si(t,n);var r=this.persistence.Jo,i=[];return r&&t.forEach(function(t){i.push(r.vi(e,t))}),Ru.Ki(i)},yl.prototype.Sh=function(e,t,n){this.nT.ki(t,n);var r=this.persistence.Jo,i=[];return r&&t.forEach(function(t){i.push(r.Di(e,t))}),Ru.Ki(i)},yl.prototype.Fd=function(t,e){return this.nT.Ni(e),Ru.resolve()},yl.prototype.Gh=function(t,e){var n=this.nT.$i(e);return Ru.resolve(n)},yl.prototype.Mi=function(t,e){return Ru.resolve(this.nT.Mi(e))},yl),el=(dl.prototype.start=function(){return Promise.resolve()},dl.prototype.lc=function(){return this.hf=!1,Promise.resolve()},Object.defineProperty(dl.prototype,"ko",{get:function(){return this.hf},enumerable:!0,configurable:!0}),dl.prototype.Jh=function(){return f(this,void 0,void 0,function(){return y(this,function(t){return[2,[this.clientId]]})})},dl.prototype.gf=function(t){return t(!0)},dl.prototype.pf=function(){},dl.prototype.Zh=function(t){},dl.prototype.nh=function(){return this.ur},dl.prototype.Yo=function(t){var e=this.rT[t.s()];return e||(e=new Hf(this.ur,this.Jo),this.rT[t.s()]=e),e},dl.prototype.eh=function(){return this.th},dl.prototype.Zo=function(){return this.hr},dl.prototype.runTransaction=function(t,e,n){var r=this;du("MemoryPersistence","Starting transaction:",t);var i=new nl(this.Vf.next());return this.Jo.hT(),n(i).next(function(t){return r.Jo.aT(i).next(function(){return t})}).Wi().then(function(t){return i.or(),t})},dl.prototype.uT=function(e,n){return Ru.Gi(Object.values(this.rT).map(function(t){return function(){return t.Mi(e,n)}}))},dl),nl=(n(pl,$f=Vu),pl),rl=(ll._T=function(t){return new ll(t)},Object.defineProperty(ll.prototype,"lT",{get:function(){if(this.cT)return this.cT;throw mu("orphanedDocuments is only valid during a transaction.")},enumerable:!0,configurable:!0}),ll.prototype.Ho=function(t){this.Qf=t},ll.prototype.vi=function(t,e){return this.lT.delete(e),Ru.resolve()},ll.prototype.Di=function(t,e){return this.lT.add(e),Ru.resolve()},ll.prototype.bd=function(t,e){return this.lT.add(e),Ru.resolve()},ll.prototype.removeTarget=function(t,e){var n=this,r=this.persistence.eh();return r.Gh(t,e.targetId).next(function(t){t.forEach(function(t){return n.lT.add(t)})}).next(function(){return r.Nd(t,e)})},ll.prototype.hT=function(){this.cT=new Set},ll.prototype.aT=function(t){var n=this,r=this.persistence.Zo().Eh();return Ru.forEach(this.lT,function(e){return n.dT(t,e).next(function(t){t||r.Zi(e)})}).next(function(){return n.cT=null,r.apply(t)})},ll.prototype.Fh=function(t,e){var n=this;return this.dT(t,e).next(function(t){t?n.lT.delete(e):n.lT.add(e)})},ll.prototype.oT=function(t){return 0},ll.prototype.dT=function(t,e){var n=this;return Ru.Gi([function(){return n.persistence.eh().Mi(t,e)},function(){return n.persistence.uT(t,e)},function(){return Ru.resolve(n.Qf.Mi(e))}])},ll),il=(fl.prototype.initialize=function(e){return f(this,void 0,void 0,function(){var n=this;return y(this,function(t){switch(t.label){case 0:return this.X_=this.fT(e),this.persistence=this.TT(e),[4,this.persistence.start()];case 1:return t.sent(),this.mT=this.ET(e),this.Wu=this.wT(e),this.W_=this.IT(e),this.mc=this.RT(e),this.AT=this.PT(e),this.X_.$u=function(t){return n.mc.B_(t,1)},this.W_.mc=this.mc,this.X_.mc=this.mc,[4,this.X_.start()];case 2:return t.sent(),[4,this.W_.start()];case 3:return t.sent(),[4,this.Wu.start()];case 4:return t.sent(),[4,this.persistence.gf(function(e){return f(n,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return[4,this.mc.Cc(e)];case 1:return t.sent(),this.mT&&(e&&!this.mT.ko?this.mT.start(this.Wu):e||this.mT.stop()),[2]}})})})];case 5:return t.sent(),[2]}})})},fl.prototype.PT=function(t){return new sc(this.mc)},fl.prototype.ET=function(t){return null},fl.prototype.wT=function(t){return new ha(this.persistence,new ac,t.VT)},fl.prototype.TT=function(t){return new el(t.clientId,rl._T)},fl.prototype.IT=function(t){var e=this;return new Lh(this.Wu,t.bu,t.Nr,function(t){return e.mc.B_(t,0)},t.platform.gT())},fl.prototype.fT=function(t){return new ec},fl.prototype.RT=function(t){return new oc(this.Wu,this.W_,this.X_,t.VT,t.Z_)},fl.prototype.clearPersistence=function(t){throw new Mr(Ur.FAILED_PRECONDITION,"You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.")},fl),ol=(n(cl,Zf=il),cl.prototype.ET=function(t){var e=this.persistence.Jo.bo;return new ua(e,t.Nr)},cl.prototype.TT=function(t){var e=Uf.qf(t.pT),n=t.platform.yT(t.pT.cn);return Uf.mf({allowTabSynchronization:t.bT.synchronizeTabs,persistenceKey:e,clientId:t.clientId,platform:t.platform,$a:t.Nr,serializer:n,Ef:ia.Io(t.bT.cacheSizeBytes),rf:this.X_})},cl.prototype.fT=function(t){if(t.bT.synchronizeTabs){if(!tc.Uc(t.platform))throw new Mr(Ur.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var e=Uf.qf(t.pT);return new tc(t.Nr,t.platform,e,t.clientId,t.VT)}return new ec},cl.prototype.clearPersistence=function(t){var e=Uf.qf(t);return Uf.clearPersistence(e)},cl),sl=(hl.prototype.start=function(e,n){var r=this;this.vT();var i=new Ju,o=new Ju,s=!1;return this.credentials.l(function(t){if(!s)return s=!0,du("FirestoreClient","Initializing. user=",t.uid),r.ST(e,n,t,o).then(i.resolve,i.reject);r.Nr.qr(function(){return r.Dc(t)})}),this.Nr.qr(function(){return i.promise}),o.promise},hl.prototype.enableNetwork=function(){var t=this;return this.vT(),this.Nr.enqueue(function(){return t.mc.enableNetwork()})},hl.prototype.ST=function(s,u,a,h){return f(this,void 0,void 0,function(){var e,n,r,i,o=this;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.platform.DT(this.pT)];case 1:return e=t.sent(),n=this.platform.yT(this.pT.cn),r=new kh(this.Nr,e,this.credentials,n),[4,s.initialize({Nr:this.Nr,pT:this.pT,platform:this.platform,bu:r,clientId:this.clientId,VT:a,Z_:100,bT:u})];case 2:return t.sent(),this.persistence=s.persistence,this.X_=s.X_,this.Wu=s.Wu,this.W_=s.W_,this.mc=s.mc,this.mT=s.mT,this.CT=s.AT,this.persistence.pf(function(){return f(o,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})}),h.resolve(),[3,4];case 3:if(i=t.sent(),h.reject(i),!this.kT(i))throw i;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+i),this.ST(new il,{NT:!1},a,h))];case 4:return[2]}})})},hl.prototype.kT=function(t){return"FirebaseError"===t.name?t.code===Ur.FAILED_PRECONDITION||t.code===Ur.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},hl.prototype.vT=function(){if(this.Nr.Hr)throw new Mr(Ur.FAILED_PRECONDITION,"The client has already been terminated.")},hl.prototype.Dc=function(t){return this.Nr.no(),du("FirestoreClient","Credential Changed. Current user: "+t.uid),this.mc.Dc(t)},hl.prototype.disableNetwork=function(){var t=this;return this.vT(),this.Nr.enqueue(function(){return t.mc.disableNetwork()})},hl.prototype.terminate=function(){var t=this;return this.Nr.to(function(){return f(t,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.mT&&this.mT.stop(),[4,this.W_.lc()];case 1:return t.sent(),[4,this.X_.lc()];case 2:return t.sent(),[4,this.persistence.lc()];case 3:return t.sent(),this.credentials.T(),[2]}})})})},hl.prototype.waitForPendingWrites=function(){var t=this;this.vT();var e=new Ju;return this.Nr.qr(function(){return t.mc.Pl(e)}),e.promise},hl.prototype.listen=function(t,e,n){var r=this;this.vT();var i=new uc(t,e,n);return this.Nr.qr(function(){return r.CT.listen(i)}),i},hl.prototype.fc=function(t){var e=this;this.FT||this.Nr.qr(function(){return e.CT.fc(t)})},hl.prototype.$T=function(t){var e=this;return this.vT(),this.Nr.enqueue(function(){return e.Wu.Bh(t)}).then(function(t){if(t instanceof Oo)return t;if(t instanceof Vo)return null;throw new Mr(Ur.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.)")})},hl.prototype.MT=function(i){var t=this;return this.vT(),this.Nr.enqueue(function(){return f(t,void 0,void 0,function(){var e,n,r;return y(this,function(t){switch(t.label){case 0:return[4,this.Wu.Kh(i,!0)];case 1:return e=t.sent(),n=new rc(i,e.zh),r=n.k_(e.documents),[2,n.nr(r,!1).snapshot]}})})})},hl.prototype.write=function(t){var e=this;this.vT();var n=new Ju;return this.Nr.qr(function(){return e.mc.write(t,n)}),n.promise},hl.prototype.cn=function(){return this.pT.cn},hl.prototype.Ol=function(t){var e=this;this.vT(),this.Nr.qr(function(){return e.CT.Ol(t),Promise.resolve()})},hl.prototype.xl=function(t){this.FT||this.CT.xl(t)},Object.defineProperty(hl.prototype,"FT",{get:function(){return this.Nr.Hr},enumerable:!0,configurable:!0}),hl.prototype.transaction=function(t){var e=this;this.vT();var n=new Ju;return this.Nr.qr(function(){return e.mc.runTransaction(e.Nr,t,n),Promise.resolve()}),n.promise},hl),ul=(al.prototype.next=function(t){this.LT(this.observer.next,t)},al.prototype.error=function(t){this.LT(this.observer.error,t)},al.prototype.OT=function(){this.muted=!0},al.prototype.LT=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},al);function al(t){this.observer=t,this.muted=!1}function hl(t,e,n,r){this.platform=t,this.pT=e,this.credentials=n,this.Nr=r,this.clientId=wu.mi()}function cl(){return null!==Zf&&Zf.apply(this,arguments)||this}function fl(){}function ll(t){this.persistence=t,this.Qf=null,this.cT=null}function pl(t){var e=this;return(e=$f.call(this)||this).Ch=t,e}function dl(t,e){var n=this;this.clientId=t,this.rT={},this.Vf=new Uu(0),this.hf=!1,this.hf=!0,this.Jo=e(this),this.th=new tl(this),this.ur=new uf,this.hr=new Yf(this.ur,function(t){return n.Jo.oT(t)})}function yl(t){this.persistence=t,this.eT=new _u(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=zr.MIN,this.highestTargetId=0,this.sT=0,this.nT=new ku,this.targetCount=0,this.iT=nc.p_()}function vl(i){return function(){if("object"==typeof i&&null!==i)for(var t=i,e=0,n=["next","error","complete"];e=",">","array-contains","in","array-contains-any"],e);var i=bh("Query.where",t),o=Mo.G(e);if(i.Y()){if(o===Mo.ARRAY_CONTAINS||o===Mo.ARRAY_CONTAINS_ANY)throw new Mr(Ur.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o.toString()+"' queries on FieldPath.documentId().");if(o===Mo.IN){this.gm(n,o);for(var s=[],u=0,a=n;ur.length)throw new Mr(Ur.INVALID_ARGUMENT,"Too many arguments provided to "+t+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var i=[],o=0;o, or >=) must be on the same field. But you have inequality filters on '"+o.toString()+"' and '"+t.field.toString()+"'");var s=this.Vm.De();null!==s&&this.km(t.field,s)}else if(i||r){var u=null;if(i&&(u=this.Vm.ze(n)),null===u&&r&&(u=this.Vm.ze(e)),null!=u)throw u===t.op?new Mr(Ur.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+t.op.toString()+"' filter."):new Mr(Ur.INVALID_ARGUMENT,"Invalid query. You cannot use '"+t.op.toString()+"' filters with '"+u.toString()+"' filters.")}}},Vl.prototype.bm=function(t){if(null===this.Vm.De()){var e=this.Vm.Se();null!==e&&this.km(e,t.field)}},Vl.prototype.km=function(t,e){if(!e.isEqual(t))throw new Mr(Ur.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+t.toString()+"' and so you must also use '"+t.toString()+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+e.toString()+"' instead.")},Vl),xl=(Object.defineProperty(Ol.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),Object.defineProperty(Ol.prototype,"empty",{get:function(){return this.Fm.docs.U()},enumerable:!0,configurable:!0}),Object.defineProperty(Ol.prototype,"size",{get:function(){return this.Fm.docs.size},enumerable:!0,configurable:!0}),Ol.prototype.forEach=function(e,n){var r=this;ma("QuerySnapshot.forEach",arguments,1,2),ga("QuerySnapshot.forEach","function",1,e),this.Fm.docs.forEach(function(t){e.call(n,r.Lm(t))})},Object.defineProperty(Ol.prototype,"query",{get:function(){return new kl(this.Nm,this.lm,this.fm)},enumerable:!0,configurable:!0}),Ol.prototype.docChanges=function(t){t&&(Sa("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),Ea("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.Fm.ds)throw new Mr(Ur.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.$m&&this.Mm===e||(this.$m=function(i,e,o,s){if(o.cs.U()){var n=0;return o.docChanges.map(function(t){var e=new Dl(i,t.doc.key,t.doc,o.fromCache,o._s.has(t.doc.key),s);return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var u=o.cs;return o.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new Dl(i,t.doc.key,t.doc,o.fromCache,o._s.has(t.doc.key),s),n=-1,r=-1;return 0!==t.type&&(n=u.indexOf(t.doc.key),u=u.delete(t.doc.key)),1!==t.type&&(r=(u=u.add(t.doc)).indexOf(t.doc.key)),{type:function(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return mu("Unknown change type: "+t)}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.lm,e,this.Fm,this.fm),this.Mm=e),this.$m},Ol.prototype.isEqual=function(t){if(!(t instanceof Ol))throw Da("isEqual","QuerySnapshot",1,t);return this.lm===t.lm&&this.Nm.isEqual(t.Nm)&&this.Fm.isEqual(t.Fm)&&this.fm===t.fm},Ol.prototype.Lm=function(t){return new Dl(this.lm,t.key,t,this.metadata.fromCache,this.Fm._s.has(t.key),this.fm)},Ol),Rl=(n(Ll,ml=kl),Object.defineProperty(Ll.prototype,"id",{get:function(){return this.Vm.path.B()},enumerable:!0,configurable:!0}),Object.defineProperty(Ll.prototype,"parent",{get:function(){var t=this.Vm.path.L();return t.U()?null:new Al(new ui(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(Ll.prototype,"path",{get:function(){return this.Vm.path.K()},enumerable:!0,configurable:!0}),Ll.prototype.doc=function(t){if(ma("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=wu.mi()),ga("CollectionReference.doc","non-empty string",1,t),""===t)throw new Mr(Ur.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=ti.G(t);return Al.cm(this.Vm.path.child(e),this.firestore,this.fm)},Ll.prototype.add=function(t){ya("CollectionReference.add",arguments,1),ga("CollectionReference.add","object",1,this.fm?this.fm.toFirestore(t):t);var e=this.doc();return e.set(t).then(function(){return e})},Ll.prototype.withConverter=function(t){return new Ll(this.Om,this.firestore,t)},Ll);function Ll(t,e,n){var r=this;if(((r=ml.call(this,Uo.ve(t),e,n)||this).Om=t).length%2!=1)throw new Mr(Ur.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.K()+" has "+t.length);return r}function Ol(t,e,n,r){this.lm=t,this.Nm=e,this.Fm=n,this.fm=r,this.$m=null,this.Mm=null,this.metadata=new _l(n.hasPendingWrites,n.fromCache)}function Vl(t,e,n){this.Vm=t,this.firestore=e,this.fm=n}function Pl(){return null!==gl&&gl.apply(this,arguments)||this}function Cl(t,e,n,r,i,o){this.lm=t,this.um=e,this.Rm=n,this.Am=r,this.Pm=i,this.fm=o}function Ul(t,e){this.hasPendingWrites=t,this.fromCache=e}function Ml(t,e,n){this.um=t,this.firestore=e,this.fm=n,this.JT=this.firestore.HT()}function Fl(t){this.lm=t,this.Tm=[],this.mm=!1}function jl(t,e){this.lm=t,this.dm=e}function ql(t,e,n){var r=this;if(void 0===n&&(n=new il),this.GT=null,this.zT=new Zu,this.INTERNAL={delete:function(){return f(r,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.HT(),[4,this.JT.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var i=t;this.GT=i,this.KT=ql.YT(i),this.XT=i.name,this.ZT=new jr(e)}else{var o=t;if(!o.projectId)throw new Mr(Ur.INVALID_ARGUMENT,"Must provide projectId");this.KT=new Au(o.projectId,o.database),this.XT="[DEFAULT]",this.ZT=new Fr}this.tm=n,this.em=new El({}),this.sm=this.nm(this.KT)}function Gl(t){var e,n;if(void 0===t.host){if(void 0!==t.ssl)throw new Mr(Ur.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else ba("settings","non-empty string","host",t.host),this.host=t.host,Ea("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(Sa("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling"]),Ea("settings","object","credentials",t.credentials),this.credentials=t.credentials,Ea("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),!0===t.timestampsInSnapshots?yu("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&yu("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(n=t.timestampsInSnapshots)||void 0===n||n,Ea("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=ia.po;else{if(t.cacheSizeBytes!==bl&&t.cacheSizeBytes