!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(Dh){"use strict";try{(function(){var o,t;Dh=Dh&&Dh.hasOwnProperty("default")?Dh.default:Dh,(t=o||(o={}))[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT";var e=o.INFO,n=function(t,e){for(var n=[],r=2;ra[0]&&e[1]"})):"Error",u=this.serviceName+": "+s+" ("+o+").",c=new d(o,u),h=0,l=Object.keys(i);h>>0),D=0;function N(t,e,n){return t.call.apply(t.bind,arguments)}function A(e,n,t){if(!e)throw Error();if(2parseFloat(ot)){X=String(st);break t}}X=ot}var ut,ct={};function ht(s){return t=s,e=function(){for(var t=0,e=U(String(X)).split("."),n=U(String(s)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i>>0);function Lt(e){return"function"==E(e)?e:(e[Pt]||(e[Pt]=function(t){return e.handleEvent(t)}),e[Pt])}function xt(){_.call(this),this.c=new St(this),(this.J=this).B=null}function qt(t,e,n,r){if(!(e=t.c.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;oe.length?Ce:(e=e.substr(r,n),t.A=r+n,e))}function Me(t){t.R=M()+t.O,Oe(t,t.O)}function Oe(t,e){if(null!=t.i)throw Error("WatchDog timer not null");t.i=le(k(t.bb,t),e)}function _e(t){t.i&&(y.clearTimeout(t.i),t.i=null)}function Pe(t){t.g.Da()||t.m||t.g.na(t)}function Le(t){_e(t);var e=t.B;e&&"function"==typeof e.la&&e.la(),t.B=null,Xt(t.P),re(t.I),t.a&&(e=t.a,t.a=null,e.abort(),e.la())}function xe(t,e){try{t.g.Ga(t,e),se(4)}catch(t){}}function qe(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(T(t)||g(t))L(t,e,void 0);else{if(t.K&&"function"==typeof t.K)var n=t.K();else if(t.C&&"function"==typeof t.C)n=void 0;else if(T(t)||g(t)){n=[];for(var r=t.length,i=0;i2*t.c&&Ue(t))}function Ue(t){if(t.c!=t.a.length){for(var e=0,n=0;e>4&15).toString(16)+(15&t).toString(16)}Ke.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Ze(e,en,!0),":");var n=this.b;return(n||"file"==e)&&(t.push("//"),(e=this.j)&&t.push(Ze(e,en,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.i)&&t.push(":",String(n))),(n=this.a)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(Ze(n,"/"==n.charAt(0)?rn:nn,!0))),(n=this.c.toString())&&t.push("?",n),(n=this.g)&&t.push("#",Ze(n,an)),t.join("")},Ke.prototype.resolve=function(t){var e=je(this),n=!!t.f;n?Ge(e,t.f):n=!!t.j,n?e.j=t.j:n=!!t.b,n?We(e,t.b):n=null!=t.i;var r=t.a;if(n)ze(e,t.i);else if(n=!!t.a){if("/"!=r.charAt(0))if(this.b&&!this.a)r="/"+r;else{var i=e.a.lastIndexOf("/");-1!=i&&(r=e.a.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(B(i,"./")||B(i,"/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],a=0;a=t.f}function In(t){return t.b?1:t.a?t.a.a.c:0}function Cn(t,e){return t=t.b?t.b==e:!!t.a&&(e=vn(e),Be(t.a.a.b,e))}function Dn(t,e){t.a?t.a.add(e):t.b=e}function Nn(t,e){var n;t.b&&t.b==e?t.b=null:((n=t.a)&&(n=vn(e),n=Be(t.a.a.b,n)),n&&Ve(t.a.a,vn(e)))}function An(t){if(null!=t.b)return t.c.concat(t.b.j);if(null==t.a||0==t.a.a.c)return q(t.c);var e=t.c;return L(t.a.C(),function(t){e=e.concat(t.j)}),e}function kn(){}function Rn(){this.a=new kn}function Mn(t,r,e){var i=e||"";try{qe(t,function(t,e){var n=t;I(t)&&(n=Ft(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){}}wn.prototype.cancel=function(){var t;this.c=An(this),this.b?(this.b.cancel(),this.b=null):this.a&&0!=this.a.a.c&&(L(this.a.C(),function(t){t.cancel()}),(t=this.a.a).b={},t.a.length=0,t.c=0)},kn.prototype.stringify=function(t){return y.JSON.stringify(t,void 0)},kn.prototype.parse=function(t){return y.JSON.parse(t,void 0)};var _n=y.JSON.parse;function Pn(t){xt.call(this),this.headers=new Fe,this.H=t||null,this.b=!1,this.s=this.a=null,this.A="",this.h=0,this.f="",this.g=this.w=this.l=this.v=!1,this.o=0,this.m=null,this.I=Ln,this.D=this.F=!1}O(Pn,xt);var Ln="",xn=/^https?$/i,qn=["POST","PUT"];function Fn(t){return"content-type"==t.toLowerCase()}function Vn(t,e){t.b=!1,t.a&&(t.g=!0,t.a.abort(),t.g=!1),t.f=e,t.h=5,Un(t),Qn(t)}function Un(t){t.v||(t.v=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function Bn(t){if(t.b&&void 0!==f&&(!t.s[1]||4!=jn(t)||2!=t.T()))if(t.l&&4==jn(t))Jt(t.Fa,0,t);else if(t.dispatchEvent("readystatechange"),4==jn(t)){t.b=!1;try{var e,n=t.T();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var o=String(t.A).match(Qe)[1]||null;if(!o&&y.self&&y.self.location){var a=y.self.location.protocol;o=a.substr(0,a.length-1)}i=!xn.test(o?o.toLowerCase():"")}e=i}e?(t.dispatchEvent("complete"),t.dispatchEvent("success")):(t.h=6,t.f=t.za()+" ["+t.T()+"]",Un(t))}finally{Qn(t)}}}function Qn(t,e){if(t.a){Kn(t);var n=t.a,r=t.s[0]?w:null;t.a=null,t.s=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){}}}function Kn(t){t.a&&t.D&&(t.a.ontimeout=null),t.m&&(y.clearTimeout(t.m),t.m=null)}function jn(t){return t.a?t.a.readyState:0}function Gn(t,e){return t.a?t.a.getResponseHeader(e):null}function Wn(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}if(r)return t;var i;if(i="",G(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,g(t)){if(e=encodeURIComponent(String(e)),e+=n=null!=n?"="+encodeURIComponent(String(n)):""){if((n=t.indexOf("#"))<0&&(n=t.length),(r=t.indexOf("?"))<0||n=e.b.f-(e.h?1:0)||(e.h?(e.f=n.j.concat(e.f),0):1==e.u||2==e.u||e.A>=(e.Pa?0:e.Qa)||(e.h=le(k(e.Ia,e,n),or(e,e.A)),e.A++,0))))&&(2!=i||!nr(this)))switch(r&&0r)throw new xr(Lr.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+ai(e.length,"argument")+".")}function zr(t,e,n,r){Zr(t,e,oi(n)+" argument",r)}function Hr(t,e,n,r){void 0!==r&&zr(t,e,n,r)}function Yr(t,e,n,r){Zr(t,e,n+" option",r)}function Xr(t,e,n,r){void 0!==r&&Yr(t,e,n,r)}function Jr(t,e,n,r,i){void 0!==r&&function(t,e,n,r,i){if(!(r instanceof Array))throw new xr(Lr.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+ei(r));for(var o=0;ot.length&&Mr("offset "+e+" out of range "+t.length),void 0===n?n=t.length-e:n>t.length-e&&Mr("length "+n+" out of range "+(t.length-e)),this.segments=t,this.offset=e,this.len=n},n.prototype.construct=function(t,e,n){var r=Object.create(Object.getPrototypeOf(this));return r.init(t,e,n),r},Object.defineProperty(n.prototype,"length",{get:function(){return this.len},enumerable:!0,configurable:!0}),n.prototype.isEqual=function(t){return 0===n.comparator(this,t)},n.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof n?t.forEach(function(t){e.push(t)}):"string"==typeof t?e.push(t):Mr("Unknown parameter type for Path.child(): "+t),this.construct(e)},n.prototype.limit=function(){return this.offset+this.length},n.prototype.popFirst=function(t){return t=void 0===t?1:t,Or(this.length>=t,"Can't call popFirst() with less segments"),this.construct(this.segments,this.offset+t,this.length-t)},n.prototype.popLast=function(){return Or(!this.isEmpty(),"Can't call popLast() on empty path"),this.construct(this.segments,this.offset,this.length-1)},n.prototype.firstSegment=function(){return Or(!this.isEmpty(),"Can't call firstSegment() on empty path"),this.segments[this.offset]},n.prototype.lastSegment=function(){return this.get(this.length-1)},n.prototype.get=function(t){return Or(te.length?1:0},n}(),Ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.canonicalString=function(){return this.toArray().join("/")},e.prototype.toString=function(){return this.canonicalString()},e.fromString=function(t){if(0<=t.indexOf("//"))throw new xr(Lr.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new e(t.split("/").filter(function(t){return 0=i,"Should have found mutation after "+i),o=r.serializer.fromDbMutationBatch(e)),n.done()}).next(function(){return o})},i.prototype.getAllMutationBatches=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return ho(t).loadAll(Jo.userMutationsIndex,n).next(function(t){return t.map(function(t){return e.serializer.fromDbMutationBatch(t)})})},i.prototype.getAllMutationBatchesAffectingDocumentKey=function(s,u){var c=this,t=$o.prefixForPath(this.userId,u.path),e=IDBKeyRange.lowerBound(t),h=[];return lo(s).iterate({range:e},function(e,t,n){var r=e[0],i=e[1],o=e[2],a=qi(i);if(r===c.userId&&u.path.isEqual(a))return ho(s).get(o).next(function(t){if(!t)throw Mr("Dangling document-mutation reference found: "+e+" which points to "+o);Or(t.userId===c.userId,"Unexpected user '"+t.userId+"' for mutation batch "+o),h.push(c.serializer.fromDbMutationBatch(t))});n.done()}).next(function(){return h})},i.prototype.getAllMutationBatchesAffectingDocumentKeys=function(r,t){var u=this,c=new ji(ui),i=[];return t.forEach(function(s){var t=$o.prefixForPath(u.userId,s.path),e=IDBKeyRange.lowerBound(t),n=lo(r).iterate({range:e},function(t,e,n){var r=t[0],i=t[1],o=t[2],a=qi(i);r===u.userId&&s.path.isEqual(a)?c=c.add(o):n.done()});i.push(n)}),oo.waitFor(i).next(function(){return u.lookupMutationBatches(r,c)})},i.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var s=this;Or(!e.isDocumentQuery(),"Document queries shouldn't go down this path"),Or(!e.isCollectionGroupQuery(),"CollectionGroup queries should be handled in LocalDocumentsView");var u=e.path,c=u.length+1,n=$o.prefixForPath(this.userId,u),r=IDBKeyRange.lowerBound(n),h=new ji(ui);return lo(t).iterate({range:r},function(t,e,n){var r=t[0],i=t[1],o=t[2],a=qi(i);r===s.userId&&u.isPrefixOf(a)?a.length===c&&(h=h.add(o)):n.done()}).next(function(){return s.lookupMutationBatches(t,h)})},i.prototype.lookupMutationBatches=function(t,e){var n=this,r=[],i=[];return e.forEach(function(e){i.push(ho(t).get(e).next(function(t){if(null===t)throw Mr("Dangling document-mutation reference found, which points to "+e);Or(t.userId===n.userId,"Unexpected user '"+t.userId+"' for mutation batch "+e),r.push(n.serializer.fromDbMutationBatch(t))}))}),oo.waitFor(i).next(function(){return r})},i.prototype.removeMutationBatch=function(e,n){var r=this;return uo(e.simpleDbTransaction,this.userId,n).next(function(t){return r.removeCachedMutationKeys(n.batchId),oo.forEach(t,function(t){return r.referenceDelegate.removeMutationReference(e,t)})})},i.prototype.removeCachedMutationKeys=function(t){delete this.documentKeysByBatchId[t]},i.prototype.performConsistencyCheck=function(n){var o=this;return this.checkEmpty(n).next(function(t){if(!t)return oo.resolve();var e=IDBKeyRange.lowerBound($o.prefixForUser(o.userId)),i=[];return lo(n).iterate({range:e},function(t,e,n){if(t[0]===o.userId){var r=qi(t[1]);i.push(r)}else n.done()}).next(function(){Or(0===i.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+i.map(function(t){return t.canonicalString()}))})})},i.prototype.containsKey=function(t,e){return so(t,this.userId,e)},i.prototype.getMutationQueueMetadata=function(t){var e=this;return fo(t).get(this.userId).next(function(t){return t||new Xo(e.userId,-1,"")})},i}();function so(t,o,e){var n=$o.prefixForPath(o,e.path),a=n[1],r=IDBKeyRange.lowerBound(n),s=!1;return lo(t).iterate({range:r,keysOnly:!0},function(t,e,n){var r=t[0],i=t[1];t[2];r===o&&i===a&&(s=!0),n.done()}).next(function(){return s})}function uo(t,e,n){var r=t.store(Jo.store),i=t.store($o.store),o=[],a=IDBKeyRange.only(n.batchId),s=0,u=r.iterate({range:a},function(t,e,n){return s++,n.delete()});o.push(u.next(function(){Or(1===s,"Dangling document-mutation reference found: Missing batch "+n.batchId)}));for(var c=[],h=0,l=n.mutations;h",t),this.store.put(t)))},t.prototype.add=function(t){return Ar(go,"ADD",this.store.name,t,t),So(this.store.add(t))},t.prototype.get=function(e){var n=this;return So(this.store.get(e)).next(function(t){return void 0===t&&(t=null),Ar(go,"GET",n.store.name,e,t),t})},t.prototype.delete=function(t){return Ar(go,"DELETE",this.store.name,t),So(this.store.delete(t))},t.prototype.count=function(){return Ar(go,"COUNT",this.store.name),So(this.store.count())},t.prototype.loadAll=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.iterateCursor(n,function(t,e){r.push(e)}).next(function(){return r})},t.prototype.deleteAll=function(t,e){Ar(go,"DELETE ALL",this.store.name);var n=this.options(t,e);n.keysOnly=!1;var r=this.cursor(n);return this.iterateCursor(r,function(t,e,n){return n.delete()})},t.prototype.iterate=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.iterateCursor(r,e)},t.prototype.iterateSerial=function(i){var t=this.cursor({});return new oo(function(n,r){t.onerror=function(t){var e=Io(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()}})},t.prototype.iterateCursor=function(t,a){var s=[];return new oo(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 bo(e),r=a(e.primaryKey,e.value,n);if(r instanceof oo){var i=r.catch(function(t){return n.done(),oo.reject(t)});s.push(i)}n.isDone?o():null===n.skipToKey?e.continue():e.continue(n.skipToKey)}else o()}}).next(function(){return oo.waitFor(s)})},t.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"==typeof t?n=t:(Or(void 0===e,"3rd argument must not be defined if 2nd is a range."),e=t)),{index:n,range:e}},t.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.keysOnly?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},t}();function So(t){return new oo(function(n,r){t.onsuccess=function(t){var e=t.target.result;n(e)},t.onerror=function(t){var e=Io(t.target.error);r(e)}})}var To=!1;function Io(t){var e=vo.getIOSVersion(a());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 xr("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 To||(To=!0,setTimeout(function(){throw r},0)),r}}return t}var Co=function(){function t(t,e){this.referenceDelegate=t,this.serializer=e,this.targetIdGenerator=yo.forQueryCache()}return t.prototype.allocateTargetId=function(e){var n=this;return this.retrieveMetadata(e).next(function(t){return t.highestTargetId=n.targetIdGenerator.after(t.highestTargetId),n.saveMetadata(e,t).next(function(){return t.highestTargetId})})},t.prototype.getLastRemoteSnapshotVersion=function(t){return this.retrieveMetadata(t).next(function(t){return Vi.fromTimestamp(new Fi(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},t.prototype.getHighestSequenceNumber=function(t){return Ao(t.simpleDbTransaction)},t.prototype.setTargetsMetadata=function(e,n,r){var i=this;return this.retrieveMetadata(e).next(function(t){return t.highestListenSequenceNumber=n,r&&(t.lastRemoteSnapshotVersion=r.toTimestamp()),n>t.highestListenSequenceNumber&&(t.highestListenSequenceNumber=n),i.saveMetadata(e,t)})},t.prototype.addQueryData=function(e,n){var r=this;return this.saveQueryData(e,n).next(function(){return r.retrieveMetadata(e).next(function(t){return t.targetCount+=1,r.updateMetadataFromQueryData(n,t),r.saveMetadata(e,t)})})},t.prototype.updateQueryData=function(t,e){return this.saveQueryData(t,e)},t.prototype.removeQueryData=function(e,t){var n=this;return this.removeMatchingKeysForTargetId(e,t.targetId).next(function(){return Do(e).delete(t.targetId)}).next(function(){return n.retrieveMetadata(e)}).next(function(t){return Or(0e.highestTargetId&&(e.highestTargetId=t.targetId,n=!0),t.sequenceNumber>e.highestListenSequenceNumber&&(e.highestListenSequenceNumber=t.sequenceNumber,n=!0),n},t.prototype.getQueryCount=function(t){return this.retrieveMetadata(t).next(function(t){return t.targetCount})},t.prototype.getQueryData=function(t,i){var o=this,e=i.canonicalId(),n=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),a=null;return Do(t).iterate({range:n,index:ra.queryTargetsIndexName},function(t,e,n){var r=o.serializer.fromDbTarget(e);i.isEqual(r.query)&&(a=r,n.done())}).next(function(){return a})},t.prototype.addMatchingKeys=function(n,t,r){var i=this,o=[],a=ko(n);return t.forEach(function(t){var e=Pi(t.path);o.push(a.put(new ia(r,e))),o.push(i.referenceDelegate.addReference(n,t))}),oo.waitFor(o)},t.prototype.removeMatchingKeys=function(n,t,r){var i=this,o=ko(n);return oo.forEach(t,function(t){var e=Pi(t.path);return oo.waitFor([o.delete([r,e]),i.referenceDelegate.removeReference(n,t)])})},t.prototype.removeMatchingKeysForTargetId=function(t,e){var n=ko(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return n.delete(r)},t.prototype.getMatchingKeysForTargetId=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=ko(t),o=to();return r.iterate({range:n,keysOnly:!0},function(t,e,n){var r=qi(t[1]),i=new Di(r);o=o.add(i)}).next(function(){return o})},t.prototype.containsKey=function(t,e){var n=Pi(e.path),r=IDBKeyRange.bound([n],[hi(n)],!1,!0),i=0;return ko(t).iterate({index:ia.documentTargetsIndex,keysOnly:!0,range:r},function(t,e,n){var r=t[0];t[1];0!==r&&(i++,n.done())}).next(function(){return 0l.params.maximumSequenceNumbersToCollect?(Ar("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+l.params.maximumSequenceNumbersToCollect+" from "+t),l.params.maximumSequenceNumbersToCollect):t,s=Date.now(),l.nthSequenceNumber(e,i)}).next(function(t){return r=t,u=Date.now(),l.removeTargets(e,r,n)}).next(function(t){return o=t,c=Date.now(),l.removeOrphanedDocuments(e,r)}).next(function(t){(h=Date.now(),Dr()<=yr.DEBUG)&&Ar("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-a)+"ms\n\tDetermined least recently used "+i+" in "+(u-s)+"ms\n\tRemoved "+o+" targets in "+(c-u)+"ms\n\tRemoved "+t+" documents in "+(h-c)+"ms\nTotal Duration: "+(h-a)+"ms");return oo.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:t})})},t}(),Ta="IndexedDbPersistence",Ia="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",Ca="Another tab has exclusive access to the persistence layer. To allow shared access, make sure to invoke `enablePersistence()` with `synchronizeTabs:true` in all tabs.",Da=function(r){function t(t,e){var n=r.call(this)||this;return n.simpleDbTransaction=t,n.currentSequenceNumber=e,n}return s(t,r),t}(function(){}),Na=function(){function c(t,e,n,r,i,o,a){if(this.persistenceKey=t,this.clientId=e,this.queue=r,this.multiClientParams=a,this._started=!1,this.isPrimary=!1,this.networkEnabled=!0,this.inForeground=!1,this.lastGarbageCollectionTime=Number.NEGATIVE_INFINITY,this.primaryStateListener=function(t){return Promise.resolve()},!c.isAvailable())throw new xr(Lr.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");if(this.referenceDelegate=new La(this,o),this.dbName=t+c.MAIN_DATABASE,this.serializer=new ya(i),this.document=n.document,this.allowTabSynchronization=void 0!==a,this.queryCache=new Co(this.referenceDelegate,this.serializer),this.indexManager=new pa,this.remoteDocumentCache=new qo(this.serializer,this.indexManager,this.allowTabSynchronization),!n.window||!n.window.localStorage)throw new xr(Lr.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");this.window=n.window,this.webStorage=this.window.localStorage}return c.getStore=function(t,e){if(t instanceof Da)return vo.getStore(t.simpleDbTransaction,e);throw Mr("IndexedDbPersistence must use instances of IndexedDbTransaction")},c.createIndexedDbPersistence=function(n,r,i,o,a,s){return h(this,void 0,void 0,function(){var e;return p(this,function(t){switch(t.label){case 0:return[4,(e=new c(n,r,i,o,a,s)).start()];case 1:return t.sent(),[2,e]}})})},c.createMultiClientIndexedDbPersistence=function(n,r,i,o,a,s,u){return h(this,void 0,void 0,function(){var e;return p(this,function(t){switch(t.label){case 0:return[4,(e=new c(n,r,i,o,a,s,u)).start()];case 1:return t.sent(),[2,e]}})})},c.prototype.start=function(){var n=this;return Or(!this.started,"IndexedDbPersistence double-started!"),Or(null!==this.window,"Expected 'window' to be defined"),vo.openOrCreate(this.dbName,Wo,new zo(this.serializer)).then(function(t){return n.simpleDb=t,n.updateClientMetadataAndTryBecomePrimary()}).then(function(){return n.attachVisibilityHandler(),n.attachWindowUnloadHook(),n.scheduleClientMetadataAndPrimaryLeaseRefreshes(),n.startRemoteDocumentCache()}).then(function(){return n.simpleDb.runTransaction("readonly",[oa.store],function(t){return Ao(t).next(function(t){var e=n.multiClientParams?n.multiClientParams.sequenceNumberSyncer:void 0;n.listenSequence=new wi(t,e)})})}).then(function(){n._started=!0}).catch(function(t){return n.simpleDb&&n.simpleDb.close(),Promise.reject(t)})},c.prototype.startRemoteDocumentCache=function(){var e=this;return this.simpleDb.runTransaction("readonly",fa,function(t){return e.remoteDocumentCache.start(t)})},c.prototype.setPrimaryStateListener=function(n){var t=this;return this.primaryStateListener=function(e){return h(t,void 0,void 0,function(){return p(this,function(t){return this.started?[2,n(e)]:[2]})})},n(this.isPrimary)},c.prototype.setDatabaseDeletedListener=function(n){var t=this;this.simpleDb.setVersionChangeListener(function(e){return h(t,void 0,void 0,function(){return p(this,function(t){switch(t.label){case 0:return null!==e.newVersion?[3,2]:[4,n()];case 1:t.sent(),t.label=2;case 2:return[2]}})})})},c.prototype.setNetworkEnabled=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.queue.enqueueAndForget(function(){return h(e,void 0,void 0,function(){return p(this,function(t){switch(t.label){case 0:return this.started?[4,this.updateClientMetadataAndTryBecomePrimary()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})}))},c.prototype.updateClientMetadataAndTryBecomePrimary=function(){var r=this;return this.simpleDb.runTransaction("readwrite",fa,function(n){return Ra(n).put(new ca(r.clientId,Date.now(),r.networkEnabled,r.inForeground,r.remoteDocumentCache.lastProcessedDocumentChangeId)).next(function(){if(r.isPrimary)return r.verifyPrimaryLease(n).next(function(t){t||(r.isPrimary=!1,r.queue.enqueueAndForget(function(){return r.primaryStateListener(!1)}))})}).next(function(){return r.canActAsPrimary(n)}).next(function(t){var e=r.isPrimary;return r.isPrimary=t,e!==r.isPrimary&&r.queue.enqueueAndForget(function(){return r.primaryStateListener(r.isPrimary)}),e&&!r.isPrimary?r.releasePrimaryLeaseIfHeld(n):r.isPrimary?r.acquireOrExtendPrimaryLease(n):void 0})})},c.prototype.verifyPrimaryLease=function(t){var e=this;return ka(t).get(Yo.key).next(function(t){return oo.resolve(e.isLocalClient(t))})},c.prototype.removeClientMetadata=function(t){return Ra(t).delete(this.clientId)},c.prototype.maybeGarbageCollectMultiClientState=function(){return h(this,void 0,void 0,function(){var r,i,o=this;return p(this,function(t){switch(t.label){case 0:return!this.isPrimary||this.isWithinAge(this.lastGarbageCollectionTime,18e5)?[3,2]:(this.lastGarbageCollectionTime=Date.now(),i=[],[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(n){var e=c.getStore(n,ca.store);return e.loadAll().next(function(t){r=o.filterActiveClients(t,18e5),i=t.filter(function(t){return-1===r.indexOf(t)})}).next(function(){return oo.forEach(i,function(t){return e.delete(t.clientId)})}).next(function(){if(0<(r=r.filter(function(t){return t.clientId!==o.clientId})).length){var t=r.map(function(t){return t.lastProcessedDocumentChangeId||0}),e=Math.min.apply(Math,t);return o.remoteDocumentCache.removeDocumentChangesThroughChangeId(n,e)}})})]);case 1:t.sent(),i.forEach(function(t){o.window.localStorage.removeItem(o.zombiedClientLocalStorageKey(t.clientId))}),t.label=2;case 2:return[2]}})})},c.prototype.scheduleClientMetadataAndPrimaryLeaseRefreshes=function(){var t=this;this.clientMetadataRefresher=this.queue.enqueueAfterDelay(pi.ClientMetadataRefresh,4e3,function(){return t.updateClientMetadataAndTryBecomePrimary().then(function(){return t.maybeGarbageCollectMultiClientState()}).then(function(){return t.scheduleClientMetadataAndPrimaryLeaseRefreshes()})})},c.prototype.isLocalClient=function(t){return!!t&&t.ownerId===this.clientId},c.prototype.canActAsPrimary=function(e){var i=this;return ka(e).get(Yo.key).next(function(t){if(null!==t&&i.isWithinAge(t.leaseTimestampMs,5e3)&&!i.isClientZombied(t.ownerId)){if(i.isLocalClient(t)&&i.networkEnabled)return!0;if(!i.isLocalClient(t)){if(!t.allowTabSynchronization)throw new xr(Lr.FAILED_PRECONDITION,Ca);return!1}}return!(!i.networkEnabled||!i.inForeground)||Ra(e).loadAll().next(function(t){return void 0===i.filterActiveClients(t,5e3).find(function(t){if(i.clientId!==t.clientId){var e=!i.networkEnabled&&t.networkEnabled,n=!i.inForeground&&t.inForeground,r=i.networkEnabled===t.networkEnabled;if(e||n&&r)return!0}return!1})})}).next(function(t){return i.isPrimary!==t&&Ar(Ta,"Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},c.prototype.shutdown=function(){return h(this,void 0,void 0,function(){var e=this;return p(this,function(t){switch(t.label){case 0:return this._started=!1,this.markClientZombied(),this.clientMetadataRefresher&&this.clientMetadataRefresher.cancel(),this.detachVisibilityHandler(),this.detachWindowUnloadHook(),[4,this.simpleDb.runTransaction("readwrite",[Yo.store,ca.store],function(t){return e.releasePrimaryLeaseIfHeld(t).next(function(){return e.removeClientMetadata(t)})})];case 1:return t.sent(),this.simpleDb.close(),this.removeClientZombiedEntry(),[2]}})})},c.prototype.filterActiveClients=function(t,e){var n=this;return t.filter(function(t){return n.isWithinAge(t.updateTimeMs,e)&&!n.isClientZombied(t.clientId)})},c.prototype.getActiveClients=function(){var e=this;return this.simpleDb.runTransaction("readonly",[ca.store],function(t){return Ra(t).loadAll().next(function(t){return e.filterActiveClients(t,18e5).map(function(t){return t.clientId})})})},c.clearPersistence=function(n){return h(this,void 0,void 0,function(){var e;return p(this,function(t){switch(t.label){case 0:return c.isAvailable()?(e=n+c.MAIN_DATABASE,[4,vo.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})},Object.defineProperty(c.prototype,"started",{get:function(){return this._started},enumerable:!0,configurable:!0}),c.prototype.getMutationQueue=function(t){return Or(this.started,"Cannot initialize MutationQueue before persistence is started."),ao.forUser(t,this.serializer,this.indexManager,this.referenceDelegate)},c.prototype.getQueryCache=function(){return Or(this.started,"Cannot initialize QueryCache before persistence is started."),this.queryCache},c.prototype.getRemoteDocumentCache=function(){return Or(this.started,"Cannot initialize RemoteDocumentCache before persistence is started."),this.remoteDocumentCache},c.prototype.getIndexManager=function(){return Or(this.started,"Cannot initialize IndexManager before persistence is started."),this.indexManager},c.prototype.runTransaction=function(n,t,r){var i=this;return Ar(Ta,"Starting transaction:",n),this.simpleDb.runTransaction("readonly"===t?"readonly":"readwrite",fa,function(e){return"readwrite-primary"===t?i.verifyPrimaryLease(e).next(function(t){if(!t)throw kr("Failed to obtain primary lease for action '"+n+"'."),i.isPrimary=!1,i.queue.enqueueAndForget(function(){return i.primaryStateListener(!1)}),new xr(Lr.FAILED_PRECONDITION,Ia);return r(new Da(e,i.listenSequence.next()))}).next(function(t){return i.acquireOrExtendPrimaryLease(e).next(function(){return t})}):i.verifyAllowTabSynchronization(e).next(function(){return r(new Da(e,i.listenSequence.next()))})})},c.prototype.verifyAllowTabSynchronization=function(t){var e=this;return ka(t).get(Yo.key).next(function(t){if(null!==t&&e.isWithinAge(t.leaseTimestampMs,5e3)&&!e.isClientZombied(t.ownerId)&&!e.isLocalClient(t)&&!t.allowTabSynchronization)throw new xr(Lr.FAILED_PRECONDITION,Ca)})},c.prototype.acquireOrExtendPrimaryLease=function(t){var e=new Yo(this.clientId,this.allowTabSynchronization,Date.now());return ka(t).put(Yo.key,e)},c.isAvailable=function(){return vo.isAvailable()},c.buildStoragePrefix=function(t){var e=t.databaseId.projectId;return t.databaseId.isDefaultDatabase||(e+="."+t.databaseId.database),"firestore/"+t.persistenceKey+"/"+e+"/"},c.prototype.releasePrimaryLeaseIfHeld=function(t){var e=this,n=ka(t);return n.get(Yo.key).next(function(t){return e.isLocalClient(t)?(Ar(Ta,"Releasing primary lease."),n.delete(Yo.key)):oo.resolve()})},c.prototype.isWithinAge=function(t,e){var n=Date.now();return!(t "+n),!1))},c.prototype.attachVisibilityHandler=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.documentVisibilityHandler=function(){t.queue.enqueueAndForget(function(){return t.inForeground="visible"===t.document.visibilityState,t.updateClientMetadataAndTryBecomePrimary()})},this.document.addEventListener("visibilitychange",this.documentVisibilityHandler),this.inForeground="visible"===this.document.visibilityState)},c.prototype.detachVisibilityHandler=function(){this.documentVisibilityHandler&&(Or(null!==this.document&&"function"==typeof this.document.addEventListener,"Expected 'document.addEventListener' to be a function"),this.document.removeEventListener("visibilitychange",this.documentVisibilityHandler),this.documentVisibilityHandler=null)},c.prototype.attachWindowUnloadHook=function(){var t=this;"function"==typeof this.window.addEventListener&&(this.windowUnloadHandler=function(){t.markClientZombied(),t.queue.enqueueAndForget(function(){return t.shutdown()})},this.window.addEventListener("unload",this.windowUnloadHandler))},c.prototype.detachWindowUnloadHook=function(){this.windowUnloadHandler&&(Or("function"==typeof this.window.removeEventListener,"Expected 'window.removeEventListener' to be a function"),this.window.removeEventListener("unload",this.windowUnloadHandler),this.windowUnloadHandler=null)},c.prototype.isClientZombied=function(t){try{var e=null!==this.webStorage.getItem(this.zombiedClientLocalStorageKey(t));return Ar(Ta,"Client '"+t+"' "+(e?"is":"is not")+" zombied in LocalStorage"),e}catch(t){return kr(Ta,"Failed to get zombied client id.",t),!1}},c.prototype.markClientZombied=function(){try{this.webStorage.setItem(this.zombiedClientLocalStorageKey(this.clientId),String(Date.now()))}catch(t){kr("Failed to set zombie client id.",t)}},c.prototype.removeClientZombiedEntry=function(){try{this.webStorage.removeItem(this.zombiedClientLocalStorageKey(this.clientId))}catch(t){}},c.prototype.zombiedClientLocalStorageKey=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},c.MAIN_DATABASE="main",c}();function Aa(n){return h(this,void 0,void 0,function(){return p(this,function(t){if((e=n).code!==Lr.FAILED_PRECONDITION||e.message!==Ia)throw n;var e;return Ar(Ta,"Unexpectedly lost primary lease"),[2]})})}function ka(t){return t.store(Yo.store)}function Ra(t){return t.store(ca.store)}var Ma,Oa,_a,Pa,La=function(){function t(t,e){this.db=t,this.garbageCollector=new Sa(this,e)}return t.prototype.getSequenceNumberCount=function(t){var n=this.orphanedDocmentCount(t);return this.db.getQueryCache().getQueryCount(t).next(function(e){return n.next(function(t){return e+t})})},t.prototype.orphanedDocmentCount=function(t){var e=0;return this.forEachOrphanedDocumentSequenceNumber(t,function(t){e++}).next(function(){return e})},t.prototype.forEachTarget=function(t,e){return this.db.getQueryCache().forEachTarget(t,e)},t.prototype.forEachOrphanedDocumentSequenceNumber=function(t,n){return this.forEachOrphanedDocument(t,function(t,e){return n(e)})},t.prototype.setInMemoryPins=function(t){this.inMemoryPins=t},t.prototype.addReference=function(t,e){return xa(t,e)},t.prototype.removeReference=function(t,e){return xa(t,e)},t.prototype.removeTargets=function(t,e,n){return this.db.getQueryCache().removeTargets(t,e,n)},t.prototype.removeMutationReference=function(t,e){return xa(t,e)},t.prototype.isPinned=function(t,e){return this.inMemoryPins.containsKey(e)?oo.resolve(!0):(r=e,i=!1,fo(n=t).iterateSerial(function(t){return so(n,t,r).next(function(t){return t&&(i=!0),oo.resolve(!t)})}).next(function(){return i}));var n,r,i},t.prototype.removeOrphanedDocuments=function(r,i){var o=this,a=0,s=0,u=[];return this.forEachOrphanedDocument(r,function(e,t){if(t<=i){var n=o.isPinned(r,e).next(function(t){if(!t)return a++,o.removeOrphanedDocument(r,e).next(function(t){s+=t})});u.push(n)}}).next(function(){return oo.waitFor(u)}).next(function(){return o.db.getRemoteDocumentCache().updateSize(r,-s)}).next(function(){return a})},t.prototype.removeOrphanedDocument=function(t,e){var n,r=0,i=this.db.getRemoteDocumentCache();return oo.waitFor([ko(t).delete((n=e,[0,Pi(n.path)])),i.removeEntry(t,e).next(function(t){r+=t})]).next(function(){return r})},t.prototype.removeTarget=function(t,e){var n=e.copy({sequenceNumber:t.currentSequenceNumber});return this.db.getQueryCache().updateQueryData(t,n)},t.prototype.updateLimboDocument=function(t,e){return xa(t,e)},t.prototype.forEachOrphanedDocument=function(t,o){var a,e=ko(t),s=wi.INVALID;return e.iterate({index:ia.documentTargetsIndex},function(t,e){var n=t[0],r=(t[1],e.path),i=e.sequenceNumber;0===n?(s!==wi.INVALID&&o(new Di(qi(a)),s),s=i,a=r):s=wi.INVALID}).next(function(){s!==wi.INVALID&&o(new Di(qi(a)),s)})},t.prototype.getCacheSize=function(t){return this.db.getRemoteDocumentCache().getSize(t)},t}();function xa(t,e){return ko(t).put((n=e,r=t.currentSequenceNumber,new ia(0,Pi(n.path),r)));var n,r}(Oa=Ma||(Ma={}))[Oa.NullValue=0]="NullValue",Oa[Oa.BooleanValue=1]="BooleanValue",Oa[Oa.NumberValue=2]="NumberValue",Oa[Oa.TimestampValue=3]="TimestampValue",Oa[Oa.StringValue=4]="StringValue",Oa[Oa.BlobValue=5]="BlobValue",Oa[Oa.RefValue=6]="RefValue",Oa[Oa.GeoPointValue=7]="GeoPointValue",Oa[Oa.ArrayValue=8]="ArrayValue",Oa[Oa.ObjectValue=9]="ObjectValue",(Pa=_a||(_a={}))[Pa.Default=0]="Default",Pa[Pa.Estimate=1]="Estimate",Pa[Pa.Previous=2]="Previous";var qa=function(){function n(t,e){this.serverTimestampBehavior=t,this.timestampsInSnapshots=e}return n.fromSnapshotOptions=function(t,e){switch(t.serverTimestamps){case"estimate":return new n(_a.Estimate,e);case"previous":return new n(_a.Previous,e);case"none":case void 0:return new n(_a.Default,e);default:return Mr("fromSnapshotOptions() called with invalid options.")}},n}(),Fa=function(){function t(){}return t.prototype.toString=function(){var t=this.value();return null===t?"null":t.toString()},t.prototype.defaultCompareTo=function(t){return Or(this.typeOrder!==t.typeOrder,"Default compareTo should not be used for values of same type."),ui(this.typeOrder,t.typeOrder)},t}(),Va=function(e){function n(){var t=e.call(this)||this;return t.typeOrder=Ma.NullValue,t.internalValue=null,t}return s(n,e),n.prototype.value=function(t){return null},n.prototype.isEqual=function(t){return t instanceof n},n.prototype.compareTo=function(t){return t instanceof n?0:this.defaultCompareTo(t)},n.INSTANCE=new n,n}(Fa),Ua=function(n){function e(t){var e=n.call(this)||this;return e.internalValue=t,e.typeOrder=Ma.BooleanValue,e}return s(e,n),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue===t.internalValue},e.prototype.compareTo=function(t){return t instanceof e?ui(this,t):this.defaultCompareTo(t)},e.of=function(t){return t?e.TRUE:e.FALSE},e.TRUE=new e(!0),e.FALSE=new e(!1),e}(Fa),Ba=function(n){function r(t){var e=n.call(this)||this;return e.internalValue=t,e.typeOrder=Ma.NumberValue,e}return s(r,n),r.prototype.value=function(t){return this.internalValue},r.prototype.compareTo=function(t){return t instanceof r?(e=this.internalValue,n=t.internalValue,e"},e}(Fa),Xa=function(n){function e(t){var e=n.call(this)||this;return e.internalValue=t,e.typeOrder=Ma.BlobValue,e}return s(e,n),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue.isEqual(t.internalValue)},e.prototype.compareTo=function(t){return t instanceof e?this.internalValue._compareTo(t.internalValue):this.defaultCompareTo(t)},e}(Fa),Ja=function(r){function n(t,e){var n=r.call(this)||this;return n.databaseId=t,n.key=e,n.typeOrder=Ma.RefValue,n}return s(n,r),n.prototype.value=function(t){return this.key},n.prototype.isEqual=function(t){return t instanceof n&&(this.key.isEqual(t.key)&&this.databaseId.isEqual(t.databaseId))},n.prototype.compareTo=function(t){if(t instanceof n){var e=this.databaseId.compareTo(t.databaseId);return 0!==e?e:Di.comparator(this.key,t.key)}return this.defaultCompareTo(t)},n}(Fa),$a=function(n){function e(t){var e=n.call(this)||this;return e.internalValue=t,e.typeOrder=Ma.GeoPointValue,e}return s(e,n),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue.isEqual(t.internalValue)},e.prototype.compareTo=function(t){return t instanceof e?this.internalValue._compareTo(t.internalValue):this.defaultCompareTo(t)},e}(Fa),Za=function(n){function a(t){var e=n.call(this)||this;return e.internalValue=t,e.typeOrder=Ma.ObjectValue,e}return s(a,n),a.prototype.value=function(n){var r={};return this.internalValue.inorderTraversal(function(t,e){r[t]=e.value(n)}),r},a.prototype.forEach=function(t){this.internalValue.inorderTraversal(t)},a.prototype.isEqual=function(t){if(t instanceof a){for(var e=this.internalValue.getIterator(),n=t.internalValue.getIterator();e.hasNext()&&n.hasNext();){var r=e.getNext(),i=n.getNext();if(r.key!==i.key||!r.value.isEqual(i.value))return!1}return!e.hasNext()&&!n.hasNext()}return!1},a.prototype.compareTo=function(t){if(t instanceof a){for(var e=this.internalValue.getIterator(),n=t.internalValue.getIterator();e.hasNext()&&n.hasNext();){var r=e.getNext(),i=n.getNext(),o=ui(r.key,i.key)||r.value.compareTo(i.value);if(o)return o}return ui(e.hasNext(),n.hasNext())}return this.defaultCompareTo(t)},a.prototype.set=function(t,e){if(Or(!t.isEmpty(),"Cannot set field for empty path on ObjectValue"),1===t.length)return this.setChild(t.firstSegment(),e);var n=this.child(t.firstSegment());n instanceof a||(n=a.EMPTY);var r=n.set(t.popFirst(),e);return this.setChild(t.firstSegment(),r)},a.prototype.delete=function(t){if(Or(!t.isEmpty(),"Cannot delete field for empty path on ObjectValue"),1===t.length)return new a(this.internalValue.remove(t.firstSegment()));var e=this.child(t.firstSegment());if(e instanceof a){var n=e.delete(t.popFirst());return new a(this.internalValue.insert(t.firstSegment(),n))}return this},a.prototype.contains=function(t){return void 0!==this.field(t)},a.prototype.field=function(t){Or(!t.isEmpty(),"Can't get field of empty path");var e=this;return t.forEach(function(t){e=e instanceof a&&e.internalValue.get(t)||void 0}),e},a.prototype.toString=function(){return this.internalValue.toString()},a.prototype.child=function(t){return this.internalValue.get(t)||void 0},a.prototype.setChild=function(t,e){return new a(this.internalValue.insert(t,e))},a.EMPTY=new a(new Ui(ui)),a}(Fa),ts=function(n){function i(t){var e=n.call(this)||this;return e.internalValue=t,e.typeOrder=Ma.ArrayValue,e}return s(i,n),i.prototype.value=function(e){return this.internalValue.map(function(t){return t.value(e)})},i.prototype.contains=function(t){for(var e=0,n=this.internalValue;e=this.RESUME_TOKEN_MAX_AGE_MICROS||0i?this.mutationQueue[i]:null)},t.prototype.getAllMutationBatches=function(t){return oo.resolve(this.mutationQueue.slice())},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,n){var r=this,e=new fs(n,0),i=new fs(n,Number.POSITIVE_INFINITY),o=[];return this.batchesByDocumentKey.forEachInRange([e,i],function(t){Or(n.isEqual(t.key),"Should only iterate over a single key's batches");var e=r.findMutationBatch(t.targetOrBatchId);Or(null!==e,"Batches in the index must exist in the main table"),o.push(e)}),oo.resolve(o)},t.prototype.getAllMutationBatchesAffectingDocumentKeys=function(t,e){var r=this,i=new ji(ui);return e.forEach(function(e){var t=new fs(e,0),n=new fs(e,Number.POSITIVE_INFINITY);r.batchesByDocumentKey.forEachInRange([t,n],function(t){Or(e.isEqual(t.key),"For each key, should only iterate over a single key's batches"),i=i.add(t.targetOrBatchId)})}),oo.resolve(this.findMutationBatches(i))},t.prototype.getAllMutationBatchesAffectingQuery=function(t,e){Or(!e.isCollectionGroupQuery(),"CollectionGroup queries should be handled in LocalDocumentsView");var n=e.path,r=n.length+1,i=n;Di.isDocumentKey(i)||(i=i.child(""));var o=new fs(new Di(i),0),a=new ji(ui);return this.batchesByDocumentKey.forEachWhile(function(t){var e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(a=a.add(t.targetOrBatchId)),!0)},o),oo.resolve(this.findMutationBatches(a))},t.prototype.findMutationBatches=function(t){var n=this,r=[];return t.forEach(function(t){var e=n.findMutationBatch(t);null!==e&&r.push(e)}),r},t.prototype.removeMutationBatch=function(n,r){var i=this;Or(0===this.indexOfExistingBatchId(r.batchId,"removed"),"Can only remove the first entry of the mutation queue"),this.mutationQueue.shift();var o=this.batchesByDocumentKey;return oo.forEach(r.mutations,function(t){var e=new fs(t.key,r.batchId);return o=o.delete(e),i.referenceDelegate.removeMutationReference(n,t.key)}).next(function(){i.batchesByDocumentKey=o})},t.prototype.removeCachedMutationKeys=function(t){},t.prototype.containsKey=function(t,e){var n=new fs(e,0),r=this.batchesByDocumentKey.firstAfterOrEqual(n);return oo.resolve(e.isEqual(r&&r.key))},t.prototype.performConsistencyCheck=function(t){return 0===this.mutationQueue.length&&Or(this.batchesByDocumentKey.isEmpty(),"Document leak -- detected dangling mutation references when queue is empty."),oo.resolve()},t.prototype.indexOfExistingBatchId=function(t,e){var n=this.indexOfBatchId(t);return Or(0<=n&&n=this.mutationQueue.length)return null;var n=this.mutationQueue[e];return Or(n.batchId===t,"If found batch must match"),n},t}(),ms=function(){function t(t){this.persistence=t,this.queries=new Po(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=Vi.MIN,this.highestTargetId=0,this.highestSequenceNumber=0,this.references=new ls,this.targetCount=0,this.targetIdGenerator=yo.forQueryCache()}return t.prototype.getTargetCount=function(t){return oo.resolve(this.targetCount)},t.prototype.forEachTarget=function(t,n){return this.queries.forEach(function(t,e){return n(e)}),oo.resolve()},t.prototype.getLastRemoteSnapshotVersion=function(t){return oo.resolve(this.lastRemoteSnapshotVersion)},t.prototype.getHighestSequenceNumber=function(t){return oo.resolve(this.highestSequenceNumber)},t.prototype.allocateTargetId=function(t){var e=this.targetIdGenerator.after(this.highestTargetId);return this.highestTargetId=e,oo.resolve(e)},t.prototype.setTargetsMetadata=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.highestSequenceNumber&&(this.highestSequenceNumber=e),oo.resolve()},t.prototype.saveQueryData=function(t){this.queries.set(t.query,t);var e=t.targetId;e>this.highestTargetId&&(this.highestTargetId=e),t.sequenceNumber>this.highestSequenceNumber&&(this.highestSequenceNumber=t.sequenceNumber)},t.prototype.addQueryData=function(t,e){return Or(!this.queries.has(e.query),"Adding a query that already exists"),this.saveQueryData(e),this.targetCount+=1,oo.resolve()},t.prototype.updateQueryData=function(t,e){return Or(this.queries.has(e.query),"Updating a non-existent query"),this.saveQueryData(e),oo.resolve()},t.prototype.removeQueryData=function(t,e){return Or(0this.maxDelayMs&&(this.currentBaseMs=this.maxDelayMs)},t.prototype.cancel=function(){null!==this.timerPromise&&(this.timerPromise.cancel(),this.timerPromise=null)},t.prototype.jitterDelayMs=function(){return(Math.random()-.5)*this.currentBaseMs},t}(),Ms="PersistentStream";(ks=As||(As={}))[ks.Initial=0]="Initial",ks[ks.Starting=1]="Starting",ks[ks.Open=2]="Open",ks[ks.Error=3]="Error",ks[ks.Backoff=4]="Backoff";var Os,_s,Ps,Ls,xs=function(){function t(t,e,n,r,i,o){this.queue=t,this.idleTimerId=n,this.connection=r,this.credentialsProvider=i,this.listener=o,this.state=As.Initial,this.closeCount=0,this.idleTimer=null,this.stream=null,this.backoff=new Rs(t,e,1e3,1.5,6e4)}return t.prototype.isStarted=function(){return this.state===As.Starting||this.state===As.Open||this.state===As.Backoff},t.prototype.isOpen=function(){return this.state===As.Open},t.prototype.start=function(){this.state!==As.Error?(Or(this.state===As.Initial,"Already started"),this.auth()):this.performBackoff()},t.prototype.stop=function(){return h(this,void 0,void 0,function(){return p(this,function(t){switch(t.label){case 0:return this.isStarted()?[4,this.close(As.Initial)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},t.prototype.inhibitBackoff=function(){Or(!this.isStarted(),"Can only inhibit backoff in a stopped state"),this.state=As.Initial,this.backoff.reset()},t.prototype.markIdle=function(){var t=this;this.isOpen()&&null===this.idleTimer&&(this.idleTimer=this.queue.enqueueAfterDelay(this.idleTimerId,6e4,function(){return t.handleIdleCloseTimer()}))},t.prototype.sendRequest=function(t){this.cancelIdleCheck(),this.stream.send(t)},t.prototype.handleIdleCloseTimer=function(){return h(this,void 0,void 0,function(){return p(this,function(t){return this.isOpen()?[2,this.close(As.Initial)]:[2]})})},t.prototype.cancelIdleCheck=function(){this.idleTimer&&(this.idleTimer.cancel(),this.idleTimer=null)},t.prototype.close=function(e,n){return h(this,void 0,void 0,function(){return p(this,function(t){switch(t.label){case 0:return Or(this.isStarted(),"Only started streams should be closed."),Or(e===As.Error||Ds(n),"Can't provide an error when not in an error state."),this.cancelIdleCheck(),this.backoff.cancel(),this.closeCount++,e!==As.Error?this.backoff.reset():n&&n.code===Lr.RESOURCE_EXHAUSTED?(kr(n.toString()),kr("Using maximum backoff delay to prevent overloading the backend."),this.backoff.resetToMax()):n&&n.code===Lr.UNAUTHENTICATED&&this.credentialsProvider.invalidateToken(),null!==this.stream&&(this.tearDown(),this.stream.close(),this.stream=null),this.state=e,[4,this.listener.onClose(n)];case 1:return t.sent(),[2]}})})},t.prototype.tearDown=function(){},t.prototype.auth=function(){var n=this;Or(this.state===As.Initial,"Must be in initial state to auth"),this.state=As.Starting;var t=this.getCloseGuardedDispatcher(this.closeCount),e=this.closeCount;this.credentialsProvider.getToken().then(function(t){n.closeCount===e&&n.startStream(t)},function(e){t(function(){var t=new xr(Lr.UNKNOWN,"Fetching auth token failed: "+e.message);return n.handleStreamClose(t)})})},t.prototype.startStream=function(t){var e=this;Or(this.state===As.Starting,"Trying to start stream in a non-starting state");var n=this.getCloseGuardedDispatcher(this.closeCount);this.stream=this.startRpc(t),this.stream.onOpen(function(){n(function(){return Or(e.state===As.Starting,"Expected stream to be in state Starting, but was "+e.state),e.state=As.Open,e.listener.onOpen()})}),this.stream.onClose(function(t){n(function(){return e.handleStreamClose(t)})}),this.stream.onMessage(function(t){n(function(){return e.onMessage(t)})})},t.prototype.performBackoff=function(){var t=this;Or(this.state===As.Error,"Should only perform backoff when in Error state"),this.state=As.Backoff,this.backoff.backoffAndRun(function(){return h(t,void 0,void 0,function(){return p(this,function(t){return Or(this.state===As.Backoff,"Backoff elapsed but state is now: "+this.state),this.state=As.Initial,this.start(),Or(this.isStarted(),"PersistentStream should have started"),[2]})})})},t.prototype.handleStreamClose=function(t){return Or(this.isStarted(),"Can't handle server close on non-started stream"),Ar(Ms,"close with error: "+t),this.stream=null,this.close(As.Error,t)},t.prototype.getCloseGuardedDispatcher=function(e){var n=this;return function(t){n.queue.enqueueAndForget(function(){return n.closeCount===e?t():(Ar(Ms,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},t}(),qs=function(a){function t(t,e,n,r,i){var o=a.call(this,t,pi.ListenStreamConnectionBackoff,pi.ListenStreamIdle,e,n,i)||this;return o.serializer=r,o}return s(t,a),t.prototype.startRpc=function(t){return this.connection.openStream("Listen",t)},t.prototype.onMessage=function(t){this.backoff.reset();var e=this.serializer.fromWatchChange(t),n=this.serializer.versionFromListenResponse(t);return this.listener.onWatchChange(e,n)},t.prototype.watch=function(t){var e={};e.database=this.serializer.encodedDatabaseId,e.addTarget=this.serializer.toTarget(t);var n=this.serializer.toListenRequestLabels(t);n&&(e.labels=n),this.sendRequest(e)},t.prototype.unwatch=function(t){var e={};e.database=this.serializer.encodedDatabaseId,e.removeTarget=t,this.sendRequest(e)},t}(xs),Fs=function(a){function t(t,e,n,r,i){var o=a.call(this,t,pi.WriteStreamConnectionBackoff,pi.WriteStreamIdle,e,n,i)||this;return o.serializer=r,o.handshakeComplete_=!1,o}return s(t,a),Object.defineProperty(t.prototype,"handshakeComplete",{get:function(){return this.handshakeComplete_},enumerable:!0,configurable:!0}),t.prototype.start=function(){this.handshakeComplete_=!1,a.prototype.start.call(this)},t.prototype.tearDown=function(){this.handshakeComplete_&&this.writeMutations([])},t.prototype.startRpc=function(t){return this.connection.openStream("Write",t)},t.prototype.onMessage=function(t){if(Or(!!t.streamToken,"Got a write response without a stream token"),this.lastStreamToken=t.streamToken,this.handshakeComplete_){this.backoff.reset();var e=this.serializer.fromWriteResults(t.writeResults,t.commitTime),n=this.serializer.fromVersion(t.commitTime);return this.listener.onMutationResult(n,e)}return Or(!t.writeResults||0===t.writeResults.length,"Got mutation results for handshake"),this.handshakeComplete_=!0,this.listener.onHandshakeComplete()},t.prototype.writeHandshake=function(){Or(this.isOpen(),"Writing handshake requires an opened stream"),Or(!this.handshakeComplete_,"Handshake already completed");var t={};t.database=this.serializer.encodedDatabaseId,this.sendRequest(t)},t.prototype.writeMutations=function(t){var e=this;Or(this.isOpen(),"Writing mutations requires an opened stream"),Or(this.handshakeComplete_,"Handshake must be complete before writing mutations"),Or(0=":return e.GREATER_THAN_OR_EQUAL;case">":return e.GREATER_THAN;case"array-contains":return e.ARRAY_CONTAINS;case"in":return e.IN;case"array-contains-any":return e.ARRAY_CONTAINS_ANY;default:return Mr("Unknown FieldFilter operator: "+t)}},e.prototype.toString=function(){return this.name},e.prototype.isEqual=function(t){return this.name===t.name},e.LESS_THAN=new e("<"),e.LESS_THAN_OR_EQUAL=new e("<="),e.EQUAL=new e("=="),e.GREATER_THAN=new e(">"),e.GREATER_THAN_OR_EQUAL=new e(">="),e.ARRAY_CONTAINS=new e("array-contains"),e.IN=new e("in"),e.ARRAY_CONTAINS_ANY=new e("array-contains-any"),e}(),yu=function(i){function e(t,e,n){var r=i.call(this)||this;return r.field=t,r.op=e,r.value=n,r}return s(e,i),e.prototype.matches=function(t){var e=t.field(this.field);return void 0!==e&&this.value.typeOrder===e.typeOrder&&this.matchesComparison(e.compareTo(this.value))},e.prototype.matchesComparison=function(t){switch(this.op){case mu.LESS_THAN:return t<0;case mu.LESS_THAN_OR_EQUAL:return t<=0;case mu.EQUAL:return 0===t;case mu.GREATER_THAN:return 0() instead."),Mc=/^__.*__$/,Oc=function(){function t(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}return t.prototype.toMutations=function(t,e){var n=[];return null!==this.fieldMask?n.push(new ss(t,this.data,this.fieldMask,e)):n.push(new as(t,this.data,e)),0=",">","array-contains"],2,e)}var r,i=Uc("Query.where",t),o=mu.fromString(e);if(i.isKeyField()){if(o===mu.ARRAY_CONTAINS||o===mu.ARRAY_CONTAINS_ANY||o===mu.IN)throw new xr(Lr.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+o.toString()+"' queries on FieldPath.documentId().");if("string"==typeof n){if(""===n)throw new xr(Lr.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it was an empty string.");if(!this._query.isCollectionGroupQuery()&&-1!==n.indexOf("/"))throw new xr(Lr.INVALID_ARGUMENT,"Invalid third parameter to Query.where(). When querying a collection by FieldPath.documentId(), the value provided must be a plain document ID, but '"+n+"' contains a slash.");var a=this._query.path.child(Ti.fromString(n));if(!Di.isDocumentKey(a))throw new xr(Lr.INVALID_ARGUMENT,"Invalid third parameter to Query.where(). When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '"+a+"' is not because it has an odd number of segments ("+a.length+").");r=new Ja(this.firestore._databaseId,new Di(a))}else{if(!(n instanceof Yc))throw new xr(Lr.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a string or a DocumentReference if the first parameter is FieldPath.documentId(), but it was: "+ei(n)+".");var s=n;r=new Ja(this.firestore._databaseId,s._key)}}else{if(o===mu.IN||o===mu.ARRAY_CONTAINS_ANY){if(!Array.isArray(n)||0===n.length)throw new xr(Lr.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+o.toString()+"' filters.");if(10r.length)throw new xr(Lr.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 a=this._query.getFirstOrderByField();null!==a&&this.validateOrderByAndInequalityMatch(t.field,a)}else if(i||r){var s=null;if(i&&(s=this._query.findFilterOperator(n)),null===s&&r&&(s=this._query.findFilterOperator(e)),null!=s)throw s===t.op?new xr(Lr.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+t.op.toString()+"' filter."):new xr(Lr.INVALID_ARGUMENT,"Invalid query. You cannot use '"+t.op.toString()+"' filters with '"+s.toString()+"' filters.")}}},c.prototype.validateNewOrderBy=function(t){if(null===this._query.getFirstOrderByField()){var e=this._query.getInequalityFilterField();null!==e&&this.validateOrderByAndInequalityMatch(e,t.field)}},c.prototype.validateOrderByAndInequalityMatch=function(t,e){if(!e.isEqual(t))throw new xr(Lr.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.")},c}(),th=function(){function e(t,e,n){this._firestore=t,this._originalQuery=e,this._snapshot=n,this._cachedChanges=null,this._cachedChangesIncludeMetadataChanges=null,this.metadata=new Xc(n.hasPendingWrites,n.fromCache)}return Object.defineProperty(e.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"empty",{get:function(){return this._snapshot.docs.isEmpty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this._snapshot.docs.size},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e,n){var r=this;Wr("QuerySnapshot.forEach",arguments,1,2),zr("QuerySnapshot.forEach","function",1,e),this._snapshot.docs.forEach(function(t){e.call(n,r.convertToDocumentImpl(t))})},Object.defineProperty(e.prototype,"query",{get:function(){return new Zc(this._originalQuery,this._firestore)},enumerable:!0,configurable:!0}),e.prototype.docChanges=function(t){t&&(ri("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),Xr("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges));var e=!(!t||!t.includeMetadataChanges);if(e&&this._snapshot.excludesMetadataChanges)throw new xr(Lr.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(i,e,o){{if(o.oldDocs.isEmpty()){var n,r=0;return o.docChanges.map(function(t){var e=new $c(i,t.doc.key,t.doc,o.fromCache,o.mutatedKeys.has(t.doc.key));return Or(t.type===Ws.Added,"Invalid event type for first snapshot"),Or(!n||o.query.docComparator(n,t.doc)<0,"Got added events in wrong order"),n=t.doc,{type:"added",doc:e,oldIndex:-1,newIndex:r++}})}var a=o.oldDocs;return o.docChanges.filter(function(t){return e||t.type!==Ws.Metadata}).map(function(t){var e=new $c(i,t.doc.key,t.doc,o.fromCache,o.mutatedKeys.has(t.doc.key)),n=-1,r=-1;return t.type!==Ws.Added&&(Or(0<=(n=a.indexOf(t.doc.key)),"Index for document not found"),a=a.delete(t.doc.key)),t.type!==Ws.Removed&&(a=a.add(t.doc),r=a.indexOf(t.doc.key)),{type:function(t){switch(t){case Ws.Added:return"added";case Ws.Modified:case Ws.Metadata:return"modified";case Ws.Removed:return"removed";default:return Mr("Unknown change type: "+t)}}(t.type),doc:e,oldIndex:n,newIndex:r}})}}(this._firestore,e,this._snapshot),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges},e.prototype.isEqual=function(t){if(!(t instanceof e))throw ii("isEqual","QuerySnapshot",1,t);return this._firestore===t._firestore&&this._originalQuery.isEqual(t._originalQuery)&&this._snapshot.isEqual(t._snapshot)},e.prototype.convertToDocumentImpl=function(t){return new $c(this._firestore,t.key,t,this.metadata.fromCache,this._snapshot.mutatedKeys.has(t.key))},e}();["length","forEach","map"].concat("undefined"!=typeof Symbol?[Symbol.iterator]:[]).forEach(function(t){try{Object.defineProperty(th.prototype.docChanges,t,{get:function(){return function(){throw new xr(Lr.INVALID_ARGUMENT,'QuerySnapshot.docChanges has been changed from a property into a method, so usages like "querySnapshot.docChanges" should become "querySnapshot.docChanges()"')}()}})}catch(t){}});var eh=function(r){function t(t,e){var n=r.call(this,pu.atPath(t),e)||this;if(t.length%2!=1)throw new xr(Lr.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t.canonicalString()+" has "+t.length);return n}return s(t,r),Object.defineProperty(t.prototype,"id",{get:function(){return this._query.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){var t=this._query.path.popLast();return t.isEmpty()?null:new Yc(new Di(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this._query.path.canonicalString()},enumerable:!0,configurable:!0}),t.prototype.doc=function(t){if(Wr("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=si.newId()),zr("CollectionReference.doc","non-empty string",1,t),""===t)throw new xr(Lr.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=Ti.fromString(t);return Yc.forPath(this._query.path.child(e),this.firestore)},t.prototype.add=function(t){jr("CollectionReference.add",arguments,1),zr("CollectionReference.add","object",1,t);var e=this.doc();return e.set(t).then(function(){return e})},t}(Zc);function nh(t,e){if(void 0===e)return{merge:!1};if(ri(t,e,["merge","mergeFields"]),Xr(t,"boolean","merge",e.merge),Jr(t,"mergeFields","a string or a FieldPath",e.mergeFields,function(t){return"string"==typeof t||t instanceof dc}),void 0!==e.mergeFields&&void 0!==e.merge)throw new xr(Lr.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function rh(t,e){return void 0===e?{}:(ri(t,e,["serverTimestamps"]),$r(t,0,"serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function ih(t,e){Hr(t,"object",1,e),e&&(ri(t,e,["source"]),$r(t,0,"source",e.source,["default","server","cache"]))}function oh(t,e,n){if(e instanceof Yc){if(e.firestore!==n)throw new xr(Lr.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw ii(t,"DocumentReference",1,e)}var ah=qr(Wc,"Use firebase.firestore() instead."),sh=qr(zc,"Use firebase.firestore().runTransaction() instead."),uh=qr(Hc,"Use firebase.firestore().batch() instead."),ch=qr(Yc,"Use firebase.firestore().doc() instead."),hh=qr(Jc),lh=qr($c),fh=qr(Zc),ph=qr(th),dh=qr(eh,"Use firebase.firestore().collection() instead."),mh={Firestore:ah,GeoPoint:fu,Timestamp:Fi,Blob:yi,Transaction:sh,WriteBatch:uh,DocumentReference:ch,DocumentSnapshot:hh,Query:fh,QueryDocumentSnapshot:lh,QuerySnapshot:ph,CollectionReference:dh,FieldPath:dc,FieldValue:Rc,setLogLevel:Wc.setLogLevel,CACHE_SIZE_UNLIMITED:Kc};function yh(t){t.INTERNAL.registerService("firestore",function(t){return new Wc(t)},function(t){Or(t&&"object"==typeof t,"shallowCopy() expects object parameter.");var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}(mh))}var gh=function(){function t(){}return t.prototype.addCallback=function(t){},t.prototype.shutdown=function(){},t}(),vh="ConnectivityMonitor",bh=function(){function t(){var t=this;this.networkAvailableListener=function(){return t.onNetworkAvailable()},this.networkUnavailableListener=function(){return t.onNetworkUnavailable()},this.callbacks=[],this.configureNetworkMonitoring()}return t.prototype.addCallback=function(t){this.callbacks.push(t)},t.prototype.shutdown=function(){window.removeEventListener("online",this.networkAvailableListener),window.removeEventListener("offline",this.networkUnavailableListener)},t.prototype.configureNetworkMonitoring=function(){window.addEventListener("online",this.networkAvailableListener),window.addEventListener("offline",this.networkUnavailableListener)},t.prototype.onNetworkAvailable=function(){Ar(vh,"Network connectivity changed: AVAILABLE");for(var t=0,e=this.callbacks;t