firebase 12.12.0 → 12.12.1
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/app/dist/esm/index.esm.js +1 -1
- package/app/dist/index.cjs.js +1 -1
- package/app/dist/index.mjs +1 -1
- package/compat/app/dist/esm/index.esm.js +1 -1
- package/compat/app/dist/index.cjs.js +1 -1
- package/compat/app/dist/index.mjs +1 -1
- package/compat/dist/esm/index.esm.js +2 -2
- package/compat/dist/index.node.cjs +2 -2
- package/compat/dist/index.rn.cjs.js +2 -2
- package/firebase-ai.js +1 -1
- package/firebase-ai.js.map +1 -1
- package/firebase-analytics.js +1 -1
- package/firebase-app-check.js +1 -1
- package/firebase-app-compat.js +2 -2
- package/firebase-app.js +4 -4
- package/firebase-auth-cordova.js +1 -1
- package/firebase-auth-web-extension.js +1 -1
- package/firebase-auth.js +1 -1
- package/firebase-compat.js +4 -4
- package/firebase-data-connect.js +1 -1
- package/firebase-database.js +1 -1
- package/firebase-firestore-compat.js +1 -1
- package/firebase-firestore-lite-pipelines.js +1 -1
- package/firebase-firestore-lite.js +1 -1
- package/firebase-firestore-pipelines.js +1 -1
- package/firebase-firestore.js +1 -1
- package/firebase-functions.js +1 -1
- package/firebase-installations.js +1 -1
- package/firebase-messaging-sw.js +1 -1
- package/firebase-messaging.js +1 -1
- package/firebase-performance-standalone-compat.js +3 -3
- package/firebase-performance.js +1 -1
- package/firebase-remote-config.js +1 -1
- package/firebase-storage.js +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)})(this,function(Qd,Hd){try{!(function(){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}let s=i(Qd),a=()=>{},u=function(t){var r=[];let n=0;for(let i=0;i<t.length;i++){let e=t.charCodeAt(i);e<128?r[n++]=e:(e<2048?r[n++]=e>>6|192:(55296==(64512&e)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++i)),r[n++]=e>>18|240,r[n++]=e>>12&63|128):r[n++]=e>>12|224,r[n++]=e>>6&63|128),r[n++]=63&e|128)}return r},B={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let h=0;h<r.length;h+=3){var s=r[h],a=h+1<r.length,o=a?r[h+1]:0,u=h+2<r.length,l=u?r[h+2]:0;let e=(15&o)<<2|l>>6,t=63&l;u||(t=64,a)||(e=64),i.push(n[s>>2],n[(3&s)<<4|o>>4],n[e],n[t])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(u(e),t)},decodeString(r,n){if(this.HAS_NATIVE_SUPPORT&&!n)return atob(r);{var i=this.decodeStringToByteArray(r,n);var s=[];let e=0,t=0;for(;e<i.length;){var a,o,u,l=i[e++];l<128?s[t++]=String.fromCharCode(l):191<l&&l<224?(a=i[e++],s[t++]=String.fromCharCode((31&l)<<6|63&a)):239<l&&l<365?(a=((7&l)<<18|(63&i[e++])<<12|(63&i[e++])<<6|63&i[e++])-65536,s[t++]=String.fromCharCode(55296+(a>>10)),s[t++]=String.fromCharCode(56320+(1023&a))):(o=i[e++],u=i[e++],s[t++]=String.fromCharCode((15&l)<<12|(63&o)<<6|63&u))}return s.join("");return}},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let u=0;u<e.length;){var i=r[e.charAt(u++)],s=u<e.length?r[e.charAt(u)]:0,a=++u<e.length?r[e.charAt(u)]:64,o=++u<e.length?r[e.charAt(u)]:64;if(++u,null==i||null==s||null==a||null==o)throw new q;n.push(i<<2|s>>4),64!==a&&(n.push(s<<4&240|a>>2),64!==o)&&n.push(a<<6&192|o)}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class q extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let j=function(e){var t=u(e);return B.encodeByteArray(t,!0)},z=function(e){return j(e).replace(/\./g,"")},K=function(e){try{return B.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function G(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}let $=()=>G().__FIREBASE_DEFAULTS__,Q=()=>{var e;return"undefined"!=typeof process&&void 0!==process.env&&(e=process.env.__FIREBASE_DEFAULTS__)?JSON.parse(e):void 0},H=()=>{if("undefined"!=typeof document){let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&K(e[1]);return t&&JSON.parse(t)}},W=()=>{try{return a()||$()||Q()||H()}catch(e){console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "+e)}};function Y(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function J(){var e=W()?.forceEnvironment;if("node"===e)return 1;if("browser"!==e)try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){}}function X(){return!J()&&navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Z(){return!J()&&navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}class ee extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,ee.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,te.prototype.create)}}class te{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var n,r=t[0]||{},i=this.service+"/"+e,s=this.errors[e],s=s?(n=r,s.replace(re,(e,t)=>{var r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",s=this.serviceName+`: ${s} (${i}).`;return new ee(i,s,r)}}let re=/\{\$([^}]+)}/g;function ne(e,t){if(e!==t){var r,n,i=Object.keys(e),s=Object.keys(t);for(r of i){if(!s.includes(r))return!1;var a=e[r],o=t[r];if(ie(a)&&ie(o)){if(!ne(a,o))return!1}else if(a!==o)return!1}for(n of s)if(!i.includes(n))return!1}return!0}function ie(e){return null!==e&&"object"==typeof e}function _(e){return e&&e._delegate?e._delegate:e}function se(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}class ae{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}var oe,ue,c,e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!(function(){var e,t,s;function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(){}function a(e,t,r){r=r||0;var n=Array(16);if("string"==typeof t)for(var i=0;i<16;++i)n[i]=t.charCodeAt(r++)|t.charCodeAt(r++)<<8|t.charCodeAt(r++)<<16|t.charCodeAt(r++)<<24;else for(i=0;i<16;++i)n[i]=t[r++]|t[r++]<<8|t[r++]<<16|t[r++]<<24;t=e.g[0],r=e.g[1];var i=e.g[2],s=e.g[3],a=t+(s^r&(i^s))+n[0]+3614090360&4294967295;a=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=r+(a<<7&4294967295|a>>>25))+((a=s+(i^t&(r^i))+n[1]+3905402710&4294967295)<<12&4294967295|a>>>20))+((a=i+(r^s&(t^r))+n[2]+606105819&4294967295)<<17&4294967295|a>>>15))+((a=r+(t^i&(s^t))+n[3]+3250441966&4294967295)<<22&4294967295|a>>>10))+((a=t+(s^r&(i^s))+n[4]+4118548399&4294967295)<<7&4294967295|a>>>25))+((a=s+(i^t&(r^i))+n[5]+1200080426&4294967295)<<12&4294967295|a>>>20))+((a=i+(r^s&(t^r))+n[6]+2821735955&4294967295)<<17&4294967295|a>>>15))+((a=r+(t^i&(s^t))+n[7]+4249261313&4294967295)<<22&4294967295|a>>>10))+((a=t+(s^r&(i^s))+n[8]+1770035416&4294967295)<<7&4294967295|a>>>25))+((a=s+(i^t&(r^i))+n[9]+2336552879&4294967295)<<12&4294967295|a>>>20))+((a=i+(r^s&(t^r))+n[10]+4294925233&4294967295)<<17&4294967295|a>>>15))+((a=r+(t^i&(s^t))+n[11]+2304563134&4294967295)<<22&4294967295|a>>>10))+((a=t+(s^r&(i^s))+n[12]+1804603682&4294967295)<<7&4294967295|a>>>25))+((a=s+(i^t&(r^i))+n[13]+4254626195&4294967295)<<12&4294967295|a>>>20))+((a=i+(r^s&(t^r))+n[14]+2792965006&4294967295)<<17&4294967295|a>>>15))+((a=r+(t^i&(s^t))+n[15]+1236535329&4294967295)<<22&4294967295|a>>>10))+((a=t+(i^s&(r^i))+n[1]+4129170786&4294967295)<<5&4294967295|a>>>27))+((a=s+(r^i&(t^r))+n[6]+3225465664&4294967295)<<9&4294967295|a>>>23))+((a=i+(t^r&(s^t))+n[11]+643717713&4294967295)<<14&4294967295|a>>>18))+((a=r+(s^t&(i^s))+n[0]+3921069994&4294967295)<<20&4294967295|a>>>12))+((a=t+(i^s&(r^i))+n[5]+3593408605&4294967295)<<5&4294967295|a>>>27))+((a=s+(r^i&(t^r))+n[10]+38016083&4294967295)<<9&4294967295|a>>>23))+((a=i+(t^r&(s^t))+n[15]+3634488961&4294967295)<<14&4294967295|a>>>18))+((a=r+(s^t&(i^s))+n[4]+3889429448&4294967295)<<20&4294967295|a>>>12))+((a=t+(i^s&(r^i))+n[9]+568446438&4294967295)<<5&4294967295|a>>>27))+((a=s+(r^i&(t^r))+n[14]+3275163606&4294967295)<<9&4294967295|a>>>23))+((a=i+(t^r&(s^t))+n[3]+4107603335&4294967295)<<14&4294967295|a>>>18))+((a=r+(s^t&(i^s))+n[8]+1163531501&4294967295)<<20&4294967295|a>>>12))+((a=t+(i^s&(r^i))+n[13]+2850285829&4294967295)<<5&4294967295|a>>>27))+((a=s+(r^i&(t^r))+n[2]+4243563512&4294967295)<<9&4294967295|a>>>23))+((a=i+(t^r&(s^t))+n[7]+1735328473&4294967295)<<14&4294967295|a>>>18))+((a=r+(s^t&(i^s))+n[12]+2368359562&4294967295)<<20&4294967295|a>>>12))+((a=t+(r^i^s)+n[5]+4294588738&4294967295)<<4&4294967295|a>>>28))+((a=s+(t^r^i)+n[8]+2272392833&4294967295)<<11&4294967295|a>>>21))+((a=i+(s^t^r)+n[11]+1839030562&4294967295)<<16&4294967295|a>>>16))+((a=r+(i^s^t)+n[14]+4259657740&4294967295)<<23&4294967295|a>>>9))+((a=t+(r^i^s)+n[1]+2763975236&4294967295)<<4&4294967295|a>>>28))+((a=s+(t^r^i)+n[4]+1272893353&4294967295)<<11&4294967295|a>>>21))+((a=i+(s^t^r)+n[7]+4139469664&4294967295)<<16&4294967295|a>>>16))+((a=r+(i^s^t)+n[10]+3200236656&4294967295)<<23&4294967295|a>>>9))+((a=t+(r^i^s)+n[13]+681279174&4294967295)<<4&4294967295|a>>>28))+((a=s+(t^r^i)+n[0]+3936430074&4294967295)<<11&4294967295|a>>>21))+((a=i+(s^t^r)+n[3]+3572445317&4294967295)<<16&4294967295|a>>>16))+((a=r+(i^s^t)+n[6]+76029189&4294967295)<<23&4294967295|a>>>9))+((a=t+(r^i^s)+n[9]+3654602809&4294967295)<<4&4294967295|a>>>28))+((a=s+(t^r^i)+n[12]+3873151461&4294967295)<<11&4294967295|a>>>21))+((a=i+(s^t^r)+n[15]+530742520&4294967295)<<16&4294967295|a>>>16))+((a=r+(i^s^t)+n[2]+3299628645&4294967295)<<23&4294967295|a>>>9))+((a=t+(i^(r|~s))+n[0]+4096336452&4294967295)<<6&4294967295|a>>>26))+((a=s+(r^(t|~i))+n[7]+1126891415&4294967295)<<10&4294967295|a>>>22))+((a=i+(t^(s|~r))+n[14]+2878612391&4294967295)<<15&4294967295|a>>>17))+((a=r+(s^(i|~t))+n[5]+4237533241&4294967295)<<21&4294967295|a>>>11))+((a=t+(i^(r|~s))+n[12]+1700485571&4294967295)<<6&4294967295|a>>>26))+((a=s+(r^(t|~i))+n[3]+2399980690&4294967295)<<10&4294967295|a>>>22))+((a=i+(t^(s|~r))+n[10]+4293915773&4294967295)<<15&4294967295|a>>>17))+((a=r+(s^(i|~t))+n[1]+2240044497&4294967295)<<21&4294967295|a>>>11))+((a=t+(i^(r|~s))+n[8]+1873313359&4294967295)<<6&4294967295|a>>>26))+((a=s+(r^(t|~i))+n[15]+4264355552&4294967295)<<10&4294967295|a>>>22))+((a=i+(t^(s|~r))+n[6]+2734768916&4294967295)<<15&4294967295|a>>>17))+((a=r+(s^(i|~t))+n[13]+1309151649&4294967295)<<21&4294967295|a>>>11))+((s=(t=r+((a=t+(i^(r|~s))+n[4]+4149444226&4294967295)<<6&4294967295|a>>>26))+((a=s+(r^(t|~i))+n[11]+3174756917&4294967295)<<10&4294967295|a>>>22))^((i=s+((a=i+(t^(s|~r))+n[2]+718787259&4294967295)<<15&4294967295|a>>>17))|~t))+n[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(a<<21&4294967295|a>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+s&4294967295}function u(e,t){this.h=t;var r=[];let n=!0;for(let s=e.length-1;0<=s;s--){var i=0|e[s];n&&i==t||(r[s]=i,n=!1)}this.g=r}t=r,s=function(){this.blockSize=-1},n.prototype=s.prototype,t.F=s.prototype,t.prototype=new n,(t.prototype.constructor=t).D=function(e,t,r){for(var n=Array(arguments.length-2),i=2;i<arguments.length;i++)n[i-2]=arguments[i];return s.prototype[t].apply(e,n)},r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},r.prototype.v=function(e,t){var r=(t=void 0===t?e.length:t)-this.blockSize,n=this.C;let i=this.h,s=0;for(;s<t;){if(0==i)for(;s<=r;)a(this,e,s),s+=this.blockSize;if("string"==typeof e){for(;s<t;)if(n[i++]=e.charCodeAt(s++),i==this.blockSize){a(this,n),i=0;break}}else for(;s<t;)if(n[i++]=e[s++],i==this.blockSize){a(this,n),i=0;break}}this.h=i,this.o+=t},r.prototype.A=function(){var t=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var r=1;r<t.length-8;++r)t[r]=0;for(var r=8*this.o,n=t.length-8;n<t.length;++n)t[n]=255&r,r/=256;for(this.v(t),t=Array(16),n=r=0;n<4;++n)for(let e=0;e<32;e+=8)t[r++]=this.g[n]>>>e&255;return t};var i={};function o(e){return-128<=e&&e<128?(t=e,r=function(e){return new u([0|e],e<0?-1:0)},n=i,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=r(t)):new u([0|e],e<0?-1:0);var t,r,n}function l(e){if(isNaN(e)||!isFinite(e))return h;if(e<0)return m(l(-e));var t=[];let r=1;for(let n=0;e>=r;n++)t[n]=e/r|0,r*=4294967296;return new u(t,0)}var h=o(0),c=o(1),d=o(16777216);function f(t){if(0==t.h){for(let e=0;e<t.g.length;e++)if(0!=t.g[e])return;return 1}}function g(e){return-1==e.h}function m(e){var t=e.g.length,r=[];for(let n=0;n<t;n++)r[n]=~e.g[n];return new u(r,~e.h).add(c)}function p(e,t){return e.add(m(t))}function y(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function v(e,t){this.g=e,this.h=t}function w(e,t){if(f(t))throw Error("division by zero");if(f(e))return new v(h,h);if(g(e))return t=w(m(e),t),new v(m(t.g),m(t.h));if(g(t))return t=w(e,m(t)),new v(m(t.g),t.h);if(30<e.g.length){if(g(e)||g(t))throw Error("slowDivide_ only works with positive integers.");for(var r=c,n=t;n.l(e)<=0;)r=_(r),n=_(n);for(var i=b(r,1),s=b(n,1),n=b(n,2),r=b(r,2);!f(n);){var a=s.add(n);a.l(e)<=0&&(i=i.add(r),s=a),n=b(n,1),r=b(r,1)}return t=p(e,i.j(t)),new v(i,t)}for(i=h;0<=e.l(t);){for(r=Math.max(1,Math.floor(e.m()/t.m())),n=(n=Math.ceil(Math.log(r)/Math.LN2))<=48?1:Math.pow(2,n-48),a=(s=l(r)).j(t);g(a)||0<a.l(e);)a=(s=l(r-=n)).j(t);f(s)&&(s=c),i=i.add(s),e=p(e,a)}return new v(i,e)}function _(e){var t=e.g.length+1,r=[];for(let n=0;n<t;n++)r[n]=e.i(n)<<1|e.i(n-1)>>>31;return new u(r,e.h)}function b(e,t){var r=t>>5,n=(t%=32,e.g.length-r),i=[];for(let s=0;s<n;s++)i[s]=0<t?e.i(s+r)>>>t|e.i(s+r+1)<<32-t:e.i(s+r);return new u(i,e.h)}(e=u.prototype).m=function(){if(g(this))return-m(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){var r=this.i(n);e+=(0<=r?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(t){if((t=t||10)<2||36<t)throw Error("radix out of range: "+t);if(f(this))return"0";if(g(this))return"-"+m(this).toString(t);var r=l(Math.pow(t,6)),n=this;let i="";for(;;){var s=w(n,r).g;let e=((0<(n=p(n,s.j(r))).g.length?n.g[0]:n.h)>>>0).toString(t);if(f(n=s))return e+i;for(;e.length<6;)e="0"+e;i=e+i}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return g(e=p(this,e))?-1:f(e)?0:1},e.abs=function(){return g(this)?m(this):this},e.add=function(e){var t=Math.max(this.g.length,e.g.length),r=[];let n=0;for(let a=0;a<=t;a++){var i=n+(65535&this.i(a))+(65535&e.i(a)),s=(i>>>16)+(this.i(a)>>>16)+(e.i(a)>>>16);n=s>>>16,i&=65535,s&=65535,r[a]=s<<16|i}return new u(r,-2147483648&r[r.length-1]?-1:0)},e.j=function(t){if(f(this)||f(t))return h;if(g(this))return g(t)?m(this).j(m(t)):m(m(this).j(t));if(g(t))return m(this.j(m(t)));if(this.l(d)<0&&t.l(d)<0)return l(this.m()*t.m());for(var e=this.g.length+t.g.length,r=[],n=0;n<2*e;n++)r[n]=0;for(n=0;n<this.g.length;n++)for(let e=0;e<t.g.length;e++){var i=this.i(n)>>>16,s=65535&this.i(n),a=t.i(e)>>>16,o=65535&t.i(e);r[2*n+2*e]+=s*o,y(r,2*n+2*e),r[2*n+2*e+1]+=i*o,y(r,2*n+2*e+1),r[2*n+2*e+1]+=s*a,y(r,2*n+2*e+1),r[2*n+2*e+2]+=i*a,y(r,2*n+2*e+2)}for(t=0;t<e;t++)r[t]=r[2*t+1]<<16|r[2*t];for(t=e;t<2*e;t++)r[t]=0;return new u(r,0)},e.B=function(e){return w(this,e).h},e.and=function(e){var t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)&e.i(n);return new u(r,this.h&e.h)},e.or=function(e){var t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)|e.i(n);return new u(r,this.h|e.h)},e.xor=function(e){var t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)^e.i(n);return new u(r,this.h^e.h)},r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,ue=r,u.prototype.multiply=u.prototype.j,u.prototype.modulo=u.prototype.B,u.prototype.compare=u.prototype.l,u.prototype.toNumber=u.prototype.m,u.prototype.getBits=u.prototype.i,u.fromNumber=l,u.fromString=function e(t,r){if(0==t.length)throw Error("number format error: empty string");if((r=r||10)<2||36<r)throw Error("radix out of range: "+r);if("-"==t.charAt(0))return m(e(t.substring(1),r));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');var n=l(Math.pow(r,8));let i=h;for(let o=0;o<t.length;o+=8){var s=Math.min(8,t.length-o),a=parseInt(t.substring(o,o+s),r);i=(s<8?(s=l(Math.pow(r,s)),i.j(s)):i=i.j(n)).add(l(a))}return i},oe=u}).apply(void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),(n=c=c||{})[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT";let le={debug:c.DEBUG,verbose:c.VERBOSE,info:c.INFO,warn:c.WARN,error:c.ERROR,silent:c.SILENT},he=c.INFO,ce={[c.DEBUG]:"log",[c.VERBOSE]:"log",[c.INFO]:"info",[c.WARN]:"warn",[c.ERROR]:"error"},de=(e,t,...r)=>{if(!(t<e.logLevel)){var n=(new Date).toISOString(),i=ce[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...r)}};var ar,or,ur,lr,hr,cr,dr,fr,f,fe,gr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!(function(){var e,L=Object.defineProperty;var F=(e=>{e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof gr&&gr];for(var t=0;t<e.length;++t){var r=e[t];if(r&&r.Math==Math)return r}throw Error("Cannot find global object")})(this);function P(e,t){if(t)e:{var r=F;e=e.split(".");for(var n=0;n<e.length-1;n++){var i=e[n];if(!(i in r))break e;r=r[i]}(t=t(n=r[e=e[e.length-1]]))!=n&&null!=t&&L(r,e,{configurable:!0,writable:!0,value:t})}}P("Symbol.dispose",function(e){return e||Symbol("Symbol.dispose")}),P("Array.prototype.values",function(e){return e||function(){return this[Symbol.iterator]()}}),P("Object.entries",function(e){return e||function(e){var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push([t,e[t]]);return r}});var U=U||{},D=this||self;function d(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function B(e,t,r){return e.call.apply(e.bind,arguments)}function y(e,t,r){return(y=B).apply(null,arguments)}function q(t){var r=Array.prototype.slice.call(arguments,1);return function(){var e=r.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function t(e,s){function t(){}t.prototype=s.prototype,e.Z=s.prototype,e.prototype=new t,(e.prototype.constructor=e).Ob=function(e,t,r){for(var n=Array(arguments.length-2),i=2;i<arguments.length;i++)n[i-2]=arguments[i];return s.prototype[t].apply(e,n)}}var j="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function z(t){var r=t.length;if(0<r){var n=Array(r);for(let e=0;e<r;e++)n[e]=t[e];return n}return[]}function K(t){for(let e=1;e<arguments.length;e++){var r=arguments[e];if("array"==(n="object"!=(n=typeof r)?n:r?Array.isArray(r)?"array":n:"null")||"object"==n&&"number"==typeof r.length){var n=t.length||0,i=r.length||0;t.length=n+i;for(let e=0;e<i;e++)t[n+e]=r[e]}else t.push(r)}}var G=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new $,e=>e.reset());class ${constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let r,n=!1,Q=new class{constructor(){this.h=this.g=null}add(e,t){var r=G.get();r.set(e,t),this.h?this.h.next=r:this.g=r,this.h=r}},H=()=>{let e=Promise.resolve(void 0);r=()=>{e.then(W)}};function W(){for(var e;e=(()=>{let e=Q,t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t})();){try{e.h.call(e.g)}catch(e){(e=>{D.setTimeout(()=>{throw e},0)})(e)}var t=G;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}n=!1}function i(){this.u=this.u,this.C=this.C}function o(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}i.prototype.u=!1,i.prototype.dispose=function(){this.u||(this.u=!0,this.N())},i.prototype[Symbol.dispose]=function(){this.dispose()},i.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},o.prototype.h=function(){this.defaultPrevented=!0};var Y=(()=>{if(!D.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{var r=()=>{};D.addEventListener("test",r,t),D.removeEventListener("test",r,t)}catch(e){}return e})();function N(e){return/^[\s\xa0]*$/.test(e)}function s(e,t){o.call(this,e?e.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,e&&this.init(e,t)}t(s,o),s.prototype.init=function(e,t){var r=this.type=e.type,n=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,(t=e.relatedTarget)||("mouseover"==r?t=e.fromElement:"mouseout"==r&&(t=e.toElement)),this.relatedTarget=t,n?(this.clientX=void 0!==n.clientX?n.clientX:n.pageX,this.clientY=void 0!==n.clientY?n.clientY:n.pageY,this.screenX=n.screenX||0,this.screenY=n.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=e.pointerType,this.state=e.state,(this.i=e).defaultPrevented&&s.Z.h.call(this)},s.prototype.h=function(){s.Z.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var u="closure_listenable_"+(1e6*Math.random()|0),J=0;function X(e,t,r,n,i){this.listener=e,this.proxy=null,this.src=t,this.type=r,this.capture=!!n,this.ha=i,this.key=++J,this.da=this.fa=!1}function Z(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function ee(e,t,r){for(var n in e)t.call(r,e[n],n,e)}function te(e){var t,r={};for(t in e)r[t]=e[t];return r}let re="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function ne(t){let r,n;for(let i=1;i<arguments.length;i++){for(r in n=arguments[i])t[r]=n[r];for(let e=0;e<re.length;e++)r=re[e],Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}}function ie(e){this.src=e,this.g={},this.h=0}function se(e,t){var r,n,i,s=t.type;s in e.g&&(r=e.g[s],(i=0<=(n=Array.prototype.indexOf.call(r,t,void 0)))&&Array.prototype.splice.call(r,n,1),i)&&(Z(t),0==e.g[s].length)&&(delete e.g[s],e.h--)}function ae(e,t,r,n){for(let s=0;s<e.length;++s){var i=e[s];if(!i.da&&i.listener==t&&i.capture==!!r&&i.ha==n)return s}return-1}ie.prototype.add=function(e,t,r,n,i){var s=e.toString(),a=((e=this.g[s])||(e=this.g[s]=[],this.h++),ae(e,t,n,i));return-1<a?(t=e[a],r||(t.fa=!1)):((t=new X(t,this.src,s,!!n,i)).fa=r,e.push(t)),t};var oe="closure_lm_"+(1e6*Math.random()|0),ue={};function le(t,r,n,i,s){if(i&&i.once)return function t(r,n,i,s,a){if(Array.isArray(n)){for(let e=0;e<n.length;e++)t(r,n[e],i,s,a);return null}i=pe(i);return r&&r[u]?r.K(n,i,d(s)?!!s.capture:!!s,a):he(r,n,i,!0,s,a)}(t,r,n,i,s);if(Array.isArray(r)){for(let e=0;e<r.length;e++)le(t,r[e],n,i,s);return null}return n=pe(n),t&&t[u]?t.J(r,n,d(i)?!!i.capture:!!i,s):he(t,r,n,!1,i,s)}function he(e,t,r,n,i,s){if(!t)throw Error("Invalid event type");var a=d(i)?!!i.capture:!!i;let o=ge(e);if(o||(e[oe]=o=new ie(e)),!(r=o.add(t,r,n,a,s)).proxy)if(n=(()=>{let r=fe;return function e(t){return r.call(e.src,e.listener,t)}})(),(r.proxy=n).src=e,n.listener=r,e.addEventListener)void 0===(i=Y?i:a)&&(i=!1),e.addEventListener(t.toString(),n,i);else if(e.attachEvent)e.attachEvent(de(t.toString()),n);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(n)}return r}function ce(e){var t,r,n;"number"!=typeof e&&e&&!e.da&&((t=e.src)&&t[u]?se(t.i,e):(r=e.type,n=e.proxy,t.removeEventListener?t.removeEventListener(r,n,e.capture):t.detachEvent?t.detachEvent(de(r),n):t.addListener&&t.removeListener&&t.removeListener(n),(r=ge(t))?(se(r,e),0==r.h&&(r.src=null,t[oe]=null)):Z(e)))}function de(e){return e in ue?ue[e]:ue[e]="on"+e}function fe(e,t){var r,n;return e=!!e.da||(t=new s(t,this),r=e.listener,n=e.ha||e.src,e.fa&&ce(e),r.call(n,t))}function ge(e){return(e=e[oe])instanceof ie?e:null}var me="__closure_events_fn_"+(1e9*Math.random()>>>0);function pe(t){return"function"==typeof t?t:(t[me]||(t[me]=function(e){return t.handleEvent(e)}),t[me])}function a(){i.call(this),this.i=new ie(this),(this.M=this).G=null}function l(e,t){var r,n,i=e.G;if(i)for(r=[];i;i=i.G)r.push(i);e=e.M,i=t.type||t,"string"==typeof t?t=new o(t,e):t instanceof o?t.target=t.target||e:(n=t,ne(t=new o(i,e),n)),n=!0;let s,a;if(r)for(a=r.length-1;0<=a;a--)n=ye(s=t.g=r[a],i,!0,t)&&n;if(n=ye(s=t.g=e,i,!0,t)&&n,n=ye(s,i,!1,t)&&n,r)for(a=0;a<r.length;a++)n=ye(s=t.g=r[a],i,!1,t)&&n}function ye(e,t,r,n){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();let i=!0;for(let u=0;u<t.length;++u){var s,a,o=t[u];o&&!o.da&&o.capture==r&&(s=o.listener,a=o.ha||o.src,o.fa&&se(e.i,o),i=!1!==s.call(a,n)&&i)}return i&&!n.defaultPrevented}function ve(e){e.g=((e,t)=>{if("function"!=typeof e){if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=y(e.handleEvent,e)}return 2147483647<Number(t)?-1:D.setTimeout(e,t||0)})(()=>{e.g=null,e.i&&(e.i=!1,ve(e))},e.l);var t=e.h;e.h=null,e.m.apply(null,t)}t(a,i),a.prototype[u]=!0,a.prototype.removeEventListener=function(e,t,r,n){!function e(t,r,n,i,s){if(Array.isArray(r))for(var a=0;a<r.length;a++)e(t,r[a],n,i,s);else i=d(i)?!!i.capture:!!i,n=pe(n),t&&t[u]?(t=t.i,(a=String(r).toString())in t.g&&-1<(n=ae(r=t.g[a],n,i,s))&&(Z(r[n]),Array.prototype.splice.call(r,n,1),0==r.length)&&(delete t.g[a],t.h--)):(t=t&&ge(t))&&(r=t.g[r.toString()],n=(t=-1)<(t=r?ae(r,n,i,s):t)?r[t]:null)&&ce(n)}(this,e,t,r,n)},a.prototype.N=function(){if(a.Z.N.call(this),this.i){var t,r=this.i;for(t in r.g){var n=r.g[t];for(let e=0;e<n.length;e++)Z(n[e]);delete r.g[t],r.h--}}this.G=null},a.prototype.J=function(e,t,r,n){return this.i.add(String(e),t,!1,r,n)},a.prototype.K=function(e,t,r,n){return this.i.add(String(e),t,!0,r,n)};class we extends i{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:ve(this)}N(){super.N(),this.g&&(D.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function h(e){i.call(this),this.h=e,this.g={}}t(h,i);var _e=[];function be(e){ee(e.g,function(e,t){this.g.hasOwnProperty(t)&&ce(e)},e),e.g={}}h.prototype.N=function(){h.Z.N.call(this),be(this)},h.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Ie=D.JSON.stringify,Te=D.JSON.parse,Ee=class{stringify(e){return D.JSON.stringify(e,void 0)}parse(e){return D.JSON.parse(e,void 0)}};function Se(){}function xe(){}var Ae={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function Ce(){o.call(this,"d")}function De(){o.call(this,"c")}t(Ce,o),t(De,o);var c={},Ne=null;function ke(){return Ne=Ne||new a}function Re(e){o.call(this,c.Ia,e)}function Oe(){var e=ke();l(e,new Re(e))}function Me(e,t){o.call(this,c.STAT_EVENT,e),this.stat=t}function k(e){var t=ke();l(t,new Me(t,e))}function Ve(e,t){o.call(this,c.Ja,e),this.size=t}function v(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return D.setTimeout(function(){e()},t)}function f(){this.g=!0}function R(e,t,r,n){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+((e,t)=>{if(!e.g)return t;if(!t)return null;try{var r=JSON.parse(t);if(r)for(e=0;e<r.length;e++)if(Array.isArray(r[e])){var n=r[e];if(!(n.length<2)){var i=n[1];if(Array.isArray(i)&&!(i.length<1)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(let e=1;e<i.length;e++)i[e]=""}}}return Ie(r)}catch(e){return t}})(e,r)+(n?" "+n:"")})}c.Ia="serverreachability",t(Re,o),c.STAT_EVENT="statevent",t(Me,o),c.Ja="timingevent",t(Ve,o),f.prototype.ua=function(){this.g=!1},f.prototype.info=function(){};var Le={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},Fe={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function Pe(){}function g(e){return encodeURIComponent(String(e))}function m(e,t,r,n){this.j=e,this.i=t,this.l=r,this.S=n||1,this.V=new h(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Ue}function Ue(){this.i=null,this.g="",this.h=!1}t(Pe,Se),Pe.prototype.g=function(){return new XMLHttpRequest};var Be=new Pe,qe={},je={};function ze(e,t,r){e.M=1,e.A=ot(w(t)),e.u=r,e.R=!0,Ke(e,null)}function Ke(e,t){e.F=Date.now(),$e(e),e.B=w(e.A);var a,o,u,l,h,c,r=e.B,n=e.S,i=(Array.isArray(n)||(n=[String(n)]),_t(r.i,"t",n),e.C=0,r=e.j.L,e.h=new Ue,e.g=tr(e.j,r?t:null,!e.u),0<e.P&&(e.O=new we(y(e.Y,e,e.g),e.P)),t=e.V,r=e.g,n=e.ba,"readystatechange");Array.isArray(i)||(i&&(_e[0]=i.toString()),i=_e);for(let d=0;d<i.length;d++){var s=le(r,i[d],n||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}t=e.J?te(e.J):{},e.u?(e.v||(e.v="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.B,e.v,e.u,t)):(e.v="GET",e.g.ea(e.B,e.v,null,t)),Oe(),a=e.i,o=e.v,u=e.B,l=e.l,h=e.S,c=e.u,a.info(function(){if(a.g)if(c){var t="",r=c.split("&");for(let e=0;e<r.length;e++){var n,i,s=r[e].split("=");1<s.length&&(n=s[0],s=s[1],t=2<=(i=n.split("_")).length&&"type"==i[1]?t+(n+"=")+s+"&":t+(n+"=redacted&"))}}else t=null;else t=c;return"XMLHTTP REQ ("+l+") [attempt "+h+"]: "+o+"\n"+u+"\n"+t})}function Ge(e){return e.g&&"GET"==e.v&&2!=e.M&&e.j.Aa}function $e(e){e.T=Date.now()+e.H,Qe(e,e.H)}function Qe(e,t){if(null!=e.D)throw Error("WatchDog timer not null");e.D=v(y(e.aa,e),t)}function He(e){e.D&&(D.clearTimeout(e.D),e.D=null)}function O(e){0==e.j.I||e.K||Jt(e.j,e)}function M(e){He(e);var t=e.O;t&&"function"==typeof t.dispose&&t.dispose(),e.O=null,be(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dispose())}function We(e,t){try{var r=e.j;if(0!=r.I&&(r.g==e||et(r.h,e)))if(!e.L&&et(r.h,e)&&3==r.I){try{var n=r.Ba.g.parse(t)}catch(e){n=null}if(Array.isArray(n)&&3==n.length){var i=n;if(0==i[0]){e:if(!r.v){if(r.g){if(!(r.g.F+3e3<e.F))break e;Yt(r),Bt(r)}Qt(r),k(18)}}else r.xa=i[1],0<r.xa-r.K&&i[2]<37500&&r.F&&0==r.A&&!r.C&&(r.C=v(y(r.Va,r),6e3));Ze(r.h)<=1&&r.ta&&(r.ta=void 0)}else x(r,11)}else if(!e.L&&r.g!=e||Yt(r),!N(t))for(i=r.Ba.g.parse(t),t=0;t<i.length;t++){var s,a,o,u,l,h,c,d,f,g,m=i[t],p=m[0];p<=r.K||(r.K=p,m=m[1],2==r.I?"c"==m[0]?(r.M=m[1],r.ba=m[2],null!=(s=m[3])&&(r.ka=s,r.j.info("VER="+r.ka)),null!=(a=m[4])&&(r.za=a,r.j.info("SVER="+r.za)),null!=(o=m[5])&&"number"==typeof o&&0<o&&(n=1.5*o,r.O=n,r.j.info("backChannelRequestTimeoutMs_="+n)),n=r,(u=e.g)&&(!(l=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null)||(h=n.h).g||-1==l.indexOf("spdy")&&-1==l.indexOf("quic")&&-1==l.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(tt(h,h.h),h.h=null)),n.G)&&(c=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null)&&(n.wa=c,b(n.J,n.G,c)),r.I=3,r.l&&r.l.ra(),r.aa&&(r.T=Date.now()-e.F,r.j.info("Handshake RTT: "+r.T+"ms")),d=e,(n=r).na=er(n,n.L?n.ba:null,n.W),d.L?(rt(n.h,d),f=d,(g=n.O)&&(f.H=g),f.D&&(He(f),$e(f)),n.g=d):$t(n),0<r.i.length&&jt(r)):"stop"!=m[0]&&"close"!=m[0]||x(r,7):3==r.I&&("stop"==m[0]||"close"==m[0]?"stop"==m[0]?x(r,7):Ut(r):"noop"!=m[0]&&r.l&&r.l.qa(m),r.A=0))}Oe()}catch(e){}}m.prototype.ba=function(e){e=e.target;var t=this.O;t&&3==V(e)?t.j():this.Y(e)},m.prototype.Y=function(e){try{if(e==this.g)e:{var t=V(this.g),r=this.g.ya();this.g.ca();if(!(t<3)&&(3!=t||this.g&&(this.h.h||this.g.la()||Lt(this.g)))){this.K||4!=t||7==r||Oe(),He(this);var n,i,s=this.g.ca(),a=(this.X=s,(e=>{if(!Ge(e))return e.g.la();var t=Lt(e.g);if(""===t)return"";let r="",n=t.length,i=4==V(e.g);if(!e.h.i){if("undefined"==typeof TextDecoder)return M(e),O(e),"";e.h.i=new D.TextDecoder}for(let s=0;s<n;s++)e.h.h=!0,r+=e.h.i.decode(t[s],{stream:!(i&&s==n-1)});return t.length=0,e.h.g+=r,e.C=0,e.h.g})(this));if(this.o=200==s,I=this.i,T=this.v,E=this.B,S=this.l,x=this.S,A=t,C=s,I.info(function(){return"XMLHTTP RESP ("+S+") [ attempt "+x+"]: "+T+"\n"+E+"\n"+A+" "+C}),this.o){if(this.U&&!this.L){t:{if(this.g){var o,u=this.g;if((o=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!N(o)){var l=o;break t}}l=null}if(!(e=l)){this.o=!1,this.m=3,k(12),M(this),O(this);break e}R(this.i,this.l,e,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,We(this,e)}if(this.R){for(e=!0;!this.K&&this.C<a.length;){if(w=a,b=_=void 0,_=(v=this).C,(n=-1==(b=w.indexOf("\n",_))?je:(_=Number(w.substring(_,b)),isNaN(_)?qe:(b+=1)+_>w.length?je:(w=w.slice(b,b+_),v.C=b+_,w)))==je){4==t&&(this.m=4,k(14),e=!1),R(this.i,this.l,null,"[Incomplete Response]");break}if(n==qe){this.m=4,k(15),R(this.i,this.l,a,"[Invalid Chunk]"),e=!1;break}R(this.i,this.l,n,null),We(this,n)}Ge(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=t||0!=a.length||this.h.h||(this.m=1,k(16),e=!1),this.o=this.o&&e,e?0<a.length&&!this.W&&(this.W=!0,(i=this.j).g==this)&&i.aa&&!i.P&&(i.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),Ht(i),i.P=!0,k(11)):(R(this.i,this.l,a,"[Invalid Chunked Response]"),M(this),O(this))}else R(this.i,this.l,a,null),We(this,a);4==t&&M(this),this.o&&!this.K&&(4==t?Jt(this.j,this):(this.o=!1,$e(this)))}else{{var h=this.g;var c,d,f,g={};h=(h.g&&2<=V(h)&&h.g.getAllResponseHeaders()||"").split("\r\n");for(let e=0;e<h.length;e++)N(h[e])||(c=(e=>{for(var t=1,r=(e=e.split(":"),[]);0<t&&e.length;)r.push(e.shift()),t--;return e.length&&r.push(e.join(":")),r})(h[e]),d=c[0],"string"==typeof(c=c[1])&&(c=c.trim(),f=g[d]||[],(g[d]=f).push(c)));var m,p=g,y=function(e){return e.join(", ")};for(m in p)y.call(void 0,p[m],m,p)}400==s&&0<a.indexOf("Unknown SID")?(this.m=3,k(12)):(this.m=0,k(13)),M(this),O(this)}}}}catch(e){}var v,w,_,b,I,T,E,S,x,A,C},m.prototype.cancel=function(){this.K=!0,M(this)},m.prototype.aa=function(){this.D=null;var e,t,r=Date.now();0<=r-this.T?(e=this.i,t=this.B,e.info(function(){return"TIMEOUT: "+t}),2!=this.M&&(Oe(),k(17)),M(this),this.m=2,O(this)):Qe(this,this.T-r)};var Ye=class{constructor(e,t){this.g=e,this.map=t}};function Je(e){this.l=e||10,e=D.PerformanceNavigationTiming?0<(e=D.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):!!(D.chrome&&D.chrome.loadTimes&&D.chrome.loadTimes()&&D.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Xe(e){return e.h||e.g&&e.g.size>=e.j}function Ze(e){return e.h?1:e.g?e.g.size:0}function et(e,t){return e.h?e.h==t:e.g&&e.g.has(t)}function tt(e,t){e.g?e.g.add(t):e.h=t}function rt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function nt(t){if(null!=t.h)return t.i.concat(t.h.G);if(null==t.g||0===t.g.size)return z(t.i);{let e=t.i;for(var r of t.g.values())e=e.concat(r.G);return e}}Je.prototype.cancel=function(){if(this.i=nt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(var e of this.g.values())e.cancel();this.g.clear()}};var it=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function p(e){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let t;e instanceof p?(this.l=e.l,_(this,e.j),this.o=e.o,this.g=e.g,st(this,e.u),this.h=e.h,at(this,bt(e.i)),this.m=e.m):e&&(t=String(e).match(it))?(this.l=!1,_(this,t[1]||"",!0),this.o=ut(t[2]||""),this.g=ut(t[3]||"",!0),st(this,t[4]),this.h=ut(t[5]||"",!0),at(this,t[6]||"",!0),this.m=ut(t[7]||"")):(this.l=!1,this.i=new pt(null,this.l))}function w(e){return new p(e)}function _(e,t,r){e.j=r?ut(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function st(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error("Bad port number "+t);e.u=t}else e.u=null}function at(e,t,r){var n,i;t instanceof pt?(e.i=t,n=e.i,(i=e.l)&&!n.j&&(I(n),n.i=null,n.g.forEach(function(e,t){var r=t.toLowerCase();t!=r&&(yt(this,t),_t(this,r,e))},n)),n.j=i):(r||(t=lt(t,gt)),e.i=new pt(t,e.l))}function b(e,t,r){e.i.set(t,r)}function ot(e){return b(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function ut(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function lt(e,t,r){return"string"==typeof e?(e=encodeURI(e).replace(t,ht),e=r?e.replace(/%25([0-9a-fA-F]{2})/g,"%$1"):e):null}function ht(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}p.prototype.toString=function(){var e=[],t=this.j,r=(t&&e.push(lt(t,ct,!0),":"),this.g);return!r&&"file"!=t||(e.push("//"),(t=this.o)&&e.push(lt(t,ct,!0),"@"),e.push(g(r).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null==(r=this.u))||e.push(":",String(r)),(r=this.h)&&(this.g&&"/"!=r.charAt(0)&&e.push("/"),e.push(lt(r,"/"==r.charAt(0)?ft:dt,!0))),(r=this.i.toString())&&e.push("?",r),(r=this.m)&&e.push("#",lt(r,mt)),e.join("")},p.prototype.resolve=function(e){var t=w(this);let r=!!e.j;r?_(t,e.j):r=!!e.o,r?t.o=e.o:r=!!e.g,r?t.g=e.g:r=null!=e.u;var n=e.h;if(r)st(t,e.u);else if(r=!!e.h)if("/"!=n.charAt(0)&&(this.g&&!this.h?n="/"+n:-1!=(i=t.h.lastIndexOf("/"))&&(n=t.h.slice(0,i+1)+n)),".."==(i=n)||"."==i)n="";else if(-1!=i.indexOf("./")||-1!=i.indexOf("/.")){var n=0==i.lastIndexOf("/",0),i=i.split("/"),s=[];for(let e=0;e<i.length;){var a=i[e++];"."==a?n&&e==i.length&&s.push(""):".."==a?((1<s.length||1==s.length&&""!=s[0])&&s.pop(),n&&e==i.length&&s.push("")):(s.push(a),n=!0)}n=s.join("/")}else n=i;return r?t.h=n:r=""!==e.i.toString(),r?at(t,bt(e.i)):r=!!e.m,r&&(t.m=e.m),t};var ct=/[#\/\?@]/g,dt=/[#\?:]/g,ft=/[#\?]/g,gt=/[#\?@]/g,mt=/#/g;function pt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function I(r){if(!r.g&&(r.g=new Map,r.h=0,r.i)){var n=r.i,i=function(e,t){r.add(decodeURIComponent(e.replace(/\+/g," ")),t)};if(n){n=n.split("&");for(let r=0;r<n.length;r++){var s=n[r].indexOf("=");let e,t=null;0<=s?(e=n[r].substring(0,s),t=n[r].substring(s+1)):e=n[r],i(e,t?decodeURIComponent(t.replace(/\+/g," ")):"")}}}}function yt(e,t){I(e),t=T(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function vt(e,t){return I(e),t=T(e,t),e.g.has(t)}function wt(e,t){I(e);let r=[];if("string"==typeof t)vt(e,t)&&(r=r.concat(e.g.get(T(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)r=r.concat(e[t]);return r}function _t(e,t,r){yt(e,t),0<r.length&&(e.i=null,e.g.set(T(e,t),z(r)),e.h+=r.length)}function bt(e){var t=new pt;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function T(e,t){return t=String(t),t=e.j?t.toLowerCase():t}function E(e,t,r,n,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),n(r)}catch(e){}}function It(){this.g=new Ee}function Tt(e){this.i=e.Sb||null,this.h=e.ab||!1}function Et(e,t){a.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function St(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}function xt(e){e.readyState=4,e.l=null,e.j=null,e.B=null,At(e)}function At(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Ct(e){let r="";return ee(e,function(e,t){r=(r=r+t+":")+e+"\r\n"}),r}function Dt(e,t,r){e:{for(n in r){var n=!1;break e}n=!0}n||(r=Ct(r),"string"==typeof e?null!=r&&g(r):b(e,t,r))}function S(e){a.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(e=pt.prototype).add=function(e,t){I(this),this.i=null,e=T(this,e);let r=this.g.get(e);return r||this.g.set(e,r=[]),r.push(t),this.h+=1,this},e.forEach=function(r,n){I(this),this.g.forEach(function(e,t){e.forEach(function(e){r.call(n,e,t,this)},this)},this)},e.set=function(e,t){return I(this),this.i=null,vt(this,e=T(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=wt(this,e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";var r=[],e=Array.from(this.g.keys());for(let s=0;s<e.length;s++){var n=g(i=e[s]),i=wt(this,i);for(let t=0;t<i.length;t++){let e=n;""!==i[t]&&(e+="="+g(i[t])),r.push(e)}}return this.i=r.join("&")},t(Tt,Se),Tt.prototype.g=function(){return new Et(this.i,this.h)},t(Et,a),(e=Et.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=e,this.D=t,this.readyState=1,At(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;var t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||D).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,xt(this)),this.readyState=0},e.Pa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,At(this)),this.g)&&(this.readyState=3,At(this),this.g))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==D.ReadableStream&&"body"in e){if(this.j=e.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.B=new TextDecoder;St(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))},e.Ma=function(e){var t;this.g&&(this.o&&e.value?this.response.push(e.value):!this.o&&(t=e.value||new Uint8Array(0),t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t),(e.done?xt:At)(this),3==this.readyState)&&St(this)},e.Oa=function(e){this.g&&(this.response=this.responseText=e,xt(this))},e.Na=function(e){this.g&&(this.response=e,xt(this))},e.ga=function(){this.g&&xt(this)},e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";for(var e=[],t=this.h.entries(),r=t.next();!r.done;)r=r.value,e.push(r[0]+": "+r[1]),r=t.next();return e.join("\r\n")},Object.defineProperty(Et.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),t(S,a);var Nt=/^https?$/i,kt=["POST","PUT"];function Rt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,Ot(e),Vt(e)}function Ot(e){e.A||(e.A=!0,l(e,"complete"),l(e,"error"))}function Mt(t){if(t.h&&void 0!==U)if(t.v&&4==V(t))setTimeout(t.Ca.bind(t),0);else if(l(t,"readystatechange"),4==V(t)){t.h=!1;try{var e,r,n=t.ca();switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var i=!0;break;default:i=!1}if(!(e=i)){if(r=0===n){let e=String(t.D).match(it)[1]||null;!e&&D.self&&D.self.location&&(e=D.self.location.protocol.slice(0,-1)),r=!Nt.test(e?e.toLowerCase():"")}e=r}if(e)l(t,"complete"),l(t,"success");else{t.o=6;try{var s=2<V(t)?t.g.statusText:""}catch(e){s=""}t.l=s+" ["+t.ca()+"]",Ot(t)}}finally{Vt(t)}}}function Vt(e,t){if(e.g){e.m&&(clearTimeout(e.m),e.m=null);var r=e.g;e.g=null,t||l(e,"ready");try{r.onreadystatechange=null}catch(e){}}}function V(e){return e.g?e.g.readyState:0}function Lt(e){try{if(e.g){if("response"in e.g)return e.g.response;switch(e.F){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}}return null}catch(e){return null}}function Ft(e,t,r){return r&&r.internalChannelParams&&r.internalChannelParams[e]||t}function Pt(e){this.za=0,this.i=[],this.j=new f,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Ft("failFast",!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Ft("baseRetryDelayMs",5e3,e),this.Za=Ft("retryDelaySeedMs",1e4,e),this.Ta=Ft("forwardChannelMaxRetries",2,e),this.va=Ft("forwardChannelRequestTimeoutMs",2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M="",this.h=new Je(e&&e.concurrentRequestLimit),this.Ba=new It,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function Ut(e){if(qt(e),3==e.I){var t=e.V++,r=w(e.J);if(b(r,"SID",e.M),b(r,"RID",t),b(r,"TYPE","terminate"),Kt(e,r),(t=new m(e,e.j,t)).M=2,t.A=ot(w(r)),r=!1,D.navigator&&D.navigator.sendBeacon)try{r=D.navigator.sendBeacon(t.A.toString(),"")}catch(e){}!r&&D.Image&&((new Image).src=t.A,r=!0),r||(t.g=tr(t.j,null),t.g.ea(t.A)),t.F=Date.now(),$e(t)}Zt(e)}function Bt(e){e.g&&(Ht(e),e.g.cancel(),e.g=null)}function qt(e){Bt(e),e.v&&(D.clearTimeout(e.v),e.v=null),Yt(e),e.h.cancel(),e.m&&("number"==typeof e.m&&D.clearTimeout(e.m),e.m=null)}function jt(e){var t;Xe(e.h)||e.m||(e.m=!0,t=e.Ea,r||H(),n||(r(),n=!0),Q.add(t,e),e.D=0)}function zt(e,t){var r=t?t.l:e.V++,n=w(e.J);b(n,"SID",e.M),b(n,"RID",r),b(n,"AID",e.K),Kt(e,n),e.u&&e.o&&Dt(n,e.u,e.o),r=new m(e,e.j,r,e.D+1),null===e.u&&(r.J=e.o),t&&(e.i=t.G.concat(e.i)),t=Gt(e,r,1e3),r.H=Math.round(.5*e.va)+Math.round(.5*e.va*Math.random()),tt(e.h,r),ze(r,n,t)}function Kt(e,r){e.H&&ee(e.H,function(e,t){b(r,t,e)}),e.l&&ee({},function(e,t){b(r,t,e)})}function Gt(e,t,i){i=Math.min(e.i.length,i);var s=e.l?y(e.l.Ka,e.l,e):null;e:{let r=e.i,n=-1;for(;;){var a=["count="+i];-1==n?0<i?(n=r[0].g,a.push("ofs="+n)):n=0:a.push("ofs="+n);let e=!0;for(let t=0;t<i;t++){var o=r[t].g,u=r[t].map;if((o-=n)<0)n=Math.max(0,r[t].g-100),e=!1;else try{o="req"+o+"_"||"";try{var l,h,c=u instanceof Map?u:Object.entries(u);for([l,h]of c){let e=h;d(h)&&(e=Ie(h)),a.push(o+l+"="+encodeURIComponent(e))}}catch(e){throw a.push(o+"type="+encodeURIComponent("_badmap")),e}}catch(e){s&&s(u)}}if(e){c=a.join("&");break e}}c=void 0}return e=e.i.splice(0,i),t.G=e,c}function $t(e){var t;e.g||e.v||(e.Y=1,t=e.Da,r||H(),n||(r(),n=!0),Q.add(t,e),e.A=0)}function Qt(e){return!(e.g||e.v||3<=e.A)&&(e.Y++,e.v=v(y(e.Da,e),Xt(e,e.A)),e.A++,1)}function Ht(e){null!=e.B&&(D.clearTimeout(e.B),e.B=null)}function Wt(e){e.g=new m(e,e.j,"rpc",e.Y),null===e.u&&(e.g.J=e.o),e.g.P=0;var t=w(e.na),r=(b(t,"RID","rpc"),b(t,"SID",e.M),b(t,"AID",e.K),b(t,"CI",e.F?"0":"1"),!e.F&&e.ia&&b(t,"TO",e.ia),b(t,"TYPE","xmlhttp"),Kt(e,t),e.u&&e.o&&Dt(t,e.u,e.o),e.O&&(e.g.H=e.O),e.g);e=e.ba,r.M=1,r.A=ot(w(t)),r.u=null,r.R=!0,Ke(r,e)}function Yt(e){null!=e.C&&(D.clearTimeout(e.C),e.C=null)}function Jt(e,t){var r,n,i,s=null;if(e.g==t){Yt(e),Ht(e),e.g=null;var a=2}else{if(!et(e.h,t))return;s=t.G,rt(e.h,t),a=1}if(0!=e.I)if(t.o)(1==a?(s=t.u?t.u.length:0,t=Date.now()-t.F,r=e.D,l(a=ke(),new Ve(a,s)),jt):$t)(e);else if(3==(r=t.m)||0==r&&0<t.X||(1!=a||(i=t,Ze((n=e).h)>=n.h.j-(n.m?1:0))||(n.m?(n.i=i.G.concat(n.i),0):1==n.I||2==n.I||n.D>=(n.Sa?0:n.Ta)||(n.m=v(y(n.Ea,n,i),Xt(n,n.D)),n.D++,0)))&&(2!=a||!Qt(e)))switch(s&&0<s.length&&(t=e.h,t.i=t.i.concat(s)),r){case 1:x(e,5);break;case 4:x(e,10);break;case 3:x(e,6);break;default:x(e,2)}}function Xt(e,t){let r=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(r*=2),r*t}function x(e,t){var r,n,i;e.j.info("Error code "+t),2==t?(r=y(e.bb,e),n=!(i=e.Ua),i=new p(i||"//www.google.com/images/cleardot.gif"),D.location&&"http"==D.location.protocol||_(i,"https"),ot(i),(n?(t,r)=>{var n=new f;if(D.Image){let e=new Image;e.onload=q(E,n,"TestLoadImage: loaded",!0,r,e),e.onerror=q(E,n,"TestLoadImage: error",!1,r,e),e.onabort=q(E,n,"TestLoadImage: abort",!1,r,e),e.ontimeout=q(E,n,"TestLoadImage: timeout",!1,r,e),D.setTimeout(function(){e.ontimeout&&e.ontimeout()},1e4),e.src=t}else r(!1)}:(e,t)=>{let r=new f,n=new AbortController,i=setTimeout(()=>{n.abort(),E(r,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(i),e.ok?E(r,0,!0,t):E(r,0,!1,t)}).catch(()=>{clearTimeout(i),E(r,0,!1,t)})})(i.toString(),r)):k(2),e.I=0,e.l&&e.l.pa(t),Zt(e),qt(e)}function Zt(e){var t;e.I=0,e.ja=[],e.l&&(0==(t=nt(e.h)).length&&0==e.i.length||(K(e.ja,t),K(e.ja,e.i),e.h.i.length=0,z(e.i),e.i.length=0),e.l.oa())}function er(e,t,r){var n,i,s=r instanceof p?w(r):new p(r);return""!=s.g?(t&&(s.g=t+"."+s.g),st(s,s.u)):(s=(n=D.location).protocol,t=t?t+"."+n.hostname:n.hostname,n=+n.port,i=new p(null),s&&_(i,s),t&&(i.g=t),n&&st(i,n),r&&(i.h=r),s=i),r=e.G,t=e.wa,r&&t&&b(s,r,t),b(s,"VER",e.ka),Kt(e,s),s}function tr(e,t,r){if(t&&!e.L)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Aa&&!e.ma?new S(new Tt({ab:r})):new S(e.ma)).Fa(e.L),t}function rr(){}function nr(){}function A(e,t){a.call(this),this.g=new Pt(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.sa&&(e?e["X-WebChannel-Client-Profile"]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!N(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!N(t)&&(this.g.G=t,null!==(e=this.h))&&t in e&&t in(e=this.h)&&delete e[t],this.j=new C(this)}function ir(e){Ce.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(var r in t){e=r;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function sr(){De.call(this),this.status=1}function C(e){this.g=e}(e=S.prototype).Fa=function(e){this.H=e},e.ea=function(e,t,r,n){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=(this.L||Be).g(),this.g.onreadystatechange=j(y(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Rt(this,e)}if(e=r||"",r=new Map(this.headers),n)if(Object.getPrototypeOf(n)===Object.prototype)for(var i in n)r.set(i,n[i]);else{if("function"!=typeof n.keys||"function"!=typeof n.get)throw Error("Unknown input type for opt_headers: "+String(n));for(var s of n.keys())r.set(s,n.get(s))}n=Array.from(r.keys()).find(e=>"content-type"==e.toLowerCase()),i=D.FormData&&e instanceof D.FormData,0<=Array.prototype.indexOf.call(kt,t,void 0)&&!n&&!i&&r.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(var[a,o]of r)this.g.setRequestHeader(a,o);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(e),this.v=!1}catch(e){Rt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,l(this,"complete"),l(this,"abort"),Vt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Vt(this,!0)),S.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?Mt(this):this.Xa())},e.Xa=function(){Mt(this)},e.isActive=function(){return!!this.g},e.ca=function(){try{return 2<V(this)?this.g.status:-1}catch(e){return-1}},e.la=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.La=function(e){var t;if(this.g)return t=this.g.responseText,e&&0==t.indexOf(e)&&(t=t.substring(e.length)),Te(t)},e.ya=function(){return this.o},e.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=Pt.prototype).ka=8,e.I=1,e.connect=function(e,t,r,n){k(0),this.W=e,this.H=t||{},r&&void 0!==n&&(this.H.OSID=r,this.H.OAID=n),this.F=this.X,this.J=er(this,null,this.W),jt(this)},e.Ea=function(t){if(this.m)if(this.m=null,1==this.I){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;var r=new m(this,this.j,t);let e=this.o;if(this.U&&(e?ne(e=te(e),this.U):e=this.U),null!==this.u||this.R||(r.J=e,e=null),this.S)e:{for(var n=0,i=0;i<this.i.length;i++){var s=this.i[i];if("__data__"in s.map&&"string"==typeof(s=s.map.__data__)?s=s.length:s=void 0,void 0===s)break;if(4096<(n+=s)){n=i;break e}if(4096===n||i===this.i.length-1){n=i+1;break e}}n=1e3}else n=1e3;n=Gt(this,r,n),b(i=w(this.J),"RID",t),b(i,"CVER",22),this.G&&b(i,"X-HTTP-Session-Id",this.G),Kt(this,i),e&&(this.R?n="headers="+g(Ct(e))+"&"+n:this.u&&Dt(i,this.u,e)),tt(this.h,r),this.Ra&&b(i,"TYPE","init"),this.S?(b(i,"$req",n),b(i,"SID","null"),r.U=!0,ze(r,i,null)):ze(r,i,n),this.I=2}}else 3==this.I&&(t?zt(this,t):0==this.i.length||Xe(this.h)||zt(this))},e.Da=function(){var e;this.v=null,Wt(this),this.aa&&!(this.P||null==this.g||this.T<=0)&&(e=4*this.T,this.j.info("BP detection timer enabled: "+e),this.B=v(y(this.Wa,this),e))},e.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,k(10),Bt(this),Wt(this))},e.Va=function(){null!=this.C&&(this.C=null,Bt(this),Qt(this),k(19))},e.bb=function(e){e?(this.j.info("Successfully pinged google.com"),k(2)):(this.j.info("Failed to ping google.com"),k(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=rr.prototype).ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){},nr.prototype.g=function(e,t){return new A(e,t)},t(A,a),A.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},A.prototype.close=function(){Ut(this.g)},A.prototype.o=function(e){var t,r=this.g;"string"==typeof e?((t={}).__data__=e,e=t):this.v&&((t={}).__data__=Ie(e),e=t),r.i.push(new Ye(r.Ya++,e)),3==r.I&&jt(r)},A.prototype.N=function(){this.g.l=null,delete this.j,Ut(this.g),delete this.g,A.Z.N.call(this)},t(ir,Ce),t(sr,De),t(C,rr),C.prototype.ra=function(){l(this.g,"a")},C.prototype.qa=function(e){l(this.g,new ir(e))},C.prototype.pa=function(e){l(this.g,new sr)},C.prototype.oa=function(){l(this.g,"b")},nr.prototype.createWebChannel=nr.prototype.g,A.prototype.send=A.prototype.o,A.prototype.open=A.prototype.m,fr=function(){return new nr},dr=ke,cr=c,hr={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Le.NO_ERROR=0,Le.TIMEOUT=8,Le.HTTP_ERROR=6,lr=Le,Fe.COMPLETE="complete",ur=Fe,(xe.EventType=Ae).OPEN="a",Ae.CLOSE="b",Ae.ERROR="c",Ae.MESSAGE="d",a.prototype.listen=a.prototype.J,or=xe,S.prototype.listenOnce=S.prototype.K,S.prototype.getLastError=S.prototype.Ha,S.prototype.getLastErrorCode=S.prototype.ya,S.prototype.getStatus=S.prototype.ca,S.prototype.getResponseJson=S.prototype.La,S.prototype.getResponseText=S.prototype.la,S.prototype.send=S.prototype.ea,S.prototype.setWithCredentials=S.prototype.Fa,ar=S}).apply(void 0!==gr?gr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});class l{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}l.UNAUTHENTICATED=new l(null),l.GOOGLE_CREDENTIALS=new l("google-credentials-uid"),l.FIRST_PARTY=new l("first-party-uid"),l.MOCK_USER=new l("mock-user");let ge="12.12.0";let me=new class{constructor(e){this.name=e,this._logLevel=he,this._logHandler=de,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in c))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?le[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,c.DEBUG,...e),this._logHandler(this,c.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,c.VERBOSE,...e),this._logHandler(this,c.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,c.INFO,...e),this._logHandler(this,c.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,c.WARN,...e),this._logHandler(this,c.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,c.ERROR,...e),this._logHandler(this,c.ERROR,...e)}}("@firebase/firestore");function pe(){return me.logLevel}function g(e,...t){var r;me.logLevel<=c.DEBUG&&(r=t.map(ve),me.debug(`Firestore (${ge}): `+e,...r))}function d(e,...t){var r;me.logLevel<=c.ERROR&&(r=t.map(ve),me.error(`Firestore (${ge}): `+e,...r))}function ye(e,...t){var r;me.logLevel<=c.WARN&&(r=t.map(ve),me.warn(`Firestore (${ge}): `+e,...r))}function ve(t){if("string"==typeof t)return t;try{return JSON.stringify(t)}catch(e){return t}}function E(e,t,r){let n="Unexpected state";"string"==typeof t?n=t:r=t,we(e,n,r)}function we(e,t,r){let n=`FIRESTORE (${ge}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==r)try{n+=" CONTEXT: "+JSON.stringify(r)}catch(e){n+=" CONTEXT: "+r}throw d(n),new Error(n)}function y(e,t,r,n){let i="Unexpected state";"string"==typeof r?i=r:n=r,e||we(t,i,n)}let b={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class I extends ee{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: `+this.message}}class m{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class _e{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer "+e)}}class be{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(l.UNAUTHENTICATED))}shutdown(){}}class Ie{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class Te{constructor(e){this.t=e,this.currentUser=l.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,r){y(void 0===this.o,42304);let n=this.i,i=e=>this.i!==n?(n=this.i,r(e)):Promise.resolve(),s=new m,a=(this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new m,t.enqueueRetryable(()=>i(this.currentUser))},()=>{let e=s;t.enqueueRetryable(async()=>{await e.promise,await i(this.currentUser)})}),o=e=>{g("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(e=>o(e)),setTimeout(()=>{var e;this.auth||((e=this.t.getImmediate({optional:!0}))?o(e):(g("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new m))},0),a()}getToken(){let t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then(e=>this.i!==t?(g("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(y("string"==typeof e.accessToken,31837,{l:e}),new _e(e.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(){var e=this.auth&&this.auth.getUid();return y(null===e||"string"==typeof e,2055,{h:e}),new l(e)}}class Ee{constructor(e,t,r){this.P=e,this.T=t,this.I=r,this.type="FirstParty",this.user=l.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);var e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class Se{constructor(e,t,r){this.P=e,this.T=t,this.I=r}getToken(){return Promise.resolve(new Ee(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(l.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class xe{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&0<e.length&&this.headers.set("x-firebase-appcheck",this.value)}}class Ae{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Hd._isFirebaseServerApp(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(t,r){y(void 0===this.o,3512);let n=e=>{null!=e.error&&g("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: "+e.error.message);var t=e.token!==this.m;return this.m=e.token,g("FirebaseAppCheckTokenProvider",`Received ${t?"new":"existing"} token.`),t?r(e.token):Promise.resolve()},i=(this.o=e=>{t.enqueueRetryable(()=>n(e))},e=>{g("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)});this.V.onInit(e=>i(e)),setTimeout(()=>{var e;this.appCheck||((e=this.V.getImmediate({optional:!0}))?i(e):g("FirebaseAppCheckTokenProvider","AppCheck not yet detected"))},0)}getToken(){var e;return this.p?Promise.resolve(new xe(this.p)):(e=this.forceRefresh,this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(y("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new xe(e.token)):null):Promise.resolve(null))}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}class Ce{static newId(){var t=62*Math.floor(256/62);let r="";for(;r.length<20;){var n=(t=>{var r="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(r&&"function"==typeof r.getRandomValues)r.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n})(40);for(let e=0;e<n.length;++e)r.length<20&&n[e]<t&&(r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[e]%62))}return r}}function S(e,t){return e<t?-1:t<e?1:0}function De(r,n){let e=Math.min(r.length,n.length);for(let i=0;i<e;i++){let e=r.charAt(i),t=n.charAt(i);if(e!==t)return Re(e)===Re(t)?S(e,t):Re(e)?1:-1}return S(r.length,n.length)}let Ne=55296,ke=57343;function Re(e){var t=e.charCodeAt(0);return t>=Ne&&t<=ke}function Oe(e,r,n){return e.length===r.length&&e.every((e,t)=>n(e,r[t]))}function Me(e){return e+"\0"}let Ve="__name__";class Le{constructor(e,t,r){void 0===t?t=0:t>e.length&&E(637,{offset:t,range:e.length}),void 0===r?r=e.length-t:r>e.length-t&&E(1746,{length:r,range:e.length-t}),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return 0===Le.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof Le?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return this.construct(this.segments,this.offset+(e=void 0===e?1:e),this.length-e)}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(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,r){let e=Math.min(t.length,r.length);for(let n=0;n<e;n++){let e=Le.compareSegments(t.get(n),r.get(n));if(0!==e)return e}return S(t.length,r.length)}static compareSegments(e,t){var r=Le.isNumericId(e),n=Le.isNumericId(t);return r&&!n?-1:!r&&n?1:r&&n?Le.extractNumericId(e).compare(Le.extractNumericId(t)):De(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return oe.fromString(e.substring(4,e.length-2))}}class T extends Le{construct(e,t,r){return new T(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){var t,r=[];for(t of e){if(0<=t.indexOf("//"))throw new I(b.INVALID_ARGUMENT,`Invalid segment (${t}). Paths must not contain // in them.`);r.push(...t.split("/").filter(e=>0<e.length))}return new T(r)}static emptyPath(){return new T([])}}let Fe=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class h extends Le{construct(e,t,r){return new h(e,t,r)}static isValidIdentifier(e){return Fe.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),e=h.isValidIdentifier(e)?e:"`"+e+"`")).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Ve}static keyField(){return new h([Ve])}static fromServerFormat(t){let e=[],r="",n=0;var i=()=>{if(0===r.length)throw new I(b.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(r),r=""};let s=!1;for(;n<t.length;){let e=t[n];if("\\"===e){if(n+1===t.length)throw new I(b.INVALID_ARGUMENT,"Path has trailing escape character: "+t);let e=t[n+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new I(b.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);r+=e,n+=2}else"`"===e?s=!s:"."!==e||s?r+=e:i(),n++}if(i(),s)throw new I(b.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new h(e)}static emptyPath(){return new h([])}}class x{constructor(e){this.path=e}static fromPath(e){return new x(T.fromString(e))}static fromName(e){return new x(T.fromString(e).popFirst(5))}static empty(){return new x(T.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return 2<=this.path.length&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===T.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return T.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new x(new T(e.slice()))}}function Pe(e,t,r){if(!r)throw new I(b.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Ue(e,t,r,n){if(!0===t&&!0===n)throw new I(b.INVALID_ARGUMENT,e+` and ${r} cannot be used together.`)}function Be(e){if(!x.isDocumentKey(e))throw new I(b.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function qe(e){if(x.isDocumentKey(e))throw new I(b.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function je(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function ze(e){var t,r;return void 0===e?"undefined":null===e?"null":"string"==typeof e?(20<e.length&&(e=e.substring(0,20)+"..."),JSON.stringify(e)):"number"==typeof e||"boolean"==typeof e?""+e:"object"==typeof e?e instanceof Array?"an array":(t=(r=e).constructor?r.constructor.name:null)?`a custom ${t} object`:"an object":"function"==typeof e?"a function":E(12329,{type:typeof e})}function p(e,t){if((e="_delegate"in e?e._delegate:e)instanceof t)return e;if(t.name===e.constructor.name)throw new I(b.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var r=ze(e);throw new I(b.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: `+r)}function Ke(e,t){if(t<=0)throw new I(b.INVALID_ARGUMENT,`Function ${e}() requires a positive number, but it was: ${t}.`)}function t(e,t){var r={typeString:e};return t&&(r.value=t),r}function Ge(e,t){if(!je(e))throw new I(b.INVALID_ARGUMENT,"JSON must be an object");let r;for(var n in t)if(t[n]){var i=t[n].typeString,s="value"in t[n]?{value:t[n].value}:void 0;if(!(n in e)){r=`JSON missing required field: '${n}'`;break}var a=e[n];if(i&&typeof a!==i){r=`JSON field '${n}' must be a ${i}.`;break}if(void 0!==s&&a!==s.value){r=`Expected '${n}' field to equal '${s.value}'`;break}}if(r)throw new I(b.INVALID_ARGUMENT,r);return 1}let $e=-62135596800;class v{static now(){return v.fromMillis(Date.now())}static fromDate(e){return v.fromMillis(e.getTime())}static fromMillis(e){var t=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*t));return new v(t,r)}constructor(e,t){if(this.seconds=e,(this.nanoseconds=t)<0)throw new I(b.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(1e9<=t)throw new I(b.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<$e)throw new I(b.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(253402300800<=e)throw new I(b.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?S(this.nanoseconds,e.nanoseconds):S(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:v._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Ge(e,v._jsonSchema))return new v(e.seconds,e.nanoseconds)}valueOf(){var e=this.seconds-$e;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}v._jsonSchemaVersion="firestore/timestamp/1.0",v._jsonSchema={type:t("string",v._jsonSchemaVersion),seconds:t("number"),nanoseconds:t("number")};class w{static fromTimestamp(e){return new w(e)}static min(){return new w(new v(0,0))}static max(){return new w(new v(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}let Qe=-1;class He{constructor(e,t,r,n){this.indexId=e,this.collectionGroup=t,this.fields=r,this.indexState=n}}function We(e){return e.fields.find(e=>2===e.kind)}function Ye(e){return e.fields.filter(e=>2!==e.kind)}He.UNKNOWN_ID=-1;class Je{constructor(e,t){this.fieldPath=e,this.kind=t}}class Xe{constructor(e,t){this.sequenceNumber=e,this.offset=t}static empty(){return new Xe(0,tt.min())}}function Ze(e,t){var r=e.toTimestamp().seconds,n=e.toTimestamp().nanoseconds+1,r=w.fromTimestamp(1e9===n?new v(r+1,0):new v(r,n));return new tt(r,x.empty(),t)}function et(e){return new tt(e.readTime,e.key,Qe)}class tt{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new tt(w.min(),x.empty(),Qe)}static max(){return new tt(w.max(),x.empty(),Qe)}}function rt(e,t){var r=e.readTime.compareTo(t.readTime);return 0!==r||0!==(r=x.comparator(e.documentKey,t.documentKey))?r:S(e.largestBatchId,t.largestBatchId)}let nt="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class it{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function st(e){if(e.code!==b.FAILED_PRECONDITION||e.message!==nt)throw e;g("LocalStore","Unexpectedly lost primary lease")}class A{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(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(e){return this.next(void 0,e)}next(n,i){return this.callbackAttached&&E(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(i,this.error):this.wrapSuccess(n,this.result):new A((t,r)=>{this.nextCallback=e=>{this.wrapSuccess(n,e).next(t,r)},this.catchCallback=e=>{this.wrapFailure(i,e).next(t,r)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{var t=e();return t instanceof A?t:A.resolve(t)}catch(e){return A.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):A.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):A.reject(t)}static resolve(r){return new A((e,t)=>{e(r)})}static reject(r){return new A((e,t)=>{t(r)})}static waitFor(e){return new A((t,r)=>{let n=0,i=0,s=!1;e.forEach(e=>{++n,e.next(()=>{++i,s&&i===n&&t()},e=>r(e))}),s=!0,i===n&&t()})}static or(e){let t=A.resolve(!1);for(let r of e)t=t.next(e=>e?A.resolve(e):r());return t}static forEach(e,r){let n=[];return e.forEach((e,t)=>{n.push(r.call(this,e,t))}),this.waitFor(n)}static mapArray(o,u){return new A((r,n)=>{let i=o.length,s=new Array(i),a=0;for(let e=0;e<i;e++){let t=e;u(o[t]).next(e=>{s[t]=e,++a===i&&r(s)},e=>n(e))}})}static doWhile(n,i){return new A((e,t)=>{let r=()=>{!0===n()?i().next(()=>{r()},t):e()};r()})}}let at="SimpleDb";class ot{static open(e,t,r,n){try{return new ot(t,e.transaction(n,r))}catch(e){throw new ct(t,e)}}constructor(r,e){this.action=r,this.transaction=e,this.aborted=!1,this.S=new m,this.transaction.oncomplete=()=>{this.S.resolve()},this.transaction.onabort=()=>{e.error?this.S.reject(new ct(r,e.error)):this.S.resolve()},this.transaction.onerror=e=>{var t=pt(e.target.error);this.S.reject(new ct(r,t))}}get D(){return this.S.promise}abort(e){e&&this.S.reject(e),this.aborted||(g(at,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}C(){var e=this.transaction;this.aborted||"function"!=typeof e.commit||e.commit()}store(e){var t=this.transaction.objectStore(e);return new ft(t)}}class ut{static delete(e){return g(at,"Removing database:",e),gt(G().indexedDB.deleteDatabase(e)).toPromise()}static v(){var e,t,r;return!(!(()=>{try{return"object"==typeof indexedDB}catch(e){}})()||!ut.F()&&(e=Y(),t=0<(t=ut.M(e))&&t<10,r=0<(r=lt(e))&&r<4.5,0<e.indexOf("MSIE ")||0<e.indexOf("Trident/")||0<e.indexOf("Edge/")||t||r))}static F(){return"undefined"!=typeof process&&"YES"===process.__PRIVATE_env?.__PRIVATE_USE_MOCK_PERSISTENCE}static O(e,t){return e.store(t)}static M(e){var t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),t=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(t)}constructor(e,t,r){this.name=e,this.version=t,this.N=r,this.B=null,12.2===ut.M(Y())&&d("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}async L(s){return this.db||(g(at,"Opening database:",this.name),this.db=await new Promise((r,n)=>{let i=indexedDB.open(this.name,this.version);i.onsuccess=e=>{var t=e.target.result;r(t)},i.onblocked=()=>{n(new ct(s,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=e=>{var t=e.target.error;"VersionError"===t.name?n(new I(b.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):"InvalidStateError"===t.name?n(new I(b.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+t)):n(new ct(s,t))},i.onupgradeneeded=e=>{g(at,'Database "'+this.name+'" requires upgrade from version:',e.oldVersion);var t=e.target.result;this.N.k(t,i.transaction,e.oldVersion,this.version).next(()=>{g(at,"Database upgrade to version "+this.version+" complete")})}})),this.q&&(this.db.onversionchange=e=>this.q(e)),this.db}K(t){this.q=t,this.db&&(this.db.onversionchange=e=>t(e))}async runTransaction(r,e,n,i){var s="readonly"===e;let a=0;for(;;){++a;try{this.db=await this.L(r);let t=ot.open(this.db,r,s?"readonly":"readwrite",n),e=i(t).next(e=>(t.C(),e)).catch(e=>(t.abort(e),A.reject(e))).toPromise();return e.catch(()=>{}),await t.D,e}catch(r){let e=r,t="FirebaseError"!==e.name&&a<3;if(g(at,"Transaction failed with error:",e.message,"Retrying:",t),this.close(),!t)return Promise.reject(e)}}}close(){this.db&&this.db.close(),this.db=void 0}}function lt(e){var t=e.match(/Android ([\d.]+)/i),t=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(t)}class ht{constructor(e){this.U=e,this.$=!1,this.W=null}get isDone(){return this.$}get G(){return this.W}set cursor(e){this.U=e}done(){this.$=!0}j(e){this.W=e}delete(){return gt(this.U.delete())}}class ct extends I{constructor(e,t){super(b.UNAVAILABLE,`IndexedDB transaction '${e}' failed: `+t),this.name="IndexedDbTransactionError"}}function dt(e){return"IndexedDbTransactionError"===e.name}class ft{constructor(e){this.store=e}put(e,t){let r;return gt(r=void 0!==t?(g(at,"PUT",this.store.name,e,t),this.store.put(t,e)):(g(at,"PUT",this.store.name,"<auto-key>",e),this.store.put(e)))}add(e){return g(at,"ADD",this.store.name,e,e),gt(this.store.add(e))}get(t){return gt(this.store.get(t)).next(e=>(void 0===e&&(e=null),g(at,"GET",this.store.name,t,e),e))}delete(e){return g(at,"DELETE",this.store.name,e),gt(this.store.delete(e))}count(){return g(at,"COUNT",this.store.name),gt(this.store.count())}J(e,t){var n=this.options(e,t),r=n.index?this.store.index(n.index):this.store;if("function"==typeof r.getAll){let e=r.getAll(n.range);return new A((t,r)=>{e.onerror=e=>{r(e.target.error)},e.onsuccess=e=>{t(e.target.result)}})}{let e=this.cursor(n),r=[];return this.H(e,(e,t)=>{r.push(t)}).next(()=>r)}}Z(e,t){let n=this.store.getAll(e,null===t?void 0:t);return new A((t,r)=>{n.onerror=e=>{r(e.target.error)},n.onsuccess=e=>{t(e.target.result)}})}X(e,t){g(at,"DELETE ALL",this.store.name);var r=this.options(e,t),r=(r.Y=!1,this.cursor(r));return this.H(r,(e,t,r)=>r.delete())}ee(e,t){let r;t?r=e:(r={},t=e);var n=this.cursor(r);return this.H(n,t)}te(i){let e=this.cursor({});return new A((r,n)=>{e.onerror=e=>{var t=pt(e.target.error);n(t)},e.onsuccess=e=>{let t=e.target.result;t?i(t.primaryKey,t.value).next(e=>{e?t.continue():r()}):r()}})}H(e,s){let a=[];return new A((i,t)=>{e.onerror=e=>{t(e.target.error)},e.onsuccess=e=>{var n=e.target.result;if(n){let t=new ht(n),r=s(n.primaryKey,n.value,t);if(r instanceof A){let e=r.catch(e=>(t.done(),A.reject(e)));a.push(e)}t.isDone?i():null===t.G?n.continue():n.continue(t.G)}else i()}}).next(()=>A.waitFor(a))}options(e,t){let r;return void 0!==e&&("string"==typeof e?r=e:t=e),{index:r,range:t}}cursor(e){let t="next";var r;return e.reverse&&(t="prev"),e.index?(r=this.store.index(e.index),e.Y?r.openKeyCursor(e.range,t):r.openCursor(e.range,t)):this.store.openCursor(e.range,t)}}function gt(e){return new A((r,n)=>{e.onsuccess=e=>{var t=e.target.result;r(t)},e.onerror=e=>{var t=pt(e.target.error);n(t)}})}let mt=!1;function pt(e){let t=ut.M(Y());if(12.2<=t&&t<13){let t="An internal error was encountered in the Indexed Database server";if(0<=e.message.indexOf(t)){let e=new I("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${t}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return mt||(mt=!0,setTimeout(()=>{throw e},0)),e}}return e}let yt="IndexBackfiller";class vt{constructor(e,t){this.asyncQueue=e,this.ne=t,this.task=null}start(){this.re(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return null!==this.task}re(e){g(yt,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,async()=>{this.task=null;try{var e=await this.ne.ie();g(yt,"Documents written: "+e)}catch(e){dt(e)?g(yt,"Ignoring IndexedDB error during index backfill: ",e):await st(e)}await this.re(6e4)})}}class wt{constructor(e,t){this.localStore=e,this.persistence=t}async ie(t=50){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",e=>this.se(e,t))}se(e,t){let r=new Set,n=t,i=!0;return A.doWhile(()=>!0===i&&0<n,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(t=>{if(null!==t&&!r.has(t))return g(yt,"Processing collection: "+t),this.oe(e,t,n).next(e=>{n-=e,r.add(t)});i=!1})).next(()=>t-n)}oe(n,i,e){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(n,i).next(r=>this.localStore.localDocuments.getNextDocuments(n,i,r,e).next(e=>{let t=e.changes;return this.localStore.indexManager.updateIndexEntries(n,t).next(()=>this._e(r,e)).next(e=>(g(yt,"Updating offset: "+e),this.localStore.indexManager.updateCollectionGroup(n,i,e))).next(()=>t.size)}))}_e(e,t){let n=e;return t.changes.forEach((e,t)=>{var r=et(t);0<rt(r,n)&&(n=r)}),new tt(n.readTime,n.documentKey,Math.max(t.batchId,e.largestBatchId))}}class _t{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){var e=++this.previousValue;return this.ue&&this.ue(e),e}}let bt=_t.ce=-1;function It(e){return null==e}function Tt(e){return 0===e&&1/e==-1/0}function Et(e){return"number"==typeof e&&Number.isInteger(e)&&!Tt(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}let St="";function xt(e){let t="";for(let r=0;r<e.length;r++)0<t.length&&(t=At(t)),t=((t,e)=>{let r=e,n=t.length;for(let i=0;i<n;i++){let e=t.charAt(i);switch(e){case"\0":r+="";break;case St:r+="";break;default:r+=e}}return r})(e.get(r),t);return At(t)}function At(e){return e+St+""}function Ct(r){let e=r.length;if(y(2<=e,64408,{path:r}),2===e)return y(r.charAt(0)===St&&""===r.charAt(1),56145,{path:r}),T.emptyPath();var __PRIVATE_lastReasonableEscapeIndex=e-2,n=[];let i="";for(let a=0;a<e;){let t=r.indexOf(St,a);switch((t<0||t>__PRIVATE_lastReasonableEscapeIndex)&&E(50515,{path:r}),r.charAt(t+1)){case"":var s=r.substring(a,t);let e;0===i.length?e=s:(i+=s,e=i,i=""),n.push(e);break;case"":i=i+r.substring(a,t)+"\0";break;case"":i+=r.substring(a,t+1);break;default:E(61167,{path:r})}a=t+2}return new T(n)}let Dt="remoteDocuments",Nt="owner",kt="owner",Rt="mutationQueues",Ot="mutations",Mt="batchId",Vt="userMutationsIndex",Lt=["userId","batchId"];function Ft(e,t){return[e,xt(t)]}function Pt(e,t,r){return[e,xt(t),r]}let Ut={},Bt="documentMutations",qt="remoteDocumentsV14",jt=["prefixPath","collectionGroup","readTime","documentId"],zt="documentKeyIndex",Kt=["prefixPath","collectionGroup","documentId"],Gt="collectionGroupIndex",$t=["collectionGroup","readTime","prefixPath","documentId"],Qt="remoteDocumentGlobal",Ht="remoteDocumentGlobalKey",Wt="targets",Yt="queryTargetsIndex",Jt=["canonicalId","targetId"],Xt="targetDocuments",Zt=["targetId","path"],er="documentTargetsIndex",tr=["path","targetId"],rr="targetGlobalKey",nr="targetGlobal",ir="collectionParents",sr=["collectionId","parent"],mr="clientMetadata",pr="bundles",yr="namedQueries",vr="indexConfiguration",wr="collectionGroupIndex",_r="indexState",br=["indexId","uid"],Ir="sequenceNumberIndex",Tr=["uid","sequenceNumber"],Er="indexEntries",Sr=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],xr="documentKeyIndex",Ar=["indexId","uid","orderedDocumentKey"],Cr="documentOverlays",Dr=["userId","collectionPath","documentId"],Nr="collectionPathOverlayIndex",kr=["userId","collectionPath","largestBatchId"],Rr="collectionGroupOverlayIndex",Or=["userId","collectionGroup","largestBatchId"],Mr="globals",Vr=[Rt,Ot,Bt,Dt,Wt,Nt,nr,Xt,mr,Qt,ir,pr,yr],Lr=[...Vr,Cr],Fr=[Rt,Ot,Bt,qt,Wt,Nt,nr,Xt,mr,Qt,ir,pr,yr,Cr],Pr=Fr,Ur=[...Pr,vr,_r,Er],Br=Ur,qr=[...Ur,Mr],jr=qr;class zr extends it{constructor(e,t){super(),this.le=e,this.currentSequenceNumber=t}}function r(e,t){var r=e;return ut.O(r.le,t)}function Kr(e){let t=0;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function Gr(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(r,e[r])}function $r(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class C{constructor(e,t){this.comparator=e,this.root=t||Hr.EMPTY}insert(e,t){return new C(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Hr.BLACK,null,null))}remove(e){return new C(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Hr.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){var r=this.comparator(e,t.key);if(0===r)return t.value;r<0?t=t.left:0<r&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){var n=this.comparator(e,r.key);if(0===n)return t+r.left.size;r=n<0?r.left:(t+=r.left.size+1,r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(r){this.inorderTraversal((e,t)=>(r(e,t),!1))}toString(){let r=[];return this.inorderTraversal((e,t)=>(r.push(e+":"+t),!1)),`{${r.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Qr(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Qr(this.root,e,this.comparator,!1)}getReverseIterator(){return new Qr(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Qr(this.root,e,this.comparator,!0)}}class Qr{constructor(e,t,r,n){this.isReverse=n,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?r(e.key,t):1,t&&n&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(0===i){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();var t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return 0<this.nodeStack.length}peek(){var e;return 0===this.nodeStack.length?null:{key:(e=this.nodeStack[this.nodeStack.length-1]).key,value:e.value}}}class Hr{constructor(e,t,r,n,i){this.key=e,this.value=t,this.color=null!=r?r:Hr.RED,this.left=null!=n?n:Hr.EMPTY,this.right=null!=i?i:Hr.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,n,i){return new Hr(null!=e?e:this.key,null!=t?t:this.value,null!=r?r:this.color,null!=n?n:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}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(e,t,r){var n=this,i=r(e,n.key);return(n=i<0?n.copy(null,null,null,n.left.insert(e,t,r),null):0===i?n.copy(null,t,null,null,null):n.copy(null,null,null,null,n.right.insert(e,t,r))).fixUp()}removeMin(){if(this.left.isEmpty())return Hr.EMPTY;let e=this;return(e=(e=e.left.isRed()||e.left.left.isRed()?e:e.moveRedLeft()).copy(null,null,null,e.left.removeMin(),null)).fixUp()}remove(e,t){let r,n=this;if(t(e,n.key)<0)n=(n=n.left.isEmpty()||n.left.isRed()||n.left.left.isRed()?n:n.moveRedLeft()).copy(null,null,null,n.left.remove(e,t),null);else{if(0===t(e,(n=(n=n.left.isRed()?n.rotateRight():n).right.isEmpty()||n.right.isRed()||n.right.left.isRed()?n:n.moveRedRight()).key)){if(n.right.isEmpty())return Hr.EMPTY;r=n.right.min(),n=n.copy(r.key,r.value,null,null,n.right.removeMin())}n=n.copy(null,null,null,null,n.right.remove(e,t))}return n.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e=(e=(e=e.right.isRed()&&!e.left.isRed()?e.rotateLeft():e).left.isRed()&&e.left.left.isRed()?e.rotateRight():e).left.isRed()&&e.right.isRed()?e.colorFlip():e}moveRedLeft(){let e=this.colorFlip();return e=e.right.left.isRed()?(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip():e}moveRedRight(){let e=this.colorFlip();return e=e.left.left.isRed()?(e=e.rotateRight()).colorFlip():e}rotateLeft(){var e=this.copy(null,null,Hr.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){var e=this.copy(null,null,Hr.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){var e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){var e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw E(43730,{key:this.key,value:this.value});if(this.right.isRed())throw E(14113,{key:this.key,value:this.value});var e=this.left.check();if(e!==this.right.check())throw E(27949);return e+(this.isRed()?0:1)}}Hr.EMPTY=null,Hr.RED=!0,Hr.BLACK=!1,Hr.EMPTY=new class{constructor(){this.size=0}get key(){throw E(57766)}get value(){throw E(16141)}get color(){throw E(16727)}get left(){throw E(29726)}get right(){throw E(36894)}copy(e,t,r,n,i){return this}insert(e,t,r){return new Hr(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class D{constructor(e){this.comparator=e,this.data=new C(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(r){this.data.inorderTraversal((e,t)=>(r(e),!1))}forEachInRange(e,t){for(var r=this.data.getIteratorFrom(e[0]);r.hasNext();){var n=r.getNext();if(0<=this.comparator(n.key,e[1]))return;t(n.key)}}forEachWhile(e,t){for(var r=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){var t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Wr(this.data.getIterator())}getIteratorFrom(e){return new Wr(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof D))return!1;if(this.size!==e.size)return!1;for(var r=this.data.getIterator(),n=e.data.getIterator();r.hasNext();){let e=r.getNext().key,t=n.getNext().key;if(0!==this.comparator(e,t))return!1}return!0}toArray(){let t=[];return this.forEach(e=>{t.push(e)}),t}toString(){let t=[];return this.forEach(e=>t.push(e)),"SortedSet("+t.toString()+")"}copy(e){var t=new D(this.comparator);return t.data=e,t}}class Wr{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}function Yr(e){return e.hasNext()?e.getNext():void 0}class Jr{constructor(e){(this.fields=e).sort(h.comparator)}static empty(){return new Jr([])}unionWith(e){let t=new D(h.comparator);for(let e of this.fields)t=t.add(e);for(var r of e)t=t.add(r);return new Jr(t.toArray())}covers(e){for(var t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Oe(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class Xr extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class N{constructor(e){this.binaryString=e}static fromBase64String(e){var t=(e=>{try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Xr("Invalid base64 string: "+e):e}})(e);return new N(t)}static fromUint8Array(e){var t=(e=>{let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t})(e);return new N(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){var e=this.binaryString,t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return S(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}N.EMPTY_BYTE_STRING=new N("");let Zr=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function en(t){if(y(!!t,39018),"string"!=typeof t)return{seconds:k(t.seconds),nanos:k(t.nanos)};{let e=0;var r=Zr.exec(t),r=(y(!!r,46558,{timestamp:t}),r[1]&&(r=((r=r[1])+"000000000").substr(0,9),e=Number(r)),new Date(t));return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}}function k(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function tn(e){return"string"==typeof e?N.fromBase64String(e):N.fromUint8Array(e)}let rn="server_timestamp",nn="__type__",sn="__previous_value__",an="__local_write_time__";function on(e){return(e?.mapValue?.fields||{})[nn]?.stringValue===rn}function un(e){var t=e.mapValue.fields[sn];return on(t)?un(t):t}function ln(e){var t=en(e.mapValue.fields[an].timestampValue);return new v(t.seconds,t.nanos)}class hn{constructor(e,t,r,n,i,s,a,o,u,l,h){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=n,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=u,this.isUsingEmulator=l,this.apiKey=h}}let cn="(default)";class dn{constructor(e,t){this.projectId=e,this.database=t||cn}static empty(){return new dn("","")}get isDefaultDatabase(){return this.database===cn}isEqual(e){return e instanceof dn&&e.projectId===this.projectId&&e.database===this.database}}let fn="__type__",gn="__max__",mn={mapValue:{fields:{__type__:{stringValue:gn}}}},pn="__vector__",yn="value",vn={nullValue:"NULL_VALUE"};function wn(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?on(e)?4:Mn(e)?9007199254740991:Rn(e)?10:11:E(28295,{value:e})}function _n(t,r){if(t===r)return!0;var n,i,s,a,o,e=wn(t);if(e!==wn(r))return!1;switch(e){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===r.booleanValue;case 4:return ln(t).isEqual(ln(r));case 3:return s=r,"string"==typeof(i=t).timestampValue&&"string"==typeof s.timestampValue&&i.timestampValue.length===s.timestampValue.length?i.timestampValue===s.timestampValue:(a=en(i.timestampValue),o=en(s.timestampValue),a.seconds===o.seconds&&a.nanos===o.nanos);case 5:return t.stringValue===r.stringValue;case 6:return i=r,tn(t.bytesValue).isEqual(tn(i.bytesValue));case 7:return t.referenceValue===r.referenceValue;case 8:return s=r,k((n=t).geoPointValue.latitude)===k(s.geoPointValue.latitude)&&k(n.geoPointValue.longitude)===k(s.geoPointValue.longitude);case 2:return n=r,"integerValue"in(l=t)&&"integerValue"in n?k(l.integerValue)===k(n.integerValue):"doubleValue"in l&&"doubleValue"in n&&((a=k(l.doubleValue))===(o=k(n.doubleValue))?Tt(a)===Tt(o):isNaN(a)&&isNaN(o));case 9:return Oe(t.arrayValue.values||[],r.arrayValue.values||[],_n);case 10:case 11:var u=t,l=r,h=u.mapValue.fields||{},c=l.mapValue.fields||{};if(Kr(h)!==Kr(c))return!1;for(let e in h)if(h.hasOwnProperty(e)&&(void 0===c[e]||!_n(h[e],c[e])))return!1;return!0;default:return E(52216,{left:t})}}function bn(e,t){return void 0!==(e.values||[]).find(e=>_n(e,t))}function In(e,n){if(e===n)return 0;var i,s,a,o,u,l,h,c,d=wn(e),t=wn(n);if(d!==t)return S(d,t);switch(d){case 0:case 9007199254740991:return 0;case 1:return S(e.booleanValue,n.booleanValue);case 2:return l=n,h=k((u=e).integerValue||u.doubleValue),c=k(l.integerValue||l.doubleValue),h<c?-1:c<h?1:h===c?0:isNaN(h)?isNaN(c)?0:-1:1;case 3:return Tn(e.timestampValue,n.timestampValue);case 4:return Tn(ln(e),ln(n));case 5:return De(e.stringValue,n.stringValue);case 6:return u=e.bytesValue,l=n.bytesValue,h=tn(u),c=tn(l),h.compareTo(c);case 7:var f=e.referenceValue,g=n.referenceValue,m=f.split("/"),p=g.split("/");for(let t=0;t<m.length&&t<p.length;t++){let e=S(m[t],p[t]);if(0!==e)return e}return S(m.length,p.length);case 8:return f=e.geoPointValue,g=n.geoPointValue,0!==(o=S(k(f.latitude),k(g.latitude)))?o:S(k(f.longitude),k(g.longitude));case 9:return En(e.arrayValue,n.arrayValue);case 10:return y=e.mapValue,i=n.mapValue,o=y.fields||{},s=i.fields||{},o=o[yn]?.arrayValue,s=s[yn]?.arrayValue,0!==(a=S(o?.values?.length||0,s?.values?.length||0))?a:En(o,s);case 11:var y=e.mapValue,v=n.mapValue;if(y===mn.mapValue&&v===mn.mapValue)return 0;if(y===mn.mapValue)return 1;if(v===mn.mapValue)return-1;var w=y.fields||{},_=Object.keys(w),b=v.fields||{},I=Object.keys(b);_.sort(),I.sort();for(let r=0;r<_.length&&r<I.length;++r){let e=De(_[r],I[r]);if(0!==e)return e;var T=In(w[_[r]],b[I[r]]);if(0!==T)return T}return S(_.length,I.length);default:throw E(23264,{he:d})}}function Tn(e,t){var r,n,i;return"string"==typeof e&&"string"==typeof t&&e.length===t.length?S(e,t):(r=en(e),n=en(t),0!==(i=S(r.seconds,n.seconds))?i:S(r.nanos,n.nanos))}function En(e,t){var r=e.values||[],n=t.values||[];for(let i=0;i<r.length&&i<n.length;++i){let e=In(r[i],n[i]);if(e)return e}return S(r.length,n.length)}function Sn(e){return function s(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?(e=>{let t=en(e);return`time(${t.seconds},${t.nanos})`})(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?(e=>tn(e).toBase64())(e.bytesValue):"referenceValue"in e?(e=>x.fromName(e).toString())(e.referenceValue):"geoPointValue"in e?(e=>`geo(${e.latitude},${e.longitude})`)(e.geoPointValue):"arrayValue"in e?(e=>{let t="[",r=!0;for(var n of e.values||[])r?r=!1:t+=",",t+=s(n);return t+"]"})(e.arrayValue):"mapValue"in e?(e=>{let t=Object.keys(e.fields||{}).sort(),r="{",n=!0;for(var i of t)n?n=!1:r+=",",r+=i+":"+s(e.fields[i]);return r+"}"})(e.mapValue):E(61005,{value:e})}(e)}function xn(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/`+t.path.canonicalString()}}function An(e){return!!e&&"integerValue"in e}function Cn(e){return!!e&&"arrayValue"in e}function Dn(e){return e&&"nullValue"in e}function Nn(e){return e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function kn(e){return e&&"mapValue"in e}function Rn(e){return(e?.mapValue?.fields||{})[fn]?.stringValue===pn}function On(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:{...t.timestampValue}};if(t.mapValue){let r={mapValue:{fields:{}}};return Gr(t.mapValue.fields,(e,t)=>r.mapValue.fields[e]=On(t)),r}if(t.arrayValue){var r={arrayValue:{values:[]}};for(let e=0;e<(t.arrayValue.values||[]).length;++e)r.arrayValue.values[e]=On(t.arrayValue.values[e]);return r}return{...t}}function Mn(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===gn}let Vn={mapValue:{fields:{[fn]:{stringValue:pn},[yn]:{arrayValue:{}}}}};function Ln(e,t){var r=In(e.value,t.value);return 0!==r?r:e.inclusive&&!t.inclusive?-1:!e.inclusive&&t.inclusive?1:0}function Fn(e,t){var r=In(e.value,t.value);return 0!==r?r:e.inclusive&&!t.inclusive?1:!e.inclusive&&t.inclusive?-1:0}class Pn{constructor(e){this.value=e}static empty(){return new Pn({mapValue:{}})}field(r){if(r.isEmpty())return this.value;{let e=this.value;for(let t=0;t<r.length-1;++t)if(!kn(e=(e.mapValue.fields||{})[r.get(t)]))return null;return(e=(e.mapValue.fields||{})[r.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=On(t)}setAll(e){let r=h.emptyPath(),n={},i=[];e.forEach((e,t)=>{if(!r.isImmediateParentOf(t)){let e=this.getFieldsMap(r);this.applyChanges(e,n,i),n={},i=[],r=t.popLast()}e?n[t.lastSegment()]=On(e):i.push(t.lastSegment())});var t=this.getFieldsMap(r);this.applyChanges(t,n,i)}delete(e){var t=this.field(e.popLast());kn(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return _n(this.value,e.value)}getFieldsMap(t){let r=this.value;r.mapValue.fields||(r.mapValue={fields:{}});for(let n=0;n<t.length;++n){let e=r.mapValue.fields[t.get(n)];kn(e)&&e.mapValue.fields||(e={mapValue:{fields:{}}},r.mapValue.fields[t.get(n)]=e),r=e}return r.mapValue.fields}applyChanges(r,e,t){Gr(e,(e,t)=>r[e]=t);for(let e of t)delete r[e]}clone(){return new Pn(On(this.value))}}class R{constructor(e,t,r,n,i,s,a){this.key=e,this.documentType=t,this.version=r,this.readTime=n,this.createTime=i,this.data=s,this.documentState=a}static newInvalidDocument(e){return new R(e,0,w.min(),w.min(),w.min(),Pn.empty(),0)}static newFoundDocument(e,t,r,n){return new R(e,1,t,w.min(),r,n,0)}static newNoDocument(e,t){return new R(e,2,t,w.min(),w.min(),Pn.empty(),0)}static newUnknownDocument(e,t){return new R(e,3,t,w.min(),w.min(),Pn.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(w.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Pn.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Pn.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=w.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof R&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new R(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class Un{constructor(e,t){this.position=e,this.inclusive=t}}function Bn(e,t,r){let n=0;for(let a=0;a<e.position.length;a++){var i=t[a],s=e.position[a];if(n=i.field.isKeyField()?x.comparator(x.fromName(s.referenceValue),r.key):In(s,r.data.field(i.field)),"desc"===i.dir&&(n*=-1),0!==n)break}return n}function qn(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let r=0;r<e.position.length;r++)if(!_n(e.position[r],t.position[r]))return!1;return!0}class jn{constructor(e,t="asc"){this.field=e,this.dir=t}}class zn{}class O extends zn{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,r):new Yn(e,t,r):"array-contains"===t?new ei(e,r):"in"===t?new ti(e,r):"not-in"===t?new ri(e,r):"array-contains-any"===t?new ni(e,r):new O(e,t,r)}static createKeyFieldInFilter(e,t,r){return new("in"===t?Jn:Xn)(e,r)}matches(e){var t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(In(t,this.value)):null!==t&&wn(this.value)===wn(t)&&this.matchesComparison(In(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return 0<e;case">=":return 0<=e;default:return E(47266,{operator:this.op})}}isInequality(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class M extends zn{constructor(e,t){super(),this.filters=e,this.op=t,this.Pe=null}static create(e,t){return new M(e,t)}matches(t){return Kn(this)?void 0===this.filters.find(e=>!e.matches(t)):void 0!==this.filters.find(e=>e.matches(t))}getFlattenedFilters(){return null===this.Pe&&(this.Pe=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function Kn(e){return"and"===e.op}function Gn(e){return"or"===e.op}function $n(e){return Qn(e)&&Kn(e)}function Qn(e){for(var t of e.filters)if(t instanceof M)return!1;return!0}function Hn(e,t){var r=e.filters.concat(t);return M.create(r,e.op)}function Wn(e){return e instanceof O?`${(t=e).field.canonicalString()} ${t.op} `+Sn(t.value):e instanceof M?(t=e).op.toString()+" {"+t.getFilters().map(Wn).join(" ,")+"}":"Filter";var t}class Yn extends O{constructor(e,t,r){super(e,t,r),this.key=x.fromName(r.referenceValue)}matches(e){var t=x.comparator(e.key,this.key);return this.matchesComparison(t)}}class Jn extends O{constructor(e,t){super(e,"in",t),this.keys=Zn(0,t)}matches(t){return this.keys.some(e=>e.isEqual(t.key))}}class Xn extends O{constructor(e,t){super(e,"not-in",t),this.keys=Zn(0,t)}matches(t){return!this.keys.some(e=>e.isEqual(t.key))}}function Zn(e,t){return(t.arrayValue?.values||[]).map(e=>x.fromName(e.referenceValue))}class ei extends O{constructor(e,t){super(e,"array-contains",t)}matches(e){var t=e.data.field(this.field);return Cn(t)&&bn(t.arrayValue,this.value)}}class ti extends O{constructor(e,t){super(e,"in",t)}matches(e){var t=e.data.field(this.field);return null!==t&&bn(this.value.arrayValue,t)}}class ri extends O{constructor(e,t){super(e,"not-in",t)}matches(e){var t;return!bn(this.value.arrayValue,{nullValue:"NULL_VALUE"})&&null!==(t=e.data.field(this.field))&&void 0===t.nullValue&&!bn(this.value.arrayValue,t)}}class ni extends O{constructor(e,t){super(e,"array-contains-any",t)}matches(e){var t=e.data.field(this.field);return!(!Cn(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>bn(this.value.arrayValue,e))}}class ii{constructor(e,t=null,r=[],n=[],i=null,s=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=n,this.limit=i,this.startAt=s,this.endAt=a,this.Te=null}}function si(e,t=null,r=[],n=[],i=null,s=null,a=null){return new ii(e,t,r,n,i,s,a)}function ai(e){var t=e;if(null===t.Te){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e=(e=(e+="|f:")+t.filters.map(e=>function t(e){var r;return e instanceof O?e.field.canonicalString()+e.op.toString()+Sn(e.value):$n(e)?e.filters.map(e=>t(e)).join(","):(r=e.filters.map(e=>t(e)).join(","),e.op+`(${r})`)}(e)).join(",")+"|ob:")+t.orderBy.map(e=>(e=e).field.canonicalString()+e.dir).join(","),It(t.limit)||(e=(e+="|l:")+t.limit),t.startAt&&(e=(e=(e+="|lb:")+(t.startAt.inclusive?"b:":"a:"))+t.startAt.position.map(e=>Sn(e)).join(",")),t.endAt&&(e=(e=(e+="|ub:")+(t.endAt.inclusive?"a:":"b:"))+t.endAt.position.map(e=>Sn(e)).join(",")),t.Te=e}return t.Te}function oi(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let i=0;i<e.orderBy.length;i++)if(r=e.orderBy[i],n=t.orderBy[i],r.dir!==n.dir||!r.field.isEqual(n.field))return!1;var r,n;if(e.filters.length!==t.filters.length)return!1;for(let s=0;s<e.filters.length;s++)if(!function n(e,t){return e instanceof O?(r=e,(s=t)instanceof O&&r.op===s.op&&r.field.isEqual(s.field)&&_n(r.value,s.value)):e instanceof M?(r=e,(i=t)instanceof M&&r.op===i.op&&r.filters.length===i.filters.length&&r.filters.reduce((e,t,r)=>e&&n(t,i.filters[r]),!0)):void E(19439);var i,r,s}(e.filters[s],t.filters[s]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!qn(e.startAt,t.startAt)&&qn(e.endAt,t.endAt)}function ui(e){return x.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}function li(e,t){return e.filters.filter(e=>e instanceof O&&e.field.isEqual(t))}function hi(e,r,n){let i=vn,s=!0;for(let n of li(e,r)){let e=vn,t=!0;switch(n.op){case"<":case"<=":e="nullValue"in(a=n.value)?vn:"booleanValue"in a?{booleanValue:!1}:"integerValue"in a||"doubleValue"in a?{doubleValue:NaN}:"timestampValue"in a?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in a?{stringValue:""}:"bytesValue"in a?{bytesValue:""}:"referenceValue"in a?xn(dn.empty(),x.empty()):"geoPointValue"in a?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in a?{arrayValue:{}}:"mapValue"in a?Rn(a)?Vn:{mapValue:{}}:E(35942,{value:a});break;case"==":case"in":case">=":e=n.value;break;case">":e=n.value,t=!1;break;case"!=":case"not-in":e=vn}Ln({value:i,inclusive:s},{value:e,inclusive:t})<0&&(i=e,s=t)}var a;if(null!==n)for(let t=0;t<e.orderBy.length;++t)if(e.orderBy[t].field.isEqual(r)){let e=n.position[t];Ln({value:i,inclusive:s},{value:e,inclusive:n.inclusive})<0&&(i=e,s=n.inclusive);break}return{value:i,inclusive:s}}function ci(e,r,n){let i=mn,s=!0;for(let n of li(e,r)){let e=mn,t=!0;switch(n.op){case">=":case">":e="nullValue"in(a=n.value)?{booleanValue:!1}:"booleanValue"in a?{doubleValue:NaN}:"integerValue"in a||"doubleValue"in a?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in a?{stringValue:""}:"stringValue"in a?{bytesValue:""}:"bytesValue"in a?xn(dn.empty(),x.empty()):"referenceValue"in a?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in a?{arrayValue:{}}:"arrayValue"in a?Vn:"mapValue"in a?Rn(a)?{mapValue:{}}:mn:E(61959,{value:a}),t=!1;break;case"==":case"in":case"<=":e=n.value;break;case"<":e=n.value,t=!1;break;case"!=":case"not-in":e=mn}0<Fn({value:i,inclusive:s},{value:e,inclusive:t})&&(i=e,s=t)}var a;if(null!==n)for(let t=0;t<e.orderBy.length;++t)if(e.orderBy[t].field.isEqual(r)){let e=n.position[t];0<Fn({value:i,inclusive:s},{value:e,inclusive:n.inclusive})&&(i=e,s=n.inclusive);break}return{value:i,inclusive:s}}class di{constructor(e,t=null,r=[],n=[],i=null,s="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=n,this.limit=i,this.limitType=s,this.startAt=a,this.endAt=o,this.Ee=null,this.Ie=null,this.Re=null,this.startAt,this.endAt}}function fi(e,t,r,n,i,s,a,o){return new di(e,t,r,n,i,s,a,o)}function gi(e){return new di(e)}function mi(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function pi(e){return null!==e.collectionGroup}function yi(e){let n=e;if(null===n.Ee){n.Ee=[];let t=new Set;for(var i of n.explicitOrderBy)n.Ee.push(i),t.add(i.field.canonicalString());let r=0<n.explicitOrderBy.length?n.explicitOrderBy[n.explicitOrderBy.length-1].dir:"asc",e=(e=>{let t=new D(h.comparator);return e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t})(n);e.forEach(e=>{t.has(e.canonicalString())||e.isKeyField()||n.Ee.push(new jn(e,r))}),t.has(h.keyField().canonicalString())||n.Ee.push(new jn(h.keyField(),r))}return n.Ee}function vi(e){var t=e;return t.Ie||(t.Ie=((e,t)=>{if("F"===e.limitType)return si(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);t=t.map(e=>{var t="desc"===e.dir?"asc":"desc";return new jn(e.field,t)});var r=e.endAt?new Un(e.endAt.position,e.endAt.inclusive):null,n=e.startAt?new Un(e.startAt.position,e.startAt.inclusive):null;return si(e.path,e.collectionGroup,t,e.filters,e.limit,r,n)})(t,yi(e))),t.Ie}function wi(e,t){var r=e.filters.concat([t]);return new di(e.path,e.collectionGroup,e.explicitOrderBy.slice(),r,e.limit,e.limitType,e.startAt,e.endAt)}function _i(e,t,r){return new di(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,r,e.startAt,e.endAt)}function bi(e,t){return oi(vi(e),vi(t))&&e.limitType===t.limitType}function Ii(e){return ai(vi(e))+"|lt:"+e.limitType}function Ti(e){return`Query(target=${(e=>{let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),0<e.filters.length&&(t+=`, filters: [${e.filters.map(e=>Wn(e)).join(", ")}]`),It(e.limit)||(t+=", limit: "+e.limit),0<e.orderBy.length&&(t+=`, orderBy: [${e.orderBy.map(e=>`${(e=e).field.canonicalString()} (${e.dir})`).join(", ")}]`),e.startAt&&(t=(t=(t+=", startAt: ")+(e.startAt.inclusive?"b:":"a:"))+e.startAt.position.map(e=>Sn(e)).join(",")),`Target(${t=e.endAt?(t=(t+=", endAt: ")+(e.endAt.inclusive?"a:":"b:"))+e.endAt.position.map(e=>Sn(e)).join(","):t})`})(vi(e))}; limitType=${e.limitType})`}function Ei(e,t){return t.isFoundDocument()&&(s=e,o=(a=t).key.path,null!==s.collectionGroup?a.key.hasCollectionId(s.collectionGroup)&&s.path.isPrefixOf(o):x.isDocumentKey(s.path)?s.path.isEqual(o):s.path.isImmediateParentOf(o))&&((e,t)=>{for(var r of yi(e))if(!r.field.isKeyField()&&null===t.data.field(r.field))return;return 1})(e,t)&&((e,t)=>{for(var r of e.filters)if(!r.matches(t))return;return 1})(e,t)&&(a=t,!(s=e).startAt||(n=s.startAt,r=yi(s),i=Bn(n,r,a),n.inclusive?i<=0:i<0))&&(!s.endAt||(r=s.endAt,n=yi(s),i=Bn(r,n,a),r.inclusive?0<=i:0<i));var r,n,i,s,a,o}function Si(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function xi(e){return(t,r)=>{let n=!1;for(var i of yi(e)){let e=((e,t,r)=>{var n=e.field.isKeyField()?x.comparator(t.key,r.key):((e,t,r)=>{var n=t.data.field(e),i=r.data.field(e);return null!==n&&null!==i?In(n,i):E(42886)})(e.field,t,r);switch(e.dir){case"asc":return n;case"desc":return-1*n;default:return E(19790,{direction:e.dir})}})(i,t,r);if(0!==e)return e;n=n||i.field.isKeyField()}return 0}}class Ai{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(r){let e=this.mapKeyFn(r),n=this.inner[e];if(void 0!==n)for(let[e,t]of n)if(this.equalsFn(e,r))return t}has(e){return void 0!==this.get(e)}set(t,r){var e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)this.inner[e]=[[t,r]];else{for(let e=0;e<n.length;e++)if(this.equalsFn(n[e][0],t))return void(n[e]=[t,r]);n.push([t,r])}this.innerSize++}delete(t){var r=this.mapKeyFn(t),n=this.inner[r];if(void 0!==n)for(let e=0;e<n.length;e++)if(this.equalsFn(n[e][0],t))return 1===n.length?delete this.inner[r]:n.splice(e,1),this.innerSize--,!0;return!1}forEach(n){Gr(this.inner,(e,t)=>{for(let[e,r]of t)n(e,r)})}isEmpty(){return $r(this.inner)}size(){return this.innerSize}}let Ci=new C(x.comparator);let Di=new C(x.comparator);function Ni(...e){let t=Di;for(var r of e)t=t.insert(r.key,r);return t}function ki(e){let r=Di;return e.forEach((e,t)=>r=r.insert(e,t.overlayedDocument)),r}function Ri(){return new Ai(e=>e.toString(),(e,t)=>e.isEqual(t))}let Oi=new C(x.comparator),Mi=new D(x.comparator);function V(...e){let t=Mi;for(var r of e)t=t.add(r);return t}let Vi=new D(S);function Li(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Tt(t)?"-0":t}}function Fi(e){return{integerValue:""+e}}function Pi(e,t){return Et(t)?Fi(t):Li(e,t)}class Ui{constructor(){this._=void 0}}function Bi(e,t){return e instanceof $i?An(e=t)||(e=e)&&"doubleValue"in e?t:{integerValue:0}:null}class qi extends Ui{}class ji extends Ui{constructor(e){super(),this.elements=e}}function zi(e,t){var r=Hi(t);for(let t of e.elements)r.some(e=>_n(e,t))||r.push(t);return{arrayValue:{values:r}}}class Ki extends Ui{constructor(e){super(),this.elements=e}}function Gi(e,t){let r=Hi(t);for(let t of e.elements)r=r.filter(e=>!_n(e,t));return{arrayValue:{values:r}}}class $i extends Ui{constructor(e,t){super(),this.serializer=e,this.Ae=t}}function Qi(e){return k(e.integerValue||e.doubleValue)}function Hi(e){return Cn(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Wi{constructor(e,t){this.field=e,this.transform=t}}class Yi{constructor(e,t){this.version=e,this.transformResults=t}}class L{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new L}static exists(e){return new L(void 0,e)}static updateTime(e){return new L(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ji(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Xi{}function Zi(e,r){if(!e.hasLocalMutations||r&&0===r.fields.length)return null;if(null===r)return e.isNoDocument()?new os(e.key,L.none()):new rs(e.key,e.data,L.none());{var n,i=e.data,s=Pn.empty();let t=new D(h.comparator);for(n of r.fields)if(!t.has(n)){let e=i.field(n);null===e&&1<n.length&&(n=n.popLast(),e=i.field(n)),null===e?s.delete(n):s.set(n,e),t=t.add(n)}return new ns(e.key,s,new Jr(t.toArray()),L.none())}}function es(e,t,r,n){return e instanceof rs?(s=t,a=r,o=n,Ji((i=e).precondition,s)?(u=i.value.clone(),l=as(i.fieldTransforms,o,s),u.setAll(l),s.convertToFoundDocument(s.version,u).setHasLocalMutations(),null):a):e instanceof ns?(i=t,o=r,s=n,Ji((a=e).precondition,i)?(l=as(a.fieldTransforms,s,i),(u=i.data).setAll(is(a)),u.setAll(l),i.convertToFoundDocument(i.version,u).setHasLocalMutations(),null===o?null:o.unionWith(a.fieldMask.fields).unionWith(a.fieldTransforms.map(e=>e.field))):o):(n=t,t=r,Ji(e.precondition,n)?(n.convertToNoDocument(n.version).setHasLocalMutations(),null):t);var i,s,a,o,u,l}function ts(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(r=e.fieldTransforms,n=t.fieldTransforms,!!(void 0===r&&void 0===n||r&&n&&Oe(r,n,(e,t)=>(t=t,(e=e).field.isEqual(t.field)&&(e=e.transform,t=t.transform,e instanceof ji&&t instanceof ji||e instanceof Ki&&t instanceof Ki?Oe(e.elements,t.elements,_n):e instanceof $i&&t instanceof $i?_n(e.Ae,t.Ae):e instanceof qi&&t instanceof qi)))))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask));var r,n}class rs extends Xi{constructor(e,t,r,n=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=n,this.type=0}getFieldMask(){return null}}class ns extends Xi{constructor(e,t,r,n,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=n,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function is(r){let n=new Map;return r.fieldMask.fields.forEach(e=>{var t;e.isEmpty()||(t=r.data.field(e),n.set(e,t))}),n}function ss(e,t,r){var n,i,s,a=new Map;y(e.length===r.length,32656,{Ve:r.length,de:e.length});for(let h=0;h<r.length;h++){var o=e[h],u=o.transform,l=t.data.field(o.field);a.set(o.field,(n=u,i=l,s=r[h],n instanceof ji?zi(n,i):n instanceof Ki?Gi(n,i):s))}return a}function as(e,r,n){var i,s,a,o,u,l,h,c=new Map;for(i of e){let e=i.transform,t=n.data.field(i.field);c.set(i.field,(s=e,a=t,o=r,h=l=u=void 0,s instanceof qi?(o=o,l=a,h={fields:{[nn]:{stringValue:rn},[an]:{timestampValue:{seconds:o.seconds,nanos:o.nanoseconds}}}},(l=l&&on(l)?un(l):l)&&(h.fields[sn]=l),{mapValue:h}):s instanceof ji?zi(s,a):s instanceof Ki?Gi(s,a):(h=Bi(o=s,a),u=Qi(h)+Qi(o.Ae),An(h)&&An(o.Ae)?Fi(u):Li(o.serializer,u))))}return c}class os extends Xi{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class us extends Xi{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class ls{constructor(e,t,r,n){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=n}applyToRemoteDocument(e,t){var r,n,i,s,a,o,u,l=t.mutationResults;for(let c=0;c<this.mutations.length;c++){var h=this.mutations[c];h.key.isEqual(e.key)&&(r=h,n=e,i=l[c],u=h=o=a=s=void 0,r instanceof rs?(a=n,o=i,h=(s=r).value.clone(),u=ss(s.fieldTransforms,a,o.transformResults),h.setAll(u),a.convertToFoundDocument(o.version,h).setHasCommittedMutations()):r instanceof ns?(s=n,a=i,Ji((o=r).precondition,s)?(u=ss(o.fieldTransforms,s,a.transformResults),(h=s.data).setAll(is(o)),h.setAll(u),s.convertToFoundDocument(a.version,h).setHasCommittedMutations()):s.convertToUnknownDocument(a.version)):n.convertToNoDocument(i.version).setHasCommittedMutations())}}applyToLocalView(e,t){for(var r of this.baseMutations)r.key.isEqual(e.key)&&(t=es(r,e,t,this.localWriteTime));for(var n of this.mutations)n.key.isEqual(e.key)&&(t=es(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(n,i){let s=Ri();return this.mutations.forEach(e=>{var t=n.get(e.key),r=t.overlayedDocument,t=this.applyToLocalView(r,t.mutatedFields),t=Zi(r,i.has(e.key)?null:t);null!==t&&s.set(e.key,t),r.isValidDocument()||r.convertToNoDocument(w.min())}),s}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),V())}isEqual(e){return this.batchId===e.batchId&&Oe(this.mutations,e.mutations,(e,t)=>ts(e,t))&&Oe(this.baseMutations,e.baseMutations,(e,t)=>ts(e,t))}}class hs{constructor(e,t,r,n){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=n}static from(e,t,r){y(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let n=Oi;var i=e.mutations;for(let s=0;s<i.length;s++)n=n.insert(i[s].key,r[s].version);return new hs(e,t,r,n)}}class cs{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{
|
|
1
|
+
((e,t)=>{"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)})(this,function(Qd,Hd){try{!(function(){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}let s=i(Qd),a=()=>{},u=function(t){var r=[];let n=0;for(let i=0;i<t.length;i++){let e=t.charCodeAt(i);e<128?r[n++]=e:(e<2048?r[n++]=e>>6|192:(55296==(64512&e)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++i)),r[n++]=e>>18|240,r[n++]=e>>12&63|128):r[n++]=e>>12|224,r[n++]=e>>6&63|128),r[n++]=63&e|128)}return r},B={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let h=0;h<r.length;h+=3){var s=r[h],a=h+1<r.length,o=a?r[h+1]:0,u=h+2<r.length,l=u?r[h+2]:0;let e=(15&o)<<2|l>>6,t=63&l;u||(t=64,a)||(e=64),i.push(n[s>>2],n[(3&s)<<4|o>>4],n[e],n[t])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(u(e),t)},decodeString(r,n){if(this.HAS_NATIVE_SUPPORT&&!n)return atob(r);{var i=this.decodeStringToByteArray(r,n);var s=[];let e=0,t=0;for(;e<i.length;){var a,o,u,l=i[e++];l<128?s[t++]=String.fromCharCode(l):191<l&&l<224?(a=i[e++],s[t++]=String.fromCharCode((31&l)<<6|63&a)):239<l&&l<365?(a=((7&l)<<18|(63&i[e++])<<12|(63&i[e++])<<6|63&i[e++])-65536,s[t++]=String.fromCharCode(55296+(a>>10)),s[t++]=String.fromCharCode(56320+(1023&a))):(o=i[e++],u=i[e++],s[t++]=String.fromCharCode((15&l)<<12|(63&o)<<6|63&u))}return s.join("");return}},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let u=0;u<e.length;){var i=r[e.charAt(u++)],s=u<e.length?r[e.charAt(u)]:0,a=++u<e.length?r[e.charAt(u)]:64,o=++u<e.length?r[e.charAt(u)]:64;if(++u,null==i||null==s||null==a||null==o)throw new q;n.push(i<<2|s>>4),64!==a&&(n.push(s<<4&240|a>>2),64!==o)&&n.push(a<<6&192|o)}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class q extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let j=function(e){var t=u(e);return B.encodeByteArray(t,!0)},z=function(e){return j(e).replace(/\./g,"")},K=function(e){try{return B.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function G(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}let $=()=>G().__FIREBASE_DEFAULTS__,Q=()=>{var e;return"undefined"!=typeof process&&void 0!==process.env&&(e=process.env.__FIREBASE_DEFAULTS__)?JSON.parse(e):void 0},H=()=>{if("undefined"!=typeof document){let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&K(e[1]);return t&&JSON.parse(t)}},W=()=>{try{return a()||$()||Q()||H()}catch(e){console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "+e)}};function Y(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function J(){var e=W()?.forceEnvironment;if("node"===e)return 1;if("browser"!==e)try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){}}function X(){return!J()&&navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Z(){return!J()&&navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}class ee extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,ee.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,te.prototype.create)}}class te{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var n,r=t[0]||{},i=this.service+"/"+e,s=this.errors[e],s=s?(n=r,s.replace(re,(e,t)=>{var r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",s=this.serviceName+`: ${s} (${i}).`;return new ee(i,s,r)}}let re=/\{\$([^}]+)}/g;function ne(e,t){if(e!==t){var r,n,i=Object.keys(e),s=Object.keys(t);for(r of i){if(!s.includes(r))return!1;var a=e[r],o=t[r];if(ie(a)&&ie(o)){if(!ne(a,o))return!1}else if(a!==o)return!1}for(n of s)if(!i.includes(n))return!1}return!0}function ie(e){return null!==e&&"object"==typeof e}function _(e){return e&&e._delegate?e._delegate:e}function se(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}class ae{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}var oe,ue,c,e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!(function(){var e,t,s;function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}function n(){}function a(e,t,r){r=r||0;var n=Array(16);if("string"==typeof t)for(var i=0;i<16;++i)n[i]=t.charCodeAt(r++)|t.charCodeAt(r++)<<8|t.charCodeAt(r++)<<16|t.charCodeAt(r++)<<24;else for(i=0;i<16;++i)n[i]=t[r++]|t[r++]<<8|t[r++]<<16|t[r++]<<24;t=e.g[0],r=e.g[1];var i=e.g[2],s=e.g[3],a=t+(s^r&(i^s))+n[0]+3614090360&4294967295;a=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=(r=(i=(s=(t=r+(a<<7&4294967295|a>>>25))+((a=s+(i^t&(r^i))+n[1]+3905402710&4294967295)<<12&4294967295|a>>>20))+((a=i+(r^s&(t^r))+n[2]+606105819&4294967295)<<17&4294967295|a>>>15))+((a=r+(t^i&(s^t))+n[3]+3250441966&4294967295)<<22&4294967295|a>>>10))+((a=t+(s^r&(i^s))+n[4]+4118548399&4294967295)<<7&4294967295|a>>>25))+((a=s+(i^t&(r^i))+n[5]+1200080426&4294967295)<<12&4294967295|a>>>20))+((a=i+(r^s&(t^r))+n[6]+2821735955&4294967295)<<17&4294967295|a>>>15))+((a=r+(t^i&(s^t))+n[7]+4249261313&4294967295)<<22&4294967295|a>>>10))+((a=t+(s^r&(i^s))+n[8]+1770035416&4294967295)<<7&4294967295|a>>>25))+((a=s+(i^t&(r^i))+n[9]+2336552879&4294967295)<<12&4294967295|a>>>20))+((a=i+(r^s&(t^r))+n[10]+4294925233&4294967295)<<17&4294967295|a>>>15))+((a=r+(t^i&(s^t))+n[11]+2304563134&4294967295)<<22&4294967295|a>>>10))+((a=t+(s^r&(i^s))+n[12]+1804603682&4294967295)<<7&4294967295|a>>>25))+((a=s+(i^t&(r^i))+n[13]+4254626195&4294967295)<<12&4294967295|a>>>20))+((a=i+(r^s&(t^r))+n[14]+2792965006&4294967295)<<17&4294967295|a>>>15))+((a=r+(t^i&(s^t))+n[15]+1236535329&4294967295)<<22&4294967295|a>>>10))+((a=t+(i^s&(r^i))+n[1]+4129170786&4294967295)<<5&4294967295|a>>>27))+((a=s+(r^i&(t^r))+n[6]+3225465664&4294967295)<<9&4294967295|a>>>23))+((a=i+(t^r&(s^t))+n[11]+643717713&4294967295)<<14&4294967295|a>>>18))+((a=r+(s^t&(i^s))+n[0]+3921069994&4294967295)<<20&4294967295|a>>>12))+((a=t+(i^s&(r^i))+n[5]+3593408605&4294967295)<<5&4294967295|a>>>27))+((a=s+(r^i&(t^r))+n[10]+38016083&4294967295)<<9&4294967295|a>>>23))+((a=i+(t^r&(s^t))+n[15]+3634488961&4294967295)<<14&4294967295|a>>>18))+((a=r+(s^t&(i^s))+n[4]+3889429448&4294967295)<<20&4294967295|a>>>12))+((a=t+(i^s&(r^i))+n[9]+568446438&4294967295)<<5&4294967295|a>>>27))+((a=s+(r^i&(t^r))+n[14]+3275163606&4294967295)<<9&4294967295|a>>>23))+((a=i+(t^r&(s^t))+n[3]+4107603335&4294967295)<<14&4294967295|a>>>18))+((a=r+(s^t&(i^s))+n[8]+1163531501&4294967295)<<20&4294967295|a>>>12))+((a=t+(i^s&(r^i))+n[13]+2850285829&4294967295)<<5&4294967295|a>>>27))+((a=s+(r^i&(t^r))+n[2]+4243563512&4294967295)<<9&4294967295|a>>>23))+((a=i+(t^r&(s^t))+n[7]+1735328473&4294967295)<<14&4294967295|a>>>18))+((a=r+(s^t&(i^s))+n[12]+2368359562&4294967295)<<20&4294967295|a>>>12))+((a=t+(r^i^s)+n[5]+4294588738&4294967295)<<4&4294967295|a>>>28))+((a=s+(t^r^i)+n[8]+2272392833&4294967295)<<11&4294967295|a>>>21))+((a=i+(s^t^r)+n[11]+1839030562&4294967295)<<16&4294967295|a>>>16))+((a=r+(i^s^t)+n[14]+4259657740&4294967295)<<23&4294967295|a>>>9))+((a=t+(r^i^s)+n[1]+2763975236&4294967295)<<4&4294967295|a>>>28))+((a=s+(t^r^i)+n[4]+1272893353&4294967295)<<11&4294967295|a>>>21))+((a=i+(s^t^r)+n[7]+4139469664&4294967295)<<16&4294967295|a>>>16))+((a=r+(i^s^t)+n[10]+3200236656&4294967295)<<23&4294967295|a>>>9))+((a=t+(r^i^s)+n[13]+681279174&4294967295)<<4&4294967295|a>>>28))+((a=s+(t^r^i)+n[0]+3936430074&4294967295)<<11&4294967295|a>>>21))+((a=i+(s^t^r)+n[3]+3572445317&4294967295)<<16&4294967295|a>>>16))+((a=r+(i^s^t)+n[6]+76029189&4294967295)<<23&4294967295|a>>>9))+((a=t+(r^i^s)+n[9]+3654602809&4294967295)<<4&4294967295|a>>>28))+((a=s+(t^r^i)+n[12]+3873151461&4294967295)<<11&4294967295|a>>>21))+((a=i+(s^t^r)+n[15]+530742520&4294967295)<<16&4294967295|a>>>16))+((a=r+(i^s^t)+n[2]+3299628645&4294967295)<<23&4294967295|a>>>9))+((a=t+(i^(r|~s))+n[0]+4096336452&4294967295)<<6&4294967295|a>>>26))+((a=s+(r^(t|~i))+n[7]+1126891415&4294967295)<<10&4294967295|a>>>22))+((a=i+(t^(s|~r))+n[14]+2878612391&4294967295)<<15&4294967295|a>>>17))+((a=r+(s^(i|~t))+n[5]+4237533241&4294967295)<<21&4294967295|a>>>11))+((a=t+(i^(r|~s))+n[12]+1700485571&4294967295)<<6&4294967295|a>>>26))+((a=s+(r^(t|~i))+n[3]+2399980690&4294967295)<<10&4294967295|a>>>22))+((a=i+(t^(s|~r))+n[10]+4293915773&4294967295)<<15&4294967295|a>>>17))+((a=r+(s^(i|~t))+n[1]+2240044497&4294967295)<<21&4294967295|a>>>11))+((a=t+(i^(r|~s))+n[8]+1873313359&4294967295)<<6&4294967295|a>>>26))+((a=s+(r^(t|~i))+n[15]+4264355552&4294967295)<<10&4294967295|a>>>22))+((a=i+(t^(s|~r))+n[6]+2734768916&4294967295)<<15&4294967295|a>>>17))+((a=r+(s^(i|~t))+n[13]+1309151649&4294967295)<<21&4294967295|a>>>11))+((s=(t=r+((a=t+(i^(r|~s))+n[4]+4149444226&4294967295)<<6&4294967295|a>>>26))+((a=s+(r^(t|~i))+n[11]+3174756917&4294967295)<<10&4294967295|a>>>22))^((i=s+((a=i+(t^(s|~r))+n[2]+718787259&4294967295)<<15&4294967295|a>>>17))|~t))+n[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(a<<21&4294967295|a>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+s&4294967295}function u(e,t){this.h=t;var r=[];let n=!0;for(let s=e.length-1;0<=s;s--){var i=0|e[s];n&&i==t||(r[s]=i,n=!1)}this.g=r}t=r,s=function(){this.blockSize=-1},n.prototype=s.prototype,t.F=s.prototype,t.prototype=new n,(t.prototype.constructor=t).D=function(e,t,r){for(var n=Array(arguments.length-2),i=2;i<arguments.length;i++)n[i-2]=arguments[i];return s.prototype[t].apply(e,n)},r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},r.prototype.v=function(e,t){var r=(t=void 0===t?e.length:t)-this.blockSize,n=this.C;let i=this.h,s=0;for(;s<t;){if(0==i)for(;s<=r;)a(this,e,s),s+=this.blockSize;if("string"==typeof e){for(;s<t;)if(n[i++]=e.charCodeAt(s++),i==this.blockSize){a(this,n),i=0;break}}else for(;s<t;)if(n[i++]=e[s++],i==this.blockSize){a(this,n),i=0;break}}this.h=i,this.o+=t},r.prototype.A=function(){var t=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var r=1;r<t.length-8;++r)t[r]=0;for(var r=8*this.o,n=t.length-8;n<t.length;++n)t[n]=255&r,r/=256;for(this.v(t),t=Array(16),n=r=0;n<4;++n)for(let e=0;e<32;e+=8)t[r++]=this.g[n]>>>e&255;return t};var i={};function o(e){return-128<=e&&e<128?(t=e,r=function(e){return new u([0|e],e<0?-1:0)},n=i,Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=r(t)):new u([0|e],e<0?-1:0);var t,r,n}function l(e){if(isNaN(e)||!isFinite(e))return h;if(e<0)return m(l(-e));var t=[];let r=1;for(let n=0;e>=r;n++)t[n]=e/r|0,r*=4294967296;return new u(t,0)}var h=o(0),c=o(1),d=o(16777216);function f(t){if(0==t.h){for(let e=0;e<t.g.length;e++)if(0!=t.g[e])return;return 1}}function g(e){return-1==e.h}function m(e){var t=e.g.length,r=[];for(let n=0;n<t;n++)r[n]=~e.g[n];return new u(r,~e.h).add(c)}function p(e,t){return e.add(m(t))}function y(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function v(e,t){this.g=e,this.h=t}function w(e,t){if(f(t))throw Error("division by zero");if(f(e))return new v(h,h);if(g(e))return t=w(m(e),t),new v(m(t.g),m(t.h));if(g(t))return t=w(e,m(t)),new v(m(t.g),t.h);if(30<e.g.length){if(g(e)||g(t))throw Error("slowDivide_ only works with positive integers.");for(var r=c,n=t;n.l(e)<=0;)r=_(r),n=_(n);for(var i=b(r,1),s=b(n,1),n=b(n,2),r=b(r,2);!f(n);){var a=s.add(n);a.l(e)<=0&&(i=i.add(r),s=a),n=b(n,1),r=b(r,1)}return t=p(e,i.j(t)),new v(i,t)}for(i=h;0<=e.l(t);){for(r=Math.max(1,Math.floor(e.m()/t.m())),n=(n=Math.ceil(Math.log(r)/Math.LN2))<=48?1:Math.pow(2,n-48),a=(s=l(r)).j(t);g(a)||0<a.l(e);)a=(s=l(r-=n)).j(t);f(s)&&(s=c),i=i.add(s),e=p(e,a)}return new v(i,e)}function _(e){var t=e.g.length+1,r=[];for(let n=0;n<t;n++)r[n]=e.i(n)<<1|e.i(n-1)>>>31;return new u(r,e.h)}function b(e,t){var r=t>>5,n=(t%=32,e.g.length-r),i=[];for(let s=0;s<n;s++)i[s]=0<t?e.i(s+r)>>>t|e.i(s+r+1)<<32-t:e.i(s+r);return new u(i,e.h)}(e=u.prototype).m=function(){if(g(this))return-m(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){var r=this.i(n);e+=(0<=r?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(t){if((t=t||10)<2||36<t)throw Error("radix out of range: "+t);if(f(this))return"0";if(g(this))return"-"+m(this).toString(t);var r=l(Math.pow(t,6)),n=this;let i="";for(;;){var s=w(n,r).g;let e=((0<(n=p(n,s.j(r))).g.length?n.g[0]:n.h)>>>0).toString(t);if(f(n=s))return e+i;for(;e.length<6;)e="0"+e;i=e+i}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return g(e=p(this,e))?-1:f(e)?0:1},e.abs=function(){return g(this)?m(this):this},e.add=function(e){var t=Math.max(this.g.length,e.g.length),r=[];let n=0;for(let a=0;a<=t;a++){var i=n+(65535&this.i(a))+(65535&e.i(a)),s=(i>>>16)+(this.i(a)>>>16)+(e.i(a)>>>16);n=s>>>16,i&=65535,s&=65535,r[a]=s<<16|i}return new u(r,-2147483648&r[r.length-1]?-1:0)},e.j=function(t){if(f(this)||f(t))return h;if(g(this))return g(t)?m(this).j(m(t)):m(m(this).j(t));if(g(t))return m(this.j(m(t)));if(this.l(d)<0&&t.l(d)<0)return l(this.m()*t.m());for(var e=this.g.length+t.g.length,r=[],n=0;n<2*e;n++)r[n]=0;for(n=0;n<this.g.length;n++)for(let e=0;e<t.g.length;e++){var i=this.i(n)>>>16,s=65535&this.i(n),a=t.i(e)>>>16,o=65535&t.i(e);r[2*n+2*e]+=s*o,y(r,2*n+2*e),r[2*n+2*e+1]+=i*o,y(r,2*n+2*e+1),r[2*n+2*e+1]+=s*a,y(r,2*n+2*e+1),r[2*n+2*e+2]+=i*a,y(r,2*n+2*e+2)}for(t=0;t<e;t++)r[t]=r[2*t+1]<<16|r[2*t];for(t=e;t<2*e;t++)r[t]=0;return new u(r,0)},e.B=function(e){return w(this,e).h},e.and=function(e){var t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)&e.i(n);return new u(r,this.h&e.h)},e.or=function(e){var t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)|e.i(n);return new u(r,this.h|e.h)},e.xor=function(e){var t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)^e.i(n);return new u(r,this.h^e.h)},r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,ue=r,u.prototype.multiply=u.prototype.j,u.prototype.modulo=u.prototype.B,u.prototype.compare=u.prototype.l,u.prototype.toNumber=u.prototype.m,u.prototype.getBits=u.prototype.i,u.fromNumber=l,u.fromString=function e(t,r){if(0==t.length)throw Error("number format error: empty string");if((r=r||10)<2||36<r)throw Error("radix out of range: "+r);if("-"==t.charAt(0))return m(e(t.substring(1),r));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');var n=l(Math.pow(r,8));let i=h;for(let o=0;o<t.length;o+=8){var s=Math.min(8,t.length-o),a=parseInt(t.substring(o,o+s),r);i=(s<8?(s=l(Math.pow(r,s)),i.j(s)):i=i.j(n)).add(l(a))}return i},oe=u}).apply(void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),(n=c=c||{})[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT";let le={debug:c.DEBUG,verbose:c.VERBOSE,info:c.INFO,warn:c.WARN,error:c.ERROR,silent:c.SILENT},he=c.INFO,ce={[c.DEBUG]:"log",[c.VERBOSE]:"log",[c.INFO]:"info",[c.WARN]:"warn",[c.ERROR]:"error"},de=(e,t,...r)=>{if(!(t<e.logLevel)){var n=(new Date).toISOString(),i=ce[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...r)}};var ar,or,ur,lr,hr,cr,dr,fr,f,fe,gr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!(function(){var e,L=Object.defineProperty;var F=(e=>{e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof gr&&gr];for(var t=0;t<e.length;++t){var r=e[t];if(r&&r.Math==Math)return r}throw Error("Cannot find global object")})(this);function P(e,t){if(t)e:{var r=F;e=e.split(".");for(var n=0;n<e.length-1;n++){var i=e[n];if(!(i in r))break e;r=r[i]}(t=t(n=r[e=e[e.length-1]]))!=n&&null!=t&&L(r,e,{configurable:!0,writable:!0,value:t})}}P("Symbol.dispose",function(e){return e||Symbol("Symbol.dispose")}),P("Array.prototype.values",function(e){return e||function(){return this[Symbol.iterator]()}}),P("Object.entries",function(e){return e||function(e){var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push([t,e[t]]);return r}});var U=U||{},D=this||self;function d(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function B(e,t,r){return e.call.apply(e.bind,arguments)}function y(e,t,r){return(y=B).apply(null,arguments)}function q(t){var r=Array.prototype.slice.call(arguments,1);return function(){var e=r.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function t(e,s){function t(){}t.prototype=s.prototype,e.Z=s.prototype,e.prototype=new t,(e.prototype.constructor=e).Ob=function(e,t,r){for(var n=Array(arguments.length-2),i=2;i<arguments.length;i++)n[i-2]=arguments[i];return s.prototype[t].apply(e,n)}}var j="undefined"!=typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function z(t){var r=t.length;if(0<r){var n=Array(r);for(let e=0;e<r;e++)n[e]=t[e];return n}return[]}function K(t){for(let e=1;e<arguments.length;e++){var r=arguments[e];if("array"==(n="object"!=(n=typeof r)?n:r?Array.isArray(r)?"array":n:"null")||"object"==n&&"number"==typeof r.length){var n=t.length||0,i=r.length||0;t.length=n+i;for(let e=0;e<i;e++)t[n+e]=r[e]}else t.push(r)}}var G=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new $,e=>e.reset());class ${constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let r,n=!1,Q=new class{constructor(){this.h=this.g=null}add(e,t){var r=G.get();r.set(e,t),this.h?this.h.next=r:this.g=r,this.h=r}},H=()=>{let e=Promise.resolve(void 0);r=()=>{e.then(W)}};function W(){for(var e;e=(()=>{let e=Q,t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t})();){try{e.h.call(e.g)}catch(e){(e=>{D.setTimeout(()=>{throw e},0)})(e)}var t=G;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}n=!1}function i(){this.u=this.u,this.C=this.C}function o(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}i.prototype.u=!1,i.prototype.dispose=function(){this.u||(this.u=!0,this.N())},i.prototype[Symbol.dispose]=function(){this.dispose()},i.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},o.prototype.h=function(){this.defaultPrevented=!0};var Y=(()=>{if(!D.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{var r=()=>{};D.addEventListener("test",r,t),D.removeEventListener("test",r,t)}catch(e){}return e})();function N(e){return/^[\s\xa0]*$/.test(e)}function s(e,t){o.call(this,e?e.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,e&&this.init(e,t)}t(s,o),s.prototype.init=function(e,t){var r=this.type=e.type,n=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,(t=e.relatedTarget)||("mouseover"==r?t=e.fromElement:"mouseout"==r&&(t=e.toElement)),this.relatedTarget=t,n?(this.clientX=void 0!==n.clientX?n.clientX:n.pageX,this.clientY=void 0!==n.clientY?n.clientY:n.pageY,this.screenX=n.screenX||0,this.screenY=n.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=e.pointerType,this.state=e.state,(this.i=e).defaultPrevented&&s.Z.h.call(this)},s.prototype.h=function(){s.Z.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var u="closure_listenable_"+(1e6*Math.random()|0),J=0;function X(e,t,r,n,i){this.listener=e,this.proxy=null,this.src=t,this.type=r,this.capture=!!n,this.ha=i,this.key=++J,this.da=this.fa=!1}function Z(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function ee(e,t,r){for(var n in e)t.call(r,e[n],n,e)}function te(e){var t,r={};for(t in e)r[t]=e[t];return r}let re="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function ne(t){let r,n;for(let i=1;i<arguments.length;i++){for(r in n=arguments[i])t[r]=n[r];for(let e=0;e<re.length;e++)r=re[e],Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}}function ie(e){this.src=e,this.g={},this.h=0}function se(e,t){var r,n,i,s=t.type;s in e.g&&(r=e.g[s],(i=0<=(n=Array.prototype.indexOf.call(r,t,void 0)))&&Array.prototype.splice.call(r,n,1),i)&&(Z(t),0==e.g[s].length)&&(delete e.g[s],e.h--)}function ae(e,t,r,n){for(let s=0;s<e.length;++s){var i=e[s];if(!i.da&&i.listener==t&&i.capture==!!r&&i.ha==n)return s}return-1}ie.prototype.add=function(e,t,r,n,i){var s=e.toString(),a=((e=this.g[s])||(e=this.g[s]=[],this.h++),ae(e,t,n,i));return-1<a?(t=e[a],r||(t.fa=!1)):((t=new X(t,this.src,s,!!n,i)).fa=r,e.push(t)),t};var oe="closure_lm_"+(1e6*Math.random()|0),ue={};function le(t,r,n,i,s){if(i&&i.once)return function t(r,n,i,s,a){if(Array.isArray(n)){for(let e=0;e<n.length;e++)t(r,n[e],i,s,a);return null}i=pe(i);return r&&r[u]?r.K(n,i,d(s)?!!s.capture:!!s,a):he(r,n,i,!0,s,a)}(t,r,n,i,s);if(Array.isArray(r)){for(let e=0;e<r.length;e++)le(t,r[e],n,i,s);return null}return n=pe(n),t&&t[u]?t.J(r,n,d(i)?!!i.capture:!!i,s):he(t,r,n,!1,i,s)}function he(e,t,r,n,i,s){if(!t)throw Error("Invalid event type");var a=d(i)?!!i.capture:!!i;let o=ge(e);if(o||(e[oe]=o=new ie(e)),!(r=o.add(t,r,n,a,s)).proxy)if(n=(()=>{let r=fe;return function e(t){return r.call(e.src,e.listener,t)}})(),(r.proxy=n).src=e,n.listener=r,e.addEventListener)void 0===(i=Y?i:a)&&(i=!1),e.addEventListener(t.toString(),n,i);else if(e.attachEvent)e.attachEvent(de(t.toString()),n);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(n)}return r}function ce(e){var t,r,n;"number"!=typeof e&&e&&!e.da&&((t=e.src)&&t[u]?se(t.i,e):(r=e.type,n=e.proxy,t.removeEventListener?t.removeEventListener(r,n,e.capture):t.detachEvent?t.detachEvent(de(r),n):t.addListener&&t.removeListener&&t.removeListener(n),(r=ge(t))?(se(r,e),0==r.h&&(r.src=null,t[oe]=null)):Z(e)))}function de(e){return e in ue?ue[e]:ue[e]="on"+e}function fe(e,t){var r,n;return e=!!e.da||(t=new s(t,this),r=e.listener,n=e.ha||e.src,e.fa&&ce(e),r.call(n,t))}function ge(e){return(e=e[oe])instanceof ie?e:null}var me="__closure_events_fn_"+(1e9*Math.random()>>>0);function pe(t){return"function"==typeof t?t:(t[me]||(t[me]=function(e){return t.handleEvent(e)}),t[me])}function a(){i.call(this),this.i=new ie(this),(this.M=this).G=null}function l(e,t){var r,n,i=e.G;if(i)for(r=[];i;i=i.G)r.push(i);e=e.M,i=t.type||t,"string"==typeof t?t=new o(t,e):t instanceof o?t.target=t.target||e:(n=t,ne(t=new o(i,e),n)),n=!0;let s,a;if(r)for(a=r.length-1;0<=a;a--)n=ye(s=t.g=r[a],i,!0,t)&&n;if(n=ye(s=t.g=e,i,!0,t)&&n,n=ye(s,i,!1,t)&&n,r)for(a=0;a<r.length;a++)n=ye(s=t.g=r[a],i,!1,t)&&n}function ye(e,t,r,n){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();let i=!0;for(let u=0;u<t.length;++u){var s,a,o=t[u];o&&!o.da&&o.capture==r&&(s=o.listener,a=o.ha||o.src,o.fa&&se(e.i,o),i=!1!==s.call(a,n)&&i)}return i&&!n.defaultPrevented}function ve(e){e.g=((e,t)=>{if("function"!=typeof e){if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=y(e.handleEvent,e)}return 2147483647<Number(t)?-1:D.setTimeout(e,t||0)})(()=>{e.g=null,e.i&&(e.i=!1,ve(e))},e.l);var t=e.h;e.h=null,e.m.apply(null,t)}t(a,i),a.prototype[u]=!0,a.prototype.removeEventListener=function(e,t,r,n){!function e(t,r,n,i,s){if(Array.isArray(r))for(var a=0;a<r.length;a++)e(t,r[a],n,i,s);else i=d(i)?!!i.capture:!!i,n=pe(n),t&&t[u]?(t=t.i,(a=String(r).toString())in t.g&&-1<(n=ae(r=t.g[a],n,i,s))&&(Z(r[n]),Array.prototype.splice.call(r,n,1),0==r.length)&&(delete t.g[a],t.h--)):(t=t&&ge(t))&&(r=t.g[r.toString()],n=(t=-1)<(t=r?ae(r,n,i,s):t)?r[t]:null)&&ce(n)}(this,e,t,r,n)},a.prototype.N=function(){if(a.Z.N.call(this),this.i){var t,r=this.i;for(t in r.g){var n=r.g[t];for(let e=0;e<n.length;e++)Z(n[e]);delete r.g[t],r.h--}}this.G=null},a.prototype.J=function(e,t,r,n){return this.i.add(String(e),t,!1,r,n)},a.prototype.K=function(e,t,r,n){return this.i.add(String(e),t,!0,r,n)};class we extends i{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:ve(this)}N(){super.N(),this.g&&(D.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function h(e){i.call(this),this.h=e,this.g={}}t(h,i);var _e=[];function be(e){ee(e.g,function(e,t){this.g.hasOwnProperty(t)&&ce(e)},e),e.g={}}h.prototype.N=function(){h.Z.N.call(this),be(this)},h.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Ie=D.JSON.stringify,Te=D.JSON.parse,Ee=class{stringify(e){return D.JSON.stringify(e,void 0)}parse(e){return D.JSON.parse(e,void 0)}};function Se(){}function xe(){}var Ae={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function Ce(){o.call(this,"d")}function De(){o.call(this,"c")}t(Ce,o),t(De,o);var c={},Ne=null;function ke(){return Ne=Ne||new a}function Re(e){o.call(this,c.Ia,e)}function Oe(){var e=ke();l(e,new Re(e))}function Me(e,t){o.call(this,c.STAT_EVENT,e),this.stat=t}function k(e){var t=ke();l(t,new Me(t,e))}function Ve(e,t){o.call(this,c.Ja,e),this.size=t}function v(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return D.setTimeout(function(){e()},t)}function f(){this.g=!0}function R(e,t,r,n){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+((e,t)=>{if(!e.g)return t;if(!t)return null;try{var r=JSON.parse(t);if(r)for(e=0;e<r.length;e++)if(Array.isArray(r[e])){var n=r[e];if(!(n.length<2)){var i=n[1];if(Array.isArray(i)&&!(i.length<1)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(let e=1;e<i.length;e++)i[e]=""}}}return Ie(r)}catch(e){return t}})(e,r)+(n?" "+n:"")})}c.Ia="serverreachability",t(Re,o),c.STAT_EVENT="statevent",t(Me,o),c.Ja="timingevent",t(Ve,o),f.prototype.ua=function(){this.g=!1},f.prototype.info=function(){};var Le={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},Fe={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function Pe(){}function g(e){return encodeURIComponent(String(e))}function m(e,t,r,n){this.j=e,this.i=t,this.l=r,this.S=n||1,this.V=new h(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Ue}function Ue(){this.i=null,this.g="",this.h=!1}t(Pe,Se),Pe.prototype.g=function(){return new XMLHttpRequest};var Be=new Pe,qe={},je={};function ze(e,t,r){e.M=1,e.A=ot(w(t)),e.u=r,e.R=!0,Ke(e,null)}function Ke(e,t){e.F=Date.now(),$e(e),e.B=w(e.A);var a,o,u,l,h,c,r=e.B,n=e.S,i=(Array.isArray(n)||(n=[String(n)]),_t(r.i,"t",n),e.C=0,r=e.j.L,e.h=new Ue,e.g=tr(e.j,r?t:null,!e.u),0<e.P&&(e.O=new we(y(e.Y,e,e.g),e.P)),t=e.V,r=e.g,n=e.ba,"readystatechange");Array.isArray(i)||(i&&(_e[0]=i.toString()),i=_e);for(let d=0;d<i.length;d++){var s=le(r,i[d],n||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}t=e.J?te(e.J):{},e.u?(e.v||(e.v="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.B,e.v,e.u,t)):(e.v="GET",e.g.ea(e.B,e.v,null,t)),Oe(),a=e.i,o=e.v,u=e.B,l=e.l,h=e.S,c=e.u,a.info(function(){if(a.g)if(c){var t="",r=c.split("&");for(let e=0;e<r.length;e++){var n,i,s=r[e].split("=");1<s.length&&(n=s[0],s=s[1],t=2<=(i=n.split("_")).length&&"type"==i[1]?t+(n+"=")+s+"&":t+(n+"=redacted&"))}}else t=null;else t=c;return"XMLHTTP REQ ("+l+") [attempt "+h+"]: "+o+"\n"+u+"\n"+t})}function Ge(e){return e.g&&"GET"==e.v&&2!=e.M&&e.j.Aa}function $e(e){e.T=Date.now()+e.H,Qe(e,e.H)}function Qe(e,t){if(null!=e.D)throw Error("WatchDog timer not null");e.D=v(y(e.aa,e),t)}function He(e){e.D&&(D.clearTimeout(e.D),e.D=null)}function O(e){0==e.j.I||e.K||Jt(e.j,e)}function M(e){He(e);var t=e.O;t&&"function"==typeof t.dispose&&t.dispose(),e.O=null,be(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dispose())}function We(e,t){try{var r=e.j;if(0!=r.I&&(r.g==e||et(r.h,e)))if(!e.L&&et(r.h,e)&&3==r.I){try{var n=r.Ba.g.parse(t)}catch(e){n=null}if(Array.isArray(n)&&3==n.length){var i=n;if(0==i[0]){e:if(!r.v){if(r.g){if(!(r.g.F+3e3<e.F))break e;Yt(r),Bt(r)}Qt(r),k(18)}}else r.xa=i[1],0<r.xa-r.K&&i[2]<37500&&r.F&&0==r.A&&!r.C&&(r.C=v(y(r.Va,r),6e3));Ze(r.h)<=1&&r.ta&&(r.ta=void 0)}else x(r,11)}else if(!e.L&&r.g!=e||Yt(r),!N(t))for(i=r.Ba.g.parse(t),t=0;t<i.length;t++){var s,a,o,u,l,h,c,d,f,g,m=i[t],p=m[0];p<=r.K||(r.K=p,m=m[1],2==r.I?"c"==m[0]?(r.M=m[1],r.ba=m[2],null!=(s=m[3])&&(r.ka=s,r.j.info("VER="+r.ka)),null!=(a=m[4])&&(r.za=a,r.j.info("SVER="+r.za)),null!=(o=m[5])&&"number"==typeof o&&0<o&&(n=1.5*o,r.O=n,r.j.info("backChannelRequestTimeoutMs_="+n)),n=r,(u=e.g)&&(!(l=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null)||(h=n.h).g||-1==l.indexOf("spdy")&&-1==l.indexOf("quic")&&-1==l.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(tt(h,h.h),h.h=null)),n.G)&&(c=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null)&&(n.wa=c,b(n.J,n.G,c)),r.I=3,r.l&&r.l.ra(),r.aa&&(r.T=Date.now()-e.F,r.j.info("Handshake RTT: "+r.T+"ms")),d=e,(n=r).na=er(n,n.L?n.ba:null,n.W),d.L?(rt(n.h,d),f=d,(g=n.O)&&(f.H=g),f.D&&(He(f),$e(f)),n.g=d):$t(n),0<r.i.length&&jt(r)):"stop"!=m[0]&&"close"!=m[0]||x(r,7):3==r.I&&("stop"==m[0]||"close"==m[0]?"stop"==m[0]?x(r,7):Ut(r):"noop"!=m[0]&&r.l&&r.l.qa(m),r.A=0))}Oe()}catch(e){}}m.prototype.ba=function(e){e=e.target;var t=this.O;t&&3==V(e)?t.j():this.Y(e)},m.prototype.Y=function(e){try{if(e==this.g)e:{var t=V(this.g),r=this.g.ya();this.g.ca();if(!(t<3)&&(3!=t||this.g&&(this.h.h||this.g.la()||Lt(this.g)))){this.K||4!=t||7==r||Oe(),He(this);var n,i,s=this.g.ca(),a=(this.X=s,(e=>{if(!Ge(e))return e.g.la();var t=Lt(e.g);if(""===t)return"";let r="",n=t.length,i=4==V(e.g);if(!e.h.i){if("undefined"==typeof TextDecoder)return M(e),O(e),"";e.h.i=new D.TextDecoder}for(let s=0;s<n;s++)e.h.h=!0,r+=e.h.i.decode(t[s],{stream:!(i&&s==n-1)});return t.length=0,e.h.g+=r,e.C=0,e.h.g})(this));if(this.o=200==s,I=this.i,T=this.v,E=this.B,S=this.l,x=this.S,A=t,C=s,I.info(function(){return"XMLHTTP RESP ("+S+") [ attempt "+x+"]: "+T+"\n"+E+"\n"+A+" "+C}),this.o){if(this.U&&!this.L){t:{if(this.g){var o,u=this.g;if((o=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!N(o)){var l=o;break t}}l=null}if(!(e=l)){this.o=!1,this.m=3,k(12),M(this),O(this);break e}R(this.i,this.l,e,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,We(this,e)}if(this.R){for(e=!0;!this.K&&this.C<a.length;){if(w=a,b=_=void 0,_=(v=this).C,(n=-1==(b=w.indexOf("\n",_))?je:(_=Number(w.substring(_,b)),isNaN(_)?qe:(b+=1)+_>w.length?je:(w=w.slice(b,b+_),v.C=b+_,w)))==je){4==t&&(this.m=4,k(14),e=!1),R(this.i,this.l,null,"[Incomplete Response]");break}if(n==qe){this.m=4,k(15),R(this.i,this.l,a,"[Invalid Chunk]"),e=!1;break}R(this.i,this.l,n,null),We(this,n)}Ge(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=t||0!=a.length||this.h.h||(this.m=1,k(16),e=!1),this.o=this.o&&e,e?0<a.length&&!this.W&&(this.W=!0,(i=this.j).g==this)&&i.aa&&!i.P&&(i.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),Ht(i),i.P=!0,k(11)):(R(this.i,this.l,a,"[Invalid Chunked Response]"),M(this),O(this))}else R(this.i,this.l,a,null),We(this,a);4==t&&M(this),this.o&&!this.K&&(4==t?Jt(this.j,this):(this.o=!1,$e(this)))}else{{var h=this.g;var c,d,f,g={};h=(h.g&&2<=V(h)&&h.g.getAllResponseHeaders()||"").split("\r\n");for(let e=0;e<h.length;e++)N(h[e])||(c=(e=>{for(var t=1,r=(e=e.split(":"),[]);0<t&&e.length;)r.push(e.shift()),t--;return e.length&&r.push(e.join(":")),r})(h[e]),d=c[0],"string"==typeof(c=c[1])&&(c=c.trim(),f=g[d]||[],(g[d]=f).push(c)));var m,p=g,y=function(e){return e.join(", ")};for(m in p)y.call(void 0,p[m],m,p)}400==s&&0<a.indexOf("Unknown SID")?(this.m=3,k(12)):(this.m=0,k(13)),M(this),O(this)}}}}catch(e){}var v,w,_,b,I,T,E,S,x,A,C},m.prototype.cancel=function(){this.K=!0,M(this)},m.prototype.aa=function(){this.D=null;var e,t,r=Date.now();0<=r-this.T?(e=this.i,t=this.B,e.info(function(){return"TIMEOUT: "+t}),2!=this.M&&(Oe(),k(17)),M(this),this.m=2,O(this)):Qe(this,this.T-r)};var Ye=class{constructor(e,t){this.g=e,this.map=t}};function Je(e){this.l=e||10,e=D.PerformanceNavigationTiming?0<(e=D.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):!!(D.chrome&&D.chrome.loadTimes&&D.chrome.loadTimes()&&D.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Xe(e){return e.h||e.g&&e.g.size>=e.j}function Ze(e){return e.h?1:e.g?e.g.size:0}function et(e,t){return e.h?e.h==t:e.g&&e.g.has(t)}function tt(e,t){e.g?e.g.add(t):e.h=t}function rt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function nt(t){if(null!=t.h)return t.i.concat(t.h.G);if(null==t.g||0===t.g.size)return z(t.i);{let e=t.i;for(var r of t.g.values())e=e.concat(r.G);return e}}Je.prototype.cancel=function(){if(this.i=nt(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(var e of this.g.values())e.cancel();this.g.clear()}};var it=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function p(e){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let t;e instanceof p?(this.l=e.l,_(this,e.j),this.o=e.o,this.g=e.g,st(this,e.u),this.h=e.h,at(this,bt(e.i)),this.m=e.m):e&&(t=String(e).match(it))?(this.l=!1,_(this,t[1]||"",!0),this.o=ut(t[2]||""),this.g=ut(t[3]||"",!0),st(this,t[4]),this.h=ut(t[5]||"",!0),at(this,t[6]||"",!0),this.m=ut(t[7]||"")):(this.l=!1,this.i=new pt(null,this.l))}function w(e){return new p(e)}function _(e,t,r){e.j=r?ut(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function st(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error("Bad port number "+t);e.u=t}else e.u=null}function at(e,t,r){var n,i;t instanceof pt?(e.i=t,n=e.i,(i=e.l)&&!n.j&&(I(n),n.i=null,n.g.forEach(function(e,t){var r=t.toLowerCase();t!=r&&(yt(this,t),_t(this,r,e))},n)),n.j=i):(r||(t=lt(t,gt)),e.i=new pt(t,e.l))}function b(e,t,r){e.i.set(t,r)}function ot(e){return b(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function ut(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function lt(e,t,r){return"string"==typeof e?(e=encodeURI(e).replace(t,ht),e=r?e.replace(/%25([0-9a-fA-F]{2})/g,"%$1"):e):null}function ht(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}p.prototype.toString=function(){var e=[],t=this.j,r=(t&&e.push(lt(t,ct,!0),":"),this.g);return!r&&"file"!=t||(e.push("//"),(t=this.o)&&e.push(lt(t,ct,!0),"@"),e.push(g(r).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null==(r=this.u))||e.push(":",String(r)),(r=this.h)&&(this.g&&"/"!=r.charAt(0)&&e.push("/"),e.push(lt(r,"/"==r.charAt(0)?ft:dt,!0))),(r=this.i.toString())&&e.push("?",r),(r=this.m)&&e.push("#",lt(r,mt)),e.join("")},p.prototype.resolve=function(e){var t=w(this);let r=!!e.j;r?_(t,e.j):r=!!e.o,r?t.o=e.o:r=!!e.g,r?t.g=e.g:r=null!=e.u;var n=e.h;if(r)st(t,e.u);else if(r=!!e.h)if("/"!=n.charAt(0)&&(this.g&&!this.h?n="/"+n:-1!=(i=t.h.lastIndexOf("/"))&&(n=t.h.slice(0,i+1)+n)),".."==(i=n)||"."==i)n="";else if(-1!=i.indexOf("./")||-1!=i.indexOf("/.")){var n=0==i.lastIndexOf("/",0),i=i.split("/"),s=[];for(let e=0;e<i.length;){var a=i[e++];"."==a?n&&e==i.length&&s.push(""):".."==a?((1<s.length||1==s.length&&""!=s[0])&&s.pop(),n&&e==i.length&&s.push("")):(s.push(a),n=!0)}n=s.join("/")}else n=i;return r?t.h=n:r=""!==e.i.toString(),r?at(t,bt(e.i)):r=!!e.m,r&&(t.m=e.m),t};var ct=/[#\/\?@]/g,dt=/[#\?:]/g,ft=/[#\?]/g,gt=/[#\?@]/g,mt=/#/g;function pt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function I(r){if(!r.g&&(r.g=new Map,r.h=0,r.i)){var n=r.i,i=function(e,t){r.add(decodeURIComponent(e.replace(/\+/g," ")),t)};if(n){n=n.split("&");for(let r=0;r<n.length;r++){var s=n[r].indexOf("=");let e,t=null;0<=s?(e=n[r].substring(0,s),t=n[r].substring(s+1)):e=n[r],i(e,t?decodeURIComponent(t.replace(/\+/g," ")):"")}}}}function yt(e,t){I(e),t=T(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function vt(e,t){return I(e),t=T(e,t),e.g.has(t)}function wt(e,t){I(e);let r=[];if("string"==typeof t)vt(e,t)&&(r=r.concat(e.g.get(T(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)r=r.concat(e[t]);return r}function _t(e,t,r){yt(e,t),0<r.length&&(e.i=null,e.g.set(T(e,t),z(r)),e.h+=r.length)}function bt(e){var t=new pt;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function T(e,t){return t=String(t),t=e.j?t.toLowerCase():t}function E(e,t,r,n,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),n(r)}catch(e){}}function It(){this.g=new Ee}function Tt(e){this.i=e.Sb||null,this.h=e.ab||!1}function Et(e,t){a.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function St(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}function xt(e){e.readyState=4,e.l=null,e.j=null,e.B=null,At(e)}function At(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Ct(e){let r="";return ee(e,function(e,t){r=(r=r+t+":")+e+"\r\n"}),r}function Dt(e,t,r){e:{for(n in r){var n=!1;break e}n=!0}n||(r=Ct(r),"string"==typeof e?null!=r&&g(r):b(e,t,r))}function S(e){a.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(e=pt.prototype).add=function(e,t){I(this),this.i=null,e=T(this,e);let r=this.g.get(e);return r||this.g.set(e,r=[]),r.push(t),this.h+=1,this},e.forEach=function(r,n){I(this),this.g.forEach(function(e,t){e.forEach(function(e){r.call(n,e,t,this)},this)},this)},e.set=function(e,t){return I(this),this.i=null,vt(this,e=T(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=wt(this,e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";var r=[],e=Array.from(this.g.keys());for(let s=0;s<e.length;s++){var n=g(i=e[s]),i=wt(this,i);for(let t=0;t<i.length;t++){let e=n;""!==i[t]&&(e+="="+g(i[t])),r.push(e)}}return this.i=r.join("&")},t(Tt,Se),Tt.prototype.g=function(){return new Et(this.i,this.h)},t(Et,a),(e=Et.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=e,this.D=t,this.readyState=1,At(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;var t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||D).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,xt(this)),this.readyState=0},e.Pa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,At(this)),this.g)&&(this.readyState=3,At(this),this.g))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(void 0!==D.ReadableStream&&"body"in e){if(this.j=e.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.B=new TextDecoder;St(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))},e.Ma=function(e){var t;this.g&&(this.o&&e.value?this.response.push(e.value):!this.o&&(t=e.value||new Uint8Array(0),t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t),(e.done?xt:At)(this),3==this.readyState)&&St(this)},e.Oa=function(e){this.g&&(this.response=this.responseText=e,xt(this))},e.Na=function(e){this.g&&(this.response=e,xt(this))},e.ga=function(){this.g&&xt(this)},e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";for(var e=[],t=this.h.entries(),r=t.next();!r.done;)r=r.value,e.push(r[0]+": "+r[1]),r=t.next();return e.join("\r\n")},Object.defineProperty(Et.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),t(S,a);var Nt=/^https?$/i,kt=["POST","PUT"];function Rt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,Ot(e),Vt(e)}function Ot(e){e.A||(e.A=!0,l(e,"complete"),l(e,"error"))}function Mt(t){if(t.h&&void 0!==U)if(t.v&&4==V(t))setTimeout(t.Ca.bind(t),0);else if(l(t,"readystatechange"),4==V(t)){t.h=!1;try{var e,r,n=t.ca();switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var i=!0;break;default:i=!1}if(!(e=i)){if(r=0===n){let e=String(t.D).match(it)[1]||null;!e&&D.self&&D.self.location&&(e=D.self.location.protocol.slice(0,-1)),r=!Nt.test(e?e.toLowerCase():"")}e=r}if(e)l(t,"complete"),l(t,"success");else{t.o=6;try{var s=2<V(t)?t.g.statusText:""}catch(e){s=""}t.l=s+" ["+t.ca()+"]",Ot(t)}}finally{Vt(t)}}}function Vt(e,t){if(e.g){e.m&&(clearTimeout(e.m),e.m=null);var r=e.g;e.g=null,t||l(e,"ready");try{r.onreadystatechange=null}catch(e){}}}function V(e){return e.g?e.g.readyState:0}function Lt(e){try{if(e.g){if("response"in e.g)return e.g.response;switch(e.F){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}}return null}catch(e){return null}}function Ft(e,t,r){return r&&r.internalChannelParams&&r.internalChannelParams[e]||t}function Pt(e){this.za=0,this.i=[],this.j=new f,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=Ft("failFast",!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=Ft("baseRetryDelayMs",5e3,e),this.Za=Ft("retryDelaySeedMs",1e4,e),this.Ta=Ft("forwardChannelMaxRetries",2,e),this.va=Ft("forwardChannelRequestTimeoutMs",2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M="",this.h=new Je(e&&e.concurrentRequestLimit),this.Ba=new It,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function Ut(e){if(qt(e),3==e.I){var t=e.V++,r=w(e.J);if(b(r,"SID",e.M),b(r,"RID",t),b(r,"TYPE","terminate"),Kt(e,r),(t=new m(e,e.j,t)).M=2,t.A=ot(w(r)),r=!1,D.navigator&&D.navigator.sendBeacon)try{r=D.navigator.sendBeacon(t.A.toString(),"")}catch(e){}!r&&D.Image&&((new Image).src=t.A,r=!0),r||(t.g=tr(t.j,null),t.g.ea(t.A)),t.F=Date.now(),$e(t)}Zt(e)}function Bt(e){e.g&&(Ht(e),e.g.cancel(),e.g=null)}function qt(e){Bt(e),e.v&&(D.clearTimeout(e.v),e.v=null),Yt(e),e.h.cancel(),e.m&&("number"==typeof e.m&&D.clearTimeout(e.m),e.m=null)}function jt(e){var t;Xe(e.h)||e.m||(e.m=!0,t=e.Ea,r||H(),n||(r(),n=!0),Q.add(t,e),e.D=0)}function zt(e,t){var r=t?t.l:e.V++,n=w(e.J);b(n,"SID",e.M),b(n,"RID",r),b(n,"AID",e.K),Kt(e,n),e.u&&e.o&&Dt(n,e.u,e.o),r=new m(e,e.j,r,e.D+1),null===e.u&&(r.J=e.o),t&&(e.i=t.G.concat(e.i)),t=Gt(e,r,1e3),r.H=Math.round(.5*e.va)+Math.round(.5*e.va*Math.random()),tt(e.h,r),ze(r,n,t)}function Kt(e,r){e.H&&ee(e.H,function(e,t){b(r,t,e)}),e.l&&ee({},function(e,t){b(r,t,e)})}function Gt(e,t,i){i=Math.min(e.i.length,i);var s=e.l?y(e.l.Ka,e.l,e):null;e:{let r=e.i,n=-1;for(;;){var a=["count="+i];-1==n?0<i?(n=r[0].g,a.push("ofs="+n)):n=0:a.push("ofs="+n);let e=!0;for(let t=0;t<i;t++){var o=r[t].g,u=r[t].map;if((o-=n)<0)n=Math.max(0,r[t].g-100),e=!1;else try{o="req"+o+"_"||"";try{var l,h,c=u instanceof Map?u:Object.entries(u);for([l,h]of c){let e=h;d(h)&&(e=Ie(h)),a.push(o+l+"="+encodeURIComponent(e))}}catch(e){throw a.push(o+"type="+encodeURIComponent("_badmap")),e}}catch(e){s&&s(u)}}if(e){c=a.join("&");break e}}c=void 0}return e=e.i.splice(0,i),t.G=e,c}function $t(e){var t;e.g||e.v||(e.Y=1,t=e.Da,r||H(),n||(r(),n=!0),Q.add(t,e),e.A=0)}function Qt(e){return!(e.g||e.v||3<=e.A)&&(e.Y++,e.v=v(y(e.Da,e),Xt(e,e.A)),e.A++,1)}function Ht(e){null!=e.B&&(D.clearTimeout(e.B),e.B=null)}function Wt(e){e.g=new m(e,e.j,"rpc",e.Y),null===e.u&&(e.g.J=e.o),e.g.P=0;var t=w(e.na),r=(b(t,"RID","rpc"),b(t,"SID",e.M),b(t,"AID",e.K),b(t,"CI",e.F?"0":"1"),!e.F&&e.ia&&b(t,"TO",e.ia),b(t,"TYPE","xmlhttp"),Kt(e,t),e.u&&e.o&&Dt(t,e.u,e.o),e.O&&(e.g.H=e.O),e.g);e=e.ba,r.M=1,r.A=ot(w(t)),r.u=null,r.R=!0,Ke(r,e)}function Yt(e){null!=e.C&&(D.clearTimeout(e.C),e.C=null)}function Jt(e,t){var r,n,i,s=null;if(e.g==t){Yt(e),Ht(e),e.g=null;var a=2}else{if(!et(e.h,t))return;s=t.G,rt(e.h,t),a=1}if(0!=e.I)if(t.o)(1==a?(s=t.u?t.u.length:0,t=Date.now()-t.F,r=e.D,l(a=ke(),new Ve(a,s)),jt):$t)(e);else if(3==(r=t.m)||0==r&&0<t.X||(1!=a||(i=t,Ze((n=e).h)>=n.h.j-(n.m?1:0))||(n.m?(n.i=i.G.concat(n.i),0):1==n.I||2==n.I||n.D>=(n.Sa?0:n.Ta)||(n.m=v(y(n.Ea,n,i),Xt(n,n.D)),n.D++,0)))&&(2!=a||!Qt(e)))switch(s&&0<s.length&&(t=e.h,t.i=t.i.concat(s)),r){case 1:x(e,5);break;case 4:x(e,10);break;case 3:x(e,6);break;default:x(e,2)}}function Xt(e,t){let r=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(r*=2),r*t}function x(e,t){var r,n,i;e.j.info("Error code "+t),2==t?(r=y(e.bb,e),n=!(i=e.Ua),i=new p(i||"//www.google.com/images/cleardot.gif"),D.location&&"http"==D.location.protocol||_(i,"https"),ot(i),(n?(t,r)=>{var n=new f;if(D.Image){let e=new Image;e.onload=q(E,n,"TestLoadImage: loaded",!0,r,e),e.onerror=q(E,n,"TestLoadImage: error",!1,r,e),e.onabort=q(E,n,"TestLoadImage: abort",!1,r,e),e.ontimeout=q(E,n,"TestLoadImage: timeout",!1,r,e),D.setTimeout(function(){e.ontimeout&&e.ontimeout()},1e4),e.src=t}else r(!1)}:(e,t)=>{let r=new f,n=new AbortController,i=setTimeout(()=>{n.abort(),E(r,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(i),e.ok?E(r,0,!0,t):E(r,0,!1,t)}).catch(()=>{clearTimeout(i),E(r,0,!1,t)})})(i.toString(),r)):k(2),e.I=0,e.l&&e.l.pa(t),Zt(e),qt(e)}function Zt(e){var t;e.I=0,e.ja=[],e.l&&(0==(t=nt(e.h)).length&&0==e.i.length||(K(e.ja,t),K(e.ja,e.i),e.h.i.length=0,z(e.i),e.i.length=0),e.l.oa())}function er(e,t,r){var n,i,s=r instanceof p?w(r):new p(r);return""!=s.g?(t&&(s.g=t+"."+s.g),st(s,s.u)):(s=(n=D.location).protocol,t=t?t+"."+n.hostname:n.hostname,n=+n.port,i=new p(null),s&&_(i,s),t&&(i.g=t),n&&st(i,n),r&&(i.h=r),s=i),r=e.G,t=e.wa,r&&t&&b(s,r,t),b(s,"VER",e.ka),Kt(e,s),s}function tr(e,t,r){if(t&&!e.L)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Aa&&!e.ma?new S(new Tt({ab:r})):new S(e.ma)).Fa(e.L),t}function rr(){}function nr(){}function A(e,t){a.call(this),this.g=new Pt(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.sa&&(e?e["X-WebChannel-Client-Profile"]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!N(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!N(t)&&(this.g.G=t,null!==(e=this.h))&&t in e&&t in(e=this.h)&&delete e[t],this.j=new C(this)}function ir(e){Ce.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(var r in t){e=r;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function sr(){De.call(this),this.status=1}function C(e){this.g=e}(e=S.prototype).Fa=function(e){this.H=e},e.ea=function(e,t,r,n){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=(this.L||Be).g(),this.g.onreadystatechange=j(y(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Rt(this,e)}if(e=r||"",r=new Map(this.headers),n)if(Object.getPrototypeOf(n)===Object.prototype)for(var i in n)r.set(i,n[i]);else{if("function"!=typeof n.keys||"function"!=typeof n.get)throw Error("Unknown input type for opt_headers: "+String(n));for(var s of n.keys())r.set(s,n.get(s))}n=Array.from(r.keys()).find(e=>"content-type"==e.toLowerCase()),i=D.FormData&&e instanceof D.FormData,0<=Array.prototype.indexOf.call(kt,t,void 0)&&!n&&!i&&r.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(var[a,o]of r)this.g.setRequestHeader(a,o);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(e),this.v=!1}catch(e){Rt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,l(this,"complete"),l(this,"abort"),Vt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Vt(this,!0)),S.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?Mt(this):this.Xa())},e.Xa=function(){Mt(this)},e.isActive=function(){return!!this.g},e.ca=function(){try{return 2<V(this)?this.g.status:-1}catch(e){return-1}},e.la=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.La=function(e){var t;if(this.g)return t=this.g.responseText,e&&0==t.indexOf(e)&&(t=t.substring(e.length)),Te(t)},e.ya=function(){return this.o},e.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=Pt.prototype).ka=8,e.I=1,e.connect=function(e,t,r,n){k(0),this.W=e,this.H=t||{},r&&void 0!==n&&(this.H.OSID=r,this.H.OAID=n),this.F=this.X,this.J=er(this,null,this.W),jt(this)},e.Ea=function(t){if(this.m)if(this.m=null,1==this.I){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;var r=new m(this,this.j,t);let e=this.o;if(this.U&&(e?ne(e=te(e),this.U):e=this.U),null!==this.u||this.R||(r.J=e,e=null),this.S)e:{for(var n=0,i=0;i<this.i.length;i++){var s=this.i[i];if("__data__"in s.map&&"string"==typeof(s=s.map.__data__)?s=s.length:s=void 0,void 0===s)break;if(4096<(n+=s)){n=i;break e}if(4096===n||i===this.i.length-1){n=i+1;break e}}n=1e3}else n=1e3;n=Gt(this,r,n),b(i=w(this.J),"RID",t),b(i,"CVER",22),this.G&&b(i,"X-HTTP-Session-Id",this.G),Kt(this,i),e&&(this.R?n="headers="+g(Ct(e))+"&"+n:this.u&&Dt(i,this.u,e)),tt(this.h,r),this.Ra&&b(i,"TYPE","init"),this.S?(b(i,"$req",n),b(i,"SID","null"),r.U=!0,ze(r,i,null)):ze(r,i,n),this.I=2}}else 3==this.I&&(t?zt(this,t):0==this.i.length||Xe(this.h)||zt(this))},e.Da=function(){var e;this.v=null,Wt(this),this.aa&&!(this.P||null==this.g||this.T<=0)&&(e=4*this.T,this.j.info("BP detection timer enabled: "+e),this.B=v(y(this.Wa,this),e))},e.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,k(10),Bt(this),Wt(this))},e.Va=function(){null!=this.C&&(this.C=null,Bt(this),Qt(this),k(19))},e.bb=function(e){e?(this.j.info("Successfully pinged google.com"),k(2)):(this.j.info("Failed to ping google.com"),k(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=rr.prototype).ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){},nr.prototype.g=function(e,t){return new A(e,t)},t(A,a),A.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},A.prototype.close=function(){Ut(this.g)},A.prototype.o=function(e){var t,r=this.g;"string"==typeof e?((t={}).__data__=e,e=t):this.v&&((t={}).__data__=Ie(e),e=t),r.i.push(new Ye(r.Ya++,e)),3==r.I&&jt(r)},A.prototype.N=function(){this.g.l=null,delete this.j,Ut(this.g),delete this.g,A.Z.N.call(this)},t(ir,Ce),t(sr,De),t(C,rr),C.prototype.ra=function(){l(this.g,"a")},C.prototype.qa=function(e){l(this.g,new ir(e))},C.prototype.pa=function(e){l(this.g,new sr)},C.prototype.oa=function(){l(this.g,"b")},nr.prototype.createWebChannel=nr.prototype.g,A.prototype.send=A.prototype.o,A.prototype.open=A.prototype.m,fr=function(){return new nr},dr=ke,cr=c,hr={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Le.NO_ERROR=0,Le.TIMEOUT=8,Le.HTTP_ERROR=6,lr=Le,Fe.COMPLETE="complete",ur=Fe,(xe.EventType=Ae).OPEN="a",Ae.CLOSE="b",Ae.ERROR="c",Ae.MESSAGE="d",a.prototype.listen=a.prototype.J,or=xe,S.prototype.listenOnce=S.prototype.K,S.prototype.getLastError=S.prototype.Ha,S.prototype.getLastErrorCode=S.prototype.ya,S.prototype.getStatus=S.prototype.ca,S.prototype.getResponseJson=S.prototype.La,S.prototype.getResponseText=S.prototype.la,S.prototype.send=S.prototype.ea,S.prototype.setWithCredentials=S.prototype.Fa,ar=S}).apply(void 0!==gr?gr:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});class l{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}l.UNAUTHENTICATED=new l(null),l.GOOGLE_CREDENTIALS=new l("google-credentials-uid"),l.FIRST_PARTY=new l("first-party-uid"),l.MOCK_USER=new l("mock-user");let ge="12.12.1";let me=new class{constructor(e){this.name=e,this._logLevel=he,this._logHandler=de,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in c))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?le[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,c.DEBUG,...e),this._logHandler(this,c.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,c.VERBOSE,...e),this._logHandler(this,c.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,c.INFO,...e),this._logHandler(this,c.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,c.WARN,...e),this._logHandler(this,c.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,c.ERROR,...e),this._logHandler(this,c.ERROR,...e)}}("@firebase/firestore");function pe(){return me.logLevel}function g(e,...t){var r;me.logLevel<=c.DEBUG&&(r=t.map(ve),me.debug(`Firestore (${ge}): `+e,...r))}function d(e,...t){var r;me.logLevel<=c.ERROR&&(r=t.map(ve),me.error(`Firestore (${ge}): `+e,...r))}function ye(e,...t){var r;me.logLevel<=c.WARN&&(r=t.map(ve),me.warn(`Firestore (${ge}): `+e,...r))}function ve(t){if("string"==typeof t)return t;try{return JSON.stringify(t)}catch(e){return t}}function E(e,t,r){let n="Unexpected state";"string"==typeof t?n=t:r=t,we(e,n,r)}function we(e,t,r){let n=`FIRESTORE (${ge}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==r)try{n+=" CONTEXT: "+JSON.stringify(r)}catch(e){n+=" CONTEXT: "+r}throw d(n),new Error(n)}function y(e,t,r,n){let i="Unexpected state";"string"==typeof r?i=r:n=r,e||we(t,i,n)}let b={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class I extends ee{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: `+this.message}}class m{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class _e{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization","Bearer "+e)}}class be{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(l.UNAUTHENTICATED))}shutdown(){}}class Ie{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class Te{constructor(e){this.t=e,this.currentUser=l.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,r){y(void 0===this.o,42304);let n=this.i,i=e=>this.i!==n?(n=this.i,r(e)):Promise.resolve(),s=new m,a=(this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new m,t.enqueueRetryable(()=>i(this.currentUser))},()=>{let e=s;t.enqueueRetryable(async()=>{await e.promise,await i(this.currentUser)})}),o=e=>{g("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit(e=>o(e)),setTimeout(()=>{var e;this.auth||((e=this.t.getImmediate({optional:!0}))?o(e):(g("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new m))},0),a()}getToken(){let t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then(e=>this.i!==t?(g("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(y("string"==typeof e.accessToken,31837,{l:e}),new _e(e.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(){var e=this.auth&&this.auth.getUid();return y(null===e||"string"==typeof e,2055,{h:e}),new l(e)}}class Ee{constructor(e,t,r){this.P=e,this.T=t,this.I=r,this.type="FirstParty",this.user=l.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);var e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class Se{constructor(e,t,r){this.P=e,this.T=t,this.I=r}getToken(){return Promise.resolve(new Ee(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(l.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class xe{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&0<e.length&&this.headers.set("x-firebase-appcheck",this.value)}}class Ae{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Hd._isFirebaseServerApp(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(t,r){y(void 0===this.o,3512);let n=e=>{null!=e.error&&g("FirebaseAppCheckTokenProvider","Error getting App Check token; using placeholder token instead. Error: "+e.error.message);var t=e.token!==this.m;return this.m=e.token,g("FirebaseAppCheckTokenProvider",`Received ${t?"new":"existing"} token.`),t?r(e.token):Promise.resolve()},i=(this.o=e=>{t.enqueueRetryable(()=>n(e))},e=>{g("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)});this.V.onInit(e=>i(e)),setTimeout(()=>{var e;this.appCheck||((e=this.V.getImmediate({optional:!0}))?i(e):g("FirebaseAppCheckTokenProvider","AppCheck not yet detected"))},0)}getToken(){var e;return this.p?Promise.resolve(new xe(this.p)):(e=this.forceRefresh,this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(y("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new xe(e.token)):null):Promise.resolve(null))}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}class Ce{static newId(){var t=62*Math.floor(256/62);let r="";for(;r.length<20;){var n=(t=>{var r="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(r&&"function"==typeof r.getRandomValues)r.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n})(40);for(let e=0;e<n.length;++e)r.length<20&&n[e]<t&&(r+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[e]%62))}return r}}function S(e,t){return e<t?-1:t<e?1:0}function De(r,n){let e=Math.min(r.length,n.length);for(let i=0;i<e;i++){let e=r.charAt(i),t=n.charAt(i);if(e!==t)return Re(e)===Re(t)?S(e,t):Re(e)?1:-1}return S(r.length,n.length)}let Ne=55296,ke=57343;function Re(e){var t=e.charCodeAt(0);return t>=Ne&&t<=ke}function Oe(e,r,n){return e.length===r.length&&e.every((e,t)=>n(e,r[t]))}function Me(e){return e+"\0"}let Ve="__name__";class Le{constructor(e,t,r){void 0===t?t=0:t>e.length&&E(637,{offset:t,range:e.length}),void 0===r?r=e.length-t:r>e.length-t&&E(1746,{length:r,range:e.length-t}),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return 0===Le.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof Le?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return this.construct(this.segments,this.offset+(e=void 0===e?1:e),this.length-e)}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(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,r){let e=Math.min(t.length,r.length);for(let n=0;n<e;n++){let e=Le.compareSegments(t.get(n),r.get(n));if(0!==e)return e}return S(t.length,r.length)}static compareSegments(e,t){var r=Le.isNumericId(e),n=Le.isNumericId(t);return r&&!n?-1:!r&&n?1:r&&n?Le.extractNumericId(e).compare(Le.extractNumericId(t)):De(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return oe.fromString(e.substring(4,e.length-2))}}class T extends Le{construct(e,t,r){return new T(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){var t,r=[];for(t of e){if(0<=t.indexOf("//"))throw new I(b.INVALID_ARGUMENT,`Invalid segment (${t}). Paths must not contain // in them.`);r.push(...t.split("/").filter(e=>0<e.length))}return new T(r)}static emptyPath(){return new T([])}}let Fe=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class h extends Le{construct(e,t,r){return new h(e,t,r)}static isValidIdentifier(e){return Fe.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),e=h.isValidIdentifier(e)?e:"`"+e+"`")).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Ve}static keyField(){return new h([Ve])}static fromServerFormat(t){let e=[],r="",n=0;var i=()=>{if(0===r.length)throw new I(b.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(r),r=""};let s=!1;for(;n<t.length;){let e=t[n];if("\\"===e){if(n+1===t.length)throw new I(b.INVALID_ARGUMENT,"Path has trailing escape character: "+t);let e=t[n+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new I(b.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);r+=e,n+=2}else"`"===e?s=!s:"."!==e||s?r+=e:i(),n++}if(i(),s)throw new I(b.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new h(e)}static emptyPath(){return new h([])}}class x{constructor(e){this.path=e}static fromPath(e){return new x(T.fromString(e))}static fromName(e){return new x(T.fromString(e).popFirst(5))}static empty(){return new x(T.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return 2<=this.path.length&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===T.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return T.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new x(new T(e.slice()))}}function Pe(e,t,r){if(!r)throw new I(b.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Ue(e,t,r,n){if(!0===t&&!0===n)throw new I(b.INVALID_ARGUMENT,e+` and ${r} cannot be used together.`)}function Be(e){if(!x.isDocumentKey(e))throw new I(b.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function qe(e){if(x.isDocumentKey(e))throw new I(b.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function je(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function ze(e){var t,r;return void 0===e?"undefined":null===e?"null":"string"==typeof e?(20<e.length&&(e=e.substring(0,20)+"..."),JSON.stringify(e)):"number"==typeof e||"boolean"==typeof e?""+e:"object"==typeof e?e instanceof Array?"an array":(t=(r=e).constructor?r.constructor.name:null)?`a custom ${t} object`:"an object":"function"==typeof e?"a function":E(12329,{type:typeof e})}function p(e,t){if((e="_delegate"in e?e._delegate:e)instanceof t)return e;if(t.name===e.constructor.name)throw new I(b.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");var r=ze(e);throw new I(b.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: `+r)}function Ke(e,t){if(t<=0)throw new I(b.INVALID_ARGUMENT,`Function ${e}() requires a positive number, but it was: ${t}.`)}function t(e,t){var r={typeString:e};return t&&(r.value=t),r}function Ge(e,t){if(!je(e))throw new I(b.INVALID_ARGUMENT,"JSON must be an object");let r;for(var n in t)if(t[n]){var i=t[n].typeString,s="value"in t[n]?{value:t[n].value}:void 0;if(!(n in e)){r=`JSON missing required field: '${n}'`;break}var a=e[n];if(i&&typeof a!==i){r=`JSON field '${n}' must be a ${i}.`;break}if(void 0!==s&&a!==s.value){r=`Expected '${n}' field to equal '${s.value}'`;break}}if(r)throw new I(b.INVALID_ARGUMENT,r);return 1}let $e=-62135596800;class v{static now(){return v.fromMillis(Date.now())}static fromDate(e){return v.fromMillis(e.getTime())}static fromMillis(e){var t=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*t));return new v(t,r)}constructor(e,t){if(this.seconds=e,(this.nanoseconds=t)<0)throw new I(b.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(1e9<=t)throw new I(b.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<$e)throw new I(b.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(253402300800<=e)throw new I(b.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?S(this.nanoseconds,e.nanoseconds):S(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:v._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Ge(e,v._jsonSchema))return new v(e.seconds,e.nanoseconds)}valueOf(){var e=this.seconds-$e;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}v._jsonSchemaVersion="firestore/timestamp/1.0",v._jsonSchema={type:t("string",v._jsonSchemaVersion),seconds:t("number"),nanoseconds:t("number")};class w{static fromTimestamp(e){return new w(e)}static min(){return new w(new v(0,0))}static max(){return new w(new v(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}let Qe=-1;class He{constructor(e,t,r,n){this.indexId=e,this.collectionGroup=t,this.fields=r,this.indexState=n}}function We(e){return e.fields.find(e=>2===e.kind)}function Ye(e){return e.fields.filter(e=>2!==e.kind)}He.UNKNOWN_ID=-1;class Je{constructor(e,t){this.fieldPath=e,this.kind=t}}class Xe{constructor(e,t){this.sequenceNumber=e,this.offset=t}static empty(){return new Xe(0,tt.min())}}function Ze(e,t){var r=e.toTimestamp().seconds,n=e.toTimestamp().nanoseconds+1,r=w.fromTimestamp(1e9===n?new v(r+1,0):new v(r,n));return new tt(r,x.empty(),t)}function et(e){return new tt(e.readTime,e.key,Qe)}class tt{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new tt(w.min(),x.empty(),Qe)}static max(){return new tt(w.max(),x.empty(),Qe)}}function rt(e,t){var r=e.readTime.compareTo(t.readTime);return 0!==r||0!==(r=x.comparator(e.documentKey,t.documentKey))?r:S(e.largestBatchId,t.largestBatchId)}let nt="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class it{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function st(e){if(e.code!==b.FAILED_PRECONDITION||e.message!==nt)throw e;g("LocalStore","Unexpectedly lost primary lease")}class A{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(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(e){return this.next(void 0,e)}next(n,i){return this.callbackAttached&&E(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(i,this.error):this.wrapSuccess(n,this.result):new A((t,r)=>{this.nextCallback=e=>{this.wrapSuccess(n,e).next(t,r)},this.catchCallback=e=>{this.wrapFailure(i,e).next(t,r)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{var t=e();return t instanceof A?t:A.resolve(t)}catch(e){return A.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):A.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):A.reject(t)}static resolve(r){return new A((e,t)=>{e(r)})}static reject(r){return new A((e,t)=>{t(r)})}static waitFor(e){return new A((t,r)=>{let n=0,i=0,s=!1;e.forEach(e=>{++n,e.next(()=>{++i,s&&i===n&&t()},e=>r(e))}),s=!0,i===n&&t()})}static or(e){let t=A.resolve(!1);for(let r of e)t=t.next(e=>e?A.resolve(e):r());return t}static forEach(e,r){let n=[];return e.forEach((e,t)=>{n.push(r.call(this,e,t))}),this.waitFor(n)}static mapArray(o,u){return new A((r,n)=>{let i=o.length,s=new Array(i),a=0;for(let e=0;e<i;e++){let t=e;u(o[t]).next(e=>{s[t]=e,++a===i&&r(s)},e=>n(e))}})}static doWhile(n,i){return new A((e,t)=>{let r=()=>{!0===n()?i().next(()=>{r()},t):e()};r()})}}let at="SimpleDb";class ot{static open(e,t,r,n){try{return new ot(t,e.transaction(n,r))}catch(e){throw new ct(t,e)}}constructor(r,e){this.action=r,this.transaction=e,this.aborted=!1,this.S=new m,this.transaction.oncomplete=()=>{this.S.resolve()},this.transaction.onabort=()=>{e.error?this.S.reject(new ct(r,e.error)):this.S.resolve()},this.transaction.onerror=e=>{var t=pt(e.target.error);this.S.reject(new ct(r,t))}}get D(){return this.S.promise}abort(e){e&&this.S.reject(e),this.aborted||(g(at,"Aborting transaction:",e?e.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())}C(){var e=this.transaction;this.aborted||"function"!=typeof e.commit||e.commit()}store(e){var t=this.transaction.objectStore(e);return new ft(t)}}class ut{static delete(e){return g(at,"Removing database:",e),gt(G().indexedDB.deleteDatabase(e)).toPromise()}static v(){var e,t,r;return!(!(()=>{try{return"object"==typeof indexedDB}catch(e){}})()||!ut.F()&&(e=Y(),t=0<(t=ut.M(e))&&t<10,r=0<(r=lt(e))&&r<4.5,0<e.indexOf("MSIE ")||0<e.indexOf("Trident/")||0<e.indexOf("Edge/")||t||r))}static F(){return"undefined"!=typeof process&&"YES"===process.__PRIVATE_env?.__PRIVATE_USE_MOCK_PERSISTENCE}static O(e,t){return e.store(t)}static M(e){var t=e.match(/i(?:phone|pad|pod) os ([\d_]+)/i),t=t?t[1].split("_").slice(0,2).join("."):"-1";return Number(t)}constructor(e,t,r){this.name=e,this.version=t,this.N=r,this.B=null,12.2===ut.M(Y())&&d("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.")}async L(s){return this.db||(g(at,"Opening database:",this.name),this.db=await new Promise((r,n)=>{let i=indexedDB.open(this.name,this.version);i.onsuccess=e=>{var t=e.target.result;r(t)},i.onblocked=()=>{n(new ct(s,"Cannot upgrade IndexedDB schema while another tab is open. Close all tabs that access Firestore and reload this page to proceed."))},i.onerror=e=>{var t=e.target.error;"VersionError"===t.name?n(new I(b.FAILED_PRECONDITION,"A newer version of the Firestore SDK was previously used and so the persisted data is not compatible with the version of the SDK you are now using. The SDK will operate with persistence disabled. If you need persistence, please re-upgrade to a newer version of the SDK or else clear the persisted IndexedDB data for your app to start fresh.")):"InvalidStateError"===t.name?n(new I(b.FAILED_PRECONDITION,"Unable to open an IndexedDB connection. This could be due to running in a private browsing session on a browser whose private browsing sessions do not support IndexedDB: "+t)):n(new ct(s,t))},i.onupgradeneeded=e=>{g(at,'Database "'+this.name+'" requires upgrade from version:',e.oldVersion);var t=e.target.result;this.N.k(t,i.transaction,e.oldVersion,this.version).next(()=>{g(at,"Database upgrade to version "+this.version+" complete")})}})),this.q&&(this.db.onversionchange=e=>this.q(e)),this.db}K(t){this.q=t,this.db&&(this.db.onversionchange=e=>t(e))}async runTransaction(r,e,n,i){var s="readonly"===e;let a=0;for(;;){++a;try{this.db=await this.L(r);let t=ot.open(this.db,r,s?"readonly":"readwrite",n),e=i(t).next(e=>(t.C(),e)).catch(e=>(t.abort(e),A.reject(e))).toPromise();return e.catch(()=>{}),await t.D,e}catch(r){let e=r,t="FirebaseError"!==e.name&&a<3;if(g(at,"Transaction failed with error:",e.message,"Retrying:",t),this.close(),!t)return Promise.reject(e)}}}close(){this.db&&this.db.close(),this.db=void 0}}function lt(e){var t=e.match(/Android ([\d.]+)/i),t=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(t)}class ht{constructor(e){this.U=e,this.$=!1,this.W=null}get isDone(){return this.$}get G(){return this.W}set cursor(e){this.U=e}done(){this.$=!0}j(e){this.W=e}delete(){return gt(this.U.delete())}}class ct extends I{constructor(e,t){super(b.UNAVAILABLE,`IndexedDB transaction '${e}' failed: `+t),this.name="IndexedDbTransactionError"}}function dt(e){return"IndexedDbTransactionError"===e.name}class ft{constructor(e){this.store=e}put(e,t){let r;return gt(r=void 0!==t?(g(at,"PUT",this.store.name,e,t),this.store.put(t,e)):(g(at,"PUT",this.store.name,"<auto-key>",e),this.store.put(e)))}add(e){return g(at,"ADD",this.store.name,e,e),gt(this.store.add(e))}get(t){return gt(this.store.get(t)).next(e=>(void 0===e&&(e=null),g(at,"GET",this.store.name,t,e),e))}delete(e){return g(at,"DELETE",this.store.name,e),gt(this.store.delete(e))}count(){return g(at,"COUNT",this.store.name),gt(this.store.count())}J(e,t){var n=this.options(e,t),r=n.index?this.store.index(n.index):this.store;if("function"==typeof r.getAll){let e=r.getAll(n.range);return new A((t,r)=>{e.onerror=e=>{r(e.target.error)},e.onsuccess=e=>{t(e.target.result)}})}{let e=this.cursor(n),r=[];return this.H(e,(e,t)=>{r.push(t)}).next(()=>r)}}Z(e,t){let n=this.store.getAll(e,null===t?void 0:t);return new A((t,r)=>{n.onerror=e=>{r(e.target.error)},n.onsuccess=e=>{t(e.target.result)}})}X(e,t){g(at,"DELETE ALL",this.store.name);var r=this.options(e,t),r=(r.Y=!1,this.cursor(r));return this.H(r,(e,t,r)=>r.delete())}ee(e,t){let r;t?r=e:(r={},t=e);var n=this.cursor(r);return this.H(n,t)}te(i){let e=this.cursor({});return new A((r,n)=>{e.onerror=e=>{var t=pt(e.target.error);n(t)},e.onsuccess=e=>{let t=e.target.result;t?i(t.primaryKey,t.value).next(e=>{e?t.continue():r()}):r()}})}H(e,s){let a=[];return new A((i,t)=>{e.onerror=e=>{t(e.target.error)},e.onsuccess=e=>{var n=e.target.result;if(n){let t=new ht(n),r=s(n.primaryKey,n.value,t);if(r instanceof A){let e=r.catch(e=>(t.done(),A.reject(e)));a.push(e)}t.isDone?i():null===t.G?n.continue():n.continue(t.G)}else i()}}).next(()=>A.waitFor(a))}options(e,t){let r;return void 0!==e&&("string"==typeof e?r=e:t=e),{index:r,range:t}}cursor(e){let t="next";var r;return e.reverse&&(t="prev"),e.index?(r=this.store.index(e.index),e.Y?r.openKeyCursor(e.range,t):r.openCursor(e.range,t)):this.store.openCursor(e.range,t)}}function gt(e){return new A((r,n)=>{e.onsuccess=e=>{var t=e.target.result;r(t)},e.onerror=e=>{var t=pt(e.target.error);n(t)}})}let mt=!1;function pt(e){let t=ut.M(Y());if(12.2<=t&&t<13){let t="An internal error was encountered in the Indexed Database server";if(0<=e.message.indexOf(t)){let e=new I("internal",`IOS_INDEXEDDB_BUG1: IndexedDb has thrown '${t}'. This is likely due to an unavoidable bug in iOS. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.`);return mt||(mt=!0,setTimeout(()=>{throw e},0)),e}}return e}let yt="IndexBackfiller";class vt{constructor(e,t){this.asyncQueue=e,this.ne=t,this.task=null}start(){this.re(15e3)}stop(){this.task&&(this.task.cancel(),this.task=null)}get started(){return null!==this.task}re(e){g(yt,`Scheduled in ${e}ms`),this.task=this.asyncQueue.enqueueAfterDelay("index_backfill",e,async()=>{this.task=null;try{var e=await this.ne.ie();g(yt,"Documents written: "+e)}catch(e){dt(e)?g(yt,"Ignoring IndexedDB error during index backfill: ",e):await st(e)}await this.re(6e4)})}}class wt{constructor(e,t){this.localStore=e,this.persistence=t}async ie(t=50){return this.persistence.runTransaction("Backfill Indexes","readwrite-primary",e=>this.se(e,t))}se(e,t){let r=new Set,n=t,i=!0;return A.doWhile(()=>!0===i&&0<n,()=>this.localStore.indexManager.getNextCollectionGroupToUpdate(e).next(t=>{if(null!==t&&!r.has(t))return g(yt,"Processing collection: "+t),this.oe(e,t,n).next(e=>{n-=e,r.add(t)});i=!1})).next(()=>t-n)}oe(n,i,e){return this.localStore.indexManager.getMinOffsetFromCollectionGroup(n,i).next(r=>this.localStore.localDocuments.getNextDocuments(n,i,r,e).next(e=>{let t=e.changes;return this.localStore.indexManager.updateIndexEntries(n,t).next(()=>this._e(r,e)).next(e=>(g(yt,"Updating offset: "+e),this.localStore.indexManager.updateCollectionGroup(n,i,e))).next(()=>t.size)}))}_e(e,t){let n=e;return t.changes.forEach((e,t)=>{var r=et(t);0<rt(r,n)&&(n=r)}),new tt(n.readTime,n.documentKey,Math.max(t.batchId,e.largestBatchId))}}class _t{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){var e=++this.previousValue;return this.ue&&this.ue(e),e}}let bt=_t.ce=-1;function It(e){return null==e}function Tt(e){return 0===e&&1/e==-1/0}function Et(e){return"number"==typeof e&&Number.isInteger(e)&&!Tt(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}let St="";function xt(e){let t="";for(let r=0;r<e.length;r++)0<t.length&&(t=At(t)),t=((t,e)=>{let r=e,n=t.length;for(let i=0;i<n;i++){let e=t.charAt(i);switch(e){case"\0":r+="";break;case St:r+="";break;default:r+=e}}return r})(e.get(r),t);return At(t)}function At(e){return e+St+""}function Ct(r){let e=r.length;if(y(2<=e,64408,{path:r}),2===e)return y(r.charAt(0)===St&&""===r.charAt(1),56145,{path:r}),T.emptyPath();var __PRIVATE_lastReasonableEscapeIndex=e-2,n=[];let i="";for(let a=0;a<e;){let t=r.indexOf(St,a);switch((t<0||t>__PRIVATE_lastReasonableEscapeIndex)&&E(50515,{path:r}),r.charAt(t+1)){case"":var s=r.substring(a,t);let e;0===i.length?e=s:(i+=s,e=i,i=""),n.push(e);break;case"":i=i+r.substring(a,t)+"\0";break;case"":i+=r.substring(a,t+1);break;default:E(61167,{path:r})}a=t+2}return new T(n)}let Dt="remoteDocuments",Nt="owner",kt="owner",Rt="mutationQueues",Ot="mutations",Mt="batchId",Vt="userMutationsIndex",Lt=["userId","batchId"];function Ft(e,t){return[e,xt(t)]}function Pt(e,t,r){return[e,xt(t),r]}let Ut={},Bt="documentMutations",qt="remoteDocumentsV14",jt=["prefixPath","collectionGroup","readTime","documentId"],zt="documentKeyIndex",Kt=["prefixPath","collectionGroup","documentId"],Gt="collectionGroupIndex",$t=["collectionGroup","readTime","prefixPath","documentId"],Qt="remoteDocumentGlobal",Ht="remoteDocumentGlobalKey",Wt="targets",Yt="queryTargetsIndex",Jt=["canonicalId","targetId"],Xt="targetDocuments",Zt=["targetId","path"],er="documentTargetsIndex",tr=["path","targetId"],rr="targetGlobalKey",nr="targetGlobal",ir="collectionParents",sr=["collectionId","parent"],mr="clientMetadata",pr="bundles",yr="namedQueries",vr="indexConfiguration",wr="collectionGroupIndex",_r="indexState",br=["indexId","uid"],Ir="sequenceNumberIndex",Tr=["uid","sequenceNumber"],Er="indexEntries",Sr=["indexId","uid","arrayValue","directionalValue","orderedDocumentKey","documentKey"],xr="documentKeyIndex",Ar=["indexId","uid","orderedDocumentKey"],Cr="documentOverlays",Dr=["userId","collectionPath","documentId"],Nr="collectionPathOverlayIndex",kr=["userId","collectionPath","largestBatchId"],Rr="collectionGroupOverlayIndex",Or=["userId","collectionGroup","largestBatchId"],Mr="globals",Vr=[Rt,Ot,Bt,Dt,Wt,Nt,nr,Xt,mr,Qt,ir,pr,yr],Lr=[...Vr,Cr],Fr=[Rt,Ot,Bt,qt,Wt,Nt,nr,Xt,mr,Qt,ir,pr,yr,Cr],Pr=Fr,Ur=[...Pr,vr,_r,Er],Br=Ur,qr=[...Ur,Mr],jr=qr;class zr extends it{constructor(e,t){super(),this.le=e,this.currentSequenceNumber=t}}function r(e,t){var r=e;return ut.O(r.le,t)}function Kr(e){let t=0;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function Gr(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(r,e[r])}function $r(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class C{constructor(e,t){this.comparator=e,this.root=t||Hr.EMPTY}insert(e,t){return new C(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Hr.BLACK,null,null))}remove(e){return new C(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Hr.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){var r=this.comparator(e,t.key);if(0===r)return t.value;r<0?t=t.left:0<r&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){var n=this.comparator(e,r.key);if(0===n)return t+r.left.size;r=n<0?r.left:(t+=r.left.size+1,r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(r){this.inorderTraversal((e,t)=>(r(e,t),!1))}toString(){let r=[];return this.inorderTraversal((e,t)=>(r.push(e+":"+t),!1)),`{${r.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Qr(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Qr(this.root,e,this.comparator,!1)}getReverseIterator(){return new Qr(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Qr(this.root,e,this.comparator,!0)}}class Qr{constructor(e,t,r,n){this.isReverse=n,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?r(e.key,t):1,t&&n&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(0===i){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();var t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return 0<this.nodeStack.length}peek(){var e;return 0===this.nodeStack.length?null:{key:(e=this.nodeStack[this.nodeStack.length-1]).key,value:e.value}}}class Hr{constructor(e,t,r,n,i){this.key=e,this.value=t,this.color=null!=r?r:Hr.RED,this.left=null!=n?n:Hr.EMPTY,this.right=null!=i?i:Hr.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,n,i){return new Hr(null!=e?e:this.key,null!=t?t:this.value,null!=r?r:this.color,null!=n?n:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}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(e,t,r){var n=this,i=r(e,n.key);return(n=i<0?n.copy(null,null,null,n.left.insert(e,t,r),null):0===i?n.copy(null,t,null,null,null):n.copy(null,null,null,null,n.right.insert(e,t,r))).fixUp()}removeMin(){if(this.left.isEmpty())return Hr.EMPTY;let e=this;return(e=(e=e.left.isRed()||e.left.left.isRed()?e:e.moveRedLeft()).copy(null,null,null,e.left.removeMin(),null)).fixUp()}remove(e,t){let r,n=this;if(t(e,n.key)<0)n=(n=n.left.isEmpty()||n.left.isRed()||n.left.left.isRed()?n:n.moveRedLeft()).copy(null,null,null,n.left.remove(e,t),null);else{if(0===t(e,(n=(n=n.left.isRed()?n.rotateRight():n).right.isEmpty()||n.right.isRed()||n.right.left.isRed()?n:n.moveRedRight()).key)){if(n.right.isEmpty())return Hr.EMPTY;r=n.right.min(),n=n.copy(r.key,r.value,null,null,n.right.removeMin())}n=n.copy(null,null,null,null,n.right.remove(e,t))}return n.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e=(e=(e=e.right.isRed()&&!e.left.isRed()?e.rotateLeft():e).left.isRed()&&e.left.left.isRed()?e.rotateRight():e).left.isRed()&&e.right.isRed()?e.colorFlip():e}moveRedLeft(){let e=this.colorFlip();return e=e.right.left.isRed()?(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip():e}moveRedRight(){let e=this.colorFlip();return e=e.left.left.isRed()?(e=e.rotateRight()).colorFlip():e}rotateLeft(){var e=this.copy(null,null,Hr.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){var e=this.copy(null,null,Hr.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){var e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){var e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw E(43730,{key:this.key,value:this.value});if(this.right.isRed())throw E(14113,{key:this.key,value:this.value});var e=this.left.check();if(e!==this.right.check())throw E(27949);return e+(this.isRed()?0:1)}}Hr.EMPTY=null,Hr.RED=!0,Hr.BLACK=!1,Hr.EMPTY=new class{constructor(){this.size=0}get key(){throw E(57766)}get value(){throw E(16141)}get color(){throw E(16727)}get left(){throw E(29726)}get right(){throw E(36894)}copy(e,t,r,n,i){return this}insert(e,t,r){return new Hr(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};class D{constructor(e){this.comparator=e,this.data=new C(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(r){this.data.inorderTraversal((e,t)=>(r(e),!1))}forEachInRange(e,t){for(var r=this.data.getIteratorFrom(e[0]);r.hasNext();){var n=r.getNext();if(0<=this.comparator(n.key,e[1]))return;t(n.key)}}forEachWhile(e,t){for(var r=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){var t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Wr(this.data.getIterator())}getIteratorFrom(e){return new Wr(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof D))return!1;if(this.size!==e.size)return!1;for(var r=this.data.getIterator(),n=e.data.getIterator();r.hasNext();){let e=r.getNext().key,t=n.getNext().key;if(0!==this.comparator(e,t))return!1}return!0}toArray(){let t=[];return this.forEach(e=>{t.push(e)}),t}toString(){let t=[];return this.forEach(e=>t.push(e)),"SortedSet("+t.toString()+")"}copy(e){var t=new D(this.comparator);return t.data=e,t}}class Wr{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}function Yr(e){return e.hasNext()?e.getNext():void 0}class Jr{constructor(e){(this.fields=e).sort(h.comparator)}static empty(){return new Jr([])}unionWith(e){let t=new D(h.comparator);for(let e of this.fields)t=t.add(e);for(var r of e)t=t.add(r);return new Jr(t.toArray())}covers(e){for(var t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Oe(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class Xr extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class N{constructor(e){this.binaryString=e}static fromBase64String(e){var t=(e=>{try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Xr("Invalid base64 string: "+e):e}})(e);return new N(t)}static fromUint8Array(e){var t=(e=>{let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t})(e);return new N(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){var e=this.binaryString,t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return S(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}N.EMPTY_BYTE_STRING=new N("");let Zr=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function en(t){if(y(!!t,39018),"string"!=typeof t)return{seconds:k(t.seconds),nanos:k(t.nanos)};{let e=0;var r=Zr.exec(t),r=(y(!!r,46558,{timestamp:t}),r[1]&&(r=((r=r[1])+"000000000").substr(0,9),e=Number(r)),new Date(t));return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}}function k(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function tn(e){return"string"==typeof e?N.fromBase64String(e):N.fromUint8Array(e)}let rn="server_timestamp",nn="__type__",sn="__previous_value__",an="__local_write_time__";function on(e){return(e?.mapValue?.fields||{})[nn]?.stringValue===rn}function un(e){var t=e.mapValue.fields[sn];return on(t)?un(t):t}function ln(e){var t=en(e.mapValue.fields[an].timestampValue);return new v(t.seconds,t.nanos)}class hn{constructor(e,t,r,n,i,s,a,o,u,l,h){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=n,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=u,this.isUsingEmulator=l,this.apiKey=h}}let cn="(default)";class dn{constructor(e,t){this.projectId=e,this.database=t||cn}static empty(){return new dn("","")}get isDefaultDatabase(){return this.database===cn}isEqual(e){return e instanceof dn&&e.projectId===this.projectId&&e.database===this.database}}let fn="__type__",gn="__max__",mn={mapValue:{fields:{__type__:{stringValue:gn}}}},pn="__vector__",yn="value",vn={nullValue:"NULL_VALUE"};function wn(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?on(e)?4:Mn(e)?9007199254740991:Rn(e)?10:11:E(28295,{value:e})}function _n(t,r){if(t===r)return!0;var n,i,s,a,o,e=wn(t);if(e!==wn(r))return!1;switch(e){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===r.booleanValue;case 4:return ln(t).isEqual(ln(r));case 3:return s=r,"string"==typeof(i=t).timestampValue&&"string"==typeof s.timestampValue&&i.timestampValue.length===s.timestampValue.length?i.timestampValue===s.timestampValue:(a=en(i.timestampValue),o=en(s.timestampValue),a.seconds===o.seconds&&a.nanos===o.nanos);case 5:return t.stringValue===r.stringValue;case 6:return i=r,tn(t.bytesValue).isEqual(tn(i.bytesValue));case 7:return t.referenceValue===r.referenceValue;case 8:return s=r,k((n=t).geoPointValue.latitude)===k(s.geoPointValue.latitude)&&k(n.geoPointValue.longitude)===k(s.geoPointValue.longitude);case 2:return n=r,"integerValue"in(l=t)&&"integerValue"in n?k(l.integerValue)===k(n.integerValue):"doubleValue"in l&&"doubleValue"in n&&((a=k(l.doubleValue))===(o=k(n.doubleValue))?Tt(a)===Tt(o):isNaN(a)&&isNaN(o));case 9:return Oe(t.arrayValue.values||[],r.arrayValue.values||[],_n);case 10:case 11:var u=t,l=r,h=u.mapValue.fields||{},c=l.mapValue.fields||{};if(Kr(h)!==Kr(c))return!1;for(let e in h)if(h.hasOwnProperty(e)&&(void 0===c[e]||!_n(h[e],c[e])))return!1;return!0;default:return E(52216,{left:t})}}function bn(e,t){return void 0!==(e.values||[]).find(e=>_n(e,t))}function In(e,n){if(e===n)return 0;var i,s,a,o,u,l,h,c,d=wn(e),t=wn(n);if(d!==t)return S(d,t);switch(d){case 0:case 9007199254740991:return 0;case 1:return S(e.booleanValue,n.booleanValue);case 2:return l=n,h=k((u=e).integerValue||u.doubleValue),c=k(l.integerValue||l.doubleValue),h<c?-1:c<h?1:h===c?0:isNaN(h)?isNaN(c)?0:-1:1;case 3:return Tn(e.timestampValue,n.timestampValue);case 4:return Tn(ln(e),ln(n));case 5:return De(e.stringValue,n.stringValue);case 6:return u=e.bytesValue,l=n.bytesValue,h=tn(u),c=tn(l),h.compareTo(c);case 7:var f=e.referenceValue,g=n.referenceValue,m=f.split("/"),p=g.split("/");for(let t=0;t<m.length&&t<p.length;t++){let e=S(m[t],p[t]);if(0!==e)return e}return S(m.length,p.length);case 8:return f=e.geoPointValue,g=n.geoPointValue,0!==(o=S(k(f.latitude),k(g.latitude)))?o:S(k(f.longitude),k(g.longitude));case 9:return En(e.arrayValue,n.arrayValue);case 10:return y=e.mapValue,i=n.mapValue,o=y.fields||{},s=i.fields||{},o=o[yn]?.arrayValue,s=s[yn]?.arrayValue,0!==(a=S(o?.values?.length||0,s?.values?.length||0))?a:En(o,s);case 11:var y=e.mapValue,v=n.mapValue;if(y===mn.mapValue&&v===mn.mapValue)return 0;if(y===mn.mapValue)return 1;if(v===mn.mapValue)return-1;var w=y.fields||{},_=Object.keys(w),b=v.fields||{},I=Object.keys(b);_.sort(),I.sort();for(let r=0;r<_.length&&r<I.length;++r){let e=De(_[r],I[r]);if(0!==e)return e;var T=In(w[_[r]],b[I[r]]);if(0!==T)return T}return S(_.length,I.length);default:throw E(23264,{he:d})}}function Tn(e,t){var r,n,i;return"string"==typeof e&&"string"==typeof t&&e.length===t.length?S(e,t):(r=en(e),n=en(t),0!==(i=S(r.seconds,n.seconds))?i:S(r.nanos,n.nanos))}function En(e,t){var r=e.values||[],n=t.values||[];for(let i=0;i<r.length&&i<n.length;++i){let e=In(r[i],n[i]);if(e)return e}return S(r.length,n.length)}function Sn(e){return function s(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?(e=>{let t=en(e);return`time(${t.seconds},${t.nanos})`})(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?(e=>tn(e).toBase64())(e.bytesValue):"referenceValue"in e?(e=>x.fromName(e).toString())(e.referenceValue):"geoPointValue"in e?(e=>`geo(${e.latitude},${e.longitude})`)(e.geoPointValue):"arrayValue"in e?(e=>{let t="[",r=!0;for(var n of e.values||[])r?r=!1:t+=",",t+=s(n);return t+"]"})(e.arrayValue):"mapValue"in e?(e=>{let t=Object.keys(e.fields||{}).sort(),r="{",n=!0;for(var i of t)n?n=!1:r+=",",r+=i+":"+s(e.fields[i]);return r+"}"})(e.mapValue):E(61005,{value:e})}(e)}function xn(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/`+t.path.canonicalString()}}function An(e){return!!e&&"integerValue"in e}function Cn(e){return!!e&&"arrayValue"in e}function Dn(e){return e&&"nullValue"in e}function Nn(e){return e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function kn(e){return e&&"mapValue"in e}function Rn(e){return(e?.mapValue?.fields||{})[fn]?.stringValue===pn}function On(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:{...t.timestampValue}};if(t.mapValue){let r={mapValue:{fields:{}}};return Gr(t.mapValue.fields,(e,t)=>r.mapValue.fields[e]=On(t)),r}if(t.arrayValue){var r={arrayValue:{values:[]}};for(let e=0;e<(t.arrayValue.values||[]).length;++e)r.arrayValue.values[e]=On(t.arrayValue.values[e]);return r}return{...t}}function Mn(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===gn}let Vn={mapValue:{fields:{[fn]:{stringValue:pn},[yn]:{arrayValue:{}}}}};function Ln(e,t){var r=In(e.value,t.value);return 0!==r?r:e.inclusive&&!t.inclusive?-1:!e.inclusive&&t.inclusive?1:0}function Fn(e,t){var r=In(e.value,t.value);return 0!==r?r:e.inclusive&&!t.inclusive?1:!e.inclusive&&t.inclusive?-1:0}class Pn{constructor(e){this.value=e}static empty(){return new Pn({mapValue:{}})}field(r){if(r.isEmpty())return this.value;{let e=this.value;for(let t=0;t<r.length-1;++t)if(!kn(e=(e.mapValue.fields||{})[r.get(t)]))return null;return(e=(e.mapValue.fields||{})[r.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=On(t)}setAll(e){let r=h.emptyPath(),n={},i=[];e.forEach((e,t)=>{if(!r.isImmediateParentOf(t)){let e=this.getFieldsMap(r);this.applyChanges(e,n,i),n={},i=[],r=t.popLast()}e?n[t.lastSegment()]=On(e):i.push(t.lastSegment())});var t=this.getFieldsMap(r);this.applyChanges(t,n,i)}delete(e){var t=this.field(e.popLast());kn(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return _n(this.value,e.value)}getFieldsMap(t){let r=this.value;r.mapValue.fields||(r.mapValue={fields:{}});for(let n=0;n<t.length;++n){let e=r.mapValue.fields[t.get(n)];kn(e)&&e.mapValue.fields||(e={mapValue:{fields:{}}},r.mapValue.fields[t.get(n)]=e),r=e}return r.mapValue.fields}applyChanges(r,e,t){Gr(e,(e,t)=>r[e]=t);for(let e of t)delete r[e]}clone(){return new Pn(On(this.value))}}class R{constructor(e,t,r,n,i,s,a){this.key=e,this.documentType=t,this.version=r,this.readTime=n,this.createTime=i,this.data=s,this.documentState=a}static newInvalidDocument(e){return new R(e,0,w.min(),w.min(),w.min(),Pn.empty(),0)}static newFoundDocument(e,t,r,n){return new R(e,1,t,w.min(),r,n,0)}static newNoDocument(e,t){return new R(e,2,t,w.min(),w.min(),Pn.empty(),0)}static newUnknownDocument(e,t){return new R(e,3,t,w.min(),w.min(),Pn.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(w.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Pn.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Pn.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=w.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof R&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new R(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class Un{constructor(e,t){this.position=e,this.inclusive=t}}function Bn(e,t,r){let n=0;for(let a=0;a<e.position.length;a++){var i=t[a],s=e.position[a];if(n=i.field.isKeyField()?x.comparator(x.fromName(s.referenceValue),r.key):In(s,r.data.field(i.field)),"desc"===i.dir&&(n*=-1),0!==n)break}return n}function qn(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let r=0;r<e.position.length;r++)if(!_n(e.position[r],t.position[r]))return!1;return!0}class jn{constructor(e,t="asc"){this.field=e,this.dir=t}}class zn{}class O extends zn{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,r):new Yn(e,t,r):"array-contains"===t?new ei(e,r):"in"===t?new ti(e,r):"not-in"===t?new ri(e,r):"array-contains-any"===t?new ni(e,r):new O(e,t,r)}static createKeyFieldInFilter(e,t,r){return new("in"===t?Jn:Xn)(e,r)}matches(e){var t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(In(t,this.value)):null!==t&&wn(this.value)===wn(t)&&this.matchesComparison(In(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return 0<e;case">=":return 0<=e;default:return E(47266,{operator:this.op})}}isInequality(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class M extends zn{constructor(e,t){super(),this.filters=e,this.op=t,this.Pe=null}static create(e,t){return new M(e,t)}matches(t){return Kn(this)?void 0===this.filters.find(e=>!e.matches(t)):void 0!==this.filters.find(e=>e.matches(t))}getFlattenedFilters(){return null===this.Pe&&(this.Pe=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function Kn(e){return"and"===e.op}function Gn(e){return"or"===e.op}function $n(e){return Qn(e)&&Kn(e)}function Qn(e){for(var t of e.filters)if(t instanceof M)return!1;return!0}function Hn(e,t){var r=e.filters.concat(t);return M.create(r,e.op)}function Wn(e){return e instanceof O?`${(t=e).field.canonicalString()} ${t.op} `+Sn(t.value):e instanceof M?(t=e).op.toString()+" {"+t.getFilters().map(Wn).join(" ,")+"}":"Filter";var t}class Yn extends O{constructor(e,t,r){super(e,t,r),this.key=x.fromName(r.referenceValue)}matches(e){var t=x.comparator(e.key,this.key);return this.matchesComparison(t)}}class Jn extends O{constructor(e,t){super(e,"in",t),this.keys=Zn(0,t)}matches(t){return this.keys.some(e=>e.isEqual(t.key))}}class Xn extends O{constructor(e,t){super(e,"not-in",t),this.keys=Zn(0,t)}matches(t){return!this.keys.some(e=>e.isEqual(t.key))}}function Zn(e,t){return(t.arrayValue?.values||[]).map(e=>x.fromName(e.referenceValue))}class ei extends O{constructor(e,t){super(e,"array-contains",t)}matches(e){var t=e.data.field(this.field);return Cn(t)&&bn(t.arrayValue,this.value)}}class ti extends O{constructor(e,t){super(e,"in",t)}matches(e){var t=e.data.field(this.field);return null!==t&&bn(this.value.arrayValue,t)}}class ri extends O{constructor(e,t){super(e,"not-in",t)}matches(e){var t;return!bn(this.value.arrayValue,{nullValue:"NULL_VALUE"})&&null!==(t=e.data.field(this.field))&&void 0===t.nullValue&&!bn(this.value.arrayValue,t)}}class ni extends O{constructor(e,t){super(e,"array-contains-any",t)}matches(e){var t=e.data.field(this.field);return!(!Cn(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>bn(this.value.arrayValue,e))}}class ii{constructor(e,t=null,r=[],n=[],i=null,s=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=n,this.limit=i,this.startAt=s,this.endAt=a,this.Te=null}}function si(e,t=null,r=[],n=[],i=null,s=null,a=null){return new ii(e,t,r,n,i,s,a)}function ai(e){var t=e;if(null===t.Te){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e=(e=(e+="|f:")+t.filters.map(e=>function t(e){var r;return e instanceof O?e.field.canonicalString()+e.op.toString()+Sn(e.value):$n(e)?e.filters.map(e=>t(e)).join(","):(r=e.filters.map(e=>t(e)).join(","),e.op+`(${r})`)}(e)).join(",")+"|ob:")+t.orderBy.map(e=>(e=e).field.canonicalString()+e.dir).join(","),It(t.limit)||(e=(e+="|l:")+t.limit),t.startAt&&(e=(e=(e+="|lb:")+(t.startAt.inclusive?"b:":"a:"))+t.startAt.position.map(e=>Sn(e)).join(",")),t.endAt&&(e=(e=(e+="|ub:")+(t.endAt.inclusive?"a:":"b:"))+t.endAt.position.map(e=>Sn(e)).join(",")),t.Te=e}return t.Te}function oi(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let i=0;i<e.orderBy.length;i++)if(r=e.orderBy[i],n=t.orderBy[i],r.dir!==n.dir||!r.field.isEqual(n.field))return!1;var r,n;if(e.filters.length!==t.filters.length)return!1;for(let s=0;s<e.filters.length;s++)if(!function n(e,t){return e instanceof O?(r=e,(s=t)instanceof O&&r.op===s.op&&r.field.isEqual(s.field)&&_n(r.value,s.value)):e instanceof M?(r=e,(i=t)instanceof M&&r.op===i.op&&r.filters.length===i.filters.length&&r.filters.reduce((e,t,r)=>e&&n(t,i.filters[r]),!0)):void E(19439);var i,r,s}(e.filters[s],t.filters[s]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!qn(e.startAt,t.startAt)&&qn(e.endAt,t.endAt)}function ui(e){return x.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}function li(e,t){return e.filters.filter(e=>e instanceof O&&e.field.isEqual(t))}function hi(e,r,n){let i=vn,s=!0;for(let n of li(e,r)){let e=vn,t=!0;switch(n.op){case"<":case"<=":e="nullValue"in(a=n.value)?vn:"booleanValue"in a?{booleanValue:!1}:"integerValue"in a||"doubleValue"in a?{doubleValue:NaN}:"timestampValue"in a?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"stringValue"in a?{stringValue:""}:"bytesValue"in a?{bytesValue:""}:"referenceValue"in a?xn(dn.empty(),x.empty()):"geoPointValue"in a?{geoPointValue:{latitude:-90,longitude:-180}}:"arrayValue"in a?{arrayValue:{}}:"mapValue"in a?Rn(a)?Vn:{mapValue:{}}:E(35942,{value:a});break;case"==":case"in":case">=":e=n.value;break;case">":e=n.value,t=!1;break;case"!=":case"not-in":e=vn}Ln({value:i,inclusive:s},{value:e,inclusive:t})<0&&(i=e,s=t)}var a;if(null!==n)for(let t=0;t<e.orderBy.length;++t)if(e.orderBy[t].field.isEqual(r)){let e=n.position[t];Ln({value:i,inclusive:s},{value:e,inclusive:n.inclusive})<0&&(i=e,s=n.inclusive);break}return{value:i,inclusive:s}}function ci(e,r,n){let i=mn,s=!0;for(let n of li(e,r)){let e=mn,t=!0;switch(n.op){case">=":case">":e="nullValue"in(a=n.value)?{booleanValue:!1}:"booleanValue"in a?{doubleValue:NaN}:"integerValue"in a||"doubleValue"in a?{timestampValue:{seconds:Number.MIN_SAFE_INTEGER}}:"timestampValue"in a?{stringValue:""}:"stringValue"in a?{bytesValue:""}:"bytesValue"in a?xn(dn.empty(),x.empty()):"referenceValue"in a?{geoPointValue:{latitude:-90,longitude:-180}}:"geoPointValue"in a?{arrayValue:{}}:"arrayValue"in a?Vn:"mapValue"in a?Rn(a)?{mapValue:{}}:mn:E(61959,{value:a}),t=!1;break;case"==":case"in":case"<=":e=n.value;break;case"<":e=n.value,t=!1;break;case"!=":case"not-in":e=mn}0<Fn({value:i,inclusive:s},{value:e,inclusive:t})&&(i=e,s=t)}var a;if(null!==n)for(let t=0;t<e.orderBy.length;++t)if(e.orderBy[t].field.isEqual(r)){let e=n.position[t];0<Fn({value:i,inclusive:s},{value:e,inclusive:n.inclusive})&&(i=e,s=n.inclusive);break}return{value:i,inclusive:s}}class di{constructor(e,t=null,r=[],n=[],i=null,s="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=n,this.limit=i,this.limitType=s,this.startAt=a,this.endAt=o,this.Ee=null,this.Ie=null,this.Re=null,this.startAt,this.endAt}}function fi(e,t,r,n,i,s,a,o){return new di(e,t,r,n,i,s,a,o)}function gi(e){return new di(e)}function mi(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function pi(e){return null!==e.collectionGroup}function yi(e){let n=e;if(null===n.Ee){n.Ee=[];let t=new Set;for(var i of n.explicitOrderBy)n.Ee.push(i),t.add(i.field.canonicalString());let r=0<n.explicitOrderBy.length?n.explicitOrderBy[n.explicitOrderBy.length-1].dir:"asc",e=(e=>{let t=new D(h.comparator);return e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t})(n);e.forEach(e=>{t.has(e.canonicalString())||e.isKeyField()||n.Ee.push(new jn(e,r))}),t.has(h.keyField().canonicalString())||n.Ee.push(new jn(h.keyField(),r))}return n.Ee}function vi(e){var t=e;return t.Ie||(t.Ie=((e,t)=>{if("F"===e.limitType)return si(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);t=t.map(e=>{var t="desc"===e.dir?"asc":"desc";return new jn(e.field,t)});var r=e.endAt?new Un(e.endAt.position,e.endAt.inclusive):null,n=e.startAt?new Un(e.startAt.position,e.startAt.inclusive):null;return si(e.path,e.collectionGroup,t,e.filters,e.limit,r,n)})(t,yi(e))),t.Ie}function wi(e,t){var r=e.filters.concat([t]);return new di(e.path,e.collectionGroup,e.explicitOrderBy.slice(),r,e.limit,e.limitType,e.startAt,e.endAt)}function _i(e,t,r){return new di(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,r,e.startAt,e.endAt)}function bi(e,t){return oi(vi(e),vi(t))&&e.limitType===t.limitType}function Ii(e){return ai(vi(e))+"|lt:"+e.limitType}function Ti(e){return`Query(target=${(e=>{let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),0<e.filters.length&&(t+=`, filters: [${e.filters.map(e=>Wn(e)).join(", ")}]`),It(e.limit)||(t+=", limit: "+e.limit),0<e.orderBy.length&&(t+=`, orderBy: [${e.orderBy.map(e=>`${(e=e).field.canonicalString()} (${e.dir})`).join(", ")}]`),e.startAt&&(t=(t=(t+=", startAt: ")+(e.startAt.inclusive?"b:":"a:"))+e.startAt.position.map(e=>Sn(e)).join(",")),`Target(${t=e.endAt?(t=(t+=", endAt: ")+(e.endAt.inclusive?"a:":"b:"))+e.endAt.position.map(e=>Sn(e)).join(","):t})`})(vi(e))}; limitType=${e.limitType})`}function Ei(e,t){return t.isFoundDocument()&&(s=e,o=(a=t).key.path,null!==s.collectionGroup?a.key.hasCollectionId(s.collectionGroup)&&s.path.isPrefixOf(o):x.isDocumentKey(s.path)?s.path.isEqual(o):s.path.isImmediateParentOf(o))&&((e,t)=>{for(var r of yi(e))if(!r.field.isKeyField()&&null===t.data.field(r.field))return;return 1})(e,t)&&((e,t)=>{for(var r of e.filters)if(!r.matches(t))return;return 1})(e,t)&&(a=t,!(s=e).startAt||(n=s.startAt,r=yi(s),i=Bn(n,r,a),n.inclusive?i<=0:i<0))&&(!s.endAt||(r=s.endAt,n=yi(s),i=Bn(r,n,a),r.inclusive?0<=i:0<i));var r,n,i,s,a,o}function Si(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}function xi(e){return(t,r)=>{let n=!1;for(var i of yi(e)){let e=((e,t,r)=>{var n=e.field.isKeyField()?x.comparator(t.key,r.key):((e,t,r)=>{var n=t.data.field(e),i=r.data.field(e);return null!==n&&null!==i?In(n,i):E(42886)})(e.field,t,r);switch(e.dir){case"asc":return n;case"desc":return-1*n;default:return E(19790,{direction:e.dir})}})(i,t,r);if(0!==e)return e;n=n||i.field.isKeyField()}return 0}}class Ai{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(r){let e=this.mapKeyFn(r),n=this.inner[e];if(void 0!==n)for(let[e,t]of n)if(this.equalsFn(e,r))return t}has(e){return void 0!==this.get(e)}set(t,r){var e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)this.inner[e]=[[t,r]];else{for(let e=0;e<n.length;e++)if(this.equalsFn(n[e][0],t))return void(n[e]=[t,r]);n.push([t,r])}this.innerSize++}delete(t){var r=this.mapKeyFn(t),n=this.inner[r];if(void 0!==n)for(let e=0;e<n.length;e++)if(this.equalsFn(n[e][0],t))return 1===n.length?delete this.inner[r]:n.splice(e,1),this.innerSize--,!0;return!1}forEach(n){Gr(this.inner,(e,t)=>{for(let[e,r]of t)n(e,r)})}isEmpty(){return $r(this.inner)}size(){return this.innerSize}}let Ci=new C(x.comparator);let Di=new C(x.comparator);function Ni(...e){let t=Di;for(var r of e)t=t.insert(r.key,r);return t}function ki(e){let r=Di;return e.forEach((e,t)=>r=r.insert(e,t.overlayedDocument)),r}function Ri(){return new Ai(e=>e.toString(),(e,t)=>e.isEqual(t))}let Oi=new C(x.comparator),Mi=new D(x.comparator);function V(...e){let t=Mi;for(var r of e)t=t.add(r);return t}let Vi=new D(S);function Li(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Tt(t)?"-0":t}}function Fi(e){return{integerValue:""+e}}function Pi(e,t){return Et(t)?Fi(t):Li(e,t)}class Ui{constructor(){this._=void 0}}function Bi(e,t){return e instanceof $i?An(e=t)||(e=e)&&"doubleValue"in e?t:{integerValue:0}:null}class qi extends Ui{}class ji extends Ui{constructor(e){super(),this.elements=e}}function zi(e,t){var r=Hi(t);for(let t of e.elements)r.some(e=>_n(e,t))||r.push(t);return{arrayValue:{values:r}}}class Ki extends Ui{constructor(e){super(),this.elements=e}}function Gi(e,t){let r=Hi(t);for(let t of e.elements)r=r.filter(e=>!_n(e,t));return{arrayValue:{values:r}}}class $i extends Ui{constructor(e,t){super(),this.serializer=e,this.Ae=t}}function Qi(e){return k(e.integerValue||e.doubleValue)}function Hi(e){return Cn(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Wi{constructor(e,t){this.field=e,this.transform=t}}class Yi{constructor(e,t){this.version=e,this.transformResults=t}}class L{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new L}static exists(e){return new L(void 0,e)}static updateTime(e){return new L(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ji(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Xi{}function Zi(e,r){if(!e.hasLocalMutations||r&&0===r.fields.length)return null;if(null===r)return e.isNoDocument()?new os(e.key,L.none()):new rs(e.key,e.data,L.none());{var n,i=e.data,s=Pn.empty();let t=new D(h.comparator);for(n of r.fields)if(!t.has(n)){let e=i.field(n);null===e&&1<n.length&&(n=n.popLast(),e=i.field(n)),null===e?s.delete(n):s.set(n,e),t=t.add(n)}return new ns(e.key,s,new Jr(t.toArray()),L.none())}}function es(e,t,r,n){return e instanceof rs?(s=t,a=r,o=n,Ji((i=e).precondition,s)?(u=i.value.clone(),l=as(i.fieldTransforms,o,s),u.setAll(l),s.convertToFoundDocument(s.version,u).setHasLocalMutations(),null):a):e instanceof ns?(i=t,o=r,s=n,Ji((a=e).precondition,i)?(l=as(a.fieldTransforms,s,i),(u=i.data).setAll(is(a)),u.setAll(l),i.convertToFoundDocument(i.version,u).setHasLocalMutations(),null===o?null:o.unionWith(a.fieldMask.fields).unionWith(a.fieldTransforms.map(e=>e.field))):o):(n=t,t=r,Ji(e.precondition,n)?(n.convertToNoDocument(n.version).setHasLocalMutations(),null):t);var i,s,a,o,u,l}function ts(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(r=e.fieldTransforms,n=t.fieldTransforms,!!(void 0===r&&void 0===n||r&&n&&Oe(r,n,(e,t)=>(t=t,(e=e).field.isEqual(t.field)&&(e=e.transform,t=t.transform,e instanceof ji&&t instanceof ji||e instanceof Ki&&t instanceof Ki?Oe(e.elements,t.elements,_n):e instanceof $i&&t instanceof $i?_n(e.Ae,t.Ae):e instanceof qi&&t instanceof qi)))))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask));var r,n}class rs extends Xi{constructor(e,t,r,n=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=n,this.type=0}getFieldMask(){return null}}class ns extends Xi{constructor(e,t,r,n,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=n,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function is(r){let n=new Map;return r.fieldMask.fields.forEach(e=>{var t;e.isEmpty()||(t=r.data.field(e),n.set(e,t))}),n}function ss(e,t,r){var n,i,s,a=new Map;y(e.length===r.length,32656,{Ve:r.length,de:e.length});for(let h=0;h<r.length;h++){var o=e[h],u=o.transform,l=t.data.field(o.field);a.set(o.field,(n=u,i=l,s=r[h],n instanceof ji?zi(n,i):n instanceof Ki?Gi(n,i):s))}return a}function as(e,r,n){var i,s,a,o,u,l,h,c=new Map;for(i of e){let e=i.transform,t=n.data.field(i.field);c.set(i.field,(s=e,a=t,o=r,h=l=u=void 0,s instanceof qi?(o=o,l=a,h={fields:{[nn]:{stringValue:rn},[an]:{timestampValue:{seconds:o.seconds,nanos:o.nanoseconds}}}},(l=l&&on(l)?un(l):l)&&(h.fields[sn]=l),{mapValue:h}):s instanceof ji?zi(s,a):s instanceof Ki?Gi(s,a):(h=Bi(o=s,a),u=Qi(h)+Qi(o.Ae),An(h)&&An(o.Ae)?Fi(u):Li(o.serializer,u))))}return c}class os extends Xi{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class us extends Xi{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class ls{constructor(e,t,r,n){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=n}applyToRemoteDocument(e,t){var r,n,i,s,a,o,u,l=t.mutationResults;for(let c=0;c<this.mutations.length;c++){var h=this.mutations[c];h.key.isEqual(e.key)&&(r=h,n=e,i=l[c],u=h=o=a=s=void 0,r instanceof rs?(a=n,o=i,h=(s=r).value.clone(),u=ss(s.fieldTransforms,a,o.transformResults),h.setAll(u),a.convertToFoundDocument(o.version,h).setHasCommittedMutations()):r instanceof ns?(s=n,a=i,Ji((o=r).precondition,s)?(u=ss(o.fieldTransforms,s,a.transformResults),(h=s.data).setAll(is(o)),h.setAll(u),s.convertToFoundDocument(a.version,h).setHasCommittedMutations()):s.convertToUnknownDocument(a.version)):n.convertToNoDocument(i.version).setHasCommittedMutations())}}applyToLocalView(e,t){for(var r of this.baseMutations)r.key.isEqual(e.key)&&(t=es(r,e,t,this.localWriteTime));for(var n of this.mutations)n.key.isEqual(e.key)&&(t=es(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(n,i){let s=Ri();return this.mutations.forEach(e=>{var t=n.get(e.key),r=t.overlayedDocument,t=this.applyToLocalView(r,t.mutatedFields),t=Zi(r,i.has(e.key)?null:t);null!==t&&s.set(e.key,t),r.isValidDocument()||r.convertToNoDocument(w.min())}),s}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),V())}isEqual(e){return this.batchId===e.batchId&&Oe(this.mutations,e.mutations,(e,t)=>ts(e,t))&&Oe(this.baseMutations,e.baseMutations,(e,t)=>ts(e,t))}}class hs{constructor(e,t,r,n){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=n}static from(e,t,r){y(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let n=Oi;var i=e.mutations;for(let s=0;s<i.length;s++)n=n.insert(i[s].key,r[s].version);return new hs(e,t,r,n)}}class cs{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{
|
|
2
2
|
largestBatchId: ${this.largestBatchId},
|
|
3
3
|
mutation: ${this.mutation.toString()}
|
|
4
4
|
}`}}class ds{constructor(e,t){this.count=e,this.unchangedNames=t}}function fs(e){switch(e){case b.OK:return E(64938);case b.CANCELLED:case b.UNKNOWN:case b.DEADLINE_EXCEEDED:case b.RESOURCE_EXHAUSTED:case b.INTERNAL:case b.UNAVAILABLE:case b.UNAUTHENTICATED:return!1;case b.INVALID_ARGUMENT:case b.NOT_FOUND:case b.ALREADY_EXISTS:case b.PERMISSION_DENIED:case b.FAILED_PRECONDITION:case b.ABORTED:case b.OUT_OF_RANGE:case b.UNIMPLEMENTED:case b.DATA_LOSS:return!0;default:return E(15467,{code:e})}}function gs(e){if(void 0===e)return d("GRPC error has no .code"),b.UNKNOWN;switch(e){case f.OK:return b.OK;case f.CANCELLED:return b.CANCELLED;case f.UNKNOWN:return b.UNKNOWN;case f.DEADLINE_EXCEEDED:return b.DEADLINE_EXCEEDED;case f.RESOURCE_EXHAUSTED:return b.RESOURCE_EXHAUSTED;case f.INTERNAL:return b.INTERNAL;case f.UNAVAILABLE:return b.UNAVAILABLE;case f.UNAUTHENTICATED:return b.UNAUTHENTICATED;case f.INVALID_ARGUMENT:return b.INVALID_ARGUMENT;case f.NOT_FOUND:return b.NOT_FOUND;case f.ALREADY_EXISTS:return b.ALREADY_EXISTS;case f.PERMISSION_DENIED:return b.PERMISSION_DENIED;case f.FAILED_PRECONDITION:return b.FAILED_PRECONDITION;case f.ABORTED:return b.ABORTED;case f.OUT_OF_RANGE:return b.OUT_OF_RANGE;case f.UNIMPLEMENTED:return b.UNIMPLEMENTED;case f.DATA_LOSS:return b.DATA_LOSS;default:return E(39323,{code:e})}}(e=f=f||{})[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.ALREADY_EXISTS=6]="ALREADY_EXISTS",e[e.PERMISSION_DENIED=7]="PERMISSION_DENIED",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED",e[e.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",e[e.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",e[e.ABORTED=10]="ABORTED",e[e.OUT_OF_RANGE=11]="OUT_OF_RANGE",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.DATA_LOSS=15]="DATA_LOSS";function ms(){return new TextEncoder}let ps=new oe([4294967295,4294967295],0);function ys(e){var t=ms().encode(e),r=new ue;return r.update(t),new Uint8Array(r.digest())}function vs(e){var t=new DataView(e.buffer),r=t.getUint32(0,!0),n=t.getUint32(4,!0),i=t.getUint32(8,!0),t=t.getUint32(12,!0);return[new oe([r,n],0),new oe([i,t],0)]}class ws{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||8<=t)throw new _s("Invalid padding: "+t);if(r<0)throw new _s("Invalid hash count: "+r);if(0<e.length&&0===this.hashCount)throw new _s("Invalid hash count: "+r);if(0===e.length&&0!==t)throw new _s("Invalid padding when bitmap length is 0: "+t);this.ge=8*e.length-t,this.pe=oe.fromNumber(this.ge)}ye(e,t,r){let n=e.add(t.multiply(oe.fromNumber(r)));return(n=1===n.compare(ps)?new oe([n.getBits(0),n.getBits(1)],0):n).modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.ge)return!1;let t=ys(e),[r,n]=vs(t);for(let i=0;i<this.hashCount;i++){let e=this.ye(r,n,i);if(!this.we(e))return!1}return!0}static create(e,t,r){let n=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),s=new ws(i,n,t);return r.forEach(e=>s.insert(e)),s}insert(i){if(0!==this.ge){let e=ys(i),[t,r]=vs(e);for(let n=0;n<this.hashCount;n++){let e=this.ye(t,r,n);this.Se(e)}}}Se(e){var t=Math.floor(e/8);this.bitmap[t]|=1<<e%8}}class _s extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class bs{constructor(e,t,r,n,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=n,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,r){var n=new Map;return n.set(e,Is.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new bs(w.min(),n,new C(S),Ci,V())}}class Is{constructor(e,t,r,n,i){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=n,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new Is(r,t,V(),V(),V())}}class Ts{constructor(e,t,r,n){this.be=e,this.removedTargetIds=t,this.key=r,this.De=n}}class Es{constructor(e,t){this.targetId=e,this.Ce=t}}class Ss{constructor(e,t,r=N.EMPTY_BYTE_STRING,n=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=n}}class xs{constructor(){this.ve=0,this.Fe=Ds(),this.Me=N.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return 0!==this.ve}get Be(){return this.Oe}Le(e){0<e.approximateByteSize()&&(this.Oe=!0,this.Me=e)}ke(){let r=V(),n=V(),i=V();return this.Fe.forEach((e,t)=>{switch(t){case 0:r=r.add(e);break;case 2:n=n.add(e);break;case 1:i=i.add(e);break;default:E(38017,{changeType:t})}}),new Is(this.Me,this.xe,r,n,i)}qe(){this.Oe=!1,this.Fe=Ds()}Ke(e,t){this.Oe=!0,this.Fe=this.Fe.insert(e,t)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){--this.ve,y(0<=this.ve,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class As{constructor(e){this.Ge=e,this.ze=new Map,this.je=Ci,this.Je=Cs(),this.He=Cs(),this.Ze=new C(S)}Xe(e){for(var t of e.be)e.De&&e.De.isFoundDocument()?this.Ye(t,e.De):this.et(t,e.key,e.De);for(var r of e.removedTargetIds)this.et(r,e.key,e.De)}tt(r){this.forEachTarget(r,e=>{var t=this.nt(e);switch(r.state){case 0:this.rt(e)&&t.Le(r.resumeToken);break;case 1:t.We(),t.Ne||t.qe(),t.Le(r.resumeToken);break;case 2:t.We(),t.Ne||this.removeTarget(e);break;case 3:this.rt(e)&&(t.Qe(),t.Le(r.resumeToken));break;case 4:this.rt(e)&&(this.it(e),t.Le(r.resumeToken));break;default:E(56790,{state:r.state})}})}forEachTarget(e,r){0<e.targetIds.length?e.targetIds.forEach(r):this.ze.forEach((e,t)=>{this.rt(t)&&r(t)})}st(n){let i=n.targetId,e=n.Ce.count,t=this.ot(i);if(t){var r=t.target;if(ui(r))if(0===e){let e=new x(r.path);this.et(i,e,R.newNoDocument(e,w.min()))}else y(1===e,20013,{expectedCount:e});else{let r=this._t(i);if(r!==e){let e=this.ut(n),t=e?this.ct(e,n,r):1;if(0!==t){this.it(i);let e=2===t?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(i,e)}}}}}ut(e){var t=e.Ce.unchangedNames;if(!t||!t.bits)return null;var{bits:{bitmap:t="",padding:r=0},hashCount:n=0}=t;let i,s;try{i=tn(t).toUint8Array()}catch(e){if(e instanceof Xr)return ye("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{s=new ws(i,r,n)}catch(e){return ye(e instanceof _s?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===s.ge?null:s}ct(e,t,r){return t.Ce.count===r-this.Pt(e,t.targetId)?0:2}Pt(r,n){var e=this.Ge.getRemoteKeysForTarget(n);let i=0;return e.forEach(e=>{var t=this.Ge.ht(),t=`projects/${t.projectId}/databases/${t.database}/documents/`+e.path.canonicalString();r.mightContain(t)||(this.et(n,e,null),i++)}),i}Tt(n){let i=new Map,s=(this.ze.forEach((e,t)=>{var r=this.ot(t);if(r){if(e.current&&ui(r.target)){let e=new x(r.target.path);this.Et(e).has(t)||this.It(t,e)||this.et(t,e,R.newNoDocument(e,n))}e.Be&&(i.set(t,e.ke()),e.qe())}}),V());this.He.forEach((e,t)=>{let r=!0;t.forEachWhile(e=>{var t=this.ot(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1)}),r&&(s=s.add(e))}),this.je.forEach((e,t)=>t.setReadTime(n));var e=new bs(n,i,this.Ze,this.je,s);return this.je=Ci,this.Je=Cs(),this.He=Cs(),this.Ze=new C(S),e}Ye(e,t){var r;this.rt(e)&&(r=this.It(e,t.key)?2:0,this.nt(e).Ke(t.key,r),this.je=this.je.insert(t.key,t),this.Je=this.Je.insert(t.key,this.Et(t.key).add(e)),this.He=this.He.insert(t.key,this.Rt(t.key).add(e)))}et(e,t,r){var n;this.rt(e)&&(n=this.nt(e),this.It(e,t)?n.Ke(t,1):n.Ue(t),this.He=this.He.insert(t,this.Rt(t).delete(e)),this.He=this.He.insert(t,this.Rt(t).add(e)),r)&&(this.je=this.je.insert(t,r))}removeTarget(e){this.ze.delete(e)}_t(e){var t=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let t=this.ze.get(e);return t||(t=new xs,this.ze.set(e,t)),t}Rt(e){let t=this.He.get(e);return t||(t=new D(S),this.He=this.He.insert(e,t)),t}Et(e){let t=this.Je.get(e);return t||(t=new D(S),this.Je=this.Je.insert(e,t)),t}rt(e){var t=null!==this.ot(e);return t||g("WatchChangeAggregator","Detected inactive target",e),t}ot(e){var t=this.ze.get(e);return t&&t.Ne?null:this.Ge.At(e)}it(t){this.ze.set(t,new xs),this.Ge.getRemoteKeysForTarget(t).forEach(e=>{this.et(t,e,null)})}It(e,t){return this.Ge.getRemoteKeysForTarget(e).has(t)}}function Cs(){return new C(x.comparator)}function Ds(){return new C(x.comparator)}let Ns={asc:"ASCENDING",desc:"DESCENDING"},ks={"<":"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"},Rs={and:"AND",or:"OR"};class Os{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Ms(e,t){return e.useProto3Json||It(t)?t:{value:t}}function Vs(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Ls(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function F(e){return y(!!e,49232),w.fromTimestamp((t=en(e),new v(t.seconds,t.nanos)));var t}function Fs(e,t){return Ps(e,t).canonicalString()}function Ps(e,t){e=e;var r=new T(["projects",e.projectId,"databases",e.database]).child("documents");return void 0===t?r:r.child(t)}function Us(e){var t=T.fromString(e);return y(sa(t),10190,{key:t.toString()}),t}function Bs(e,t){return Fs(e.databaseId,t.path)}function qs(e,t){var r=Us(t);if(r.get(1)!==e.databaseId.projectId)throw new I(b.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+r.get(1)+" vs "+e.databaseId.projectId);if(r.get(3)!==e.databaseId.database)throw new I(b.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+r.get(3)+" vs "+e.databaseId.database);return new x(Gs(r))}function js(e,t){return Fs(e.databaseId,t)}function zs(e){var t=Us(e);return 4===t.length?T.emptyPath():Gs(t)}function Ks(e){return new T(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Gs(e){return y(4<e.length&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function $s(e,t,r){return{name:Bs(e,t),fields:r.value.mapValue.fields}}function Qs(e,t,r){var n=qs(e,t.name),i=F(t.updateTime),s=t.createTime?F(t.createTime):w.min(),a=new Pn({mapValue:{fields:t.fields}}),n=R.newFoundDocument(n,i,s,a);return r&&n.setHasCommittedMutations(),r?n.setHasCommittedMutations():n}function Hs(e,t){let r;if(t instanceof rs)r={update:$s(e,t.key,t.value)};else if(t instanceof os)r={delete:Bs(e,t.key)};else if(t instanceof ns)r={update:$s(e,t.key,t.data),updateMask:(e=>{let t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}})(t.fieldMask)};else{if(!(t instanceof us))return E(16599,{dt:t.type});r={verify:Bs(e,t.key)}}return 0<t.fieldTransforms.length&&(r.updateTransforms=t.fieldTransforms.map(e=>{var t=e.transform;if(t instanceof qi)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(t instanceof ji)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:t.elements}};if(t instanceof Ki)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:t.elements}};if(t instanceof $i)return{fieldPath:e.field.canonicalString(),increment:t.Ae};throw E(20930,{transform:e.transform})})),t.precondition.isNone||(r.currentDocument=(e=e,void 0!==(t=t.precondition).updateTime?{updateTime:(n=t.updateTime,Vs(e,n.toTimestamp()))}:void 0!==t.exists?{exists:t.exists}:E(27497))),r;var n}function Ws(i,t){let r=t.currentDocument?void 0!==(s=t.currentDocument).updateTime?L.updateTime(F(s.updateTime)):void 0!==s.exists?L.exists(s.exists):L.none():L.none(),n=t.updateTransforms?t.updateTransforms.map(r=>{{var e=i;let t=null;if("setToServerValue"in r)y("REQUEST_TIME"===r.setToServerValue,16630,{proto:r}),t=new qi;else if("appendMissingElements"in r){let e=r.appendMissingElements.values||[];t=new ji(e)}else if("removeAllFromArray"in r){let e=r.removeAllFromArray.values||[];t=new Ki(e)}else"increment"in r?t=new $i(e,r.increment):E(16584,{proto:r});var n=h.fromServerFormat(r.fieldPath);return new Wi(n,t)}}):[];var s,a;if(t.update){t.update.name;var o=qs(i,t.update.name),u=new Pn({mapValue:{fields:t.update.fields}});if(t.updateMask){s=t.updateMask,a=s.fieldPaths||[];let e=new Jr(a.map(e=>h.fromServerFormat(e)));return new ns(o,u,e,r,n)}return new rs(o,u,r,n)}if(t.delete){let e=qs(i,t.delete);return new os(e,r)}if(t.verify){let e=qs(i,t.verify);return new us(e,r)}return E(1463,{proto:t})}function Ys(e,n){return e&&0<e.length?(y(void 0!==n,14353),e.map(t=>{{var r=n;let e=t.updateTime?F(t.updateTime):F(r);return e.isEqual(w.min())&&(e=F(r)),new Yi(e,t.transformResults||[])}})):[]}function Js(e,t){return{documents:[js(e,t.path)]}}function Xs(e,t){var r={structuredQuery:{}},n=t.path;let i;null!==t.collectionGroup?(i=n,r.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=n.popLast(),r.structuredQuery.from=[{collectionId:n.lastSegment()}]),r.parent=js(e,i);n=(e=>{if(0!==e.length)return function r(e){return e instanceof O?(e=>{if("=="===e.op){if(Nn(e.value))return{unaryFilter:{field:na(e.field),op:"IS_NAN"}};if(Dn(e.value))return{unaryFilter:{field:na(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(Nn(e.value))return{unaryFilter:{field:na(e.field),op:"IS_NOT_NAN"}};if(Dn(e.value))return{unaryFilter:{field:na(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:na(e.field),op:ta(e.op),value:e.value}}})(e):e instanceof M?(e=>{let t=e.getFilters().map(e=>r(e));return 1===t.length?t[0]:{compositeFilter:{op:ra(e.op),filters:t}}})(e):E(54877,{filter:e})}(M.create(e,"and"))})(t.filters),n&&(r.structuredQuery.where=n),n=(e=>{if(0!==e.length)return e.map(e=>({field:na((e=e).field),direction:(e=e.dir,Ns[e])}))})(t.orderBy),n&&(r.structuredQuery.orderBy=n),n=Ms(e,t.limit);return null!==n&&(r.structuredQuery.limit=n),t.startAt&&(r.structuredQuery.startAt={before:(e=t.startAt).inclusive,values:e.position}),t.endAt&&(r.structuredQuery.endAt={before:!(e=t.endAt).inclusive,values:e.position}),{ft:r,parent:i}}function Zs(e){let t=zs(e.parent);var r,n=e.structuredQuery,i=n.from?n.from.length:0;let s=null;if(0<i){y(1===i,65062);let e=n.from[0];e.allDescendants?s=e.collectionId:t=t.child(e.collectionId)}let a=[],o=(n.where&&(a=(e=n.where,(i=function t(e){return void 0!==e.unaryFilter?(i=>{switch(i.unaryFilter.op){case"IS_NAN":let e=ia(i.unaryFilter.field);return O.create(e,"==",{doubleValue:NaN});case"IS_NULL":let t=ia(i.unaryFilter.field);return O.create(t,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let r=ia(i.unaryFilter.field);return O.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let n=ia(i.unaryFilter.field);return O.create(n,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return E(61313);default:return E(60726)}})(e):void 0!==e.fieldFilter?(e=>O.create(ia(e.fieldFilter.field),(e=>{switch(e){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 E(58110);default:return E(50506)}})(e.fieldFilter.op),e.fieldFilter.value))(e):void 0!==e.compositeFilter?(e=>M.create(e.compositeFilter.filters.map(e=>t(e)),(e=>{switch(e){case"AND":return"and";case"OR":return"or";default:return E(1026)}})(e.compositeFilter.op)))(e):E(30097,{filter:e})}(e))instanceof M&&$n(i)?i.getFilters():[i])),[]),u=(n.orderBy&&(o=n.orderBy.map(e=>(e=e,new jn(ia(e.field),(e=>{switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(e.direction))))),null),l=(n.limit&&(u=(e=n.limit,It(i="object"==typeof e?e.value:e)?null:i)),null),h=(n.startAt&&(l=(e=n.startAt,i=!!e.before,r=e.values||[],new Un(r,i))),null);return n.endAt&&(h=(e=n.endAt,r=!e.before,i=e.values||[],new Un(i,r))),fi(t,s,o,a,u,"F",l,h)}function ea(e,t){var r=(e=>{switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return E(28987,{purpose:e})}})(t.purpose);return null==r?null:{"goog-listen-tags":r}}function ta(e){return ks[e]}function ra(e){return Rs[e]}function na(e){return{fieldPath:e.canonicalString()}}function ia(e){return h.fromServerFormat(e.fieldPath)}function sa(e){return 4<=e.length&&"projects"===e.get(0)&&"databases"===e.get(2)}function aa(e){return e&&"function"==typeof e._toProto&&"ProtoValue"===e._protoValueType}class oa{constructor(e,t,r,n,i=w.min(),s=w.min(),a=N.EMPTY_BYTE_STRING,o=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=n,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=a,this.expectedCount=o}withSequenceNumber(e){return new oa(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new oa(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new oa(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new oa(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class ua{constructor(e){this.yt=e}}function la(e,t){var r,n=t.key,i={prefixPath:n.getCollectionPath().popLast().toArray(),collectionGroup:n.collectionGroup,documentId:n.path.lastSegment(),readTime:ha(t.readTime),hasCommittedMutations:t.hasCommittedMutations};if(t.isFoundDocument())i.document={name:Bs(e=e.yt,(r=t).key),fields:r.data.value.mapValue.fields,updateTime:Vs(e,r.version.toTimestamp()),createTime:Vs(e,r.createTime.toTimestamp())};else if(t.isNoDocument())i.noDocument={path:n.path.toArray(),readTime:ca(t.version)};else{if(!t.isUnknownDocument())return E(57904,{document:t});i.unknownDocument={path:n.path.toArray(),version:ca(t.version)}}return i}function ha(e){var t=e.toTimestamp();return[t.seconds,t.nanoseconds]}function ca(e){var t=e.toTimestamp();return{seconds:t.seconds,nanoseconds:t.nanoseconds}}function da(e){var t=new v(e.seconds,e.nanoseconds);return w.fromTimestamp(t)}function fa(t,r){let e=(r.baseMutations||[]).map(e=>Ws(t.yt,e));for(let s=0;s<r.mutations.length-1;++s){let t=r.mutations[s];if(s+1<r.mutations.length&&void 0!==r.mutations[s+1].transform){let e=r.mutations[s+1];t.updateTransforms=e.transform.fieldTransforms,r.mutations.splice(s+1,1),++s}}let n=r.mutations.map(e=>Ws(t.yt,e)),i=v.fromMillis(r.localWriteTimeMs);return new ls(r.batchId,i,e,n)}function ga(e){var t,r=da(e.readTime),n=void 0!==e.lastLimboFreeSnapshotVersion?da(e.lastLimboFreeSnapshotVersion):w.min(),i=void 0!==e.query.documents?(t=e.query,y(1===(i=t.documents.length),1966,{count:i}),vi(gi(zs(t.documents[0])))):vi(Zs(e.query));return new oa(i,e.targetId,"TargetPurposeListen",e.lastListenSequenceNumber,r,n,N.fromBase64String(e.resumeToken))}function ma(e,t){var r=ca(t.snapshotVersion),n=ca(t.lastLimboFreeSnapshotVersion),i=ui(t.target)?Js(e.yt,t.target):Xs(e.yt,t.target).ft,s=t.resumeToken.toBase64();return{targetId:t.targetId,canonicalId:ai(t.target),readTime:r,resumeToken:s,lastListenSequenceNumber:t.sequenceNumber,lastLimboFreeSnapshotVersion:n,query:i}}function pa(e){var t=Zs({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?_i(t,t.limit,"L"):t}function ya(e,t){return new cs(t.largestBatchId,Ws(e.yt,t.overlayMutation))}function va(e,t){var r=t.path.lastSegment();return[e,xt(t.path.popLast()),r]}function wa(e,t,r,n){return{indexId:e,uid:t,sequenceNumber:r,readTime:ca(n.readTime),documentKey:xt(n.documentKey.path),largestBatchId:n.largestBatchId}}class _a{getBundleMetadata(e,t){return ba(e).get(t).next(e=>{if(e)return{id:(e=e).bundleId,createTime:da(e.createTime),version:e.version}})}saveBundleMetadata(e,t){return ba(e).put({bundleId:(e=t).id,createTime:ca(F(e.createTime)),version:e.version})}getNamedQuery(e,t){return Ia(e).get(t).next(e=>{if(e)return{name:(e=e).name,query:pa(e.bundledQuery),readTime:da(e.readTime)}})}saveNamedQuery(e,t){return Ia(e).put({name:(e=t).name,readTime:ca(F(e.readTime)),bundledQuery:e.bundledQuery})}}function ba(e){return r(e,pr)}function Ia(e){return r(e,yr)}class Ta{constructor(e,t){this.serializer=e,this.userId=t}static wt(e,t){var r=t.uid||"";return new Ta(e,r)}getOverlay(e,t){return Ea(e).get(va(this.userId,t)).next(e=>e?ya(this.serializer,e):null)}getOverlays(e,t){let r=Ri();return A.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&r.set(t,e)})).next(()=>r)}saveOverlays(n,i,e){let s=[];return e.forEach((e,t)=>{var r=new cs(i,t);s.push(this.St(n,r))}),A.waitFor(s)}removeOverlaysForBatchId(r,e,n){let t=new Set,i=(e.forEach(e=>t.add(xt(e.getCollectionPath()))),[]);return t.forEach(e=>{var t=IDBKeyRange.bound([this.userId,e,n],[this.userId,e,n+1],!1,!0);i.push(Ea(r).X(Nr,t))}),A.waitFor(i)}getOverlaysForCollection(e,t,r){let n=Ri(),i=xt(t),s=IDBKeyRange.bound([this.userId,i,r],[this.userId,i,Number.POSITIVE_INFINITY],!0);return Ea(e).J(Nr,s).next(e=>{for(var t of e){let e=ya(this.serializer,t);n.set(e.getKey(),e)}return n})}getOverlaysForCollectionGroup(e,t,r,i){let s=Ri(),a;var n=IDBKeyRange.bound([this.userId,t,r],[this.userId,t,Number.POSITIVE_INFINITY],!0);return Ea(e).ee({index:Rr,range:n},(e,t,r)=>{var n=ya(this.serializer,t);s.size()<i||n.largestBatchId===a?(s.set(n.getKey(),n),a=n.largestBatchId):r.done()}).next(()=>s)}St(e,t){return Ea(e).put(((e,t,r)=>{var[,n,i]=va(t,r.mutation.key);return{userId:t,collectionPath:n,documentId:i,collectionGroup:r.mutation.key.getCollectionGroup(),largestBatchId:r.largestBatchId,overlayMutation:Hs(e.yt,r.mutation)}})(this.serializer,this.userId,t))}}function Ea(e){return r(e,Cr)}class Sa{bt(e){return r(e,Mr)}getSessionToken(e){return this.bt(e).get("sessionToken").next(e=>{var t=e?.value;return t?N.fromUint8Array(t):N.EMPTY_BYTE_STRING})}setSessionToken(e,t){return this.bt(e).put({name:"sessionToken",value:t.toUint8Array()})}}class xa{constructor(){}Dt(e,t){this.Ct(e,t),t.vt()}Ct(t,r){if("nullValue"in t)this.Ft(r,5);else if("booleanValue"in t)this.Ft(r,10),r.Mt(t.booleanValue?1:0);else if("integerValue"in t)this.Ft(r,15),r.Mt(k(t.integerValue));else if("doubleValue"in t){var e=k(t.doubleValue);isNaN(e)?this.Ft(r,13):(this.Ft(r,15),Tt(e)?r.Mt(0):r.Mt(e))}else if("timestampValue"in t){let e=t.timestampValue;this.Ft(r,20),"string"==typeof e&&(e=en(e)),r.xt(""+(e.seconds||"")),r.Mt(e.nanos||0)}else"stringValue"in t?(this.Ot(t.stringValue,r),this.Nt(r)):"bytesValue"in t?(this.Ft(r,30),r.Bt(tn(t.bytesValue)),this.Nt(r)):"referenceValue"in t?this.Lt(t.referenceValue,r):"geoPointValue"in t?(e=t.geoPointValue,this.Ft(r,45),r.Mt(e.latitude||0),r.Mt(e.longitude||0)):"mapValue"in t?Mn(t)?this.Ft(r,Number.MAX_SAFE_INTEGER):Rn(t)?this.kt(t.mapValue,r):(this.qt(t.mapValue,r),this.Nt(r)):"arrayValue"in t?(this.Kt(t.arrayValue,r),this.Nt(r)):E(19022,{Ut:t})}Ot(e,t){this.Ft(t,25),this.$t(e,t)}$t(e,t){t.xt(e)}qt(e,t){var r=e.fields||{};this.Ft(t,55);for(let e of Object.keys(r))this.Ot(e,t),this.Ct(r[e],t)}kt(e,t){var r=e.fields||{},n=(this.Ft(t,53),yn),i=r[n].arrayValue?.values?.length||0;this.Ft(t,15),t.Mt(k(i)),this.Ot(n,t),this.Ct(r[n],t)}Kt(e,t){var r=e.values||[];this.Ft(t,50);for(let e of r)this.Ct(e,t)}Lt(e,t){this.Ft(t,37),x.fromName(e).path.forEach(e=>{this.Ft(t,60),this.$t(e,t)})}Ft(e,t){e.Mt(t)}Nt(e){e.Mt(2)}}xa.Wt=new xa;function Aa(e){var t=64-(e=>{let t=0;for(let n=0;n<8;++n){var r=(e=>{if(0===e)return 8;let t=0;return e>>4||(t+=4,e<<=4),e>>6||(t+=2,e<<=2),e>>7||(t+=1),t})(255&e[n]);if(t+=r,8!==r)break}return t})(e);return Math.ceil(t/8)}class Ca{constructor(){this.buffer=new Uint8Array(1024),this.position=0}Qt(e){var t=e[Symbol.iterator]();let r=t.next();for(;!r.done;)this.Gt(r.value),r=t.next();this.zt()}jt(e){var t=e[Symbol.iterator]();let r=t.next();for(;!r.done;)this.Jt(r.value),r=t.next();this.Ht()}Zt(e){for(var t of e){let e=t.charCodeAt(0);if(e<128)this.Gt(e);else if(e<2048)this.Gt(960|e>>>6),this.Gt(128|63&e);else if(t<"\ud800"||"\udbff"<t)this.Gt(480|e>>>12),this.Gt(128|63&e>>>6),this.Gt(128|63&e);else{let e=t.codePointAt(0);this.Gt(240|e>>>18),this.Gt(128|63&e>>>12),this.Gt(128|63&e>>>6),this.Gt(128|63&e)}}this.zt()}Xt(e){for(var t of e){let e=t.charCodeAt(0);if(e<128)this.Jt(e);else if(e<2048)this.Jt(960|e>>>6),this.Jt(128|63&e);else if(t<"\ud800"||"\udbff"<t)this.Jt(480|e>>>12),this.Jt(128|63&e>>>6),this.Jt(128|63&e);else{let e=t.codePointAt(0);this.Jt(240|e>>>18),this.Jt(128|63&e>>>12),this.Jt(128|63&e>>>6),this.Jt(128|63&e)}}this.Ht()}Yt(e){var t=this.en(e),r=Aa(t);this.tn(1+r),this.buffer[this.position++]=255&r;for(let n=t.length-r;n<t.length;++n)this.buffer[this.position++]=255&t[n]}nn(e){var t=this.en(e),r=Aa(t);this.tn(1+r),this.buffer[this.position++]=~(255&r);for(let n=t.length-r;n<t.length;++n)this.buffer[this.position++]=~(255&t[n])}rn(){this.sn(255),this.sn(255)}_n(){this.an(255),this.an(255)}reset(){this.position=0}seed(e){this.tn(e.length),this.buffer.set(e,this.position),this.position+=e.length}un(){return this.buffer.slice(0,this.position)}en(e){e=e,(t=new DataView(new ArrayBuffer(8))).setFloat64(0,e,!1);var t,r=new Uint8Array(t.buffer),n=!!(128&r[0]);r[0]^=n?255:128;for(let i=1;i<r.length;++i)r[i]^=n?255:0;return r}Gt(e){var t=255&e;0==t?(this.sn(0),this.sn(255)):255==t?(this.sn(255),this.sn(0)):this.sn(t)}Jt(e){var t=255&e;0==t?(this.an(0),this.an(255)):255==t?(this.an(255),this.an(0)):this.an(e)}zt(){this.sn(0),this.sn(1)}Ht(){this.an(0),this.an(1)}sn(e){this.tn(1),this.buffer[this.position++]=e}an(e){this.tn(1),this.buffer[this.position++]=~e}tn(e){var t=e+this.position;if(!(t<=this.buffer.length)){let e=2*this.buffer.length;e<t&&(e=t);t=new Uint8Array(e);t.set(this.buffer),this.buffer=t}}}class Da{constructor(e){this.cn=e}Bt(e){this.cn.Qt(e)}xt(e){this.cn.Zt(e)}Mt(e){this.cn.Yt(e)}vt(){this.cn.rn()}}class Na{constructor(e){this.cn=e}Bt(e){this.cn.jt(e)}xt(e){this.cn.Xt(e)}Mt(e){this.cn.nn(e)}vt(){this.cn._n()}}class ka{constructor(){this.cn=new Ca,this.ascending=new Da(this.cn),this.descending=new Na(this.cn)}seed(e){this.cn.seed(e)}ln(e){return 0===e?this.ascending:this.descending}un(){return this.cn.un()}reset(){this.cn.reset()}}class Ra{constructor(e,t,r,n){this.hn=e,this.Pn=t,this.Tn=r,this.En=n}In(){var e=this.En.length,t=0===e||255===this.En[e-1]?e+1:e,r=new Uint8Array(t);return r.set(this.En,0),t!==e?r.set([0],this.En.length):++r[r.length-1],new Ra(this.hn,this.Pn,this.Tn,r)}Rn(e,t,r){return{indexId:this.hn,uid:e,arrayValue:Va(this.Tn),directionalValue:Va(this.En),orderedDocumentKey:Va(t),documentKey:r.path.toArray()}}An(e,t,r){var n=this.Rn(e,t,r);return[n.indexId,n.uid,n.arrayValue,n.directionalValue,n.orderedDocumentKey,n.documentKey]}}function Oa(e,t){var r=e.hn-t.hn;return 0!=r||0!==(r=Ma(e.Tn,t.Tn))||0!==(r=Ma(e.En,t.En))?r:x.comparator(e.Pn,t.Pn)}function Ma(e,t){for(let n=0;n<e.length&&n<t.length;++n){var r=e[n]-t[n];if(0!=r)return r}return e.length-t.length}function Va(r){if(Z()){var n=r;let e="";for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);return e}return r}function La(e){if("string"!=typeof e)return e;var t=e,r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}class Fa{constructor(e){this.Vn=new D((e,t)=>h.comparator(e.field,t.field)),this.collectionId=null!=e.collectionGroup?e.collectionGroup:e.path.lastSegment(),this.dn=e.orderBy,this.mn=[];for(var t of e.filters){let e=t;e.isInequality()?this.Vn=this.Vn.add(e):this.mn.push(e)}}get fn(){return 1<this.Vn.size}gn(e){if(y(e.collectionGroup===this.collectionId,49279),this.fn)return!1;let t=We(e);if(void 0!==t&&!this.pn(t))return!1;var r=Ye(e);let n=new Set,i=0,s=0;for(;i<r.length&&this.pn(r[i]);++i)n=n.add(r[i].fieldPath.canonicalString());if(i!==r.length){if(0<this.Vn.size){let t=this.Vn.getIterator().getNext();if(!n.has(t.field.canonicalString())){let e=r[i];if(!this.yn(t,e)||!this.wn(this.dn[s++],e))return!1}++i}for(;i<r.length;++i){let e=r[i];if(s>=this.dn.length||!this.wn(this.dn[s++],e))return!1}}return!0}Sn(){if(this.fn)return null;let e=new D(h.comparator);var t,r,n=[];for(t of this.mn)t.field.isKeyField()||("array-contains"===t.op||"array-contains-any"===t.op?n.push(new Je(t.field,2)):e.has(t.field)||(e=e.add(t.field),n.push(new Je(t.field,0))));for(r of this.dn)r.field.isKeyField()||e.has(r.field)||(e=e.add(r.field),n.push(new Je(r.field,"asc"===r.dir?0:1)));return new He(He.UNKNOWN_ID,this.collectionId,n,Xe.empty())}pn(e){for(var t of this.mn)if(this.yn(t,e))return!0;return!1}yn(e,t){var r;return!(void 0===e||!e.field.isEqual(t.fieldPath))&&(r="array-contains"===e.op||"array-contains-any"===e.op,2===t.kind==r)}wn(e,t){return!!e.field.isEqual(t.fieldPath)&&(0===t.kind&&"asc"===e.dir||1===t.kind&&"desc"===e.dir)}}function Pa(e){var t;return 0===e.getFilters().length?[]:(t=function t(e){if(y(e instanceof O||e instanceof M,34018),e instanceof O)return e;if(1===e.filters.length)return t(e.filters[0]);let r=e.filters.map(e=>t(e));let n=M.create(r,e.op);return n=Ka(n),qa(n)?n:(y(n instanceof M,64498),y(Kn(n),40251),y(1<n.filters.length,57927),n.filters.reduce((e,t)=>ja(e,t)))}(function t(r){if(y(r instanceof O||r instanceof M,20012),r instanceof O){if(r instanceof ti){let e=r.value.arrayValue?.values?.map(e=>O.create(r.field,"==",e))||[];return M.create(e,"or")}return r}let e=r.filters.map(e=>t(e));return M.create(e,r.op)}(e)),y(qa(t),7391),Ua(t)||Ba(t)?[t]:t.getFilters())}function Ua(e){return e instanceof O}function Ba(e){return e instanceof M&&$n(e)}function qa(e){return Ua(e)||Ba(e)||(e=>{if(e instanceof M&&Gn(e)){for(var t of e.getFilters())if(!Ua(t)&&!Ba(t))return!1;return!0}return!1})(e)}function ja(e,t){var r,n;return y(e instanceof O||e instanceof M,38388),y(t instanceof O||t instanceof M,25473),Ka(e instanceof O?t instanceof O?(r=e,n=t,M.create([r,n],"and")):za(e,t):t instanceof O?za(t,e):((e,t)=>{if(y(0<e.filters.length&&0<t.filters.length,48005),Kn(e)&&Kn(t))return Hn(e,t.getFilters());let r=Gn(e)?e:t,n=Gn(e)?t:e,i=r.filters.map(e=>ja(e,n));return M.create(i,"or")})(e,t))}function za(t,e){var r;return Kn(e)?Hn(e,t.getFilters()):(r=e.filters.map(e=>ja(t,e)),M.create(r,"or"))}function Ka(t){if(y(t instanceof O||t instanceof M,11850),t instanceof O)return t;var e=t.getFilters();if(1===e.length)return Ka(e[0]);if(Qn(t))return t;let r=e.map(e=>Ka(e)),n=[];return r.forEach(e=>{e instanceof O?n.push(e):e instanceof M&&(e.op===t.op?n.push(...e.filters):n.push(e))}),1===n.length?n[0]:M.create(n,t.op)}class Ga{constructor(){this.bn=new $a}addToCollectionParentIndex(e,t){return this.bn.add(t),A.resolve()}getCollectionParents(e,t){return A.resolve(this.bn.getEntries(t))}addFieldIndex(e,t){return A.resolve()}deleteFieldIndex(e,t){return A.resolve()}deleteAllFieldIndexes(e){return A.resolve()}createTargetIndexes(e,t){return A.resolve()}getDocumentsMatchingTarget(e,t){return A.resolve(null)}getIndexType(e,t){return A.resolve(0)}getFieldIndexes(e,t){return A.resolve([])}getNextCollectionGroupToUpdate(e){return A.resolve(null)}getMinOffset(e,t){return A.resolve(tt.min())}getMinOffsetFromCollectionGroup(e,t){return A.resolve(tt.min())}updateCollectionGroup(e,t,r){return A.resolve()}updateIndexEntries(e,t){return A.resolve()}}class $a{constructor(){this.index={}}add(e){var t=e.lastSegment(),r=e.popLast(),n=this.index[t]||new D(T.comparator),i=!n.has(r);return this.index[t]=n.add(r),i}has(e){var t=e.lastSegment(),r=e.popLast(),t=this.index[t];return t&&t.has(r)}getEntries(e){return(this.index[e]||new D(T.comparator)).toArray()}}let Qa="IndexedDbIndexManager",Ha=new Uint8Array(0);class Wa{constructor(e,t){this.databaseId=t,this.Dn=new $a,this.Cn=new Ai(e=>ai(e),(e,t)=>oi(e,t)),this.uid=e.uid||""}addToCollectionParentIndex(e,t){var r,n;return this.Dn.has(t)?A.resolve():(n=t.lastSegment(),r=t.popLast(),e.addOnCommittedListener(()=>{this.Dn.add(t)}),n={collectionId:n,parent:xt(r)},Ya(e).put(n))}getCollectionParents(e,r){let n=[],t=IDBKeyRange.bound([r,""],[Me(r),""],!1,!0);return Ya(e).J(t).next(e=>{for(var t of e){if(t.collectionId!==r)break;n.push(Ct(t.parent))}return n})}addFieldIndex(e,r){let t=Xa(e),n={indexId:r.indexId,collectionGroup:r.collectionGroup,fields:r.fields.map(e=>[e.fieldPath.canonicalString(),e.kind])};delete n.indexId;var i=t.add(n);if(r.indexState){let t=Za(e);return i.next(e=>{t.put(wa(e,this.uid,r.indexState.sequenceNumber,r.indexState.offset))})}return i.next()}deleteFieldIndex(e,t){let r=Xa(e),n=Za(e),i=Ja(e);return r.delete(t.indexId).next(()=>n.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0))).next(()=>i.delete(IDBKeyRange.bound([t.indexId],[t.indexId+1],!1,!0)))}deleteAllFieldIndexes(e){let t=Xa(e),r=Ja(e),n=Za(e);return t.X().next(()=>r.X()).next(()=>n.X())}createTargetIndexes(r,e){return A.forEach(this.vn(e),t=>this.getIndexType(r,t).next(e=>{if(0===e||1===e){let e=new Fa(t).Sn();if(null!=e)return this.addFieldIndex(r,e)}}))}getDocumentsMatchingTarget(e,c){let d=Ja(e),r=!0,n=new Map;return A.forEach(this.vn(c),t=>this.Fn(e,t).next(e=>{r=r&&!!e,n.set(t,e)})).next(()=>{if(r){let l=V(),h=[];return A.forEach(n,(e,t)=>{g(Qa,`Using index ${r=e,`id=${r.indexId}|cg=${r.collectionGroup}|f=`+r.fields.map(e=>e.fieldPath+":"+e.kind).join(",")} to execute `+ai(c));var r,n=((t,e)=>{var r=We(e);if(void 0!==r)for(let e of li(t,r.fieldPath))switch(e.op){case"array-contains-any":return e.value.arrayValue.values||[];case"array-contains":return[e.value]}return null})(t,e),i=((t,r)=>{var n,i=new Map;for(n of Ye(r))for(let e of li(t,n.fieldPath))switch(e.op){case"==":case"in":i.set(n.fieldPath.canonicalString(),e.value);break;case"not-in":case"!=":return i.set(n.fieldPath.canonicalString(),e.value),Array.from(i.values())}return null})(t,e),s=((t,e)=>{var r,n=[];let i=!0;for(r of Ye(e)){let e=(0===r.kind?hi:ci)(t,r.fieldPath,t.startAt);n.push(e.value),i=i&&e.inclusive}return new Un(n,i)})(t,e),a=((t,e)=>{var r,n=[];let i=!0;for(r of Ye(e)){let e=(0===r.kind?ci:hi)(t,r.fieldPath,t.endAt);n.push(e.value),i=i&&e.inclusive}return new Un(n,i)})(t,e),o=this.Mn(e,t,s),u=this.Mn(e,t,a),i=this.xn(e,t,i),n=this.On(e.indexId,n,o,s.inclusive,u,a.inclusive,i);return A.forEach(n,e=>d.Z(e,c.limit).next(e=>{e.forEach(e=>{var t=x.fromSegments(e.documentKey);l.has(t)||(l=l.add(t),h.push(t))})}))}).next(()=>h)}return A.resolve(null)})}vn(t){let e=this.Cn.get(t);return e||(e=0===t.filters.length?[t]:Pa(M.create(t.filters,"and")).map(e=>si(t.path,t.collectionGroup,t.orderBy,e.getFilters(),t.limit,t.startAt,t.endAt)),this.Cn.set(t,e)),e}On(i,s,a,o,u,l,h){let e=(null!=s?s.length:1)*Math.max(a.length,u.length),c=e/(null!=s?s.length:1),d=[];for(let f=0;f<e;++f){let t=s?this.Nn(s[f/c]):Ha,e=this.Bn(i,t,a[f%c],o),r=this.Ln(i,t,u[f%c],l),n=h.map(e=>this.Bn(i,t,e,!0));d.push(...this.createRange(e,r,n))}return d}Bn(e,t,r,n){var i=new Ra(e,x.empty(),t,r);return n?i:i.In()}Ln(e,t,r,n){var i=new Ra(e,x.empty(),t,r);return n?i.In():i}Fn(e,t){let n=new Fa(t),r=null!=t.collectionGroup?t.collectionGroup:t.path.lastSegment();return this.getFieldIndexes(e,r).next(e=>{let t=null;for(var r of e)n.gn(r)&&(!t||r.fields.length>t.fields.length)&&(t=r);return t})}getIndexType(e,t){let r=2,n=this.vn(t);return A.forEach(n,t=>this.Fn(e,t).next(e=>{e?0!==r&&e.fields.length<(t=>{let r=new D(h.comparator),n=!1;for(var i of t.filters)for(let e of i.getFlattenedFilters())e.field.isKeyField()||("array-contains"===e.op||"array-contains-any"===e.op?n=!0:r=r.add(e.field));for(let n of t.orderBy)n.field.isKeyField()||(r=r.add(n.field));return r.size+(n?1:0)})(t)&&(r=1):r=0})).next(()=>null!==t.limit&&1<n.length&&2===r?1:r)}kn(e,t){var r,n=new ka;for(r of Ye(e)){let e=t.data.field(r.fieldPath);if(null==e)return null;var i=n.ln(r.kind);xa.Wt.Dt(e,i)}return n.un()}Nn(e){var t=new ka;return xa.Wt.Dt(e,t.ln(0)),t.un()}qn(e,t){var r,n=new ka;return xa.Wt.Dt(xn(this.databaseId,t),n.ln(0===(r=Ye(e)).length?0:r[r.length-1].kind)),n.un()}xn(e,n,i){if(null===i)return[];let s=[],a=(s.push(new ka),0);for(var o of Ye(e)){let t=i[a++];for(let r of s)if(this.Kn(n,o.fieldPath)&&Cn(t))s=this.Un(s,o,t);else{let e=r.ln(o.kind);xa.Wt.Dt(t,e)}}return this.$n(s)}Mn(e,t,r){return this.xn(e,t,r.position)}$n(e){var t=[];for(let r=0;r<e.length;++r)t[r]=e[r].un();return t}Un(r,n,e){let i=[...r],s=[];for(let r of e.arrayValue.values||[])for(let t of i){let e=new ka;e.seed(t.un()),xa.Wt.Dt(r,e.ln(n.kind)),s.push(e)}return s}Kn(e,t){return!!e.filters.find(e=>e instanceof O&&e.field.isEqual(t)&&("in"===e.op||"not-in"===e.op))}getFieldIndexes(e,t){let r=Xa(e),n=Za(e);return(t?r.J(wr,IDBKeyRange.bound(t,t)):r.J()).next(e=>{let s=[];return A.forEach(e,i=>n.get([i.indexId,this.uid]).next(e=>{var t,r,n;s.push((t=i,r=(e=e)?new Xe(e.sequenceNumber,new tt(da(e.readTime),new x(Ct(e.documentKey)),e.largestBatchId)):Xe.empty(),n=t.fields.map(([e,t])=>new Je(h.fromServerFormat(e),t)),new He(t.indexId,t.collectionGroup,n,r)))})).next(()=>s)})}getNextCollectionGroupToUpdate(e){return this.getFieldIndexes(e).next(e=>0===e.length?null:(e.sort((e,t)=>{var r=e.indexState.sequenceNumber-t.indexState.sequenceNumber;return 0!=r?r:S(e.collectionGroup,t.collectionGroup)}),e[0].collectionGroup))}updateCollectionGroup(e,r,n){let i=Xa(e),s=Za(e);return this.Wn(e).next(t=>i.J(wr,IDBKeyRange.bound(r,r)).next(e=>A.forEach(e,e=>s.put(wa(e.indexId,this.uid,t,n)))))}updateIndexEntries(i,e){let r=new Map;return A.forEach(e,(t,n)=>{var e=r.get(t.collectionGroup);return(e?A.resolve(e):this.getFieldIndexes(i,t.collectionGroup)).next(e=>(r.set(t.collectionGroup,e),A.forEach(e,r=>this.Qn(i,t,r).next(e=>{var t=this.Gn(n,r);return e.isEqual(t)?A.resolve():this.zn(i,n,r,e,t)}))))})}jn(e,t,r,n){return Ja(e).put(n.Rn(this.uid,this.qn(r,t.key),t.key))}Jn(e,t,r,n){return Ja(e).delete(n.An(this.uid,this.qn(r,t.key),t.key))}Qn(e,r,n){var t=Ja(e);let i=new D(Oa);return t.ee({index:xr,range:IDBKeyRange.only([n.indexId,this.uid,Va(this.qn(n,r))])},(e,t)=>{i=i.add(new Ra(n.indexId,r,La(t.arrayValue),La(t.directionalValue)))}).next(()=>i)}Gn(t,r){let n=new D(Oa);var i=this.kn(r,t);if(null!=i){let e=We(r);if(null!=e){var s=t.data.field(e.fieldPath);if(Cn(s))for(let e of s.arrayValue.values||[])n=n.add(new Ra(r.indexId,t.key,this.Nn(e),i))}else n=n.add(new Ra(r.indexId,t.key,Ha,i))}return n}zn(t,r,s,e,a){g(Qa,"Updating index entries for document '%s'",r.key);let o=[];{var u=Oa,l=e=>{o.push(this.jn(t,r,s,e))},h=e=>{o.push(this.Jn(t,r,s,e))},c=e.getIterator(),d=a.getIterator();let n=Yr(c),i=Yr(d);for(;n||i;){let t=!1,r=!1;if(n&&i){let e=u(n,i);e<0?r=!0:0<e&&(t=!0)}else null!=n?r=!0:t=!0;t?(l(i),i=Yr(d)):r?(h(n),n=Yr(c)):(n=Yr(c),i=Yr(d))}}return A.waitFor(o)}Wn(e){let n=1;return Za(e).ee({index:Ir,reverse:!0,range:IDBKeyRange.upperBound([this.uid,Number.MAX_SAFE_INTEGER])},(e,t,r)=>{r.done(),n=t.sequenceNumber+1}).next(()=>n)}createRange(r,n,e){e=e.sort((e,t)=>Oa(e,t)).filter((e,t,r)=>!t||0!==Oa(e,r[t-1]));var i=[];i.push(r);for(let s of e){let e=Oa(s,r),t=Oa(s,n);if(0===e)i[0]=r.In();else if(0<e&&t<0)i.push(s),i.push(s.In());else if(0<t)break}i.push(n);let s=[];for(let a=0;a<i.length;a+=2){if(this.Hn(i[a],i[a+1]))return[];let e=i[a].An(this.uid,Ha,x.empty()),t=i[a+1].An(this.uid,Ha,x.empty());s.push(IDBKeyRange.bound(e,t))}return s}Hn(e,t){return 0<Oa(e,t)}getMinOffsetFromCollectionGroup(e,t){return this.getFieldIndexes(e,t).next(eo)}getMinOffset(t,e){return A.mapArray(this.vn(e),e=>this.Fn(t,e).next(e=>e||E(44426))).next(eo)}}function Ya(e){return r(e,ir)}function Ja(e){return r(e,Er)}function Xa(e){return r(e,vr)}function Za(e){return r(e,_r)}function eo(e){y(0!==e.length,28825);let t=e[0].indexState.offset,r=t.largestBatchId;for(let i=1;i<e.length;i++){var n=e[i].indexState.offset;rt(n,t)<0&&(t=n),r<n.largestBatchId&&(r=n.largestBatchId)}return new tt(t.readTime,t.documentKey,r)}let to={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0};class ro{static withCacheSize(e){return new ro(e,ro.DEFAULT_COLLECTION_PERCENTILE,ro.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=r}}function no(t,r,n){let e=t.store(Ot),i=t.store(Bt),s=[],a=IDBKeyRange.only(n.batchId),o=0;var u=e.ee({range:a},(e,t,r)=>(o++,r.delete()));s.push(u.next(()=>{y(1===o,47070,{batchId:n.batchId})}));let l=[];for(let t of n.mutations){let e=Pt(r,t.key.path,n.batchId);s.push(i.delete(e)),l.push(t.key)}return A.waitFor(s).next(()=>l)}function io(e){if(!e)return 0;let t;if(e.document)t=e.document;else if(e.unknownDocument)t=e.unknownDocument;else{if(!e.noDocument)throw E(14731);t=e.noDocument}return JSON.stringify(t).length}ro.DEFAULT_COLLECTION_PERCENTILE=10,ro.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,ro.DEFAULT=new ro(41943040,ro.DEFAULT_COLLECTION_PERCENTILE,ro.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),ro.DISABLED=new ro(-1,0,0);class so{constructor(e,t,r,n){this.userId=e,this.serializer=t,this.indexManager=r,this.referenceDelegate=n,this.Zn={}}static wt(e,t,r,n){y(""!==e.uid,64387);var i=e.isAuthenticated()?e.uid:"";return new so(i,t,r,n)}checkEmpty(e){let n=!0;var t=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return oo(e).ee({index:Vt,range:t},(e,t,r)=>{n=!1,r.done()}).next(()=>n)}addMutationBatch(c,d,f,g){let m=uo(c),p=oo(c);return p.add({}).next(t=>{y("number"==typeof t,49019);let e=new ls(t,d,f,g),r=(i=this.serializer,s=this.userId,a=e,o=a.baseMutations.map(e=>Hs(i.yt,e)),u=a.mutations.map(e=>Hs(i.yt,e)),{userId:s,batchId:a.batchId,localWriteTimeMs:a.localWriteTime.toMillis(),baseMutations:o,mutations:u}),n=[];var i,s,a,o,u;let l=new D((e,t)=>S(e.canonicalString(),t.canonicalString()));for(let h of g){let e=Pt(this.userId,h.key.path,t);l=l.add(h.key.path.popLast()),n.push(p.put(r)),n.push(m.put(e,Ut))}return l.forEach(e=>{n.push(this.indexManager.addToCollectionParentIndex(c,e))}),c.addOnCommittedListener(()=>{this.Zn[t]=e.keys()}),A.waitFor(n).next(()=>e)})}lookupMutationBatch(e,t){return oo(e).get(t).next(e=>e?(y(e.userId===this.userId,48,"Unexpected user for mutation batch",{userId:e.userId,batchId:t}),fa(this.serializer,e)):null)}Xn(e,r){return this.Zn[r]?A.resolve(this.Zn[r]):this.lookupMutationBatch(e,r).next(e=>{var t;return e?(t=e.keys(),this.Zn[r]=t):null})}getNextMutationBatchAfterBatchId(e,t){let n=t+1,r=IDBKeyRange.lowerBound([this.userId,n]),i=null;return oo(e).ee({index:Vt,range:r},(e,t,r)=>{t.userId===this.userId&&(y(t.batchId>=n,47524,{Yn:n}),i=fa(this.serializer,t)),r.done()}).next(()=>i)}getHighestUnacknowledgedBatchId(e){var t=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]);let n=bt;return oo(e).ee({index:Vt,range:t,reverse:!0},(e,t,r)=>{n=t.batchId,r.done()}).next(()=>n)}getAllMutationBatches(e){var t=IDBKeyRange.bound([this.userId,bt],[this.userId,Number.POSITIVE_INFINITY]);return oo(e).J(Vt,t).next(e=>e.map(e=>fa(this.serializer,e)))}getAllMutationBatchesAffectingDocumentKey(o,u){let e=Ft(this.userId,u.path),t=IDBKeyRange.lowerBound(e),l=[];return uo(o).ee({range:t},(t,e,r)=>{let[n,i,s]=t,a=Ct(i);if(n===this.userId&&u.path.isEqual(a))return oo(o).get(s).next(e=>{if(!e)throw E(61480,{er:t,batchId:s});y(e.userId===this.userId,10503,"Unexpected user for mutation batch",{userId:e.userId,batchId:s}),l.push(fa(this.serializer,e))});r.done()}).next(()=>l)}getAllMutationBatchesAffectingDocumentKeys(t,e){let o=new D(S),r=[];return e.forEach(a=>{var e=Ft(this.userId,a.path),e=IDBKeyRange.lowerBound(e),e=uo(t).ee({range:e},(e,t,r)=>{var[n,i,s]=e,i=Ct(i);n===this.userId&&a.path.isEqual(i)?o=o.add(s):r.done()});r.push(e)}),A.waitFor(r).next(()=>this.tr(t,o))}getAllMutationBatchesAffectingQuery(e,t){let a=t.path,o=a.length+1,r=Ft(this.userId,a),n=IDBKeyRange.lowerBound(r),u=new D(S);return uo(e).ee({range:n},(e,t,r)=>{var[n,i,s]=e,i=Ct(i);n===this.userId&&a.isPrefixOf(i)?i.length===o&&(u=u.add(s)):r.done()}).next(()=>this.tr(e,u))}tr(e,t){let r=[],n=[];return t.forEach(t=>{n.push(oo(e).get(t).next(e=>{if(null===e)throw E(35274,{batchId:t});y(e.userId===this.userId,9748,"Unexpected user for mutation batch",{userId:e.userId,batchId:t}),r.push(fa(this.serializer,e))}))}),A.waitFor(n).next(()=>r)}removeMutationBatch(t,r){return no(t.le,this.userId,r).next(e=>(t.addOnCommittedListener(()=>{this.nr(r.batchId)}),A.forEach(e,e=>this.referenceDelegate.markPotentiallyOrphaned(t,e))))}nr(e){delete this.Zn[e]}performConsistencyCheck(r){return this.checkEmpty(r).next(e=>{if(!e)return A.resolve();let t=IDBKeyRange.lowerBound([this.userId]),n=[];return uo(r).ee({range:t},(t,e,r)=>{if(t[0]===this.userId){let e=Ct(t[1]);n.push(e)}else r.done()}).next(()=>{y(0===n.length,56720,{rr:n.map(e=>e.canonicalString())})})})}containsKey(e,t){return ao(e,this.userId,t)}ir(e){return lo(e).get(this.userId).next(e=>e||{userId:this.userId,lastAcknowledgedBatchId:bt,lastStreamToken:""})}}function ao(e,s,t){let r=Ft(s,t.path),a=r[1],n=IDBKeyRange.lowerBound(r),o=!1;return uo(e).ee({range:n,Y:!0},(e,t,r)=>{var[n,i,,]=e;n===s&&i===a&&(o=!0),r.done()}).next(()=>o)}function oo(e){return r(e,Ot)}function uo(e){return r(e,Bt)}function lo(e){return r(e,Rt)}class ho{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new ho(0)}static ar(){return new ho(-1)}}class co{constructor(e,t){this.referenceDelegate=e,this.serializer=t}allocateTargetId(r){return this.ur(r).next(e=>{var t=new ho(e.highestTargetId);return e.highestTargetId=t.next(),this.cr(r,e).next(()=>e.highestTargetId)})}getLastRemoteSnapshotVersion(e){return this.ur(e).next(e=>w.fromTimestamp(new v(e.lastRemoteSnapshotVersion.seconds,e.lastRemoteSnapshotVersion.nanoseconds)))}getHighestSequenceNumber(e){return this.ur(e).next(e=>e.highestListenSequenceNumber)}setTargetsMetadata(t,r,n){return this.ur(t).next(e=>(e.highestListenSequenceNumber=r,n&&(e.lastRemoteSnapshotVersion=n.toTimestamp()),e.highestListenSequenceNumber<r&&(e.highestListenSequenceNumber=r),this.cr(t,e)))}addTargetData(t,r){return this.lr(t,r).next(()=>this.ur(t).next(e=>(e.targetCount+=1,this.hr(r,e),this.cr(t,e))))}updateTargetData(e,t){return this.lr(e,t)}removeTargetData(t,e){return this.removeMatchingKeysForTargetId(t,e.targetId).next(()=>fo(t).delete(e.targetId)).next(()=>this.ur(t)).next(e=>(y(0<e.targetCount,8065),--e.targetCount,this.cr(t,e)))}removeTargets(n,i,s){let a=0,o=[];return fo(n).ee((e,t)=>{var r=ga(t);r.sequenceNumber<=i&&null===s.get(r.targetId)&&(a++,o.push(this.removeTargetData(n,r)))}).next(()=>A.waitFor(o)).next(()=>a)}forEachTarget(e,n){return fo(e).ee((e,t)=>{var r=ga(t);n(r)})}ur(e){return go(e).get(rr).next(e=>(y(null!==e,2888),e))}cr(e,t){return go(e).put(rr,t)}lr(e,t){return fo(e).put(ma(this.serializer,t))}hr(e,t){let r=!1;return e.targetId>t.highestTargetId&&(t.highestTargetId=e.targetId,r=!0),t.highestListenSequenceNumber<e.sequenceNumber&&(t.highestListenSequenceNumber=e.sequenceNumber,r=!0),r}getTargetCount(e){return this.ur(e).next(e=>e.targetCount)}getTargetData(e,i){var t=ai(i),t=IDBKeyRange.bound([t,Number.NEGATIVE_INFINITY],[t,Number.POSITIVE_INFINITY]);let s=null;return fo(e).ee({range:t,index:Yt},(e,t,r)=>{var n=ga(t);oi(i,n.target)&&(s=n,r.done())}).next(()=>s)}addMatchingKeys(r,e,n){let i=[],s=mo(r);return e.forEach(e=>{var t=xt(e.path);i.push(s.put({targetId:n,path:t})),i.push(this.referenceDelegate.addReference(r,n,e))}),A.waitFor(i)}removeMatchingKeys(r,e,n){let i=mo(r);return A.forEach(e,e=>{var t=xt(e.path);return A.waitFor([i.delete([n,t]),this.referenceDelegate.removeReference(r,n,e)])})}removeMatchingKeysForTargetId(e,t){var r=mo(e),n=IDBKeyRange.bound([t],[t+1],!1,!0);return r.delete(n)}getMatchingKeysForTargetId(e,t){var r=IDBKeyRange.bound([t],[t+1],!1,!0),n=mo(e);let i=V();return n.ee({range:r,Y:!0},(e,t,r)=>{var n=Ct(e[1]),n=new x(n);i=i.add(n)}).next(()=>i)}containsKey(e,t){var r=xt(t.path),r=IDBKeyRange.bound([r],[Me(r)],!1,!0);let n=0;return mo(e).ee({index:er,Y:!0,range:r},([e],t,r)=>{0!==e&&(n++,r.done())}).next(()=>0<n)}At(e,t){return fo(e).get(t).next(e=>e?ga(e):null)}}function fo(e){return r(e,Wt)}function go(e){return r(e,nr)}function mo(e){return r(e,Xt)}let po="LruGarbageCollector";function yo([e,t],[r,n]){var i=S(e,r);return 0===i?S(t,n):i}class vo{constructor(e){this.Pr=e,this.buffer=new D(yo),this.Tr=0}Er(){return++this.Tr}Ir(e){var t=[e,this.Er()];if(this.buffer.size<this.Pr)this.buffer=this.buffer.add(t);else{let e=this.buffer.last();yo(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class wo{constructor(e,t,r){this.garbageCollector=e,this.asyncQueue=t,this.localStore=r,this.Rr=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.Ar(6e4)}stop(){this.Rr&&(this.Rr.cancel(),this.Rr=null)}get started(){return null!==this.Rr}Ar(e){g(po,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){dt(e)?g(po,"Ignoring IndexedDB error during garbage collection: ",e):await st(e)}await this.Ar(3e5)})}}class _o{constructor(e,t){this.Vr=e,this.params=t}calculateTargetCount(e,t){return this.Vr.dr(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return A.resolve(_t.ce);let r=new vo(t);return this.Vr.forEachTarget(e,e=>r.Ir(e.sequenceNumber)).next(()=>this.Vr.mr(e,e=>r.Ir(e))).next(()=>r.maxValue)}removeTargets(e,t,r){return this.Vr.removeTargets(e,t,r)}removeOrphanedDocuments(e,t){return this.Vr.removeOrphanedDocuments(e,t)}collect(t,r){return-1===this.params.cacheSizeCollectionThreshold?(g("LruGarbageCollector","Garbage collection skipped; disabled"),A.resolve(to)):this.getCacheSize(t).next(e=>e<this.params.cacheSizeCollectionThreshold?(g("LruGarbageCollector",`Garbage collection skipped; Cache size ${e} is lower than threshold `+this.params.cacheSizeCollectionThreshold),to):this.gr(t,r))}getCacheSize(e){return this.Vr.getCacheSize(e)}gr(t,r){let n,i,s,a,o,u,l,h=Date.now();return this.calculateTargetCount(t,this.params.percentileToCollect).next(e=>(i=e>this.params.maximumSequenceNumbersToCollect?(g("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from `+e),this.params.maximumSequenceNumbersToCollect):e,a=Date.now(),this.nthSequenceNumber(t,i))).next(e=>(n=e,o=Date.now(),this.removeTargets(t,n,r))).next(e=>(s=e,u=Date.now(),this.removeOrphanedDocuments(t,n))).next(e=>(l=Date.now(),pe()<=c.DEBUG&&g("LruGarbageCollector",`LRU Garbage Collection
|