!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(fp){"use strict";try{(function(){fp=fp&&Object.prototype.hasOwnProperty.call(fp,"default")?fp.default:fp;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 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,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 d(o,a),c=0,f=Object.keys(i);c=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,A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_=_||{},S=A||self;function k(){}function D(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function x(t){var e=D(t);return"array"==e||"object"==e&&"number"==typeof t.length}function O(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var R="closure_uid_"+(1e9*Math.random()>>>0),P=0;function L(t,e,n){return t.call.apply(t.bind,arguments)}function V(e,n,t){if(!e)throw Error();if(2parseFloat(lt)){rt=String(dt);break t}}rt=lt}var yt,vt={};function gt(u){return t=u,e=function(){for(var t=0,e=Y(String(rt)).split("."),n=Y(String(u)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i>>0);function Gt(e){return"function"==D(e)?e:(e[Bt]||(e[Bt]=function(t){return e.handleEvent(t)}),e[Bt])}function zt(){q.call(this),this.c=new xt(this),(this.J=this).A=null}function Wt(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;oe.length?Le:(e=e.substr(r,n),t.w=r+n,e))}function Me(t){t.P=j()+t.N,qe(t,t.N)}function qe(t,e){if(null!=t.h)throw Error("WatchDog timer not null");t.h=be(C(t.Qa,t),e)}function Fe(t){t.h&&(S.clearTimeout(t.h),t.h=null)}function Be(t){0==t.g.u||t.l||rr(t.g,t)}function Ge(t){Fe(t);var e=t.D;e&&"function"==typeof e.da&&e.da(),t.D=null,ie(t.O),fe(t.G),t.a&&(e=t.a,t.a=null,e.abort(),e.da())}function ze(t,e){try{var n=t.g;if(0!=n.u&&(n.a==t||Nn(n.b,t)))if(n.A=t.H,!t.o&&Nn(n.b,t)&&3==n.u){try{var r=n.ja.a.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.i){if(n.a){if(!(n.a.s+3e3>4&15).toString(16)+(15&t).toString(16)}$e.prototype.toString=function(){var t=[],e=this.f;e&&t.push(sn(e,an,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(sn(e,an,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(sn(n,"/"==n.charAt(0)?cn:hn,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",sn(n,ln)),t.join("")};var an=/[#\/\?@]/g,hn=/[#\?:]/g,cn=/[#\?]/g,fn=/[#\?@]/g,ln=/#/g;function pn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function dn(n){n.a||(n.a=new Ke,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n2*t.c&&Ye(t)))}function vn(t,e){return dn(t),e=mn(t,e),Qe(t.a.b,e)}function gn(t,e,n){yn(t,e),0=t.f}function In(t){return t.b?1:t.a?t.a.size:0}function Nn(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 _n(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function Sn(t){var e,n;if(null!=t.b)return t.c.concat(t.b.i);if(null==t.a||0===t.a.size)return z(t.c);var r=t.c;try{for(var i=I(t.a.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r.concat(s.i)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function kn(){}function Dn(){this.a=new kn}function xn(t,r,e){var i=e||"";try{We(t,function(t,e){var n=t;O(t)&&(n=Kt(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}function On(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}bn.prototype.cancel=function(){var e,t;if(this.c=Sn(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=I(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()}},kn.prototype.stringify=function(t){return S.JSON.stringify(t,void 0)},kn.prototype.parse=function(t){return S.JSON.parse(t,void 0)};var Rn=S.JSON.parse;function Pn(t){zt.call(this),this.headers=new Ke,this.G=t||null,this.b=!1,this.s=this.a=null,this.D="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.H=Ln,this.B=this.F=!1}M(Pn,zt);var Ln="",Vn=/^https?$/i,Cn=["POST","PUT"];function Un(t){return"content-type"==t.toLowerCase()}function jn(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,Mn(t),Fn(t)}function Mn(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function qn(t){if(t.b&&void 0!==_&&(!t.s[1]||4!=Gn(t)||2!=t.S()))if(t.l&&4==Gn(t))oe(t.va,0,t);else if(t.dispatchEvent("readystatechange"),4==Gn(t)){t.b=!1;try{var e,n=t.S();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.D).match(He)[1]||null;if(!o&&S.self&&S.self.location){var s=S.self.location.protocol;o=s.substr(0,s.length-1)}i=!Vn.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.g?1:0))){if(t.g)return t.f=e.i.concat(t.f),1;if(!(1==t.u||2==t.u||t.o>=(t.Ca?0:t.Da)))return t.g=be(C(t.xa,t,e),ir(t,t.o)),t.o++,1}}(t,e)||2==r&&er(t)))switch(n&&0e.length?1:0},jr),Cr=(n(Ur,Ar=Vr),Ur.prototype.$=function(t,e,n){return new Ur(t,e,n)},Ur.prototype.j=function(){return this.W().join("/")},Ur.prototype.toString=function(){return this.j()},Ur.K=function(t){if(0<=t.indexOf("//"))throw new kr(Sr.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new Ur(t.split("/").filter(function(t){return 0t.length&&Js(),void 0===n?n=t.length-e:n>t.length-e&&Js(),this.segments=t,this.offset=e,this.F=n}function Mr(t){this.timestamp=t}function qr(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new kr(Sr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new kr(Sr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new kr(Sr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new kr(Sr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function Fr(t,e){this.P=t,this.V=e}function Br(t,e){this.P=t,this.V=e,this.type="FirstParty",this.user=Tr.h}function Gr(t){var e=this;this.I=null,this.currentUser=Tr.UNAUTHENTICATED,this.R=!1,this.A=0,this.u=null,this.forceRefresh=!1,this.I=function(){e.A++,e.currentUser=e.m(),e.R=!0,e.u&&e.u(e.currentUser)},this.A=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.I):(this.I(null),t.get().then(function(t){e.auth=t,e.I&&e.auth.addAuthTokenListener(e.I)},function(){}))}function zr(){this.u=null}function Wr(t,e){var n=this;return(n=_r.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}Cr.G=new Cr([]);var Kr,Yr=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Qr=(n(Hr,Kr=Vr),Hr.prototype.$=function(t,e,n){return new Hr(t,e,n)},Hr.H=function(t){return Yr.test(t)},Hr.prototype.j=function(){return this.W().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),Hr.H(t)||(t="`"+t+"`"),t}).join(".")},Hr.prototype.toString=function(){return this.j()},Hr.prototype.Y=function(){return 1===this.length&&"__name__"===this.get(0)},Hr.J=function(){return new Hr(["__name__"])},Hr.X=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new kr(Sr.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 si(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 ui(t){var e=yi(t.mapValue.fields.__local_write_time__.timestampValue);return new Pr(e.seconds,e.nanos)}ei.ht=new ei("");var ai=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function hi(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?si(t)?4:10:Js()}function ci(i,t){var e,n,r,o=hi(i);if(o!==hi(t))return!1;switch(o){case 0:return!0;case 1:return i.booleanValue===t.booleanValue;case 4:return ui(i).isEqual(ui(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=yi(i.timestampValue),n=yi(t.timestampValue);return e.seconds===n.seconds&&e.nanos===n.nanos}(t);case 5:return i.stringValue===t.stringValue;case 6:return r=t,gi(i.bytesValue).isEqual(gi(r.bytesValue));case 7:return i.referenceValue===t.referenceValue;case 8:return n=t,vi((e=i).geoPointValue.latitude)===vi(n.geoPointValue.latitude)&&vi(e.geoPointValue.longitude)===vi(n.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return vi(t.integerValue)===vi(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){var n=vi(t.doubleValue),r=vi(e.doubleValue);return n===r?ii(n)===ii(r):isNaN(n)&&isNaN(r)}return!1}(i,t);case 9:return iu(i.arrayValue.values||[],t.arrayValue.values||[],ci);case 10:return function(t){var e=i.mapValue.fields||{},n=t.mapValue.fields||{};if(Jr(e)!==Jr(n))return!1;for(var r in e)if(e.hasOwnProperty(r)&&(void 0===n[r]||!ci(e[r],n[r])))return!1;return!0}(t);default:return Js()}}function fi(t,e){return void 0!==(t.values||[]).find(function(t){return ci(t,e)})}function li(t,e){var n,r,i,o,s,u,a,h,c,f,l=hi(t),p=hi(e);if(l!==p)return ru(l,p);switch(l){case 0:return 0;case 1:return ru(t.booleanValue,e.booleanValue);case 2:return h=e,c=vi(t.integerValue||t.doubleValue),f=vi(h.integerValue||h.doubleValue),c":return 0=":return 0<=t;default:return Js()}},zo.prototype.ue=function(){return 0<=["<","<=",">",">="].indexOf(this.op)},zo.prototype.canonicalId=function(){return this.field.j()+this.op.toString()+di(this.value)},zo.prototype.isEqual=function(t){return t instanceof zo&&this.op===t.op&&this.field.isEqual(t.field)&&ci(this.value,t.value)},zo.prototype.toString=function(){return this.field.j()+" "+this.op+" "+di(this.value)},zo),ko=(n(Go,go=So),Go.prototype.matches=function(t){var e=$r.N(t.key,this.key);return this.de(e)},Go),Do=(n(Bo,vo=So),Bo.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},Bo),xo=(n(Fo,yo=So),Fo.prototype.matches=function(t){var e=t.field(this.field);return bi(e)&&fi(e.arrayValue,this.value)},Fo),Oo=(n(qo,po=So),qo.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&fi(this.value.arrayValue,e)},qo),Ro=(n(Mo,lo=So),Mo.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!bi(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(t){return fi(e.value.arrayValue,t)})},Mo),Po=(jo.prototype.canonicalId=function(){return(this.before?"b":"a")+":"+this.position.map(function(t){return di(t)}).join(",")},jo.prototype.le=function(t,e){for(var n=0,r=0;r":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Fs=(Bs.prototype.ni=function(t){var e=void 0===t.code?Sr.UNKNOWN:Xo(t.code);return new kr(e,t.message||"")},Bs.prototype.ri=function(t){return this.options.hi||ri(t)?t:{value:t}},Bs.prototype.oi=function(t){var e;return ri(e="object"==typeof t?t.value:t)?null:e},Bs.prototype._t=function(t){return{integerValue:""+t}},Bs.prototype.lt=function(t){if(this.options.hi){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:ii(t)?"-0":t}},Bs.prototype.ai=function(t){return oi(t)?this._t(t):this.lt(t)},Bs.prototype.C=function(t){return this.options.hi?new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+t.nanoseconds).slice(-9)+"Z":{seconds:""+t.seconds,nanos:t.nanoseconds}},Bs.prototype.v=function(t){var e=yi(t);return new Pr(e.seconds,e.nanos)},Bs.prototype.ui=function(t){return this.options.hi?t.toBase64():t.toUint8Array()},Bs.prototype.ci=function(t){return this.options.hi?(Zs(void 0===t||"string"==typeof t),ei.fromBase64String(t||"")):(Zs(void 0===t||t instanceof Uint8Array),ei.fromUint8Array(t||new Uint8Array))},Bs.prototype.toVersion=function(t){return this.C(t.C())},Bs.prototype.fromVersion=function(t){return Zs(!!t),Lr.v(this.v(t))},Bs.prototype._i=function(t,e){return this.li(e||this.ii).child("documents").child(t).j()},Bs.prototype.di=function(t){var e=Cr.K(t);return Zs(Gs(e)),e},Bs.prototype.fi=function(t){return this._i(t.path)},Bs.prototype.Z=function(t){var e=this.di(t);return Zs(e.get(1)===this.ii.projectId),Zs(!e.get(3)&&!this.ii.database||e.get(3)===this.ii.database),new $r(this.Ti(e))},Bs.prototype.Ei=function(t){return this._i(t)},Bs.prototype.Ii=function(t){var e=this.di(t);return 4===e.length?Cr.G:this.Ti(e)},Object.defineProperty(Bs.prototype,"wi",{get:function(){return new Cr(["projects",this.ii.projectId,"databases",this.ii.database]).j()},enumerable:!0,configurable:!0}),Bs.prototype.li=function(t){return new Cr(["projects",t.projectId,"databases",t.database])},Bs.prototype.Ti=function(t){return Zs(4";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return Js()}},Bs.prototype.hn=function(t){return{fieldPath:t.j()}},Bs.prototype.on=function(t){return Qr.X(t.fieldPath)},Bs.prototype.Zi=function(t){return{field:this.hn(t.field),direction:this.en(t.dir)}},Bs.prototype.tn=function(t){return new Lo(this.on(t.field),this.sn(t.direction))},Bs.prototype.Xi=function(t){return So.create(this.on(t.fieldFilter.field),this.rn(t.fieldFilter.op),t.fieldFilter.value)},Bs.prototype.Yi=function(t){if("=="===t.op){if(Ti(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NAN"}};if(Ei(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NULL"}}}return{fieldFilter:{field:this.hn(t.field),op:this.nn(t.op),value:t.value}}},Bs.prototype.Ji=function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=this.on(t.unaryFilter.field);return So.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=this.on(t.unaryFilter.field);return So.create(n,"==",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return Js()}},Bs.prototype.Si=function(t){var e=[];return t.fields.forEach(function(t){return e.push(t.j())}),{fieldPaths:e}},Bs.prototype.$i=function(t){var e=t.fieldPaths||[];return new Mi(e.map(function(t){return Qr.X(t)}))},Bs);function Bs(t,e){this.ii=t,this.options=e}function Gs(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}var zs=(Ks.an=function(t){Ks.platform&&Js(),Ks.platform=t},Ks.nt=function(){return Ks.platform||Js(),Ks.platform},Ks),Ws=new h("@firebase/firestore");function Ks(){}function Ys(){return Ws.logLevel}function Qs(t){Ws.logLevel=t}function Hs(t){for(var e=[],n=1;nthis.Rr&&(this.Ar=this.Rr)},xu.prototype.br=function(){null!==this.mr&&(this.mr.vr(),this.mr=null)},xu.prototype.cancel=function(){null!==this.mr&&(this.mr.cancel(),this.mr=null)},xu.prototype.pr=function(){return(Math.random()-.5)*this.Ar},xu);function xu(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.Tr=t,this.Er=e,this.Ir=n,this.wr=r,this.Rr=i,this.Ar=0,this.mr=null,this.Pr=Date.now(),this.reset()}function Ou(t){for(var e="",n=0;nt.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.uh(e,t)})},Ju.prototype.fh=function(e,n){var r=this;return this.Th(e,n).next(function(){return r.ah(e).next(function(t){return t.targetCount+=1,r.Eh(n,t),r.uh(e,t)})})},Ju.prototype.Ih=function(t,e){return this.Th(t,e)},Ju.prototype.wh=function(e,t){var n=this;return this.Rh(e,t.targetId).next(function(){return ta(e).delete(t.targetId)}).next(function(){return n.ah(e)}).next(function(t){return Zs(0e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},Ju.prototype.Vh=function(t){return this.ah(t).next(function(t){return t.targetCount})},Ju.prototype.gh=function(t,i){var o=this,e=i.canonicalId(),n=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),s=null;return ta(t).Ur({range:n,index:Ca.queryTargetsIndexName},function(t,e,n){var r=o.serializer.mh(e);i.isEqual(r.target)&&(s=r,n.done())}).next(function(){return s})},Ju.prototype.ph=function(n,t,r){var i=this,o=[],s=na(n);return t.forEach(function(t){var e=Ou(t.path);o.push(s.put(new Ua(r,e))),o.push(i.hh.yh(n,r,t))}),fu.vn(o)},Ju.prototype.bh=function(n,t,r){var i=this,o=na(n);return fu.forEach(t,function(t){var e=Ou(t.path);return fu.vn([o.delete([r,e]),i.hh.vh(n,r,t)])})},Ju.prototype.Rh=function(t,e){var n=na(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},Ju.prototype.Sh=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=na(t),o=gs();return r.Ur({range:n,Dh:!0},function(t,e,n){var r=Lu(t[1]),i=new $r(r);o=o.add(i)}).next(function(){return o})},Ju.prototype.Ch=function(t,e){var n=Ou(e.path),r=IDBKeyRange.bound([n],[ou(n)],!1,!0),i=0;return na(t).Ur({index:Ua.documentTargetsIndex,Dh:!0,range:r},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0 "+n),1))},aa.prototype.eo=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Qh=function(){t.Tr.uo(function(){return t.inForeground="visible"===t.document.visibilityState,t.to()})},this.document.addEventListener("visibilitychange",this.Qh),this.inForeground="visible"===this.document.visibilityState)},aa.prototype.Vo=function(){this.Qh&&(this.document.removeEventListener("visibilitychange",this.Qh),this.Qh=null)},aa.prototype.so=function(){var t=this;"function"==typeof this.window.addEventListener&&(this.Uh=function(){t.Po(),t.Tr.uo(function(){return t.mo()})},this.window.addEventListener("unload",this.Uh))},aa.prototype.po=function(){this.Uh&&(this.window.removeEventListener("unload",this.Uh),this.Uh=null)},aa.prototype.Ao=function(t){try{var e=null!==this.Jh.getItem(this.Ro(t));return Hs("IndexedDbPersistence","Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return $s("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},aa.prototype.Po=function(){try{this.Jh.setItem(this.Ro(this.clientId),String(Date.now()))}catch(t){$s("Failed to set zombie client id.",t)}},aa.prototype.yo=function(){try{this.Jh.removeItem(this.Ro(this.clientId))}catch(t){}},aa.prototype.Ro=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},aa);function aa(t,e,n,r,i,o,s,u){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Tr=o,this.xh=u,this.Bh=null,this.qh=!1,this.isPrimary=!1,this.networkEnabled=!0,this.Uh=null,this.inForeground=!1,this.Qh=null,this.Wh=null,this.jh=Number.NEGATIVE_INFINITY,this.Kh=function(t){return Promise.resolve()},!aa.Gh())throw new kr(Sr.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");if(this.hh=new pa(this,i),this.zh=e+aa.Hh,this.serializer=new ia(s),this.document=r.document,this.Yh=new Xu(this.hh,this.serializer),this.jn=new Uu,this.Qn=new Gu(this.serializer,this.jn),!r.window||!r.window.localStorage)throw new kr(Sr.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");this.window=r.window,this.Jh=this.window.localStorage}function ha(t,e){var n=this;return(n=ra.call(this)||this).Mh=t,n.Oh=e,n}function ca(t){this.Fh=t}function fa(t){return ua.Nr(t,_a.store)}function la(t){return ua.Nr(t,Fa.store)}ua.Hh="main";var pa=(da.prototype.Lo=function(t){var n=this.Mo(t);return this.db.Do().Vh(t).next(function(e){return n.next(function(t){return e+t})})},da.prototype.Mo=function(t){var e=0;return this.Oo(t,function(t){e++}).next(function(){return e})},da.prototype.js=function(t,e){return this.db.Do().js(t,e)},da.prototype.Oo=function(t,n){return this.xo(t,function(t,e){return n(e)})},da.prototype.yh=function(t,e,n){return ya(t,n)},da.prototype.vh=function(t,e,n){return ya(t,n)},da.prototype.Ah=function(t,e,n){return this.db.Do().Ah(t,e,n)},da.prototype.Bo=function(t,e){return ya(t,e)},da.prototype.qo=function(t,e){return r=e,i=!1,Ta(n=t).Uo(function(t){return ma(n,t,r).next(function(t){return t&&(i=!0),fu.resolve(!t)})}).next(function(){return i});var n,r,i},da.prototype.Qo=function(r,i){var o=this,s=this.db.Co().Yr(),u=[],a=0;return this.xo(r,function(e,t){if(t<=i){var n=o.qo(r,e).next(function(t){if(!t)return a++,s.Ln(r,e).next(function(){return s.kn(e),na(r).delete([0,Ou(e.path)])})});u.push(n)}}).next(function(){return fu.vn(u)}).next(function(){return s.apply(r)}).next(function(){return a})},da.prototype.removeTarget=function(t,e){var n=e.Ie(t.Oh);return this.db.Do().Ih(t,n)},da.prototype.Wo=function(t,e){return ya(t,e)},da.prototype.xo=function(t,o){var s,e=na(t),u=gu.dr;return e.Ur({index:Ua.documentTargetsIndex},function(t,e){var n=t[0],r=(t[1],e.path),i=e.sequenceNumber;0===n?(u!==gu.dr&&o(new $r(Lu(s)),u),u=i,s=r):u=gu.dr}).next(function(){u!==gu.dr&&o(new $r(Lu(s)),u)})},da.prototype.jo=function(t){return this.db.Co().Zr(t)},da);function da(t,e){this.db=t,this.ko=new vh(this,e)}function ya(t,e){return na(t).put((n=e,r=t.Oh,new Ua(0,Ou(n.path),r)));var n,r}var va=(ga.So=function(t,e,n,r){return Zs(""!==t.uid),new ga(t.t()?t.uid:"",e,n,r)},ga.prototype.Go=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return ba(t).Ur({index:Da.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},ga.prototype.zo=function(e,t,n){return this.Ho(e).next(function(t){return t.lastStreamToken=n.toBase64(),Ta(e).put(t)})},ga.prototype.Yo=function(t){return this.Ho(t).next(function(t){return ei.fromBase64String(t.lastStreamToken)})},ga.prototype.Jo=function(e,n){return this.Ho(e).next(function(t){return t.lastStreamToken=n.toBase64(),Ta(e).put(t)})},ga.prototype.Xo=function(h,c,f,l){var p=this,d=Ea(h),y=ba(h);return y.add({}).next(function(t){Zs("number"==typeof t);for(var e=new hu(t,c,f,l),n=p.serializer.kh(p.userId,e),r=[],i=new os(function(t,e){return ru(t.j(),e.j())}),o=0,s=l;o=i),o=r.serializer.Lh(e)),n.done()}).next(function(){return o})},ga.prototype.sa=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return ba(t).Ur({index:Da.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},ga.prototype.ia=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return ba(t).Fr(Da.userMutationsIndex,n).next(function(t){return t.map(function(t){return e.serializer.Lh(t)})})},ga.prototype.Gn=function(u,a){var h=this,t=xa.prefixForPath(this.userId,a.path),e=IDBKeyRange.lowerBound(t),c=[];return Ea(u).Ur({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=Lu(i);if(r===h.userId&&a.path.isEqual(s))return ba(u).get(o).next(function(t){if(!t)throw Js();Zs(t.userId===h.userId),c.push(h.serializer.Lh(t))});n.done()}).next(function(){return c})},ga.prototype.Xn=function(r,t){var a=this,h=new os(ru),i=[];return t.forEach(function(u){var t=xa.prefixForPath(a.userId,u.path),e=IDBKeyRange.lowerBound(t),n=Ea(r).Ur({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=Lu(i);r===a.userId&&u.path.isEqual(s)?h=h.add(o):n.done()});i.push(n)}),fu.vn(i).next(function(){return a.na(r,h)})},ga.prototype.nr=function(t,e){var u=this,a=e.path,h=a.length+1,n=xa.prefixForPath(this.userId,a),r=IDBKeyRange.lowerBound(n),c=new os(ru);return Ea(t).Ur({range:r},function(t,e,n){var r=t[0],i=t[1],o=t[2],s=Lu(i);r===u.userId&&a.q(s)?s.length===h&&(c=c.add(o)):n.done()}).next(function(){return u.na(t,c)})},ga.prototype.na=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(ba(e).get(t).next(function(t){if(null===t)throw Js();Zs(t.userId===n.userId),r.push(n.serializer.Lh(t))}))}),fu.vn(i).next(function(){return r})},ga.prototype.ra=function(e,n){var r=this;return wa(e.Mh,this.userId,n).next(function(t){return e.qn(function(){r.ha(n.batchId)}),fu.forEach(t,function(t){return r.hh.Bo(e,t)})})},ga.prototype.ha=function(t){delete this.Ko[t]},ga.prototype.oa=function(n){var o=this;return this.Go(n).next(function(t){if(!t)return fu.resolve();var e=IDBKeyRange.lowerBound(xa.prefixForUser(o.userId)),i=[];return Ea(n).Ur({range:e},function(t,e,n){if(t[0]===o.userId){var r=Lu(t[1]);i.push(r)}else n.done()}).next(function(){Zs(0===i.length)})})},ga.prototype.Ch=function(t,e){return ma(t,this.userId,e)},ga.prototype.Ho=function(t){var e=this;return Ta(t).get(this.userId).next(function(t){return t||new ka(e.userId,-1,"")})},ga);function ga(t,e,n,r){this.userId=t,this.serializer=e,this.jn=n,this.hh=r,this.Ko={}}function ma(t,o,e){var n=xa.prefixForPath(o,e.path),s=n[1],r=IDBKeyRange.lowerBound(n),u=!1;return Ea(t).Ur({range:r,Dh:!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 wa(t,e,n){var r=t.store(Da.store),i=t.store(xa.store),o=[],s=IDBKeyRange.only(n.batchId),u=0,a=r.Ur({range:s},function(t,e,n){return u++,n.delete()});o.push(a.next(function(){Zs(1===u)}));for(var h=[],c=0,f=n.mutations;c",t),this.store.put(t)))},Za.prototype.add=function(t){return Hs("SimpleDb","ADD",this.store.name,t,t),eh(this.store.add(t))},Za.prototype.get=function(e){var n=this;return eh(this.store.get(e)).next(function(t){return void 0===t&&(t=null),Hs("SimpleDb","GET",n.store.name,e,t),t})},Za.prototype.delete=function(t){return Hs("SimpleDb","DELETE",this.store.name,t),eh(this.store.delete(t))},Za.prototype.count=function(){return Hs("SimpleDb","COUNT",this.store.name),eh(this.store.count())},Za.prototype.Fr=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.wa(n,function(t,e){r.push(e)}).next(function(){return r})},Za.prototype.Ra=function(t,e){Hs("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.Dh=!1;var r=this.cursor(n);return this.wa(r,function(t,e,n){return n.delete()})},Za.prototype.Ur=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.wa(r,e)},Za.prototype.Uo=function(i){var t=this.cursor({});return new fu(function(n,r){t.onerror=function(t){var e=rh(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()}})},Za.prototype.wa=function(t,s){var u=[];return new fu(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 Wa(e),r=s(e.primaryKey,e.value,n);if(r instanceof fu){var i=r.catch(function(t){return n.done(),fu.reject(t)});u.push(i)}n.Pn?o():null===n.Ea?e.continue():e.continue(n.Ea)}else o()}}).next(function(){return fu.vn(u)})},Za.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},Za.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.Dh?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},Za);function Za(t){this.store=t}function th(t){var n=this;this.transaction=t,this.aborted=!1,this.Ia=new ku,this.transaction.oncomplete=function(){n.Ia.resolve()},this.transaction.onabort=function(){t.error?n.Ia.reject(new Ka(t.error)):n.Ia.resolve()},this.transaction.onerror=function(t){var e=rh(t.target.error);n.Ia.reject(new Ka(e))}}function eh(t){return new fu(function(n,r){t.onsuccess=function(t){var e=t.target.result;n(e)},t.onerror=function(t){var e=rh(t.target.error);r(e)}})}var nh=!1;function rh(t){var e=za.aa(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 kr("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 nh||(nh=!0,setTimeout(function(){throw r},0)),r}}return t}var ih=(uh.ga=function(t,e,n,r,i){var o=new uh(t,e,Date.now()+n,r,i);return o.start(n),o},uh.prototype.start=function(t){var e=this;this.pa=setTimeout(function(){return e.ya()},t)},uh.prototype.vr=function(){return this.ya()},uh.prototype.cancel=function(t){null!==this.pa&&(this.clearTimeout(),this.Va.reject(new kr(Sr.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},uh.prototype.ya=function(){var e=this;this.Aa.uo(function(){return null!==e.pa?(e.clearTimeout(),e.op().then(function(t){return e.Va.resolve(t)})):Promise.resolve()})},uh.prototype.clearTimeout=function(){null!==this.pa&&(this.Pa(this),clearTimeout(this.pa),this.pa=null)},uh),oh=(Object.defineProperty(sh.prototype,"La",{get:function(){return this.Sa},enumerable:!0,configurable:!0}),sh.prototype.uo=function(t){this.enqueue(t)},sh.prototype.Ma=function(t){this.Oa(),this.xa(t)},sh.prototype.Ba=function(t){return this.Oa(),this.xa(t)},sh.prototype.qa=function(n){return y(this,void 0,void 0,function(){var e;return v(this,function(t){switch(t.label){case 0:return this.Oa(),this.Sa?[3,2]:(this.Sa=!0,(e=zs.nt().window)&&e.removeEventListener("visibilitychange",this.ka),[4,this.Ba(n)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},sh.prototype.enqueue=function(t){return this.Oa(),this.Sa?new Promise(function(t){}):this.xa(t)},sh.prototype.Ua=function(i){var t=this;this.Oa(),this.Sa||(this.va=this.va.then(function(){var n=new ku,r=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,2,,3]),[4,i()];case 1:return t.sent(),n.resolve(),this.$a.reset(),[3,3];case 2:if(!$a(e=t.sent()))throw n.resolve(),e;return Hs("AsyncQueue","Operation failed with retryable error: "+e),this.$a.gr(r),[3,3];case 3:return[2]}})})};return t.uo(r),n.promise}))},sh.prototype.xa=function(t){var e=this,n=this.ba.then(function(){return e.Fa=!0,t().catch(function(t){throw e.Ca=t,e.Fa=!1,$s("INTERNAL UNHANDLED ERROR: ",t.stack||t.message||""),t}).then(function(t){return e.Fa=!1,t})});return this.ba=n},sh.prototype.yr=function(t,e,n){var r=this;this.Oa(),-1c.Tu.ru?(Hs("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+c.Tu.ru+" from "+t),c.Tu.ru):t,s=Date.now(),c.Au(e,i)}).next(function(t){return r=t,u=Date.now(),c.Ah(e,r,n)}).next(function(t){return o=t,a=Date.now(),c.Qo(e,r)}).next(function(t){return h=Date.now(),Ys()<=l.DEBUG&&Hs("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"),fu.resolve({Za:!0,tu:i,eu:o,su:t})})},wh),gh=(mh.prototype.start=function(){return Promise.resolve()},mh.prototype.Du=function(i){return y(this,void 0,void 0,function(){var e,m,n,r=this;return v(this,function(t){switch(t.label){case 0:return e=this.Wn,m=this.vu,[4,this.persistence.runTransaction("Handle user change","readonly",function(v){var g;return r.Wn.ia(v).next(function(t){return g=t,e=r.persistence.vo(i),m=new yu(r.bu,e,r.persistence.Fo()),e.ia(v)}).next(function(t){for(var e=[],n=[],r=gs(),i=0,o=g;i=this.xu||0r)throw new kr(Sr.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+Kh(e.length,"argument")+".")}function Ph(t,e,n,r){jh(t,e,Wh(n)+" argument",r)}function Lh(t,e,n,r){void 0!==r&&Ph(t,e,n,r)}function Vh(t,e,n,r){jh(t,e,n+" option",r)}function Ch(t,e,n,r){void 0!==r&&Vh(t,e,n,r)}function Uh(t,e,n,r,a){void 0!==r&&function(t,e,n){for(var r=[],i=0,o=a;ithis.query.limit;){var n=this.query.oe()?f.last():f.first();f=f.delete(n.key),c=c.delete(n.key),a.track({type:1,doc:n})}return{md:f,gd:a,yd:l,ns:c}},Pf.prototype.pd=function(t,e){return t.At&&e.hasCommittedMutations&&!e.At},Pf.prototype.xn=function(t,e,n){var o=this,r=this.md;this.md=t.md,this.ns=t.ns;var i=t.gd.es();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.query.se(t.doc,e.doc);function n(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Js()}}var r,i}),this.bd(n);var s=e?this.vd():[],u=0===this.Ad.size&&this.fs?1:0,a=u!==this.Rd;return this.Rd=u,0!==i.length||a?{snapshot:new As(this.query,t.md,r,i,t.ns,0==u,a,!1),Sd:s}:{Sd:s}},Pf.prototype.Dd=function(t){return this.fs&&"Offline"===t?(this.fs=!1,this.xn({md:this.md,gd:new Ns,ns:this.ns,yd:!1},!1)):{Sd:[]}},Pf.prototype.Cd=function(t){return!this.wd.has(t)&&!!this.md.has(t)&&!this.md.get(t).At},Pf.prototype.bd=function(t){var e=this;t&&(t.Ts.forEach(function(t){return e.wd=e.wd.add(t)}),t.Es.forEach(function(t){}),t.Is.forEach(function(t){return e.wd=e.wd.delete(t)}),this.fs=t.fs)},Pf.prototype.vd=function(){var e=this;if(!this.fs)return[];var n=this.Ad;this.Ad=gs(),this.md.forEach(function(t){e.Cd(t.key)&&(e.Ad=e.Ad.add(t.key))});var r=[];return n.forEach(function(t){e.Ad.has(t)||r.push(new nf(t))}),this.Ad.forEach(function(t){n.has(t)||r.push(new ef(t))}),r},Pf.prototype.Fd=function(t){this.wd=t.Ku,this.Ad=gs();var e=this.Vd(t.documents);return this.xn(e,!0)},Pf.prototype.Nd=function(){return As.os(this.query,this.md,this.ns,0===this.Rd)},Pf),gf=(Rf.prototype.Ld=function(){this.Md()},Rf.prototype.Md=function(){var t=this;this.$a.gr(function(){return y(t,void 0,void 0,function(){var e,n,r=this;return v(this,function(t){return e=this.$d.ml(),(n=this.Od(e))&&n.then(function(t){r.Aa.uo(function(){return e.commit().then(function(){r.Va.resolve(t)}).catch(function(t){r.xd(t)})})}).catch(function(t){r.xd(t)}),[2]})})})},Rf.prototype.Od=function(t){try{var e=this.updateFunction(t);return!ri(e)&&e.catch&&e.then?e:(this.Va.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.Va.reject(t),null}},Rf.prototype.xd=function(t){var e=this;0i?this.Wn[i]:null)},_f.prototype.sa=function(){return fu.resolve(0===this.Wn.length?-1:this.Uf-1)},_f.prototype.ia=function(t){return fu.resolve(this.Wn.slice())},_f.prototype.Gn=function(t,e){var n=this,r=new _h(e,0),i=new _h(e,Number.POSITIVE_INFINITY),o=[];return this.Qf.Ke([r,i],function(t){var e=n.jf(t.oc);o.push(e)}),fu.resolve(o)},_f.prototype.Xn=function(t,e){var r=this,i=new os(ru);return e.forEach(function(t){var e=new _h(t,0),n=new _h(t,Number.POSITIVE_INFINITY);r.Qf.Ke([e,n],function(t){i=i.add(t.oc)})}),fu.resolve(this.Gf(i))},_f.prototype.nr=function(t,e){var n=e.path,r=n.length+1,i=n;$r.et(i)||(i=i.child(""));var o=new _h(new $r(i),0),s=new os(ru);return this.Qf.Ge(function(t){var e=t.key.path;return!!n.q(e)&&(e.length===r&&(s=s.add(t.oc)),!0)},o),fu.resolve(this.Gf(s))},_f.prototype.Gf=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.jf(t);null!==e&&r.push(e)}),r},_f.prototype.ra=function(n,r){var i=this;Zs(0===this.Wf(r.batchId,"removed")),this.Wn.shift();var o=this.Qf;return fu.forEach(r.mutations,function(t){var e=new _h(t.key,r.batchId);return o=o.delete(e),i.hh.Bo(n,t.key)}).next(function(){i.Qf=o})},_f.prototype.ha=function(t){},_f.prototype.Ch=function(t,e){var n=new _h(e,0),r=this.Qf.ze(n);return fu.resolve(e.isEqual(r&&r.key))},_f.prototype.oa=function(t){return this.Wn.length,fu.resolve()},_f.prototype.Wf=function(t,e){return this.Kf(t)},_f.prototype.Kf=function(t){return 0===this.Wn.length?0:t-this.Wn[0].batchId},_f.prototype.jf=function(t){var e=this.Kf(t);return e<0||e>=this.Wn.length?null:this.Wn[e]},_f),Nf=(Af.prototype.Nn=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.Ae(r,{Mr:e,size:s,readTime:n}),this.size+=s-o,this.jn.Dr(t,r.path.L())},Af.prototype.kn=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},Af.prototype.Ln=function(t,e){var n=this.docs.get(e);return fu.resolve(n?n.Mr:null)},Af.prototype.getEntries=function(t,e){var n=this,r=fs();return e.forEach(function(t){var e=n.docs.get(t);r=r.Ae(t,e?e.Mr:null)}),fu.resolve(r)},Af.prototype.Zn=function(t,e,n){for(var r=ps(),i=new $r(e.path.child("")),o=this.docs.ve(i);o.$e();){var s=o.Ne(),u=s.key,a=s.value,h=a.Mr,c=a.readTime;if(!e.path.q(u.path))break;c.S(n)<=0||h instanceof To&&e.matches(h)&&(r=r.Ae(h.key,h))}return fu.resolve(r)},Af.prototype.Hf=function(t,e){return fu.forEach(this.docs,function(t){return e(t)})},Af.prototype.Yr=function(t){return new Af.Jr(this)},Af.prototype.Zr=function(t){return fu.resolve(this.size)},Af);function Af(t,e){this.jn=t,this.zf=e,this.docs=new Jo($r.N),this.size=0}function _f(t,e){this.jn=t,this.hh=e,this.Wn=[],this.Uf=1,this.lastStreamToken=ei.ht,this.Qf=new os(_h.Xu)}function Sf(){}function kf(t,e,n){this.query=t,this.Ff=e,this.Nf=!1,this.$f=null,this.onlineState="Unknown",this.options=n||{}}function Df(t){this.ol=t,this.yf=new au(function(t){return t.canonicalId()}),this.onlineState="Unknown",this.bf=new Set,this.ol.subscribe(this)}function xf(t,e,n,r,i){var o=this;return(o=uf.call(this,t,e,n,r,i)||this).N_=t,o.Rf=void 0,o}function Of(t,e,n,r,i){this.N_=t,this.$d=e,this.Ud=n,this.currentUser=r,this.Qd=i,this.Wd=null,this.jd=new au(function(t){return t.canonicalId()}),this.Kd=new Map,this.Gd=[],this.zd=new Jo($r.N),this.Hd=new Map,this.Yd=new Ah,this.Jd={},this.Xd=new Map,this.Zd=$u.rh(),this.onlineState="Unknown"}function Rf(t,e,n,r){this.Aa=t,this.$d=e,this.updateFunction=n,this.Va=r,this.kd=5,this.$a=new Du(this.Aa,"transaction_retry")}function Pf(t,e){this.query=t,this.wd=e,this.Rd=null,this.fs=!1,this.Ad=gs(),this.ns=gs(),this.md=new Is(t.se.bind(t))}function Lf(){this.Ed=new pf,this.Id={},this.ol=null,this.g_=null,this.ur=null}function Vf(t,e,n,r,i){if(this.Tr=t,this.platform=e,this.persistenceKey=n,this.vl=r,this.ol=null,this.g_=null,this.ur=null,this.Sl=this.Dl.bind(this),this.Cl=new Jo(ru),this.ro=!1,this.Fl=[],!Vf.Gh(this.platform))throw new kr(Sr.UNIMPLEMENTED,"LocalStorage is not available on this platform.");var o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.platform.window.localStorage,this.currentUser=i,this.Nl=Jc(this.persistenceKey,this.vl),this.$l="firestore_sequence_number_"+this.persistenceKey,this.Cl=this.Cl.Ae(this.vl,new pf),this.kl=new RegExp("^firestore_clients_"+o+"_([^_]*)$"),this.Ll=new RegExp("^firestore_mutations_"+o+"_(\\d+)(?:_(.*))?$"),this.Ml=new RegExp("^firestore_targets_"+o+"_(\\d+)$"),this.Ol="firestore_online_state_"+this.persistenceKey,this.platform.window.addEventListener("storage",this.Sl)}function Cf(){this.activeTargetIds=ws()}function Uf(t,e){this.clientId=t,this.onlineState=e}function jf(t,e){this.clientId=t,this.activeTargetIds=e}function Mf(t,e,n){this.targetId=t,this.state=e,this.error=n}function qf(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function Ff(t){var e=this;return(e=af.call(this)||this).th=t,e}Nf.Jr=(n(Ff,af=lu),Ff.prototype.xn=function(n){var r=this,i=[];return this.Dn.forEach(function(t,e){e?i.push(r.th.Nn(n,e,r.readTime)):r.th.kn(t)}),fu.vn(i)},Ff.prototype.Mn=function(t,e){return this.th.Ln(t,e)},Ff.prototype.On=function(t,e){return this.th.getEntries(t,e)},Ff);var Bf,Gf,zf=(ol.prototype.js=function(t,n){return this.Yf.forEach(function(t,e){return n(e)}),fu.resolve()},ol.prototype._h=function(t){return fu.resolve(this.lastRemoteSnapshotVersion)},ol.prototype.lh=function(t){return fu.resolve(this.Jf)},ol.prototype.oh=function(t){return this.highestTargetId=this.Zf.next(),fu.resolve(this.highestTargetId)},ol.prototype.dh=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.Jf&&(this.Jf=e),fu.resolve()},ol.prototype.Th=function(t){this.Yf.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.Zf=new $u(e),this.highestTargetId=e),t.sequenceNumber>this.Jf&&(this.Jf=t.sequenceNumber)},ol.prototype.fh=function(t,e){return this.Th(e),this.targetCount+=1,fu.resolve()},ol.prototype.Ih=function(t,e){return this.Th(e),fu.resolve()},ol.prototype.wh=function(t,e){return this.Yf.delete(e.target),this.Xf.nc(e.targetId),--this.targetCount,fu.resolve()},ol.prototype.Ah=function(n,r,i){var o=this,s=0,u=[];return this.Yf.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.Yf.delete(t),u.push(o.Rh(n,e.targetId)),s++)}),fu.vn(u).next(function(){return s})},ol.prototype.Vh=function(t){return fu.resolve(this.targetCount)},ol.prototype.gh=function(t,e){var n=this.Yf.get(e)||null;return fu.resolve(n)},ol.prototype.ph=function(t,e,n){return this.Xf.ec(e,n),fu.resolve()},ol.prototype.bh=function(e,t,n){this.Xf.ic(t,n);var r=this.persistence.hh,i=[];return r&&t.forEach(function(t){i.push(r.Bo(e,t))}),fu.vn(i)},ol.prototype.Rh=function(t,e){return this.Xf.nc(e),fu.resolve()},ol.prototype.Sh=function(t,e){var n=this.Xf.hc(e);return fu.resolve(n)},ol.prototype.Ch=function(t,e){return fu.resolve(this.Xf.Ch(e))},ol),Wf=(il.prototype.start=function(){return Promise.resolve()},il.prototype.mo=function(){return this.qh=!1,Promise.resolve()},Object.defineProperty(il.prototype,"ro",{get:function(){return this.qh},enumerable:!0,configurable:!0}),il.prototype.ho=function(){},il.prototype.Fo=function(){return this.jn},il.prototype.vo=function(t){var e=this.tT[t.s()];return e||(e=new If(this.jn,this.hh),this.tT[t.s()]=e),e},il.prototype.Do=function(){return this.Yh},il.prototype.Co=function(){return this.Qn},il.prototype.runTransaction=function(t,e,n){var r=this;Hs("MemoryPersistence","Starting transaction:",t);var i=new Kf(this.Bh.next());return this.hh.sT(),n(i).next(function(t){return r.hh.iT(i).next(function(){return t})}).yn().then(function(t){return i.Un(),t})},il.prototype.nT=function(e,n){return fu.Sn(Object.values(this.tT).map(function(t){return function(){return t.Ch(e,n)}}))},il),Kf=(n(rl,Gf=du),rl),Yf=(nl.oT=function(t){return new nl(t)},Object.defineProperty(nl.prototype,"aT",{get:function(){if(this.hT)return this.hT;throw Js()},enumerable:!0,configurable:!0}),nl.prototype.yh=function(t,e,n){return this.rT.yh(n,e),this.aT.delete(n),fu.resolve()},nl.prototype.vh=function(t,e,n){return this.rT.vh(n,e),this.aT.add(n),fu.resolve()},nl.prototype.Bo=function(t,e){return this.aT.add(e),fu.resolve()},nl.prototype.removeTarget=function(t,e){var n=this;this.rT.nc(e.targetId).forEach(function(t){return n.aT.add(t)});var r=this.persistence.Do();return r.Sh(t,e.targetId).next(function(t){t.forEach(function(t){return n.aT.add(t)})}).next(function(){return r.wh(t,e)})},nl.prototype.sT=function(){this.hT=new Set},nl.prototype.iT=function(t){var n=this,r=this.persistence.Co().Yr();return fu.forEach(this.aT,function(e){return n.uT(t,e).next(function(t){t||r.kn(e)})}).next(function(){return n.hT=null,r.apply(t)})},nl.prototype.Wo=function(t,e){var n=this;return this.uT(t,e).next(function(t){t?n.aT.delete(e):n.aT.add(e)})},nl.prototype.eT=function(t){return 0},nl.prototype.uT=function(t,e){var n=this;return fu.Sn([function(){return fu.resolve(n.rT.Ch(e))},function(){return n.persistence.Do().Ch(t,e)},function(){return n.persistence.nT(t,e)}])},nl),Qf=(el.prototype.initialize=function(n){return y(this,void 0,void 0,function(){var e=this;return v(this,function(t){switch(t.label){case 0:return this.Ud=this.cT(n),this.persistence=this._T(n),[4,this.persistence.start()];case 1:return t.sent(),this.lT=this.dT(n),this.N_=this.fT(n),this.$d=this.TT(n),this.ol=this.ET(n),this.IT=this.wT(n),this.Ud.g_=function(t){return e.ol.Dd(t,1)},this.$d.ol=this.ol,[4,this.N_.start()];case 2:return t.sent(),[4,this.Ud.start()];case 3:return t.sent(),[4,this.$d.start()];case 4:return t.sent(),[4,this.$d.Vl(this.ol.tf)];case 5:return t.sent(),[2]}})})},el.prototype.wT=function(t){return new bf(this.ol)},el.prototype.dT=function(t){return null},el.prototype.fT=function(t){return new gh(this.persistence,new Tf,t.RT)},el.prototype._T=function(t){return new Wf(Yf.oT)},el.prototype.TT=function(t){var e=this;return new zc(this.N_,t.T_,t.Aa,function(t){return e.ol.Dd(t,0)},t.platform.AT())},el.prototype.cT=function(t){return new yf},el.prototype.ET=function(t){return new mf(this.N_,this.$d,this.Ud,t.RT,t.Qd)},el.prototype.clearPersistence=function(t){throw new kr(Sr.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.")},el),Hf=(n(tl,Bf=Qf),tl.prototype.initialize=function(e){return y(this,void 0,void 0,function(){var n=this;return v(this,function(t){switch(t.label){case 0:return[4,Bf.prototype.initialize.call(this,e)];case 1:return t.sent(),[4,this.persistence.no(function(e){return y(n,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return[4,this.ol.Vl(e)];case 1:return t.sent(),this.lT&&(e&&!this.lT.ro?this.lT.start(this.N_):e||this.lT.stop()),[2]}})})})];case 2:return t.sent(),[2]}})})},tl.prototype.fT=function(t){return new Th(this.persistence,new Tf,t.RT)},tl.prototype.ET=function(t){var e=new wf(this.N_,this.$d,this.Ud,t.RT,t.Qd);return this.Ud instanceof df&&(this.Ud.ol=e),e},tl.prototype.dT=function(t){var e=this.persistence.hh.ko;return new yh(e,t.Aa)},tl.prototype._T=function(t){var e=ua.$o(t.mT),n=t.platform.bc(t.mT.ii);return new ua(t.PT.synchronizeTabs,e,t.clientId,t.platform,lh.hu(t.PT.cacheSizeBytes),t.Aa,n,this.Ud)},tl.prototype.cT=function(t){if(t.PT.VT&&t.PT.synchronizeTabs){if(!df.Gh(t.platform))throw new kr(Sr.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var e=ua.$o(t.mT);return new df(t.Aa,t.platform,e,t.clientId,t.RT)}return new yf},tl.prototype.clearPersistence=function(t){var e=ua.$o(t);return ua.clearPersistence(e)},tl),$f=(Zf.prototype.start=function(e,n){var r=this;this.gT();var i=new ku,o=new ku,s=!1;return this.credentials.l(function(t){if(!s)return s=!0,Hs("FirestoreClient","Initializing. user=",t.uid),r.pT(e,n,t,o).then(i.resolve,i.reject);r.Aa.Ua(function(){return r.Pl(t)})}),this.Aa.uo(function(){return i.promise}),o.promise},Zf.prototype.enableNetwork=function(){var t=this;return this.gT(),this.Aa.enqueue(function(){return t.ol.enableNetwork()})},Zf.prototype.pT=function(a,h,c,f){return y(this,void 0,void 0,function(){var r,i,o,s,u=this;return v(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.platform.yT(this.mT)];case 1:return r=t.sent(),i=this.platform.bc(this.mT.ii),e=r,n=this.credentials,o=new Fc(e,n,i),[4,a.initialize({Aa:this.Aa,mT:this.mT,platform:this.platform,T_:o,clientId:this.clientId,RT:c,Qd:100,PT:h})];case 2:return t.sent(),this.persistence=a.persistence,this.Ud=a.Ud,this.N_=a.N_,this.$d=a.$d,this.ol=a.ol,this.lT=a.lT,this.bT=a.IT,this.persistence.ho(function(){return y(u,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})}),f.resolve(),[3,4];case 3:if(s=t.sent(),f.reject(s),!this.vT(s))throw s;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+s),this.pT(new Qf,{VT:!1},c,f))];case 4:return[2]}var e,n})})},Zf.prototype.vT=function(t){return"FirebaseError"===t.name?t.code===Sr.FAILED_PRECONDITION||t.code===Sr.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},Zf.prototype.gT=function(){if(this.Aa.La)throw new kr(Sr.FAILED_PRECONDITION,"The client has already been terminated.")},Zf.prototype.Pl=function(t){return this.Aa.Wa(),Hs("FirestoreClient","Credential Changed. Current user: "+t.uid),this.ol.Pl(t)},Zf.prototype.disableNetwork=function(){var t=this;return this.gT(),this.Aa.enqueue(function(){return t.ol.disableNetwork()})},Zf.prototype.terminate=function(){var t=this;return this.Aa.qa(function(){return y(t,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return this.lT&&this.lT.stop(),[4,this.$d.mo()];case 1:return t.sent(),[4,this.Ud.mo()];case 2:return t.sent(),[4,this.persistence.mo()];case 3:return t.sent(),this.credentials.T(),[2]}})})})},Zf.prototype.waitForPendingWrites=function(){var t=this;this.gT();var e=new ku;return this.Aa.uo(function(){return t.ol.lf(e)}),e.promise},Zf.prototype.listen=function(t,e,n){var r=this;this.gT();var i=new Ef(t,e,n);return this.Aa.uo(function(){return r.bT.listen(i)}),i},Zf.prototype.rl=function(t){var e=this;this.ST||this.Aa.uo(function(){return e.bT.rl(t)})},Zf.prototype.DT=function(o){return y(this,void 0,void 0,function(){var i,e=this;return v(this,function(t){switch(t.label){case 0:return this.gT(),i=new ku,[4,this.Aa.enqueue(function(){return y(e,void 0,void 0,function(){var e,n,r;return v(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.N_.Uu(o)];case 1:return(e=t.sent())instanceof To?i.resolve(e):e instanceof Io?i.resolve(null):i.reject(new kr(Sr.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")),[3,3];case 2:return n=t.sent(),r=ah(n,"Failed to get document '"+o+" from cache"),i.reject(r),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),i.promise)]}})})},Zf.prototype.CT=function(a){return y(this,void 0,void 0,function(){var u,e=this;return v(this,function(t){switch(t.label){case 0:return this.gT(),u=new ku,[4,this.Aa.enqueue(function(){return y(e,void 0,void 0,function(){var e,n,r,i,o,s;return v(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.N_.ju(a,!0)];case 1:return e=t.sent(),n=new vf(a,e.Ku),r=n.Vd(e.documents),i=n.xn(r,!1),u.resolve(i.snapshot),[3,3];case 2:return o=t.sent(),s=ah(o,"Failed to execute query '"+a+" against cache"),u.reject(s),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),u.promise)]}})})},Zf.prototype.write=function(t){var e=this;this.gT();var n=new ku;return this.Aa.uo(function(){return e.ol.write(t,n)}),n.promise},Zf.prototype.ii=function(){return this.mT.ii},Zf.prototype.Df=function(t){var e=this;this.gT(),this.Aa.uo(function(){return e.bT.Df(t),Promise.resolve()})},Zf.prototype.Cf=function(t){var e=this;this.ST||this.Aa.uo(function(){return e.bT.Cf(t),Promise.resolve()})},Object.defineProperty(Zf.prototype,"ST",{get:function(){return this.Aa.La},enumerable:!0,configurable:!0}),Zf.prototype.transaction=function(t){var e=this;this.gT();var n=new ku;return this.Aa.uo(function(){return e.ol.runTransaction(e.Aa,t,n),Promise.resolve()}),n.promise},Zf),Xf=(Jf.prototype.next=function(t){this.FT(this.observer.next,t)},Jf.prototype.error=function(t){this.FT(this.observer.error,t)},Jf.prototype.NT=function(){this.muted=!0},Jf.prototype.FT=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},Jf);function Jf(t){this.observer=t,this.muted=!1}function Zf(t,e,n,r){this.platform=t,this.mT=e,this.credentials=n,this.Aa=r,this.clientId=eu.cn()}function tl(){return null!==Bf&&Bf.apply(this,arguments)||this}function el(){}function nl(t){this.persistence=t,this.rT=new Ah,this.hT=null}function rl(t){var e=this;return(e=Gf.call(this)||this).Oh=t,e}function il(t){var e=this;this.tT={},this.Bh=new gu(0),this.qh=!1,this.qh=!0,this.hh=t(this),this.Yh=new zf(this),this.jn=new Vu,this.Qn=new Nf(this.jn,function(t){return e.hh.eT(t)})}function ol(t){this.persistence=t,this.Yf=new au(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=Lr.min(),this.highestTargetId=0,this.Jf=0,this.Xf=new Ah,this.targetCount=0,this.Zf=$u.nh()}function sl(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),o=Rc("Query.where",t);if(o.Y()){if("array-contains"===i||"array-contains-any"===i)throw new kr(Sr.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i){this.wE(n,i);for(var s=[],u=0,a=n;ur.length)throw new kr(Sr.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.IE.Kt();null!==s&&this.yE(t.field,s)}else if(i||r){var u=null;if(i&&(u=this.IE.ce(n)),null===u&&r&&(u=this.IE.ce(e)),null!=u)throw u===t.op?new kr(Sr.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+t.op.toString()+"' filter."):new kr(Sr.INVALID_ARGUMENT,"Invalid query. You cannot use '"+t.op.toString()+"' filters with '"+u.toString()+"' filters.")}}},Nl.prototype.mE=function(t){if(null===this.IE.Kt()){var e=this.IE.jt();null!==e&&this.yE(e,t.field)}},Nl.prototype.yE=function(t,e){if(!e.isEqual(t))throw new kr(Sr.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.")},Nl),bl=(Object.defineProperty(Il.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),Object.defineProperty(Il.prototype,"empty",{get:function(){return this.vE.docs.B()},enumerable:!0,configurable:!0}),Object.defineProperty(Il.prototype,"size",{get:function(){return this.vE.docs.size},enumerable:!0,configurable:!0}),Il.prototype.forEach=function(e,n){var r=this;Rh("QuerySnapshot.forEach",arguments,1,2),Ph("QuerySnapshot.forEach","function",1,e),this.vE.docs.forEach(function(t){e.call(n,r.CE(t))})},Object.defineProperty(Il.prototype,"query",{get:function(){return new wl(this.bE,this.hE,this.aE)},enumerable:!0,configurable:!0}),Il.prototype.docChanges=function(t){t&&(Bh("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),Ch("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.vE.hs)throw new kr(Sr.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.SE&&this.DE===e||(this.SE=function(i,e,o,s){if(o.ss.B()){var n=0;return o.docChanges.map(function(t){var e=new ml(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s);return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var u=o.ss;return o.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new ml(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s),n=-1,r=-1;return 0!==t.type&&(n=u.indexOf(t.doc.key),u=u.delete(t.doc.key)),1!==t.type&&(r=(u=u.add(t.doc)).indexOf(t.doc.key)),{type:function(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Js()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.hE,e,this.vE,this.aE),this.DE=e),this.SE},Il.prototype.isEqual=function(t){if(!(t instanceof Il))throw Gh("isEqual","QuerySnapshot",1,t);return this.hE===t.hE&&this.bE.isEqual(t.bE)&&this.vE.isEqual(t.vE)&&this.aE===t.aE},Il.prototype.CE=function(t){return new ml(this.hE,t.key,t,this.metadata.fromCache,this.vE.ns.has(t.key),this.aE)},Il),El=(n(Tl,ul=wl),Object.defineProperty(Tl.prototype,"id",{get:function(){return this.IE.path.O()},enumerable:!0,configurable:!0}),Object.defineProperty(Tl.prototype,"parent",{get:function(){var t=this.IE.path.L();return t.B()?null:new yl(new $r(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(Tl.prototype,"path",{get:function(){return this.IE.path.j()},enumerable:!0,configurable:!0}),Tl.prototype.doc=function(t){if(Rh("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=eu.cn()),Ph("CollectionReference.doc","non-empty string",1,t),""===t)throw new kr(Sr.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=Cr.K(t);return yl.nE(this.IE.path.child(e),this.firestore,this.aE)},Tl.prototype.add=function(t){xh("CollectionReference.add",arguments,1),Ph("CollectionReference.add","object",1,this.aE?this.aE.toFirestore(t):t);var e=this.doc();return e.set(t).then(function(){return e})},Tl.prototype.withConverter=function(t){return new Tl(this.FE,this.firestore,t)},Tl);function Tl(t,e,n){var r=this;if(((r=ul.call(this,_o.Wt(t),e,n)||this).FE=t).length%2!=1)throw new kr(Sr.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.j()+" has "+t.length);return r}function Il(t,e,n,r){this.hE=t,this.bE=e,this.vE=n,this.aE=r,this.SE=null,this.DE=null,this.metadata=new vl(n.hasPendingWrites,n.fromCache)}function Nl(t,e,n){this.IE=t,this.firestore=e,this.aE=n}function Al(){return null!==al&&al.apply(this,arguments)||this}function _l(t,e,n,r,i,o){this.hE=t,this.kc=e,this.fE=n,this.TE=r,this.EE=i,this.aE=o}function Sl(t,e){this.hasPendingWrites=t,this.fromCache=e}function kl(t,e,n){this.kc=t,this.firestore=e,this.aE=n,this.jT=this.firestore.WT()}function Dl(t){this.hE=t,this.uE=[],this.cE=!1}function xl(t,e){this.hE=t,this.oE=e}function Ol(t,e,n){var r=this;if(void 0===n&&(n=new Qf),this.UT=null,this.QT=new oh,this.INTERNAL={delete:function(){return y(r,void 0,void 0,function(){return v(this,function(t){switch(t.label){case 0:return this.WT(),[4,this.jT.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var i=t;this.UT=i,this.$c=Ol.KT(i),this.GT=i.name,this.zT=new xr(e)}else{var o=t;if(!o.projectId)throw new kr(Sr.INVALID_ARGUMENT,"Must provide projectId");this.$c=new uu(o.projectId,o.database),this.GT="[DEFAULT]",this.zT=new Dr}this.HT=n,this.YT=new fl({})}function Rl(t){var e,n,r,i;if(void 0===t.host){if(void 0!==t.ssl)throw new kr(Sr.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else Vh("settings","non-empty string","host",t.host),this.host=t.host,Ch("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(Bh("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","ignoreUndefinedProperties"]),Ch("settings","object","credentials",t.credentials),this.credentials=t.credentials,Ch("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),Ch("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),!0===t.timestampsInSnapshots?$s("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&$s("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(n=t.timestampsInSnapshots)||void 0===n||n,this.ignoreUndefinedProperties=null!==(r=t.ignoreUndefinedProperties)&&void 0!==r&&r,Ch("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=lh._u;else{if(t.cacheSizeBytes!==cl&&t.cacheSizeBytes() instead."),Xl=Ml(Hh,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),Jl={Firestore:Fl,GeoPoint:fc,Timestamp:Pr,Blob:Xl,Transaction:Bl,WriteBatch:Gl,DocumentReference:zl,DocumentSnapshot:Wl,Query:Yl,QueryDocumentSnapshot:Kl,QuerySnapshot:Ql,CollectionReference:Hl,FieldPath:$h,FieldValue:$l,setLogLevel:ll.setLogLevel,CACHE_SIZE_UNLIMITED:cl},Zl=(ap.prototype.B_=function(t){},ap.prototype.mo=function(){},ap),tp=(up.prototype.B_=function(t){this.ME.push(t)},up.prototype.mo=function(){window.removeEventListener("online",this.NE),window.removeEventListener("offline",this.kE)},up.prototype.OE=function(){window.addEventListener("online",this.NE),window.addEventListener("offline",this.kE)},up.prototype.$E=function(){Hs("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.ME;t