vendor: 14,550 bytes, line 1
1import{D as Bu,F as ju,G as It,H as $u,I as Nt,J as zu,K as Gu,O as Ku,d as Au,e as Su,f as bu,g as Ru,h as Pu,i as Sn,j as Vu,k as Cu,l as Du,m as xu,n as nt,o as Nu,p as ku,t as Fu,u as js,v as Ou,w as Mu,x as Lu,y as qu,z as Uu}from"./chunk-OYOXAY44.js";import{Ha as vu,Ka as Iu,Ta as Tu,Ya as Eu,c as wu,fb as An,z as mr}from"./chunk-Z5YOIIAC.js";import{t as N}from"./chunk-ATLPHYUF.js";var Qu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Wu={};var $t,$s;(function(){var n;function t(I,m){function y(){}y.prototype=m.prototype,I.D=m.prototype,I.prototype=new y,I.prototype.constructor=I,I.C=function(_,v,E){for(var p=Array(arguments.length-2),Ut=2;Ut<arguments.length;Ut++)p[Ut-2]=arguments[Ut];return m.prototype[v].apply(_,p)}}function e(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}t(r,e),r.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(I,m,y){y||(y=0);var _=Array(16);if(typeof m=="string")for(var v=0;16>v;++v)_[v]=m.charCodeAt(y++)|m.charCodeAt(y++)<<8|m.charCodeAt(y++)<<16|m.charCodeAt(y++)<<24;else for(v=0;16>v;++v)_[v]=m[y++]|m[y++]<<8|m[y++]<<16|m[y++]<<24;m=I.g[0],y=I.g[1],v=I.g[2];var E=I.g[3],p=m+(E^y&(v^E))+_[0]+3614090360&4294967295;m=y+(p<<7&4294967295|p>>>25),p=E+(v^m&(y^v))+_[1]+3905402710&4294967295,E=m+(p<<12&4294967295|p>>>20),p=v+(y^E&(m^y))+_[2]+606105819&4294967295,v=E+(p<<17&4294967295|p>>>15),p=y+(m^v&(E^m))+_[3]+3250441966&4294967295,y=v+(p<<22&4294967295|p>>>10),p=m+(E^y&(v^E))+_[4]+4118548399&4294967295,m=y+(p<<7&4294967295|p>>>25),p=E+(v^m&(y^v))+_[5]+1200080426&4294967295,E=m+(p<<12&4294967295|p>>>20),p=v+(y^E&(m^y))+_[6]+2821735955&4294967295,v=E+(p<<17&4294967295|p>>>15),p=y+(m^v&(E^m))+_[7]+4249261313&4294967295,y=v+(p<<22&4294967295|p>>>10),p=m+(E^y&(v^E))+_[8]+1770035416&4294967295,m=y+(p<<7&4294967295|p>>>25),p=E+(v^m&(y^v))+_[9]+2336552879&4294967295,E=m+(p<<12&4294967295|p>>>20),p=v+(y^E&(m^y))+_[10]+4294925233&4294967295,v=E+(p<<17&4294967295|p>>>15),p=y+(m^v&(E^m))+_[11]+2304563134&4294967295,y=v+(p<<22&4294967295|p>>>10),p=m+(E^y&(v^E))+_[12]+1804603682&4294967295,m=y+(p<<7&4294967295|p>>>25),p=E+(v^m&(y^v))+_[13]+4254626195&4294967295,E=m+(p<<12&4294967295|p>>>20),p=v+(y^E&(m^y))+_[14]+2792965006&4294967295,v=E+(p<<17&4294967295|p>>>15),p=y+(m^v&(E^m))+_[15]+1236535329&4294967295,y=v+(p<<22&4294967295|p>>>10),p=m+(v^E&(y^v))+_[1]+4129170786&4294967295,m=y+(p<<5&4294967295|p>>>27),p=E+(y^v&(m^y))+_[6]+3225465664&4294967295,E=m+(p<<9&4294967295|p>>>23),p=v+(m^y&(E^m))+_[11]+643717713&4294967295,v=E+(p<<14&4294967295|p>>>18),p=y+(E^m&(v^E))+_[0]+3921069994&4294967295,y=v+(p<<20&4294967295|p>>>12),p=m+(v^E&(y^v))+_[5]+3593408605&4294967295,m=y+(p<<5&4294967295|p>>>27),p=E+(y^v&(m^y))+_[10]+38016083&4294967295,E=m+(p<<9&4294967295|p>>>23),p=v+(m^y&(E^m))+_[15]+3634488961&4294967295,v=E+(p<<14&4294967295|p>>>18),p=y+(E^m&(v^E))+_[4]+3889429448&4294967295,y=v+(p<<20&4294967295|p>>>12),p=m+(v^E&(y^v))+_[9]+568446438&4294967295,m=y+(p<<5&4294967295|p>>>27),p=E+(y^v&(m^y))+_[14]+3275163606&4294967295,E=m+(p<<9&4294967295|p>>>23),p=v+(m^y&(E^m))+_[3]+4107603335&4294967295,v=E+(p<<14&4294967295|p>>>18),p=y+(E^m&(v^E))+_[8]+1163531501&4294967295,y=v+(p<<20&4294967295|p>>>12),p=m+(v^E&(y^v))+_[13]+2850285829&4294967295,m=y+(p<<5&4294967295|p>>>27),p=E+(y^v&(m^y))+_[2]+4243563512&4294967295,E=m+(p<<9&4294967295|p>>>23),p=v+(m^y&(E^m))+_[7]+1735328473&4294967295,v=E+(p<<14&4294967295|p>>>18),p=y+(E^m&(v^E))+_[12]+2368359562&4294967295,y=v+(p<<20&4294967295|p>>>12),p=m+(y^v^E)+_[5]+4294588738&4294967295,m=y+(p<<4&4294967295|p>>>28),p=E+(m^y^v)+_[8]+2272392833&4294967295,E=m+(p<<11&4294967295|p>>>21),p=v+(E^m^y)+_[11]+1839030562&4294967295,v=E+(p<<16&4294967295|p>>>16),p=y+(v^E^m)+_[14]+4259657740&4294967295,y=v+(p<<23&4294967295|p>>>9),p=m+(y^v^E)+_[1]+2763975236&4294967295,m=y+(p<<4&4294967295|p>>>28),p=E+(m^y^v)+_[4]+1272893353&4294967295,E=m+(p<<11&4294967295|p>>>21),p=v+(E^m^y)+_[7]+4139469664&4294967295,v=E+(p<<16&4294967295|p>>>16),p=y+(v^E^m)+_[10]+3200236656&4294967295,y=v+(p<<23&4294967295|p>>>9),p=m+(y^v^E)+_[13]+681279174&4294967295,m=y+(p<<4&4294967295|p>>>28),p=E+(m^y^v)+_[0]+3936430074&4294967295,E=m+(p<<11&4294967295|p>>>21),p=v+(E^m^y)+_[3]+3572445317&4294967295,v=E+(p<<16&4294967295|p>>>16),p=y+(v^E^m)+_[6]+76029189&4294967295,y=v+(p<<23&4294967295|p>>>9),p=m+(y^v^E)+_[9]+3654602809&4294967295,m=y+(p<<4&4294967295|p>>>28),p=E+(m^y^v)+_[12]+3873151461&4294967295,E=m+(p<<11&4294967295|p>>>21),p=v+(E^m^y)+_[15]+530742520&4294967295,v=E+(p<<16&4294967295|p>>>16),p=y+(v^E^m)+_[2]+3299628645&4294967295,y=v+(p<<23&4294967295|p>>>9),p=m+(v^(y|~E))+_[0]+4096336452&4294967295,m=y+(p<<6&4294967295|p>>>26),p=E+(y^(m|~v))+_[7]+1126891415&4294967295,E=m+(p<<10&4294967295|p>>>22),p=v+(m^(E|~y))+_[14]+2878612391&4294967295,v=E+(p<<15&4294967295|p>>>17),p=y+(E^(v|~m))+_[5]+4237533241&4294967295,y=v+(p<<21&4294967295|p>>>11),p=m+(v^(y|~E))+_[12]+1700485571&4294967295,m=y+(p<<6&4294967295|p>>>26),p=E+(y^(m|~v))+_[3]+2399980690&4294967295,E=m+(p<<10&4294967295|p>>>22),p=v+(m^(E|~y))+_[10]+4293915773&4294967295,v=E+(p<<15&4294967295|p>>>17),p=y+(E^(v|~m))+_[1]+2240044497&4294967295,y=v+(p<<21&4294967295|p>>>11),p=m+(v^(y|~E))+_[8]+1873313359&4294967295,m=y+(p<<6&4294967295|p>>>26),p=E+(y^(m|~v))+_[15]+4264355552&4294967295,E=m+(p<<10&4294967295|p>>>22),p=v+(m^(E|~y))+_[6]+2734768916&4294967295,v=E+(p<<15&4294967295|p>>>17),p=y+(E^(v|~m))+_[13]+1309151649&4294967295,y=v+(p<<21&4294967295|p>>>11),p=m+(v^(y|~E))+_[4]+4149444226&4294967295,m=y+(p<<6&4294967295|p>>>26),p=E+(y^(m|~v))+_[11]+3174756917&4294967295,E=m+(p<<10&4294967295|p>>>22),p=v+(m^(E|~y))+_[2]+718787259&4294967295,v=E+(p<<15&4294967295|p>>>17),p=y+(E^(v|~m))+_[9]+3951481745&4294967295,I.g[0]=I.g[0]+m&4294967295,I.g[1]=I.g[1]+(v+(p<<21&4294967295|p>>>11))&4294967295,I.g[2]=I.g[2]+v&4294967295,I.g[3]=I.g[3]+E&4294967295}r.prototype.u=function(I,m){m===void 0&&(m=I.length);for(var y=m-this.blockSize,_=this.B,v=this.h,E=0;E<m;){if(v==0)for(;E<=y;)i(this,I,E),E+=this.blockSize;if(typeof I=="string"){for(;E<m;)if(_[v++]=I.charCodeAt(E++),v==this.blockSize){i(this,_),v=0;break}}else for(;E<m;)if(_[v++]=I[E++],v==this.blockSize){i(this,_),v=0;break}}this.h=v,this.o+=m},r.prototype.v=function(){var I=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);I[0]=128;for(var m=1;m<I.length-8;++m)I[m]=0;var y=8*this.o;for(m=I.length-8;m<I.length;++m)I[m]=y&255,y/=256;for(this.u(I),I=Array(16),m=y=0;4>m;++m)for(var _=0;32>_;_+=8)I[y++]=this.g[m]>>>_&255;return I};function o(I,m){var y=l;return Object.prototype.hasOwnProperty.call(y,I)?y[I]:y[I]=m(I)}function u(I,m){this.h=m;for(var y=[],_=!0,v=I.length-1;0<=v;v--){var E=I[v]|0;_&&E==m||(y[v]=E,_=!1)}this.g=y}var l={};function h(I){return-128<=I&&128>I?o(I,function(m){return new u([m|0],0>m?-1:0)}):new u([I|0],0>I?-1:0)}function f(I){if(isNaN(I)||!isFinite(I))return w;if(0>I)return C(f(-I));for(var m=[],y=1,_=0;I>=y;_++)m[_]=I/y|0,y*=4294967296;return new u(m,0)}function g(I,m){if(I.length==0)throw Error("number format error: empty string");if(m=m||10,2>m||36<m)throw Error("radix out of range: "+m);if(I.charAt(0)=="-")return C(g(I.substring(1),m));if(0<=I.indexOf("-"))throw Error('number format error: interior "-" character');for(var y=f(Math.pow(m,8)),_=w,v=0;v<I.length;v+=8){var E=Math.min(8,I.length-v),p=parseInt(I.substring(v,v+E),m);8>E?(E=f(Math.pow(m,E)),_=_.j(E).add(f(p))):(_=_.j(y),_=_.add(f(p)))}return _}var w=h(0),S=h(1),P=h(16777216);n=u.prototype,n.m=function(){if(F(this))return-C(this).m();for(var I=0,m=1,y=0;y<this.g.length;y++){var _=this.i(y);I+=(0<=_?_:4294967296+_)*m,m*=4294967296}return I},n.toString=function(I){if(I=I||10,2>I||36<I)throw Error("radix out of range: "+I);if(D(this))return"0";if(F(this))return"-"+C(this).toString(I);for(var m=f(Math.pow(I,6)),y=this,_="";;){var v=Z(y,m).g;y=$(y,v.j(m));var E=((0<y.g.length?y.g[0]:y.h)>>>0).toString(I);if(y=v,D(y))return E+_;for(;6>E.length;)E="0"+E;_=E+_}},n.i=function(I){return 0>I?0:I<this.g.length?this.g[I]:this.h};function D(I){if(I.h!=0)return!1;for(var m=0;m<I.g.length;m++)if(I.g[m]!=0)return!1;return!0}function F(I){return I.h==-1}n.l=function(I){return I=$(this,I),F(I)?-1:D(I)?0:1};function C(I){for(var m=I.g.length,y=[],_=0;_<m;_++)y[_]=~I.g[_];return new u(y,~I.h).add(S)}n.abs=function(){return F(this)?C(this):this},n.add=function(I){for(var m=Math.max(this.g.length,I.g.length),y=[],_=0,v=0;v<=m;v++){var E=_+(this.i(v)&65535)+(I.i(v)&65535),p=(E>>>16)+(this.i(v)>>>16)+(I.i(v)>>>16);_=p>>>16,E&=65535,p&=65535,y[v]=p<<16|E}return new u(y,y[y.length-1]&-2147483648?-1:0)};function $(I,m){return I.add(C(m))}n.j=function(I){if(D(this)||D(I))return w;if(F(this))return F(I)?C(this).j(C(I)):C(C(this).j(I));if(F(I))return C(this.j(C(I)));if(0>this.l(P)&&0>I.l(P))return f(this.m()*I.m());for(var m=this.g.length+I.g.length,y=[],_=0;_<2*m;_++)y[_]=0;for(_=0;_<this.g.length;_++)for(var v=0;v<I.g.length;v++){var E=this.i(_)>>>16,p=this.i(_)&65535,Ut=I.i(v)>>>16,sn=I.i(v)&65535;y[2*_+2*v]+=p*sn,B(y,2*_+2*v),y[2*_+2*v+1]+=E*sn,B(y,2*_+2*v+1),y[2*_+2*v+1]+=p*Ut,B(y,2*_+2*v+1),y[2*_+2*v+2]+=E*Ut,B(y,2*_+2*v+2)}for(_=0;_<m;_++)y[_]=y[2*_+1]<<16|y[2*_];for(_=m;_<2*m;_++)y[_]=0;return new u(y,0)};function B(I,m){for(;(I[m]&65535)!=I[m];)I[m+1]+=I[m]>>>16,I[m]&=65535,m++}function G(I,m){this.g=I,this.h=m}function Z(I,m){if(D(m))throw Error("division by zero");if(D(I))return new G(w,w);if(F(I))return m=Z(C(I),m),new G(C(m.g),C(m.h));if(F(m))return m=Z(I,C(m)),new G(C(m.g),m.h);if(30<I.g.length){if(F(I)||F(m))throw Error("slowDivide_ only works with positive integers.");for(var y=S,_=m;0>=_.l(I);)y=bt(y),_=bt(_);var v=H(y,1),E=H(_,1);for(_=H(_,2),y=H(y,2);!D(_);){var p=E.add(_);0>=p.l(I)&&(v=v.add(y),E=p),_=H(_,1),y=H(y,1)}return m=$(I,v.j(m)),new G(v,m)}for(v=w;0<=I.l(m);){for(y=Math.max(1,Math.floor(I.m()/m.m())),_=Math.ceil(Math.log(y)/Math.LN2),_=48>=_?1:Math.pow(2,_-48),E=f(y),p=E.j(m);F(p)||0<p.l(I);)y-=_,E=f(y),p=E.j(m);D(E)&&(E=S),v=v.add(E),I=$(I,p)}return new G(v,I)}n.A=function(I){return Z(this,I).h},n.and=function(I){for(var m=Math.max(this.g.length,I.g.length),y=[],_=0;_<m;_++)y[_]=this.i(_)&I.i(_);return new u(y,this.h&I.h)},n.or=function(I){for(var m=Math.max(this.g.length,I.g.length),y=[],_=0;_<m;_++)y[_]=this.i(_)|I.i(_);return new u(y,this.h|I.h)},n.xor=function(I){for(var m=Math.max(this.g.length,I.g.length),y=[],_=0;_<m;_++)y[_]=this.i(_)^I.i(_);return new u(y,this.h^I.h)};function bt(I){for(var m=I.g.length+1,y=[],_=0;_<m;_++)y[_]=I.i(_)<<1|I.i(_-1)>>>31;return new u(y,I.h)}function H(I,m){var y=m>>5;m%=32;for(var _=I.g.length-y,v=[],E=0;E<_;E++)v[E]=0<m?I.i(E+y)>>>m|I.i(E+y+1)<<32-m:I.i(E+y);return new u(v,I.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,$s=Wu.Md5=r,u.prototype.add=u.prototype.add,u.prototype.multiply=u.prototype.j,u.prototype.modulo=u.prototype.A,u.prototype.compare=u.prototype.l,u.prototype.toNumber=u.prototype.m,u.prototype.toString=u.prototype.toString,u.prototype.getBits=u.prototype.i,u.fromNumber=f,u.fromString=g,$t=Wu.Integer=u}).apply(typeof Qu<"u"?Qu:typeof self<"u"?self:typeof window<"u"?window:{});var gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},zt={};var zs,yd,ke,Gs,bn,pr,Ks,Qs,Ws;(function(){var n,t=typeof Object.defineProperties=="function"?Object.defineProperty:function(s,a,c){return s==Array.prototype||s==Object.prototype||(s[a]=c.value),s};function e(s){s=[typeof globalThis=="object"&&globalThis,s,typeof window=="object"&&window,typeof self=="object"&&self,typeof gr=="object"&&gr];for(var a=0;a<s.length;++a){var c=s[a];if(c&&c.Math==Math)return c}throw Error("Cannot find global object")}var r=e(this);function i(s,a){if(a)t:{var c=r;s=s.split(".");for(var d=0;d<s.length-1;d++){var T=s[d];if(!(T in c))break t;c=c[T]}s=s[s.length-1],d=c[s],a=a(d),a!=d&&a!=null&&t(c,s,{configurable:!0,writable:!0,value:a})}}function o(s,a){s instanceof String&&(s+="");var c=0,d=!1,T={next:function(){if(!d&&c<s.length){var A=c++;return{value:a(A,s[A]),done:!1}}return d=!0,{done:!0,value:void 0}}};return T[Symbol.iterator]=function(){return T},T}i("Array.prototype.values",function(s){return s||function(){return o(this,function(a,c){return c})}});var u=u||{},l=this||self;function h(s){var a=typeof s;return a=a!="object"?a:s?Array.isArray(s)?"array":a:"null",a=="array"||a=="object"&&typeof s.length=="number"}function f(s){var a=typeof s;return a=="object"&&s!=null||a=="function"}function g(s,a,c){return s.call.apply(s.bind,arguments)}function w(s,a,c){if(!s)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var T=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(T,d),s.apply(a,T)}}return function(){return s.apply(a,arguments)}}function S(s,a,c){return S=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?g:w,S.apply(null,arguments)}function P(s,a){var c=Array.prototype.slice.call(arguments,1);return function(){var d=c.slice();return d.push.apply(d,arguments),s.apply(this,d)}}function D(s,a){function c(){}c.prototype=a.prototype,s.aa=a.prototype,s.prototype=new c,s.prototype.constructor=s,s.Qb=function(d,T,A){for(var V=Array(arguments.length-2),W=2;W<arguments.length;W++)V[W-2]=arguments[W];return a.prototype[T].apply(d,V)}}function F(s){let a=s.length;if(0<a){let c=Array(a);for(let d=0;d<a;d++)c[d]=s[d];return c}return[]}function C(s,a){for(let c=1;c<arguments.length;c++){let d=arguments[c];if(h(d)){let T=s.length||0,A=d.length||0;s.length=T+A;for(let V=0;V<A;V++)s[T+V]=d[V]}else s.push(d)}}class ${constructor(a,c){this.i=a,this.j=c,this.h=0,this.g=null}get(){let a;return 0<this.h?(this.h--,a=this.g,this.g=a.next,a.next=null):a=this.i(),a}}function B(s){return/^[\s\xa0]*$/.test(s)}function G(){var s=l.navigator;return s&&(s=s.userAgent)?s:""}function Z(s){return Z[" "](s),s}Z[" "]=function(){};var bt=G().indexOf("Gecko")!=-1&&!(G().toLowerCase().indexOf("webkit")!=-1&&G().indexOf("Edge")==-1)&&!(G().indexOf("Trident")!=-1||G().indexOf("MSIE")!=-1)&&G().indexOf("Edge")==-1;function H(s,a,c){for(let d in s)a.call(c,s[d],d,s)}function I(s,a){for(let c in s)a.call(void 0,s[c],c,s)}function m(s){let a={};for(let c in s)a[c]=s[c];return a}let y="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
1ing toString valueOf".split(" ");function _(s,a){let c,d;for(let T=1;T<arguments.length;T++){d=arguments[T];for(c in d)s[c]=d[c];for(let A=0;A<y.length;A++)c=y[A],Object.prototype.hasOwnProperty.call(d,c)&&(s[c]=d[c])}}function v(s){var a=1;s=s.split(":");let c=[];for(;0<a&&s.length;)c.push(s.shift()),a--;return s.length&&c.push(s.join(":")),c}function E(s){l.setTimeout(()=>{throw s},0)}function p(){var s=ys;let a=null;return s.g&&(a=s.g,s.g=s.g.next,s.g||(s.h=null),a.next=null),a}class Ut{constructor(){this.h=this.g=null}add(a,c){let d=sn.get();d.set(a,c),this.h?this.h.next=d:this.g=d,this.h=d}}var sn=new $(()=>new Mh,s=>s.reset());class Mh{constructor(){this.next=this.g=this.h=null}set(a,c){this.h=a,this.g=c,this.next=null}reset(){this.next=this.g=this.h=null}}let on,an=!1,ys=new Ut,_a=()=>{let s=l.Promise.resolve(void 0);on=()=>{s.then(Lh)}};var Lh=()=>{for(var s;s=p();){try{s.h.call(s.g)}catch(c){E(c)}var a=sn;a.j(s),100>a.h&&(a.h++,s.next=a.g,a.g=s)}an=!1};function Yt(){this.s=this.s,this.C=this.C}Yt.prototype.s=!1,Yt.prototype.ma=function(){this.s||(this.s=!0,this.N())},Yt.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function dt(s,a){this.type=s,this.g=this.target=a,this.defaultPrevented=!1}dt.prototype.h=function(){this.defaultPrevented=!0};var qh=(function(){if(!l.addEventListener||!Object.defineProperty)return!1;var s=!1,a=Object.defineProperty({},"passive",{get:function(){s=!0}});try{let c=()=>{};l.addEventListener("test",c,a),l.removeEventListener("test",c,a)}catch(c){}return s})();function un(s,a){if(dt.call(this,s?s.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,s){var c=this.type=s.type,d=s.changedTouches&&s.changedTouches.length?s.changedTouches[0]:null;if(this.target=s.target||s.srcElement,this.g=a,a=s.relatedTarget){if(bt){t:{try{Z(a.nodeName);var T=!0;break t}catch(A){}T=!1}T||(a=null)}}else c=="mouseover"?a=s.fromElement:c=="mouseout"&&(a=s.toElement);this.relatedTarget=a,d?(this.clientX=d.clientX!==void 0?d.clientX:d.pageX,this.clientY=d.clientY!==void 0?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0):(this.clientX=s.clientX!==void 0?s.clientX:s.pageX,this.clientY=s.clientY!==void 0?s.clientY:s.pageY,this.screenX=s.screenX||0,this.screenY=s.screenY||0),this.button=s.button,this.key=s.key||"",this.ctrlKey=s.ctrlKey,this.altKey=s.altKey,this.shiftKey=s.shiftKey,this.metaKey=s.metaKey,this.pointerId=s.pointerId||0,this.pointerType=typeof s.pointerType=="string"?s.pointerType:Uh[s.pointerType]||"",this.state=s.state,this.i=s,s.defaultPrevented&&un.aa.h.call(this)}}D(un,dt);var Uh={2:"touch",3:"pen",4:"mouse"};un.prototype.h=function(){un.aa.h.call(this);var s=this.i;s.preventDefault?s.preventDefault():s.returnValue=!1};var cn="closure_listenable_"+(1e6*Math.random()|0),Bh=0;function jh(s,a,c,d,T){this.listener=s,this.proxy=null,this.src=a,this.type=c,this.capture=!!d,this.ha=T,this.key=++Bh,this.da=this.fa=!1}function Jn(s){s.da=!0,s.listener=null,s.proxy=null,s.src=null,s.ha=null}function Yn(s){this.src=s,this.g={},this.h=0}Yn.prototype.add=function(s,a,c,d,T){var A=s.toString();s=this.g[A],s||(s=this.g[A]=[],this.h++);var V=ws(s,a,d,T);return-1<V?(a=s[V],c||(a.fa=!1)):(a=new jh(a,this.src,A,!!d,T),a.fa=c,s.push(a)),a};function _s(s,a){var c=a.type;if(c in s.g){var d=s.g[c],T=Array.prototype.indexOf.call(d,a,void 0),A;(A=0<=T)&&Array.prototype.splice.call(d,T,1),A&&(Jn(a),s.g[c].length==0&&(delete s.g[c],s.h--))}}function ws(s,a,c,d){for(var T=0;T<s.length;++T){var A=s[T];if(!A.da&&A.listener==a&&A.capture==!!c&&A.ha==d)return T}return-1}var vs="closure_lm_"+(1e6*Math.random()|0),Is={};function wa(s,a,c,d,T){if(d&&d.once)return Ia(s,a,c,d,T);if(Array.isArray(a)){for(var A=0;A<a.length;A++)wa(s,a[A],c,d,T);return null}return c=Ss(c),s&&s[cn]?s.K(a,c,f(d)?!!d.capture:!!d,T):va(s,a,c,!1,d,T)}function va(s,a,c,d,T,A){if(!a)throw Error("Invalid event type");var V=f(T)?!!T.capture:!!T,W=Es(s);if(W||(s[vs]=W=new Yn(s)),c=W.add(a,c,d,V,A),c.proxy)return c;if(d=$h(),c.proxy=d,d.src=s,d.listener=c,s.addEventListener)qh||(T=V),T===void 0&&(T=!1),s.addEventListener(a.toString(),d,T);else if(s.attachEvent)s.attachEvent(Ea(a.toString()),d);else if(s.addListener&&s.removeListener)s.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");return c}function $h(){function s(c){return a.call(s.src,s.listener,c)}let a=zh;return s}function Ia(s,a,c,d,T){if(Array.isArray(a)){for(var A=0;A<a.length;A++)Ia(s,a[A],c,d,T);return null}return c=Ss(c),s&&s[cn]?s.L(a,c,f(d)?!!d.capture:!!d,T):va(s,a,c,!0,d,T)}function Ta(s,a,c,d,T){if(Array.isArray(a))for(var A=0;A<a.length;A++)Ta(s,a[A],c,d,T);else d=f(d)?!!d.capture:!!d,c=Ss(c),s&&s[cn]?(s=s.i,a=String(a).toString(),a in s.g&&(A=s.g[a],c=ws(A,c,d,T),-1<c&&(Jn(A[c]),Array.prototype.splice.call(A,c,1),A.length==0&&(delete s.g[a],s.h--)))):s&&(s=Es(s))&&(a=s.g[a.toString()],s=-1,a&&(s=ws(a,c,d,T)),(c=-1<s?a[s]:null)&&Ts(c))}function Ts(s){if(typeof s!="number"&&s&&!s.da){var a=s.src;if(a&&a[cn])_s(a.i,s);else{var c=s.type,d=s.proxy;a.removeEventListener?a.removeEventListener(c,d,s.capture):a.detachEvent?a.detachEvent(Ea(c),d):a.addListener&&a.removeListener&&a.removeListener(d),(c=Es(a))?(_s(c,s),c.h==0&&(c.src=null,a[vs]=null)):Jn(s)}}}function Ea(s){return s in Is?Is[s]:Is[s]="on"+s}function zh(s,a){if(s.da)s=!0;else{a=new un(a,this);var c=s.listener,d=s.ha||s.src;
vendor: 44,295 bytes, line 1
1s.fa&&Ts(s),s=c.call(d,a)}return s}function Es(s){return s=s[vs],s instanceof Yn?s:null}var As="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ss(s){return typeof s=="function"?s:(s[As]||(s[As]=function(a){return s.handleEvent(a)}),s[As])}function ft(){Yt.call(this),this.i=new Yn(this),this.M=this,this.F=null}D(ft,Yt),ft.prototype[cn]=!0,ft.prototype.removeEventListener=function(s,a,c,d){Ta(this,s,a,c,d)};function _t(s,a){var c,d=s.F;if(d)for(c=[];d;d=d.F)c.push(d);if(s=s.M,d=a.type||a,typeof a=="string")a=new dt(a,s);else if(a instanceof dt)a.target=a.target||s;else{var T=a;a=new dt(d,s),_(a,T)}if(T=!0,c)for(var A=c.length-1;0<=A;A--){var V=a.g=c[A];T=Zn(V,d,!0,a)&&T}if(V=a.g=s,T=Zn(V,d,!0,a)&&T,T=Zn(V,d,!1,a)&&T,c)for(A=0;A<c.length;A++)V=a.g=c[A],T=Zn(V,d,!1,a)&&T}ft.prototype.N=function(){if(ft.aa.N.call(this),this.i){var s=this.i,a;for(a in s.g){for(var c=s.g[a],d=0;d<c.length;d++)Jn(c[d]);delete s.g[a],s.h--}}this.F=null},ft.prototype.K=function(s,a,c,d){return this.i.add(String(s),a,!1,c,d)},ft.prototype.L=function(s,a,c,d){return this.i.add(String(s),a,!0,c,d)};function Zn(s,a,c,d){if(a=s.i.g[String(a)],!a)return!0;a=a.concat();for(var T=!0,A=0;A<a.length;++A){var V=a[A];if(V&&!V.da&&V.capture==c){var W=V.listener,ht=V.ha||V.src;V.fa&&_s(s.i,V),T=W.call(ht,d)!==!1&&T}}return T&&!d.defaultPrevented}function Aa(s,a,c){if(typeof s=="function")c&&(s=S(s,c));else if(s&&typeof s.handleEvent=="function")s=S(s.handleEvent,s);else throw Error("Invalid listener argument");return 2147483647<Number(a)?-1:l.setTimeout(s,a||0)}function Sa(s){s.g=Aa(()=>{s.g=null,s.i&&(s.i=!1,Sa(s))},s.l);let a=s.h;s.h=null,s.m.apply(null,a)}class Gh extends Yt{constructor(a,c){super(),this.m=a,this.l=c,this.h=null,this.i=!1,this.g=null}j(a){this.h=arguments,this.g?this.i=!0:Sa(this)}N(){super.N(),this.g&&(l.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ln(s){Yt.call(this),this.h=s,this.g={}}D(ln,Yt);var ba=[];function Ra(s){H(s.g,function(a,c){this.g.hasOwnProperty(c)&&Ts(a)},s),s.g={}}ln.prototype.N=function(){ln.aa.N.call(this),Ra(this)},ln.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var bs=l.JSON.stringify,Kh=l.JSON.parse,Qh=class{stringify(s){return l.JSON.stringify(s,void 0)}parse(s){return l.JSON.parse(s,void 0)}};function Rs(){}Rs.prototype.h=null;function Pa(s){return s.h||(s.h=s.i())}function Va(){}var hn={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function Ps(){dt.call(this,"d")}D(Ps,dt);function Vs(){dt.call(this,"c")}D(Vs,dt);var de={},Ca=null;function tr(){return Ca=Ca||new ft}de.La="serverreachability";function Da(s){dt.call(this,de.La,s)}D(Da,dt);function dn(s){let a=tr();_t(a,new Da(a))}de.STAT_EVENT="statevent";function xa(s,a){dt.call(this,de.STAT_EVENT,s),this.stat=a}D(xa,dt);function wt(s){let a=tr();_t(a,new xa(a,s))}de.Ma="timingevent";function Na(s,a){dt.call(this,de.Ma,s),this.size=a}D(Na,dt);function fn(s,a){if(typeof s!="function")throw Error("Fn must not be null and must be a function");return l.setTimeout(function(){s()},a)}function mn(){this.g=!0}mn.prototype.xa=function(){this.g=!1};function Wh(s,a,c,d,T,A){s.info(function(){if(s.g)if(A)for(var V="",W=A.split("&"),ht=0;ht<W.length;ht++){var K=W[ht].split("=");if(1<K.length){var mt=K[0];K=K[1];var gt=mt.split("_");V=2<=gt.length&>[1]=="type"?V+(mt+"="+K+"&"):V+(mt+"=redacted&")}}else V=null;else V=A;return"XMLHTTP REQ ("+d+") [attempt "+T+"]: "+a+"\n"+c+"\n"+V})}function Hh(s,a,c,d,T,A,V){s.info(function(){return"XMLHTTP RESP ("+d+") [ attempt "+T+"]: "+a+"\n"+c+"\n"+A+" "+V})}function Ce(s,a,c,d){s.info(function(){return"XMLHTTP TEXT ("+a+"): "+Jh(s,c)+(d?" "+d:"")})}function Xh(s,a){s.info(function(){return"TIMEOUT: "+a})}mn.prototype.info=function(){};function Jh(s,a){if(!s.g)return a;if(!a)return null;try{var c=JSON.parse(a);if(c){for(s=0;s<c.length;s++)if(Array.isArray(c[s])){var d=c[s];if(!(2>d.length)){var T=d[1];if(Array.isArray(T)&&!(1>T.length)){var A=T[0];if(A!="noop"&&A!="stop"&&A!="close")for(var V=1;V<T.length;V++)T[V]=""}}}}return bs(c)}catch(W){return a}}var er={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},ka={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Cs;function nr(){}D(nr,Rs),nr.prototype.g=function(){return new XMLHttpRequest},nr.prototype.i=function(){return{}},Cs=new nr;function Zt(s,a,c,d){this.j=s,this.i=a,this.l=c,this.R=d||1,this.U=new ln(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Fa}function Fa(){this.i=null,this.g="",this.h=!1}var Oa={},Ds={};function xs(s,a,c){s.L=1,s.v=or(Bt(a)),s.m=c,s.P=!0,Ma(s,null)}function Ma(s,a){s.F=Date.now(),rr(s),s.A=Bt(s.v);var c=s.A,d=s.R;Array.isArray(d)||(d=[String(d)]),Ja(c.i,"t",d),s.C=0,c=s.j.J,s.h=new Fa,s.g=gu(s.j,c?a:null,!s.m),0<s.O&&(s.M=new Gh(S(s.Y,s,s.g),s.O)),a=s.U,c=s.g,d=s.ca;var T="readystatechange";Array.isArray(T)||(T&&(ba[0]=T.toString()),T=ba);for(var A=0;A<T.length;A++){var V=wa(c,T[A],d||a.handleEvent,!1,a.h||a);if(!V)break;a.g[V.key]=V}a=s.H?m(s.H):{},s.m?(s.u||(s.u="POST"),a["Content-Type"]="application/x-www-form-urlencoded",s.g.ea(s.A,s.u,s.m,a)):(s.u="GET",s.g.ea(s.A,s.u,null,a)),dn(),Wh(s.i,s.u,s.A,s.l,s.R,s.m)}Zt.prototype.ca=function(s){s=s.target;let a=this.M;a&&jt(s)==3?a.j():this.Y(s)},Zt.prototype.Y=function(s){try{if(s==this.g)t:{let gt=jt(this.g);var a=this.g.Ba();let Ne=this.g.Z();if(!(3>gt)&&(gt!=3||this.g&&(this.h.h||this.g.oa()||su(this.g)))){this.J||gt!=4||a==7||(a==8||0>=Ne?dn(3):dn(2)),Ns(this);var c=this.g.Z();this.X=c;e:if(La(this)){var d=su(this.g);s="";var T=d.length,A=jt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){fe(this),gn(this);var V="";break e}this.h.i=new l.TextDecoder}for(a=0;a<T;a++)this.h.h=!0,s+=this.h.i.decode(d[a],{stream:!(A&&a==T-1)});d.length=0,this.h.g+=s,this.C=0,V=this.h.g}else V=this.g.oa();if(this.o=c==200,Hh(this.i,this.u,this.A,this.l,this.R,gt,c),this.o){if(this.T&&!this.K){e:{if(this.g){var W,ht=this.g;if((W=ht.g?ht.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!B(W)){var K=W;break e}}K=null}if(c=K)Ce(this.i,this.l,c,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,ks(this,c);else{this.o=!1,this.s=3,wt(12),fe(this),gn(this);break t}}if(this.P){c=!0;let Vt;for(;!this.J&&this.C<V.length;)if(Vt=Yh(this,V),Vt==Ds){gt==4&&(this.s=4,wt(14),c=!1),Ce(this.i,this.l,null,"[Incomplete Response]");break}else if(Vt==Oa){this.s=4,wt(15),Ce(this.i,this.l,V,"[Invalid Chunk]"),c=!1;break}else Ce(this.i,this.l,Vt,null),ks(this,Vt);if(La(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),gt!=4||V.length!=0||this.h.h||(this.s=1,wt(16),c=!1),this.o=this.o&&c,!c)Ce(this.i,this.l,V,"[Invalid Chunked Response]"),fe(this),gn(this);else if(0<V.length&&!this.W){this.W=!0;var mt=this.j;mt.g==this&&mt.ba&&!mt.M&&(mt.j.info("Great, no buffering proxy detected. Bytes received: "+V.length),Us(mt),mt.M=!0,wt(11))}}else Ce(this.i,this.l,V,null),ks(this,V);gt==4&&fe(this),this.o&&!this.J&&(gt==4?hu(this.j,this):(this.o=!1,rr(this)))}else gd(this.g),c==400&&0<V.indexOf("Unknown SID")?(this.s=3,wt(12)):(this.s=0,wt(13)),fe(this),gn(this)}}}catch(gt){}finally{}};function La(s){return s.g?s.u=="GET"&&s.L!=2&&s.j.Ca:!1}function Yh(s,a){var c=s.C,d=a.indexOf("\n",c);return d==-1?Ds:(c=Number(a.substring(c,d)),isNaN(c)?Oa:(d+=1,d+c>a.length?Ds:(a=a.slice(d,d+c),s.C=d+c,a)))}Zt.prototype.cancel=function(){this.J=!0,fe(this)};function rr(s){s.S=Date.now()+s.I,qa(s,s.I)}function qa(s,a){if(s.B!=null)throw Error("WatchDog timer not null");s.B=fn(S(s.ba,s),a)}function Ns(s){s.B&&(l.clearTimeout(s.B),s.B=null)}Zt.prototype.ba=function(){this.B=null;let s=Date.now();0<=s-this.S?(Xh(this.i,this.A),this.L!=2&&(dn(),wt(17)),fe(this),this.s=2,gn(this)):qa(this,this.S-s)};function gn(s){s.j.G==0||s.J||hu(s.j,s)}function fe(s){Ns(s);var a=s.M;a&&typeof a.ma=="function"&&a.ma(),s.M=null,Ra(s.U),s.g&&(a=s.g,s.g=null,a.abort(),a.ma())}function ks(s,a){try{var c=s.j;if(c.G!=0&&(c.g==s||Fs(c.h,s))){if(!s.K&&Fs(c.h,s)&&c.G==3){try{var d=c.Da.g.parse(a)}catch(K){d=null}if(Array.isArray(d)&&d.length==3){var T=d;if(T[0]==0){t:if(!c.u){if(c.g)if(c.g.F+3e3<s.F)hr(c),cr(c);else break t;qs(c),wt(18)}}else c.za=T[1],0<c.za-c.T&&37500>T[2]&&c.F&&c.v==0&&!c.C&&(c.C=fn(S(c.Za,c),6e3));if(1>=ja(c.h)&&c.ca){try{c.ca()}catch(K){}c.ca=void 0}}else ge(c,11)}else if((s.K||c.g==s)&&hr(c),!B(a))for(T=c.Da.g.parse(a),a=0;a<T.length;a++){let K=T[a];if(c.T=K[0],K=K[1],c.G==2)if(K[0]=="c"){c.K=K[1],c.ia=K[2];let mt=K[3];mt!=null&&(c.la=mt,c.j.info("VER="+c.la));let gt=K[4];gt!=null&&(c.Aa=gt,c.j.info("SVER="+c.Aa));let Ne=K[5];Ne!=null&&typeof Ne=="number"&&0<Ne&&(d=1.5*Ne,c.L=d,c.j.info("backChannelRequestTimeoutMs_="+d)),d=c;let Vt=s.g;if(Vt){let fr=Vt.g?Vt.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(fr){var A=d.h;A.g||fr.indexOf("spdy")==-1&&fr.indexOf("quic")==-1&&fr.indexOf("h2")==-1||(A.j=A.l,A.g=new Set,A.h&&(Os(A,A.h),A.h=null))}if(d.D){let Bs=Vt.g?Vt.g.getResponseHeader("X-HTTP-Session-Id"):null;Bs&&(d.ya=Bs,X(d.I,d.D,Bs))}}c.G=3,c.l&&c.l.ua(),c.ba&&(c.R=Date.now()-s.F,c.j.info("Handshake RTT: "+c.R+"ms")),d=c;var V=s;if(d.qa=mu(d,d.J?d.ia:null,d.W),V.K){$a(d.h,V);var W=V,ht=d.L;ht&&(W.I=ht),W.B&&(Ns(W),rr(W)),d.g=V}else cu(d);0<c.i.length&&lr(c)}else K[0]!="stop"&&K[0]!="close"||ge(c,7);else c.G==3&&(K[0]=="stop"||K[0]=="close"?K[0]=="stop"?ge(c,7):Ls(c):K[0]!="noop"&&c.l&&c.l.ta(K),c.v=0)}}dn(4)}catch(K){}}var Zh=class{constructor(s,a){this.g=s,this.map=a}};function Ua(s){this.l=s||10,l.PerformanceNavigationTiming?(s=l.performance.getEntriesByType("navigation"),s=0<s.length&&(s[0].nextHopProtocol=="hq"||s[0].nextHopProtocol=="h2")):s=!!(l.chrome&&l.chrome.loadTimes&&l.chrome.loadTimes()&&l.chrome.loadTimes().wasFetchedViaSpdy),this.j=s?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Ba(s){return s.h?!0:s.g?s.g.size>=s.j:!1}function ja(s){return s.h?1:s.g?s.g.size:0}function Fs(s,a){return s.h?s.h==a:s.g?s.g.has(a):!1}function Os(s,a){s.g?s.g.add(a):s.h=a}function $a(s,a){s.h&&s.h==a?s.h=null:s.g&&s.g.has(a)&&s.g.delete(a)}Ua.prototype.cancel=function(){if(this.i=za(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let s of this.g.values())s.cancel();this.g.clear()}};function za(s){if(s.h!=null)return s.i.concat(s.h.D);if(s.g!=null&&s.g.size!==0){let a=s.i;for(let c of s.g.values())a=a.concat(c.D);return a}return F(s.i)}function td(s){if(s.V&&typeof s.V=="function")return s.V();if(typeof Map<"u"&&s instanceof Map||typeof Set<"u"&&s instanceof Set)return Array.from(s.values());if(typeof s=="string")return s.split("");if(h(s)){for(var a=[],c=s.length,d=0;d<c;d++)a.push(s[d]);return a}a=[],c=0;for(d in s)a[c++]=s[d];return a}function ed(s){if(s.na&&typeof s.na=="function")return s.na();if(!s.V||typeof s.V!="function"){if(typeof Map<"u"&&s instanceof Map)return Array.from(s.keys());if(!(typeof Set<"u"&&s instanceof Set)){if(h(s)||typeof s=="string"){var a=[];s=s.length;for(var c=0;c<s;c++)a.push(c);return a}a=[],c=0;for(let d in s)a[c++]=d;return a}}}function Ga(s,a){if(s.forEach&&typeof s.forEach=="function")s.forEach(a,void 0);else if(h(s)||typeof s=="string")Array.prototype.forEach.call(s,a,void 0);else for(var c=ed(s),d=td(s),T=d.length,A=0;A<T;A++)a.call(void 0,d[A],c&&c[A],s)}var Ka=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function nd(s,a){if(s){s=s.split("&");for(var c=0;c<s.length;c++){var d=s[c].indexOf("="),T=null;if(0<=d){var A=s[c].substring(0,d);T=s[c].substring(d+1)}else A=s[c];a(A,T?decodeURIComponent(T.replace(/\+/g," ")):"")}}}function me(s){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,s instanceof me){this.h=s.h,sr(this,s.j),this.o=s.o,this.g=s.g,ir(this,s.s),this.l=s.l;var a=s.i,c=new _n;c.i=a.i,a.g&&(c.g=new Map(a.g),c.h=a.h),Qa(this,c),this.m=s.m}else s&&(a=String(s).match(Ka))?(this.h=!1,sr(this,a[1]||"",!0),this.o=pn(a[2]||""),this.g=pn(a[3]||"",!0),ir(this,a[4]),this.l=pn(a[5]||"",!0),Qa(this,a[6]||"",!0),this.m=pn(a[7]||"")):(this.h=!1,this.i=new _n(null,this.h))}me.prototype.toString=function(){var s=[],a=this.j;a&&s.push(yn(a,Wa,!0),":");var c=this.g;return(c||a=="file")&&(s.push("//"),(a=this.o)&&s.push(yn(a,Wa,!0),"@"),s.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.s,c!=null&&s.push(":",String(c))),(c=this.l)&&(this.g&&c.charAt(0)!="/"&&s.push("/"),s.push(yn(c,c.charAt(0)=="/"?id:sd,!0))),(c=this.i.toString())&&s.push("?",c),(c=this.m)&&s.push("#",yn(c,ad)),s.join("")};function Bt(s){return new me(s)}function sr(s,a,c){s.j=c?pn(a,!0):a,s.j&&(s.j=s.j.replace(/:$/,""))}function ir(s,a){if(a){if(a=Number(a),isNaN(a)||0>a)throw Error("Bad port number "+a);s.s=a}else s.s=null}function Qa(s,a,c){a instanceof _n?(s.i=a,ud(s.i,s.h)):(c||(a=yn(a,od)),s.i=new _n(a,s.h))}function X(s,a,c){s.i.set(a,c)}function or(s){return X(s,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),s}function pn(s,a){return s?a?decodeURI(s.replace(/%25/g,"%2525")):decodeURIComponent(s):""}function yn(s,a,c){return typeof s=="string"?(s=encodeURI(s).replace(a,rd),c&&(s=s.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),s):null}function rd(s){return s=s.charCodeAt(0),"%"+(s>>4&15).toString(16)+(s&15).toString(16)}var Wa=/[#\/\?@]/g,sd=/[#\?:]/g,id=/[#\?]/g,od=/[#\?@]/g,ad=/#/g;function _n(s,a){this.h=this.g=null,this.i=s||null,this.j=!!a}function te(s){s.g||(s.g=new Map,s.h=0,s.i&&nd(s.i,function(a,c){s.add(decodeURIComponent(a.replace(/\+/g," ")),c)}))}n=_n.prototype,n.add=function(s,a){te(this),this.i=null,s=De(this,s);var c=this.g.get(s);return c||this.g.set(s,c=[]),c.push(a),this.h+=1,this};function Ha(s,a){te(s),a=De(s,a),s.g.has(a)&&(s.i=null,s.h-=s.g.get(a).length,s.g.delete(a))}function Xa(s,a){return te(s),a=De(s,a),s.g.has(a)}n.forEach=function(s,a){te(this),this.g.forEach(function(c,d){c.forEach(function(T){s.call(a,T,d,this)},this)},this)},n.na=function(){te(this);let s=Array.from(this.g.values()),a=Array.from(this.g.keys()),c=[];for(let d=0;d<a.length;d++){let T=s[d];for(let A=0;A<T.length;A++)c.push(a[d])}return c},n.V=function(s){te(this);let a=[];if(typeof s=="string")Xa(this,s)&&(a=a.concat(this.g.get(De(this,s))));else{s=Array.from(this.g.values());for(let c=0;c<s.length;c++)a=a.concat(s[c])}return a},n.set=function(s,a){return te(this),this.i=null,s=De(this,s),Xa(this,s)&&(this.h-=this.g.get(s).length),this.g.set(s,[a]),this.h+=1,this},n.get=function(s,a){return s?(s=this.V(s),0<s.length?String(s[0]):a):a};function Ja(s,a,c){Ha(s,a),0<c.length&&(s.i=null,s.g.set(De(s,a),F(c)),s.h+=c.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";let s=[],a=Array.from(this.g.keys());for(var c=0;c<a.length;c++){var d=a[c];let A=encodeURIComponent(String(d)),V=this.V(d);for(d=0;d<V.length;d++){var T=A;V[d]!==""&&(T+="="+encodeURIComponent(String(V[d]))),s.push(T)}}return this.i=s.join("&")};function De(s,a){return a=String(a),s.j&&(a=a.toLowerCase()),a}function ud(s,a){a&&!s.j&&(te(s),s.i=null,s.g.forEach(function(c,d){var T=d.toLowerCase();d!=T&&(Ha(this,d),Ja(this,T,c))},s)),s.j=a}function cd(s,a){let c=new mn;if(l.Image){let d=new Image;d.onload=P(ee,c,"TestLoadImage: loaded",!0,a,d),d.onerror=P(ee,c,"TestLoadImage: error",!1,a,d),d.onabort=P(ee,c,"TestLoadImage: abort",!1,a,d),d.ontimeout=P(ee,c,"TestLoadImage: timeout",!1,a,d),l.setTimeout(function(){d.ontimeout&&d.ontimeout()},1e4),d.src=s}else a(!1)}function ld(s,a){let c=new mn,d=new AbortController,T=setTimeout(()=>{d.abort(),ee(c,"TestPingServer: timeout",!1,a)},1e4);fetch(s,{signal:d.signal}).then(A=>{clearTimeout(T),A.ok?ee(c,"TestPingServer: ok",!0,a):ee(c,"TestPingServer: server error",!1,a)}).catch(()=>{clearTimeout(T),ee(c,"TestPingServer: error",!1,a)})}function ee(s,a,c,d,T){try{T&&(T.onload=null,T.onerror=null,T.onabort=null,T.ontimeout=null),d(c)}catch(A){}}function hd(){this.g=new Qh}function dd(s,a,c){let d=c||"";try{Ga(s,function(T,A){let V=T;f(T)&&(V=bs(T)),a.push(d+A+"="+encodeURIComponent(V))})}catch(T){throw a.push(d+"type="+encodeURIComponent("_badmap")),T}}function wn(s){this.l=s.Ub||null,this.j=s.eb||!1}D(wn,Rs),wn.prototype.g=function(){return new ar(this.l,this.j)},wn.prototype.i=(function(s){return function(){return s}})({});function ar(s,a){ft.call(this),this.D=s,this.o=a,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}D(ar,ft),n=ar.prototype,n.open=function(s,a){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=s,this.A=a,this.readyState=1,In(this)},n.send=function(s){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;let a={headers:this.u,method:this.B,credentials:this.m,cache:void 0};s&&(a.body=s),(this.D||l).fetch(new Request(this.A,a)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,vn(this)),this.readyState=0},n.Sa=function(s){if(this.g&&(this.l=s,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=s.headers,this.readyState=2,In(this)),this.g&&(this.readyState=3,In(this),this.g)))if(this.responseType==="arraybuffer")s.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof l.ReadableStream<"u"&&"body"in s){if(this.j=s.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Ya(this)}else s.text().then(this.Ra.bind(this),this.ga.bind(this))};function Ya(s){s.j.read().then(s.Pa.bind(s)).catch(s.ga.bind(s))}n.Pa=function(s){if(this.g){if(this.o&&s.value)this.response.push(s.value);else if(!this.o){var a=s.value?s.value:new Uint8Array(0);(a=this.v.decode(a,{stream:!s.done}))&&(this.response=this.responseText+=a)}s.done?vn(this):In(this),this.readyState==3&&Ya(this)}},n.Ra=function(s){this.g&&(this.response=this.responseText=s,vn(this))},n.Qa=function(s){this.g&&(this.response=s,vn(this))},n.ga=function(){this.g&&vn(this)};function vn(s){s.readyState=4,s.l=null,s.j=null,s.v=null,In(s)}n.setRequestHeader=function(s,a){this.u.append(s,a)},n.getResponseHeader=function(s){return this.h&&this.h.get(s.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";let s=[],a=this.h.entries();for(var c=a.next();!c.done;)c=c.value,s.push(c[0]+": "+c[1]),c=a.next();return s.join("\r\n")};function In(s){s.onreadystatechange&&s.onreadystatechange.call(s)}Object.defineProperty(ar.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(s){this.m=s?"include":"same-origin"}});function Za(s){let a="";return H(s,function(c,d){a+=d,a+=":",a+=c,a+="\r\n"}),a}function Ms(s,a,c){t:{for(d in c){var d=!1;break t}d=!0}d||(c=Za(c),typeof s=="string"?c!=null&&encodeURIComponent(String(c)):X(s,a,c))}function tt(s){ft.call(this),this.headers=new Map,this.o=s||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}D(tt,ft);var fd=/^https?$/i,md=["POST","PUT"];n=tt.prototype,n.Ha=function(s){this.J=s},n.ea=function(s,a,c,d){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+s);a=a?a.toUpperCase():"GET",this.D=s,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Cs.g(),this.v=this.o?Pa(this.o):Pa(Cs),this.g.onreadystatechange=S(this.Ea,this);try{this.B=!0,this.g.open(a,String(s),!0),this.B=!1}catch(A){tu(this,A);return}if(s=c||"",c=new Map(this.headers),d)if(Object.getPrototypeOf(d)===Object.prototype)for(var T in d)c.set(T,d[T]);else if(typeof d.keys=="function"&&typeof d.get=="function")for(let A of d.keys())c.set(A,d.get(A));else throw Error("Unknown input type for opt_headers: "+String(d));d=Array.from(c.keys()).find(A=>A.toLowerCase()=="content-type"),T=l.FormData&&s instanceof l.FormData,!(0<=Array.prototype.indexOf.call(md,a,void 0))||d||T||c.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(let[A,V]of c)this.g.setRequestHeader(A,V);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{ru(this),this.u=!0,this.g.send(s),this.u=!1}catch(A){tu(this,A)}};function tu(s,a){s.h=!1,s.g&&(s.j=!0,s.g.abort(),s.j=!1),s.l=a,s.m=5,eu(s),ur(s)}function eu(s){s.A||(s.A=!0,_t(s,"complete"),_t(s,"error"))}n.abort=function(s){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=s||7,_t(this,"complete"),_t(this,"abort"),ur(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),ur(this,!0)),tt.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?nu(this):this.bb())},n.bb=function(){nu(this)};function nu(s){if(s.h&&typeof u<"u"&&(!s.v[1]||jt(s)!=4||s.Z()!=2)){if(s.u&&jt(s)==4)Aa(s.Ea,0,s);else if(_t(s,"readystatechange"),jt(s)==4){s.h=!1;try{let V=s.Z();t:switch(V){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var a=!0;break t;default:a=!1}var c;if(!(c=a)){var d;if(d=V===0){var T=String(s.D).match(Ka)[1]||null;!T&&l.self&&l.self.location&&(T=l.self.location.protocol.slice(0,-1)),d=!fd.test(T?T.toLowerCase():"")}c=d}if(c)_t(s,"complete"),_t(s,"success");else{s.m=6;try{var A=2<jt(s)?s.g.statusText:""}catch(W){A=""}s.l=A+" ["+s.Z()+"]",eu(s)}}finally{ur(s)}}}}function ur(s,a){if(s.g){ru(s);let c=s.g,d=s.v[0]?()=>{}:null;s.g=null,s.v=null,a||_t(s,"ready");try{c.onreadystatechange=d}catch(T){}}}function ru(s){s.I&&(l.clearTimeout(s.I),s.I=null)}n.isActive=function(){return!!this.g};function jt(s){return s.g?s.g.readyState:0}n.Z=function(){try{return 2<jt(this)?this.g.status:-1}catch(s){return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch(s){return""}},n.Oa=function(s){if(this.g){var a=this.g.responseText;return s&&a.indexOf(s)==0&&(a=a.substring(s.length)),Kh(a)}};function su(s){try{if(!s.g)return null;if("response"in s.g)return s.g.response;switch(s.H){case"":case"text":return s.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in s.g)return s.g.mozResponseArrayBuffer}return null}catch(a){return null}}function gd(s){let a={};s=(s.g&&2<=jt(s)&&s.g.getAllResponseHeaders()||"").split("\r\n");for(let d=0;d<s.length;d++){if(B(s[d]))continue;var c=v(s[d]);let T=c[0];if(c=c[1],typeof c!="string")continue;c=c.trim();let A=a[T]||[];a[T]=A,A.push(c)}I(a,function(d){return d.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Tn(s,a,c){return c&&c.internalChannelParams&&c.internalChannelParams[s]||a}function iu(s){this.Aa=0,this.i=[],this.j=new mn,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=Tn("failFast",!1,s),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=Tn("baseRetryDelayMs",5e3,s),this.cb=Tn("retryDelaySeedMs",1e4,s),this.Wa=Tn("forwardChannelMaxRetries",2,s),this.wa=Tn("forwardChannelRequestTimeoutMs",2e4,s),this.pa=s&&s.xmlHttpFactory||void 0,this.Xa=s&&s.Tb||void 0,this.Ca=s&&s.useFetchStreams||!1,this.L=void 0,this.J=s&&s.supportsCrossDomainXhr||!1,this.K="",this.h=new Ua(s&&s.concurrentRequestLimit),this.Da=new hd,this.P=s&&s.fastHandshake||!1,this.O=s&&s.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=s&&s.Rb||!1,s&&s.xa&&this.j.xa(),s&&s.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&s&&s.detectBufferingProxy||!1,this.ja=void 0,s&&s.longPollingTimeout&&0<s.longPollingTimeout&&(this.ja=s.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=iu.prototype,n.la=8,n.G=1,n.connect=function(s,a,c,d){wt(0),this.W=s,this.H=a||{},c&&d!==void 0&&(this.H.OSID=c,this.H.OAID=d),this.F=this.X,this.I=mu(this,null,this.W),lr(this)};function Ls(s){if(ou(s),s.G==3){var a=s.U++,c=Bt(s.I);if(X(c,"SID",s.K),X(c,"RID",a),X(c,"TYPE","terminate"),En(s,c),a=new Zt(s,s.j,a),a.L=2,a.v=or(Bt(c)),c=!1,l.navigator&&l.navigator.sendBeacon)try{c=l.navigator.sendBeacon(a.v.toString(),"")}catch(d){}!c&&l.Image&&(new Image().src=a.v,c=!0),c||(a.g=gu(a.j,null),a.g.ea(a.v)),a.F=Date.now(),rr(a)}fu(s)}function cr(s){s.g&&(Us(s),s.g.cancel(),s.g=null)}function ou(s){cr(s),s.u&&(l.clearTimeout(s.u),s.u=null),hr(s),s.h.cancel(),s.s&&(typeof s.s=="number"&&l.clearTimeout(s.s),s.s=null)}function lr(s){if(!Ba(s.h)&&!s.s){s.s=!0;var a=s.Ga;on||_a(),an||(on(),an=!0),ys.add(a,s),s.B=0}}function pd(s,a){return ja(s.h)>=s.h.j-(s.s?1:0)?!1:s.s?(s.i=a.D.concat(s.i),!0):s.G==1||s.G==2||s.B>=(s.Va?0:s.Wa)?!1:(s.s=fn(S(s.Ga,s,a),du(s,s.B)),s.B++,!0)}n.Ga=function(s){if(this.s)if(this.s=null,this.G==1){if(!s){this.U=Math.floor(1e5*Math.random()),s=this.U++;let T=new Zt(this,this.j,s),A=this.o;if(this.S&&(A?(A=m(A),_(A,this.S)):A=this.S),this.m!==null||this.O||(T.H=A,A=null),this.P)t:{for(var a=0,c=0;c<this.i.length;c++){e:{var d=this.i[c];if("__data__"in d.map&&(d=d.map.__data__,typeof d=="string")){d=d.length;break e}d=void 0}if(d===void 0)break;if(a+=d,4096<a){a=c;break t}if(a===4096||c===this.i.length-1){a=c+1;break t}}a=1e3}else a=1e3;a=uu(this,T,a),c=Bt(this.I),X(c,"RID",s),X(c,"CVER",22),this.D&&X(c,"X-HTTP-Session-Id",this.D),En(this,c),A&&(this.O?a="headers="+encodeURIComponent(String(Za(A)))+"&"+a:this.m&&Ms(c,this.m,A)),Os(this.h,T),this.Ua&&X(c,"TYPE","init"),this.P?(X(c,"$req",a),X(c,"SID","null"),T.T=!0,xs(T,c,null)):xs(T,c,a),this.G=2}}else this.G==3&&(s?au(this,s):this.i.length==0||Ba(this.h)||au(this))};function au(s,a){var c;a?c=a.l:c=s.U++;let d=Bt(s.I);X(d,"SID",s.K),X(d,"RID",c),X(d,"AID",s.T),En(s,d),s.m&&s.o&&Ms(d,s.m,s.o),c=new Zt(s,s.j,c,s.B+1),s.m===null&&(c.H=s.o),a&&(s.i=a.D.concat(s.i)),a=uu(s,c,1e3),c.I=Math.round(.5*s.wa)+Math.round(.5*s.wa*Math.random()),Os(s.h,c),xs(c,d,a)}function En(s,a){s.H&&H(s.H,function(c,d){X(a,d,c)}),s.l&&Ga({},function(c,d){X(a,d,c)})}function uu(s,a,c){c=Math.min(s.i.length,c);var d=s.l?S(s.l.Na,s.l,s):null;t:{var T=s.i;let A=-1;for(;;){let V=["count="+c];A==-1?0<c?(A=T[0].g,V.push("ofs="+A)):A=0:V.push("ofs="+A);let W=!0;for(let ht=0;ht<c;ht++){let K=T[ht].g,mt=T[ht].map;if(K-=A,0>K)A=Math.max(0,T[ht].g-100),W=!1;else try{dd(mt,V,"req"+K+"_")}catch(gt){d&&d(mt)}}if(W){d=V.join("&");break t}}}return s=s.i.splice(0,c),a.D=s,d}function cu(s){if(!s.g&&!s.u){s.Y=1;var a=s.Fa;on||_a(),an||(on(),an=!0),ys.add(a,s),s.v=0}}function qs(s){return s.g||s.u||3<=s.v?!1:(s.Y++,s.u=fn(S(s.Fa,s),du(s,s.v)),s.v++,!0)}n.Fa=function(){if(this.u=null,lu(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var s=2*this.R;this.j.info("BP detection timer enabled: "+s),this.A=fn(S(this.ab,this),s)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,wt(10),cr(this),lu(this))};function Us(s){s.A!=null&&(l.clearTimeout(s.A),s.A=null)}function lu(s){s.g=new Zt(s,s.j,"rpc",s.Y),s.m===null&&(s.g.H=s.o),s.g.O=0;var a=Bt(s.qa);X(a,"RID","rpc"),X(a,"SID",s.K),X(a,"AID",s.T),X(a,"CI",s.F?"0":"1"),!s.F&&s.ja&&X(a,"TO",s.ja),X(a,"TYPE","xmlhttp"),En(s,a),s.m&&s.o&&Ms(a,s.m,s.o),s.L&&(s.g.I=s.L);var c=s.g;s=s.ia,c.L=1,c.v=or(Bt(a)),c.m=null,c.P=!0,Ma(c,s)}n.Za=function(){this.C!=null&&(this.C=null,cr(this),qs(this),wt(19))};function hr(s){s.C!=null&&(l.clearTimeout(s.C),s.C=null)}function hu(s,a){var c=null;if(s.g==a){hr(s),Us(s),s.g=null;var d=2}else if(Fs(s.h,a))c=a.D,$a(s.h,a),d=1;else return;if(s.G!=0){if(a.o)if(d==1){c=a.m?a.m.length:0,a=Date.now()-a.F;var T=s.B;d=tr(),_t(d,new Na(d,c)),lr(s)}else cu(s);else if(T=a.s,T==3||T==0&&0<a.X||!(d==1&&pd(s,a)||d==2&&qs(s)))switch(c&&0<c.length&&(a=s.h,a.i=a.i.concat(c)),T){case 1:ge(s,5);break;case 4:ge(s,10);break;case 3:ge(s,6);break;default:ge(s,2)}}}function du(s,a){let c=s.Ta+Math.floor(Math.random()*s.cb);return s.isActive()||(c*=2),c*a}function ge(s,a){if(s.j.info("Error code "+a),a==2){var c=S(s.fb,s),d=s.Xa;let T=!d;d=new me(d||"//www.google.com/images/cleardot.gif"),l.location&&l.location.protocol=="http"||sr(d,"https"),or(d),T?cd(d.toString(),c):ld(d.toString(),c)}else wt(2);s.G=0,s.l&&s.l.sa(a),fu(s),ou(s)}n.fb=function(s){s?(this.j.info("Successfully pinged google.com"),wt(2)):(this.j.info("Failed to ping google.com"),wt(1))};function fu(s){if(s.G=0,s.ka=[],s.l){let a=za(s.h);(a.length!=0||s.i.length!=0)&&(C(s.ka,a),C(s.ka,s.i),s.h.i.length=0,F(s.i),s.i.length=0),s.l.ra()}}function mu(s,a,c){var d=c instanceof me?Bt(c):new me(c);if(d.g!="")a&&(d.g=a+"."+d.g),ir(d,d.s);else{var T=l.location;d=T.protocol,a=a?a+"."+T.hostname:T.hostname,T=+T.port;var A=new me(null);d&&sr(A,d),a&&(A.g=a),T&&ir(A,T),c&&(A.l=c),d=A}return c=s.D,a=s.ya,c&&a&&X(d,c,a),X(d,"VER",s.la),En(s,d),d}function gu(s,a,c){if(a&&!s.J)throw Error("Can't create secondary domain capable XhrIo object.");return a=s.Ca&&!s.pa?new tt(new wn({eb:c})):new tt(s.pa),a.Ha(s.J),a}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function pu(){}n=pu.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function dr(){}dr.prototype.g=function(s,a){return new vt(s,a)};function vt(s,a){ft.call(this),this.g=new iu(a),this.l=s,this.h=a&&a.messageUrlParams||null,s=a&&a.messageHeaders||null,a&&a.clientProtocolHeaderRequired&&(s?s["X-Client-Protocol"]="webchannel":s={"X-Client-Protocol":"webchannel"}),this.g.o=s,s=a&&a.initMessageHeaders||null,a&&a.messageContentType&&(s?s["X-WebChannel-Content-Type"]=a.messageContentType:s={"X-WebChannel-Content-Type":a.messageContentType}),a&&a.va&&(s?s["X-WebChannel-Client-Profile"]=a.va:s={"X-WebChannel-Client-Profile":a.va}),this.g.S=s,(s=a&&a.Sb)&&!B(s)&&(this.g.m=s),this.v=a&&a.supportsCrossDomainXhr||!1,this.u=a&&a.sendRawJson||!1,(a=a&&a.httpSessionIdParam)&&!B(a)&&(this.g.D=a,s=this.h,s!==null&&a in s&&(s=this.h,a in s&&delete s[a])),this.j=new xe(this)}D(vt,ft),vt.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},vt.prototype.close=function(){Ls(this.g)},vt.prototype.o=function(s){var a=this.g;if(typeof s=="string"){var c={};c.__data__=s,s=c}else this.u&&(c={},c.__data__=bs(s),s=c);a.i.push(new Zh(a.Ya++,s)),a.G==3&&lr(a)},vt.prototype.N=function(){this.g.l=null,delete this.j,Ls(this.g),delete this.g,vt.aa.N.call(this)};function yu(s){Ps.call(this),s.__headers__&&(this.headers=s.__headers__,this.statusCode=s.__status__,delete s.__headers__,delete s.__status__);var a=s.__sm__;if(a){t:{for(let c in a){s=c;break t}s=void 0}(this.i=s)&&(s=this.i,a=a!==null&&s in a?a[s]:void 0),this.data=a}else this.data=s}D(yu,Ps);function _u(){Vs.call(this),this.status=1}D(_u,Vs);function xe(s){this.g=s}D(xe,pu),xe.prototype.ua=function(){_t(this.g,"a")},xe.prototype.ta=function(s){_t(this.g,new yu(s))},xe.prototype.sa=function(s){_t(this.g,new _u)},xe.prototype.ra=function(){_t(this.g,"b")},dr.prototype.createWebChannel=dr.prototype.g,vt.prototype.send=vt.prototype.o,vt.prototype.open=vt.prototype.m,vt.prototype.close=vt.prototype.close,Ws=zt.createWebChannelTransport=function(){return new dr},Qs=zt.getStatEventTarget=function(){return tr()},Ks=zt.Event=de,pr=zt.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},er.NO_ERROR=0,er.TIMEOUT=8,er.HTTP_ERROR=6,bn=zt.ErrorCode=er,ka.COMPLETE="complete",Gs=zt.EventType=ka,Va.EventType=hn,hn.OPEN="a",hn.CLOSE="b",hn.ERROR="c",hn.MESSAGE="d",ft.prototype.listen=ft.prototype.K,ke=zt.WebChannel=Va,yd=zt.FetchXmlHttpFactory=wn,tt.prototype.listenOnce=tt.prototype.L,tt.prototype.getLastError=tt.prototype.Ka,tt.prototype.getLastErrorCode=tt.prototype.Ba,tt.prototype.getStatus=tt.prototype.Z,tt.prototype.getResponseJson=tt.prototype.Oa,tt.prototype.getResponseText=tt.prototype.oa,tt.prototype.send=tt.prototype.ea,tt.prototype.setWithCredentials=tt.prototype.Ha,zs=zt.XhrIo=tt}).apply(typeof gr<"u"?gr:typeof self<"u"?self:typeof window<"u"?window:{});var Hu="@firebase/firestore",Xu="4.8.0";var ut=class{constructor(t){this.uid=t}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}};ut.UNAUTHENTICATED=new ut(null),ut.GOOGLE_CREDENTIALS=new ut("google-credentials-uid"),ut.FIRST_PARTY=new ut("first-party-uid"),ut.MOCK_USER=new ut("mock-user");var tn="11.10.0";var ve=new zu("@firebase/firestore");function Fe(){return ve.logLevel}function k(n,...t){if(ve.logLevel<=Nt.DEBUG){let e=t.map(jo);ve.debug("Firestore (".concat(tn,"): ").concat(n),...e)}}function Gt(n,...t){if(ve.logLevel<=Nt.ERROR){let e=t.map(jo);ve.error("Firestore (".concat(tn,"): ").concat(n),...e)}}function oe(n,...t){if(ve.logLevel<=Nt.WARN){let e=t.map(jo);ve.warn("Firestore (".concat(tn,"): ").concat(n),...e)}}function jo(n){if(typeof n=="string")return n;try{return(function(e){return JSON.stringify(e)})(n)}catch(t){return n}}function M(n,t,e){let r="Unexpected state";typeof t=="string"?r=t:e=t,$c(n,r,e)}function $c(n,t,e){let r="FIRESTORE (".concat(tn,") INTERNAL ASSERTION FAILED: ").concat(t," (ID: ").concat(n.toString(16),")");if(e!==void 0)try{r+=" CONTEXT: "+JSON.stringify(e)}catch(i){r+=" CONTEXT: "+e}throw Gt(r),new Error(r)}function Q(n,t,e,r){let i="Unexpected state";typeof e=="string"?i=e:r=e,n||$c(t,i,r)}function L(n,t){return n}var b={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"},x=class extends Bu{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>"".concat(this.name,": [code=").concat(this.code,"]: ").concat(this.message)}};var kt=class{constructor(){this.promise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}};var Er=class{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer ".concat(t))}},ti=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable(()=>e(ut.UNAUTHENTICATED))}shutdown(){}},ei=class{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable(()=>e(this.token.user))}shutdown(){this.changeListener=null}},ni=class{constructor(t){this.t=t,this.currentUser=ut.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){Q(this.o===void 0,42304);let r=this.i,i=h=>this.i!==r?(r=this.i,e(h)):Promise.resolve(),o=new kt;this.o=()=>{this.i++,this.currentUser=this.u(),o.resolve(),o=new kt,t.enqueueRetryable(()=>i(this.currentUser))};let u=()=>{let h=o;t.enqueueRetryable(()=>N(this,null,function*(){yield h.promise,yield i(this.currentUser)}))},l=h=>{k("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=h,this.o&&(this.auth.addAuthTokenListener(this.o),u())};this.t.onInit(h=>l(h)),setTimeout(()=>{if(!this.auth){let h=this.t.getImmediate({optional:!0});h?l(h):(k("FirebaseAuthCredentialsProvider","Auth not yet detected"),o.resolve(),o=new kt)}},0),u()}getToken(){let t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then(r=>this.i!==t?(k("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Q(typeof r.accessToken=="string",31837,{l:r}),new Er(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let t=this.auth&&this.auth.getUid();return Q(t===null||typeof t=="string",2055,{h:t}),new ut(t)}},ri=class{constructor(t,e,r){this.P=t,this.T=e,this.I=r,this.type="FirstParty",this.user=ut.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);let t=this.R();return t&&this.A.set("Authorization",t),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}},si=class{constructor(t,e,r){this.P=t,this.T=e,this.I=r}getToken(){return Promise.resolve(new ri(this.P,this.T,this.I))}start(t,e){t.enqueueRetryable(()=>e(ut.FIRST_PARTY))}shutdown(){}invalidateToken(){}},Ar=class{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}},ii=class{constructor(t,e){this.V=e,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,bu(t)&&t.settings.appCheckToken&&(this.p=t.settings.appCheckToken)}start(t,e){Q(this.o===void 0,3512);let r=o=>{o.error!=null&&k("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: ".concat(o.error.message));let u=o.token!==this.m;return this.m=o.token,k("FirebaseAppCheckTokenProvider","Received ".concat(u?"new":"existing"," token.")),u?e(o.token):Promise.resolve()};this.o=o=>{t.enqueueRetryable(()=>r(o))};let i=o=>{k("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=o,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(o=>i(o)),setTimeout(()=>{if(!this.appCheck){let o=this.V.getImmediate({optional:!0});o?i(o):k("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Ar(this.p));let t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then(e=>e?(Q(typeof e.token=="string",44558,{tokenResult:e}),this.m=e.token,new Ar(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function _d(n){let t=typeof self<"u"&&(self.crypto||self.msCrypto),e=new Uint8Array(n);if(t&&typeof t.getRandomValues=="function")t.getRandomValues(e);else for(let r=0;r<n;r++)e[r]=Math.floor(256*Math.random());return e}function zc(){return new TextEncoder}var xn=class{static newId(){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(4.129032258064516),r="";for(;r.length<20;){let i=_d(40);for(let o=0;o<i.length;++o)r.length<20&&i[o]<e&&(r+=t.charAt(i[o]%62))}return r}};function U(n,t){return n<t?-1:n>t?1:0}function oi(n,t){let e=0;for(;e<n.length&&e<t.length;){let r=n.codePointAt(e),i=t.codePointAt(e);if(r!==i){if(r<128&&i<128)return U(r,i);{let o=zc(),u=wd(o.encode(Ju(n,e)),o.encode(Ju(t,e)));return u!==0?u:U(r,i)}}e+=r>65535?2:1}return U(n.length,t.length)}function Ju(n,t){return n.codePointAt(t)>65535?n.substring(t,t+2):n.substring(t,t+1)}function wd(n,t){for(let e=0;e<n.length&&e<t.length;++e)if(n[e]!==t[e])return U(n[e],t[e]);return U(n.length,t.length)}function $e(n,t,e){return n.length===t.length&&n.every((r,i)=>e(r,t[i]))}var Yu="__name__",Sr=class n{constructor(t,e,r){e===void 0?e=0:e>t.length&&M(637,{offset:e,range:t.length}),r===void 0?r=t.length-e:r>t.length-e&&M(1746,{length:r,range:t.length-e}),this.segments=t,this.offset=e,this.len=r}get length(){return this.len}isEqual(t){return n.comparator(this,t)===0}child(t){let e=this.segments.slice(this.offset,this.limit());return t instanceof n?t.forEach(r=>{e.push(r)}):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=t===void 0?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return this.length===0}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,r=this.limit();e<r;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){let r=Math.min(t.length,e.length);for(let i=0;i<r;i++){let o=n.compareSegments(t.get(i),e.get(i));if(o!==0)return o}return U(t.length,e.length)}static compareSegments(t,e){let r=n.isNumericId(t),i=n.isNumericId(e);return r&&!i?-1:!r&&i?1:r&&i?n.extractNumericId(t).compare(n.extractNumericId(e)):oi(t,e)}static isNumericId(t){return t.startsWith("__id")&&t.endsWith("__")}static extractNumericId(t){return $t.fromString(t.substring(4,t.length-2))}},J=class n extends Sr{construct(t,e,r){return new n(t,e,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...t){let e=[];for(let r of t){if(r.indexOf("//")>=0)throw new x(b.INVALID_ARGUMENT,"Invalid segment (".concat(r,"). Paths must not contain // in them."));e.push(...r.split("/").filter(i=>i.length>0))}return new n(e)}static emptyPath(){return new n([])}},vd=/^[_a-zA-Z][_a-zA-Z0-9]*$/,Et=class n extends Sr{construct(t,e,r){return new n(t,e,r)}static isValidIdentifier(t){return vd.test(t)}canonicalString(){return this.toArray().map(t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),n.isValidIdentifier(t)||(t="`"+t+"`"),t)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Yu}static keyField(){return new n([Yu])}static fromServerFormat(t){let e=[],r="",i=0,o=()=>{if(r.length===0)throw new x(b.INVALID_ARGUMENT,"Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"));e.push(r),r=""},u=!1;for(;i<t.length;){let l=t[i];if(l==="\\"){if(i+1===t.length)throw new x(b.INVALID_ARGUMENT,"Path has trailing escape character: "+t);let h=t[i+1];if(h!=="\\"&&h!=="."&&h!=="`")throw new x(b.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);r+=h,i+=2}else l==="`"?(u=!u,i++):l!=="."||u?(r+=l,i++):(o(),i++)}if(o(),u)throw new x(b.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new n(e)}static emptyPath(){return new n([])}};var O=class n{constructor(t){this.path=t}static fromPath(t){return new n(J.fromString(t))}static fromName(t){return new n(J.fromString(t).popFirst(5))}static empty(){return new n(J.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return t!==null&&J.comparator(this.path,t.path)===0}toString(){return this.path.toString()}static comparator(t,e){return J.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new n(new J(t.slice()))}};function $o(n,t,e){if(!e)throw new x(b.INVALID_ARGUMENT,"Function ".concat(n,"() cannot be called with an empty ").concat(t,"."))}function Id(n,t,e,r){if(t===!0&&r===!0)throw new x(b.INVALID_ARGUMENT,"".concat(n," and ").concat(e," cannot be used together."))}function Zu(n){if(!O.isDocumentKey(n))throw new x(b.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but ".concat(n," has ").concat(n.length,"."))}function tc(n){if(O.isDocumentKey(n))throw new x(b.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but ".concat(n," has ").concat(n.length,"."))}function Gc(n){return typeof n=="object"&&n!==null&&(Object.getPrototypeOf(n)===Object.prototype||Ob
1ject.getPrototypeOf(n)===null)}function rs(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n="".concat(n.substring(0,20),"...")),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{let t=(function(r){return r.constructor?r.constructor.name:null})(n);return t?"a custom ".concat(t," object"):"an object"}}return typeof n=="function"?"a function":M(12329,{type:typeof n})}function At(n,t){if("_delegate"in n&&(n=n._delegate),!(n instanceof t)){if(t.name===n.constructor.name)throw new x(b.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let e=rs(n);throw new x(b.INVALID_ARGUMENT,"Expected type '".concat(t.name,"', but it was: ").concat(e))}}return n}function Kc(n,t){if(t<=0)throw new x(b.INVALID_ARGUMENT,"Function ".concat(n,"() requires a positive number, but it was: ").concat(t,"."))}function ot(n,t){let e={typeString:n};return t&&(e.value=t),e}function zn(n,t){if(!Gc(n))throw new x(b.INVALID_ARGUMENT,"JSON must be an object");let e;for(let r in t)if(t[r]){let i=t[r].typeString,o="value"in t[r]?{value:t[r].value}:void 0;if(!(r in n)){e="JSON missing required field: '".concat(r,"'");break}let u=n[r];if(i&&typeof u!==i){e="JSON field '".concat(r,"' must be a ").concat(i,".");break}if(o!==void 0&&u!==o.value){e="Expected '".concat(r,"' field to equal '").concat(o.value,"'");break}}if(e)throw new x(b.INVALID_ARGUMENT,e);return!0}var ec=-62135596800,nc=1e6,at=class n{static now(){return n.fromMillis(Date.now())}static fromDate(t){return n.fromMillis(t.getTime())}static fromMillis(t){let e=Math.floor(t/1e3),r=Math.floor((t-1e3*e)*nc);return new n(e,r)}constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new x(b.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new x(b.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<ec)throw new x(b.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new x(b.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/nc}_compareTo(t){return this.seconds===t.seconds?U(this.nanoseconds,t.nanoseconds):U(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:n._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(zn(t,n._jsonSchema))return new n(t.seconds,t.nanoseconds)}valueOf(){let t=this.seconds-ec;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}};at._jsonSchemaVersion="firestore/timestamp/1.0",at._jsonSchema={type:ot("string",at._jsonSchemaVersion),seconds:ot("number"),nanoseconds:ot("number")};var q=class n{static fromTimestamp(t){return new n(t)}static min(){return new n(new at(0,0))}static max(){return new n(new at(253402300799,999999999))}constructor(t){this.timestamp=t}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}};var Nn=-1,ai=class{constructor(t,e,r,i){this.indexId=t,this.collectionGroup=e,this.fields=r,this.indexState=i}};ai.UNKNOWN_ID=-1;function Td(n,t){let e=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,i=q.fromTimestamp(r===1e9?new at(e+1,0):new at(e,r));return new Ie(i,O.empty(),t)}function Ed(n){return new Ie(n.readTime,n.key,Nn)}var Ie=class n{constructor(t,e,r){this.readTime=t,this.documentKey=e,this.largestBatchId=r}static min(){return new n(q.min(),O.empty(),Nn)}static max(){return new n(q.max(),O.empty(),Nn)}};function Ad(n,t){let e=n.readTime.compareTo(t.readTime);return e!==0?e:(e=O.comparator(n.documentKey,t.documentKey),e!==0?e:U(n.largestBatchId,t.largestBatchId))}var Sd="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",ui=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}
vendor: 59,185 bytes, line 1
1raiseOnCommittedEvent(){this.onCommittedListeners.forEach(t=>t())}};function en(n){return N(this,null,function*(){if(n.code!==b.FAILED_PRECONDITION||n.message!==Sd)throw n;k("LocalStore","Unexpectedly lost primary lease")})}var R=class n{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&M(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new n((r,i)=>{this.nextCallback=o=>{this.wrapSuccess(t,o).next(r,i)},this.catchCallback=o=>{this.wrapFailure(e,o).next(r,i)}})}toPromise(){return new Promise((t,e)=>{this.next(t,e)})}wrapUserFunction(t){try{let e=t();return e instanceof n?e:n.resolve(e)}catch(e){return n.reject(e)}}wrapSuccess(t,e){return t?this.wrapUserFunction(()=>t(e)):n.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction(()=>t(e)):n.reject(e)}static resolve(t){return new n((e,r)=>{e(t)})}static reject(t){return new n((e,r)=>{r(t)})}static waitFor(t){return new n((e,r)=>{let i=0,o=0,u=!1;t.forEach(l=>{++i,l.next(()=>{++o,u&&o===i&&e()},h=>r(h))}),u=!0,o===i&&e()})}static or(t){let e=n.resolve(!1);for(let r of t)e=e.next(i=>i?n.resolve(i):r());return e}static forEach(t,e){let r=[];return t.forEach((i,o)=>{r.push(e.call(this,i,o))}),this.waitFor(r)}static mapArray(t,e){return new n((r,i)=>{let o=t.length,u=new Array(o),l=0;for(let h=0;h<o;h++){let f=h;e(t[f]).next(g=>{u[f]=g,++l,l===o&&r(u)},g=>i(g))}})}static doWhile(t,e){return new n((r,i)=>{let o=()=>{t()===!0?e().next(()=>{o()},i):r()};o()})}};function bd(n){let t=n.match(/Android ([\d.]+)/i),e=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(e)}function nn(n){return n.name==="IndexedDbTransactionError"}var zo=(()=>{class n{constructor(e,r){this.previousValue=e,r&&(r.sequenceNumberHandler=i=>this._e(i),this.ae=i=>r.writeSequenceNumber(i))}_e(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ae&&this.ae(e),e}}n.ue=-1;return n})(),ss=-1;function is(n){return n==null}function kn(n){return n===0&&1/n==-1/0}function Rd(n){return typeof n=="number"&&Number.isInteger(n)&&!kn(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}var Qc="�";function Pd(n){let t="";for(let e=0;e<n.length;e++)t.length>0&&(t=rc(t)),t=Vd(n.get(e),t);return rc(t)}function Vd(n,t){let e=t,r=n.length;for(let i=0;i<r;i++){let o=n.charAt(i);switch(o){case"\0":e+="��";break;case Qc:e+="��";break;default:e+=o}}return e}function rc(n){return n+Qc+"�"}var Cd="remoteDocuments",Wc="owner";var Hc="mutationQueues";var Xc="mutations";var Jc="documentMutations",Dd="remoteDocumentsV14";var Yc="remoteDocumentGlobal";var Zc="targets";var tl="targetDocuments";var el="targetGlobal",nl="collectionParents";var rl="clientMetadata";var sl="bundles";var il="namedQueries";var xd="indexConfiguration";var Nd="indexState";var kd="indexEntries";var ol="documentOverlays";var Fd="globals";var Od=[Hc,Xc,Jc,Cd,Zc,Wc,el,tl,rl,Yc,nl,sl,il],Um=[...Od,ol],Md=[Hc,Xc,Jc,Dd,Zc,Wc,el,tl,rl,Yc,nl,sl,il,ol],Ld=Md,qd=[...Ld,xd,Nd,kd];var Bm=[...qd,Fd];function sc(n){let t=0;for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&t++;return t}function le(n,t){for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&t(e,n[e])}function al(n){for(let t in n)if(Object.prototype.hasOwnProperty.call(n,t))return!1;return!0}var et=class n{constructor(t,e){this.comparator=t,this.root=e||Ft.EMPTY}insert(t,e){return new n(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,Ft.BLACK,null,null))}remove(t){return new n(this.comparator,this.root.remove(t,this.comparator).copy(null,null,Ft.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){let r=this.comparator(t,e.key);if(r===0)return e.value;r<0?e=e.left:r>0&&(e=e.right)}return null}indexOf(t){let e=0,r=this.root;for(;!r.isEmpty();){let i=this.comparator(t,r.key);if(i===0)return e+r.left.size;i<0?r=r.left:(e+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal((e,r)=>(t(e,r),!1))}toString(){let t=[];return this.inorderTraversal((e,r)=>(t.push("".concat(e,":").concat(r)),!1)),"{".concat(t.join(", "),"}")}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new qe(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new qe(this.root,t,this.comparator,!1)}getReverseIterator(){return new qe(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new qe(this.root,t,this.comparator,!0)}},qe=class{constructor(t,e,r,i){this.isReverse=i,this.nodeStack=[];let o=1;for(;!t.isEmpty();)if(o=e?r(t.key,e):1,e&&i&&(o*=-1),o<0)t=this.isReverse?t.left:t.right;else{if(o===0){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop(),e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;let t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}},Ft=class n{constructor(t,e,r,i,o){this.key=t,this.value=e,this.color=r!=null?r:n.RED,this.left=i!=null?i:n.EMPTY,this.right=o!=null?o:n.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,r,i,o){return new n(t!=null?t:this.key,e!=null?e:this.value,r!=null?r:this.color,i!=null?i:this.left,o!=null?o:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,r){let i=this,o=r(t,i.key);return i=o<0?i.copy(null,null,null,i.left.insert(t,e,r),null):o===0?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return n.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let r,i=this;if(e(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,e),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),e(t,i.key)===0){if(i.right.isEmpty())return n.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,e))}return i.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){let t=this.copy(null,null,n.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){let t=this.copy(null,null,n.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){let t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){let t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw M(43730,{key:this.key,value:this.value});if(this.right.isRed())throw M(14113,{key:this.key,value:this.value});let t=this.left.check();if(t!==this.right.check())throw M(27949);return t+(this.isRed()?0:1)}};Ft.EMPTY=null,Ft.RED=!0,Ft.BLACK=!1;Ft.EMPTY=new class{constructor(){this.size=0}get key(){throw M(57766)}get value(){throw M(16141)}get color(){throw M(16727)}get left(){throw M(29726)}get right(){throw M(36894)}copy(t,e,r,i,o){return this}insert(t,e,r){return new Ft(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};var ct=class n{constructor(t){this.comparator=t,this.data=new et(this.comparator)}has(t){return this.data.get(t)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal((e,r)=>(t(e),!1))}forEachInRange(t,e){let r=this.data.getIteratorFrom(t[0]);for(;r.hasNext();){let i=r.getNext();if(this.comparator(i.key,t[1])>=0)return;e(i.key)}}forEachWhile(t,e){let r;for(r=e!==void 0?this.data.getIteratorFrom(e):this.data.getIterator();r.hasNext();)if(!t(r.getNext().key))return}firstAfterOrEqual(t){let e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new br(this.data.getIterator())}getIteratorFrom(t){return new br(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach(r=>{e=e.add(r)}),e}isEqual(t){if(!(t instanceof n)||this.size!==t.size)return!1;let e=this.data.getIterator(),r=t.data.getIterator();for(;e.hasNext();){let i=e.getNext().key,o=r.getNext().key;if(this.comparator(i,o)!==0)return!1}return!0}toArray(){let t=[];return this.forEach(e=>{t.push(e)}),t}toString(){let t=[];return this.forEach(e=>t.push(e)),"SortedSet("+t.toString()+")"}copy(t){let e=new n(this.comparator);return e.data=t,e}},br=class{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}};var Pt=class n{constructor(t){this.fields=t,t.sort(Et.comparator)}static empty(){return new n([])}unionWith(t){let e=new ct(Et.comparator);for(let r of this.fields)e=e.add(r);for(let r of t)e=e.add(r);return new n(e.toArray())}covers(t){for(let e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return $e(this.fields,t.fields,(e,r)=>e.isEqual(r))}};var Rr=class extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}};var yt=class n{constructor(t){this.binaryString=t}static fromBase64String(t){let e=(function(i){try{return atob(i)}catch(o){throw typeof DOMException<"u"&&o instanceof DOMException?new Rr("Invalid base64 string: "+o):o}})(t);return new n(e)}static fromUint8Array(t){let e=(function(i){let o="";for(let u=0;u<i.length;++u)o+=String.fromCharCode(i[u]);return o})(t);return new n(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return(function(e){return btoa(e)})(this.binaryString)}toUint8Array(){return(function(e){let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return r})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return U(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}};yt.EMPTY_BYTE_STRING=new yt("");var Ud=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Kt(n){if(Q(!!n,39018),typeof n=="string"){let t=0,e=Ud.exec(n);if(Q(!!e,46558,{timestamp:n}),e[1]){let i=e[1];i=(i+"000000000").substr(0,9),t=Number(i)}let r=new Date(n);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:Y(n.seconds),nanos:Y(n.nanos)}}function Y(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Qt(n){return typeof n=="string"?yt.fromBase64String(n):yt.fromUint8Array(n)}var ul="server_timestamp",cl="__type__",ll="__previous_value__",hl="__local_write_time__";function Go(n){var t,e;return((e=(((t=n==null?void 0:n.mapValue)===null||t===void 0?void 0:t.fields)||{})[cl])===null||e===void 0?void 0:e.stringValue)===ul}function os(n){let t=n.mapValue.fields[ll];return Go(t)?os(t):t}function Fn(n){let t=Kt(n.mapValue.fields[hl].timestampValue);return new at(t.seconds,t.nanos)}var ci=class{constructor(t,e,r,i,o,u,l,h,f,g){this.databaseId=t,this.appId=e,this.persistenceKey=r,this.host=i,this.ssl=o,this.forceLongPolling=u,this.autoDetectLongPolling=l,this.longPollingOptions=h,this.useFetchStreams=f,this.isUsingEmulator=g}},Pr="(default)",Vr=class n{constructor(t,e){this.projectId=t,this.database=e||Pr}static empty(){return new n("","")}get isDefaultDatabase(){return this.database===Pr}isEqual(t){return t instanceof n&&t.projectId===this.projectId&&t.database===this.database}};var Ko="__type__",dl="__max__",yr={mapValue:{fields:{__type__:{stringValue:dl}}}},Qo="__vector__",ze="value";function ae(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?Go(n)?4:ml(n)?9007199254740991:fl(n)?10:11:M(28295,{value:n})}function Lt(n,t){if(n===t)return!0;let e=ae(n);if(e!==ae(t))return!1;switch(e){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===t.booleanValue;case 4:return Fn(n).isEqual(Fn(t));case 3:return(function(i,o){if(typeof i.timestampValue=="string"&&typeof o.timestampValue=="string"&&i.timestampValue.length===o.timestampValue.length)return i.timestampValue===o.timestampValue;let u=Kt(i.timestampValue),l=Kt(o.timestampValue);return u.seconds===l.seconds&&u.nanos===l.nanos})(n,t);case 5:return n.stringValue===t.stringValue;case 6:return(function(i,o){return Qt(i.bytesValue).isEqual(Qt(o.bytesValue))})(n,t);case 7:return n.referenceValue===t.referenceValue;case 8:return(function(i,o){return Y(i.geoPointValue.latitude)===Y(o.geoPointValue.latitude)&&Y(i.geoPointValue.longitude)===Y(o.geoPointValue.longitude)})(n,t);case 2:return(function(i,o){if("integerValue"in i&&"integerValue"in o)return Y(i.integerValue)===Y(o.integerValue);if("doubleValue"in i&&"doubleValue"in o){let u=Y(i.doubleValue),l=Y(o.doubleValue);return u===l?kn(u)===kn(l):isNaN(u)&&isNaN(l)}return!1})(n,t);case 9:return $e(n.arrayValue.values||[],t.arrayValue.values||[],Lt);case 10:case 11:return(function(i,o){let u=i.mapValue.fields||{},l=o.mapValue.fields||{};if(sc(u)!==sc(l))return!1;for(let h in u)if(u.hasOwnProperty(h)&&(l[h]===void 0||!Lt(u[h],l[h])))return!1;return!0})(n,t);default:return M(52216,{left:n})}}function On(n,t){return(n.values||[]).find(e=>Lt(e,t))!==void 0}function Ge(n,t){if(n===t)return 0;let e=ae(n),r=ae(t);if(e!==r)return U(e,r);switch(e){case 0:case 9007199254740991:return 0;case 1:return U(n.booleanValue,t.booleanValue);case 2:return(function(o,u){let l=Y(o.integerValue||o.doubleValue),h=Y(u.integerValue||u.doubleValue);return l<h?-1:l>h?1:l===h?0:isNaN(l)?isNaN(h)?0:-1:1})(n,t);case 3:return ic(n.timestampValue,t.timestampValue);case 4:return ic(Fn(n),Fn(t));case 5:return oi(n.stringValue,t.stringValue);case 6:return(function(o,u){let l=Qt(o),h=Qt(u);return l.compareTo(h)})(n.bytesValue,t.bytesValue);case 7:return(function(o,u){let l=o.split("/"),h=u.split("/");for(let f=0;f<l.length&&f<h.length;f++){let g=U(l[f],h[f]);if(g!==0)return g}return U(l.length,h.length)})(n.referenceValue,t.referenceValue);case 8:return(function(o,u){let l=U(Y(o.latitude),Y(u.latitude));return l!==0?l:U(Y(o.longitude),Y(u.longitude))})(n.geoPointValue,t.geoPointValue);case 9:return oc(n.arrayValue,t.arrayValue);case 10:return(function(o,u){var l,h,f,g;let w=o.fields||{},S=u.fields||{},P=(l=w[ze])===null||l===void 0?void 0:l.arrayValue,D=(h=S[ze])===null||h===void 0?void 0:h.arrayValue,F=U(((f=P==null?void 0:P.values)===null||f===void 0?void 0:f.length)||0,((g=D==null?void 0:D.values)===null||g===void 0?void 0:g.length)||0);return F!==0?F:oc(P,D)})(n.mapValue,t.mapValue);case 11:return(function(o,u){if(o===yr.mapValue&&u===yr.mapValue)return 0;if(o===yr.mapValue)return 1;if(u===yr.mapValue)return-1;let l=o.fields||{},h=Object.keys(l),f=u.fields||{},g=Object.keys(f);h.sort(),g.sort();for(let w=0;w<h.length&&w<g.length;++w){let S=oi(h[w],g[w]);if(S!==0)return S;let P=Ge(l[h[w]],f[g[w]]);if(P!==0)return P}return U(h.length,g.length)})(n.mapValue,t.mapValue);default:throw M(23264,{le:e})}}function ic(n,t){if(typeof n=="string"&&typeof t=="string"&&n.length===t.length)return U(n,t);let e=Kt(n),r=Kt(t),i=U(e.seconds,r.seconds);return i!==0?i:U(e.nanos,r.nanos)}function oc(n,t){let e=n.values||[],r=t.values||[];for(let i=0;i<e.length&&i<r.length;++i){let o=Ge(e[i],r[i]);if(o)return o}return U(e.length,r.length)}function Ke(n){return li(n)}function li(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?(function(e){let r=Kt(e);return"time(".concat(r.seconds,",").concat(r.nanos,")")})(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?(function(e){return Qt(e).toBase64()})(n.bytesValue):"referenceValue"in n?(function(e){return O.fromName(e).toString()})(n.referenceValue):"geoPointValue"in n?(function(e){return"geo(".concat(e.latitude,",").concat(e.longitude,")")})(n.geoPointValue):"arrayValue"in n?(function(e){let r="[",i=!0;for(let o of e.values||[])i?i=!1:r+=",",r+=li(o);return r+"]"})(n.arrayValue):"mapValue"in n?(function(e){let r=Object.keys(e.fields||{}).sort(),i="{",o=!0;for(let u of r)o?o=!1:i+=",",i+="".concat(u,":").concat(li(e.fields[u]));return i+"}"})(n.mapValue):M(61005,{value:n})}function vr(n){switch(ae(n)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let t=os(n);return t?16+vr(t):16;case 5:return 2*n.stringValue.length;case 6:return Qt(n.bytesValue).approximateByteSize();case 7:return n.referenceValue.length;case 9:return(function(r){return(r.values||[]).reduce((i,o)=>i+vr(o),0)})(n.arrayValue);case 10:case 11:return(function(r){let i=0;return le(r.fields,(o,u)=>{i+=o.length+vr(u)}),i})(n.mapValue);default:throw M(13486,{value:n})}}function ac(n,t){return{referenceValue:"projects/".concat(n.projectId,"/databases/").concat(n.database,"/documents/").concat(t.path.canonicalString())}}function hi(n){return!!n&&"integerValue"in n}function Wo(n){return!!n&&"arrayValue"in n}function uc(n){return!!n&&"nullValue"in n}function cc(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function Ir(n){return!!n&&"mapValue"in n}function fl(n){var t,e;return((e=(((t=n==null?void 0:n.mapValue)===null||t===void 0?void 0:t.fields)||{})[Ko])===null||e===void 0?void 0:e.stringValue)===Qo}function Pn(n){if(n.geoPointValue)return{geoPointValue:Object.assign({},n.geoPointValue)};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:Object.assign({},n.timestampValue)};if(n.mapValue){let t={mapValue:{fields:{}}};return le(n.mapValue.fields,(e,r)=>t.mapValue.fields[e]=Pn(r)),t}if(n.arrayValue){let t={arrayValue:{values:[]}};for(let e=0;e<(n.arrayValue.values||[]).length;++e)t.arrayValue.values[e]=Pn(n.arrayValue.values[e]);return t}return Object.assign({},n)}function ml(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue===dl}var $m={mapValue:{fields:{[Ko]:{stringValue:Qo},[ze]:{arrayValue:{}}}}};var Tt=class n{constructor(t){this.value=t}static empty(){return new n({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let r=0;r<t.length-1;++r)if(e=(e.mapValue.fields||{})[t.get(r)],!Ir(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Pn(e)}setAll(t){let e=Et.emptyPath(),r={},i=[];t.forEach((u,l)=>{if(!e.isImmediateParentOf(l)){let h=this.getFieldsMap(e);this.applyChanges(h,r,i),r={},i=[],e=l.popLast()}u?r[l.lastSegment()]=Pn(u):i.push(l.lastSegment())});let o=this.getFieldsMap(e);this.applyChanges(o,r,i)}delete(t){let e=this.field(t.popLast());Ir(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Lt(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let r=0;r<t.length;++r){let i=e.mapValue.fields[t.get(r)];Ir(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},e.mapValue.fields[t.get(r)]=i),e=i}return e.mapValue.fields}applyChanges(t,e,r){le(e,(i,o)=>t[i]=o);for(let i of r)delete t[i]}clone(){return new n(Pn(this.value))}};function gl(n){let t=[];return le(n.fields,(e,r)=>{let i=new Et([e]);if(Ir(r)){let o=gl(r.mapValue).fields;if(o.length===0)t.push(i);else for(let u of o)t.push(i.child(u))}else t.push(i)}),new Pt(t)}var Ct=class n{constructor(t,e,r,i,o,u,l){this.key=t,this.documentType=e,this.version=r,this.readTime=i,this.createTime=o,this.data=u,this.documentState=l}static newInvalidDocument(t){return new n(t,0,q.min(),q.min(),q.min(),Tt.empty(),0)}static newFoundDocument(t,e,r,i){return new n(t,1,e,q.min(),r,i,0)}static newNoDocument(t,e){return new n(t,2,e,q.min(),q.min(),Tt.empty(),0)}static newUnknownDocument(t,e){return new n(t,3,e,q.min(),q.min(),Tt.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(q.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=Tt.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=Tt.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=q.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(t){return t instanceof n&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new n(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return"Document(".concat(this.key,", ").concat(this.version,", ").concat(JSON.stringify(this.data.value),", {createTime: ").concat(this.createTime,"}), {documentType: ").concat(this.documentType,"}), {documentState: ").concat(this.documentState,"})")}};var Qe=class{constructor(t,e){this.position=t,this.inclusive=e}};function lc(n,t,e){let r=0;for(let i=0;i<n.position.length;i++){let o=t[i],u=n.position[i];if(o.field.isKeyField()?r=O.comparator(O.fromName(u.referenceValue),e.key):r=Ge(u,e.data.field(o.field)),o.dir==="desc"&&(r*=-1),r!==0)break}return r}function hc(n,t){if(n===null)return t===null;if(t===null||n.inclusive!==t.inclusive||n.position.length!==t.position.length)return!1;for(let e=0;e<n.position.length;e++)if(!Lt(n.position[e],t.position[e]))return!1;return!0}var Te=class{constructor(t,e="asc"){this.field=t,this.dir=e}};function Bd(n,t){return n.dir===t.dir&&n.field.isEqual(t.field)}var Cr=class{},it=class n extends Cr{constructor(t,e,r){super(),this.field=t,this.op=e,this.value=r}static create(t,e,r){return t.isKeyField()?e==="in"||e==="not-in"?this.createKeyFieldInFilter(t,e,r):new fi(t,e,r):e==="array-contains"?new pi(t,r):e==="in"?new yi(t,r):e==="not-in"?new _i(t,r):e==="array-contains-any"?new wi(t,r):new n(t,e,r)}static createKeyFieldInFilter(t,e,r){return e==="in"?new mi(t,r):new gi(t,r)}matches(t){let e=t.data.field(this.field);return this.op==="!="?e!==null&&e.nullValue===void 0&&this.matchesComparison(Ge(e,this.value)):e!==null&&ae(this.value)===ae(e)&&this.matchesComparison(Ge(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return t===0;case"!=":return t!==0;case">":return t>0;case">=":return t>=0;default:return M(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},Dt=class n extends Cr{constructor(t,e){super(),this.filters=t,this.op=e,this.he=null}static create(t,e){return new n(t,e)}matches(t){return pl(this)?this.filters.find(e=>!e.matches(t))===void 0:this.filters.find(e=>e.matches(t))!==void 0}getFlattenedFilters(){return this.he!==null||(this.he=this.filters.reduce((t,e)=>t.concat(e.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}};function pl(n){return n.op==="and"}function yl(n){return jd(n)&&pl(n)}function jd(n){for(let t of n.filters)if(t instanceof Dt)return!1;return!0}function di(n){if(n instanceof it)return n.field.canonicalString()+n.op.toString()+Ke(n.value);if(yl(n))return n.filters.map(t=>di(t)).join(",");{let t=n.filters.map(e=>di(e)).join(",");return"".concat(n.op,"(").concat(t,")")}}function _l(n,t){return n instanceof it?(function(r,i){return i instanceof it&&r.op===i.op&&r.field.isEqual(i.field)&&Lt(r.value,i.value)})(n,t):n instanceof Dt?(function(r,i){return i instanceof Dt&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((o,u,l)=>o&&_l(u,i.filters[l]),!0):!1})(n,t):void M(19439)}function wl(n){return n instanceof it?(function(e){return"".concat(e.field.canonicalString()," ").concat(e.op," ").concat(Ke(e.value))})(n):n instanceof Dt?(function(e){return e.op.toString()+" {"+e.getFilters().map(wl).join(" ,")+"}"})(n):"Filter"}var fi=class extends it{constructor(t,e,r){super(t,e,r),this.key=O.fromName(r.referenceValue)}matches(t){let e=O.comparator(t.key,this.key);return this.matchesComparison(e)}},mi=class extends it{constructor(t,e){super(t,"in",e),this.keys=vl("in",e)}matches(t){return this.keys.some(e=>e.isEqual(t.key))}},gi=class extends it{constructor(t,e){super(t,"not-in",e),this.keys=vl("not-in",e)}matches(t){return!this.keys.some(e=>e.isEqual(t.key))}};function vl(n,t){var e;return(((e=t.arrayValue)===null||e===void 0?void 0:e.values)||[]).map(r=>O.fromName(r.referenceValue))}var pi=class extends it{constructor(t,e){super(t,"array-contains",e)}matches(t){let e=t.data.field(this.field);return Wo(e)&&On(e.arrayValue,this.value)}},yi=class extends it{constructor(t,e){super(t,"in",e)}matches(t){let e=t.data.field(this.field);return e!==null&&On(this.value.arrayValue,e)}},_i=class extends it{constructor(t,e){super(t,"not-in",e)}matches(t){if(On(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let e=t.data.field(this.field);return e!==null&&e.nullValue===void 0&&!On(this.value.arrayValue,e)}},wi=class extends it{constructor(t,e){super(t,"array-contains-any",e)}matches(t){let e=t.data.field(this.field);return!(!Wo(e)||!e.arrayValue.values)&&e.arrayValue.values.some(r=>On(this.value.arrayValue,r))}};var vi=class{constructor(t,e=null,r=[],i=[],o=null,u=null,l=null){this.path=t,this.collectionGroup=e,this.orderBy=r,this.filters=i,this.limit=o,this.startAt=u,this.endAt=l,this.Pe=null}};function dc(n,t=null,e=[],r=[],i=null,o=null,u=null){return new vi(n,t,e,r,i,o,u)}function Ho(n){let t=L(n);if(t.Pe===null){let e=t.path.canonicalString();t.collectionGroup!==null&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map(r=>di(r)).join(","),e+="|ob:",e+=t.orderBy.map(r=>(function(o){return o.field.canonicalString()+o.dir})(r)).join(","),is(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(r=>Ke(r)).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(r=>Ke(r)).join(",")),t.Pe=e}return t.Pe}function Xo(n,t){if(n.limit!==t.limit||n.orderBy.length!==t.orderBy.length)return!1;for(let e=0;e<n.orderBy.length;e++)if(!Bd(n.orderBy[e],t.orderBy[e]))return!1;if(n.filters.length!==t.filters.length)return!1;for(let e=0;e<n.filters.length;e++)if(!_l(n.filters[e],t.filters[e]))return!1;return n.collectionGroup===t.collectionGroup&&!!n.path.isEqual(t.path)&&!!hc(n.startAt,t.startAt)&&hc(n.endAt,t.endAt)}function Ii(n){return O.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}var Wt=class{constructor(t,e=null,r=[],i=[],o=null,u="F",l=null,h=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=r,this.filters=i,this.limit=o,this.limitType=u,this.startAt=l,this.endAt=h,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}};function $d(n,t,e,r,i,o,u,l){return new Wt(n,t,e,r,i,o,u,l)}function Jo(n){return new Wt(n)}function fc(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function Il(n){return n.collectionGroup!==null}function Vn(n){let t=L(n);if(t.Te===null){t.Te=[];let e=new Set;for(let o of t.explicitOrderBy)t.Te.push(o),e.add(o.field.canonicalString());let r=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";(function(u){let l=new ct(Et.comparator);return u.filters.forEach(h=>{h.getFlattenedFilters().forEach(f=>{f.isInequality()&&(l=l.add(f.field))})}),l})(t).forEach(o=>{e.has(o.canonicalString())||o.isKeyField()||t.Te.push(new Te(o,r))}),e.has(Et.keyField().canonicalString())||t.Te.push(new Te(Et.keyField(),r))}return t.Te}function Ot(n){let t=L(n);return t.Ie||(t.Ie=zd(t,Vn(n))),t.Ie}function zd(n,t){if(n.limitType==="F")return dc(n.path,n.collectionGroup,t,n.filters,n.limit,n.startAt,n.endAt);{t=t.map(i=>{let o=i.dir==="desc"?"asc":"desc";return new Te(i.field,o)});let e=n.endAt?new Qe(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new Qe(n.startAt.position,n.startAt.inclusive):null;return dc(n.path,n.collectionGroup,t,n.filters,n.limit,e,r)}}function Ti(n,t){let e=n.filters.concat([t]);return new Wt(n.path,n.collectionGroup,n.explicitOrderBy.slice(),e,n.limit,n.limitType,n.startAt,n.endAt)}function Dr(n,t,e){return new Wt(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),t,e,n.startAt,n.endAt)}function as(n,t){return Xo(Ot(n),Ot(t))&&n.limitType===t.limitType}function Tl(n){return"".concat(Ho(Ot(n)),"|lt:").concat(n.limitType)}function Oe(n){return"Query(target=".concat((function(e){let r=e.path.canonicalString();return e.collectionGroup!==null&&(r+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(r+=", filters: [".concat(e.filters.map(i=>wl(i)).join(", "),"]")),is(e.limit)||(r+=", limit: "+e.limit),e.orderBy.length>0&&(r+=", orderBy: [".concat(e.orderBy.map(i=>(function(u){return"".concat(u.field.canonicalString()," (").concat(u.dir,")")})(i)).join(", "),"]")),e.startAt&&(r+=", startAt: ",r+=e.startAt.inclusive?"b:":"a:",r+=e.startAt.position.map(i=>Ke(i)).join(",")),e.endAt&&(r+=", endAt: ",r+=e.endAt.inclusive?"a:":"b:",r+=e.endAt.position.map(i=>Ke(i)).join(",")),"Target(".concat(r,")")})(Ot(n)),"; limitType=").concat(n.limitType,")")}function us(n,t){return t.isFoundDocument()&&(function(r,i){let o=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(o):O.isDocumentKey(r.path)?r.path.isEqual(o):r.path.isImmediateParentOf(o)})(n,t)&&(function(r,i){for(let o of Vn(r))if(!o.field.isKeyField()&&i.data.field(o.field)===null)return!1;return!0})(n,t)&&(function(r,i){for(let o of r.filters)if(!o.matches(i))return!1;return!0})(n,t)&&(function(r,i){return!(r.startAt&&!(function(u,l,h){let f=lc(u,l,h);return u.inclusive?f<=0:f<0})(r.startAt,Vn(r),i)||r.endAt&&!(function(u,l,h){let f=lc(u,l,h);return u.inclusive?f>=0:f>0})(r.endAt,Vn(r),i))})(n,t)}function Gd(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function El(n){return(t,e)=>{let r=!1;for(let i of Vn(n)){let o=Kd(i,t,e);if(o!==0)return o;r=r||i.field.isKeyField()}return 0}}function Kd(n,t,e){let r=n.field.isKeyField()?O.comparator(t.key,e.key):(function(o,u,l){let h=u.data.field(o),f=l.data.field(o);return h!==null&&f!==null?Ge(h,f):M(42886)})(n.field,t,e);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return M(19790,{direction:n.dir})}}var Ht=class{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){let e=this.mapKeyFn(t),r=this.inner[e];if(r!==void 0){for(let[i,o]of r)if(this.equalsFn(i,t))return o}}has(t){return this.get(t)!==void 0}set(t,e){let r=this.mapKeyFn(t),i=this.inner[r];if(i===void 0)return this.inner[r]=[[t,e]],void this.innerSize++;for(let o=0;o<i.length;o++)if(this.equalsFn(i[o][0],t))return void(i[o]=[t,e]);i.push([t,e]),this.innerSize++}delete(t){let e=this.mapKeyFn(t),r=this.inner[e];if(r===void 0)return!1;for(let i=0;i<r.length;i++)if(this.equalsFn(r[i][0],t))return r.length===1?delete this.inner[e]:r.splice(i,1),this.innerSize--,!0;return!1}forEach(t){le(this.inner,(e,r)=>{for(let[i,o]of r)t(i,o)})}isEmpty(){return al(this.inner)}size(){return this.innerSize}};var Qd=new et(O.comparator);function Xt(){return Qd}var Al=new et(O.comparator);function Rn(...n){let t=Al;for(let e of n)t=t.insert(e.key,e);return t}function Sl(n){let t=Al;return n.forEach((e,r)=>t=t.insert(e,r.overlayedDocument)),t}function pe(){return Cn()}function bl(){return Cn()}function Cn(){return new Ht(n=>n.toString(),(n,t)=>n.isEqual(t))}var Wd=new et(O.comparator),Hd=new ct(O.comparator);function j(...n){let t=Hd;for(let e of n)t=t.add(e);return t}var Xd=new ct(U);function Jd(){return Xd}function Yo(n,t){if(n.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:kn(t)?"-0":t}}function Rl(n){return{integerValue:""+n}}function Pl(n,t){return Rd(t)?Rl(t):Yo(n,t)}var We=class{constructor(){this._=void 0}};function Yd(n,t,e){return n instanceof He?(function(i,o){let u={fields:{[cl]:{stringValue:ul},[hl]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return o&&Go(o)&&(o=os(o)),o&&(u.fields[ll]=o),{mapValue:u}})(e,t):n instanceof Ee?Cl(n,t):n instanceof Ae?Dl(n,t):(function(i,o){let u=Vl(i,o),l=mc(u)+mc(i.Ee);return hi(u)&&hi(i.Ee)?Rl(l):Yo(i.serializer,l)})(n,t)}function Zd(n,t,e){return n instanceof Ee?Cl(n,t):n instanceof Ae?Dl(n,t):e}function Vl(n,t){return n instanceof Se?(function(r){return hi(r)||(function(o){return!!o&&"doubleValue"in o})(r)})(t)?t:{integerValue:0}:null}var He=class extends We{},Ee=class extends We{constructor(t){super(),this.elements=t}};function Cl(n,t){let e=xl(t);for(let r of n.elements)e.some(i=>Lt(i,r))||e.push(r);return{arrayValue:{values:e}}}var Ae=class extends We{constructor(t){super(),this.elements=t}};function Dl(n,t){let e=xl(t);for(let r of n.elements)e=e.filter(i=>!Lt(i,r));return{arrayValue:{values:e}}}var Se=class extends We{constructor(t,e){super(),this.serializer=t,this.Ee=e}};function mc(n){return Y(n.integerValue||n.doubleValue)}function xl(n){return Wo(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}var Ei=class{constructor(t,e){this.field=t,this.transform=e}};function tf(n,t){return n.field.isEqual(t.field)&&(function(r,i){return r instanceof Ee&&i instanceof Ee||r instanceof Ae&&i instanceof Ae?$e(r.elements,i.elements,Lt):r instanceof Se&&i instanceof Se?Lt(r.Ee,i.Ee):r instanceof He&&i instanceof He})(n.transform,t.transform)}var Ai=class{constructor(t,e){this.version=t,this.transformResults=e}},St=class n{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new n}static exists(t){return new n(void 0,t)}static updateTime(t){return new n(t)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}};function Tr(n,t){return n.updateTime!==void 0?t.isFoundDocument()&&t.version.isEqual(n.updateTime):n.exists===void 0||n.exists===t.isFoundDocument()}var Xe=class{};function Nl(n,t){if(!n.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return n.isNoDocument()?new Je(n.key,St.none()):new be(n.key,n.data,St.none());{let e=n.data,r=Tt.empty(),i=new ct(Et.comparator);for(let o of t.fields)if(!i.has(o)){let u=e.field(o);u===null&&o.length>1&&(o=o.popLast(),u=e.field(o)),u===null?r.delete(o):r.set(o,u),i=i.add(o)}return new qt(n.key,r,new Pt(i.toArray()),St.none())}}function ef(n,t,e){n instanceof be?(function(i,o,u){let l=i.value.clone(),h=pc(i.fieldTransforms,o,u.transformResults);l.setAll(h),o.convertToFoundDocument(u.version,l).setHasCommittedMutations()})(n,t,e):n instanceof qt?(function(i,o,u){if(!Tr(i.precondition,o))return void o.convertToUnknownDocument(u.version);let l=pc(i.fieldTransforms,o,u.transformResults),h=o.data;h.setAll(kl(i)),h.setAll(l),o.convertToFoundDocument(u.version,h).setHasCommittedMutations()})(n,t,e):(function(i,o,u){o.convertToNoDocument(u.version).setHasCommittedMutations()})(0,t,e)}function Dn(n,t,e,r){return n instanceof be?(function(o,u,l,h){if(!Tr(o.precondition,u))return l;let f=o.value.clone(),g=yc(o.fieldTransforms,h,u);return f.setAll(g),u.convertToFoundDocument(u.version,f).setHasLocalMutations(),null})(n,t,e,r):n instanceof qt?(function(o,u,l,h){if(!Tr(o.precondition,u))return l;let f=yc(o.fieldTransforms,h,u),g=u.data;return g.setAll(kl(o)),g.setAll(f),u.convertToFoundDocument(u.version,g).setHasLocalMutations(),l===null?null:l.unionWith(o.fieldMask.fields).unionWith(o.fieldTransforms.map(w=>w.field))})(n,t,e,r):(function(o,u,l){return Tr(o.precondition,u)?(u.convertToNoDocument(u.version).setHasLocalMutations(),null):l})(n,t,e)}function nf(n,t){let e=null;for(let r of n.fieldTransforms){let i=t.data.field(r.field),o=Vl(r.transform,i||null);o!=null&&(e===null&&(e=Tt.empty()),e.set(r.field,o))}return e||null}function gc(n,t){return n.type===t.type&&!!n.key.isEqual(t.key)&&!!n.precondition.isEqual(t.precondition)&&!!(function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&$e(r,i,(o,u)=>tf(o,u))})(n.fieldTransforms,t.fieldTransforms)&&(n.type===0?n.value.isEqual(t.value):n.type!==1||n.data.isEqual(t.data)&&n.fieldMask.isEqual(t.fieldMask))}var be=class extends Xe{constructor(t,e,r,i=[]){super(),this.key=t,this.value=e,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}},qt=class extends Xe{constructor(t,e,r,i,o=[]){super(),this.key=t,this.data=e,this.fieldMask=r,this.precondition=i,this.fieldTransforms=o,this.type=1}getFieldMask(){return this.fieldMask}};function kl(n){let t=new Map;return n.fieldMask.fields.forEach(e=>{if(!e.isEmpty()){let r=n.data.field(e);t.set(e,r)}}),t}function pc(n,t,e){let r=new Map;Q(n.length===e.length,32656,{Ae:e.length,Re:n.length});for(let i=0;i<e.length;i++){let o=n[i],u=o.transform,l=t.data.field(o.field);r.set(o.field,Zd(u,l,e[i]))}return r}function yc(n,t,e){let r=new Map;for(let i of n){let o=i.transform,u=e.data.field(i.field);r.set(i.field,Yd(o,u,t))}return r}var Je=class extends Xe{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},Si=class extends Xe{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}};var bi=class{constructor(t,e,r,i){this.batchId=t,this.localWriteTime=e,this.baseMutations=r,this.mutations=i}applyToRemoteDocument(t,e){let r=e.mutationResults;for(let i=0;i<this.mutations.length;i++){let o=this.mutations[i];o.key.isEqual(t.key)&&ef(o,t,r[i])}}applyToLocalView(t,e){for(let r of this.baseMutations)r.key.isEqual(t.key)&&(e=Dn(r,t,e,this.localWriteTime));for(let r of this.mutations)r.key.isEqual(t.key)&&(e=Dn(r,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){let r=bl();return this.mutations.forEach(i=>{let o=t.get(i.key),u=o.overlayedDocument,l=this.applyToLocalView(u,o.mutatedFields);l=e.has(i.key)?null:l;let h=Nl(u,l);h!==null&&r.set(i.key,h),u.isValidDocument()||u.convertToNoDocument(q.min())}),r}keys(){return this.mutations.reduce((t,e)=>t.add(e.key),j())}isEqual(t){return this.batchId===t.batchId&&$e(this.mutations,t.mutations,(e,r)=>gc(e,r))&&$e(this.baseMutations,t.baseMutations,(e,r)=>gc(e,r))}},Ri=class n{constructor(t,e,r,i){this.batch=t,this.commitVersion=e,this.mutationResults=r,this.docVersions=i}static from(t,e,r){Q(t.mutations.length===r.length,58842,{Ve:t.mutations.length,me:r.length});let i=(function(){return Wd})(),o=t.mutations;for(let u=0;u<o.length;u++)i=i.insert(o[u].key,r[u].version);return new n(t,e,r,i)}};var Pi=class{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return t!==null&&this.mutation===t.mutation}toString(){return"Overlay{\n largestBatchId: ".concat(this.largestBatchId,",\n mutation: ").concat(this.mutation.toString(),"\n }")}};var Vi=class{constructor(t,e){this.count=t,this.unchangedNames=e}};var rt,z;function rf(n){switch(n){case b.OK:return M(64938);case b.CANCELLED:case b.UNKNOWN:case b.DEADLINE_EXCEEDED:case b.RESOURCE_EXHAUSTED:case b.INTERNAL:case b.UNAVAILABLE:case b.UNAUTHENTICATED:return!1;case b.INVALID_ARGUMENT:case b.NOT_FOUND:case b.ALREADY_EXISTS:case b.PERMISSION_DENIED:case b.FAILED_PRECONDITION:case b.ABORTED:case b.OUT_OF_RANGE:case b.UNIMPLEMENTED:case b.DATA_LOSS:return!0;default:return M(15467,{code:n})}}function Fl(n){if(n===void 0)return Gt("GRPC error has no .code"),b.UNKNOWN;switch(n){case rt.OK:return b.OK;case rt.CANCELLED:return b.CANCELLED;case rt.UNKNOWN:return b.UNKNOWN;case rt.DEADLINE_EXCEEDED:return b.DEADLINE_EXCEEDED;case rt.RESOURCE_EXHAUSTED:return b.RESOURCE_EXHAUSTED;case rt.INTERNAL:return b.INTERNAL;case rt.UNAVAILABLE:return b.UNAVAILABLE;case rt.UNAUTHENTICATED:return b.UNAUTHENTICATED;case rt.INVALID_ARGUMENT:return b.INVALID_ARGUMENT;case rt.NOT_FOUND:return b.NOT_FOUND;case rt.ALREADY_EXISTS:return b.ALREADY_EXISTS;case rt.PERMISSION_DENIED:return b.PERMISSION_DENIED;case rt.FAILED_PRECONDITION:return b.FAILED_PRECONDITION;case rt.ABORTED:return b.ABORTED;case rt.OUT_OF_RANGE:return b.OUT_OF_RANGE;case rt.UNIMPLEMENTED:return b.UNIMPLEMENTED;case rt.DATA_LOSS:return b.DATA_LOSS;default:return M(39323,{code:n})}}(z=rt||(rt={}))[z.OK=0]="OK",z[z.CANCELLED=1]="CANCELLED",z[z.UNKNOWN=2]="UNKNOWN",z[z.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",z[z.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",z[z.NOT_FOUND=5]="NOT_FOUND",z[z.ALREADY_EXISTS=6]="ALREADY_EXISTS",z[z.PERMISSION_DENIED=7]="PERMISSION_DENIED",z[z.UNAUTHENTICATED=16]="UNAUTHENTICATED",z[z.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",z[z.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",z[z.ABORTED=10]="ABORTED",z[z.OUT_OF_RANGE=11]="OUT_OF_RANGE",z[z.UNIMPLEMENTED=12]="UNIMPLEMENTED",z[z.INTERNAL=13]="INTERNAL",z[z.UNAVAILABLE=14]="UNAVAILABLE",z[z.DATA_LOSS=15]="DATA_LOSS";var _c=null;var sf=new $t([4294967295,4294967295],0);function wc(n){let t=zc().encode(n),e=new $s;return e.update(t),new Uint8Array(e.digest())}function vc(n){let t=new DataView(n.buffer),e=t.getUint32(0,!0),r=t.getUint32(4,!0),i=t.getUint32(8,!0),o=t.getUint32(12,!0);return[new $t([e,r],0),new $t([i,o],0)]}var Ci=class n{constructor(t,e,r){if(this.bitmap=t,this.padding=e,this.hashCount=r,e<0||e>=8)throw new ye("Invalid padding: ".concat(e));if(r<0)throw new ye("Invalid hash count: ".concat(r));if(t.length>0&&this.hashCount===0)throw new ye("Invalid hash count: ".concat(r));if(t.length===0&&e!==0)throw new ye("Invalid padding when bitmap length is 0: ".concat(e));this.fe=8*t.length-e,this.ge=$t.fromNumber(this.fe)}pe(t,e,r){let i=t.add(e.multiply($t.fromNumber(r)));return i.compare(sf)===1&&(i=new $t([i.getBits(0),i.getBits(1)],0)),i.modulo(this.ge).toNumber()}ye(t){return!!(this.bitmap[Math.floor(t/8)]&1<<t%8)}mightContain(t){if(this.fe===0)return!1;let e=wc(t),[r,i]=vc(e);for(let o=0;o<this.hashCount;o++){let u=this.pe(r,i,o);if(!this.ye(u))return!1}return!0}static create(t,e,r){let i=t%8==0?0:8-t%8,o=new Uint8Array(Math.ceil(t/8)),u=new n(o,i,e);return r.forEach(l=>u.insert(l)),u}insert(t){if(this.fe===0)return;let e=wc(t),[r,i]=vc(e);for(let o=0;o<this.hashCount;o++){let u=this.pe(r,i,o);this.we(u)}}we(t){let e=Math.floor(t/8),r=t%8;this.bitmap[e]|=1<<r}},ye=class extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}};var xr=class n{constructor(t,e,r,i,o){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=o}static createSynthesizedRemoteEventForCurrentChange(t,e,r){let i=new Map;return i.set(t,Mn.createSynthesizedTargetChangeForCurrentChange(t,e,r)),new n(q.min(),i,new et(U),Xt(),j())}},Mn=class n{constructor(t,e,r,i,o){this.resumeToken=t,this.current=e,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=o}static createSynthesizedTargetChangeForCurrentChange(t,e,r){return new n(r,e,j(),j(),j())}};var Ue=class{constructor(t,e,r,i){this.Se=t,this.removedTargetIds=e,this.key=r,this.be=i}},Nr=class{constructor(t,e){this.targetId=t,this.De=e}},kr=class{constructor(t,e,r=yt.EMPTY_BYTE_STRING,i=null){this.state=t,this.targetIds=e,this.resumeToken=r,this.cause=i}},Fr=class{constructor(){this.ve=0,this.Ce=Ic(),this.Fe=yt.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return this.ve!==0}get Ne(){return this.xe}Be(t){t.approximateByteSize()>0&&(this.xe=!0,this.Fe=t)}Le(){let t=j(),e=j(),r=j();return this.Ce.forEach((i,o)=>{switch(o){case 0:t=t.add(i);break;case 2:e=e.add(i);break;case 1:r=r.add(i);break;default:M(38017,{changeType:o})}}),new Mn(this.Fe,this.Me,t,e,r)}ke(){this.xe=!1,this.Ce=Ic()}qe(t,e){this.xe=!0,this.Ce=this.Ce.insert(t,e)}Qe(t){this.xe=!0,this.Ce=this.Ce.remove(t)}$e(){this.ve+=1}Ue(){this.ve-=1,Q(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}},Di=class{constructor(t){this.We=t,this.Ge=new Map,this.ze=Xt(),this.je=_r(),this.Je=_r(),this.He=new et(U)}Ye(t){for(let e of t.Se)t.be&&t.be.isFoundDocument()?this.Ze(e,t.be):this.Xe(e,t.key,t.be);for(let e of t.removedTargetIds)this.Xe(e,t.key,t.be)}et(t){this.forEachTarget(t,e=>{let r=this.tt(e);switch(t.state){case 0:this.nt(e)&&r.Be(t.resumeToken);break;case 1:r.Ue(),r.Oe||r.ke(),r.Be(t.resumeToken);break;case 2:r.Ue(),r.Oe||this.removeTarget(e);break;case 3:this.nt(e)&&(r.Ke(),r.Be(t.resumeToken));break;case 4:this.nt(e)&&(this.rt(e),r.Be(t.resumeToken));break;default:M(56790,{state:t.state})}})}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Ge.forEach((r,i)=>{this.nt(i)&&e(i)})}it(t){let e=t.targetId,r=t.De.count,i=this.st(e);if(i){let o=i.target;if(Ii(o))if(r===0){let u=new O(o.path);this.Xe(e,u,Ct.newNoDocument(u,q.min()))}else Q(r===1,20013,{expectedCount:r});else{let u=this.ot(e);if(u!==r){let l=this._t(t),h=l?this.ut(l,t,u):1;if(h!==0){this.rt(e);let f=h===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(e,f)}_c==null||_c.ct((function(g,w,S,P,D){var F,C,$,B,G,Z;let bt={localCacheCount:g,existenceFilterCount:w.count,databaseId:S.database,projectId:S.projectId},H=w.unchangedNames;return H&&(bt.bloomFilter={applied:D===0,hashCount:(F=H==null?void 0:H.hashCount)!==null&&F!==void 0?F:0,bitmapLength:(B=($=(C=H==null?void 0:H.bits)===null||C===void 0?void 0:C.bitmap)===null||$===void 0?void 0:$.length)!==null&&B!==void 0?B:0,padding:(Z=(G=H==null?void 0:H.bits)===null||G===void 0?void 0:G.padding)!==null&&Z!==void 0?Z:0,mightContain:I=>{var m;return(m=P==null?void 0:P.mightContain(I))!==null&&m!==void 0&&m}}),bt})(u,t.De,this.We.lt(),l,h))}}}}_t(t){let e=t.De.unchangedNames;if(!e||!e.bits)return null;let{bits:{bitmap:r="",padding:i=0},hashCount:o=0}=e,u,l;try{u=Qt(r).toUint8Array()}catch(h){if(h instanceof Rr)return oe("Decoding the base64 bloom filter in existence filter failed ("+h.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw h}try{l=new Ci(u,i,o)}catch(h){return oe(h instanceof ye?"BloomFilter error: ":"Applying bloom filter failed: ",h),null}return l.fe===0?null:l}ut(t,e,r){return e.De.count===r-this.ht(t,e.targetId)?0:2}ht(t,e){let r=this.We.getRemoteKeysForTarget(e),i=0;return r.forEach(o=>{let u=this.We.lt(),l="projects/".concat(u.projectId,"/databases/").concat(u.database,"/documents/").concat(o.path.canonicalString());t.mightContain(l)||(this.Xe(e,o,null),i++)}),i}Pt(t){let e=new Map;this.Ge.forEach((o,u)=>{let l=this.st(u);if(l){if(o.current&&Ii(l.target)){let h=new O(l.target.path);this.Tt(h).has(u)||this.It(u,h)||this.Xe(u,h,Ct.newNoDocument(h,t))}o.Ne&&(e.set(u,o.Le()),o.ke())}});let r=j();this.Je.forEach((o,u)=>{let l=!0;u.forEachWhile(h=>{let f=this.st(h);return!f||f.purpose==="TargetPurposeLimboResolution"||(l=!1,!1)}),l&&(r=r.add(o))}),this.ze.forEach((o,u)=>u.setReadTime(t));let i=new xr(t,e,this.He,this.ze,r);return this.ze=Xt(),this.je=_r(),this.Je=_r(),this.He=new et(U),i}Ze(t,e){if(!this.nt(t))return;let r=this.It(t,e.key)?2:0;this.tt(t).qe(e.key,r),this.ze=this.ze.insert(e.key,e),this.je=this.je.insert(e.key,this.Tt(e.key).add(t)),this.Je=this.Je.insert(e.key,this.dt(e.key).add(t))}Xe(t,e,r){if(!this.nt(t))return;let i=this.tt(t);this.It(t,e)?i.qe(e,1):i.Qe(e),this.Je=this.Je.insert(e,this.dt(e).delete(t)),this.Je=this.Je.insert(e,this.dt(e).add(t)),r&&(this.ze=this.ze.insert(e,r))}removeTarget(t){this.Ge.delete(t)}ot(t){let e=this.tt(t).Le();return this.We.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}$e(t){this.tt(t).$e()}tt(t){let e=this.Ge.get(t);return e||(e=new Fr,this.Ge.set(t,e)),e}dt(t){let e=this.Je.get(t);return e||(e=new ct(U),this.Je=this.Je.insert(t,e)),e}Tt(t){let e=this.je.get(t);return e||(e=new ct(U),this.je=this.je.insert(t,e)),e}nt(t){let e=this.st(t)!==null;return e||k("WatchChangeAggregator","Detected inactive target",t),e}st(t){let e=this.Ge.get(t);return e&&e.Oe?null:this.We.Et(t)}rt(t){this.Ge.set(t,new Fr),this.We.getRemoteKeysForTarget(t).forEach(e=>{this.Xe(t,e,null)})}It(t,e){return this.We.getRemoteKeysForTarget(t).has(e)}};function _r(){return new et(O.comparator)}function Ic(){return new et(O.comparator)}var of={asc:"ASCENDING",desc:"DESCENDING"},af={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},uf={and:"AND",or:"OR"},xi=class{constructor(t,e){this.databaseId=t,this.useProto3Json=e}};function Ni(n,t){return n.useProto3Json||is(t)?t:{value:t}}function Or(n,t){return n.useProto3Json?"".concat(new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z",""),".").concat(("000000000"+t.nanoseconds).slice(-9),"Z"):{seconds:""+t.seconds,nanos:t.nanoseconds}}function Ol(n,t){return n.useProto3Json?t.toBase64():t.toUint8Array()}function cf(n,t){return Or(n,t.toTimestamp())}function Mt(n){return Q(!!n,49232),q.fromTimestamp((function(e){let r=Kt(e);return new at(r.seconds,r.nanos)})(n))}function Zo(n,t){return ki(n,t).canonicalString()}function ki(n,t){let e=(function(i){return new J(["projects",i.projectId,"databases",i.database])})(n).child("documents");return t===void 0?e:e.child(t)}function Ml(n){let t=J.fromString(n);return Q(jl(t),10190,{key:t.toString()}),t}function Fi(n,t){return Zo(n.databaseId,t.path)}function Hs(n,t){let e=Ml(t);if(e.get(1)!==n.databaseId.projectId)throw new x(b.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+e.get(1)+" vs "+n.databaseId.projectId);if(e.get(3)!==n.databaseId.database)throw new x(b.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+e.get(3)+" vs "+n.databaseId.database);return new O(ql(e))}function Ll(n,t){return Zo(n.databaseId,t)}function lf(n){let t=Ml(n);return t.length===4?J.emptyPath():ql(t)}function Oi(n){return new J(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function ql(n){return Q(n.length>4&&n.get(4)==="documents",29091,{key:n.toString()}),n.popFirst(5)}function Tc(n,t,e){return{name:Fi(n,t),fields:e.value.mapValue.fields}}function hf(n,t){let e;if("targetChange"in t){t.targetChange;let r=(function(f){return f==="NO_CHANGE"?0:f==="ADD"?1:f==="REMOVE"?2:f==="CURRENT"?3:f==="RESET"?4:M(39313,{state:f})})(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],o=(function(f,g){return f.useProto3Json?(Q(g===void 0||typeof g=="string",58123),yt.fromBase64String(g||"")):(Q(g===void 0||g instanceof Buffer||g instanceof Uint8Array,16193),yt.fromUint8Array(g||new Uint8Array))})(n,t.targetChange.resumeToken),u=t.targetChange.cause,l=u&&(function(f){let g=f.code===void 0?b.UNKNOWN:Fl(f.code);return new x(g,f.message||"")})(u);e=new kr(r,i,o,l||null)}else if("documentChange"in t){t.documentChange;let r=t.documentChange;r.document,r.document.name,r.document.updateTime;let i=Hs(n,r.document.name),o=Mt(r.document.updateTime),u=r.document.createTime?Mt(r.document.createTime):q.min(),l=new Tt({mapValue:{fields:r.document.fields}}),h=Ct.newFoundDocument(i,o,u,l),f=r.targetIds||[],g=r.removedTargetIds||[];e=new Ue(f,g,h.key,h)}else if("documentDelete"in t){t.documentDelete;let r=t.documentDelete;r.document;let i=Hs(n,r.document),o=r.readTime?Mt(r.readTime):q.min(),u=Ct.newNoDocument(i,o),l=r.removedTargetIds||[];e=new Ue([],l,u.key,u)}else if("documentRemove"in t){t.documentRemove;let r=t.documentRemove;r.document;let i=Hs(n,r.document),o=r.removedTargetIds||[];e=new Ue([],o,i,null)}else{if(!("filter"in t))return M(11601,{At:t});{t.filter;let r=t.filter;r.targetId;let{count:i=0,unchangedNames:o}=r,u=new Vi(i,o),l=r.targetId;e=new Nr(l,u)}}return e}function df(n,t){let e;if(t instanceof be)e={update:Tc(n,t.key,t.value)};else if(t instanceof Je)e={delete:Fi(n,t.key)};else if(t instanceof qt)e={update:Tc(n,t.key,t.data),updateMask:If(t.fieldMask)};else{if(!(t instanceof Si))return M(16599,{Rt:t.type});e={verify:Fi(n,t.key)}}return t.fieldTransforms.length>0&&(e.updateTransforms=t.fieldTransforms.map(r=>(function(o,u){let l=u.transform;if(l instanceof He)return{fieldPath:u.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(l instanceof Ee)return{fieldPath:u.field.canonicalString(),appendMissingElements:{values:l.elements}};if(l instanceof Ae)return{fieldPath:u.field.canonicalString(),removeAllFromArray:{values:l.elements}};if(l instanceof Se)return{fieldPath:u.field.canonicalString(),increment:l.Ee};throw M(20930,{transform:u.transform})})(0,r))),t.precondition.isNone||(e.currentDocument=(function(i,o){return o.updateTime!==void 0?{updateTime:cf(i,o.updateTime)}:o.exists!==void 0?{exists:o.exists}:M(27497)})(n,t.precondition)),e}function ff(n,t){return n&&n.length>0?(Q(t!==void 0,14353),n.map(e=>(function(i,o){let u=i.updateTime?Mt(i.updateTime):Mt(o);return u.isEqual(q.min())&&(u=Mt(o)),new Ai(u,i.transformResults||[])})(e,t))):[]}function mf(n,t){return{documents:[Ll(n,t.path)]}}function gf(n,t){let e={structuredQuery:{}},r=t.path,i;t.collectionGroup!==null?(i=r,e.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=r.popLast(),e.structuredQuery.from=[{collectionId:r.lastSegment()}]),e.parent=Ll(n,i);let o=(function(f){if(f.length!==0)return Bl(Dt.create(f,"and"))})(t.filters);o&&(e.structuredQuery.where=o);let u=(function(f){if(f.length!==0)return f.map(g=>(function(S){return{field:Me(S.field),direction:_f(S.dir)}})(g))})(t.orderBy);u&&(e.structuredQuery.orderBy=u);let l=Ni(n,t.limit);return l!==null&&(e.structuredQuery.limit=l),t.startAt&&(e.structuredQuery.startAt=(function(f){return{before:f.inclusive,values:f.position}})(t.startAt)),t.endAt&&(e.structuredQuery.endAt=(function(f){return{before:!f.inclusive,values:f.position}})(t.endAt)),{Vt:e,parent:i}}function pf(n){let t=lf(n.parent),e=n.structuredQuery,r=e.from?e.from.length:0,i=null;if(r>0){Q(r===1,65062);let g=e.from[0];g.allDescendants?i=g.collectionId:t=t.child(g.collectionId)}let o=[];e.where&&(o=(function(w){let S=Ul(w);return S instanceof Dt&&yl(S)?S.getFilters():[S]})(e.where));let u=[];e.orderBy&&(u=(function(w){return w.map(S=>(function(D){return new Te(Le(D.field),(function(C){switch(C){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(D.direction))})(S))})(e.orderBy));let l=null;e.limit&&(l=(function(w){let S;return S=typeof w=="object"?w.value:w,is(S)?null:S})(e.limit));let h=null;e.startAt&&(h=(function(w){let S=!!w.before,P=w.values||[];return new Qe(P,S)})(e.startAt));let f=null;return e.endAt&&(f=(function(w){let S=!w.before,P=w.values||[];return new Qe(P,S)})(e.endAt)),$d(t,i,u,o,l,"F",h,f)}function yf(n,t){let e=(function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return M(28987,{purpose:i})}})(t.purpose);return e==null?null:{"goog-listen-tags":e}}function Ul(n){return n.unaryFilter!==void 0?(function(e){switch(e.unaryFilter.op){case"IS_NAN":let r=Le(e.unaryFilter.field);return it.create(r,"==",{doubleValue:NaN});case"IS_NULL":let i=Le(e.unaryFilter.field);return it.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let o=Le(e.unaryFilter.field);return it.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let u=Le(e.unaryFilter.field);return it.create(u,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return M(61313);default:return M(60726)}})(n):n.fieldFilter!==void 0?(function(e){return it.create(Le(e.fieldFilter.field),(function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";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"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return M(58110);default:return M(50506)}})(e.fieldFilter.op),e.fieldFilter.value)})(n):n.compositeFilter!==void 0?(function(e){return Dt.create(e.compositeFilter.filters.map(r=>Ul(r)),(function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return M(1026)}})(e.compositeFilter.op))})(n):M(30097,{filter:n})}function _f(n){return of[n]}function wf(n){return af[n]}function vf(n){return uf[n]}function Me(n){return{fieldPath:n.canonicalString()}}function Le(n){return Et.fromServerFormat(n.fieldPath)}function Bl(n){return n instanceof it?(function(e){if(e.op==="=="){if(cc(e.value))return{unaryFilter:{field:Me(e.field),op:"IS_NAN"}};if(uc(e.value))return{unaryFilter:{field:Me(e.field),op:"IS_NULL"}}}else if(e.op==="!="){if(cc(e.value))return{unaryFilter:{field:Me(e.field),op:"IS_NOT_NA
1N"}};if(uc(e.value))return{unaryFilter:{field:Me(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Me(e.field),op:wf(e.op),value:e.value}}})(n):n instanceof Dt?(function(e){let r=e.getFilters().map(i=>Bl(i));return r.length===1?r[0]:{compositeFilter:{op:vf(e.op),filters:r}}})(n):M(54877,{filter:n})}function If(n){let t=[];return n.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function jl(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}var Ln=class n{constructor(t,e,r,i,o=q.min(),u=q.min(),l=yt.EMPTY_BYTE_STRING,h=null){this.target=t,this.targetId=e,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=o,this.lastLimboFreeSnapshotVersion=u,this.resumeToken=l,this.expectedCount=h}withSequenceNumber(t){return new n(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(t,e){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t,null)}withExpectedCount(t){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}withLastLimboFreeSnapshotVersion(t){return new n(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}};var Mi=class{constructor(t){this.gt=t}};function Tf(n){let t=pf({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?Dr(t,t.limit,"L"):t}var Mr=class{constructor(){}bt(t,e){this.Dt(t,e),e.vt()}Dt(t,e){if("nullValue"in t)this.Ct(e,5);else if("booleanValue"in t)this.Ct(e,10),e.Ft(t.booleanValue?1:0);else if("integerValue"in t)this.Ct(e,15),e.Ft(Y(t.integerValue));else if("doubleValue"in t){let r=Y(t.doubleValue);isNaN(r)?this.Ct(e,13):(this.Ct(e,15),kn(r)?e.Ft(0):e.Ft(r))}else if("timestampValue"in t){let r=t.timestampValue;this.Ct(e,20),typeof r=="string"&&(r=Kt(r)),e.Mt("".concat(r.seconds||"")),e.Ft(r.nanos||0)}else if("stringValue"in t)this.xt(t.stringValue,e),this.Ot(e);else if("bytesValue"in t)this.Ct(e,30),e.Nt(Qt(t.bytesValue)),this.Ot(e);else if("referenceValue"in t)this.Bt(t.referenceValue,e);else if("geoPointValue"in t){let r=t.geoPointValue;this.Ct(e,45),e.Ft(r.latitude||0),e.Ft(r.longitude||0)}else"mapValue"in t?ml(t)?this.Ct(e,Number.MAX_SAFE_INTEGER):fl(t)?this.Lt(t.mapValue,e):(this.kt(t.mapValue,e),this.Ot(e)):"arrayValue"in t?(this.qt(t.arrayValue,e),this.Ot(e)):M(19022,{Qt:t})}xt(t,e){this.Ct(e,25),this.$t(t,e)}$t(t,e){e.Mt(t)}kt(t,e){let r=t.fields||{};this.Ct(e,55);for(let i of Object.keys(r))this.xt(i,e),this.Dt(r[i],e)}Lt(t,e){var r,i;let o=t.fields||{};this.Ct(e,53);let u=ze,l=((i=(r=o[u].arrayValue)===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.length)||0;this.Ct(e,15),e.Ft(Y(l)),this.xt(u,e),this.Dt(o[u],e)}qt(t,e){let r=t.values||[];this.Ct(e,50);for(let i of r)this.Dt(i,e)}Bt(t,e){this.Ct(e,37),O.fromName(t).path.forEach(r=>{this.Ct(e,60),this.$t(r,e)})}Ct(t,e){t.Ft(e)}Ot(t){t.Ft(2)}};Mr.Ut=new Mr;var Li=class{constructor(){this.Dn=new qi}addToCollectionParentIndex(t,e){return this.Dn.add(e),R.resolve()}getCollectionParents(t,e){return R.resolve(this.Dn.getEntries(e))}addFieldIndex(t,e){return R.resolve()}deleteFieldIndex(t,e){return R.resolve()}deleteAllFieldIndexes(t){return R.resolve()}createTargetIndexes(t,e){return R.resolve()}getDocumentsMatchingTarget(t,e){return R.resolve(null)}getIndexType(t,e){return R.resolve(0)}getFieldIndexes(t,e){return R.resolve([])}getNextCollectionGroupToUpdate(t){return R.resolve(null)}getMinOffset(t,e){return R.resolve(Ie.min())}getMinOffsetFromCollectionGroup(t,e){return R.resolve(Ie.min())}updateCollectionGroup(t,e,r){return R.resolve()}updateIndexEntries(t,e){return R.resolve()}},qi=class{constructor(){this.index={}}add(t){let e=t.lastSegment(),r=t.popLast(),i=this.index[e]||new ct(J.comparator),o=!i.has(r);return this.index[e]=i.add(r),o}has(t){let e=t.lastSegment(),r=t.popLast(),i=this.index[e];return i&&i.has(r)}getEntries(t){return(this.index[t]||new ct(J.comparator)).toArray()}};
1var zm=new Uint8Array(0);var Ec={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},$l=41943040,Rt=class n{static withCacheSize(t){return new n(t,n.DEFAULT_COLLECTION_PERCENTILE,n.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(t,e,r){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=r}};Rt.DEFAULT_COLLECTION_PERCENTILE=10,Rt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Rt.DEFAULT=new Rt($l,Rt.DEFAULT_COLLECTION_PERCENTILE,Rt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Rt.DISABLED=new Rt(-1,0,0);var qn=class n{constructor(t){this._r=t}next(){return this._r+=2,this._r}static ar(){return new n(0)}static ur(){return new n(-1)}};var Ac="LruGarbageCollector",Ef=1048576;function Sc([n,t],[e,r]){let i=U(n,e);return i===0?U(t,r):i}var Ui=class{constructor(t){this.Tr=t,this.buffer=new ct(Sc),this.Ir=0}dr(){return++this.Ir}Er(t){let e=[t,this.dr()];if(this.buffer.size<this.Tr)this.buffer=this.buffer.add(e);else{let r=this.buffer.last();Sc(e,r)<0&&(this.buffer=this.buffer.delete(r).add(e))}}get maxValue(){return this.buffer.last()[0]}},Bi=class{constructor(t,e,r){this.garbageCollector=t,this.asyncQueue=e,this.localStore=r,this.Ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Rr(6e4)}stop(){this.Ar&&(this.Ar.cancel(),this.Ar=null)}get started(){return this.Ar!==null}Rr(t){k(Ac,"Garbage collection scheduled in ".concat(t,"ms")),this.Ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",t,()=>N(this,null,function*(){this.Ar=null;try{yield this.localStore.collectGarbage(this.garbageCollector)}catch(e){nn(e)?k(Ac,"Ignoring IndexedDB error during garbage collection: ",e):yield en(e)}yield this.Rr(3e5)}))}},ji=class{constructor(t,e){this.Vr=t,this.params=e}calculateTargetCount(t,e){return this.Vr.mr(t).next(r=>Math.floor(e/100*r))}nthSequenceNumber(t,e){if(e===0)return R.resolve(zo.ue);let r=new Ui(e);return this.Vr.forEachTarget(t,i=>r.Er(i.sequenceNumber)).next(()=>this.Vr.gr(t,i=>r.Er(i))).next(()=>r.maxValue)}removeTargets(t,e,r){return this.Vr.removeTargets(t,e,r)}removeOrphanedDocuments(t,e){return this.Vr.removeOrphanedDocuments(t,e)}collect(t,e){return this.params.cacheSizeCollectionThreshold===-1?(k("LruGarbageCollector","Garbage collection skipped; disabled"),R.resolve(Ec)):this.getCacheSize(t).next(r=>r<this.params.cacheSizeCollectionThreshold?(k("LruGarbageCollector","Garbage collection skipped; Cache size ".concat(r," is lower than threshold ").concat(this.params.cacheSizeCollectionThreshold)),Ec):this.pr(t,e))}getCacheSize(t){return this.Vr.getCacheSize(t)}pr(t,e){let r,i,o,u,l,h,f,g=Date.now();return this.calculateTargetCount(t,this.params.percentileToCollect).next(w=>(w>this.params.maximumSequenceNumbersToCollect?(k("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of ".concat(this.params.maximumSequenceNumbersToCollect," from ").concat(w)),i=this.params.maximumSequenceNumbersToCollect):i=w,u=Date.now(),this.nthSequenceNumber(t,i))).next(w=>(r=w,l=Date.now(),this.removeTargets(t,r,e))).next(w=>(o=w,h=Date.now(),this.removeOrphanedDocuments(t,r))).next(w=>(f=Date.now(),Fe()<=Nt.DEBUG&&k("LruGarbageCollector","LRU Garbage Collection\n Counted targets in ".concat(u-g,"ms\n Determined least recently used ").concat(i," in ")+(l-u)+"ms\n"+" Removed ".concat(o," targets in ")+(h-l)+"ms\n"+" Removed ".concat(w," documents in ")+(f-h)+"ms\n"+"Total Duration: ".concat(f-g,"ms")),R.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:w})))}};function Af(n,t){return new ji(n,t)}var $i=class{constructor(){this.changes=new Ht(t=>t.toString(),(t,e)=>t.isEqual(e)),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,Ct.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();let r=this.changes.get(e);return r!==void 0?R.resolve(r):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}
vendor: 27,519 bytes, line 1
1assertNotApplied(){}};var zi=class{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}};var Gi=class{constructor(t,e,r,i){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=r,this.indexManager=i}getDocument(t,e){let r=null;return this.documentOverlayCache.getOverlay(t,e).next(i=>(r=i,this.remoteDocumentCache.getEntry(t,e))).next(i=>(r!==null&&Dn(r.mutation,i,Pt.empty(),at.now()),i))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next(r=>this.getLocalViewOfDocuments(t,r,j()).next(()=>r))}getLocalViewOfDocuments(t,e,r=j()){let i=pe();return this.populateOverlays(t,i,e).next(()=>this.computeViews(t,e,i,r).next(o=>{let u=Rn();return o.forEach((l,h)=>{u=u.insert(l,h.overlayedDocument)}),u}))}getOverlayedDocuments(t,e){let r=pe();return this.populateOverlays(t,r,e).next(()=>this.computeViews(t,e,r,j()))}populateOverlays(t,e,r){let i=[];return r.forEach(o=>{e.has(o)||i.push(o)}),this.documentOverlayCache.getOverlays(t,i).next(o=>{o.forEach((u,l)=>{e.set(u,l)})})}computeViews(t,e,r,i){let o=Xt(),u=Cn(),l=(function(){return Cn()})();return e.forEach((h,f)=>{let g=r.get(f.key);i.has(f.key)&&(g===void 0||g.mutation instanceof qt)?o=o.insert(f.key,f):g!==void 0?(u.set(f.key,g.mutation.getFieldMask()),Dn(g.mutation,f,g.mutation.getFieldMask(),at.now())):u.set(f.key,Pt.empty())}),this.recalculateAndSaveOverlays(t,o).next(h=>(h.forEach((f,g)=>u.set(f,g)),e.forEach((f,g)=>{var w;return l.set(f,new zi(g,(w=u.get(f))!==null&&w!==void 0?w:null))}),l))}recalculateAndSaveOverlays(t,e){let r=Cn(),i=new et((u,l)=>u-l),o=j();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next(u=>{for(let l of u)l.keys().forEach(h=>{let f=e.get(h);if(f===null)return;let g=r.get(h)||Pt.empty();g=l.applyToLocalView(f,g),r.set(h,g);let w=(i.get(l.batchId)||j()).add(h);i=i.insert(l.batchId,w)})}).next(()=>{let u=[],l=i.getReverseIterator();for(;l.hasNext();){let h=l.getNext(),f=h.key,g=h.value,w=bl();g.forEach(S=>{if(!o.has(S)){let P=Nl(e.get(S),r.get(S));P!==null&&w.set(S,P),o=o.add(S)}}),u.push(this.documentOverlayCache.saveOverlays(t,f,w))}return R.waitFor(u)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next(r=>this.recalculateAndSaveOverlays(t,r))}getDocumentsMatchingQuery(t,e,r,i){return(function(u){return O.isDocumentKey(u.path)&&u.collectionGroup===null&&u.filters.length===0})(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Il(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,r,i):this.getDocumentsMatchingCollectionQuery(t,e,r,i)}getNextDocuments(t,e,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,r,i).next(o=>{let u=i-o.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,r.largestBatchId,i-o.size):R.resolve(pe()),l=Nn,h=o;return u.next(f=>R.forEach(f,(g,w)=>(l<w.largestBatchId&&(l=w.largestBatchId),o.get(g)?R.resolve():this.remoteDocumentCache.getEntry(t,g).next(S=>{h=h.insert(g,S)}))).next(()=>this.populateOverlays(t,f,o)).next(()=>this.computeViews(t,h,f,j())).next(g=>({batchId:l,changes:Sl(g)})))})}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new O(e)).next(r=>{let i=Rn();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(t,e,r,i){let o=e.collectionGroup,u=Rn();return this.indexManager.getCollectionParents(t,o).next(l=>R.forEach(l,h=>{let f=(function(w,S){return new Wt(S,null,w.explicitOrderBy.slice(),w.filters.slice(),w.limit,w.limitType,w.startAt,w.endAt)})(e,h.child(o));return this.getDocumentsMatchingCollectionQuery(t,f,r,i).next(g=>{g.forEach((w,S)=>{u=u.insert(w,S)})})}).next(()=>u))}getDocumentsMatchingCollectionQuery(t,e,r,i){let o;return this.documentOverlayCache.getOverlaysForCollection(t,e.path,r.largestBatchId).next(u=>(o=u,this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,r,o,i))).next(u=>{o.forEach((h,f)=>{let g=f.getKey();u.get(g)===null&&(u=u.insert(g,Ct.newInvalidDocument(g)))});let l=Rn();return u.forEach((h,f)=>{let g=o.get(h);g!==void 0&&Dn(g.mutation,f,Pt.empty(),at.now()),us(e,f)&&(l=l.insert(h,f))}),l})}};var Ki=class{constructor(t){this.serializer=t,this.Br=new Map,this.Lr=new Map}getBundleMetadata(t,e){return R.resolve(this.Br.get(e))}saveBundleMetadata(t,e){return this.Br.set(e.id,(function(i){return{id:i.id,version:i.version,createTime:Mt(i.createTime)}})(e)),R.resolve()}getNamedQuery(t,e){return R.resolve(this.Lr.get(e))}saveNamedQuery(t,e){return this.Lr.set(e.name,(function(i){return{name:i.name,query:Tf(i.bundledQuery),readTime:Mt(i.readTime)}})(e)),R.resolve()}};var Qi=class{constructor(){this.overlays=new et(O.comparator),this.kr=new Map}getOverlay(t,e){return R.resolve(this.overlays.get(e))}getOverlays(t,e){let r=pe();return R.forEach(e,i=>this.getOverlay(t,i).next(o=>{o!==null&&r.set(i,o)})).next(()=>r)}saveOverlays(t,e,r){return r.forEach((i,o)=>{this.wt(t,e,o)}),R.resolve()}removeOverlaysForBatchId(t,e,r){let i=this.kr.get(r);return i!==void 0&&(i.forEach(o=>this.overlays=this.overlays.remove(o)),this.kr.delete(r)),R.resolve()}getOverlaysForCollection(t,e,r){let i=pe(),o=e.length+1,u=new O(e.child("")),l=this.overlays.getIteratorFrom(u);for(;l.hasNext();){let h=l.getNext().value,f=h.getKey();if(!e.isPrefixOf(f.path))break;f.path.length===o&&h.largestBatchId>r&&i.set(h.getKey(),h)}return R.resolve(i)}getOverlaysForCollectionGroup(t,e,r,i){let o=new et((f,g)=>f-g),u=this.overlays.getIterator();for(;u.hasNext();){let f=u.getNext().value;if(f.getKey().getCollectionGroup()===e&&f.largestBatchId>r){let g=o.get(f.largestBatchId);g===null&&(g=pe(),o=o.insert(f.largestBatchId,g)),g.set(f.getKey(),f)}}let l=pe(),h=o.getIterator();for(;h.hasNext()&&(h.getNext().value.forEach((f,g)=>l.set(f,g)),!(l.size()>=i)););return R.resolve(l)}wt(t,e,r){let i=this.overlays.get(r.key);if(i!==null){let u=this.kr.get(i.largestBatchId).delete(r.key);this.kr.set(i.largestBatchId,u)}this.overlays=this.overlays.insert(r.key,new Pi(e,r));let o=this.kr.get(e);o===void 0&&(o=j(),this.kr.set(e,o)),this.kr.set(e,o.add(r.key))}};var Wi=class{constructor(){this.sessionToken=yt.EMPTY_BYTE_STRING}getSessionToken(t){return R.resolve(this.sessionToken)}setSessionToken(t,e){return this.sessionToken=e,R.resolve()}};var Un=class{constructor(){this.qr=new ct(st.Qr),this.$r=new ct(st.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(t,e){let r=new st(t,e);this.qr=this.qr.add(r),this.$r=this.$r.add(r)}Kr(t,e){t.forEach(r=>this.addReference(r,e))}removeReference(t,e){this.Wr(new st(t,e))}Gr(t,e){t.forEach(r=>this.removeReference(r,e))}zr(t){let e=new O(new J([])),r=new st(e,t),i=new st(e,t+1),o=[];return this.$r.forEachInRange([r,i],u=>{this.Wr(u),o.push(u.key)}),o}jr(){this.qr.forEach(t=>this.Wr(t))}Wr(t){this.qr=this.qr.delete(t),this.$r=this.$r.delete(t)}Jr(t){let e=new O(new J([])),r=new st(e,t),i=new st(e,t+1),o=j();return this.$r.forEachInRange([r,i],u=>{o=o.add(u.key)}),o}containsKey(t){let e=new st(t,0),r=this.qr.firstAfterOrEqual(e);return r!==null&&t.isEqual(r.key)}},st=class{constructor(t,e){this.key=t,this.Hr=e}static Qr(t,e){return O.comparator(t.key,e.key)||U(t.Hr,e.Hr)}static Ur(t,e){return U(t.Hr,e.Hr)||O.comparator(t.key,e.key)}};var Hi=class{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.er=1,this.Yr=new ct(st.Qr)}checkEmpty(t){return R.resolve(this.mutationQueue.length===0)}addMutationBatch(t,e,r,i){let o=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let u=new bi(o,e,r,i);this.mutationQueue.push(u);for(let l of i)this.Yr=this.Yr.add(new st(l.key,o)),this.indexManager.addToCollectionParentIndex(t,l.key.path.popLast());return R.resolve(u)}lookupMutationBatch(t,e){return R.resolve(this.Zr(e))}getNextMutationBatchAfterBatchId(t,e){let r=e+1,i=this.Xr(r),o=i<0?0:i;return R.resolve(this.mutationQueue.length>o?this.mutationQueue[o]:null)}getHighestUnacknowledgedBatchId(){return R.resolve(this.mutationQueue.length===0?ss:this.er-1)}getAllMutationBatches(t){return R.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){let r=new st(e,0),i=new st(e,Number.POSITIVE_INFINITY),o=[];return this.Yr.forEachInRange([r,i],u=>{let l=this.Zr(u.Hr);o.push(l)}),R.resolve(o)}getAllMutationBatchesAffectingDocumentKeys(t,e){let r=new ct(U);return e.forEach(i=>{let o=new st(i,0),u=new st(i,Number.POSITIVE_INFINITY);this.Yr.forEachInRange([o,u],l=>{r=r.add(l.Hr)})}),R.resolve(this.ei(r))}getAllMutationBatchesAffectingQuery(t,e){let r=e.path,i=r.length+1,o=r;O.isDocumentKey(o)||(o=o.child(""));let u=new st(new O(o),0),l=new ct(U);return this.Yr.forEachWhile(h=>{let f=h.key.path;return!!r.isPrefixOf(f)&&(f.length===i&&(l=l.add(h.Hr)),!0)},u),R.resolve(this.ei(l))}ei(t){let e=[];return t.forEach(r=>{let i=this.Zr(r);i!==null&&e.push(i)}),e}removeMutationBatch(t,e){Q(this.ti(e.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Yr;return R.forEach(e.mutations,i=>{let o=new st(i.key,e.batchId);return r=r.delete(o),this.referenceDelegate.markPotentiallyOrphaned(t,i.key)}).next(()=>{this.Yr=r})}rr(t){}containsKey(t,e){let r=new st(e,0),i=this.Yr.firstAfterOrEqual(r);return R.resolve(e.isEqual(i&&i.key))}performConsistencyCheck(t){return this.mutationQueue.length,R.resolve()}ti(t,e){return this.Xr(t)}Xr(t){return this.mutationQueue.length===0?0:t-this.mutationQueue[0].batchId}Zr(t){let e=this.Xr(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}};var Xi=class{constructor(t){this.ni=t,this.docs=(function(){return new et(O.comparator)})(),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){let r=e.key,i=this.docs.get(r),o=i?i.size:0,u=this.ni(e);return this.docs=this.docs.insert(r,{document:e.mutableCopy(),size:u}),this.size+=u-o,this.indexManager.addToCollectionParentIndex(t,r.path.popLast())}removeEntry(t){let e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){let r=this.docs.get(e);return R.resolve(r?r.document.mutableCopy():Ct.newInvalidDocument(e))}getEntries(t,e){let r=Xt();return e.forEach(i=>{let o=this.docs.get(i);r=r.insert(i,o?o.document.mutableCopy():Ct.newInvalidDocument(i))}),R.resolve(r)}getDocumentsMatchingQuery(t,e,r,i){let o=Xt(),u=e.path,l=new O(u.child("__id-9223372036854775808__")),h=this.docs.getIteratorFrom(l);for(;h.hasNext();){let{key:f,value:{document:g}}=h.getNext();if(!u.isPrefixOf(f.path))break;f.path.length>u.length+1||Ad(Ed(g),r)<=0||(i.has(g.key)||us(e,g))&&(o=o.insert(g.key,g.mutableCopy()))}return R.resolve(o)}getAllFromCollectionGroup(t,e,r,i){M(9500)}ri(t,e){return R.forEach(this.docs,r=>e(r))}newChangeBuffer(t){return new Ji(this)}getSize(t){return R.resolve(this.size)}},Ji=class extends $i{constructor(t){super(),this.Or=t}applyChanges(t){let e=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?e.push(this.Or.addEntry(t,i)):this.Or.removeEntry(r)}),R.waitFor(e)}getFromCache(t,e){return this.Or.getEntry(t,e)}getAllFromCache(t,e){return this.Or.getEntries(t,e)}};var Yi=class{constructor(t){this.persistence=t,this.ii=new Ht(e=>Ho(e),Xo),this.lastRemoteSnapshotVersion=q.min(),this.highestTargetId=0,this.si=0,this.oi=new Un,this.targetCount=0,this._i=qn.ar()}forEachTarget(t,e){return this.ii.forEach((r,i)=>e(i)),R.resolve()}getLastRemoteSnapshotVersion(t){return R.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return R.resolve(this.si)}allocateTargetId(t){return this.highestTargetId=this._i.next(),R.resolve(this.highestTargetId)}setTargetsMetadata(t,e,r){return r&&(this.lastRemoteSnapshotVersion=r),e>this.si&&(this.si=e),R.resolve()}hr(t){this.ii.set(t.target,t);let e=t.targetId;e>this.highestTargetId&&(this._i=new qn(e),this.highestTargetId=e),t.sequenceNumber>this.si&&(this.si=t.sequenceNumber)}addTargetData(t,e){return this.hr(e),this.targetCount+=1,R.resolve()}updateTargetData(t,e){return this.hr(e),R.resolve()}removeTargetData(t,e){return this.ii.delete(e.target),this.oi.zr(e.targetId),this.targetCount-=1,R.resolve()}removeTargets(t,e,r){let i=0,o=[];return this.ii.forEach((u,l)=>{l.sequenceNumber<=e&&r.get(l.targetId)===null&&(this.ii.delete(u),o.push(this.removeMatchingKeysForTargetId(t,l.targetId)),i++)}),R.waitFor(o).next(()=>i)}getTargetCount(t){return R.resolve(this.targetCount)}getTargetData(t,e){let r=this.ii.get(e)||null;return R.resolve(r)}addMatchingKeys(t,e,r){return this.oi.Kr(e,r),R.resolve()}removeMatchingKeys(t,e,r){this.oi.Gr(e,r);let i=this.persistence.referenceDelegate,o=[];return i&&e.forEach(u=>{o.push(i.markPotentiallyOrphaned(t,u))}),R.waitFor(o)}removeMatchingKeysForTargetId(t,e){return this.oi.zr(e),R.resolve()}getMatchingKeysForTargetId(t,e){let r=this.oi.Jr(e);return R.resolve(r)}containsKey(t,e){return R.resolve(this.oi.containsKey(e))}};var Lr=class{constructor(t,e){this.ai={},this.overlays={},this.ui=new zo(0),this.ci=!1,this.ci=!0,this.li=new Wi,this.referenceDelegate=t(this),this.hi=new Yi(this),this.indexManager=new Li,this.remoteDocumentCache=(function(i){return new Xi(i)})(r=>this.referenceDelegate.Pi(r)),this.serializer=new Mi(e),this.Ti=new Ki(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Qi,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let r=this.ai[t.toKey()];return r||(r=new Hi(e,this.referenceDelegate),this.ai[t.toKey()]=r),r}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(t,e,r){k("MemoryPersistence","Starting transaction:",t);let i=new Zi(this.ui.next());return this.referenceDelegate.Ii(),r(i).next(o=>this.referenceDelegate.di(i).next(()=>o)).toPromise().then(o=>(i.raiseOnCommittedEvent(),o))}Ei(t,e){return R.or(Object.values(this.ai).map(r=>()=>r.containsKey(t,e)))}},Zi=class extends ui{constructor(t){super(),this.currentSequenceNumber=t}},to=class n{constructor(t){this.persistence=t,this.Ai=new Un,this.Ri=null}static Vi(t){return new n(t)}get mi(){if(this.Ri)return this.Ri;throw M(60996)}addReference(t,e,r){return this.Ai.addReference(r,e),this.mi.delete(r.toString()),R.resolve()}removeReference(t,e,r){return this.Ai.removeReference(r,e),this.mi.add(r.toString()),R.resolve()}markPotentiallyOrphaned(t,e){return this.mi.add(e.toString()),R.resolve()}removeTarget(t,e){this.Ai.zr(e.targetId).forEach(i=>this.mi.add(i.toString()));let r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(t,e.targetId).next(i=>{i.forEach(o=>this.mi.add(o.toString()))}).next(()=>r.removeTargetData(t,e))}Ii(){this.Ri=new Set}di(t){let e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return R.forEach(this.mi,r=>{let i=O.fromPath(r);return this.fi(t,i).next(o=>{o||e.removeEntry(i,q.min())})}).next(()=>(this.Ri=null,e.apply(t)))}updateLimboDocument(t,e){return this.fi(t,e).next(r=>{r?this.mi.delete(e.toString()):this.mi.add(e.toString())})}Pi(t){return 0}fi(t,e){return R.or([()=>R.resolve(this.Ai.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ei(t,e)])}},qr=class n{constructor(t,e){this.persistence=t,this.gi=new Ht(r=>Pd(r.path),(r,i)=>r.isEqual(i)),this.garbageCollector=Af(this,e)}static Vi(t,e){return new n(t,e)}Ii(){}di(t){return R.resolve()}forEachTarget(t,e){return this.persistence.getTargetCache().forEachTarget(t,e)}mr(t){let e=this.yr(t);return this.persistence.getTargetCache().getTargetCount(t).next(r=>e.next(i=>r+i))}yr(t){let e=0;return this.gr(t,r=>{e++}).next(()=>e)}gr(t,e){return R.forEach(this.gi,(r,i)=>this.Sr(t,r,i).next(o=>o?R.resolve():e(i)))}removeTargets(t,e,r){return this.persistence.getTargetCache().removeTargets(t,e,r)}removeOrphanedDocuments(t,e){let r=0,i=this.persistence.getRemoteDocumentCache(),o=i.newChangeBuffer();return i.ri(t,u=>this.Sr(t,u,e).next(l=>{l||(r++,o.removeEntry(u,q.min()))})).next(()=>o.apply(t)).next(()=>r)}markPotentiallyOrphaned(t,e){return this.gi.set(e,t.currentSequenceNumber),R.resolve()}removeTarget(t,e){let r=e.withSequenceNumber(t.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(t,r)}addReference(t,e,r){return this.gi.set(r,t.currentSequenceNumber),R.resolve()}removeReference(t,e,r){return this.gi.set(r,t.currentSequenceNumber),R.resolve()}updateLimboDocument(t,e){return this.gi.set(e,t.currentSequenceNumber),R.resolve()}Pi(t){let e=t.key.toString().length;return t.isFoundDocument()&&(e+=vr(t.data.value)),e}Sr(t,e,r){return R.or([()=>this.persistence.Ei(t,e),()=>this.persistence.getTargetCache().containsKey(t,e),()=>{let i=this.gi.get(e);return R.resolve(i!==void 0&&i>r)}])}getCacheSize(t){return this.persistence.getRemoteDocumentCache().getSize(t)}};var eo=class n{constructor(t,e,r,i){this.targetId=t,this.fromCache=e,this.Is=r,this.ds=i}static Es(t,e){let r=j(),i=j();for(let o of e.docChanges)switch(o.type){case 0:r=r.add(o.doc.key);break;case 1:i=i.add(o.doc.key)}return new n(t,e.fromCache,r,i)}};var no=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(t){this._documentReadCount+=t}};var ro=class{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=(function(){return Uu()?8:bd(qu())>0?6:4})()}initialize(t,e){this.gs=t,this.indexManager=e,this.As=!0}getDocumentsMatchingQuery(t,e,r,i){let o={result:null};return this.ps(t,e).next(u=>{o.result=u}).next(()=>{if(!o.result)return this.ys(t,e,i,r).next(u=>{o.result=u})}).next(()=>{if(o.result)return;let u=new no;return this.ws(t,e,u).next(l=>{if(o.result=l,this.Rs)return this.Ss(t,e,u,l.size)})}).next(()=>o.result)}Ss(t,e,r,i){return r.documentReadCount<this.Vs?(Fe()<=Nt.DEBUG&&k("QueryEngine","SDK will not create cache indexes for query:",Oe(e),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),R.resolve()):(Fe()<=Nt.DEBUG&&k("QueryEngine","Query:",Oe(e),"scans",r.documentReadCount,"local documents and returns",i,"documents as results."),r.documentReadCount>this.fs*i?(Fe()<=Nt.DEBUG&&k("QueryEngine","The SDK decides to create cache indexes for query:",Oe(e),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(t,Ot(e))):R.resolve())}ps(t,e){if(fc(e))return R.resolve(null);let r=Ot(e);return this.indexManager.getIndexType(t,r).next(i=>i===0?null:(e.limit!==null&&i===1&&(e=Dr(e,null,"F"),r=Ot(e)),this.indexManager.getDocumentsMatchingTarget(t,r).next(o=>{let u=j(...o);return this.gs.getDocuments(t,u).next(l=>this.indexManager.getMinOffset(t,r).next(h=>{let f=this.bs(e,l);return this.Ds(e,f,u,h.readTime)?this.ps(t,Dr(e,null,"F")):this.vs(t,f,e,h)}))})))}ys(t,e,r,i){return fc(e)||i.isEqual(q.min())?R.resolve(null):this.gs.getDocuments(t,r).next(o=>{let u=this.bs(e,o);return this.Ds(e,u,r,i)?R.resolve(null):(Fe()<=Nt.DEBUG&&k("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Oe(e)),this.vs(t,u,e,Td(i,Nn)).next(l=>l))})}bs(t,e){let r=new ct(El(t));return e.forEach((i,o)=>{us(t,o)&&(r=r.add(o))}),r}Ds(t,e,r,i){if(t.limit===null)return!1;if(r.size!==e.size)return!0;let o=t.limitType==="F"?e.last():e.first();return!!o&&(o.hasPendingWrites||o.version.compareTo(i)>0)}ws(t,e,r){return Fe()<=Nt.DEBUG&&k("QueryEngine","Using full collection scan to execute query:",Oe(e)),this.gs.getDocumentsMatchingQuery(t,e,Ie.min(),r)}vs(t,e,r,i){return this.gs.getDocumentsMatchingQuery(t,r,i).next(o=>(e.forEach(u=>{o=o.insert(u.key,u)}),o))}};var ta="LocalStore",Sf=3e8,so=class{constructor(t,e,r,i){this.persistence=t,this.Cs=e,this.serializer=i,this.Fs=new et(U),this.Ms=new Ht(o=>Ho(o),Xo),this.xs=new Map,this.Os=t.getRemoteDocumentCache(),this.hi=t.getTargetCache(),this.Ti=t.getBundleCache(),this.Ns(r)}Ns(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Gi(this.Os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Os.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",e=>t.collect(e,this.Fs))}};function bf(n,t,e,r){return new so(n,t,e,r)}function zl(n,t){return N(this,null,function*(){let e=L(n);return yield e.persistence.runTransaction("Handle user change","readonly",r=>{let i;return e.mutationQueue.getAllMutationBatches(r).next(o=>(i=o,e.Ns(t),e.mutationQueue.getAllMutationBatches(r))).next(o=>{let u=[],l=[],h=j();for(let f of i){u.push(f.batchId);for(let g of f.mutations)h=h.add(g.key)}for(let f of o){l.push(f.batchId);for(let g of f.mutations)h=h.add(g.key)}return e.localDocuments.getDocuments(r,h).next(f=>({Bs:f,removedBatchIds:u,addedBatchIds:l}))})})})}function Rf(n,t){let e=L(n);return e.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{let i=t.batch.keys(),o=e.Os.newChangeBuffer({trackRemovals:!0});return(function(l,h,f,g){let w=f.batch,S=w.keys(),P=R.resolve();return S.forEach(D=>{P=P.next(()=>g.getEntry(h,D)).next(F=>{let C=f.docVersions.get(D);Q(C!==null,48541),F.version.compareTo(C)<0&&(w.applyToRemoteDocument(F,f),F.isValidDocument()&&(F.setReadTime(f.commitVersion),g.addEntry(F)))})}),P.next(()=>l.mutationQueue.removeMutationBatch(h,w))})(e,r,t,o).next(()=>o.apply(r)).next(()=>e.mutationQueue.performConsistencyCheck(r)).next(()=>e.documentOverlayCache.removeOverlaysForBatchId(r,i,t.batch.batchId)).next(()=>e.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,(function(l){let h=j();for(let f=0;f<l.mutationResults.length;++f)l.mutationResults[f].transformResults.length>0&&(h=h.add(l.batch.mutations[f].key));return h})(t))).next(()=>e.localDocuments.getDocuments(r,i))})}function Gl(n){let t=L(n);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.hi.getLastRemoteSnapshotVersion(e))}function Pf(n,t){let e=L(n),r=t.snapshotVersion,i=e.Fs;return e.persistence.runTransaction("Apply remote event","readwrite-primary",o=>{let u=e.Os.newChangeBuffer({trackRemovals:!0});i=e.Fs;let l=[];t.targetChanges.forEach((g,w)=>{let S=i.get(w);if(!S)return;l.push(e.hi.removeMatchingKeys(o,g.removedDocuments,w).next(()=>e.hi.addMatchingKeys(o,g.addedDocuments,w)));let P=S.withSequenceNumber(o.currentSequenceNumber);t.targetMismatches.get(w)!==null?P=P.withResumeToken(yt.EMPTY_BYTE_STRING,q.min()).withLastLimboFreeSnapshotVersion(q.min()):g.resumeToken.approximateByteSize()>0&&(P=P.withResumeToken(g.resumeToken,r)),i=i.insert(w,P),(function(F,C,$){return F.resumeToken.approximateByteSize()===0||C.snapshotVersion.toMicroseconds()-F.snapshotVersion.toMicroseconds()>=Sf?!0:$.addedDocuments.size+$.modifiedDocuments.size+$.removedDocuments.size>0})(S,P,g)&&l.push(e.hi.updateTargetData(o,P))});let h=Xt(),f=j();if(t.documentUpdates.forEach(g=>{t.resolvedLimboDocuments.has(g)&&l.push(e.persistence.referenceDelegate.updateLimboDocument(o,g))}),l.push(Vf(o,u,t.documentUpdates).next(g=>{h=g.Ls,f=g.ks})),!r.isEqual(q.min())){let g=e.hi.getLastRemoteSnapshotVersion(o).next(w=>e.hi.setTargetsMetadata(o,o.currentSequenceNumber,r));l.push(g)}return R.waitFor(l).next(()=>u.apply(o)).next(()=>e.localDocuments.getLocalViewOfDocuments(o,h,f)).next(()=>h)}).then(o=>(e.Fs=i,o))}function Vf(n,t,e){let r=j(),i=j();return e.forEach(o=>r=r.add(o)),t.getEntries(n,r).next(o=>{let u=Xt();return e.forEach((l,h)=>{let f=o.get(l);h.isFoundDocument()!==f.isFoundDocument()&&(i=i.add(l)),h.isNoDocument()&&h.version.isEqual(q.min())?(t.removeEntry(l,h.readTime),u=u.insert(l,h)):!f.isValidDocument()||h.version.compareTo(f.version)>0||h.version.compareTo(f.version)===0&&f.hasPendingWrites?(t.addEntry(h),u=u.insert(l,h)):k(ta,"Ignoring outdated watch update for ",l,". Current version:",f.version," Watch version:",h.version)}),{Ls:u,ks:i}})}function Cf(n,t){let e=L(n);return e.persistence.runTransaction("Get next mutation batch","readonly",r=>(t===void 0&&(t=ss),e.mutationQueue.getNextMutationBatchAfterBatchId(r,t)))}function Df(n,t){let e=L(n);return e.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return e.hi.getTargetData(r,t).next(o=>o?(i=o,R.resolve(i)):e.hi.allocateTargetId(r).next(u=>(i=new Ln(t,u,"TargetPurposeListen",r.currentSequenceNumber),e.hi.addTargetData(r,i).next(()=>i))))}).then(r=>{let i=e.Fs.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(e.Fs=e.Fs.insert(r.targetId,r),e.Ms.set(t,r.targetId)),r})}function io(n,t,e){return N(this,null,function*(){let r=L(n),i=r.Fs.get(t),o=e?"readwrite":"readwrite-primary";try{e||(yield r.persistence.runTransaction("Release target",o,u=>r.persistence.referenceDelegate.removeTarget(u,i)))}catch(u){if(!nn(u))throw u;k(ta,"Failed to update sequence numbers for target ".concat(t,": ").concat(u))}r.Fs=r.Fs.remove(t),r.Ms.delete(i.target)})}function bc(n,t,e){let r=L(n),i=q.min(),o=j();return r.persistence.runTransaction("Execute query","readwrite",u=>(function(h,f,g){let w=L(h),S=w.Ms.get(g);return S!==void 0?R.resolve(w.Fs.get(S)):w.hi.getTargetData(f,g)})(r,u,Ot(t)).next(l=>{if(l)return i=l.lastLimboFreeSnapshotVersion,r.hi.getMatchingKeysForTargetId(u,l.targetId).next(h=>{o=h})}).next(()=>r.Cs.getDocumentsMatchingQuery(u,t,e?i:q.min(),e?o:j())).next(l=>(xf(r,Gd(t),l),{documents:l,qs:o})))}function xf(n,t,e){let r=n.xs.get(t)||q.min();e.forEach((i,o)=>{o.readTime.compareTo(r)>0&&(r=o.readTime)}),n.xs.set(t,r)}var Ur=class{constructor(){this.activeTargetIds=Jd()}Gs(t){this.activeTargetIds=this.activeTargetIds.add(t)}zs(t){this.activeTargetIds=this.activeTargetIds.delete(t)}Ws(){let t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}};var oo=class{constructor(){this.Fo=new Ur,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,r){}addLocalQueryTarget(t,e=!0){return e&&this.Fo.Gs(t),this.Mo[t]||"not-current"}updateQueryState(t,e,r){this.Mo[t]=e}removeLocalQueryTarget(t){this.Fo.zs(t)}isLocalQueryTarget(t){return this.Fo.activeTargetIds.has(t)}clearQueryState(t){delete this.Mo[t]}getAllActiveQueryTargets(){return this.Fo.activeTargetIds}isActiveQueryTarget(t){return this.Fo.activeTargetIds.has(t)}start(){return this.Fo=new Ur,Promise.resolve()}handleUserChange(t,e,r){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}};var ao=class{xo(t){}shutdown(){}};var Rc="ConnectivityMonitor",Br=class{constructor(){this.Oo=()=>this.No(),this.Bo=()=>this.Lo(),this.ko=[],this.qo()}xo(t){this.ko.push(t)}shutdown(){window.removeEventListener("online",this.Oo),window.removeEventListener("offline",this.Bo)}qo(){window.addEventListener("online",this.Oo),window.addEventListener("offline",this.Bo)}No(){k(Rc,"Network connectivity changed: AVAILABLE");for(let t of this.ko)t(0)}Lo(){k(Rc,"Network connectivity changed: UNAVAILABLE");for(let t of this.ko)t(1)}static C(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}};var wr=null;function uo(){return wr===null?wr=(function(){return 268435456+Math.round(2147483648*Math.random())})():wr++,"0x"+wr.toString(16)}var Xs="RestConnection",Nf={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregation
1Query:"runAggregationQuery"},co=class{get Qo(){return!1}constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;let e=t.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.$o=e+"://"+t.host,this.Uo="projects/".concat(r,"/databases/").concat(i),this.Ko=this.databaseId.database===Pr?"project_id=".concat(r):"project_id=".concat(r,"&database_id=").concat(i)}Wo(t,e,r,i,o){let u=uo(),l=this.Go(t,e.toUriEncodedString());k(Xs,"Sending RPC '".concat(t,"' ").concat(u,":"),l,r);let h={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.Ko};this.zo(h,i,o);let{host:f}=new URL(l),g=js(f);return this.jo(t,l,h,r,g).then(w=>(k(Xs,"Received RPC '".concat(t,"' ").concat(u,": "),w),w),w=>{throw oe(Xs,"RPC '".concat(t,"' ").concat(u," failed with error: "),w,"url: ",l,"request:",r),w})}Jo(t,e,r,i,o,u){return this.Wo(t,e,r,i,o)}zo(t,e,r){t["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+tn})(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach((i,o)=>t[o]=i),r&&r.headers.forEach((i,o)=>t[o]=i)}Go(t,e){let r=Nf[t];return"".concat(this.$o,"/v1/").concat(e,":").concat(r)}terminate(){}};var lo=class{constructor(t){this.Ho=t.Ho,this.Yo=t.Yo}Zo(t){this.Xo=t}e_(t){this.t_=t}n_(t){this.r_=t}onMessage(t){this.i_=t}close(){this.Yo()}send(t){this.Ho(t)}s_(){this.Xo()}o_(){this.t_()}__(t){this.r_(t)}a_(t){this.i_(t)}};var pt="WebChannelConnection",ho=class extends co{constructor(t){super(t),this.u_=[],this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams,this.longPollingOptions=t.longPollingOptions}jo(t,e,r,i,o){let u=uo();return new Promise((l,h)=>{let f=new zs;f.setWithCredentials(!0),f.listenOnce(Gs.COMPLETE,()=>{try{switch(f.getLastErrorCode()){case bn.NO_ERROR:let w=f.getResponseJson();k(pt,"XHR for RPC '".concat(t,"' ").concat(u," received:"),JSON.stringify(w)),l(w);break;case bn.TIMEOUT:k(pt,"RPC '".concat(t,"' ").concat(u," timed out")),h(new x(b.DEADLINE_EXCEEDED,"Request time out"));break;case bn.HTTP_ERROR:let S=f.getStatus();if(k(pt,"RPC '".concat(t,"' ").concat(u," failed with status:"),S,"response text:",f.getResponseText()),S>0){let P=f.getResponseJson();Array.isArray(P)&&(P=P[0]);let D=P==null?void 0:P.error;if(D&&D.status&&D.message){let F=(function($){let B=$.toLowerCase().replace(/_/g,"-");return Object.values(b).indexOf(B)>=0?B:b.UNKNOWN})(D.status);h(new x(F,D.message))}else h(new x(b.UNKNOWN,"Server responded with status "+f.getStatus()))}else h(new x(b.UNAVAILABLE,"Connection failed."));break;default:M(9055,{c_:t,streamId:u,l_:f.getLastErrorCode(),h_:f.getLastError()})}}finally{k(pt,"RPC '".concat(t,"' ").concat(u," completed."))}});let g=JSON.stringify(i);k(pt,"RPC '".concat(t,"' ").concat(u," sending request:"),i),f.send(e,"POST",g,r,15)})}P_(t,e,r){let i=uo(),o=[this.$o,"/","google.firestore.v1.Firestore","/",t,"/channel"],u=Ws(),l=Qs(),h={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/".concat(this.databaseId.projectId,"/databases/").concat(this.databaseId.database)},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},f=this.longPollingOptions.timeoutSeconds;f!==void 0&&(h.longPollingTimeout=Math.round(1e3*f)),this.useFetchStreams&&(h.useFetchStreams=!0),this.zo(h.initMessageHeaders,e,r),h.encodeInitMessageHeaders=!0;let g=o.join("");k(pt,"Creating RPC '".concat(t,"' stream ").concat(i,": ").concat(g),h);let w=u.createWebChannel(g,h);this.T_(w);let S=!1,P=!1,D=new lo({Ho:C=>{P?k(pt,"Not sending because RPC '".concat(t,"' stream ").concat(i," is closed:"),C):(S||(k(pt,"Opening RPC '".concat(t,"' stream ").concat(i," transport.")),w.open(),S=!0),k(pt,"RPC '".concat(t,"' stream ").concat(i," sending:"),C),w.send(C))},Yo:()=>w.close()}),F=(C,$,B)=>{C.listen($,G=>{try{B(G)}catch(Z){setTimeout(()=>{throw Z},0)}})};return F(w,ke.EventType.OPEN,()=>{P||(k(pt,"RPC '".concat(t,"' stream ").concat(i," transport opened.")),D.s_())}),F(w,ke.EventType.CLOSE,()=>{P||(P=!0,k(pt,"RPC '".concat(t,"' stream ").concat(i," transport closed")),D.__(),this.I_(w))}
vendor: 40,565 bytes, line 1
1),F(w,ke.EventType.ERROR,C=>{P||(P=!0,oe(pt,"RPC '".concat(t,"' stream ").concat(i," transport errored. Name:"),C.name,"Message:",C.message),D.__(new x(b.UNAVAILABLE,"The operation could not be completed")))}),F(w,ke.EventType.MESSAGE,C=>{var $;if(!P){let B=C.data[0];Q(!!B,16349);let G=B,Z=(G==null?void 0:G.error)||(($=G[0])===null||$===void 0?void 0:$.error);if(Z){k(pt,"RPC '".concat(t,"' stream ").concat(i," received error:"),Z);let bt=Z.status,H=(function(y){let _=rt[y];if(_!==void 0)return Fl(_)})(bt),I=Z.message;H===void 0&&(H=b.INTERNAL,I="Unknown error status: "+bt+" with message "+Z.message),P=!0,D.__(new x(H,I)),w.close()}else k(pt,"RPC '".concat(t,"' stream ").concat(i," received:"),B),D.a_(B)}}),F(l,Ks.STAT_EVENT,C=>{C.stat===pr.PROXY?k(pt,"RPC '".concat(t,"' stream ").concat(i," detected buffering proxy")):C.stat===pr.NOPROXY&&k(pt,"RPC '".concat(t,"' stream ").concat(i," detected no buffering proxy"))}),setTimeout(()=>{D.o_()},0),D}terminate(){this.u_.forEach(t=>t.close()),this.u_=[]}T_(t){this.u_.push(t)}I_(t){this.u_=this.u_.filter(e=>e===t)}};function Js(){return typeof document<"u"?document:null}function cs(n){return new xi(n,!0)}var jr=class{constructor(t,e,r=1e3,i=1.5,o=6e4){this.Fi=t,this.timerId=e,this.d_=r,this.E_=i,this.A_=o,this.R_=0,this.V_=null,this.m_=Date.now(),this.reset()}reset(){this.R_=0}f_(){this.R_=this.A_}g_(t){this.cancel();let e=Math.floor(this.R_+this.p_()),r=Math.max(0,Date.now()-this.m_),i=Math.max(0,e-r);i>0&&k("ExponentialBackoff","Backing off for ".concat(i," ms (base delay: ").concat(this.R_," ms, delay with jitter: ").concat(e," ms, last attempt: ").concat(r," ms ago)")),this.V_=this.Fi.enqueueAfterDelay(this.timerId,i,()=>(this.m_=Date.now(),t())),this.R_*=this.E_,this.R_<this.d_&&(this.R_=this.d_),this.R_>this.A_&&(this.R_=this.A_)}y_(){this.V_!==null&&(this.V_.skipDelay(),this.V_=null)}cancel(){this.V_!==null&&(this.V_.cancel(),this.V_=null)}p_(){return(Math.random()-.5)*this.R_}};var Pc="PersistentStream",$r=class{constructor(t,e,r,i,o,u,l,h){this.Fi=t,this.w_=r,this.S_=i,this.connection=o,this.authCredentialsProvider=u,this.appCheckCredentialsProvider=l,this.listener=h,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new jr(t,e)}M_(){return this.state===1||this.state===5||this.x_()}x_(){return this.state===2||this.state===3}start(){this.C_=0,this.state!==4?this.auth():this.O_()}stop(){return N(this,null,function*(){this.M_()&&(yield this.close(0))})}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&this.D_===null&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,()=>this.L_()))}k_(t){this.q_(),this.stream.send(t)}L_(){return N(this,null,function*(){if(this.x_())return this.close(0)})}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}close(t,e){return N(this,null,function*(){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,t!==4?this.F_.reset():e&&e.code===b.RESOURCE_EXHAUSTED?(Gt(e.toString()),Gt("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):e&&e.code===b.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.U_(),this.stream.close(),this.stream=null),this.state=t,yield this.listener.n_(e)})}U_(){}auth(){this.state=1;let t=this.K_(this.b_),e=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.b_===e&&this.W_(r,i)},r=>{t(()=>{let i=new x(b.UNKNOWN,"Fetching auth token failed: "+r.message);return this.G_(i)})})}W_(t,e){let r=this.K_(this.b_);this.stream=this.z_(t,e),this.stream.Zo(()=>{r(()=>this.listener.Zo())}),this.stream.e_(()=>{r(()=>(this.state=2,this.v_=this.Fi.enqueueAfterDelay(this.S_,1e4,()=>(this.x_()&&(this.state=3),Promise.resolve())),this.listener.e_()))}),this.stream.n_(i=>{r(()=>this.G_(i))}),this.stream.onMessage(i=>{r(()=>++this.C_==1?this.j_(i):this.onNext(i))})}O_(){this.state=5,this.F_.g_(()=>N(this,null,function*(){this.state=0,this.start()}))}G_(t){return k(Pc,"close with error: ".concat(t)),this.stream=null,this.close(4,t)}K_(t){return e=>{this.Fi.enqueueAndForget(()=>this.b_===t?e():(k(Pc,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}},fo=class extends $r{constructor(t,e,r,i,o,u){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,r,i,u),this.serializer=o}z_(t,e){return this.connection.P_("Listen",t,e)}j_(t){return this.onNext(t)}onNext(t){this.F_.reset();let e=hf(this.serializer,t),r=(function(o){if(!("targetChange"in o))return q.min();let u=o.targetChange;return u.targetIds&&u.targetIds.length?q.min():u.readTime?Mt(u.readTime):q.min()})(t);return this.listener.J_(e,r)}H_(t){let e={};e.database=Oi(this.serializer),e.addTarget=(function(o,u){let l,h=u.target;if(l=Ii(h)?{documents:mf(o,h)}:{query:gf(o,h).Vt},l.targetId=u.targetId,u.resumeToken.approximateByteSize()>0){l.resumeToken=Ol(o,u.resumeToken);let f=Ni(o,u.expectedCount);f!==null&&(l.expectedCount=f)}else if(u.snapshotVersion.compareTo(q.min())>0){l.readTime=Or(o,u.snapshotVersion.toTimestamp());let f=Ni(o,u.expectedCount);f!==null&&(l.expectedCount=f)}return l})(this.serializer,t);let r=yf(this.serializer,t);r&&(e.labels=r),this.k_(e)}Y_(t){let e={};e.database=Oi(this.serializer),e.removeTarget=t,this.k_(e)}},mo=class extends $r{constructor(t,e,r,i,o,u){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,r,i,u),this.serializer=o}get Z_(){return this.C_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.Z_&&this.X_([])}z_(t,e){return this.connection.P_("Write",t,e)}j_(t){return Q(!!t.streamToken,31322),this.lastStreamToken=t.streamToken,Q(!t.writeResults||t.writeResults.length===0,55816),this.listener.ea()}onNext(t){Q(!!t.streamToken,12678),this.lastStreamToken=t.streamToken,this.F_.reset();let e=ff(t.writeResults,t.commitTime),r=Mt(t.commitTime);return this.listener.ta(r,e)}na(){let t={};t.database=Oi(this.serializer),this.k_(t)}X_(t){let e={streamToken:this.lastStreamToken,writes:t.map(r=>df(this.serializer,r))};this.k_(e)}};var go=class{},po=class extends go{constructor(t,e,r,i){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=r,this.serializer=i,this.ra=!1}ia(){if(this.ra)throw new x(b.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(t,e,r,i){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,u])=>this.connection.Wo(t,ki(e,r),i,o,u)).catch(o=>{throw o.name==="FirebaseError"?(o.code===b.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new x(b.UNKNOWN,o.toString())})}Jo(t,e,r,i,o){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([u,l])=>this.connection.Jo(t,ki(e,r),i,u,l,o)).catch(u=>{throw u.name==="FirebaseError"?(u.code===b.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),u):new x(b.UNKNOWN,u.toString())})}terminate(){this.ra=!0,this.connection.terminate()}},yo=class{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.sa=0,this.oa=null,this._a=!0}aa(){this.sa===0&&(this.ua("Unknown"),this.oa=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.oa=null,this.ca("Backend didn't respond within 10 seconds."),this.ua("Offline"),Promise.resolve())))}la(t){this.state==="Online"?this.ua("Unknown"):(this.sa++,this.sa>=1&&(this.ha(),this.ca("Connection failed 1 times. Most recent error: ".concat(t.toString())),this.ua("Offline")))}set(t){this.ha(),this.sa=0,t==="Online"&&(this._a=!1),this.ua(t)}ua(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}ca(t){let e="Could not reach Cloud Firestore backend. ".concat(t,"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.");this._a?(Gt(e),this._a=!1):k("OnlineStateTracker",e)}ha(){this.oa!==null&&(this.oa.cancel(),this.oa=null)}};var Re="RemoteStore",_o=class{constructor(t,e,r,i,o){this.localStore=t,this.datastore=e,this.asyncQueue=r,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=o,this.Ea.xo(u=>{r.enqueueAndForget(()=>N(this,null,function*(){he(this)&&(k(Re,"Restarting streams for network reachability change."),yield(function(h){return N(this,null,function*(){let f=L(h);f.Ia.add(4),yield Gn(f),f.Aa.set("Unknown"),f.Ia.delete(4),yield ls(f)})})(this))}))}),this.Aa=new yo(r,i)}};function ls(n){return N(this,null,function*(){if(he(n))for(let t of n.da)yield t(!0)})}function Gn(n){return N(this,null,function*(){for(let t of n.da)yield t(!1)})}function Kl(n,t){let e=L(n);e.Ta.has(t.targetId)||(e.Ta.set(t.targetId,t),sa(e)?ra(e):rn(e).x_()&&na(e,t))}function ea(n,t){let e=L(n),r=rn(e);e.Ta.delete(t),r.x_()&&Ql(e,t),e.Ta.size===0&&(r.x_()?r.B_():he(e)&&e.Aa.set("Unknown"))}function na(n,t){if(n.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(q.min())>0){let e=n.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(e)}rn(n).H_(t)}function Ql(n,t){n.Ra.$e(t),rn(n).Y_(t)}function ra(n){n.Ra=new Di({getRemoteKeysForTarget:t=>n.remoteSyncer.getRemoteKeysForTarget(t),Et:t=>n.Ta.get(t)||null,lt:()=>n.datastore.serializer.databaseId}),rn(n).start(),n.Aa.aa()}function sa(n){return he(n)&&!rn(n).M_()&&n.Ta.size>0}function he(n){return L(n).Ia.size===0}function Wl(n){n.Ra=void 0}function kf(n){return N(this,null,function*(){n.Aa.set("Online")})}function Ff(n){return N(this,null,function*(){n.Ta.forEach((t,e)=>{na(n,t)})})}function Of(n,t){return N(this,null,function*(){Wl(n),sa(n)?(n.Aa.la(t),ra(n)):n.Aa.set("Unknown")})}function Mf(n,t,e){return N(this,null,function*(){if(n.Aa.set("Online"),t instanceof kr&&t.state===2&&t.cause)try{yield(function(i,o){return N(this,null,function*(){let u=o.cause;for(let l of o.targetIds)i.Ta.has(l)&&(yield i.remoteSyncer.rejectListen(l,u),i.Ta.delete(l),i.Ra.removeTarget(l))})})(n,t)}catch(r){k(Re,"Failed to remove targets %s: %s ",t.targetIds.join(","),r),yield zr(n,r)}else if(t instanceof Ue?n.Ra.Ye(t):t instanceof Nr?n.Ra.it(t):n.Ra.et(t),!e.isEqual(q.min()))try{let r=yield Gl(n.localStore);e.compareTo(r)>=0&&(yield(function(o,u){let l=o.Ra.Pt(u);return l.targetChanges.forEach((h,f)=>{if(h.resumeToken.approximateByteSize()>0){let g=o.Ta.get(f);g&&o.Ta.set(f,g.withResumeToken(h.resumeToken,u))}}),l.targetMismatches.forEach((h,f)=>{let g=o.Ta.get(h);if(!g)return;o.Ta.set(h,g.withResumeToken(yt.EMPTY_BYTE_STRING,g.snapshotVersion)),Ql(o,h);let w=new Ln(g.target,h,f,g.sequenceNumber);na(o,w)}),o.remoteSyncer.applyRemoteEvent(l)})(n,e))}catch(r){k(Re,"Failed to raise snapshot:",r),yield zr(n,r)}})}function zr(n,t,e){return N(this,null,function*(){if(!nn(t))throw t;n.Ia.add(1),yield Gn(n),n.Aa.set("Offline"),e||(e=()=>Gl(n.localStore)),n.asyncQueue.enqueueRetryable(()=>N(null,null,function*(){k(Re,"Retrying IndexedDB access"),yield e(),n.Ia.delete(1),yield ls(n)}))})}function Hl(n,t){return t().catch(e=>zr(n,e,t))}function hs(n){return N(this,null,function*(){let t=L(n),e=ue(t),r=t.Pa.length>0?t.Pa[t.Pa.length-1].batchId:ss;for(;Lf(t);)try{let i=yield Cf(t.localStore,r);if(i===null){t.Pa.length===0&&e.B_();break}r=i.batchId,qf(t,i)}catch(i){yield zr(t,i)}Xl(t)&&Jl(t)})}function Lf(n){return he(n)&&n.Pa.length<10}function qf(n,t){n.Pa.push(t);let e=ue(n);e.x_()&&e.Z_&&e.X_(t.mutations)}function Xl(n){return he(n)&&!ue(n).M_()&&n.Pa.length>0}function Jl(n){ue(n).start()}function Uf(n){return N(this,null,function*(){ue(n).na()})}function Bf(n){return N(this,null,function*(){let t=ue(n);for(let e of n.Pa)t.X_(e.mutations)})}function jf(n,t,e){return N(this,null,function*(){let r=n.Pa.shift(),i=Ri.from(r,t,e);yield Hl(n,()=>n.remoteSyncer.applySuccessfulWrite(i)),yield hs(n)})}function $f(n,t){return N(this,null,function*(){t&&ue(n).Z_&&(yield(function(r,i){return N(this,null,function*(){if((function(u){return rf(u)&&u!==b.ABORTED})(i.code)){let o=r.Pa.shift();ue(r).N_(),yield Hl(r,()=>r.remoteSyncer.rejectFailedWrite(o.batchId,i)),yield hs(r)}})})(n,t)),Xl(n)&&Jl(n)})}function Vc(n,t){return N(this,null,function*(){let e=L(n);e.asyncQueue.verifyOperationInProgress(),k(Re,"RemoteStore received new credentials");let r=he(e);e.Ia.add(3),yield Gn(e),r&&e.Aa.set("Unknown"),yield e.remoteSyncer.handleCredentialChange(t),e.Ia.delete(3),yield ls(e)})}function zf(n,t){return N(this,null,function*(){let e=L(n);t?(e.Ia.delete(2),yield ls(e)):t||(e.Ia.add(2),yield Gn(e),e.Aa.set("Unknown"))})}function rn(n){return n.Va||(n.Va=(function(e,r,i){let o=L(e);return o.ia(),new fo(r,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(n.datastore,n.asyncQueue,{Zo:kf.bind(null,n),e_:Ff.bind(null,n),n_:Of.bind(null,n),J_:Mf.bind(null,n)}),n.da.push(t=>N(null,null,function*(){t?(n.Va.N_(),sa(n)?ra(n):n.Aa.set("Unknown")):(yield n.Va.stop(),Wl(n))}))),n.Va}function ue(n){return n.ma||(n.ma=(function(e,r,i){let o=L(e);return o.ia(),new mo(r,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(n.datastore,n.asyncQueue,{Zo:()=>Promise.resolve(),e_:Uf.bind(null,n),n_:$f.bind(null,n),ea:Bf.bind(null,n),ta:jf.bind(null,n)}),n.da.push(t=>N(null,null,function*(){t?(n.ma.N_(),yield hs(n)):(yield n.ma.stop(),n.Pa.length>0&&(k(Re,"Stopping write stream with ".concat(n.Pa.length," pending writes")),n.Pa=[]))}))),n.ma}var wo=class n{constructor(t,e,r,i,o){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=r,this.op=i,this.removalCallback=o,this.deferred=new kt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(u=>{})}get promise(){return this.deferred.promise}static createAndSchedule(t,e,r,i,o){let u=Date.now()+r,l=new n(t,e,u,i,o);return l.start(r),l}start(t){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new x(b.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(t=>this.deferred.resolve(t))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function ds(n,t){if(Gt("AsyncQueue","".concat(t,": ").concat(n)),nn(n))return new x(b.UNAVAILABLE,"".concat(t,": ").concat(n));throw n}var Gr=class n{static emptySet(t){return new n(t.comparator)}constructor(t){this.comparator=t?(e,r)=>t(e,r)||O.comparator(e.key,r.key):(e,r)=>O.comparator(e.key,r.key),this.keyedMap=Rn(),this.sortedSet=new et(this.comparator)}has(t){return this.keyedMap.get(t)!=null}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){let e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal((e,r)=>(t(e),!1))}add(t){let e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){let e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof n)||this.size!==t.size)return!1;let e=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();for(;e.hasNext();){let i=e.getNext().key,o=r.getNext().key;if(!i.isEqual(o))return!1}return!0}toString(){let t=[];return this.forEach(e=>{t.push(e.toString())}),t.length===0?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){let r=new n;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=e,r}};var Kr=class{constructor(){this.fa=new et(O.comparator)}track(t){let e=t.doc.key,r=this.fa.get(e);r?t.type!==0&&r.type===3?this.fa=this.fa.insert(e,t):t.type===3&&r.type!==1?this.fa=this.fa.insert(e,{type:r.type,doc:t.doc}):t.type===2&&r.type===2?this.fa=this.fa.insert(e,{type:2,doc:t.doc}):t.type===2&&r.type===0?this.fa=this.fa.insert(e,{type:0,doc:t.doc}):t.type===1&&r.type===0?this.fa=this.fa.remove(e):t.type===1&&r.type===2?this.fa=this.fa.insert(e,{type:1,doc:r.doc}):t.type===0&&r.type===1?this.fa=this.fa.insert(e,{type:2,doc:t.doc}):M(63341,{At:t,ga:r}):this.fa=this.fa.insert(e,t)}pa(){let t=[];return this.fa.inorderTraversal((e,r)=>{t.push(r)}),t}},Ye=class n{constructor(t,e,r,i,o,u,l,h,f){this.query=t,this.docs=e,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=o,this.fromCache=u,this.syncStateChanged=l,this.excludesMetadataChanges=h,this.hasCachedResults=f}static fromInitialDocuments(t,e,r,i,o){let u=[];return e.forEach(l=>{u.push({type:0,doc:l})}),new n(t,e,Gr.emptySet(e),u,r,i,!0,!1,o)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&as(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;let e=this.docChanges,r=t.docChanges;if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(e[i].type!==r[i].type||!e[i].doc.isEqual(r[i].doc))return!1;return!0}};var vo=class{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(t=>t.ba())}},Io=class{constructor(){this.queries=Cc(),this.onlineState="Unknown",this.Da=new Set}terminate(){(function(e,r){let i=L(e),o=i.queries;i.queries=Cc(),o.forEach((u,l)=>{for(let h of l.wa)h.onError(r)})})(this,new x(b.ABORTED,"Firestore shutting down"))}};function Cc(){return new Ht(n=>Tl(n),as)}function Gf(n,t){return N(this,null,function*(){let e=L(n),r=3,i=t.query,o=e.queries.get(i);o?!o.Sa()&&t.ba()&&(r=2):(o=new vo,r=t.ba()?0:1);try{switch(r){case 0:o.ya=yield e.onListen(i,!0);break;case 1:o.ya=yield e.onListen(i,!1);break;case 2:yield e.onFirstRemoteStoreListen(i)}}catch(u){let l=ds(u,"Initialization of query '".concat(Oe(t.query),"' failed"));return void t.onError(l)}e.queries.set(i,o),o.wa.push(t),t.va(e.onlineState),o.ya&&t.Ca(o.ya)&&ia(e)})}function Kf(n,t){return N(this,null,function*(){let e=L(n),r=t.query,i=3,o=e.queries.get(r);if(o){let u=o.wa.indexOf(t);u>=0&&(o.wa.splice(u,1),o.wa.length===0?i=t.ba()?0:1:!o.Sa()&&t.ba()&&(i=2))}switch(i){case 0:return e.queries.delete(r),e.onUnlisten(r,!0);case 1:return e.queries.delete(r),e.onUnlisten(r,!1);case 2:return e.onLastRemoteStoreUnlisten(r);default:return}})}function Qf(n,t){let e=L(n),r=!1;for(let i of t){let o=i.query,u=e.queries.get(o);if(u){for(let l of u.wa)l.Ca(i)&&(r=!0);u.ya=i}}r&&ia(e)}function Wf(n,t,e){let r=L(n),i=r.queries.get(t);if(i)for(let o of i.wa)o.onError(e);r.queries.delete(t)}function ia(n){n.Da.forEach(t=>{t.next()})}var To,Dc;(Dc=To||(To={})).Fa="default",Dc.Cache="cache";var Eo=class{constructor(t,e,r){this.query=t,this.Ma=e,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=r||{}}Ca(t){if(!this.options.includeMetadataChanges){let r=[];for(let i of t.docChanges)i.type!==3&&r.push(i);t=new Ye(t.query,t.docs,t.oldDocs,r,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.xa?this.Na(t)&&(this.Ma.next(t),e=!0):this.Ba(t,this.onlineState)&&(this.La(t),e=!0),this.Oa=t,e}onError(t){this.Ma.error(t)}va(t){this.onlineState=t;let e=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,t)&&(this.La(this.Oa),e=!0),e}Ba(t,e){if(!t.fromCache||!this.ba())return!0;let r=e!=="Offline";return(!this.options.ka||!r)&&(!t.docs.isEmpty()||t.hasCachedResults||e==="Offline")}Na(t){if(t.docChanges.length>0)return!0;let e=this.Oa&&this.Oa.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&this.options.includeMetadataChanges===!0}La(t){t=Ye.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.xa=!0,this.Ma.next(t)}ba(){return this.options.source!==To.Cache}};var Qr=class{constructor(t){this.key=t}},Wr=class{constructor(t){this.key=t}},Ao=class{constructor(t,e){this.query=t,this.Ha=e,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=j(),this.mutatedKeys=j(),this.Xa=El(t),this.eu=new Gr(this.Xa)}get tu(){return this.Ha}nu(t,e){let r=e?e.ru:new Kr,i=e?e.eu:this.eu,o=e?e.mutatedKeys:this.mutatedKeys,u=i,l=!1,h=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,f=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(t.inorderTraversal((g,w)=>{let S=i.get(g),P=us(this.query,w)?w:null,D=!!S&&this.mutatedKeys.has(S.key),F=!!P&&(P.hasLocalMutations||this.mutatedKeys.has(P.key)&&P.hasCommittedMutations),C=!1;S&&P?S.data.isEqual(P.data)?D!==F&&(r.track({type:3,doc:P}),C=!0):this.iu(S,P)||(r.track({type:2,doc:P}),C=!0,(h&&this.Xa(P,h)>0||f&&this.Xa(P,f)<0)&&(l=!0)):!S&&P?(r.track({type:0,doc:P}),C=!0):S&&!P&&(r.track({type:1,doc:S}),C=!0,(h||f)&&(l=!0)),C&&(P?(u=u.add(P),o=F?o.add(g):o.delete(g)):(u=u.delete(g),o=o.delete(g)))}),this.query.limit!==null)for(;u.size>this.query.limit;){let g=this.query.limitType==="F"?u.last():u.first();u=u.delete(g.key),o=o.delete(g.key),r.track({type:1,doc:g})}return{eu:u,ru:r,Ds:l,mutatedKeys:o}}iu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,r,i){let o=this.eu;this.eu=t.eu,this.mutatedKeys=t.mutatedKeys;let u=t.ru.pa();u.sort((g,w)=>(function(P,D){let F=C=>{switch(C){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return M(20277,{At:C})}};return F(P)-F(D)})(g.type,w.type)||this.Xa(g.doc,w.doc)),this.su(r),i=i!=null&&i;let l=e&&!i?this.ou():[],h=this.Za.size===0&&this.current&&!i?1:0,f=h!==this.Ya;return this.Ya=h,u.length!==0||f?{snapshot:new Ye(this.query,t.eu,o,u,t.mutatedKeys,h===0,f,!1,!!r&&r.resumeToken.approximateByteSize()>0),_u:l}:{_u:l}}va(t){return this.current&&t==="Offline"?(this.current=!1,this.applyChanges({eu:this.eu,ru:new Kr,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(t){return!this.Ha.has(t)&&!!this.eu.has(t)&&!this.eu.get(t).hasLocalMutations}su(t){t&&(t.addedDocuments.forEach(e=>this.Ha=this.Ha.add(e)),t.modifiedDocuments.forEach(e=>{}),t.removedDocuments.forEach(e=>this.Ha=this.Ha.delete(e)),this.current=t.current)}ou(){if(!this.current)return[];let t=this.Za;this.Za=j(),this.eu.forEach(r=>{this.au(r.key)&&(this.Za=this.Za.add(r.key))});let e=[];return t.forEach(r=>{this.Za.has(r)||e.push(new Wr(r))}),this.Za.forEach(r=>{t.has(r)||e.push(new Qr(r))}),e}uu(t){this.Ha=t.qs,this.Za=j();let e=this.nu(t.documents);return this.applyChanges(e,!0)}cu(){return Ye.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,this.Ya===0,this.hasCachedResults)}},fs="SyncEngine",So=class{constructor(t,e,r){this.query=t,this.targetId=e,this.view=r}},bo=class{constructor(t){this.key=t,this.lu=!1}},Ro=class{constructor(t,e,r,i,o,u){this.localStore=t,this.remoteStore=e,this.eventManager=r,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=u,this.hu={},this.Pu=new Ht(l=>Tl(l),as),this.Tu=new Map,this.Iu=new Set,this.du=new et(O.comparator),this.Eu=new Map,this.Au=new Un,this.Ru={},this.Vu=new Map,this.mu=qn.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return this.fu===!0}};function Hf(n,t,e=!0){return N(this,null,function*(){let r=rh(n),i,o=r.Pu.get(t);return o?(r.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.cu()):i=yield Yl(r,t,e,!0),i})}function Xf(n,t){return N(this,null,function*(){let e=rh(n);yield Yl(e,t,!0,!1)})}function Yl(n,t,e,r){return N(this,null,function*(){let i=yield Df(n.localStore,Ot(t)),o=i.targetId,u=n.sharedClientState.addLocalQueryTarget(o,e),l;return r&&(l=yield Jf(n,t,o,u==="current",i.resumeToken)),n.isPrimaryClient&&e&&Kl(n.remoteStore,i),l})}function Jf(n,t,e,r,i){return N(this,null,function*(){n.gu=(w,S,P)=>(function(F,C,$,B){return N(this,null,function*(){let G=C.view.nu($);G.Ds&&(G=yield bc(F.localStore,C.query,!1).then(({documents:I})=>C.view.nu(I,G)));let Z=B&&B.targetChanges.get(C.targetId),bt=B&&B.targetMismatches.get(C.targetId)!=null,H=C.view.applyChanges(G,F.isPrimaryClient,Z,bt);return Nc(F,C.targetId,H._u),H.snapshot})})(n,w,S,P);let o=yield bc(n.localStore,t,!0),u=new Ao(t,o.qs),l=u.nu(o.documents),h=Mn.createSynthesizedTargetChangeForCurrentChange(e,r&&n.onlineState!=="Offline",i),f=u.applyChanges(l,n.isPrimaryClient,h);Nc(n,e,f._u);let g=new So(t,e,u);return n.Pu.set(t,g),n.Tu.has(e)?n.Tu.get(e).push(t):n.Tu.set(e,[t]),f.snapshot})}function Yf(n,t,e){return N(this,null,function*(){let r=L(n),i=r.Pu.get(t),o=r.Tu.get(i.targetId);if(o.length>1)return r.Tu.set(i.targetId,o.filter(u=>!as(u,t))),void r.Pu.delete(t);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||(yield io(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),e&&ea(r.remoteStore,i.targetId),Po(r,i.targetId)}).catch(en))):(Po(r,i.targetId),yield io(r.localStore,i.targetId,!0))})}function Zf(n,t){return N(this,null,function*(){let e=L(n),r=e.Pu.get(t),i=e.Tu.get(r.targetId);e.isPrimaryClient&&i.length===1&&(e.sharedClientState.removeLocalQueryTarget(r.targetId),ea(e.remoteStore,r.targetId))})}function tm(n,t,e){return N(this,null,function*(){let r=um(n);try{let i=yield(function(u,l){let h=L(u),f=at.now(),g=l.reduce((P,D)=>P.add(D.key),j()),w,S;return h.persistence.runTransaction("Locally write mutations","readwrite",P=>{let D=Xt(),F=j();return h.Os.getEntries(P,g).next(C=>{D=C,D.forEach(($,B)=>{B.isValidDocument()||(F=F.add($))})}).next(()=>h.localDocuments.getOverlayedDocuments(P,D)).next(C=>{w=C;let $=[];for(let B of l){let G=nf(B,w.get(B.key).overlayedDocument);G!=null&&$.push(new qt(B.key,G,gl(G.value.mapValue),St.exists(!0)))}return h.mutationQueue.addMutationBatch(P,f,$,l)}).next(C=>{S=C;let $=C.applyToLocalDocumentSet(w,F);return h.documentOverlayCache.saveOverlays(P,C.batchId,$)})}).then(()=>({batchId:S.batchId,changes:Sl(w)}))})(r.localStore,t);r.sharedClientState.addPendingMutation(i.batchId),(function(u,l,h){let f=u.Ru[u.currentUser.toKey()];f||(f=new et(U)),f=f.insert(l,h),u.Ru[u.currentUser.toKey()]=f})(r,i.batchId,e),yield Kn(r,i.changes),yield hs(r.remoteStore)}catch(i){let o=ds(i,"Failed to persist write");e.reject(o)}})}function Zl(n,t){return N(this,null,function*(){let e=L(n);try{let r=yield Pf(e.localStore,t);t.targetChanges.forEach((i,o)=>{let u=e.Eu.get(o);u&&(Q(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?u.lu=!0:i.modifiedDocuments.size>0?Q(u.lu,14607):i.removedDocuments.size>0&&(Q(u.lu,42227),u.lu=!1))}),yield Kn(e,r,t)}catch(r){yield en(r)}})}function xc(n,t,e){let r=L(n);if(r.isPrimaryClient&&e===0||!r.isPrimaryClient&&e===1){let i=[];r.Pu.forEach((o,u)=>{let l=u.view.va(t);l.snapshot&&i.push(l.snapshot)}),(function(u,l){let h=L(u);h.onlineState=l;let f=!1;h.queries.forEach((g,w)=>{for(let S of w.wa)S.va(l)&&(f=!0)}),f&&ia(h)})(r.eventManager,t),i.length&&r.hu.J_(i),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}function em(n,t,e){return N(this,null,function*(){let r=L(n);r.sharedClientState.updateQueryState(t,"rejected",e);let i=r.Eu.get(t),o=i&&i.key;if(o){let u=new et(O.comparator);u=u.insert(o,Ct.newNoDocument(o,q.min()));let l=j().add(o),h=new xr(q.min(),new Map,new et(U),u,l);yield Zl(r,h),r.du=r.du.remove(o),r.Eu.delete(t),oa(r)}else yield io(r.localStore,t,!1).then(()=>Po(r,t,e)).catch(en)})}function nm(n,t){return N(this,null,function*(){let e=L(n),r=t.batch.batchId;try{let i=yield Rf(e.localStore,t);eh(e,r,null),th(e,r),e.sharedClientState.updateMutationState(r,"acknowledged"),yield Kn(e,i)}catch(i){yield en(i)}})}function rm(n,t,e){return N(this,null,function*(){let r=L(n);try{let i=yield(function(u,l){let h=L(u);return h.persistence.runTransaction("Reject batch","readwrite-primary",f=>{let g;return h.mutationQueue.lookupMutationBatch(f,l).next(w=>(Q(w!==null,37113),g=w.keys(),h.mutationQueue.removeMutationBatch(f,w))).next(()=>h.mutationQueue.performConsistencyCheck(f)).next(()=>h.documentOverlayCache.removeOverlaysForBatchId(f,g,l)).next(()=>h.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(f,g)).next(()=>h.localDocuments.getDocuments(f,g))})})(r.localStore,t);eh(r,t,e),th(r,t),r.sharedClientState.updateMutationState(t,"rejected",e),yield Kn(r,i)}catch(i){yield en(i)}})}function sm(n,t){return N(this,null,function*(){let e=L(n);he(e.remoteStore)||k(fs,"The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");try{let r=yield(function(u){let l=L(u);return l.persistence.runTransaction("Get highest unacknowledged batch id","readonly",h=>l.mutationQueue.getHighestUnacknowledgedBatchId(h))})(e.localStore);if(r===ss)return void t.resolve();let i=e.Vu.get(r)||[];i.push(t),e.Vu.set(r,i)}catch(r){let i=ds(r,"Initialization of waitForPendingWrites() operation failed");t.reject(i)}})}function th(n,t){(n.Vu.get(t)||[]).forEach(e=>{e.resolve()}),n.Vu.delete(t)}function eh(n,t,e){let r=L(n),i=r.Ru[r.currentUser.toKey()];if(i){let o=i.get(t);o&&(e?o.reject(e):o.resolve(),i=i.remove(t)),r.Ru[r.currentUser.toKey()]=i}}function Po(n,t,e=null){n.sharedClientState.removeLocalQueryTarget(t);for(let r of n.Tu.get(t))n.Pu.delete(r),e&&n.hu.pu(r,e);n.Tu.delete(t),n.isPrimaryClient&&n.Au.zr(t).forEach(r=>{n.Au.containsKey(r)||nh(n,r)})}function nh(n,t){n.Iu.delete(t.path.canonicalString());let e=n.du.get(t);e!==null&&(ea(n.remoteStore,e),n.du=n.du.remove(t),n.Eu.delete(e),oa(n))}function Nc(n,t,e){for(let r of e)r instanceof Qr?(n.Au.addReference(r.key,t),im(n,r)):r instanceof Wr?(k(fs,"Document no longer in limbo: "+r.key),n.Au.removeReference(r.key,t),n.Au.containsKey(r.key)||nh(n,r.key)):M(19791,{yu:r})}function im(n,t){let e=t.key,r=e.path.canonicalString();n.du.get(e)||n.Iu.has(r)||(k(fs,"New document in limbo: "+e),n.Iu.add(r),oa(n))}function oa(n){for(;n.Iu.size>0&&n.du.size<n.maxConcurrentLimboResolutions;){let t=n.Iu.values().next().value;n.Iu.delete(t);let e=new O(J.fromString(t)),r=n.mu.next();n.Eu.set(r,new bo(e)),n.du=n.du.insert(e,r),Kl(n.remoteStore,new Ln(Ot(Jo(e.path)),r,"TargetPurposeLimboResolution",zo.ue))}}function Kn(n,t,e){return N(this,null,function*(){let r=L(n),i=[],o=[],u=[];r.Pu.isEmpty()||(r.Pu.forEach((l,h)=>{u.push(r.gu(h,t,e).then(f=>{var g;if((f||e)&&r.isPrimaryClient){let w=f?!f.fromCache:(g=e==null?void 0:e.targetChanges.get(h.targetId))===null||g===void 0?void 0:g.current;r.sharedClientState.updateQueryState(h.targetId,w?"current":"not-current")}if(f){i.push(f);let w=eo.Es(h.targetId,f);o.push(w)}}))}),yield Promise.all(u),r.hu.J_(i),yield(function(h,f){return N(this,null,function*(){let g=L(h);try{yield g.persistence.runTransaction("notifyLocalViewChanges","readwrite",w=>R.forEach(f,S=>R.forEach(S.Is,P=>g.persistence.referenceDelegate.addReference(w,S.targetId,P)).next(()=>R.forEach(S.ds,P=>g.persistence.referenceDelegate.removeReference(w,S.targetId,P)))))}catch(w){if(!nn(w))throw w;k(ta,"Failed to update sequence numbers: "+w)}for(let w of f){let S=w.targetId;if(!w.fromCache){let P=g.Fs.get(S),D=P.snapshotVersion,F=P.withLastLimboFreeSnapshotVersion(D);g.Fs=g.Fs.insert(S,F)}}})})(r.localStore,o))})}function om(n,t){return N(this,null,function*(){let e=L(n);if(!e.currentUser.isEqual(t)){k(fs,"User change. New user:",t.toKey());let r=yield zl(e.localStore,t);e.currentUser=t,(function(o,u){o.Vu.forEach(l=>{l.forEach(h=>{h.reject(new x(b.CANCELLED,u))})}),o.Vu.clear()})(e,"'waitForPendingWrites' promise is rejected due to a user change."),e.sharedClientState.handleUserChange(t,r.removedBatchIds,r.addedBatchIds),yield Kn(e,r.Bs)}})}function am(n,t){let e=L(n),r=e.Eu.get(t);if(r&&r.lu)return j().add(r.key);{let i=j(),o=e.Tu.get(t);if(!o)return i;for(let u of o){let l=e.Pu.get(u);i=i.unionWith(l.view.tu)}return i}}function rh(n){let t=L(n);return t.remoteStore.remoteSyncer.applyRemoteEvent=Zl.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=am.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=em.bind(null,t),t.hu.J_=Qf.bind(null,t.eventManager),t.hu.pu=Wf.bind(null,t.eventManager),t}function um(n){let t=L(n);return t.remoteStore.remoteSyncer.applySuccessfulWrite=nm.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=rm.bind(null,t),t}var sh=(()=>{class n{constructor(){this.kind="memory",this.synchronizeTabs=!1}initialize(e){return N(this,null,function*(){this.serializer=cs(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Du(e),yield this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Cu(e,this.localStore),this.indexBackfillerScheduler=this.Fu(e,this.localStore)})}Cu(e,r){return null}Fu(e,r){return null}vu(e){return bf(this.persistence,new ro,e.initialUser,this.serializer)}Du(e){return new Lr(to.Vi,this.serializer)}bu(e){return new oo}terminate(){return N(this,null,function*(){var e,r;(e=this.gcScheduler)===null||e===void 0||e.stop(),(r=this.indexBackfillerScheduler)===null||r===void 0||r.stop(),this.sharedClientState.shutdown(),yield this.persistence.shutdown()})}}return n.provider={build:()=>new n},n})(),Vo=class extends sh{constructor(t){super(),this.cacheSizeBytes=t}Cu(t,e){Q(this.persistence.referenceDelegate instanceof qr,46915);let r=this.persistence.referenceDelegate.garbageCollector;return new Bi(r,t.asyncQueue,e)}Du(t){let e=this.cacheSizeBytes!==void 0?Rt.withCacheSize(this.cacheSizeBytes):Rt.DEFAULT;return new Lr(r=>qr.Vi(r,e),this.serializer)}};var cm=(()=>{class n{initialize(e,r){return N(this,null,function*(){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(r),this.remoteStore=this.createRemoteStore(r),this.eventManager=this.createEventManager(r),this.syncEngine=this.createSyncEngine(r,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=i=>xc(this.syncEngine,i,1),this.remoteStore.remoteSyncer.handleCredentialChange=om.bind(null,this.syncEngine),yield zf(this.remoteStore,this.syncEngine.isPrimaryClient))})}createEventManager(e){return(function(){return new Io})()}createDatastore(e){let r=cs(e.databaseInfo.databaseId),i=(function(u){return new ho(u)})(e.databaseInfo);return(function(u,l,h,f){return new po(u,l,h,f)})(e.authCredentials,e.appCheckCredentials,i,r)}createRemoteStore(e){return(function(i,o,u,l,h){return new _o(i,o,u,l,h)})(this.localStore,this.datastore,e.asyncQueue,r=>xc(this.syncEngine,r,0),(function(){return Br.C()?new Br:new ao})())}createSyncEngine(e,r){return(function(o,u,l,h,f,g,w){let S=new Ro(o,u,l,h,f,g);return w&&(S.fu=!0),S})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,r)}terminate(){return N(this,null,function*(){var e,r;yield(function(o){return N(this,null,function*(){let u=L(o);k(Re,"RemoteStore shutting down."),u.Ia.add(5),yield Gn(u),u.Ea.shutdown(),u.Aa.set("Unknown")})})(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(r=this.eventManager)===null||r===void 0||r.terminate()})}}return n.provider={build:()=>new n},n})();var Co=class{constructor(t){this.observer=t,this.muted=!1}next(t){this.muted||this.observer.next&&this.xu(this.observer.next,t)}error(t){this.muted||(this.observer.error?this.xu(this.observer.error,t):Gt("Uncaught Error in snapshot listener:",t.toString()))}Ou(){this.muted=!0}xu(t,e){setTimeout(()=>{this.muted||t(e)},0)}};var ce="FirestoreClient",Do=class{constructor(t,e,r,i,o){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=r,this.databaseInfo=i,this.user=ut.UNAUTHENTICATED,this.clientId=xn.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=o,this.authCredentials.start(r,u=>N(this,null,function*(){k(ce,"Received user=",u.uid),yield this.authCredentialListener(u),this.user=u})),this.appCheckCredentials.start(r,u=>(k(ce,"Received new app check token=",u),this.appCheckCredentialListener(u,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}terminate(){this.asyncQueue.enterRestrictedMode();let t=new kt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(()=>N(this,null,function*(){try{this._onlineComponents&&(yield this._onlineComponents.terminate()),this._offlineComponents&&(yield this._offlineComponents.terminate()),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){let r=ds(e,"Failed to shutdown persistence");t.reject(r)}})),t.promise}};function Ys(n,t){return N(this,null,function*(){n.asyncQueue.verifyOperationInProgress(),k(ce,"Initializing OfflineComponentProvider");let e=n.configuration;yield t.initialize(e);let r=e.initialUser;n.setCredentialChangeListener(i=>N(null,null,function*(){r.isEqual(i)||(yield zl(t.localStore,i),r=i)})),t.persistence.setDatabaseDeletedListener(()=>{oe("Terminating Firestore due to IndexedDb database deletion"),n.terminate().then(()=>{k("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(i=>{oe("Terminating Firestore due to IndexedDb database deletion failed",i)})}),n._offlineComponents=t})}function kc(n,t){return N(this,null,function*(){n.asyncQueue.verifyOperationInProgress();let e=yield lm(n);k(ce,"Initializing OnlineComponentProvider"),yield t.initialize(e,n.configuration),n.setCredentialChangeListener(r=>Vc(t.remoteStore,r)),n.setAppCheckTokenChangeListener((r,i)=>Vc(t.remoteStore,i)),n._onlineComponents=t})}function lm(n){return N(this,null,function*(){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){k(ce,"Using user provided OfflineComponentProvider");try{yield Ys(n,n._uninitializedComponentsProvider._offline)}catch(t){let e=t;if(!(function(i){return i.name==="FirebaseError"?i.code===b.FAILED_PRECONDITION||i.code===b.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11})(e))throw e;oe("Error using user provided cache. Falling back to memory cache: "+e),yield Ys(n,new sh)}}else k(ce,"Using default OfflineComponentProvider"),yield Ys(n,new Vo(void 0));return n._offlineComponents})}function ih(n){return N(this,null,function*(){return n._onlineComponents||(n._uninitializedComponentsProvider?(k(ce,"Using user provided OnlineComponentProvider"),yield kc(n,n._uninitializedComponentsProvider._online)):(k(ce,"Using default OnlineComponentProvider"),yield kc(n,new cm))),n._onlineComponents})}function oh(n){return ih(n).then(t=>t.syncEngine)}function Fc(n){return N(this,null,function*(){let t=yield ih(n),e=t.eventManager;return e.onListen=Hf.bind(null,t.syncEngine),e.onUnlisten=Yf.bind(null,t.syncEngine),e.onFirstRemoteStoreListen=Xf.bind(null,t.syncEngine),e.onLastRemoteStoreUnlisten=Zf.bind(null,t.syncEngine),e})}function ah(n){let t={};return n.timeoutSeconds!==void 0&&(t.timeoutSeconds=n.timeoutSeconds),t}var Oc=new Map;var uh="firestore.googleapis.com",Mc=!0,Hr=class{constructor(t){var e,r;if(t.host===void 0){if(t.ssl!==void 0)throw new x(b.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=uh,this.ssl=Mc}else this.host=t.host,this.ssl=(e=t.ssl)!==null&&e!==void 0?e:Mc;if(this.isUsingEmulator=t.emulatorOptions!==void 0,this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,this.localCache=t.localCache,t.cacheSizeBytes===void 0)this.cacheSizeBytes=$l;else{if(t.cacheSizeBytes!==-1&&t.cacheSizeBytes<Ef)throw new x(b.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}Id("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:t.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=ah((r=t.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}
1),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new x(b.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(o.timeoutSeconds," (must not be NaN)"));if(o.timeoutSeconds<5)throw new x(b.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(o.timeoutSeconds," (minimum allowed value is 5)"));if(o.timeoutSeconds>30)throw new x(b.INVALID_ARGUMENT,"invalid long polling timeout: ".concat(o.timeoutSeconds," (maximum allowed value is 30)"))}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!t.useFetchStreams}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&(function(r,i){return r.timeoutSeconds===i.timeoutSeconds})(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}},Pe=class{constructor(t,e,r,i){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Hr({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new x(b.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(t){if(this._settingsFrozen)throw new x(b.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Hr(t),this._emulatorOptions=t.emulatorOptions||{},t.credentials!==void 0&&(this._authCredentials=(function(r){if(!r)return new ti;switch(r.type){case"firstParty":return new si(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new x(b.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}})(t.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}_restart(){return N(this,null,function*(){this._terminateTask==="notTerminated"?yield this._terminate():this._terminateTask="notTerminated"})}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(e){let r=Oc.get(e);r&&(k("ComponentProvider","Removing Datastore"),Oc.delete(e),r.terminate())})(this),Promise.resolve()}};function aa(n,t,e,r={}){var i;n=At(n,Pe);let o=js(t),u=n._getSettings(),l=Object.assign(Object.assign({},u),{emulatorOptions:n._getEmulatorOptions()}),h="".concat(t,":").concat(e);o&&(Ou("https://".concat(h)),Lu("Firestore",!0)),u.host!==uh&&u.host!==h&&oe("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let f=Object.assign(Object.assign({},u),{host:h,ssl:o,emulatorOptions:r});if(!ju(f,l)&&(n._setSettings(f),r.mockUserToken)){let g,w;if(typeof r.mockUserToken=="string")g=r.mockUserToken,w=ut.MOCK_USER;else{g=Mu(r.mockUserToken,(i=n._app)===null||i===void 0?void 0:i.options.projectId);let S=r.mockUserToken.sub||r.mockUserToken.user_id;if(!S)throw new x(b.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");w=new ut(S)}n._authCredentials=new ei(new Er(g,w))}}var Jt=class n{constructor(t,e,r){this.converter=e,this._query=r,this.type="query",this.firestore=t}withConverter(t){return new n(this.firestore,t,this._query)}},lt=class n{constructor(t,e,r){this.converter=e,this._key=r,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}
vendor: 12,849 bytes, line 1
1get path(){return this._key.path.canonicalString()}get parent(){return new ne(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new n(this.firestore,t,this._key)}toJSON(){return{type:n._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,e,r){if(zn(e,n._jsonSchema))return new n(t,r||null,new O(J.fromString(e.referencePath)))}};lt._jsonSchemaVersion="firestore/documentReference/1.0",lt._jsonSchema={type:ot("string",lt._jsonSchemaVersion),referencePath:ot("string")};var ne=class n extends Jt{constructor(t,e,r){super(t,e,Jo(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let t=this._path.popLast();return t.isEmpty()?null:new lt(this.firestore,null,new O(t))}withConverter(t){return new n(this.firestore,t,this._path)}};function ch(n,t,...e){if(n=It(n),$o("collection","path",t),n instanceof Pe){let r=J.fromString(t,...e);return tc(r),new ne(n,null,r)}{if(!(n instanceof lt||n instanceof ne))throw new x(b.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let r=n._path.child(J.fromString(t,...e));return tc(r),new ne(n.firestore,null,r)}}function lh(n,t){if(n=At(n,Pe),$o("collectionGroup","collection id",t),t.indexOf("/")>=0)throw new x(b.INVALID_ARGUMENT,"Invalid collection ID '".concat(t,"' passed to function collectionGroup(). Collection IDs must not contain '/'."));return new Jt(n,null,(function(r){return new Wt(J.emptyPath(),r)})(t))}function ua(n,t,...e){if(n=It(n),arguments.length===1&&(t=xn.newId()),$o("doc","path",t),n instanceof Pe){let r=J.fromString(t,...e);return Zu(r),new lt(n,null,new O(r))}{if(!(n instanceof lt||n instanceof ne))throw new x(b.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let r=n._path.child(J.fromString(t,...e));return Zu(r),new lt(n.firestore,n instanceof ne?n.converter:null,new O(r))}}var Lc="AsyncQueue",Xr=class{constructor(t=Promise.resolve()){this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new jr(this,"async_queue_retry"),this.oc=()=>{let r=Js();r&&k(Lc,"Visibility state changed to "+r.visibilityState),this.F_.y_()},this._c=t;let e=Js();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.ac(),this.uc(t)}enterRestrictedMode(t){if(!this.Xu){this.Xu=!0,this.rc=t||!1;let e=Js();e&&typeof e.removeEventListener=="function"&&e.removeEventListener("visibilitychange",this.oc)}}enqueue(t){if(this.ac(),this.Xu)return new Promise(()=>{});let e=new kt;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise)).then(()=>e.promise)}enqueueRetryable(t){this.enqueueAndForget(()=>(this.Zu.push(t),this.cc()))}cc(){return N(this,null,function*(){if(this.Zu.length!==0){try{yield this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(t){if(!nn(t))throw t;k(Lc,"Operation failed with retryable error: "+t)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}})}uc(t){let e=this._c.then(()=>(this.nc=!0,t().catch(r=>{throw this.tc=r,this.nc=!1,Gt("INTERNAL UNHANDLED ERROR: ",qc(r)),r}).then(r=>(this.nc=!1,r))));return this._c=e,e}enqueueAfterDelay(t,e,r){this.ac(),this.sc.indexOf(t)>-1&&(e=0);let i=wo.createAndSchedule(this,t,e,r,o=>this.lc(o));return this.ec.push(i),i}ac(){this.tc&&M(47125,{hc:qc(this.tc)})}verifyOperationInProgress(){}Pc(){return N(this,null,function*(){let t;do t=this._c,yield t;while(t!==this._c)})}Tc(t){for(let e of this.ec)if(e.timerId===t)return!0;return!1}Ic(t){return this.Pc().then(()=>{this.ec.sort((e,r)=>e.targetTimeMs-r.targetTimeMs);for(let e of this.ec)if(e.skipDelay(),t!=="all"&&e.timerId===t)break;return this.Pc()})}dc(t){this.sc.push(t)}lc(t){let e=this.ec.indexOf(t);this.ec.splice(e,1)}};function qc(n){let t=n.message||"";return n.stack&&(t=n.stack.includes(n.message)?n.stack:n.message+"\n"+n.stack),t}function Uc(n){return(function(e,r){if(typeof e!="object"||e===null)return!1;let i=e;for(let o of r)if(o in i&&typeof i[o]=="function")return!0;return!1})(n,["next","error","complete"])}var xt=class extends Pe{constructor(t,e,r,i){super(t,e,r,i),this.type="firestore",this._queue=new Xr,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}_terminate(){return N(this,null,function*(){if(this._firestoreClient){let t=this._firestoreClient.terminate();this._queue=new Xr(t),this._firestoreClient=void 0,yield t}})}};function hh(n,t){let e=typeof n=="object"?n:Pu(),r=typeof n=="string"?n:t||Pr,i=Su(e,"firestore").getImmediate({identifier:r});if(!i._initialized){let o=Fu("firestore");o&&aa(i,...o)}return i}function ms(n){if(n._terminated)throw new x(b.FAILED_PRECONDITION,"The client has already been terminated.");return n._firestoreClient||hm(n),n._firestoreClient}function hm(n){var t,e,r;let i=n._freezeSettings(),o=(function(l,h,f,g){return new ci(l,h,f,g.host,g.ssl,g.experimentalForceLongPolling,g.experimentalAutoDetectLongPolling,ah(g.experimentalLongPollingOptions),g.useFetchStreams,g.isUsingEmulator)})(n._databaseId,((t=n._app)===null||t===void 0?void 0:t.options.appId)||"",n._persistenceKey,i);n._componentsProvider||!((e=i.localCache)===null||e===void 0)&&e._offlineComponentProvider&&(!((r=i.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(n._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),n._firestoreClient=new Do(n._authCredentials,n._appCheckCredentials,n._queue,o,n._componentsProvider&&(function(l){let h=l==null?void 0:l._online.build();return{_offline:l==null?void 0:l._offline.build(h),_online:h}})(n._componentsProvider))}function dh(n){return(function(e){let r=new kt;return e.asyncQueue.enqueueAndForget(()=>N(null,null,function*(){return sm(yield oh(e),r)})),r.promise})(ms(n=At(n,xt)))}var re=class n{constructor(t){this._byteString=t}static fromBase64String(t){try{return new n(yt.fromBase64String(t))}catch(e){throw new x(b.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(t){return new n(yt.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}toJSON(){return{type:n._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(zn(t,n._jsonSchema))return n.fromBase64String(t.bytes)}};re._jsonSchemaVersion="firestore/bytes/1.0",re._jsonSchema={type:ot("string",re._jsonSchemaVersion),bytes:ot("string")};var Ve=class{constructor(...t){for(let e=0;e<t.length;++e)if(t[e].length===0)throw new x(b.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Et(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}};var Ze=class{constructor(t){this._methodName=t}};var se=class n{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new x(b.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new x(b.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}_compareTo(t){return U(this._lat,t._lat)||U(this._long,t._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:n._jsonSchemaVersion}}static fromJSON(t){if(zn(t,n._jsonSchema))return new n(t.latitude,t.longitude)}};se._jsonSchemaVersion="firestore/geoPoint/1.0",se._jsonSchema={type:ot("string",se._jsonSchemaVersion),latitude:ot("number"),longitude:ot("number")};var ie=class n{constructor(t){this._values=(t||[]).map(e=>e)}toArray(){return this._values.map(t=>t)}isEqual(t){return(function(r,i){if(r.length!==i.length)return!1;for(let o=0;o<r.length;++o)if(r[o]!==i[o])return!1;return!0})(this._values,t._values)}toJSON(){return{type:n._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(zn(t,n._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every(e=>typeof e=="number"))return new n(t.vectorValues);throw new x(b.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}};ie._jsonSchemaVersion="firestore/vectorValue/1.0",ie._jsonSchema={type:ot("string",ie._jsonSchemaVersion),vectorValues:ot("object")};var dm=/^__.*__$/,xo=class{constructor(t,e,r){this.data=t,this.fieldMask=e,this.fieldTransforms=r}toMutation(t,e){return this.fieldMask!==null?new qt(t,this.data,this.fieldMask,e,this.fieldTransforms):new be(t,this.data,e,this.fieldTransforms)}},Jr=class{constructor(t,e,r){this.data=t,this.fieldMask=e,this.fieldTransforms=r}toMutation(t,e){return new qt(t,this.data,this.fieldMask,e,this.fieldTransforms)}};function fh(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw M(40011,{Ec:n})}}var No=class n{constructor(t,e,r,i,o,u){this.settings=t,this.databaseId=e,this.serializer=r,this.ignoreUndefinedProperties=i,o===void 0&&this.Ac(),this.fieldTransforms=o||[],this.fieldMask=u||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(t){return new n(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(t){var e;let r=(e=this.path)===null||e===void 0?void 0:e.child(t),i=this.Rc({path:r,mc:!1});return i.fc(t),i}gc(t){var e;let r=(e=this.path)===null||e===void 0?void 0:e.child(t),i=this.Rc({path:r,mc:!1});return i.Ac(),i}yc(t){return this.Rc({path:void 0,mc:!0})}wc(t){return Yr(t,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(t){return this.fieldMask.find(e=>t.isPrefixOf(e))!==void 0||this.fieldTransforms.find(e=>t.isPrefixOf(e.field))!==void 0}Ac(){if(this.path)for(let t=0;t<this.path.length;t++)this.fc(this.path.get(t))}fc(t){if(t.length===0)throw this.wc("Document fields must not be empty");if(fh(this.Ec)&&dm.test(t))throw this.wc('Document fields cannot begin and end with "__"')}},ko=class{constructor(t,e,r){this.databaseId=t,this.ignoreUndefinedProperties=e,this.serializer=r||cs(t)}Dc(t,e,r,i=!1){return new No({Ec:t,methodName:e,bc:r,path:Et.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function Qn(n){let t=n._freezeSettings(),e=cs(n._databaseId);return new ko(n._databaseId,!!t.ignoreUndefinedProperties,e)}function ca(n,t,e,r,i,o={}){let u=n.Dc(o.merge||o.mergeFields?2:0,t,e,i);la("Data must be an object, but it was:",u,r);let l=ph(r,u),h,f;if(o.merge)h=new Pt(u.fieldMask),f=u.fieldTransforms;else if(o.mergeFields){let g=[];for(let w of o.mergeFields){let S=Oo(t,w,e);if(!u.contains(S))throw new x(b.INVALID_ARGUMENT,"Field '".concat(S,"' is specified in your field mask but missing from your input data."));_h(g,S)||g.push(S)}h=new Pt(g),f=u.fieldTransforms.filter(w=>h.covers(w.field))}else h=null,f=u.fieldTransforms;return new xo(new Tt(l),h,f)}var Bn=class n extends Ze{_toFieldTransform(t){if(t.Ec!==2)throw t.Ec===1?t.wc("".concat(this._methodName,"() can only appear at the top level of your update data")):t.wc("".concat(this._methodName,"() cannot be used with set() unless you pass {merge:true}"));return t.fieldMask.push(t.path),null}isEqual(t){return t instanceof n}};var Fo=class n extends Ze{constructor(t,e){super(t),this.Cc=e}_toFieldTransform(t){let e=new Se(t.serializer,Pl(t.serializer,this.Cc));return new Ei(t.path,e)}isEqual(t){return t instanceof n&&this.Cc===t.Cc}};function mh(n,t,e,r){let i=n.Dc(1,t,e);la("Data must be an object, but it was:",i,r);let o=[],u=Tt.empty();le(r,(h,f)=>{let g=ha(t,h,e);f=It(f);let w=i.gc(g);if(f instanceof Bn)o.push(g);else{let S=Wn(f,w);S!=null&&(o.push(g),u.set(g,S))}});let l=new Pt(o);return new Jr(u,l,i.fieldTransforms)}function gh(n,t,e,r,i,o){let u=n.Dc(1,t,e),l=[Oo(t,r,e)],h=[i];if(o.length%2!=0)throw new x(b.INVALID_ARGUMENT,"Function ".concat(t,"() needs to be called with an even number of arguments that alternate between field names and values."));for(let S=0;S<o.length;S+=2)l.push(Oo(t,o[S])),h.push(o[S+1]);let f=[],g=Tt.empty();for(let S=l.length-1;S>=0;--S)if(!_h(f,l[S])){let P=l[S],D=h[S];D=It(D);let F=u.gc(P);if(D instanceof Bn)f.push(P);else{let C=Wn(D,F);C!=null&&(f.push(P),g.set(P,C))}}let w=new Pt(f);return new Jr(g,w,u.fieldTransforms)}function fm(n,t,e,r=!1){return Wn(e,n.Dc(r?4:3,t))}function Wn(n,t){if(yh(n=It(n)))return la("Unsupported field value:",t,n),ph(n,t);if(n instanceof Ze)return(function(r,i){if(!fh(i.Ec))throw i.wc("".concat(r._methodName,"() can only be used with update(
1) and set()"));if(!i.path)throw i.wc("".concat(r._methodName,"() is not currently supported inside arrays"));let o=r._toFieldTransform(i);o&&i.fieldTransforms.push(o)})(n,t),null;if(n===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),n instanceof Array){if(t.settings.mc&&t.Ec!==4)throw t.wc("Nested arrays are not supported");return(function(r,i){let o=[],u=0;for(let l of r){let h=Wn(l,i.yc(u));h==null&&(h={nullValue:"NULL_VALUE"}),o.push(h),u++}return{arrayValue:{values:o}}})(n,t)}return(function(r,i){if((r=It(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Pl(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){let o=at.fromDate(r);return{timestampValue:Or(i.serializer,o)}}if(r instanceof at){let o=new at(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Or(i.serializer,o)}}if(r instanceof se)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof re)return{bytesValue:Ol(i.seri
vendor: 11,574 bytes, line 1
1alizer,r._byteString)};if(r instanceof lt){let o=i.databaseId,u=r.firestore._databaseId;if(!u.isEqual(o))throw i.wc("Document reference is for database ".concat(u.projectId,"/").concat(u.database," but should be for database ").concat(o.projectId,"/").concat(o.database));return{referenceValue:Zo(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof ie)return(function(u,l){return{mapValue:{fields:{[Ko]:{stringValue:Qo},[ze]:{arrayValue:{values:u.toArray().map(f=>{if(typeof f!="number")throw l.wc("VectorValues must only contain numeric values.");return Yo(l.serializer,f)})}}}}}})(r,i);throw i.wc("Unsupported field value: ".concat(rs(r)))})(n,t)}function ph(n,t){let e={};return al(n)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):le(n,(r,i)=>{let o=Wn(i,t.Vc(r));o!=null&&(e[r]=o)}),{mapValue:{fields:e}}}function yh(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof at||n instanceof se||n instanceof re||n instanceof lt||n instanceof Ze||n instanceof ie)}function la(n,t,e){if(!yh(e)||!Gc(e)){let r=rs(e);throw r==="an object"?t.wc(n+" a custom object"):t.wc(n+" "+r)}}function Oo(n,t,e){if((t=It(t))instanceof Ve)return t._internalPath;if(typeof t=="string")return ha(n,t);throw Yr("Field path arguments must be of type string or ",n,!1,void 0,e)}var mm=new RegExp("[~\\*/\\[\\]]");function ha(n,t,e){if(t.search(mm)>=0)throw Yr("Invalid field path (".concat(t,"). Paths must not contain '~', '*', '/', '[', or ']'"),n,!1,void 0,e);try{return new Ve(...t.split("."))._internalPath}catch(r){throw Yr("Invalid field path (".concat(t,"). Paths must not be empty, begin with '.', end with '.', or contain '..'"),n,!1,void 0,e)}}function Yr(n,t,e,r,i){let o=r&&!r.isEmpty(),u=i!==void 0,l="Function ".concat(t,"() called with invalid data");e&&(l+=" (via `toFirestore()`)"),l+=". ";let h="";return(o||u)&&(h+=" (found",o&&(h+=" in field ".concat(r)),u&&(h+=" in document ".concat(i)),h+=")"),new x(b.INVALID_ARGUMENT,l+n+h)}function _h(n,t){return n.some(e=>e.isEqual(t))}var Zr=class{constructor(t,e,r,i,o){this._firestore=t,this._userDataWriter=e,this._key=r,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new lt(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let t=new Mo(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){let e=this._document.data.field(gs("DocumentSnapshot.get",t));if(e!==null)return this._userDataWriter.convertValue(e)}}},Mo=class extends Zr{data(){return super.data()}};function gs(n,t){return typeof t=="string"?ha(n,t):t instanceof Ve?t._internalPath:t._delegate._internalPath}function gm(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new x(b.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}var jn=class{},$n=class extends jn{};function wh(n,t,...e){let r=[];t instanceof jn&&r.push(t),r=r.concat(e),(function(o){let u=o.filter(h=>h instanceof Lo).length,l=o.filter(h=>h instanceof ts).length;if(u>1||u>0&&l>0)throw new x(b.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")})(r);for(let i of r)n=i._apply(n);return n}var ts=class n extends $n{constructor(t,e,r){super(),this._field=t,this._op=e,this._value=r,this.type="where"}static _create(t,e,r){return new n(t,e,r)}_apply(t){let e=this._parse(t);return Ah(t._query,e),new Jt(t.firestore,t.converter,Ti(t._query,e))}_parse(t){let e=Qn(t.firestore);return(function(o,u,l,h,f,g,w){let S;if(f.isKeyField()){if(g==="array-contains"||g==="array-contains-any")throw new x(b.INVALID_ARGUMENT,"Invalid Query. You can't perform '".concat(g,"' queries on documentId()."));if(g==="in"||g==="not-in"){jc(w,g);let D=[];for(let F of w)D.push(Bc(h,o,F));S={arrayValue:{values:D}}}else S=Bc(h,o,w)}else g!=="in"&&g!=="not-in"&&g!=="array-contains-any"||jc(w,g),S=fm(l,u,w,g==="in"||g==="not-in");return it.create(f,g,S)})(t._query,"where",e,t.firestore._databaseId,this._field,this._op,this._value)}};function vh(n,t,e){let r=t,i=gs("where",n);return ts._create(i,r,e)}var Lo=class n extends jn{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new n(t,e)}_parse(t){let e=this._queryConstraints.map(r=>r._parse(t)).filter(r=>r.getFilters().length>0);return e.length===1?e[0]:Dt.create(e,this._getOperator())}_apply(t){let e=this._parse(t);return e.getFilters().length===0?t:((function(i,o){let u=i,l=o.getFlattenedFilters();for(let h of l)Ah(u,h),u=Ti(u,h)})(t._query,e),new Jt(t.firestore,t.converter,Ti(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}};var qo=class n extends $n{constructor(t,e){super(),this._field=t,this._direction=e,this.type="orderBy"}static _create(t,e){return new n(t,e)}_apply(t){let e=(function(i,o,u){if(i.startAt!==null)throw new x(b.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new x(b.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Te(o,u)})(t._query,this._field,this._direction);return new Jt(t.firestore,t.converter,(function(i,o){let u=i.explicitOrderBy.concat([o]);return new Wt(i.path,i.collectionGroup,u,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)})(t._query,e))}};function Ih(n,t="asc"){let e=t,r=gs("orderBy",n);return qo._create(r,e)}var es=class n extends $n{constructor(t,e,r){super(),this.type=t,this._limit=e,this._limitType=r}static _create(t,e,r){return new n(t,e,r)}_apply(t){return new Jt(t.firestore,t.converter,Dr(t._query,this._limit,this._limitType))}};function Th(n){return Kc("limit",n),es._create("limit",n,"F")}function Eh(n){return Kc("limitToLast",n),es._create("limitToLast",n,"L")}function Bc(n,t,e){if(typeof(e=It(e))=="string"){if(e==="")throw new x(b.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Il(t)&&e.indexOf("/")!==-1)throw new x(b.INVALID_ARGUMENT,"Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '".concat(e,"' contains a '/' character."));let r=t.path.child(J.fromString(e));if(!O.isDocumentKey(r))throw new x(b.INVALID_ARGUMENT,"Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '".concat(r,"' is not because it has an odd number of segments (").concat(r.length,")."));return ac(n,new O(r))}if(e instanceof lt)return ac(n,e._key);throw new x(b.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ".concat(rs(e),"."))}function jc(n,t){if(!Array.isArray(n)||n.length===0)throw new x(b.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '".concat(t.toString(),"' filters."))}function Ah(n,t){let e=(function(i,o){for(let u of i)for(let l of u.getFlattenedFilters())if(o.indexOf(l.op)>=0)return l.op;return null})(n.filters,(function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}})(t.op));if(e!==null)throw e===t.op?new x(b.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '".concat(t.op.toString(),"' filter.")):new x(b.INVALID_ARGUMENT,"Invalid query. You cannot use '".concat(t.op.toString(),"' filters with '").concat(e.toString(),"' filters."))}var Uo=class{convertValue(t,e="none"){switch(ae(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Y(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(Qt(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 11:return this.convertObject(t.mapValue,e);case 10:return this.convertVectorValue(t.mapValue);default:throw M(62114,{value:t})}}convertObject(t,e){return this.convertObjectMap(t.fields,e)}convertObjectMap(t,e="none"){let r={};return le(t,(i,o)=>{r[i]=this.convertValue(o,e)}),r}convertVectorValue(t){var e,r,i;let o=(i=(r=(e=t.fields)===null||e===void 0?void 0:e[ze].arrayValue)===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.map(u=>Y(u.doubleValue));return new ie(o)}convertGeoPoint(t){return new se(Y(t.latitude),Y(t.longitude))}convertArray(t,e){return(t.values||[]).map(r=>this.convertValue(r,e))}convertServerTimestamp(t,e){switch(e){case"previous":let r=os(t);return r==null?null:this.convertValue(r,e);case"estimate":return this.convertTimestamp(Fn(t));default:return null}}convertTimestamp(t){let e=Kt(t);return new at(e.seconds,e.nanos)}convertDocumentKey(t,e){let r=J.fromString(t);Q(jl(r),9688,{name:t});let i=new Vr(r.get(1),r.get(3)),o=new O(r.popFirst(5));return i.isEqual(e)||Gt("Document ".concat(o," contains a document reference within a different database (").concat(i.projectId,"/").concat(i.database,") which is not supported. It will be treated as a reference in the current database (").concat(e.projectId,"/").concat(e.database,") instead.")),o}};function da(n,t,e){let r;return r=n?e&&(e.merge||e.mergeFields)?n.toFirestore(t,e):n.toFirestore(t):t,r}var _e=class{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}},we=class n extends Zr{constructor(t,e,r,i,o,u){super(t,e,r,i,u),this._firestore=t,this._firestoreImpl=t,this.metadata=o}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){let e=new Be(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){let r=this._document.data.field(gs("DocumentSnapshot.get",t));if(r!==null)return this._userDataWriter.convertValue(r,e.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new x(b.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let t=this._document,e={};return e.type=n._jsonSchemaVersion,e.bundle="",e.bundleSource="DocumentSnapshot",e.bundleName=this._key.toString(),!t||!t.isValidDocument()||!t.isFoundDocument()?e:(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,"previous"),e.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),e)}};we._jsonSchemaVersion="firestore/documentSnapshot/1.0",we._jsonSchema={type:ot("string",we._jsonSchemaVersion),bundleSource:ot("string","DocumentSnapshot"),bundleName:ot("string"),bundle:ot("string")};var Be=class extends we{data(t={}){return super.data(t)}},je=class n{constructor(t,e,r,i){this._firestore=t,this._userDataWriter=e,this._snapshot=i,this.metadata=new _e(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){let t=[];
1return this.forEach(e=>t.push(e)),t}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(t,e){this._snapshot.docs.forEach(r=>{t.call(e,new Be(this._firestore,this._userDataWriter,r.key,r,new _e(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(t={}){let e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new x(b.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,o){if(i._snapshot.oldDocs.isEmpty()){let u=0;return i._snapshot.docChanges.map(l=>{let h=new Be(i._firestore,i._userDataWriter,l.doc.key,l.doc,new _e(i._snapshot.mutatedKeys.has(l.doc.key),i._snapshot.fromCache),i.query.converter);return l.doc,{type:"added",doc:h,oldIndex:-1,newIndex:u++}})}{let u=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(l=>o||l.type!==3).map(l=>{let h=new Be(i._firestore,i._userDataWriter,l.doc.key,l.doc,new _e(i._snapshot.mutatedKeys.has(l.doc.key),i._snapshot.fromCache),i.query.converter),f=-1,g=-1;return l.type!==0&&(f=u.indexOf(l.doc.key),u=u.delete(l.doc.key)),l.type!==1&&(u=u.add(l.doc),g=u.indexOf(l.doc.key)),{type:pm(l.type),doc:h,oldIndex:f,newIndex:g}})}})(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new x(b.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let t={};t.type=n._jsonSchemaVersion,t.bundleSource="QuerySnapshot",t.bundleName=xn.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let e=[],r=[],i=[];return this.docs.forEach(o=>{o._document!==null&&(e.push(o._document),r.push(this._userDataWriter.convertObjectMap(o._document.data.value.mapValue.fields,"previous")),i.push(o.ref.path))}),t.bundle=(this._firestore,this.query._query,t.bundleName,"NOT SUPPORTED"),t}};function pm(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return M(61501,{type:n})}}je._jsonSchemaVersion="firestore/querySnapshot/1.0",je._jsonSchema={type:ot("string",je._jsonSchemaVersion),bundleSource:ot("string","QuerySnapshot"),bundleName:ot("string"),bundle:ot("string")};var ns=class extends Uo{constructor(t){super(),this.firestore=t}convertBytes(t){return new re(t)}convertReference(t){let e=this.convertDocumentKey(t,this.firestore._databaseId);return new lt(this.firestore,null,e)}};function Sh(n,t,e){n=At(n,lt);let r=At(n.firestore,xt),i=da(n.converter,t,e);return Hn(r,[ca(Qn(r),"setDoc",n._key,i,n.converter!==null,e).toMutation(n._key,St.none())])}function bh(n,t,e,...r){n=At(n,lt);let i=At(n.firestore,xt),o=Qn(i),u;return u=typeof(t=It(t))=="string"||t instanceof Ve?gh(o,"updateDoc",n._key,t,e,r):mh(o,"updateDoc",n._key,t),Hn(i,[u.toMutation(n._key,St.exists(!0))])}function Rh(n){return Hn(At(n.firestore,xt),[new Je(n._key,St.none())])}function Ph(n,t){let e=At(n.firestore,xt),r=ua(n),i=da(n.converter,t);return Hn(e,[ca(Qn(n.firestore),"addDoc",r._key,i,n.converter!==null,{}).toMutation(r._key,St.exists(!1))]).then(()=>r)}function fa(n,...t){var e,r,i;n=It(n);let o={includeMetadataChanges:!1,source:"default"},u=0;typeof t[u]!="object"||Uc(t[u])||(o=t[u++]);let l={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(Uc(t[u])){let w=t[u];t[u]=(e=w.next)===null||e===void 0?void 0:e.bind(w),t[u+1]=(r=w.error)===null||r===void 0?void 0:r.bind(w),t[u+2]=(i=w.complete)===null||i===void 0?void 0:i.bind(w)}let h,f,g;if(n instanceof lt)f=At(n.firestore,xt),g=Jo(n._key.path),h={next:w=>{t[u]&&t[u](ym(f,n,w))},error:t[u+1],complete:t[u+2]};else{let w=At(n,Jt);f=At(w.firestore,xt),g=w._query;let S=new ns(f);h={next:P=>{t[u]&&t[u](new je(f,S,w,P))},error:t[u+1],complete:t[u+2]},gm(n._query)}return(function(S,P,D,F){let C=new Co(F),$=new Eo(P,C,D);return S.asyncQueue.enqueueAndForget(()=>N(null,null,function*(){return Gf(yield Fc(S),$)})),()=>{C.Ou(),S.asyncQueue.enqueueAndForget(()=>N(null,null,function*(){return Kf(yield Fc(S),$)}))}})(ms(f),g,l,h)}function Hn(n,t){return(function(r,i){let o=new kt;return r.asyncQueue.enqueueAndForget(()=>N(null,null,function*(){return tm(yield oh(r),i,o)})),o.promise})(ms(n),t)}function ym(n,t,e){let r=e.docs.get(t._key),i=new ns(n);return new we(n,i,t._key,r,new _e(e.hasPendingWrites,e.fromCache),t.converter)}var Bo=class{constructor(t,e){this._firestore=t,this._commitHandler=e,this._mutations=[],this._committed=!1,this._dataReader=Qn(t)}set(t,e,r){this._verifyNotCommitted();let i=Zs(t,this._firestore),o=da(i.converter,e,r),u=ca(this._dataReader,"WriteBatch.set",i._key,o,i.converter!==null,r);return this._mutations.push(u.toMutation(i._key,St.none())),this}update(t,e,r,...i){this._verifyNotCommitted();let o=Zs(t,this._firestore),u;return u=typeof(e=It(e))=="string"||e instanceof Ve?gh(this._dataReader,"WriteBatch.update",o._key,e,r,i):mh(this._dataReader,"WriteBatch.update",o._key,e),this._mutations.push(u.toMutation(o._key,St.exists(!0))),this}delete(t){this._verifyNotCommitted();let e=Zs(t,this._firestore);return this._mutations=this._mutations.concat(new Je(e._key,St.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new x(b.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}};function Zs(n,t){if((n=It(n)).firestore!==t)throw new x(b.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}function Vh(){return new Bn("deleteField")}function Ch(n){return new Fo("increment",n)}function Dh(n){return ms(n=At(n,xt)),new Bo(n,t=>Hn(n,t))}(function(t,e=!0){(function(i){tn=i})(Ru),Au(new $u("firestore",(r,{instanceIdentifier:i,options:o})=>{let u=r.getProvider("app").getImmediate(),l=new xt(new ni(r.getProvider("auth-internal")),new ii(u,r.getProvider("app-check-internal")),(function(f,g){if(!Object.prototype.hasOwnProperty.apply(f.options,["projectId"]))throw new x(b.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Vr(f.options.projectId,g)})(u,i),u);return o=Object.assign({useFetchStreams:e},o),l._setSettings(o),l},"PUBLIC").setMultipleInstances(!0)),Sn(Hu,Xu,t),Sn(Hu,Xu,"esm2017")})();var ps=function(){return ps=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},ps.apply(this,arguments)};var vm={includeMetadataChanges:!1};function ma(n,t){return t===void 0&&(t=vm),new wu(function(e){var r=fa(n,t,{next:e.next.bind(e),error:e.error.bind(e),complete:e.complete.bind(e)});return{unsubscribe:r}})}function xh(n){return ma(n,{includeMetadataChanges:!0})}function Nh(n,t){return t===void 0&&(t={}),xh(n).pipe(mr(function(e){return ga(e,t)}))}function ga(n,t){var e;t===void 0&&(t={});var r=n.data(t);return!n.exists()||typeof r!="object"||r===null||!t.idField?r:ps(ps({},r),(e={},e[t.idField]=n.id,e))}function kh(n){return ma(n,{includeMetadataChanges:!0}).pipe(mr(function(t){return t.docs}))}function Fh(n,t){return t===void 0&&(t={}),kh(n).pipe(mr(function(e){return e.map(function(r){return ga(r,t)})}))}var Xn=class{constructor(t){return t}},Oh="firestore",pa=class{constructor(){return Du(Oh)}};var ya=new vu("angularfire2.firestore-instances");function Im(n,t){let e=Cu(Oh,n,t);return e&&new Xn(e)}function Tm(n){return(t,e)=>{let r=t.runOutsideAngular(()=>n(e));return new Xn(r)}}var Em={provide:pa,deps:[[new An,ya]]},Am={provide:Xn,useFactory:Im,deps:[[new An,ya],Nu]};function ap(n,...t){return Sn("angularfire",Vu.full,"fst"),Iu([Am,Em,{provide:ya,useFactory:Tm(n),multi:!0,deps:[Eu,Tu,xu,ku,[new An,Ku],[new An,Gu],...t]}])}var up=nt(Fh,!0);var cp=nt(Nh,!0);var lp=nt(Ph,!0,2);var hp=nt(ch,!0,2),dp=nt(lh,!0,2),fp=nt(aa,!0);var mp=nt(Rh,!0,2),gp=nt(Vh,!0,2);var pp=nt(ua,!0,2);var yp=nt(hh,!0);var _p=nt(Ch,!0,2);var wp=nt(Th,!0,2),vp=nt(Eh,!0,2);var Ip=nt(Ih,!0,2),Tp=nt(wh,!0,2);var Ep=nt(Sh,!0,2);var Ap=nt(bh,!0,2);var Sp=nt(dh,!0),bp=nt(vh,!0,2),Rp=nt(Dh,!0,2);export{Xn as a,ap as b,up as c,cp as d,lp as e,hp as f,dp as g,fp as h,mp as i,gp as j,pp as k,yp as l,_p as m,wp as n,vp as o,Ip as p,Tp as q,Ep as r,Ap as s,Sp as t,bp as u,Rp as v};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.