1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[4897],{87315:(e,t,r)=>{let i,n,s;r.r(t),r.d(t,{default:()=>hS,getFirebaseErrorLevel:()=>hT});var a,o,l,h,u,c,d,f,p,g,m,y,v,w,_,E,b,I=r(67294),T=r(86706),C=r(10326);let S=function(e){let t=[],r=0;for(let i=0;i<e.length;i++){let n=e.charCodeAt(i);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:((64512&n)==55296&&i+1<e.length&&(64512&e.charCodeAt(i+1))==56320?(n=65536+((1023&n)<<10)+(1023&e.charCodeAt(++i)),t[r++]=n>>18|240,t[r++]=n>>12&63|128):t[r++]=n>>12|224,t[r++]=n>>6&63|128),t[r++]=63&n|128)}return t},A=function(e){let t=[],r=0,i=0;for(;r<e.length;){let n=e[r++];if(n<128)t[i++]=String.fromCharCode(n);else if(n>191&&n<224){let s=e[r++];t[i++]=String.fromCharCode((31&n)<<6|63&s)}else if(n>239&&n<365){let s=((7&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{let s=e[r++],a=e[r++];t[i++]=String.fromCharCode((15&n)<<12|(63&s)<<6|63&a)}}return t.join("")},k={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(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let t=0;t<e.length;t+=3){let n=e[t],s=t+1<e.length,a=s?e[t+1]:0,o=t+2<e.length,l=o?e[t+2]:0,h=n>>2,u=(3&n)<<4|a>>4,c=(15&a)<<2|l>>6,d=63&l;!o&&(d=64,s||(c=64)),i.push(r[h],r[u],r[c],r[d])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(S(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):A(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let r=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let t=0;t<e.length;){let n=r[e.charAt(t++)],s=t<e.length?r[e.charAt(t)]:0,a=++t<e.length?r[e.charAt(t)]:64,o=++t<e.length?r[e.charAt(t)]:64;if(++t,null==n||null==s||null==a||null==o)throw new R;let l=n<<2|s>>4;if(i.push(l),64!==a){let e=s<<4&240|a>>2;if(i.push(e),64!==o){let e=a<<6&192|o;i.push(e)}}}return i},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,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class R extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let N=function(e){let t=S(e);return k.encodeByteArray(t,!0)},O=function(e){return N(e).replace(/\./g,"")},D=function(e){try{return k.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null},P=()=>{try{return function(){if("u">typeof self)return self;if("u">typeof window)return window;if(void 0!==r.g)return r.g;throw Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__||(()=>{let e;if(!("u"<typeof process)){if(e)return JSON.parse(e)}})()||(()=>{let e;if("u"<typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&D(e[1]);return t&&JSON.parse(t)})()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},x=e=>{var t,r;return null==(r=null==(t=P())?void 0:t.emulatorHosts)?void 0:r[e]},L=()=>{var e;return null==(e=P())?void 0:e.config},M=e=>{var t;return null==(t=P())?void 0:t[`_${e}`]};class V{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,r))}}}function U(e){return e.endsWith(".cloudworkstations.dev")}async function F(e){return(await fetch(e,{credentials:"include"})).ok}let j={},B=!1;function q(e,t){if("u"<typeof window||"u"<typeof document||!U(window.location.host)||j[e]===t||j[e]||B)return;function r(e){return`__firebase__banner__${e}`}j[e]=t;let i="__firebase__banner",n=function(){let e={prod:[],emulator:[]};for(let t of Object.keys(j))j[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){let e,t,s=(e=document.getElementById(i),t=!1,e||((e=document.createElement("div")).setAttribute("id",i),t=!0),{created:t,element:e}),a=r("text"),o=document.getElementById(a)||document.createElement("span"),l=r("learnmore"),h=document.getElementById(l)||document.createElement("a"),u=r("preprendIcon"),
1c=document.getElementById(u)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.created){let e,t=s.element;t.style.display="flex",t.style.background="#7faaf0",t.style.position="fixed",t.style.bottom="5px",t.style.left="5px",t.style.padding=".5em",t.style.borderRadius="5px",t.style.alignItems="center",h.setAttribute("id",l),h.innerText="Learn more",h.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",h.setAttribute("target","__blank"),h.style.paddingLeft="5px",h.style.textDecoration="underline";let r=((e=document.createElement("span")).style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" ×",e.onclick=()=>{let e;B=!0,(e=document.getElementById(i))&&e.remove()},e);c.setAttribute("width","24"),c.setAttribute("id",u),c.setAttribute("height","24"),c.setAttribute("viewBox","0 0 24 24"),c.setAttribute("fill","none"),c.style.marginLeft="-6px",t.append(c,o,h,r),document.body.appendChild(t)}n?(o.innerText="Preview backend disconnected.",c.innerHTML=`<g clip-path="url(#clip0_6013_33858)"> 2<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/> 3</g> 4<defs> 5<clipPath id="clip0_6013_33858"> 6<rect width="24" height="24" fill="white"/> 7</clipPath> 8</defs>`):(c.innerHTML=`<g clip-path="url(#clip0_6083_34804)"> 9<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/> 10</g> 11<defs> 12<clipPath id="clip0_6083_34804"> 13<rect width="24" height="24" fill="white"/> 14</clipPath> 15</defs>`,o.innerText="Preview backend running in this workspace."),o.setAttribute("id",a)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",s):s()}function $(){return"u">typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class z extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,z.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,H.prototype.create)}}class H{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var r,i;let n=t[0]||{},s=`${this.service}/${e}`,a=this.errors[e],o=a?(r=a,i=n,r.replace(K,(e,t)=>{let r=i[t];return null!=r?String(r):`<${t}?>`})):"Error",l=`${this.serviceName}: ${o} (${s}).`;return new z(s,l,n)}}let K=/\{\$([^}]+)}/g;function G(e,t){if(e===t)return!0;let r=Object.keys(e),i=Object.keys(t);for(let n of r){if(!i.includes(n))return!1;let r=e[n],s=t[n];if(W(r)&&W(s)){if(!G(r,s))return!1}else if(r!==s)return!1}for(let e of i)if(!r.includes(e))return!1;return!0}function W(e){return null!==e&&"object"==typeof e}function Q(e){let t=[];
15for(let[r,i]of Object.entries(e))Array.isArray(i)?i.forEach(e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(i));return t.length?"&"+t.join("&"):""}function X(e){let t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){let[r,i]=e.split("=");t[decodeURIComponent(r)]=decodeURIComponent(i)}}),t}function Y(e){let t=e.indexOf("?");if(!t)return"";let r=e.indexOf("#",t);return e.substring(t,r>0?r:void 0)}class J{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let i;if(void 0===e&&void 0===t&&void 0===r)throw Error("Missing Observer.");void 0===(i=!function(e,t){if("object"!=typeof e||null===e)return!1;for(let r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?{next:e,error:t,complete:r}:e).next&&(i.next=Z),void 0===i.error&&(i.error=Z),void 0===i.complete&&(i.complete=Z);let n=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(e){}}),this.observers.push(i),n}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"u">typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Z(){}function ee(e){return e&&e._delegate?e._delegate:e}class et{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}}let er="[DEFAULT]";class ei{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new V;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;let r=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),i=null!=(t=null==e?void 0:e.optional)&&t;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(e){if(i)return null;throw e}if(i)return null;throw Error(`Service ${this.name} is not available`)}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:er})}catch(e){}for(let[e,t]of this.instancesDeferred.entries()){let r=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e=er){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=er){return this.instances.has(e)}getOptions(e=er){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(let[e,t]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(e)&&t.resolve(i);return i}onInit(e,t){var r;let i=this.normalizeInstanceIdentifier(t),n=null!=(r=this.onInitCallbacks.get(i))?r:new Set;n.add(e),this.onInitCallbacks.set(i,n);let s=this.instances.get(i);return s&&e(s,i),()=>{n.delete(e)}}invokeOnInitCallbacks(e,t){let r=this.onInitCallbacks.get(t);if(r)for(let i of r)try{i(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){var r;let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e)===er?void 0:r,options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch(e){}return i||null}normalizeInstanceIdentifier(e=er){return this.component?this.component.multipleInstances?e:er:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class en{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new ei(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}let es=[];(a=l||(l={}))[a.DEBUG=0]="DEBUG",a[a.VERBOSE=1]="VERBOSE",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.S
15ILENT=5]="SILENT";let ea={debug:l.DEBUG,verbose:l.VERBOSE,info:l.INFO,warn:l.WARN,error:l.ERROR,silent:l.SILENT},eo=l.INFO,el={[l.DEBUG]:"log",[l.VERBOSE]:"log",[l.INFO]:"info",[l.WARN]:"warn",[l.ERROR]:"error"},eh=(e,t,...r)=>{if(t<e.logLevel)return;let i=new Date().toISOString(),n=el[t];if(n)console[n](`[${i}] ${e.name}:`,...r);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class eu{constructor(e){this.name=e,this._logLevel=eo,this._logHandler=eh,this._userLogHandler=null,es.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in l))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?ea[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw 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,l.DEBUG,...e),this._logHandler(this,l.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,l.VERBOSE,...e),this._logHandler(this,l.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,l.INFO,...e),this._logHandler(this,l.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,l.WARN,...e),this._logHandler(this,l.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,l.ERROR,...e),this._logHandler(this,l.ERROR,...e)}}let ec=new WeakMap,ed=new WeakMap,ef=new WeakMap,ep=new WeakMap,eg=new WeakMap,em={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return ed.get(e);if("objectStoreNames"===t)return e.objectStoreNames||ef.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return ey(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function ey(e){if(e instanceof IDBRequest){let t;return(t=new Promise((t,r)=>{let i=()=>{e.removeEventListener("success",n),e.removeEventListener("error",s)},n=()=>{t(ey(e.result)),i()},s=()=>{r(e.error),i()};e.addEventListener("success",n),e.addEventListener("error",s)})).then(t=>{t instanceof IDBCursor&&ec.set(t,e)}).catch(()=>{}),eg.set(t,e),t}if(ep.has(e))return ep.get(e);let t=function(e){if("function"==typeof e)return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(n||(n=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(ev(this),t),ey(ec.get(this))}:function(...t){return ey(e.apply(ev(this),t))}:function(t,...r){let i=e.call(ev(this),t,...r);return ef.set(i,t.sort?t.sort():[t]),ey(i)};return e instanceof IDBTransaction&&function(e){if(ed.has(e))return;let t=new Promise((t,r)=>{let i=()=>{e.removeEventListener("complete",n),e.removeEventListener("error",s),e.removeEventListener("abort",s)},n=()=>{t(),i()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",n),e.addEventListener("error",s),e.addEventListener("abort",s)});ed.set(e,t)}(e),(i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(e,em):e}(e);return t!==e&&(ep.set(e,t),eg.set(t,e)),t}let ev=e=>eg.get(e),ew=["get","getKey","getAll","getAllKeys","count"],e_=["put","add","delete","clear"],eE=new Map;function eb(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(eE.get(t))return eE.get(t);let r=t.replace(/FromIndex$/,""),i=t!==r,n=e_.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!(n||ew.includes(r)))return;let s=async function(e,...t){let s=this.transaction(e,n?"readwrite":"readonly"),a=s.store;return i&&(a=a.index(t.shift())),(await Promise.all([a[r](...t),n&&s.done]))[0]};return eE.set(t,s),s}em={...s=em,get:(e,t,r)=>eb(e,t)||s.get(e,t,r),has:(e,t)=>!!eb(e,t)||s.has(e,t)};class eI{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{let t;if((null==(t=e.getComponent())?void 0:t.type)!=="VERSION")return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let eT="@firebase/app",eC="0.13.1",eS=new eu("@firebase/app"),eA="[DEFAULT]",ek={[eT]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/ai":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},eR=new Map,eN=new Map,eO=new Map;function eD(e,t){try{e.container.addComponent(t)}catch(r){eS.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function eP(e){let t=e.name;if(eO.has(t))return eS.debug(`There were multiple attempts to register component ${t}.`),!1;
15for(let r of(eO.set(t,e),eR.values()))eD(r,e);for(let t of eN.values())eD(t,e);return!0}function ex(e,t){let r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function eL(e){return null!=e&&void 0!==e.settings}let eM=new H("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class eV{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new et("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw eM.create("app-deleted",{appName:this._name})}}let eU="11.9.0";function eF(e,t={}){let r=e;"object"!=typeof t&&(t={name:t});let i=Object.assign({name:eA,automaticDataCollectionEnabled:!0},t),n=i.name;if("string"!=typeof n||!n)throw eM.create("bad-app-name",{appName:String(n)});if(r||(r=L()),!r)throw eM.create("no-options");let s=eR.get(n);if(s)if(G(r,s.options)&&G(i,s.config))return s;else throw eM.create("duplicate-app",{appName:n});let a=new en(n);for(let e of eO.values())a.addComponent(e);let o=new eV(r,i,a);return eR.set(n,o),o}function ej(e=eA){let t=eR.get(e);if(!t&&e===eA&&L())return eF();if(!t)throw eM.create("no-app",{appName:e});return t}function eB(e,t,r){var i;let n=null!=(i=ek[e])?i:e;r&&(n+=`-${r}`);let s=n.match(/\s|\//),a=t.match(/\s|\//);if(s||a){let e=[`Unable to register library "${n}" with version "${t}":`];s&&e.push(`library name "${n}" contains illegal characters (whitespace or "/")`),s&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),eS.warn(e.join(" "));return}eP(new et(`${n}-version`,()=>({library:n,version:t}),"VERSION"))}let eq="firebase-heartbeat-store",e$=null;function ez(){return e$||(e$=(function(e,t,{blocked:r,upgrade:i,blocking:n,terminated:s}={}){let a=indexedDB.open(e,1),o=ey(a);return i&&a.addEventListener("upgradeneeded",e=>{i(ey(a.result),e.oldVersion,e.newVersion,ey(a.transaction),e)}),r&&a.addEventListener("blocked",e=>r(e.oldVersion,e.newVersion,e)),o.then(e=>{s&&e.addEventListener("close",()=>s()),n&&e.addEventListener("versionchange",e=>n(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o})("firebase-heartbeat-database",0,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(eq)}catch(e){console.warn(e)}}}).catch(e=>{throw eM.create("idb-open",{originalErrorMessage:e.message})})),e$}async function eH(e){try{let t=(await ez()).transaction(eq),r=await t.objectStore(eq).get(eG(e));return await t.done,r}catch(e){if(e instanceof z)eS.warn(e.message);else{let t=eM.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});eS.warn(t.message)}}}async function eK(e,t){try{let r=(await ez()).transaction(eq,"readwrite"),i=r.objectStore(eq);await i.put(t,eG(e)),await r.done}catch(e){if(e instanceof z)eS.warn(e.message);else{let t=eM.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});eS.warn(t.message)}}}function eG(e){return`${e.name}!${e.options.appId}`}class eW{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new eX(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{let r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=eQ();if((null==(e=this._heartbeatsCache)?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,(null==(t=this._heartbeatsCache)?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(e=>e.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:r}),this._heartbeatsCache.heartbeats.length>30){let e=function(e){if(0===e.length)return -1;let t=0,r=e[0].date;for(let i=1;i<e.length;i++)e[i].date<r&&(r=e[i].date,t=i);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){eS.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,(null==(e=this._heartbeatsCache)?void 0:e.heartbeats)==null||0===this._heartbeatsCache.heartbeats.length)return"";let t=eQ(),{heartbeatsToSend:r,unsentEntries:i}=function(e,t=1024){let r=[],i=e.slice();for(let n of e){let e=r.find(e=>e.agent===n.agent);if(e){if(e.dates.push(n.date),eY(r)>t){e.dates.pop();break}}else if(r.push({agent:n.agent,dates:[n.date]}),eY(r)>t){r.pop();break}i=i.slice(1)}return{heartbeatsToSend:r,unsentEntries:i}}(this._heartbeatsCache.heartbeats),n=O(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}catch(e){return eS.warn(e),""}}}function eQ(){return new Date().toISOString().substring(0,10)}class eX{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise((e,t)=>
15{try{let r=!0,i="validate-browser-context-for-indexeddb-analytics-module",n=self.indexedDB.open(i);n.onsuccess=()=>{n.result.close(),r||self.indexedDB.deleteDatabase(i),e(!0)},n.onupgradeneeded=()=>{r=!1},n.onerror=()=>{var e;t((null==(e=n.error)?void 0:e.message)||"")}}catch(e){t(e)}}).then(()=>!0).catch(()=>!1)}async read(){if(!await this._canUseIndexedDBPromise)return{heartbeats:[]};{let e=await eH(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){let r=await this.read();return eK(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){let r=await this.read();return eK(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function eY(e){return O(JSON.stringify({version:2,heartbeats:e})).length}eP(new et("platform-logger",e=>new eI(e),"PRIVATE")),eP(new et("heartbeat",e=>new eW(e),"PRIVATE")),eB(eT,eC,""),eB(eT,eC,"esm2017"),eB("fire-js",""),eB("firebase","11.9.1","app");function eJ(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function eZ(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}"function"==typeof SuppressedError&&SuppressedError;let e0=new H("auth","Firebase",eZ()),e1=new eu("@firebase/auth");function e2(e,...t){e1.logLevel<=l.ERROR&&e1.error(`Auth (${eU}): ${e}`,...t)}function e6(e,...t){throw e8(e,...t)}function e3(e,...t){return e8(e,...t)}function e4(e,t,r){return new H("auth","Firebase",Object.assign(Object.assign({},eZ()),{[t]:r})).create(t,{appName:e.name})}function e5(e){return e4(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function e8(e,...t){if("string"!=typeof e){let r=t[0],i=[...t.slice(1)];return i[0]&&(i[0].appName=e.name),e._errorFactory.create(r,...i)}return e0.create(e,...t)}function e7(e,t,...r){if(!e)throw e8(t,...r)}function e9(e){let t="INTERNAL ASSERTION FAILED: "+e;throw e2(t),Error(t)}function te(){var e;return"u">typeof self&&(null==(e=self.location)?void 0:e.href)||""}function tt(){var e;return"u">typeof self&&(null==(e=self.location)?void 0:e.protocol)||null}class tr{constructor(e,t){var r;this.shortDelay=e,this.longDelay=t,r="Short delay should be less than long delay!",t>e||e9(r),this.isMobile="u">typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test($())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){let e;return!("u">typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&("http:"===tt()||"https:"===tt()||"object"==typeof(e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0)&&void 0!==e.id||"connection"in navigator))||navigator.onLine?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function ti(e,t){var r,i;r=e.emulator,i="Emulator should always be set here",r||e9(i);let{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class tn{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){return this.fetchImpl?this.fetchImpl:"u">typeof self&&"fetch"in self?self.fetch:"u">typeof globalThis&&globalThis.fetch?globalThis.fetch:"u">typeof fetch?fetch:void e9("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"u">typeof self&&"Headers"in self?self.Headers:"u">typeof globalThis&&globalThis.Headers?globalThis.Headers:"u">typeof Headers?Headers:void e9("Could not find Headers implementation, make sure you call FetchProvi
15der.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"u">typeof self&&"Response"in self?self.Response:"u">typeof globalThis&&globalThis.Response?globalThis.Response:"u">typeof Response?Response:void e9("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}let ts={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},ta=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],to=new tr(3e4,6e4);function tl(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function th(e,t,r,i,n={}){return tu(e,n,async()=>{let n={},s={};i&&("GET"===t?s=i:n={body:JSON.stringify(i)});let a=Q(Object.assign({key:e.config.apiKey},s)).slice(1),o=await e._getAdditionalHeaders();o["Content-Type"]="application/json",e.languageCode&&(o["X-Firebase-Locale"]=e.languageCode);let l=Object.assign({method:t,headers:o},n);return"u">typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(l.referrerPolicy="no-referrer"),e.emulatorConfig&&U(e.emulatorConfig.host)&&(l.credentials="include"),tn.fetch()(await td(e,e.config.apiHost,r,a),l)})}async function tu(e,t,r){e._canInitEmulator=!1;let i=Object.assign(Object.assign({},ts),t);try{let t=new tf(e),n=await Promise.race([r(),t.promise]);t.clearNetworkTimeout();let s=await n.json();if("needConfirmation"in s)throw tp(e,"account-exists-with-different-credential",s);if(n.ok&&!("errorMessage"in s))return s;{let[t,r]=(n.ok?s.errorMessage:s.error.message).split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===t)throw tp(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===t)throw tp(e,"email-already-in-use",s);if("USER_DISABLED"===t)throw tp(e,"user-disabled",s);let a=i[t]||t.toLowerCase().replace(/[_\s]+/g,"-");if(r)throw e4(e,a,r);e6(e,a)}}catch(t){if(t instanceof z)throw t;e6(e,"network-request-failed",{message:String(t)})}}async function tc(e,t,r,i,n={}){let s=await th(e,t,r,i,n);return"mfaPendingCredential"in s&&e6(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function td(e,t,r,i){let n=`${t}${r}?${i}`,s=e.config.emulator?ti(e.config,n):`${e.config.apiScheme}://${n}`;return ta.includes(r)&&(await e._persistenceManagerAvailable,"COOKIE"===e._getPersistenceType())?e._getPersistence()._getFinalTarget(s).toString():s}class tf{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>
15{this.timer=setTimeout(()=>t(e3(this.auth,"network-request-failed")),to.get())})}}function tp(e,t,r){let i={appName:e.name};r.email&&(i.email=r.email),r.phoneNumber&&(i.phoneNumber=r.phoneNumber);let n=e3(e,t,i);return n.customData._tokenResponse=r,n}function tg(e){return void 0!==e&&void 0!==e.enterprise}class tm{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)switch(t.enforcementState){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function ty(e,t){return th(e,"GET","/v2/recaptchaConfig",tl(e,t))}async function tv(e,t){return th(e,"POST","/v1/accounts:delete",t)}async function tw(e,t){return th(e,"POST","/v1/accounts:lookup",t)}function t_(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}async function tE(e,t=!1){let r=ee(e),i=await r.getIdToken(t),n=tI(i);e7(n&&n.exp&&n.auth_time&&n.iat,r.auth,"internal-error");let s="object"==typeof n.firebase?n.firebase:void 0,a=null==s?void 0:s.sign_in_provider;return{claims:n,token:i,authTime:t_(tb(n.auth_time)),issuedAtTime:t_(tb(n.iat)),expirationTime:t_(tb(n.exp)),signInProvider:a||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}function tb(e){return 1e3*Number(e)}function tI(e){let[t,r,i]=e.split(".");if(void 0===t||void 0===r||void 0===i)return e2("JWT malformed, contained fewer than 3 sections"),null;try{let e=D(r);if(!e)return e2("Failed to decode base64 JWT payload"),null;return JSON.parse(e)}catch(e){return e2("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function tT(e){let t=tI(e);return e7(t,"internal-error"),e7(void 0!==t.exp,"internal-error"),e7(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function tC(e,t,r=!1){if(r)return t;try{return await t}catch(t){throw t instanceof z&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class tS{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(!e)return this.errorBackoff=3e4,Math.max(0,(null!=(t=this.user.stsTokenManager.expirationTime)?t:0)-Date.now()-3e5);{let e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(null==e?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class tA{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=t_(this.lastLoginAt),this.creationTime=t_(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function tk(e){var t,r,i;let n=e.auth,s=await e.getIdToken(),a=await tC(e,tw(n,{idToken:s}));e7(null==a?void 0:a.users.length,n,"internal-error");let o=a.users[0];e._notifyReloadListener(o);let l=(null==(t=o.providerUserInfo)?void 0:t.length)?tN(o.providerUserInfo):[],h=(r=e.providerData,i=l,[...r.filter(e=>!i.some(t=>t.providerId===e.providerId)),...i]),u=e.isAnonymous,c=!(e.email&&o.passwordHash)&&!(null==h?void 0:h.length);Object.assign(e,{uid:o.localId,displayName:o.displayName||null,photoURL:o.photoUrl||null,email:o.email||null,emailVerified:o.emailVerified||!1,phoneNumber:o.phoneNumber||null,tenantId:o.tenantId||null,providerData:h,metadata:new tA(o.createdAt,o.lastLoginAt),isAnonymous:!!u&&c})}async function tR(e){let t=ee(e);await tk(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function tN(e){return e.map(e=>{var{providerId:t}=e,r=eJ(e,["providerId"]);
15return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}async function tO(e,t){let r=await tu(e,{},async()=>{let r=Q({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:n}=e.config,s=await td(e,i,"/v1/token",`key=${n}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";let o={method:"POST",headers:a,body:r};return e.emulatorConfig&&U(e.emulatorConfig.host)&&(o.credentials="include"),tn.fetch()(s,o)});return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}async function tD(e,t){return th(e,"POST","/v2/accounts:revokeToken",tl(e,t))}class tP{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){e7(e.idToken,"internal-error"),e7(void 0!==e.idToken,"internal-error"),e7(void 0!==e.refreshToken,"internal-error");let t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):tT(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){e7(0!==e.length,"internal-error");let t=tT(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(e7(this.refreshToken,e,"user-token-expired"),this.refreshToken)?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:r,refreshToken:i,expiresIn:n}=await tO(e,t);this.updateTokensAndExpiration(r,i,Number(n))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){let{refreshToken:r,accessToken:i,expirationTime:n}=t,s=new tP;return r&&(e7("string"==typeof r,"internal-error",{appName:e}),s.refreshToken=r),i&&(e7("string"==typeof i,"internal-error",{appName:e}),s.accessToken=i),n&&(e7("number"==typeof n,"internal-error",{appName:e}),s.expirationTime=n),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new tP,this.toJSON())}_performRefresh(){return e9("not implemented")}}function tx(e,t){e7("string"==typeof e||void 0===e,"internal-error",{appName:t})}class tL{constructor(e){var{uid:t,auth:r,stsTokenManager:i}=e,n=eJ(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new tS(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=n.displayName||null,this.email=n.email||null,this.emailVerified=n.emailVerified||!1,this.phoneNumber=n.phoneNumber||null,this.photoURL=n.photoURL||null,this.isAnonymous=n.isAnonymous||!1,this.tenantId=n.tenantId||null,this.providerData=n.providerData?[...n.providerData]:[],this.metadata=new tA(n.createdAt||void 0,n.lastLoginAt||void 0)}async getIdToken(e){let t=await tC(this,this.stsTokenManager.getToken(this.auth,e));return e7(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return tE(this,e)}reload(){return tR(this)}_assign(e){this!==e&&(e7(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new tL(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){e7(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await tk(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(eL(this.auth.app))return Promise.reject(e5(this.auth));let e=await this.getIdToken();return await tC(this,tv(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
15nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var r,i,n,s,a,o,l,h;let u=null!=(r=t.displayName)?r:void 0,c=null!=(i=t.email)?i:void 0,d=null!=(n=t.phoneNumber)?n:void 0,f=null!=(s=t.photoURL)?s:void 0,p=null!=(a=t.tenantId)?a:void 0,g=null!=(o=t._redirectEventId)?o:void 0,m=null!=(l=t.createdAt)?l:void 0,y=null!=(h=t.lastLoginAt)?h:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:E,stsTokenManager:b}=t;e7(v&&b,e,"internal-error");let I=tP.fromJSON(this.name,b);e7("string"==typeof v,e,"internal-error"),tx(u,e.name),tx(c,e.name),e7("boolean"==typeof w,e,"internal-error"),e7("boolean"==typeof _,e,"internal-error"),tx(d,e.name),tx(f,e.name),tx(p,e.name),tx(g,e.name),tx(m,e.name),tx(y,e.name);let T=new tL({uid:v,auth:e,email:c,emailVerified:w,displayName:u,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:I,createdAt:m,lastLoginAt:y});return E&&Array.isArray(E)&&(T.providerData=E.map(e=>Object.assign({},e))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(e,t,r=!1){let i=new tP;i.updateFromServerResponse(t);let n=new tL({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await tk(n),n}static async _fromGetAccountInfoResponse(e,t,r){let i=t.users[0];e7(void 0!==i.localId,"internal-error");let n=void 0!==i.providerUserInfo?tN(i.providerUserInfo):[],s=!(i.email&&i.passwordHash)&&!(null==n?void 0:n.length),a=new tP;a.updateFromIdToken(r);let o=new tL({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:s});return Object.assign(o,{uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:n,metadata:new tA(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(null==n?void 0:n.length)}),o}}let tM=new Map;function tV(e){var t,r;t="Expected a class definition",e instanceof Function||e9(t);let i=tM.get(e);return i?(r="Instance stored in cache mismatched with class",i instanceof e||e9(r)):(i=new e,tM.set(e,i)),i}class tU{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}function tF(e,t,r){return`firebase:${e}:${t}:${r}`}tU.type="NONE";class tj{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:i,name:n}=this.auth;this.fullUserKey=tF(this.userKey,i.apiKey,n),this.fullPersistenceKey=tF("persistence",i.apiKey,n),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){let t=await tw(this.auth,{idToken:e}).catch(()=>void 0);return t?tL._fromGetAccountInfoResponse(this.auth,t,e):null}return tL._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new tj(tV(tU),e,r);let i=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),n=i[0]||tV(tU),s=tF(r,e.config.apiKey,e.name),a=null;for(let r of t)try{let t=await r._get(s);if(t){let i;if("string"==typeof t){let r=await tw(e,{idToken:t}).catch(()=>void 0);if(!r)break;
15i=await tL._fromGetAccountInfoResponse(e,r,t)}else i=tL._fromJSON(e,t);r!==n&&(a=i),n=r;break}}catch(e){}let o=i.filter(e=>e._shouldAllowMigration);return n._shouldAllowMigration&&o.length&&(n=o[0],a&&await n._set(s,a.toJSON()),await Promise.all(t.map(async e=>{if(e!==n)try{await e._remove(s)}catch(e){}}))),new tj(n,e,r)}}function tB(e){let t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";{if(tH(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(tq(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(tG(t))return"Blackberry";if(tW(t))return"Webos";if(t$(t))return"Safari";if((t.includes("chrome/")||tz(t))&&!t.includes("edge/"))return"Chrome";if(tK(t))return"Android";let r=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if((null==r?void 0:r.length)===2)return r[1]}return"Other"}function tq(e=$()){return/firefox\//i.test(e)}function t$(e=$()){let t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function tz(e=$()){return/crios\//i.test(e)}function tH(e=$()){return/iemobile/i.test(e)}function tK(e=$()){return/android/i.test(e)}function tG(e=$()){return/blackberry/i.test(e)}function tW(e=$()){return/webos/i.test(e)}function tQ(e=$()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function tX(e=$()){return tQ(e)||tK(e)||tW(e)||tG(e)||/windows phone/i.test(e)||tH(e)}function tY(e,t=[]){let r;switch(e){case"Browser":r=tB($());break;case"Worker":r=`${tB($())}-${e}`;break;default:r=e}let i=t.length?t.join(","):"FirebaseCore-web";return`${r}/JsCore/${eU}/${i}`}class tJ{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let r=t=>new Promise((r,i)=>{try{let i=e(t);r(i)}catch(e){i(e)}});r.onAbort=t,this.queue.push(r);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(e){for(let e of(t.reverse(),t))try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}async function tZ(e,t={}){return th(e,"GET","/v2/passwordPolicy",tl(e,t))}class t0{constructor(e){var t,r,i,n;const s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!=(t=s.minPasswordLength)?t:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!=(i=null==(r=e.allowedNonAlphanumericCharacters)?void 0:r.join(""))?i:"",this.forceUpgradeOnSignin=null!=(n=e.forceUpgradeOnSignin)&&n,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,i,n,s,a;let o={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,o),this.validatePasswordCharacterOptions(e,o),o.isValid&&(o.isValid=null==(t=o.meetsMinPasswordLength)||t),o.isValid&&(o.isValid=null==(r=o.meetsMaxPasswordLength)||r),o.isValid&&(o.isValid=null==(i=o.containsLowercaseLetter)||i),o.isValid&&(o.isValid=null==(n=o.containsUppercaseLetter)||n),o.isValid&&(o.isValid=null==(s=o.containsNumericCharacter)||s),o.isValid&&(o.isValid=null==(a=o.containsNonAlphanumericCharacter)||a),o}validatePasswordLengthOptions(e,t){let r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){let r;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,i,n){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=n))}}
15class t1{constructor(e,t,r,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new t2(this),this.idTokenSubscription=new t2(this),this.beforeStateQueue=new tJ(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=e0,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=tV(t)),this._initializationPromise=this.queue(async()=>{var r,i,n;if(!this._deleted){if(this.persistenceManager=await tj.create(this,e),null==(r=this._resolvePersistenceManagerAvailable)||r.call(this),!this._deleted){if(null==(i=this._popupRedirectResolver)?void 0:i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null==(n=this.currentUser)?void 0:n.uid)||null,this._deleted||(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(this.currentUser||e){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let t=await tw(this,{idToken:e}),r=await tL._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(eL(this.app)){let e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}let r=await this.assertedPersistence.getCurrentUser(),i=r,n=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let r=null==(t=this.redirectUser)?void 0:t._redirectEventId,s=null==i?void 0:i._redirectEventId,a=await this.tryRedirectSignIn(e);(!r||r===s)&&(null==a?void 0:a.user)&&(i=a.user,n=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(n)try{await this.beforeStateQueue.runMiddleware(i)}catch(e){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return(e7(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId)?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await tk(e)}catch(e){if((null==e?void 0:e.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("u"<typeof navigator)return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(eL(this.app))return Promise.reject(e5(this));let t=e?ee(e):null;return t&&e7(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&e7(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return eL(this.app)?Promise.reject(e5(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return eL(this.app)?Promise.reject(e5(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(tV(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=new t0(await tZ(this));null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new H("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>
15{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await tD(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null==(e=this._currentUser)?void 0:e.toJSON()}}async _setRedirectUser(e,t){let r=await this.getOrInitRedirectPersistenceManager(t);return null===e?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&tV(e)||this._popupRedirectResolver;e7(t,this,"argument-error"),this.redirectPersistenceManager=await tj.create(this,[tV(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return(this._isInitialized&&await this.queue(async()=>{}),(null==(t=this._currentUser)?void 0:t._redirectEventId)===e)?this._currentUser:(null==(r=this.redirectUser)?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let r=null!=(t=null==(e=this.currentUser)?void 0:e.uid)?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,i){if(this._deleted)return()=>{};let n="function"==typeof t?t:t.next.bind(t),s=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(e7(a,this,"internal-error"),a.then(()=>{s||n(this.currentUser)}),"function"==typeof t){let n=e.addObserver(t,r,i);return()=>{s=!0,n()}}{let r=e.addObserver(t);return()=>{s=!0,r()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return e7(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=tY(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);let r=await (null==(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))?void 0:e.getHeartbeatsHeader());r&&(t["X-Firebase-Client"]=r);let i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;if(eL(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let t=await (null==(e=this.appCheckServiceProvider.getImmediate({optional:!0}))?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){e1.logLevel<=l.WARN&&e1.warn(`Auth (${eU}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}class t2{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){let r=new J(e,void 0);return r.subscribe.bind(r)}(e=>this.observer=e)}get next(){return e7(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let t6={async loadJS(){throw Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function t3(e){return`__${e}${Math.floor(1e6*Math.random())}`}class t4{constructor(){this.enterprise=new t5}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class t5{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}let t8="NO_RECAPTCHA";class t7{constructor(e){this.type="recaptcha-enterprise",this.auth=ee(e)}async verify(e="verify",t=!1){async function r(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,r)=>
15{ty(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(i=>{if(void 0===i.recaptchaKey)r(Error("recaptcha Enterprise site key undefined"));else{let r=new tm(i);return null==e.tenantId?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,t(r.siteKey)}}).catch(e=>{r(e)})})}function i(t,r,i){let n=window.grecaptcha;tg(n)?n.enterprise.ready(()=>{n.enterprise.execute(t,{action:e}).then(e=>{r(e)}).catch(()=>{r(t8)})}):i(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new t4().execute("siteKey",{action:"verify"}):new Promise((e,n)=>{r(this.auth).then(r=>{if(!t&&tg(window.grecaptcha))i(r,e,n);else{var s;if("u"<typeof window)return void n(Error("RecaptchaVerifier is only supported in browser"));let t=t6.recaptchaEnterpriseScript;0!==t.length&&(t+=r),(s=t,t6.loadJS(s)).then(()=>{i(r,e,n)}).catch(e=>{n(e)})}}).catch(e=>{n(e)})})}}async function t9(e,t,r,i=!1,n=!1){let s,a=new t7(e);if(n)s=t8;else try{s=await a.verify(r)}catch(e){s=await a.verify(r,!0)}let o=Object.assign({},t);if("mfaSmsEnrollment"===r||"mfaSmsSignIn"===r){if("phoneEnrollmentInfo"in o){let e=o.phoneEnrollmentInfo.phoneNumber,t=o.phoneEnrollmentInfo.recaptchaToken;Object.assign(o,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in o){let e=o.phoneSignInInfo.recaptchaToken;Object.assign(o,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return o}return i?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function re(e,t,r,i,n){var s,a;if("EMAIL_PASSWORD_PROVIDER"===n)if(null==(s=e._getRecaptchaConfig())||!s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER"))return i(e,t).catch(async n=>{if("auth/missing-recaptcha-token"!==n.code)return Promise.reject(n);{console.log(`${r} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let n=await t9(e,t,r,"getOobCode"===r);return i(e,n)}});else{let n=await t9(e,t,r,"getOobCode"===r);return i(e,n)}if("PHONE_PROVIDER"!==n)return Promise.reject(n+" provider is not supported.");if(null==(a=e._getRecaptchaConfig())?void 0:a.isProviderEnabled("PHONE_PROVIDER")){let n=await t9(e,t,r);return i(e,n).catch(async n=>{var s;if((null==(s=e._getRecaptchaConfig())?void 0:s.getProviderEnforcementState("PHONE_PROVIDER"))==="AUDIT"&&("auth/missing-recaptcha-token"===n.code||"auth/invalid-app-credential"===n.code)){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${r} flow.`);let n=await t9(e,t,r,!1,!0);return i(e,n)}return Promise.reject(n)})}{let n=await t9(e,t,r,!1,!0);return i(e,n)}}async function rt(e){let t=ee(e),r=new tm(await ty(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}));null==t.tenantId?t._agentRecaptchaConfig=r:t._tenantRecaptchaConfigs[t.tenantId]=r,r.isAnyProviderEnabled()&&new t7(t).verify()}function rr(e){let t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function ri(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}class rn{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return e9("not implemented")}_getIdTokenResponse(e){return e9("not implemented")}_linkToIdToken(e,t){return e9("not implemented")}_getReauthenticationResolver(e){return e9("not implemented")}}async function rs(e,t){return th(e,"POST","/v1/accounts:signUp",t)}async function ra(e,t){return tc(e,"POST","/v1/accounts:signInWithPassword",tl(e,t))}async function ro(e,t){return tc(e,"POST","/v1/accounts:signInWithEmailLink",tl(e,t))}async function rl(e,t){return tc(e,"POST","/v1/accounts:signInWithEmailLink",tl(e,t))}class rh extends rn{constructor(e,t,r,i=null){super("password",r),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new rh(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new rh(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);else if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return re(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",ra,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return ro(e,{email:this._email,oobCode:this._password});default:e6(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return re(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",rs,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return rl(e,{idToken:t,email:this._email,oobCode:this._password});default:e6(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function ru(e,t){return tc(e,"POST","/v1/accounts:signInWithIdp",tl(e,t))}class rc extends rn{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new rc(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&
15(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):e6("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e,{providerId:r,signInMethod:i}=t,n=eJ(t,["providerId","signInMethod"]);if(!r||!i)return null;let s=new rc(r,i);return s.idToken=n.idToken||void 0,s.accessToken=n.accessToken||void 0,s.secret=n.secret,s.nonce=n.nonce,s.pendingToken=n.pendingToken||null,s}_getIdTokenResponse(e){return ru(e,this.buildRequest())}_linkToIdToken(e,t){let r=this.buildRequest();return r.idToken=t,ru(e,r)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,ru(e,t)}buildRequest(){let e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=Q(t)}return e}}async function rd(e,t){return th(e,"POST","/v1/accounts:sendVerificationCode",tl(e,t))}async function rf(e,t){return tc(e,"POST","/v1/accounts:signInWithPhoneNumber",tl(e,t))}async function rp(e,t){let r=await tc(e,"POST","/v1/accounts:signInWithPhoneNumber",tl(e,t));if(r.temporaryProof)throw tp(e,"account-exists-with-different-credential",r);return r}let rg={USER_NOT_FOUND:"user-not-found"};async function rm(e,t){return tc(e,"POST","/v1/accounts:signInWithPhoneNumber",tl(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),rg)}class ry extends rn{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new ry({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new ry({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return rf(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return rp(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return rm(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:i}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:i}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));let{verificationId:t,verificationCode:r,phoneNumber:i,temporaryProof:n}=e;return r||t||i||n?new ry({verificationId:t,verificationCode:r,phoneNumber:i,temporaryProof:n}):null}}class rv{constructor(e){var t,r,i,n,s,a;const o=X(Y(e)),l=null!=(t=o.apiKey)?t:null,h=null!=(r=o.oobCode)?r:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!=(i=o.mode)?i:null);e7(l&&h&&u,"argument-error"),this.apiKey=l,this.operation=u,this.code=h,this.continueUrl=null!=(n=o.continueUrl)?n:null,this.languageCode=null!=(s=o.lang)?s:null,this.tenantId=null!=(a=o.tenantId)?a:null}static parseLink(e){let t,r,i,n=(r=(t=X(Y(e)).link)?X(Y(t)).deep_link_id:null,((i=X(Y(e)).deep_link_id)?X(Y(i)).link:null)||i||r||t||e);try{return new rv(n)}catch(e){return null}}}class rw{constructor(){this.providerId=rw.PROVIDER_ID}static credential(e,t){return rh._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let r=rv.parseLink(t);return e7(r,"argument-error"),rh._fromEmailAndCode(e,r.code,r.tenantId)}}rw.PROVIDER_ID="password",rw.EMAIL_PASSWORD_SIGN_IN_METHOD="password",rw.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class r_{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class rE extends r_{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class rb extends rE{constructor(){super("facebook.com")}static credential(e){return rc._fromParams({providerId:rb.PROVIDER_ID,signInMethod:rb.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return rb.credentialFromTaggedObject(e)}static credentialFromError(e){return rb.credentialFromTaggedObject(e.customData||{})}
15static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return rb.credential(e.oauthAccessToken)}catch(e){return null}}}rb.FACEBOOK_SIGN_IN_METHOD="facebook.com",rb.PROVIDER_ID="facebook.com";class rI extends rE{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return rc._fromParams({providerId:rI.PROVIDER_ID,signInMethod:rI.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return rI.credentialFromTaggedObject(e)}static credentialFromError(e){return rI.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return rI.credential(t,r)}catch(e){return null}}}rI.GOOGLE_SIGN_IN_METHOD="google.com",rI.PROVIDER_ID="google.com";class rT extends rE{constructor(){super("github.com")}static credential(e){return rc._fromParams({providerId:rT.PROVIDER_ID,signInMethod:rT.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return rT.credentialFromTaggedObject(e)}static credentialFromError(e){return rT.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return rT.credential(e.oauthAccessToken)}catch(e){return null}}}rT.GITHUB_SIGN_IN_METHOD="github.com",rT.PROVIDER_ID="github.com";class rC extends rE{constructor(){super("twitter.com")}static credential(e,t){return rc._fromParams({providerId:rC.PROVIDER_ID,signInMethod:rC.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return rC.credentialFromTaggedObject(e)}static credentialFromError(e){return rC.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return rC.credential(t,r)}catch(e){return null}}}rC.TWITTER_SIGN_IN_METHOD="twitter.com",rC.PROVIDER_ID="twitter.com";class rS{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){return new rS({user:await tL._fromIdTokenResponse(e,r,i),providerId:rA(r),_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){return await e._updateTokensIfNecessary(r,!0),new rS({user:e,providerId:rA(r),_tokenResponse:r,operationType:t})}}function rA(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}
15class rk extends z{constructor(e,t,r,i){var n;super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,rk.prototype),this.customData={appName:e.name,tenantId:null!=(n=e.tenantId)?n:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new rk(e,t,r,i)}}function rR(e,t,r,i){return("reauthenticate"===t?r._getReauthenticationResolver(e):r._getIdTokenResponse(e)).catch(r=>{if("auth/multi-factor-auth-required"===r.code)throw rk._fromErrorAndOperation(e,r,t,i);throw r})}async function rN(e,t,r=!1){let i=await tC(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return rS._forOperation(e,"link",i)}async function rO(e,t,r=!1){let{auth:i}=e;if(eL(i.app))return Promise.reject(e5(i));let n="reauthenticate";try{let s=await tC(e,rR(i,n,t,e),r);e7(s.idToken,i,"internal-error");let a=tI(s.idToken);e7(a,i,"internal-error");let{sub:o}=a;return e7(e.uid===o,i,"user-mismatch"),rS._forOperation(e,n,s)}catch(e){throw(null==e?void 0:e.code)==="auth/user-not-found"&&e6(i,"user-mismatch"),e}}async function rD(e,t,r=!1){if(eL(e.app))return Promise.reject(e5(e));let i="signIn",n=await rR(e,i,t),s=await rS._fromIdTokenResponse(e,i,n);return r||await e._updateCurrentUser(s.user),s}async function rP(e,t){return tc(e,"POST","/v1/accounts:signInWithCustomToken",tl(e,t))}async function rx(e,t){if(eL(e.app))return Promise.reject(e5(e));let r=ee(e),i=await rP(r,{token:t,returnSecureToken:!0}),n=await rS._fromIdTokenResponse(r,"signIn",i);return await r._updateCurrentUser(n.user),n}function rL(e,t){return th(e,"POST","/v2/accounts/mfaEnrollment:start",tl(e,t))}new WeakMap;let rM="__sak";class rV{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{if(!this.storage)return Promise.resolve(!1);return this.storage.setItem(rM,"1"),this.storage.removeItem(rM),Promise.resolve(!0)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class rU extends rV{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=tX(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}onStorageEvent(e,t=!1){let r;if(!e.key)return void this.forAllChangedKeys((e,t,r)=>{this.notifyListeners(e,r)});let i=e.key;t?this.detachListener():this.stopPolling();let n=()=>{let e=this.storage.getItem(i);(t||this.localCache[i]!==e)&&this.notifyListeners(i,e)},s=this.storage.getItem(i);((r=$()).indexOf("MSIE ")>=0||r.indexOf("Trident/")>=0)&&10===document.documentMode&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(n,10):n()}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let e of Array.from(r))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}rU.type="LOCAL";class rF extends rV{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}rF.type="SESSION";class rj{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;let r=new rj(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let{eventId:t,eventType:r,data:i}=e.data,n=this.handlersMap[r];if(!(null==n?void 0:n.size))return;e.ports[0].postMessage({status:"ack",eventId:t,eventType:r});let s=Array.from(n).map(async t=>t(e.origin,i)),a=await Promise.all(s.map(async e=>{try{let t=await e;return{fulfilled:!0,value:t}}catch(e){return{fulfilled:!1,reason:e}}}));e.ports[0].postMessage({status:"done",eventId:t,eventType:r,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function rB(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}rj.receivers=[];class rq{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){let i,n,s="u">typeof MessageChannel?new MessageChannel:null;if(!s)throw Error("connection_unavailable");return new Promise((a,o)=>{let l=rB("",20);s.port1.start();let h=setTimeout(()=>{o(Error("unsupported_event"))},r);n={messageChannel:s,onMessage(e){if(e.data.eventId===l)switch(e.data.status){case"ack":clearTimeout(h),i=setTimeout(()=>{o(Error("timeout"))},3e3);break;case"done":clearTimeout(i),a(e.data.response);break;default:clearTimeout(h),clearTimeout(i),o(Error("invalid_response"))}}},this.handlers.add(n),s.port1.addEventListener("message",n.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[s.port2])}).finally(()=>{n&&this.removeMessageHandler(n)})}}function r$(){return window}
15function rz(){return void 0!==r$().WorkerGlobalScope&&"function"==typeof r$().importScripts}async function rH(){if(!(null==navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}let rK="firebaseLocalStorageDb",rG="firebaseLocalStorage",rW="fbase_key";class rQ{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function rX(e,t){return e.transaction([rG],t?"readwrite":"readonly").objectStore(rG)}function rY(){let e=indexedDB.open(rK,1);return new Promise((t,r)=>{e.addEventListener("error",()=>{r(e.error)}),e.addEventListener("upgradeneeded",()=>{let t=e.result;try{t.createObjectStore(rG,{keyPath:rW})}catch(e){r(e)}}),e.addEventListener("success",async()=>{let r=e.result;r.objectStoreNames.contains(rG)?t(r):(r.close(),await new rQ(indexedDB.deleteDatabase(rK)).toPromise(),t(await rY()))})})}async function rJ(e,t,r){return new rQ(rX(e,!0).put({[rW]:t,value:r})).toPromise()}async function rZ(e,t){let r=rX(e,!1).get(t),i=await new rQ(r).toPromise();return void 0===i?null:i.value}function r0(e,t){return new rQ(rX(e,!0).delete(t)).toPromise()}class r1{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await rY()),this.db}async _withRetries(e){let t=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return rz()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=rj._getInstance(rz()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await rH(),!this.activeServiceWorker)return;this.sender=new rq(this.activeServiceWorker);let r=await this.sender._send("ping",{},800);r&&(null==(e=r[0])?void 0:e.fulfilled)&&(null==(t=r[0])?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null==(t=null==navigator?void 0:navigator.serviceWorker)?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await rY();return await rJ(e,rM,"1"),await r0(e,rM),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>rJ(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>rZ(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>r0(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>new rQ(rX(e,!1).getAll()).toPromise());if(!e||0!==this.pendingWrites)return[];let t=[],r=new Set;if(0!==e.length)for(let{fbase_key:i,value:n}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(n)&&(this.notifyListeners(i,n),t.push(i));for(let e of Object.keys(this.localCache))this.localCache[e]&&!r.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let e of Array.from(r))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}function r2(e,t){return th(e,"POST","/v2/accounts/mfaSignIn:start",tl(e,t))}r1.type="LOCAL",t3("rcb"),new tr(3e4,6e4);let r6="recaptcha";async function r3(e,t,r){var i;if(!e._getRecaptchaConfig())try{await rt(e)}catch(e){console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let n;if(n="string"==typeof t?{phoneNumber:t}
15:t,"session"in n){let t=n.session;if("phoneNumber"in n){e7("enroll"===t.type,e,"internal-error");let i={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},s=async(e,t)=>{if(t.phoneEnrollmentInfo.captchaResponse===t8){e7((null==r?void 0:r.type)===r6,e,"argument-error");let i=await r4(e,t,r);return rL(e,i)}return rL(e,t)},a=re(e,i,"mfaSmsEnrollment",s,"PHONE_PROVIDER");return(await a.catch(e=>Promise.reject(e))).phoneSessionInfo.sessionInfo}{e7("signin"===t.type,e,"internal-error");let s=(null==(i=n.multiFactorHint)?void 0:i.uid)||n.multiFactorUid;e7(s,e,"missing-multi-factor-info");let a={mfaPendingCredential:t.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},o=async(e,t)=>{if(t.phoneSignInInfo.captchaResponse===t8){e7((null==r?void 0:r.type)===r6,e,"argument-error");let i=await r4(e,t,r);return r2(e,i)}return r2(e,t)},l=re(e,a,"mfaSmsSignIn",o,"PHONE_PROVIDER");return(await l.catch(e=>Promise.reject(e))).phoneResponseInfo.sessionInfo}}{let t={phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"},i=async(e,t)=>{if(t.captchaResponse===t8){e7((null==r?void 0:r.type)===r6,e,"argument-error");let i=await r4(e,t,r);return rd(e,i)}return rd(e,t)},s=re(e,t,"sendVerificationCode",i,"PHONE_PROVIDER");return(await s.catch(e=>Promise.reject(e))).sessionInfo}}finally{null==r||r._reset()}}async function r4(e,t,r){e7(r.type===r6,e,"argument-error");let i=await r.verify();e7("string"==typeof i,e,"argument-error");let n=Object.assign({},t);if("phoneEnrollmentInfo"in n){let e=n.phoneEnrollmentInfo.phoneNumber,t=n.phoneEnrollmentInfo.captchaResponse,r=n.phoneEnrollmentInfo.clientType,s=n.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(n,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:i,captchaResponse:t,clientType:r,recaptchaVersion:s}}),n}if(!("phoneSignInInfo"in n))return Object.assign(n,{recaptchaToken:i}),n;{let e=n.phoneSignInInfo.captchaResponse,t=n.phoneSignInInfo.clientType,r=n.phoneSignInInfo.recaptchaVersion;return Object.assign(n,{phoneSignInInfo:{recaptchaToken:i,captchaResponse:e,clientType:t,recaptchaVersion:r}}),n}}class r5{constructor(e){this.providerId=r5.PROVIDER_ID,this.auth=ee(e)}verifyPhoneNumber(e,t){return r3(this.auth,e,ee(t))}static credential(e,t){return ry._fromVerification(e,t)}static credentialFromResult(e){return r5.credentialFromTaggedObject(e)}static credentialFromError(e){return r5.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:r}=e;return t&&r?ry._fromTokenResponse(t,r):null}}r5.PROVIDER_ID="phone",r5.PHONE_SIGN_IN_METHOD="phone";class r8 extends rn{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ru(e,this._buildIdpRequest())}_linkToIdToken(e,t){return ru(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return ru(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function r7(e){return rD(e.auth,new r8(e),e.bypassAuthState)}function r9(e){let{auth:t,user:r}=e;return e7(r,t,"internal-error"),rO(r,new r8(e),e.bypassAuthState)}async function ie(e){let{auth:t,user:r}=e;return e7(r,t,"internal-error"),rN(r,new r8(e),e.bypassAuthState)}class it{constructor(e,t,r,i,n=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=n,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:r,postBody:i,tenantId:n,error:s,type:a}=e;if(s)return void this.reject(s);let o={auth:this.auth,requestUri:t,sessionId:r,tenantId:n||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return r7;case"linkViaPopup":case"linkViaRedirect":return ie;case"reauthViaPopup":case"reauthViaRedirect":return r9;default:e6(this.auth,"internal-error")}}resolve(e){var t,r;t=this.pendingPromise,r="Pending promise was never set",t||e9(r),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){var t,r;t=this.pendingPromise,r="Pending promise was never set",t||e9(r),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}let ir=new tr(2e3,1e4);class ii extends it{constructor(e,t,r,i,n){super(e,t,i,n),this.provider=r,this.authWindow=null,this.pollId=null,ii.currentPopupAction&&ii.currentPopupAction.cancel(),ii.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return e7(e,this.auth,"internal-error"),e}async onExecution(){var e,t;e=1===this.filter.length,t="Popup operations only handle one event",e||e9(t);let r=rB();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],r),this.authWindow.associatedEvent=r,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(e3(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null==(e=this.authWindow)?void 0:e.associatedEvent)||null}cancel(){this.reject(e3(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ii.currentPopupAction=null}pollUserCancellation(){let e=()=>{var t,r;if(null==(r=null==(t=this.authWindow)?void 0:t.window)?void 0:r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(e3(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,ir.get())};e()}}ii.currentPopupAction=null;let is=new Map;class ia extends it{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=is.get(this.auth._key());if(!e){try{let t=await io(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}is.set(this.auth._key(),e)}return this.bypassAuthState||is.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);
15if("unknown"===e.type)return void this.resolve(null);if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function io(e,t){var r;let i=tF("pendingRedirect",(r=t).config.apiKey,r.name),n=tV(e._redirectPersistence);if(!await n._isAvailable())return!1;let s=await n._get(i)==="true";return await n._remove(i),s}function il(e,t){is.set(e._key(),t)}async function ih(e,t,r=!1){if(eL(e.app))return Promise.reject(e5(e));let i=ee(e),n=t?tV(t):(e7(i._popupRedirectResolver,i,"argument-error"),i._popupRedirectResolver),s=new ia(i,n,r),a=await s.execute();return a&&!r&&(delete a.user._redirectEventId,await i._persistUserIfCurrent(a.user),await i._setRedirectUser(null,t)),a}class iu{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return id(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!id(e)){let i=(null==(r=e.error.code)?void 0:r.split("auth/")[1])||"internal-error";t.onError(e3(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(ic(e))}saveEventToCache(e){this.cachedEventUids.add(ic(e)),this.lastProcessedEventTime=Date.now()}}function ic(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function id({type:e,error:t}){return"unknown"===e&&(null==t?void 0:t.code)==="auth/no-auth-event"}async function ip(e,t={}){return th(e,"GET","/v1/projects",t)}let ig=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,im=/^https?/;async function iy(e){if(e.config.emulator)return;let{authorizedDomains:t}=await ip(e);for(let e of t)try{if(function(e){let t=te(),{protocol:r,hostname:i}=new URL(t);if(e.startsWith("chrome-extension://")){let n=new URL(e);return""===n.hostname&&""===i?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&n.hostname===i}if(!im.test(r))return!1;if(ig.test(e))return i===e;let n=e.replace(/\./g,"\\.");return RegExp("^(.+\\."+n+"|"+n+")$","i").test(i)}(e))return}catch(e){}e6(e,"unauthorized-domain")}let iv=new tr(3e4,6e4);function iw(){let e=r$().___jsl;if(null==e?void 0:e.H){for(let t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}}let i_=null,iE=new tr(5e3,15e3),ib={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},iI=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function iT(e){let t,r,i,n,s,a=await (i_=i_||new Promise((t,r)=>{var i,n,s,a;function o(){iw(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{iw(),r(e3(e,"network-request-failed"))},timeout:iv.get()})}if(null==(n=null==(i=r$().gapi)?void 0:i.iframes)?void 0:n.Iframe)t(gapi.iframes.getContext());else if(null==(s=r$().gapi)?void 0:s.load)o();else{let t=t3("iframefcb");return r$()[t]=()=>{gapi.load?o():r(e3(e,"network-request-failed"))},(a=`${t6.gapiScript}?onload=${t}`,t6.loadJS(a)).catch(e=>r(e))}}).catch(e=>{throw i_=null,e})),o=r$().gapi;return e7(o,e,"internal-error"),a.open({where:document.body,url:(e7((t=e.config).authDomain,e,"auth-domain-config-required"),r=t.emulator?ti(t,"emulator/auth/iframe"):`https://${e.config.authDomain}
15/__/auth/iframe`,i={apiKey:t.apiKey,appName:e.name,v:eU},(n=iI.get(e.config.apiHost))&&(i.eid=n),(s=e._getFrameworks()).length&&(i.fw=s.join(",")),`${r}?${Q(i).slice(1)}`),messageHandlersFilter:o.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ib,dontclear:!0},t=>new Promise(async(r,i)=>{await t.restyle({setHideOnLeave:!1});let n=e3(e,"network-request-failed"),s=r$().setTimeout(()=>{i(n)},iE.get());function a(){r$().clearTimeout(s),r(t)}t.ping(a).then(a,()=>{i(n)})}))}let iC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class iS{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}let iA=encodeURIComponent("fac");async function ik(e,t,r,i,n,s){e7(e.config.authDomain,e,"auth-domain-config-required"),e7(e.config.apiKey,e,"invalid-api-key");let a={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:i,v:eU,eventId:n};if(t instanceof r_)for(let[r,i]of(t.setDefaultLanguage(e.languageCode),a.providerId=t.providerId||"",!function(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())&&(a.customParameters=JSON.stringify(t.getCustomParameters())),Object.entries(s||{})))a[r]=i;if(t instanceof rE){let e=t.getScopes().filter(e=>""!==e);e.length>0&&(a.scopes=e.join(","))}for(let t of(e.tenantId&&(a.tid=e.tenantId),Object.keys(a)))void 0===a[t]&&delete a[t];let o=await e._getAppCheckToken(),l=o?`#${iA}=${encodeURIComponent(o)}`:"";return`${function({config:e}){return e.emulator?ti(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${Q(a).slice(1)}${l}`}let iR="webStorageSupport",iN=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=rF,this._completeRedirectFn=ih,this._overrideRedirectResult=il}async _openPopup(e,t,r,i){var n,s,a;s=null==(n=this.eventManagers[e._key()])?void 0:n.manager,a="_initialize() not called before _openPopup()",s||e9(a);let o=await ik(e,t,r,te(),i);return function(e,t,r,i=500,n=600){let s=Math.max((window.screen.availHeight-n)/2,0).toString(),a=Math.max((window.screen.availWidth-i)/2,0).toString(),o="",l=Object.assign(Object.assign({},iC),{width:i.toString(),height:n.toString(),top:s,left:a}),h=$().toLowerCase();r&&(o=tz(h)?"_blank":r),tq(h)&&(t=t||"http://localhost",l.scrollbars="yes");let u=Object.entries(l).reduce((e,[t,r])=>`${e}${t}=${r},`,"");if(function(e=$()){var t;return tQ(e)&&!!(null==(t=window.navigator)?void 0:t.standalone)}(h)&&"_self"!==o){var c,d;let e,r;return c=t||"",d=o,(e=document.createElement("a")).href=c,e.target=d,(r=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),e.dispatchEvent(r),new iS(null)}let f=window.open(t||"",o,u);e7(f,e,"popup-blocked");try{f.focus()}catch(e){}return new iS(f)}(e,o,rB())}
15async _openRedirect(e,t,r,i){var n;return await this._originValidation(e),n=await ik(e,t,r,te(),i),r$().location.href=n,new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){var r;let{manager:e,promise:i}=this.eventManagers[t];return e?Promise.resolve(e):(r="If manager is not set, promise should be",i||e9(r),i)}let i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){let t=await iT(e),r=new iu(e);return t.register("authEvent",t=>(e7(null==t?void 0:t.authEvent,e,"invalid-auth-event"),{status:r.onEvent(t.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(iR,{type:iR},r=>{var i;let n=null==(i=null==r?void 0:r[0])?void 0:i[iR];void 0!==n&&t(!!n),e6(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=iy(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return tX()||t$()||tQ()}};var iO="@firebase/auth",iD="1.10.7";class iP{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null==(e=this.auth.currentUser)?void 0:e.uid)||null}async getToken(e){return(this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser)?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){e7(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}let ix=M("authIdTokenMaxAge")||300,iL=null;t6={loadJS:e=>new Promise((t,r)=>{var i,n;let s=document.createElement("script");s.setAttribute("src",e),s.onload=t,s.onerror=e=>{let t=e3("internal-error");t.customData=e,r(t)},s.type="text/javascript",s.charset="UTF-8",(null!=(n=null==(i=document.getElementsByTagName("head"))?void 0:i[0])?n:document).appendChild(s)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},o="Browser",eP(new et("auth",(e,{options:t})=>{let r,i,n=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),a=e.getProvider("app-check-internal"),{apiKey:l,authDomain:h}=n.options;e7(l&&!l.includes(":"),"invalid-api-key",{appName:n.name});let u=new t1(n,s,a,{apiKey:l,authDomain:h,clientPlatform:o,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:tY(o)});return i=(Array.isArray(r=(null==t?void 0:t.persistence)||[])?r:[r]).map(tV),(null==t?void 0:t.errorMap)&&u._updateErrorMap(t.errorMap),u._initializeWithPersistence(i,null==t?void 0:t.popupRedirectResolver),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),eP(new et("auth-internal",e=>new iP(ee(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),eB(iO,iD,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(o)),eB(iO,iD,"esm2017");var iM="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{},iV={};(function(){function e(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.B=Array(this.blockSize),this.o=this.h=0,this.s()}var t=function(){this.blockSize=-1};function r(){}function i(e,t,r){r||(r=0);var i=Array(16);if("string"==typeof t)for(var n=0;16>n;++n)i[n]=t.charCodeAt(r++)|t.charCodeAt(r++)<<8|t.charCodeAt(r++)<<16|t.charCodeAt(r++)<<24;else for(n=0;16>n;++n)i[n]=t[r++]|t[r++]<<8|t[r++]<<16|t[r++]<<24;t=e.g[0],r=e.g[1],n=e.g[2];var s=e.g[3],a=t+(s^r&(n^s))+i[0]+0xd76aa478|0;a=s+(n^(t=r+(a<<7|a>>>25))&(r^n))+i[1]+0xe8c7b756|0,a=n+(r^(s=t+(a<<12|a>>>20))&(t^r))+i[2]+0x242070db|0,a=r+(t^(n=s+(a<<17|a>>>15))&(s^t))+i[3]+0xc1bdceee|0,a=t+(s^(r=n+(a<<22|a>>>10))&(n^s))+i[4]+0xf57c0faf|0,a=s+(n^(t=r+(a<<7|a>>>25))&(r^n))+i[5]+0x4787c62a|0,a=n+(r^(s=t+(a<<12|a>>>20))&(t^r))+i[6]+0xa8304613|0,a=r+(t^(n=s+(a<<17|a>>>
1515))&(s^t))+i[7]+0xfd469501|0,a=t+(s^(r=n+(a<<22|a>>>10))&(n^s))+i[8]+0x698098d8|0,a=s+(n^(t=r+(a<<7|a>>>25))&(r^n))+i[9]+0x8b44f7af|0,a=n+(r^(s=t+(a<<12|a>>>20))&(t^r))+i[10]+0xffff5bb1|0,a=r+(t^(n=s+(a<<17|a>>>15))&(s^t))+i[11]+0x895cd7be|0,a=t+(s^(r=n+(a<<22|a>>>10))&(n^s))+i[12]+0x6b901122|0,a=s+(n^(t=r+(a<<7|a>>>25))&(r^n))+i[13]+0xfd987193|0,a=n+(r^(s=t+(a<<12|a>>>20))&(t^r))+i[14]+0xa679438e|0,a=r+(t^(n=s+(a<<17|a>>>15))&(s^t))+i[15]+0x49b40821|0,r=n+(a<<22|a>>>10),a=t+(n^s&(r^n))+i[1]+0xf61e2562|0,t=r+(a<<5|a>>>27),a=s+(r^n&(t^r))+i[6]+0xc040b340|0,s=t+(a<<9|a>>>23),a=n+(t^r&(s^t))+i[11]+0x265e5a51|0,n=s+(a<<14|a>>>18),a=r+(s^t&(n^s))+i[0]+0xe9b6c7aa|0,r=n+(a<<20|a>>>12),a=t+(n^s&(r^n))+i[5]+0xd62f105d|0,t=r+(a<<5|a>>>27),a=s+(r^n&(t^r))+i[10]+0x2441453|0,s=t+(a<<9|a>>>23),a=n+(t^r&(s^t))+i[15]+0xd8a1e681|0,n=s+(a<<14|a>>>18),a=r+(s^t&(n^s))+i[4]+0xe7d3fbc8|0,r=n+(a<<20|a>>>12),a=t+(n^s&(r^n))+i[9]+0x21e1cde6|0,t=r+(a<<5|a>>>27),a=s+(r^n&(t^r))+i[14]+0xc33707d6|0,s=t+(a<<9|a>>>23),a=n+(t^r&(s^t))+i[3]+0xf4d50d87|0,n=s+(a<<14|a>>>18),a=r+(s^t&(n^s))+i[8]+0x455a14ed|0,r=n+(a<<20|a>>>12),a=t+(n^s&(r^n))+i[13]+0xa9e3e905|0,t=r+(a<<5|a>>>27),a=s+(r^n&(t^r))+i[2]+0xfcefa3f8|0,s=t+(a<<9|a>>>23),a=n+(t^r&(s^t))+i[7]+0x676f02d9|0,n=s+(a<<14|a>>>18),a=r+(s^t&(n^s))+i[12]+0x8d2a4c8a|0,a=t+((r=n+(a<<20|a>>>12))^n^s)+i[5]+0xfffa3942|0,a=s+((t=r+(a<<4|a>>>28))^r^n)+i[8]+0x8771f681|0,a=n+((s=t+(a<<11|a>>>21))^t^r)+i[11]+0x6d9d6122|0,a=r+((n=s+(a<<16|a>>>16))^s^t)+i[14]+0xfde5380c|0,a=t+((r=n+(a<<23|a>>>9))^n^s)+i[1]+0xa4beea44|0,a=s+((t=r+(a<<4|a>>>28))^r^n)+i[4]+0x4bdecfa9|0,a=n+((s=t+(a<<11|a>>>21))^t^r)+i[7]+0xf6bb4b60|0,a=r+((n=s+(a<<16|a>>>16))^s^t)+i[10]+0xbebfbc70|0,a=t+((r=n+(a<<23|a>>>9))^n^s)+i[13]+0x289b7ec6|0,a=s+((t=r+(a<<4|a>>>28))^r^n)+i[0]+0xeaa127fa|0,a=n+((s=t+(a<<11|a>>>21))^t^r)+i[3]+0xd4ef3085|0,a=r+((n=s+(a<<16|a>>>16))^s^t)+i[6]+0x4881d05|0,a=t+((r=n+(a<<23|a>>>9))^n^s)+i[9]+0xd9d4d039|0,a=s+((t=r+(a<<4|a>>>28))^r^n)+i[12]+0xe6db99e5|0,a=n+((s=t+(a<<11|a>>>21))^t^r)+i[15]+0x1fa27cf8|0,a=r+((n=s+(a<<16|a>>>16))^s^t)+i[2]+0xc4ac5665|0,r=n+(a<<23|a>>>9),a=t+(n^(r|~s))+i[0]+0xf4292244|0,t=r+(a<<6|a>>>26),a=s+(r^(t|~n))+i[7]+0x432aff97|0,s=t+(a<<10|a>>>22),a=n+(t^(s|~r))+i[14]+0xab9423a7|0,n=s+(a<<15|a>>>17),a=r+(s^(n|~t))+i[5]+0xfc93a039|0,r=n+(a<<21|a>>>11),a=t+(n^(r|~s))+i[12]+0x655b59c3|0,t=r+(a<<6|a>>>26),a=s+(r^(t|~n))+i[3]+0x8f0ccc92|0,s=t+(a<<10|a>>>22),a=n+(t^(s|~r))+i[10]+0xffeff47d|0,n=s+(a<<15|a>>>17),a=r+(s^(n|~t))+i[1]+0x85845dd1|0,r=n+(a<<21|a>>>11),a=t+(n^(r|~s))+i[8]+0x6fa87e4f|0,t=r+(a<<6|a>>>26),a=s+(r^(t|~n))+i[15]+0xfe2ce6e0|0,s=t+(a<<10|a>>>22),a=n+(t^(s|~r))+i[6]+0xa3014314|0,n=s+(a<<15|a>>>17),a=r+(s^(n|~t))+i[13]+0x4e0811a1|0,r=n+(a<<21|a>>>11),a=t+(n^(r|~s))+i[4]+0xf7537e82|0,t=r+(a<<6|a>>>26),a=s+(r^(t|~n))+i[11]+0xbd3af235|0,s=t+(a<<10|a>>>22),a=n+(t^(s|~r))+i[2]+0x2ad7d2bb|0,n=s+(a<<15|a>>>17),a=r+(s^(n|~t))+i[9]+0xeb86d391|0,e.g[0]=e.g[0]+t|0,e.g[1]=e.g[1]+(n+(a<<21|a>>>11))|0,e.g[2]=e.g[2]+n|0,e.g[3]=e.g[3]+s|0}function n(e,t){this.h=t;for(var r=[],i=!0,n=e.length-1;0<=n;n--){var s=0|e[n];i&&s==t||(r[n]=s,i=!1)}this.g=r}r.prototype=t.prototype,e.D=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.C=function(e,r,i){for(var n=Array(arguments.length-2),s=2;s<arguments.length;s++)n[s-2]=arguments[s];return t.prototype[r].apply(e,n)},e.prototype.s=function(){this.g[0]=0x67452301,this.g[1]=0xefcdab89,this.g[2]=0x98badcfe,this.g[3]=0x10325476,this.o=this.h=0},e.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var r=t-this.blockSize,n=this.B,s=this.h,a=0;a<t;){if(0==s)for(;a<=r;)i(this,e,a),a+=this.blockSize;if("string"==typeof e){for(;a<t;)if(n[s++]=e.charCodeAt(a++),s==this.blockSize){i(this,n),s=0;break}}else for(;a<t;)if(n[s++]=e[a++],s==this.blockSize){i(this,n),s=0;break}}this.h=s,this.o+=t},e.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var r=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&r,r/=256;for(this.u(e),e=Array(16),t=r=0;4>t;++t)for(var i=0;32>i;i+=8)e[r++]=this.g[t]>>>i&255;return e};var s,a={};function o(e){var t;return -128<=e&&128>e?(t=function(e){return new n([0|e],0>e?-1:0)},Object.prototype.hasOwnProperty.call(a,e)?a[e]:a[e]=t(e)):new n([0|e],0>e?-1:0)}function l(e){if(isNaN(e)||!isFinite(e))return c;if(0>e)return m(l(-e));for(var t=[],r=1,i=0;e>=r;i++)t[i]=e/r|0,r*=0x100000000;return new n(t,0)}var c=o(0),d=o(1),f=o(0x1000000);function p(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function g(e){return -1==e.h}function m(e){for(var t=e.g.length,r=[],i=0;i<t;i++)r[i]=~e.g[i];return new n(r,~e.h).add(d)}function y(e,t){return e.add(m(t))}function v(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function w(e,t){this.g=e,this.h=t}function _(e,t){if(p(t))throw Error("division by zero");if(p(e))return new w(c,c);if(g(e))return t=_(m(e),t),new w(m(t.g),m(t.h));if(g(t))return t=_(e,m(t)),new w(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=d,i=t;0>=i.l(e);)r=E(r),i=E(i);var n=b(r,1),s=b(i,1);for(i=b(i,2),r=b(r,2);!p(i);){var a=s.add(i);0>=a.l(e)&&(n=n.add(r),s=a),i=b(i,1),r=b(r,1)}return t=y(e,n.j(t)),new w(n,t)}for(n=c;0<=e.l(t);){for(i=48>=(i=Math.ceil(Math.log(r=Math.max(1,Math.floor(e.m()/t.m())))/Math.LN2))?1:Math.pow(2,i-48),a=(s=l(r)).j(t);g(a)||0<a.l(e);)r-=i,a=(s=l(r)).j(t);p(s)&&(s=d),n=n.add(s),e=y(e,a)}return new w(n,e)}function E(e){for(var t=e.g.length+1,r=[],i=0;i<t;i++)r[i]=e.i(i)<<1|e.i(i-1)>>>31;return new n(r,e.h)}function b(e,t){var r=t>>5;t%=32;for(var i=e.g.length-r,s=[],a=0;a<i;a++)s[a]=0<t?e.i(a+r)>>>t|e.i(a+r+1)<<32-t:e.i(a+r);return new n(s,e.h)}(s=n.prototype).m=function(){if(g(this))return-m(this).m();for(var e=0,t=1,r=0;r<this.g.length;r++){var i=this.i(r);e+=(0<=i?i:0x100000000+i)*t,t*=0x100000000}return e},s.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(p(this))return"0";if(g(this))return"-"+m(this).toString(e);for(var t=l(Math.pow(e,6)),r=this,i="";;){var n=_(r,t).g,s=((0<(r=y(r,n.j(t))).g.length?r.g[0]:r.h)>>>0).toString(e);if(p(r=n))return s+i;for(;6>s.length;)s="0"+s;i=s+i}},s.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},s.l=function(e){return g(e=y(this,e))?-1:+!p(e)},s.abs=function(){return g(this)?m(this):this},s.add=function(e){for(var t=Math.max(this.g.length,e.g.length),r=[],i=0,s=0;s<=t;s++){var a=i+(65535&this.i(s))+(65535&e.i(s)),o=(a>>>16)+(this.i(s)>>>16)+(e.i(s)>>>16);i=o>>>16,a&=65535,o&=65535,r[s]=o<<16|a}return new n(r,-0x80000000&r[r.length-1]?-1:0)},s.j=function(e){if(p(this)||p(e))return c;if(g(this))return g(e)?m(this).j(m(e)):m(m(this).j(e));if(g(e))return m(this.j(m(e)));if(0>this.l(f)&&0>e.l(f))return l(this.m()*e.m());for(var t=this.g.length+e.g.length,r=[],i=0;i<2*t;i++)r[i]=0;for(i=0;i<this.g.length;i++)for(var s=0;s<e.g.length;s++){var a=this.i(i)>>>16,o=65535&this.i(i),h=e.i(s)>>>16,u=65535&e.i(s);r[2*i+2*s]+=o*u,v(r,2*i+2*s),r[2*i+2*s+1]+=a*u,v(r,2*i+2*s+1),r[2*i+2*s+1]+=o*h,v(r,2*i+2*s+1),r[2*i+2*s+2]+=a*h,v(r,2*i+2*s+2)}for(i=0;i<t;i++)r[i]=r[2*i+1]<<16|r[2*i];for(i=t;i<2*t;i++)r[i]=0;return new n(r,0)},s.A=function(e){return _(this,e).h},s.and=function(e){for(var t=Math.max(this.g.length,e.g.length),r=[],i=0;i<t;i++)r[i]=this.i(i)&e.i(i);return new n(r,this.h&e.h)},s.or=function(e){for(var t=Math.max(this.g.length,e.g.length),r=[],i=0;i<t;i++)r[i]=this.i(i)|e.i(i);return new n(r,this.h|e.h)},s.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),r=[],i=0;i<t;i++)r[i]=this.i(i)^e.i(i);return new n(r,this.h^e.h)},e.prototype.digest=e.prototype.v,e.prototype.reset=e.prototype.s,e.prototype.update=e.prototype.u,u=iV.Md5=e,n.prototype.add=n.prototype.add,n.prototype.multiply=n.prototype.j,n.prototype.modulo=n.prototype.A,n.prototype.compare=n.prototype.l,n.prototype.toNumber=n.prototype.m,n.prototype.toString=n.prototype.toString,n.prototype.getBits=n.prototype.i,n.fromNumber=l,n.fromString=function e(t,r){if(0==t.length)throw Error("number format error: empty string");if(2>(r=r||10)||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');for(var i=l(Math.pow(r,8)),n=c,s=0;s<t.length;s+=8){var a=Math.min(8,t.length-s),o=parseInt(t.substring(s,s+a),r);8>a?(a=l(Math.pow(r,a)),n=n.j(a).add(l(o))):n=(n=n.j(i)).add(l(o))}return n},h=iV.Integer=n}).apply(void 0!==iM?iM:"u">typeof self?self:"u">typeof window?window:{});var iU="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{},iF={};(function(){var e,t,r,i="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){return e==Array.prototype||e==Object.prototype||(e[t]=r.value),e},n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof iU&&iU];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(e,t){if(t)e:{var r=n;e=e.split(".");for(var s=0;s<e.length-1;s++){var a=e[s];if(!(a in r))break e;r=r[a]}(t=t(s=r[e=e[e.length-1]]))!=s&&null!=t&&i(r,e,{configurable:!0,writable:!0,value:t})}}("Array.prototype.values",function(e){return e||function(){var e,t,r,i,n;return e=this,t=function(e,t){return t},e instanceof String&&(e+=""),r=0,i=!1,(n={next:function(){if(!i&&r<e.length){var n=r++;return{value:t(n,e[n]),done:!1}}return i=!0,{done:!0,value:void 0}}})[Symbol.iterator]=function(){return n},n}});var s=s||{},a=this||self;function o(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function l(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function h(e,t,r){return e.call.apply(e.bind,arguments)}function u(e,t,r){if(!e)throw Error();if(2<arguments.length){var i=Array.prototype.slice.call(arguments,2);return function(){var r=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(r,i),e.apply(t,r)}}return function(){return e.apply(t,arguments)}}function w(e,t,r){return(w=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?h:u).apply(null,arguments)}
15function _(e,t){var r=Array.prototype.slice.call(arguments,1);return function(){var t=r.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function E(e,t){function r(){}r.prototype=t.prototype,e.aa=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.Qb=function(e,r,i){for(var n=Array(arguments.length-2),s=2;s<arguments.length;s++)n[s-2]=arguments[s];return t.prototype[r].apply(e,n)}}function b(e){let t=e.length;if(0<t){let r=Array(t);for(let i=0;i<t;i++)r[i]=e[i];return r}return[]}function I(e,t){for(let t=1;t<arguments.length;t++){let r=arguments[t];if(o(r)){let t=e.length||0,i=r.length||0;e.length=t+i;for(let n=0;n<i;n++)e[t+n]=r[n]}else e.push(r)}}function T(e){return/^[\s\xa0]*$/.test(e)}function C(){var e=a.navigator;return e&&(e=e.userAgent)?e:""}function S(e){return S[" "](e),e}S[" "]=function(){};var A=-1!=C().indexOf("Gecko")&&(-1==C().toLowerCase().indexOf("webkit")||-1!=C().indexOf("Edge"))&&-1==C().indexOf("Trident")&&-1==C().indexOf("MSIE")&&-1==C().indexOf("Edge");function k(e,t,r){for(let i in e)t.call(r,e[i],i,e)}function R(e){let t={};for(let r in e)t[r]=e[r];return t}let N="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function O(e,t){let r,i;for(let t=1;t<arguments.length;t++){for(r in i=arguments[t])e[r]=i[r];for(let t=0;t<N.length;t++)r=N[t],Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}}var D=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 P,e=>e.reset());class P{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 x,L=!1,M=new class{constructor(){this.h=this.g=null}add(e,t){let r=D.get();r.set(e,t),this.h?this.h.next=r:this.g=r,this.h=r}},V=()=>{let e=a.Promise.resolve(void 0);x=()=>{e.then(U)}};var U=()=>{let e;for(var t;e=null,M.g&&(e=M.g,M.g=M.g.next,M.g||(M.h=null),e.next=null),t=e;){try{t.h.call(t.g)}catch(e){!function(e){a.setTimeout(()=>{throw e},0)}(e)}D.j(t),100>D.h&&(D.h++,t.next=D.g,D.g=t)}L=!1};function F(){this.s=this.s,this.C=this.C}function j(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}F.prototype.s=!1,F.prototype.ma=function(){this.s||(this.s=!0,this.N())},F.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},j.prototype.h=function(){this.defaultPrevented=!0};var B=function(){if(!a.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{let e=()=>{};a.addEventListener("test",e,t),a.removeEventListener("test",e,t)}catch(e){}return e}();function q(e,t){if(j.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){var r=this.type=e.type,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(A){e:{try{S(t.nodeName);var n=!0;break e}catch(e){}n=!1}n||(t=null)}}else"mouseover"==r?t=e.fromElement:"mouseout"==r&&(t=e.toElement);this.relatedTarget=t,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.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="string"==typeof e.pointerType?e.pointerType:$[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&q.aa.h.call(this)}}E(q,j);var $={2:"touch",3:"pen",4:"mouse"};q.prototype.h=function(){q.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var z="closure_listenable_"+(1e6*Math.random()|0),H=0;function K(e,t,r,i,n){this.listener=e,this.proxy=null,this.src=t,this.type=r,this.capture=!!i,this.ha=n,this.key=++H,this.da=this.fa=!1}function G(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function W(e){this.src=e,this.g={},this.h=0}function Q(e,t){var r=t.type;if(r in e.g){var i,n=e.g[r],s=Array.prototype.indexOf.call(n,t,void 0);(i=0<=s)&&Array.prototype.splice.call(n,s,1),i&&(G(t),0==e.g[r].length&&(delete e.g[r],e.h--))}}function X(e,t,r,i){for(var n=0;n<e.length;++n){var s=e[n];if(!s.da&&s.listener==t&&!!r==s.capture&&s.ha==i)return n}return -1}W.prototype.add=function(e,t,r,i,n){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var a=X(e,t,i,n);return -1<a?(t=e[a],r||(t.fa=!1)):((t=new K(t,this.src,s,!!i,n)).fa=r,e.push(t)),t};var Y="closure_lm_"+(1e6*Math.random()|0),J={};function Z(e,t,r,i,n,s){if(!t)throw Error("Invalid event type");var a=l(n)?!!n.capture:!!n,o=ei(e);if(o||(e[Y]=o=new W(e)),(r=o.add(t,r,i,a,s)).proxy)return r;if(i=function e(t){return er.call(e.src,e.listener,t)},r.proxy=i,i.src=e,i.listener=r,e.addEventListener)B||(n=a),void 0===n&&(n=!1),e.addEventListener(t.toString(),i,n);else if(e.attachEvent)e.attachEvent(et(t.toString()),i);else if(e.addListener&&e.removeListener)e.addListener(i);else throw Error("addEventListener and attachEvent are unavailable.");return r}function ee(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[z])Q(t.i,e);else{var r=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(r,i,e.capture):t.detachEvent?t.detachEvent(et(r),i):t.addListener&&t.removeListener&&t.removeListener(i),(r=ei(t))?(Q(r,e),0==r.h&&(r.src=null,t[Y]=null)):G(e)}}}function et(e){return e in J?J[e]:J[e]="on"+e}function er(e,t){if(e.da)e=!0;else{t=new q(t,this);var r=e.listener,i=e.ha||e.src;e.fa&&ee(e),e=r.call(i,t)}return e}function ei(e){return(e=e[Y])instanceof W?e:null}var en="__closure_events_fn_"+(1e9*Math.random()>>>0);function es(e){return"function"==typeof e?e:(e[en]||(e[en]=function(t){return e.handleEvent(t)}),e[en])}function ea(){F.call(this),this.i=new W(this),this.M=this,this.F=null}function eo(e,t){var r,i=e.F;if(i)for(r=[];i;i=i.F)r.push(i);if(e=e.M,i=t.type||t,"string"==typeof t)t=new j(t,e);else if(t instanceof j)t.target=t.target||e;else{var n=t;O(t=new j(i,e),n)}if(n=!0,r)for(var s=r.length-1;0<=s;s--){var a=t.g=r[s];n=el(a,i,!0,t)&&n}if(n=el(a=t.g=e,i,!0,t)&&n,n=el(a,i,!1,t)&&n,r)for(s=0;s<r.length;s++)n=el(a=t.g=r[s],i,!1,t)&&n}
15function el(e,t,r,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var n=!0,s=0;s<t.length;++s){var a=t[s];if(a&&!a.da&&a.capture==r){var o=a.listener,l=a.ha||a.src;a.fa&&Q(e.i,a),n=!1!==o.call(l,i)&&n}}return n&&!i.defaultPrevented}function eh(e,t,r){if("function"==typeof e)r&&(e=w(e,r));else if(e&&"function"==typeof e.handleEvent)e=w(e.handleEvent,e);else throw Error("Invalid listener argument");return 0x7fffffff<Number(t)?-1:a.setTimeout(e,t||0)}E(ea,F),ea.prototype[z]=!0,ea.prototype.removeEventListener=function(e,t,r,i){!function e(t,r,i,n,s){if(Array.isArray(r))for(var a=0;a<r.length;a++)e(t,r[a],i,n,s);else(n=l(n)?!!n.capture:!!n,i=es(i),t&&t[z])?(t=t.i,(r=String(r).toString())in t.g&&-1<(i=X(a=t.g[r],i,n,s))&&(G(a[i]),Array.prototype.splice.call(a,i,1),0==a.length&&(delete t.g[r],t.h--))):t&&(t=ei(t))&&(r=t.g[r.toString()],t=-1,r&&(t=X(r,i,n,s)),(i=-1<t?r[t]:null)&&ee(i))}(this,e,t,r,i)},ea.prototype.N=function(){if(ea.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var r=t.g[e],i=0;i<r.length;i++)G(r[i]);delete t.g[e],t.h--}}this.F=null},ea.prototype.K=function(e,t,r,i){return this.i.add(String(e),t,!1,r,i)},ea.prototype.L=function(e,t,r,i){return this.i.add(String(e),t,!0,r,i)};class eu extends F{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:function e(t){t.g=eh(()=>{t.g=null,t.i&&(t.i=!1,e(t))},t.l);let r=t.h;t.h=null,t.m.apply(null,r)}(this)}N(){super.N(),this.g&&(a.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ec(e){F.call(this),this.h=e,this.g={}}E(ec,F);var ed=[];function ef(e){k(e.g,function(e,t){this.g.hasOwnProperty(t)&&ee(e)},e),e.g={}}ec.prototype.N=function(){ec.aa.N.call(this),ef(this)},ec.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ep=a.JSON.stringify,eg=a.JSON.parse,em=class{stringify(e){return a.JSON.stringify(e,void 0)}parse(e){return a.JSON.parse(e,void 0)}};function ey(){}function ev(e){return e.h||(e.h=e.i())}function ew(){}ey.prototype.h=null;var e_={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function eE(){j.call(this,"d")}function eb(){j.call(this,"c")}E(eE,j),E(eb,j);var eI={},eT=null;function eC(){return eT=eT||new ea}function eS(e){j.call(this,eI.La,e)}function eA(e){let t=eC();eo(t,new eS(t))}function ek(e,t){j.call(this,eI.STAT_EVENT,e),this.stat=t}function eR(e){let t=eC();eo(t,new ek(t,e))}function eN(e,t){j.call(this,eI.Ma,e),this.size=t}function eO(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return a.setTimeout(function(){e()},t)}function eD(){this.g=!0}function eP(e,t,r,i){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(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 i=r[e];if(!(2>i.length)){var n=i[1];if(Array.isArray(n)&&!(1>n.length)){var s=n[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var a=1;a<n.length;a++)n[a]=""}}}}return ep(r)}catch(e){return t}}(e,r)+(i?" "+i:"")})}eI.La="serverreachability",E(eS,j),eI.STAT_EVENT="statevent",E(ek,j),eI.Ma="timingevent",E(eN,j),eD.prototype.xa=function(){this.g=!1},eD.prototype.info=function(){};var ex={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},eL={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function eM(){}function eV(e,t,r,i){this.j=e,this.i=t,this.l=r,this.R=i||1,this.U=new ec(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new eU}function eU(){this.i=null,this.g="",this.h=!1}E(eM,ey),eM.prototype.g=function(){return new XMLHttpRequest},eM.prototype.i=function(){return{}},t=new eM;var eF={},ej={};function eB(e,t,r){e.L=1,e.v=tr(e8(t)),e.m=r,e.P=!0,eq(e,null)}function eq(e,t){e.F=Date.now(),ez(e),e.A=e8(e.v);var r,i,n,s,a,o,h=e.A,u=e.R;Array.isArray(u)||(u=[String(u)]),tg(h.i,"t",u),e.C=0,h=e.j.J,e.h=new eU,e.g=t1(e.j,h?t:null,!e.m),
150<e.O&&(e.M=new eu(w(e.Y,e,e.g),e.O)),t=e.U,h=e.g,u=e.ca;var c="readystatechange";Array.isArray(c)||(c&&(ed[0]=c.toString()),c=ed);for(var d=0;d<c.length;d++){var f=function e(t,r,i,n,s){if(n&&n.once)return function e(t,r,i,n,s){if(Array.isArray(r)){for(var a=0;a<r.length;a++)e(t,r[a],i,n,s);return null}return i=es(i),t&&t[z]?t.L(r,i,l(n)?!!n.capture:!!n,s):Z(t,r,i,!0,n,s)}(t,r,i,n,s);if(Array.isArray(r)){for(var a=0;a<r.length;a++)e(t,r[a],i,n,s);return null}return i=es(i),t&&t[z]?t.K(r,i,l(n)?!!n.capture:!!n,s):Z(t,r,i,!1,n,s)}(h,c[d],u||t.handleEvent,!1,t.h||t);if(!f)break;t.g[f.key]=f}t=e.H?R(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),eA(),r=e.i,i=e.u,n=e.A,s=e.l,a=e.R,o=e.m,r.info(function(){if(r.g)if(o)for(var e="",t=o.split("&"),l=0;l<t.length;l++){var h=t[l].split("=");if(1<h.length){var u=h[0];h=h[1];var c=u.split("_");e=2<=c.length&&"type"==c[1]?e+(u+"=")+h+"&":e+(u+"=redacted&")}}else e=null;else e=o;return"XMLHTTP REQ ("+s+") [attempt "+a+"]: "+i+` 16`+n+` 17`+e})}function e$(e){return!!e.g&&"GET"==e.u&&2!=e.L&&e.j.Ca}function ez(e){e.S=Date.now()+e.I,eH(e,e.I)}function eH(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=eO(w(e.ba,e),t)}function eK(e){e.B&&(a.clearTimeout(e.B),e.B=null)}function eG(e){0==e.j.G||e.J||tX(e.j,e)}function eW(e){eK(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ef(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function eQ(e,t){try{var r=e.j;if(0!=r.G&&(r.g==e||e0(r.h,e))){if(!e.K&&e0(r.h,e)&&3==r.G){try{var i=r.Da.g.parse(t)}catch(e){i=null}if(Array.isArray(i)&&3==i.length){var n=i;if(0==n[0]){e:if(!r.u){if(r.g)if(r.g.F+3e3<e.F)tQ(r),tF(r);else break e;tK(r),eR(18)}}else r.za=n[1],0<r.za-r.T&&37500>n[2]&&r.F&&0==r.v&&!r.C&&(r.C=eO(w(r.Za,r),6e3));if(1>=eZ(r.h)&&r.ca){try{r.ca()}catch(e){}r.ca=void 0}}else tJ(r,11)}else if((e.K||r.g==e)&&tQ(r),!T(t))for(n=r.Da.g.parse(t),t=0;t<n.length;t++){let o=n[t];if(r.T=o[0],o=o[1],2==r.G)if("c"==o[0]){r.K=o[1],r.ia=o[2];let t=o[3];null!=t&&(r.la=t,r.j.info("VER="+r.la));let n=o[4];null!=n&&(r.Aa=n,r.j.info("SVER="+r.Aa));let l=o[5];null!=l&&"number"==typeof l&&0<l&&(r.L=i=1.5*l,r.j.info("backChannelRequestTimeoutMs_="+i)),i=r;let h=e.g;if(h){let e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=i.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(e1(s,s.h),s.h=null))}if(i.D){let e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.ya=e,tt(i.I,i.D,e))}}if(r.G=3,r.l&&r.l.ua(),r.ba&&(r.R=Date.now()-e.F,r.j.info("Handshake RTT: "+r.R+"ms")),(i=r).qa=t0(i,i.J?i.ia:null,i.W),e.K){e2(i.h,e);var a=i.L;a&&(e.I=a),e.B&&(eK(e),ez(e)),i.g=e}else tH(i);0<r.i.length&&tB(r)}else"stop"!=o[0]&&"close"!=o[0]||tJ(r,7);else 3==r.G&&("stop"==o[0]||"close"==o[0]?"stop"==o[0]?tJ(r,7):tU(r):"noop"!=o[0]&&r.l&&r.l.ta(o),r.v=0)}}eA(4)}catch(e){}}eV.prototype.ca=function(e){e=e.target;let t=this.M;t&&3==tx(e)?t.j():this.Y(e)},eV.prototype.Y=function(e){try{if(e==this.g)e:{let v=tx(this.g);var t=this.g.Ba();let w=this.g.Z();if(!(3>v)&&(3!=v||this.g&&(this.h.h||this.g.oa()||tL(this.g)))){this.J||4!=v||7==t||(8==t||0>=w?eA(3):eA(2)),eK(this);var r=this.g.Z();this.X=r;t:if(e$(this)){var i=tL(this.g);e="";var n=i.length,s=4==tx(this.g);if(!this.h.i){if("u"<typeof TextDecoder){eW(this),eG(this);var o="";break t}this.h.i=new a.TextDecoder}for(t=0;t<n;t++)this.h.h=!0,e+=this.h.i.decode(i[t],{stream:!(s&&t==n-1)});i.length=0,this.h.g+=e,this.C=0,o=this.h.g}else o=this.g.oa();if(this.o=200==r,l=this.i,h=this.u,u=this.A,c=this.l,d=this.R,f=r,l.info(function(){return"XMLHTTP RESP ("+c+") [ attempt "+d+"]: "+h+` 18`+u+` 19`+v+" "+f}),this.o){if(this.T&&!this.K){t:{if(this.g){var l,h,u,c,d,f,p,g=this.g;if((p=g.g?g.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!T(p)){var m=p;break t}}m=null}if(r=m)eP(this.i,this.l,r,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,eQ(this,r);else{this.o=!1,this.s=3,eR(12),eW(this),eG(this);break e}}if(this.P){let e;for(r=!0;!this.J&&this.C<o.length;)if((e=function(e,t){var r=e.C,i=t.indexOf(` 20`,r);return -1==i?ej:isNaN(r=Number(t.substring(r,i)))?eF:(i+=1)+r>t.length?ej:(t=t.slice(i,i+r),e.C=i+r,t)}(this,o))==ej){4==v&&(this.s=4,eR(14),r=!1),eP(this.i,this.l,null,"[Incomplete Response]");break}else if(e==eF){this.s=4,eR(15),eP(this.i,this.l,o,"[Invalid Chunk]"),r=!1;break}else eP(this.i,this.l,e,null),eQ(this,e);if(e$(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=v||0!=o.length||this.h.h||(this.s=1,eR(16),r=!1),this.o=this.o&&r,r){if(0<o.length&&!this.W){this.W=!0;var y=this.j;y.g==this&&y.ba&&!y.M&&(y.j.info("Great, no buffering proxy detected. Bytes received: "+o.length),tG(y),y.M=!0,eR(11))}}else eP(this.i,this.l,o,"[Invalid Chunked Response]"),eW(this),eG(this)}else eP(this.i,this.l,o,null),eQ(this,o);4==v&&eW(this),this.o&&!this.J&&(4==v?tX(this.j,this):(this.o=!1,ez(this)))}else(function(e){let t={};e=(e.g&&2<=tx(e)&&e.g.getAllResponseHeaders()||"").split(`\r 21`);for(let i=0;i<e.length;i++){if(T(e[i]))continue;var r=function(e){var t=1;e=e.split(":");let r=[];for(;0<t&&e.length;)r.push(e.shift()),t--;return e.length&&r.push(e.join(":")),r}(e[i]);let n=r[0];if("string"!=typeof(r=r[1]))continue;r=r.trim();let s=t[n]||[];t[n]=s,s.push(r)}var i=function(e){return e.join(", ")};for(let e in t)i.call(void 0,t[e],e,t)})(this.g),400==r&&0<o.indexOf("Unknown SID")?(this.s=3,eR(12)):(this.s=0,eR(13)),eW(this),eG(this)}}}catch(e){}finally{}},eV.prototype.cancel=function(){this.J=!0,eW(this)},eV.prototype.ba=function(){var e,t;this.B=null;let r=Date.now();0<=r-this.S?(e=this.i,t=this.A,e.info(function(){return"TIMEOUT: "+t}),2!=this.L&&(eA(),eR(17)),eW(this),this.s=2,eG(this)):eH(this,this.S-r)};var eX=class{constructor(e,t){this.g=e,this.map=t}};function eY(e){this.l=e||10,e=a.PerformanceNavigationTiming?0<(e=a.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):!!(a.chrome&&a.chrome.loadTimes&&a.chrome.loadTimes()&&a.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 eJ(e){return!!e.h||!!e.g&&e.g.size>=e.j}function eZ(e){return e.h?1:e.g?e.g.size:0}function e0(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function e1(e,t){e.g?e.g.add(t):e.h=t}function e2(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function e6(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(let r of e.g.values())t=t.concat(r.D);return t}return b(e.i)}function e3(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(o(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var r=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("u">typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("u">typeof Set&&e instanceof Set)){if(o(e)||"string"==typeof e){var t=[];e=e.length;for(var r=0;r<e;r++)t.push(r);return t}for(let i in t=[],r=0,e)t[r++]=i;return t}}}(e),i=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("u">typeof Map&&e instanceof Map||"u">typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");
21if(o(e)){for(var t=[],r=e.length,i=0;i<r;i++)t.push(e[i]);return t}for(i in t=[],r=0,e)t[r++]=e[i];return t}(e),n=i.length,s=0;s<n;s++)t.call(void 0,i[s],r&&r[s],e)}eY.prototype.cancel=function(){if(this.i=e6(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(let e of this.g.values())e.cancel();this.g.clear()}};var e4=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function e5(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof e5){this.h=e.h,e7(this,e.j),this.o=e.o,this.g=e.g,e9(this,e.s),this.l=e.l;var t=e.i,r=new tc;r.i=t.i,t.g&&(r.g=new Map(t.g),r.h=t.h),te(this,r),this.m=e.m}else e&&(t=String(e).match(e4))?(this.h=!1,e7(this,t[1]||"",!0),this.o=ti(t[2]||""),this.g=ti(t[3]||"",!0),e9(this,t[4]),this.l=ti(t[5]||"",!0),te(this,t[6]||"",!0),this.m=ti(t[7]||"")):(this.h=!1,this.i=new tc(null,this.h))}function e8(e){return new e5(e)}function e7(e,t,r){e.j=r?ti(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function e9(e,t){if(t){if(isNaN(t=Number(t))||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function te(e,t,r){var i,n;t instanceof tc?(e.i=t,i=e.i,(n=e.h)&&!i.j&&(td(i),i.i=null,i.g.forEach(function(e,t){var r=t.toLowerCase();t!=r&&(tf(this,t),tg(this,r,e))},i)),i.j=n):(r||(t=tn(t,th)),e.i=new tc(t,e.h))}function tt(e,t,r){e.i.set(t,r)}function tr(e){return tt(e,"zx",Math.floor(0x80000000*Math.random()).toString(36)+Math.abs(Math.floor(0x80000000*Math.random())^Date.now()).toString(36)),e}function ti(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function tn(e,t,r){return"string"==typeof e?(e=encodeURI(e).replace(t,ts),r&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ts(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}e5.prototype.toString=function(){var e=[],t=this.j;t&&e.push(tn(t,ta,!0),":");var r=this.g;return(r||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(tn(t,ta,!0),"@"),e.push(encodeURIComponent(String(r)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(r=this.s)&&e.push(":",String(r))),(r=this.l)&&(this.g&&"/"!=r.charAt(0)&&e.push("/"),e.push(tn(r,"/"==r.charAt(0)?tl:to,!0))),(r=this.i.toString())&&e.push("?",r),(r=this.m)&&e.push("#",tn(r,tu)),e.join("")};var ta=/[#\/\?@]/g,to=/[#\?:]/g,tl=/[#\?]/g,th=/[#\?@]/g,tu=/#/g;function tc(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function td(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var r=0;r<e.length;r++){var i=e[r].indexOf("="),n=null;if(0<=i){var s=e[r].substring(0,i);n=e[r].substring(i+1)}else s=e[r];t(s,n?decodeURIComponent(n.replace(/\+/g," ")):"")}}}(e.i,function(t,r){e.add(decodeURIComponent(t.replace(/\+/g," ")),r)}))}function tf(e,t){td(e),t=tm(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function tp(e,t){return td(e),t=tm(e,t),e.g.has(t)}function tg(e,t,r){tf(e,t),0<r.length&&(e.i=null,e.g.set(tm(e,t),b(r)),e.h+=r.length)}function tm(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function ty(e,t,r,i,n){try{n&&(n.onload=null,n.onerror=null,n.onabort=null,n.ontimeout=null),i(r)}catch(e){}}function tv(){this.g=new em}function tw(e){this.l=e.Ub||null,this.j=e.eb||!1}function t_(e,t){ea.call(this),this.D=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.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function tE(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function tb(e){e.readyState=4,e.l=null,e.j=null,e.v=null,tI(e)}function tI(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function tT(e){let t="";return k(e,function(e,r){t+=r,t+=":",t+=e,t+=`\r 22`}),t}function tC(e,t,r){e:{for(i in r){var i=!1;break e}i=!0}i||(r=tT(r),"string"==typeof e?null!=r&&encodeURIComponent(String(r)):tt(e,t,r))}function tS(e){ea.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(r=tc.prototype).add=function(e,t){td(this),this.i=null,e=tm(this,e);var r=this.g.get(e);return r||this.g.set(e,r=[]),r.push(t),this.h+=1,this},r.forEach=function(e,t){td(this),this.g.forEach(function(r,i){r.forEach(function(r){e.call(t,r,i,this)},this)},this)},r.na=function(){td(this);let e=Array.from(this.g.values()),t=Array.from(this.g.keys()),r=[];for(let i=0;i<t.length;i++){let n=e[i];for(let e=0;e<n.length;e++)r.push(t[i])}return r},r.V=function(e){td(this);let t=[];if("string"==typeof e)tp(this,e)&&(t=t.concat(this.g.get(tm(this,e))));else{e=Array.from(this.g.values());for(let r=0;r<e.length;r++)t=t.concat(e[r])}return t},r.set=function(e,t){return td(this),this.i=null,tp(this,e=tm(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},r.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},r.toString=function(){if(this.i)return this.i;if(!this.g)return"";let e=[],t=Array.from(this.g.keys());for(var r=0;r<t.length;r++){var i=t[r];let s=encodeURIComponent(String(i)),a=this.V(i);for(i=0;i<a.length;i++){var n=s;""!==a[i]&&(n+="="+encodeURIComponent(String(a[i]))),e.push(n)}}return this.i=e.join("&")},E(tw,ey),tw.prototype.g=function(){return new t_(this.l,this.j)},tw.prototype.i=(e={},function(){return e}),E(t_,ea),(r=t_.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,tI(this)},r.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;let t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};
22e&&(t.body=e),(this.D||a).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},r.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,tb(this)),this.readyState=0},r.Sa=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,tI(this)),this.g&&(this.readyState=3,tI(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==a.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.v=new TextDecoder;tE(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},r.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?tb(this):tI(this),3==this.readyState&&tE(this)}},r.Ra=function(e){this.g&&(this.response=this.responseText=e,tb(this))},r.Qa=function(e){this.g&&(this.response=e,tb(this))},r.ga=function(){this.g&&tb(this)},r.setRequestHeader=function(e,t){this.u.append(e,t)},r.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},r.getAllResponseHeaders=function(){if(!this.h)return"";let e=[],t=this.h.entries();for(var r=t.next();!r.done;)e.push((r=r.value)[0]+": "+r[1]),r=t.next();return e.join(`\r 23`)},Object.defineProperty(t_.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),E(tS,ea);var tA=/^https?$/i,tk=["POST","PUT"];function tR(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,tN(e),tD(e)}function tN(e){e.A||(e.A=!0,eo(e,"complete"),eo(e,"error"))}function tO(e){if(e.h&&void 0!==s&&(!e.v[1]||4!=tx(e)||2!=e.Z())){if(e.u&&4==tx(e))eh(e.Ea,0,e);else if(eo(e,"readystatechange"),4==tx(e)){e.h=!1;try{let s=e.Z();switch(s){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t,r,i=!0;break;default:i=!1}if(!(t=i)){if(r=0===s){var n=String(e.D).match(e4)[1]||null;!n&&a.self&&a.self.location&&(n=a.self.location.protocol.slice(0,-1)),r=!tA.test(n?n.toLowerCase():"")}t=r}if(t)eo(e,"complete"),eo(e,"success");else{e.m=6;try{var o=2<tx(e)?e.g.statusText:""}catch(e){o=""}e.l=o+" ["+e.Z()+"]",tN(e)}}finally{tD(e)}}}}function tD(e,t){if(e.g){tP(e);let r=e.g,i=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||eo(e,"ready");try{r.onreadystatechange=i}catch(e){}}}function tP(e){e.I&&(a.clearTimeout(e.I),e.I=null)}function tx(e){return e.g?e.g.readyState:0}function tL(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){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 tM(e,t,r){return r&&r.internalChannelParams&&r.internalChannelParams[e]||t}function tV(e){this.Aa=0,this.i=[],this.j=new eD,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=tM("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=tM("baseRetryDelayMs",5e3,e),this.cb=tM("retryDelaySeedMs",1e4,e),this.Wa=tM("forwardChannelMaxRetries",2,e),this.wa=tM("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new eY(e&&e.concurrentRequestLimit),this.Da=new tv,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function tU(e){if(tj(e),3==e.G){var t=e.U++,r=e8(e.I);if(tt(r,"SID",e.K),tt(r,"RID",t),tt(r,"TYPE","terminate"),t$(e,r),(t=new eV(e,e.j,t)).L=2,t.v=tr(e8(r)),r=!1,a.navigator&&a.navigator.sendBeacon)try{r=a.navigator.sendBeacon(t.v.toString(),"")}catch(e){}
23!r&&a.Image&&((new Image).src=t.v,r=!0),r||(t.g=t1(t.j,null),t.g.ea(t.v)),t.F=Date.now(),ez(t)}tZ(e)}function tF(e){e.g&&(tG(e),e.g.cancel(),e.g=null)}function tj(e){tF(e),e.u&&(a.clearTimeout(e.u),e.u=null),tQ(e),e.h.cancel(),e.s&&("number"==typeof e.s&&a.clearTimeout(e.s),e.s=null)}function tB(e){if(!eJ(e.h)&&!e.s){e.s=!0;var t=e.Ga;x||V(),L||(x(),L=!0),M.add(t,e),e.B=0}}function tq(e,t){var r;r=t?t.l:e.U++;let i=e8(e.I);tt(i,"SID",e.K),tt(i,"RID",r),tt(i,"AID",e.T),t$(e,i),e.m&&e.o&&tC(i,e.m,e.o),r=new eV(e,e.j,r,e.B+1),null===e.m&&(r.H=e.o),t&&(e.i=t.D.concat(e.i)),t=tz(e,r,1e3),r.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),e1(e.h,r),eB(r,i,t)}function t$(e,t){e.H&&k(e.H,function(e,r){tt(t,r,e)}),e.l&&e3({},function(e,r){tt(t,r,e)})}function tz(e,t,r){r=Math.min(e.i.length,r);var i=e.l?w(e.l.Na,e.l,e):null;e:{var n=e.i;let t=-1;for(;;){let e=["count="+r];-1==t?0<r?(t=n[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let s=!0;for(let a=0;a<r;a++){let r=n[a].g,o=n[a].map;if(0>(r-=t))t=Math.max(0,n[a].g-100),s=!1;else try{!function(e,t,r){let i=r||"";try{e3(e,function(e,r){let n=e;l(e)&&(n=ep(e)),t.push(i+r+"="+encodeURIComponent(n))})}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}(o,e,"req"+r+"_")}catch(e){i&&i(o)}}if(s){i=e.join("&");break e}}}return t.D=e=e.i.splice(0,r),i}function tH(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;x||V(),L||(x(),L=!0),M.add(t,e),e.v=0}}function tK(e){return!e.g&&!e.u&&!(3<=e.v)&&(e.Y++,e.u=eO(w(e.Fa,e),tY(e,e.v)),e.v++,!0)}function tG(e){null!=e.A&&(a.clearTimeout(e.A),e.A=null)}function tW(e){e.g=new eV(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=e8(e.qa);tt(t,"RID","rpc"),tt(t,"SID",e.K),tt(t,"AID",e.T),tt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&tt(t,"TO",e.ja),tt(t,"TYPE","xmlhttp"),t$(e,t),e.m&&e.o&&tC(t,e.m,e.o),e.L&&(e.g.I=e.L);var r=e.g;e=e.ia,r.L=1,r.v=tr(e8(t)),r.m=null,r.P=!0,eq(r,e)}function tQ(e){null!=e.C&&(a.clearTimeout(e.C),e.C=null)}function tX(e,t){var r,i=null;if(e.g==t){tQ(e),tG(e),e.g=null;var n=2}else{if(!e0(e.h,t))return;i=t.D,e2(e.h,t),n=1}if(0!=e.G){if(t.o)if(1==n){i=t.m?t.m.length:0,t=Date.now()-t.F;var s=e.B;eo(n=eC(),new eN(n,i)),tB(e)}else tH(e);else if(3==(s=t.s)||0==s&&0<t.X||!(1==n&&(r=t,!(eZ(e.h)>=e.h.j-!!e.s)&&(e.s?(e.i=r.D.concat(e.i),!0):1!=e.G&&2!=e.G&&!(e.B>=(e.Va?0:e.Wa))&&(e.s=eO(w(e.Ga,e,r),tY(e,e.B)),e.B++,!0)))||2==n&&tK(e)))switch(i&&0<i.length&&((t=e.h).i=t.i.concat(i)),s){case 1:tJ(e,5);break;case 4:tJ(e,10);break;case 3:tJ(e,6);break;default:tJ(e,2)}}}function tY(e,t){let r=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(r*=2),r*t}function tJ(e,t){if(e.j.info("Error code "+t),2==t){let t,s,o;var r,i=w(e.fb,e),n=e.Xa;let l=!n;n=new e5(n||"//www.google.com/images/cleardot.gif"),a.location&&"http"==a.location.protocol||e7(n,"https"),tr(n),l?function(e,t){let r=new eD;if(a.Image){let i=new Image;i.onload=_(ty,r,"TestLoadImage: loaded",!0,t,i),i.onerror=_(ty,r,"TestLoadImage: error",!1,t,i),i.onabort=_(ty,r,"TestLoadImage: abort",!1,t,i),i.ontimeout=_(ty,r,"TestLoadImage: timeout",!1,t,i),a.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=e}else t(!1)}(n.toString(),i):(r=n.toString(),t=new eD,s=new AbortController,o=setTimeout(()=>{s.abort(),ty(t,"TestPingServer: timeout",!1,i)},1e4),fetch(r,{signal:s.signal}).then(e=>{clearTimeout(o),e.ok?ty(t,"TestPingServer: ok",!0,i):ty(t,"TestPingServer: server error",!1,i)}).catch(()=>{clearTimeout(o),ty(t,"TestPingServer: error",!1,i)}))}else eR(2);e.G=0,e.l&&e.l.sa(t),tZ(e),tj(e)}function tZ(e){if(e.G=0,e.ka=[],e.l){let t=e6(e.h);(0!=t.length||0!=e.i.length)&&(I(e.ka,t),I(e.ka,e.i),e.h.i.length=0,b(e.i),e.i.length=0),e.l.ra()}}function t0(e,t,r){var i=r instanceof e5?e8(r):new e5(r);if(""!=i.g)t&&(i.g=t+"."+i.g),e9(i,i.s);else{var n=a.location;i=n.protocol,t=t?t+"."+n.hostname:n.hostname,n=+n.port;var s=new e5(null);i&&e7(s,i),t&&(s.g=t),n&&e9(s,n),r&&(s.l=r),i=s}return r=e.D,t=e.ya,r&&t&&tt(i,r,t),tt(i,"VER",e.la),t$(e,i),i}function t1(e,t,r){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new tS(e.Ca&&!e.pa?new tw({eb:r}):e.pa)).Ha(e.J),t}function t2(){}function t6(){}function t3(e,t){ea.call(this),this.g=new tV(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.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!T(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!T(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&t in(e=this.h)&&delete e[t]),this.j=new t8(this)}function t4(e){eE.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(let 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 t5(){eb.call(this),this.status=1}function t8(e){this.g=e}(r=tS.prototype).Ha=function(e){this.J=e},r.ea=function(e,r,i,n){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);r=r?r.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():t.g(),this.v=this.o?ev(this.o):ev(t),this.g.onreadystatechange=w(this.Ea,this);try{this.B=!0,this.g.open(r,String(e),!0),this.B=!1}catch(e){tR(this,e);return}if(e=i||"",i=new Map(this.headers),n)if(Object.getPrototypeOf(n)===Object.prototype)for(var s in n)i.set(s,n[s]);else if("function"==typeof n.keys&&"function"==typeof n.get)for(let e of n.keys())i.set(e,n.get(e));else throw Error("Unknown input type for opt_headers: "+String(n));for(let[t,o]of(n=Array.from(i.keys()).find(e=>"content-type"==e.toLowerCase()),s=a.FormData&&e instanceof a.FormData,!(0<=Array.prototype.indexOf.call(tk,r,void 0))||n||s||i.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),i))this.g.setRequestHeader(t,o);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{tP(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){tR(this,e)}},r.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,eo(this,"complete"),eo(this,"abort"),tD(this))},r.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),tD(this,!0)),tS.aa.N.call(this)},r.Ea=function(){this.s||(this.B||this.u||this.j?tO(this):this.bb())},r.bb=function(){tO(this)},r.isActive=function(){return!!this.g},r.Z=function(){try{return 2<tx(this)?this.g.status:-1}catch(e){return -1}},r.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},r.Oa=function(e){if(this.g){var t=this.g.responseText;
23return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),eg(t)}},r.Ba=function(){return this.m},r.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(r=tV.prototype).la=8,r.G=1,r.connect=function(e,t,r,i){eR(0),this.W=e,this.H=t||{},r&&void 0!==i&&(this.H.OSID=r,this.H.OAID=i),this.F=this.X,this.I=t0(this,null,this.W),tB(this)},r.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;let n=new eV(this,this.j,e),s=this.o;if(this.S&&(s?O(s=R(s),this.S):s=this.S),null!==this.m||this.O||(n.H=s,s=null),this.P)e:{for(var t=0,r=0;r<this.i.length;r++){t:{var i=this.i[r];if("__data__"in i.map&&"string"==typeof(i=i.map.__data__)){i=i.length;break t}i=void 0}if(void 0===i)break;if(4096<(t+=i)){t=r;break e}if(4096===t||r===this.i.length-1){t=r+1;break e}}t=1e3}else t=1e3;t=tz(this,n,t),tt(r=e8(this.I),"RID",e),tt(r,"CVER",22),this.D&&tt(r,"X-HTTP-Session-Id",this.D),t$(this,r),s&&(this.O?t="headers="+encodeURIComponent(String(tT(s)))+"&"+t:this.m&&tC(r,this.m,s)),e1(this.h,n),this.Ua&&tt(r,"TYPE","init"),this.P?(tt(r,"$req",t),tt(r,"SID","null"),n.T=!0,eB(n,r,null)):eB(n,r,t),this.G=2}}else 3==this.G&&(e?tq(this,e):0==this.i.length||eJ(this.h)||tq(this))},r.Fa=function(){if(this.u=null,tW(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=eO(w(this.ab,this),e)}},r.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,eR(10),tF(this),tW(this))},r.Za=function(){null!=this.C&&(this.C=null,tF(this),tK(this),eR(19))},r.fb=function(e){e?(this.j.info("Successfully pinged google.com"),eR(2)):(this.j.info("Failed to ping google.com"),eR(1))},r.isActive=function(){return!!this.l&&this.l.isActive(this)},(r=t2.prototype).ua=function(){},r.ta=function(){},r.sa=function(){},r.ra=function(){},r.isActive=function(){return!0},r.Na=function(){},t6.prototype.g=function(e,t){return new t3(e,t)},E(t3,ea),t3.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},t3.prototype.close=function(){tU(this.g)},t3.prototype.o=function(e){var t=this.g;if("string"==typeof e){var r={};r.__data__=e,e=r}else this.u&&((r={}).__data__=ep(e),e=r);t.i.push(new eX(t.Ya++,e)),3==t.G&&tB(t)},t3.prototype.N=function(){this.g.l=null,delete this.j,tU(this.g),delete this.g,t3.aa.N.call(this)},E(t4,eE),E(t5,eb),E(t8,t2),t8.prototype.ua=function(){eo(this.g,"a")},t8.prototype.ta=function(e){eo(this.g,new t4(e))},t8.prototype.sa=function(e){eo(this.g,new t5)},t8.prototype.ra=function(){eo(this.g,"b")},t6.prototype.createWebChannel=t6.prototype.g,t3.prototype.send=t3.prototype.o,t3.prototype.open=t3.prototype.m,t3.prototype.close=t3.prototype.close,v=iF.createWebChannelTransport=function(){return new t6},y=iF.getStatEventTarget=function(){return eC()},m=iF.Event=eI,g=iF.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},ex.NO_ERROR=0,ex.TIMEOUT=8,ex.HTTP_ERROR=6,p=iF.ErrorCode=ex,eL.COMPLETE="complete",f=iF.EventType=eL,ew.EventType=e_,e_.OPEN="a",e_.CLOSE="b",e_.ERROR="c",e_.MESSAGE="d",ea.prototype.listen=ea.prototype.K,d=iF.WebChannel=ew,iF.FetchXmlHttpFactory=tw,tS.prototype.listenOnce=tS.prototype.L,tS.prototype.getLastError=tS.prototype.Ka,tS.prototype.getLastErrorCode=tS.prototype.Ba,tS.prototype.getStatus=tS.prototype.Z,tS.prototype.getResponseJson=tS.prototype.Oa,tS.prototype.getResponseText=tS.prototype.oa,tS.prototype.send=tS.prototype.ea,tS.prototype.setWithCredentials=tS.prototype.Ha,c=iF.XhrIo=tS}).apply(void 0!==iU?iU:"u">typeof self?self:"u">typeof window?window:{});var ij=r(48764).lW;let iB="@firebase/firestore",iq="4.7.17";class i${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}}i$.UNAUTHENTICATED=new i$(null),i$.GOOGLE_CREDENTIALS=new i$("google-credentials-uid"),i$.FIRST_PARTY=new i$("first-party-uid"),i$.MOCK_USER=new i$("mock-user");let iz="11.9.0",iH=new eu("@firebase/firestore");function iK(){return iH.logLevel}function iG(e,...t){if(iH.logLevel<=l.DEBUG){let r=t.map(iX);iH.debug(`Firestore (${iz}): ${e}`,...r)}}function iW(e,...t){if(iH.logLevel<=l.ERROR){let r=t.map(iX);iH.error(`Firestore (${iz}): ${e}`,...r)}}function iQ(e,...t){if(iH.logLevel<=l.WARN){let r=t.map(iX);iH.warn(`Firestore (${iz}): ${e}`,...r)}}function iX(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function iY(e,t,r){let i="Unexpected state";"string"==typeof t?i=t:r=t,iJ(e,i,r)}function iJ(e,t,r){let i=`FIRESTORE (${iz}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==r)try{i+=" CONTEXT: "+JSON.stringify(r)}catch(e){i+=" CONTEXT: "+r}throw iW(i),Error(i)}function iZ(e,t,r,i){let n="Unexpected state";"string"==typeof r?n=r:i=r,e||iJ(t,n,i)}let i0={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",UNIMPLEMENT
23ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class i1 extends z{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class i2{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class i6{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class i3{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(i$.UNAUTHENTICATED))}shutdown(){}}class i4{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 i5{constructor(e){this.t=e,this.currentUser=i$.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){iZ(void 0===this.o,42304);let r=this.i,i=e=>this.i!==r?(r=this.i,t(e)):Promise.resolve(),n=new i2;this.o=()=>{this.i++,this.currentUser=this.u(),n.resolve(),n=new i2,e.enqueueRetryable(()=>i(this.currentUser))};let s=()=>{let t=n;e.enqueueRetryable(async()=>{await t.promise,await i(this.currentUser)})},a=e=>{iG("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>a(e)),setTimeout(()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?a(e):(iG("FirebaseAuthCredentialsProvider","Auth not yet detected"),n.resolve(),n=new i2)}},0),s()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(iG("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(iZ("string"==typeof t.accessToken,31837,{l:t}),new i6(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let e=this.auth&&this.auth.getUid();return iZ(null===e||"string"==typeof e,2055,{h:e}),new i$(e)}}class i8{constructor(e,t,r){this.P=e,this.T=t,this.I=r,this.type="FirstParty",this.user=i$.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);let e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class i7{constructor(e,t,r){this.P=e,this.T=t,this.I=r}getToken(){return Promise.resolve(new i8(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(i$.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class i9{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class ne{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,eL(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){iZ(void 0===this.o,3512);let r=e=>{null!=e.error&&iG("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let r=e.token!==this.m;return this.m=e.token,iG("FirebaseAppCheckTokenProvider",`Received ${r?"new":"existing"} token.`),r?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>r(t))};let i=e=>{iG("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>i(e)),setTimeout(()=>{if(!this.appCheck){let e=this.V.getImmediate({optional:!0});e?i(e):iG("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new i9(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(iZ("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new i9(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}function nt(){return new TextEncoder}class nr{static newId(){let e=62*Math.floor(256/62),t="";for(;t.length<20;){let r=function(e){let t="u">
23typeof self&&(self.crypto||self.msCrypto),r=new Uint8Array(40);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(r);else for(let e=0;e<40;e++)r[e]=Math.floor(256*Math.random());return r}(0);for(let i=0;i<r.length;++i)t.length<20&&r[i]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(r[i]%62))}return t}}function ni(e,t){return e<t?-1:+(e>t)}function nn(e,t){let r=0;for(;r<e.length&&r<t.length;){let i=e.codePointAt(r),n=t.codePointAt(r);if(i!==n){if(i<128&&n<128)return ni(i,n);{let s=nt(),a=function(e,t){for(let r=0;r<e.length&&r<t.length;++r)if(e[r]!==t[r])return ni(e[r],t[r]);return ni(e.length,t.length)}(s.encode(ns(e,r)),s.encode(ns(t,r)));return 0!==a?a:ni(i,n)}}r+=i>65535?2:1}return ni(e.length,t.length)}function ns(e,t){return e.codePointAt(t)>65535?e.substring(t,t+2):e.substring(t,t+1)}function na(e,t,r){return e.length===t.length&&e.every((e,i)=>r(e,t[i]))}class no{static now(){return no.fromMillis(Date.now())}static fromDate(e){return no.fromMillis(e.getTime())}static fromMillis(e){let t=Math.floor(e/1e3),r=Math.floor((e-1e3*t)*1e6);return new no(t,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new i1(i0.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-0xe7791f700||e>=0x3afff44180)throw new i1(i0.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?ni(this.nanoseconds,e.nanoseconds):ni(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{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){return String(this.seconds- -0xe7791f700).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}class nl{static fromTimestamp(e){return new nl(e)}static min(){return new nl(new no(0,0))}static max(){return new nl(new no(0x3afff4417f,0x3b9ac9ff))}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 nh="__name__";class nu{constructor(e,t,r){void 0===t?t=0:t>e.length&&iY(637,{offset:t,range:e.length}),void 0===r?r=e.length-t:r>e.length-t&&iY(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===nu.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof nu?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+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(e,t){let r=Math.min(e.length,t.length);for(let i=0;i<r;i++){let r=nu.compareSegments(e.get(i),t.get(i));if(0!==r)return r}return ni(e.length,t.length)}static compareSegments(e,t){let r=nu.isNumericId(e),i=nu.isNumericId(t);return r&&!i?-1:!r&&i?1:r&&i?nu.extractNumericId(e).compare(nu.extractNumericId(t)):nn(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return h.fromString(e.substring(4,e.length-2))}}class nc extends nu{construct(e,t,r){return new nc(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}
23toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let t=[];for(let r of e){if(r.indexOf("//")>=0)throw new i1(i0.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(e=>e.length>0))}return new nc(t)}static emptyPath(){return new nc([])}}let nd=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class nf extends nu{construct(e,t,r){return new nf(e,t,r)}static isValidIdentifier(e){return nd.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),nf.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===nh}static keyField(){return new nf([nh])}static fromServerFormat(e){let t=[],r="",i=0,n=()=>{if(0===r.length)throw new i1(i0.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""},s=!1;for(;i<e.length;){let t=e[i];if("\\"===t){if(i+1===e.length)throw new i1(i0.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let t=e[i+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new i1(i0.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=t,i+=2}else"`"===t?s=!s:"."!==t||s?r+=t:n(),i++}if(n(),s)throw new i1(i0.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new nf(t)}static emptyPath(){return new nf([])}}class np{constructor(e){this.path=e}static fromPath(e){return new np(nc.fromString(e))}static fromName(e){return new np(nc.fromString(e).popFirst(5))}static empty(){return new np(nc.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&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===nc.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return nc.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new np(new nc(e.slice()))}}class ng{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new ng(nl.min(),np.empty(),-1)}static max(){return new ng(nl.max(),np.empty(),-1)}}class nm{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function ny(e){if(e.code!==i0.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;iG("LocalStore","Unexpectedly lost primary lease")}class nv{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(e,t){return this.callbackAttached&&iY(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new nv((r,i)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(r,i)},this.catchCallback=e=>{this.wrapFailure(t,e).next(r,i)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{let t=e();return t instanceof nv?t:nv.resolve(t)}catch(e){return nv.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):nv.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):nv.reject(t)}static resolve(e){return new nv((t,r)=>{t(e)})}static reject(e){return new nv((t,r)=>{r(e)})}static waitFor(e){return new nv((t,r)=>{let i=0,n=0,s=!1;e.forEach(e=>{++i,e.next(()=>{++n,s&&n===i&&t()},e=>r(e))}),s=!0,n===i&&t()})}static or(e){let t=nv.resolve(!1);for(let r of e)t=t.next(e=>e?nv.resolve(e):r());return t}static forEach(e,t){let r=[];return e.forEach((e,i)=>{r.push(t.call(this,e,i))}),this.waitFor(r)}static mapArray(e,t){return new nv((r,i)=>{let n=e.length,s=Array(n),a=0;for(let o=0;o<n;o++){let l=o;t(e[l]).next(e=>{s[l]=e,++a===n&&r(s)},e=>i(e))}})}static doWhile(e,t){return new nv((r,i)=>{let n=()=>{!0===e()?t().next(()=>{n()},i):r()};n()})}}function nw(e){return"IndexedDbTransactionError"===e.name}class n_{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ue(e),this.ce=e=>t.writeSequenceNumber(e))}ue(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ce&&this.ce(e),e}}n_.le=-1;function nE(e){return 0===e&&1/e==-1/0}function nb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function nI(e,t){for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(r,e[r])}function nT(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class nC{constructor(e,t){this.comparator=e,this.root=t||nA.EMPTY}insert(e,t){return new nC(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,nA.BLACK,null,
23null))}remove(e){return new nC(this.comparator,this.root.remove(e,this.comparator).copy(null,null,nA.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let r=this.comparator(e,t.key);if(0===r)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){let i=this.comparator(e,r.key);if(0===i)return t+r.left.size;i<0?r=r.left:(t+=r.left.size+1,r=r.right)}return -1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,r)=>(e(t,r),!1))}toString(){let e=[];return this.inorderTraversal((t,r)=>(e.push(`${t}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new nS(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new nS(this.root,e,this.comparator,!1)}getReverseIterator(){return new nS(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new nS(this.root,e,this.comparator,!0)}}
23class nS{constructor(e,t,r,i){this.isReverse=i,this.nodeStack=[];let n=1;for(;!e.isEmpty();)if(n=t?r(e.key,t):1,t&&i&&(n*=-1),n<0)e=this.isReverse?e.left:e.right;else{if(0===n){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),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 this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class nA{constructor(e,t,r,i,n){this.key=e,this.value=t,this.color=null!=r?r:nA.RED,this.left=null!=i?i:nA.EMPTY,this.right=null!=n?n:nA.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,i,n){return new nA(null!=e?e:this.key,null!=t?t:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=n?n: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){let i=this,n=r(e,i.key);return(i=n<0?i.copy(null,null,null,i.left.insert(e,t,r),null):0===n?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,r))).fixUp()}removeMin(){if(this.left.isEmpty())return nA.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),(e=e.copy(null,null,null,e.left.removeMin(),null)).fixUp()}remove(e,t){let r,i=this;if(0>t(e,i.key))i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===t(e,i.key)){if(i.right.isEmpty())return nA.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=(e=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}rotateLeft(){let e=this.copy(null,null,nA.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,nA.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let 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(){return Math.pow(2,this.check())<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw iY(43730,{key:this.key,value:this.value});if(this.right.isRed())throw iY(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw iY(27949);return e+ +!this.isRed()}}nA.EMPTY=null,nA.RED=!0,nA.BLACK=!1,nA.EMPTY=new class{constructor(){this.size=0}get key(){throw iY(57766)}get value(){throw iY(16141)}get color(){throw iY(16727)}get left(){throw iY(29726)}get right(){throw iY(36894)}copy(e,t,r,i,n){return this}insert(e,t,r){return new nA(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 nk{constructor(e){this.comparator=e,this.data=new nC(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(e){this.data.inorderTraversal((t,r)=>(e(t),!1))}forEachInRange(e,t){let r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){let i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.key)}}forEachWhile(e,t){let r;for(r=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new nR(this.data.getIterator())}getIteratorFrom(e){return new nR(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;
23return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof nk)||this.size!==e.size)return!1;let t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){let e=t.getNext().key,i=r.getNext().key;if(0!==this.comparator(e,i))return!1}return!0}toArray(){let e=[];return this.forEach(t=>{e.push(t)}),e}toString(){let e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){let t=new nk(this.comparator);return t.data=e,t}}class nR{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class nN{constructor(e){this.fields=e,e.sort(nf.comparator)}static empty(){return new nN([])}unionWith(e){let t=new nk(nf.comparator);for(let e of this.fields)t=t.add(e);for(let r of e)t=t.add(r);return new nN(t.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return na(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class nO extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class nD{constructor(e){this.binaryString=e}static fromBase64String(e){return new nD(function(e){try{return atob(e)}catch(e){throw"u">typeof DOMException&&e instanceof DOMException?new nO("Invalid base64 string: "+e):e}}(e))}static fromUint8Array(e){return new nD(function(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);return t}(e))}[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 btoa(this.binaryString)}toUint8Array(){var e=this.binaryString;let 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 ni(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}nD.EMPTY_BYTE_STRING=new nD("");let nP=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function nx(e){if(iZ(!!e,39018),"string"==typeof e){let t=0,r=nP.exec(e);if(iZ(!!r,46558,{timestamp:e}),r[1]){let e=r[1];t=Number(e=(e+"000000000").substr(0,9))}return{seconds:Math.floor(new Date(e).getTime()/1e3),nanos:t}}return{seconds:nL(e.seconds),nanos:nL(e.nanos)}}function nL(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function nM(e){return"string"==typeof e?nD.fromBase64String(e):nD.fromUint8Array(e)}let nV="server_timestamp",nU="__type__",nF="__previous_value__",nj="__local_write_time__";function nB(e){var t,r;return(null==(r=((null==(t=null==e?void 0:e.mapValue)?void 0:t.fields)||{})[nU])?void 0:r.stringValue)===nV}function nq(e){let t=e.mapValue.fields[nF];return nB(t)?nq(t):t}function n$(e){let t=nx(e.mapValue.fields[nj].timestampValue);return new no(t.seconds,t.nanos)}class nz{constructor(e,t,r,i,n,s,a,o,l,h){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=i,this.ssl=n,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=l,this.isUsingEmulator=h}}let nH="(default)";class nK{constructor(e,t){this.projectId=e,this.database=t||nH}static empty(){return new nK("","")}get isDefaultDatabase(){return this.database===nH}isEqual(e){return e instanceof nK&&e.projectId===this.projectId&&e.database===this.database}}let nG="__type__",nW="__max__",nQ={},nX="__vector__",nY="value";function nJ(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?nB(e)?4:si(e)?0x1fffffffffffff:st(e)?10:11:iY(28295,{value:e})}function nZ(e,t){if(e===t)return!0;let r=nJ(e);if(r!==nJ(t))return!1;switch(r){case 0:case 0x1fffffffffffff:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return n$(e).isEqual(n$(t));case 3:if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let i=nx(e.timestampValue),n=nx(t.timestampValue);return i.seconds===n.seconds&&i.nanos===n.nanos;case 5:return e.stringValue===t.stringValue;case 6:return nM(e.bytesValue).isEqual(nM(t.bytesValue));case 7:return e.referenceValue===t.referenceValue;case 8:return nL(e.geoPointValue.latitude)===nL(t.geoPointValue.latitude)&&nL(e.geoPointValue.longitude)===nL(t.geoPointValue.longitude);case 2:if("integerValue"in e&&"integerValue"in t)return nL(e.integerValue)===nL(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){let r=nL(e.doubleValue),i=nL(t.doubleValue);return r===i?nE(r)===nE(i):isNaN(r)&&isNaN(i)}return!1;case 9:return na(e.arrayValue.values||[],t.arrayValue.values||[],nZ);case 10:case 11:let s=e.mapValue.fields||{},a=t.mapValue.fields||{};if(nb(s)!==nb(a))return!1;for(let e in s)if(s.hasOwnProperty(e)&&(void 0===a[e]||!nZ(s[e],a[e])))return!1;return!0;default:return iY(52216,{left:e})}}function n0(e,t){return void 0!==(e.values||[]).find(e=>nZ(e,t))}function n1(e,t){var r,i,n,s,a,o,l,h,u,c;if(e===t)return 0;let d=nJ(e),f=nJ(t);if(d!==f)return ni(d,f);switch(d){case 0:case 0x1fffffffffffff:return 0;case 1:return ni(e.booleanValue,t.booleanValue);case 2:let p,g;return p=nL(e.integerValue||e.doubleValue),p<(g=nL(t.integerValue||t.doubleValue))?-1:p>g?1:p===g?0:isNaN(p)?isNaN(g)?0:-1:1;case 3:return n2(e.timestampValue,t.timestampValue);case 4:return n2(n$(e),n$(t));case 5:return nn(e.stringValue,t.stringValue);case 6:let m,y;return r=e.bytesValue,i=t.bytesValue,m=nM(r),y=nM(i),m.compareTo(y);case 7:return function(e,t){let r=e.split("/"),i=t.split("/");for(let e=0;e<r.length&&e<i.length;e++){let t=ni(r[e],i[e]);if(0!==t)return t}return ni(r.length,i.length)}(e.referenceValue,t.referenceValue);case 8:let v;return n=e.geoPointValue,s=t.geoPointValue,0!==(v=ni(nL(n.latitude),nL(s.latitude)))?v:ni(nL(n.longitude),nL(s.longitude));case 9:return n6(e.arrayValue,t.arrayValue);case 10:let w,_,E,b,I;return a=e.mapValue,o=t.mapValue,w=a.fields||{},_=o.fields||{},E=null==(l=w[nY])?void 0:l.arrayValue,b=null==(h=_[nY])?void 0:h.arrayValue,0!==(I=ni((null==(u=null==E?void 0:E.values)?void 0:u.length)||0,(null==(c=null==b?void 0:b.values)?void 0:c.length)||0))?I:n6(E,b);case 11:return function(e,t){if(e===nQ&&t===nQ)return 0;if(e===nQ)return 1;if(t===nQ)return -1;let r=e.fields||{},i=Object.keys(r),n=t.fields||{},s=Object.keys(n);i.sort(),s.sort();for(let e=0;e<i.length&&e<s.length;++e){let t=nn(i[e],s[e]);if(0!==t)return t;let a=n1(r[i[e]],n[s[e]]);if(0!==a)return a}return ni(i.length,s.length)}(e.mapValue,t.mapValue);default:throw iY(23264,{Pe:d})}}function n2(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return ni(e,t);let r=nx(e),i=nx(t),n=ni(r.seconds,i.seconds);return 0!==n?n:ni(r.nanos,i.nanos)}function n6(e,t){let r=e.values||[],i=t.values||[];for(let e=0;e<r.length&&e<i.length;++e){let t=n1(r[e],i[e]);if(t)return t}return ni(r.length,i.length)}function n3(e){var t,r;let i;return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?(i=nx(e.timestampValue),`time(${i.seconds},${i.nanos}
23)`):"stringValue"in e?e.stringValue:"bytesValue"in e?nM(e.bytesValue).toBase64():"referenceValue"in e?(t=e.referenceValue,np.fromName(t).toString()):"geoPointValue"in e?(r=e.geoPointValue,`geo(${r.latitude},${r.longitude})`):"arrayValue"in e?function(e){let t="[",r=!0;for(let i of e.values||[])r?r=!1:t+=",",t+=n3(i);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){let t=Object.keys(e.fields||{}).sort(),r="{",i=!0;for(let n of t)i?i=!1:r+=",",r+=`${n}:${n3(e.fields[n])}`;return r+"}"}(e.mapValue):iY(61005,{value:e})}function n4(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function n5(e){return!!e&&"integerValue"in e}function n8(e){return!!e&&"arrayValue"in e}function n7(e){return!!e&&"nullValue"in e}function n9(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function se(e){return!!e&&"mapValue"in e}function st(e){var t,r;return(null==(r=((null==(t=null==e?void 0:e.mapValue)?void 0:t.fields)||{})[nG])?void 0:r.stringValue)===nX}function sr(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){let t={mapValue:{fields:{}}};return nI(e.mapValue.fields,(e,r)=>t.mapValue.fields[e]=sr(r)),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let r=0;r<(e.arrayValue.values||[]).length;++r)t.arrayValue.values[r]=sr(e.arrayValue.values[r]);return t}return Object.assign({},e)}function si(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===nW}class sn{constructor(e){this.value=e}static empty(){return new sn({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let r=0;r<e.length-1;++r)if(!se(t=(t.mapValue.fields||{})[e.get(r)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=sr(t)}setAll(e){let t=nf.emptyPath(),r={},i=[];e.forEach((e,n)=>{if(!t.isImmediateParentOf(n)){let e=this.getFieldsMap(t);this.applyChanges(e,r,i),r={},i=[],t=n.popLast()}e?r[n.lastSegment()]=sr(e):i.push(n.lastSegment())});let n=this.getFieldsMap(t);this.applyChanges(n,r,i)}delete(e){let t=this.field(e.popLast());se(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return nZ(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let r=0;r<e.length;++r){let i=t.mapValue.fields[e.get(r)];se(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,r){for(let i of(nI(t,(t,r)=>e[t]=r),r))delete e[i]}clone(){return new sn(sr(this.value))}}class ss{constructor(e,t,r,i,n,s,a){this.key=e,this.documentType=t,this.version=r,this.readTime=i,this.createTime=n,this.data=s,this.documentState=a}static newInvalidDocument(e){return new ss(e,0,nl.min(),nl.min(),nl.min(),sn.empty(),0)}static newFoundDocument(e,t,r,i){return new ss(e,1,t,nl.min(),r,i,0)}static newNoDocument(e,t){return new ss(e,2,t,nl.min(),nl.min(),sn.empty(),0)}static newUnknownDocument(e,t){return new ss(e,3,t,nl.min(),nl.min(),sn.empty(),2)}convertToFoundDocument(e,t){return this.createTime.isEqual(nl.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=sn.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=sn.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=nl.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 ss&&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 ss(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}})`}}
23class sa{constructor(e,t){this.position=e,this.inclusive=t}}function so(e,t,r){let i=0;for(let n=0;n<e.position.length;n++){let s=t[n],a=e.position[n];if(i=s.field.isKeyField()?np.comparator(np.fromName(a.referenceValue),r.key):n1(a,r.data.field(s.field)),"desc"===s.dir&&(i*=-1),0!==i)break}return i}function sl(e,t){if(null===e)return null===t;if(null===t||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let r=0;r<e.position.length;r++)if(!nZ(e.position[r],t.position[r]))return!1;return!0}class sh{constructor(e,t="asc"){this.field=e,this.dir=t}}class su{}class sc extends su{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 sg(e,t,r):"array-contains"===t?new sw(e,r):"in"===t?new s_(e,r):"not-in"===t?new sE(e,r):"array-contains-any"===t?new sb(e,r):new sc(e,t,r)}static createKeyFieldInFilter(e,t,r){return"in"===t?new sm(e,r):new sy(e,r)}matches(e){let t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(n1(t,this.value)):null!==t&&nJ(this.value)===nJ(t)&&this.matchesComparison(n1(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 e>0;case">=":return e>=0;default:return iY(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class sd extends su{constructor(e,t){super(),this.filters=e,this.op=t,this.Te=null}static create(e,t){return new sd(e,t)}matches(e){return sf(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.Te||(this.Te=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.Te}getFilters(){return Object.assign([],this.filters)}}function sf(e){return"and"===e.op}function sp(e){for(let t of e.filters)if(t instanceof sd)return!1;return!0}class sg extends sc{constructor(e,t,r){super(e,t,r),this.key=np.fromName(r.referenceValue)}matches(e){let t=np.comparator(e.key,this.key);return this.matchesComparison(t)}}class sm extends sc{constructor(e,t){super(e,"in",t),this.keys=sv("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class sy extends sc{constructor(e,t){super(e,"not-in",t),this.keys=sv("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function sv(e,t){var r;return((null==(r=t.arrayValue)?void 0:r.values)||[]).map(e=>np.fromName(e.referenceValue))}class sw extends sc{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return n8(t)&&n0(t.arrayValue,this.value)}}class s_ extends sc{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return null!==t&&n0(this.value.arrayValue,t)}}class sE extends sc{constructor(e,t){super(e,"not-in",t)}matches(e){if(n0(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!n0(this.value.arrayValue,t)}}class sb extends sc{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!n8(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>n0(this.value.arrayValue,e))}}class sI{constructor(e,t=null,r=[],i=[],n=null,s=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=i,this.limit=n,this.startAt=s,this.endAt=a,this.Ie=null}}function sT(e,t=null,r=[],i=[],n=null,s=null,a=null){return new sI(e,t,r,i,n,s,a)}function sC(e){if(null===e.Ie){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(e=>(function e(t){if(t instanceof sc)return t.field.canonicalString()+t.op.toString()+n3(t.value);if(sp(t)&&sf(t))return t.filters.map(t=>e(t)).join(",");{let r=t.filters.map(t=>e(t)).join(",");return`${t.op}(${r})`}})(e)).join(","),t+="|ob:",t+=e.orderBy.map(e=>e.field.canonicalString()+e.dir).join(","),null==e.limit||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>n3(e)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>n3(e)).join(",")),e.Ie=t}return e.Ie}function sS(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++){var r,i;if(r=e.orderBy[n],i=t.orderBy[n],!(r.dir===i.dir&&r.field.isEqual(i.field)))return!1}if(e.filters.length!==t.filters.length)return!1;for(let r=0;r<e.filters.length;r++)if(!function e(t,r){return t instanceof sc?r instanceof sc&&t.op===r.op&&t.field.isEqual(r.field)&&nZ(t.value,r.value):t instanceof sd?r instanceof sd&&t.op===r.op&&t.filters.length===r.filters.length&&t.filters.reduce((t,i,n)=>
23t&&e(i,r.filters[n]),!0):void iY(19439)}(e.filters[r],t.filters[r]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!sl(e.startAt,t.startAt)&&sl(e.endAt,t.endAt)}function sA(e){return np.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}class sk{constructor(e,t=null,r=[],i=[],n=null,s="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=i,this.limit=n,this.limitType=s,this.startAt=a,this.endAt=o,this.Ee=null,this.de=null,this.Ae=null,this.startAt,this.endAt}}function sR(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 sN(e){return null!==e.collectionGroup}function sO(e){if(null===e.Ee){let t;e.Ee=[];let r=new Set;for(let t of e.explicitOrderBy)e.Ee.push(t),r.add(t.field.canonicalString());let i=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(t=new nk(nf.comparator),e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t).forEach(t=>{r.has(t.canonicalString())||t.isKeyField()||e.Ee.push(new sh(t,i))}),r.has(nf.keyField().canonicalString())||e.Ee.push(new sh(nf.keyField(),i))}return e.Ee}function sD(e){return e.de||(e.de=function(e,t){if("F"===e.limitType)return sT(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{let t="desc"===e.dir?"asc":"desc";return new sh(e.field,t)});let r=e.endAt?new sa(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new sa(e.startAt.position,e.startAt.inclusive):null;return sT(e.path,e.collectionGroup,t,e.filters,e.limit,r,i)}}(e,sO(e))),e.de}function sP(e,t){let r=e.filters.concat([t]);return new sk(e.path,e.collectionGroup,e.explicitOrderBy.slice(),r,e.limit,e.limitType,e.startAt,e.endAt)}function sx(e,t,r){return new sk(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,r,e.startAt,e.endAt)}function sL(e,t){return sS(sD(e),sD(t))&&e.limitType===t.limitType}function sM(e){return`${sC(sD(e))}|lt:${e.limitType}`}function sV(e){var t;let r;return`Query(target=${r=(t=sD(e)).path.canonicalString(),null!==t.collectionGroup&&(r+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(r+=`, filters: [${t.filters.map(e=>(function e(t){return t instanceof sc?`${t.field.canonicalString()} ${t.op} ${n3(t.value)}`:t instanceof sd?t.op.toString()+" {"+t.getFilters().map(e).join(" ,")+"}":"Filter"})(e)).join(", ")}]`),null==t.limit||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(e=>`${e.field.canonicalString()} (${e.dir})`).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(e=>n3(e)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(e=>n3(e)).join(",")),`Target(${r})`}; limitType=${e.limitType})`}function sU(e,t){var r,i,n,s;let a,o,l;return t.isFoundDocument()&&(a=t.key.path,null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(a):np.isDocumentKey(e.path)?e.path.isEqual(a):e.path.isImmediateParentOf(a))&&function(e,t){for(let r of sO(e))if(!r.field.isKeyField()&&null===t.data.field(r.field))return!1;return!0}(e,t)&&function(e,t){for(let r of e.filters)if(!r.matches(t))return!1;return!0}(e,t)&&(r=e,i=t,(!r.startAt||(n=r.startAt,o=so(n,sO(r),i),n.inclusive?!!(o<=0):!!(o<0)))&&(!r.endAt||(s=r.endAt,l=so(s,sO(r),i),s.inclusive?!!(l>=0):!!(l>0))))}function sF(e){return(t,r)=>{let i=!1;for(let n of sO(e)){let e=function(e,t,r){var i;let n,s,a=e.field.isKeyField()?np.comparator(t.key,r.key):(i=e.field,n=t.data.field(i),s=r.data.field(i),null!==n&&null!==s?n1(n,s):iY(42886));switch(e.dir){case"asc":return a;case"desc":return -1*a;default:return iY(19790,{direction:e.dir})}}(n,t,r);if(0!==e)return e;i=i||n.field.isKeyField()}return 0}}class sj{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),r=this.inner[t];if(void 0!==r){for(let[t,i]of r)if(this.equalsFn(t,e))return i}}has(e){return void 0!==this.get(e)}set(e,t){let r=this.mapKeyFn(e),i=this.inner[r];if(void 0===i)return this.inner[r]=[[e,t]],void this.innerSize++;for(let r=0;r<i.length;r++)if(this.equalsFn(i[r][0],e))return void(i[r]=[e,t]);i.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),r=this.inner[t];if(void 0===r)return!1;for(let i=0;i<r.length;i++)if(this.equalsFn(r[i][0],e))return 1===r.length?delete this.inner[t]:r.splice(i,1),this.innerSize--,!0;return!1}forEach(e){nI(this.inner,(t,r)=>{for(let[t,i]of r)e(t,i)})}isEmpty(){return nT(this.inner)}size(){return this.innerSize}}let sB=new nC(np.comparator),sq=new nC(np.comparator);function s$(...e){let t=sq;for(let r of e)t=t.insert(r.key,r);return t}function sz(){return new sj(e=>e.toString(),(e,t)=>e.isEqual(t))}
23new nC(np.comparator);let sH=new nk(np.comparator);function sK(...e){let t=sH;for(let r of e)t=t.add(r);return t}let sG=new nk(ni);function sW(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:nE(t)?"-0":t}}function sQ(e){return{integerValue:""+e}}class sX{constructor(){this._=void 0}}class sY extends sX{}class sJ extends sX{constructor(e){super(),this.elements=e}}function sZ(e,t){let r=s3(t);for(let t of e.elements)r.some(e=>nZ(e,t))||r.push(t);return{arrayValue:{values:r}}}class s0 extends sX{constructor(e){super(),this.elements=e}}function s1(e,t){let r=s3(t);for(let t of e.elements)r=r.filter(e=>!nZ(e,t));return{arrayValue:{values:r}}}class s2 extends sX{constructor(e,t){super(),this.serializer=e,this.Re=t}}function s6(e){return nL(e.integerValue||e.doubleValue)}function s3(e){return n8(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class s4{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new s4}static exists(e){return new s4(void 0,e)}static updateTime(e){return new s4(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 s5(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class s8{}function s7(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new aa(e.key,s4.none()):new at(e.key,e.data,s4.none());{let r=e.data,i=sn.empty(),n=new nk(nf.comparator);for(let e of t.fields)if(!n.has(e)){let t=r.field(e);null===t&&e.length>1&&(e=e.popLast(),t=r.field(e)),null===t?i.delete(e):i.set(e,t),n=n.add(e)}return new ar(e.key,i,new nN(n.toArray()),s4.none())}}function s9(e,t,r,i){return e instanceof at?function(e,t,r,i){if(!s5(e.precondition,t))return r;let n=e.value.clone(),s=as(e.fieldTransforms,i,t);return n.setAll(s),t.convertToFoundDocument(t.version,n).setHasLocalMutations(),null}(e,t,r,i):e instanceof ar?function(e,t,r,i){if(!s5(e.precondition,t))return r;let n=as(e.fieldTransforms,i,t),s=t.data;return(s.setAll(ai(e)),s.setAll(n),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===r)?null:r.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,r,i):s5(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):r}function ae(e,t){var r,i;return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(r=e.fieldTransforms,i=t.fieldTransforms,!!(void 0===r&&void 0===i||!(!r||!i)&&na(r,i,(e,t)=>{var r,i;return e.field.isEqual(t.field)&&(r=e.transform,i=t.transform,r instanceof sJ&&i instanceof sJ||r instanceof s0&&i instanceof s0?na(r.elements,i.elements,nZ):r instanceof s2&&i instanceof s2?nZ(r.Re,i.Re):r instanceof sY&&i instanceof sY)})))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class at extends s8{constructor(e,t,r,i=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class ar extends s8{constructor(e,t,r,i,n=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=i,this.fieldTransforms=n,this.type=1}getFieldMask(){return this.fieldMask}}function ai(e){let t=new Map;return e.fieldMask.fields.forEach(r=>{if(!r.isEmpty()){let i=e.data.field(r);t.set(r,i)}}),t}function an(e,t,r){let i=new Map;iZ(e.length===r.length,32656,{Ve:r.length,me:e.length});for(let s=0;s<r.length;s++){var n;let a=e[s],o=a.transform,l=t.data.field(a.field);i.set(a.field,(n=r[s],o instanceof sJ?sZ(o,l):o instanceof s0?s1(o,l):n))}return i}function as(e,t,r){let i=new Map;for(let n of e){let e=n.transform,s=r.data.field(n.field);i.set(n.field,function(e,t,r){var i;let n,s,a;return e instanceof sY?(i=t,n={fields:{[nU]:{stringValue:nV},[nj]:{timestampValue:{seconds:r.seconds,nanos:r.nanoseconds}}}},i&&nB(i)&&(i=nq(i)),i&&(n.fields[nF]=i),{mapValue:n}):e instanceof sJ?sZ(e,t):e instanceof s0?s1(e,t):(a=s6(s=function(e,t){return e instanceof s2?n5(t)||t&&"doubleValue"in t?t:{integerValue:0}:null}(e,t))+s6(e.Re),n5(s)&&n5(e.Re)?sQ(a):sW(e.serializer,a))}(e,s,t))}return i}class aa extends s8{constructor(e,t){super(),this.key=e,this.prec
23ondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class ao{constructor(e,t,r,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=i}applyToRemoteDocument(e,t){let r=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let i=this.mutations[t];i.key.isEqual(e.key)&&function(e,t,r){let i,n;e instanceof at?(i=e.value.clone(),n=an(e.fieldTransforms,t,r.transformResults),i.setAll(n),t.convertToFoundDocument(r.version,i).setHasCommittedMutations()):e instanceof ar?function(e,t,r){if(!s5(e.precondition,t))return t.convertToUnknownDocument(r.version);let i=an(e.fieldTransforms,t,r.transformResults),n=t.data;n.setAll(ai(e)),n.setAll(i),t.convertToFoundDocument(r.version,n).setHasCommittedMutations()}(e,t,r):t.convertToNoDocument(r.version).setHasCommittedMutations()}(i,e,r[t])}}applyToLocalView(e,t){for(let r of this.baseMutations)r.key.isEqual(e.key)&&(t=s9(r,e,t,this.localWriteTime));for(let r of this.mutations)r.key.isEqual(e.key)&&(t=s9(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let r=sz();return this.mutations.forEach(i=>{let n=e.get(i.key),s=n.overlayedDocument,a=this.applyToLocalView(s,n.mutatedFields),o=s7(s,a=t.has(i.key)?null:a);null!==o&&r.set(i.key,o),s.isValidDocument()||s.convertToNoDocument(nl.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),sK())}isEqual(e){return this.batchId===e.batchId&&na(this.mutations,e.mutations,(e,t)=>ae(e,t))&&na(this.baseMutations,e.baseMutations,(e,t)=>ae(e,t))}}class al{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{ 24 largestBatchId: ${this.largestBatchId}, 25 mutation: ${this.mutation.toString()} 26 }`}}class ah{constructor(e,t){this.count=e,this.unchangedNames=t}}function au(e){if(void 0===e)return iW("GRPC error has no .code"),i0.UNKNOWN;switch(e){case w.OK:return i0.OK;case w.CANCELLED:return i0.CANCELLED;case w.UNKNOWN:return i0.UNKNOWN;case w.DEADLINE_EXCEEDED:return i0.DEADLINE_EXCEEDED;case w.RESOURCE_EXHAUSTED:return i0.RESOURCE_EXHAUSTED;case w.INTERNAL:return i0.INTERNAL;case w.UNAVAILABLE:return i0.UNAVAILABLE;case w.UNAUTHENTICATED:return i0.UNAUTHENTICATED;case w.INVALID_ARGUMENT:return i0.INVALID_ARGUMENT;case w.NOT_FOUND:return i0.NOT_FOUND;case w.ALREADY_EXISTS:return i0.ALREADY_EXISTS;case w.PERMISSION_DENIED:return i0.PERMISSION_DENIED;case w.FAILED_PRECONDITION:return i0.FAILED_PRECONDITION;case w.ABORTED:return i0.ABORTED;case w.OUT_OF_RANGE:return i0.OUT_OF_RANGE;case w.UNIMPLEMENTED:return i0.UNIMPLEMENTED;case w.DATA_LOSS:return i0.DATA_LOSS;default:return iY(39323,{code:e})}}(_=w||(w={}))[_.OK=0]="OK",_[_.CANCELLED=1]="CANCELLED",_[_.UNKNOWN=2]="UNKNOWN",_[_.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",_[_.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",_[_.NOT_FOUND=5]="NOT_FOUND",_[_.ALREADY_EXISTS=6]="ALREADY_EXISTS",_[_.PERMISSION_DENIED=7]="PERMISSION_DENIED",_[_.UNAUTHENTICATED=16]="UNAUTHENTICATED",_[_.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",_[_.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",_[_.ABORTED=10]="ABORTED",_[_.OUT_OF_RANGE=11]="OUT_OF_RANGE",_[_.UNIMPLEMENTED=12]="UNIMPLEMENTED",_[_.INTERNAL=13]="INTERNAL",_[_.UNAVAILABLE=14]="UNAVAILABLE",_[_.DATA_LOSS=15]="DATA_LOSS";let ac=new h([0xffffffff,0xffffffff],0);function ad(e){let t=nt().encode(e),r=new u;return r.update(t),new Uint8Array(r.digest())}function af(e){let t=new DataView(e.buffer),r=t.getUint32(0,!0),i=t.getUint32(4,!0),n=t.getUint32(8,!0),s=t.getUint32(12,!0);return[new h([r,i],0),new h([n,s],0)]}class ap{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new ag(`Invalid padding: ${t}`);if(r<0||e.length>0&&0===this.hashCount)throw new ag(`Invalid hash count: ${r}`);if(0===e.length&&0!==t)throw new ag(`Invalid padding when bitmap length is 0: ${t}`);this.pe=8*e.length-t,this.ye=h.fromNumber(this.pe)}we(e,t,r){let i=e.add(t.multiply(h.fromNumber(r)));return 1===i.compare(ac)&&(i=new h([i.getBits(0),i.getBits(1)],0)),i.modulo(this.ye).toNumber()}be(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.pe)return!1;let[t,r]=af(ad(e));for(let e=0;e<this.hashCount;e++){let i=this.we(t,r,e);if(!this.be(i))return!1}return!0}static create(e,t,r){let i=new ap(new Uint8Array(Math.ceil(e/8)),e%8==0?0:8-e%8,t);
26return r.forEach(e=>i.insert(e)),i}insert(e){if(0===this.pe)return;let[t,r]=af(ad(e));for(let e=0;e<this.hashCount;e++){let i=this.we(t,r,e);this.Se(i)}}Se(e){let t=Math.floor(e/8);this.bitmap[t]|=1<<e%8}}class ag extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class am{constructor(e,t,r,i,n){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=i,this.resolvedLimboDocuments=n}static createSynthesizedRemoteEventForCurrentChange(e,t,r){let i=new Map;return i.set(e,ay.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new am(nl.min(),i,new nC(ni),sB,sK())}}class ay{constructor(e,t,r,i,n){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=i,this.removedDocuments=n}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new ay(r,t,sK(),sK(),sK())}}class av{constructor(e,t,r,i){this.De=e,this.removedTargetIds=t,this.key=r,this.ve=i}}class aw{constructor(e,t){this.targetId=e,this.Ce=t}}class a_{constructor(e,t,r=nD.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=i}}class aE{constructor(){this.Fe=0,this.Me=aT(),this.xe=nD.EMPTY_BYTE_STRING,this.Oe=!1,this.Ne=!0}get current(){return this.Oe}get resumeToken(){return this.xe}get Be(){return 0!==this.Fe}get Le(){return this.Ne}ke(e){e.approximateByteSize()>0&&(this.Ne=!0,this.xe=e)}qe(){let e=sK(),t=sK(),r=sK();return this.Me.forEach((i,n)=>{switch(n){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:r=r.add(i);break;default:iY(38017,{changeType:n})}}),new ay(this.xe,this.Oe,e,t,r)}Qe(){this.Ne=!1,this.Me=aT()}$e(e,t){this.Ne=!0,this.Me=this.Me.insert(e,t)}Ue(e){this.Ne=!0,this.Me=this.Me.remove(e)}Ke(){this.Fe+=1}We(){this.Fe-=1,iZ(this.Fe>=0,3241,{Fe:this.Fe})}Ge(){this.Ne=!0,this.Oe=!0}}class ab{constructor(e){this.ze=e,this.je=new Map,this.He=sB,this.Je=aI(),this.Ye=aI(),this.Ze=new nC(ni)}Xe(e){for(let t of e.De)e.ve&&e.ve.isFoundDocument()?this.et(t,e.ve):this.tt(t,e.key,e.ve);for(let t of e.removedTargetIds)this.tt(t,e.key,e.ve)}nt(e){this.forEachTarget(e,t=>{let r=this.rt(t);switch(e.state){case 0:this.it(t)&&r.ke(e.resumeToken);break;case 1:r.We(),r.Be||r.Qe(),r.ke(e.resumeToken);break;case 2:r.We(),r.Be||this.removeTarget(t);break;case 3:this.it(t)&&(r.Ge(),r.ke(e.resumeToken));break;case 4:this.it(t)&&(this.st(t),r.ke(e.resumeToken));break;default:iY(56790,{state:e.state})}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.je.forEach((e,r)=>{this.it(r)&&t(r)})}ot(e){let t=e.targetId,r=e.Ce.count,i=this._t(t);if(i){let n=i.target;if(sA(n))if(0===r){let e=new np(n.path);this.tt(t,e,ss.newNoDocument(e,nl.min()))}else iZ(1===r,20013,{expectedCount:r});else{let i=this.ut(t);if(i!==r){let r=this.ct(e),n=r?this.lt(r,e,i):1;0!==n&&(this.st(t),this.Ze=this.Ze.insert(t,2===n?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch"))}}}}ct(e){let t,r,i=e.Ce.unchangedNames;if(!i||!i.bits)return null;let{bits:{bitmap:n="",padding:s=0},hashCount:a=0}=i;try{t=nM(n).toUint8Array()}catch(e){if(e instanceof nO)return iQ("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{r=new ap(t,s,a)}catch(e){return iQ(e instanceof ag?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===r.pe?null:r}lt(e,t,r){return 2*(t.Ce.count!==r-this.Tt(e,t.targetId))}Tt(e,t){let r=this.ze.getRemoteKeysForTarget(t),i=0;return r.forEach(r=>{let n=this.ze.Pt(),s=`projects/${n.projectId}/databases/${n.database}/documents/${r.path.canonicalString()}`;e.mightContain(s)||(this.tt(t,r,null),i++)}),i}It(e){let t=new Map;this.je.forEach((r,i)=>{let n=this._t(i);if(n){if(r.current&&sA(n.target)){let t=new np(n.target.path);this.Et(t).has(i)||this.dt(i,t)||this.tt(i,t,ss.newNoDocument(t,e))}r.Le&&(t.set(i,r.qe()),r.Qe())}});let r=sK();this.Ye.forEach((e,t)=>{let i=!0;t.forEachWhile(e=>{let t=this._t(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)}),i&&(r=r.add(e))}),this.He.forEach((t,r)=>r.setReadTime(e));let i=new am(e,t,this.Ze,this.He,r);return this.He=sB,this.Je=aI(),this.Ye=aI(),this.Ze=new nC(ni),i}et(e,t){if(!this.it(e))return;
26let r=2*!!this.dt(e,t.key);this.rt(e).$e(t.key,r),this.He=this.He.insert(t.key,t),this.Je=this.Je.insert(t.key,this.Et(t.key).add(e)),this.Ye=this.Ye.insert(t.key,this.At(t.key).add(e))}tt(e,t,r){if(!this.it(e))return;let i=this.rt(e);this.dt(e,t)?i.$e(t,1):i.Ue(t),this.Ye=this.Ye.insert(t,this.At(t).delete(e)),this.Ye=this.Ye.insert(t,this.At(t).add(e)),r&&(this.He=this.He.insert(t,r))}removeTarget(e){this.je.delete(e)}ut(e){let t=this.rt(e).qe();return this.ze.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Ke(e){this.rt(e).Ke()}rt(e){let t=this.je.get(e);return t||(t=new aE,this.je.set(e,t)),t}At(e){let t=this.Ye.get(e);return t||(t=new nk(ni),this.Ye=this.Ye.insert(e,t)),t}Et(e){let t=this.Je.get(e);return t||(t=new nk(ni),this.Je=this.Je.insert(e,t)),t}it(e){let t=null!==this._t(e);return t||iG("WatchChangeAggregator","Detected inactive target",e),t}_t(e){let t=this.je.get(e);return t&&t.Be?null:this.ze.Rt(e)}st(e){this.je.set(e,new aE),this.ze.getRemoteKeysForTarget(e).forEach(t=>{this.tt(e,t,null)})}dt(e,t){return this.ze.getRemoteKeysForTarget(e).has(t)}}function aI(){return new nC(np.comparator)}function aT(){return new nC(np.comparator)}let aC={asc:"ASCENDING",desc:"DESCENDING"},aS={"<":"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"},aA={and:"AND",or:"OR"};class ak{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function aR(e,t){return e.useProto3Json||null==t?t:{value:t}}function aN(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 aO(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function aD(e){let t;return iZ(!!e,49232),nl.fromTimestamp(new no((t=nx(e)).seconds,t.nanos))}function aP(e,t){return ax(e,t).canonicalString()}function ax(e,t){let r=new nc(["projects",e.projectId,"databases",e.database]).child("documents");return void 0===t?r:r.child(t)}function aL(e){let t=nc.fromString(e);return iZ(aq(t),10190,{key:t.toString()}),t}function aM(e,t){let r=aL(t);if(r.get(1)!==e.databaseId.projectId)throw new i1(i0.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 i1(i0.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+r.get(3)+" vs "+e.databaseId.database);return new np(aF(r))}function aV(e,t){return aP(e.databaseId,t)}function aU(e){return new nc(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function aF(e){return iZ(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function aj(e){return{fieldPath:e.canonicalString()}}function aB(e){return nf.fromServerFormat(e.fieldPath)}function aq(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class a${constructor(e,t,r,i,n=nl.min(),s=nl.min(),a=nD.EMPTY_BYTE_STRING,o=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=n,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=a,this.expectedCount=o}withSequenceNumber(e){return new a$(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new a$(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new a$(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new a$(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class az{constructor(e){this.wt=e}}class aH{vt(e,t){this.Ct(e,t),t.Ft()}Ct(e,t){if("nullValue"in e)this.Mt(t,5);else if("booleanValue"in e)this.Mt(t,10),t.xt(+!!e.booleanValue);else if("integerValue"in e)this.Mt(t,15),t.xt(nL(e.integerValue));else if("doubleValue"in e){let r=nL(e.doubleValue);isNaN(r)?this.Mt(t,13):(this.Mt(t,15),nE(r)?t.xt(0):t.xt(r))}else if("timestampValue"in e){let r=e.timestampValue;this.Mt(t,20),"string"==typeof r&&(r=nx(r)),t.Ot(`${r.seconds||""}`),t.xt(r.nanos||0)}else if("stringValue"in e)this.Nt(e.stringValue,t),this.Bt(t);else if("bytesValue"in e)this.Mt(t,30),t.Lt(nM(e.bytesValue)),this.Bt(t);else if("referenceValue"in e)this.kt(e.referenceValue,t);else if("geoPointValue"in e){let r=e.geoPointValue;this.Mt(t,45),t.xt(r.latitude||0),t.xt(r.longitude||0)}else"mapValue"in e?si(e)?this.Mt(t,Number.MAX_SAFE_INTEGER):st(e)?this.qt(e.mapValue,t):(this.Qt(e.mapValue,t),this.Bt(t)):"arrayValue"in e?(this.$t(e.arrayValue,t),this.Bt(t)):iY(19022,{Ut:e})}Nt(e,t){this.Mt(t,25),this.Kt(e,t)}Kt(e,t){t.Ot(e)}Qt(e,t){let r=e.fields||{};for(let e of(this.Mt(t,55),Object.keys(r)))this.Nt(e,t),this.Ct(r[e],t)}qt(e,t){var r,i;let n=e.fields||{};this.Mt(t,53);let s=(null==(i=null==(r=n[nY].arrayValue)?void 0:r.values)?void 0:i.length)||0;this.Mt(t,15),t.xt(nL(s)),this.Nt(nY,t),this.Ct(n[nY],t)}$t(e,t){let r=e.values||[];for(let e of(this.Mt(t,50),r))this.Ct(e,t)}
vendor: 5,226 bytes, lines 26-31
26kt(e,t){this.Mt(t,37),np.fromName(e).path.forEach(e=>{this.Mt(t,60),this.Kt(e,t)})}Mt(e,t){e.xt(t)}Bt(e){e.xt(2)}}aH.Wt=new aH;class aK{constructor(){this.Cn=new aG}addToCollectionParentIndex(e,t){return this.Cn.add(t),nv.resolve()}getCollectionParents(e,t){return nv.resolve(this.Cn.getEntries(t))}addFieldIndex(e,t){return nv.resolve()}deleteFieldIndex(e,t){return nv.resolve()}deleteAllFieldIndexes(e){return nv.resolve()}createTargetIndexes(e,t){return nv.resolve()}getDocumentsMatchingTarget(e,t){return nv.resolve(null)}getIndexType(e,t){return nv.resolve(0)}getFieldIndexes(e,t){return nv.resolve([])}getNextCollectionGroupToUpdate(e){return nv.resolve(null)}getMinOffset(e,t){return nv.resolve(ng.min())}getMinOffsetFromCollectionGroup(e,t){return nv.resolve(ng.min())}updateCollectionGroup(e,t,r){return nv.resolve()}updateIndexEntries(e,t){return nv.resolve()}}class aG{constructor(){this.index={}}add(e){let t=e.lastSegment(),r=e.popLast(),i=this.index[t]||new nk(nc.comparator),n=!i.has(r);return this.index[t]=i.add(r),n}has(e){let t=e.lastSegment(),r=e.popLast(),i=this.index[t];return i&&i.has(r)}getEntries(e){return(this.index[e]||new nk(nc.comparator)).toArray()}}new Uint8Array(0);let aW={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0};class aQ{static withCacheSize(e){return new aQ(e,aQ.DEFAULT_COLLECTION_PERCENTILE,aQ.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=r}}aQ.DEFAULT_COLLECTION_PERCENTILE=10,aQ.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,aQ.DEFAULT=new aQ(0x2800000,aQ.DEFAULT_COLLECTION_PERCENTILE,aQ.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),aQ.DISABLED=new aQ(-1,0,0);class aX{constructor(e){this.ur=e}next(){return this.ur+=2,this.ur}static cr(){return new aX(0)}static lr(){return new aX(-1)}}let aY="LruGarbageCollector";function aJ([e,t],[r,i]){let n=ni(e,r);return 0===n?ni(t,i):n}class aZ{constructor(e){this.Er=e,this.buffer=new nk(aJ),this.dr=0}Ar(){return++this.dr}Rr(e){let t=[e,this.Ar()];if(this.buffer.size<this.Er)this.buffer=this.buffer.add(t);else{let e=this.buffer.last();0>aJ(t,e)&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class a0{constructor(e,t,r){this.garbageCollector=e,this.asyncQueue=t,this.localStore=r,this.Vr=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.mr(6e4)}stop(){this.Vr&&(this.Vr.cancel(),this.Vr=null)}get started(){return null!==this.Vr}mr(e){iG(aY,`Garbage collection scheduled in ${e}ms`),this.Vr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Vr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){nw(e)?iG(aY,"Ignoring IndexedDB error during garbage collection: ",e):await ny(e)}await this.mr(3e5)})}}class a1{constructor(e,t){this.gr=e,this.params=t}calculateTargetCount(e,t){return this.gr.pr(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return nv.resolve(n_.le);let r=new aZ(t);return this.gr.forEachTarget(e,e=>r.Rr(e.sequenceNumber)).next(()=>this.gr.yr(e,e=>r.Rr(e))).next(()=>r.maxValue)}removeTargets(e,t,r){return this.gr.removeTargets(e,t,r)}removeOrphanedDocuments(e,t){return this.gr.removeOrphanedDocuments(e,t)}collect(e,t){return -1===this.params.cacheSizeCollectionThreshold?(iG("LruGarbageCollector","Garbage collection skipped; disabled"),nv.resolve(aW)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(iG("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),aW):this.wr(e,t))}getCacheSize(e){return this.gr.getCacheSize(e)}wr(e,t){let r,i,n,s,a,o,h,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(t=>(t>this.params.maximumSequenceNumbersToCollect?(iG("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),i=this.params.maximumSequenceNumbersToCollect):i=t,s=Date.now(),this.nthSequenceNumber(e,i))).next(i=>(r=i,a=Date.now(),this.removeTargets(e,r,t))).next(t=>(n=t,o=Date.now(),this.removeOrphanedDocuments(e,r))).next(e=>(h=Date.now(),iK()<=l.DEBUG&&iG("LruGarbageCollector",`LRU Garbage Collection 27 Counted targets in ${s-u}ms 28 Determined least recently used ${i} in `+(a-s)+`ms 29`+` Removed ${n} targets in `+(o-a)+`ms 30`+` Removed ${e} documents in `+(h-o)+`ms 31`+`Total Duration: ${h-u}ms`),nv.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:n,documentsRemoved:e})))}}class a2{constructor(){this.changes=new sj(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,ss.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let r=this.changes.get(t);return void 0!==r?nv.resolve(r):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class a6{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}
31class a3{constructor(e,t,r,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==r&&s9(r.mutation,e,nN.empty(),no.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,sK()).next(()=>t))}getLocalViewOfDocuments(e,t,r=sK()){let i=sz();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,r).next(e=>{let t=s$();return e.forEach((e,r)=>{t=t.insert(e,r.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){let r=sz();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,sK()))}populateOverlays(e,t,r){let i=[];return r.forEach(e=>{t.has(e)||i.push(e)}),this.documentOverlayCache.getOverlays(e,i).next(e=>{e.forEach((e,r)=>{t.set(e,r)})})}computeViews(e,t,r,i){let n=sB,s=sz(),a=sz();return t.forEach((e,t)=>{let a=r.get(t.key);i.has(t.key)&&(void 0===a||a.mutation instanceof ar)?n=n.insert(t.key,t):void 0!==a?(s.set(t.key,a.mutation.getFieldMask()),s9(a.mutation,t,a.mutation.getFieldMask(),no.now())):s.set(t.key,nN.empty())}),this.recalculateAndSaveOverlays(e,n).next(e=>(e.forEach((e,t)=>s.set(e,t)),t.forEach((e,t)=>{var r;return a.set(e,new a6(t,null!=(r=s.get(e))?r:null))}),a))}recalculateAndSaveOverlays(e,t){let r=sz(),i=new nC((e,t)=>e-t),n=sK();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(let n of e)n.keys().forEach(e=>{let s=t.get(e);if(null===s)return;let a=r.get(e)||nN.empty();a=n.applyToLocalView(s,a),r.set(e,a);let o=(i.get(n.batchId)||sK()).add(e);i=i.insert(n.batchId,o)})}).next(()=>{let s=[],a=i.getReverseIterator();for(;a.hasNext();){let i=a.getNext(),o=i.key,l=i.value,h=sz();l.forEach(e=>{if(!n.has(e)){let i=s7(t.get(e),r.get(e));null!==i&&h.set(e,i),n=n.add(e)}}),s.push(this.documentOverlayCache.saveOverlays(e,o,h))}return nv.waitFor(s)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,r,i){return np.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length?this.getDocumentsMatchingDocumentQuery(e,t.path):sN(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,i):this.getDocumentsMatchingCollectionQuery(e,t,r,i)}getNextDocuments(e,t,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,i).next(n=>{let s=i-n.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,i-n.size):nv.resolve(sz()),a=-1,o=n;return s.next(t=>nv.forEach(t,(t,r)=>(a<r.largestBatchId&&(a=r.largestBatchId),n.get(t)?nv.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{o=o.insert(t,e)}))).next(()=>this.populateOverlays(e,t,n)).next(()=>this.computeViews(e,o,t,sK())).next(e=>{let t;return{batchId:a,changes:(t=sq,e.forEach((e,r)=>t=t.insert(e,r.overlayedDocument)),t)}}))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new np(t)).next(e=>{let t=s$();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,r,i){let n=t.collectionGroup,s=s$();return this.indexManager.getCollectionParents(e,n).next(a=>nv.forEach(a,a=>{let o=new sk(a.child(n),null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt);return this.getDocumentsMatchingCollectionQuery(e,o,r,i).next(e=>{e.forEach((e,t)=>{s=s.insert(e,t)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(e,t,r,i){let n;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(s=>(n=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,n,i))).next(e=>{n.forEach((t,r)=>{let i=r.getKey();null===e.get(i)&&(e=e.insert(i,ss.newInvalidDocument(i)))});let r=s$();return e.forEach((e,i)=>{let s=n.get(e);void 0!==s&&s9(s.mutation,i,nN.empty(),no.now()),sU(t,i)&&(r=r.insert(e,i))}),r})}}class a4{constructor(e){this.serializer=e,this.kr=new Map,this.qr=new Map}getBundleMetadata(e,t){return nv.resolve(this.kr.get(t))}
31saveBundleMetadata(e,t){return this.kr.set(t.id,{id:t.id,version:t.version,createTime:aD(t.createTime)}),nv.resolve()}getNamedQuery(e,t){return nv.resolve(this.qr.get(t))}saveNamedQuery(e,t){var r;let i;return this.qr.set(t.name,{name:t.name,query:(i=function(e){var t,r,i,n;let s,a,o,l,h,u=4===(s=aL(e.parent)).length?nc.emptyPath():aF(s),c=e.structuredQuery,d=c.from?c.from.length:0,f=null;if(d>0){iZ(1===d,65062);let e=c.from[0];e.allDescendants?f=e.collectionId:u=u.child(e.collectionId)}let p=[];c.where&&(p=(a=function e(t){return void 0!==t.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":let t=aB(e.unaryFilter.field);return sc.create(t,"==",{doubleValue:NaN});case"IS_NULL":let r=aB(e.unaryFilter.field);return sc.create(r,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let i=aB(e.unaryFilter.field);return sc.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let n=aB(e.unaryFilter.field);return sc.create(n,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return iY(61313);default:return iY(60726)}}(t):void 0!==t.fieldFilter?sc.create(aB(t.fieldFilter.field),function(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 iY(58110);default:return iY(50506)}}(t.fieldFilter.op),t.fieldFilter.value):void 0!==t.compositeFilter?sd.create(t.compositeFilter.filters.map(t=>e(t)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return iY(1026)}}(t.compositeFilter.op)):iY(30097,{filter:t})}(c.where))instanceof sd&&sp(t=a)&&sf(t)?a.getFilters():[a]);let g=[];c.orderBy&&(g=c.orderBy.map(e=>new sh(aB(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))));let m=null;c.limit&&(m=null==(o="object"==typeof(r=c.limit)?r.value:r)?null:o);let y=null;c.startAt&&(l=!!(i=c.startAt).before,y=new sa(i.values||[],l));let v=null;return c.endAt&&(h=!(n=c.endAt).before,v=new sa(n.values||[],h)),new sk(u,f,g,p,m,"F",y,v)}({parent:(r=t.bundledQuery).parent,structuredQuery:r.structuredQuery}),"LAST"===r.limitType?sx(i,i.limit,"L"):i),readTime:aD(t.readTime)}),nv.resolve()}}class a5{constructor(){this.overlays=new nC(np.comparator),this.Qr=new Map}getOverlay(e,t){return nv.resolve(this.overlays.get(t))}getOverlays(e,t){let r=sz();return nv.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&r.set(t,e)})).next(()=>r)}saveOverlays(e,t,r){return r.forEach((r,i)=>{this.St(e,t,i)}),nv.resolve()}removeOverlaysForBatchId(e,t,r){let i=this.Qr.get(r);return void 0!==i&&(i.forEach(e=>this.overlays=this.overlays.remove(e)),this.Qr.delete(r)),nv.resolve()}getOverlaysForCollection(e,t,r){let i=sz(),n=t.length+1,s=new np(t.child("")),a=this.overlays.getIteratorFrom(s);for(;a.hasNext();){let e=a.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===n&&e.largestBatchId>r&&i.set(e.getKey(),e)}return nv.resolve(i)}getOverlaysForCollectionGroup(e,t,r,i){let n=new nC((e,t)=>e-t),s=this.overlays.getIterator();for(;s.hasNext();){let e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>r){let t=n.get(e.largestBatchId);null===t&&(t=sz(),n=n.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let a=sz(),o=n.getIterator();for(;o.hasNext()&&(o.getNext().value.forEach((e,t)=>a.set(e,t)),!(a.size()>=i)););return nv.resolve(a)}St(e,t,r){let i=this.overlays.get(r.key);if(null!==i){let e=this.Qr.get(i.largestBatchId).delete(r.key);this.Qr.set(i.largestBatchId,e)}this.overlays=this.overlays.insert(r.key,new al(t,r));let n=this.Qr.get(t);void 0===n&&(n=sK(),this.Qr.set(t,n)),this.Qr.set(t,n.add(r.key))}}class a8{constructor(){this.sessionToken=nD.EMPTY_BYTE_STRING}getSessionToken(e){return nv.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,nv.resolve()}}class a7{constructor(){this.$r=new nk(a9.Ur),this.Kr=new nk(a9.Wr)}isEmpty(){return this.$r.isEmpty()}addReference(e,t){let r=new a9(e,t);this.$r=this.$r.add(r),this.Kr=this.Kr.add(r)}
31Gr(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.zr(new a9(e,t))}jr(e,t){e.forEach(e=>this.removeReference(e,t))}Hr(e){let t=new np(new nc([])),r=new a9(t,e),i=new a9(t,e+1),n=[];return this.Kr.forEachInRange([r,i],e=>{this.zr(e),n.push(e.key)}),n}Jr(){this.$r.forEach(e=>this.zr(e))}zr(e){this.$r=this.$r.delete(e),this.Kr=this.Kr.delete(e)}Yr(e){let t=new np(new nc([])),r=new a9(t,e),i=new a9(t,e+1),n=sK();return this.Kr.forEachInRange([r,i],e=>{n=n.add(e.key)}),n}containsKey(e){let t=new a9(e,0),r=this.$r.firstAfterOrEqual(t);return null!==r&&e.isEqual(r.key)}}class a9{constructor(e,t){this.key=e,this.Zr=t}static Ur(e,t){return np.comparator(e.key,t.key)||ni(e.Zr,t.Zr)}static Wr(e,t){return ni(e.Zr,t.Zr)||np.comparator(e.key,t.key)}}class oe{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.nr=1,this.Xr=new nk(a9.Ur)}checkEmpty(e){return nv.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,r,i){let n=this.nr;this.nr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let s=new ao(n,t,r,i);for(let t of(this.mutationQueue.push(s),i))this.Xr=this.Xr.add(new a9(t.key,n)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return nv.resolve(s)}lookupMutationBatch(e,t){return nv.resolve(this.ei(t))}getNextMutationBatchAfterBatchId(e,t){let r=this.ti(t+1),i=r<0?0:r;return nv.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return nv.resolve(0===this.mutationQueue.length?-1:this.nr-1)}getAllMutationBatches(e){return nv.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let r=new a9(t,0),i=new a9(t,1/0),n=[];return this.Xr.forEachInRange([r,i],e=>{let t=this.ei(e.Zr);n.push(t)}),nv.resolve(n)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new nk(ni);return t.forEach(e=>{let t=new a9(e,0),i=new a9(e,1/0);this.Xr.forEachInRange([t,i],e=>{r=r.add(e.Zr)})}),nv.resolve(this.ni(r))}getAllMutationBatchesAffectingQuery(e,t){let r=t.path,i=r.length+1,n=r;np.isDocumentKey(n)||(n=n.child(""));let s=new a9(new np(n),0),a=new nk(ni);return this.Xr.forEachWhile(e=>{let t=e.key.path;return!!r.isPrefixOf(t)&&(t.length===i&&(a=a.add(e.Zr)),!0)},s),nv.resolve(this.ni(a))}ni(e){let t=[];return e.forEach(e=>{let r=this.ei(e);null!==r&&t.push(r)}),t}removeMutationBatch(e,t){iZ(0===this.ri(t.batchId,"removed"),55003),this.mutationQueue.shift();let r=this.Xr;return nv.forEach(t.mutations,i=>{let n=new a9(i.key,t.batchId);return r=r.delete(n),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Xr=r})}sr(e){}containsKey(e,t){let r=new a9(t,0),i=this.Xr.firstAfterOrEqual(r);return nv.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,nv.resolve()}ri(e,t){return this.ti(e)}ti(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}ei(e){let t=this.ti(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class ot{constructor(e){this.ii=e,this.docs=new nC(np.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let r=t.key,i=this.docs.get(r),n=i?i.size:0,s=this.ii(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:s}),this.size+=s-n,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let r=this.docs.get(t);return nv.resolve(r?r.document.mutableCopy():ss.newInvalidDocument(t))}getEntries(e,t){let r=sB;return t.forEach(e=>{let t=this.docs.get(e);r=r.insert(e,t?t.document.mutableCopy():ss.newInvalidDocument(e))}),nv.resolve(r)}getDocumentsMatchingQuery(e,t,r,i){let n=sB,s=t.path,a=new np(s.child("__id-9223372036854775808__")),o=this.docs.getIteratorFrom(a);for(;o.hasNext();){let{key:e,value:{document:a}}=o.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||0>=function(e,t){let r=e.readTime.compareTo(t.readTime);return 0!==r||0!==(r=np.comparator(e.documentKey,t.documentKey))?r:ni(e.largestBatchId,t.largestBatchId)}(new ng(a.readTime,a.key,-1),r)||(i.has(a.key)||sU(t,a))&&(n=n.insert(a.key,a.mutableCopy()))}return nv.resolve(n)}getAllFromCollectionGroup(e,t,r,i){iY(9500)}si(e,t){return nv.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new or(this)}getSize(e){return nv.resolve(this.size)}}class or extends a2{constructor(e){super(),this.Br=e}applyChanges(e){let t=[];
vendor: 5,013 bytes, line 31
31return this.changes.forEach((r,i)=>{i.isValidDocument()?t.push(this.Br.addEntry(e,i)):this.Br.removeEntry(r)}),nv.waitFor(t)}getFromCache(e,t){return this.Br.getEntry(e,t)}getAllFromCache(e,t){return this.Br.getEntries(e,t)}}class oi{constructor(e){this.persistence=e,this.oi=new sj(e=>sC(e),sS),this.lastRemoteSnapshotVersion=nl.min(),this.highestTargetId=0,this._i=0,this.ai=new a7,this.targetCount=0,this.ui=aX.cr()}forEachTarget(e,t){return this.oi.forEach((e,r)=>t(r)),nv.resolve()}getLastRemoteSnapshotVersion(e){return nv.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return nv.resolve(this._i)}allocateTargetId(e){return this.highestTargetId=this.ui.next(),nv.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this._i&&(this._i=t),nv.resolve()}Tr(e){this.oi.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.ui=new aX(t),this.highestTargetId=t),e.sequenceNumber>this._i&&(this._i=e.sequenceNumber)}addTargetData(e,t){return this.Tr(t),this.targetCount+=1,nv.resolve()}updateTargetData(e,t){return this.Tr(t),nv.resolve()}removeTargetData(e,t){return this.oi.delete(t.target),this.ai.Hr(t.targetId),this.targetCount-=1,nv.resolve()}removeTargets(e,t,r){let i=0,n=[];return this.oi.forEach((s,a)=>{a.sequenceNumber<=t&&null===r.get(a.targetId)&&(this.oi.delete(s),n.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),nv.waitFor(n).next(()=>i)}getTargetCount(e){return nv.resolve(this.targetCount)}getTargetData(e,t){let r=this.oi.get(t)||null;return nv.resolve(r)}addMatchingKeys(e,t,r){return this.ai.Gr(t,r),nv.resolve()}removeMatchingKeys(e,t,r){this.ai.jr(t,r);let i=this.persistence.referenceDelegate,n=[];return i&&t.forEach(t=>{n.push(i.markPotentiallyOrphaned(e,t))}),nv.waitFor(n)}removeMatchingKeysForTargetId(e,t){return this.ai.Hr(t),nv.resolve()}getMatchingKeysForTargetId(e,t){let r=this.ai.Yr(t);return nv.resolve(r)}containsKey(e,t){return nv.resolve(this.ai.containsKey(t))}}class on{constructor(e,t){this.ci={},this.overlays={},this.li=new n_(0),this.hi=!1,this.hi=!0,this.Pi=new a8,this.referenceDelegate=e(this),this.Ti=new oi(this),this.indexManager=new aK,this.remoteDocumentCache=new ot(e=>this.referenceDelegate.Ii(e)),this.serializer=new az(t),this.Ei=new a4(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.hi=!1,Promise.resolve()}get started(){return this.hi}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new a5,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.ci[e.toKey()];return r||(r=new oe(t,this.referenceDelegate),this.ci[e.toKey()]=r),r}getGlobalsCache(){return this.Pi}getTargetCache(){return this.Ti}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ei}runTransaction(e,t,r){iG("MemoryPersistence","Starting transaction:",e);let i=new os(this.li.next());return this.referenceDelegate.di(),r(i).next(e=>this.referenceDelegate.Ai(i).next(()=>e)).toPromise().then(e=>(i.raiseOnCommittedEvent(),e))}Ri(e,t){return nv.or(Object.values(this.ci).map(r=>()=>r.containsKey(e,t)))}}class os extends nm{constructor(e){super(),this.currentSequenceNumber=e}}class oa{constructor(e){this.persistence=e,this.Vi=new a7,this.mi=null}static fi(e){return new oa(e)}get gi(){if(this.mi)return this.mi;throw iY(60996)}addReference(e,t,r){return this.Vi.addReference(r,t),this.gi.delete(r.toString()),nv.resolve()}removeReference(e,t,r){return this.Vi.removeReference(r,t),this.gi.add(r.toString()),nv.resolve()}markPotentiallyOrphaned(e,t){return this.gi.add(t.toString()),nv.resolve()}removeTarget(e,t){this.Vi.Hr(t.targetId).forEach(e=>this.gi.add(e.toString()));let r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.gi.add(e.toString()))}).next(()=>r.removeTargetData(e,t))}di(){this.mi=new Set}Ai(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return nv.forEach(this.gi,r=>{let i=np.fromPath(r);return this.pi(e,i).next(e=>{e||t.removeEntry(i,nl.min())})}).next(()=>(this.mi=null,t.apply(e)))}updateLimboDocument(e,t){return this.pi(e,t).next(e=>{e?this.gi.delete(t.toString()):this.gi.add(t.toString())})}Ii(e){return 0}pi(e,t){return nv.or([()=>nv.resolve(this.Vi.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ri(e,t)])}}class oo{constructor(e,t){this.persistence=e,this.yi=new sj(e=>(function(e){let t="";for(let r=0;r<e.length;r++)t.length>0&&(t+="\x01\x01"),t=function(e,t){let r=t,i=e.length;for(let t=0;t<i;t++){let i=e.charAt(t);switch(i){case"\0":r+="\x01\x10";break;case"\x01":r+="\x01\x11";break;default:r+=i}}return r}(e.get(r),t);return t+"\x01\x01"})(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=new a1(this,t)}static fi(e,t){return new oo(e,t)}di(){}Ai(e){return nv.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEac
31hTarget(e,t)}pr(e){let t=this.br(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}br(e){let t=0;return this.yr(e,e=>{t++}).next(()=>t)}yr(e,t){return nv.forEach(this.yi,(r,i)=>this.Dr(e,r,i).next(e=>e?nv.resolve():t(i)))}removeTargets(e,t,r){return this.persistence.getTargetCache().removeTargets(e,t,r)}removeOrphanedDocuments(e,t){let r=0,i=this.persistence.getRemoteDocumentCache(),n=i.newChangeBuffer();return i.si(e,i=>this.Dr(e,i,t).next(e=>{e||(r++,n.removeEntry(i,nl.min()))})).next(()=>n.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,t){return this.yi.set(t,e.currentSequenceNumber),nv.resolve()}removeTarget(e,t){let r=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,t,r){return this.yi.set(r,e.currentSequenceNumber),nv.resolve()}removeReference(e,t,r){return this.yi.set(r,e.currentSequenceNumber),nv.resolve()}updateLimboDocument(e,t){return this.yi.set(t,e.currentSequenceNumber),nv.resolve()}Ii(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=function e(t){switch(nJ(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let r=nq(t);return r?16+e(r):16;case 5:return 2*t.stringValue.length;case 6:return nM(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return(t.arrayValue.values||[]).reduce((t,r)=>t+e(r),0);case 10:case 11:var i;let n;return i=t.mapValue,n=0,nI(i.fields,(t,r)=>{n+=t.length+e(r)}),n;default:throw iY(13486,{value:t})}}(e.data.value)),t}Dr(e,t,r){return nv.or([()=>this.persistence.Ri(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let e=this.yi.get(t);return nv.resolve(void 0!==e&&e>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}
31class ol{constructor(e,t,r,i){this.targetId=e,this.fromCache=t,this.ds=r,this.As=i}static Rs(e,t){let r=sK(),i=sK();for(let e of t.docChanges)switch(e.type){case 0:r=r.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new ol(e,t.fromCache,r,i)}}class oh{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class ou{constructor(){this.Vs=!1,this.fs=!1,this.gs=100,this.ps=function(){let e;return!function(){var e;let t=null==(e=P())?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(r.g.process)}catch(e){return!1}}()&&navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")?8:Number((e=$().match(/Android ([\d.]+)/i))?e[1].split(".").slice(0,2).join("."):"-1")>0?6:4}()}initialize(e,t){this.ys=e,this.indexManager=t,this.Vs=!0}getDocumentsMatchingQuery(e,t,r,i){let n={result:null};return this.ws(e,t).next(e=>{n.result=e}).next(()=>{if(!n.result)return this.bs(e,t,i,r).next(e=>{n.result=e})}).next(()=>{if(n.result)return;let r=new oh;return this.Ss(e,t,r).next(i=>{if(n.result=i,this.fs)return this.Ds(e,t,r,i.size)})}).next(()=>n.result)}Ds(e,t,r,i){return r.documentReadCount<this.gs?(iK()<=l.DEBUG&&iG("QueryEngine","SDK will not create cache indexes for query:",sV(t),"since it only creates cache indexes for collection contains","more than or equal to",this.gs,"documents"),nv.resolve()):(iK()<=l.DEBUG&&iG("QueryEngine","Query:",sV(t),"scans",r.documentReadCount,"local documents and returns",i,"documents as results."),r.documentReadCount>this.ps*i?(iK()<=l.DEBUG&&iG("QueryEngine","The SDK decides to create cache indexes for query:",sV(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,sD(t))):nv.resolve())}ws(e,t){if(sR(t))return nv.resolve(null);let r=sD(t);return this.indexManager.getIndexType(e,r).next(i=>0===i?null:(null!==t.limit&&1===i&&(r=sD(t=sx(t,null,"F"))),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{let n=sK(...i);return this.ys.getDocuments(e,n).next(i=>this.indexManager.getMinOffset(e,r).next(r=>{let s=this.vs(t,i);return this.Cs(t,s,n,r.readTime)?this.ws(e,sx(t,null,"F")):this.Fs(e,s,t,r)}))})))}bs(e,t,r,i){return sR(t)||i.isEqual(nl.min())?nv.resolve(null):this.ys.getDocuments(e,r).next(n=>{let s,a,o=this.vs(t,n);return this.Cs(t,o,r,i)?nv.resolve(null):(iK()<=l.DEBUG&&iG("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),sV(t)),this.Fs(e,o,t,(s=i.toTimestamp().seconds,a=i.toTimestamp().nanoseconds+1,new ng(nl.fromTimestamp(1e9===a?new no(s+1,0):new no(s,a)),np.empty(),-1))).next(e=>e))})}vs(e,t){let r=new nk(sF(e));return t.forEach((t,i)=>{sU(e,i)&&(r=r.add(i))}),r}Cs(e,t,r,i){if(null===e.limit)return!1;if(r.size!==t.size)return!0;let n="F"===e.limitType?t.last():t.first();return!!n&&(n.hasPendingWrites||n.version.compareTo(i)>0)}Ss(e,t,r){return iK()<=l.DEBUG&&iG("QueryEngine","Using full collection scan to execute query:",sV(t)),this.ys.getDocumentsMatchingQuery(e,t,ng.min(),r)}Fs(e,t,r,i){return this.ys.getDocumentsMatchingQuery(e,r,i).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}let oc="LocalStore";
31class od{constructor(e,t,r,i){this.persistence=e,this.Ms=t,this.serializer=i,this.xs=new nC(ni),this.Os=new sj(e=>sC(e),sS),this.Ns=new Map,this.Bs=e.getRemoteDocumentCache(),this.Ti=e.getTargetCache(),this.Ei=e.getBundleCache(),this.Ls(r)}Ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new a3(this.Bs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Bs.setIndexManager(this.indexManager),this.Ms.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.xs))}}async function of(e,t){return await e.persistence.runTransaction("Handle user change","readonly",r=>{let i;return e.mutationQueue.getAllMutationBatches(r).next(n=>(i=n,e.Ls(t),e.mutationQueue.getAllMutationBatches(r))).next(t=>{let n=[],s=[],a=sK();for(let e of i)for(let t of(n.push(e.batchId),e.mutations))a=a.add(t.key);for(let e of t)for(let t of(s.push(e.batchId),e.mutations))a=a.add(t.key);return e.localDocuments.getDocuments(r,a).next(e=>({ks:e,removedBatchIds:n,addedBatchIds:s}))})})}function op(e){return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ti.getLastRemoteSnapshotVersion(t))}async function og(e,t,r){let i=e.xs.get(t);try{r||await e.persistence.runTransaction("Release target",r?"readwrite":"readwrite-primary",t=>e.persistence.referenceDelegate.removeTarget(t,i))}catch(e){if(!nw(e))throw e;iG(oc,`Failed to update sequence numbers for target ${t}: ${e}`)}e.xs=e.xs.remove(t),e.Os.delete(i.target)}function om(e,t,r){let i=nl.min(),n=sK();return e.persistence.runTransaction("Execute query","readwrite",s=>{var a;let o;return(a=sD(t),void 0!==(o=e.Os.get(a))?nv.resolve(e.xs.get(o)):e.Ti.getTargetData(s,a)).next(t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,e.Ti.getMatchingKeysForTargetId(s,t.targetId).next(e=>{n=e})}).next(()=>e.Ms.getDocumentsMatchingQuery(s,t,r?i:nl.min(),r?n:sK())).next(r=>{var i,s,a;let o;return i=e,s=t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2)),a=r,o=i.Ns.get(s)||nl.min(),a.forEach((e,t)=>{t.readTime.compareTo(o)>0&&(o=t.readTime)}),i.Ns.set(s,o),{documents:r,$s:n}})})}class oy{constructor(){this.activeTargetIds=sG}js(e){this.activeTargetIds=this.activeTargetIds.add(e)}Hs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}zs(){return JSON.stringify({activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()})}}class ov{constructor(){this.xo=new oy,this.Oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.xo.js(e),this.Oo[e]||"not-current"}updateQueryState(e,t,r){this.Oo[e]=t}removeLocalQueryTarget(e){this.xo.Hs(e)}isLocalQueryTarget(e){return this.xo.activeTargetIds.has(e)}clearQueryState(e){delete this.Oo[e]}getAllActiveQueryTargets(){return this.xo.activeTargetIds}isActiveQueryTarget(e){return this.xo.activeTargetIds.has(e)}start(){return this.xo=new oy,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class ow{No(e){}shutdown(){}}let o_="ConnectivityMonitor";class oE{constructor(){this.Bo=()=>this.Lo(),this.ko=()=>this.qo(),this.Qo=[],this.$o()}No(e){this.Qo.push(e)}shutdown(){window.removeEventListener("online",this.Bo),window.removeEventListener("offline",this.ko)}$o(){window.addEventListener("online",this.Bo),window.addEventListener("offline",this.ko)}Lo(){for(let e of(iG(o_,"Network connectivity changed: AVAILABLE"),this.Qo))e(0)}qo(){for(let e of(iG(o_,"Network connectivity changed: UNAVAILABLE"),this.Qo))e(1)}static C(){return"u">typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let ob=null;function oI(){return null===ob?ob=0x10000000+Math.round(0x80000000*Math.random()):ob++,"0x"+ob.toString(16)}let oT="RestConnection",oC={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregation
31Query:"runAggregationQuery"};class oS{get Uo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.Ko=t+"://"+e.host,this.Wo=`projects/${r}/databases/${i}`,this.Go=this.databaseId.database===nH?`project_id=${r}`:`project_id=${r}&database_id=${i}`}zo(e,t,r,i,n){let s=oI(),a=this.jo(e,t.toUriEncodedString());iG(oT,`Sending RPC '${e}' ${s}:`,a,r);let o={"google-cloud-resource-prefix":this.Wo,"x-goog-request-params":this.Go};this.Ho(o,i,n);let{host:l}=new URL(a),h=U(l);return this.Jo(e,a,o,r,h).then(t=>(iG(oT,`Received RPC '${e}' ${s}: `,t),t),t=>{throw iQ(oT,`RPC '${e}' ${s} failed with error: `,t,"url: ",a,"request:",r),t})}Yo(e,t,r,i,n,s){return this.zo(e,t,r,i,n)}Ho(e,t,r){e["X-Goog-Api-Client"]="gl-js/ fire/"+iz,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((t,r)=>e[r]=t),r&&r.headers.forEach((t,r)=>e[r]=t)}jo(e,t){let r=oC[e];return`${this.Ko}/v1/${t}:${r}`}terminate(){}}class oA{constructor(e){this.Zo=e.Zo,this.Xo=e.Xo}e_(e){this.t_=e}n_(e){this.r_=e}i_(e){this.s_=e}onMessage(e){this.o_=e}close(){this.Xo()}send(e){this.Zo(e)}__(){this.t_()}a_(){this.r_()}u_(e){this.s_(e)}c_(e){this.o_(e)}}let ok="WebChannelConnection";class oR extends oS{constructor(e){super(e),this.l_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Jo(e,t,r,i,n){let s=oI();return new Promise((n,a)=>{let o=new c;o.setWithCredentials(!0),o.listenOnce(f.COMPLETE,()=>{try{switch(o.getLastErrorCode()){case p.NO_ERROR:let t=o.getResponseJson();iG(ok,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(t)),n(t);break;case p.TIMEOUT:iG(ok,`RPC '${e}' ${s} timed out`),a(new i1(i0.DEADLINE_EXCEEDED,"Request time out"));break;case p.HTTP_ERROR:let r=o.getStatus();if(iG(ok,`RPC '${e}' ${s} failed with status:`,r,"response text:",o.getResponseText()),r>0){let e=o.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=null==e?void 0:e.error;if(t&&t.status&&t.message){let e,r=(e=t.status.toLowerCase().replace(/_/g,"-"),Object.values(i0).indexOf(e)>=0?e:i0.UNKNOWN);a(new i1(r,t.message))}else a(new i1(i0.UNKNOWN,"Server responded with status "+o.getStatus()))}else a(new i1(i0.UNAVAILABLE,"Connection failed."));break;default:iY(9055,{h_:e,streamId:s,P_:o.getLastErrorCode(),T_:o.getLastError()})}}finally{iG(ok,`RPC '${e}' ${s} completed.`)}});let l=JSON.stringify(i);iG(ok,`RPC '${e}' ${s} sending request:`,i),o.send(t,"POST",l,r,15)})}I_(e,t,r){let i=oI(),n=[this.Ko,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=v(),a=y(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;void 0!==l&&(o.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(o.useFetchStreams=!0),this.Ho(o.initMessageHeaders,t,r),o.encodeInitMessageHeaders=!0;let h=n.join("");iG(ok,`Creating RPC '${e}' stream ${i}: ${h}`,o);let u=s.createWebChannel(h,o);this.E_(u);let c=!1,f=!1,p=new oA({Zo:t=>{f?iG(ok,`Not sending because RPC '${e}' stream ${i} is closed:`,t):(c||(iG(ok,`Opening RPC '${e}' stream ${i} transport.`),u.open(),c=!0),iG(ok,`RPC '${e}' stream ${i} sending:`,t),u.send(t))},Xo:()=>u.close()}),_=(e,t,r)=>{e.listen(t,e=>{try{r(e)}catch(e){setTimeout(()=>{throw e},0)}})};return _(u,d.EventType.OPEN,()=>{f||(iG(ok,`RPC '${e}' stream ${i} transport opened.`),p.__())}),_(u,d.EventType.CLOSE,()=>{f||(f=!0,iG(ok,`RPC '${e}' stream ${i} transport closed`),p.u_(),this.d_(u))}),_(u,d.EventType.ERROR,t=>{f||(f=!0,iQ(ok,`RPC '${e}' stream ${i} transport errored. Name:`,t.name,"Message:",t.message),p.u_(new i1(i0.UNAVAILABLE,"The operation could not be completed")))}),_(u,d.EventType.MESSAGE,t=>{var r;if(!f){let n=t.data[0];iZ(!!n,16349);let s=(null==n?void 0:n.error)||(null==(r=n[0])?void 0:r.error);if(s){iG(ok,`RPC '${e}' stream ${i} received error:`,s);let t=s.status,r=function(e){let t=w[e];if(void 0!==t)return au(t)}(t),n=s.message;void 0===r&&(r=i0.INTERNAL,n="Unknown error status: "+t+" with message "+s.message),f=!0,p.u_(new i1(r,n)),u.close()}else iG(ok,`RPC '${e}' stream ${i} received:`,n),p.c_(n)}}),_(a,m.STAT_EVENT,t=>{t.stat===g.PROXY?iG(ok,`RPC '${e}' stream ${i} detected buffering proxy`):t.stat===g.NOPROXY&&iG(ok,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{p.a_()},0),p}
31terminate(){this.l_.forEach(e=>e.close()),this.l_=[]}E_(e){this.l_.push(e)}d_(e){this.l_=this.l_.filter(t=>t===e)}}function oN(){return"u">typeof document?document:null}function oO(e){return new ak(e,!0)}class oD{constructor(e,t,r=1e3,i=1.5,n=6e4){this.xi=e,this.timerId=t,this.A_=r,this.R_=i,this.V_=n,this.m_=0,this.f_=null,this.g_=Date.now(),this.reset()}reset(){this.m_=0}p_(){this.m_=this.V_}y_(e){this.cancel();let t=Math.floor(this.m_+this.w_()),r=Math.max(0,Date.now()-this.g_),i=Math.max(0,t-r);i>0&&iG("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.m_} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.f_=this.xi.enqueueAfterDelay(this.timerId,i,()=>(this.g_=Date.now(),e())),this.m_*=this.R_,this.m_<this.A_&&(this.m_=this.A_),this.m_>this.V_&&(this.m_=this.V_)}b_(){null!==this.f_&&(this.f_.skipDelay(),this.f_=null)}cancel(){null!==this.f_&&(this.f_.cancel(),this.f_=null)}w_(){return(Math.random()-.5)*this.m_}}let oP="PersistentStream";class ox{constructor(e,t,r,i,n,s,a,o){this.xi=e,this.S_=r,this.D_=i,this.connection=n,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=a,this.listener=o,this.state=0,this.v_=0,this.C_=null,this.F_=null,this.stream=null,this.M_=0,this.x_=new oD(e,t)}O_(){return 1===this.state||5===this.state||this.N_()}N_(){return 2===this.state||3===this.state}start(){this.M_=0,4!==this.state?this.auth():this.B_()}async stop(){this.O_()&&await this.close(0)}L_(){this.state=0,this.x_.reset()}k_(){this.N_()&&null===this.C_&&(this.C_=this.xi.enqueueAfterDelay(this.S_,6e4,()=>this.q_()))}Q_(e){this.U_(),this.stream.send(e)}async q_(){if(this.N_())return this.close(0)}U_(){this.C_&&(this.C_.cancel(),this.C_=null)}K_(){this.F_&&(this.F_.cancel(),this.F_=null)}async close(e,t){this.U_(),this.K_(),this.x_.cancel(),this.v_++,4!==e?this.x_.reset():t&&t.code===i0.RESOURCE_EXHAUSTED?(iW(t.toString()),iW("Using maximum backoff delay to prevent overloading the backend."),this.x_.p_()):t&&t.code===i0.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.i_(t)}W_(){}auth(){this.state=1;let e=this.G_(this.v_),t=this.v_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,r])=>{this.v_===t&&this.z_(e,r)},t=>{e(()=>{let e=new i1(i0.UNKNOWN,"Fetching auth token failed: "+t.message);return this.j_(e)})})}z_(e,t){let r=this.G_(this.v_);this.stream=this.H_(e,t),this.stream.e_(()=>{r(()=>this.listener.e_())}),this.stream.n_(()=>{r(()=>(this.state=2,this.F_=this.xi.enqueueAfterDelay(this.D_,1e4,()=>(this.N_()&&(this.state=3),Promise.resolve())),this.listener.n_()))}),this.stream.i_(e=>{r(()=>this.j_(e))}),this.stream.onMessage(e=>{r(()=>1==++this.M_?this.J_(e):this.onNext(e))})}B_(){this.state=5,this.x_.y_(async()=>{this.state=0,this.start()})}j_(e){return iG(oP,`close with error: ${e}`),this.stream=null,this.close(4,e)}G_(e){return t=>{this.xi.enqueueAndForget(()=>this.v_===e?t():(iG(oP,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class oL extends ox{constructor(e,t,r,i,n,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,i,s),this.serializer=n}H_(e,t){return this.connection.I_("Listen",e,t)}J_(e){return this.onNext(e)}onNext(e){this.x_.reset();let t=function(e,t){let r;if("targetChange"in t){var i,n;t.targetChange;let s="NO_CHANGE"===(i=t.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===i?1:"REMOVE"===i?2:"CURRENT"===i?3:"RESET"===i?4:iY(39313,{state:i}),a=t.targetChange.targetIds||[],o=(n=t.targetChange.resumeToken,e.useProto3Json?(iZ(void 0===n||"string"==typeof n,58123),nD.fromBase64String(n||"")):(iZ(void 0===n||n instanceof ij||n instanceof Uint8Array,16193),nD.fromUint8Array(n||new Uint8Array))),l=t.targetChange.cause;r=new a_(s,a,o,l&&new i1(void 0===l.code?i0.UNKNOWN:au(l.code),l.message||"")||null)}else if("documentChange"in t){t.documentChange;let i=t.documentChange;i.document,i.document.name,i.document.updateTime;let n=aM(e,i.document.name),s=aD(i.document.updateTime),a=i.document.createTime?aD(i.document.createTime):nl.min(),o=new sn({mapValue:{fields:i.document.fields}}),l=ss.newFoundDocument(n,s,a,o);r=new av(i.targetIds||[],i.removedTargetIds||[],l.key,l)}else if("documentDelete"in t){t.documentDelete;let i=t.documentDelete;i.document;let n=aM(e,i.document),s=i.readTime?aD(i.readTime):nl.min(),a=ss.newNoDocument(n,s);r=new av([],i.removedTargetIds||[],a.key,a)}else if("documentRemove"in t){t.documentRemove;let i=t.documentRemove;i.document;let n=aM(e,i.document);r=new av([],i.removedTargetIds||[],n,null)}else{if(!("filter"in t))return iY(11601,{Vt:t});{t.filter;let e=t.filter;e.targetId;
31let{count:i=0,unchangedNames:n}=e,s=new ah(i,n);r=new aw(e.targetId,s)}}return r}(this.serializer,e),r=function(e){if(!("targetChange"in e))return nl.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?nl.min():t.readTime?aD(t.readTime):nl.min()}(e);return this.listener.Y_(t,r)}Z_(e){let t,r={};r.database=aU(this.serializer),r.addTarget=function(e,t){var r,i;let n,s,a,o,l,h,u,c=t.target;if((n=sA(c)?{documents:{documents:[aV(e,c.path)]}}:{query:(a={structuredQuery:{}},o=c.path,null!==c.collectionGroup?(s=o,a.structuredQuery.from=[{collectionId:c.collectionGroup,allDescendants:!0}]):(s=o.popLast(),a.structuredQuery.from=[{collectionId:o.lastSegment()}]),a.parent=aV(e,s),(l=function(e){if(0!==e.length)return function e(t){var r;let i;return t instanceof sc?function(e){if("=="===e.op){if(n9(e.value))return{unaryFilter:{field:aj(e.field),op:"IS_NAN"}};if(n7(e.value))return{unaryFilter:{field:aj(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(n9(e.value))return{unaryFilter:{field:aj(e.field),op:"IS_NOT_NAN"}};if(n7(e.value))return{unaryFilter:{field:aj(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:aj(e.field),op:aS[e.op],value:e.value}}}(t):t instanceof sd?1===(i=(r=t).getFilters().map(t=>e(t))).length?i[0]:{compositeFilter:{op:aA[r.op],filters:i}}:iY(54877,{filter:t})}(sd.create(e,"and"))}(c.filters))&&(a.structuredQuery.where=l),(h=function(e){if(0!==e.length)return e.map(e=>({field:aj(e.field),direction:aC[e.dir]}))}(c.orderBy))&&(a.structuredQuery.orderBy=h),null!==(u=aR(e,c.limit))&&(a.structuredQuery.limit=u),c.startAt&&(a.structuredQuery.startAt={before:(r=c.startAt).inclusive,values:r.position}),c.endAt&&(a.structuredQuery.endAt={before:!(i=c.endAt).inclusive,values:i.position}),{gt:a,parent:s}).gt}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=aO(e,t.resumeToken);let r=aR(e,t.expectedCount);null!==r&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(nl.min())>0){n.readTime=aN(e,t.snapshotVersion.toTimestamp());let r=aR(e,t.expectedCount);null!==r&&(n.expectedCount=r)}return n}(this.serializer,e);let i=(this.serializer,null==(t=function(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 iY(28987,{purpose:e})}}(e.purpose))?null:{"goog-listen-tags":t});i&&(r.labels=i),this.Q_(r)}X_(e){let t={};t.database=aU(this.serializer),t.removeTarget=e,this.Q_(t)}}class oM{}
31class oV extends oM{constructor(e,t,r,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=i,this.sa=!1}oa(){if(this.sa)throw new i1(i0.FAILED_PRECONDITION,"The client has already been terminated.")}zo(e,t,r,i){return this.oa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([n,s])=>this.connection.zo(e,ax(t,r),i,n,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===i0.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new i1(i0.UNKNOWN,e.toString())})}Yo(e,t,r,i,n){return this.oa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,a])=>this.connection.Yo(e,ax(t,r),i,s,a,n)).catch(e=>{throw"FirebaseError"===e.name?(e.code===i0.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new i1(i0.UNKNOWN,e.toString())})}terminate(){this.sa=!0,this.connection.terminate()}}class oU{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this._a=0,this.aa=null,this.ua=!0}ca(){0===this._a&&(this.la("Unknown"),this.aa=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.aa=null,this.ha("Backend didn't respond within 10 seconds."),this.la("Offline"),Promise.resolve())))}Pa(e){"Online"===this.state?this.la("Unknown"):(this._a++,this._a>=1&&(this.Ta(),this.ha(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.la("Offline")))}set(e){this.Ta(),this._a=0,"Online"===e&&(this.ua=!1),this.la(e)}la(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}ha(e){let t=`Could not reach Cloud Firestore backend. ${e} 32This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.ua?(iW(t),this.ua=!1):iG("OnlineStateTracker",t)}Ta(){null!==this.aa&&(this.aa.cancel(),this.aa=null)}}let oF="RemoteStore";class oj{constructor(e,t,r,i,n){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.Ia=[],this.Ea=new Map,this.da=new Set,this.Aa=[],this.Ra=n,this.Ra.No(e=>{r.enqueueAndForget(async()=>{oQ(this)&&(iG(oF,"Restarting streams for network reachability change."),await async function(e){e.da.add(4),await oq(e),e.Va.set("Unknown"),e.da.delete(4),await oB(e)}(this))})}),this.Va=new oU(r,i)}}async function oB(e){if(oQ(e))for(let t of e.Aa)await t(!0)}async function oq(e){for(let t of e.Aa)await t(!1)}function o$(e,t){e.Ea.has(t.targetId)||(e.Ea.set(t.targetId,t),oW(e)?oG(e):o6(e).N_()&&oH(e,t))}function oz(e,t){let r=o6(e);e.Ea.delete(t),r.N_()&&oK(e,t),0===e.Ea.size&&(r.N_()?r.k_():oQ(e)&&e.Va.set("Unknown"))}function oH(e,t){if(e.ma.Ke(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(nl.min())>0){let r=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(r)}o6(e).Z_(t)}function oK(e,t){e.ma.Ke(t),o6(e).X_(t)}function oG(e){e.ma=new ab({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),Rt:t=>e.Ea.get(t)||null,Pt:()=>e.datastore.serializer.databaseId}),o6(e).start(),e.Va.ca()}function oW(e){return oQ(e)&&!o6(e).O_()&&e.Ea.size>0}function oQ(e){return 0===e.da.size}async function oX(e){e.Va.set("Online")}async function oY(e){e.Ea.forEach((t,r)=>{oH(e,t)})}async function oJ(e,t){e.ma=void 0,oW(e)?(e.Va.Pa(t),oG(e)):e.Va.set("Unknown")}async function oZ(e,t,r){if(e.Va.set("Online"),t instanceof a_&&2===t.state&&t.cause)try{await async function(e,t){let r=t.cause;for(let i of t.targetIds)e.Ea.has(i)&&(await e.remoteSyncer.rejectListen(i,r),e.Ea.delete(i),e.ma.removeTarget(i))}(e,t)}catch(r){iG(oF,"Failed to remove targets %s: %s ",t.targetIds.join(","),r),await o0(e,r)}else if(t instanceof av?e.ma.Xe(t):t instanceof aw?e.ma.ot(t):e.ma.nt(t),!r.isEqual(nl.min()))try{let t,i=await op(e.localStore);r.compareTo(i)>
32=0&&await ((t=e.ma.It(r)).targetChanges.forEach((t,i)=>{if(t.resumeToken.approximateByteSize()>0){let n=e.Ea.get(i);n&&e.Ea.set(i,n.withResumeToken(t.resumeToken,r))}}),t.targetMismatches.forEach((t,r)=>{let i=e.Ea.get(t);if(!i)return;e.Ea.set(t,i.withResumeToken(nD.EMPTY_BYTE_STRING,i.snapshotVersion)),oK(e,t);let n=new a$(i.target,t,r,i.sequenceNumber);oH(e,n)}),e.remoteSyncer.applyRemoteEvent(t))}catch(t){iG(oF,"Failed to raise snapshot:",t),await o0(e,t)}}async function o0(e,t,r){if(!nw(t))throw t;e.da.add(1),await oq(e),e.Va.set("Offline"),r||(r=()=>op(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{iG(oF,"Retrying IndexedDB access"),await r(),e.da.delete(1),await oB(e)})}async function o1(e,t){e.asyncQueue.verifyOperationInProgress(),iG(oF,"RemoteStore received new credentials");let r=oQ(e);e.da.add(3),await oq(e),r&&e.Va.set("Unknown"),await e.remoteSyncer.handleCredentialChange(t),e.da.delete(3),await oB(e)}async function o2(e,t){t?(e.da.delete(2),await oB(e)):t||(e.da.add(2),await oq(e),e.Va.set("Unknown"))}function o6(e){var t,r,i;return e.fa||(t=e.datastore,r=e.asyncQueue,i={e_:oX.bind(null,e),n_:oY.bind(null,e),i_:oJ.bind(null,e),Y_:oZ.bind(null,e)},t.oa(),e.fa=new oL(r,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,i),e.Aa.push(async t=>{t?(e.fa.L_(),oW(e)?oG(e):e.Va.set("Unknown")):(await e.fa.stop(),e.ma=void 0)})),e.fa}class o3{constructor(e,t,r,i,n){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=i,this.removalCallback=n,this.deferred=new i2,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,i,n){let s=new o3(e,t,Date.now()+r,i,n);return s.start(r),s}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new i1(i0.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function o4(e,t){if(iW("AsyncQueue",`${t}: ${e}`),nw(e))return new i1(i0.UNAVAILABLE,`${t}: ${e}`);throw e}class o5{static emptySet(e){return new o5(e.comparator)}constructor(e){this.comparator=e?(t,r)=>e(t,r)||np.comparator(t.key,r.key):(e,t)=>np.comparator(e.key,t.key),this.keyedMap=s$(),this.sortedSet=new nC(this.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,r)=>(e(t),!1))}add(e){let t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){let t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof o5)||this.size!==e.size)return!1;let t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){let e=t.getNext().key,i=r.getNext().key;if(!e.isEqual(i))return!1}return!0}toString(){let e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":`DocumentSet ( 33 `+e.join(` 34`)+` 35)`}copy(e,t){let r=new o5;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}class o8{constructor(){this.pa=new nC(np.comparator)}track(e){let t=e.doc.key,r=this.pa.get(t);r?0!==e.type&&3===r.type?this.pa=this.pa.insert(t,e):3===e.type&&1!==r.type?this.pa=this.pa.insert(t,{type:r.type,doc:e.doc}):2===e.type&&2===r.type?this.pa=this.pa.insert(t,{type:2,doc:e.doc}):2===e.type&&0===r.type?this.pa=this.pa.insert(t,{type:0,doc:e.doc}):1===e.type&&0===r.type?this.pa=this.pa.remove(t):1===e.type&&2===r.type?this.pa=this.pa.insert(t,{type:1,doc:r.doc}):0===e.type&&1===r.type?this.pa=this.pa.insert(t,{type:2,doc:e.doc}):iY(63341,{Vt:e,ya:r}):this.pa=this.pa.insert(t,e)}wa(){let e=[];return this.pa.inorderTraversal((t,r)=>{e.push(r)}),e}}class o7{constructor(e,t,r,i,n,s,a,o,l){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=n,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=o,this.hasCachedResults=l}static fromInitialDocuments(e,t,r,i,n){let s=[];
35return t.forEach(e=>{s.push({type:0,doc:e})}),new o7(e,t,o5.emptySet(t),s,r,i,!0,!1,n)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&sL(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==r[e].type||!t[e].doc.isEqual(r[e].doc))return!1;return!0}}class o9{constructor(){this.ba=void 0,this.Sa=[]}Da(){return this.Sa.some(e=>e.va())}}class le{constructor(){this.queries=lt(),this.onlineState="Unknown",this.Ca=new Set}terminate(){var e;let t;e=new i1(i0.ABORTED,"Firestore shutting down"),t=this.queries,this.queries=lt(),t.forEach((t,r)=>{for(let t of r.Sa)t.onError(e)})}}function lt(){return new sj(e=>sM(e),sL)}async function lr(e,t){let r=3,i=t.query,n=e.queries.get(i);n?!n.Da()&&t.va()&&(r=2):(n=new o9,r=+!t.va());try{switch(r){case 0:n.ba=await e.onListen(i,!0);break;case 1:n.ba=await e.onListen(i,!1);break;case 2:await e.onFirstRemoteStoreListen(i)}}catch(r){let e=o4(r,`Initialization of query '${sV(t.query)}' failed`);return void t.onError(e)}e.queries.set(i,n),n.Sa.push(t),t.Fa(e.onlineState),n.ba&&t.Ma(n.ba)&&ls(e)}function li(e,t){let r=!1;for(let i of t){let t=i.query,n=e.queries.get(t);if(n){for(let e of n.Sa)e.Ma(i)&&(r=!0);n.ba=i}}r&&ls(e)}function ln(e,t,r){let i=e.queries.get(t);if(i)for(let e of i.Sa)e.onError(r);e.queries.delete(t)}function ls(e){e.Ca.forEach(e=>{e.next()})}(b=E||(E={})).xa="default",b.Cache="cache";class la{constructor(e,t,r){this.query=e,this.Oa=t,this.Na=!1,this.Ba=null,this.onlineState="Unknown",this.options=r||{}}Ma(e){if(!this.options.includeMetadataChanges){let t=[];for(let r of e.docChanges)3!==r.type&&t.push(r);e=new o7(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Na?this.La(e)&&(this.Oa.next(e),t=!0):this.ka(e,this.onlineState)&&(this.qa(e),t=!0),this.Ba=e,t}onError(e){this.Oa.error(e)}Fa(e){this.onlineState=e;let t=!1;return this.Ba&&!this.Na&&this.ka(this.Ba,e)&&(this.qa(this.Ba),t=!0),t}ka(e,t){return!(e.fromCache&&this.va())||(!this.options.Qa||"Offline"===t)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}La(e){if(e.docChanges.length>0)return!0;let t=this.Ba&&this.Ba.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}qa(e){e=o7.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Na=!0,this.Oa.next(e)}va(){return this.options.source!==E.Cache}}class lo{constructor(e){this.key=e}}class ll{constructor(e){this.key=e}}class lh{constructor(e,t){this.query=e,this.Ha=t,this.Ja=null,this.hasCachedResults=!1,this.current=!1,this.Ya=sK(),this.mutatedKeys=sK(),this.Za=sF(e),this.Xa=new o5(this.Za)}get eu(){return this.Ha}tu(e,t){let r=t?t.nu:new o8,i=t?t.Xa:this.Xa,n=t?t.mutatedKeys:this.mutatedKeys,s=i,a=!1,o="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,l="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((e,t)=>{let h=i.get(e),u=sU(this.query,t)?t:null,c=!!h&&this.mutatedKeys.has(h.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations),f=!1;h&&u?h.data.isEqual(u.data)?c!==d&&(r.track({type:3,doc:u}),f=!0):this.ru(h,u)||(r.track({type:2,doc:u}),f=!0,(o&&this.Za(u,o)>0||l&&0>this.Za(u,l))&&(a=!0)):!h&&u?(r.track({type:0,doc:u}),f=!0):h&&!u&&(r.track({type:1,doc:h}),f=!0,(o||l)&&(a=!0)),f&&(u?(s=s.add(u),n=d?n.add(e):n.delete(e)):(s=s.delete(e),n=n.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){let e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),n=n.delete(e.key),r.track({type:1,doc:e})}return{Xa:s,nu:r,Cs:a,mutatedKeys:n}}ru(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,i){let n=this.Xa;this.Xa=e.Xa,this.mutatedKeys=e.mutatedKeys;let s=e.nu.wa();s.sort((e,t)=>
35{var r,i;let n;return r=e.type,i=t.type,(n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return iY(20277,{Vt:e})}})(r)-n(i)||this.Za(e.doc,t.doc)}),this.iu(r),i=null!=i&&i;let a=t&&!i?this.su():[],o=0===this.Ya.size&&this.current&&!i?1:0,l=o!==this.Ja;return(this.Ja=o,0!==s.length||l)?{snapshot:new o7(this.query,e.Xa,n,s,e.mutatedKeys,0===o,l,!1,!!r&&r.resumeToken.approximateByteSize()>0),ou:a}:{ou:a}}Fa(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({Xa:this.Xa,nu:new o8,mutatedKeys:this.mutatedKeys,Cs:!1},!1)):{ou:[]}}_u(e){return!this.Ha.has(e)&&!!this.Xa.has(e)&&!this.Xa.get(e).hasLocalMutations}iu(e){e&&(e.addedDocuments.forEach(e=>this.Ha=this.Ha.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ha=this.Ha.delete(e)),this.current=e.current)}su(){if(!this.current)return[];let e=this.Ya;this.Ya=sK(),this.Xa.forEach(e=>{this._u(e.key)&&(this.Ya=this.Ya.add(e.key))});let t=[];return e.forEach(e=>{this.Ya.has(e)||t.push(new ll(e))}),this.Ya.forEach(r=>{e.has(r)||t.push(new lo(r))}),t}au(e){this.Ha=e.$s,this.Ya=sK();let t=this.tu(e.documents);return this.applyChanges(t,!0)}uu(){return o7.fromInitialDocuments(this.query,this.Xa,this.mutatedKeys,0===this.Ja,this.hasCachedResults)}}let lu="SyncEngine";class lc{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class ld{constructor(e){this.key=e,this.cu=!1}}class lf{constructor(e,t,r,i,n,s){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=i,this.currentUser=n,this.maxConcurrentLimboResolutions=s,this.lu={},this.hu=new sj(e=>sM(e),sL),this.Pu=new Map,this.Tu=new Set,this.Iu=new nC(np.comparator),this.Eu=new Map,this.du=new a7,this.Au={},this.Ru=new Map,this.Vu=aX.lr(),this.onlineState="Unknown",this.mu=void 0}get isPrimaryClient(){return!0===this.mu}}async function lp(e,t,r=!0){let i,n=lN(e),s=n.hu.get(t);return s?(n.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.uu()):i=await lm(n,t,r,!0),i}async function lg(e,t){let r=lN(e);await lm(r,t,!0,!1)}async function lm(e,t,r,i){var n,s;let a,o=await (n=e.localStore,s=sD(t),n.persistence.runTransaction("Allocate target","readwrite",e=>{let t;return n.Ti.getTargetData(e,s).next(r=>r?(t=r,nv.resolve(t)):n.Ti.allocateTargetId(e).next(r=>(t=new a$(s,r,"TargetPurposeListen",e.currentSequenceNumber),n.Ti.addTargetData(e,t).next(()=>t))))}).then(e=>{let t=n.xs.get(e.targetId);return(null===t||e.snapshotVersion.compareTo(t.snapshotVersion)>0)&&(n.xs=n.xs.insert(e.targetId,e),n.Os.set(s,e.targetId)),e}
35)),l=o.targetId,h=e.sharedClientState.addLocalQueryTarget(l,r);return i&&(a=await ly(e,t,l,"current"===h,o.resumeToken)),e.isPrimaryClient&&r&&o$(e.remoteStore,o),a}async function ly(e,t,r,i,n){e.fu=(t,r,i)=>(async function(e,t,r,i){let n=t.view.tu(r);n.Cs&&(n=await om(e.localStore,t.query,!1).then(({documents:e})=>t.view.tu(e,n)));let s=i&&i.targetChanges.get(t.targetId),a=i&&null!=i.targetMismatches.get(t.targetId),o=t.view.applyChanges(n,e.isPrimaryClient,s,a);return lC(e,t.targetId,o.ou),o.snapshot})(e,t,r,i);let s=await om(e.localStore,t,!0),a=new lh(t,s.$s),o=a.tu(s.documents),l=ay.createSynthesizedTargetChangeForCurrentChange(r,i&&"Offline"!==e.onlineState,n),h=a.applyChanges(o,e.isPrimaryClient,l);lC(e,r,h.ou);let u=new lc(t,r,a);return e.hu.set(t,u),e.Pu.has(r)?e.Pu.get(r).push(t):e.Pu.set(r,[t]),h.snapshot}async function lv(e,t,r){let i=e.hu.get(t),n=e.Pu.get(i.targetId);n.length>1?(e.Pu.set(i.targetId,n.filter(e=>!sL(e,t))),e.hu.delete(t)):e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(i.targetId),e.sharedClientState.isActiveQueryTarget(i.targetId)||await og(e.localStore,i.targetId,!1).then(()=>{e.sharedClientState.clearQueryState(i.targetId),r&&oz(e.remoteStore,i.targetId),lI(e,i.targetId)}).catch(ny)):(lI(e,i.targetId),await og(e.localStore,i.targetId,!0))}async function lw(e,t){let r=e.hu.get(t),i=e.Pu.get(r.targetId);e.isPrimaryClient&&1===i.length&&(e.sharedClientState.removeLocalQueryTarget(r.targetId),oz(e.remoteStore,r.targetId))}async function l_(e,t){var r;try{let i,n,s=await (r=e.localStore,i=t.snapshotVersion,n=r.xs,r.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{var s,a,o;let l,h,u=r.Bs.newChangeBuffer({trackRemovals:!0});n=r.xs;let c=[];
35t.targetChanges.forEach((s,a)=>{var o;let l=n.get(a);if(!l)return;c.push(r.Ti.removeMatchingKeys(e,s.removedDocuments,a).next(()=>r.Ti.addMatchingKeys(e,s.addedDocuments,a)));let h=l.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?h=h.withResumeToken(nD.EMPTY_BYTE_STRING,nl.min()).withLastLimboFreeSnapshotVersion(nl.min()):s.resumeToken.approximateByteSize()>0&&(h=h.withResumeToken(s.resumeToken,i)),n=n.insert(a,h),o=h,(0===l.resumeToken.approximateByteSize()||o.snapshotVersion.toMicroseconds()-l.snapshotVersion.toMicroseconds()>=3e8||s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size>0)&&c.push(r.Ti.updateTargetData(e,h))});let d=sB,f=sK();if(t.documentUpdates.forEach(i=>{t.resolvedLimboDocuments.has(i)&&c.push(r.persistence.referenceDelegate.updateLimboDocument(e,i))}),c.push((s=e,a=u,o=t.documentUpdates,l=sK(),h=sK(),o.forEach(e=>l=l.add(e)),a.getEntries(s,l).next(e=>{let t=sB;return o.forEach((r,i)=>{let n=e.get(r);i.isFoundDocument()!==n.isFoundDocument()&&(h=h.add(r)),i.isNoDocument()&&i.version.isEqual(nl.min())?(a.removeEntry(r,i.readTime),t=t.insert(r,i)):!n.isValidDocument()||i.version.compareTo(n.version)>0||0===i.version.compareTo(n.version)&&n.hasPendingWrites?(a.addEntry(i),t=t.insert(r,i)):iG(oc,"Ignoring outdated watch update for ",r,". Current version:",n.version," Watch version:",i.version)}),{qs:t,Qs:h}})).next(e=>{d=e.qs,f=e.Qs})),!i.isEqual(nl.min())){let t=r.Ti.getLastRemoteSnapshotVersion(e).next(t=>r.Ti.setTargetsMetadata(e,e.currentSequenceNumber,i));c.push(t)}return nv.waitFor(c).next(()=>u.apply(e)).next(()=>r.localDocuments.getLocalViewOfDocuments(e,d,f)).next(()=>d)}).then(e=>(r.xs=n,e)));
35t.targetChanges.forEach((t,r)=>{let i=e.Eu.get(r);i&&(iZ(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1,22616),t.addedDocuments.size>0?i.cu=!0:t.modifiedDocuments.size>0?iZ(i.cu,14607):t.removedDocuments.size>0&&(iZ(i.cu,42227),i.cu=!1))}),await lA(e,s,t)}catch(e){await ny(e)}}function lE(e,t,r){var i;if(e.isPrimaryClient&&0===r||!e.isPrimaryClient&&1===r){let r,n=[];e.hu.forEach((e,r)=>{let i=r.view.Fa(t);i.snapshot&&n.push(i.snapshot)}),(i=e.eventManager).onlineState=t,r=!1,i.queries.forEach((e,i)=>{for(let e of i.Sa)e.Fa(t)&&(r=!0)}),r&&ls(i),n.length&&e.lu.Y_(n),e.onlineState=t,e.isPrimaryClient&&e.sharedClientState.setOnlineState(t)}}async function lb(e,t,r){e.sharedClientState.updateQueryState(t,"rejected",r);let i=e.Eu.get(t),n=i&&i.key;if(n){let r=new nC(np.comparator);r=r.insert(n,ss.newNoDocument(n,nl.min()));let i=sK().add(n),s=new am(nl.min(),new Map,new nC(ni),r,i);await l_(e,s),e.Iu=e.Iu.remove(n),e.Eu.delete(t),lS(e)}else await og(e.localStore,t,!1).then(()=>lI(e,t,r)).catch(ny)}function lI(e,t,r=null){for(let i of(e.sharedClientState.removeLocalQueryTarget(t),e.Pu.get(t)))e.hu.delete(i),r&&e.lu.gu(i,r);e.Pu.delete(t),e.isPrimaryClient&&e.du.Hr(t).forEach(t=>{e.du.containsKey(t)||lT(e,t)})}function lT(e,t){e.Tu.delete(t.path.canonicalString());let r=e.Iu.get(t);null!==r&&(oz(e.remoteStore,r),e.Iu=e.Iu.remove(t),e.Eu.delete(r),lS(e))}function lC(e,t,r){for(let i of r)i instanceof lo?(e.du.addReference(i.key,t),function(e,t){let r=t.key,i=r.path.canonicalString();e.Iu.get(r)||e.Tu.has(i)||(iG(lu,"New document in limbo: "+r),e.Tu.add(i),lS(e))}(e,i)):i instanceof ll?(iG(lu,"Document no longer in limbo: "+i.key),e.du.removeReference(i.key,t),e.du.containsKey(i.key)||lT(e,i.key)):iY(19791,{pu:i})}function lS(e){for(;e.Tu.size>0&&e.Iu.size<e.maxConcurrentLimboResolutions;){let t=e.Tu.values().next().value;e.Tu.delete(t);let r=new np(nc.fromString(t)),i=e.Vu.next();e.Eu.set(i,new ld(r)),e.Iu=e.Iu.insert(r,i),o$(e.remoteStore,new a$(sD(new sk(r.path)),i,"TargetPurposeLimboResolution",n_.le))}}async function lA(e,t,r){let i=[],n=[],s=[];e.hu.isEmpty()||(e.hu.forEach((a,o)=>{s.push(e.fu(o,t,r).then(t=>{var s;if((t||r)&&e.isPrimaryClient){let i=t?!t.fromCache:null==(s=null==r?void 0:r.targetChanges.get(o.targetId))?void 0:s.current;e.sharedClientState.updateQueryState(o.targetId,i?"current":"not-current")}if(t){i.push(t);let e=ol.Rs(o.targetId,t);n.push(e)}}))}),await Promise.all(s),e.lu.Y_(i),await async function(e,t){try{await e.persistence.runTransaction("notifyLocalViewChanges","readwrite",r=>nv.forEach(t,t=>nv.forEach(t.ds,i=>e.persistence.referenceDelegate.addReference(r,t.targetId,i)).next(()=>nv.forEach(t.As,i=>e.persistence.referenceDelegate.removeReference(r,t.targetId,i)))))}catch(e){if(!nw(e))throw e;iG(oc,"Failed to update sequence numbers: "+e)}for(let r of t){let t=r.targetId;if(!r.fromCache){let r=e.xs.get(t),i=r.snapshotVersion,n=r.withLastLimboFreeSnapshotVersion(i);e.xs=e.xs.insert(t,n)}}}(e.localStore,n))}async function lk(e,t){if(!e.currentUser.isEqual(t)){iG(lu,"User change. New user:",t.toKey());let r=await of(e.localStore,t);e.currentUser=t,e.Ru.forEach(e=>{e.forEach(e=>{e.reject(new i1(i0.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.Ru.clear(),e.sharedClientState.handleUserChange(t,r.removedBatchIds,r.addedBatchIds),await lA(e,r.ks)}}function lR(e,t){let r=e.Eu.get(t);if(r&&r.cu)return sK().add(r.key);{let r=sK(),i=e.Pu.get(t);if(!i)return r;for(let t of i){let i=e.hu.get(t);r=r.unionWith(i.view.eu)}return r}}function lN(e){return e.remoteStore.remoteSyncer.applyRemoteEvent=l_.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=lR.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=lb.bind(null,e),e.lu.Y_=li.bind(null,e.eventManager),e.lu.gu=ln.bind(null,e.eventManager),e}class lO{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=oO(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Su(e),await this.persistence.start(),this.localStore=this.Du(e),this.gcScheduler
35=this.vu(e,this.localStore),this.indexBackfillerScheduler=this.Cu(e,this.localStore)}vu(e,t){return null}Cu(e,t){return null}Du(e){var t,r;return t=this.persistence,r=new ou,new od(t,r,e.initialUser,this.serializer)}Su(e){return new on(oa.fi,this.serializer)}bu(e){return new ov}async terminate(){var e,t;null==(e=this.gcScheduler)||e.stop(),null==(t=this.indexBackfillerScheduler)||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}lO.provider={build:()=>new lO};class lD extends lO{constructor(e){super(),this.cacheSizeBytes=e}vu(e,t){return iZ(this.persistence.referenceDelegate instanceof oo,46915),new a0(this.persistence.referenceDelegate.garbageCollector,e.asyncQueue,t)}Su(e){let t=void 0!==this.cacheSizeBytes?aQ.withCacheSize(this.cacheSizeBytes):aQ.DEFAULT;return new on(e=>oo.fi(e,t),this.serializer)}}class lP{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>lE(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=lk.bind(null,this.syncEngine),await o2(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new le}createDatastore(e){var t;let r=oO(e.databaseInfo.databaseId),i=new oR(e.databaseInfo);return t=e.authCredentials,new oV(t,e.appCheckCredentials,i,r)}createRemoteStore(e){var t,r;return t=this.localStore,r=this.datastore,new oj(t,r,e.asyncQueue,e=>lE(this.syncEngine,e,0),oE.C()?new oE:new ow)}createSyncEngine(e,t){var r,i,n,s,a,o;let l;return r=this.localStore,i=this.remoteStore,n=this.eventManager,s=this.sharedClientState,a=e.initialUser,o=e.maxConcurrentLimboResolutions,l=new lf(r,i,n,s,a,o),t&&(l.mu=!0),l}async terminate(){var e,t;await async function(e){iG(oF,"RemoteStore shutting down."),e.da.add(5),await oq(e),e.Ra.shutdown(),e.Va.set("Unknown")}(this.remoteStore),null==(e=this.datastore)||e.terminate(),null==(t=this.eventManager)||t.terminate()}}lP.provider={build:()=>new lP};class lx{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Mu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Mu(this.observer.error,e):iW("Uncaught Error in snapshot listener:",e.toString()))}xu(){this.muted=!0}Mu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}let lL="FirestoreClient";class lM{constructor(e,t,r,i,n){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=i,this.user=i$.UNAUTHENTICATED,this.clientId=nr.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=n,this.authCredentials.start(r,async e=>{iG(lL,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(r,e=>(iG(lL,"Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();let e=new i2;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(r){let t=o4(r,"Failed to shutdown persistence");e.reject(t)}}),e.promise}}async function lV(e,t){e.asyncQueue.verifyOperationInProgress(),iG(lL,"Initializing OfflineComponentProvider");let r=e.configuration;await t.initialize(r);let i=r.initialUser;e.setCredentialChangeListener(async e=>{i.isEqual(e)||(await of(t.localStore,e),i=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}async function lU(e,t){e.asyncQueue.verifyOperationInProgress();let r=await lF(e);iG(lL,"Initializing OnlineComponentProvider"),await t.initialize(r,e.configuration),e.setCredentialChangeListener(e=>o1(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,r)=>o1(t.remoteStore,r)),e._onlineComponents=t}async function lF(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){iG(lL,"Using user provided OfflineComponentProvider");try{await lV(e,e._uninitializedComponentsProvider._offline)}catch(t){if(!("FirebaseError"===t.name?t.code===i0.FAILED_PRECONDITION||t.code===i0.UNIMPLEMENT
35ED:!("u">typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code))throw t;iQ("Error using user provided cache. Falling back to memory cache: "+t),await lV(e,new lO)}}else iG(lL,"Using default OfflineComponentProvider"),await lV(e,new lD(void 0));return e._offlineComponents}async function lj(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(iG(lL,"Using user provided OnlineComponentProvider"),await lU(e,e._uninitializedComponentsProvider._online)):(iG(lL,"Using default OnlineComponentProvider"),await lU(e,new lP))),e._onlineComponents}async function lB(e){let t=await lj(e),r=t.eventManager;return r.onListen=lp.bind(null,t.syncEngine),r.onUnlisten=lv.bind(null,t.syncEngine),r.onFirstRemoteStoreListen=lg.bind(null,t.syncEngine),r.onLastRemoteStoreUnlisten=lw.bind(null,t.syncEngine),r}function lq(e){let t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}let l$=new Map;function lz(e){if(np.isDocumentKey(e))throw new i1(i0.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function lH(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{var t;let r=(t=e).constructor?t.constructor.name:null;return r?`a custom ${r} object`:"an object"}}return"function"==typeof e?"a function":iY(12329,{type:typeof e})}function lK(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new i1(i0.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let r=lH(e);throw new i1(i0.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${r}`)}}return e}let lG="firestore.googleapis.com";class lW{constructor(e){var t,r;if(void 0===e.host){if(void 0!==e.ssl)throw new i1(i0.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=lG,this.ssl=!0}else this.host=e.host,this.ssl=null==(t=e.ssl)||t;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=0x2800000;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new i1(i0.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,r,i){if(!0===t&&!0===i)throw new i1(i0.INVALID_ARGUMENT,`${e} and ${r} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=lq(null!=(r=e.experimentalLongPollingOptions)?r:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new i1(i0.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new i1(i0.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new i1(i0.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){var t,r;return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(t=this.experimentalLongPollingOptions,r=e.experimentalLongPollingOptions,t.timeoutSeconds===r.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}
35class lQ{constructor(e,t,r,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new lW({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new i1(i0.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new i1(i0.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new lW(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new i3;switch(e.type){case"firstParty":return new i7(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new i1(i0.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){let e;return(e=l$.get(this))&&(iG("ComponentProvider","Removing Datastore"),l$.delete(this),e.terminate()),Promise.resolve()}}class lX{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new lX(this.firestore,e,this._query)}}class lY{constructor(e,t,r){this.converter=t,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new lJ(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new lY(this.firestore,e,this._key)}}class lJ extends lX{constructor(e,t,r){super(e,t,new sk(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new lY(this.firestore,null,new np(e))}withConverter(e){return new lJ(this.firestore,e,this._path)}}let lZ="AsyncQueue";class l0{constructor(e=Promise.resolve()){this.Ju=[],this.Yu=!1,this.Zu=[],this.Xu=null,this.ec=!1,this.tc=!1,this.nc=[],this.x_=new oD(this,"async_queue_retry"),this.rc=()=>{let e=oN();e&&iG(lZ,"Visibility state changed to "+e.visibilityState),this.x_.b_()},this.sc=e;const t=oN();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.rc)}get isShuttingDown(){return this.Yu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.oc(),this._c(e)}enterRestrictedMode(e){if(!this.Yu){this.Yu=!0,this.tc=e||!1;let t=oN();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.rc)}}enqueue(e){if(this.oc(),this.Yu)return new Promise(()=>{});let t=new i2;return this._c(()=>this.Yu&&this.tc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Ju.push(e),this.ac()))}async ac(){if(0!==this.Ju.length){try{await this.Ju[0](),this.Ju.shift(),this.x_.reset()}catch(e){if(!nw(e))throw e;iG(lZ,"Operation failed with retryable error: "+e)}this.Ju.length>0&&this.x_.y_(()=>this.ac())}}_c(e){let t=this.sc.then(()=>(this.ec=!0,e().catch(e=>{throw this.Xu=e,this.ec=!1,iW("INTERNAL UNHANDLED ERROR: ",l1(e)),e}).then(e=>(this.ec=!1,e))));return this.sc=t,t}enqueueAfterDelay(e,t,r){this.oc(),this.nc.indexOf(e)>-1&&(t=0);let i=o3.createAndSchedule(this,e,t,r,e=>this.uc(e));return this.Zu.push(i),i}oc(){this.Xu&&iY(47125,{cc:l1(this.Xu)})}verifyOperationInProgress(){}async lc(){let e;do e=this.sc,await e;while(e!==this.sc)}hc(e){for(let t of this.Zu)if(t.timerId===e)return!0;return!1}Pc(e){return this.lc().then(()=>{for(let t of(this.Zu.sort((e,t)=>
35e.targetTimeMs-t.targetTimeMs),this.Zu))if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.lc()})}Tc(e){this.nc.push(e)}uc(e){let t=this.Zu.indexOf(e);this.Zu.splice(t,1)}}function l1(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+` 36`+e.stack),t}function l2(e){if("object"!=typeof e||null===e)return!1;for(let t of["next","error","complete"])if(t in e&&"function"==typeof e[t])return!0;return!1}class l6 extends lQ{constructor(e,t,r,i){super(e,t,r,i),this.type="firestore",this._queue=new l0,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new l0(e),this._firestoreClient=void 0,await e}}}class l3{constructor(e){this._byteString=e}static fromBase64String(e){try{return new l3(nD.fromBase64String(e))}catch(e){throw new i1(i0.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new l3(nD.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}class l4{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new i1(i0.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new nf(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class l5{constructor(e){this._methodName=e}}class l8{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new i1(i0.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new i1(i0.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return ni(this._lat,e._lat)||ni(this._long,e._long)}}class l7{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}(this._values,e._values)}}let l9=/^__.*__$/;function he(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw iY(40011,{Ic:e})}}class ht{constructor(e,t,r,i,n,s){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=i,void 0===n&&this.Ec(),this.fieldTransforms=n||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ic(){return this.settings.Ic}dc(e){return new ht(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Ac(e){var t;let r=null==(t=this.path)?void 0:t.child(e),i=this.dc({path:r,Rc:!1});return i.Vc(e),i}mc(e){var t;let r=null==(t=this.path)?void 0:t.child(e),i=this.dc({path:r,Rc:!1});return i.Ec(),i}fc(e){return this.dc({path:void 0,Rc:!0})}gc(e){return hs(e,this.settings.methodName,this.settings.yc||!1,this.path,this.settings.wc)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}Ec(){if(this.path)for(let e=0;e<this.path.length;e++)this.Vc(this.path.get(e))}Vc(e){if(0===e.length)throw this.gc("Document fields must not be empty");if(he(this.Ic)&&l9.test(e))throw this.gc('Document fields cannot begin and end with "__"')}}class hr{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||oO(e)}bc(e,t,r,i=!1){return new ht({Ic:e,methodName:t,wc:r,path:nf.emptyPath(),Rc:!1,yc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function hi(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof no||e instanceof l8||e instanceof l3||e instanceof lY||e instanceof l5||e instanceof l7)}let hn=RegExp("[~\\*/\\[\\]]");function hs(e,t,r,i,n){let s=i&&!i.isEmpty(),a=void 0!==n,o=`Function ${t}
36() called with invalid data`;r&&(o+=" (via `toFirestore()`)"),o+=". ";let l="";return(s||a)&&(l+=" (found",s&&(l+=` in field ${i}`),a&&(l+=` in document ${n}`),l+=")"),new i1(i0.INVALID_ARGUMENT,o+e+l)}class ha{constructor(e,t,r,i,n){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=i,this._converter=n}get id(){return this._key.path.lastSegment()}get ref(){return new lY(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){let e=new ho(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){let t=this._document.data.field(hl("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class ho extends ha{data(){return super.data()}}function hl(e,t){return"string"==typeof t?function(e,t,r){if(t.search(hn)>=0)throw hs(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,void 0);try{return new l4(...t.split("."))._internalPath}catch(r){throw hs(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,void 0)}}(e,t):t instanceof l4?t._internalPath:t._delegate._internalPath}class hh{}class hu extends hh{}class hc extends hu{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new hc(e,t,r)}_apply(e){let t=this._parse(e);return hg(e._query,t),new lX(e.firestore,e.converter,sP(e._query,t))}_parse(e){var t;let r,i,n=(r=(t=e.firestore)._freezeSettings(),i=oO(t._databaseId),new hr(t._databaseId,!!r.ignoreUndefinedProperties,i));return function(e,t,r,i,n,s,a){let o;if(n.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new i1(i0.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){hp(a,s);let t=[];for(let r of a)t.push(hf(i,e,r));o={arrayValue:{values:t}}}else o=hf(i,e,a)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||hp(a,s),o=function(e,t,r,i=!1){return function e(t,r){if(hi(t=ee(t))){var i,n;let s;return function(e,t,r){if(!hi(r)||"object"!=typeof r||null===r||Object.getPrototypeOf(r)!==Object.prototype&&null!==Object.getPrototypeOf(r)){let i=lH(r);throw"an object"===i?t.gc(e+" a custom object"):t.gc(e+" "+i)}}("Unsupported field value:",r,t),i=t,n=r,s={},nT(i)?n.path&&n.path.length>0&&n.fieldMask.push(n.path):nI(i,(t,r)=>{let i=e(r,n.Ac(t));null!=i&&(s[t]=i)}),{mapValue:{fields:s}}}if(t instanceof l5)return function(e,t){if(!he(t.Ic))throw t.gc(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.gc(`${e._methodName}() is not currently supported inside arrays`);let r=e._toFieldTransform(t);r&&t.fieldTransforms.push(r)}(t,r),null;if(void 0===t&&r.ignoreUndefinedProperties)return null;if(r.path&&r.fieldMask.push(r.path),t instanceof Array){if(r.settings.Rc&&4!==r.Ic)throw r.gc("Nested arrays are not supported");let i=[],n=0;for(let s of t){let t=e(s,r.fc(n));null==t&&(t={nullValue:"NULL_VALUE"}),i.push(t),n++}return{arrayValue:{values:i}}}return function(e,t){var r,i,n;if(null===(e=ee(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return r=t.serializer,"number"==typeof(n=i=e)&&Number.isInteger(n)&&!nE(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER?sQ(i):sW(r,i);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){let r=no.fromDate(e);return{timestampValue:aN(t.serializer,r)}}if(e instanceof no){let r=new no(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:aN(t.serializer,r)}}if(e instanceof l8)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof l3)return{bytesValue:aO(t.serializer,e._byteString)};if(e instanceof lY){let r=t.databaseId,i=e.firestore._databaseId;if(!i.isEqual(r))throw t.gc(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${r.projectId}/${r.database}`);return{referenceValue:aP(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof l7)return{mapValue:{fields:{[nG]:{stringValue:nX},[nY]:{arrayValue:{values:e.toArray().map(e=>{if("number"!=typeof e)throw t.gc("VectorValues must only contain numeric values.");return sW(t.serializer,e)})}}}}};throw t.gc(`Unsupported field value: ${lH(e)}`)}(t,r)}(r,e.bc(i?4:3,t))}(r,t,a,"in"===s||"not-in"===s);return sc.create(n,s,o)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}class hd extends hh{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new hd(e,t)}_parse(e){let t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:sd.create(t,this._getOperator())}_apply(e){let t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let r=e;for(let e of t.getFlattenedFilters())hg(r,e),r=sP(r,e)}(e._query,t),new lX(e.firestore,e.converter,sP(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}
36function hf(e,t,r){if("string"==typeof(r=ee(r))){if(""===r)throw new i1(i0.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!sN(t)&&-1!==r.indexOf("/"))throw new i1(i0.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);let i=t.path.child(nc.fromString(r));if(!np.isDocumentKey(i))throw new i1(i0.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${i}' is not because it has an odd number of segments (${i.length}).`);return n4(e,new np(i))}if(r instanceof lY)return n4(e,r._key);throw new i1(i0.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${lH(r)}.`)}function hp(e,t){if(!Array.isArray(e)||0===e.length)throw new i1(i0.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function hg(e,t){let r=function(e,t){for(let r of e)for(let e of r.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==r)throw r===t.op?new i1(i0.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new i1(i0.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${r.toString()}' filters.`)}class hm{convertValue(e,t="none"){switch(nJ(e)){case 0:return null;case 1:return e.booleanValue;case 2:return nL(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(nM(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw iY(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let r={};return nI(e,(e,i)=>{r[e]=this.convertValue(i,t)}),r}convertVectorValue(e){var t,r,i;return new l7(null==(i=null==(r=null==(t=e.fields)?void 0:t[nY].arrayValue)?void 0:r.values)?void 0:i.map(e=>nL(e.doubleValue)))}convertGeoPoint(e){return new l8(nL(e.latitude),nL(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":let r=nq(e);return null==r?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(n$(e));default:return null}}convertTimestamp(e){let t=nx(e);return new no(t.seconds,t.nanos)}convertDocumentKey(e,t){let r=nc.fromString(e);iZ(aq(r),9688,{name:e});let i=new nK(r.get(1),r.get(3)),n=new np(r.popFirst(5));return i.isEqual(t)||iW(`Document ${n} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),n}}class hy{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class hv extends ha{constructor(e,t,r,i,n,s){super(e,t,r,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=n}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new hw(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){let r=this._document.data.field(hl("DocumentSnapshot.get",e));if(null!==r)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class hw extends hv{data(e={}){return super.data(e)}}
36class h_{constructor(e,t,r,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new hy(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){let e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(r=>{e.call(t,new hw(this._firestore,this._userDataWriter,r.key,r,new hy(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new i1(i0.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(r=>{let i=new hw(e._firestore,e._userDataWriter,r.doc.key,r.doc,new hy(e._snapshot.mutatedKeys.has(r.doc.key),e._snapshot.fromCache),e.query.converter);return r.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}})}{let r=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{let i=new hw(e._firestore,e._userDataWriter,t.doc.key,t.doc,new hy(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),n=-1,s=-1;return 0!==t.type&&(n=r.indexOf(t.doc.key),r=r.delete(t.doc.key)),1!==t.type&&(s=(r=r.add(t.doc)).indexOf(t.doc.key)),{type:function(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return iY(61501,{type:e})}}(t.type),doc:i,oldIndex:n,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}class hE extends hm{constructor(e){super(),this.firestore=e}convertBytes(e){return new l3(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new lY(this.firestore,null,t)}}new WeakMap,function(e=!0){iz=eU,eP(new et("firestore",(t,{instanceIdentifier:r,options:i})=>{let n=t.getProvider("app").getImmediate(),s=new l6(new i5(t.getProvider("auth-internal")),new ne(n,t.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new i1(i0.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new nK(e.options.projectId,t)}(n,r),n);return i=Object.assign({useFetchStreams:e},i),s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),eB(iB,iq,void 0),eB(iB,iq,"esm2017")}();var hb=r(8618),hI=r(81466);let hT=e=>{let t=e?.code;return t?.startsWith("auth/")&&"auth/network-request-failed"!==t?"error":"debug"};class hC extends I.Component{async connectFirebase(e,t=!1){var r;let i,n=eF({apiKey:this.props.firebase.GOOGLE_GCP_FIREBASE_APIKEY,authDomain:`${this.props.firebase.FIREBASE_PROJECT}.firebaseapp.com`,databaseURL:`https://${this.props.firebase.FIREBASE_PROJECT}.firebaseio.com`,projectId:this.props.firebase.FIREBASE_PROJECT,storageBucket:`${this.props.firebase.FIREBASE_PROJECT}.appspot.com`,messagingSenderId:this.props.firebase.GOOGLE_GCP_FIREBASE_SENDERID,appId:this.props.firebase.GOOGLE_GCP_FIREBASE_APPID}),s=function(e=ej()){let t=ex(e,"auth");if(t.isInitialized())return t.getImmediate();let r=function(e,t){let r=ex(e,"auth");if(r.isInitialized()){let e=r.getImmediate();if(G(r.getOptions(),null!=t?t:{}))return e;e6(e,"already-initialized")}return r.initialize({options:t})}(e,{popupRedirectResolver:iN,persistence:[r1,rU,rF]}),i=M("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){let e=new URL(i,location.origin);if(location.origin===e.origin){let t,i=(t=e.toString(),async e=>{let r=e&&await e.getIdTokenResult(),i=r&&(new Date().getTime()-Date.parse(r.issuedAtTime))/1e3;if(i&&i>ix)return;let n=null==r?void 0:r.token;iL!==n&&(iL=n,await fetch(t,{method:n?"POST":"DELETE",headers:n?{Authorization:`Bearer ${n}`}:{}}))});ee(r).beforeAuthStateChanged(i,()=>i(r.currentUser)),ee(r).onIdTokenChanged(e=>i(e),void 0,void 0)}}let n=x("auth");return n&&function(e,t,r){let i=ee(e);e7(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");let n=rr(t),{host:s,port:a}=function(e){let t=rr(e),r=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!r)return{host:"",port:null};let i=r[2].split("@").pop()||"",n=/^(\[[^\]]+\])(:|$)/.exec(i);if(n){let e=n[1];return{host:e,port:ri(i.substr(e.length+1))}}{let[e,t]=i.split(":");return{host:e,port:ri(t)}}}(t),o=null===a?"":`:${a}`,l={url:`${n}//${s}${o}/`},h=Object.freeze({host:s,port:a,protocol:n.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!i._canInitEmulator){e7(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),e7(G(l,i.config.emulator)&&G(h,i.emulatorConfig),i,"emulator-config-failed");return}i.config.emulator=l,i.emulatorConfig=h,i.settings.appVerificationDisabledForTesting=!0,U(s)?(F(`${n}//${s}${o}
36`),q("Auth",!0)):function(){function e(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"u">typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),"u">typeof window&&"u">typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}(r,`http://${n}`),r}(n),a=s.currentUser;if(!a||a.uid!==e){try{await rx(s,this.props.firebaseToken)}catch(r){this.errorHandling(r,"FirebaseComponent: firebase sign in error",{userId:e,isAnonymous:t})}!function(e,...t){var r,i,n,s;let a,o,l,h,u;e=ee(e);let c={includeMetadataChanges:!1,source:"default"},d=0;"object"!=typeof t[0]||l2(t[d])||(c=t[d],d++);let f={includeMetadataChanges:c.includeMetadataChanges,source:c.source};if(l2(t[d])){let e=t[d];t[d]=null==(r=e.next)?void 0:r.bind(e),t[d+1]=null==(i=e.error)?void 0:i.bind(e),t[d+2]=null==(n=e.complete)?void 0:n.bind(e)}if(e instanceof lY)o=lK(e.firestore,l6),l=new sk(e._key.path),a={next:r=>{var i,n,s;let a,l;t[d]&&t[d]((i=o,n=e,a=(s=r).docs.get(n._key),l=new hE(i),new hv(i,l,n._key,a,new hy(s.hasPendingWrites,s.fromCache),n.converter)))},error:t[d+1],complete:t[d+2]};else{let r=lK(e,lX);o=lK(r.firestore,l6),l=r._query;let i=new hE(o);a={next:e=>{t[d]&&t[d](new h_(o,i,r,e))},error:t[d+1],complete:t[d+2]},function(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new i1(i0.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}(e._query)}s=function(e){if(e._terminated)throw new i1(i0.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,r,i,n,s,a;let o,l=e._freezeSettings(),h=(n=e._databaseId,s=(null==(t=e._app)?void 0:t.options.appId)||"",new nz(n,s,e._persistenceKey,l.host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,lq(l.experimentalLongPollingOptions),l.useFetchStreams,l.isUsingEmulator));e._componentsProvider||(null==(r=l.localCache)?void 0:r._offlineComponentProvider)&&(null==(i=l.localCache)?void 0:i._onlineComponentProvider)&&(e._componentsProvider={_offline:l.localCache._offlineComponentProvider,_online:l.localCache._onlineComponentProvider}),e._firestoreClient=new lM(e._authCredentials,e._appCheckCredentials,e._queue,h,e._componentsProvider&&(o=null==(a=e._componentsProvider)?void 0:a._online.build(),{_offline:null==a?void 0:a._offline.build(o),_online:o}))}(e),e._firestoreClient}(o),u=new la(l,h=new lx(a),f),s.asyncQueue.enqueueAndForget(async()=>lr(await lB(s),u))}(function(e,t,...r){let i=[];for(let n of(t instanceof hh&&i.push(t),function(e){let t=e.filter(e=>e instanceof hd).length,r=e.filter(e=>e instanceof hc).length;if(t>1||t>0&&r>0)throw new i1(i0.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(i=i.concat(r)),i))e=n._apply(e);return e}(function(e,t,...r){if(e=ee(e),function(e,t,r){if(!r)throw new i1(i0.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}("collection","path",t),e instanceof lQ){let i=nc.fromString(t,...r);return lz(i),new lJ(e,null,i)}{if(!(e instanceof lY||e instanceof lJ))throw new i1(i0.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let i=e._path.child(nc.fromString(t,...r));return lz(i),new lJ(e.firestore,null,i)}}(function(e,t){let r=ex("object"==typeof e?e:ej(),"firestore").getImmediate({identifier:"string"==typeof e?e:nH});if(!r._initialized){let e=(e=>{let t=x(e);if(!t)return;let r=t.lastIndexOf(":");if(r<=0||r+1===t.length)throw Error(`Invalid host ${t} with no separate hostname and port!`);let i=parseInt(t.substring(r+1),10);return"["===t[0]?[t.substring(1,r-1),i]:[t.substring(0,r),i]})("firestore");e&&function(e,t,r,i={}){var n;e=lK(e,lQ);
36let s=U(t),a=e._getSettings(),o=Object.assign(Object.assign({},a),{emulatorOptions:e._getEmulatorOptions()}),l=`${t}:${r}`;s&&(F(`https://${l}`),q("Firestore",!0)),a.host!==lG&&a.host!==l&&iQ("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let h=Object.assign(Object.assign({},a),{host:l,ssl:s,emulatorOptions:i});if(!G(h,o)&&(e._setSettings(h),i.mockUserToken)){let t,r;if("string"==typeof i.mockUserToken)t=i.mockUserToken,r=i$.MOCK_USER;else{t=function(e,t){if(e.uid)throw Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let r=t||"demo-project",i=e.iat||0,n=e.sub||e.user_id;if(!n)throw Error("mockUserToken must contain 'sub' or 'user_id' field!");let s=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:n,user_id:n,firebase:{sign_in_provider:"custom",identities:{}}},e);return[O(JSON.stringify({alg:"none",type:"JWT"})),O(JSON.stringify(s)),""].join(".")}(i.mockUserToken,null==(n=e._app)?void 0:n.options.projectId);let s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new i1(i0.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");r=new i$(s)}e._authCredentials=new i4(new i6(t,r))}}(r,...e)}return r}(n),"notifications",e,"events"),(r=new Date(Date.now()),i=hl("where","created"),hc._create(i,">",r))),e=>
36{e.docChanges().forEach(e=>{this.state[e.doc.id]||(this.props.trigger((0,C.ys)(e.doc.data())),this.setState(t=>({...t,[e.doc.id]:e.doc.id})))})},r=>this.errorHandling(r,"FirebaseComponent: error connecting to firebase ",{userId:e,isAnonymous:t}))}}async authFirebase(){if(!this.props.oidc.isLoadingUser){var e;let t;if(!this.props.firebaseToken)return;let r=this.props.sac_cookie?(0,hI.a)(this.props.sac_cookie,"Firebase.component.tsx"):null,i=(t=(e={sub:this.props.oidc?.user?.profile?.sub,sacSub:r?.sub,anonymousSub:this.props.anonymous_sub}).sub??e.sacSub??e.anonymousSub)?t.replace(/^(auth0\||azuread\|)/,""):void 0;i&&await this.connectFirebase(i)}}componentDidMount(){this.authFirebase()}componentDidUpdate(e){this.props.firebaseToken&&e.firebaseToken!==this.props.firebaseToken&&this.authFirebase()}render(){return null}constructor(e){super(e),function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"errorHandling",(e,t,r)=>"debug"===hT(e)?hb.logger.debug(t,r):hb.logger.error(t,e,r)),this.state={}}}let hS=(0,T.$j)(e=>({oidc:e.oidc,firebaseToken:e.sessions.firebase_token,anonymous_sub:e.cookieJar.anonymous_sub,sac_cookie:e.cookieJar.sac,firebase:e.settings.firebase}),e=>({trigger:t=>e(t)}))(hC)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.