@fleox-agent-crm/agentcrm 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -16
- package/changelog.json +13 -0
- package/dist/admin/admin-files.json +7 -7
- package/dist/admin/assets/{chartsImpl-aBuZ1X4W.js → chartsImpl-zjsXDhuy.js} +1 -1
- package/dist/admin/assets/firebase-C3h9mF8O.js +2 -0
- package/dist/admin/assets/{gitJson-DzX3eZ2P.js → gitJson-nrOYgX0x.js} +1 -1
- package/dist/admin/assets/{index-DLy5RpPl.js → index-0ejjkW0z.js} +6 -6
- package/dist/admin/assets/{lucide-react.min-BgcmukkH.js → lucide-react.min-CI5dCsSm.js} +1 -1
- package/dist/admin/assets/{sdk-DtP9zqdi.js → sdk-mepKXtVl.js} +135 -120
- package/dist/admin/index.html +1 -1
- package/dist/agent/agentcrm.mjs +29 -16
- package/dist/agent/chunks/api-BEl_EKwf.mjs +79 -0
- package/dist/agent/chunks/{firebase-DWR0K1OC.mjs → firebase-Bknru2pE.mjs} +230 -53
- package/dist/agent/chunks/firebaseCache-sK4jA0ru.mjs +39 -0
- package/dist/agent/chunks/{firebaseRules-iori-s7U.mjs → firebaseRules-Jq85MBBN.mjs} +14 -3
- package/dist/agent/chunks/{hosting-Dnn1k3cV.mjs → hosting-C_UDyMkm.mjs} +1 -1
- package/dist/agent/chunks/{index-DtCezG4R.mjs → index-DWecFbTi.mjs} +1 -1
- package/dist/agent/chunks/{install-Bp-CwDVC.mjs → install-BLNflFes.mjs} +3 -3
- package/dist/agent/chunks/{sdk-CYgNyuoK.mjs → sdk-NYUHv7WG.mjs} +493 -214
- package/dist/version.json +1 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agentcrm-admin/SKILL.md +67 -67
- package/plugin/skills/agentcrm-admin/references/records.md +5 -5
- package/plugin/skills/agentcrm-admin/references/schema.md +19 -19
- package/plugin/skills/agentcrm-extensions/SKILL.md +8 -8
- package/plugin/skills/agentcrm-extensions/references/module-recipes.md +2 -2
- package/plugin/skills/agentcrm-extensions/references/testing.md +14 -14
- package/plugin/skills/agentcrm-extensions/references/theme-recipes.md +3 -3
- package/plugin/skills/agentcrm-install/SKILL.md +13 -13
- package/plugin/skills/agentcrm-install/references/firebase.md +1 -1
- package/plugin/skills/agentcrm-install/references/github.md +1 -1
- package/plugin/skills/agentcrm-install/references/mcp.md +2 -2
- package/plugin/skills/agentcrm-install/references/plans.md +1 -1
- package/plugin/skills/agentcrm-install/references/s3.md +1 -1
- package/plugin/skills/agentcrm-manage/SKILL.md +15 -15
- package/plugin/skills/agentcrm-sales/SKILL.md +18 -18
- package/dist/admin/assets/firebase-BG1GpyBB.js +0 -2
- package/dist/agent/chunks/api-Dwb4xz1k.mjs +0 -27
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.esm-BFc7vwnl.js","./index.esm2017-EOzKbpUS.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as
|
|
2
|
+
import{_ as kl}from"./index-0ejjkW0z.js";import"./index.esm-Dum0J07z.js";import{getAuth as xl,onAuthStateChanged as ho,signOut as Ol,sendEmailVerification as Ml,sendPasswordResetEmail as Fl,GoogleAuthProvider as Ll,signInWithPopup as Ul,signInWithEmailAndPassword as ql}from"./index.esm-CtEQZRb1.js";import{q as St,e as Ea,y as Ta,u as Vs,v as va,m as jl,t as Bl,F as zl,w as $l,x as Gl,L as Kl,z as qt,A as Ql,B as Wl,S as Hl,i as Xl,C as Yl,r as fo,h as Jl,g as Zl,n as tc}from"./index.esm2017-EOzKbpUS.js";import{withChangeTracking as ec,DELETE_FIELD as nc,SERVER_TIMESTAMP as rc,TS_FIELD as sc,splitTs as ic}from"./firebase-C3h9mF8O.js";var mo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
|
3
3
|
Copyright The Closure Library Authors.
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/var Xt,
|
|
5
|
+
*/var Xt,Ia;(function(){var r;/** @license
|
|
6
6
|
|
|
7
7
|
Copyright The Closure Library Authors.
|
|
8
8
|
SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
*/function t(v,m){function _(){}_.prototype=m.prototype,v.D=m.prototype,v.prototype=new _,v.prototype.constructor=v,v.C=function(y,T,A){for(var g=Array(arguments.length-2),Ft=2;Ft<arguments.length;Ft++)g[Ft-2]=arguments[Ft];return m.prototype[T].apply(y,g)}}function e(){this.blockSize=-1}function n(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}t(n,e),n.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(v,m,_){_||(_=0);var y=Array(16);if(typeof m=="string")for(var T=0;16>T;++T)y[T]=m.charCodeAt(_++)|m.charCodeAt(_++)<<8|m.charCodeAt(_++)<<16|m.charCodeAt(_++)<<24;else for(T=0;16>T;++T)y[T]=m[_++]|m[_++]<<8|m[_++]<<16|m[_++]<<24;m=v.g[0],_=v.g[1],T=v.g[2];var A=v.g[3],g=m+(A^_&(T^A))+y[0]+3614090360&4294967295;m=_+(g<<7&4294967295|g>>>25),g=A+(T^m&(_^T))+y[1]+3905402710&4294967295,A=m+(g<<12&4294967295|g>>>20),g=T+(_^A&(m^_))+y[2]+606105819&4294967295,T=A+(g<<17&4294967295|g>>>15),g=_+(m^T&(A^m))+y[3]+3250441966&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(A^_&(T^A))+y[4]+4118548399&4294967295,m=_+(g<<7&4294967295|g>>>25),g=A+(T^m&(_^T))+y[5]+1200080426&4294967295,A=m+(g<<12&4294967295|g>>>20),g=T+(_^A&(m^_))+y[6]+2821735955&4294967295,T=A+(g<<17&4294967295|g>>>15),g=_+(m^T&(A^m))+y[7]+4249261313&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(A^_&(T^A))+y[8]+1770035416&4294967295,m=_+(g<<7&4294967295|g>>>25),g=A+(T^m&(_^T))+y[9]+2336552879&4294967295,A=m+(g<<12&4294967295|g>>>20),g=T+(_^A&(m^_))+y[10]+4294925233&4294967295,T=A+(g<<17&4294967295|g>>>15),g=_+(m^T&(A^m))+y[11]+2304563134&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(A^_&(T^A))+y[12]+1804603682&4294967295,m=_+(g<<7&4294967295|g>>>25),g=A+(T^m&(_^T))+y[13]+4254626195&4294967295,A=m+(g<<12&4294967295|g>>>20),g=T+(_^A&(m^_))+y[14]+2792965006&4294967295,T=A+(g<<17&4294967295|g>>>15),g=_+(m^T&(A^m))+y[15]+1236535329&4294967295,_=T+(g<<22&4294967295|g>>>10),g=m+(T^A&(_^T))+y[1]+4129170786&4294967295,m=_+(g<<5&4294967295|g>>>27),g=A+(_^T&(m^_))+y[6]+3225465664&4294967295,A=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(A^m))+y[11]+643717713&4294967295,T=A+(g<<14&4294967295|g>>>18),g=_+(A^m&(T^A))+y[0]+3921069994&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^A&(_^T))+y[5]+3593408605&4294967295,m=_+(g<<5&4294967295|g>>>27),g=A+(_^T&(m^_))+y[10]+38016083&4294967295,A=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(A^m))+y[15]+3634488961&4294967295,T=A+(g<<14&4294967295|g>>>18),g=_+(A^m&(T^A))+y[4]+3889429448&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^A&(_^T))+y[9]+568446438&4294967295,m=_+(g<<5&4294967295|g>>>27),g=A+(_^T&(m^_))+y[14]+3275163606&4294967295,A=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(A^m))+y[3]+4107603335&4294967295,T=A+(g<<14&4294967295|g>>>18),g=_+(A^m&(T^A))+y[8]+1163531501&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(T^A&(_^T))+y[13]+2850285829&4294967295,m=_+(g<<5&4294967295|g>>>27),g=A+(_^T&(m^_))+y[2]+4243563512&4294967295,A=m+(g<<9&4294967295|g>>>23),g=T+(m^_&(A^m))+y[7]+1735328473&4294967295,T=A+(g<<14&4294967295|g>>>18),g=_+(A^m&(T^A))+y[12]+2368359562&4294967295,_=T+(g<<20&4294967295|g>>>12),g=m+(_^T^A)+y[5]+4294588738&4294967295,m=_+(g<<4&4294967295|g>>>28),g=A+(m^_^T)+y[8]+2272392833&4294967295,A=m+(g<<11&4294967295|g>>>21),g=T+(A^m^_)+y[11]+1839030562&4294967295,T=A+(g<<16&4294967295|g>>>16),g=_+(T^A^m)+y[14]+4259657740&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^A)+y[1]+2763975236&4294967295,m=_+(g<<4&4294967295|g>>>28),g=A+(m^_^T)+y[4]+1272893353&4294967295,A=m+(g<<11&4294967295|g>>>21),g=T+(A^m^_)+y[7]+4139469664&4294967295,T=A+(g<<16&4294967295|g>>>16),g=_+(T^A^m)+y[10]+3200236656&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^A)+y[13]+681279174&4294967295,m=_+(g<<4&4294967295|g>>>28),g=A+(m^_^T)+y[0]+3936430074&4294967295,A=m+(g<<11&4294967295|g>>>21),g=T+(A^m^_)+y[3]+3572445317&4294967295,T=A+(g<<16&4294967295|g>>>16),g=_+(T^A^m)+y[6]+76029189&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(_^T^A)+y[9]+3654602809&4294967295,m=_+(g<<4&4294967295|g>>>28),g=A+(m^_^T)+y[12]+3873151461&4294967295,A=m+(g<<11&4294967295|g>>>21),g=T+(A^m^_)+y[15]+530742520&4294967295,T=A+(g<<16&4294967295|g>>>16),g=_+(T^A^m)+y[2]+3299628645&4294967295,_=T+(g<<23&4294967295|g>>>9),g=m+(T^(_|~A))+y[0]+4096336452&4294967295,m=_+(g<<6&4294967295|g>>>26),g=A+(_^(m|~T))+y[7]+1126891415&4294967295,A=m+(g<<10&4294967295|g>>>22),g=T+(m^(A|~_))+y[14]+2878612391&4294967295,T=A+(g<<15&4294967295|g>>>17),g=_+(A^(T|~m))+y[5]+4237533241&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~A))+y[12]+1700485571&4294967295,m=_+(g<<6&4294967295|g>>>26),g=A+(_^(m|~T))+y[3]+2399980690&4294967295,A=m+(g<<10&4294967295|g>>>22),g=T+(m^(A|~_))+y[10]+4293915773&4294967295,T=A+(g<<15&4294967295|g>>>17),g=_+(A^(T|~m))+y[1]+2240044497&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~A))+y[8]+1873313359&4294967295,m=_+(g<<6&4294967295|g>>>26),g=A+(_^(m|~T))+y[15]+4264355552&4294967295,A=m+(g<<10&4294967295|g>>>22),g=T+(m^(A|~_))+y[6]+2734768916&4294967295,T=A+(g<<15&4294967295|g>>>17),g=_+(A^(T|~m))+y[13]+1309151649&4294967295,_=T+(g<<21&4294967295|g>>>11),g=m+(T^(_|~A))+y[4]+4149444226&4294967295,m=_+(g<<6&4294967295|g>>>26),g=A+(_^(m|~T))+y[11]+3174756917&4294967295,A=m+(g<<10&4294967295|g>>>22),g=T+(m^(A|~_))+y[2]+718787259&4294967295,T=A+(g<<15&4294967295|g>>>17),g=_+(A^(T|~m))+y[9]+3951481745&4294967295,v.g[0]=v.g[0]+m&4294967295,v.g[1]=v.g[1]+(T+(g<<21&4294967295|g>>>11))&4294967295,v.g[2]=v.g[2]+T&4294967295,v.g[3]=v.g[3]+A&4294967295}n.prototype.u=function(v,m){m===void 0&&(m=v.length);for(var _=m-this.blockSize,y=this.B,T=this.h,A=0;A<m;){if(T==0)for(;A<=_;)i(this,v,A),A+=this.blockSize;if(typeof v=="string"){for(;A<m;)if(y[T++]=v.charCodeAt(A++),T==this.blockSize){i(this,y),T=0;break}}else for(;A<m;)if(y[T++]=v[A++],T==this.blockSize){i(this,y),T=0;break}}this.h=T,this.o+=m},n.prototype.v=function(){var v=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);v[0]=128;for(var m=1;m<v.length-8;++m)v[m]=0;var _=8*this.o;for(m=v.length-8;m<v.length;++m)v[m]=_&255,_/=256;for(this.u(v),v=Array(16),m=_=0;4>m;++m)for(var y=0;32>y;y+=8)v[_++]=this.g[m]>>>y&255;return v};function o(v,m){var _=c;return Object.prototype.hasOwnProperty.call(_,v)?_[v]:_[v]=m(v)}function u(v,m){this.h=m;for(var _=[],y=!0,T=v.length-1;0<=T;T--){var A=v[T]|0;y&&A==m||(_[T]=A,y=!1)}this.g=_}var c={};function h(v){return-128<=v&&128>v?o(v,function(m){return new u([m|0],0>m?-1:0)}):new u([v|0],0>v?-1:0)}function f(v){if(isNaN(v)||!isFinite(v))return E;if(0>v)return b(f(-v));for(var m=[],_=1,y=0;v>=_;y++)m[y]=v/_|0,_*=4294967296;return new u(m,0)}function p(v,m){if(v.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(v.charAt(0)=="-")return b(p(v.substring(1),m));if(0<=v.indexOf("-"))throw Error('number format error: interior "-" character');for(var _=f(Math.pow(m,8)),y=E,T=0;T<v.length;T+=8){var A=Math.min(8,v.length-T),g=parseInt(v.substring(T,T+A),m);8>A?(A=f(Math.pow(m,A)),y=y.j(A).add(f(g))):(y=y.j(_),y=y.add(f(g)))}return y}var E=h(0),R=h(1),S=h(16777216);r=u.prototype,r.m=function(){if(x(this))return-b(this).m();for(var v=0,m=1,_=0;_<this.g.length;_++){var y=this.i(_);v+=(0<=y?y:4294967296+y)*m,m*=4294967296}return v},r.toString=function(v){if(v=v||10,2>v||36<v)throw Error("radix out of range: "+v);if(D(this))return"0";if(x(this))return"-"+b(this).toString(v);for(var m=f(Math.pow(v,6)),_=this,y="";;){var T=it(_,m).g;_=$(_,T.j(m));var A=((0<_.g.length?_.g[0]:_.h)>>>0).toString(v);if(_=T,D(_))return A+y;for(;6>A.length;)A="0"+A;y=A+y}},r.i=function(v){return 0>v?0:v<this.g.length?this.g[v]:this.h};function D(v){if(v.h!=0)return!1;for(var m=0;m<v.g.length;m++)if(v.g[m]!=0)return!1;return!0}function x(v){return v.h==-1}r.l=function(v){return v=$(this,v),x(v)?-1:D(v)?0:1};function b(v){for(var m=v.g.length,_=[],y=0;y<m;y++)_[y]=~v.g[y];return new u(_,~v.h).add(R)}r.abs=function(){return x(this)?b(this):this},r.add=function(v){for(var m=Math.max(this.g.length,v.g.length),_=[],y=0,T=0;T<=m;T++){var A=y+(this.i(T)&65535)+(v.i(T)&65535),g=(A>>>16)+(this.i(T)>>>16)+(v.i(T)>>>16);y=g>>>16,A&=65535,g&=65535,_[T]=g<<16|A}return new u(_,_[_.length-1]&-2147483648?-1:0)};function $(v,m){return v.add(b(m))}r.j=function(v){if(D(this)||D(v))return E;if(x(this))return x(v)?b(this).j(b(v)):b(b(this).j(v));if(x(v))return b(this.j(b(v)));if(0>this.l(S)&&0>v.l(S))return f(this.m()*v.m());for(var m=this.g.length+v.g.length,_=[],y=0;y<2*m;y++)_[y]=0;for(y=0;y<this.g.length;y++)for(var T=0;T<v.g.length;T++){var A=this.i(y)>>>16,g=this.i(y)&65535,Ft=v.i(T)>>>16,Fe=v.i(T)&65535;_[2*y+2*T]+=g*Fe,B(_,2*y+2*T),_[2*y+2*T+1]+=A*Fe,B(_,2*y+2*T+1),_[2*y+2*T+1]+=g*Ft,B(_,2*y+2*T+1),_[2*y+2*T+2]+=A*Ft,B(_,2*y+2*T+2)}for(y=0;y<m;y++)_[y]=_[2*y+1]<<16|_[2*y];for(y=m;y<2*m;y++)_[y]=0;return new u(_,0)};function B(v,m){for(;(v[m]&65535)!=v[m];)v[m+1]+=v[m]>>>16,v[m]&=65535,m++}function K(v,m){this.g=v,this.h=m}function it(v,m){if(D(m))throw Error("division by zero");if(D(v))return new K(E,E);if(x(v))return m=it(b(v),m),new K(b(m.g),b(m.h));if(x(m))return m=it(v,b(m)),new K(b(m.g),m.h);if(30<v.g.length){if(x(v)||x(m))throw Error("slowDivide_ only works with positive integers.");for(var _=R,y=m;0>=y.l(v);)_=Mt(_),y=Mt(y);var T=at(_,1),A=at(y,1);for(y=at(y,2),_=at(_,2);!D(y);){var g=A.add(y);0>=g.l(v)&&(T=T.add(_),A=g),y=at(y,1),_=at(_,1)}return m=$(v,T.j(m)),new K(T,m)}for(T=E;0<=v.l(m);){for(_=Math.max(1,Math.floor(v.m()/m.m())),y=Math.ceil(Math.log(_)/Math.LN2),y=48>=y?1:Math.pow(2,y-48),A=f(_),g=A.j(m);x(g)||0<g.l(v);)_-=y,A=f(_),g=A.j(m);D(A)&&(A=R),T=T.add(A),v=$(v,g)}return new K(T,v)}r.A=function(v){return it(this,v).h},r.and=function(v){for(var m=Math.max(this.g.length,v.g.length),_=[],y=0;y<m;y++)_[y]=this.i(y)&v.i(y);return new u(_,this.h&v.h)},r.or=function(v){for(var m=Math.max(this.g.length,v.g.length),_=[],y=0;y<m;y++)_[y]=this.i(y)|v.i(y);return new u(_,this.h|v.h)},r.xor=function(v){for(var m=Math.max(this.g.length,v.g.length),_=[],y=0;y<m;y++)_[y]=this.i(y)^v.i(y);return new u(_,this.h^v.h)};function Mt(v){for(var m=v.g.length+1,_=[],y=0;y<m;y++)_[y]=v.i(y)<<1|v.i(y-1)>>>31;return new u(_,v.h)}function at(v,m){var _=m>>5;m%=32;for(var y=v.g.length-_,T=[],A=0;A<y;A++)T[A]=0<m?v.i(A+_)>>>m|v.i(A+_+1)<<32-m:v.i(A+_);return new u(T,v.h)}n.prototype.digest=n.prototype.v,n.prototype.reset=n.prototype.s,n.prototype.update=n.prototype.u,ha=n,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=p,Xt=u}).apply(typeof oo<"u"?oo:typeof self<"u"?self:typeof window<"u"?window:{});var Gn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
|
9
|
+
*/function t(v,p){function _(){}_.prototype=p.prototype,v.D=p.prototype,v.prototype=new _,v.prototype.constructor=v,v.C=function(E,T,w){for(var g=Array(arguments.length-2),Ft=2;Ft<arguments.length;Ft++)g[Ft-2]=arguments[Ft];return p.prototype[T].apply(E,g)}}function e(){this.blockSize=-1}function n(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}t(n,e),n.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(v,p,_){_||(_=0);var E=Array(16);if(typeof p=="string")for(var T=0;16>T;++T)E[T]=p.charCodeAt(_++)|p.charCodeAt(_++)<<8|p.charCodeAt(_++)<<16|p.charCodeAt(_++)<<24;else for(T=0;16>T;++T)E[T]=p[_++]|p[_++]<<8|p[_++]<<16|p[_++]<<24;p=v.g[0],_=v.g[1],T=v.g[2];var w=v.g[3],g=p+(w^_&(T^w))+E[0]+3614090360&4294967295;p=_+(g<<7&4294967295|g>>>25),g=w+(T^p&(_^T))+E[1]+3905402710&4294967295,w=p+(g<<12&4294967295|g>>>20),g=T+(_^w&(p^_))+E[2]+606105819&4294967295,T=w+(g<<17&4294967295|g>>>15),g=_+(p^T&(w^p))+E[3]+3250441966&4294967295,_=T+(g<<22&4294967295|g>>>10),g=p+(w^_&(T^w))+E[4]+4118548399&4294967295,p=_+(g<<7&4294967295|g>>>25),g=w+(T^p&(_^T))+E[5]+1200080426&4294967295,w=p+(g<<12&4294967295|g>>>20),g=T+(_^w&(p^_))+E[6]+2821735955&4294967295,T=w+(g<<17&4294967295|g>>>15),g=_+(p^T&(w^p))+E[7]+4249261313&4294967295,_=T+(g<<22&4294967295|g>>>10),g=p+(w^_&(T^w))+E[8]+1770035416&4294967295,p=_+(g<<7&4294967295|g>>>25),g=w+(T^p&(_^T))+E[9]+2336552879&4294967295,w=p+(g<<12&4294967295|g>>>20),g=T+(_^w&(p^_))+E[10]+4294925233&4294967295,T=w+(g<<17&4294967295|g>>>15),g=_+(p^T&(w^p))+E[11]+2304563134&4294967295,_=T+(g<<22&4294967295|g>>>10),g=p+(w^_&(T^w))+E[12]+1804603682&4294967295,p=_+(g<<7&4294967295|g>>>25),g=w+(T^p&(_^T))+E[13]+4254626195&4294967295,w=p+(g<<12&4294967295|g>>>20),g=T+(_^w&(p^_))+E[14]+2792965006&4294967295,T=w+(g<<17&4294967295|g>>>15),g=_+(p^T&(w^p))+E[15]+1236535329&4294967295,_=T+(g<<22&4294967295|g>>>10),g=p+(T^w&(_^T))+E[1]+4129170786&4294967295,p=_+(g<<5&4294967295|g>>>27),g=w+(_^T&(p^_))+E[6]+3225465664&4294967295,w=p+(g<<9&4294967295|g>>>23),g=T+(p^_&(w^p))+E[11]+643717713&4294967295,T=w+(g<<14&4294967295|g>>>18),g=_+(w^p&(T^w))+E[0]+3921069994&4294967295,_=T+(g<<20&4294967295|g>>>12),g=p+(T^w&(_^T))+E[5]+3593408605&4294967295,p=_+(g<<5&4294967295|g>>>27),g=w+(_^T&(p^_))+E[10]+38016083&4294967295,w=p+(g<<9&4294967295|g>>>23),g=T+(p^_&(w^p))+E[15]+3634488961&4294967295,T=w+(g<<14&4294967295|g>>>18),g=_+(w^p&(T^w))+E[4]+3889429448&4294967295,_=T+(g<<20&4294967295|g>>>12),g=p+(T^w&(_^T))+E[9]+568446438&4294967295,p=_+(g<<5&4294967295|g>>>27),g=w+(_^T&(p^_))+E[14]+3275163606&4294967295,w=p+(g<<9&4294967295|g>>>23),g=T+(p^_&(w^p))+E[3]+4107603335&4294967295,T=w+(g<<14&4294967295|g>>>18),g=_+(w^p&(T^w))+E[8]+1163531501&4294967295,_=T+(g<<20&4294967295|g>>>12),g=p+(T^w&(_^T))+E[13]+2850285829&4294967295,p=_+(g<<5&4294967295|g>>>27),g=w+(_^T&(p^_))+E[2]+4243563512&4294967295,w=p+(g<<9&4294967295|g>>>23),g=T+(p^_&(w^p))+E[7]+1735328473&4294967295,T=w+(g<<14&4294967295|g>>>18),g=_+(w^p&(T^w))+E[12]+2368359562&4294967295,_=T+(g<<20&4294967295|g>>>12),g=p+(_^T^w)+E[5]+4294588738&4294967295,p=_+(g<<4&4294967295|g>>>28),g=w+(p^_^T)+E[8]+2272392833&4294967295,w=p+(g<<11&4294967295|g>>>21),g=T+(w^p^_)+E[11]+1839030562&4294967295,T=w+(g<<16&4294967295|g>>>16),g=_+(T^w^p)+E[14]+4259657740&4294967295,_=T+(g<<23&4294967295|g>>>9),g=p+(_^T^w)+E[1]+2763975236&4294967295,p=_+(g<<4&4294967295|g>>>28),g=w+(p^_^T)+E[4]+1272893353&4294967295,w=p+(g<<11&4294967295|g>>>21),g=T+(w^p^_)+E[7]+4139469664&4294967295,T=w+(g<<16&4294967295|g>>>16),g=_+(T^w^p)+E[10]+3200236656&4294967295,_=T+(g<<23&4294967295|g>>>9),g=p+(_^T^w)+E[13]+681279174&4294967295,p=_+(g<<4&4294967295|g>>>28),g=w+(p^_^T)+E[0]+3936430074&4294967295,w=p+(g<<11&4294967295|g>>>21),g=T+(w^p^_)+E[3]+3572445317&4294967295,T=w+(g<<16&4294967295|g>>>16),g=_+(T^w^p)+E[6]+76029189&4294967295,_=T+(g<<23&4294967295|g>>>9),g=p+(_^T^w)+E[9]+3654602809&4294967295,p=_+(g<<4&4294967295|g>>>28),g=w+(p^_^T)+E[12]+3873151461&4294967295,w=p+(g<<11&4294967295|g>>>21),g=T+(w^p^_)+E[15]+530742520&4294967295,T=w+(g<<16&4294967295|g>>>16),g=_+(T^w^p)+E[2]+3299628645&4294967295,_=T+(g<<23&4294967295|g>>>9),g=p+(T^(_|~w))+E[0]+4096336452&4294967295,p=_+(g<<6&4294967295|g>>>26),g=w+(_^(p|~T))+E[7]+1126891415&4294967295,w=p+(g<<10&4294967295|g>>>22),g=T+(p^(w|~_))+E[14]+2878612391&4294967295,T=w+(g<<15&4294967295|g>>>17),g=_+(w^(T|~p))+E[5]+4237533241&4294967295,_=T+(g<<21&4294967295|g>>>11),g=p+(T^(_|~w))+E[12]+1700485571&4294967295,p=_+(g<<6&4294967295|g>>>26),g=w+(_^(p|~T))+E[3]+2399980690&4294967295,w=p+(g<<10&4294967295|g>>>22),g=T+(p^(w|~_))+E[10]+4293915773&4294967295,T=w+(g<<15&4294967295|g>>>17),g=_+(w^(T|~p))+E[1]+2240044497&4294967295,_=T+(g<<21&4294967295|g>>>11),g=p+(T^(_|~w))+E[8]+1873313359&4294967295,p=_+(g<<6&4294967295|g>>>26),g=w+(_^(p|~T))+E[15]+4264355552&4294967295,w=p+(g<<10&4294967295|g>>>22),g=T+(p^(w|~_))+E[6]+2734768916&4294967295,T=w+(g<<15&4294967295|g>>>17),g=_+(w^(T|~p))+E[13]+1309151649&4294967295,_=T+(g<<21&4294967295|g>>>11),g=p+(T^(_|~w))+E[4]+4149444226&4294967295,p=_+(g<<6&4294967295|g>>>26),g=w+(_^(p|~T))+E[11]+3174756917&4294967295,w=p+(g<<10&4294967295|g>>>22),g=T+(p^(w|~_))+E[2]+718787259&4294967295,T=w+(g<<15&4294967295|g>>>17),g=_+(w^(T|~p))+E[9]+3951481745&4294967295,v.g[0]=v.g[0]+p&4294967295,v.g[1]=v.g[1]+(T+(g<<21&4294967295|g>>>11))&4294967295,v.g[2]=v.g[2]+T&4294967295,v.g[3]=v.g[3]+w&4294967295}n.prototype.u=function(v,p){p===void 0&&(p=v.length);for(var _=p-this.blockSize,E=this.B,T=this.h,w=0;w<p;){if(T==0)for(;w<=_;)i(this,v,w),w+=this.blockSize;if(typeof v=="string"){for(;w<p;)if(E[T++]=v.charCodeAt(w++),T==this.blockSize){i(this,E),T=0;break}}else for(;w<p;)if(E[T++]=v[w++],T==this.blockSize){i(this,E),T=0;break}}this.h=T,this.o+=p},n.prototype.v=function(){var v=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);v[0]=128;for(var p=1;p<v.length-8;++p)v[p]=0;var _=8*this.o;for(p=v.length-8;p<v.length;++p)v[p]=_&255,_/=256;for(this.u(v),v=Array(16),p=_=0;4>p;++p)for(var E=0;32>E;E+=8)v[_++]=this.g[p]>>>E&255;return v};function o(v,p){var _=c;return Object.prototype.hasOwnProperty.call(_,v)?_[v]:_[v]=p(v)}function u(v,p){this.h=p;for(var _=[],E=!0,T=v.length-1;0<=T;T--){var w=v[T]|0;E&&w==p||(_[T]=w,E=!1)}this.g=_}var c={};function h(v){return-128<=v&&128>v?o(v,function(p){return new u([p|0],0>p?-1:0)}):new u([v|0],0>v?-1:0)}function f(v){if(isNaN(v)||!isFinite(v))return y;if(0>v)return D(f(-v));for(var p=[],_=1,E=0;v>=_;E++)p[E]=v/_|0,_*=4294967296;return new u(p,0)}function m(v,p){if(v.length==0)throw Error("number format error: empty string");if(p=p||10,2>p||36<p)throw Error("radix out of range: "+p);if(v.charAt(0)=="-")return D(m(v.substring(1),p));if(0<=v.indexOf("-"))throw Error('number format error: interior "-" character');for(var _=f(Math.pow(p,8)),E=y,T=0;T<v.length;T+=8){var w=Math.min(8,v.length-T),g=parseInt(v.substring(T,T+w),p);8>w?(w=f(Math.pow(p,w)),E=E.j(w).add(f(g))):(E=E.j(_),E=E.add(f(g)))}return E}var y=h(0),A=h(1),S=h(16777216);r=u.prototype,r.m=function(){if(x(this))return-D(this).m();for(var v=0,p=1,_=0;_<this.g.length;_++){var E=this.i(_);v+=(0<=E?E:4294967296+E)*p,p*=4294967296}return v},r.toString=function(v){if(v=v||10,2>v||36<v)throw Error("radix out of range: "+v);if(C(this))return"0";if(x(this))return"-"+D(this).toString(v);for(var p=f(Math.pow(v,6)),_=this,E="";;){var T=it(_,p).g;_=q(_,T.j(p));var w=((0<_.g.length?_.g[0]:_.h)>>>0).toString(v);if(_=T,C(_))return w+E;for(;6>w.length;)w="0"+w;E=w+E}},r.i=function(v){return 0>v?0:v<this.g.length?this.g[v]:this.h};function C(v){if(v.h!=0)return!1;for(var p=0;p<v.g.length;p++)if(v.g[p]!=0)return!1;return!0}function x(v){return v.h==-1}r.l=function(v){return v=q(this,v),x(v)?-1:C(v)?0:1};function D(v){for(var p=v.g.length,_=[],E=0;E<p;E++)_[E]=~v.g[E];return new u(_,~v.h).add(A)}r.abs=function(){return x(this)?D(this):this},r.add=function(v){for(var p=Math.max(this.g.length,v.g.length),_=[],E=0,T=0;T<=p;T++){var w=E+(this.i(T)&65535)+(v.i(T)&65535),g=(w>>>16)+(this.i(T)>>>16)+(v.i(T)>>>16);E=g>>>16,w&=65535,g&=65535,_[T]=g<<16|w}return new u(_,_[_.length-1]&-2147483648?-1:0)};function q(v,p){return v.add(D(p))}r.j=function(v){if(C(this)||C(v))return y;if(x(this))return x(v)?D(this).j(D(v)):D(D(this).j(v));if(x(v))return D(this.j(D(v)));if(0>this.l(S)&&0>v.l(S))return f(this.m()*v.m());for(var p=this.g.length+v.g.length,_=[],E=0;E<2*p;E++)_[E]=0;for(E=0;E<this.g.length;E++)for(var T=0;T<v.g.length;T++){var w=this.i(E)>>>16,g=this.i(E)&65535,Ft=v.i(T)>>>16,Le=v.i(T)&65535;_[2*E+2*T]+=g*Le,z(_,2*E+2*T),_[2*E+2*T+1]+=w*Le,z(_,2*E+2*T+1),_[2*E+2*T+1]+=g*Ft,z(_,2*E+2*T+1),_[2*E+2*T+2]+=w*Ft,z(_,2*E+2*T+2)}for(E=0;E<p;E++)_[E]=_[2*E+1]<<16|_[2*E];for(E=p;E<2*p;E++)_[E]=0;return new u(_,0)};function z(v,p){for(;(v[p]&65535)!=v[p];)v[p+1]+=v[p]>>>16,v[p]&=65535,p++}function K(v,p){this.g=v,this.h=p}function it(v,p){if(C(p))throw Error("division by zero");if(C(v))return new K(y,y);if(x(v))return p=it(D(v),p),new K(D(p.g),D(p.h));if(x(p))return p=it(v,D(p)),new K(D(p.g),p.h);if(30<v.g.length){if(x(v)||x(p))throw Error("slowDivide_ only works with positive integers.");for(var _=A,E=p;0>=E.l(v);)_=Mt(_),E=Mt(E);var T=at(_,1),w=at(E,1);for(E=at(E,2),_=at(_,2);!C(E);){var g=w.add(E);0>=g.l(v)&&(T=T.add(_),w=g),E=at(E,1),_=at(_,1)}return p=q(v,T.j(p)),new K(T,p)}for(T=y;0<=v.l(p);){for(_=Math.max(1,Math.floor(v.m()/p.m())),E=Math.ceil(Math.log(_)/Math.LN2),E=48>=E?1:Math.pow(2,E-48),w=f(_),g=w.j(p);x(g)||0<g.l(v);)_-=E,w=f(_),g=w.j(p);C(w)&&(w=A),T=T.add(w),v=q(v,g)}return new K(T,v)}r.A=function(v){return it(this,v).h},r.and=function(v){for(var p=Math.max(this.g.length,v.g.length),_=[],E=0;E<p;E++)_[E]=this.i(E)&v.i(E);return new u(_,this.h&v.h)},r.or=function(v){for(var p=Math.max(this.g.length,v.g.length),_=[],E=0;E<p;E++)_[E]=this.i(E)|v.i(E);return new u(_,this.h|v.h)},r.xor=function(v){for(var p=Math.max(this.g.length,v.g.length),_=[],E=0;E<p;E++)_[E]=this.i(E)^v.i(E);return new u(_,this.h^v.h)};function Mt(v){for(var p=v.g.length+1,_=[],E=0;E<p;E++)_[E]=v.i(E)<<1|v.i(E-1)>>>31;return new u(_,v.h)}function at(v,p){var _=p>>5;p%=32;for(var E=v.g.length-_,T=[],w=0;w<E;w++)T[w]=0<p?v.i(w+_)>>>p|v.i(w+_+1)<<32-p:v.i(w+_);return new u(T,v.h)}n.prototype.digest=n.prototype.v,n.prototype.reset=n.prototype.s,n.prototype.update=n.prototype.u,Ia=n,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=m,Xt=u}).apply(typeof mo<"u"?mo:typeof self<"u"?self:typeof window<"u"?window:{});var Qn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
|
|
10
10
|
Copyright The Closure Library Authors.
|
|
11
11
|
SPDX-License-Identifier: Apache-2.0
|
|
12
|
-
*/var
|
|
12
|
+
*/var Aa,nn,wa,Jn,ls,Ra,Pa,Va;(function(){var r,t=typeof Object.defineProperties=="function"?Object.defineProperty:function(s,a,l){return s==Array.prototype||s==Object.prototype||(s[a]=l.value),s};function e(s){s=[typeof globalThis=="object"&&globalThis,s,typeof window=="object"&&window,typeof self=="object"&&self,typeof Qn=="object"&&Qn];for(var a=0;a<s.length;++a){var l=s[a];if(l&&l.Math==Math)return l}throw Error("Cannot find global object")}var n=e(this);function i(s,a){if(a)t:{var l=n;s=s.split(".");for(var d=0;d<s.length-1;d++){var I=s[d];if(!(I in l))break t;l=l[I]}s=s[s.length-1],d=l[s],a=a(d),a!=d&&a!=null&&t(l,s,{configurable:!0,writable:!0,value:a})}}function o(s,a){s instanceof String&&(s+="");var l=0,d=!1,I={next:function(){if(!d&&l<s.length){var R=l++;return{value:a(R,s[R]),done:!1}}return d=!0,{done:!0,value:void 0}}};return I[Symbol.iterator]=function(){return I},I}i("Array.prototype.values",function(s){return s||function(){return o(this,function(a,l){return l})}});/** @license
|
|
13
13
|
|
|
14
14
|
Copyright The Closure Library Authors.
|
|
15
15
|
SPDX-License-Identifier: Apache-2.0
|
|
16
|
-
*/var u=u||{},c=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 p(s,a,l){return s.call.apply(s.bind,arguments)}function E(s,a,l){if(!s)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var I=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(I,d),s.apply(a,I)}}return function(){return s.apply(a,arguments)}}function R(s,a,l){return R=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?p:E,R.apply(null,arguments)}function S(s,a){var l=Array.prototype.slice.call(arguments,1);return function(){var d=l.slice();return d.push.apply(d,arguments),s.apply(this,d)}}function D(s,a){function l(){}l.prototype=a.prototype,s.aa=a.prototype,s.prototype=new l,s.prototype.constructor=s,s.Qb=function(d,I,w){for(var C=Array(arguments.length-2),Q=2;Q<arguments.length;Q++)C[Q-2]=arguments[Q];return a.prototype[I].apply(d,C)}}function x(s){const a=s.length;if(0<a){const l=Array(a);for(let d=0;d<a;d++)l[d]=s[d];return l}return[]}function b(s,a){for(let l=1;l<arguments.length;l++){const d=arguments[l];if(h(d)){const I=s.length||0,w=d.length||0;s.length=I+w;for(let C=0;C<w;C++)s[I+C]=d[C]}else s.push(d)}}class ${constructor(a,l){this.i=a,this.j=l,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 K(){var s=c.navigator;return s&&(s=s.userAgent)?s:""}function it(s){return it[" "](s),s}it[" "]=function(){};var Mt=K().indexOf("Gecko")!=-1&&!(K().toLowerCase().indexOf("webkit")!=-1&&K().indexOf("Edge")==-1)&&!(K().indexOf("Trident")!=-1||K().indexOf("MSIE")!=-1)&&K().indexOf("Edge")==-1;function at(s,a,l){for(const d in s)a.call(l,s[d],d,s)}function v(s,a){for(const l in s)a.call(void 0,s[l],l,s)}function m(s){const a={};for(const l in s)a[l]=s[l];return a}const _="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function y(s,a){let l,d;for(let I=1;I<arguments.length;I++){d=arguments[I];for(l in d)s[l]=d[l];for(let w=0;w<_.length;w++)l=_[w],Object.prototype.hasOwnProperty.call(d,l)&&(s[l]=d[l])}}function T(s){var a=1;s=s.split(":");const l=[];for(;0<a&&s.length;)l.push(s.shift()),a--;return s.length&&l.push(s.join(":")),l}function A(s){c.setTimeout(()=>{throw s},0)}function g(){var s=br;let a=null;return s.g&&(a=s.g,s.g=s.g.next,s.g||(s.h=null),a.next=null),a}class Ft{constructor(){this.h=this.g=null}add(a,l){const d=Fe.get();d.set(a,l),this.h?this.h.next=d:this.g=d,this.h=d}}var Fe=new $(()=>new Uu,s=>s.reset());class Uu{constructor(){this.next=this.g=this.h=null}set(a,l){this.h=a,this.g=l,this.next=null}reset(){this.next=this.g=this.h=null}}let Le,Ue=!1,br=new Ft,si=()=>{const s=c.Promise.resolve(void 0);Le=()=>{s.then(qu)}};var qu=()=>{for(var s;s=g();){try{s.h.call(s.g)}catch(l){A(l)}var a=Fe;a.j(s),100>a.h&&(a.h++,s.next=a.g,a.g=s)}Ue=!1};function Gt(){this.s=this.s,this.C=this.C}Gt.prototype.s=!1,Gt.prototype.ma=function(){this.s||(this.s=!0,this.N())},Gt.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 ju=(function(){if(!c.addEventListener||!Object.defineProperty)return!1;var s=!1,a=Object.defineProperty({},"passive",{get:function(){s=!0}});try{const l=()=>{};c.addEventListener("test",l,a),c.removeEventListener("test",l,a)}catch{}return s})();function qe(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 l=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(Mt){t:{try{it(a.nodeName);var I=!0;break t}catch{}I=!1}I||(a=null)}}else l=="mouseover"?a=s.fromElement:l=="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:Bu[s.pointerType]||"",this.state=s.state,this.i=s,s.defaultPrevented&&qe.aa.h.call(this)}}D(qe,dt);var Bu={2:"touch",3:"pen",4:"mouse"};qe.prototype.h=function(){qe.aa.h.call(this);var s=this.i;s.preventDefault?s.preventDefault():s.returnValue=!1};var Pn="closure_listenable_"+(1e6*Math.random()|0),zu=0;function $u(s,a,l,d,I){this.listener=s,this.proxy=null,this.src=a,this.type=l,this.capture=!!d,this.ha=I,this.key=++zu,this.da=this.fa=!1}function Vn(s){s.da=!0,s.listener=null,s.proxy=null,s.src=null,s.ha=null}function Sn(s){this.src=s,this.g={},this.h=0}Sn.prototype.add=function(s,a,l,d,I){var w=s.toString();s=this.g[w],s||(s=this.g[w]=[],this.h++);var C=Nr(s,a,d,I);return-1<C?(a=s[C],l||(a.fa=!1)):(a=new $u(a,this.src,w,!!d,I),a.fa=l,s.push(a)),a};function Dr(s,a){var l=a.type;if(l in s.g){var d=s.g[l],I=Array.prototype.indexOf.call(d,a,void 0),w;(w=0<=I)&&Array.prototype.splice.call(d,I,1),w&&(Vn(a),s.g[l].length==0&&(delete s.g[l],s.h--))}}function Nr(s,a,l,d){for(var I=0;I<s.length;++I){var w=s[I];if(!w.da&&w.listener==a&&w.capture==!!l&&w.ha==d)return I}return-1}var kr="closure_lm_"+(1e6*Math.random()|0),xr={};function ii(s,a,l,d,I){if(Array.isArray(a)){for(var w=0;w<a.length;w++)ii(s,a[w],l,d,I);return null}return l=ui(l),s&&s[Pn]?s.K(a,l,f(d)?!!d.capture:!1,I):Gu(s,a,l,!1,d,I)}function Gu(s,a,l,d,I,w){if(!a)throw Error("Invalid event type");var C=f(I)?!!I.capture:!!I,Q=Mr(s);if(Q||(s[kr]=Q=new Sn(s)),l=Q.add(a,l,d,C,w),l.proxy)return l;if(d=Ku(),l.proxy=d,d.src=s,d.listener=l,s.addEventListener)ju||(I=C),I===void 0&&(I=!1),s.addEventListener(a.toString(),d,I);else if(s.attachEvent)s.attachEvent(ai(a.toString()),d);else if(s.addListener&&s.removeListener)s.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");return l}function Ku(){function s(l){return a.call(s.src,s.listener,l)}const a=Qu;return s}function oi(s,a,l,d,I){if(Array.isArray(a))for(var w=0;w<a.length;w++)oi(s,a[w],l,d,I);else d=f(d)?!!d.capture:!!d,l=ui(l),s&&s[Pn]?(s=s.i,a=String(a).toString(),a in s.g&&(w=s.g[a],l=Nr(w,l,d,I),-1<l&&(Vn(w[l]),Array.prototype.splice.call(w,l,1),w.length==0&&(delete s.g[a],s.h--)))):s&&(s=Mr(s))&&(a=s.g[a.toString()],s=-1,a&&(s=Nr(a,l,d,I)),(l=-1<s?a[s]:null)&&Or(l))}function Or(s){if(typeof s!="number"&&s&&!s.da){var a=s.src;if(a&&a[Pn])Dr(a.i,s);else{var l=s.type,d=s.proxy;a.removeEventListener?a.removeEventListener(l,d,s.capture):a.detachEvent?a.detachEvent(ai(l),d):a.addListener&&a.removeListener&&a.removeListener(d),(l=Mr(a))?(Dr(l,s),l.h==0&&(l.src=null,a[kr]=null)):Vn(s)}}}function ai(s){return s in xr?xr[s]:xr[s]="on"+s}function Qu(s,a){if(s.da)s=!0;else{a=new qe(a,this);var l=s.listener,d=s.ha||s.src;s.fa&&Or(s),s=l.call(d,a)}return s}function Mr(s){return s=s[kr],s instanceof Sn?s:null}var Fr="__closure_events_fn_"+(1e9*Math.random()>>>0);function ui(s){return typeof s=="function"?s:(s[Fr]||(s[Fr]=function(a){return s.handleEvent(a)}),s[Fr])}function ft(){Gt.call(this),this.i=new Sn(this),this.M=this,this.F=null}D(ft,Gt),ft.prototype[Pn]=!0,ft.prototype.removeEventListener=function(s,a,l,d){oi(this,s,a,l,d)};function Et(s,a){var l,d=s.F;if(d)for(l=[];d;d=d.F)l.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 I=a;a=new dt(d,s),y(a,I)}if(I=!0,l)for(var w=l.length-1;0<=w;w--){var C=a.g=l[w];I=Cn(C,d,!0,a)&&I}if(C=a.g=s,I=Cn(C,d,!0,a)&&I,I=Cn(C,d,!1,a)&&I,l)for(w=0;w<l.length;w++)C=a.g=l[w],I=Cn(C,d,!1,a)&&I}ft.prototype.N=function(){if(ft.aa.N.call(this),this.i){var s=this.i,a;for(a in s.g){for(var l=s.g[a],d=0;d<l.length;d++)Vn(l[d]);delete s.g[a],s.h--}}this.F=null},ft.prototype.K=function(s,a,l,d){return this.i.add(String(s),a,!1,l,d)},ft.prototype.L=function(s,a,l,d){return this.i.add(String(s),a,!0,l,d)};function Cn(s,a,l,d){if(a=s.i.g[String(a)],!a)return!0;a=a.concat();for(var I=!0,w=0;w<a.length;++w){var C=a[w];if(C&&!C.da&&C.capture==l){var Q=C.listener,ut=C.ha||C.src;C.fa&&Dr(s.i,C),I=Q.call(ut,d)!==!1&&I}}return I&&!d.defaultPrevented}function li(s,a,l){if(typeof s=="function")l&&(s=R(s,l));else if(s&&typeof s.handleEvent=="function")s=R(s.handleEvent,s);else throw Error("Invalid listener argument");return 2147483647<Number(a)?-1:c.setTimeout(s,a||0)}function ci(s){s.g=li(()=>{s.g=null,s.i&&(s.i=!1,ci(s))},s.l);const a=s.h;s.h=null,s.m.apply(null,a)}class Wu extends Gt{constructor(a,l){super(),this.m=a,this.l=l,this.h=null,this.i=!1,this.g=null}j(a){this.h=arguments,this.g?this.i=!0:ci(this)}N(){super.N(),this.g&&(c.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function je(s){Gt.call(this),this.h=s,this.g={}}D(je,Gt);var hi=[];function di(s){at(s.g,function(a,l){this.g.hasOwnProperty(l)&&Or(a)},s),s.g={}}je.prototype.N=function(){je.aa.N.call(this),di(this)},je.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Lr=c.JSON.stringify,Hu=c.JSON.parse,Xu=class{stringify(s){return c.JSON.stringify(s,void 0)}parse(s){return c.JSON.parse(s,void 0)}};function Ur(){}Ur.prototype.h=null;function fi(s){return s.h||(s.h=s.i())}function mi(){}var Be={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function qr(){dt.call(this,"d")}D(qr,dt);function jr(){dt.call(this,"c")}D(jr,dt);var ae={},pi=null;function bn(){return pi=pi||new ft}ae.La="serverreachability";function gi(s){dt.call(this,ae.La,s)}D(gi,dt);function ze(s){const a=bn();Et(a,new gi(a))}ae.STAT_EVENT="statevent";function _i(s,a){dt.call(this,ae.STAT_EVENT,s),this.stat=a}D(_i,dt);function Tt(s){const a=bn();Et(a,new _i(a,s))}ae.Ma="timingevent";function yi(s,a){dt.call(this,ae.Ma,s),this.size=a}D(yi,dt);function $e(s,a){if(typeof s!="function")throw Error("Fn must not be null and must be a function");return c.setTimeout(function(){s()},a)}function Ge(){this.g=!0}Ge.prototype.xa=function(){this.g=!1};function Yu(s,a,l,d,I,w){s.info(function(){if(s.g)if(w)for(var C="",Q=w.split("&"),ut=0;ut<Q.length;ut++){var z=Q[ut].split("=");if(1<z.length){var mt=z[0];z=z[1];var pt=mt.split("_");C=2<=pt.length&&pt[1]=="type"?C+(mt+"="+z+"&"):C+(mt+"=redacted&")}}else C=null;else C=w;return"XMLHTTP REQ ("+d+") [attempt "+I+"]: "+a+`
|
|
16
|
+
*/var u=u||{},c=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 m(s,a,l){return s.call.apply(s.bind,arguments)}function y(s,a,l){if(!s)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var I=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(I,d),s.apply(a,I)}}return function(){return s.apply(a,arguments)}}function A(s,a,l){return A=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?m:y,A.apply(null,arguments)}function S(s,a){var l=Array.prototype.slice.call(arguments,1);return function(){var d=l.slice();return d.push.apply(d,arguments),s.apply(this,d)}}function C(s,a){function l(){}l.prototype=a.prototype,s.aa=a.prototype,s.prototype=new l,s.prototype.constructor=s,s.Qb=function(d,I,R){for(var b=Array(arguments.length-2),Q=2;Q<arguments.length;Q++)b[Q-2]=arguments[Q];return a.prototype[I].apply(d,b)}}function x(s){const a=s.length;if(0<a){const l=Array(a);for(let d=0;d<a;d++)l[d]=s[d];return l}return[]}function D(s,a){for(let l=1;l<arguments.length;l++){const d=arguments[l];if(h(d)){const I=s.length||0,R=d.length||0;s.length=I+R;for(let b=0;b<R;b++)s[I+b]=d[b]}else s.push(d)}}class q{constructor(a,l){this.i=a,this.j=l,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 z(s){return/^[\s\xa0]*$/.test(s)}function K(){var s=c.navigator;return s&&(s=s.userAgent)?s:""}function it(s){return it[" "](s),s}it[" "]=function(){};var Mt=K().indexOf("Gecko")!=-1&&!(K().toLowerCase().indexOf("webkit")!=-1&&K().indexOf("Edge")==-1)&&!(K().indexOf("Trident")!=-1||K().indexOf("MSIE")!=-1)&&K().indexOf("Edge")==-1;function at(s,a,l){for(const d in s)a.call(l,s[d],d,s)}function v(s,a){for(const l in s)a.call(void 0,s[l],l,s)}function p(s){const a={};for(const l in s)a[l]=s[l];return a}const _="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function E(s,a){let l,d;for(let I=1;I<arguments.length;I++){d=arguments[I];for(l in d)s[l]=d[l];for(let R=0;R<_.length;R++)l=_[R],Object.prototype.hasOwnProperty.call(d,l)&&(s[l]=d[l])}}function T(s){var a=1;s=s.split(":");const l=[];for(;0<a&&s.length;)l.push(s.shift()),a--;return s.length&&l.push(s.join(":")),l}function w(s){c.setTimeout(()=>{throw s},0)}function g(){var s=kr;let a=null;return s.g&&(a=s.g,s.g=s.g.next,s.g||(s.h=null),a.next=null),a}class Ft{constructor(){this.h=this.g=null}add(a,l){const d=Le.get();d.set(a,l),this.h?this.h.next=d:this.g=d,this.h=d}}var Le=new q(()=>new Ju,s=>s.reset());class Ju{constructor(){this.next=this.g=this.h=null}set(a,l){this.h=a,this.g=l,this.next=null}reset(){this.next=this.g=this.h=null}}let Ue,qe=!1,kr=new Ft,hi=()=>{const s=c.Promise.resolve(void 0);Ue=()=>{s.then(Zu)}};var Zu=()=>{for(var s;s=g();){try{s.h.call(s.g)}catch(l){w(l)}var a=Le;a.j(s),100>a.h&&(a.h++,s.next=a.g,a.g=s)}qe=!1};function Gt(){this.s=this.s,this.C=this.C}Gt.prototype.s=!1,Gt.prototype.ma=function(){this.s||(this.s=!0,this.N())},Gt.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 tl=(function(){if(!c.addEventListener||!Object.defineProperty)return!1;var s=!1,a=Object.defineProperty({},"passive",{get:function(){s=!0}});try{const l=()=>{};c.addEventListener("test",l,a),c.removeEventListener("test",l,a)}catch{}return s})();function je(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 l=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(Mt){t:{try{it(a.nodeName);var I=!0;break t}catch{}I=!1}I||(a=null)}}else l=="mouseover"?a=s.fromElement:l=="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:el[s.pointerType]||"",this.state=s.state,this.i=s,s.defaultPrevented&&je.aa.h.call(this)}}C(je,dt);var el={2:"touch",3:"pen",4:"mouse"};je.prototype.h=function(){je.aa.h.call(this);var s=this.i;s.preventDefault?s.preventDefault():s.returnValue=!1};var Sn="closure_listenable_"+(1e6*Math.random()|0),nl=0;function rl(s,a,l,d,I){this.listener=s,this.proxy=null,this.src=a,this.type=l,this.capture=!!d,this.ha=I,this.key=++nl,this.da=this.fa=!1}function Cn(s){s.da=!0,s.listener=null,s.proxy=null,s.src=null,s.ha=null}function bn(s){this.src=s,this.g={},this.h=0}bn.prototype.add=function(s,a,l,d,I){var R=s.toString();s=this.g[R],s||(s=this.g[R]=[],this.h++);var b=Or(s,a,d,I);return-1<b?(a=s[b],l||(a.fa=!1)):(a=new rl(a,this.src,R,!!d,I),a.fa=l,s.push(a)),a};function xr(s,a){var l=a.type;if(l in s.g){var d=s.g[l],I=Array.prototype.indexOf.call(d,a,void 0),R;(R=0<=I)&&Array.prototype.splice.call(d,I,1),R&&(Cn(a),s.g[l].length==0&&(delete s.g[l],s.h--))}}function Or(s,a,l,d){for(var I=0;I<s.length;++I){var R=s[I];if(!R.da&&R.listener==a&&R.capture==!!l&&R.ha==d)return I}return-1}var Mr="closure_lm_"+(1e6*Math.random()|0),Fr={};function di(s,a,l,d,I){if(Array.isArray(a)){for(var R=0;R<a.length;R++)di(s,a[R],l,d,I);return null}return l=pi(l),s&&s[Sn]?s.K(a,l,f(d)?!!d.capture:!1,I):sl(s,a,l,!1,d,I)}function sl(s,a,l,d,I,R){if(!a)throw Error("Invalid event type");var b=f(I)?!!I.capture:!!I,Q=Ur(s);if(Q||(s[Mr]=Q=new bn(s)),l=Q.add(a,l,d,b,R),l.proxy)return l;if(d=il(),l.proxy=d,d.src=s,d.listener=l,s.addEventListener)tl||(I=b),I===void 0&&(I=!1),s.addEventListener(a.toString(),d,I);else if(s.attachEvent)s.attachEvent(mi(a.toString()),d);else if(s.addListener&&s.removeListener)s.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");return l}function il(){function s(l){return a.call(s.src,s.listener,l)}const a=ol;return s}function fi(s,a,l,d,I){if(Array.isArray(a))for(var R=0;R<a.length;R++)fi(s,a[R],l,d,I);else d=f(d)?!!d.capture:!!d,l=pi(l),s&&s[Sn]?(s=s.i,a=String(a).toString(),a in s.g&&(R=s.g[a],l=Or(R,l,d,I),-1<l&&(Cn(R[l]),Array.prototype.splice.call(R,l,1),R.length==0&&(delete s.g[a],s.h--)))):s&&(s=Ur(s))&&(a=s.g[a.toString()],s=-1,a&&(s=Or(a,l,d,I)),(l=-1<s?a[s]:null)&&Lr(l))}function Lr(s){if(typeof s!="number"&&s&&!s.da){var a=s.src;if(a&&a[Sn])xr(a.i,s);else{var l=s.type,d=s.proxy;a.removeEventListener?a.removeEventListener(l,d,s.capture):a.detachEvent?a.detachEvent(mi(l),d):a.addListener&&a.removeListener&&a.removeListener(d),(l=Ur(a))?(xr(l,s),l.h==0&&(l.src=null,a[Mr]=null)):Cn(s)}}}function mi(s){return s in Fr?Fr[s]:Fr[s]="on"+s}function ol(s,a){if(s.da)s=!0;else{a=new je(a,this);var l=s.listener,d=s.ha||s.src;s.fa&&Lr(s),s=l.call(d,a)}return s}function Ur(s){return s=s[Mr],s instanceof bn?s:null}var qr="__closure_events_fn_"+(1e9*Math.random()>>>0);function pi(s){return typeof s=="function"?s:(s[qr]||(s[qr]=function(a){return s.handleEvent(a)}),s[qr])}function ft(){Gt.call(this),this.i=new bn(this),this.M=this,this.F=null}C(ft,Gt),ft.prototype[Sn]=!0,ft.prototype.removeEventListener=function(s,a,l,d){fi(this,s,a,l,d)};function Et(s,a){var l,d=s.F;if(d)for(l=[];d;d=d.F)l.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 I=a;a=new dt(d,s),E(a,I)}if(I=!0,l)for(var R=l.length-1;0<=R;R--){var b=a.g=l[R];I=Dn(b,d,!0,a)&&I}if(b=a.g=s,I=Dn(b,d,!0,a)&&I,I=Dn(b,d,!1,a)&&I,l)for(R=0;R<l.length;R++)b=a.g=l[R],I=Dn(b,d,!1,a)&&I}ft.prototype.N=function(){if(ft.aa.N.call(this),this.i){var s=this.i,a;for(a in s.g){for(var l=s.g[a],d=0;d<l.length;d++)Cn(l[d]);delete s.g[a],s.h--}}this.F=null},ft.prototype.K=function(s,a,l,d){return this.i.add(String(s),a,!1,l,d)},ft.prototype.L=function(s,a,l,d){return this.i.add(String(s),a,!0,l,d)};function Dn(s,a,l,d){if(a=s.i.g[String(a)],!a)return!0;a=a.concat();for(var I=!0,R=0;R<a.length;++R){var b=a[R];if(b&&!b.da&&b.capture==l){var Q=b.listener,ut=b.ha||b.src;b.fa&&xr(s.i,b),I=Q.call(ut,d)!==!1&&I}}return I&&!d.defaultPrevented}function gi(s,a,l){if(typeof s=="function")l&&(s=A(s,l));else if(s&&typeof s.handleEvent=="function")s=A(s.handleEvent,s);else throw Error("Invalid listener argument");return 2147483647<Number(a)?-1:c.setTimeout(s,a||0)}function _i(s){s.g=gi(()=>{s.g=null,s.i&&(s.i=!1,_i(s))},s.l);const a=s.h;s.h=null,s.m.apply(null,a)}class al extends Gt{constructor(a,l){super(),this.m=a,this.l=l,this.h=null,this.i=!1,this.g=null}j(a){this.h=arguments,this.g?this.i=!0:_i(this)}N(){super.N(),this.g&&(c.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Be(s){Gt.call(this),this.h=s,this.g={}}C(Be,Gt);var yi=[];function Ei(s){at(s.g,function(a,l){this.g.hasOwnProperty(l)&&Lr(a)},s),s.g={}}Be.prototype.N=function(){Be.aa.N.call(this),Ei(this)},Be.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var jr=c.JSON.stringify,ul=c.JSON.parse,ll=class{stringify(s){return c.JSON.stringify(s,void 0)}parse(s){return c.JSON.parse(s,void 0)}};function Br(){}Br.prototype.h=null;function Ti(s){return s.h||(s.h=s.i())}function vi(){}var ze={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function zr(){dt.call(this,"d")}C(zr,dt);function $r(){dt.call(this,"c")}C($r,dt);var ae={},Ii=null;function Nn(){return Ii=Ii||new ft}ae.La="serverreachability";function Ai(s){dt.call(this,ae.La,s)}C(Ai,dt);function $e(s){const a=Nn();Et(a,new Ai(a))}ae.STAT_EVENT="statevent";function wi(s,a){dt.call(this,ae.STAT_EVENT,s),this.stat=a}C(wi,dt);function Tt(s){const a=Nn();Et(a,new wi(a,s))}ae.Ma="timingevent";function Ri(s,a){dt.call(this,ae.Ma,s),this.size=a}C(Ri,dt);function Ge(s,a){if(typeof s!="function")throw Error("Fn must not be null and must be a function");return c.setTimeout(function(){s()},a)}function Ke(){this.g=!0}Ke.prototype.xa=function(){this.g=!1};function cl(s,a,l,d,I,R){s.info(function(){if(s.g)if(R)for(var b="",Q=R.split("&"),ut=0;ut<Q.length;ut++){var $=Q[ut].split("=");if(1<$.length){var mt=$[0];$=$[1];var pt=mt.split("_");b=2<=pt.length&&pt[1]=="type"?b+(mt+"="+$+"&"):b+(mt+"=redacted&")}}else b=null;else b=R;return"XMLHTTP REQ ("+d+") [attempt "+I+"]: "+a+`
|
|
17
17
|
`+l+`
|
|
18
|
-
`+
|
|
18
|
+
`+b})}function hl(s,a,l,d,I,R,b){s.info(function(){return"XMLHTTP RESP ("+d+") [ attempt "+I+"]: "+a+`
|
|
19
19
|
`+l+`
|
|
20
|
-
`+
|
|
21
|
-
`,l);return d==-1?zr:(l=Number(a.substring(l,d)),isNaN(l)?vi:(d+=1,d+l>a.length?zr:(a=a.slice(d,d+l),s.C=d+l,a)))}Kt.prototype.cancel=function(){this.J=!0,ue(this)};function kn(s){s.S=Date.now()+s.I,wi(s,s.I)}function wi(s,a){if(s.B!=null)throw Error("WatchDog timer not null");s.B=$e(R(s.ba,s),a)}function Gr(s){s.B&&(c.clearTimeout(s.B),s.B=null)}Kt.prototype.ba=function(){this.B=null;const s=Date.now();0<=s-this.S?(Zu(this.i,this.A),this.L!=2&&(ze(),Tt(17)),ue(this),this.s=2,Ke(this)):wi(this,this.S-s)};function Ke(s){s.j.G==0||s.J||Xi(s.j,s)}function ue(s){Gr(s);var a=s.M;a&&typeof a.ma=="function"&&a.ma(),s.M=null,di(s.U),s.g&&(a=s.g,s.g=null,a.abort(),a.ma())}function Kr(s,a){try{var l=s.j;if(l.G!=0&&(l.g==s||Qr(l.h,s))){if(!s.K&&Qr(l.h,s)&&l.G==3){try{var d=l.Da.g.parse(a)}catch{d=null}if(Array.isArray(d)&&d.length==3){var I=d;if(I[0]==0){t:if(!l.u){if(l.g)if(l.g.F+3e3<s.F)Bn(l),qn(l);else break t;Yr(l),Tt(18)}}else l.za=I[1],0<l.za-l.T&&37500>I[2]&&l.F&&l.v==0&&!l.C&&(l.C=$e(R(l.Za,l),6e3));if(1>=Vi(l.h)&&l.ca){try{l.ca()}catch{}l.ca=void 0}}else ce(l,11)}else if((s.K||l.g==s)&&Bn(l),!B(a))for(I=l.Da.g.parse(a),a=0;a<I.length;a++){let z=I[a];if(l.T=z[0],z=z[1],l.G==2)if(z[0]=="c"){l.K=z[1],l.ia=z[2];const mt=z[3];mt!=null&&(l.la=mt,l.j.info("VER="+l.la));const pt=z[4];pt!=null&&(l.Aa=pt,l.j.info("SVER="+l.Aa));const ve=z[5];ve!=null&&typeof ve=="number"&&0<ve&&(d=1.5*ve,l.L=d,l.j.info("backChannelRequestTimeoutMs_="+d)),d=l;const Pt=s.g;if(Pt){const $n=Pt.g?Pt.g.getResponseHeader("X-Client-Wire-Protocol"):null;if($n){var w=d.h;w.g||$n.indexOf("spdy")==-1&&$n.indexOf("quic")==-1&&$n.indexOf("h2")==-1||(w.j=w.l,w.g=new Set,w.h&&(Wr(w,w.h),w.h=null))}if(d.D){const Zr=Pt.g?Pt.g.getResponseHeader("X-HTTP-Session-Id"):null;Zr&&(d.ya=Zr,H(d.I,d.D,Zr))}}l.G=3,l.l&&l.l.ua(),l.ba&&(l.R=Date.now()-s.F,l.j.info("Handshake RTT: "+l.R+"ms")),d=l;var C=s;if(d.qa=Zi(d,d.J?d.ia:null,d.W),C.K){Si(d.h,C);var Q=C,ut=d.L;ut&&(Q.I=ut),Q.B&&(Gr(Q),kn(Q)),d.g=C}else Wi(d);0<l.i.length&&jn(l)}else z[0]!="stop"&&z[0]!="close"||ce(l,7);else l.G==3&&(z[0]=="stop"||z[0]=="close"?z[0]=="stop"?ce(l,7):Xr(l):z[0]!="noop"&&l.l&&l.l.ta(z),l.v=0)}}ze(4)}catch{}}var nl=class{constructor(s,a){this.g=s,this.map=a}};function Ri(s){this.l=s||10,c.PerformanceNavigationTiming?(s=c.performance.getEntriesByType("navigation"),s=0<s.length&&(s[0].nextHopProtocol=="hq"||s[0].nextHopProtocol=="h2")):s=!!(c.chrome&&c.chrome.loadTimes&&c.chrome.loadTimes()&&c.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 Pi(s){return s.h?!0:s.g?s.g.size>=s.j:!1}function Vi(s){return s.h?1:s.g?s.g.size:0}function Qr(s,a){return s.h?s.h==a:s.g?s.g.has(a):!1}function Wr(s,a){s.g?s.g.add(a):s.h=a}function Si(s,a){s.h&&s.h==a?s.h=null:s.g&&s.g.has(a)&&s.g.delete(a)}Ri.prototype.cancel=function(){if(this.i=Ci(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const s of this.g.values())s.cancel();this.g.clear()}};function Ci(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(const l of s.g.values())a=a.concat(l.D);return a}return x(s.i)}function rl(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=[],l=s.length,d=0;d<l;d++)a.push(s[d]);return a}a=[],l=0;for(d in s)a[l++]=s[d];return a}function sl(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 l=0;l<s;l++)a.push(l);return a}a=[],l=0;for(const d in s)a[l++]=d;return a}}}function bi(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 l=sl(s),d=rl(s),I=d.length,w=0;w<I;w++)a.call(void 0,d[w],l&&l[w],s)}var Di=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function il(s,a){if(s){s=s.split("&");for(var l=0;l<s.length;l++){var d=s[l].indexOf("="),I=null;if(0<=d){var w=s[l].substring(0,d);I=s[l].substring(d+1)}else w=s[l];a(w,I?decodeURIComponent(I.replace(/\+/g," ")):"")}}}function le(s){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,s instanceof le){this.h=s.h,xn(this,s.j),this.o=s.o,this.g=s.g,On(this,s.s),this.l=s.l;var a=s.i,l=new He;l.i=a.i,a.g&&(l.g=new Map(a.g),l.h=a.h),Ni(this,l),this.m=s.m}else s&&(a=String(s).match(Di))?(this.h=!1,xn(this,a[1]||"",!0),this.o=Qe(a[2]||""),this.g=Qe(a[3]||"",!0),On(this,a[4]),this.l=Qe(a[5]||"",!0),Ni(this,a[6]||"",!0),this.m=Qe(a[7]||"")):(this.h=!1,this.i=new He(null,this.h))}le.prototype.toString=function(){var s=[],a=this.j;a&&s.push(We(a,ki,!0),":");var l=this.g;return(l||a=="file")&&(s.push("//"),(a=this.o)&&s.push(We(a,ki,!0),"@"),s.push(encodeURIComponent(String(l)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),l=this.s,l!=null&&s.push(":",String(l))),(l=this.l)&&(this.g&&l.charAt(0)!="/"&&s.push("/"),s.push(We(l,l.charAt(0)=="/"?ul:al,!0))),(l=this.i.toString())&&s.push("?",l),(l=this.m)&&s.push("#",We(l,cl)),s.join("")};function Lt(s){return new le(s)}function xn(s,a,l){s.j=l?Qe(a,!0):a,s.j&&(s.j=s.j.replace(/:$/,""))}function On(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 Ni(s,a,l){a instanceof He?(s.i=a,hl(s.i,s.h)):(l||(a=We(a,ll)),s.i=new He(a,s.h))}function H(s,a,l){s.i.set(a,l)}function Mn(s){return H(s,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),s}function Qe(s,a){return s?a?decodeURI(s.replace(/%25/g,"%2525")):decodeURIComponent(s):""}function We(s,a,l){return typeof s=="string"?(s=encodeURI(s).replace(a,ol),l&&(s=s.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),s):null}function ol(s){return s=s.charCodeAt(0),"%"+(s>>4&15).toString(16)+(s&15).toString(16)}var ki=/[#\/\?@]/g,al=/[#\?:]/g,ul=/[#\?]/g,ll=/[#\?@]/g,cl=/#/g;function He(s,a){this.h=this.g=null,this.i=s||null,this.j=!!a}function Qt(s){s.g||(s.g=new Map,s.h=0,s.i&&il(s.i,function(a,l){s.add(decodeURIComponent(a.replace(/\+/g," ")),l)}))}r=He.prototype,r.add=function(s,a){Qt(this),this.i=null,s=Ee(this,s);var l=this.g.get(s);return l||this.g.set(s,l=[]),l.push(a),this.h+=1,this};function xi(s,a){Qt(s),a=Ee(s,a),s.g.has(a)&&(s.i=null,s.h-=s.g.get(a).length,s.g.delete(a))}function Oi(s,a){return Qt(s),a=Ee(s,a),s.g.has(a)}r.forEach=function(s,a){Qt(this),this.g.forEach(function(l,d){l.forEach(function(I){s.call(a,I,d,this)},this)},this)},r.na=function(){Qt(this);const s=Array.from(this.g.values()),a=Array.from(this.g.keys()),l=[];for(let d=0;d<a.length;d++){const I=s[d];for(let w=0;w<I.length;w++)l.push(a[d])}return l},r.V=function(s){Qt(this);let a=[];if(typeof s=="string")Oi(this,s)&&(a=a.concat(this.g.get(Ee(this,s))));else{s=Array.from(this.g.values());for(let l=0;l<s.length;l++)a=a.concat(s[l])}return a},r.set=function(s,a){return Qt(this),this.i=null,s=Ee(this,s),Oi(this,s)&&(this.h-=this.g.get(s).length),this.g.set(s,[a]),this.h+=1,this},r.get=function(s,a){return s?(s=this.V(s),0<s.length?String(s[0]):a):a};function Mi(s,a,l){xi(s,a),0<l.length&&(s.i=null,s.g.set(Ee(s,a),x(l)),s.h+=l.length)}r.toString=function(){if(this.i)return this.i;if(!this.g)return"";const s=[],a=Array.from(this.g.keys());for(var l=0;l<a.length;l++){var d=a[l];const w=encodeURIComponent(String(d)),C=this.V(d);for(d=0;d<C.length;d++){var I=w;C[d]!==""&&(I+="="+encodeURIComponent(String(C[d]))),s.push(I)}}return this.i=s.join("&")};function Ee(s,a){return a=String(a),s.j&&(a=a.toLowerCase()),a}function hl(s,a){a&&!s.j&&(Qt(s),s.i=null,s.g.forEach(function(l,d){var I=d.toLowerCase();d!=I&&(xi(this,d),Mi(this,I,l))},s)),s.j=a}function dl(s,a){const l=new Ge;if(c.Image){const d=new Image;d.onload=S(Wt,l,"TestLoadImage: loaded",!0,a,d),d.onerror=S(Wt,l,"TestLoadImage: error",!1,a,d),d.onabort=S(Wt,l,"TestLoadImage: abort",!1,a,d),d.ontimeout=S(Wt,l,"TestLoadImage: timeout",!1,a,d),c.setTimeout(function(){d.ontimeout&&d.ontimeout()},1e4),d.src=s}else a(!1)}function fl(s,a){const l=new Ge,d=new AbortController,I=setTimeout(()=>{d.abort(),Wt(l,"TestPingServer: timeout",!1,a)},1e4);fetch(s,{signal:d.signal}).then(w=>{clearTimeout(I),w.ok?Wt(l,"TestPingServer: ok",!0,a):Wt(l,"TestPingServer: server error",!1,a)}).catch(()=>{clearTimeout(I),Wt(l,"TestPingServer: error",!1,a)})}function Wt(s,a,l,d,I){try{I&&(I.onload=null,I.onerror=null,I.onabort=null,I.ontimeout=null),d(l)}catch{}}function ml(){this.g=new Xu}function pl(s,a,l){const d=l||"";try{bi(s,function(I,w){let C=I;f(I)&&(C=Lr(I)),a.push(d+w+"="+encodeURIComponent(C))})}catch(I){throw a.push(d+"type="+encodeURIComponent("_badmap")),I}}function Fn(s){this.l=s.Ub||null,this.j=s.eb||!1}D(Fn,Ur),Fn.prototype.g=function(){return new Ln(this.l,this.j)},Fn.prototype.i=(function(s){return function(){return s}})({});function Ln(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(Ln,ft),r=Ln.prototype,r.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,Ye(this)},r.send=function(s){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const a={headers:this.u,method:this.B,credentials:this.m,cache:void 0};s&&(a.body=s),(this.D||c).fetch(new Request(this.A,a)).then(this.Sa.bind(this),this.ga.bind(this))},r.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,Xe(this)),this.readyState=0},r.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,Ye(this)),this.g&&(this.readyState=3,Ye(this),this.g)))if(this.responseType==="arraybuffer")s.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof c.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;Fi(this)}else s.text().then(this.Ra.bind(this),this.ga.bind(this))};function Fi(s){s.j.read().then(s.Pa.bind(s)).catch(s.ga.bind(s))}r.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?Xe(this):Ye(this),this.readyState==3&&Fi(this)}},r.Ra=function(s){this.g&&(this.response=this.responseText=s,Xe(this))},r.Qa=function(s){this.g&&(this.response=s,Xe(this))},r.ga=function(){this.g&&Xe(this)};function Xe(s){s.readyState=4,s.l=null,s.j=null,s.v=null,Ye(s)}r.setRequestHeader=function(s,a){this.u.append(s,a)},r.getResponseHeader=function(s){return this.h&&this.h.get(s.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";const s=[],a=this.h.entries();for(var l=a.next();!l.done;)l=l.value,s.push(l[0]+": "+l[1]),l=a.next();return s.join(`\r
|
|
22
|
-
`)};function
|
|
23
|
-
`}),a}function
|
|
24
|
-
`);for(let d=0;d<s.length;d++){if(
|
|
20
|
+
`+R+" "+b})}function Ee(s,a,l,d){s.info(function(){return"XMLHTTP TEXT ("+a+"): "+fl(s,l)+(d?" "+d:"")})}function dl(s,a){s.info(function(){return"TIMEOUT: "+a})}Ke.prototype.info=function(){};function fl(s,a){if(!s.g)return a;if(!a)return null;try{var l=JSON.parse(a);if(l){for(s=0;s<l.length;s++)if(Array.isArray(l[s])){var d=l[s];if(!(2>d.length)){var I=d[1];if(Array.isArray(I)&&!(1>I.length)){var R=I[0];if(R!="noop"&&R!="stop"&&R!="close")for(var b=1;b<I.length;b++)I[b]=""}}}}return jr(l)}catch{return a}}var kn={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Pi={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Gr;function xn(){}C(xn,Br),xn.prototype.g=function(){return new XMLHttpRequest},xn.prototype.i=function(){return{}},Gr=new xn;function Kt(s,a,l,d){this.j=s,this.i=a,this.l=l,this.R=d||1,this.U=new Be(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 Vi}function Vi(){this.i=null,this.g="",this.h=!1}var Si={},Kr={};function Qr(s,a,l){s.L=1,s.v=Ln(Lt(a)),s.m=l,s.P=!0,Ci(s,null)}function Ci(s,a){s.F=Date.now(),On(s),s.A=Lt(s.v);var l=s.A,d=s.R;Array.isArray(d)||(d=[String(d)]),zi(l.i,"t",d),s.C=0,l=s.j.J,s.h=new Vi,s.g=ao(s.j,l?a:null,!s.m),0<s.O&&(s.M=new al(A(s.Y,s,s.g),s.O)),a=s.U,l=s.g,d=s.ca;var I="readystatechange";Array.isArray(I)||(I&&(yi[0]=I.toString()),I=yi);for(var R=0;R<I.length;R++){var b=di(l,I[R],d||a.handleEvent,!1,a.h||a);if(!b)break;a.g[b.key]=b}a=s.H?p(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)),$e(),cl(s.i,s.u,s.A,s.l,s.R,s.m)}Kt.prototype.ca=function(s){s=s.target;const a=this.M;a&&Ut(s)==3?a.j():this.Y(s)},Kt.prototype.Y=function(s){try{if(s==this.g)t:{const pt=Ut(this.g);var a=this.g.Ba();const Ie=this.g.Z();if(!(3>pt)&&(pt!=3||this.g&&(this.h.h||this.g.oa()||Xi(this.g)))){this.J||pt!=4||a==7||(a==8||0>=Ie?$e(3):$e(2)),Wr(this);var l=this.g.Z();this.X=l;e:if(bi(this)){var d=Xi(this.g);s="";var I=d.length,R=Ut(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){ue(this),Qe(this);var b="";break e}this.h.i=new c.TextDecoder}for(a=0;a<I;a++)this.h.h=!0,s+=this.h.i.decode(d[a],{stream:!(R&&a==I-1)});d.length=0,this.h.g+=s,this.C=0,b=this.h.g}else b=this.g.oa();if(this.o=l==200,hl(this.i,this.u,this.A,this.l,this.R,pt,l),this.o){if(this.T&&!this.K){e:{if(this.g){var Q,ut=this.g;if((Q=ut.g?ut.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!z(Q)){var $=Q;break e}}$=null}if(l=$)Ee(this.i,this.l,l,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Hr(this,l);else{this.o=!1,this.s=3,Tt(12),ue(this),Qe(this);break t}}if(this.P){l=!0;let Pt;for(;!this.J&&this.C<b.length;)if(Pt=ml(this,b),Pt==Kr){pt==4&&(this.s=4,Tt(14),l=!1),Ee(this.i,this.l,null,"[Incomplete Response]");break}else if(Pt==Si){this.s=4,Tt(15),Ee(this.i,this.l,b,"[Invalid Chunk]"),l=!1;break}else Ee(this.i,this.l,Pt,null),Hr(this,Pt);if(bi(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),pt!=4||b.length!=0||this.h.h||(this.s=1,Tt(16),l=!1),this.o=this.o&&l,!l)Ee(this.i,this.l,b,"[Invalid Chunked Response]"),ue(this),Qe(this);else if(0<b.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: "+b.length),es(mt),mt.M=!0,Tt(11))}}else Ee(this.i,this.l,b,null),Hr(this,b);pt==4&&ue(this),this.o&&!this.J&&(pt==4?ro(this.j,this):(this.o=!1,On(this)))}else Dl(this.g),l==400&&0<b.indexOf("Unknown SID")?(this.s=3,Tt(12)):(this.s=0,Tt(13)),ue(this),Qe(this)}}}catch{}finally{}};function bi(s){return s.g?s.u=="GET"&&s.L!=2&&s.j.Ca:!1}function ml(s,a){var l=s.C,d=a.indexOf(`
|
|
21
|
+
`,l);return d==-1?Kr:(l=Number(a.substring(l,d)),isNaN(l)?Si:(d+=1,d+l>a.length?Kr:(a=a.slice(d,d+l),s.C=d+l,a)))}Kt.prototype.cancel=function(){this.J=!0,ue(this)};function On(s){s.S=Date.now()+s.I,Di(s,s.I)}function Di(s,a){if(s.B!=null)throw Error("WatchDog timer not null");s.B=Ge(A(s.ba,s),a)}function Wr(s){s.B&&(c.clearTimeout(s.B),s.B=null)}Kt.prototype.ba=function(){this.B=null;const s=Date.now();0<=s-this.S?(dl(this.i,this.A),this.L!=2&&($e(),Tt(17)),ue(this),this.s=2,Qe(this)):Di(this,this.S-s)};function Qe(s){s.j.G==0||s.J||ro(s.j,s)}function ue(s){Wr(s);var a=s.M;a&&typeof a.ma=="function"&&a.ma(),s.M=null,Ei(s.U),s.g&&(a=s.g,s.g=null,a.abort(),a.ma())}function Hr(s,a){try{var l=s.j;if(l.G!=0&&(l.g==s||Xr(l.h,s))){if(!s.K&&Xr(l.h,s)&&l.G==3){try{var d=l.Da.g.parse(a)}catch{d=null}if(Array.isArray(d)&&d.length==3){var I=d;if(I[0]==0){t:if(!l.u){if(l.g)if(l.g.F+3e3<s.F)$n(l),Bn(l);else break t;ts(l),Tt(18)}}else l.za=I[1],0<l.za-l.T&&37500>I[2]&&l.F&&l.v==0&&!l.C&&(l.C=Ge(A(l.Za,l),6e3));if(1>=xi(l.h)&&l.ca){try{l.ca()}catch{}l.ca=void 0}}else ce(l,11)}else if((s.K||l.g==s)&&$n(l),!z(a))for(I=l.Da.g.parse(a),a=0;a<I.length;a++){let $=I[a];if(l.T=$[0],$=$[1],l.G==2)if($[0]=="c"){l.K=$[1],l.ia=$[2];const mt=$[3];mt!=null&&(l.la=mt,l.j.info("VER="+l.la));const pt=$[4];pt!=null&&(l.Aa=pt,l.j.info("SVER="+l.Aa));const Ie=$[5];Ie!=null&&typeof Ie=="number"&&0<Ie&&(d=1.5*Ie,l.L=d,l.j.info("backChannelRequestTimeoutMs_="+d)),d=l;const Pt=s.g;if(Pt){const Kn=Pt.g?Pt.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Kn){var R=d.h;R.g||Kn.indexOf("spdy")==-1&&Kn.indexOf("quic")==-1&&Kn.indexOf("h2")==-1||(R.j=R.l,R.g=new Set,R.h&&(Yr(R,R.h),R.h=null))}if(d.D){const ns=Pt.g?Pt.g.getResponseHeader("X-HTTP-Session-Id"):null;ns&&(d.ya=ns,X(d.I,d.D,ns))}}l.G=3,l.l&&l.l.ua(),l.ba&&(l.R=Date.now()-s.F,l.j.info("Handshake RTT: "+l.R+"ms")),d=l;var b=s;if(d.qa=oo(d,d.J?d.ia:null,d.W),b.K){Oi(d.h,b);var Q=b,ut=d.L;ut&&(Q.I=ut),Q.B&&(Wr(Q),On(Q)),d.g=b}else eo(d);0<l.i.length&&zn(l)}else $[0]!="stop"&&$[0]!="close"||ce(l,7);else l.G==3&&($[0]=="stop"||$[0]=="close"?$[0]=="stop"?ce(l,7):Zr(l):$[0]!="noop"&&l.l&&l.l.ta($),l.v=0)}}$e(4)}catch{}}var pl=class{constructor(s,a){this.g=s,this.map=a}};function Ni(s){this.l=s||10,c.PerformanceNavigationTiming?(s=c.performance.getEntriesByType("navigation"),s=0<s.length&&(s[0].nextHopProtocol=="hq"||s[0].nextHopProtocol=="h2")):s=!!(c.chrome&&c.chrome.loadTimes&&c.chrome.loadTimes()&&c.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 ki(s){return s.h?!0:s.g?s.g.size>=s.j:!1}function xi(s){return s.h?1:s.g?s.g.size:0}function Xr(s,a){return s.h?s.h==a:s.g?s.g.has(a):!1}function Yr(s,a){s.g?s.g.add(a):s.h=a}function Oi(s,a){s.h&&s.h==a?s.h=null:s.g&&s.g.has(a)&&s.g.delete(a)}Ni.prototype.cancel=function(){if(this.i=Mi(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const s of this.g.values())s.cancel();this.g.clear()}};function Mi(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(const l of s.g.values())a=a.concat(l.D);return a}return x(s.i)}function gl(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=[],l=s.length,d=0;d<l;d++)a.push(s[d]);return a}a=[],l=0;for(d in s)a[l++]=s[d];return a}function _l(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 l=0;l<s;l++)a.push(l);return a}a=[],l=0;for(const d in s)a[l++]=d;return a}}}function Fi(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 l=_l(s),d=gl(s),I=d.length,R=0;R<I;R++)a.call(void 0,d[R],l&&l[R],s)}var Li=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function yl(s,a){if(s){s=s.split("&");for(var l=0;l<s.length;l++){var d=s[l].indexOf("="),I=null;if(0<=d){var R=s[l].substring(0,d);I=s[l].substring(d+1)}else R=s[l];a(R,I?decodeURIComponent(I.replace(/\+/g," ")):"")}}}function le(s){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,s instanceof le){this.h=s.h,Mn(this,s.j),this.o=s.o,this.g=s.g,Fn(this,s.s),this.l=s.l;var a=s.i,l=new Xe;l.i=a.i,a.g&&(l.g=new Map(a.g),l.h=a.h),Ui(this,l),this.m=s.m}else s&&(a=String(s).match(Li))?(this.h=!1,Mn(this,a[1]||"",!0),this.o=We(a[2]||""),this.g=We(a[3]||"",!0),Fn(this,a[4]),this.l=We(a[5]||"",!0),Ui(this,a[6]||"",!0),this.m=We(a[7]||"")):(this.h=!1,this.i=new Xe(null,this.h))}le.prototype.toString=function(){var s=[],a=this.j;a&&s.push(He(a,qi,!0),":");var l=this.g;return(l||a=="file")&&(s.push("//"),(a=this.o)&&s.push(He(a,qi,!0),"@"),s.push(encodeURIComponent(String(l)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),l=this.s,l!=null&&s.push(":",String(l))),(l=this.l)&&(this.g&&l.charAt(0)!="/"&&s.push("/"),s.push(He(l,l.charAt(0)=="/"?vl:Tl,!0))),(l=this.i.toString())&&s.push("?",l),(l=this.m)&&s.push("#",He(l,Al)),s.join("")};function Lt(s){return new le(s)}function Mn(s,a,l){s.j=l?We(a,!0):a,s.j&&(s.j=s.j.replace(/:$/,""))}function Fn(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 Ui(s,a,l){a instanceof Xe?(s.i=a,wl(s.i,s.h)):(l||(a=He(a,Il)),s.i=new Xe(a,s.h))}function X(s,a,l){s.i.set(a,l)}function Ln(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 We(s,a){return s?a?decodeURI(s.replace(/%25/g,"%2525")):decodeURIComponent(s):""}function He(s,a,l){return typeof s=="string"?(s=encodeURI(s).replace(a,El),l&&(s=s.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),s):null}function El(s){return s=s.charCodeAt(0),"%"+(s>>4&15).toString(16)+(s&15).toString(16)}var qi=/[#\/\?@]/g,Tl=/[#\?:]/g,vl=/[#\?]/g,Il=/[#\?@]/g,Al=/#/g;function Xe(s,a){this.h=this.g=null,this.i=s||null,this.j=!!a}function Qt(s){s.g||(s.g=new Map,s.h=0,s.i&&yl(s.i,function(a,l){s.add(decodeURIComponent(a.replace(/\+/g," ")),l)}))}r=Xe.prototype,r.add=function(s,a){Qt(this),this.i=null,s=Te(this,s);var l=this.g.get(s);return l||this.g.set(s,l=[]),l.push(a),this.h+=1,this};function ji(s,a){Qt(s),a=Te(s,a),s.g.has(a)&&(s.i=null,s.h-=s.g.get(a).length,s.g.delete(a))}function Bi(s,a){return Qt(s),a=Te(s,a),s.g.has(a)}r.forEach=function(s,a){Qt(this),this.g.forEach(function(l,d){l.forEach(function(I){s.call(a,I,d,this)},this)},this)},r.na=function(){Qt(this);const s=Array.from(this.g.values()),a=Array.from(this.g.keys()),l=[];for(let d=0;d<a.length;d++){const I=s[d];for(let R=0;R<I.length;R++)l.push(a[d])}return l},r.V=function(s){Qt(this);let a=[];if(typeof s=="string")Bi(this,s)&&(a=a.concat(this.g.get(Te(this,s))));else{s=Array.from(this.g.values());for(let l=0;l<s.length;l++)a=a.concat(s[l])}return a},r.set=function(s,a){return Qt(this),this.i=null,s=Te(this,s),Bi(this,s)&&(this.h-=this.g.get(s).length),this.g.set(s,[a]),this.h+=1,this},r.get=function(s,a){return s?(s=this.V(s),0<s.length?String(s[0]):a):a};function zi(s,a,l){ji(s,a),0<l.length&&(s.i=null,s.g.set(Te(s,a),x(l)),s.h+=l.length)}r.toString=function(){if(this.i)return this.i;if(!this.g)return"";const s=[],a=Array.from(this.g.keys());for(var l=0;l<a.length;l++){var d=a[l];const R=encodeURIComponent(String(d)),b=this.V(d);for(d=0;d<b.length;d++){var I=R;b[d]!==""&&(I+="="+encodeURIComponent(String(b[d]))),s.push(I)}}return this.i=s.join("&")};function Te(s,a){return a=String(a),s.j&&(a=a.toLowerCase()),a}function wl(s,a){a&&!s.j&&(Qt(s),s.i=null,s.g.forEach(function(l,d){var I=d.toLowerCase();d!=I&&(ji(this,d),zi(this,I,l))},s)),s.j=a}function Rl(s,a){const l=new Ke;if(c.Image){const d=new Image;d.onload=S(Wt,l,"TestLoadImage: loaded",!0,a,d),d.onerror=S(Wt,l,"TestLoadImage: error",!1,a,d),d.onabort=S(Wt,l,"TestLoadImage: abort",!1,a,d),d.ontimeout=S(Wt,l,"TestLoadImage: timeout",!1,a,d),c.setTimeout(function(){d.ontimeout&&d.ontimeout()},1e4),d.src=s}else a(!1)}function Pl(s,a){const l=new Ke,d=new AbortController,I=setTimeout(()=>{d.abort(),Wt(l,"TestPingServer: timeout",!1,a)},1e4);fetch(s,{signal:d.signal}).then(R=>{clearTimeout(I),R.ok?Wt(l,"TestPingServer: ok",!0,a):Wt(l,"TestPingServer: server error",!1,a)}).catch(()=>{clearTimeout(I),Wt(l,"TestPingServer: error",!1,a)})}function Wt(s,a,l,d,I){try{I&&(I.onload=null,I.onerror=null,I.onabort=null,I.ontimeout=null),d(l)}catch{}}function Vl(){this.g=new ll}function Sl(s,a,l){const d=l||"";try{Fi(s,function(I,R){let b=I;f(I)&&(b=jr(I)),a.push(d+R+"="+encodeURIComponent(b))})}catch(I){throw a.push(d+"type="+encodeURIComponent("_badmap")),I}}function Un(s){this.l=s.Ub||null,this.j=s.eb||!1}C(Un,Br),Un.prototype.g=function(){return new qn(this.l,this.j)},Un.prototype.i=(function(s){return function(){return s}})({});function qn(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}C(qn,ft),r=qn.prototype,r.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,Je(this)},r.send=function(s){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const a={headers:this.u,method:this.B,credentials:this.m,cache:void 0};s&&(a.body=s),(this.D||c).fetch(new Request(this.A,a)).then(this.Sa.bind(this),this.ga.bind(this))},r.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,Ye(this)),this.readyState=0},r.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,Je(this)),this.g&&(this.readyState=3,Je(this),this.g)))if(this.responseType==="arraybuffer")s.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof c.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;$i(this)}else s.text().then(this.Ra.bind(this),this.ga.bind(this))};function $i(s){s.j.read().then(s.Pa.bind(s)).catch(s.ga.bind(s))}r.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?Ye(this):Je(this),this.readyState==3&&$i(this)}},r.Ra=function(s){this.g&&(this.response=this.responseText=s,Ye(this))},r.Qa=function(s){this.g&&(this.response=s,Ye(this))},r.ga=function(){this.g&&Ye(this)};function Ye(s){s.readyState=4,s.l=null,s.j=null,s.v=null,Je(s)}r.setRequestHeader=function(s,a){this.u.append(s,a)},r.getResponseHeader=function(s){return this.h&&this.h.get(s.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";const s=[],a=this.h.entries();for(var l=a.next();!l.done;)l=l.value,s.push(l[0]+": "+l[1]),l=a.next();return s.join(`\r
|
|
22
|
+
`)};function Je(s){s.onreadystatechange&&s.onreadystatechange.call(s)}Object.defineProperty(qn.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(s){this.m=s?"include":"same-origin"}});function Gi(s){let a="";return at(s,function(l,d){a+=d,a+=":",a+=l,a+=`\r
|
|
23
|
+
`}),a}function Jr(s,a,l){t:{for(d in l){var d=!1;break t}d=!0}d||(l=Gi(l),typeof s=="string"?l!=null&&encodeURIComponent(String(l)):X(s,a,l))}function J(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}C(J,ft);var Cl=/^https?$/i,bl=["POST","PUT"];r=J.prototype,r.Ha=function(s){this.J=s},r.ea=function(s,a,l,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():Gr.g(),this.v=this.o?Ti(this.o):Ti(Gr),this.g.onreadystatechange=A(this.Ea,this);try{this.B=!0,this.g.open(a,String(s),!0),this.B=!1}catch(R){Ki(this,R);return}if(s=l||"",l=new Map(this.headers),d)if(Object.getPrototypeOf(d)===Object.prototype)for(var I in d)l.set(I,d[I]);else if(typeof d.keys=="function"&&typeof d.get=="function")for(const R of d.keys())l.set(R,d.get(R));else throw Error("Unknown input type for opt_headers: "+String(d));d=Array.from(l.keys()).find(R=>R.toLowerCase()=="content-type"),I=c.FormData&&s instanceof c.FormData,!(0<=Array.prototype.indexOf.call(bl,a,void 0))||d||I||l.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[R,b]of l)this.g.setRequestHeader(R,b);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Hi(this),this.u=!0,this.g.send(s),this.u=!1}catch(R){Ki(this,R)}};function Ki(s,a){s.h=!1,s.g&&(s.j=!0,s.g.abort(),s.j=!1),s.l=a,s.m=5,Qi(s),jn(s)}function Qi(s){s.A||(s.A=!0,Et(s,"complete"),Et(s,"error"))}r.abort=function(s){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=s||7,Et(this,"complete"),Et(this,"abort"),jn(this))},r.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),jn(this,!0)),J.aa.N.call(this)},r.Ea=function(){this.s||(this.B||this.u||this.j?Wi(this):this.bb())},r.bb=function(){Wi(this)};function Wi(s){if(s.h&&typeof u<"u"&&(!s.v[1]||Ut(s)!=4||s.Z()!=2)){if(s.u&&Ut(s)==4)gi(s.Ea,0,s);else if(Et(s,"readystatechange"),Ut(s)==4){s.h=!1;try{const b=s.Z();t:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var a=!0;break t;default:a=!1}var l;if(!(l=a)){var d;if(d=b===0){var I=String(s.D).match(Li)[1]||null;!I&&c.self&&c.self.location&&(I=c.self.location.protocol.slice(0,-1)),d=!Cl.test(I?I.toLowerCase():"")}l=d}if(l)Et(s,"complete"),Et(s,"success");else{s.m=6;try{var R=2<Ut(s)?s.g.statusText:""}catch{R=""}s.l=R+" ["+s.Z()+"]",Qi(s)}}finally{jn(s)}}}}function jn(s,a){if(s.g){Hi(s);const l=s.g,d=s.v[0]?()=>{}:null;s.g=null,s.v=null,a||Et(s,"ready");try{l.onreadystatechange=d}catch{}}}function Hi(s){s.I&&(c.clearTimeout(s.I),s.I=null)}r.isActive=function(){return!!this.g};function Ut(s){return s.g?s.g.readyState:0}r.Z=function(){try{return 2<Ut(this)?this.g.status:-1}catch{return-1}},r.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},r.Oa=function(s){if(this.g){var a=this.g.responseText;return s&&a.indexOf(s)==0&&(a=a.substring(s.length)),ul(a)}};function Xi(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{return null}}function Dl(s){const a={};s=(s.g&&2<=Ut(s)&&s.g.getAllResponseHeaders()||"").split(`\r
|
|
24
|
+
`);for(let d=0;d<s.length;d++){if(z(s[d]))continue;var l=T(s[d]);const I=l[0];if(l=l[1],typeof l!="string")continue;l=l.trim();const R=a[I]||[];a[I]=R,R.push(l)}v(a,function(d){return d.join(", ")})}r.Ba=function(){return this.m},r.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Ze(s,a,l){return l&&l.internalChannelParams&&l.internalChannelParams[s]||a}function Yi(s){this.Aa=0,this.i=[],this.j=new Ke,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=Ze("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=Ze("baseRetryDelayMs",5e3,s),this.cb=Ze("retryDelaySeedMs",1e4,s),this.Wa=Ze("forwardChannelMaxRetries",2,s),this.wa=Ze("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 Ni(s&&s.concurrentRequestLimit),this.Da=new Vl,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}r=Yi.prototype,r.la=8,r.G=1,r.connect=function(s,a,l,d){Tt(0),this.W=s,this.H=a||{},l&&d!==void 0&&(this.H.OSID=l,this.H.OAID=d),this.F=this.X,this.I=oo(this,null,this.W),zn(this)};function Zr(s){if(Ji(s),s.G==3){var a=s.U++,l=Lt(s.I);if(X(l,"SID",s.K),X(l,"RID",a),X(l,"TYPE","terminate"),tn(s,l),a=new Kt(s,s.j,a),a.L=2,a.v=Ln(Lt(l)),l=!1,c.navigator&&c.navigator.sendBeacon)try{l=c.navigator.sendBeacon(a.v.toString(),"")}catch{}!l&&c.Image&&(new Image().src=a.v,l=!0),l||(a.g=ao(a.j,null),a.g.ea(a.v)),a.F=Date.now(),On(a)}io(s)}function Bn(s){s.g&&(es(s),s.g.cancel(),s.g=null)}function Ji(s){Bn(s),s.u&&(c.clearTimeout(s.u),s.u=null),$n(s),s.h.cancel(),s.s&&(typeof s.s=="number"&&c.clearTimeout(s.s),s.s=null)}function zn(s){if(!ki(s.h)&&!s.s){s.s=!0;var a=s.Ga;Ue||hi(),qe||(Ue(),qe=!0),kr.add(a,s),s.B=0}}function Nl(s,a){return xi(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=Ge(A(s.Ga,s,a),so(s,s.B)),s.B++,!0)}r.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++;const I=new Kt(this,this.j,s);let R=this.o;if(this.S&&(R?(R=p(R),E(R,this.S)):R=this.S),this.m!==null||this.O||(I.H=R,R=null),this.P)t:{for(var a=0,l=0;l<this.i.length;l++){e:{var d=this.i[l];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=l;break t}if(a===4096||l===this.i.length-1){a=l+1;break t}}a=1e3}else a=1e3;a=to(this,I,a),l=Lt(this.I),X(l,"RID",s),X(l,"CVER",22),this.D&&X(l,"X-HTTP-Session-Id",this.D),tn(this,l),R&&(this.O?a="headers="+encodeURIComponent(String(Gi(R)))+"&"+a:this.m&&Jr(l,this.m,R)),Yr(this.h,I),this.Ua&&X(l,"TYPE","init"),this.P?(X(l,"$req",a),X(l,"SID","null"),I.T=!0,Qr(I,l,null)):Qr(I,l,a),this.G=2}}else this.G==3&&(s?Zi(this,s):this.i.length==0||ki(this.h)||Zi(this))};function Zi(s,a){var l;a?l=a.l:l=s.U++;const d=Lt(s.I);X(d,"SID",s.K),X(d,"RID",l),X(d,"AID",s.T),tn(s,d),s.m&&s.o&&Jr(d,s.m,s.o),l=new Kt(s,s.j,l,s.B+1),s.m===null&&(l.H=s.o),a&&(s.i=a.D.concat(s.i)),a=to(s,l,1e3),l.I=Math.round(.5*s.wa)+Math.round(.5*s.wa*Math.random()),Yr(s.h,l),Qr(l,d,a)}function tn(s,a){s.H&&at(s.H,function(l,d){X(a,d,l)}),s.l&&Fi({},function(l,d){X(a,d,l)})}function to(s,a,l){l=Math.min(s.i.length,l);var d=s.l?A(s.l.Na,s.l,s):null;t:{var I=s.i;let R=-1;for(;;){const b=["count="+l];R==-1?0<l?(R=I[0].g,b.push("ofs="+R)):R=0:b.push("ofs="+R);let Q=!0;for(let ut=0;ut<l;ut++){let $=I[ut].g;const mt=I[ut].map;if($-=R,0>$)R=Math.max(0,I[ut].g-100),Q=!1;else try{Sl(mt,b,"req"+$+"_")}catch{d&&d(mt)}}if(Q){d=b.join("&");break t}}}return s=s.i.splice(0,l),a.D=s,d}function eo(s){if(!s.g&&!s.u){s.Y=1;var a=s.Fa;Ue||hi(),qe||(Ue(),qe=!0),kr.add(a,s),s.v=0}}function ts(s){return s.g||s.u||3<=s.v?!1:(s.Y++,s.u=Ge(A(s.Fa,s),so(s,s.v)),s.v++,!0)}r.Fa=function(){if(this.u=null,no(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=Ge(A(this.ab,this),s)}},r.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,Tt(10),Bn(this),no(this))};function es(s){s.A!=null&&(c.clearTimeout(s.A),s.A=null)}function no(s){s.g=new Kt(s,s.j,"rpc",s.Y),s.m===null&&(s.g.H=s.o),s.g.O=0;var a=Lt(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"),tn(s,a),s.m&&s.o&&Jr(a,s.m,s.o),s.L&&(s.g.I=s.L);var l=s.g;s=s.ia,l.L=1,l.v=Ln(Lt(a)),l.m=null,l.P=!0,Ci(l,s)}r.Za=function(){this.C!=null&&(this.C=null,Bn(this),ts(this),Tt(19))};function $n(s){s.C!=null&&(c.clearTimeout(s.C),s.C=null)}function ro(s,a){var l=null;if(s.g==a){$n(s),es(s),s.g=null;var d=2}else if(Xr(s.h,a))l=a.D,Oi(s.h,a),d=1;else return;if(s.G!=0){if(a.o)if(d==1){l=a.m?a.m.length:0,a=Date.now()-a.F;var I=s.B;d=Nn(),Et(d,new Ri(d,l)),zn(s)}else eo(s);else if(I=a.s,I==3||I==0&&0<a.X||!(d==1&&Nl(s,a)||d==2&&ts(s)))switch(l&&0<l.length&&(a=s.h,a.i=a.i.concat(l)),I){case 1:ce(s,5);break;case 4:ce(s,10);break;case 3:ce(s,6);break;default:ce(s,2)}}}function so(s,a){let l=s.Ta+Math.floor(Math.random()*s.cb);return s.isActive()||(l*=2),l*a}function ce(s,a){if(s.j.info("Error code "+a),a==2){var l=A(s.fb,s),d=s.Xa;const I=!d;d=new le(d||"//www.google.com/images/cleardot.gif"),c.location&&c.location.protocol=="http"||Mn(d,"https"),Ln(d),I?Rl(d.toString(),l):Pl(d.toString(),l)}else Tt(2);s.G=0,s.l&&s.l.sa(a),io(s),Ji(s)}r.fb=function(s){s?(this.j.info("Successfully pinged google.com"),Tt(2)):(this.j.info("Failed to ping google.com"),Tt(1))};function io(s){if(s.G=0,s.ka=[],s.l){const a=Mi(s.h);(a.length!=0||s.i.length!=0)&&(D(s.ka,a),D(s.ka,s.i),s.h.i.length=0,x(s.i),s.i.length=0),s.l.ra()}}function oo(s,a,l){var d=l instanceof le?Lt(l):new le(l);if(d.g!="")a&&(d.g=a+"."+d.g),Fn(d,d.s);else{var I=c.location;d=I.protocol,a=a?a+"."+I.hostname:I.hostname,I=+I.port;var R=new le(null);d&&Mn(R,d),a&&(R.g=a),I&&Fn(R,I),l&&(R.l=l),d=R}return l=s.D,a=s.ya,l&&a&&X(d,l,a),X(d,"VER",s.la),tn(s,d),d}function ao(s,a,l){if(a&&!s.J)throw Error("Can't create secondary domain capable XhrIo object.");return a=s.Ca&&!s.pa?new J(new Un({eb:l})):new J(s.pa),a.Ha(s.J),a}r.isActive=function(){return!!this.l&&this.l.isActive(this)};function uo(){}r=uo.prototype,r.ua=function(){},r.ta=function(){},r.sa=function(){},r.ra=function(){},r.isActive=function(){return!0},r.Na=function(){};function Gn(){}Gn.prototype.g=function(s,a){return new At(s,a)};function At(s,a){ft.call(this),this.g=new Yi(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)&&!z(s)&&(this.g.m=s),this.v=a&&a.supportsCrossDomainXhr||!1,this.u=a&&a.sendRawJson||!1,(a=a&&a.httpSessionIdParam)&&!z(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 ve(this)}C(At,ft),At.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},At.prototype.close=function(){Zr(this.g)},At.prototype.o=function(s){var a=this.g;if(typeof s=="string"){var l={};l.__data__=s,s=l}else this.u&&(l={},l.__data__=jr(s),s=l);a.i.push(new pl(a.Ya++,s)),a.G==3&&zn(a)},At.prototype.N=function(){this.g.l=null,delete this.j,Zr(this.g),delete this.g,At.aa.N.call(this)};function lo(s){zr.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(const l in a){s=l;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}C(lo,zr);function co(){$r.call(this),this.status=1}C(co,$r);function ve(s){this.g=s}C(ve,uo),ve.prototype.ua=function(){Et(this.g,"a")},ve.prototype.ta=function(s){Et(this.g,new lo(s))},ve.prototype.sa=function(s){Et(this.g,new co)},ve.prototype.ra=function(){Et(this.g,"b")},Gn.prototype.createWebChannel=Gn.prototype.g,At.prototype.send=At.prototype.o,At.prototype.open=At.prototype.m,At.prototype.close=At.prototype.close,Va=function(){return new Gn},Pa=function(){return Nn()},Ra=ae,ls={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},kn.NO_ERROR=0,kn.TIMEOUT=8,kn.HTTP_ERROR=6,Jn=kn,Pi.COMPLETE="complete",wa=Pi,vi.EventType=ze,ze.OPEN="a",ze.CLOSE="b",ze.ERROR="c",ze.MESSAGE="d",ft.prototype.listen=ft.prototype.K,nn=vi,J.prototype.listenOnce=J.prototype.L,J.prototype.getLastError=J.prototype.Ka,J.prototype.getLastErrorCode=J.prototype.Ba,J.prototype.getStatus=J.prototype.Z,J.prototype.getResponseJson=J.prototype.Oa,J.prototype.getResponseText=J.prototype.oa,J.prototype.send=J.prototype.ea,J.prototype.setWithCredentials=J.prototype.Ha,Aa=J}).apply(typeof Qn<"u"?Qn:typeof self<"u"?self:typeof window<"u"?window:{});const po="@firebase/firestore",go="4.8.0";/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2017 Google LLC
|
|
27
27
|
*
|
|
@@ -51,7 +51,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
51
51
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
52
52
|
* See the License for the specific language governing permissions and
|
|
53
53
|
* limitations under the License.
|
|
54
|
-
*/let
|
|
54
|
+
*/let xe="11.10.0";/**
|
|
55
55
|
* @license
|
|
56
56
|
* Copyright 2017 Google LLC
|
|
57
57
|
*
|
|
@@ -66,7 +66,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
66
66
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
67
67
|
* See the License for the specific language governing permissions and
|
|
68
68
|
* limitations under the License.
|
|
69
|
-
*/const me=new
|
|
69
|
+
*/const me=new Kl("@firebase/firestore");function Ae(){return me.logLevel}function k(r,...t){if(me.logLevel<=qt.DEBUG){const e=t.map(Ss);me.debug(`Firestore (${xe}): ${r}`,...e)}}function zt(r,...t){if(me.logLevel<=qt.ERROR){const e=t.map(Ss);me.error(`Firestore (${xe}): ${r}`,...e)}}function Jt(r,...t){if(me.logLevel<=qt.WARN){const e=t.map(Ss);me.warn(`Firestore (${xe}): ${r}`,...e)}}function Ss(r){if(typeof r=="string")return r;try{/**
|
|
70
70
|
* @license
|
|
71
71
|
* Copyright 2020 Google LLC
|
|
72
72
|
*
|
|
@@ -96,7 +96,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
96
96
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
97
97
|
* See the License for the specific language governing permissions and
|
|
98
98
|
* limitations under the License.
|
|
99
|
-
*/function M(r,t,e){let n="Unexpected state";typeof t=="string"?n=t:e=t,
|
|
99
|
+
*/function M(r,t,e){let n="Unexpected state";typeof t=="string"?n=t:e=t,Sa(r,n,e)}function Sa(r,t,e){let n=`FIRESTORE (${xe}) INTERNAL ASSERTION FAILED: ${t} (ID: ${r.toString(16)})`;if(e!==void 0)try{n+=" CONTEXT: "+JSON.stringify(e)}catch{n+=" CONTEXT: "+e}throw zt(n),new Error(n)}function G(r,t,e,n){let i="Unexpected state";typeof e=="string"?i=e:n=e,r||Sa(t,i,n)}function L(r,t){return r}/**
|
|
100
100
|
* @license
|
|
101
101
|
* Copyright 2017 Google LLC
|
|
102
102
|
*
|
|
@@ -111,7 +111,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
111
111
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
112
112
|
* See the License for the specific language governing permissions and
|
|
113
113
|
* limitations under the License.
|
|
114
|
-
*/const P={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"};class
|
|
114
|
+
*/const P={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"};class N extends zl{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
|
|
115
115
|
* @license
|
|
116
116
|
* Copyright 2017 Google LLC
|
|
117
117
|
*
|
|
@@ -141,7 +141,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
141
141
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
142
142
|
* See the License for the specific language governing permissions and
|
|
143
143
|
* limitations under the License.
|
|
144
|
-
*/class
|
|
144
|
+
*/class Ca{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class oc{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(_t.UNAUTHENTICATED)))}shutdown(){}}class ac{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}}class uc{constructor(t){this.t=t,this.currentUser=_t.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){G(this.o===void 0,42304);let n=this.i;const i=h=>this.i!==n?(n=this.i,e(h)):Promise.resolve();let o=new jt;this.o=()=>{this.i++,this.currentUser=this.u(),o.resolve(),o=new jt,t.enqueueRetryable((()=>i(this.currentUser)))};const u=()=>{const h=o;t.enqueueRetryable((async()=>{await h.promise,await i(this.currentUser)}))},c=h=>{k("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=h,this.o&&(this.auth.addAuthTokenListener(this.o),u())};this.t.onInit((h=>c(h))),setTimeout((()=>{if(!this.auth){const h=this.t.getImmediate({optional:!0});h?c(h):(k("FirebaseAuthCredentialsProvider","Auth not yet detected"),o.resolve(),o=new jt)}}),0),u()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((n=>this.i!==t?(k("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):n?(G(typeof n.accessToken=="string",31837,{l:n}),new Ca(n.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(){const t=this.auth&&this.auth.getUid();return G(t===null||typeof t=="string",2055,{h:t}),new _t(t)}}class lc{constructor(t,e,n){this.P=t,this.T=e,this.I=n,this.type="FirstParty",this.user=_t.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const t=this.R();return t&&this.A.set("Authorization",t),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class cc{constructor(t,e,n){this.P=t,this.T=e,this.I=n}getToken(){return Promise.resolve(new lc(this.P,this.T,this.I))}start(t,e){t.enqueueRetryable((()=>e(_t.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class _o{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class hc{constructor(t,e){this.V=e,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Jl(t)&&t.settings.appCheckToken&&(this.p=t.settings.appCheckToken)}start(t,e){G(this.o===void 0,3512);const n=o=>{o.error!=null&&k("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${o.error.message}`);const u=o.token!==this.m;return this.m=o.token,k("FirebaseAppCheckTokenProvider",`Received ${u?"new":"existing"} token.`),u?e(o.token):Promise.resolve()};this.o=o=>{t.enqueueRetryable((()=>n(o)))};const 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){const o=this.V.getImmediate({optional:!0});o?i(o):k("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new _o(this.p));const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((e=>e?(G(typeof e.token=="string",44558,{tokenResult:e}),this.m=e.token,new _o(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
|
|
145
145
|
* @license
|
|
146
146
|
* Copyright 2020 Google LLC
|
|
147
147
|
*
|
|
@@ -156,7 +156,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
156
156
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
157
157
|
* See the License for the specific language governing permissions and
|
|
158
158
|
* limitations under the License.
|
|
159
|
-
*/function
|
|
159
|
+
*/function dc(r){const t=typeof self<"u"&&(self.crypto||self.msCrypto),e=new Uint8Array(r);if(t&&typeof t.getRandomValues=="function")t.getRandomValues(e);else for(let n=0;n<r;n++)e[n]=Math.floor(256*Math.random());return e}/**
|
|
160
160
|
* @license
|
|
161
161
|
* Copyright 2023 Google LLC
|
|
162
162
|
*
|
|
@@ -171,7 +171,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
171
171
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
172
172
|
* See the License for the specific language governing permissions and
|
|
173
173
|
* limitations under the License.
|
|
174
|
-
*/function
|
|
174
|
+
*/function ba(){return new TextEncoder}/**
|
|
175
175
|
* @license
|
|
176
176
|
* Copyright 2017 Google LLC
|
|
177
177
|
*
|
|
@@ -186,7 +186,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
186
186
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
187
187
|
* See the License for the specific language governing permissions and
|
|
188
188
|
* limitations under the License.
|
|
189
|
-
*/class
|
|
189
|
+
*/class Cs{static newId(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(4.129032258064516);let n="";for(;n.length<20;){const i=dc(40);for(let o=0;o<i.length;++o)n.length<20&&i[o]<e&&(n+=t.charAt(i[o]%62))}return n}}function U(r,t){return r<t?-1:r>t?1:0}function cs(r,t){let e=0;for(;e<r.length&&e<t.length;){const n=r.codePointAt(e),i=t.codePointAt(e);if(n!==i){if(n<128&&i<128)return U(n,i);{const o=ba(),u=fc(o.encode(yo(r,e)),o.encode(yo(t,e)));return u!==0?u:U(n,i)}}e+=n>65535?2:1}return U(r.length,t.length)}function yo(r,t){return r.codePointAt(t)>65535?r.substring(t,t+2):r.substring(t,t+1)}function fc(r,t){for(let e=0;e<r.length&&e<t.length;++e)if(r[e]!==t[e])return U(r[e],t[e]);return U(r.length,t.length)}function Se(r,t,e){return r.length===t.length&&r.every(((n,i)=>e(n,t[i])))}/**
|
|
190
190
|
* @license
|
|
191
191
|
* Copyright 2017 Google LLC
|
|
192
192
|
*
|
|
@@ -201,7 +201,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
201
201
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
202
|
* See the License for the specific language governing permissions and
|
|
203
203
|
* limitations under the License.
|
|
204
|
-
*/const
|
|
204
|
+
*/const Eo="__name__";class bt{constructor(t,e,n){e===void 0?e=0:e>t.length&&M(637,{offset:e,range:t.length}),n===void 0?n=t.length-e:n>t.length-e&&M(1746,{length:n,range:t.length-e}),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return bt.comparator(this,t)===0}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof bt?t.forEach((n=>{e.push(n)})):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,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let i=0;i<n;i++){const o=bt.compareSegments(t.get(i),e.get(i));if(o!==0)return o}return U(t.length,e.length)}static compareSegments(t,e){const n=bt.isNumericId(t),i=bt.isNumericId(e);return n&&!i?-1:!n&&i?1:n&&i?bt.extractNumericId(t).compare(bt.extractNumericId(e)):cs(t,e)}static isNumericId(t){return t.startsWith("__id")&&t.endsWith("__")}static extractNumericId(t){return Xt.fromString(t.substring(4,t.length-2))}}class H extends bt{construct(t,e,n){return new H(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new N(P.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((i=>i.length>0)))}return new H(e)}static emptyPath(){return new H([])}}const mc=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class ct extends bt{construct(t,e,n){return new ct(t,e,n)}static isValidIdentifier(t){return mc.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),ct.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Eo}static keyField(){return new ct([Eo])}static fromServerFormat(t){const e=[];let n="",i=0;const o=()=>{if(n.length===0)throw new N(P.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let u=!1;for(;i<t.length;){const c=t[i];if(c==="\\"){if(i+1===t.length)throw new N(P.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const h=t[i+1];if(h!=="\\"&&h!=="."&&h!=="`")throw new N(P.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=h,i+=2}else c==="`"?(u=!u,i++):c!=="."||u?(n+=c,i++):(o(),i++)}if(o(),u)throw new N(P.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new ct(e)}static emptyPath(){return new ct([])}}/**
|
|
205
205
|
* @license
|
|
206
206
|
* Copyright 2017 Google LLC
|
|
207
207
|
*
|
|
@@ -216,7 +216,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
216
216
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
217
217
|
* See the License for the specific language governing permissions and
|
|
218
218
|
* limitations under the License.
|
|
219
|
-
*/class O{constructor(t){this.path=t}static fromPath(t){return new O(
|
|
219
|
+
*/class O{constructor(t){this.path=t}static fromPath(t){return new O(H.fromString(t))}static fromName(t){return new O(H.fromString(t).popFirst(5))}static empty(){return new O(H.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&&H.comparator(this.path,t.path)===0}toString(){return this.path.toString()}static comparator(t,e){return H.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new O(new H(t.slice()))}}/**
|
|
220
220
|
* @license
|
|
221
221
|
* Copyright 2017 Google LLC
|
|
222
222
|
*
|
|
@@ -231,7 +231,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
231
231
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
232
232
|
* See the License for the specific language governing permissions and
|
|
233
233
|
* limitations under the License.
|
|
234
|
-
*/function
|
|
234
|
+
*/function Da(r,t,e){if(!e)throw new N(P.INVALID_ARGUMENT,`Function ${r}() cannot be called with an empty ${t}.`)}function pc(r,t,e,n){if(t===!0&&n===!0)throw new N(P.INVALID_ARGUMENT,`${r} and ${e} cannot be used together.`)}function To(r){if(!O.isDocumentKey(r))throw new N(P.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${r} has ${r.length}.`)}function vo(r){if(O.isDocumentKey(r))throw new N(P.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${r} has ${r.length}.`)}function Na(r){return typeof r=="object"&&r!==null&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function gr(r){if(r===void 0)return"undefined";if(r===null)return"null";if(typeof r=="string")return r.length>20&&(r=`${r.substring(0,20)}...`),JSON.stringify(r);if(typeof r=="number"||typeof r=="boolean")return""+r;if(typeof r=="object"){if(r instanceof Array)return"an array";{const t=(function(n){return n.constructor?n.constructor.name:null})(r);return t?`a custom ${t} object`:"an object"}}return typeof r=="function"?"a function":M(12329,{type:typeof r})}function Bt(r,t){if("_delegate"in r&&(r=r._delegate),!(r instanceof t)){if(t.name===r.constructor.name)throw new N(P.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const e=gr(r);throw new N(P.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${e}`)}}return r}/**
|
|
235
235
|
* @license
|
|
236
236
|
* Copyright 2025 Google LLC
|
|
237
237
|
*
|
|
@@ -246,7 +246,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
246
246
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
247
247
|
* See the License for the specific language governing permissions and
|
|
248
248
|
* limitations under the License.
|
|
249
|
-
*/function
|
|
249
|
+
*/function nt(r,t){const e={typeString:r};return t&&(e.value=t),e}function En(r,t){if(!Na(r))throw new N(P.INVALID_ARGUMENT,"JSON must be an object");let e;for(const n in t)if(t[n]){const i=t[n].typeString,o="value"in t[n]?{value:t[n].value}:void 0;if(!(n in r)){e=`JSON missing required field: '${n}'`;break}const u=r[n];if(i&&typeof u!==i){e=`JSON field '${n}' must be a ${i}.`;break}if(o!==void 0&&u!==o.value){e=`Expected '${n}' field to equal '${o.value}'`;break}}if(e)throw new N(P.INVALID_ARGUMENT,e);return!0}/**
|
|
250
250
|
* @license
|
|
251
251
|
* Copyright 2017 Google LLC
|
|
252
252
|
*
|
|
@@ -261,7 +261,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
261
261
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
262
262
|
* See the License for the specific language governing permissions and
|
|
263
263
|
* limitations under the License.
|
|
264
|
-
*/const
|
|
264
|
+
*/const Io=-62135596800,Ao=1e6;class W{static now(){return W.fromMillis(Date.now())}static fromDate(t){return W.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor((t-1e3*e)*Ao);return new W(e,n)}constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new N(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new N(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<Io)throw new N(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new N(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Ao}_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:W._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(En(t,W._jsonSchema))return new W(t.seconds,t.nanoseconds)}valueOf(){const t=this.seconds-Io;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}W._jsonSchemaVersion="firestore/timestamp/1.0",W._jsonSchema={type:nt("string",W._jsonSchemaVersion),seconds:nt("number"),nanoseconds:nt("number")};/**
|
|
265
265
|
* @license
|
|
266
266
|
* Copyright 2017 Google LLC
|
|
267
267
|
*
|
|
@@ -291,7 +291,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
291
291
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
292
292
|
* See the License for the specific language governing permissions and
|
|
293
293
|
* limitations under the License.
|
|
294
|
-
*/const hn=-1;function
|
|
294
|
+
*/const hn=-1;function gc(r,t){const e=r.toTimestamp().seconds,n=r.toTimestamp().nanoseconds+1,i=F.fromTimestamp(n===1e9?new W(e+1,0):new W(e,n));return new Zt(i,O.empty(),t)}function _c(r){return new Zt(r.readTime,r.key,hn)}class Zt{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new Zt(F.min(),O.empty(),hn)}static max(){return new Zt(F.max(),O.empty(),hn)}}function yc(r,t){let e=r.readTime.compareTo(t.readTime);return e!==0?e:(e=O.comparator(r.documentKey,t.documentKey),e!==0?e:U(r.largestBatchId,t.largestBatchId))}/**
|
|
295
295
|
* @license
|
|
296
296
|
* Copyright 2020 Google LLC
|
|
297
297
|
*
|
|
@@ -306,7 +306,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
306
306
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
307
307
|
* See the License for the specific language governing permissions and
|
|
308
308
|
* limitations under the License.
|
|
309
|
-
*/const
|
|
309
|
+
*/const Ec="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class Tc{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}/**
|
|
310
310
|
* @license
|
|
311
311
|
* Copyright 2017 Google LLC
|
|
312
312
|
*
|
|
@@ -321,7 +321,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
321
321
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
322
322
|
* See the License for the specific language governing permissions and
|
|
323
323
|
* limitations under the License.
|
|
324
|
-
*/async function
|
|
324
|
+
*/async function Oe(r){if(r.code!==P.FAILED_PRECONDITION||r.message!==Ec)throw r;k("LocalStore","Unexpectedly lost primary lease")}/**
|
|
325
325
|
* @license
|
|
326
326
|
* Copyright 2017 Google LLC
|
|
327
327
|
*
|
|
@@ -336,7 +336,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
336
336
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
337
337
|
* See the License for the specific language governing permissions and
|
|
338
338
|
* limitations under the License.
|
|
339
|
-
*/class V{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 V(((n,i)=>{this.nextCallback=o=>{this.wrapSuccess(t,o).next(n,i)},this.catchCallback=o=>{this.wrapFailure(e,o).next(n,i)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof V?e:V.resolve(e)}catch(e){return V.reject(e)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):V.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):V.reject(e)}static resolve(t){return new V(((e,n)=>{e(t)}))}static reject(t){return new V(((e,n)=>{n(t)}))}static waitFor(t){return new V(((e,n)=>{let i=0,o=0,u=!1;t.forEach((c=>{++i,c.next((()=>{++o,u&&o===i&&e()}),(h=>n(h)))})),u=!0,o===i&&e()}))}static or(t){let e=V.resolve(!1);for(const n of t)e=e.next((i=>i?V.resolve(i):n()));return e}static forEach(t,e){const n=[];return t.forEach(((i,o)=>{n.push(e.call(this,i,o))})),this.waitFor(n)}static mapArray(t,e){return new V(((n,i)=>{const o=t.length,u=new Array(o);let c=0;for(let h=0;h<o;h++){const f=h;e(t[f]).next((
|
|
339
|
+
*/class V{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 V(((n,i)=>{this.nextCallback=o=>{this.wrapSuccess(t,o).next(n,i)},this.catchCallback=o=>{this.wrapFailure(e,o).next(n,i)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof V?e:V.resolve(e)}catch(e){return V.reject(e)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):V.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):V.reject(e)}static resolve(t){return new V(((e,n)=>{e(t)}))}static reject(t){return new V(((e,n)=>{n(t)}))}static waitFor(t){return new V(((e,n)=>{let i=0,o=0,u=!1;t.forEach((c=>{++i,c.next((()=>{++o,u&&o===i&&e()}),(h=>n(h)))})),u=!0,o===i&&e()}))}static or(t){let e=V.resolve(!1);for(const n of t)e=e.next((i=>i?V.resolve(i):n()));return e}static forEach(t,e){const n=[];return t.forEach(((i,o)=>{n.push(e.call(this,i,o))})),this.waitFor(n)}static mapArray(t,e){return new V(((n,i)=>{const o=t.length,u=new Array(o);let c=0;for(let h=0;h<o;h++){const f=h;e(t[f]).next((m=>{u[f]=m,++c,c===o&&n(u)}),(m=>i(m)))}}))}static doWhile(t,e){return new V(((n,i)=>{const o=()=>{t()===!0?e().next((()=>{o()}),i):n()};o()}))}}function vc(r){const t=r.match(/Android ([\d.]+)/i),e=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(e)}function Me(r){return r.name==="IndexedDbTransactionError"}/**
|
|
340
340
|
* @license
|
|
341
341
|
* Copyright 2018 Google LLC
|
|
342
342
|
*
|
|
@@ -351,7 +351,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
351
351
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
352
352
|
* See the License for the specific language governing permissions and
|
|
353
353
|
* limitations under the License.
|
|
354
|
-
*/class
|
|
354
|
+
*/class _r{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=n=>this._e(n),this.ae=n=>e.writeSequenceNumber(n))}_e(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ae&&this.ae(t),t}}_r.ue=-1;/**
|
|
355
355
|
* @license
|
|
356
356
|
* Copyright 2017 Google LLC
|
|
357
357
|
*
|
|
@@ -366,7 +366,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
366
366
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
367
367
|
* See the License for the specific language governing permissions and
|
|
368
368
|
* limitations under the License.
|
|
369
|
-
*/const
|
|
369
|
+
*/const bs=-1;function yr(r){return r==null}function sr(r){return r===0&&1/r==-1/0}function Ic(r){return typeof r=="number"&&Number.isInteger(r)&&!sr(r)&&r<=Number.MAX_SAFE_INTEGER&&r>=Number.MIN_SAFE_INTEGER}/**
|
|
370
370
|
* @license
|
|
371
371
|
* Copyright 2017 Google LLC
|
|
372
372
|
*
|
|
@@ -381,7 +381,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
381
381
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
382
382
|
* See the License for the specific language governing permissions and
|
|
383
383
|
* limitations under the License.
|
|
384
|
-
*/const
|
|
384
|
+
*/const ka="";function Ac(r){let t="";for(let e=0;e<r.length;e++)t.length>0&&(t=wo(t)),t=wc(r.get(e),t);return wo(t)}function wc(r,t){let e=t;const n=r.length;for(let i=0;i<n;i++){const o=r.charAt(i);switch(o){case"\0":e+="";break;case ka:e+="";break;default:e+=o}}return e}function wo(r){return r+ka+""}/**
|
|
385
385
|
* @license
|
|
386
386
|
* Copyright 2017 Google LLC
|
|
387
387
|
*
|
|
@@ -396,7 +396,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
396
396
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
397
397
|
* See the License for the specific language governing permissions and
|
|
398
398
|
* limitations under the License.
|
|
399
|
-
*/function
|
|
399
|
+
*/function Ro(r){let t=0;for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&t++;return t}function ie(r,t){for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&t(e,r[e])}function xa(r){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t))return!1;return!0}/**
|
|
400
400
|
* @license
|
|
401
401
|
* Copyright 2017 Google LLC
|
|
402
402
|
*
|
|
@@ -411,7 +411,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
411
411
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
412
412
|
* See the License for the specific language governing permissions and
|
|
413
413
|
* limitations under the License.
|
|
414
|
-
*/class Y{constructor(t,e){this.comparator=t,this.root=e||lt.EMPTY}insert(t,e){return new Y(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,lt.BLACK,null,null))}remove(t){return new Y(this.comparator,this.root.remove(t,this.comparator).copy(null,null,lt.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(n===0)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const i=this.comparator(t,n.key);if(i===0)return e+n.left.size;i<0?n=n.left:(e+=n.left.size+1,n=n.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,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new
|
|
414
|
+
*/class Y{constructor(t,e){this.comparator=t,this.root=e||lt.EMPTY}insert(t,e){return new Y(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,lt.BLACK,null,null))}remove(t){return new Y(this.comparator,this.root.remove(t,this.comparator).copy(null,null,lt.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(n===0)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const i=this.comparator(t,n.key);if(i===0)return e+n.left.size;i<0?n=n.left:(e+=n.left.size+1,n=n.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,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new Wn(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new Wn(this.root,t,this.comparator,!1)}getReverseIterator(){return new Wn(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new Wn(this.root,t,this.comparator,!0)}}class Wn{constructor(t,e,n,i){this.isReverse=i,this.nodeStack=[];let o=1;for(;!t.isEmpty();)if(o=e?n(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();const 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;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class lt{constructor(t,e,n,i,o){this.key=t,this.value=e,this.color=n??lt.RED,this.left=i??lt.EMPTY,this.right=o??lt.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,i,o){return new lt(t??this.key,e??this.value,n??this.color,i??this.left,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,n){let i=this;const o=n(t,i.key);return i=o<0?i.copy(null,null,null,i.left.insert(t,e,n),null):o===0?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n)),i.fixUp()}removeMin(){if(this.left.isEmpty())return lt.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 n,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 lt.EMPTY;n=i.right.min(),i=i.copy(n.key,n.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(){const t=this.copy(null,null,lt.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,lt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const 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(){const 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});const t=this.left.check();if(t!==this.right.check())throw M(27949);return t+(this.isRed()?0:1)}}lt.EMPTY=null,lt.RED=!0,lt.BLACK=!1;lt.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,n,i,o){return this}insert(t,e,n){return new lt(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}};/**
|
|
415
415
|
* @license
|
|
416
416
|
* Copyright 2017 Google LLC
|
|
417
417
|
*
|
|
@@ -426,7 +426,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
426
426
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
427
427
|
* See the License for the specific language governing permissions and
|
|
428
428
|
* limitations under the License.
|
|
429
|
-
*/class st{constructor(t){this.comparator=t,this.data=new Y(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,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const i=n.getNext();if(this.comparator(i.key,t[1])>=0)return;e(i.key)}}forEachWhile(t,e){let n;for(n=e!==void 0?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new
|
|
429
|
+
*/class st{constructor(t){this.comparator=t,this.data=new Y(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,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const i=n.getNext();if(this.comparator(i.key,t[1])>=0)return;e(i.key)}}forEachWhile(t,e){let n;for(n=e!==void 0?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new Po(this.data.getIterator())}getIteratorFrom(t){return new Po(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((n=>{e=e.add(n)})),e}isEqual(t){if(!(t instanceof st)||this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const i=e.getNext().key,o=n.getNext().key;if(this.comparator(i,o)!==0)return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new st(this.comparator);return e.data=t,e}}class Po{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
|
|
430
430
|
* @license
|
|
431
431
|
* Copyright 2020 Google LLC
|
|
432
432
|
*
|
|
@@ -441,7 +441,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
441
441
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
442
442
|
* See the License for the specific language governing permissions and
|
|
443
443
|
* limitations under the License.
|
|
444
|
-
*/class wt{constructor(t){this.fields=t,t.sort(ct.comparator)}static empty(){return new wt([])}unionWith(t){let e=new st(ct.comparator);for(const n of this.fields)e=e.add(n);for(const n of t)e=e.add(n);return new wt(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return
|
|
444
|
+
*/class wt{constructor(t){this.fields=t,t.sort(ct.comparator)}static empty(){return new wt([])}unionWith(t){let e=new st(ct.comparator);for(const n of this.fields)e=e.add(n);for(const n of t)e=e.add(n);return new wt(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return Se(this.fields,t.fields,((e,n)=>e.isEqual(n)))}}/**
|
|
445
445
|
* @license
|
|
446
446
|
* Copyright 2023 Google LLC
|
|
447
447
|
*
|
|
@@ -456,7 +456,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
456
456
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
457
457
|
* See the License for the specific language governing permissions and
|
|
458
458
|
* limitations under the License.
|
|
459
|
-
*/class
|
|
459
|
+
*/class Oa extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
|
|
460
460
|
* @license
|
|
461
461
|
* Copyright 2020 Google LLC
|
|
462
462
|
*
|
|
@@ -471,7 +471,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
471
471
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
472
472
|
* See the License for the specific language governing permissions and
|
|
473
473
|
* limitations under the License.
|
|
474
|
-
*/class ht{constructor(t){this.binaryString=t}static fromBase64String(t){const e=(function(i){try{return atob(i)}catch(o){throw typeof DOMException<"u"&&o instanceof DOMException?new
|
|
474
|
+
*/class ht{constructor(t){this.binaryString=t}static fromBase64String(t){const e=(function(i){try{return atob(i)}catch(o){throw typeof DOMException<"u"&&o instanceof DOMException?new Oa("Invalid base64 string: "+o):o}})(t);return new ht(e)}static fromUint8Array(t){const e=(function(i){let o="";for(let u=0;u<i.length;++u)o+=String.fromCharCode(i[u]);return o})(t);return new ht(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){const n=new Uint8Array(e.length);for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return U(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}ht.EMPTY_BYTE_STRING=new ht("");const Rc=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function te(r){if(G(!!r,39018),typeof r=="string"){let t=0;const e=Rc.exec(r);if(G(!!e,46558,{timestamp:r}),e[1]){let i=e[1];i=(i+"000000000").substr(0,9),t=Number(i)}const n=new Date(r);return{seconds:Math.floor(n.getTime()/1e3),nanos:t}}return{seconds:Z(r.seconds),nanos:Z(r.nanos)}}function Z(r){return typeof r=="number"?r:typeof r=="string"?Number(r):0}function ee(r){return typeof r=="string"?ht.fromBase64String(r):ht.fromUint8Array(r)}/**
|
|
475
475
|
* @license
|
|
476
476
|
* Copyright 2020 Google LLC
|
|
477
477
|
*
|
|
@@ -486,7 +486,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
486
486
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
487
487
|
* See the License for the specific language governing permissions and
|
|
488
488
|
* limitations under the License.
|
|
489
|
-
*/const
|
|
489
|
+
*/const Ma="server_timestamp",Fa="__type__",La="__previous_value__",Ua="__local_write_time__";function Ds(r){var t,e;return((e=(((t=r==null?void 0:r.mapValue)===null||t===void 0?void 0:t.fields)||{})[Fa])===null||e===void 0?void 0:e.stringValue)===Ma}function Er(r){const t=r.mapValue.fields[La];return Ds(t)?Er(t):t}function dn(r){const t=te(r.mapValue.fields[Ua].timestampValue);return new W(t.seconds,t.nanos)}/**
|
|
490
490
|
* @license
|
|
491
491
|
* Copyright 2017 Google LLC
|
|
492
492
|
*
|
|
@@ -501,7 +501,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
501
501
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
502
502
|
* See the License for the specific language governing permissions and
|
|
503
503
|
* limitations under the License.
|
|
504
|
-
*/class
|
|
504
|
+
*/class Pc{constructor(t,e,n,i,o,u,c,h,f,m){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=i,this.ssl=o,this.forceLongPolling=u,this.autoDetectLongPolling=c,this.longPollingOptions=h,this.useFetchStreams=f,this.isUsingEmulator=m}}const fn="(default)";class mn{constructor(t,e){this.projectId=t,this.database=e||fn}static empty(){return new mn("","")}get isDefaultDatabase(){return this.database===fn}isEqual(t){return t instanceof mn&&t.projectId===this.projectId&&t.database===this.database}}/**
|
|
505
505
|
* @license
|
|
506
506
|
* Copyright 2020 Google LLC
|
|
507
507
|
*
|
|
@@ -516,7 +516,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
516
516
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
517
517
|
* See the License for the specific language governing permissions and
|
|
518
518
|
* limitations under the License.
|
|
519
|
-
*/const
|
|
519
|
+
*/const qa="__type__",Vc="__max__",Hn={mapValue:{}},ja="__vector__",ir="value";function ne(r){return"nullValue"in r?0:"booleanValue"in r?1:"integerValue"in r||"doubleValue"in r?2:"timestampValue"in r?3:"stringValue"in r?5:"bytesValue"in r?6:"referenceValue"in r?7:"geoPointValue"in r?8:"arrayValue"in r?9:"mapValue"in r?Ds(r)?4:Cc(r)?9007199254740991:Sc(r)?10:11:M(28295,{value:r})}function Ot(r,t){if(r===t)return!0;const e=ne(r);if(e!==ne(t))return!1;switch(e){case 0:case 9007199254740991:return!0;case 1:return r.booleanValue===t.booleanValue;case 4:return dn(r).isEqual(dn(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;const u=te(i.timestampValue),c=te(o.timestampValue);return u.seconds===c.seconds&&u.nanos===c.nanos})(r,t);case 5:return r.stringValue===t.stringValue;case 6:return(function(i,o){return ee(i.bytesValue).isEqual(ee(o.bytesValue))})(r,t);case 7:return r.referenceValue===t.referenceValue;case 8:return(function(i,o){return Z(i.geoPointValue.latitude)===Z(o.geoPointValue.latitude)&&Z(i.geoPointValue.longitude)===Z(o.geoPointValue.longitude)})(r,t);case 2:return(function(i,o){if("integerValue"in i&&"integerValue"in o)return Z(i.integerValue)===Z(o.integerValue);if("doubleValue"in i&&"doubleValue"in o){const u=Z(i.doubleValue),c=Z(o.doubleValue);return u===c?sr(u)===sr(c):isNaN(u)&&isNaN(c)}return!1})(r,t);case 9:return Se(r.arrayValue.values||[],t.arrayValue.values||[],Ot);case 10:case 11:return(function(i,o){const u=i.mapValue.fields||{},c=o.mapValue.fields||{};if(Ro(u)!==Ro(c))return!1;for(const h in u)if(u.hasOwnProperty(h)&&(c[h]===void 0||!Ot(u[h],c[h])))return!1;return!0})(r,t);default:return M(52216,{left:r})}}function pn(r,t){return(r.values||[]).find((e=>Ot(e,t)))!==void 0}function Ce(r,t){if(r===t)return 0;const e=ne(r),n=ne(t);if(e!==n)return U(e,n);switch(e){case 0:case 9007199254740991:return 0;case 1:return U(r.booleanValue,t.booleanValue);case 2:return(function(o,u){const c=Z(o.integerValue||o.doubleValue),h=Z(u.integerValue||u.doubleValue);return c<h?-1:c>h?1:c===h?0:isNaN(c)?isNaN(h)?0:-1:1})(r,t);case 3:return Vo(r.timestampValue,t.timestampValue);case 4:return Vo(dn(r),dn(t));case 5:return cs(r.stringValue,t.stringValue);case 6:return(function(o,u){const c=ee(o),h=ee(u);return c.compareTo(h)})(r.bytesValue,t.bytesValue);case 7:return(function(o,u){const c=o.split("/"),h=u.split("/");for(let f=0;f<c.length&&f<h.length;f++){const m=U(c[f],h[f]);if(m!==0)return m}return U(c.length,h.length)})(r.referenceValue,t.referenceValue);case 8:return(function(o,u){const c=U(Z(o.latitude),Z(u.latitude));return c!==0?c:U(Z(o.longitude),Z(u.longitude))})(r.geoPointValue,t.geoPointValue);case 9:return So(r.arrayValue,t.arrayValue);case 10:return(function(o,u){var c,h,f,m;const y=o.fields||{},A=u.fields||{},S=(c=y[ir])===null||c===void 0?void 0:c.arrayValue,C=(h=A[ir])===null||h===void 0?void 0:h.arrayValue,x=U(((f=S==null?void 0:S.values)===null||f===void 0?void 0:f.length)||0,((m=C==null?void 0:C.values)===null||m===void 0?void 0:m.length)||0);return x!==0?x:So(S,C)})(r.mapValue,t.mapValue);case 11:return(function(o,u){if(o===Hn.mapValue&&u===Hn.mapValue)return 0;if(o===Hn.mapValue)return 1;if(u===Hn.mapValue)return-1;const c=o.fields||{},h=Object.keys(c),f=u.fields||{},m=Object.keys(f);h.sort(),m.sort();for(let y=0;y<h.length&&y<m.length;++y){const A=cs(h[y],m[y]);if(A!==0)return A;const S=Ce(c[h[y]],f[m[y]]);if(S!==0)return S}return U(h.length,m.length)})(r.mapValue,t.mapValue);default:throw M(23264,{le:e})}}function Vo(r,t){if(typeof r=="string"&&typeof t=="string"&&r.length===t.length)return U(r,t);const e=te(r),n=te(t),i=U(e.seconds,n.seconds);return i!==0?i:U(e.nanos,n.nanos)}function So(r,t){const e=r.values||[],n=t.values||[];for(let i=0;i<e.length&&i<n.length;++i){const o=Ce(e[i],n[i]);if(o)return o}return U(e.length,n.length)}function be(r){return hs(r)}function hs(r){return"nullValue"in r?"null":"booleanValue"in r?""+r.booleanValue:"integerValue"in r?""+r.integerValue:"doubleValue"in r?""+r.doubleValue:"timestampValue"in r?(function(e){const n=te(e);return`time(${n.seconds},${n.nanos})`})(r.timestampValue):"stringValue"in r?r.stringValue:"bytesValue"in r?(function(e){return ee(e).toBase64()})(r.bytesValue):"referenceValue"in r?(function(e){return O.fromName(e).toString()})(r.referenceValue):"geoPointValue"in r?(function(e){return`geo(${e.latitude},${e.longitude})`})(r.geoPointValue):"arrayValue"in r?(function(e){let n="[",i=!0;for(const o of e.values||[])i?i=!1:n+=",",n+=hs(o);return n+"]"})(r.arrayValue):"mapValue"in r?(function(e){const n=Object.keys(e.fields||{}).sort();let i="{",o=!0;for(const u of n)o?o=!1:i+=",",i+=`${u}:${hs(e.fields[u])}`;return i+"}"})(r.mapValue):M(61005,{value:r})}function Zn(r){switch(ne(r)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Er(r);return t?16+Zn(t):16;case 5:return 2*r.stringValue.length;case 6:return ee(r.bytesValue).approximateByteSize();case 7:return r.referenceValue.length;case 9:return(function(n){return(n.values||[]).reduce(((i,o)=>i+Zn(o)),0)})(r.arrayValue);case 10:case 11:return(function(n){let i=0;return ie(n.fields,((o,u)=>{i+=o.length+Zn(u)})),i})(r.mapValue);default:throw M(13486,{value:r})}}function Co(r,t){return{referenceValue:`projects/${r.projectId}/databases/${r.database}/documents/${t.path.canonicalString()}`}}function ds(r){return!!r&&"integerValue"in r}function Ns(r){return!!r&&"arrayValue"in r}function bo(r){return!!r&&"nullValue"in r}function Do(r){return!!r&&"doubleValue"in r&&isNaN(Number(r.doubleValue))}function tr(r){return!!r&&"mapValue"in r}function Sc(r){var t,e;return((e=(((t=r==null?void 0:r.mapValue)===null||t===void 0?void 0:t.fields)||{})[qa])===null||e===void 0?void 0:e.stringValue)===ja}function an(r){if(r.geoPointValue)return{geoPointValue:Object.assign({},r.geoPointValue)};if(r.timestampValue&&typeof r.timestampValue=="object")return{timestampValue:Object.assign({},r.timestampValue)};if(r.mapValue){const t={mapValue:{fields:{}}};return ie(r.mapValue.fields,((e,n)=>t.mapValue.fields[e]=an(n))),t}if(r.arrayValue){const t={arrayValue:{values:[]}};for(let e=0;e<(r.arrayValue.values||[]).length;++e)t.arrayValue.values[e]=an(r.arrayValue.values[e]);return t}return Object.assign({},r)}function Cc(r){return(((r.mapValue||{}).fields||{}).__type__||{}).stringValue===Vc}/**
|
|
520
520
|
* @license
|
|
521
521
|
* Copyright 2017 Google LLC
|
|
522
522
|
*
|
|
@@ -531,7 +531,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
531
531
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
532
532
|
* See the License for the specific language governing permissions and
|
|
533
533
|
* limitations under the License.
|
|
534
|
-
*/class It{constructor(t){this.value=t}static empty(){return new It({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!
|
|
534
|
+
*/class It{constructor(t){this.value=t}static empty(){return new It({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!tr(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=an(e)}setAll(t){let e=ct.emptyPath(),n={},i=[];t.forEach(((u,c)=>{if(!e.isImmediateParentOf(c)){const h=this.getFieldsMap(e);this.applyChanges(h,n,i),n={},i=[],e=c.popLast()}u?n[c.lastSegment()]=an(u):i.push(c.lastSegment())}));const o=this.getFieldsMap(e);this.applyChanges(o,n,i)}delete(t){const e=this.field(t.popLast());tr(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Ot(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let i=e.mapValue.fields[t.get(n)];tr(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=i),e=i}return e.mapValue.fields}applyChanges(t,e,n){ie(e,((i,o)=>t[i]=o));for(const i of n)delete t[i]}clone(){return new It(an(this.value))}}function Ba(r){const t=[];return ie(r.fields,((e,n)=>{const i=new ct([e]);if(tr(n)){const o=Ba(n.mapValue).fields;if(o.length===0)t.push(i);else for(const u of o)t.push(i.child(u))}else t.push(i)})),new wt(t)}/**
|
|
535
535
|
* @license
|
|
536
536
|
* Copyright 2017 Google LLC
|
|
537
537
|
*
|
|
@@ -561,7 +561,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
561
561
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
562
562
|
* See the License for the specific language governing permissions and
|
|
563
563
|
* limitations under the License.
|
|
564
|
-
*/class
|
|
564
|
+
*/class or{constructor(t,e){this.position=t,this.inclusive=e}}function No(r,t,e){let n=0;for(let i=0;i<r.position.length;i++){const o=t[i],u=r.position[i];if(o.field.isKeyField()?n=O.comparator(O.fromName(u.referenceValue),e.key):n=Ce(u,e.data.field(o.field)),o.dir==="desc"&&(n*=-1),n!==0)break}return n}function ko(r,t){if(r===null)return t===null;if(t===null||r.inclusive!==t.inclusive||r.position.length!==t.position.length)return!1;for(let e=0;e<r.position.length;e++)if(!Ot(r.position[e],t.position[e]))return!1;return!0}/**
|
|
565
565
|
* @license
|
|
566
566
|
* Copyright 2022 Google LLC
|
|
567
567
|
*
|
|
@@ -576,7 +576,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
576
576
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
577
577
|
* See the License for the specific language governing permissions and
|
|
578
578
|
* limitations under the License.
|
|
579
|
-
*/class
|
|
579
|
+
*/class ar{constructor(t,e="asc"){this.field=t,this.dir=e}}function bc(r,t){return r.dir===t.dir&&r.field.isEqual(t.field)}/**
|
|
580
580
|
* @license
|
|
581
581
|
* Copyright 2022 Google LLC
|
|
582
582
|
*
|
|
@@ -591,7 +591,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
591
591
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
592
592
|
* See the License for the specific language governing permissions and
|
|
593
593
|
* limitations under the License.
|
|
594
|
-
*/class
|
|
594
|
+
*/class za{}class et extends za{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?e==="in"||e==="not-in"?this.createKeyFieldInFilter(t,e,n):new Nc(t,e,n):e==="array-contains"?new Oc(t,n):e==="in"?new Mc(t,n):e==="not-in"?new Fc(t,n):e==="array-contains-any"?new Lc(t,n):new et(t,e,n)}static createKeyFieldInFilter(t,e,n){return e==="in"?new kc(t,n):new xc(t,n)}matches(t){const e=t.data.field(this.field);return this.op==="!="?e!==null&&e.nullValue===void 0&&this.matchesComparison(Ce(e,this.value)):e!==null&&ne(this.value)===ne(e)&&this.matchesComparison(Ce(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]}}class Ct extends za{constructor(t,e){super(),this.filters=t,this.op=e,this.he=null}static create(t,e){return new Ct(t,e)}matches(t){return $a(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 $a(r){return r.op==="and"}function Ga(r){return Dc(r)&&$a(r)}function Dc(r){for(const t of r.filters)if(t instanceof Ct)return!1;return!0}function fs(r){if(r instanceof et)return r.field.canonicalString()+r.op.toString()+be(r.value);if(Ga(r))return r.filters.map((t=>fs(t))).join(",");{const t=r.filters.map((e=>fs(e))).join(",");return`${r.op}(${t})`}}function Ka(r,t){return r instanceof et?(function(n,i){return i instanceof et&&n.op===i.op&&n.field.isEqual(i.field)&&Ot(n.value,i.value)})(r,t):r instanceof Ct?(function(n,i){return i instanceof Ct&&n.op===i.op&&n.filters.length===i.filters.length?n.filters.reduce(((o,u,c)=>o&&Ka(u,i.filters[c])),!0):!1})(r,t):void M(19439)}function Qa(r){return r instanceof et?(function(e){return`${e.field.canonicalString()} ${e.op} ${be(e.value)}`})(r):r instanceof Ct?(function(e){return e.op.toString()+" {"+e.getFilters().map(Qa).join(" ,")+"}"})(r):"Filter"}class Nc extends et{constructor(t,e,n){super(t,e,n),this.key=O.fromName(n.referenceValue)}matches(t){const e=O.comparator(t.key,this.key);return this.matchesComparison(e)}}class kc extends et{constructor(t,e){super(t,"in",e),this.keys=Wa("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class xc extends et{constructor(t,e){super(t,"not-in",e),this.keys=Wa("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function Wa(r,t){var e;return(((e=t.arrayValue)===null||e===void 0?void 0:e.values)||[]).map((n=>O.fromName(n.referenceValue)))}class Oc extends et{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Ns(e)&&pn(e.arrayValue,this.value)}}class Mc extends et{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return e!==null&&pn(this.value.arrayValue,e)}}class Fc extends et{constructor(t,e){super(t,"not-in",e)}matches(t){if(pn(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return e!==null&&e.nullValue===void 0&&!pn(this.value.arrayValue,e)}}class Lc extends et{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Ns(e)||!e.arrayValue.values)&&e.arrayValue.values.some((n=>pn(this.value.arrayValue,n)))}}/**
|
|
595
595
|
* @license
|
|
596
596
|
* Copyright 2019 Google LLC
|
|
597
597
|
*
|
|
@@ -606,7 +606,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
606
606
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
607
607
|
* See the License for the specific language governing permissions and
|
|
608
608
|
* limitations under the License.
|
|
609
|
-
*/class
|
|
609
|
+
*/class Uc{constructor(t,e=null,n=[],i=[],o=null,u=null,c=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=i,this.limit=o,this.startAt=u,this.endAt=c,this.Pe=null}}function xo(r,t=null,e=[],n=[],i=null,o=null,u=null){return new Uc(r,t,e,n,i,o,u)}function ks(r){const t=L(r);if(t.Pe===null){let e=t.path.canonicalString();t.collectionGroup!==null&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((n=>fs(n))).join(","),e+="|ob:",e+=t.orderBy.map((n=>(function(o){return o.field.canonicalString()+o.dir})(n))).join(","),yr(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((n=>be(n))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((n=>be(n))).join(",")),t.Pe=e}return t.Pe}function xs(r,t){if(r.limit!==t.limit||r.orderBy.length!==t.orderBy.length)return!1;for(let e=0;e<r.orderBy.length;e++)if(!bc(r.orderBy[e],t.orderBy[e]))return!1;if(r.filters.length!==t.filters.length)return!1;for(let e=0;e<r.filters.length;e++)if(!Ka(r.filters[e],t.filters[e]))return!1;return r.collectionGroup===t.collectionGroup&&!!r.path.isEqual(t.path)&&!!ko(r.startAt,t.startAt)&&ko(r.endAt,t.endAt)}function ms(r){return O.isDocumentKey(r.path)&&r.collectionGroup===null&&r.filters.length===0}/**
|
|
610
610
|
* @license
|
|
611
611
|
* Copyright 2017 Google LLC
|
|
612
612
|
*
|
|
@@ -621,7 +621,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
621
621
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
622
622
|
* See the License for the specific language governing permissions and
|
|
623
623
|
* limitations under the License.
|
|
624
|
-
*/class
|
|
624
|
+
*/class Tn{constructor(t,e=null,n=[],i=[],o=null,u="F",c=null,h=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=i,this.limit=o,this.limitType=u,this.startAt=c,this.endAt=h,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}}function qc(r,t,e,n,i,o,u,c){return new Tn(r,t,e,n,i,o,u,c)}function Tr(r){return new Tn(r)}function Oo(r){return r.filters.length===0&&r.limit===null&&r.startAt==null&&r.endAt==null&&(r.explicitOrderBy.length===0||r.explicitOrderBy.length===1&&r.explicitOrderBy[0].field.isKeyField())}function Ha(r){return r.collectionGroup!==null}function un(r){const t=L(r);if(t.Te===null){t.Te=[];const e=new Set;for(const o of t.explicitOrderBy)t.Te.push(o),e.add(o.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";(function(u){let c=new st(ct.comparator);return u.filters.forEach((h=>{h.getFlattenedFilters().forEach((f=>{f.isInequality()&&(c=c.add(f.field))}))})),c})(t).forEach((o=>{e.has(o.canonicalString())||o.isKeyField()||t.Te.push(new ar(o,n))})),e.has(ct.keyField().canonicalString())||t.Te.push(new ar(ct.keyField(),n))}return t.Te}function Dt(r){const t=L(r);return t.Ie||(t.Ie=jc(t,un(r))),t.Ie}function jc(r,t){if(r.limitType==="F")return xo(r.path,r.collectionGroup,t,r.filters,r.limit,r.startAt,r.endAt);{t=t.map((i=>{const o=i.dir==="desc"?"asc":"desc";return new ar(i.field,o)}));const e=r.endAt?new or(r.endAt.position,r.endAt.inclusive):null,n=r.startAt?new or(r.startAt.position,r.startAt.inclusive):null;return xo(r.path,r.collectionGroup,t,r.filters,r.limit,e,n)}}function ps(r,t){const e=r.filters.concat([t]);return new Tn(r.path,r.collectionGroup,r.explicitOrderBy.slice(),e,r.limit,r.limitType,r.startAt,r.endAt)}function gs(r,t,e){return new Tn(r.path,r.collectionGroup,r.explicitOrderBy.slice(),r.filters.slice(),t,e,r.startAt,r.endAt)}function vr(r,t){return xs(Dt(r),Dt(t))&&r.limitType===t.limitType}function Xa(r){return`${ks(Dt(r))}|lt:${r.limitType}`}function we(r){return`Query(target=${(function(e){let n=e.path.canonicalString();return e.collectionGroup!==null&&(n+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(n+=`, filters: [${e.filters.map((i=>Qa(i))).join(", ")}]`),yr(e.limit)||(n+=", limit: "+e.limit),e.orderBy.length>0&&(n+=`, orderBy: [${e.orderBy.map((i=>(function(u){return`${u.field.canonicalString()} (${u.dir})`})(i))).join(", ")}]`),e.startAt&&(n+=", startAt: ",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map((i=>be(i))).join(",")),e.endAt&&(n+=", endAt: ",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map((i=>be(i))).join(",")),`Target(${n})`})(Dt(r))}; limitType=${r.limitType})`}function Ir(r,t){return t.isFoundDocument()&&(function(n,i){const o=i.key.path;return n.collectionGroup!==null?i.key.hasCollectionId(n.collectionGroup)&&n.path.isPrefixOf(o):O.isDocumentKey(n.path)?n.path.isEqual(o):n.path.isImmediateParentOf(o)})(r,t)&&(function(n,i){for(const o of un(n))if(!o.field.isKeyField()&&i.data.field(o.field)===null)return!1;return!0})(r,t)&&(function(n,i){for(const o of n.filters)if(!o.matches(i))return!1;return!0})(r,t)&&(function(n,i){return!(n.startAt&&!(function(u,c,h){const f=No(u,c,h);return u.inclusive?f<=0:f<0})(n.startAt,un(n),i)||n.endAt&&!(function(u,c,h){const f=No(u,c,h);return u.inclusive?f>=0:f>0})(n.endAt,un(n),i))})(r,t)}function Bc(r){return r.collectionGroup||(r.path.length%2==1?r.path.lastSegment():r.path.get(r.path.length-2))}function Ya(r){return(t,e)=>{let n=!1;for(const i of un(r)){const o=zc(i,t,e);if(o!==0)return o;n=n||i.field.isKeyField()}return 0}}function zc(r,t,e){const n=r.field.isKeyField()?O.comparator(t.key,e.key):(function(o,u,c){const h=u.data.field(o),f=c.data.field(o);return h!==null&&f!==null?Ce(h,f):M(42886)})(r.field,t,e);switch(r.dir){case"asc":return n;case"desc":return-1*n;default:return M(19790,{direction:r.dir})}}/**
|
|
625
625
|
* @license
|
|
626
626
|
* Copyright 2017 Google LLC
|
|
627
627
|
*
|
|
@@ -636,7 +636,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
636
636
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
637
637
|
* See the License for the specific language governing permissions and
|
|
638
638
|
* limitations under the License.
|
|
639
|
-
*/class ge{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(n!==void 0){for(const[i,o]of n)if(this.equalsFn(i,t))return o}}has(t){return this.get(t)!==void 0}set(t,e){const n=this.mapKeyFn(t),i=this.inner[n];if(i===void 0)return this.inner[n]=[[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){const e=this.mapKeyFn(t),n=this.inner[e];if(n===void 0)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],t))return n.length===1?delete this.inner[e]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(t){ie(this.inner,((e,n)=>{for(const[i,o]of n)t(i,o)}))}isEmpty(){return
|
|
639
|
+
*/class ge{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(n!==void 0){for(const[i,o]of n)if(this.equalsFn(i,t))return o}}has(t){return this.get(t)!==void 0}set(t,e){const n=this.mapKeyFn(t),i=this.inner[n];if(i===void 0)return this.inner[n]=[[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){const e=this.mapKeyFn(t),n=this.inner[e];if(n===void 0)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],t))return n.length===1?delete this.inner[e]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(t){ie(this.inner,((e,n)=>{for(const[i,o]of n)t(i,o)}))}isEmpty(){return xa(this.inner)}size(){return this.innerSize}}/**
|
|
640
640
|
* @license
|
|
641
641
|
* Copyright 2017 Google LLC
|
|
642
642
|
*
|
|
@@ -651,7 +651,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
651
651
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
652
652
|
* See the License for the specific language governing permissions and
|
|
653
653
|
* limitations under the License.
|
|
654
|
-
*/const
|
|
654
|
+
*/const $c=new Y(O.comparator);function $t(){return $c}const Ja=new Y(O.comparator);function rn(...r){let t=Ja;for(const e of r)t=t.insert(e.key,e);return t}function Za(r){let t=Ja;return r.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function he(){return ln()}function tu(){return ln()}function ln(){return new ge((r=>r.toString()),((r,t)=>r.isEqual(t)))}const Gc=new Y(O.comparator),Kc=new st(O.comparator);function j(...r){let t=Kc;for(const e of r)t=t.add(e);return t}const Qc=new st(U);function Wc(){return Qc}/**
|
|
655
655
|
* @license
|
|
656
656
|
* Copyright 2020 Google LLC
|
|
657
657
|
*
|
|
@@ -666,7 +666,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
666
666
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
667
667
|
* See the License for the specific language governing permissions and
|
|
668
668
|
* limitations under the License.
|
|
669
|
-
*/function
|
|
669
|
+
*/function Os(r,t){if(r.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:sr(t)?"-0":t}}function eu(r){return{integerValue:""+r}}function Hc(r,t){return Ic(t)?eu(t):Os(r,t)}/**
|
|
670
670
|
* @license
|
|
671
671
|
* Copyright 2018 Google LLC
|
|
672
672
|
*
|
|
@@ -681,7 +681,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
681
681
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
682
682
|
* See the License for the specific language governing permissions and
|
|
683
683
|
* limitations under the License.
|
|
684
|
-
*/class
|
|
684
|
+
*/class Ar{constructor(){this._=void 0}}function Xc(r,t,e){return r instanceof gn?(function(i,o){const u={fields:{[Fa]:{stringValue:Ma},[Ua]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return o&&Ds(o)&&(o=Er(o)),o&&(u.fields[La]=o),{mapValue:u}})(e,t):r instanceof _n?ru(r,t):r instanceof yn?su(r,t):(function(i,o){const u=nu(i,o),c=Mo(u)+Mo(i.Ee);return ds(u)&&ds(i.Ee)?eu(c):Os(i.serializer,c)})(r,t)}function Yc(r,t,e){return r instanceof _n?ru(r,t):r instanceof yn?su(r,t):e}function nu(r,t){return r instanceof ur?(function(n){return ds(n)||(function(o){return!!o&&"doubleValue"in o})(n)})(t)?t:{integerValue:0}:null}class gn extends Ar{}class _n extends Ar{constructor(t){super(),this.elements=t}}function ru(r,t){const e=iu(t);for(const n of r.elements)e.some((i=>Ot(i,n)))||e.push(n);return{arrayValue:{values:e}}}class yn extends Ar{constructor(t){super(),this.elements=t}}function su(r,t){let e=iu(t);for(const n of r.elements)e=e.filter((i=>!Ot(i,n)));return{arrayValue:{values:e}}}class ur extends Ar{constructor(t,e){super(),this.serializer=t,this.Ee=e}}function Mo(r){return Z(r.integerValue||r.doubleValue)}function iu(r){return Ns(r)&&r.arrayValue.values?r.arrayValue.values.slice():[]}/**
|
|
685
685
|
* @license
|
|
686
686
|
* Copyright 2017 Google LLC
|
|
687
687
|
*
|
|
@@ -696,7 +696,22 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
696
696
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
697
697
|
* See the License for the specific language governing permissions and
|
|
698
698
|
* limitations under the License.
|
|
699
|
-
*/class
|
|
699
|
+
*/class Jc{constructor(t,e){this.field=t,this.transform=e}}function Zc(r,t){return r.field.isEqual(t.field)&&(function(n,i){return n instanceof _n&&i instanceof _n||n instanceof yn&&i instanceof yn?Se(n.elements,i.elements,Ot):n instanceof ur&&i instanceof ur?Ot(n.Ee,i.Ee):n instanceof gn&&i instanceof gn})(r.transform,t.transform)}class th{constructor(t,e){this.version=t,this.transformResults=e}}class Vt{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Vt}static exists(t){return new Vt(void 0,t)}static updateTime(t){return new Vt(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 er(r,t){return r.updateTime!==void 0?t.isFoundDocument()&&t.version.isEqual(r.updateTime):r.exists===void 0||r.exists===t.isFoundDocument()}class wr{}function ou(r,t){if(!r.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return r.isNoDocument()?new Ms(r.key,Vt.none()):new vn(r.key,r.data,Vt.none());{const e=r.data,n=It.empty();let i=new st(ct.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?n.delete(o):n.set(o,u),i=i.add(o)}return new oe(r.key,n,new wt(i.toArray()),Vt.none())}}function eh(r,t,e){r instanceof vn?(function(i,o,u){const c=i.value.clone(),h=Lo(i.fieldTransforms,o,u.transformResults);c.setAll(h),o.convertToFoundDocument(u.version,c).setHasCommittedMutations()})(r,t,e):r instanceof oe?(function(i,o,u){if(!er(i.precondition,o))return void o.convertToUnknownDocument(u.version);const c=Lo(i.fieldTransforms,o,u.transformResults),h=o.data;h.setAll(au(i)),h.setAll(c),o.convertToFoundDocument(u.version,h).setHasCommittedMutations()})(r,t,e):(function(i,o,u){o.convertToNoDocument(u.version).setHasCommittedMutations()})(0,t,e)}function cn(r,t,e,n){return r instanceof vn?(function(o,u,c,h){if(!er(o.precondition,u))return c;const f=o.value.clone(),m=Uo(o.fieldTransforms,h,u);return f.setAll(m),u.convertToFoundDocument(u.version,f).setHasLocalMutations(),null})(r,t,e,n):r instanceof oe?(function(o,u,c,h){if(!er(o.precondition,u))return c;const f=Uo(o.fieldTransforms,h,u),m=u.data;return m.setAll(au(o)),m.setAll(f),u.convertToFoundDocument(u.version,m).setHasLocalMutations(),c===null?null:c.unionWith(o.fieldMask.fields).unionWith(o.fieldTransforms.map((y=>y.field)))})(r,t,e,n):(function(o,u,c){return er(o.precondition,u)?(u.convertToNoDocument(u.version).setHasLocalMutations(),null):c})(r,t,e)}function nh(r,t){let e=null;for(const n of r.fieldTransforms){const i=t.data.field(n.field),o=nu(n.transform,i||null);o!=null&&(e===null&&(e=It.empty()),e.set(n.field,o))}return e||null}function Fo(r,t){return r.type===t.type&&!!r.key.isEqual(t.key)&&!!r.precondition.isEqual(t.precondition)&&!!(function(n,i){return n===void 0&&i===void 0||!(!n||!i)&&Se(n,i,((o,u)=>Zc(o,u)))})(r.fieldTransforms,t.fieldTransforms)&&(r.type===0?r.value.isEqual(t.value):r.type!==1||r.data.isEqual(t.data)&&r.fieldMask.isEqual(t.fieldMask))}class vn extends wr{constructor(t,e,n,i=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class oe extends wr{constructor(t,e,n,i,o=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=i,this.fieldTransforms=o,this.type=1}getFieldMask(){return this.fieldMask}}function au(r){const t=new Map;return r.fieldMask.fields.forEach((e=>{if(!e.isEmpty()){const n=r.data.field(e);t.set(e,n)}})),t}function Lo(r,t,e){const n=new Map;G(r.length===e.length,32656,{Ae:e.length,Re:r.length});for(let i=0;i<e.length;i++){const o=r[i],u=o.transform,c=t.data.field(o.field);n.set(o.field,Yc(u,c,e[i]))}return n}function Uo(r,t,e){const n=new Map;for(const i of r){const o=i.transform,u=e.data.field(i.field);n.set(i.field,Xc(o,u,t))}return n}class Ms extends wr{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class rh extends wr{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
|
|
700
|
+
* @license
|
|
701
|
+
* Copyright 2017 Google LLC
|
|
702
|
+
*
|
|
703
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
704
|
+
* you may not use this file except in compliance with the License.
|
|
705
|
+
* You may obtain a copy of the License at
|
|
706
|
+
*
|
|
707
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
708
|
+
*
|
|
709
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
710
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
711
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
712
|
+
* See the License for the specific language governing permissions and
|
|
713
|
+
* limitations under the License.
|
|
714
|
+
*/class sh{constructor(t,e,n,i){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let i=0;i<this.mutations.length;i++){const o=this.mutations[i];o.key.isEqual(t.key)&&eh(o,t,n[i])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=cn(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=cn(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=tu();return this.mutations.forEach((i=>{const o=t.get(i.key),u=o.overlayedDocument;let c=this.applyToLocalView(u,o.mutatedFields);c=e.has(i.key)?null:c;const h=ou(u,c);h!==null&&n.set(i.key,h),u.isValidDocument()||u.convertToNoDocument(F.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),j())}isEqual(t){return this.batchId===t.batchId&&Se(this.mutations,t.mutations,((e,n)=>Fo(e,n)))&&Se(this.baseMutations,t.baseMutations,((e,n)=>Fo(e,n)))}}class Fs{constructor(t,e,n,i){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=i}static from(t,e,n){G(t.mutations.length===n.length,58842,{Ve:t.mutations.length,me:n.length});let i=(function(){return Gc})();const o=t.mutations;for(let u=0;u<o.length;u++)i=i.insert(o[u].key,n[u].version);return new Fs(t,e,n,i)}}/**
|
|
700
715
|
* @license
|
|
701
716
|
* Copyright 2022 Google LLC
|
|
702
717
|
*
|
|
@@ -711,7 +726,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
711
726
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
712
727
|
* See the License for the specific language governing permissions and
|
|
713
728
|
* limitations under the License.
|
|
714
|
-
*/class
|
|
729
|
+
*/class ih{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{
|
|
715
730
|
largestBatchId: ${this.largestBatchId},
|
|
716
731
|
mutation: ${this.mutation.toString()}
|
|
717
732
|
}`}}/**
|
|
@@ -729,7 +744,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
729
744
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
730
745
|
* See the License for the specific language governing permissions and
|
|
731
746
|
* limitations under the License.
|
|
732
|
-
*/class
|
|
747
|
+
*/class oh{constructor(t,e){this.count=t,this.unchangedNames=e}}/**
|
|
733
748
|
* @license
|
|
734
749
|
* Copyright 2017 Google LLC
|
|
735
750
|
*
|
|
@@ -744,7 +759,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
744
759
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
745
760
|
* See the License for the specific language governing permissions and
|
|
746
761
|
* limitations under the License.
|
|
747
|
-
*/var tt,
|
|
762
|
+
*/var tt,B;function ah(r){switch(r){case P.OK:return M(64938);case P.CANCELLED:case P.UNKNOWN:case P.DEADLINE_EXCEEDED:case P.RESOURCE_EXHAUSTED:case P.INTERNAL:case P.UNAVAILABLE:case P.UNAUTHENTICATED:return!1;case P.INVALID_ARGUMENT:case P.NOT_FOUND:case P.ALREADY_EXISTS:case P.PERMISSION_DENIED:case P.FAILED_PRECONDITION:case P.ABORTED:case P.OUT_OF_RANGE:case P.UNIMPLEMENTED:case P.DATA_LOSS:return!0;default:return M(15467,{code:r})}}function uu(r){if(r===void 0)return zt("GRPC error has no .code"),P.UNKNOWN;switch(r){case tt.OK:return P.OK;case tt.CANCELLED:return P.CANCELLED;case tt.UNKNOWN:return P.UNKNOWN;case tt.DEADLINE_EXCEEDED:return P.DEADLINE_EXCEEDED;case tt.RESOURCE_EXHAUSTED:return P.RESOURCE_EXHAUSTED;case tt.INTERNAL:return P.INTERNAL;case tt.UNAVAILABLE:return P.UNAVAILABLE;case tt.UNAUTHENTICATED:return P.UNAUTHENTICATED;case tt.INVALID_ARGUMENT:return P.INVALID_ARGUMENT;case tt.NOT_FOUND:return P.NOT_FOUND;case tt.ALREADY_EXISTS:return P.ALREADY_EXISTS;case tt.PERMISSION_DENIED:return P.PERMISSION_DENIED;case tt.FAILED_PRECONDITION:return P.FAILED_PRECONDITION;case tt.ABORTED:return P.ABORTED;case tt.OUT_OF_RANGE:return P.OUT_OF_RANGE;case tt.UNIMPLEMENTED:return P.UNIMPLEMENTED;case tt.DATA_LOSS:return P.DATA_LOSS;default:return M(39323,{code:r})}}(B=tt||(tt={}))[B.OK=0]="OK",B[B.CANCELLED=1]="CANCELLED",B[B.UNKNOWN=2]="UNKNOWN",B[B.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",B[B.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",B[B.NOT_FOUND=5]="NOT_FOUND",B[B.ALREADY_EXISTS=6]="ALREADY_EXISTS",B[B.PERMISSION_DENIED=7]="PERMISSION_DENIED",B[B.UNAUTHENTICATED=16]="UNAUTHENTICATED",B[B.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",B[B.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",B[B.ABORTED=10]="ABORTED",B[B.OUT_OF_RANGE=11]="OUT_OF_RANGE",B[B.UNIMPLEMENTED=12]="UNIMPLEMENTED",B[B.INTERNAL=13]="INTERNAL",B[B.UNAVAILABLE=14]="UNAVAILABLE",B[B.DATA_LOSS=15]="DATA_LOSS";/**
|
|
748
763
|
* @license
|
|
749
764
|
* Copyright 2022 Google LLC
|
|
750
765
|
*
|
|
@@ -759,7 +774,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
759
774
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
760
775
|
* See the License for the specific language governing permissions and
|
|
761
776
|
* limitations under the License.
|
|
762
|
-
*/const
|
|
777
|
+
*/const uh=new Xt([4294967295,4294967295],0);function qo(r){const t=ba().encode(r),e=new Ia;return e.update(t),new Uint8Array(e.digest())}function jo(r){const t=new DataView(r.buffer),e=t.getUint32(0,!0),n=t.getUint32(4,!0),i=t.getUint32(8,!0),o=t.getUint32(12,!0);return[new Xt([e,n],0),new Xt([i,o],0)]}class Ls{constructor(t,e,n){if(this.bitmap=t,this.padding=e,this.hashCount=n,e<0||e>=8)throw new sn(`Invalid padding: ${e}`);if(n<0)throw new sn(`Invalid hash count: ${n}`);if(t.length>0&&this.hashCount===0)throw new sn(`Invalid hash count: ${n}`);if(t.length===0&&e!==0)throw new sn(`Invalid padding when bitmap length is 0: ${e}`);this.fe=8*t.length-e,this.ge=Xt.fromNumber(this.fe)}pe(t,e,n){let i=t.add(e.multiply(Xt.fromNumber(n)));return i.compare(uh)===1&&(i=new Xt([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;const e=qo(t),[n,i]=jo(e);for(let o=0;o<this.hashCount;o++){const u=this.pe(n,i,o);if(!this.ye(u))return!1}return!0}static create(t,e,n){const i=t%8==0?0:8-t%8,o=new Uint8Array(Math.ceil(t/8)),u=new Ls(o,i,e);return n.forEach((c=>u.insert(c))),u}insert(t){if(this.fe===0)return;const e=qo(t),[n,i]=jo(e);for(let o=0;o<this.hashCount;o++){const u=this.pe(n,i,o);this.we(u)}}we(t){const e=Math.floor(t/8),n=t%8;this.bitmap[e]|=1<<n}}class sn extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
|
|
763
778
|
* @license
|
|
764
779
|
* Copyright 2017 Google LLC
|
|
765
780
|
*
|
|
@@ -774,7 +789,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
774
789
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
775
790
|
* See the License for the specific language governing permissions and
|
|
776
791
|
* limitations under the License.
|
|
777
|
-
*/class
|
|
792
|
+
*/class Rr{constructor(t,e,n,i,o){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=i,this.resolvedLimboDocuments=o}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const i=new Map;return i.set(t,In.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new Rr(F.min(),i,new Y(U),$t(),j())}}class In{constructor(t,e,n,i,o){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=i,this.removedDocuments=o}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new In(n,e,j(),j(),j())}}/**
|
|
778
793
|
* @license
|
|
779
794
|
* Copyright 2017 Google LLC
|
|
780
795
|
*
|
|
@@ -789,7 +804,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
789
804
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
790
805
|
* See the License for the specific language governing permissions and
|
|
791
806
|
* limitations under the License.
|
|
792
|
-
*/class tr{constructor(t,e,n,i){this.Se=t,this.removedTargetIds=e,this.key=n,this.be=i}}class Ya{constructor(t,e){this.targetId=t,this.De=e}}class Ja{constructor(t,e,n=ht.EMPTY_BYTE_STRING,i=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=i}}class xo{constructor(){this.ve=0,this.Ce=Oo(),this.Fe=ht.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=q(),e=q(),n=q();return this.Ce.forEach(((i,o)=>{switch(o){case 0:t=t.add(i);break;case 2:e=e.add(i);break;case 1:n=n.add(i);break;default:M(38017,{changeType:o})}})),new Tn(this.Fe,this.Me,t,e,n)}ke(){this.xe=!1,this.Ce=Oo()}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,G(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class Kc{constructor(t){this.We=t,this.Ge=new Map,this.ze=$t(),this.je=Wn(),this.Je=Wn(),this.He=new Y(U)}Ye(t){for(const e of t.Se)t.be&&t.be.isFoundDocument()?this.Ze(e,t.be):this.Xe(e,t.key,t.be);for(const e of t.removedTargetIds)this.Xe(e,t.key,t.be)}et(t){this.forEachTarget(t,(e=>{const n=this.tt(e);switch(t.state){case 0:this.nt(e)&&n.Be(t.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(t.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(e);break;case 3:this.nt(e)&&(n.Ke(),n.Be(t.resumeToken));break;case 4:this.nt(e)&&(this.rt(e),n.Be(t.resumeToken));break;default:M(56790,{state:t.state})}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Ge.forEach(((n,i)=>{this.nt(i)&&e(i)}))}it(t){const e=t.targetId,n=t.De.count,i=this.st(e);if(i){const o=i.target;if(cs(o))if(n===0){const u=new O(o.path);this.Xe(e,u,yt.newNoDocument(u,F.min()))}else G(n===1,20013,{expectedCount:n});else{const u=this.ot(e);if(u!==n){const c=this._t(t),h=c?this.ut(c,t,u):1;if(h!==0){this.rt(e);const f=h===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(e,f)}}}}}_t(t){const e=t.De.unchangedNames;if(!e||!e.bits)return null;const{bits:{bitmap:n="",padding:i=0},hashCount:o=0}=e;let u,c;try{u=ee(n).toUint8Array()}catch(h){if(h instanceof wa)return Jt("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{c=new xs(u,i,o)}catch(h){return Jt(h instanceof rn?"BloomFilter error: ":"Applying bloom filter failed: ",h),null}return c.fe===0?null:c}ut(t,e,n){return e.De.count===n-this.ht(t,e.targetId)?0:2}ht(t,e){const n=this.We.getRemoteKeysForTarget(e);let i=0;return n.forEach((o=>{const u=this.We.lt(),c=`projects/${u.projectId}/databases/${u.database}/documents/${o.path.canonicalString()}`;t.mightContain(c)||(this.Xe(e,o,null),i++)})),i}Pt(t){const e=new Map;this.Ge.forEach(((o,u)=>{const c=this.st(u);if(c){if(o.current&&cs(c.target)){const h=new O(c.target.path);this.Tt(h).has(u)||this.It(u,h)||this.Xe(u,h,yt.newNoDocument(h,t))}o.Ne&&(e.set(u,o.Le()),o.ke())}}));let n=q();this.Je.forEach(((o,u)=>{let c=!0;u.forEachWhile((h=>{const f=this.st(h);return!f||f.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)})),c&&(n=n.add(o))})),this.ze.forEach(((o,u)=>u.setReadTime(t)));const i=new Ar(t,e,this.He,this.ze,n);return this.ze=$t(),this.je=Wn(),this.Je=Wn(),this.He=new Y(U),i}Ze(t,e){if(!this.nt(t))return;const n=this.It(t,e.key)?2:0;this.tt(t).qe(e.key,n),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,n){if(!this.nt(t))return;const 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)),n&&(this.ze=this.ze.insert(e,n))}removeTarget(t){this.Ge.delete(t)}ot(t){const 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 xo,this.Ge.set(t,e)),e}dt(t){let e=this.Je.get(t);return e||(e=new st(U),this.Je=this.Je.insert(t,e)),e}Tt(t){let e=this.je.get(t);return e||(e=new st(U),this.je=this.je.insert(t,e)),e}nt(t){const e=this.st(t)!==null;return e||N("WatchChangeAggregator","Detected inactive target",t),e}st(t){const e=this.Ge.get(t);return e&&e.Oe?null:this.We.Et(t)}rt(t){this.Ge.set(t,new xo),this.We.getRemoteKeysForTarget(t).forEach((e=>{this.Xe(t,e,null)}))}It(t,e){return this.We.getRemoteKeysForTarget(t).has(e)}}function Wn(){return new Y(O.comparator)}function Oo(){return new Y(O.comparator)}const Qc={asc:"ASCENDING",desc:"DESCENDING"},Wc={"<":"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"},Hc={and:"AND",or:"OR"};class Xc{constructor(t,e){this.databaseId=t,this.useProto3Json=e}}function ds(r,t){return r.useProto3Json||pr(t)?t:{value:t}}function ur(r,t){return r.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Za(r,t){return r.useProto3Json?t.toBase64():t.toUint8Array()}function Yc(r,t){return ur(r,t.toTimestamp())}function bt(r){return G(!!r,49232),F.fromTimestamp((function(e){const n=te(e);return new W(n.seconds,n.nanos)})(r))}function Os(r,t){return fs(r,t).canonicalString()}function fs(r,t){const e=(function(i){return new X(["projects",i.projectId,"databases",i.database])})(r).child("documents");return t===void 0?e:e.child(t)}function tu(r){const t=X.fromString(r);return G(iu(t),10190,{key:t.toString()}),t}function ms(r,t){return Os(r.databaseId,t.path)}function ts(r,t){const e=tu(t);if(e.get(1)!==r.databaseId.projectId)throw new k(P.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+e.get(1)+" vs "+r.databaseId.projectId);if(e.get(3)!==r.databaseId.database)throw new k(P.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+e.get(3)+" vs "+r.databaseId.database);return new O(nu(e))}function eu(r,t){return Os(r.databaseId,t)}function Jc(r){const t=tu(r);return t.length===4?X.emptyPath():nu(t)}function ps(r){return new X(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function nu(r){return G(r.length>4&&r.get(4)==="documents",29091,{key:r.toString()}),r.popFirst(5)}function Mo(r,t,e){return{name:ms(r,t),fields:e.value.mapValue.fields}}function Zc(r,t){let e;if("targetChange"in t){t.targetChange;const n=(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,p){return f.useProto3Json?(G(p===void 0||typeof p=="string",58123),ht.fromBase64String(p||"")):(G(p===void 0||p instanceof Buffer||p instanceof Uint8Array,16193),ht.fromUint8Array(p||new Uint8Array))})(r,t.targetChange.resumeToken),u=t.targetChange.cause,c=u&&(function(f){const p=f.code===void 0?P.UNKNOWN:Xa(f.code);return new k(p,f.message||"")})(u);e=new Ja(n,i,o,c||null)}else if("documentChange"in t){t.documentChange;const n=t.documentChange;n.document,n.document.name,n.document.updateTime;const i=ts(r,n.document.name),o=bt(n.document.updateTime),u=n.document.createTime?bt(n.document.createTime):F.min(),c=new It({mapValue:{fields:n.document.fields}}),h=yt.newFoundDocument(i,o,u,c),f=n.targetIds||[],p=n.removedTargetIds||[];e=new tr(f,p,h.key,h)}else if("documentDelete"in t){t.documentDelete;const n=t.documentDelete;n.document;const i=ts(r,n.document),o=n.readTime?bt(n.readTime):F.min(),u=yt.newNoDocument(i,o),c=n.removedTargetIds||[];e=new tr([],c,u.key,u)}else if("documentRemove"in t){t.documentRemove;const n=t.documentRemove;n.document;const i=ts(r,n.document),o=n.removedTargetIds||[];e=new tr([],o,i,null)}else{if(!("filter"in t))return M(11601,{At:t});{t.filter;const n=t.filter;n.targetId;const{count:i=0,unchangedNames:o}=n,u=new zc(i,o),c=n.targetId;e=new Ya(c,u)}}return e}function th(r,t){let e;if(t instanceof En)e={update:Mo(r,t.key,t.value)};else if(t instanceof Ns)e={delete:ms(r,t.key)};else if(t instanceof oe)e={update:Mo(r,t.key,t.data),updateMask:lh(t.fieldMask)};else{if(!(t instanceof qc))return M(16599,{Rt:t.type});e={verify:ms(r,t.key)}}return t.fieldTransforms.length>0&&(e.updateTransforms=t.fieldTransforms.map((n=>(function(o,u){const c=u.transform;if(c instanceof or)return{fieldPath:u.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof gn)return{fieldPath:u.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof _n)return{fieldPath:u.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof ar)return{fieldPath:u.field.canonicalString(),increment:c.Ee};throw M(20930,{transform:u.transform})})(0,n)))),t.precondition.isNone||(e.currentDocument=(function(i,o){return o.updateTime!==void 0?{updateTime:Yc(i,o.updateTime)}:o.exists!==void 0?{exists:o.exists}:M(27497)})(r,t.precondition)),e}function eh(r,t){return r&&r.length>0?(G(t!==void 0,14353),r.map((e=>(function(i,o){let u=i.updateTime?bt(i.updateTime):bt(o);return u.isEqual(F.min())&&(u=bt(o)),new Fc(u,i.transformResults||[])})(e,t)))):[]}function nh(r,t){return{documents:[eu(r,t.path)]}}function rh(r,t){const e={structuredQuery:{}},n=t.path;let i;t.collectionGroup!==null?(i=n,e.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=n.popLast(),e.structuredQuery.from=[{collectionId:n.lastSegment()}]),e.parent=eu(r,i);const o=(function(f){if(f.length!==0)return su(Ot.create(f,"and"))})(t.filters);o&&(e.structuredQuery.where=o);const u=(function(f){if(f.length!==0)return f.map((p=>(function(R){return{field:we(R.field),direction:oh(R.dir)}})(p)))})(t.orderBy);u&&(e.structuredQuery.orderBy=u);const c=ds(r,t.limit);return c!==null&&(e.structuredQuery.limit=c),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 sh(r){let t=Jc(r.parent);const e=r.structuredQuery,n=e.from?e.from.length:0;let i=null;if(n>0){G(n===1,65062);const p=e.from[0];p.allDescendants?i=p.collectionId:t=t.child(p.collectionId)}let o=[];e.where&&(o=(function(E){const R=ru(E);return R instanceof Ot&&xa(R)?R.getFilters():[R]})(e.where));let u=[];e.orderBy&&(u=(function(E){return E.map((R=>(function(D){return new ir(Re(D.field),(function(b){switch(b){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(D.direction))})(R)))})(e.orderBy));let c=null;e.limit&&(c=(function(E){let R;return R=typeof E=="object"?E.value:E,pr(R)?null:R})(e.limit));let h=null;e.startAt&&(h=(function(E){const R=!!E.before,S=E.values||[];return new sr(S,R)})(e.startAt));let f=null;return e.endAt&&(f=(function(E){const R=!E.before,S=E.values||[];return new sr(S,R)})(e.endAt)),Ac(t,i,u,o,c,"F",h,f)}function ih(r,t){const 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 ru(r){return r.unaryFilter!==void 0?(function(e){switch(e.unaryFilter.op){case"IS_NAN":const n=Re(e.unaryFilter.field);return nt.create(n,"==",{doubleValue:NaN});case"IS_NULL":const i=Re(e.unaryFilter.field);return nt.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const o=Re(e.unaryFilter.field);return nt.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const u=Re(e.unaryFilter.field);return nt.create(u,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return M(61313);default:return M(60726)}})(r):r.fieldFilter!==void 0?(function(e){return nt.create(Re(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)})(r):r.compositeFilter!==void 0?(function(e){return Ot.create(e.compositeFilter.filters.map((n=>ru(n))),(function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return M(1026)}})(e.compositeFilter.op))})(r):M(30097,{filter:r})}function oh(r){return Qc[r]}function ah(r){return Wc[r]}function uh(r){return Hc[r]}function we(r){return{fieldPath:r.canonicalString()}}function Re(r){return ct.fromServerFormat(r.fieldPath)}function su(r){return r instanceof nt?(function(e){if(e.op==="=="){if(Ao(e.value))return{unaryFilter:{field:we(e.field),op:"IS_NAN"}};if(Io(e.value))return{unaryFilter:{field:we(e.field),op:"IS_NULL"}}}else if(e.op==="!="){if(Ao(e.value))return{unaryFilter:{field:we(e.field),op:"IS_NOT_NAN"}};if(Io(e.value))return{unaryFilter:{field:we(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:we(e.field),op:ah(e.op),value:e.value}}})(r):r instanceof Ot?(function(e){const n=e.getFilters().map((i=>su(i)));return n.length===1?n[0]:{compositeFilter:{op:uh(e.op),filters:n}}})(r):M(54877,{filter:r})}function lh(r){const t=[];return r.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function iu(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}/**
|
|
807
|
+
*/class nr{constructor(t,e,n,i){this.Se=t,this.removedTargetIds=e,this.key=n,this.be=i}}class lu{constructor(t,e){this.targetId=t,this.De=e}}class cu{constructor(t,e,n=ht.EMPTY_BYTE_STRING,i=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=i}}class Bo{constructor(){this.ve=0,this.Ce=zo(),this.Fe=ht.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(),n=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:n=n.add(i);break;default:M(38017,{changeType:o})}})),new In(this.Fe,this.Me,t,e,n)}ke(){this.xe=!1,this.Ce=zo()}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,G(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class lh{constructor(t){this.We=t,this.Ge=new Map,this.ze=$t(),this.je=Xn(),this.Je=Xn(),this.He=new Y(U)}Ye(t){for(const e of t.Se)t.be&&t.be.isFoundDocument()?this.Ze(e,t.be):this.Xe(e,t.key,t.be);for(const e of t.removedTargetIds)this.Xe(e,t.key,t.be)}et(t){this.forEachTarget(t,(e=>{const n=this.tt(e);switch(t.state){case 0:this.nt(e)&&n.Be(t.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(t.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(e);break;case 3:this.nt(e)&&(n.Ke(),n.Be(t.resumeToken));break;case 4:this.nt(e)&&(this.rt(e),n.Be(t.resumeToken));break;default:M(56790,{state:t.state})}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Ge.forEach(((n,i)=>{this.nt(i)&&e(i)}))}it(t){const e=t.targetId,n=t.De.count,i=this.st(e);if(i){const o=i.target;if(ms(o))if(n===0){const u=new O(o.path);this.Xe(e,u,yt.newNoDocument(u,F.min()))}else G(n===1,20013,{expectedCount:n});else{const u=this.ot(e);if(u!==n){const c=this._t(t),h=c?this.ut(c,t,u):1;if(h!==0){this.rt(e);const f=h===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(e,f)}}}}}_t(t){const e=t.De.unchangedNames;if(!e||!e.bits)return null;const{bits:{bitmap:n="",padding:i=0},hashCount:o=0}=e;let u,c;try{u=ee(n).toUint8Array()}catch(h){if(h instanceof Oa)return Jt("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{c=new Ls(u,i,o)}catch(h){return Jt(h instanceof sn?"BloomFilter error: ":"Applying bloom filter failed: ",h),null}return c.fe===0?null:c}ut(t,e,n){return e.De.count===n-this.ht(t,e.targetId)?0:2}ht(t,e){const n=this.We.getRemoteKeysForTarget(e);let i=0;return n.forEach((o=>{const u=this.We.lt(),c=`projects/${u.projectId}/databases/${u.database}/documents/${o.path.canonicalString()}`;t.mightContain(c)||(this.Xe(e,o,null),i++)})),i}Pt(t){const e=new Map;this.Ge.forEach(((o,u)=>{const c=this.st(u);if(c){if(o.current&&ms(c.target)){const h=new O(c.target.path);this.Tt(h).has(u)||this.It(u,h)||this.Xe(u,h,yt.newNoDocument(h,t))}o.Ne&&(e.set(u,o.Le()),o.ke())}}));let n=j();this.Je.forEach(((o,u)=>{let c=!0;u.forEachWhile((h=>{const f=this.st(h);return!f||f.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)})),c&&(n=n.add(o))})),this.ze.forEach(((o,u)=>u.setReadTime(t)));const i=new Rr(t,e,this.He,this.ze,n);return this.ze=$t(),this.je=Xn(),this.Je=Xn(),this.He=new Y(U),i}Ze(t,e){if(!this.nt(t))return;const n=this.It(t,e.key)?2:0;this.tt(t).qe(e.key,n),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,n){if(!this.nt(t))return;const 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)),n&&(this.ze=this.ze.insert(e,n))}removeTarget(t){this.Ge.delete(t)}ot(t){const 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 Bo,this.Ge.set(t,e)),e}dt(t){let e=this.Je.get(t);return e||(e=new st(U),this.Je=this.Je.insert(t,e)),e}Tt(t){let e=this.je.get(t);return e||(e=new st(U),this.je=this.je.insert(t,e)),e}nt(t){const e=this.st(t)!==null;return e||k("WatchChangeAggregator","Detected inactive target",t),e}st(t){const e=this.Ge.get(t);return e&&e.Oe?null:this.We.Et(t)}rt(t){this.Ge.set(t,new Bo),this.We.getRemoteKeysForTarget(t).forEach((e=>{this.Xe(t,e,null)}))}It(t,e){return this.We.getRemoteKeysForTarget(t).has(e)}}function Xn(){return new Y(O.comparator)}function zo(){return new Y(O.comparator)}const ch={asc:"ASCENDING",desc:"DESCENDING"},hh={"<":"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"},dh={and:"AND",or:"OR"};class fh{constructor(t,e){this.databaseId=t,this.useProto3Json=e}}function _s(r,t){return r.useProto3Json||yr(t)?t:{value:t}}function lr(r,t){return r.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function hu(r,t){return r.useProto3Json?t.toBase64():t.toUint8Array()}function mh(r,t){return lr(r,t.toTimestamp())}function Nt(r){return G(!!r,49232),F.fromTimestamp((function(e){const n=te(e);return new W(n.seconds,n.nanos)})(r))}function Us(r,t){return ys(r,t).canonicalString()}function ys(r,t){const e=(function(i){return new H(["projects",i.projectId,"databases",i.database])})(r).child("documents");return t===void 0?e:e.child(t)}function du(r){const t=H.fromString(r);return G(_u(t),10190,{key:t.toString()}),t}function Es(r,t){return Us(r.databaseId,t.path)}function rs(r,t){const e=du(t);if(e.get(1)!==r.databaseId.projectId)throw new N(P.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+e.get(1)+" vs "+r.databaseId.projectId);if(e.get(3)!==r.databaseId.database)throw new N(P.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+e.get(3)+" vs "+r.databaseId.database);return new O(mu(e))}function fu(r,t){return Us(r.databaseId,t)}function ph(r){const t=du(r);return t.length===4?H.emptyPath():mu(t)}function Ts(r){return new H(["projects",r.databaseId.projectId,"databases",r.databaseId.database]).canonicalString()}function mu(r){return G(r.length>4&&r.get(4)==="documents",29091,{key:r.toString()}),r.popFirst(5)}function $o(r,t,e){return{name:Es(r,t),fields:e.value.mapValue.fields}}function gh(r,t){let e;if("targetChange"in t){t.targetChange;const n=(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,m){return f.useProto3Json?(G(m===void 0||typeof m=="string",58123),ht.fromBase64String(m||"")):(G(m===void 0||m instanceof Buffer||m instanceof Uint8Array,16193),ht.fromUint8Array(m||new Uint8Array))})(r,t.targetChange.resumeToken),u=t.targetChange.cause,c=u&&(function(f){const m=f.code===void 0?P.UNKNOWN:uu(f.code);return new N(m,f.message||"")})(u);e=new cu(n,i,o,c||null)}else if("documentChange"in t){t.documentChange;const n=t.documentChange;n.document,n.document.name,n.document.updateTime;const i=rs(r,n.document.name),o=Nt(n.document.updateTime),u=n.document.createTime?Nt(n.document.createTime):F.min(),c=new It({mapValue:{fields:n.document.fields}}),h=yt.newFoundDocument(i,o,u,c),f=n.targetIds||[],m=n.removedTargetIds||[];e=new nr(f,m,h.key,h)}else if("documentDelete"in t){t.documentDelete;const n=t.documentDelete;n.document;const i=rs(r,n.document),o=n.readTime?Nt(n.readTime):F.min(),u=yt.newNoDocument(i,o),c=n.removedTargetIds||[];e=new nr([],c,u.key,u)}else if("documentRemove"in t){t.documentRemove;const n=t.documentRemove;n.document;const i=rs(r,n.document),o=n.removedTargetIds||[];e=new nr([],o,i,null)}else{if(!("filter"in t))return M(11601,{At:t});{t.filter;const n=t.filter;n.targetId;const{count:i=0,unchangedNames:o}=n,u=new oh(i,o),c=n.targetId;e=new lu(c,u)}}return e}function _h(r,t){let e;if(t instanceof vn)e={update:$o(r,t.key,t.value)};else if(t instanceof Ms)e={delete:Es(r,t.key)};else if(t instanceof oe)e={update:$o(r,t.key,t.data),updateMask:Ph(t.fieldMask)};else{if(!(t instanceof rh))return M(16599,{Rt:t.type});e={verify:Es(r,t.key)}}return t.fieldTransforms.length>0&&(e.updateTransforms=t.fieldTransforms.map((n=>(function(o,u){const c=u.transform;if(c instanceof gn)return{fieldPath:u.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof _n)return{fieldPath:u.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof yn)return{fieldPath:u.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof ur)return{fieldPath:u.field.canonicalString(),increment:c.Ee};throw M(20930,{transform:u.transform})})(0,n)))),t.precondition.isNone||(e.currentDocument=(function(i,o){return o.updateTime!==void 0?{updateTime:mh(i,o.updateTime)}:o.exists!==void 0?{exists:o.exists}:M(27497)})(r,t.precondition)),e}function yh(r,t){return r&&r.length>0?(G(t!==void 0,14353),r.map((e=>(function(i,o){let u=i.updateTime?Nt(i.updateTime):Nt(o);return u.isEqual(F.min())&&(u=Nt(o)),new th(u,i.transformResults||[])})(e,t)))):[]}function Eh(r,t){return{documents:[fu(r,t.path)]}}function Th(r,t){const e={structuredQuery:{}},n=t.path;let i;t.collectionGroup!==null?(i=n,e.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=n.popLast(),e.structuredQuery.from=[{collectionId:n.lastSegment()}]),e.parent=fu(r,i);const o=(function(f){if(f.length!==0)return gu(Ct.create(f,"and"))})(t.filters);o&&(e.structuredQuery.where=o);const u=(function(f){if(f.length!==0)return f.map((m=>(function(A){return{field:Re(A.field),direction:Ah(A.dir)}})(m)))})(t.orderBy);u&&(e.structuredQuery.orderBy=u);const c=_s(r,t.limit);return c!==null&&(e.structuredQuery.limit=c),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 vh(r){let t=ph(r.parent);const e=r.structuredQuery,n=e.from?e.from.length:0;let i=null;if(n>0){G(n===1,65062);const m=e.from[0];m.allDescendants?i=m.collectionId:t=t.child(m.collectionId)}let o=[];e.where&&(o=(function(y){const A=pu(y);return A instanceof Ct&&Ga(A)?A.getFilters():[A]})(e.where));let u=[];e.orderBy&&(u=(function(y){return y.map((A=>(function(C){return new ar(Pe(C.field),(function(D){switch(D){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(C.direction))})(A)))})(e.orderBy));let c=null;e.limit&&(c=(function(y){let A;return A=typeof y=="object"?y.value:y,yr(A)?null:A})(e.limit));let h=null;e.startAt&&(h=(function(y){const A=!!y.before,S=y.values||[];return new or(S,A)})(e.startAt));let f=null;return e.endAt&&(f=(function(y){const A=!y.before,S=y.values||[];return new or(S,A)})(e.endAt)),qc(t,i,u,o,c,"F",h,f)}function Ih(r,t){const 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 pu(r){return r.unaryFilter!==void 0?(function(e){switch(e.unaryFilter.op){case"IS_NAN":const n=Pe(e.unaryFilter.field);return et.create(n,"==",{doubleValue:NaN});case"IS_NULL":const i=Pe(e.unaryFilter.field);return et.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const o=Pe(e.unaryFilter.field);return et.create(o,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const u=Pe(e.unaryFilter.field);return et.create(u,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return M(61313);default:return M(60726)}})(r):r.fieldFilter!==void 0?(function(e){return et.create(Pe(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)})(r):r.compositeFilter!==void 0?(function(e){return Ct.create(e.compositeFilter.filters.map((n=>pu(n))),(function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return M(1026)}})(e.compositeFilter.op))})(r):M(30097,{filter:r})}function Ah(r){return ch[r]}function wh(r){return hh[r]}function Rh(r){return dh[r]}function Re(r){return{fieldPath:r.canonicalString()}}function Pe(r){return ct.fromServerFormat(r.fieldPath)}function gu(r){return r instanceof et?(function(e){if(e.op==="=="){if(Do(e.value))return{unaryFilter:{field:Re(e.field),op:"IS_NAN"}};if(bo(e.value))return{unaryFilter:{field:Re(e.field),op:"IS_NULL"}}}else if(e.op==="!="){if(Do(e.value))return{unaryFilter:{field:Re(e.field),op:"IS_NOT_NAN"}};if(bo(e.value))return{unaryFilter:{field:Re(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Re(e.field),op:wh(e.op),value:e.value}}})(r):r instanceof Ct?(function(e){const n=e.getFilters().map((i=>gu(i)));return n.length===1?n[0]:{compositeFilter:{op:Rh(e.op),filters:n}}})(r):M(54877,{filter:r})}function Ph(r){const t=[];return r.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function _u(r){return r.length>=4&&r.get(0)==="projects"&&r.get(2)==="databases"}/**
|
|
793
808
|
* @license
|
|
794
809
|
* Copyright 2017 Google LLC
|
|
795
810
|
*
|
|
@@ -819,7 +834,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
819
834
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
820
835
|
* See the License for the specific language governing permissions and
|
|
821
836
|
* limitations under the License.
|
|
822
|
-
*/class
|
|
837
|
+
*/class Vh{constructor(t){this.gt=t}}function Sh(r){const t=vh({parent:r.parent,structuredQuery:r.structuredQuery});return r.limitType==="LAST"?gs(t,t.limit,"L"):t}/**
|
|
823
838
|
* @license
|
|
824
839
|
* Copyright 2019 Google LLC
|
|
825
840
|
*
|
|
@@ -834,7 +849,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
834
849
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
835
850
|
* See the License for the specific language governing permissions and
|
|
836
851
|
* limitations under the License.
|
|
837
|
-
*/class
|
|
852
|
+
*/class Ch{constructor(){this.Dn=new bh}addToCollectionParentIndex(t,e){return this.Dn.add(e),V.resolve()}getCollectionParents(t,e){return V.resolve(this.Dn.getEntries(e))}addFieldIndex(t,e){return V.resolve()}deleteFieldIndex(t,e){return V.resolve()}deleteAllFieldIndexes(t){return V.resolve()}createTargetIndexes(t,e){return V.resolve()}getDocumentsMatchingTarget(t,e){return V.resolve(null)}getIndexType(t,e){return V.resolve(0)}getFieldIndexes(t,e){return V.resolve([])}getNextCollectionGroupToUpdate(t){return V.resolve(null)}getMinOffset(t,e){return V.resolve(Zt.min())}getMinOffsetFromCollectionGroup(t,e){return V.resolve(Zt.min())}updateCollectionGroup(t,e,n){return V.resolve()}updateIndexEntries(t,e){return V.resolve()}}class bh{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),i=this.index[e]||new st(H.comparator),o=!i.has(n);return this.index[e]=i.add(n),o}has(t){const e=t.lastSegment(),n=t.popLast(),i=this.index[e];return i&&i.has(n)}getEntries(t){return(this.index[t]||new st(H.comparator)).toArray()}}/**
|
|
838
853
|
* @license
|
|
839
854
|
* Copyright 2018 Google LLC
|
|
840
855
|
*
|
|
@@ -849,7 +864,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
849
864
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
850
865
|
* See the License for the specific language governing permissions and
|
|
851
866
|
* limitations under the License.
|
|
852
|
-
*/const
|
|
867
|
+
*/const Go={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},yu=41943040;class vt{static withCacheSize(t){return new vt(t,vt.DEFAULT_COLLECTION_PERCENTILE,vt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}}/**
|
|
853
868
|
* @license
|
|
854
869
|
* Copyright 2017 Google LLC
|
|
855
870
|
*
|
|
@@ -864,7 +879,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
864
879
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
865
880
|
* See the License for the specific language governing permissions and
|
|
866
881
|
* limitations under the License.
|
|
867
|
-
*/vt.DEFAULT_COLLECTION_PERCENTILE=10,vt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,vt.DEFAULT=new vt(
|
|
882
|
+
*/vt.DEFAULT_COLLECTION_PERCENTILE=10,vt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,vt.DEFAULT=new vt(yu,vt.DEFAULT_COLLECTION_PERCENTILE,vt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),vt.DISABLED=new vt(-1,0,0);/**
|
|
868
883
|
* @license
|
|
869
884
|
* Copyright 2017 Google LLC
|
|
870
885
|
*
|
|
@@ -879,7 +894,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
879
894
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
880
895
|
* See the License for the specific language governing permissions and
|
|
881
896
|
* limitations under the License.
|
|
882
|
-
*/class
|
|
897
|
+
*/class De{constructor(t){this._r=t}next(){return this._r+=2,this._r}static ar(){return new De(0)}static ur(){return new De(-1)}}/**
|
|
883
898
|
* @license
|
|
884
899
|
* Copyright 2020 Google LLC
|
|
885
900
|
*
|
|
@@ -894,12 +909,12 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
894
909
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
895
910
|
* See the License for the specific language governing permissions and
|
|
896
911
|
* limitations under the License.
|
|
897
|
-
*/const
|
|
898
|
-
Counted targets in ${u-
|
|
912
|
+
*/const Ko="LruGarbageCollector",Eu=1048576;function Qo([r,t],[e,n]){const i=U(r,e);return i===0?U(t,n):i}class Dh{constructor(t){this.Tr=t,this.buffer=new st(Qo),this.Ir=0}dr(){return++this.Ir}Er(t){const e=[t,this.dr()];if(this.buffer.size<this.Tr)this.buffer=this.buffer.add(e);else{const n=this.buffer.last();Qo(e,n)<0&&(this.buffer=this.buffer.delete(n).add(e))}}get maxValue(){return this.buffer.last()[0]}}class Nh{constructor(t,e,n){this.garbageCollector=t,this.asyncQueue=e,this.localStore=n,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(Ko,`Garbage collection scheduled in ${t}ms`),this.Ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",t,(async()=>{this.Ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){Me(e)?k(Ko,"Ignoring IndexedDB error during garbage collection: ",e):await Oe(e)}await this.Rr(3e5)}))}}class kh{constructor(t,e){this.Vr=t,this.params=e}calculateTargetCount(t,e){return this.Vr.mr(t).next((n=>Math.floor(e/100*n)))}nthSequenceNumber(t,e){if(e===0)return V.resolve(_r.ue);const n=new Dh(e);return this.Vr.forEachTarget(t,(i=>n.Er(i.sequenceNumber))).next((()=>this.Vr.gr(t,(i=>n.Er(i))))).next((()=>n.maxValue))}removeTargets(t,e,n){return this.Vr.removeTargets(t,e,n)}removeOrphanedDocuments(t,e){return this.Vr.removeOrphanedDocuments(t,e)}collect(t,e){return this.params.cacheSizeCollectionThreshold===-1?(k("LruGarbageCollector","Garbage collection skipped; disabled"),V.resolve(Go)):this.getCacheSize(t).next((n=>n<this.params.cacheSizeCollectionThreshold?(k("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Go):this.pr(t,e)))}getCacheSize(t){return this.Vr.getCacheSize(t)}pr(t,e){let n,i,o,u,c,h,f;const m=Date.now();return this.calculateTargetCount(t,this.params.percentileToCollect).next((y=>(y>this.params.maximumSequenceNumbersToCollect?(k("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${y}`),i=this.params.maximumSequenceNumbersToCollect):i=y,u=Date.now(),this.nthSequenceNumber(t,i)))).next((y=>(n=y,c=Date.now(),this.removeTargets(t,n,e)))).next((y=>(o=y,h=Date.now(),this.removeOrphanedDocuments(t,n)))).next((y=>(f=Date.now(),Ae()<=qt.DEBUG&&k("LruGarbageCollector",`LRU Garbage Collection
|
|
913
|
+
Counted targets in ${u-m}ms
|
|
899
914
|
Determined least recently used ${i} in `+(c-u)+`ms
|
|
900
915
|
Removed ${o} targets in `+(h-c)+`ms
|
|
901
|
-
Removed ${
|
|
902
|
-
Total Duration: ${f-
|
|
916
|
+
Removed ${y} documents in `+(f-h)+`ms
|
|
917
|
+
Total Duration: ${f-m}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:y}))))}}function xh(r,t){return new kh(r,t)}/**
|
|
903
918
|
* @license
|
|
904
919
|
* Copyright 2017 Google LLC
|
|
905
920
|
*
|
|
@@ -914,7 +929,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
914
929
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
915
930
|
* See the License for the specific language governing permissions and
|
|
916
931
|
* limitations under the License.
|
|
917
|
-
*/class
|
|
932
|
+
*/class Oh{constructor(){this.changes=new ge((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,yt.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return n!==void 0?V.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}/**
|
|
918
933
|
* @license
|
|
919
934
|
* Copyright 2017 Google LLC
|
|
920
935
|
*
|
|
@@ -944,7 +959,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
944
959
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
945
960
|
* See the License for the specific language governing permissions and
|
|
946
961
|
* limitations under the License.
|
|
947
|
-
*/class
|
|
962
|
+
*/class Mh{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}/**
|
|
948
963
|
* @license
|
|
949
964
|
* Copyright 2017 Google LLC
|
|
950
965
|
*
|
|
@@ -959,7 +974,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
959
974
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
960
975
|
* See the License for the specific language governing permissions and
|
|
961
976
|
* limitations under the License.
|
|
962
|
-
*/class
|
|
977
|
+
*/class Fh{constructor(t,e,n,i){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=i}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((i=>(n=i,this.remoteDocumentCache.getEntry(t,e)))).next((i=>(n!==null&&cn(n.mutation,i,wt.empty(),W.now()),i)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((n=>this.getLocalViewOfDocuments(t,n,j()).next((()=>n))))}getLocalViewOfDocuments(t,e,n=j()){const i=he();return this.populateOverlays(t,i,e).next((()=>this.computeViews(t,e,i,n).next((o=>{let u=rn();return o.forEach(((c,h)=>{u=u.insert(c,h.overlayedDocument)})),u}))))}getOverlayedDocuments(t,e){const n=he();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,j())))}populateOverlays(t,e,n){const i=[];return n.forEach((o=>{e.has(o)||i.push(o)})),this.documentOverlayCache.getOverlays(t,i).next((o=>{o.forEach(((u,c)=>{e.set(u,c)}))}))}computeViews(t,e,n,i){let o=$t();const u=ln(),c=(function(){return ln()})();return e.forEach(((h,f)=>{const m=n.get(f.key);i.has(f.key)&&(m===void 0||m.mutation instanceof oe)?o=o.insert(f.key,f):m!==void 0?(u.set(f.key,m.mutation.getFieldMask()),cn(m.mutation,f,m.mutation.getFieldMask(),W.now())):u.set(f.key,wt.empty())})),this.recalculateAndSaveOverlays(t,o).next((h=>(h.forEach(((f,m)=>u.set(f,m))),e.forEach(((f,m)=>{var y;return c.set(f,new Mh(m,(y=u.get(f))!==null&&y!==void 0?y:null))})),c)))}recalculateAndSaveOverlays(t,e){const n=ln();let i=new Y(((u,c)=>u-c)),o=j();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((u=>{for(const c of u)c.keys().forEach((h=>{const f=e.get(h);if(f===null)return;let m=n.get(h)||wt.empty();m=c.applyToLocalView(f,m),n.set(h,m);const y=(i.get(c.batchId)||j()).add(h);i=i.insert(c.batchId,y)}))})).next((()=>{const u=[],c=i.getReverseIterator();for(;c.hasNext();){const h=c.getNext(),f=h.key,m=h.value,y=tu();m.forEach((A=>{if(!o.has(A)){const S=ou(e.get(A),n.get(A));S!==null&&y.set(A,S),o=o.add(A)}})),u.push(this.documentOverlayCache.saveOverlays(t,f,y))}return V.waitFor(u)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((n=>this.recalculateAndSaveOverlays(t,n)))}getDocumentsMatchingQuery(t,e,n,i){return(function(u){return O.isDocumentKey(u.path)&&u.collectionGroup===null&&u.filters.length===0})(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Ha(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n,i):this.getDocumentsMatchingCollectionQuery(t,e,n,i)}getNextDocuments(t,e,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,i).next((o=>{const u=i-o.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,i-o.size):V.resolve(he());let c=hn,h=o;return u.next((f=>V.forEach(f,((m,y)=>(c<y.largestBatchId&&(c=y.largestBatchId),o.get(m)?V.resolve():this.remoteDocumentCache.getEntry(t,m).next((A=>{h=h.insert(m,A)}))))).next((()=>this.populateOverlays(t,f,o))).next((()=>this.computeViews(t,h,f,j()))).next((m=>({batchId:c,changes:Za(m)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new O(e)).next((n=>{let i=rn();return n.isFoundDocument()&&(i=i.insert(n.key,n)),i}))}getDocumentsMatchingCollectionGroupQuery(t,e,n,i){const o=e.collectionGroup;let u=rn();return this.indexManager.getCollectionParents(t,o).next((c=>V.forEach(c,(h=>{const f=(function(y,A){return new Tn(A,null,y.explicitOrderBy.slice(),y.filters.slice(),y.limit,y.limitType,y.startAt,y.endAt)})(e,h.child(o));return this.getDocumentsMatchingCollectionQuery(t,f,n,i).next((m=>{m.forEach(((y,A)=>{u=u.insert(y,A)}))}))})).next((()=>u))))}getDocumentsMatchingCollectionQuery(t,e,n,i){let o;return this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId).next((u=>(o=u,this.remoteDocumentCache.getDocumentsMatchingQuery(t,e,n,o,i)))).next((u=>{o.forEach(((h,f)=>{const m=f.getKey();u.get(m)===null&&(u=u.insert(m,yt.newInvalidDocument(m)))}));let c=rn();return u.forEach(((h,f)=>{const m=o.get(h);m!==void 0&&cn(m.mutation,f,wt.empty(),W.now()),Ir(e,f)&&(c=c.insert(h,f))})),c}))}}/**
|
|
963
978
|
* @license
|
|
964
979
|
* Copyright 2020 Google LLC
|
|
965
980
|
*
|
|
@@ -974,7 +989,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
974
989
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
975
990
|
* See the License for the specific language governing permissions and
|
|
976
991
|
* limitations under the License.
|
|
977
|
-
*/class
|
|
992
|
+
*/class Lh{constructor(t){this.serializer=t,this.Br=new Map,this.Lr=new Map}getBundleMetadata(t,e){return V.resolve(this.Br.get(e))}saveBundleMetadata(t,e){return this.Br.set(e.id,(function(i){return{id:i.id,version:i.version,createTime:Nt(i.createTime)}})(e)),V.resolve()}getNamedQuery(t,e){return V.resolve(this.Lr.get(e))}saveNamedQuery(t,e){return this.Lr.set(e.name,(function(i){return{name:i.name,query:Sh(i.bundledQuery),readTime:Nt(i.readTime)}})(e)),V.resolve()}}/**
|
|
978
993
|
* @license
|
|
979
994
|
* Copyright 2022 Google LLC
|
|
980
995
|
*
|
|
@@ -989,7 +1004,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
989
1004
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
990
1005
|
* See the License for the specific language governing permissions and
|
|
991
1006
|
* limitations under the License.
|
|
992
|
-
*/class
|
|
1007
|
+
*/class Uh{constructor(){this.overlays=new Y(O.comparator),this.kr=new Map}getOverlay(t,e){return V.resolve(this.overlays.get(e))}getOverlays(t,e){const n=he();return V.forEach(e,(i=>this.getOverlay(t,i).next((o=>{o!==null&&n.set(i,o)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((i,o)=>{this.wt(t,e,o)})),V.resolve()}removeOverlaysForBatchId(t,e,n){const i=this.kr.get(n);return i!==void 0&&(i.forEach((o=>this.overlays=this.overlays.remove(o))),this.kr.delete(n)),V.resolve()}getOverlaysForCollection(t,e,n){const i=he(),o=e.length+1,u=new O(e.child("")),c=this.overlays.getIteratorFrom(u);for(;c.hasNext();){const h=c.getNext().value,f=h.getKey();if(!e.isPrefixOf(f.path))break;f.path.length===o&&h.largestBatchId>n&&i.set(h.getKey(),h)}return V.resolve(i)}getOverlaysForCollectionGroup(t,e,n,i){let o=new Y(((f,m)=>f-m));const u=this.overlays.getIterator();for(;u.hasNext();){const f=u.getNext().value;if(f.getKey().getCollectionGroup()===e&&f.largestBatchId>n){let m=o.get(f.largestBatchId);m===null&&(m=he(),o=o.insert(f.largestBatchId,m)),m.set(f.getKey(),f)}}const c=he(),h=o.getIterator();for(;h.hasNext()&&(h.getNext().value.forEach(((f,m)=>c.set(f,m))),!(c.size()>=i)););return V.resolve(c)}wt(t,e,n){const i=this.overlays.get(n.key);if(i!==null){const u=this.kr.get(i.largestBatchId).delete(n.key);this.kr.set(i.largestBatchId,u)}this.overlays=this.overlays.insert(n.key,new ih(e,n));let o=this.kr.get(e);o===void 0&&(o=j(),this.kr.set(e,o)),this.kr.set(e,o.add(n.key))}}/**
|
|
993
1008
|
* @license
|
|
994
1009
|
* Copyright 2024 Google LLC
|
|
995
1010
|
*
|
|
@@ -1004,7 +1019,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1004
1019
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1005
1020
|
* See the License for the specific language governing permissions and
|
|
1006
1021
|
* limitations under the License.
|
|
1007
|
-
*/class
|
|
1022
|
+
*/class qh{constructor(){this.sessionToken=ht.EMPTY_BYTE_STRING}getSessionToken(t){return V.resolve(this.sessionToken)}setSessionToken(t,e){return this.sessionToken=e,V.resolve()}}/**
|
|
1008
1023
|
* @license
|
|
1009
1024
|
* Copyright 2017 Google LLC
|
|
1010
1025
|
*
|
|
@@ -1019,7 +1034,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1019
1034
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1020
1035
|
* See the License for the specific language governing permissions and
|
|
1021
1036
|
* limitations under the License.
|
|
1022
|
-
*/class
|
|
1037
|
+
*/class qs{constructor(){this.qr=new st(ot.Qr),this.$r=new st(ot.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(t,e){const n=new ot(t,e);this.qr=this.qr.add(n),this.$r=this.$r.add(n)}Kr(t,e){t.forEach((n=>this.addReference(n,e)))}removeReference(t,e){this.Wr(new ot(t,e))}Gr(t,e){t.forEach((n=>this.removeReference(n,e)))}zr(t){const e=new O(new H([])),n=new ot(e,t),i=new ot(e,t+1),o=[];return this.$r.forEachInRange([n,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){const e=new O(new H([])),n=new ot(e,t),i=new ot(e,t+1);let o=j();return this.$r.forEachInRange([n,i],(u=>{o=o.add(u.key)})),o}containsKey(t){const e=new ot(t,0),n=this.qr.firstAfterOrEqual(e);return n!==null&&t.isEqual(n.key)}}class ot{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)}}/**
|
|
1023
1038
|
* @license
|
|
1024
1039
|
* Copyright 2017 Google LLC
|
|
1025
1040
|
*
|
|
@@ -1034,7 +1049,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1034
1049
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1035
1050
|
* See the License for the specific language governing permissions and
|
|
1036
1051
|
* limitations under the License.
|
|
1037
|
-
*/class
|
|
1052
|
+
*/class jh{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.er=1,this.Yr=new st(ot.Qr)}checkEmpty(t){return V.resolve(this.mutationQueue.length===0)}addMutationBatch(t,e,n,i){const o=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const u=new sh(o,e,n,i);this.mutationQueue.push(u);for(const c of i)this.Yr=this.Yr.add(new ot(c.key,o)),this.indexManager.addToCollectionParentIndex(t,c.key.path.popLast());return V.resolve(u)}lookupMutationBatch(t,e){return V.resolve(this.Zr(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,i=this.Xr(n),o=i<0?0:i;return V.resolve(this.mutationQueue.length>o?this.mutationQueue[o]:null)}getHighestUnacknowledgedBatchId(){return V.resolve(this.mutationQueue.length===0?bs:this.er-1)}getAllMutationBatches(t){return V.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new ot(e,0),i=new ot(e,Number.POSITIVE_INFINITY),o=[];return this.Yr.forEachInRange([n,i],(u=>{const c=this.Zr(u.Hr);o.push(c)})),V.resolve(o)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new st(U);return e.forEach((i=>{const o=new ot(i,0),u=new ot(i,Number.POSITIVE_INFINITY);this.Yr.forEachInRange([o,u],(c=>{n=n.add(c.Hr)}))})),V.resolve(this.ei(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,i=n.length+1;let o=n;O.isDocumentKey(o)||(o=o.child(""));const u=new ot(new O(o),0);let c=new st(U);return this.Yr.forEachWhile((h=>{const f=h.key.path;return!!n.isPrefixOf(f)&&(f.length===i&&(c=c.add(h.Hr)),!0)}),u),V.resolve(this.ei(c))}ei(t){const e=[];return t.forEach((n=>{const i=this.Zr(n);i!==null&&e.push(i)})),e}removeMutationBatch(t,e){G(this.ti(e.batchId,"removed")===0,55003),this.mutationQueue.shift();let n=this.Yr;return V.forEach(e.mutations,(i=>{const o=new ot(i.key,e.batchId);return n=n.delete(o),this.referenceDelegate.markPotentiallyOrphaned(t,i.key)})).next((()=>{this.Yr=n}))}rr(t){}containsKey(t,e){const n=new ot(e,0),i=this.Yr.firstAfterOrEqual(n);return V.resolve(e.isEqual(i&&i.key))}performConsistencyCheck(t){return this.mutationQueue.length,V.resolve()}ti(t,e){return this.Xr(t)}Xr(t){return this.mutationQueue.length===0?0:t-this.mutationQueue[0].batchId}Zr(t){const e=this.Xr(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}/**
|
|
1038
1053
|
* @license
|
|
1039
1054
|
* Copyright 2017 Google LLC
|
|
1040
1055
|
*
|
|
@@ -1049,7 +1064,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1049
1064
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1050
1065
|
* See the License for the specific language governing permissions and
|
|
1051
1066
|
* limitations under the License.
|
|
1052
|
-
*/class
|
|
1067
|
+
*/class Bh{constructor(t){this.ni=t,this.docs=(function(){return new Y(O.comparator)})(),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,i=this.docs.get(n),o=i?i.size:0,u=this.ni(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:u}),this.size+=u-o,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return V.resolve(n?n.document.mutableCopy():yt.newInvalidDocument(e))}getEntries(t,e){let n=$t();return e.forEach((i=>{const o=this.docs.get(i);n=n.insert(i,o?o.document.mutableCopy():yt.newInvalidDocument(i))})),V.resolve(n)}getDocumentsMatchingQuery(t,e,n,i){let o=$t();const u=e.path,c=new O(u.child("__id-9223372036854775808__")),h=this.docs.getIteratorFrom(c);for(;h.hasNext();){const{key:f,value:{document:m}}=h.getNext();if(!u.isPrefixOf(f.path))break;f.path.length>u.length+1||yc(_c(m),n)<=0||(i.has(m.key)||Ir(e,m))&&(o=o.insert(m.key,m.mutableCopy()))}return V.resolve(o)}getAllFromCollectionGroup(t,e,n,i){M(9500)}ri(t,e){return V.forEach(this.docs,(n=>e(n)))}newChangeBuffer(t){return new zh(this)}getSize(t){return V.resolve(this.size)}}class zh extends Oh{constructor(t){super(),this.Or=t}applyChanges(t){const e=[];return this.changes.forEach(((n,i)=>{i.isValidDocument()?e.push(this.Or.addEntry(t,i)):this.Or.removeEntry(n)})),V.waitFor(e)}getFromCache(t,e){return this.Or.getEntry(t,e)}getAllFromCache(t,e){return this.Or.getEntries(t,e)}}/**
|
|
1053
1068
|
* @license
|
|
1054
1069
|
* Copyright 2017 Google LLC
|
|
1055
1070
|
*
|
|
@@ -1064,7 +1079,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1064
1079
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1065
1080
|
* See the License for the specific language governing permissions and
|
|
1066
1081
|
* limitations under the License.
|
|
1067
|
-
*/class
|
|
1082
|
+
*/class $h{constructor(t){this.persistence=t,this.ii=new ge((e=>ks(e)),xs),this.lastRemoteSnapshotVersion=F.min(),this.highestTargetId=0,this.si=0,this.oi=new qs,this.targetCount=0,this._i=De.ar()}forEachTarget(t,e){return this.ii.forEach(((n,i)=>e(i))),V.resolve()}getLastRemoteSnapshotVersion(t){return V.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return V.resolve(this.si)}allocateTargetId(t){return this.highestTargetId=this._i.next(),V.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.si&&(this.si=e),V.resolve()}hr(t){this.ii.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this._i=new De(e),this.highestTargetId=e),t.sequenceNumber>this.si&&(this.si=t.sequenceNumber)}addTargetData(t,e){return this.hr(e),this.targetCount+=1,V.resolve()}updateTargetData(t,e){return this.hr(e),V.resolve()}removeTargetData(t,e){return this.ii.delete(e.target),this.oi.zr(e.targetId),this.targetCount-=1,V.resolve()}removeTargets(t,e,n){let i=0;const o=[];return this.ii.forEach(((u,c)=>{c.sequenceNumber<=e&&n.get(c.targetId)===null&&(this.ii.delete(u),o.push(this.removeMatchingKeysForTargetId(t,c.targetId)),i++)})),V.waitFor(o).next((()=>i))}getTargetCount(t){return V.resolve(this.targetCount)}getTargetData(t,e){const n=this.ii.get(e)||null;return V.resolve(n)}addMatchingKeys(t,e,n){return this.oi.Kr(e,n),V.resolve()}removeMatchingKeys(t,e,n){this.oi.Gr(e,n);const i=this.persistence.referenceDelegate,o=[];return i&&e.forEach((u=>{o.push(i.markPotentiallyOrphaned(t,u))})),V.waitFor(o)}removeMatchingKeysForTargetId(t,e){return this.oi.zr(e),V.resolve()}getMatchingKeysForTargetId(t,e){const n=this.oi.Jr(e);return V.resolve(n)}containsKey(t,e){return V.resolve(this.oi.containsKey(e))}}/**
|
|
1068
1083
|
* @license
|
|
1069
1084
|
* Copyright 2017 Google LLC
|
|
1070
1085
|
*
|
|
@@ -1079,7 +1094,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1079
1094
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1080
1095
|
* See the License for the specific language governing permissions and
|
|
1081
1096
|
* limitations under the License.
|
|
1082
|
-
*/class
|
|
1097
|
+
*/class Tu{constructor(t,e){this.ai={},this.overlays={},this.ui=new _r(0),this.ci=!1,this.ci=!0,this.li=new qh,this.referenceDelegate=t(this),this.hi=new $h(this),this.indexManager=new Ch,this.remoteDocumentCache=(function(i){return new Bh(i)})((n=>this.referenceDelegate.Pi(n))),this.serializer=new Vh(e),this.Ti=new Lh(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 Uh,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.ai[t.toKey()];return n||(n=new jh(e,this.referenceDelegate),this.ai[t.toKey()]=n),n}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(t,e,n){k("MemoryPersistence","Starting transaction:",t);const i=new Gh(this.ui.next());return this.referenceDelegate.Ii(),n(i).next((o=>this.referenceDelegate.di(i).next((()=>o)))).toPromise().then((o=>(i.raiseOnCommittedEvent(),o)))}Ei(t,e){return V.or(Object.values(this.ai).map((n=>()=>n.containsKey(t,e))))}}class Gh extends Tc{constructor(t){super(),this.currentSequenceNumber=t}}class js{constructor(t){this.persistence=t,this.Ai=new qs,this.Ri=null}static Vi(t){return new js(t)}get mi(){if(this.Ri)return this.Ri;throw M(60996)}addReference(t,e,n){return this.Ai.addReference(n,e),this.mi.delete(n.toString()),V.resolve()}removeReference(t,e,n){return this.Ai.removeReference(n,e),this.mi.add(n.toString()),V.resolve()}markPotentiallyOrphaned(t,e){return this.mi.add(e.toString()),V.resolve()}removeTarget(t,e){this.Ai.zr(e.targetId).forEach((i=>this.mi.add(i.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((i=>{i.forEach((o=>this.mi.add(o.toString())))})).next((()=>n.removeTargetData(t,e)))}Ii(){this.Ri=new Set}di(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return V.forEach(this.mi,(n=>{const i=O.fromPath(n);return this.fi(t,i).next((o=>{o||e.removeEntry(i,F.min())}))})).next((()=>(this.Ri=null,e.apply(t))))}updateLimboDocument(t,e){return this.fi(t,e).next((n=>{n?this.mi.delete(e.toString()):this.mi.add(e.toString())}))}Pi(t){return 0}fi(t,e){return V.or([()=>V.resolve(this.Ai.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ei(t,e)])}}class cr{constructor(t,e){this.persistence=t,this.gi=new ge((n=>Ac(n.path)),((n,i)=>n.isEqual(i))),this.garbageCollector=xh(this,e)}static Vi(t,e){return new cr(t,e)}Ii(){}di(t){return V.resolve()}forEachTarget(t,e){return this.persistence.getTargetCache().forEachTarget(t,e)}mr(t){const e=this.yr(t);return this.persistence.getTargetCache().getTargetCount(t).next((n=>e.next((i=>n+i))))}yr(t){let e=0;return this.gr(t,(n=>{e++})).next((()=>e))}gr(t,e){return V.forEach(this.gi,((n,i)=>this.Sr(t,n,i).next((o=>o?V.resolve():e(i)))))}removeTargets(t,e,n){return this.persistence.getTargetCache().removeTargets(t,e,n)}removeOrphanedDocuments(t,e){let n=0;const i=this.persistence.getRemoteDocumentCache(),o=i.newChangeBuffer();return i.ri(t,(u=>this.Sr(t,u,e).next((c=>{c||(n++,o.removeEntry(u,F.min()))})))).next((()=>o.apply(t))).next((()=>n))}markPotentiallyOrphaned(t,e){return this.gi.set(e,t.currentSequenceNumber),V.resolve()}removeTarget(t,e){const n=e.withSequenceNumber(t.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(t,n)}addReference(t,e,n){return this.gi.set(n,t.currentSequenceNumber),V.resolve()}removeReference(t,e,n){return this.gi.set(n,t.currentSequenceNumber),V.resolve()}updateLimboDocument(t,e){return this.gi.set(e,t.currentSequenceNumber),V.resolve()}Pi(t){let e=t.key.toString().length;return t.isFoundDocument()&&(e+=Zn(t.data.value)),e}Sr(t,e,n){return V.or([()=>this.persistence.Ei(t,e),()=>this.persistence.getTargetCache().containsKey(t,e),()=>{const i=this.gi.get(e);return V.resolve(i!==void 0&&i>n)}])}getCacheSize(t){return this.persistence.getRemoteDocumentCache().getSize(t)}}/**
|
|
1083
1098
|
* @license
|
|
1084
1099
|
* Copyright 2017 Google LLC
|
|
1085
1100
|
*
|
|
@@ -1094,7 +1109,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1094
1109
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1095
1110
|
* See the License for the specific language governing permissions and
|
|
1096
1111
|
* limitations under the License.
|
|
1097
|
-
*/class
|
|
1112
|
+
*/class Bs{constructor(t,e,n,i){this.targetId=t,this.fromCache=e,this.Is=n,this.ds=i}static Es(t,e){let n=j(),i=j();for(const o of e.docChanges)switch(o.type){case 0:n=n.add(o.doc.key);break;case 1:i=i.add(o.doc.key)}return new Bs(t,e.fromCache,n,i)}}/**
|
|
1098
1113
|
* @license
|
|
1099
1114
|
* Copyright 2023 Google LLC
|
|
1100
1115
|
*
|
|
@@ -1109,7 +1124,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1109
1124
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1110
1125
|
* See the License for the specific language governing permissions and
|
|
1111
1126
|
* limitations under the License.
|
|
1112
|
-
*/class
|
|
1127
|
+
*/class Kh{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(t){this._documentReadCount+=t}}/**
|
|
1113
1128
|
* @license
|
|
1114
1129
|
* Copyright 2019 Google LLC
|
|
1115
1130
|
*
|
|
@@ -1124,7 +1139,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1124
1139
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1125
1140
|
* See the License for the specific language governing permissions and
|
|
1126
1141
|
* limitations under the License.
|
|
1127
|
-
*/class
|
|
1142
|
+
*/class Qh{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=(function(){return Ql()?8:vc(Wl())>0?6:4})()}initialize(t,e){this.gs=t,this.indexManager=e,this.As=!0}getDocumentsMatchingQuery(t,e,n,i){const o={result:null};return this.ps(t,e).next((u=>{o.result=u})).next((()=>{if(!o.result)return this.ys(t,e,i,n).next((u=>{o.result=u}))})).next((()=>{if(o.result)return;const u=new Kh;return this.ws(t,e,u).next((c=>{if(o.result=c,this.Rs)return this.Ss(t,e,u,c.size)}))})).next((()=>o.result))}Ss(t,e,n,i){return n.documentReadCount<this.Vs?(Ae()<=qt.DEBUG&&k("QueryEngine","SDK will not create cache indexes for query:",we(e),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),V.resolve()):(Ae()<=qt.DEBUG&&k("QueryEngine","Query:",we(e),"scans",n.documentReadCount,"local documents and returns",i,"documents as results."),n.documentReadCount>this.fs*i?(Ae()<=qt.DEBUG&&k("QueryEngine","The SDK decides to create cache indexes for query:",we(e),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(t,Dt(e))):V.resolve())}ps(t,e){if(Oo(e))return V.resolve(null);let n=Dt(e);return this.indexManager.getIndexType(t,n).next((i=>i===0?null:(e.limit!==null&&i===1&&(e=gs(e,null,"F"),n=Dt(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((o=>{const u=j(...o);return this.gs.getDocuments(t,u).next((c=>this.indexManager.getMinOffset(t,n).next((h=>{const f=this.bs(e,c);return this.Ds(e,f,u,h.readTime)?this.ps(t,gs(e,null,"F")):this.vs(t,f,e,h)}))))})))))}ys(t,e,n,i){return Oo(e)||i.isEqual(F.min())?V.resolve(null):this.gs.getDocuments(t,n).next((o=>{const u=this.bs(e,o);return this.Ds(e,u,n,i)?V.resolve(null):(Ae()<=qt.DEBUG&&k("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),we(e)),this.vs(t,u,e,gc(i,hn)).next((c=>c)))}))}bs(t,e){let n=new st(Ya(t));return e.forEach(((i,o)=>{Ir(t,o)&&(n=n.add(o))})),n}Ds(t,e,n,i){if(t.limit===null)return!1;if(n.size!==e.size)return!0;const o=t.limitType==="F"?e.last():e.first();return!!o&&(o.hasPendingWrites||o.version.compareTo(i)>0)}ws(t,e,n){return Ae()<=qt.DEBUG&&k("QueryEngine","Using full collection scan to execute query:",we(e)),this.gs.getDocumentsMatchingQuery(t,e,Zt.min(),n)}vs(t,e,n,i){return this.gs.getDocumentsMatchingQuery(t,n,i).next((o=>(e.forEach((u=>{o=o.insert(u.key,u)})),o)))}}/**
|
|
1128
1143
|
* @license
|
|
1129
1144
|
* Copyright 2020 Google LLC
|
|
1130
1145
|
*
|
|
@@ -1139,7 +1154,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1139
1154
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1140
1155
|
* See the License for the specific language governing permissions and
|
|
1141
1156
|
* limitations under the License.
|
|
1142
|
-
*/const
|
|
1157
|
+
*/const zs="LocalStore",Wh=3e8;class Hh{constructor(t,e,n,i){this.persistence=t,this.Cs=e,this.serializer=i,this.Fs=new Y(U),this.Ms=new ge((o=>ks(o)),xs),this.xs=new Map,this.Os=t.getRemoteDocumentCache(),this.hi=t.getTargetCache(),this.Ti=t.getBundleCache(),this.Ns(n)}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 Fh(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 Xh(r,t,e,n){return new Hh(r,t,e,n)}async function vu(r,t){const e=L(r);return await e.persistence.runTransaction("Handle user change","readonly",(n=>{let i;return e.mutationQueue.getAllMutationBatches(n).next((o=>(i=o,e.Ns(t),e.mutationQueue.getAllMutationBatches(n)))).next((o=>{const u=[],c=[];let h=j();for(const f of i){u.push(f.batchId);for(const m of f.mutations)h=h.add(m.key)}for(const f of o){c.push(f.batchId);for(const m of f.mutations)h=h.add(m.key)}return e.localDocuments.getDocuments(n,h).next((f=>({Bs:f,removedBatchIds:u,addedBatchIds:c})))}))}))}function Yh(r,t){const e=L(r);return e.persistence.runTransaction("Acknowledge batch","readwrite-primary",(n=>{const i=t.batch.keys(),o=e.Os.newChangeBuffer({trackRemovals:!0});return(function(c,h,f,m){const y=f.batch,A=y.keys();let S=V.resolve();return A.forEach((C=>{S=S.next((()=>m.getEntry(h,C))).next((x=>{const D=f.docVersions.get(C);G(D!==null,48541),x.version.compareTo(D)<0&&(y.applyToRemoteDocument(x,f),x.isValidDocument()&&(x.setReadTime(f.commitVersion),m.addEntry(x)))}))})),S.next((()=>c.mutationQueue.removeMutationBatch(h,y)))})(e,n,t,o).next((()=>o.apply(n))).next((()=>e.mutationQueue.performConsistencyCheck(n))).next((()=>e.documentOverlayCache.removeOverlaysForBatchId(n,i,t.batch.batchId))).next((()=>e.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(n,(function(c){let h=j();for(let f=0;f<c.mutationResults.length;++f)c.mutationResults[f].transformResults.length>0&&(h=h.add(c.batch.mutations[f].key));return h})(t)))).next((()=>e.localDocuments.getDocuments(n,i)))}))}function Iu(r){const t=L(r);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(e=>t.hi.getLastRemoteSnapshotVersion(e)))}function Jh(r,t){const e=L(r),n=t.snapshotVersion;let i=e.Fs;return e.persistence.runTransaction("Apply remote event","readwrite-primary",(o=>{const u=e.Os.newChangeBuffer({trackRemovals:!0});i=e.Fs;const c=[];t.targetChanges.forEach(((m,y)=>{const A=i.get(y);if(!A)return;c.push(e.hi.removeMatchingKeys(o,m.removedDocuments,y).next((()=>e.hi.addMatchingKeys(o,m.addedDocuments,y))));let S=A.withSequenceNumber(o.currentSequenceNumber);t.targetMismatches.get(y)!==null?S=S.withResumeToken(ht.EMPTY_BYTE_STRING,F.min()).withLastLimboFreeSnapshotVersion(F.min()):m.resumeToken.approximateByteSize()>0&&(S=S.withResumeToken(m.resumeToken,n)),i=i.insert(y,S),(function(x,D,q){return x.resumeToken.approximateByteSize()===0||D.snapshotVersion.toMicroseconds()-x.snapshotVersion.toMicroseconds()>=Wh?!0:q.addedDocuments.size+q.modifiedDocuments.size+q.removedDocuments.size>0})(A,S,m)&&c.push(e.hi.updateTargetData(o,S))}));let h=$t(),f=j();if(t.documentUpdates.forEach((m=>{t.resolvedLimboDocuments.has(m)&&c.push(e.persistence.referenceDelegate.updateLimboDocument(o,m))})),c.push(Zh(o,u,t.documentUpdates).next((m=>{h=m.Ls,f=m.ks}))),!n.isEqual(F.min())){const m=e.hi.getLastRemoteSnapshotVersion(o).next((y=>e.hi.setTargetsMetadata(o,o.currentSequenceNumber,n)));c.push(m)}return V.waitFor(c).next((()=>u.apply(o))).next((()=>e.localDocuments.getLocalViewOfDocuments(o,h,f))).next((()=>h))})).then((o=>(e.Fs=i,o)))}function Zh(r,t,e){let n=j(),i=j();return e.forEach((o=>n=n.add(o))),t.getEntries(r,n).next((o=>{let u=$t();return e.forEach(((c,h)=>{const f=o.get(c);h.isFoundDocument()!==f.isFoundDocument()&&(i=i.add(c)),h.isNoDocument()&&h.version.isEqual(F.min())?(t.removeEntry(c,h.readTime),u=u.insert(c,h)):!f.isValidDocument()||h.version.compareTo(f.version)>0||h.version.compareTo(f.version)===0&&f.hasPendingWrites?(t.addEntry(h),u=u.insert(c,h)):k(zs,"Ignoring outdated watch update for ",c,". Current version:",f.version," Watch version:",h.version)})),{Ls:u,ks:i}}))}function td(r,t){const e=L(r);return e.persistence.runTransaction("Get next mutation batch","readonly",(n=>(t===void 0&&(t=bs),e.mutationQueue.getNextMutationBatchAfterBatchId(n,t))))}function ed(r,t){const e=L(r);return e.persistence.runTransaction("Allocate target","readwrite",(n=>{let i;return e.hi.getTargetData(n,t).next((o=>o?(i=o,V.resolve(i)):e.hi.allocateTargetId(n).next((u=>(i=new Ht(t,u,"TargetPurposeListen",n.currentSequenceNumber),e.hi.addTargetData(n,i).next((()=>i)))))))})).then((n=>{const i=e.Fs.get(n.targetId);return(i===null||n.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(e.Fs=e.Fs.insert(n.targetId,n),e.Ms.set(t,n.targetId)),n}))}async function vs(r,t,e){const n=L(r),i=n.Fs.get(t),o=e?"readwrite":"readwrite-primary";try{e||await n.persistence.runTransaction("Release target",o,(u=>n.persistence.referenceDelegate.removeTarget(u,i)))}catch(u){if(!Me(u))throw u;k(zs,`Failed to update sequence numbers for target ${t}: ${u}`)}n.Fs=n.Fs.remove(t),n.Ms.delete(i.target)}function Wo(r,t,e){const n=L(r);let i=F.min(),o=j();return n.persistence.runTransaction("Execute query","readwrite",(u=>(function(h,f,m){const y=L(h),A=y.Ms.get(m);return A!==void 0?V.resolve(y.Fs.get(A)):y.hi.getTargetData(f,m)})(n,u,Dt(t)).next((c=>{if(c)return i=c.lastLimboFreeSnapshotVersion,n.hi.getMatchingKeysForTargetId(u,c.targetId).next((h=>{o=h}))})).next((()=>n.Cs.getDocumentsMatchingQuery(u,t,e?i:F.min(),e?o:j()))).next((c=>(nd(n,Bc(t),c),{documents:c,qs:o})))))}function nd(r,t,e){let n=r.xs.get(t)||F.min();e.forEach(((i,o)=>{o.readTime.compareTo(n)>0&&(n=o.readTime)})),r.xs.set(t,n)}class Ho{constructor(){this.activeTargetIds=Wc()}Gs(t){this.activeTargetIds=this.activeTargetIds.add(t)}zs(t){this.activeTargetIds=this.activeTargetIds.delete(t)}Ws(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class rd{constructor(){this.Fo=new Ho,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t,e=!0){return e&&this.Fo.Gs(t),this.Mo[t]||"not-current"}updateQueryState(t,e,n){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 Ho,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}/**
|
|
1143
1158
|
* @license
|
|
1144
1159
|
* Copyright 2019 Google LLC
|
|
1145
1160
|
*
|
|
@@ -1154,7 +1169,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1154
1169
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1155
1170
|
* See the License for the specific language governing permissions and
|
|
1156
1171
|
* limitations under the License.
|
|
1157
|
-
*/class
|
|
1172
|
+
*/class sd{xo(t){}shutdown(){}}/**
|
|
1158
1173
|
* @license
|
|
1159
1174
|
* Copyright 2019 Google LLC
|
|
1160
1175
|
*
|
|
@@ -1169,7 +1184,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1169
1184
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1170
1185
|
* See the License for the specific language governing permissions and
|
|
1171
1186
|
* limitations under the License.
|
|
1172
|
-
*/const
|
|
1187
|
+
*/const Xo="ConnectivityMonitor";class Yo{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(Xo,"Network connectivity changed: AVAILABLE");for(const t of this.ko)t(0)}Lo(){k(Xo,"Network connectivity changed: UNAVAILABLE");for(const t of this.ko)t(1)}static C(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
|
|
1173
1188
|
* @license
|
|
1174
1189
|
* Copyright 2023 Google LLC
|
|
1175
1190
|
*
|
|
@@ -1184,7 +1199,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1184
1199
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1185
1200
|
* See the License for the specific language governing permissions and
|
|
1186
1201
|
* limitations under the License.
|
|
1187
|
-
*/let
|
|
1202
|
+
*/let Yn=null;function Is(){return Yn===null?Yn=(function(){return 268435456+Math.round(2147483648*Math.random())})():Yn++,"0x"+Yn.toString(16)}/**
|
|
1188
1203
|
* @license
|
|
1189
1204
|
* Copyright 2020 Google LLC
|
|
1190
1205
|
*
|
|
@@ -1199,7 +1214,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1199
1214
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1200
1215
|
* See the License for the specific language governing permissions and
|
|
1201
1216
|
* limitations under the License.
|
|
1202
|
-
*/const
|
|
1217
|
+
*/const ss="RestConnection",id={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class od{get Qo(){return!1}constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.$o=e+"://"+t.host,this.Uo=`projects/${n}/databases/${i}`,this.Ko=this.databaseId.database===fn?`project_id=${n}`:`project_id=${n}&database_id=${i}`}Wo(t,e,n,i,o){const u=Is(),c=this.Go(t,e.toUriEncodedString());k(ss,`Sending RPC '${t}' ${u}:`,c,n);const h={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.Ko};this.zo(h,i,o);const{host:f}=new URL(c),m=Vs(f);return this.jo(t,c,h,n,m).then((y=>(k(ss,`Received RPC '${t}' ${u}: `,y),y)),(y=>{throw Jt(ss,`RPC '${t}' ${u} failed with error: `,y,"url: ",c,"request:",n),y}))}Jo(t,e,n,i,o,u){return this.Wo(t,e,n,i,o)}zo(t,e,n){t["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+xe})(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((i,o)=>t[o]=i)),n&&n.headers.forEach(((i,o)=>t[o]=i))}Go(t,e){const n=id[t];return`${this.$o}/v1/${e}:${n}`}terminate(){}}/**
|
|
1203
1218
|
* @license
|
|
1204
1219
|
* Copyright 2017 Google LLC
|
|
1205
1220
|
*
|
|
@@ -1214,7 +1229,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1214
1229
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1215
1230
|
* See the License for the specific language governing permissions and
|
|
1216
1231
|
* limitations under the License.
|
|
1217
|
-
*/class
|
|
1232
|
+
*/class ad{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)}}/**
|
|
1218
1233
|
* @license
|
|
1219
1234
|
* Copyright 2017 Google LLC
|
|
1220
1235
|
*
|
|
@@ -1229,7 +1244,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1229
1244
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1230
1245
|
* See the License for the specific language governing permissions and
|
|
1231
1246
|
* limitations under the License.
|
|
1232
|
-
*/const gt="WebChannelConnection";class
|
|
1247
|
+
*/const gt="WebChannelConnection";class ud extends od{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,n,i,o){const u=Is();return new Promise(((c,h)=>{const f=new Aa;f.setWithCredentials(!0),f.listenOnce(wa.COMPLETE,(()=>{try{switch(f.getLastErrorCode()){case Jn.NO_ERROR:const y=f.getResponseJson();k(gt,`XHR for RPC '${t}' ${u} received:`,JSON.stringify(y)),c(y);break;case Jn.TIMEOUT:k(gt,`RPC '${t}' ${u} timed out`),h(new N(P.DEADLINE_EXCEEDED,"Request time out"));break;case Jn.HTTP_ERROR:const A=f.getStatus();if(k(gt,`RPC '${t}' ${u} failed with status:`,A,"response text:",f.getResponseText()),A>0){let S=f.getResponseJson();Array.isArray(S)&&(S=S[0]);const C=S==null?void 0:S.error;if(C&&C.status&&C.message){const x=(function(q){const z=q.toLowerCase().replace(/_/g,"-");return Object.values(P).indexOf(z)>=0?z:P.UNKNOWN})(C.status);h(new N(x,C.message))}else h(new N(P.UNKNOWN,"Server responded with status "+f.getStatus()))}else h(new N(P.UNAVAILABLE,"Connection failed."));break;default:M(9055,{c_:t,streamId:u,l_:f.getLastErrorCode(),h_:f.getLastError()})}}finally{k(gt,`RPC '${t}' ${u} completed.`)}}));const m=JSON.stringify(i);k(gt,`RPC '${t}' ${u} sending request:`,i),f.send(e,"POST",m,n,15)}))}P_(t,e,n){const i=Is(),o=[this.$o,"/","google.firestore.v1.Firestore","/",t,"/channel"],u=Va(),c=Pa(),h={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${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,n),h.encodeInitMessageHeaders=!0;const m=o.join("");k(gt,`Creating RPC '${t}' stream ${i}: ${m}`,h);const y=u.createWebChannel(m,h);this.T_(y);let A=!1,S=!1;const C=new ad({Ho:D=>{S?k(gt,`Not sending because RPC '${t}' stream ${i} is closed:`,D):(A||(k(gt,`Opening RPC '${t}' stream ${i} transport.`),y.open(),A=!0),k(gt,`RPC '${t}' stream ${i} sending:`,D),y.send(D))},Yo:()=>y.close()}),x=(D,q,z)=>{D.listen(q,(K=>{try{z(K)}catch(it){setTimeout((()=>{throw it}),0)}}))};return x(y,nn.EventType.OPEN,(()=>{S||(k(gt,`RPC '${t}' stream ${i} transport opened.`),C.s_())})),x(y,nn.EventType.CLOSE,(()=>{S||(S=!0,k(gt,`RPC '${t}' stream ${i} transport closed`),C.__(),this.I_(y))})),x(y,nn.EventType.ERROR,(D=>{S||(S=!0,Jt(gt,`RPC '${t}' stream ${i} transport errored. Name:`,D.name,"Message:",D.message),C.__(new N(P.UNAVAILABLE,"The operation could not be completed")))})),x(y,nn.EventType.MESSAGE,(D=>{var q;if(!S){const z=D.data[0];G(!!z,16349);const K=z,it=(K==null?void 0:K.error)||((q=K[0])===null||q===void 0?void 0:q.error);if(it){k(gt,`RPC '${t}' stream ${i} received error:`,it);const Mt=it.status;let at=(function(_){const E=tt[_];if(E!==void 0)return uu(E)})(Mt),v=it.message;at===void 0&&(at=P.INTERNAL,v="Unknown error status: "+Mt+" with message "+it.message),S=!0,C.__(new N(at,v)),y.close()}else k(gt,`RPC '${t}' stream ${i} received:`,z),C.a_(z)}})),x(c,Ra.STAT_EVENT,(D=>{D.stat===ls.PROXY?k(gt,`RPC '${t}' stream ${i} detected buffering proxy`):D.stat===ls.NOPROXY&&k(gt,`RPC '${t}' stream ${i} detected no buffering proxy`)})),setTimeout((()=>{C.o_()}),0),C}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 is(){return typeof document<"u"?document:null}/**
|
|
1233
1248
|
* @license
|
|
1234
1249
|
* Copyright 2020 Google LLC
|
|
1235
1250
|
*
|
|
@@ -1244,7 +1259,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1244
1259
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1245
1260
|
* See the License for the specific language governing permissions and
|
|
1246
1261
|
* limitations under the License.
|
|
1247
|
-
*/function
|
|
1262
|
+
*/function Pr(r){return new fh(r,!0)}/**
|
|
1248
1263
|
* @license
|
|
1249
1264
|
* Copyright 2017 Google LLC
|
|
1250
1265
|
*
|
|
@@ -1259,7 +1274,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1259
1274
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1260
1275
|
* See the License for the specific language governing permissions and
|
|
1261
1276
|
* limitations under the License.
|
|
1262
|
-
*/class
|
|
1277
|
+
*/class Au{constructor(t,e,n=1e3,i=1.5,o=6e4){this.Fi=t,this.timerId=e,this.d_=n,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();const e=Math.floor(this.R_+this.p_()),n=Math.max(0,Date.now()-this.m_),i=Math.max(0,e-n);i>0&&k("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.R_} ms, delay with jitter: ${e} ms, last attempt: ${n} 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_}}/**
|
|
1263
1278
|
* @license
|
|
1264
1279
|
* Copyright 2017 Google LLC
|
|
1265
1280
|
*
|
|
@@ -1274,7 +1289,7 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1274
1289
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1275
1290
|
* See the License for the specific language governing permissions and
|
|
1276
1291
|
* limitations under the License.
|
|
1277
|
-
*/const
|
|
1292
|
+
*/const Jo="PersistentStream";class wu{constructor(t,e,n,i,o,u,c,h){this.Fi=t,this.w_=n,this.S_=i,this.connection=o,this.authCredentialsProvider=u,this.appCheckCredentialsProvider=c,this.listener=h,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new Au(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_()}async stop(){this.M_()&&await 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)}async L_(){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)}async close(t,e){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,t!==4?this.F_.reset():e&&e.code===P.RESOURCE_EXHAUSTED?(zt(e.toString()),zt("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):e&&e.code===P.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.U_(),this.stream.close(),this.stream=null),this.state=t,await this.listener.n_(e)}U_(){}auth(){this.state=1;const t=this.K_(this.b_),e=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([n,i])=>{this.b_===e&&this.W_(n,i)}),(n=>{t((()=>{const i=new N(P.UNKNOWN,"Fetching auth token failed: "+n.message);return this.G_(i)}))}))}W_(t,e){const n=this.K_(this.b_);this.stream=this.z_(t,e),this.stream.Zo((()=>{n((()=>this.listener.Zo()))})),this.stream.e_((()=>{n((()=>(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=>{n((()=>this.G_(i)))})),this.stream.onMessage((i=>{n((()=>++this.C_==1?this.j_(i):this.onNext(i)))}))}O_(){this.state=5,this.F_.g_((async()=>{this.state=0,this.start()}))}G_(t){return k(Jo,`close with error: ${t}`),this.stream=null,this.close(4,t)}K_(t){return e=>{this.Fi.enqueueAndForget((()=>this.b_===t?e():(k(Jo,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class ld extends wu{constructor(t,e,n,i,o,u){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,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();const e=gh(this.serializer,t),n=(function(o){if(!("targetChange"in o))return F.min();const u=o.targetChange;return u.targetIds&&u.targetIds.length?F.min():u.readTime?Nt(u.readTime):F.min()})(t);return this.listener.J_(e,n)}H_(t){const e={};e.database=Ts(this.serializer),e.addTarget=(function(o,u){let c;const h=u.target;if(c=ms(h)?{documents:Eh(o,h)}:{query:Th(o,h).Vt},c.targetId=u.targetId,u.resumeToken.approximateByteSize()>0){c.resumeToken=hu(o,u.resumeToken);const f=_s(o,u.expectedCount);f!==null&&(c.expectedCount=f)}else if(u.snapshotVersion.compareTo(F.min())>0){c.readTime=lr(o,u.snapshotVersion.toTimestamp());const f=_s(o,u.expectedCount);f!==null&&(c.expectedCount=f)}return c})(this.serializer,t);const n=Ih(this.serializer,t);n&&(e.labels=n),this.k_(e)}Y_(t){const e={};e.database=Ts(this.serializer),e.removeTarget=t,this.k_(e)}}class cd extends wu{constructor(t,e,n,i,o,u){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,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 G(!!t.streamToken,31322),this.lastStreamToken=t.streamToken,G(!t.writeResults||t.writeResults.length===0,55816),this.listener.ea()}onNext(t){G(!!t.streamToken,12678),this.lastStreamToken=t.streamToken,this.F_.reset();const e=yh(t.writeResults,t.commitTime),n=Nt(t.commitTime);return this.listener.ta(n,e)}na(){const t={};t.database=Ts(this.serializer),this.k_(t)}X_(t){const e={streamToken:this.lastStreamToken,writes:t.map((n=>_h(this.serializer,n)))};this.k_(e)}}/**
|
|
1278
1293
|
* @license
|
|
1279
1294
|
* Copyright 2017 Google LLC
|
|
1280
1295
|
*
|
|
@@ -1289,8 +1304,8 @@ Total Duration: ${f-p}ms`),V.resolve({didRun:!0,sequenceNumbersCollected:i,targe
|
|
|
1289
1304
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1290
1305
|
* See the License for the specific language governing permissions and
|
|
1291
1306
|
* limitations under the License.
|
|
1292
|
-
*/class
|
|
1293
|
-
This 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?(zt(e),this._a=!1):
|
|
1307
|
+
*/class hd{}class dd extends hd{constructor(t,e,n,i){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.serializer=i,this.ra=!1}ia(){if(this.ra)throw new N(P.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(t,e,n,i){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([o,u])=>this.connection.Wo(t,ys(e,n),i,o,u))).catch((o=>{throw o.name==="FirebaseError"?(o.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new N(P.UNKNOWN,o.toString())}))}Jo(t,e,n,i,o){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([u,c])=>this.connection.Jo(t,ys(e,n),i,u,c,o))).catch((u=>{throw u.name==="FirebaseError"?(u.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),u):new N(P.UNKNOWN,u.toString())}))}terminate(){this.ra=!0,this.connection.terminate()}}class fd{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: ${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){const e=`Could not reach Cloud Firestore backend. ${t}
|
|
1308
|
+
This 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?(zt(e),this._a=!1):k("OnlineStateTracker",e)}ha(){this.oa!==null&&(this.oa.cancel(),this.oa=null)}}/**
|
|
1294
1309
|
* @license
|
|
1295
1310
|
* Copyright 2017 Google LLC
|
|
1296
1311
|
*
|
|
@@ -1305,7 +1320,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1305
1320
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1306
1321
|
* See the License for the specific language governing permissions and
|
|
1307
1322
|
* limitations under the License.
|
|
1308
|
-
*/const pe="RemoteStore";class
|
|
1323
|
+
*/const pe="RemoteStore";class md{constructor(t,e,n,i,o){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=o,this.Ea.xo((u=>{n.enqueueAndForget((async()=>{_e(this)&&(k(pe,"Restarting streams for network reachability change."),await(async function(h){const f=L(h);f.Ia.add(4),await An(f),f.Aa.set("Unknown"),f.Ia.delete(4),await Vr(f)})(this))}))})),this.Aa=new fd(n,i)}}async function Vr(r){if(_e(r))for(const t of r.da)await t(!0)}async function An(r){for(const t of r.da)await t(!1)}function Ru(r,t){const e=L(r);e.Ta.has(t.targetId)||(e.Ta.set(t.targetId,t),Qs(e)?Ks(e):Fe(e).x_()&&Gs(e,t))}function $s(r,t){const e=L(r),n=Fe(e);e.Ta.delete(t),n.x_()&&Pu(e,t),e.Ta.size===0&&(n.x_()?n.B_():_e(e)&&e.Aa.set("Unknown"))}function Gs(r,t){if(r.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(F.min())>0){const e=r.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(e)}Fe(r).H_(t)}function Pu(r,t){r.Ra.$e(t),Fe(r).Y_(t)}function Ks(r){r.Ra=new lh({getRemoteKeysForTarget:t=>r.remoteSyncer.getRemoteKeysForTarget(t),Et:t=>r.Ta.get(t)||null,lt:()=>r.datastore.serializer.databaseId}),Fe(r).start(),r.Aa.aa()}function Qs(r){return _e(r)&&!Fe(r).M_()&&r.Ta.size>0}function _e(r){return L(r).Ia.size===0}function Vu(r){r.Ra=void 0}async function pd(r){r.Aa.set("Online")}async function gd(r){r.Ta.forEach(((t,e)=>{Gs(r,t)}))}async function _d(r,t){Vu(r),Qs(r)?(r.Aa.la(t),Ks(r)):r.Aa.set("Unknown")}async function yd(r,t,e){if(r.Aa.set("Online"),t instanceof cu&&t.state===2&&t.cause)try{await(async function(i,o){const u=o.cause;for(const c of o.targetIds)i.Ta.has(c)&&(await i.remoteSyncer.rejectListen(c,u),i.Ta.delete(c),i.Ra.removeTarget(c))})(r,t)}catch(n){k(pe,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await hr(r,n)}else if(t instanceof nr?r.Ra.Ye(t):t instanceof lu?r.Ra.it(t):r.Ra.et(t),!e.isEqual(F.min()))try{const n=await Iu(r.localStore);e.compareTo(n)>=0&&await(function(o,u){const c=o.Ra.Pt(u);return c.targetChanges.forEach(((h,f)=>{if(h.resumeToken.approximateByteSize()>0){const m=o.Ta.get(f);m&&o.Ta.set(f,m.withResumeToken(h.resumeToken,u))}})),c.targetMismatches.forEach(((h,f)=>{const m=o.Ta.get(h);if(!m)return;o.Ta.set(h,m.withResumeToken(ht.EMPTY_BYTE_STRING,m.snapshotVersion)),Pu(o,h);const y=new Ht(m.target,h,f,m.sequenceNumber);Gs(o,y)})),o.remoteSyncer.applyRemoteEvent(c)})(r,e)}catch(n){k(pe,"Failed to raise snapshot:",n),await hr(r,n)}}async function hr(r,t,e){if(!Me(t))throw t;r.Ia.add(1),await An(r),r.Aa.set("Offline"),e||(e=()=>Iu(r.localStore)),r.asyncQueue.enqueueRetryable((async()=>{k(pe,"Retrying IndexedDB access"),await e(),r.Ia.delete(1),await Vr(r)}))}function Su(r,t){return t().catch((e=>hr(r,e,t)))}async function Sr(r){const t=L(r),e=re(t);let n=t.Pa.length>0?t.Pa[t.Pa.length-1].batchId:bs;for(;Ed(t);)try{const i=await td(t.localStore,n);if(i===null){t.Pa.length===0&&e.B_();break}n=i.batchId,Td(t,i)}catch(i){await hr(t,i)}Cu(t)&&bu(t)}function Ed(r){return _e(r)&&r.Pa.length<10}function Td(r,t){r.Pa.push(t);const e=re(r);e.x_()&&e.Z_&&e.X_(t.mutations)}function Cu(r){return _e(r)&&!re(r).M_()&&r.Pa.length>0}function bu(r){re(r).start()}async function vd(r){re(r).na()}async function Id(r){const t=re(r);for(const e of r.Pa)t.X_(e.mutations)}async function Ad(r,t,e){const n=r.Pa.shift(),i=Fs.from(n,t,e);await Su(r,(()=>r.remoteSyncer.applySuccessfulWrite(i))),await Sr(r)}async function wd(r,t){t&&re(r).Z_&&await(async function(n,i){if((function(u){return ah(u)&&u!==P.ABORTED})(i.code)){const o=n.Pa.shift();re(n).N_(),await Su(n,(()=>n.remoteSyncer.rejectFailedWrite(o.batchId,i))),await Sr(n)}})(r,t),Cu(r)&&bu(r)}async function Zo(r,t){const e=L(r);e.asyncQueue.verifyOperationInProgress(),k(pe,"RemoteStore received new credentials");const n=_e(e);e.Ia.add(3),await An(e),n&&e.Aa.set("Unknown"),await e.remoteSyncer.handleCredentialChange(t),e.Ia.delete(3),await Vr(e)}async function Rd(r,t){const e=L(r);t?(e.Ia.delete(2),await Vr(e)):t||(e.Ia.add(2),await An(e),e.Aa.set("Unknown"))}function Fe(r){return r.Va||(r.Va=(function(e,n,i){const o=L(e);return o.ia(),new ld(n,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(r.datastore,r.asyncQueue,{Zo:pd.bind(null,r),e_:gd.bind(null,r),n_:_d.bind(null,r),J_:yd.bind(null,r)}),r.da.push((async t=>{t?(r.Va.N_(),Qs(r)?Ks(r):r.Aa.set("Unknown")):(await r.Va.stop(),Vu(r))}))),r.Va}function re(r){return r.ma||(r.ma=(function(e,n,i){const o=L(e);return o.ia(),new cd(n,o.connection,o.authCredentials,o.appCheckCredentials,o.serializer,i)})(r.datastore,r.asyncQueue,{Zo:()=>Promise.resolve(),e_:vd.bind(null,r),n_:wd.bind(null,r),ea:Id.bind(null,r),ta:Ad.bind(null,r)}),r.da.push((async t=>{t?(r.ma.N_(),await Sr(r)):(await r.ma.stop(),r.Pa.length>0&&(k(pe,`Stopping write stream with ${r.Pa.length} pending writes`),r.Pa=[]))}))),r.ma}/**
|
|
1309
1324
|
* @license
|
|
1310
1325
|
* Copyright 2017 Google LLC
|
|
1311
1326
|
*
|
|
@@ -1320,7 +1335,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1320
1335
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1321
1336
|
* See the License for the specific language governing permissions and
|
|
1322
1337
|
* limitations under the License.
|
|
1323
|
-
*/class
|
|
1338
|
+
*/class Ws{constructor(t,e,n,i,o){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=i,this.removalCallback=o,this.deferred=new jt,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,n,i,o){const u=Date.now()+n,c=new Ws(t,e,u,i,o);return c.start(n),c}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new N(P.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 Hs(r,t){if(zt("AsyncQueue",`${t}: ${r}`),Me(r))return new N(P.UNAVAILABLE,`${t}: ${r}`);throw r}/**
|
|
1324
1339
|
* @license
|
|
1325
1340
|
* Copyright 2017 Google LLC
|
|
1326
1341
|
*
|
|
@@ -1335,10 +1350,10 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1335
1350
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1336
1351
|
* See the License for the specific language governing permissions and
|
|
1337
1352
|
* limitations under the License.
|
|
1338
|
-
*/class
|
|
1353
|
+
*/class Ve{static emptySet(t){return new Ve(t.comparator)}constructor(t){this.comparator=t?(e,n)=>t(e,n)||O.comparator(e.key,n.key):(e,n)=>O.comparator(e.key,n.key),this.keyedMap=rn(),this.sortedSet=new Y(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){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Ve)||this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const i=e.getNext().key,o=n.getNext().key;if(!i.isEqual(o))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),t.length===0?"DocumentSet ()":`DocumentSet (
|
|
1339
1354
|
`+t.join(`
|
|
1340
1355
|
`)+`
|
|
1341
|
-
)`}copy(t,e){const n=new
|
|
1356
|
+
)`}copy(t,e){const n=new Ve;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}/**
|
|
1342
1357
|
* @license
|
|
1343
1358
|
* Copyright 2017 Google LLC
|
|
1344
1359
|
*
|
|
@@ -1353,7 +1368,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1353
1368
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1354
1369
|
* See the License for the specific language governing permissions and
|
|
1355
1370
|
* limitations under the License.
|
|
1356
|
-
*/class
|
|
1371
|
+
*/class ta{constructor(){this.fa=new Y(O.comparator)}track(t){const e=t.doc.key,n=this.fa.get(e);n?t.type!==0&&n.type===3?this.fa=this.fa.insert(e,t):t.type===3&&n.type!==1?this.fa=this.fa.insert(e,{type:n.type,doc:t.doc}):t.type===2&&n.type===2?this.fa=this.fa.insert(e,{type:2,doc:t.doc}):t.type===2&&n.type===0?this.fa=this.fa.insert(e,{type:0,doc:t.doc}):t.type===1&&n.type===0?this.fa=this.fa.remove(e):t.type===1&&n.type===2?this.fa=this.fa.insert(e,{type:1,doc:n.doc}):t.type===0&&n.type===1?this.fa=this.fa.insert(e,{type:2,doc:t.doc}):M(63341,{At:t,ga:n}):this.fa=this.fa.insert(e,t)}pa(){const t=[];return this.fa.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Ne{constructor(t,e,n,i,o,u,c,h,f){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=o,this.fromCache=u,this.syncStateChanged=c,this.excludesMetadataChanges=h,this.hasCachedResults=f}static fromInitialDocuments(t,e,n,i,o){const u=[];return e.forEach((c=>{u.push({type:0,doc:c})})),new Ne(t,e,Ve.emptySet(e),u,n,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)&&vr(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e[i].type!==n[i].type||!e[i].doc.isEqual(n[i].doc))return!1;return!0}}/**
|
|
1357
1372
|
* @license
|
|
1358
1373
|
* Copyright 2017 Google LLC
|
|
1359
1374
|
*
|
|
@@ -1368,7 +1383,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1368
1383
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1369
1384
|
* See the License for the specific language governing permissions and
|
|
1370
1385
|
* limitations under the License.
|
|
1371
|
-
*/class
|
|
1386
|
+
*/class Pd{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some((t=>t.ba()))}}class Vd{constructor(){this.queries=ea(),this.onlineState="Unknown",this.Da=new Set}terminate(){(function(e,n){const i=L(e),o=i.queries;i.queries=ea(),o.forEach(((u,c)=>{for(const h of c.wa)h.onError(n)}))})(this,new N(P.ABORTED,"Firestore shutting down"))}}function ea(){return new ge((r=>Xa(r)),vr)}async function Xs(r,t){const e=L(r);let n=3;const i=t.query;let o=e.queries.get(i);o?!o.Sa()&&t.ba()&&(n=2):(o=new Pd,n=t.ba()?0:1);try{switch(n){case 0:o.ya=await e.onListen(i,!0);break;case 1:o.ya=await e.onListen(i,!1);break;case 2:await e.onFirstRemoteStoreListen(i)}}catch(u){const c=Hs(u,`Initialization of query '${we(t.query)}' failed`);return void t.onError(c)}e.queries.set(i,o),o.wa.push(t),t.va(e.onlineState),o.ya&&t.Ca(o.ya)&&Js(e)}async function Ys(r,t){const e=L(r),n=t.query;let i=3;const o=e.queries.get(n);if(o){const 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(n),e.onUnlisten(n,!0);case 1:return e.queries.delete(n),e.onUnlisten(n,!1);case 2:return e.onLastRemoteStoreUnlisten(n);default:return}}function Sd(r,t){const e=L(r);let n=!1;for(const i of t){const o=i.query,u=e.queries.get(o);if(u){for(const c of u.wa)c.Ca(i)&&(n=!0);u.ya=i}}n&&Js(e)}function Cd(r,t,e){const n=L(r),i=n.queries.get(t);if(i)for(const o of i.wa)o.onError(e);n.queries.delete(t)}function Js(r){r.Da.forEach((t=>{t.next()}))}var As,na;(na=As||(As={})).Fa="default",na.Cache="cache";class Zs{constructor(t,e,n){this.query=t,this.Ma=e,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=n||{}}Ca(t){if(!this.options.includeMetadataChanges){const n=[];for(const i of t.docChanges)i.type!==3&&n.push(i);t=new Ne(t.query,t.docs,t.oldDocs,n,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;const n=e!=="Offline";return(!this.options.ka||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||e==="Offline")}Na(t){if(t.docChanges.length>0)return!0;const e=this.Oa&&this.Oa.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&this.options.includeMetadataChanges===!0}La(t){t=Ne.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.xa=!0,this.Ma.next(t)}ba(){return this.options.source!==As.Cache}}/**
|
|
1372
1387
|
* @license
|
|
1373
1388
|
* Copyright 2017 Google LLC
|
|
1374
1389
|
*
|
|
@@ -1383,7 +1398,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1383
1398
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1384
1399
|
* See the License for the specific language governing permissions and
|
|
1385
1400
|
* limitations under the License.
|
|
1386
|
-
*/class Eu{constructor(t){this.key=t}}class Tu{constructor(t){this.key=t}}class fd{constructor(t,e){this.query=t,this.Ha=e,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=q(),this.mutatedKeys=q(),this.Xa=Ua(t),this.eu=new Pe(this.Xa)}get tu(){return this.Ha}nu(t,e){const n=e?e.ru:new Ko,i=e?e.eu:this.eu;let o=e?e.mutatedKeys:this.mutatedKeys,u=i,c=!1;const 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(((p,E)=>{const R=i.get(p),S=Tr(this.query,E)?E:null,D=!!R&&this.mutatedKeys.has(R.key),x=!!S&&(S.hasLocalMutations||this.mutatedKeys.has(S.key)&&S.hasCommittedMutations);let b=!1;R&&S?R.data.isEqual(S.data)?D!==x&&(n.track({type:3,doc:S}),b=!0):this.iu(R,S)||(n.track({type:2,doc:S}),b=!0,(h&&this.Xa(S,h)>0||f&&this.Xa(S,f)<0)&&(c=!0)):!R&&S?(n.track({type:0,doc:S}),b=!0):R&&!S&&(n.track({type:1,doc:R}),b=!0,(h||f)&&(c=!0)),b&&(S?(u=u.add(S),o=x?o.add(p):o.delete(p)):(u=u.delete(p),o=o.delete(p)))})),this.query.limit!==null)for(;u.size>this.query.limit;){const p=this.query.limitType==="F"?u.last():u.first();u=u.delete(p.key),o=o.delete(p.key),n.track({type:1,doc:p})}return{eu:u,ru:n,Ds:c,mutatedKeys:o}}iu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n,i){const o=this.eu;this.eu=t.eu,this.mutatedKeys=t.mutatedKeys;const u=t.ru.pa();u.sort(((p,E)=>(function(S,D){const x=b=>{switch(b){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return M(20277,{At:b})}};return x(S)-x(D)})(p.type,E.type)||this.Xa(p.doc,E.doc))),this.su(n),i=i!=null&&i;const c=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 De(this.query,t.eu,o,u,t.mutatedKeys,h===0,f,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:c}:{_u:c}}va(t){return this.current&&t==="Offline"?(this.current=!1,this.applyChanges({eu:this.eu,ru:new Ko,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[];const t=this.Za;this.Za=q(),this.eu.forEach((n=>{this.au(n.key)&&(this.Za=this.Za.add(n.key))}));const e=[];return t.forEach((n=>{this.Za.has(n)||e.push(new Tu(n))})),this.Za.forEach((n=>{t.has(n)||e.push(new Eu(n))})),e}uu(t){this.Ha=t.qs,this.Za=q();const e=this.nu(t.documents);return this.applyChanges(e,!0)}cu(){return De.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,this.Ya===0,this.hasCachedResults)}}const Xs="SyncEngine";class md{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class pd{constructor(t){this.key=t,this.lu=!1}}class gd{constructor(t,e,n,i,o,u){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=u,this.hu={},this.Pu=new ge((c=>La(c)),Er),this.Tu=new Map,this.Iu=new Set,this.du=new Y(O.comparator),this.Eu=new Map,this.Au=new Ms,this.Ru={},this.Vu=new Map,this.mu=be.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return this.fu===!0}}async function _d(r,t,e=!0){const n=Pu(r);let i;const o=n.Pu.get(t);return o?(n.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.cu()):i=await vu(n,t,e,!0),i}async function yd(r,t){const e=Pu(r);await vu(e,t,!0,!1)}async function vu(r,t,e,n){const i=await Lh(r.localStore,Ct(t)),o=i.targetId,u=r.sharedClientState.addLocalQueryTarget(o,e);let c;return n&&(c=await Ed(r,t,o,u==="current",i.resumeToken)),r.isPrimaryClient&&e&&fu(r.remoteStore,i),c}async function Ed(r,t,e,n,i){r.gu=(E,R,S)=>(async function(x,b,$,B){let K=b.view.nu($);K.Ds&&(K=await qo(x.localStore,b.query,!1).then((({documents:v})=>b.view.nu(v,K))));const it=B&&B.targetChanges.get(b.targetId),Mt=B&&B.targetMismatches.get(b.targetId)!=null,at=b.view.applyChanges(K,x.isPrimaryClient,it,Mt);return Xo(x,b.targetId,at._u),at.snapshot})(r,E,R,S);const o=await qo(r.localStore,t,!0),u=new fd(t,o.qs),c=u.nu(o.documents),h=Tn.createSynthesizedTargetChangeForCurrentChange(e,n&&r.onlineState!=="Offline",i),f=u.applyChanges(c,r.isPrimaryClient,h);Xo(r,e,f._u);const p=new md(t,e,u);return r.Pu.set(t,p),r.Tu.has(e)?r.Tu.get(e).push(t):r.Tu.set(e,[t]),f.snapshot}async function Td(r,t,e){const n=L(r),i=n.Pu.get(t),o=n.Tu.get(i.targetId);if(o.length>1)return n.Tu.set(i.targetId,o.filter((u=>!Er(u,t)))),void n.Pu.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(i.targetId),n.sharedClientState.isActiveQueryTarget(i.targetId)||await gs(n.localStore,i.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(i.targetId),e&&qs(n.remoteStore,i.targetId),Es(n,i.targetId)})).catch(xe)):(Es(n,i.targetId),await gs(n.localStore,i.targetId,!0))}async function vd(r,t){const e=L(r),n=e.Pu.get(t),i=e.Tu.get(n.targetId);e.isPrimaryClient&&i.length===1&&(e.sharedClientState.removeLocalQueryTarget(n.targetId),qs(e.remoteStore,n.targetId))}async function Id(r,t,e){const n=Cd(r);try{const i=await(function(u,c){const h=L(u),f=W.now(),p=c.reduce(((S,D)=>S.add(D.key)),q());let E,R;return h.persistence.runTransaction("Locally write mutations","readwrite",(S=>{let D=$t(),x=q();return h.Os.getEntries(S,p).next((b=>{D=b,D.forEach((($,B)=>{B.isValidDocument()||(x=x.add($))}))})).next((()=>h.localDocuments.getOverlayedDocuments(S,D))).next((b=>{E=b;const $=[];for(const B of c){const K=Uc(B,E.get(B.key).overlayedDocument);K!=null&&$.push(new oe(B.key,K,Da(K.value.mapValue),Vt.exists(!0)))}return h.mutationQueue.addMutationBatch(S,f,$,c)})).next((b=>{R=b;const $=b.applyToLocalDocumentSet(E,x);return h.documentOverlayCache.saveOverlays(S,b.batchId,$)}))})).then((()=>({batchId:R.batchId,changes:ja(E)})))})(n.localStore,t);n.sharedClientState.addPendingMutation(i.batchId),(function(u,c,h){let f=u.Ru[u.currentUser.toKey()];f||(f=new Y(U)),f=f.insert(c,h),u.Ru[u.currentUser.toKey()]=f})(n,i.batchId,e),await In(n,i.changes),await Pr(n.remoteStore)}catch(i){const o=Gs(i,"Failed to persist write");e.reject(o)}}async function Iu(r,t){const e=L(r);try{const n=await Oh(e.localStore,t);t.targetChanges.forEach(((i,o)=>{const u=e.Eu.get(o);u&&(G(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?u.lu=!0:i.modifiedDocuments.size>0?G(u.lu,14607):i.removedDocuments.size>0&&(G(u.lu,42227),u.lu=!1))})),await In(e,n,t)}catch(n){await xe(n)}}function Ho(r,t,e){const n=L(r);if(n.isPrimaryClient&&e===0||!n.isPrimaryClient&&e===1){const i=[];n.Pu.forEach(((o,u)=>{const c=u.view.va(t);c.snapshot&&i.push(c.snapshot)})),(function(u,c){const h=L(u);h.onlineState=c;let f=!1;h.queries.forEach(((p,E)=>{for(const R of E.wa)R.va(c)&&(f=!0)})),f&&Ws(h)})(n.eventManager,t),i.length&&n.hu.J_(i),n.onlineState=t,n.isPrimaryClient&&n.sharedClientState.setOnlineState(t)}}async function Ad(r,t,e){const n=L(r);n.sharedClientState.updateQueryState(t,"rejected",e);const i=n.Eu.get(t),o=i&&i.key;if(o){let u=new Y(O.comparator);u=u.insert(o,yt.newNoDocument(o,F.min()));const c=q().add(o),h=new Ar(F.min(),new Map,new Y(U),u,c);await Iu(n,h),n.du=n.du.remove(o),n.Eu.delete(t),Ys(n)}else await gs(n.localStore,t,!1).then((()=>Es(n,t,e))).catch(xe)}async function wd(r,t){const e=L(r),n=t.batch.batchId;try{const i=await xh(e.localStore,t);wu(e,n,null),Au(e,n),e.sharedClientState.updateMutationState(n,"acknowledged"),await In(e,i)}catch(i){await xe(i)}}async function Rd(r,t,e){const n=L(r);try{const i=await(function(u,c){const h=L(u);return h.persistence.runTransaction("Reject batch","readwrite-primary",(f=>{let p;return h.mutationQueue.lookupMutationBatch(f,c).next((E=>(G(E!==null,37113),p=E.keys(),h.mutationQueue.removeMutationBatch(f,E)))).next((()=>h.mutationQueue.performConsistencyCheck(f))).next((()=>h.documentOverlayCache.removeOverlaysForBatchId(f,p,c))).next((()=>h.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(f,p))).next((()=>h.localDocuments.getDocuments(f,p)))}))})(n.localStore,t);wu(n,t,e),Au(n,t),n.sharedClientState.updateMutationState(t,"rejected",e),await In(n,i)}catch(i){await xe(i)}}function Au(r,t){(r.Vu.get(t)||[]).forEach((e=>{e.resolve()})),r.Vu.delete(t)}function wu(r,t,e){const n=L(r);let i=n.Ru[n.currentUser.toKey()];if(i){const o=i.get(t);o&&(e?o.reject(e):o.resolve(),i=i.remove(t)),n.Ru[n.currentUser.toKey()]=i}}function Es(r,t,e=null){r.sharedClientState.removeLocalQueryTarget(t);for(const n of r.Tu.get(t))r.Pu.delete(n),e&&r.hu.pu(n,e);r.Tu.delete(t),r.isPrimaryClient&&r.Au.zr(t).forEach((n=>{r.Au.containsKey(n)||Ru(r,n)}))}function Ru(r,t){r.Iu.delete(t.path.canonicalString());const e=r.du.get(t);e!==null&&(qs(r.remoteStore,e),r.du=r.du.remove(t),r.Eu.delete(e),Ys(r))}function Xo(r,t,e){for(const n of e)n instanceof Eu?(r.Au.addReference(n.key,t),Pd(r,n)):n instanceof Tu?(N(Xs,"Document no longer in limbo: "+n.key),r.Au.removeReference(n.key,t),r.Au.containsKey(n.key)||Ru(r,n.key)):M(19791,{yu:n})}function Pd(r,t){const e=t.key,n=e.path.canonicalString();r.du.get(e)||r.Iu.has(n)||(N(Xs,"New document in limbo: "+e),r.Iu.add(n),Ys(r))}function Ys(r){for(;r.Iu.size>0&&r.du.size<r.maxConcurrentLimboResolutions;){const t=r.Iu.values().next().value;r.Iu.delete(t);const e=new O(X.fromString(t)),n=r.mu.next();r.Eu.set(n,new pd(e)),r.du=r.du.insert(e,n),fu(r.remoteStore,new Ht(Ct(yr(e.path)),n,"TargetPurposeLimboResolution",mr.ue))}}async function In(r,t,e){const n=L(r),i=[],o=[],u=[];n.Pu.isEmpty()||(n.Pu.forEach(((c,h)=>{u.push(n.gu(h,t,e).then((f=>{var p;if((f||e)&&n.isPrimaryClient){const E=f?!f.fromCache:(p=e==null?void 0:e.targetChanges.get(h.targetId))===null||p===void 0?void 0:p.current;n.sharedClientState.updateQueryState(h.targetId,E?"current":"not-current")}if(f){i.push(f);const E=Ls.Es(h.targetId,f);o.push(E)}})))})),await Promise.all(u),n.hu.J_(i),await(async function(h,f){const p=L(h);try{await p.persistence.runTransaction("notifyLocalViewChanges","readwrite",(E=>V.forEach(f,(R=>V.forEach(R.Is,(S=>p.persistence.referenceDelegate.addReference(E,R.targetId,S))).next((()=>V.forEach(R.ds,(S=>p.persistence.referenceDelegate.removeReference(E,R.targetId,S)))))))))}catch(E){if(!Oe(E))throw E;N(Us,"Failed to update sequence numbers: "+E)}for(const E of f){const R=E.targetId;if(!E.fromCache){const S=p.Fs.get(R),D=S.snapshotVersion,x=S.withLastLimboFreeSnapshotVersion(D);p.Fs=p.Fs.insert(R,x)}}})(n.localStore,o))}async function Vd(r,t){const e=L(r);if(!e.currentUser.isEqual(t)){N(Xs,"User change. New user:",t.toKey());const n=await lu(e.localStore,t);e.currentUser=t,(function(o,u){o.Vu.forEach((c=>{c.forEach((h=>{h.reject(new k(P.CANCELLED,u))}))})),o.Vu.clear()})(e,"'waitForPendingWrites' promise is rejected due to a user change."),e.sharedClientState.handleUserChange(t,n.removedBatchIds,n.addedBatchIds),await In(e,n.Bs)}}function Sd(r,t){const e=L(r),n=e.Eu.get(t);if(n&&n.lu)return q().add(n.key);{let i=q();const o=e.Tu.get(t);if(!o)return i;for(const u of o){const c=e.Pu.get(u);i=i.unionWith(c.view.tu)}return i}}function Pu(r){const t=L(r);return t.remoteStore.remoteSyncer.applyRemoteEvent=Iu.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Sd.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=Ad.bind(null,t),t.hu.J_=hd.bind(null,t.eventManager),t.hu.pu=dd.bind(null,t.eventManager),t}function Cd(r){const t=L(r);return t.remoteStore.remoteSyncer.applySuccessfulWrite=wd.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Rd.bind(null,t),t}class hr{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(t){this.serializer=wr(t.databaseInfo.databaseId),this.sharedClientState=this.bu(t),this.persistence=this.Du(t),await this.persistence.start(),this.localStore=this.vu(t),this.gcScheduler=this.Cu(t,this.localStore),this.indexBackfillerScheduler=this.Fu(t,this.localStore)}Cu(t,e){return null}Fu(t,e){return null}vu(t){return kh(this.persistence,new bh,t.initialUser,this.serializer)}Du(t){return new uu(Fs.Vi,this.serializer)}bu(t){return new qh}async terminate(){var t,e;(t=this.gcScheduler)===null||t===void 0||t.stop(),(e=this.indexBackfillerScheduler)===null||e===void 0||e.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}hr.provider={build:()=>new hr};class bd extends hr{constructor(t){super(),this.cacheSizeBytes=t}Cu(t,e){G(this.persistence.referenceDelegate instanceof lr,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new ph(n,t.asyncQueue,e)}Du(t){const e=this.cacheSizeBytes!==void 0?vt.withCacheSize(this.cacheSizeBytes):vt.DEFAULT;return new uu((n=>lr.Vi(n,e)),this.serializer)}}class Ts{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=n=>Ho(this.syncEngine,n,1),this.remoteStore.remoteSyncer.handleCredentialChange=Vd.bind(null,this.syncEngine),await ud(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return(function(){return new cd})()}createDatastore(t){const e=wr(t.databaseInfo.databaseId),n=(function(o){return new Gh(o)})(t.databaseInfo);return(function(o,u,c,h){return new Hh(o,u,c,h)})(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return(function(n,i,o,u,c){return new Yh(n,i,o,u,c)})(this.localStore,this.datastore,t.asyncQueue,(e=>Ho(this.syncEngine,e,0)),(function(){return zo.C()?new zo:new jh})())}createSyncEngine(t,e){return(function(i,o,u,c,h,f,p){const E=new gd(i,o,u,c,h,f);return p&&(E.fu=!0),E})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}async terminate(){var t,e;await(async function(i){const o=L(i);N(pe,"RemoteStore shutting down."),o.Ia.add(5),await vn(o),o.Ea.shutdown(),o.Aa.set("Unknown")})(this.remoteStore),(t=this.datastore)===null||t===void 0||t.terminate(),(e=this.eventManager)===null||e===void 0||e.terminate()}}Ts.provider={build:()=>new Ts};/**
|
|
1401
|
+
*/class Du{constructor(t){this.key=t}}class Nu{constructor(t){this.key=t}}class bd{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=Ya(t),this.eu=new Ve(this.Xa)}get tu(){return this.Ha}nu(t,e){const n=e?e.ru:new ta,i=e?e.eu:this.eu;let o=e?e.mutatedKeys:this.mutatedKeys,u=i,c=!1;const 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(((m,y)=>{const A=i.get(m),S=Ir(this.query,y)?y:null,C=!!A&&this.mutatedKeys.has(A.key),x=!!S&&(S.hasLocalMutations||this.mutatedKeys.has(S.key)&&S.hasCommittedMutations);let D=!1;A&&S?A.data.isEqual(S.data)?C!==x&&(n.track({type:3,doc:S}),D=!0):this.iu(A,S)||(n.track({type:2,doc:S}),D=!0,(h&&this.Xa(S,h)>0||f&&this.Xa(S,f)<0)&&(c=!0)):!A&&S?(n.track({type:0,doc:S}),D=!0):A&&!S&&(n.track({type:1,doc:A}),D=!0,(h||f)&&(c=!0)),D&&(S?(u=u.add(S),o=x?o.add(m):o.delete(m)):(u=u.delete(m),o=o.delete(m)))})),this.query.limit!==null)for(;u.size>this.query.limit;){const m=this.query.limitType==="F"?u.last():u.first();u=u.delete(m.key),o=o.delete(m.key),n.track({type:1,doc:m})}return{eu:u,ru:n,Ds:c,mutatedKeys:o}}iu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n,i){const o=this.eu;this.eu=t.eu,this.mutatedKeys=t.mutatedKeys;const u=t.ru.pa();u.sort(((m,y)=>(function(S,C){const x=D=>{switch(D){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return M(20277,{At:D})}};return x(S)-x(C)})(m.type,y.type)||this.Xa(m.doc,y.doc))),this.su(n),i=i!=null&&i;const c=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 Ne(this.query,t.eu,o,u,t.mutatedKeys,h===0,f,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:c}:{_u:c}}va(t){return this.current&&t==="Offline"?(this.current=!1,this.applyChanges({eu:this.eu,ru:new ta,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[];const t=this.Za;this.Za=j(),this.eu.forEach((n=>{this.au(n.key)&&(this.Za=this.Za.add(n.key))}));const e=[];return t.forEach((n=>{this.Za.has(n)||e.push(new Nu(n))})),this.Za.forEach((n=>{t.has(n)||e.push(new Du(n))})),e}uu(t){this.Ha=t.qs,this.Za=j();const e=this.nu(t.documents);return this.applyChanges(e,!0)}cu(){return Ne.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,this.Ya===0,this.hasCachedResults)}}const ti="SyncEngine";class Dd{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class Nd{constructor(t){this.key=t,this.lu=!1}}class kd{constructor(t,e,n,i,o,u){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=i,this.currentUser=o,this.maxConcurrentLimboResolutions=u,this.hu={},this.Pu=new ge((c=>Xa(c)),vr),this.Tu=new Map,this.Iu=new Set,this.du=new Y(O.comparator),this.Eu=new Map,this.Au=new qs,this.Ru={},this.Vu=new Map,this.mu=De.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return this.fu===!0}}async function xd(r,t,e=!0){const n=Lu(r);let i;const o=n.Pu.get(t);return o?(n.sharedClientState.addLocalQueryTarget(o.targetId),i=o.view.cu()):i=await ku(n,t,e,!0),i}async function Od(r,t){const e=Lu(r);await ku(e,t,!0,!1)}async function ku(r,t,e,n){const i=await ed(r.localStore,Dt(t)),o=i.targetId,u=r.sharedClientState.addLocalQueryTarget(o,e);let c;return n&&(c=await Md(r,t,o,u==="current",i.resumeToken)),r.isPrimaryClient&&e&&Ru(r.remoteStore,i),c}async function Md(r,t,e,n,i){r.gu=(y,A,S)=>(async function(x,D,q,z){let K=D.view.nu(q);K.Ds&&(K=await Wo(x.localStore,D.query,!1).then((({documents:v})=>D.view.nu(v,K))));const it=z&&z.targetChanges.get(D.targetId),Mt=z&&z.targetMismatches.get(D.targetId)!=null,at=D.view.applyChanges(K,x.isPrimaryClient,it,Mt);return sa(x,D.targetId,at._u),at.snapshot})(r,y,A,S);const o=await Wo(r.localStore,t,!0),u=new bd(t,o.qs),c=u.nu(o.documents),h=In.createSynthesizedTargetChangeForCurrentChange(e,n&&r.onlineState!=="Offline",i),f=u.applyChanges(c,r.isPrimaryClient,h);sa(r,e,f._u);const m=new Dd(t,e,u);return r.Pu.set(t,m),r.Tu.has(e)?r.Tu.get(e).push(t):r.Tu.set(e,[t]),f.snapshot}async function Fd(r,t,e){const n=L(r),i=n.Pu.get(t),o=n.Tu.get(i.targetId);if(o.length>1)return n.Tu.set(i.targetId,o.filter((u=>!vr(u,t)))),void n.Pu.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(i.targetId),n.sharedClientState.isActiveQueryTarget(i.targetId)||await vs(n.localStore,i.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(i.targetId),e&&$s(n.remoteStore,i.targetId),ws(n,i.targetId)})).catch(Oe)):(ws(n,i.targetId),await vs(n.localStore,i.targetId,!0))}async function Ld(r,t){const e=L(r),n=e.Pu.get(t),i=e.Tu.get(n.targetId);e.isPrimaryClient&&i.length===1&&(e.sharedClientState.removeLocalQueryTarget(n.targetId),$s(e.remoteStore,n.targetId))}async function Ud(r,t,e){const n=Kd(r);try{const i=await(function(u,c){const h=L(u),f=W.now(),m=c.reduce(((S,C)=>S.add(C.key)),j());let y,A;return h.persistence.runTransaction("Locally write mutations","readwrite",(S=>{let C=$t(),x=j();return h.Os.getEntries(S,m).next((D=>{C=D,C.forEach(((q,z)=>{z.isValidDocument()||(x=x.add(q))}))})).next((()=>h.localDocuments.getOverlayedDocuments(S,C))).next((D=>{y=D;const q=[];for(const z of c){const K=nh(z,y.get(z.key).overlayedDocument);K!=null&&q.push(new oe(z.key,K,Ba(K.value.mapValue),Vt.exists(!0)))}return h.mutationQueue.addMutationBatch(S,f,q,c)})).next((D=>{A=D;const q=D.applyToLocalDocumentSet(y,x);return h.documentOverlayCache.saveOverlays(S,D.batchId,q)}))})).then((()=>({batchId:A.batchId,changes:Za(y)})))})(n.localStore,t);n.sharedClientState.addPendingMutation(i.batchId),(function(u,c,h){let f=u.Ru[u.currentUser.toKey()];f||(f=new Y(U)),f=f.insert(c,h),u.Ru[u.currentUser.toKey()]=f})(n,i.batchId,e),await wn(n,i.changes),await Sr(n.remoteStore)}catch(i){const o=Hs(i,"Failed to persist write");e.reject(o)}}async function xu(r,t){const e=L(r);try{const n=await Jh(e.localStore,t);t.targetChanges.forEach(((i,o)=>{const u=e.Eu.get(o);u&&(G(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?u.lu=!0:i.modifiedDocuments.size>0?G(u.lu,14607):i.removedDocuments.size>0&&(G(u.lu,42227),u.lu=!1))})),await wn(e,n,t)}catch(n){await Oe(n)}}function ra(r,t,e){const n=L(r);if(n.isPrimaryClient&&e===0||!n.isPrimaryClient&&e===1){const i=[];n.Pu.forEach(((o,u)=>{const c=u.view.va(t);c.snapshot&&i.push(c.snapshot)})),(function(u,c){const h=L(u);h.onlineState=c;let f=!1;h.queries.forEach(((m,y)=>{for(const A of y.wa)A.va(c)&&(f=!0)})),f&&Js(h)})(n.eventManager,t),i.length&&n.hu.J_(i),n.onlineState=t,n.isPrimaryClient&&n.sharedClientState.setOnlineState(t)}}async function qd(r,t,e){const n=L(r);n.sharedClientState.updateQueryState(t,"rejected",e);const i=n.Eu.get(t),o=i&&i.key;if(o){let u=new Y(O.comparator);u=u.insert(o,yt.newNoDocument(o,F.min()));const c=j().add(o),h=new Rr(F.min(),new Map,new Y(U),u,c);await xu(n,h),n.du=n.du.remove(o),n.Eu.delete(t),ei(n)}else await vs(n.localStore,t,!1).then((()=>ws(n,t,e))).catch(Oe)}async function jd(r,t){const e=L(r),n=t.batch.batchId;try{const i=await Yh(e.localStore,t);Mu(e,n,null),Ou(e,n),e.sharedClientState.updateMutationState(n,"acknowledged"),await wn(e,i)}catch(i){await Oe(i)}}async function Bd(r,t,e){const n=L(r);try{const i=await(function(u,c){const h=L(u);return h.persistence.runTransaction("Reject batch","readwrite-primary",(f=>{let m;return h.mutationQueue.lookupMutationBatch(f,c).next((y=>(G(y!==null,37113),m=y.keys(),h.mutationQueue.removeMutationBatch(f,y)))).next((()=>h.mutationQueue.performConsistencyCheck(f))).next((()=>h.documentOverlayCache.removeOverlaysForBatchId(f,m,c))).next((()=>h.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(f,m))).next((()=>h.localDocuments.getDocuments(f,m)))}))})(n.localStore,t);Mu(n,t,e),Ou(n,t),n.sharedClientState.updateMutationState(t,"rejected",e),await wn(n,i)}catch(i){await Oe(i)}}function Ou(r,t){(r.Vu.get(t)||[]).forEach((e=>{e.resolve()})),r.Vu.delete(t)}function Mu(r,t,e){const n=L(r);let i=n.Ru[n.currentUser.toKey()];if(i){const o=i.get(t);o&&(e?o.reject(e):o.resolve(),i=i.remove(t)),n.Ru[n.currentUser.toKey()]=i}}function ws(r,t,e=null){r.sharedClientState.removeLocalQueryTarget(t);for(const n of r.Tu.get(t))r.Pu.delete(n),e&&r.hu.pu(n,e);r.Tu.delete(t),r.isPrimaryClient&&r.Au.zr(t).forEach((n=>{r.Au.containsKey(n)||Fu(r,n)}))}function Fu(r,t){r.Iu.delete(t.path.canonicalString());const e=r.du.get(t);e!==null&&($s(r.remoteStore,e),r.du=r.du.remove(t),r.Eu.delete(e),ei(r))}function sa(r,t,e){for(const n of e)n instanceof Du?(r.Au.addReference(n.key,t),zd(r,n)):n instanceof Nu?(k(ti,"Document no longer in limbo: "+n.key),r.Au.removeReference(n.key,t),r.Au.containsKey(n.key)||Fu(r,n.key)):M(19791,{yu:n})}function zd(r,t){const e=t.key,n=e.path.canonicalString();r.du.get(e)||r.Iu.has(n)||(k(ti,"New document in limbo: "+e),r.Iu.add(n),ei(r))}function ei(r){for(;r.Iu.size>0&&r.du.size<r.maxConcurrentLimboResolutions;){const t=r.Iu.values().next().value;r.Iu.delete(t);const e=new O(H.fromString(t)),n=r.mu.next();r.Eu.set(n,new Nd(e)),r.du=r.du.insert(e,n),Ru(r.remoteStore,new Ht(Dt(Tr(e.path)),n,"TargetPurposeLimboResolution",_r.ue))}}async function wn(r,t,e){const n=L(r),i=[],o=[],u=[];n.Pu.isEmpty()||(n.Pu.forEach(((c,h)=>{u.push(n.gu(h,t,e).then((f=>{var m;if((f||e)&&n.isPrimaryClient){const y=f?!f.fromCache:(m=e==null?void 0:e.targetChanges.get(h.targetId))===null||m===void 0?void 0:m.current;n.sharedClientState.updateQueryState(h.targetId,y?"current":"not-current")}if(f){i.push(f);const y=Bs.Es(h.targetId,f);o.push(y)}})))})),await Promise.all(u),n.hu.J_(i),await(async function(h,f){const m=L(h);try{await m.persistence.runTransaction("notifyLocalViewChanges","readwrite",(y=>V.forEach(f,(A=>V.forEach(A.Is,(S=>m.persistence.referenceDelegate.addReference(y,A.targetId,S))).next((()=>V.forEach(A.ds,(S=>m.persistence.referenceDelegate.removeReference(y,A.targetId,S)))))))))}catch(y){if(!Me(y))throw y;k(zs,"Failed to update sequence numbers: "+y)}for(const y of f){const A=y.targetId;if(!y.fromCache){const S=m.Fs.get(A),C=S.snapshotVersion,x=S.withLastLimboFreeSnapshotVersion(C);m.Fs=m.Fs.insert(A,x)}}})(n.localStore,o))}async function $d(r,t){const e=L(r);if(!e.currentUser.isEqual(t)){k(ti,"User change. New user:",t.toKey());const n=await vu(e.localStore,t);e.currentUser=t,(function(o,u){o.Vu.forEach((c=>{c.forEach((h=>{h.reject(new N(P.CANCELLED,u))}))})),o.Vu.clear()})(e,"'waitForPendingWrites' promise is rejected due to a user change."),e.sharedClientState.handleUserChange(t,n.removedBatchIds,n.addedBatchIds),await wn(e,n.Bs)}}function Gd(r,t){const e=L(r),n=e.Eu.get(t);if(n&&n.lu)return j().add(n.key);{let i=j();const o=e.Tu.get(t);if(!o)return i;for(const u of o){const c=e.Pu.get(u);i=i.unionWith(c.view.tu)}return i}}function Lu(r){const t=L(r);return t.remoteStore.remoteSyncer.applyRemoteEvent=xu.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Gd.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=qd.bind(null,t),t.hu.J_=Sd.bind(null,t.eventManager),t.hu.pu=Cd.bind(null,t.eventManager),t}function Kd(r){const t=L(r);return t.remoteStore.remoteSyncer.applySuccessfulWrite=jd.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Bd.bind(null,t),t}class dr{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(t){this.serializer=Pr(t.databaseInfo.databaseId),this.sharedClientState=this.bu(t),this.persistence=this.Du(t),await this.persistence.start(),this.localStore=this.vu(t),this.gcScheduler=this.Cu(t,this.localStore),this.indexBackfillerScheduler=this.Fu(t,this.localStore)}Cu(t,e){return null}Fu(t,e){return null}vu(t){return Xh(this.persistence,new Qh,t.initialUser,this.serializer)}Du(t){return new Tu(js.Vi,this.serializer)}bu(t){return new rd}async terminate(){var t,e;(t=this.gcScheduler)===null||t===void 0||t.stop(),(e=this.indexBackfillerScheduler)===null||e===void 0||e.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}dr.provider={build:()=>new dr};class Qd extends dr{constructor(t){super(),this.cacheSizeBytes=t}Cu(t,e){G(this.persistence.referenceDelegate instanceof cr,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new Nh(n,t.asyncQueue,e)}Du(t){const e=this.cacheSizeBytes!==void 0?vt.withCacheSize(this.cacheSizeBytes):vt.DEFAULT;return new Tu((n=>cr.Vi(n,e)),this.serializer)}}class Rs{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=n=>ra(this.syncEngine,n,1),this.remoteStore.remoteSyncer.handleCredentialChange=$d.bind(null,this.syncEngine),await Rd(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return(function(){return new Vd})()}createDatastore(t){const e=Pr(t.databaseInfo.databaseId),n=(function(o){return new ud(o)})(t.databaseInfo);return(function(o,u,c,h){return new dd(o,u,c,h)})(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return(function(n,i,o,u,c){return new md(n,i,o,u,c)})(this.localStore,this.datastore,t.asyncQueue,(e=>ra(this.syncEngine,e,0)),(function(){return Yo.C()?new Yo:new sd})())}createSyncEngine(t,e){return(function(i,o,u,c,h,f,m){const y=new kd(i,o,u,c,h,f);return m&&(y.fu=!0),y})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}async terminate(){var t,e;await(async function(i){const o=L(i);k(pe,"RemoteStore shutting down."),o.Ia.add(5),await An(o),o.Ea.shutdown(),o.Aa.set("Unknown")})(this.remoteStore),(t=this.datastore)===null||t===void 0||t.terminate(),(e=this.eventManager)===null||e===void 0||e.terminate()}}Rs.provider={build:()=>new Rs};/**
|
|
1387
1402
|
* @license
|
|
1388
1403
|
* Copyright 2020 Google LLC
|
|
1389
1404
|
*
|
|
@@ -1413,7 +1428,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1413
1428
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1414
1429
|
* See the License for the specific language governing permissions and
|
|
1415
1430
|
* limitations under the License.
|
|
1416
|
-
*/class
|
|
1431
|
+
*/class ni{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):zt("Uncaught Error in snapshot listener:",t.toString()))}Ou(){this.muted=!0}xu(t,e){setTimeout((()=>{this.muted||t(e)}),0)}}/**
|
|
1417
1432
|
* @license
|
|
1418
1433
|
* Copyright 2017 Google LLC
|
|
1419
1434
|
*
|
|
@@ -1428,7 +1443,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1428
1443
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1429
1444
|
* See the License for the specific language governing permissions and
|
|
1430
1445
|
* limitations under the License.
|
|
1431
|
-
*/const se="FirestoreClient";class
|
|
1446
|
+
*/const se="FirestoreClient";class Wd{constructor(t,e,n,i,o){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=i,this.user=_t.UNAUTHENTICATED,this.clientId=Cs.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=o,this.authCredentials.start(n,(async u=>{k(se,"Received user=",u.uid),await this.authCredentialListener(u),this.user=u})),this.appCheckCredentials.start(n,(u=>(k(se,"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();const t=new jt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Hs(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function os(r,t){r.asyncQueue.verifyOperationInProgress(),k(se,"Initializing OfflineComponentProvider");const e=r.configuration;await t.initialize(e);let n=e.initialUser;r.setCredentialChangeListener((async i=>{n.isEqual(i)||(await vu(t.localStore,i),n=i)})),t.persistence.setDatabaseDeletedListener((()=>{Jt("Terminating Firestore due to IndexedDb database deletion"),r.terminate().then((()=>{k("Terminating Firestore due to IndexedDb database deletion completed successfully")})).catch((i=>{Jt("Terminating Firestore due to IndexedDb database deletion failed",i)}))})),r._offlineComponents=t}async function ia(r,t){r.asyncQueue.verifyOperationInProgress();const e=await Hd(r);k(se,"Initializing OnlineComponentProvider"),await t.initialize(e,r.configuration),r.setCredentialChangeListener((n=>Zo(t.remoteStore,n))),r.setAppCheckTokenChangeListener(((n,i)=>Zo(t.remoteStore,i))),r._onlineComponents=t}async function Hd(r){if(!r._offlineComponents)if(r._uninitializedComponentsProvider){k(se,"Using user provided OfflineComponentProvider");try{await os(r,r._uninitializedComponentsProvider._offline)}catch(t){const e=t;if(!(function(i){return i.name==="FirebaseError"?i.code===P.FAILED_PRECONDITION||i.code===P.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11})(e))throw e;Jt("Error using user provided cache. Falling back to memory cache: "+e),await os(r,new dr)}}else k(se,"Using default OfflineComponentProvider"),await os(r,new Qd(void 0));return r._offlineComponents}async function Uu(r){return r._onlineComponents||(r._uninitializedComponentsProvider?(k(se,"Using user provided OnlineComponentProvider"),await ia(r,r._uninitializedComponentsProvider._online)):(k(se,"Using default OnlineComponentProvider"),await ia(r,new Rs))),r._onlineComponents}function Xd(r){return Uu(r).then((t=>t.syncEngine))}async function fr(r){const t=await Uu(r),e=t.eventManager;return e.onListen=xd.bind(null,t.syncEngine),e.onUnlisten=Fd.bind(null,t.syncEngine),e.onFirstRemoteStoreListen=Od.bind(null,t.syncEngine),e.onLastRemoteStoreUnlisten=Ld.bind(null,t.syncEngine),e}function Yd(r,t,e={}){const n=new jt;return r.asyncQueue.enqueueAndForget((async()=>(function(o,u,c,h,f){const m=new ni({next:A=>{m.Ou(),u.enqueueAndForget((()=>Ys(o,y)));const S=A.docs.has(c);!S&&A.fromCache?f.reject(new N(P.UNAVAILABLE,"Failed to get document because the client is offline.")):S&&A.fromCache&&h&&h.source==="server"?f.reject(new N(P.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):f.resolve(A)},error:A=>f.reject(A)}),y=new Zs(Tr(c.path),m,{includeMetadataChanges:!0,ka:!0});return Xs(o,y)})(await fr(r),r.asyncQueue,t,e,n))),n.promise}function Jd(r,t,e={}){const n=new jt;return r.asyncQueue.enqueueAndForget((async()=>(function(o,u,c,h,f){const m=new ni({next:A=>{m.Ou(),u.enqueueAndForget((()=>Ys(o,y))),A.fromCache&&h.source==="server"?f.reject(new N(P.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):f.resolve(A)},error:A=>f.reject(A)}),y=new Zs(c,m,{includeMetadataChanges:!0,ka:!0});return Xs(o,y)})(await fr(r),r.asyncQueue,t,e,n))),n.promise}/**
|
|
1432
1447
|
* @license
|
|
1433
1448
|
* Copyright 2023 Google LLC
|
|
1434
1449
|
*
|
|
@@ -1443,7 +1458,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1443
1458
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1444
1459
|
* See the License for the specific language governing permissions and
|
|
1445
1460
|
* limitations under the License.
|
|
1446
|
-
*/function
|
|
1461
|
+
*/function qu(r){const t={};return r.timeoutSeconds!==void 0&&(t.timeoutSeconds=r.timeoutSeconds),t}/**
|
|
1447
1462
|
* @license
|
|
1448
1463
|
* Copyright 2020 Google LLC
|
|
1449
1464
|
*
|
|
@@ -1458,7 +1473,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1458
1473
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1459
1474
|
* See the License for the specific language governing permissions and
|
|
1460
1475
|
* limitations under the License.
|
|
1461
|
-
*/const
|
|
1476
|
+
*/const oa=new Map;/**
|
|
1462
1477
|
* @license
|
|
1463
1478
|
* Copyright 2020 Google LLC
|
|
1464
1479
|
*
|
|
@@ -1473,7 +1488,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1473
1488
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1474
1489
|
* See the License for the specific language governing permissions and
|
|
1475
1490
|
* limitations under the License.
|
|
1476
|
-
*/const
|
|
1491
|
+
*/const ju="firestore.googleapis.com",aa=!0;class ua{constructor(t){var e,n;if(t.host===void 0){if(t.ssl!==void 0)throw new N(P.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=ju,this.ssl=aa}else this.host=t.host,this.ssl=(e=t.ssl)!==null&&e!==void 0?e:aa;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=yu;else{if(t.cacheSizeBytes!==-1&&t.cacheSizeBytes<Eu)throw new N(P.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}pc("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=qu((n=t.experimentalLongPollingOptions)!==null&&n!==void 0?n:{}),(function(o){if(o.timeoutSeconds!==void 0){if(isNaN(o.timeoutSeconds))throw new N(P.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (must not be NaN)`);if(o.timeoutSeconds<5)throw new N(P.INVALID_ARGUMENT,`invalid long polling timeout: ${o.timeoutSeconds} (minimum allowed value is 5)`);if(o.timeoutSeconds>30)throw new N(P.INVALID_ARGUMENT,`invalid long polling timeout: ${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(n,i){return n.timeoutSeconds===i.timeoutSeconds})(this.experimentalLongPollingOptions,t.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}class Cr{constructor(t,e,n,i){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new ua({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new N(P.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 N(P.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 ua(t),this._emulatorOptions=t.emulatorOptions||{},t.credentials!==void 0&&(this._authCredentials=(function(n){if(!n)return new oc;switch(n.type){case"firstParty":return new cc(n.sessionIndex||"0",n.iamToken||null,n.authTokenFactory||null);case"provider":return n.client;default:throw new N(P.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}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return(function(e){const n=oa.get(e);n&&(k("ComponentProvider","Removing Datastore"),oa.delete(e),n.terminate())})(this),Promise.resolve()}}function Zd(r,t,e,n={}){var i;r=Bt(r,Cr);const o=Vs(t),u=r._getSettings(),c=Object.assign(Object.assign({},u),{emulatorOptions:r._getEmulatorOptions()}),h=`${t}:${e}`;o&&(va(`https://${h}`),$l("Firestore",!0)),u.host!==ju&&u.host!==h&&Jt("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const f=Object.assign(Object.assign({},u),{host:h,ssl:o,emulatorOptions:n});if(!Ta(f,c)&&(r._setSettings(f),n.mockUserToken)){let m,y;if(typeof n.mockUserToken=="string")m=n.mockUserToken,y=_t.MOCK_USER;else{m=Gl(n.mockUserToken,(i=r._app)===null||i===void 0?void 0:i.options.projectId);const A=n.mockUserToken.sub||n.mockUserToken.user_id;if(!A)throw new N(P.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");y=new _t(A)}r._authCredentials=new ac(new Ca(m,y))}}/**
|
|
1477
1492
|
* @license
|
|
1478
1493
|
* Copyright 2020 Google LLC
|
|
1479
1494
|
*
|
|
@@ -1488,7 +1503,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1488
1503
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1489
1504
|
* See the License for the specific language governing permissions and
|
|
1490
1505
|
* limitations under the License.
|
|
1491
|
-
*/class
|
|
1506
|
+
*/class ye{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new ye(this.firestore,t,this._query)}}class rt{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Yt(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new rt(this.firestore,t,this._key)}toJSON(){return{type:rt._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,e,n){if(En(e,rt._jsonSchema))return new rt(t,n||null,new O(H.fromString(e.referencePath)))}}rt._jsonSchemaVersion="firestore/documentReference/1.0",rt._jsonSchema={type:nt("string",rt._jsonSchemaVersion),referencePath:nt("string")};class Yt extends ye{constructor(t,e,n){super(t,e,Tr(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new rt(this.firestore,null,new O(t))}withConverter(t){return new Yt(this.firestore,t,this._path)}}function as(r,t,...e){if(r=St(r),Da("collection","path",t),r instanceof Cr){const n=H.fromString(t,...e);return vo(n),new Yt(r,null,n)}{if(!(r instanceof rt||r instanceof Yt))throw new N(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const n=r._path.child(H.fromString(t,...e));return vo(n),new Yt(r.firestore,null,n)}}function la(r,t,...e){if(r=St(r),arguments.length===1&&(t=Cs.newId()),Da("doc","path",t),r instanceof Cr){const n=H.fromString(t,...e);return To(n),new rt(r,null,new O(n))}{if(!(r instanceof rt||r instanceof Yt))throw new N(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const n=r._path.child(H.fromString(t,...e));return To(n),new rt(r.firestore,r instanceof Yt?r.converter:null,new O(n))}}/**
|
|
1492
1507
|
* @license
|
|
1493
1508
|
* Copyright 2020 Google LLC
|
|
1494
1509
|
*
|
|
@@ -1503,7 +1518,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1503
1518
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1504
1519
|
* See the License for the specific language governing permissions and
|
|
1505
1520
|
* limitations under the License.
|
|
1506
|
-
*/const
|
|
1521
|
+
*/const ca="AsyncQueue";class ha{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 Au(this,"async_queue_retry"),this.oc=()=>{const n=is();n&&k(ca,"Visibility state changed to "+n.visibilityState),this.F_.y_()},this._c=t;const e=is();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;const e=is();e&&typeof e.removeEventListener=="function"&&e.removeEventListener("visibilitychange",this.oc)}}enqueue(t){if(this.ac(),this.Xu)return new Promise((()=>{}));const e=new jt;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())))}async cc(){if(this.Zu.length!==0){try{await this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(t){if(!Me(t))throw t;k(ca,"Operation failed with retryable error: "+t)}this.Zu.length>0&&this.F_.g_((()=>this.cc()))}}uc(t){const e=this._c.then((()=>(this.nc=!0,t().catch((n=>{throw this.tc=n,this.nc=!1,zt("INTERNAL UNHANDLED ERROR: ",da(n)),n})).then((n=>(this.nc=!1,n))))));return this._c=e,e}enqueueAfterDelay(t,e,n){this.ac(),this.sc.indexOf(t)>-1&&(e=0);const i=Ws.createAndSchedule(this,t,e,n,(o=>this.lc(o)));return this.ec.push(i),i}ac(){this.tc&&M(47125,{hc:da(this.tc)})}verifyOperationInProgress(){}async Pc(){let t;do t=this._c,await t;while(t!==this._c)}Tc(t){for(const e of this.ec)if(e.timerId===t)return!0;return!1}Ic(t){return this.Pc().then((()=>{this.ec.sort(((e,n)=>e.targetTimeMs-n.targetTimeMs));for(const e of this.ec)if(e.skipDelay(),t!=="all"&&e.timerId===t)break;return this.Pc()}))}dc(t){this.sc.push(t)}lc(t){const e=this.ec.indexOf(t);this.ec.splice(e,1)}}function da(r){let t=r.message||"";return r.stack&&(t=r.stack.includes(r.message)?r.stack:r.message+`
|
|
1507
1522
|
`+r.stack),t}/**
|
|
1508
1523
|
* @license
|
|
1509
1524
|
* Copyright 2017 Google LLC
|
|
@@ -1519,7 +1534,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1519
1534
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1520
1535
|
* See the License for the specific language governing permissions and
|
|
1521
1536
|
* limitations under the License.
|
|
1522
|
-
*/function
|
|
1537
|
+
*/function fa(r){return(function(e,n){if(typeof e!="object"||e===null)return!1;const i=e;for(const o of n)if(o in i&&typeof i[o]=="function")return!0;return!1})(r,["next","error","complete"])}class ke extends Cr{constructor(t,e,n,i){super(t,e,n,i),this.type="firestore",this._queue=new ha,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const t=this._firestoreClient.terminate();this._queue=new ha(t),this._firestoreClient=void 0,await t}}}function tf(r,t,e){e||(e=fn);const n=Ea(r,"firestore");if(n.isInitialized(e)){const i=n.getImmediate({identifier:e}),o=n.getOptions(e);if(Ta(o,t))return i;throw new N(P.FAILED_PRECONDITION,"initializeFirestore() has already been called with different options. To avoid this error, call initializeFirestore() with the same options as when it was originally called, or call getFirestore() to return the already initialized instance.")}if(t.cacheSizeBytes!==void 0&&t.localCache!==void 0)throw new N(P.INVALID_ARGUMENT,"cache and cacheSizeBytes cannot be specified at the same time as cacheSizeBytes willbe deprecated. Instead, specify the cache size in the cache object");if(t.cacheSizeBytes!==void 0&&t.cacheSizeBytes!==-1&&t.cacheSizeBytes<Eu)throw new N(P.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");return t.host&&Vs(t.host)&&va(t.host),n.initialize({options:t,instanceIdentifier:e})}function ef(r,t){const e=typeof r=="object"?r:jl(),n=typeof r=="string"?r:fn,i=Ea(e,"firestore").getImmediate({identifier:n});if(!i._initialized){const o=Bl("firestore");o&&Zd(i,...o)}return i}function Rn(r){if(r._terminated)throw new N(P.FAILED_PRECONDITION,"The client has already been terminated.");return r._firestoreClient||nf(r),r._firestoreClient}function nf(r){var t,e,n;const i=r._freezeSettings(),o=(function(c,h,f,m){return new Pc(c,h,f,m.host,m.ssl,m.experimentalForceLongPolling,m.experimentalAutoDetectLongPolling,qu(m.experimentalLongPollingOptions),m.useFetchStreams,m.isUsingEmulator)})(r._databaseId,((t=r._app)===null||t===void 0?void 0:t.options.appId)||"",r._persistenceKey,i);r._componentsProvider||!((e=i.localCache)===null||e===void 0)&&e._offlineComponentProvider&&(!((n=i.localCache)===null||n===void 0)&&n._onlineComponentProvider)&&(r._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),r._firestoreClient=new Wd(r._authCredentials,r._appCheckCredentials,r._queue,o,r._componentsProvider&&(function(c){const h=c==null?void 0:c._online.build();return{_offline:c==null?void 0:c._offline.build(h),_online:h}})(r._componentsProvider))}/**
|
|
1523
1538
|
* @license
|
|
1524
1539
|
* Copyright 2020 Google LLC
|
|
1525
1540
|
*
|
|
@@ -1534,7 +1549,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1534
1549
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1535
1550
|
* See the License for the specific language governing permissions and
|
|
1536
1551
|
* limitations under the License.
|
|
1537
|
-
*/class Rt{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Rt(ht.fromBase64String(t))}catch(e){throw new
|
|
1552
|
+
*/class Rt{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Rt(ht.fromBase64String(t))}catch(e){throw new N(P.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(t){return new Rt(ht.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:Rt._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(En(t,Rt._jsonSchema))return Rt.fromBase64String(t.bytes)}}Rt._jsonSchemaVersion="firestore/bytes/1.0",Rt._jsonSchema={type:nt("string",Rt._jsonSchemaVersion),bytes:nt("string")};/**
|
|
1538
1553
|
* @license
|
|
1539
1554
|
* Copyright 2020 Google LLC
|
|
1540
1555
|
*
|
|
@@ -1549,7 +1564,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1549
1564
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1550
1565
|
* See the License for the specific language governing permissions and
|
|
1551
1566
|
* limitations under the License.
|
|
1552
|
-
*/class
|
|
1567
|
+
*/class br{constructor(...t){for(let e=0;e<t.length;++e)if(t[e].length===0)throw new N(P.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ct(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}/**
|
|
1553
1568
|
* @license
|
|
1554
1569
|
* Copyright 2020 Google LLC
|
|
1555
1570
|
*
|
|
@@ -1564,7 +1579,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1564
1579
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1565
1580
|
* See the License for the specific language governing permissions and
|
|
1566
1581
|
* limitations under the License.
|
|
1567
|
-
*/class
|
|
1582
|
+
*/class Dr{constructor(t){this._methodName=t}}/**
|
|
1568
1583
|
* @license
|
|
1569
1584
|
* Copyright 2017 Google LLC
|
|
1570
1585
|
*
|
|
@@ -1579,7 +1594,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1579
1594
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1580
1595
|
* See the License for the specific language governing permissions and
|
|
1581
1596
|
* limitations under the License.
|
|
1582
|
-
*/class
|
|
1597
|
+
*/class kt{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new N(P.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new N(P.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:kt._jsonSchemaVersion}}static fromJSON(t){if(En(t,kt._jsonSchema))return new kt(t.latitude,t.longitude)}}kt._jsonSchemaVersion="firestore/geoPoint/1.0",kt._jsonSchema={type:nt("string",kt._jsonSchemaVersion),latitude:nt("number"),longitude:nt("number")};/**
|
|
1583
1598
|
* @license
|
|
1584
1599
|
* Copyright 2024 Google LLC
|
|
1585
1600
|
*
|
|
@@ -1594,7 +1609,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1594
1609
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1595
1610
|
* See the License for the specific language governing permissions and
|
|
1596
1611
|
* limitations under the License.
|
|
1597
|
-
*/class
|
|
1612
|
+
*/class xt{constructor(t){this._values=(t||[]).map((e=>e))}toArray(){return this._values.map((t=>t))}isEqual(t){return(function(n,i){if(n.length!==i.length)return!1;for(let o=0;o<n.length;++o)if(n[o]!==i[o])return!1;return!0})(this._values,t._values)}toJSON(){return{type:xt._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(En(t,xt._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every((e=>typeof e=="number")))return new xt(t.vectorValues);throw new N(P.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}xt._jsonSchemaVersion="firestore/vectorValue/1.0",xt._jsonSchema={type:nt("string",xt._jsonSchemaVersion),vectorValues:nt("object")};/**
|
|
1598
1613
|
* @license
|
|
1599
1614
|
* Copyright 2017 Google LLC
|
|
1600
1615
|
*
|
|
@@ -1609,7 +1624,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1609
1624
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1610
1625
|
* See the License for the specific language governing permissions and
|
|
1611
1626
|
* limitations under the License.
|
|
1612
|
-
*/const
|
|
1627
|
+
*/const rf=/^__.*__$/;class sf{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return this.fieldMask!==null?new oe(t,this.data,this.fieldMask,e,this.fieldTransforms):new vn(t,this.data,e,this.fieldTransforms)}}class Bu{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return new oe(t,this.data,this.fieldMask,e,this.fieldTransforms)}}function zu(r){switch(r){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw M(40011,{Ec:r})}}class ri{constructor(t,e,n,i,o,u){this.settings=t,this.databaseId=e,this.serializer=n,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 ri(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(t){var e;const n=(e=this.path)===null||e===void 0?void 0:e.child(t),i=this.Rc({path:n,mc:!1});return i.fc(t),i}gc(t){var e;const n=(e=this.path)===null||e===void 0?void 0:e.child(t),i=this.Rc({path:n,mc:!1});return i.Ac(),i}yc(t){return this.Rc({path:void 0,mc:!0})}wc(t){return mr(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(zu(this.Ec)&&rf.test(t))throw this.wc('Document fields cannot begin and end with "__"')}}class of{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.serializer=n||Pr(t)}Dc(t,e,n,i=!1){return new ri({Ec:t,methodName:e,bc:n,path:ct.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function $u(r){const t=r._freezeSettings(),e=Pr(r._databaseId);return new of(r._databaseId,!!t.ignoreUndefinedProperties,e)}function af(r,t,e,n,i,o={}){const u=r.Dc(o.merge||o.mergeFields?2:0,t,e,i);ii("Data must be an object, but it was:",u,n);const c=Gu(n,u);let h,f;if(o.merge)h=new wt(u.fieldMask),f=u.fieldTransforms;else if(o.mergeFields){const m=[];for(const y of o.mergeFields){const A=Ps(t,y,e);if(!u.contains(A))throw new N(P.INVALID_ARGUMENT,`Field '${A}' is specified in your field mask but missing from your input data.`);Qu(m,A)||m.push(A)}h=new wt(m),f=u.fieldTransforms.filter((y=>h.covers(y.field)))}else h=null,f=u.fieldTransforms;return new sf(new It(c),h,f)}class Pn extends Dr{_toFieldTransform(t){if(t.Ec!==2)throw t.Ec===1?t.wc(`${this._methodName}() can only appear at the top level of your update data`):t.wc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return t.fieldMask.push(t.path),null}isEqual(t){return t instanceof Pn}}class si extends Dr{_toFieldTransform(t){return new Jc(t.path,new gn)}isEqual(t){return t instanceof si}}function uf(r,t,e,n){const i=r.Dc(1,t,e);ii("Data must be an object, but it was:",i,n);const o=[],u=It.empty();ie(n,((h,f)=>{const m=oi(t,h,e);f=St(f);const y=i.gc(m);if(f instanceof Pn)o.push(m);else{const A=Vn(f,y);A!=null&&(o.push(m),u.set(m,A))}}));const c=new wt(o);return new Bu(u,c,i.fieldTransforms)}function lf(r,t,e,n,i,o){const u=r.Dc(1,t,e),c=[Ps(t,n,e)],h=[i];if(o.length%2!=0)throw new N(P.INVALID_ARGUMENT,`Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let A=0;A<o.length;A+=2)c.push(Ps(t,o[A])),h.push(o[A+1]);const f=[],m=It.empty();for(let A=c.length-1;A>=0;--A)if(!Qu(f,c[A])){const S=c[A];let C=h[A];C=St(C);const x=u.gc(S);if(C instanceof Pn)f.push(S);else{const D=Vn(C,x);D!=null&&(f.push(S),m.set(S,D))}}const y=new wt(f);return new Bu(m,y,u.fieldTransforms)}function cf(r,t,e,n=!1){return Vn(e,r.Dc(n?4:3,t))}function Vn(r,t){if(Ku(r=St(r)))return ii("Unsupported field value:",t,r),Gu(r,t);if(r instanceof Dr)return(function(n,i){if(!zu(i.Ec))throw i.wc(`${n._methodName}() can only be used with update() and set()`);if(!i.path)throw i.wc(`${n._methodName}() is not currently supported inside arrays`);const o=n._toFieldTransform(i);o&&i.fieldTransforms.push(o)})(r,t),null;if(r===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),r instanceof Array){if(t.settings.mc&&t.Ec!==4)throw t.wc("Nested arrays are not supported");return(function(n,i){const o=[];let u=0;for(const c of n){let h=Vn(c,i.yc(u));h==null&&(h={nullValue:"NULL_VALUE"}),o.push(h),u++}return{arrayValue:{values:o}}})(r,t)}return(function(n,i){if((n=St(n))===null)return{nullValue:"NULL_VALUE"};if(typeof n=="number")return Hc(i.serializer,n);if(typeof n=="boolean")return{booleanValue:n};if(typeof n=="string")return{stringValue:n};if(n instanceof Date){const o=W.fromDate(n);return{timestampValue:lr(i.serializer,o)}}if(n instanceof W){const o=new W(n.seconds,1e3*Math.floor(n.nanoseconds/1e3));return{timestampValue:lr(i.serializer,o)}}if(n instanceof kt)return{geoPointValue:{latitude:n.latitude,longitude:n.longitude}};if(n instanceof Rt)return{bytesValue:hu(i.serializer,n._byteString)};if(n instanceof rt){const o=i.databaseId,u=n.firestore._databaseId;if(!u.isEqual(o))throw i.wc(`Document reference is for database ${u.projectId}/${u.database} but should be for database ${o.projectId}/${o.database}`);return{referenceValue:Us(n.firestore._databaseId||i.databaseId,n._key.path)}}if(n instanceof xt)return(function(u,c){return{mapValue:{fields:{[qa]:{stringValue:ja},[ir]:{arrayValue:{values:u.toArray().map((f=>{if(typeof f!="number")throw c.wc("VectorValues must only contain numeric values.");return Os(c.serializer,f)}))}}}}}})(n,i);throw i.wc(`Unsupported field value: ${gr(n)}`)})(r,t)}function Gu(r,t){const e={};return xa(r)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):ie(r,((n,i)=>{const o=Vn(i,t.Vc(n));o!=null&&(e[n]=o)})),{mapValue:{fields:e}}}function Ku(r){return!(typeof r!="object"||r===null||r instanceof Array||r instanceof Date||r instanceof W||r instanceof kt||r instanceof Rt||r instanceof rt||r instanceof Dr||r instanceof xt)}function ii(r,t,e){if(!Ku(e)||!Na(e)){const n=gr(e);throw n==="an object"?t.wc(r+" a custom object"):t.wc(r+" "+n)}}function Ps(r,t,e){if((t=St(t))instanceof br)return t._internalPath;if(typeof t=="string")return oi(r,t);throw mr("Field path arguments must be of type string or ",r,!1,void 0,e)}const hf=new RegExp("[~\\*/\\[\\]]");function oi(r,t,e){if(t.search(hf)>=0)throw mr(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,r,!1,void 0,e);try{return new br(...t.split("."))._internalPath}catch{throw mr(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,r,!1,void 0,e)}}function mr(r,t,e,n,i){const o=n&&!n.isEmpty(),u=i!==void 0;let c=`Function ${t}() called with invalid data`;e&&(c+=" (via `toFirestore()`)"),c+=". ";let h="";return(o||u)&&(h+=" (found",o&&(h+=` in field ${n}`),u&&(h+=` in document ${i}`),h+=")"),new N(P.INVALID_ARGUMENT,c+r+h)}function Qu(r,t){return r.some((e=>e.isEqual(t)))}/**
|
|
1613
1628
|
* @license
|
|
1614
1629
|
* Copyright 2020 Google LLC
|
|
1615
1630
|
*
|
|
@@ -1624,7 +1639,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1624
1639
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1625
1640
|
* See the License for the specific language governing permissions and
|
|
1626
1641
|
* limitations under the License.
|
|
1627
|
-
*/class
|
|
1642
|
+
*/class Wu{constructor(t,e,n,i,o){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=i,this._converter=o}get id(){return this._key.path.lastSegment()}get ref(){return new rt(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const t=new df(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){const e=this._document.data.field(ai("DocumentSnapshot.get",t));if(e!==null)return this._userDataWriter.convertValue(e)}}}class df extends Wu{data(){return super.data()}}function ai(r,t){return typeof t=="string"?oi(r,t):t instanceof br?t._internalPath:t._delegate._internalPath}/**
|
|
1628
1643
|
* @license
|
|
1629
1644
|
* Copyright 2020 Google LLC
|
|
1630
1645
|
*
|
|
@@ -1639,7 +1654,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1639
1654
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1640
1655
|
* See the License for the specific language governing permissions and
|
|
1641
1656
|
* limitations under the License.
|
|
1642
|
-
*/function
|
|
1657
|
+
*/function Hu(r){if(r.limitType==="L"&&r.explicitOrderBy.length===0)throw new N(P.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class ui{}class ff extends ui{}function mf(r,t,...e){let n=[];t instanceof ui&&n.push(t),n=n.concat(e),(function(o){const u=o.filter((h=>h instanceof li)).length,c=o.filter((h=>h instanceof Nr)).length;if(u>1||u>0&&c>0)throw new N(P.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(...)))`.")})(n);for(const i of n)r=i._apply(r);return r}class Nr extends ff{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Nr(t,e,n)}_apply(t){const e=this._parse(t);return Xu(t._query,e),new ye(t.firestore,t.converter,ps(t._query,e))}_parse(t){const e=$u(t.firestore);return(function(o,u,c,h,f,m,y){let A;if(f.isKeyField()){if(m==="array-contains"||m==="array-contains-any")throw new N(P.INVALID_ARGUMENT,`Invalid Query. You can't perform '${m}' queries on documentId().`);if(m==="in"||m==="not-in"){pa(y,m);const C=[];for(const x of y)C.push(ma(h,o,x));A={arrayValue:{values:C}}}else A=ma(h,o,y)}else m!=="in"&&m!=="not-in"&&m!=="array-contains-any"||pa(y,m),A=cf(c,u,y,m==="in"||m==="not-in");return et.create(f,m,A)})(t._query,"where",e,t.firestore._databaseId,this._field,this._op,this._value)}}function pf(r,t,e){const n=t,i=ai("where",r);return Nr._create(i,n,e)}class li extends ui{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new li(t,e)}_parse(t){const e=this._queryConstraints.map((n=>n._parse(t))).filter((n=>n.getFilters().length>0));return e.length===1?e[0]:Ct.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return e.getFilters().length===0?t:((function(i,o){let u=i;const c=o.getFlattenedFilters();for(const h of c)Xu(u,h),u=ps(u,h)})(t._query,e),new ye(t.firestore,t.converter,ps(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function ma(r,t,e){if(typeof(e=St(e))=="string"){if(e==="")throw new N(P.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Ha(t)&&e.indexOf("/")!==-1)throw new N(P.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${e}' contains a '/' character.`);const n=t.path.child(H.fromString(e));if(!O.isDocumentKey(n))throw new N(P.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${n}' is not because it has an odd number of segments (${n.length}).`);return Co(r,new O(n))}if(e instanceof rt)return Co(r,e._key);throw new N(P.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${gr(e)}.`)}function pa(r,t){if(!Array.isArray(r)||r.length===0)throw new N(P.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Xu(r,t){const e=(function(i,o){for(const u of i)for(const c of u.getFlattenedFilters())if(o.indexOf(c.op)>=0)return c.op;return null})(r.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 N(P.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new N(P.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${e.toString()}' filters.`)}class gf{convertValue(t,e="none"){switch(ne(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Z(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(ee(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"){const n={};return ie(t,((i,o)=>{n[i]=this.convertValue(o,e)})),n}convertVectorValue(t){var e,n,i;const o=(i=(n=(e=t.fields)===null||e===void 0?void 0:e[ir].arrayValue)===null||n===void 0?void 0:n.values)===null||i===void 0?void 0:i.map((u=>Z(u.doubleValue)));return new xt(o)}convertGeoPoint(t){return new kt(Z(t.latitude),Z(t.longitude))}convertArray(t,e){return(t.values||[]).map((n=>this.convertValue(n,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Er(t);return n==null?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(dn(t));default:return null}}convertTimestamp(t){const e=te(t);return new W(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=H.fromString(t);G(_u(n),9688,{name:t});const i=new mn(n.get(1),n.get(3)),o=new O(n.popFirst(5));return i.isEqual(e)||zt(`Document ${o} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),o}}/**
|
|
1643
1658
|
* @license
|
|
1644
1659
|
* Copyright 2020 Google LLC
|
|
1645
1660
|
*
|
|
@@ -1654,7 +1669,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1654
1669
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1655
1670
|
* See the License for the specific language governing permissions and
|
|
1656
1671
|
* limitations under the License.
|
|
1657
|
-
*/function
|
|
1672
|
+
*/function _f(r,t,e){let n;return n=r?e&&(e.merge||e.mergeFields)?r.toFirestore(t,e):r.toFirestore(t):t,n}class on{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class de extends Wu{constructor(t,e,n,i,o,u){super(t,e,n,i,u),this._firestore=t,this._firestoreImpl=t,this.metadata=o}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new rr(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){const n=this._document.data.field(ai("DocumentSnapshot.get",t));if(n!==null)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new N(P.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t=this._document,e={};return e.type=de._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)}}de._jsonSchemaVersion="firestore/documentSnapshot/1.0",de._jsonSchema={type:nt("string",de._jsonSchemaVersion),bundleSource:nt("string","DocumentSnapshot"),bundleName:nt("string"),bundle:nt("string")};class rr extends de{data(t={}){return super.data(t)}}class fe{constructor(t,e,n,i){this._firestore=t,this._userDataWriter=e,this._snapshot=i,this.metadata=new on(i.hasPendingWrites,i.fromCache),this.query=n}get docs(){const t=[];return 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((n=>{t.call(e,new rr(this._firestore,this._userDataWriter,n.key,n,new on(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new N(P.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((c=>{const h=new rr(i._firestore,i._userDataWriter,c.doc.key,c.doc,new on(i._snapshot.mutatedKeys.has(c.doc.key),i._snapshot.fromCache),i.query.converter);return c.doc,{type:"added",doc:h,oldIndex:-1,newIndex:u++}}))}{let u=i._snapshot.oldDocs;return i._snapshot.docChanges.filter((c=>o||c.type!==3)).map((c=>{const h=new rr(i._firestore,i._userDataWriter,c.doc.key,c.doc,new on(i._snapshot.mutatedKeys.has(c.doc.key),i._snapshot.fromCache),i.query.converter);let f=-1,m=-1;return c.type!==0&&(f=u.indexOf(c.doc.key),u=u.delete(c.doc.key)),c.type!==1&&(u=u.add(c.doc),m=u.indexOf(c.doc.key)),{type:yf(c.type),doc:h,oldIndex:f,newIndex:m}}))}})(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new N(P.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const t={};t.type=fe._jsonSchemaVersion,t.bundleSource="QuerySnapshot",t.bundleName=Cs.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const e=[],n=[],i=[];return this.docs.forEach((o=>{o._document!==null&&(e.push(o._document),n.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 yf(r){switch(r){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return M(61501,{type:r})}}/**
|
|
1658
1673
|
* @license
|
|
1659
1674
|
* Copyright 2020 Google LLC
|
|
1660
1675
|
*
|
|
@@ -1669,7 +1684,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1669
1684
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1670
1685
|
* See the License for the specific language governing permissions and
|
|
1671
1686
|
* limitations under the License.
|
|
1672
|
-
*/function
|
|
1687
|
+
*/function Ef(r){r=Bt(r,rt);const t=Bt(r.firestore,ke);return Yd(Rn(t),r._key).then((e=>Yu(t,r,e)))}fe._jsonSchemaVersion="firestore/querySnapshot/1.0",fe._jsonSchema={type:nt("string",fe._jsonSchemaVersion),bundleSource:nt("string","QuerySnapshot"),bundleName:nt("string"),bundle:nt("string")};class ci extends gf{constructor(t){super(),this.firestore=t}convertBytes(t){return new Rt(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new rt(this.firestore,null,e)}}function ga(r){r=Bt(r,ye);const t=Bt(r.firestore,ke),e=Rn(t),n=new ci(t);return Hu(r._query),Jd(e,r._query).then((i=>new fe(t,n,r,i)))}function _a(r,...t){var e,n,i;r=St(r);let o={includeMetadataChanges:!1,source:"default"},u=0;typeof t[u]!="object"||fa(t[u])||(o=t[u++]);const c={includeMetadataChanges:o.includeMetadataChanges,source:o.source};if(fa(t[u])){const y=t[u];t[u]=(e=y.next)===null||e===void 0?void 0:e.bind(y),t[u+1]=(n=y.error)===null||n===void 0?void 0:n.bind(y),t[u+2]=(i=y.complete)===null||i===void 0?void 0:i.bind(y)}let h,f,m;if(r instanceof rt)f=Bt(r.firestore,ke),m=Tr(r._key.path),h={next:y=>{t[u]&&t[u](Yu(f,r,y))},error:t[u+1],complete:t[u+2]};else{const y=Bt(r,ye);f=Bt(y.firestore,ke),m=y._query;const A=new ci(f);h={next:S=>{t[u]&&t[u](new fe(f,A,y,S))},error:t[u+1],complete:t[u+2]},Hu(r._query)}return(function(A,S,C,x){const D=new ni(x),q=new Zs(S,D,C);return A.asyncQueue.enqueueAndForget((async()=>Xs(await fr(A),q))),()=>{D.Ou(),A.asyncQueue.enqueueAndForget((async()=>Ys(await fr(A),q)))}})(Rn(f),m,c,h)}function Tf(r,t){return(function(n,i){const o=new jt;return n.asyncQueue.enqueueAndForget((async()=>Ud(await Xd(n),i,o))),o.promise})(Rn(r),t)}function Yu(r,t,e){const n=e.docs.get(t._key),i=new ci(r);return new de(r,i,t._key,n,new on(e.hasPendingWrites,e.fromCache),t.converter)}/**
|
|
1673
1688
|
* @license
|
|
1674
1689
|
* Copyright 2020 Google LLC
|
|
1675
1690
|
*
|
|
@@ -1684,7 +1699,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1684
1699
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1685
1700
|
* See the License for the specific language governing permissions and
|
|
1686
1701
|
* limitations under the License.
|
|
1687
|
-
*/class
|
|
1702
|
+
*/class vf{constructor(t,e){this._firestore=t,this._commitHandler=e,this._mutations=[],this._committed=!1,this._dataReader=$u(t)}set(t,e,n){this._verifyNotCommitted();const i=us(t,this._firestore),o=_f(i.converter,e,n),u=af(this._dataReader,"WriteBatch.set",i._key,o,i.converter!==null,n);return this._mutations.push(u.toMutation(i._key,Vt.none())),this}update(t,e,n,...i){this._verifyNotCommitted();const o=us(t,this._firestore);let u;return u=typeof(e=St(e))=="string"||e instanceof br?lf(this._dataReader,"WriteBatch.update",o._key,e,n,i):uf(this._dataReader,"WriteBatch.update",o._key,e),this._mutations.push(u.toMutation(o._key,Vt.exists(!0))),this}delete(t){this._verifyNotCommitted();const e=us(t,this._firestore);return this._mutations=this._mutations.concat(new Ms(e._key,Vt.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 N(P.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function us(r,t){if((r=St(r)).firestore!==t)throw new N(P.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return r}/**
|
|
1688
1703
|
* @license
|
|
1689
1704
|
* Copyright 2020 Google LLC
|
|
1690
1705
|
*
|
|
@@ -1699,7 +1714,7 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1699
1714
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1700
1715
|
* See the License for the specific language governing permissions and
|
|
1701
1716
|
* limitations under the License.
|
|
1702
|
-
*/function
|
|
1717
|
+
*/function If(){return new Pn("deleteField")}function Af(){return new si("serverTimestamp")}/**
|
|
1703
1718
|
* @license
|
|
1704
1719
|
* Copyright 2020 Google LLC
|
|
1705
1720
|
*
|
|
@@ -1714,4 +1729,4 @@ This typically indicates that your device does not have a healthy Internet conne
|
|
|
1714
1729
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1715
1730
|
* See the License for the specific language governing permissions and
|
|
1716
1731
|
* limitations under the License.
|
|
1717
|
-
*/function
|
|
1732
|
+
*/function wf(r){return Rn(r=Bt(r,ke)),new vf(r,(t=>Tf(r,t)))}(function(t,e=!0){(function(i){xe=i})(Hl),Xl(new Yl("firestore",((n,{instanceIdentifier:i,options:o})=>{const u=n.getProvider("app").getImmediate(),c=new ke(new uc(n.getProvider("auth-internal")),new hc(u,n.getProvider("app-check-internal")),(function(f,m){if(!Object.prototype.hasOwnProperty.apply(f.options,["projectId"]))throw new N(P.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new mn(f.options.projectId,m)})(u,i),u);return o=Object.assign({useFetchStreams:e},o),c._setSettings(o),c}),"PUBLIC").setMultipleInstances(!0)),fo(po,go,t),fo(po,go,"esm2017")})();function Rf(r){const t=()=>kl(()=>import("./index.esm-BFc7vwnl.js"),__vite__mapDeps([0,1]),import.meta.url),e=n=>(n==null?void 0:n.code)??"";return{async put(n,i,o){const u=await t();await u.uploadBytes(u.ref(u.getStorage(r),n),i,o?{contentType:o}:void 0)},async get(n){const i=await t();try{return new Uint8Array(await i.getBytes(i.ref(i.getStorage(r),n)))}catch(o){if(e(o)==="storage/object-not-found")return null;throw o}},async delete(n){const i=await t();try{await i.deleteObject(i.ref(i.getStorage(r),n))}catch(o){if(e(o)!=="storage/object-not-found")throw o}}}}function Pf(r){return`agentcrm-${r.projectId??"default"}`}function Vf(r){const t=Pf(r);return Zl().find(e=>e.name===t)??tc(r,t)}const ya=new WeakMap;function Sf(r){let t=ya.get(r);if(!t){try{t=tf(r,{ignoreUndefinedProperties:!0})}catch{t=ef(r)}ya.set(r,t)}return t}function pr(r){if(r instanceof W)return r.toMillis();if(Array.isArray(r))return r.map(pr);if(r&&typeof r=="object"&&Object.getPrototypeOf(r)===Object.prototype){const t={};for(const[e,n]of Object.entries(r))t[e]=pr(n);return t}return r}function en(r){return r?{uid:r.uid,email:r.email,displayName:r.displayName,emailVerified:r.emailVerified,photoURL:r.photoURL}:null}function Of(r){const t=Vf(r),e=Sf(t),n=xl(t),i=new Promise(m=>{const y=ho(n,()=>{y(),m()})});let o=0;const u=m=>o+=Math.max(m,1),c=(m,y)=>ic(m,pr(y)),h=(m,y)=>mf(as(e,m),pf(sc,">",W.fromMillis(y))),f=m=>m===nc?If():m===rc?Af():m;return{...r.storageBucket?{storage:Rf(t)}:{},readCount:()=>o,async listCollection(m){const y=await ga(as(e,m));return u(y.size),y.docs.map(A=>c(A.id,A.data()))},async listSince(m,y){const A=await ga(h(m,y));return u(A.size),A.docs.map(S=>c(S.id,S.data()))},watchCollection(m,y,A){return _a(as(e,m),S=>{S.metadata.fromCache||u(S.docChanges().length),y(S.docs.map(C=>c(C.id,C.data())))},A)},watchSince(m,y,A,S){return _a(h(m,y),C=>{C.metadata.fromCache||u(C.docChanges().length);const x=[],D=[];for(const q of C.docChanges())q.doc.metadata.hasPendingWrites||(q.type==="removed"?D.push(q.doc.id):x.push(c(q.doc.id,q.doc.data())));(x.length||D.length)&&A({upserts:x,removed:D})},S)},async getDoc(m,y){const A=await Ef(la(e,m,y));return A.exists()?pr(A.data()):null},async commit(m){const y=wf(e);for(const A of ec(m)){const S=la(e,A.collection,A.id);if(A.type==="delete"){y.delete(S);continue}const C={};for(const[x,D]of Object.entries(A.data))C[x]=f(D);A.type==="set"?y.set(S,C):y.update(S,C)}await y.commit()},auth:{async currentUser(){return await i,en(n.currentUser)},onChange(m){return ho(n,y=>m(en(y)))},async signInWithPassword(m,y){const A=await ql(n,m.trim(),y);return en(A.user)},async signInWithGoogle(){const m=new Ll;m.setCustomParameters({prompt:"select_account"});const y=await Ul(n,m);return en(y.user)},async sendPasswordReset(m){await Fl(n,m.trim())},async sendVerificationEmail(){n.currentUser&&await Ml(n.currentUser,{url:`${window.location.origin}${window.location.pathname}`})},async reload(){const m=n.currentUser;return m?(await m.reload(),await m.getIdToken(!0),en(n.currentUser)):null},async signOut(){await Ol(n)}}}}export{Of as createSdkFirebaseApi,Vf as getFirebaseApp};
|