!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],e):e((t=t||self).firebase)}(this,function(cf){"use strict";try{(function(){cf=cf&&Object.prototype.hasOwnProperty.call(cf,"default")?cf.default:cf;var t,u,e,r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function d(t,s,u,a){return new(u=u||Promise)(function(n,e){function r(t){try{o(a.next(t))}catch(t){e(t)}}function i(t){try{o(a.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(r,i)}o((a=a.apply(t,s||[])).next())})}function y(n,r){var i,o,s,t,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,s&&(e=[2&e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return u.label++,{value:e[1],done:!1};case 5:u.label++,o=e[1],e=[0];continue;case 7:e=u.ops.pop(),u.trys.pop();continue;default:if(!(s=0<(s=u.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){u=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]"})):"Error",a=this.serviceName+": "+u+" ("+o+").",h=new v(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 A,N="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},_=_||{},R=N||self;function S(){}function D(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&void 0!==t.splice&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||void 0!==t.call&&void 0!==t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&void 0===t.call)return"object";return e}function O(t){var e=D(t);return"array"==e||"object"==e&&"number"==typeof t.length}function P(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var k="closure_uid_"+(1e9*Math.random()>>>0),L=0;function V(t,e,n){return t.call.apply(t.bind,arguments)}function C(e,n,t){if(!e)throw Error();if(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=Q(String(rt)).split("."),n=Q(String(u)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i>>0);function Bt(e){return"function"==D(e)?e:(e[Gt]||(e[Gt]=function(t){return e.handleEvent(t)}),e[Gt])}function zt(){j.call(this),this.c=new Ot(this),(this.J=this).A=null}function Ht(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;oe.length?Ve:(e=e.substr(r,n),t.w=r+n,e))}function xe(t){t.P=q()+t.N,je(t,t.N)}function je(t,e){if(null!=t.h)throw Error("WatchDog timer not null");t.h=be(M(t.Qa,t),e)}function Fe(t){t.h&&(R.clearTimeout(t.h),t.h=null)}function Ge(t){0==t.g.u||t.l||rr(t.g,t)}function Be(t){Fe(t);var e=t.D;e&&"function"==typeof e.da&&e.da(),t.D=null,ie(t.O),fe(t.G),t.a&&(e=t.a,t.a=null,e.abort(),e.da())}function ze(t,e){try{var n=t.g;if(0!=n.u&&(n.a==t||An(n.b,t)))if(n.A=t.H,!t.o&&An(n.b,t)&&3==n.u){try{var r=n.ja.a.parse(e)}catch(t){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.i){if(n.a){if(!(n.a.s+3e3>4&15).toString(16)+(15&t).toString(16)}Xe.prototype.toString=function(){var t=[],e=this.f;e&&t.push(sn(e,an,!0),":");var n=this.c;return!n&&"file"!=e||(t.push("//"),(e=this.j)&&t.push(sn(e,an,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.h)&&t.push(":",String(n))),(n=this.g)&&(this.c&&"/"!=n.charAt(0)&&t.push("/"),t.push(sn(n,"/"==n.charAt(0)?cn:hn,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.i)&&t.push("#",sn(n,ln)),t.join("")};var an=/[#\/\?@]/g,hn=/[#\?:]/g,cn=/[#\?]/g,fn=/[#\?@]/g,ln=/#/g;function pn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function dn(n){n.a||(n.a=new We,n.b=0,n.c&&function(t,e){if(t){t=t.split("&");for(var n=0;n2*t.c&&Qe(t)))}function vn(t,e){return dn(t),e=mn(t,e),Ye(t.a.b,e)}function gn(t,e,n){yn(t,e),0=t.f}function Tn(t){return t.b?1:t.a?t.a.size:0}function An(t,e){return t.b?t.b==e:t.a&&t.a.has(e)}function Nn(t,e){t.a?t.a.add(e):t.b=e}function _n(t,e){t.b&&t.b==e?t.b=null:t.a&&t.a.has(e)&&t.a.delete(e)}function Rn(t){var e,n;if(null!=t.b)return t.c.concat(t.b.i);if(null==t.a||0===t.a.size)return z(t.c);var r=t.c;try{for(var i=T(t.a.values()),o=i.next();!o.done;o=i.next()){var s=o.value;r=r.concat(s.i)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}function Sn(){}function Dn(){this.a=new Sn}function On(t,r,e){var i=e||"";try{He(t,function(t,e){var n=t;P(t)&&(n=Wt(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}function Pn(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}bn.prototype.cancel=function(){var e,t;if(this.c=Rn(this),this.b)this.b.cancel(),this.b=null;else if(this.a&&0!==this.a.size){try{for(var n=T(this.a.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.a.clear()}},Sn.prototype.stringify=function(t){return R.JSON.stringify(t,void 0)},Sn.prototype.parse=function(t){return R.JSON.parse(t,void 0)};var kn=R.JSON.parse;function Ln(t){zt.call(this),this.headers=new We,this.G=t||null,this.b=!1,this.s=this.a=null,this.D="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.H=Vn,this.B=this.F=!1}x(Ln,zt);var Vn="",Cn=/^https?$/i,Mn=["POST","PUT"];function Un(t){return"content-type"==t.toLowerCase()}function qn(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,xn(t),Fn(t)}function xn(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function jn(t){if(t.b&&void 0!==_&&(!t.s[1]||4!=Bn(t)||2!=t.S()))if(t.l&&4==Bn(t))oe(t.va,0,t);else if(t.dispatchEvent("readystatechange"),4==Bn(t)){t.b=!1;try{var e,n=t.S();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.D).match(Ze)[1]||null;if(!o&&R.self&&R.self.location){var s=R.self.location.protocol;o=s.substr(0,s.length-1)}i=!Cn.test(o?o.toLowerCase():"")}e=i}if(e)t.dispatchEvent("complete"),t.dispatchEvent("success");else{t.h=6;try{var u=2=t.b.f-(t.g?1:0))){if(t.g)return t.f=e.i.concat(t.f),1;if(!(1==t.u||2==t.u||t.o>=(t.Ca?0:t.Da)))return t.g=be(M(t.xa,t,e),ir(t,t.o)),t.o++,1}}(t,e)||2==r&&er(t)))switch(n&&0e.length?1:0},qr),Mr=(n(Ur,Nr=Cr),Ur.prototype.$=function(t,e,n){return new Ur(t,e,n)},Ur.prototype.j=function(){return this.W().join("/")},Ur.prototype.toString=function(){return this.j()},Ur.G=function(t){if(0<=t.indexOf("//"))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new Ur(t.split("/").filter(function(t){return 0t.length&&Ks(),void 0===n?n=t.length-e:n>t.length-e&&Ks(),this.segments=t,this.offset=e,this.F=n}function xr(t){this.timestamp=t}function jr(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new Sr(Rr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new Sr(Rr.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Sr(Rr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new Sr(Rr.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function Fr(t,e){this.P=t,this.V=e}function Gr(t,e){this.P=t,this.V=e,this.type="FirstParty",this.user=Ir.h}function Br(t){var e=this;this.m=null,this.currentUser=Ir.UNAUTHENTICATED,this.I=!1,this.R=0,this.u=null,this.forceRefresh=!1,this.m=function(){e.R++,e.currentUser=e.A(),e.I=!0,e.u&&e.u(e.currentUser)},this.R=0,this.auth=t.getImmediate({optional:!0}),this.auth?this.auth.addAuthTokenListener(this.m):(this.m(null),t.get().then(function(t){e.auth=t,e.m&&e.auth.addAuthTokenListener(e.m)},function(){}))}function zr(){this.u=null}function Hr(t,e){var n=this;return(n=_r.call(this,e)||this).code=t,n.message=e,n.name="FirebaseError",n.toString=function(){return n.name+": [code="+n.code+"]: "+n.message},n}Mr.H=new Mr([]);var Wr,Qr=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Yr=(n(Zr,Wr=Cr),Zr.prototype.$=function(t,e,n){return new Zr(t,e,n)},Zr.K=function(t){return Qr.test(t)},Zr.prototype.j=function(){return this.W().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),Zr.K(t)||(t="`"+t+"`"),t}).join(".")},Zr.prototype.toString=function(){return this.j()},Zr.prototype.Y=function(){return 1===this.length&&"__name__"===this.get(0)},Zr.X=function(){return new Zr(["__name__"])},Zr.J=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");e.push(n),n=""},o=!1;r":return 0=":return 0<=t;default:return Ks()}},Bo.prototype.ue=function(){return 0<=["<","<=",">",">="].indexOf(this.op)},Bo.prototype.canonicalId=function(){return this.field.j()+this.op.toString()+pi(this.value)},Bo.prototype.isEqual=function(t){return t instanceof Bo&&this.op===t.op&&this.field.isEqual(t.field)&&hi(this.value,t.value)},Bo.prototype.toString=function(){return this.field.j()+" "+this.op+" "+pi(this.value)},Bo),Ro=(n(Go,vo=_o),Go.prototype.matches=function(t){var e=Xr.N(t.key,this.key);return this.fe(e)},Go),So=(n(Fo,yo=_o),Fo.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},Fo),Do=(n(jo,po=_o),jo.prototype.matches=function(t){var e=t.field(this.field);return wi(e)&&ci(e.arrayValue,this.value)},jo),Oo=(n(xo,lo=_o),xo.prototype.matches=function(t){var e=t.field(this.field);return null!==e&&ci(this.value.arrayValue,e)},xo),Po=(n(qo,fo=_o),qo.prototype.matches=function(t){var e=this,n=t.field(this.field);return!(!wi(n)||!n.arrayValue.values)&&n.arrayValue.values.some(function(t){return ci(e.value.arrayValue,t)})},qo),ko=(Uo.prototype.canonicalId=function(){return(this.before?"b":"a")+":"+this.position.map(function(t){return pi(t)}).join(",")},Uo.prototype._e=function(t,e){for(var n=0,r=0;r":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","array-contains-any":"ARRAY_CONTAINS_ANY"},js=(Fs.prototype.ni=function(t){var e=void 0===t.code?Rr.UNKNOWN:Xo(t.code);return new Sr(e,t.message||"")},Fs.prototype.ri=function(t){return this.options.hi||ri(t)?t:{value:t}},Fs.prototype.oi=function(t){var e;return ri(e="object"==typeof t?t.value:t)?null:e},Fs.prototype.lt=function(t){return{integerValue:""+t}},Fs.prototype._t=function(t){if(this.options.hi){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:ii(t)?"-0":t}},Fs.prototype.ai=function(t){return"number"==typeof(e=t)&&Number.isInteger(e)&&!ii(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER?this.lt(t):this._t(t);var e},Fs.prototype.D=function(t){return this.options.hi?new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")+"."+("000000000"+t.nanoseconds).slice(-9)+"Z":{seconds:""+t.seconds,nanos:t.nanoseconds}},Fs.prototype.v=function(t){var e=di(t);return new Lr(e.seconds,e.nanos)},Fs.prototype.ui=function(t){return this.options.hi?t.toBase64():t.toUint8Array()},Fs.prototype.ci=function(t){return this.options.hi?(Js(void 0===t||"string"==typeof t),ei.fromBase64String(t||"")):(Js(void 0===t||t instanceof Uint8Array),ei.fromUint8Array(t||new Uint8Array))},Fs.prototype.toVersion=function(t){return this.D(t.D())},Fs.prototype.fromVersion=function(t){return Js(!!t),Vr.v(this.v(t))},Fs.prototype.li=function(t,e){return this._i(e||this.ii).child("documents").child(t).j()},Fs.prototype.fi=function(t){var e=Mr.G(t);return Js(Gs(e)),e},Fs.prototype.di=function(t){return this.li(t.path)},Fs.prototype.Z=function(t){var e=this.fi(t);return Js(e.get(1)===this.ii.projectId),Js(!e.get(3)&&!this.ii.database||e.get(3)===this.ii.database),new Xr(this.wi(e))},Fs.prototype.Ti=function(t){return this.li(t)},Fs.prototype.Ei=function(t){var e=this.fi(t);return 4===e.length?Mr.H:this.wi(e)},Object.defineProperty(Fs.prototype,"mi",{get:function(){return new Mr(["projects",this.ii.projectId,"databases",this.ii.database]).j()},enumerable:!0,configurable:!0}),Fs.prototype._i=function(t){return new Mr(["projects",t.projectId,"databases",t.database])},Fs.prototype.wi=function(t){return Js(4";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":default:return Ks()}},Fs.prototype.hn=function(t){return{fieldPath:t.j()}},Fs.prototype.on=function(t){return Yr.J(t.fieldPath)},Fs.prototype.Zi=function(t){return{field:this.hn(t.field),direction:this.en(t.dir)}},Fs.prototype.tn=function(t){return new Lo(this.on(t.field),this.sn(t.direction))},Fs.prototype.Ji=function(t){return _o.create(this.on(t.fieldFilter.field),this.rn(t.fieldFilter.op),t.fieldFilter.value)},Fs.prototype.Yi=function(t){if("=="===t.op){if(Ei(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NAN"}};if(bi(t.value))return{unaryFilter:{field:this.hn(t.field),op:"IS_NULL"}}}return{fieldFilter:{field:this.hn(t.field),op:this.nn(t.op),value:t.value}}},Fs.prototype.Xi=function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=this.on(t.unaryFilter.field);return _o.create(e,"==",{doubleValue:NaN});case"IS_NULL":var n=this.on(t.unaryFilter.field);return _o.create(n,"==",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return Ks()}},Fs.prototype.Si=function(t){var e=[];return t.fields.forEach(function(t){return e.push(t.j())}),{fieldPaths:e}},Fs.prototype.$i=function(t){var e=t.fieldPaths||[];return new qi(e.map(function(t){return Yr.J(t)}))},Fs);function Fs(t,e){this.ii=t,this.options=e}function Gs(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}var Bs=(Hs.an=function(t){Hs.platform&&Ks(),Hs.platform=t},Hs.nt=function(){return Hs.platform||Ks(),Hs.platform},Hs),zs=new c("@firebase/firestore");function Hs(){}function Ws(){return zs.logLevel}function Qs(t){zs.logLevel=t}function Ys(t){for(var e=[],n=1;nthis.hr&&(this.or=this.hr)},Du.prototype.wr=function(){null!==this.ar&&(this.ar.Tr(),this.ar=null)},Du.prototype.cancel=function(){null!==this.ar&&(this.ar.cancel(),this.ar=null)},Du.prototype._r=function(){return(Math.random()-.5)*this.or},Du),Tu=(Su.prototype.mr=function(t,e){return this.Er.add(e),hu.resolve()},Su.prototype.jn=function(t,e){return hu.resolve(this.Er.getEntries(e))},Su),Au=(Ru.prototype.add=function(t){var e=t.q(),n=t.L(),r=this.index[e]||new is(Mr.N),i=!r.has(n);return this.index[e]=r.add(n),i},Ru.prototype.has=function(t){var e=t.q(),n=t.L(),r=this.index[e];return r&&r.has(n)},Ru.prototype.getEntries=function(t){return(this.index[t]||new is(Mr.N)).W()},Ru),Nu=(_u.prototype.next=function(){return this.Ir+=2,this.Ir},_u.Rr=function(){return new _u(0)},_u.Ar=function(){return new _u(-1)},_u);function _u(t){this.Ir=t}function Ru(){this.index={}}function Su(){this.Er=new Au}function Du(t,e,n,r,i){void 0===n&&(n=1e3),void 0===r&&(r=1.5),void 0===i&&(i=6e4),this.sr=t,this.ir=e,this.nr=n,this.rr=r,this.hr=i,this.or=0,this.ar=null,this.ur=Date.now(),this.reset()}function Ou(t){return"IndexedDbTransactionError"===t.name}var Pu=(Vu.gr=function(t,e,n,r,i){var o=new Vu(t,e,Date.now()+n,r,i);return o.start(n),o},Vu.prototype.start=function(t){var e=this;this.br=setTimeout(function(){return e.vr()},t)},Vu.prototype.Tr=function(){return this.vr()},Vu.prototype.cancel=function(t){null!==this.br&&(this.clearTimeout(),this.yr.reject(new Sr(Rr.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},Vu.prototype.vr=function(){var e=this;this.Pr.Sr(function(){return null!==e.br?(e.clearTimeout(),e.op().then(function(t){return e.yr.resolve(t)})):Promise.resolve()})},Vu.prototype.clearTimeout=function(){null!==this.br&&(this.pr(this),clearTimeout(this.br),this.br=null)},Vu),ku=(Object.defineProperty(Lu.prototype,"Mr",{get:function(){return this.Fr},enumerable:!0,configurable:!0}),Lu.prototype.Sr=function(t){this.enqueue(t)},Lu.prototype.xr=function(t){this.Br(),this.Ur(t)},Lu.prototype.Qr=function(t){return this.Br(),this.Ur(t)},Lu.prototype.Wr=function(n){return d(this,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:return this.Br(),this.Fr?[3,2]:(this.Fr=!0,(e=Bs.nt().window)&&e.removeEventListener("visibilitychange",this.qr),[4,this.Qr(n)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},Lu.prototype.enqueue=function(t){return this.Br(),this.Fr?new Promise(function(t){}):this.Ur(t)},Lu.prototype.jr=function(i){var t=this;this.Br(),this.Fr||(this.Dr=this.Dr.then(function(){var n=new Eu,r=function(){return d(t,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,i()];case 1:return t.sent(),n.resolve(),this.Or.reset(),[3,3];case 2:if(!Ou(e=t.sent()))throw n.resolve(),e;return Ys("AsyncQueue","Operation failed with retryable error: "+e),this.Or.lr(r),[3,3];case 3:return[2]}})})};return t.Sr(r),n.promise}))},Lu.prototype.Ur=function(t){var e=this,n=this.Cr.then(function(){return e.kr=!0,t().catch(function(t){throw e.$r=t,e.kr=!1,Zs("INTERNAL UNHANDLED ERROR: ",t.stack||t.message||""),t}).then(function(t){return e.kr=!1,t})});return this.Cr=n},Lu.prototype.dr=function(t,e,n){var r=this;this.Br(),-1=this.Jh||0r)throw new Sr(Rr.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+aa(e.length,"argument")+".")}function Zu(t,e,n,r){ta(t,e,ua(n)+" argument",r)}function Xu(t,e,n,r){void 0!==r&&Zu(t,e,n,r)}function Ku(t,e,n,r){ta(t,e,n+" option",r)}function Ju(t,e,n,r){void 0!==r&&Ku(t,e,n,r)}function $u(t,e,n,r,a){void 0!==r&&function(t,e,n){for(var r=[],i=0,o=a;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{ac:f,lc:a,fc:l,ns:c}},Oh.prototype._c=function(t,e){return t.At&&e.hasCommittedMutations&&!e.At},Oh.prototype.dc=function(t,e,n){var o=this,r=this.ac;this.ac=t.ac,this.ns=t.ns;var i=t.lc.es();i.sort(function(t,e){return r=t.type,i=e.type,n(r)-n(i)||o.query.se(t.doc,e.doc);function n(t){switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ks()}}var r,i}),this.wc(n);var s=e?this.Tc():[],u=0===this.oc.size&&this.ds?1:0,a=u!==this.hc;return this.hc=u,0!==i.length||a?{snapshot:new As(this.query,t.ac,r,i,t.ns,0==u,a,!1),Ec:s}:{Ec:s}},Oh.prototype.mc=function(t){return this.ds&&"Offline"===t?(this.ds=!1,this.dc({ac:this.ac,lc:new Ts,ns:this.ns,fc:!1},!1)):{Ec:[]}},Oh.prototype.Ic=function(t){return!this.rc.has(t)&&!!this.ac.has(t)&&!this.ac.get(t).At},Oh.prototype.wc=function(t){var e=this;t&&(t.ws.forEach(function(t){return e.rc=e.rc.add(t)}),t.Ts.forEach(function(t){}),t.Es.forEach(function(t){return e.rc=e.rc.delete(t)}),this.ds=t.ds)},Oh.prototype.Tc=function(){var e=this;if(!this.ds)return[];var n=this.oc;this.oc=vs(),this.ac.forEach(function(t){e.Ic(t.key)&&(e.oc=e.oc.add(t.key))});var r=[];return n.forEach(function(t){e.oc.has(t)||r.push(new Ja(t))}),this.oc.forEach(function(t){n.has(t)||r.push(new Ka(t))}),r},Oh.prototype.Rc=function(t){this.rc=t._o,this.oc=vs();var e=this.cc(t.documents);return this.dc(e,!0)},Oh.prototype.Ac=function(){return As.os(this.query,this.ac,this.ns,0===this.hc)},Oh),vh=(Dh.prototype.pc=function(){this.yc()},Dh.prototype.yc=function(){var t=this;this.Or.lr(function(){return d(t,void 0,void 0,function(){var e,n,r=this;return y(this,function(t){return e=this.Pc.Bu(),(n=this.gc(e))&&n.then(function(t){r.Pr.Sr(function(){return e.commit().then(function(){r.yr.resolve(t)}).catch(function(t){r.bc(t)})})}).catch(function(t){r.bc(t)}),[2]})})})},Dh.prototype.gc=function(t){try{var e=this.updateFunction(t);return!ri(e)&&e.catch&&e.then?e:(this.yr.reject(Error("Transaction callback must return a Promise")),null)}catch(t){return this.yr.reject(t),null}},Dh.prototype.bc=function(t){var e=this;0i?this.Dn[i]:null)},Ah.prototype.Oh=function(){return hu.resolve(0===this.Dn.length?-1:this.pl-1)},Ah.prototype.Ph=function(t){return hu.resolve(this.Dn.slice())},Ah.prototype.$n=function(t,e){var n=this,r=new Gu(e,0),i=new Gu(e,Number.POSITIVE_INFINITY),o=[];return this.yl.Ge([r,i],function(t){var e=n.vl(t.bo);o.push(e)}),hu.resolve(o)},Ah.prototype.xn=function(t,e){var r=this,i=new is(nu);return e.forEach(function(t){var e=new Gu(t,0),n=new Gu(t,Number.POSITIVE_INFINITY);r.yl.Ge([e,n],function(t){i=i.add(t.bo)})}),hu.resolve(this.Cl(i))},Ah.prototype.Gn=function(t,e){var n=e.path,r=n.length+1,i=n;Xr.et(i)||(i=i.child(""));var o=new Gu(new Xr(i),0),s=new is(nu);return this.yl.He(function(t){var e=t.key.path;return!!n.B(e)&&(e.length===r&&(s=s.add(t.bo)),!0)},o),hu.resolve(this.Cl(s))},Ah.prototype.Cl=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.vl(t);null!==e&&r.push(e)}),r},Ah.prototype.Lh=function(n,r){var i=this;Js(0===this.bl(r.batchId,"removed")),this.Dn.shift();var o=this.yl;return hu.forEach(r.mutations,function(t){var e=new Gu(t.key,r.batchId);return o=o.delete(e),i.Yh.Dl(n,t.key)}).next(function(){i.yl=o})},Ah.prototype.Fl=function(t){},Ah.prototype.yo=function(t,e){var n=new Gu(e,0),r=this.yl.Ke(n);return hu.resolve(e.isEqual(r&&r.key))},Ah.prototype.Nh=function(t){return this.Dn.length,hu.resolve()},Ah.prototype.bl=function(t,e){return this.Sl(t)},Ah.prototype.Sl=function(t){return 0===this.Dn.length?0:t-this.Dn[0].batchId},Ah.prototype.vl=function(t){var e=this.Sl(t);return e<0||e>=this.Dn.length?null:this.Dn[e]},Ah),Ih=(Th.prototype.Kh=function(t,e,n){var r=e.key,i=this.docs.get(r),o=i?i.size:0,s=this.Nl(e);return this.docs=this.docs.Re(r,{$l:e,size:s,readTime:n}),this.size+=s-o,this.Fn.mr(t,r.path.L())},Th.prototype.Hh=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},Th.prototype.Ln=function(t,e){var n=this.docs.get(e);return hu.resolve(n?n.$l:null)},Th.prototype.getEntries=function(t,e){var n=this,r=cs();return e.forEach(function(t){var e=n.docs.get(t);r=r.Re(t,e?e.$l:null)}),hu.resolve(r)},Th.prototype.Bn=function(t,e,n){for(var r=ls(),i=new Xr(e.path.child("")),o=this.docs.ve(i);o.$e();){var s=o.Ne(),u=s.key,a=s.value,h=a.$l,c=a.readTime;if(!e.path.B(u.path))break;c.S(n)<=0||h instanceof Eo&&e.matches(h)&&(r=r.Re(h.key,h))}return hu.resolve(r)},Th.prototype.kl=function(t,e){return hu.forEach(this.docs,function(t){return e(t)})},Th.prototype.Ch=function(t){return new Th.Ll(this)},Th.prototype.Ol=function(t){return hu.resolve(this.size)},Th);function Th(t,e){this.Fn=t,this.Nl=e,this.docs=new Ko(Xr.N),this.size=0}function Ah(t,e){this.Fn=t,this.Yh=e,this.Dn=[],this.pl=1,this.lastStreamToken=ei.ht,this.yl=new is(Gu.To)}function Nh(){}function _h(t,e,n){this.query=t,this.dl=e,this.wl=!1,this.Tl=null,this.onlineState="Unknown",this.options=n||{}}function Rh(t){this.bu=t,this.al=new su(function(t){return t.canonicalId()}),this.onlineState="Unknown",this.ul=new Set,this.bu.subscribe(this)}function Sh(t,e,n,r,i){this.Za=t,this.Pc=e,this.Cc=n,this.currentUser=r,this.Dc=i,this.Fc=null,this.Nc=new su(function(t){return t.canonicalId()}),this.$c=new Map,this.kc=[],this.Lc=new Ko(Xr.N),this.Oc=new Map,this.qc=new Fu,this.Mc={},this.xc=new Map,this.Bc=Nu.Ar(),this.onlineState="Unknown"}function Dh(t,e,n,r){this.Pr=t,this.Pc=e,this.updateFunction=n,this.yr=r,this.Vc=5,this.Or=new Iu(this.Pr,"transaction_retry")}function Oh(t,e){this.query=t,this.rc=e,this.hc=null,this.ds=!1,this.oc=vs(),this.ns=vs(),this.ac=new Is(t.se.bind(t))}function Ph(){this.Hu=new ph,this.Ku={},this.bu=null,this.Wa=null,this.Xn=null}function kh(){this.activeTargetIds=ms()}function Lh(t,e,n,r,i){var o,s,u,a,h,c,f,l,p=this;this.Za=t,this.ka=e,this.Pr=n,this.tu=[],this.eu=new Map,this.su=null,this.networkEnabled=!1,this.isPrimary=!1,this.iu=!1,this.nu=i,this.nu.ru(function(t){n.Sr(function(){return d(p,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.hu()?(Ys("RemoteStore","Restarting streams for network reachability change."),[4,this.ou()]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.au=new fh(n,r),this.uu=(h=this.ka,c=n,f={Aa:this.cu.bind(this),Ta:this.lu.bind(this),Va:this._u.bind(this)},l=$s(h),new uh(c,l.ia,l.credentials,l.serializer,f)),this.fu=(o=this.ka,s=n,u={Aa:this.du.bind(this),Ta:this.wu.bind(this),Ca:this.Tu.bind(this),Sa:this.Sa.bind(this)},a=$s(o),new ah(s,a.ia,a.credentials,a.serializer,u))}function Vh(t,e){this.Pr=t,this.Wa=e,this.state="Unknown",this.ja=0,this.Ga=null,this.Ha=!0}function Ch(t){this.ka=t,this.La=ds(),this.mutations=[],this.Oa=!1,this.qa=null,this.Ma=new Set}function Mh(t,e,n){var r=this;return(r=nh.call(this)||this).ia=t,r.credentials=e,r.serializer=n,r}function Uh(t,e,n,r,i){var o=this;return(o=rh.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).serializer=r,o.ga=!1,o.lastStreamToken=ei.ht,o}function qh(t,e,n,r,i){var o=this;return(o=ih.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).serializer=r,o}function xh(t,e,n,r,i,o){this.sr=t,this.sa=n,this.ia=r,this.na=i,this.listener=o,this.state=0,this.ra=0,this.ha=null,this.stream=null,this.Or=new Iu(t,e)}function jh(t){var e=this;return(e=oh.call(this)||this).Ql=t,e}function Fh(){this.vh=new su(function(t){return t.toString()}),this.ql=!1}Ih.Ll=(Object.defineProperty(Fh.prototype,"readTime",{get:function(){return this.Ml},set:function(t){this.Ml=t},enumerable:!0,configurable:!0}),Fh.prototype.Kh=function(t,e){this.xl(),this.readTime=e,this.vh.set(t.key,t)},Fh.prototype.Hh=function(t,e){this.xl(),e&&(this.readTime=e),this.vh.set(t,null)},Fh.prototype.Ln=function(t,e){this.xl();var n=this.vh.get(e);return void 0!==n?hu.resolve(n):this.Bl(t,e)},Fh.prototype.getEntries=function(t,e){return this.Ul(t,e)},Fh.prototype.apply=function(t){return this.xl(),this.ql=!0,this.dc(t)},Fh.prototype.xl=function(){},n(jh,oh=Fh),jh.prototype.dc=function(n){var r=this,i=[];return this.vh.forEach(function(t,e){e?i.push(r.Ql.Kh(n,e,r.readTime)):r.Ql.Hh(t)}),hu.vn(i)},jh.prototype.Bl=function(t,e){return this.Ql.Ln(t,e)},jh.prototype.Ul=function(t,e){return this.Ql.getEntries(t,e)},jh);var Gh,Bh=(rc.prototype.js=function(t,n){return this.Wl.forEach(function(t,e){return n(e)}),hu.resolve()},rc.prototype.xh=function(t){return hu.resolve(this.lastRemoteSnapshotVersion)},rc.prototype.Kl=function(t){return hu.resolve(this.jl)},rc.prototype.oo=function(t){return this.highestTargetId=this.Hl.next(),hu.resolve(this.highestTargetId)},rc.prototype.Xh=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.jl&&(this.jl=e),hu.resolve()},rc.prototype.zl=function(t){this.Wl.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.Hl=new Nu(e),this.highestTargetId=e),t.sequenceNumber>this.jl&&(this.jl=t.sequenceNumber)},rc.prototype.ao=function(t,e){return this.zl(e),this.targetCount+=1,hu.resolve()},rc.prototype.Gh=function(t,e){return this.zl(e),hu.resolve()},rc.prototype.Yl=function(t,e){return this.Wl.delete(e.target),this.Gl.Po(e.targetId),--this.targetCount,hu.resolve()},rc.prototype.Xl=function(n,r,i){var o=this,s=0,u=[];return this.Wl.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.Wl.delete(t),u.push(o.Jl(n,e.targetId)),s++)}),hu.vn(u).next(function(){return s})},rc.prototype.Zl=function(t){return hu.resolve(this.targetCount)},rc.prototype.ho=function(t,e){var n=this.Wl.get(e)||null;return hu.resolve(n)},rc.prototype.Qh=function(t,e,n){return this.Gl.Io(e,n),hu.resolve()},rc.prototype.Uh=function(e,t,n){this.Gl.Ao(t,n);var r=this.persistence.Yh,i=[];return r&&t.forEach(function(t){i.push(r.Dl(e,t))}),hu.vn(i)},rc.prototype.Jl=function(t,e){return this.Gl.Po(e),hu.resolve()},rc.prototype.lo=function(t,e){var n=this.Gl.po(e);return hu.resolve(n)},rc.prototype.yo=function(t,e){return hu.resolve(this.Gl.yo(e))},rc),zh=(nc.prototype.start=function(){return Promise.resolve()},nc.prototype.Vu=function(){return this.s_=!1,Promise.resolve()},Object.defineProperty(nc.prototype,"n_",{get:function(){return this.s_},enumerable:!0,configurable:!0}),nc.prototype.r_=function(){},nc.prototype.Ih=function(){return this.Fn},nc.prototype.fh=function(t){var e=this.t_[t.s()];return e||(e=new Eh(this.Fn,this.Yh),this.t_[t.s()]=e),e},nc.prototype.Eh=function(){return this.Th},nc.prototype.wh=function(){return this.Cn},nc.prototype.runTransaction=function(t,e,n){var r=this;Ys("MemoryPersistence","Starting transaction:",t);var i=new Hh(this.e_.next());return this.Yh.h_(),n(i).next(function(t){return r.Yh.o_(i).next(function(){return t})}).gn().then(function(t){return i.a_(),t})},nc.prototype.u_=function(e,n){return hu.Sn(Object.values(this.t_).map(function(t){return function(){return t.yo(e,n)}}))},nc),Hh=(ec.prototype.l_=function(t){this.c_.push(t)},ec.prototype.a_=function(){this.c_.forEach(function(t){return t()})},n(tc,Gh=ec),tc),Wh=($h.d_=function(t){return new $h(t)},Object.defineProperty($h.prototype,"w_",{get:function(){if(this.f_)return this.f_;throw Ks()},enumerable:!0,configurable:!0}),$h.prototype.to=function(t,e,n){return this.__.to(n,e),this.w_.delete(n),hu.resolve()},$h.prototype.eo=function(t,e,n){return this.__.eo(n,e),this.w_.add(n),hu.resolve()},$h.prototype.Dl=function(t,e){return this.w_.add(e),hu.resolve()},$h.prototype.removeTarget=function(t,e){var n=this;this.__.Po(e.targetId).forEach(function(t){return n.w_.add(t)});var r=this.persistence.Eh();return r.lo(t,e.targetId).next(function(t){t.forEach(function(t){return n.w_.add(t)})}).next(function(){return r.Yl(t,e)})},$h.prototype.h_=function(){this.f_=new Set},$h.prototype.o_=function(t){var n=this,r=this.persistence.wh().Ch();return hu.forEach(this.w_,function(e){return n.T_(t,e).next(function(t){t||r.Hh(e)})}).next(function(){return n.f_=null,r.apply(t)})},$h.prototype.zh=function(t,e){var n=this;return this.T_(t,e).next(function(t){t?n.w_.delete(e):n.w_.add(e)})},$h.prototype.i_=function(t){return 0},$h.prototype.T_=function(t,e){var n=this;return hu.Sn([function(){return hu.resolve(n.__.yo(e))},function(){return n.persistence.Eh().yo(t,e)},function(){return n.persistence.u_(t,e)}])},$h),Qh=(Jh.prototype.initialize=function(n){return d(this,void 0,void 0,function(){var e=this;return y(this,function(t){switch(t.label){case 0:return this.Cc=this.E_(n),this.persistence=this.m_(n),[4,this.persistence.start()];case 1:return t.sent(),this.I_=this.R_(n),this.Za=this.A_(n),this.Pc=this.P_(n),this.bu=this.V_(n),this.p_=this.y_(n),this.Cc.Wa=function(t){return e.bu.mc(t,1)},this.Pc.bu=this.bu,[4,this.Za.start()];case 2:return t.sent(),[4,this.Cc.start()];case 3:return t.sent(),[4,this.Pc.start()];case 4:return t.sent(),[4,this.Pc.Qu(this.bu.Uc)];case 5:return t.sent(),[2]}})})},Jh.prototype.y_=function(t){return new mh(this.bu)},Jh.prototype.R_=function(t){return null},Jh.prototype.A_=function(t){return new qu(this.persistence,new bh,t.g_)},Jh.prototype.m_=function(t){return new zh(Wh.d_)},Jh.prototype.P_=function(t){var e=this;return new lh(this.Za,t.ka,t.Pr,function(t){return e.bu.mc(t,0)},t.platform.b_())},Jh.prototype.E_=function(t){return new dh},Jh.prototype.V_=function(t){return new gh(this.Za,this.Pc,this.Cc,t.g_,t.Dc)},Jh.prototype.clearPersistence=function(t){throw new Sr(Rr.FAILED_PRECONDITION,"You are using the memory-only build of Firestore. Persistence support is only available via the @firebase/firestore bundle or the firebase-firestore.js build.")},Jh),Yh=(Kh.prototype.start=function(e,n){var r=this;this.S_();var i=new Eu,o=new Eu,s=!1;return this.credentials._(function(t){if(!s)return s=!0,Ys("FirestoreClient","Initializing. user=",t.uid),r.C_(e,n,t,o).then(i.resolve,i.reject);r.Pr.jr(function(){return r.Uu(t)})}),this.Pr.Sr(function(){return i.promise}),o.promise},Kh.prototype.enableNetwork=function(){var t=this;return this.S_(),this.Pr.enqueue(function(){return t.bu.enableNetwork()})},Kh.prototype.C_=function(a,h,c,f){return d(this,void 0,void 0,function(){var r,i,o,s,u=this;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,this.platform.D_(this.v_)];case 1:return r=t.sent(),i=this.platform.Ho(this.v_.ii),e=r,n=this.credentials,o=new hh(e,n,i),[4,a.initialize({Pr:this.Pr,v_:this.v_,platform:this.platform,ka:o,clientId:this.clientId,g_:c,Dc:100,F_:h})];case 2:return t.sent(),this.persistence=a.persistence,this.Cc=a.Cc,this.Za=a.Za,this.Pc=a.Pc,this.bu=a.bu,this.I_=a.I_,this.N_=a.p_,this.persistence.r_(function(){return d(u,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return[4,this.terminate()];case 1:return t.sent(),[2]}})})}),f.resolve(),[3,4];case 3:if(s=t.sent(),f.reject(s),!this.k_(s))throw s;return[2,(console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+s),this.C_(new Qh,{L_:!1},c,f))];case 4:return[2]}var e,n})})},Kh.prototype.k_=function(t){return"FirebaseError"===t.name?t.code===Rr.FAILED_PRECONDITION||t.code===Rr.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code},Kh.prototype.S_=function(){if(this.Pr.Mr)throw new Sr(Rr.FAILED_PRECONDITION,"The client has already been terminated.")},Kh.prototype.Uu=function(t){return this.Pr.Hr(),Ys("FirestoreClient","Credential Changed. Current user: "+t.uid),this.bu.Uu(t)},Kh.prototype.disableNetwork=function(){var t=this;return this.S_(),this.Pr.enqueue(function(){return t.bu.disableNetwork()})},Kh.prototype.terminate=function(){var t=this;return this.Pr.Wr(function(){return d(t,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.I_&&this.I_.stop(),[4,this.Pc.Vu()];case 1:return t.sent(),[4,this.Cc.Vu()];case 2:return t.sent(),[4,this.persistence.Vu()];case 3:return t.sent(),this.credentials.T(),[2]}})})})},Kh.prototype.waitForPendingWrites=function(){var t=this;this.S_();var e=new Eu;return this.Pr.Sr(function(){return t.bu.Zc(e)}),e.promise},Kh.prototype.listen=function(t,e,n){var r=this;this.S_();var i=new wh(t,e,n);return this.Pr.Sr(function(){return r.N_.listen(i)}),i},Kh.prototype.yu=function(t){var e=this;this.O_||this.Pr.Sr(function(){return e.N_.yu(t)})},Kh.prototype.q_=function(o){return d(this,void 0,void 0,function(){var i,e=this;return y(this,function(t){switch(t.label){case 0:return this.S_(),i=new Eu,[4,this.Pr.enqueue(function(){return d(e,void 0,void 0,function(){var e,n,r;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.Za.no(o)];case 1:return(e=t.sent())instanceof Eo?i.resolve(e):e instanceof Io?i.resolve(null):i.reject(new Sr(Rr.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")),[3,3];case 2:return n=t.sent(),r=Cu(n,"Failed to get document '"+o+" from cache"),i.reject(r),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),i.promise)]}})})},Kh.prototype.M_=function(a){return d(this,void 0,void 0,function(){var u,e=this;return y(this,function(t){switch(t.label){case 0:return this.S_(),u=new Eu,[4,this.Pr.enqueue(function(){return d(e,void 0,void 0,function(){var e,n,r,i,o,s;return y(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.Za.co(a,!0)];case 1:return e=t.sent(),n=new yh(a,e._o),r=n.cc(e.documents),i=n.dc(r,!1),u.resolve(i.snapshot),[3,3];case 2:return o=t.sent(),s=Cu(o,"Failed to execute query '"+a+" against cache"),u.reject(s),[3,3];case 3:return[2]}})})})];case 1:return[2,(t.sent(),u.promise)]}})})},Kh.prototype.write=function(t){var e=this;this.S_();var n=new Eu;return this.Pr.Sr(function(){return e.bu.write(t,n)}),n.promise},Kh.prototype.ii=function(){return this.v_.ii},Kh.prototype._l=function(t){var e=this;this.S_(),this.Pr.Sr(function(){return e.N_._l(t),Promise.resolve()})},Kh.prototype.fl=function(t){var e=this;this.O_||this.Pr.Sr(function(){return e.N_.fl(t),Promise.resolve()})},Object.defineProperty(Kh.prototype,"O_",{get:function(){return this.Pr.Mr},enumerable:!0,configurable:!0}),Kh.prototype.transaction=function(t){var e=this;this.S_();var n=new Eu;return this.Pr.Sr(function(){return e.bu.runTransaction(e.Pr,t,n),Promise.resolve()}),n.promise},Kh),Zh=(Xh.prototype.next=function(t){this.x_(this.observer.next,t)},Xh.prototype.error=function(t){this.x_(this.observer.error,t)},Xh.prototype.B_=function(){this.muted=!0},Xh.prototype.x_=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},Xh);function Xh(t){this.observer=t,this.muted=!1}function Kh(t,e,n,r){this.platform=t,this.v_=e,this.credentials=n,this.Pr=r,this.clientId=tu.cn()}function Jh(){}function $h(t){this.persistence=t,this.__=new Fu,this.f_=null}function tc(t){var e=this;return(e=Gh.call(this)||this).Wh=t,e}function ec(){this.c_=[]}function nc(t){var e=this;this.t_={},this.e_=new lu(0),this.s_=!1,this.s_=!0,this.Yh=t(this),this.Th=new Bh(this),this.Fn=new Tu,this.Cn=new Ih(this.Fn,function(t){return e.Yh.i_(t)})}function rc(t){this.persistence=t,this.Wl=new su(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=Vr.min(),this.highestTargetId=0,this.jl=0,this.Gl=new Fu,this.targetCount=0,this.Hl=Nu.Rr()}function ic(i){return function(){if("object"==typeof i&&null!==i)for(var t=i,e=0,n=["next","error","complete"];e=",">","array-contains","in","array-contains-any"],e),o=Ya("Query.where",t);if(o.Y()){if("array-contains"===i||"array-contains-any"===i)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i){this.bf(n,i);for(var s=[],u=0,a=n;ur.length)throw new Sr(Rr.INVALID_ARGUMENT,"Too many arguments provided to "+t+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var i=[],o=0;o, or >=) must be on the same field. But you have inequality filters on '"+o.toString()+"' and '"+t.field.toString()+"'");var s=this.gf.Gt();null!==s&&this.kf(t.field,s)}else if(i||r){var u=null;if(i&&(u=this.gf.ce(n)),null===u&&r&&(u=this.gf.ce(e)),null!=u)throw u===t.op?new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+t.op.toString()+"' filter."):new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You cannot use '"+t.op.toString()+"' filters with '"+u.toString()+"' filters.")}}},Ic.prototype.Cf=function(t){if(null===this.gf.Gt()){var e=this.gf.jt();null!==e&&this.kf(e,t.field)}},Ic.prototype.kf=function(t,e){if(!e.isEqual(t))throw new Sr(Rr.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+t.toString()+"' and so you must also use '"+t.toString()+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+e.toString()+"' instead.")},Ic),mc=(Object.defineProperty(Ec.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),Object.defineProperty(Ec.prototype,"empty",{get:function(){return this.Of.docs.M()},enumerable:!0,configurable:!0}),Object.defineProperty(Ec.prototype,"size",{get:function(){return this.Of.docs.size},enumerable:!0,configurable:!0}),Ec.prototype.forEach=function(e,n){var r=this;Yu("QuerySnapshot.forEach",arguments,1,2),Zu("QuerySnapshot.forEach","function",1,e),this.Of.docs.forEach(function(t){e.call(n,r.xf(t))})},Object.defineProperty(Ec.prototype,"query",{get:function(){return new gc(this.Lf,this.wf,this.Ef)},enumerable:!0,configurable:!0}),Ec.prototype.docChanges=function(t){t&&(ia("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),Ju("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this.Of.hs)throw new Sr(Rr.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this.qf&&this.Mf===e||(this.qf=function(i,e,o,s){if(o.ss.M()){var n=0;return o.docChanges.map(function(t){var e=new vc(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s);return t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:n++}})}var u=o.ss;return o.docChanges.filter(function(t){return e||3!==t.type}).map(function(t){var e=new vc(i,t.doc.key,t.doc,o.fromCache,o.ns.has(t.doc.key),s),n=-1,r=-1;return 0!==t.type&&(n=u.indexOf(t.doc.key),u=u.delete(t.doc.key)),1!==t.type&&(r=(u=u.add(t.doc)).indexOf(t.doc.key)),{type:function(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ks()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this.wf,e,this.Of,this.Ef),this.Mf=e),this.qf},Ec.prototype.isEqual=function(t){if(!(t instanceof Ec))throw oa("isEqual","QuerySnapshot",1,t);return this.wf===t.wf&&this.Lf.isEqual(t.Lf)&&this.Of.isEqual(t.Of)&&this.Ef===t.Ef},Ec.prototype.xf=function(t){return new vc(this.wf,t.key,t,this.metadata.fromCache,this.Of.ns.has(t.key),this.Ef)},Ec),wc=(n(bc,oc=gc),Object.defineProperty(bc.prototype,"id",{get:function(){return this.gf.path.q()},enumerable:!0,configurable:!0}),Object.defineProperty(bc.prototype,"parent",{get:function(){var t=this.gf.path.L();return t.M()?null:new pc(new Xr(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(bc.prototype,"path",{get:function(){return this.gf.path.j()},enumerable:!0,configurable:!0}),bc.prototype.doc=function(t){if(Yu("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=tu.cn()),Zu("CollectionReference.doc","non-empty string",1,t),""===t)throw new Sr(Rr.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=Mr.G(t);return pc.ff(this.gf.path.child(e),this.firestore,this.Ef)},bc.prototype.add=function(t){Wu("CollectionReference.add",arguments,1),Zu("CollectionReference.add","object",1,this.Ef?this.Ef.toFirestore(t):t);var e=this.doc();return e.set(t).then(function(){return e})},bc.prototype.withConverter=function(t){return new bc(this.Bf,this.firestore,t)},bc);function bc(t,e,n){var r=this;if(((r=oc.call(this,No.Wt(t),e,n)||this).Bf=t).length%2!=1)throw new Sr(Rr.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.j()+" has "+t.length);return r}function Ec(t,e,n,r){this.wf=t,this.Lf=e,this.Of=n,this.Ef=r,this.qf=null,this.Mf=null,this.metadata=new dc(n.hasPendingWrites,n.fromCache)}function Ic(t,e,n){this.gf=t,this.firestore=e,this.Ef=n}function Tc(){return null!==sc&&sc.apply(this,arguments)||this}function Ac(t,e,n,r,i,o){this.wf=t,this.ea=e,this.Vf=n,this.pf=r,this.yf=i,this.Ef=o}function Nc(t,e){this.hasPendingWrites=t,this.fromCache=e}function _c(t,e,n){this.ea=t,this.firestore=e,this.Ef=n,this.Z_=this.firestore.J_()}function Rc(t){this.wf=t,this.mf=[],this.If=!1}function Sc(t,e){this.wf=t,this.Tf=e}function Dc(t,e,n){var r=this;if(void 0===n&&(n=new Qh),this.Y_=null,this.X_=new ku,this.INTERNAL={delete:function(){return d(r,void 0,void 0,function(){return y(this,function(t){switch(t.label){case 0:return this.J_(),[4,this.Z_.terminate()];case 1:return t.sent(),[2]}})})}},"object"==typeof t.options){var i=t;this.Y_=i,this.ta=Dc.tf(i),this.ef=i.name,this.sf=new Or(e)}else{var o=t;if(!o.projectId)throw new Sr(Rr.INVALID_ARGUMENT,"Must provide projectId");this.ta=new ou(o.projectId,o.database),this.ef="[DEFAULT]",this.sf=new Dr}this.if=n,this.nf=new hc({})}function Oc(t){var e,n,r,i;if(void 0===t.host){if(void 0!==t.ssl)throw new Sr(Rr.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else Ku("settings","non-empty string","host",t.host),this.host=t.host,Ju("settings","boolean","ssl",t.ssl),this.ssl=null===(e=t.ssl)||void 0===e||e;if(ia("settings",t,["host","ssl","credentials","timestampsInSnapshots","cacheSizeBytes","experimentalForceLongPolling","ignoreUndefinedProperties"]),Ju("settings","object","credentials",t.credentials),this.credentials=t.credentials,Ju("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),Ju("settings","boolean","ignoreUndefinedProperties",t.ignoreUndefinedProperties),!0===t.timestampsInSnapshots?Zs("The setting 'timestampsInSnapshots: true' is no longer required and should be removed."):!1===t.timestampsInSnapshots&&Zs("Support for 'timestampsInSnapshots: false' will be removed soon. You must update your code to handle Timestamp objects."),this.timestampsInSnapshots=null===(n=t.timestampsInSnapshots)||void 0===n||n,this.ignoreUndefinedProperties=null!==(r=t.ignoreUndefinedProperties)&&void 0!==r&&r,Ju("settings","number","cacheSizeBytes",t.cacheSizeBytes),void 0===t.cacheSizeBytes)this.cacheSizeBytes=Mu.hh;else{if(t.cacheSizeBytes!==ac&&t.cacheSizeBytes() instead."),Zc=Uc(fa,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),Xc={Firestore:xc,GeoPoint:Ra,Timestamp:Lr,Blob:Zc,Transaction:jc,WriteBatch:Fc,DocumentReference:Gc,DocumentSnapshot:Bc,Query:Hc,QueryDocumentSnapshot:zc,QuerySnapshot:Wc,CollectionReference:Qc,FieldPath:la,FieldValue:Yc,setLogLevel:cc.setLogLevel,CACHE_SIZE_UNLIMITED:ac},Kc=(uf.prototype.ru=function(t){},uf.prototype.Vu=function(){},uf),Jc=(sf.prototype.ru=function(t){this.Gf.push(t)},sf.prototype.Vu=function(){window.removeEventListener("online",this.Uf),window.removeEventListener("offline",this.Wf)},sf.prototype.Hf=function(){window.addEventListener("online",this.Uf),window.addEventListener("offline",this.Wf)},sf.prototype.Qf=function(){Ys("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.Gf;t